change how snes firmware chips survive loadstating, so that loadstate/rewind matches performance from builds earlier in 2014. still kind of slow, but basically OK.

This commit is contained in:
zeromus 2014-09-02 05:01:51 +00:00
parent 98087fe9ea
commit 5d754cf507
10 changed files with 38 additions and 14 deletions

View File

@ -981,7 +981,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.SNES
if (data.Length != size) if (data.Length != size)
throw new Exception("Libsnes internal savestate size mismatch!"); throw new Exception("Libsnes internal savestate size mismatch!");
api.CMD_init(); api.CMD_init();
LoadCurrent(); //need to make sure chip roms are reloaded //zero 01-sep-2014 - this approach isn't being used anymore, it's too slow!
//LoadCurrent(); //need to make sure chip roms are reloaded
fixed (byte* pbuf = &data[0]) fixed (byte* pbuf = &data[0])
api.CMD_unserialize(new IntPtr(pbuf), size); api.CMD_unserialize(new IntPtr(pbuf), size);
} }

View File

@ -3,6 +3,11 @@
#define ARMDSP_CPP #define ARMDSP_CPP
namespace SNES { namespace SNES {
//zero 01-sep-2014 - dont clobber these when reconstructing!
uint8 *ArmDSP::firmware;
uint8 *ArmDSP::programROM;
uint8 *ArmDSP::dataROM;
static bool trace = 0; static bool trace = 0;
#include "opcodes.cpp" #include "opcodes.cpp"

View File

@ -1,9 +1,12 @@
//ARMv3 (ARM6) //ARMv3 (ARM6)
struct ArmDSP : public Coprocessor { struct ArmDSP : public Coprocessor {
uint8 *firmware;
uint8 *programROM; //zero 01-sep-2014 - dont clobber these when reconstructing!
uint8 *dataROM; static uint8 *firmware;
static uint8 *programROM;
static uint8 *dataROM;
uint8 *programRAM; uint8 *programRAM;
#include "registers.hpp" #include "registers.hpp"

View File

@ -9,6 +9,10 @@ namespace SNES {
#include "serialization.cpp" #include "serialization.cpp"
HitachiDSP hitachidsp; HitachiDSP hitachidsp;
//zero 01-sep-2014 - dont clobber these when reconstructing!
unsigned HitachiDSP::frequency;
uint24 HitachiDSP::dataROM[1024];
void HitachiDSP::Enter() { hitachidsp.enter(); } void HitachiDSP::Enter() { hitachidsp.enter(); }
void HitachiDSP::enter() { void HitachiDSP::enter() {

View File

@ -2,9 +2,11 @@
class HitachiDSP : public Coprocessor { class HitachiDSP : public Coprocessor {
public: public:
unsigned frequency;
//uint16 programROM[2][256]; //zero 01-sep-2014 - dont clobber these when reconstructing!
uint24 dataROM[1024]; static unsigned frequency;
static uint24 dataROM[1024];
uint8 dataRAM[3072]; uint8 dataRAM[3072];
uint24 stack[8]; uint24 stack[8];
uint16 opcode; uint16 opcode;

View File

@ -8,6 +8,13 @@ namespace SNES {
#include "serialization.cpp" #include "serialization.cpp"
NECDSP necdsp; NECDSP necdsp;
//zero 01-sep-2014 - dont clobber these when reconstructing!
unsigned NECDSP::frequency;
uint24 NECDSP::programROM[16384];
uint16 NECDSP::dataROM[2048];
unsigned NECDSP::programROMSize;
unsigned NECDSP::dataROMSize;
void NECDSP::Enter() { necdsp.enter(); } void NECDSP::Enter() { necdsp.enter(); }
void NECDSP::enter() { void NECDSP::enter() {

View File

@ -4,17 +4,18 @@
class NECDSP : public Coprocessor { class NECDSP : public Coprocessor {
public: public:
enum class Revision : unsigned { uPD7725, uPD96050 } revision; enum class Revision : unsigned { uPD7725, uPD96050 } revision;
unsigned frequency;
#include "registers.hpp" #include "registers.hpp"
uint24 programROM[16384]; //zero 01-sep-2014 - dont clobber these when reconstructing!
uint16 dataROM[2048]; static unsigned frequency;
uint16 dataRAM[2048]; static uint24 programROM[16384];
static uint16 dataROM[2048];
static unsigned programROMSize;
static unsigned dataROMSize;
unsigned programROMSize;
unsigned dataROMSize;
unsigned dataRAMSize; unsigned dataRAMSize;
uint16 dataRAM[2048];
static void Enter(); static void Enter();
void enter(); void enter();

View File

@ -222,8 +222,9 @@ void snes_init(void) {
//force everything to get initialized, even though it probably already is //force everything to get initialized, even though it probably already is
SNES::interface(); SNES::interface();
//zero 01-sep-2014 - this is too slow. made rewind totally boring. made other edits to firmware chips to preserve their roms instead
//zero 22-may-2014 - why not this too, for the sake of completeness? //zero 22-may-2014 - why not this too, for the sake of completeness?
reconstruct(&SNES::cartridge); //reconstruct(&SNES::cartridge);
//zero 01-dec-2012 - due to systematic variable initialization fails in bsnes components, these reconstructions are necessary, //zero 01-dec-2012 - due to systematic variable initialization fails in bsnes components, these reconstructions are necessary,
//and the previous comment here which called this paranoid has been removed. //and the previous comment here which called this paranoid has been removed.