GBA: Savestates with negative audio registers are only relevant if not dead

This commit is contained in:
Jeffrey Pfau 2015-07-01 19:43:34 -07:00
parent d4ecdfc2ac
commit b3ea09e150
1 changed files with 9 additions and 3 deletions

View File

@ -103,11 +103,16 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio eventDiff is negative");
error = true;
}
if (state->audio.ch1.envelopeNextStep < 0 || state->audio.ch1.waveNextStep < 0 || state->audio.ch1.sweepNextStep < 0 || state->audio.ch1.nextEvent < 0) {
if (!state->audio.ch1Dead && (state->audio.ch1.envelopeNextStep < 0 ||
state->audio.ch1.waveNextStep < 0 ||
state->audio.ch1.sweepNextStep < 0 ||
state->audio.ch1.nextEvent < 0)) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio channel 1 register is negative");
error = true;
}
if (state->audio.ch2.envelopeNextStep < 0 || state->audio.ch2.waveNextStep < 0 || state->audio.ch2.nextEvent < 0) {
if (!state->audio.ch2Dead && (state->audio.ch2.envelopeNextStep < 0 ||
state->audio.ch2.waveNextStep < 0 ||
state->audio.ch2.nextEvent < 0)) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio channel 2 register is negative");
error = true;
}
@ -115,7 +120,8 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio channel 3 register is negative");
error = true;
}
if (state->audio.ch4.envelopeNextStep < 0 || state->audio.ch4.nextEvent < 0) {
if (!state->audio.ch4Dead && (state->audio.ch4.envelopeNextStep < 0 ||
state->audio.ch4.nextEvent < 0)) {
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio channel 4 register is negative");
error = true;
}