mirror of
https://github.com/libretro/mgba.git
synced 2024-12-02 13:27:44 +00:00
GBA: Remove no-longer necessary sanitization checks
This commit is contained in:
parent
32ca05312b
commit
19453933df
1
CHANGES
1
CHANGES
@ -34,7 +34,6 @@ Misc:
|
|||||||
- Qt: Disable menu items in multiplayer that don't make sense to have enabled
|
- Qt: Disable menu items in multiplayer that don't make sense to have enabled
|
||||||
- Qt: Dropping multiplayer windows works more cleanly now
|
- Qt: Dropping multiplayer windows works more cleanly now
|
||||||
- GBA BIOS: Implement RegisterRamReset for SIO registers
|
- GBA BIOS: Implement RegisterRamReset for SIO registers
|
||||||
- GBA: Additional savestate sanity checks
|
|
||||||
- All: Reset next event to cycles instead of zero to interrupt
|
- All: Reset next event to cycles instead of zero to interrupt
|
||||||
- GBA Video: Remove lastHblank, as it is implied
|
- GBA Video: Remove lastHblank, as it is implied
|
||||||
- GBA: Check for cycle count being too high
|
- GBA: Check for cycle count being too high
|
||||||
|
@ -91,67 +91,10 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
|
|||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are too high");
|
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are too high");
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if (state->cpu.nextEvent < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: Next event is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (state->video.eventDiff < 0) {
|
if (state->video.eventDiff < 0) {
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: video eventDiff is negative");
|
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: video eventDiff is negative");
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
if (state->video.nextHblank - state->video.eventDiff < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: nextHblank is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (state->video.nextEvent < state->cpu.cycles) {
|
|
||||||
uint16_t dispstat = state->io[REG_DISPSTAT >> 1];
|
|
||||||
if (GBARegisterDISPSTATIsInHblank(dispstat) && state->video.eventDiff + state->cpu.cycles > state->video.nextHblank) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: nextHblank will be negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (!GBARegisterDISPSTATIsInHblank(dispstat) && state->video.eventDiff + state->cpu.cycles > state->video.lastHblank + VIDEO_HBLANK_LENGTH) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: nextHblank will be negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (state->timers[0].overflowInterval < 0 || state->timers[1].overflowInterval < 0 || state->timers[2].overflowInterval < 0 || state->timers[3].overflowInterval < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: overflowInterval is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (state->timers[0].nextEvent < 0 || state->timers[1].nextEvent < 0 || state->timers[2].nextEvent < 0 || state->timers[3].nextEvent < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: timer nextEvent is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (state->dma[0].nextEvent < 0 || state->dma[1].nextEvent < 0 || state->dma[2].nextEvent < 0 || state->dma[3].nextEvent < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: DMA nextEvent is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
if (state->audio.eventDiff < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio eventDiff is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
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.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;
|
|
||||||
}
|
|
||||||
if (state->audio.ch3.nextEvent < 0) {
|
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: audio channel 3 register is negative");
|
|
||||||
error = true;
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
int region = (state->cpu.gprs[ARM_PC] >> BASE_OFFSET);
|
int region = (state->cpu.gprs[ARM_PC] >> BASE_OFFSET);
|
||||||
if ((region == REGION_CART0 || region == REGION_CART1 || region == REGION_CART2) && ((state->cpu.gprs[ARM_PC] - WORD_SIZE_ARM) & SIZE_CART0) >= gba->memory.romSize - WORD_SIZE_ARM) {
|
if ((region == REGION_CART0 || region == REGION_CART1 || region == REGION_CART2) && ((state->cpu.gprs[ARM_PC] - WORD_SIZE_ARM) & SIZE_CART0) >= gba->memory.romSize - WORD_SIZE_ARM) {
|
||||||
GBALog(gba, GBA_LOG_WARN, "Savestate created using a differently sized version of the ROM");
|
GBALog(gba, GBA_LOG_WARN, "Savestate created using a differently sized version of the ROM");
|
||||||
|
Loading…
Reference in New Issue
Block a user