Allowing defining NTAB size

This commit is contained in:
SergioMartin86 2024-07-13 14:09:11 +02:00
parent 7b4ff9786a
commit 998a01febc
4 changed files with 11 additions and 6 deletions

View File

@ -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:

View File

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "ppu/ppu.hpp"
#include <cstdio>
#include <string>
#include <cstdint>
#include <jaffarCommon/serializers/base.hpp>
#include <jaffarCommon/deserializers/base.hpp>
@ -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;

View File

@ -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); };

View File

@ -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