GUI: Add Reset Game menu item

This commit is contained in:
Jeffrey Pfau 2015-12-16 20:36:38 -08:00
parent 3ce129fbb1
commit 36d726f3c5
3 changed files with 12 additions and 1 deletions

View File

@ -180,8 +180,9 @@ bool GBAContextStart(struct GBAContext* context) {
context->gba->logLevel = opts.logLevel;
context->gba->idleOptimization = opts.idleOptimization;
ARMReset(context->cpu);
GBAContextReset(context);
// TODO: Move this into GBAContextReset
if (opts.skipBios) {
GBASkipBIOS(context->gba);
}
@ -196,6 +197,10 @@ bool GBAContextStart(struct GBAContext* context) {
return true;
}
void GBAContextReset(struct GBAContext* context) {
ARMReset(context->cpu);
}
void GBAContextStop(struct GBAContext* context) {
UNUSED(context);
// TODO?

View File

@ -37,6 +37,7 @@ void GBAContextUnloadROM(struct GBAContext* context);
bool GBAContextStart(struct GBAContext* context);
void GBAContextStop(struct GBAContext* context);
void GBAContextReset(struct GBAContext* context);
void GBAContextFrame(struct GBAContext* context, uint16_t keys);
#endif

View File

@ -27,6 +27,7 @@ enum {
RUNNER_LOAD_STATE,
RUNNER_SCREENSHOT,
RUNNER_CONFIG,
RUNNER_RESET,
RUNNER_COMMAND_MASK = 0xFFFF,
RUNNER_STATE_1 = 0x10000,
@ -181,6 +182,7 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
*GUIMenuItemListAppend(&pauseMenu.items) = (struct GUIMenuItem) { .title = "Take screenshot", .data = (void*) RUNNER_SCREENSHOT };
*GUIMenuItemListAppend(&pauseMenu.items) = (struct GUIMenuItem) { .title = "Configure", .data = (void*) RUNNER_CONFIG };
*GUIMenuItemListAppend(&pauseMenu.items) = (struct GUIMenuItem) { .title = "Reset game", .data = (void*) RUNNER_RESET };
*GUIMenuItemListAppend(&pauseMenu.items) = (struct GUIMenuItem) { .title = "Exit game", .data = (void*) RUNNER_EXIT };
while (true) {
@ -303,6 +305,9 @@ void GBAGUIRunloop(struct GBAGUIRunner* runner) {
running = false;
keys = 0;
break;
case RUNNER_RESET:
GBAContextReset(&runner->context);
break;
case RUNNER_SAVE_STATE:
vf = GBAGetState(runner->context.gba, 0, ((int) item->data) >> 16, true);
if (vf) {