add crude firmware dumping script

This commit is contained in:
suchmememanyskill
2021-07-21 15:19:27 +02:00
parent d7ebd9fdbe
commit 3ab95dfd64
6 changed files with 202 additions and 10 deletions

View File

@@ -1,7 +1,9 @@
#include "intClass.h"
#include "StringClass.h"
#include "compat.h"
#include <malloc.h>
#include <string.h>
#include <utils/sprintf.h>
IntClass_t createIntClass(s64 in) {
IntClass_t a = { in };
@@ -20,6 +22,12 @@ ClassFunction(printIntVariable) {
return &emptyClass;
}
ClassFunction(intToStr) {
char buff[64] = {0};
s_printf(buff, "%d", getIntValue(caller));
return newStringVariablePtr(CpyStr(buff), 0, 1);
}
#define IntOpFunction(name, op) ClassFunction(name) { s64 i1 = getIntValue(caller); s64 i2 = getIntValue(*args); return newIntVariablePtr((i1 op i2)); }
IntOpFunction(addInt, +)
@@ -52,6 +60,7 @@ u8 oneIntArgInt[] = { IntClass };
ClassFunctionTableEntry_t intFunctions[] = {
{"print", printIntVariable, 0, 0},
{"not", notInt, 0, 0},
{"str", intToStr, 0, 0},
IntOpFunctionEntry("+", addInt),
IntOpFunctionEntry("-", minusInt),
IntOpFunctionEntry("*", multInt),