fix crash issue with the ym2151 savestates when the current samplerate is different from samplerate when the state was made. a compromise was added to prevent breakage of all old savestate files

This commit is contained in:
dinkc64 2016-03-26 00:19:18 +00:00
parent 93cd9aa1ff
commit 16d13e6f63
1 changed files with 23 additions and 15 deletions

View File

@ -234,21 +234,29 @@ void BurnYM2151Scan(INT32 nAction)
return; return;
} }
SCAN_VAR(nBurnCurrentYM2151Register); {
SCAN_VAR(BurnYM2151Registers); // A long time ago these variables were mistakenly scanned for the savestates.
SCAN_VAR(YM2151Volumes); // Recently it was found that this causes crash situations if the samplerate or
SCAN_VAR(YM2151RouteDirs); // sample size had changed between machines loading the states.
SCAN_VAR(nBurnYM2151SoundRate); // These dummy variables are to prevent the breaking all states for games that use the 2151.
SCAN_VAR(nBurnPosition); double dummyYM2151Volumes[2];
SCAN_VAR(nSampleSize); INT32 dummyYM2151RouteDirs[2];
SCAN_VAR(nFractionalPosition); INT32 dummynBurnYM2151SoundRate;
SCAN_VAR(nSamplesRendered); INT32 dummynBurnPosition;
UINT32 dummynSampleSize;
UINT32 dummynFractionalPosition;
UINT32 dummynSamplesRendered;
BurnYM2151Scan_int(nAction); // Properly scan the YM2151's internal registers SCAN_VAR(nBurnCurrentYM2151Register);
SCAN_VAR(BurnYM2151Registers);
SCAN_VAR(dummyYM2151Volumes);
SCAN_VAR(dummyYM2151RouteDirs);
SCAN_VAR(dummynBurnYM2151SoundRate);
SCAN_VAR(dummynBurnPosition);
SCAN_VAR(dummynSampleSize);
SCAN_VAR(dummynFractionalPosition);
SCAN_VAR(dummynSamplesRendered);
}
/*if (nAction & ACB_WRITE) { // Restore the operator connections, see burn_ym2151.h BurnYM2151WriteRegister() for more info. BurnYM2151Scan_int(nAction); // Scan the YM2151's internal registers
for (INT32 i = 0; i < 0x0100; i++) {
YM2151WriteReg(0, i, BurnYM2151Registers[i]);
}
}*/
} }