mirror of https://github.com/mgba-emu/mgba.git
GBA: Ensure cycles never go negative
This commit is contained in:
parent
e36f3c8211
commit
6822b8cabe
1
CHANGES
1
CHANGES
|
@ -71,6 +71,7 @@ Bugfixes:
|
|||
- Qt: Fix passing command line options
|
||||
- Qt: Fix crashes on Windows by using using QMetaObject to do cross-thread calls
|
||||
- GBA Video: Fix timing on first scanline
|
||||
- GBA: Ensure cycles never go negative
|
||||
Misc:
|
||||
- Qt: Handle saving input settings better
|
||||
- Debugger: Free watchpoints in addition to breakpoints
|
||||
|
|
|
@ -184,6 +184,11 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
|
|||
int32_t cycles = cpu->nextEvent;
|
||||
int32_t nextEvent = INT_MAX;
|
||||
int32_t testEvent;
|
||||
#ifndef NDEBUG
|
||||
if (cycles < 0) {
|
||||
GBALog(gba, GBA_LOG_FATAL, "Negative cycles passed: %i", cycles);
|
||||
}
|
||||
#endif
|
||||
|
||||
gba->bus = cpu->prefetch[1];
|
||||
if (cpu->executionMode == MODE_THUMB) {
|
||||
|
|
|
@ -87,6 +87,10 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
|
|||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: CPU cycles are negative");
|
||||
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) {
|
||||
GBALog(gba, GBA_LOG_WARN, "Savestate is corrupted: video eventDiff is negative");
|
||||
error = true;
|
||||
|
|
Loading…
Reference in New Issue