mirror of https://github.com/mgba-emu/mgba.git
GBA: Allow pausing event loop while CPU is blocked
This commit is contained in:
parent
ba2175f5c5
commit
287fd86e6a
1
CHANGES
1
CHANGES
|
@ -56,6 +56,7 @@ Other fixes:
|
|||
- Wii: Fix pixelated filtering on interframe blending (fixes mgba.io/i/1830)
|
||||
Misc:
|
||||
- GB: Allow pausing event loop while CPU is blocked
|
||||
- GBA: Allow pausing event loop while CPU is blocked
|
||||
- Debugger: Keep track of global cycle count
|
||||
- FFmpeg: Add looping option for GIF/APNG
|
||||
- FFmpeg: Use range coder for FFV1 to reduce output size
|
||||
|
|
|
@ -236,6 +236,7 @@ DECL_BITFIELD(GBASerializedMiscFlags, uint32_t);
|
|||
DECL_BIT(GBASerializedMiscFlags, Halted, 0);
|
||||
DECL_BIT(GBASerializedMiscFlags, POSTFLG, 1);
|
||||
DECL_BIT(GBASerializedMiscFlags, IrqPending, 2);
|
||||
DECL_BIT(GBASerializedMiscFlags, Blocked, 3);
|
||||
|
||||
struct GBASerializedState {
|
||||
uint32_t versionMagic;
|
||||
|
|
|
@ -286,7 +286,7 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
|
|||
}
|
||||
#endif
|
||||
nextEvent = mTimingTick(&gba->timing, cycles < nextEvent ? nextEvent : cycles);
|
||||
} while (gba->cpuBlocked);
|
||||
} while (gba->cpuBlocked && !gba->earlyExit);
|
||||
|
||||
cpu->nextEvent = nextEvent;
|
||||
if (cpu->halted) {
|
||||
|
@ -305,11 +305,9 @@ static void GBAProcessEvents(struct ARMCore* cpu) {
|
|||
}
|
||||
}
|
||||
gba->earlyExit = false;
|
||||
#ifndef NDEBUG
|
||||
if (gba->cpuBlocked) {
|
||||
mLOG(GBA, FATAL, "CPU is blocked!");
|
||||
cpu->cycles = cpu->nextEvent;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_DEBUGGERS
|
||||
|
|
|
@ -67,6 +67,7 @@ void GBASerialize(struct GBA* gba, struct GBASerializedState* state) {
|
|||
miscFlags = GBASerializedMiscFlagsFillIrqPending(miscFlags);
|
||||
STORE_32(gba->irqEvent.when - mTimingCurrentTime(&gba->timing), 0, &state->nextIrq);
|
||||
}
|
||||
miscFlags = GBASerializedMiscFlagsSetBlocked(miscFlags, gba->cpuBlocked);
|
||||
STORE_32(miscFlags, 0, &state->miscFlags);
|
||||
|
||||
GBAMemorySerialize(&gba->memory, state);
|
||||
|
@ -185,6 +186,7 @@ bool GBADeserialize(struct GBA* gba, const struct GBASerializedState* state) {
|
|||
LOAD_32(when, 0, &state->nextIrq);
|
||||
mTimingSchedule(&gba->timing, &gba->irqEvent, when);
|
||||
}
|
||||
gba->cpuBlocked = GBASerializedMiscFlagsGetBlocked(miscFlags);
|
||||
|
||||
GBAVideoDeserialize(&gba->video, state);
|
||||
GBAMemoryDeserialize(&gba->memory, state);
|
||||
|
|
|
@ -175,6 +175,7 @@ void _startHdraw(struct mTiming* timing, void* context, uint32_t cyclesLate) {
|
|||
video->frameskipCounter = video->frameskip;
|
||||
}
|
||||
++video->frameCounter;
|
||||
video->p->earlyExit = true;
|
||||
break;
|
||||
case VIDEO_VERTICAL_TOTAL_PIXELS - 1:
|
||||
video->p->memory.io[REG_DISPSTAT >> 1] = GBARegisterDISPSTATClearInVblank(dispstat);
|
||||
|
|
Loading…
Reference in New Issue