feat: Refactor Emulator to Accept ROM Parameter and Enhance Logging

- Updated Emulator::Run method to accept a Rom* parameter, improving flexibility in ROM handling.
- Refactored texture creation and ROM data initialization to utilize the new parameter.
- Enhanced logging in Snes class to provide detailed information during initialization, reset, and frame processing, aiding in debugging and performance monitoring.
- Introduced cycle tracking in Apu and Spc700 classes for accurate synchronization and debugging.
- Added unit tests for APU DSP functionality and IPL ROM handshake to ensure reliability and correctness of audio processing.
This commit is contained in:
scawful
2025-10-06 11:41:33 -04:00
parent e58bc3f007
commit a881c0f8e1
16 changed files with 922 additions and 79 deletions

View File

@@ -46,9 +46,9 @@ using ImGui::Separator;
using ImGui::TableNextColumn;
using ImGui::Text;
void Emulator::Run() {
void Emulator::Run(Rom* rom) {
static bool loaded = false;
if (!snes_.running() && rom()->is_loaded()) {
if (!snes_.running() && rom->is_loaded()) {
ppu_texture_ = SDL_CreateTexture(core::Renderer::Get().renderer(),
SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STREAMING, 512, 480);
@@ -56,7 +56,7 @@ void Emulator::Run() {
printf("Failed to create texture: %s\n", SDL_GetError());
return;
}
rom_data_ = rom()->vector();
rom_data_ = rom->vector();
snes_.Init(rom_data_);
wanted_frames_ = 1.0 / (snes_.memory().pal_timing() ? 50.0 : 60.0);
wanted_samples_ = 48000 / (snes_.memory().pal_timing() ? 50 : 60);