fix a glaring desync that would happen if you load a savestate while the lid is closed
This commit is contained in:
parent
cf93552f98
commit
967408cbc1
|
@ -1586,27 +1586,37 @@ static bool loadUserInput(EMUFILE* is, int version);
|
||||||
void nds_savestate(EMUFILE* os)
|
void nds_savestate(EMUFILE* os)
|
||||||
{
|
{
|
||||||
//version
|
//version
|
||||||
write32le(2,os);
|
write32le(3,os);
|
||||||
|
|
||||||
sequencer.save(os);
|
sequencer.save(os);
|
||||||
|
|
||||||
saveUserInput(os);
|
saveUserInput(os);
|
||||||
|
|
||||||
|
write32le(LidClosed,os);
|
||||||
|
write8le(countLid,os);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nds_loadstate(EMUFILE* is, int size)
|
bool nds_loadstate(EMUFILE* is, int size)
|
||||||
{
|
{
|
||||||
|
// this isn't part of the savestate loading logic, but
|
||||||
|
// don't skip the next frame after loading a savestate
|
||||||
|
frameSkipper.OmitSkip(true, true);
|
||||||
|
|
||||||
//read version
|
//read version
|
||||||
u32 version;
|
u32 version;
|
||||||
if(read32le(&version,is) != 1) return false;
|
if(read32le(&version,is) != 1) return false;
|
||||||
|
|
||||||
if(version > 2) return false;
|
if(version > 3) return false;
|
||||||
|
|
||||||
bool temp = true;
|
bool temp = true;
|
||||||
temp &= sequencer.load(is, version);
|
temp &= sequencer.load(is, version);
|
||||||
if(version <= 1 || !temp) return temp;
|
if(version <= 1 || !temp) return temp;
|
||||||
temp &= loadUserInput(is, version);
|
temp &= loadUserInput(is, version);
|
||||||
|
|
||||||
frameSkipper.OmitSkip(true, true);
|
if(version < 3) return temp;
|
||||||
|
|
||||||
|
read32le(&LidClosed,is);
|
||||||
|
read8le(&countLid,is);
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,6 +176,7 @@ SFORMAT SF_NDS[]={
|
||||||
{ "_ENS", 4, 1, &nds.ensataEmulation},
|
{ "_ENS", 4, 1, &nds.ensataEmulation},
|
||||||
{ "_ENH", 4, 1, &nds.ensataHandshake},
|
{ "_ENH", 4, 1, &nds.ensataHandshake},
|
||||||
{ "_ENI", 4, 1, &nds.ensataIpcSyncCounter},
|
{ "_ENI", 4, 1, &nds.ensataIpcSyncCounter},
|
||||||
|
{ "_SLP", 4, 1, &nds.sleeping},
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue