mirror of https://github.com/mgba-emu/mgba.git
Scripting: Add register information to docgen
This commit is contained in:
parent
42efdc46eb
commit
85b619dc78
|
@ -325,13 +325,17 @@ bool call(struct mScriptValue* obj, const char* method, struct mScriptFrame* fra
|
|||
|
||||
void explainCore(struct mCore* core) {
|
||||
struct mScriptValue wrapper;
|
||||
size_t size;
|
||||
size_t i;
|
||||
mScriptContextAttachCore(&context, core);
|
||||
|
||||
struct mScriptValue* emu = mScriptContextGetGlobal(&context, "emu");
|
||||
addType(emu->type);
|
||||
|
||||
if (mScriptObjectGet(emu, "memory", &wrapper)) {
|
||||
struct mScriptValue* memory = mScriptValueUnwrap(&wrapper);
|
||||
struct TableIterator iter;
|
||||
printf(" memory:\n");
|
||||
puts(" memory:");
|
||||
if (mScriptTableIteratorStart(memory, &iter)) {
|
||||
do {
|
||||
struct mScriptValue* name = mScriptTableIteratorGetKey(memory, &iter);
|
||||
|
@ -361,6 +365,27 @@ void explainCore(struct mCore* core) {
|
|||
} while (mScriptTableIteratorNext(memory, &iter));
|
||||
}
|
||||
}
|
||||
|
||||
const struct mCoreRegisterInfo* registers;
|
||||
size = core->listRegisters(core, ®isters);
|
||||
if (size) {
|
||||
puts(" registers:");
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (strncmp(registers[i].name, "spsr", 4) == 0) {
|
||||
// SPSR access is not implemented yet
|
||||
continue;
|
||||
}
|
||||
printf(" - name: \"%s\"\n", registers[i].name);
|
||||
if (registers[i].aliases && registers[i].aliases[0]) {
|
||||
size_t alias;
|
||||
puts(" aliases:");
|
||||
for (alias = 0; registers[i].aliases[alias]; ++alias) {
|
||||
printf(" - \"%s\"\n", registers[i].aliases[alias]);
|
||||
}
|
||||
}
|
||||
printf(" width: %u\n", registers[i].width);
|
||||
}
|
||||
}
|
||||
mScriptContextDetachCore(&context);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue