mirror of https://github.com/mgba-emu/mgba.git
Fix crashes when GBARR is not initialized
This commit is contained in:
parent
3051143fa3
commit
94001b1133
|
@ -84,8 +84,10 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
return;
|
return;
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
GBAThreadInterrupt(context);
|
GBAThreadInterrupt(context);
|
||||||
|
if (context->gba->rr) {
|
||||||
GBARRStopPlaying(context->gba->rr);
|
GBARRStopPlaying(context->gba->rr);
|
||||||
GBARRStopRecording(context->gba->rr);
|
GBARRStopRecording(context->gba->rr);
|
||||||
|
}
|
||||||
GBAThreadContinue(context);
|
GBAThreadContinue(context);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
@ -111,6 +113,7 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
GBAThreadReset(context);
|
GBAThreadReset(context);
|
||||||
break;
|
break;
|
||||||
case SDLK_t:
|
case SDLK_t:
|
||||||
|
if (context->gba->rr) {
|
||||||
GBAThreadReset(context);
|
GBAThreadReset(context);
|
||||||
GBAThreadInterrupt(context);
|
GBAThreadInterrupt(context);
|
||||||
GBARRContextCreate(context->gba);
|
GBARRContextCreate(context->gba);
|
||||||
|
@ -118,8 +121,10 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
GBARRStopPlaying(context->gba->rr);
|
GBARRStopPlaying(context->gba->rr);
|
||||||
GBARRStartRecording(context->gba->rr);
|
GBARRStartRecording(context->gba->rr);
|
||||||
GBAThreadContinue(context);
|
GBAThreadContinue(context);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SDLK_y:
|
case SDLK_y:
|
||||||
|
if (context->gba->rr) {
|
||||||
GBAThreadReset(context);
|
GBAThreadReset(context);
|
||||||
GBAThreadInterrupt(context);
|
GBAThreadInterrupt(context);
|
||||||
GBARRContextCreate(context->gba);
|
GBARRContextCreate(context->gba);
|
||||||
|
@ -127,6 +132,7 @@ static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents
|
||||||
GBARRStopRecording(context->gba->rr);
|
GBARRStopRecording(context->gba->rr);
|
||||||
GBARRStartPlaying(context->gba->rr, event->keysym.mod & KMOD_SHIFT);
|
GBARRStartPlaying(context->gba->rr, event->keysym.mod & KMOD_SHIFT);
|
||||||
GBAThreadContinue(context);
|
GBAThreadContinue(context);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue