mirror of https://github.com/mgba-emu/mgba.git
Debugger: Add rewind command
This commit is contained in:
parent
da094de3da
commit
4d0f855923
|
@ -20,11 +20,13 @@ static uint32_t _GBACLIDebuggerLookupIdentifier(struct CLIDebuggerSystem*, const
|
||||||
|
|
||||||
static void _frame(struct CLIDebugger*, struct CLIDebugVector*);
|
static void _frame(struct CLIDebugger*, struct CLIDebugVector*);
|
||||||
static void _load(struct CLIDebugger*, struct CLIDebugVector*);
|
static void _load(struct CLIDebugger*, struct CLIDebugVector*);
|
||||||
|
static void _rewind(struct CLIDebugger*, struct CLIDebugVector*);
|
||||||
static void _save(struct CLIDebugger*, struct CLIDebugVector*);
|
static void _save(struct CLIDebugger*, struct CLIDebugVector*);
|
||||||
|
|
||||||
struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = {
|
struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = {
|
||||||
{ "frame", _frame, 0, "Frame advance" },
|
{ "frame", _frame, 0, "Frame advance" },
|
||||||
{ "load", _load, CLIDVParse, "Load a savestate" },
|
{ "load", _load, CLIDVParse, "Load a savestate" },
|
||||||
|
{ "rewind", _rewind, CLIDVParse, "Rewind the emulation a number of recorded intervals" },
|
||||||
{ "save", _save, CLIDVParse, "Save a savestate" },
|
{ "save", _save, CLIDVParse, "Save a savestate" },
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
@ -113,6 +115,17 @@ static void _load(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
GBALoadState(gbaDebugger->context->gba, gbaDebugger->context->stateDir, dv->intValue);
|
GBALoadState(gbaDebugger->context->gba, gbaDebugger->context->stateDir, dv->intValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void _rewind(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
||||||
|
if (!dv) {
|
||||||
|
GBARewindAll(gbaDebugger->context);
|
||||||
|
} else if (dv->type != CLIDV_INT_TYPE) {
|
||||||
|
printf("%s\n", ERROR_MISSING_ARGS);
|
||||||
|
} else {
|
||||||
|
GBARewind(gbaDebugger->context, dv->intValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void _save(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _save(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
if (!dv || dv->type != CLIDV_INT_TYPE) {
|
if (!dv || dv->type != CLIDV_INT_TYPE) {
|
||||||
printf("%s\n", ERROR_MISSING_ARGS);
|
printf("%s\n", ERROR_MISSING_ARGS);
|
||||||
|
|
Loading…
Reference in New Issue