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