diff --git a/source/nesInstanceBase.hpp b/source/nesInstanceBase.hpp index acbfbd2..6af4c72 100644 --- a/source/nesInstanceBase.hpp +++ b/source/nesInstanceBase.hpp @@ -106,6 +106,7 @@ class NESInstanceBase virtual void doHardReset() = 0; virtual std::string getCoreName() const = 0; virtual void *getInternalEmulatorPointer() = 0; + virtual void setNTABBlockSize(const size_t size) { }; protected: diff --git a/source/quickerNES/core/core.hpp b/source/quickerNES/core/core.hpp index be08a69..b83770f 100644 --- a/source/quickerNES/core/core.hpp +++ b/source/quickerNES/core/core.hpp @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "ppu/ppu.hpp" #include #include +#include #include #include @@ -84,6 +85,8 @@ class Core : private Cpu public: + size_t _NTABBlockSize = 0x1000; + // Flags for lite state storage bool TIMEBlockEnabled = true; bool CPURBlockEnabled = true; @@ -237,9 +240,7 @@ class Core : private Cpu // NTAB Block if (NTABBlockEnabled == true) { - size_t nametable_size = 0x1000; - - const auto inputDataSize = nametable_size; + const auto inputDataSize = _NTABBlockSize; const auto inputData = (uint8_t *)ppu.impl->nt_ram; serializer.push(inputData, inputDataSize); } @@ -360,10 +361,8 @@ class Core : private Cpu // NTAB Block if (NTABBlockEnabled == true) { - size_t nametable_size = 0x1000; - const auto outputData = (uint8_t*) ppu.impl->nt_ram; - const auto inputDataSize = nametable_size; + const auto inputDataSize = _NTABBlockSize; deserializer.pop(outputData, inputDataSize); } @@ -394,6 +393,8 @@ class Core : private Cpu if (sram_present) enable_sram(true); } +void setNTABBlockSize(const size_t size) { _NTABBlockSize = size; } + void enableStateBlock(const std::string& block) { bool recognizedBlock = false; diff --git a/source/quickerNES/core/emu.hpp b/source/quickerNES/core/emu.hpp index f77c287..58bd8db 100644 --- a/source/quickerNES/core/emu.hpp +++ b/source/quickerNES/core/emu.hpp @@ -50,6 +50,7 @@ class Emu // Save emulator state variants void serializeState(jaffarCommon::serializer::Base& serializer) const { emu.serializeState(serializer); } void deserializeState(jaffarCommon::deserializer::Base& deserializer) { emu.deserializeState(deserializer); } + void setNTABBlockSize(const size_t size) { emu.setNTABBlockSize(size); } void enableStateBlock(const std::string& block) { emu.enableStateBlock(block); }; void disableStateBlock(const std::string& block) { emu.disableStateBlock(block); }; diff --git a/source/quickerNES/nesInstance.hpp b/source/quickerNES/nesInstance.hpp index 580c29f..32270a5 100644 --- a/source/quickerNES/nesInstance.hpp +++ b/source/quickerNES/nesInstance.hpp @@ -48,6 +48,8 @@ class NESInstance final : public NESInstanceBase return serializer.getOutputSize(); } + void setNTABBlockSize(const size_t size) override { _nes.setNTABBlockSize(size); } + protected: bool loadROMImpl(const uint8_t* romData, const size_t romSize) override