GBA: Fix hang when loading a savestate if sync to video is enabled

This commit is contained in:
Jeffrey Pfau 2015-04-22 20:41:54 -07:00
parent 255242a665
commit 242dc5067b
4 changed files with 13 additions and 1 deletions

View File

@ -33,6 +33,7 @@ Bugfixes:
- GBA Memory: Fix 32-bit loads from unaddress cartridge space
- Qt: Fix multiplayer windows opening as the wrong size
- Qt: Fix controllers sometimes not loading the right profile
- GBA: Fix hang when loading a savestate if sync to video is enabled
Misc:
- Qt: Show multiplayer numbers in window title
- Qt: Handle saving input settings better

View File

@ -178,7 +178,7 @@ static bool _loadPNGState(struct GBA* gba, struct VFile* vf) {
PNGReadFooter(png, end);
PNGReadClose(png, info, end);
gba->video.renderer->putPixels(gba->video.renderer, VIDEO_HORIZONTAL_PIXELS, pixels);
GBASyncPostFrame(gba->sync);
GBASyncForceFrame(gba->sync);
free(pixels);
return true;

View File

@ -712,6 +712,16 @@ void GBASyncPostFrame(struct GBASync* sync) {
MutexUnlock(&sync->videoFrameMutex);
}
void GBASyncForceFrame(struct GBASync* sync) {
if (!sync) {
return;
}
MutexLock(&sync->videoFrameMutex);
ConditionWake(&sync->videoFrameAvailableCond);
MutexUnlock(&sync->videoFrameMutex);
}
bool GBASyncWaitFrameStart(struct GBASync* sync, int frameskip) {
if (!sync) {
return true;

View File

@ -138,6 +138,7 @@ void GBAThreadTakeScreenshot(struct GBAThread* threadContext);
#endif
void GBASyncPostFrame(struct GBASync* sync);
void GBASyncForceFrame(struct GBASync* sync);
bool GBASyncWaitFrameStart(struct GBASync* sync, int frameskip);
void GBASyncWaitFrameEnd(struct GBASync* sync);
bool GBASyncDrawingFrame(struct GBASync* sync);