mirror of https://github.com/mgba-emu/mgba.git
Debugger: Update createDebugger
This commit is contained in:
parent
e4aed77f1e
commit
eccddde283
|
@ -31,7 +31,7 @@ struct CLIDebuggerCommandSummary _GBACLIDebuggerCommands[] = {
|
||||||
{ 0, 0, 0, 0 }
|
{ 0, 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) {
|
struct GBACLIDebugger* GBACLIDebuggerCreate(struct mCore* core) {
|
||||||
struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger));
|
struct GBACLIDebugger* debugger = malloc(sizeof(struct GBACLIDebugger));
|
||||||
debugger->d.init = _GBACLIDebuggerInit;
|
debugger->d.init = _GBACLIDebuggerInit;
|
||||||
debugger->d.deinit = _GBACLIDebuggerDeinit;
|
debugger->d.deinit = _GBACLIDebuggerDeinit;
|
||||||
|
@ -41,7 +41,7 @@ struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread* context) {
|
||||||
debugger->d.name = "Game Boy Advance";
|
debugger->d.name = "Game Boy Advance";
|
||||||
debugger->d.commands = _GBACLIDebuggerCommands;
|
debugger->d.commands = _GBACLIDebuggerCommands;
|
||||||
|
|
||||||
debugger->context = context;
|
debugger->core = core;
|
||||||
|
|
||||||
return debugger;
|
return debugger;
|
||||||
}
|
}
|
||||||
|
@ -60,12 +60,12 @@ static bool _GBACLIDebuggerCustom(struct CLIDebuggerSystem* debugger) {
|
||||||
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger;
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger;
|
||||||
|
|
||||||
if (gbaDebugger->frameAdvance) {
|
if (gbaDebugger->frameAdvance) {
|
||||||
if (!gbaDebugger->inVblank && GBARegisterDISPSTATIsInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1])) {
|
if (!gbaDebugger->inVblank && GBARegisterDISPSTATIsInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1])) {
|
||||||
ARMDebuggerEnter(&gbaDebugger->d.p->d, DEBUGGER_ENTER_MANUAL, 0);
|
ARMDebuggerEnter(&gbaDebugger->d.p->d, DEBUGGER_ENTER_MANUAL, 0);
|
||||||
gbaDebugger->frameAdvance = false;
|
gbaDebugger->frameAdvance = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1]);
|
gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -90,7 +90,7 @@ static void _frame(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
|
|
||||||
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
||||||
gbaDebugger->frameAdvance = true;
|
gbaDebugger->frameAdvance = true;
|
||||||
gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(gbaDebugger->context->gba->memory.io[REG_DISPSTAT >> 1]);
|
gbaDebugger->inVblank = GBARegisterDISPSTATGetInVblank(((struct GBA*) gbaDebugger->core->board)->memory.io[REG_DISPSTAT >> 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _load(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _load(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
|
@ -106,17 +106,17 @@ static void _load(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
|
|
||||||
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
||||||
|
|
||||||
GBALoadState(gbaDebugger->context, gbaDebugger->context->dirs.state, dv->intValue, SAVESTATE_SCREENSHOT);
|
mCoreLoadState(gbaDebugger->core, dv->intValue, SAVESTATE_SCREENSHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _rewind(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
static void _rewind(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
||||||
if (!dv) {
|
if (!dv) {
|
||||||
GBARewindAll(gbaDebugger->context);
|
// TODO: Put back rewind
|
||||||
} else if (dv->type != CLIDV_INT_TYPE) {
|
} else if (dv->type != CLIDV_INT_TYPE) {
|
||||||
printf("%s\n", ERROR_MISSING_ARGS);
|
printf("%s\n", ERROR_MISSING_ARGS);
|
||||||
} else {
|
} else {
|
||||||
GBARewind(gbaDebugger->context, dv->intValue);
|
// TODO: Put back rewind
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,6 +133,6 @@ static void _save(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
|
||||||
|
|
||||||
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
struct GBACLIDebugger* gbaDebugger = (struct GBACLIDebugger*) debugger->system;
|
||||||
|
|
||||||
GBASaveState(gbaDebugger->context, gbaDebugger->context->dirs.state, dv->intValue, SAVESTATE_SCREENSHOT);
|
mCoreSaveState(gbaDebugger->core, dv->intValue, SAVESTATE_SCREENSHOT);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,18 +9,18 @@
|
||||||
#ifdef USE_CLI_DEBUGGER
|
#ifdef USE_CLI_DEBUGGER
|
||||||
#include "debugger/cli-debugger.h"
|
#include "debugger/cli-debugger.h"
|
||||||
|
|
||||||
struct GBAThread;
|
struct mCore;
|
||||||
|
|
||||||
struct GBACLIDebugger {
|
struct GBACLIDebugger {
|
||||||
struct CLIDebuggerSystem d;
|
struct CLIDebuggerSystem d;
|
||||||
|
|
||||||
struct GBAThread* context;
|
struct mCore* core;
|
||||||
|
|
||||||
bool frameAdvance;
|
bool frameAdvance;
|
||||||
bool inVblank;
|
bool inVblank;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GBACLIDebugger* GBACLIDebuggerCreate(struct GBAThread*);
|
struct GBACLIDebugger* GBACLIDebuggerCreate(struct mCore*);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -199,7 +199,7 @@ void _applyGraphicsArgs(struct mSubParser* parser, struct mCoreConfig* config) {
|
||||||
mCoreConfigSetOverrideIntValue(config, "fullscreen", graphicsOpts->fullscreen);
|
mCoreConfigSetOverrideIntValue(config, "fullscreen", graphicsOpts->fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ARMDebugger* createDebugger(struct mArguments* opts, struct GBAThread* context) {
|
struct ARMDebugger* createDebugger(struct mArguments* opts, struct mCore* core) {
|
||||||
#ifndef USE_CLI_DEBUGGER
|
#ifndef USE_CLI_DEBUGGER
|
||||||
UNUSED(context);
|
UNUSED(context);
|
||||||
#endif
|
#endif
|
||||||
|
@ -219,7 +219,7 @@ struct ARMDebugger* createDebugger(struct mArguments* opts, struct GBAThread* co
|
||||||
#ifdef USE_CLI_DEBUGGER
|
#ifdef USE_CLI_DEBUGGER
|
||||||
case DEBUGGER_CLI:
|
case DEBUGGER_CLI:
|
||||||
CLIDebuggerCreate(&debugger->cli);
|
CLIDebuggerCreate(&debugger->cli);
|
||||||
struct GBACLIDebugger* gbaDebugger = GBACLIDebuggerCreate(context);
|
struct GBACLIDebugger* gbaDebugger = GBACLIDebuggerCreate(core);
|
||||||
CLIDebuggerAttachSystem(&debugger->cli, &gbaDebugger->d);
|
CLIDebuggerAttachSystem(&debugger->cli, &gbaDebugger->d);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -59,6 +59,7 @@ void usage(const char* arg0, const char* extraOptions);
|
||||||
void version(const char* arg0);
|
void version(const char* arg0);
|
||||||
|
|
||||||
void initParserForGraphics(struct mSubParser* parser, struct mGraphicsOpts* opts);
|
void initParserForGraphics(struct mSubParser* parser, struct mGraphicsOpts* opts);
|
||||||
struct ARMDebugger* createDebugger(struct mArguments* opts, struct GBAThread* context);
|
struct mCore;
|
||||||
|
struct ARMDebugger* createDebugger(struct mArguments* opts, struct mCore* core);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue