-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
4,442 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ | ||
|
||
#define GUI_EMU_IMPORT | ||
#include "emu.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ | ||
|
||
#ifndef EMU_H | ||
#define EMU_H | ||
|
||
#include "../../../src/geargrafx.h" | ||
|
||
#ifdef EMU_IMPORT | ||
#define EXTERN | ||
#else | ||
#define EXTERN extern | ||
#endif | ||
|
||
EXTERN u8* emu_frame_buffer; | ||
// EXTERN u8* emu_debug_background_buffer; | ||
// EXTERN u8* emu_debug_tile_buffer; | ||
// EXTERN u8* emu_debug_sprite_buffers[64]; | ||
|
||
EXTERN bool emu_audio_sync; | ||
// EXTERN bool emu_debug_disable_breakpoints_cpu; | ||
// EXTERN bool emu_debug_disable_breakpoints_mem; | ||
// EXTERN int emu_debug_tile_palette; | ||
EXTERN bool emu_savefiles_dir_option; | ||
EXTERN bool emu_savestates_dir_option; | ||
EXTERN char emu_savefiles_path[4096]; | ||
EXTERN char emu_savestates_path[4096]; | ||
|
||
EXTERN void emu_init(void); | ||
EXTERN void emu_destroy(void); | ||
EXTERN void emu_update(void); | ||
EXTERN void emu_load_rom(const char* file_path, Cartridge::ForceConfiguration config); | ||
EXTERN void emu_key_pressed(GC_Controllers controller, GC_Keys key); | ||
EXTERN void emu_key_released(GC_Controllers controller, GC_Keys key); | ||
EXTERN void emu_pause(void); | ||
EXTERN void emu_resume(void); | ||
EXTERN bool emu_is_paused(void); | ||
EXTERN bool emu_is_empty(void); | ||
EXTERN void emu_reset(Cartridge::ForceConfiguration config); | ||
EXTERN void emu_audio_mute(bool mute); | ||
EXTERN void emu_audio_reset(void); | ||
EXTERN bool emu_is_audio_enabled(void); | ||
EXTERN void emu_save_ram(const char* file_path); | ||
EXTERN void emu_load_ram(const char* file_path, Cartridge::ForceConfiguration config); | ||
EXTERN void emu_save_state_slot(int index); | ||
EXTERN void emu_load_state_slot(int index); | ||
EXTERN void emu_save_state_file(const char* file_path); | ||
EXTERN void emu_load_state_file(const char* file_path); | ||
EXTERN void emu_get_runtime(GC_RuntimeInfo& runtime); | ||
EXTERN void emu_get_info(char* info); | ||
EXTERN GearcolecoCore* emu_get_core(void); | ||
// EXTERN void emu_debug_step(void); | ||
// EXTERN void emu_debug_continue(void); | ||
// EXTERN void emu_debug_next_frame(void); | ||
EXTERN void emu_video_no_sprite_limit(bool enabled); | ||
EXTERN void emu_set_overscan(int overscan); | ||
EXTERN void emu_save_screenshot(const char* file_path); | ||
|
||
#undef EMU_IMPORT | ||
#undef EXTERN | ||
#endif /* EMU_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ | ||
|
||
#include <istream> | ||
#include <ostream> | ||
#include "audio.h" | ||
|
||
Audio::Audio() | ||
{ | ||
m_elapsed_cycles = 0; | ||
m_sample_rate = 44100; | ||
m_mute = false; | ||
} | ||
|
||
Audio::~Audio() | ||
{ | ||
} | ||
|
||
void Audio::Init() | ||
{ | ||
|
||
} | ||
|
||
void Audio::Reset() | ||
{ | ||
m_elapsed_cycles = 0; | ||
} | ||
|
||
void Audio::Mute(bool mute) | ||
{ | ||
m_mute = mute; | ||
} | ||
|
||
void Audio::EndFrame(s16* sample_buffer, int* sample_count) | ||
{ | ||
*sample_count = 0; | ||
m_elapsed_cycles = 0; | ||
} | ||
|
||
// void Audio::SaveState(std::ostream& stream) | ||
// { | ||
// stream.write(reinterpret_cast<const char*> (&m_elapsed_cycles), sizeof(m_ElapsedCycles)); | ||
// } | ||
|
||
// void Audio::LoadState(std::istream& stream) | ||
// { | ||
// stream.read(reinterpret_cast<char*> (&m_elapsed_cycles), sizeof(m_ElapsedCycles)); | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ | ||
|
||
#include "types.h" | ||
|
||
class Audio | ||
{ | ||
public: | ||
Audio(); | ||
~Audio(); | ||
void Init(); | ||
void Reset(); | ||
void Mute(bool mute); | ||
void Tick(unsigned int clock_cycles); | ||
void EndFrame(s16* sample_buffer, int* sample_count); | ||
// void SaveState(std::ostream& stream); | ||
// void LoadState(std::istream& stream); | ||
|
||
private: | ||
u64 m_elapsed_cycles; | ||
int m_sample_rate; | ||
bool m_mute; | ||
}; | ||
|
||
inline void Audio::Tick(unsigned int clock_cycles) | ||
{ | ||
m_elapsed_cycles += clock_cycles; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Geargrafx - PC Engine / TurboGrafx Emulator | ||
* Copyright (C) 2024 Ignacio Sanchez | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/ | ||
* | ||
*/ | ||
|
||
class Cartridge | ||
{ | ||
public: | ||
Cartridge(); | ||
~Cartridge(); | ||
void Init(); | ||
void Reset(); | ||
u32 GetCRC(); | ||
bool IsReady(); | ||
int GetROMSize(); | ||
int GetROMBankCount(); | ||
const char* GetFilePath(); | ||
const char* GetFileName(); | ||
u8* GetROM(); | ||
bool LoadFromFile(const char* path); | ||
bool LoadFromBuffer(const u8* buffer, int size); | ||
|
||
private: | ||
bool LoadFromZipFile(const u8* buffer, int size); | ||
|
||
private: | ||
u8* m_pROM; | ||
int m_iROMSize; | ||
bool m_bReady; | ||
char m_szFilePath[512]; | ||
char m_szFileName[512]; | ||
int m_iROMBankCount; | ||
u32 m_iCRC; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.