From c906da46a04468b815255684acb4ac560d6b510b Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 19 Apr 2024 17:54:26 -0400 Subject: [PATCH] Consolidate SNES::Init --- src/app/emu/snes.cc | 8 ++++++++ src/app/emu/snes.h | 10 ---------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/app/emu/snes.cc b/src/app/emu/snes.cc index 95e767db..fadf4d65 100644 --- a/src/app/emu/snes.cc +++ b/src/app/emu/snes.cc @@ -107,6 +107,14 @@ RomInfo SNES::ReadRomHeader(uint32_t offset) { } void SNES::Init(Rom& rom) { + // Setup observers for the memory space + memory_.AddObserver(&apu_); + memory_.AddObserver(&ppu_); + + // Load the ROM into memory and set up the memory mapping + rom_data = rom.vector(); + memory_.Initialize(rom_data); + // Perform a long jump into a FastROM bank (if the ROM speed is FastROM) // Disable the emulation flag (switch to 65816 native mode) cpu_.E = 0; diff --git a/src/app/emu/snes.h b/src/app/emu/snes.h index c69e1504..655b2220 100644 --- a/src/app/emu/snes.h +++ b/src/app/emu/snes.h @@ -68,16 +68,6 @@ class SNES : public DirectMemoryAccess { return static_cast(cpu_mode_); } - void SetupMemory(Rom& rom) { - // Setup observers for the memory space - memory_.AddObserver(&apu_); - memory_.AddObserver(&ppu_); - - // Load the ROM into memory and set up the memory mapping - rom_data = rom.vector(); - memory_.Initialize(rom_data); - } - private: void WriteToRegister(uint16_t address, uint8_t value) { memory_.WriteByte(address, value);