diff --git a/source/quickerNES/core/emu.hpp b/source/quickerNES/core/emu.hpp index eb79718..c248cbc 100644 --- a/source/quickerNES/core/emu.hpp +++ b/source/quickerNES/core/emu.hpp @@ -191,12 +191,12 @@ class Emu // Access to emulated memory, for viewer/cheater/debugger // CHR - uint8_t const *chr_mem(); + uint8_t *chr_mem() const; long chr_size() const; void write_chr(void const *, long count, long offset); // Nametable - uint8_t *nametable_mem() { return emu.ppu.impl->nt_ram; } + uint8_t *nametable_mem() const { return emu.ppu.impl->nt_ram; } long nametable_size() const { return 0x1000; } // Built-in 2K memory @@ -213,11 +213,12 @@ class Emu { high_mem_size = 0x2000 }; - uint8_t *high_mem() { return emu.impl->sram; } + uint8_t *high_mem() const { return emu.impl->sram; } + size_t get_high_mem_size() const { return high_mem_size; } // Sprite memory - uint8_t *spr_mem() { return emu.ppu.getSpriteRAM(); } - uint16_t spr_mem_size() { return emu.ppu.getSpriteRAMSize(); } + uint8_t *spr_mem() const { return emu.ppu.getSpriteRAM(); } + uint16_t spr_mem_size() const { return emu.ppu.getSpriteRAMSize(); } // End of public interface public: @@ -277,7 +278,7 @@ inline void Emu::set_pixels(void *p, long n) emu.ppu.host_row_bytes = n; } -inline uint8_t const *Emu::chr_mem() +inline uint8_t *Emu::chr_mem() const { return cart()->chr_size() ? (uint8_t *)cart()->chr() : emu.ppu.impl->chr_ram; } diff --git a/source/quickerNES/core/ppu/ppuImpl.hpp b/source/quickerNES/core/ppu/ppuImpl.hpp index 0b8bb82..ef555a9 100644 --- a/source/quickerNES/core/ppu/ppuImpl.hpp +++ b/source/quickerNES/core/ppu/ppuImpl.hpp @@ -91,8 +91,8 @@ class Ppu_Impl : public ppu_state_t static const uint16_t scanline_len = 341; - uint8_t *getSpriteRAM() { return spr_ram; } - uint16_t getSpriteRAMSize() { return spr_ram_size; } + uint8_t *getSpriteRAM() const { return (uint8_t*)spr_ram; } + uint16_t getSpriteRAMSize() const { return spr_ram_size; } uint8_t spr_ram[spr_ram_size]; void all_tiles_modified(); diff --git a/source/quickerNES/nesInstance.hpp b/source/quickerNES/nesInstance.hpp index 4b1e618..0b316a6 100644 --- a/source/quickerNES/nesInstance.hpp +++ b/source/quickerNES/nesInstance.hpp @@ -12,6 +12,18 @@ class NESInstance final : public NESInstanceBase uint8_t *getLowMem() const override { return _nes.get_low_mem(); }; size_t getLowMemSize() const override { return _nes.get_low_mem_size(); }; + uint8_t *getWorkMem() const { return _nes.high_mem(); }; + size_t getWorkMemSize() const { return _nes.get_high_mem_size(); }; + + uint8_t *getNametableMem() const { return _nes.nametable_mem(); }; + size_t getNametableMemSize() const { return _nes.nametable_size(); }; + + uint8_t *getSpriteMem() const { return _nes.spr_mem(); }; + size_t getSpriteMemSize() const { return _nes.spr_mem_size(); }; + + uint8_t *getCHRMem() const { return _nes.chr_mem(); }; + size_t getCHRMemSize() const { return _nes.chr_size(); }; + void serializeState(uint8_t *state) const override { _nes.serializeState(state); } void deserializeState(const uint8_t *state) override { _nes.deserializeState(state); } size_t getStateSize() const override { return _nes.getStateSize(); }