yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::emu::Emulator Class Reference

A class for emulating and debugging SNES games. More...

#include <emulator.h>

Classes

struct  Bookmark
 
struct  EmulatorMetrics
 

Public Member Functions

 Emulator ()=default
 
 ~Emulator ()
 
void Initialize (gfx::IRenderer *renderer, const std::vector< uint8_t > &rom_data)
 
void Run (Rom *rom)
 
void Cleanup ()
 
bool & show_cpu_debugger ()
 
bool & show_memory_viewer ()
 
bool & show_ppu_viewer ()
 
bool & show_audio_mixer ()
 
auto snes () -> Snes &
 
auto running () const -> bool
 
void set_running (bool running)
 
audio::IAudioBackendaudio_backend ()
 
void set_audio_buffer (int16_t *audio_buffer)
 
auto set_audio_device_id (SDL_AudioDeviceID audio_device)
 
auto wanted_samples () const -> int
 
void set_renderer (gfx::IRenderer *renderer)
 
gfx::IRendererrenderer ()
 
void * ppu_texture ()
 
bool is_turbo_mode () const
 
void set_turbo_mode (bool turbo)
 
BreakpointManagerbreakpoint_manager ()
 
debug::DisassemblyViewerdisassembly_viewer ()
 
input::InputManagerinput_manager ()
 
bool is_debugging () const
 
void set_debugging (bool debugging)
 
bool is_initialized () const
 
bool is_snes_initialized () const
 
bool IsEmulatorReady () const
 
double GetCurrentFPS () const
 
uint64_t GetCurrentCycle ()
 
uint16_t GetCPUPC ()
 
uint8_t GetCPUB ()
 
void StepSingleInstruction ()
 
void SetBreakpoint (uint32_t address)
 
void ClearAllBreakpoints ()
 
std::vector< uint32_t > GetBreakpoints ()
 
EmulatorMetrics GetMetrics ()
 

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< Bookmarkbookmarks
 
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::IAudioBackendaudio_backend_
 
Snes snes_
 
bool initialized_ = false
 
bool snes_initialized_ = false
 
bool debugging_ = false
 
gfx::IRendererrenderer_ = 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_
 

Detailed Description

A class for emulating and debugging SNES games.

Definition at line 33 of file emulator.h.

Constructor & Destructor Documentation

◆ Emulator()

yaze::emu::Emulator::Emulator ( )
default

◆ ~Emulator()

yaze::emu::Emulator::~Emulator ( )

Definition at line 27 of file emulator.cc.

References running_.

Member Function Documentation

◆ Initialize()

◆ Run()

◆ Cleanup()

void yaze::emu::Emulator::Cleanup ( )

Definition at line 33 of file emulator.cc.

References ppu_texture_, running_, and snes_initialized_.

◆ show_cpu_debugger()

bool & yaze::emu::Emulator::show_cpu_debugger ( )
inline

Definition at line 42 of file emulator.h.

References show_cpu_debugger_.

◆ show_memory_viewer()

bool & yaze::emu::Emulator::show_memory_viewer ( )
inline

Definition at line 43 of file emulator.h.

References show_memory_viewer_.

◆ show_ppu_viewer()

bool & yaze::emu::Emulator::show_ppu_viewer ( )
inline

Definition at line 44 of file emulator.h.

References show_ppu_viewer_.

◆ show_audio_mixer()

bool & yaze::emu::Emulator::show_audio_mixer ( )
inline

Definition at line 45 of file emulator.h.

References show_audio_mixer_.

◆ snes()

◆ running()

auto yaze::emu::Emulator::running ( ) const -> bool
inline

Definition at line 48 of file emulator.h.

References running_.

Referenced by yaze::emu::ui::RenderNavBar(), and set_running().

◆ set_running()

void yaze::emu::Emulator::set_running ( bool  running)
inline

◆ audio_backend()

◆ set_audio_buffer()

void yaze::emu::Emulator::set_audio_buffer ( int16_t *  audio_buffer)
inline

Definition at line 53 of file emulator.h.

References audio_buffer_.

◆ set_audio_device_id()

auto yaze::emu::Emulator::set_audio_device_id ( SDL_AudioDeviceID  audio_device)
inline

Definition at line 54 of file emulator.h.

References audio_device_.

◆ wanted_samples()

auto yaze::emu::Emulator::wanted_samples ( ) const -> int
inline

Definition at line 57 of file emulator.h.

References wanted_samples_.

◆ set_renderer()

void yaze::emu::Emulator::set_renderer ( gfx::IRenderer renderer)
inline

Definition at line 58 of file emulator.h.

References renderer(), and renderer_.

Referenced by yaze::editor::EditorManager::LoadAssets().

Here is the call graph for this function:

◆ renderer()

gfx::IRenderer * yaze::emu::Emulator::renderer ( )
inline

Definition at line 61 of file emulator.h.

References renderer_.

Referenced by Initialize(), yaze::emu::ui::RenderNavBar(), and set_renderer().

◆ ppu_texture()

void * yaze::emu::Emulator::ppu_texture ( )
inline

Definition at line 62 of file emulator.h.

References ppu_texture_.

Referenced by yaze::emu::ui::RenderSnesPpu().

◆ is_turbo_mode()

bool yaze::emu::Emulator::is_turbo_mode ( ) const
inline

Definition at line 65 of file emulator.h.

References turbo_mode_.

Referenced by yaze::emu::ui::RenderNavBar().

◆ set_turbo_mode()

void yaze::emu::Emulator::set_turbo_mode ( bool  turbo)
inline

Definition at line 66 of file emulator.h.

References turbo_mode_.

Referenced by yaze::emu::ui::RenderNavBar().

◆ breakpoint_manager()

BreakpointManager & yaze::emu::Emulator::breakpoint_manager ( )
inline

Definition at line 69 of file emulator.h.

References breakpoint_manager_.

◆ disassembly_viewer()

debug::DisassemblyViewer & yaze::emu::Emulator::disassembly_viewer ( )
inline

Definition at line 70 of file emulator.h.

References disassembly_viewer_.

Referenced by yaze::emu::ui::RenderCpuInstructionLog().

◆ input_manager()

◆ is_debugging()

bool yaze::emu::Emulator::is_debugging ( ) const
inline

Definition at line 72 of file emulator.h.

References debugging_.

Referenced by yaze::emu::ui::RenderNavBar().

◆ set_debugging()

void yaze::emu::Emulator::set_debugging ( bool  debugging)
inline

Definition at line 73 of file emulator.h.

References debugging_.

Referenced by yaze::emu::ui::RenderNavBar().

◆ is_initialized()

bool yaze::emu::Emulator::is_initialized ( ) const
inline

Definition at line 74 of file emulator.h.

References initialized_.

◆ is_snes_initialized()

◆ IsEmulatorReady()

bool yaze::emu::Emulator::IsEmulatorReady ( ) const
inline

Definition at line 78 of file emulator.h.

References rom_data_, yaze::emu::Snes::running(), and snes_.

Referenced by yaze::emu::ui::RenderAIAgentPanel().

Here is the call graph for this function:

◆ GetCurrentFPS()

double yaze::emu::Emulator::GetCurrentFPS ( ) const
inline

Definition at line 79 of file emulator.h.

References current_fps_.

Referenced by yaze::emu::ui::RenderNavBar().

◆ GetCurrentCycle()

uint64_t yaze::emu::Emulator::GetCurrentCycle ( )
inline

Definition at line 80 of file emulator.h.

References yaze::emu::Snes::mutable_cycles(), and snes_.

Here is the call graph for this function:

◆ GetCPUPC()

uint16_t yaze::emu::Emulator::GetCPUPC ( )
inline

Definition at line 81 of file emulator.h.

References yaze::emu::Snes::cpu(), and snes_.

Here is the call graph for this function:

◆ GetCPUB()

uint8_t yaze::emu::Emulator::GetCPUB ( )
inline

Definition at line 82 of file emulator.h.

References yaze::emu::Snes::cpu(), and snes_.

Here is the call graph for this function:

◆ StepSingleInstruction()

void yaze::emu::Emulator::StepSingleInstruction ( )
inline

Definition at line 83 of file emulator.h.

References yaze::emu::Snes::cpu(), and snes_.

Here is the call graph for this function:

◆ SetBreakpoint()

void yaze::emu::Emulator::SetBreakpoint ( uint32_t  address)
inline

Definition at line 84 of file emulator.h.

References yaze::emu::Snes::cpu(), and snes_.

Referenced by yaze::emu::ui::RenderModernCpuDebugger().

Here is the call graph for this function:

◆ ClearAllBreakpoints()

void yaze::emu::Emulator::ClearAllBreakpoints ( )
inline

Definition at line 85 of file emulator.h.

References yaze::emu::Snes::cpu(), and snes_.

Referenced by yaze::emu::ui::RenderModernCpuDebugger().

Here is the call graph for this function:

◆ GetBreakpoints()

std::vector< uint32_t > yaze::emu::Emulator::GetBreakpoints ( )
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().

Here is the call graph for this function:

◆ GetMetrics()

EmulatorMetrics yaze::emu::Emulator::GetMetrics ( )
inline

◆ RenderNavBar()

void yaze::emu::Emulator::RenderNavBar ( )
private

Definition at line 502 of file emulator.cc.

References yaze::emu::ui::RenderNavBar().

Referenced by Run().

Here is the call graph for this function:

◆ RenderEmulatorInterface()

◆ RenderSnesPpu()

void yaze::emu::Emulator::RenderSnesPpu ( )
private

Definition at line 497 of file emulator.cc.

References yaze::emu::ui::RenderSnesPpu().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderBreakpointList()

void yaze::emu::Emulator::RenderBreakpointList ( )
private

Definition at line 511 of file emulator.cc.

References yaze::emu::ui::RenderBreakpointList().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderMemoryViewer()

void yaze::emu::Emulator::RenderMemoryViewer ( )
private

Definition at line 516 of file emulator.cc.

References yaze::emu::ui::RenderMemoryViewer().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderModernCpuDebugger()

◆ RenderPerformanceMonitor()

void yaze::emu::Emulator::RenderPerformanceMonitor ( )
private

Definition at line 737 of file emulator.cc.

References yaze::emu::ui::RenderPerformanceMonitor().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderAIAgentPanel()

void yaze::emu::Emulator::RenderAIAgentPanel ( )
private

Definition at line 742 of file emulator.cc.

References yaze::emu::ui::RenderAIAgentPanel().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderSaveStates()

void yaze::emu::Emulator::RenderSaveStates ( )
private
Todo:
Create ui::RenderSaveStates() when save state system is implemented

Definition at line 753 of file emulator.cc.

References yaze::gui::ThemeManager::Get(), and ICON_MD_SAVE.

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderKeyboardConfig()

void yaze::emu::Emulator::RenderKeyboardConfig ( )
private

Definition at line 763 of file emulator.cc.

References input_manager_, and yaze::emu::ui::RenderKeyboardConfig().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderApuDebugger()

void yaze::emu::Emulator::RenderApuDebugger ( )
private

Definition at line 768 of file emulator.cc.

References yaze::emu::ui::RenderApuDebugger().

Referenced by RenderEmulatorInterface().

Here is the call graph for this function:

◆ RenderCpuInstructionLog()

void yaze::emu::Emulator::RenderCpuInstructionLog ( const std::vector< InstructionEntry > &  instructionLog)
private

Definition at line 747 of file emulator.cc.

References yaze::emu::ui::RenderCpuInstructionLog().

Here is the call graph for this function:

Member Data Documentation

◆ bookmarks

std::vector<Bookmark> yaze::emu::Emulator::bookmarks
private

Definition at line 126 of file emulator.h.

◆ step_

bool yaze::emu::Emulator::step_ = true
private

Definition at line 131 of file emulator.h.

◆ power_

bool yaze::emu::Emulator::power_ = false
private

Definition at line 132 of file emulator.h.

◆ loading_

bool yaze::emu::Emulator::loading_ = false
private

Definition at line 133 of file emulator.h.

◆ running_

bool yaze::emu::Emulator::running_ = false
private

◆ turbo_mode_

bool yaze::emu::Emulator::turbo_mode_ = false
private

Definition at line 135 of file emulator.h.

Referenced by is_turbo_mode(), Run(), and set_turbo_mode().

◆ wanted_frames_

float yaze::emu::Emulator::wanted_frames_
private

Definition at line 137 of file emulator.h.

Referenced by Run().

◆ wanted_samples_

int yaze::emu::Emulator::wanted_samples_
private

Definition at line 138 of file emulator.h.

Referenced by GetMetrics(), Run(), and wanted_samples().

◆ manual_pb_

uint8_t yaze::emu::Emulator::manual_pb_ = 0
private

Definition at line 140 of file emulator.h.

◆ manual_pc_

uint16_t yaze::emu::Emulator::manual_pc_ = 0
private

Definition at line 141 of file emulator.h.

◆ count_frequency

uint64_t yaze::emu::Emulator::count_frequency
private

Definition at line 144 of file emulator.h.

Referenced by Run().

◆ last_count

uint64_t yaze::emu::Emulator::last_count
private

Definition at line 145 of file emulator.h.

Referenced by Run().

◆ time_adder

double yaze::emu::Emulator::time_adder = 0.0
private

Definition at line 146 of file emulator.h.

Referenced by Run().

◆ frame_count_

int yaze::emu::Emulator::frame_count_ = 0
private

Definition at line 149 of file emulator.h.

Referenced by Run().

◆ fps_timer_

double yaze::emu::Emulator::fps_timer_ = 0.0
private

Definition at line 150 of file emulator.h.

Referenced by Run().

◆ current_fps_

double yaze::emu::Emulator::current_fps_ = 0.0
private

Definition at line 151 of file emulator.h.

Referenced by GetCurrentFPS(), GetMetrics(), and Run().

◆ audio_buffer_

int16_t* yaze::emu::Emulator::audio_buffer_
private

Definition at line 153 of file emulator.h.

Referenced by Run(), and set_audio_buffer().

◆ audio_device_

SDL_AudioDeviceID yaze::emu::Emulator::audio_device_
private

Definition at line 154 of file emulator.h.

Referenced by GetMetrics(), and set_audio_device_id().

◆ audio_backend_

std::unique_ptr<audio::IAudioBackend> yaze::emu::Emulator::audio_backend_
private

Definition at line 157 of file emulator.h.

Referenced by audio_backend(), Initialize(), and Run().

◆ snes_

◆ initialized_

bool yaze::emu::Emulator::initialized_ = false
private

Definition at line 160 of file emulator.h.

Referenced by Initialize(), and is_initialized().

◆ snes_initialized_

bool yaze::emu::Emulator::snes_initialized_ = false
private

Definition at line 161 of file emulator.h.

Referenced by Cleanup(), Initialize(), is_snes_initialized(), and Run().

◆ debugging_

bool yaze::emu::Emulator::debugging_ = false
private

Definition at line 162 of file emulator.h.

Referenced by is_debugging(), and set_debugging().

◆ renderer_

gfx::IRenderer* yaze::emu::Emulator::renderer_ = nullptr
private

Definition at line 163 of file emulator.h.

Referenced by Initialize(), renderer(), Run(), and set_renderer().

◆ ppu_texture_

void* yaze::emu::Emulator::ppu_texture_ = nullptr
private

Definition at line 164 of file emulator.h.

Referenced by Cleanup(), ppu_texture(), and Run().

◆ show_cpu_debugger_

bool yaze::emu::Emulator::show_cpu_debugger_ = false
private

Definition at line 167 of file emulator.h.

Referenced by Initialize(), RenderEmulatorInterface(), and show_cpu_debugger().

◆ show_memory_viewer_

bool yaze::emu::Emulator::show_memory_viewer_ = false
private

Definition at line 168 of file emulator.h.

Referenced by Initialize(), RenderEmulatorInterface(), and show_memory_viewer().

◆ show_ppu_viewer_

bool yaze::emu::Emulator::show_ppu_viewer_ = false
private

Definition at line 169 of file emulator.h.

Referenced by Initialize(), and show_ppu_viewer().

◆ show_audio_mixer_

bool yaze::emu::Emulator::show_audio_mixer_ = false
private

Definition at line 170 of file emulator.h.

Referenced by Initialize(), and show_audio_mixer().

◆ breakpoint_manager_

BreakpointManager yaze::emu::Emulator::breakpoint_manager_
private

Definition at line 173 of file emulator.h.

Referenced by breakpoint_manager(), Initialize(), and RenderModernCpuDebugger().

◆ disassembly_viewer_

debug::DisassemblyViewer yaze::emu::Emulator::disassembly_viewer_
private

Definition at line 174 of file emulator.h.

Referenced by disassembly_viewer(), and Initialize().

◆ rom_data_

std::vector<uint8_t> yaze::emu::Emulator::rom_data_
private

Definition at line 176 of file emulator.h.

Referenced by Initialize(), IsEmulatorReady(), and Run().

◆ input_manager_

input::InputManager yaze::emu::Emulator::input_manager_
private

Definition at line 179 of file emulator.h.

Referenced by input_manager(), RenderKeyboardConfig(), and Run().


The documentation for this class was generated from the following files: