mirror of https://github.com/mgba-emu/mgba.git
GUI: Add Reset Game menu item
This commit is contained in:
parent
3ce129fbb1
commit
36d726f3c5
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue