From 174694a99b646040b93dec1a6d432f453ae9b7e5 Mon Sep 17 00:00:00 2001 From: octorock <79596758+octorock@users.noreply.github.com> Date: Thu, 4 Mar 2021 17:29:56 +0100 Subject: [PATCH] Generate using inline assembly --- include/scriptMacros.h | 97 ++++---- src/scripts/ezlo_angry.c | 219 ++++-------------- .../script_disassembler.py | 24 +- 3 files changed, 101 insertions(+), 239 deletions(-) diff --git a/include/scriptMacros.h b/include/scriptMacros.h index 0663059d..fabc19f9 100644 --- a/include/scriptMacros.h +++ b/include/scriptMacros.h @@ -1,54 +1,51 @@ #ifndef SCRIPT_MACROS_H #define SCRIPT_MACROS_H - // Generated by disassemble_script.py -#define START_SCRIPT(name) const unsigned short name[] = { -#define END_SCRIPT() }; -#define WORD_TO_SHORTS(word) (unsigned short)(word & 0xffff),(unsigned short)(word >> 16) +#define START_SCRIPT(name) asm(".globl "#name); asm(".section .rodata"); asm(#name":"); +#define END_SCRIPT() asm(".short 0xffff"); -#define nullsub_507() 0x0400, -#define sub_0807E004() 0x0401, -#define sub_0807E014() 0x0402, -#define sub_0807E024(s) 0x0803, s, -#define sub_0807E050(s) 0x0804, s, -#define sub_0807E064(s) 0x0805, s, -#define sub_0807E078(s) 0x0806, s, -#define sub_0807E0A0(w) 0x0c07, WORD_TO_SHORTS(w), -#define sub_0807E0B8(w) 0x0c08, WORD_TO_SHORTS(w), -#define sub_0807E0CC(w) 0x0c09, WORD_TO_SHORTS(w), -#define sub_0807E0E0(w) 0x0c0a, WORD_TO_SHORTS(w), -#define sub_0807E10C(w) 0x0c0b, WORD_TO_SHORTS(w), -#define sub_0807E124(a,b) 0x140c, WORD_TO_SHORTS(a), WORD_TO_SHORTS(b), -#define sub_0807E148(w) 0x0c0d, WORD_TO_SHORTS(w), -#define sub_0807E158(w) 0x0c0e, WORD_TO_SHORTS(w), -#define sub_0807E188(s) 0x080f, s, -#define sub_0807E1D8(s) 0x0810, s, -#define sub_0807E4AC(s) 0x0811, s, -#define sub_0807E260(s) 0x0815, s, -#define sub_0807E2A8(s) 0x0817, s, -#define sub_0807E2E4() 0x0418, -#define sub_0807E5F8(w) 0x0c28, WORD_TO_SHORTS(w), -#define sub_0807E680(s) 0x0831, s, -#define sub_0807E6AC(w) 0x0c33, WORD_TO_SHORTS(w), -#define sub_0807E864() 0x0443, -#define sub_0807E878() 0x0444, -#define sub_0807E8C4(w) 0x0c47, WORD_TO_SHORTS(w), -#define sub_0807E8E4() 0x0449, -#define sub_0807E8E4a() 0x044a, -#define sub_0807E8E4b() 0x044b, -#define sub_0807E8E4c() 0x044c, -#define sub_0807E930(s) 0x0850, s, -#define sub_0807E9D4() 0x0453, -#define sub_0807E9DC() 0x0454, -#define sub_0807EA94() 0x0459, -#define sub_0807EAD0(a,b) 0x0c5c, a,b, -#define sub_0807EB28(s) 0x085f, s, -#define sub_0807EB8C() 0x0464, -#define sub_0807EBC0(s) 0x0867, s, -#define sub_0807EC1C(s) 0x086d, s, -#define sub_0807EE30() 0x0475, -#define sub_0807EF80(s) 0x0879, s, -#define sub_0807EFAC(s) 0x087c, s, -#define sub_0807EFE4() 0x047e, - -#endif +#define nullsub_507() asm(".short 0x0400"); +#define sub_0807E004() asm(".short 0x0401"); +#define sub_0807E014() asm(".short 0x0402"); +#define sub_0807E024(s) asm(".short 0x0803");asm(".short " #s); +#define sub_0807E050(s) asm(".short 0x0804");asm(".short " #s); +#define sub_0807E064(s) asm(".short 0x0805");asm(".short " #s); +#define sub_0807E078(s) asm(".short 0x0806");asm(".short " #s); +#define sub_0807E0A0(w) asm(".short 0x0c07");asm(".word " #w); +#define sub_0807E0B8(w) asm(".short 0x0c08");asm(".word " #w); +#define sub_0807E0CC(w) asm(".short 0x0c09");asm(".word " #w); +#define sub_0807E0E0(w) asm(".short 0x0c0a");asm(".word " #w); +#define sub_0807E10C(w) asm(".short 0x0c0b");asm(".word " #w); +#define sub_0807E124(a,b) asm(".short 0x140c");asm(".word " #a);asm(".word " #b); +#define sub_0807E148(w) asm(".short 0x0c0d");asm(".word " #w); +#define sub_0807E158(w) asm(".short 0x0c0e");asm(".word " #w); +#define sub_0807E188(s) asm(".short 0x080f");asm(".short " #s); +#define sub_0807E1D8(s) asm(".short 0x0810");asm(".short " #s); +#define sub_0807E4AC(s) asm(".short 0x0811");asm(".short " #s); +#define sub_0807E260(s) asm(".short 0x0815");asm(".short " #s); +#define sub_0807E2A8(s) asm(".short 0x0817");asm(".short " #s); +#define sub_0807E2E4() asm(".short 0x0418"); +#define sub_0807E5F8(w) asm(".short 0x0c28");asm(".word " #w); +#define sub_0807E680(s) asm(".short 0x0831");asm(".short " #s); +#define sub_0807E6AC(w) asm(".short 0x0c33");asm(".word " #w); +#define sub_0807E864() asm(".short 0x0443"); +#define sub_0807E878() asm(".short 0x0444"); +#define sub_0807E8C4(w) asm(".short 0x0c47");asm(".word " #w); +#define sub_0807E8E4_0() asm(".short 0x0449"); +#define sub_0807E8E4_1() asm(".short 0x044a"); +#define sub_0807E8E4_2() asm(".short 0x044b"); +#define sub_0807E8E4_3() asm(".short 0x044c"); +#define sub_0807E930(s) asm(".short 0x0850");asm(".short " #s); +#define sub_0807E9D4() asm(".short 0x0453"); +#define sub_0807E9DC() asm(".short 0x0454"); +#define sub_0807EA94() asm(".short 0x0459"); +#define sub_0807EAD0(a,b) asm(".short 0x0c5c");asm(".short " #a);asm(".short " #b); +#define sub_0807EB28(s) asm(".short 0x085f");asm(".short " #s); +#define sub_0807EB8C() asm(".short 0x0464"); +#define sub_0807EBC0(s) asm(".short 0x0867");asm(".short " #s); +#define sub_0807EC1C(s) asm(".short 0x086d");asm(".short " #s); +#define sub_0807EE30() asm(".short 0x0475"); +#define sub_0807EF80(s) asm(".short 0x0879");asm(".short " #s); +#define sub_0807EFAC(s) asm(".short 0x087c");asm(".short " #s); +#define sub_0807EFE4() asm(".short 0x047e"); +#endif \ No newline at end of file diff --git a/src/scripts/ezlo_angry.c b/src/scripts/ezlo_angry.c index b841a754..52458403 100644 --- a/src/scripts/ezlo_angry.c +++ b/src/scripts/ezlo_angry.c @@ -1,15 +1,18 @@ #include "scriptMacros.h" #include "functions.h" - -/*const unsigned char test[] = { - 0x01, 0x04, 0x67, 0x08, 0x40, 0x00, 0x79, 0x08, 0x07, 0x00, 0x02, 0x04, 0x50, 0x08, 0x20, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x22, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x02, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x21, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x03, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x04, 0x00, 0x31, 0x08, 0x3c, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x11, 0x00, 0x50, 0x08, 0x1c, 0x00, 0x5c, 0x0c, 0x05, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x22, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x06, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1c, 0x00, 0x0b, 0x0c, 0x6d, 0xd9, 0x06, 0x08, 0x5c, 0x0c, 0x07, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x21, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x08, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1c, 0x00, 0x0b, 0x0c, 0x6d, 0xd9, 0x06, 0x08, 0x5c, 0x0c, 0x09, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x79, 0x08, 0x0a, 0x00, 0x53, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x15, 0x08, 0x00, 0x00, 0x04, 0x08, 0x28, 0x00, 0x18, 0x04, 0x05, 0x08, 0xf0, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x14, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x44, 0x04, 0x03, 0x08, 0xd0, 0xff, 0x43, 0x04, 0x54, 0x04, 0x0c, 0x14, 0xb1, 0xf5, 0x07, 0x08, 0x3c, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0xd1, 0x91, 0x07, 0x08, 0x02, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x0b, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0a, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0b, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x04, 0x00, 0x31, 0x08, 0x3c, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0c, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0d, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0e, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x10, 0x00, 0x79, 0x08, 0x0a, 0x00, 0x53, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0f, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x50, 0x00, 0x59, 0x04, 0x0b, 0x0c, 0x51, 0xdf, 0x07, 0x08, 0x44, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x10, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x50, 0x00, 0x50, 0x08, 0x18, 0x00, 0x59, 0x04, 0x0b, 0x0c, 0x51, 0xdf, 0x07, 0x08, 0x44, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x7e, 0x04, 0x79, 0x08, 0x0b, 0x00, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x11, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0xa1, 0xd8, 0x06, 0x08, 0x75, 0x04, 0x05, 0x08, 0xfc, 0xff, 0x50, 0x08, 0x1f, 0x00, 0x59, 0x04, 0x47, 0x0c, 0x18, 0x2b, 0x01, 0x08, 0x0b, 0x0c, 0xa5, 0xd9, 0x06, 0x08, 0x79, 0x08, 0x08, 0x00, 0x31, 0x08, 0x78, 0x00, 0x7c, 0x08, 0x0e, 0x00, 0x01, 0x04, 0x4b, 0x04, 0x5f, 0x08, 0x12, 0x11, 0x02, 0x04, 0x59, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x79, 0x08, 0x06, 0x00, 0xff, 0xff -};*/ - +#include "script.h" +extern void sub_0807F3C8(Entity*, ScriptExecutionContext*); +extern void sub_0807F5B0(Entity*, ScriptExecutionContext*); +extern void sub_0806D96C(Entity*, ScriptExecutionContext*); +extern void sub_0806D944(Entity*, ScriptExecutionContext*); +extern void sub_0806D908(Entity*, ScriptExecutionContext*); +extern void sub_0807F9A4(Entity*, ScriptExecutionContext*); +extern void sub_0807DF28(Entity*, ScriptExecutionContext*); +extern void sub_0807DF50(Entity*, ScriptExecutionContext*); +extern void sub_0806D8A0(Entity*, ScriptExecutionContext*); +extern void sub_0806D9A4(Entity*, ScriptExecutionContext*); // clang-format off -extern void sub_0807F3C8(); - START_SCRIPT(gUnk_080126FC) -//0x0401, 0x0867, 0x0040, 0x0879, 0x0007, 0x0402, 0x0850, 0x0020, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0022, 0x0c0b, 0xf3c9, 0x0807, 0x0c5c, 0x1102, 0x000c, 0x0459, 0x0850, 0x0020, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0021, 0x0c0b, 0xf3c9, 0x0807, 0x0c5c, 0x1103, 0x000c, 0x0459, 0x0850, 0x0020, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0879, 0x0004, 0x0831, 0x003c, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0879, 0x0011, 0x0850, 0x001c, 0x0c5c, 0x1105, 0x000c, 0x0459, 0x0850, 0x0020, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0022, 0x0c0b, 0xf3c9, 0x0807, 0x0c5c, 0x1106, 0x000c, 0x0459, 0x0850, 0x001c, 0x0c0b, 0xd96d, 0x0806, 0x0c5c, 0x1107, 0x000c, 0x0459, 0x0850, 0x0020, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0021, 0x0c0b, 0xf3c9, 0x0807, 0x0c5c, 0x1108, 0x000c, 0x0459, 0x0850, 0x001c, 0x0c0b, 0xd96d, 0x0806, 0x0c5c, 0x1109, 0x000c, 0x0459, 0x0850, 0x0020, 0x0879, 0x000a, 0x0453, 0x0c28, 0x0008, 0x0000, 0x0402, 0x0401, 0x0815, 0x0000, 0x0804, 0x0028, 0x0418, 0x0805, 0xfff0, 0x0402, 0x0443, 0x0c0b, 0xd945, 0x0806, 0x0850, 0x0010, 0x0c5c, 0x1114, 0x000c, 0x0459, 0x0850, 0x0020, 0x0444, 0x0803, 0xffd0, 0x0443, 0x0454, 0x140c, 0xf5b1, 0x0807, 0x003c, 0x0000, 0x0c0b, 0x91d1, 0x0807, 0x0402, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0879, 0x000b, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0c0b, 0xd945, 0x0806, 0x0850, 0x0010, 0x0c5c, 0x110a, 0x000c, 0x0459, 0x0850, 0x001f, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0010, 0x0c5c, 0x110b, 0x000c, 0x0459, 0x0850, 0x001f, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0879, 0x0004, 0x0831, 0x003c, 0x0850, 0x0010, 0x0c5c, 0x110c, 0x000c, 0x0459, 0x0850, 0x001f, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0010, 0x0c5c, 0x110d, 0x000c, 0x0459, 0x0850, 0x001f, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0850, 0x0010, 0x0c5c, 0x110e, 0x000c, 0x0459, 0x0850, 0x0018, 0x0867, 0x0080, 0x0c0b, 0xd909, 0x0806, 0x086d, 0x0010, 0x0879, 0x000a, 0x0453, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0402, 0x0401, 0x0c0b, 0xd945, 0x0806, 0x0418, 0x0804, 0x000e, 0x0817, 0x3030, 0x0805, 0x0020, 0x0803, 0xffe6, 0x0443, 0x0850, 0x0010, 0x0402, 0x0c5c, 0x1115, 0x000c, 0x0459, 0x0850, 0x0018, 0x0444, 0x0803, 0xffcc, 0x0402, 0x0443, 0x0c0b, 0xf9a5, 0x0807, 0x0c0b, 0xdf29, 0x0807, 0x0464, 0x0c0b, 0xd945, 0x0806, 0x0850, 0x0010, 0x0c5c, 0x110f, 0x000c, 0x0850, 0x0018, 0x0867, 0x0080, 0x0c0b, 0xd909, 0x0806, 0x086d, 0x0050, 0x0459, 0x0c0b, 0xdf51, 0x0807, 0x0444, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0402, 0x0401, 0x0c0b, 0xd945, 0x0806, 0x0418, 0x0804, 0x000e, 0x0817, 0x3030, 0x0805, 0x0020, 0x0803, 0xffe6, 0x0443, 0x0850, 0x0010, 0x0402, 0x0c5c, 0x1115, 0x000c, 0x0459, 0x0850, 0x0018, 0x0444, 0x0803, 0xffcc, 0x0402, 0x0443, 0x0c0b, 0xf9a5, 0x0807, 0x0c0b, 0xdf29, 0x0807, 0x0464, 0x0c0b, 0xd945, 0x0806, 0x0850, 0x0010, 0x0c5c, 0x1110, 0x000c, 0x0850, 0x0018, 0x0867, 0x0080, 0x0c0b, 0xd909, 0x0806, 0x086d, 0x0050, 0x0850, 0x0018, 0x0459, 0x0c0b, 0xdf51, 0x0807, 0x0444, 0x0c28, 0x0008, 0x0000, 0x0c33, 0x0004, 0x0000, 0x0402, 0x0401, 0x0c0b, 0xd945, 0x0806, 0x0418, 0x0804, 0x000e, 0x0817, 0x3030, 0x0805, 0x0020, 0x0803, 0xffe6, 0x0443, 0x0850, 0x0010, 0x0402, 0x0c5c, 0x1115, 0x000c, 0x0459, 0x0850, 0x0018, 0x0444, 0x0803, 0xffcc, 0x0402, 0x0443, 0x0c0b, 0xf9a5, 0x0807, 0x0c0b, 0xdf29, 0x0807, 0x047e, 0x0879, 0x000b, 0x0464, 0x0c0b, 0xd945, 0x0806, 0x0850, 0x0010, 0x0c5c, 0x1111, 0x000c, 0x0850, 0x0018, 0x0867, 0x0080, 0x0c0b, 0xd8a1, 0x0806, 0x0475, 0x0805, 0xfffc, 0x0850, 0x001f, 0x0459, 0x0c47, 0x2b18, 0x0801, 0x0c0b, 0xd9a5, 0x0806, 0x0879, 0x0008, 0x0831, 0x0078, 0x087c, 0x000e, 0x0401, 0x044b, 0x085f, 0x1112, 0x0402, 0x0459, 0x0c28, 0x0008, 0x0000, 0x0879, 0x0006, 0xffff sub_0807E004() sub_0807EBC0(0x0040) sub_0807EF80(0x0007) @@ -17,27 +20,14 @@ sub_0807E014() sub_0807E930(0x0020) sub_0807E6AC(0x00000004) sub_0807E930(0x0022) -sub_0807E10C((unsigned int)(void (* const)()) sub_0807F3C8) -END_SCRIPT() -//const void (*const TEST2)() = (const void (*const)())sub_0807F3C8; - -//void (*const TEST[])() = { - //(void (*const)()) sub_0807F3C8 -//}; -// - -// -const unsigned char test[] = { - 0x5c, 0x0c, 0x02, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x21, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x03, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x04, 0x00, 0x31, 0x08, 0x3c, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x11, 0x00, 0x50, 0x08, 0x1c, 0x00, 0x5c, 0x0c, 0x05, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x22, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x06, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1c, 0x00, 0x0b, 0x0c, 0x6d, 0xd9, 0x06, 0x08, 0x5c, 0x0c, 0x07, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x21, 0x00, 0x0b, 0x0c, 0xc9, 0xf3, 0x07, 0x08, 0x5c, 0x0c, 0x08, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1c, 0x00, 0x0b, 0x0c, 0x6d, 0xd9, 0x06, 0x08, 0x5c, 0x0c, 0x09, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x79, 0x08, 0x0a, 0x00, 0x53, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x15, 0x08, 0x00, 0x00, 0x04, 0x08, 0x28, 0x00, 0x18, 0x04, 0x05, 0x08, 0xf0, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x14, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x20, 0x00, 0x44, 0x04, 0x03, 0x08, 0xd0, 0xff, 0x43, 0x04, 0x54, 0x04, 0x0c, 0x14, 0xb1, 0xf5, 0x07, 0x08, 0x3c, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0xd1, 0x91, 0x07, 0x08, 0x02, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x0b, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0a, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0b, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x79, 0x08, 0x04, 0x00, 0x31, 0x08, 0x3c, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0c, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0d, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x1f, 0x00, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0e, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x10, 0x00, 0x79, 0x08, 0x0a, 0x00, 0x53, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x0f, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x50, 0x00, 0x59, 0x04, 0x0b, 0x0c, 0x51, 0xdf, 0x07, 0x08, 0x44, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x10, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0x09, 0xd9, 0x06, 0x08, 0x6d, 0x08, 0x50, 0x00, 0x50, 0x08, 0x18, 0x00, 0x59, 0x04, 0x0b, 0x0c, 0x51, 0xdf, 0x07, 0x08, 0x44, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x33, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x02, 0x04, 0x01, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x18, 0x04, 0x04, 0x08, 0x0e, 0x00, 0x17, 0x08, 0x30, 0x30, 0x05, 0x08, 0x20, 0x00, 0x03, 0x08, 0xe6, 0xff, 0x43, 0x04, 0x50, 0x08, 0x10, 0x00, 0x02, 0x04, 0x5c, 0x0c, 0x15, 0x11, 0x0c, 0x00, 0x59, 0x04, 0x50, 0x08, 0x18, 0x00, 0x44, 0x04, 0x03, 0x08, 0xcc, 0xff, 0x02, 0x04, 0x43, 0x04, 0x0b, 0x0c, 0xa5, 0xf9, 0x07, 0x08, 0x0b, 0x0c, 0x29, 0xdf, 0x07, 0x08, 0x7e, 0x04, 0x79, 0x08, 0x0b, 0x00, 0x64, 0x04, 0x0b, 0x0c, 0x45, 0xd9, 0x06, 0x08, 0x50, 0x08, 0x10, 0x00, 0x5c, 0x0c, 0x11, 0x11, 0x0c, 0x00, 0x50, 0x08, 0x18, 0x00, 0x67, 0x08, 0x80, 0x00, 0x0b, 0x0c, 0xa1, 0xd8, 0x06, 0x08, 0x75, 0x04, 0x05, 0x08, 0xfc, 0xff, 0x50, 0x08, 0x1f, 0x00, 0x59, 0x04, 0x47, 0x0c, 0x18, 0x2b, 0x01, 0x08, 0x0b, 0x0c, 0xa5, 0xd9, 0x06, 0x08, 0x79, 0x08, 0x08, 0x00, 0x31, 0x08, 0x78, 0x00, 0x7c, 0x08, 0x0e, 0x00, 0x01, 0x04, 0x4b, 0x04, 0x5f, 0x08, 0x12, 0x11, 0x02, 0x04, 0x59, 0x04, 0x28, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x79, 0x08, 0x06, 0x00, 0xff, 0xff -}; -/* +sub_0807E10C(sub_0807F3C8) sub_0807EAD0(0x1102,0x000c) sub_0807EA94() sub_0807E930(0x0020) sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E930(0x0021) -sub_0807E10C(0x0807f3c9) +sub_0807E10C(sub_0807F3C8) sub_0807EAD0(0x1103,0x000c) sub_0807EA94() sub_0807E930(0x0020) @@ -55,22 +45,22 @@ sub_0807E930(0x0020) sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E930(0x0022) -sub_0807E10C(0x0807f3c9) +sub_0807E10C(sub_0807F3C8) sub_0807EAD0(0x1106,0x000c) sub_0807EA94() sub_0807E930(0x001c) -sub_0807E10C(0x0806d96d) +sub_0807E10C(sub_0806D96C) // Ezlo Angry FX sub_0807EAD0(0x1107,0x000c) sub_0807EA94() sub_0807E930(0x0020) sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E930(0x0021) -sub_0807E10C(0x0807f3c9) +sub_0807E10C(sub_0807F3C8) // Ezlo Angry FX sub_0807EAD0(0x1108,0x000c) sub_0807EA94() sub_0807E930(0x001c) -sub_0807E10C(0x0806d96d) +sub_0807E10C(sub_0806D96C)// Ezlo Angry FX sub_0807EAD0(0x1109,0x000c) sub_0807EA94() sub_0807E930(0x0020) @@ -85,7 +75,7 @@ sub_0807E2E4() sub_0807E064(0xfff0) sub_0807E014() sub_0807E864() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E930(0x0010) sub_0807EAD0(0x1114,0x000c) sub_0807EA94() @@ -94,15 +84,15 @@ sub_0807E878() sub_0807E024(0xffd0) sub_0807E864() sub_0807E9DC() -sub_0807E124(0x0807f5b1,0x0000003c) -sub_0807E10C(0x080791d1) +sub_0807E124(sub_0807F5B0,0x0000003c) +sub_0807E10C(sub_080791D0) sub_0807E014() sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807EF80(0x000b) sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944)// Ezlo look at player sub_0807E930(0x0010) sub_0807EAD0(0x110a,0x000c) sub_0807EA94() @@ -134,7 +124,7 @@ sub_0807EAD0(0x110e,0x000c) sub_0807EA94() sub_0807E930(0x0018) sub_0807EBC0(0x0080) -sub_0807E10C(0x0806d909) +sub_0807E10C(sub_0806D908) sub_0807EC1C(0x0010) sub_0807EF80(0x000a) sub_0807E9D4() @@ -142,7 +132,7 @@ sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E014() sub_0807E004() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E2E4() sub_0807E050(0x000e) sub_0807E2A8(0x3030) @@ -158,24 +148,24 @@ sub_0807E878() sub_0807E024(0xffcc) sub_0807E014() sub_0807E864() -sub_0807E10C(0x0807f9a5) -sub_0807E10C(0x0807df29) +sub_0807E10C(sub_0807F9A4) +sub_0807E10C(sub_0807DF28) sub_0807EB8C() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E930(0x0010) sub_0807EAD0(0x110f,0x000c) sub_0807E930(0x0018) sub_0807EBC0(0x0080) -sub_0807E10C(0x0806d909) +sub_0807E10C(sub_0806D908) sub_0807EC1C(0x0050) sub_0807EA94() -sub_0807E10C(0x0807df51) +sub_0807E10C(sub_0807DF50) sub_0807E878() sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E014() sub_0807E004() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E2E4() sub_0807E050(0x000e) sub_0807E2A8(0x3030) @@ -191,25 +181,25 @@ sub_0807E878() sub_0807E024(0xffcc) sub_0807E014() sub_0807E864() -sub_0807E10C(0x0807f9a5) -sub_0807E10C(0x0807df29) +sub_0807E10C(sub_0807F9A4) +sub_0807E10C(sub_0807DF28) sub_0807EB8C() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E930(0x0010) sub_0807EAD0(0x1110,0x000c) sub_0807E930(0x0018) sub_0807EBC0(0x0080) -sub_0807E10C(0x0806d909) +sub_0807E10C(sub_0806D908) sub_0807EC1C(0x0050) sub_0807E930(0x0018) sub_0807EA94() -sub_0807E10C(0x0807df51) +sub_0807E10C(sub_0807DF50) sub_0807E878() sub_0807E5F8(0x00000008) sub_0807E6AC(0x00000004) sub_0807E014() sub_0807E004() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E2E4() sub_0807E050(0x000e) sub_0807E2A8(0x3030) @@ -225,157 +215,32 @@ sub_0807E878() sub_0807E024(0xffcc) sub_0807E014() sub_0807E864() -sub_0807E10C(0x0807f9a5) -sub_0807E10C(0x0807df29) +sub_0807E10C(sub_0807F9A4) +sub_0807E10C(sub_0807DF28) sub_0807EFE4() sub_0807EF80(0x000b) sub_0807EB8C() -sub_0807E10C(0x0806d945) +sub_0807E10C(sub_0806D944) // Ezlo look at player sub_0807E930(0x0010) sub_0807EAD0(0x1111,0x000c) sub_0807E930(0x0018) sub_0807EBC0(0x0080) -sub_0807E10C(0x0806d8a1) +sub_0807E10C(sub_0806D8A0) sub_0807EE30() sub_0807E064(0xfffc) sub_0807E930(0x001f) sub_0807EA94() sub_0807E8C4(0x08012b18) -sub_0807E10C(0x0806d9a5) +sub_0807E10C(sub_0806D9A4) sub_0807EF80(0x0008) sub_0807E680(0x0078) sub_0807EFAC(0x000e) sub_0807E004() -sub_0807E8E4() +sub_0807E8E4_2() sub_0807EB28(0x1112) sub_0807E014() sub_0807EA94() sub_0807E5F8(0x00000008) sub_0807EF80(0x0006) -0xffff, -0x0402, -0x0861, -0x0002, -0x0831, -0x000a, -0x0861, -0x0006, -0x0831, -0x000a, -0x0803, -0xffee, -0x0000, -0x0401, -0x0867, -0x0080, -0x0402, -0x0861, -0x0000, -0x0879, -0x0000, -0x0879, -0x0004, -0x0831, -0x003c, -0x0c28, -0x0001, -0x0000, -0x0c0b, -0x91bd, -0x0807, -0xffff, -0x0000, -0x0401, -0x0867, -0x0100, -0x0402, -0x0879, -0x0001, -0x0c73, -0x0388, -0x0180, -0x0861, -0x0000, -0x0879, -0x0000, -0x0c28, -0x0001, -0x0000, -0x0c0b, -0x91bd, -0x0807, -0xffff, -0x0879, -0x0015, -0x0c0b, -0x91bd, -0x0807, -0xffff, -0x0401, -0x0867, -0x0100, -0x0861, -0x0004, -0x0402, -0x0879, -0x0001, -0x0870, -0x0008, -0x0c28, -0x0002, -0x0000, -0x140c, -0xfb65, -0x0807, -0xffe2, -0xffff, -0x0c0b, -0x91bd, -0x0807, -0xffff, -0x0401, -0x0867, -0x0100, -0x0861, -0x0000, -0x0402, -0x0879, -0x0001, -0x086e, -0x0008, -0x0c28, -0x0002, -0x0000, -0x140c, -0xfb65, -0x0807, -0xffe2, -0xffff, -0x0c0b, -0x91bd, -0x0807, -0xffff, -0x0401, -0x0867, -0x0100, -0x0861, -0x0002, -0x0402, -0x0879, -0x0001, -0x086f, -0x0008, -0x0c28, -0x0002, -0x0000, -0x140c, -0xfb65, -0x0807, -0xffe2, -0xffff, -0x0c0b, -0x91bd, -0x0807, -0xffff -END_SCRIPT()*/ +END_SCRIPT() // clang-format on \ No newline at end of file diff --git a/tools/script_disassembler/script_disassembler.py b/tools/script_disassembler/script_disassembler.py index 39390241..62f85f4c 100644 --- a/tools/script_disassembler/script_disassembler.py +++ b/tools/script_disassembler/script_disassembler.py @@ -120,10 +120,10 @@ commands = [ {'fun': 'sub_0807E898'}, {'fun': 'sub_0807E8C4', 'params': 'w'}, {'fun': 'sub_0807E8D4'}, - {'fun': 'sub_0807E8E4', 'params': ''}, - {'fun': 'sub_0807E8E4', 'params': ''}, - {'fun': 'sub_0807E8E4', 'params': ''}, - {'fun': 'sub_0807E8E4', 'params': ''}, + {'fun': 'sub_0807E8E4_0', 'params': ''}, # duplicate + {'fun': 'sub_0807E8E4_1', 'params': ''}, # duplicate + {'fun': 'sub_0807E8E4_2', 'params': ''}, # duplicate + {'fun': 'sub_0807E8E4_3', 'params': ''}, # duplicate {'fun': 'sub_0807E908'}, {'fun': 'sub_0807E914'}, {'fun': 'sub_0807E924'}, @@ -199,25 +199,25 @@ parameters = { 's': { 'length': 1, 'param': 's', - 'expr': 's,', + 'expr': 'asm(".short " #s);', 'read': lambda ctx: barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+4])[0] }, 'w': { 'length': 2, 'param': 'w', - 'expr': 'WORD_TO_SHORTS(w),', + 'expr': 'asm(".word " #w);', 'read': lambda ctx: barray_to_u32_hex(ctx.data[ctx.ptr+2:ctx.ptr+6])[0] }, 'ss': { 'length': 2, 'param': 'a,b', - 'expr': 'a,b,', + 'expr': 'asm(".short " #a);asm(".short " #b);', 'read': lambda ctx: ','.join(barray_to_u16_hex(ctx.data[ctx.ptr+2:ctx.ptr+6])) }, 'ww': { 'length': 4, 'param': 'a,b', - 'expr': 'WORD_TO_SHORTS(a), WORD_TO_SHORTS(b),', + 'expr': 'asm(".word " #a);asm(".word " #b);', 'read': lambda ctx: ','.join(barray_to_u32_hex(ctx.data[ctx.ptr+2:ctx.ptr+10])) }, } @@ -276,9 +276,9 @@ def generate_macros(): print('#ifndef SCRIPT_MACROS_H') print('#define SCRIPT_MACROS_H') print('// Generated by disassemble_script.py') - print('#define START_SCRIPT(name) const unsigned short name[] = {') - print('#define END_SCRIPT() };') - print('#define WORD_TO_SHORTS(word) (unsigned short)word & 0xffff,(unsigned short)word >> 16') + print('#define START_SCRIPT(name) asm(".globl "#name); asm(".section .rodata"); asm(#name":");') + print('#define END_SCRIPT()') + #print('#define WORD_TO_SHORTS(word) (unsigned short)word & 0xffff,(unsigned short)word >> 16') print('') for num, command in enumerate(commands): if not 'params' in command: @@ -289,7 +289,7 @@ def generate_macros(): params = parameters[command['params']] id = ((params['length']+1) << 0xA) + num - print('#define ' + command['fun'] + '(' + params['param'] + ') '+u16_to_hex(id)+', ' + params['expr']) + print('#define ' + command['fun'] + '(' + params['param'] + ') asm(".short '+u16_to_hex(id)+'");' + params['expr']) print ('#endif')