A class for emulating and debugging SNES games. More...
#include <emulator.h>
Classes | |
struct | Bookmark |
struct | EmulatorMetrics |
Private Member Functions | |
void | RenderNavBar () |
void | RenderEmulatorInterface () |
void | RenderSnesPpu () |
void | RenderBreakpointList () |
void | RenderMemoryViewer () |
void | RenderModernCpuDebugger () |
void | RenderPerformanceMonitor () |
void | RenderAIAgentPanel () |
void | RenderSaveStates () |
void | RenderKeyboardConfig () |
void | RenderApuDebugger () |
void | RenderCpuInstructionLog (const std::vector< InstructionEntry > &instructionLog) |
Private Attributes | |
std::vector< Bookmark > | bookmarks |
bool | step_ = true |
bool | power_ = false |
bool | loading_ = false |
bool | running_ = false |
bool | turbo_mode_ = false |
float | wanted_frames_ |
int | wanted_samples_ |
uint8_t | manual_pb_ = 0 |
uint16_t | manual_pc_ = 0 |
uint64_t | count_frequency |
uint64_t | last_count |
double | time_adder = 0.0 |
int | frame_count_ = 0 |
double | fps_timer_ = 0.0 |
double | current_fps_ = 0.0 |
int16_t * | audio_buffer_ |
SDL_AudioDeviceID | audio_device_ |
std::unique_ptr< audio::IAudioBackend > | audio_backend_ |
Snes | snes_ |
bool | initialized_ = false |
bool | snes_initialized_ = false |
bool | debugging_ = false |
gfx::IRenderer * | renderer_ = nullptr |
void * | ppu_texture_ = nullptr |
bool | show_cpu_debugger_ = false |
bool | show_memory_viewer_ = false |
bool | show_ppu_viewer_ = false |
bool | show_audio_mixer_ = false |
BreakpointManager | breakpoint_manager_ |
debug::DisassemblyViewer | disassembly_viewer_ |
std::vector< uint8_t > | rom_data_ |
input::InputManager | input_manager_ |
A class for emulating and debugging SNES games.
Definition at line 33 of file emulator.h.
|
default |
yaze::emu::Emulator::~Emulator | ( | ) |
Definition at line 27 of file emulator.cc.
References running_.
void yaze::emu::Emulator::Initialize | ( | gfx::IRenderer * | renderer, |
const std::vector< uint8_t > & | rom_data | ||
) |
Definition at line 47 of file emulator.cc.
References audio_backend_, breakpoint_manager_, yaze::emu::audio::AudioConfig::buffer_frames, yaze::emu::audio::AudioConfig::channels, yaze::emu::Snes::cpu(), yaze::emu::BreakpointManager::CPU_65816, yaze::emu::audio::AudioBackendFactory::Create(), disassembly_viewer_, yaze::emu::audio::AudioConfig::format, yaze::gui::EditorCardManager::Get(), ICON_MD_AUDIO_FILE, ICON_MD_BUG_REPORT, ICON_MD_GRID_VIEW, ICON_MD_MEMORY, initialized_, yaze::emu::audio::INT16, LOG_ERROR, LOG_INFO, yaze::emu::debug::DisassemblyViewer::RecordInstruction(), renderer(), renderer_, rom_data_, running_, yaze::emu::audio::AudioConfig::sample_rate, yaze::emu::audio::AudioBackendFactory::SDL2, yaze::emu::BreakpointManager::ShouldBreakOnExecute(), show_audio_mixer_, show_cpu_debugger_, show_memory_viewer_, show_ppu_viewer_, snes_, and snes_initialized_.
Referenced by yaze::emu::ui::RenderNavBar().
void yaze::emu::Emulator::Run | ( | Rom * | rom | ) |
Definition at line 134 of file emulator.cc.
References yaze::emu::Snes::apu(), audio_backend_, audio_buffer_, yaze::emu::input::InputManager::backend(), yaze::emu::audio::AudioConfig::buffer_frames, yaze::emu::audio::AudioConfig::channels, count_frequency, yaze::emu::audio::AudioBackendFactory::Create(), yaze::gfx::IRenderer::CreateTextureWithFormat(), current_fps_, yaze::emu::audio::AudioConfig::format, fps_timer_, frame_count_, yaze::core::g_window_is_resizing, yaze::emu::input::IInputBackend::GetBackendName(), yaze::emu::Snes::Init(), yaze::emu::input::InputManager::Initialize(), input_manager_, yaze::emu::audio::INT16, yaze::Rom::is_loaded(), yaze::emu::input::InputManager::IsInitialized(), last_count, yaze::gfx::IRenderer::LockTexture(), LOG_ERROR, LOG_INFO, LOG_WARN, yaze::emu::Snes::memory(), yaze::emu::input::InputManager::Poll(), ppu_texture_, RenderEmulatorInterface(), renderer_, RenderNavBar(), rom_data_, yaze::emu::Snes::RunFrame(), running_, yaze::emu::audio::AudioConfig::sample_rate, yaze::emu::audio::AudioBackendFactory::SDL2, yaze::emu::input::InputBackendFactory::SDL2, yaze::emu::Snes::SetPixels(), yaze::emu::Snes::SetSamples(), snes_, snes_initialized_, time_adder, turbo_mode_, yaze::gfx::IRenderer::UnlockTexture(), yaze::Rom::vector(), wanted_frames_, and wanted_samples_.
Referenced by yaze::editor::EditorManager::DrawMenuBar().
void yaze::emu::Emulator::Cleanup | ( | ) |
Definition at line 33 of file emulator.cc.
References ppu_texture_, running_, and snes_initialized_.
|
inline |
Definition at line 42 of file emulator.h.
References show_cpu_debugger_.
|
inline |
Definition at line 43 of file emulator.h.
References show_memory_viewer_.
|
inline |
Definition at line 44 of file emulator.h.
References show_ppu_viewer_.
|
inline |
Definition at line 45 of file emulator.h.
References show_audio_mixer_.
|
inline |
Definition at line 47 of file emulator.h.
References snes_.
Referenced by yaze::agent::EmulatorServiceImpl::GetGameState(), yaze::editor::MusicEditor::PlaySong(), yaze::agent::EmulatorServiceImpl::ReadMemory(), yaze::emu::ui::RenderApuDebugger(), yaze::emu::ui::RenderBreakpointList(), yaze::emu::ui::RenderMemoryViewer(), yaze::emu::ui::RenderModernCpuDebugger(), yaze::emu::ui::RenderNavBar(), yaze::emu::ui::RenderPerformanceMonitor(), yaze::agent::EmulatorServiceImpl::Reset(), yaze::editor::MusicEditor::StopSong(), and yaze::agent::EmulatorServiceImpl::WriteMemory().
|
inline |
Definition at line 48 of file emulator.h.
References running_.
Referenced by yaze::emu::ui::RenderNavBar(), and set_running().
|
inline |
Definition at line 49 of file emulator.h.
References running(), and running_.
Referenced by yaze::agent::EmulatorServiceImpl::Pause(), yaze::emu::ui::RenderModernCpuDebugger(), yaze::emu::ui::RenderNavBar(), yaze::agent::EmulatorServiceImpl::Resume(), yaze::agent::EmulatorServiceImpl::Start(), and yaze::agent::EmulatorServiceImpl::Stop().
|
inline |
Definition at line 52 of file emulator.h.
References audio_backend_.
Referenced by yaze::editor::MusicEditor::PlaySong(), yaze::emu::ui::RenderNavBar(), yaze::emu::ui::RenderPerformanceMonitor(), yaze::editor::MusicEditor::SetVolume(), and yaze::editor::MusicEditor::StopSong().
|
inline |
Definition at line 53 of file emulator.h.
References audio_buffer_.
|
inline |
Definition at line 54 of file emulator.h.
References audio_device_.
|
inline |
Definition at line 57 of file emulator.h.
References wanted_samples_.
|
inline |
Definition at line 58 of file emulator.h.
References renderer(), and renderer_.
Referenced by yaze::editor::EditorManager::LoadAssets().
|
inline |
Definition at line 61 of file emulator.h.
References renderer_.
Referenced by Initialize(), yaze::emu::ui::RenderNavBar(), and set_renderer().
|
inline |
Definition at line 62 of file emulator.h.
References ppu_texture_.
Referenced by yaze::emu::ui::RenderSnesPpu().
|
inline |
Definition at line 65 of file emulator.h.
References turbo_mode_.
Referenced by yaze::emu::ui::RenderNavBar().
|
inline |
Definition at line 66 of file emulator.h.
References turbo_mode_.
Referenced by yaze::emu::ui::RenderNavBar().
|
inline |
Definition at line 69 of file emulator.h.
References breakpoint_manager_.
|
inline |
Definition at line 70 of file emulator.h.
References disassembly_viewer_.
Referenced by yaze::emu::ui::RenderCpuInstructionLog().
|
inline |
Definition at line 71 of file emulator.h.
References input_manager_.
Referenced by yaze::agent::EmulatorServiceImpl::HoldButtons(), yaze::agent::EmulatorServiceImpl::PressButtons(), and yaze::agent::EmulatorServiceImpl::ReleaseButtons().
|
inline |
Definition at line 72 of file emulator.h.
References debugging_.
Referenced by yaze::emu::ui::RenderNavBar().
|
inline |
Definition at line 73 of file emulator.h.
References debugging_.
Referenced by yaze::emu::ui::RenderNavBar().
|
inline |
Definition at line 74 of file emulator.h.
References initialized_.
|
inline |
Definition at line 75 of file emulator.h.
References snes_initialized_.
Referenced by yaze::agent::EmulatorServiceImpl::GetGameState(), yaze::agent::EmulatorServiceImpl::ReadMemory(), yaze::emu::ui::RenderSnesPpu(), and yaze::agent::EmulatorServiceImpl::WriteMemory().
|
inline |
Definition at line 78 of file emulator.h.
References rom_data_, yaze::emu::Snes::running(), and snes_.
Referenced by yaze::emu::ui::RenderAIAgentPanel().
|
inline |
Definition at line 79 of file emulator.h.
References current_fps_.
Referenced by yaze::emu::ui::RenderNavBar().
|
inline |
Definition at line 80 of file emulator.h.
References yaze::emu::Snes::mutable_cycles(), and snes_.
|
inline |
Definition at line 81 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
|
inline |
Definition at line 82 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
|
inline |
Definition at line 83 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
|
inline |
Definition at line 84 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
Referenced by yaze::emu::ui::RenderModernCpuDebugger().
|
inline |
Definition at line 85 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
Referenced by yaze::emu::ui::RenderModernCpuDebugger().
|
inline |
Definition at line 86 of file emulator.h.
References yaze::emu::Snes::cpu(), and snes_.
Referenced by yaze::emu::ui::RenderBreakpointList(), and yaze::emu::ui::RenderModernCpuDebugger().
|
inline |
Definition at line 97 of file emulator.h.
References audio_device_, yaze::emu::Snes::cpu(), current_fps_, yaze::emu::Emulator::EmulatorMetrics::fps, yaze::emu::Snes::mutable_cycles(), running_, snes_, and wanted_samples_.
Referenced by yaze::emu::ui::RenderAIAgentPanel(), and yaze::emu::ui::RenderPerformanceMonitor().
|
private |
Definition at line 502 of file emulator.cc.
References yaze::emu::ui::RenderNavBar().
Referenced by Run().
|
private |
Definition at line 347 of file emulator.cc.
References yaze::gui::EditorCard::Begin(), yaze::gui::EditorCard::Bottom, yaze::gui::EditorCard::End(), yaze::gui::EditorCard::Floating, yaze::gui::ThemeManager::Get(), ICON_MD_BUG_REPORT, ICON_MD_DATA_ARRAY, ICON_MD_KEYBOARD, ICON_MD_MEMORY, ICON_MD_MUSIC_NOTE, ICON_MD_SAVE, ICON_MD_SMART_TOY, ICON_MD_SPEED, ICON_MD_VIDEOGAME_ASSET, RenderAIAgentPanel(), RenderApuDebugger(), RenderBreakpointList(), RenderKeyboardConfig(), RenderMemoryViewer(), RenderModernCpuDebugger(), RenderPerformanceMonitor(), RenderSaveStates(), RenderSnesPpu(), yaze::gui::EditorCard::Right, yaze::gui::EditorCard::SetDefaultSize(), yaze::gui::EditorCard::SetPosition(), show_cpu_debugger_, and show_memory_viewer_.
Referenced by Run().
|
private |
Definition at line 497 of file emulator.cc.
References yaze::emu::ui::RenderSnesPpu().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 511 of file emulator.cc.
References yaze::emu::ui::RenderBreakpointList().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 516 of file emulator.cc.
References yaze::emu::ui::RenderMemoryViewer().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 521 of file emulator.cc.
References yaze::emu::BreakpointManager::AddBreakpoint(), yaze::emu::Snes::apu(), breakpoint_manager_, yaze::emu::Snes::cpu(), yaze::emu::BreakpointManager::CPU_65816, yaze::emu::BreakpointManager::EXECUTE, yaze::gui::ThemeManager::Get(), yaze::emu::BreakpointManager::GetAllBreakpoints(), ICON_MD_ADD, ICON_MD_BUG_REPORT, ICON_MD_DELETE, ICON_MD_PAUSE, ICON_MD_PLAY_ARROW, ICON_MD_REFRESH, ICON_MD_SKIP_NEXT, yaze::emu::Snes::memory(), yaze::emu::Snes::mutable_cycles(), yaze::emu::BreakpointManager::RemoveBreakpoint(), yaze::emu::Snes::Reset(), running_, yaze::emu::BreakpointManager::SetEnabled(), and snes_.
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 737 of file emulator.cc.
References yaze::emu::ui::RenderPerformanceMonitor().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 742 of file emulator.cc.
References yaze::emu::ui::RenderAIAgentPanel().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 753 of file emulator.cc.
References yaze::gui::ThemeManager::Get(), and ICON_MD_SAVE.
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 763 of file emulator.cc.
References input_manager_, and yaze::emu::ui::RenderKeyboardConfig().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 768 of file emulator.cc.
References yaze::emu::ui::RenderApuDebugger().
Referenced by RenderEmulatorInterface().
|
private |
Definition at line 747 of file emulator.cc.
References yaze::emu::ui::RenderCpuInstructionLog().
|
private |
Definition at line 126 of file emulator.h.
|
private |
Definition at line 131 of file emulator.h.
|
private |
Definition at line 132 of file emulator.h.
|
private |
Definition at line 133 of file emulator.h.
|
private |
Definition at line 134 of file emulator.h.
Referenced by Cleanup(), GetMetrics(), Initialize(), RenderModernCpuDebugger(), Run(), running(), set_running(), and ~Emulator().
|
private |
Definition at line 135 of file emulator.h.
Referenced by is_turbo_mode(), Run(), and set_turbo_mode().
|
private |
Definition at line 137 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 138 of file emulator.h.
Referenced by GetMetrics(), Run(), and wanted_samples().
|
private |
Definition at line 140 of file emulator.h.
|
private |
Definition at line 141 of file emulator.h.
|
private |
Definition at line 144 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 145 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 146 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 149 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 150 of file emulator.h.
Referenced by Run().
|
private |
Definition at line 151 of file emulator.h.
Referenced by GetCurrentFPS(), GetMetrics(), and Run().
|
private |
Definition at line 153 of file emulator.h.
Referenced by Run(), and set_audio_buffer().
|
private |
Definition at line 154 of file emulator.h.
Referenced by GetMetrics(), and set_audio_device_id().
|
private |
Definition at line 157 of file emulator.h.
Referenced by audio_backend(), Initialize(), and Run().
|
private |
Definition at line 159 of file emulator.h.
Referenced by ClearAllBreakpoints(), GetBreakpoints(), GetCPUB(), GetCPUPC(), GetCurrentCycle(), GetMetrics(), Initialize(), IsEmulatorReady(), RenderModernCpuDebugger(), Run(), SetBreakpoint(), snes(), and StepSingleInstruction().
|
private |
Definition at line 160 of file emulator.h.
Referenced by Initialize(), and is_initialized().
|
private |
Definition at line 161 of file emulator.h.
Referenced by Cleanup(), Initialize(), is_snes_initialized(), and Run().
|
private |
Definition at line 162 of file emulator.h.
Referenced by is_debugging(), and set_debugging().
|
private |
Definition at line 163 of file emulator.h.
Referenced by Initialize(), renderer(), Run(), and set_renderer().
|
private |
Definition at line 164 of file emulator.h.
Referenced by Cleanup(), ppu_texture(), and Run().
|
private |
Definition at line 167 of file emulator.h.
Referenced by Initialize(), RenderEmulatorInterface(), and show_cpu_debugger().
|
private |
Definition at line 168 of file emulator.h.
Referenced by Initialize(), RenderEmulatorInterface(), and show_memory_viewer().
|
private |
Definition at line 169 of file emulator.h.
Referenced by Initialize(), and show_ppu_viewer().
|
private |
Definition at line 170 of file emulator.h.
Referenced by Initialize(), and show_audio_mixer().
|
private |
Definition at line 173 of file emulator.h.
Referenced by breakpoint_manager(), Initialize(), and RenderModernCpuDebugger().
|
private |
Definition at line 174 of file emulator.h.
Referenced by disassembly_viewer(), and Initialize().
|
private |
Definition at line 176 of file emulator.h.
Referenced by Initialize(), IsEmulatorReady(), and Run().
|
private |
Definition at line 179 of file emulator.h.
Referenced by input_manager(), RenderKeyboardConfig(), and Run().