diff --git a/include/scriptMacros.h b/include/scriptMacros.h new file mode 100644 index 00000000..0663059d --- /dev/null +++ b/include/scriptMacros.h @@ -0,0 +1,54 @@ +#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 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 diff --git a/src/scripts/ezlo_angry.c b/src/scripts/ezlo_angry.c index 38cb04b0..b841a754 100644 --- a/src/scripts/ezlo_angry.c +++ b/src/scripts/ezlo_angry.c @@ -1,14 +1,381 @@ -#define START_SCRIPT(name) const unsigned short name[] = { -#define END_SCRIPT() \ - } \ - ; +#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 };*/ // 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 -END_SCRIPT() - // clang-format on \ No newline at end of file +//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) +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_0807EAD0(0x1102,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0021) +sub_0807E10C(0x0807f3c9) +sub_0807EAD0(0x1103,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807EF80(0x0004) +sub_0807E680(0x003c) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807EF80(0x0011) +sub_0807E930(0x001c) +sub_0807EAD0(0x1105,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0022) +sub_0807E10C(0x0807f3c9) +sub_0807EAD0(0x1106,0x000c) +sub_0807EA94() +sub_0807E930(0x001c) +sub_0807E10C(0x0806d96d) +sub_0807EAD0(0x1107,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0021) +sub_0807E10C(0x0807f3c9) +sub_0807EAD0(0x1108,0x000c) +sub_0807EA94() +sub_0807E930(0x001c) +sub_0807E10C(0x0806d96d) +sub_0807EAD0(0x1109,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807EF80(0x000a) +sub_0807E9D4() +sub_0807E5F8(0x00000008) +sub_0807E014() +sub_0807E004() +sub_0807E260(0x0000) +sub_0807E050(0x0028) +sub_0807E2E4() +sub_0807E064(0xfff0) +sub_0807E014() +sub_0807E864() +sub_0807E10C(0x0806d945) +sub_0807E930(0x0010) +sub_0807EAD0(0x1114,0x000c) +sub_0807EA94() +sub_0807E930(0x0020) +sub_0807E878() +sub_0807E024(0xffd0) +sub_0807E864() +sub_0807E9DC() +sub_0807E124(0x0807f5b1,0x0000003c) +sub_0807E10C(0x080791d1) +sub_0807E014() +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807EF80(0x000b) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E10C(0x0806d945) +sub_0807E930(0x0010) +sub_0807EAD0(0x110a,0x000c) +sub_0807EA94() +sub_0807E930(0x001f) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0010) +sub_0807EAD0(0x110b,0x000c) +sub_0807EA94() +sub_0807E930(0x001f) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807EF80(0x0004) +sub_0807E680(0x003c) +sub_0807E930(0x0010) +sub_0807EAD0(0x110c,0x000c) +sub_0807EA94() +sub_0807E930(0x001f) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0010) +sub_0807EAD0(0x110d,0x000c) +sub_0807EA94() +sub_0807E930(0x001f) +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E930(0x0010) +sub_0807EAD0(0x110e,0x000c) +sub_0807EA94() +sub_0807E930(0x0018) +sub_0807EBC0(0x0080) +sub_0807E10C(0x0806d909) +sub_0807EC1C(0x0010) +sub_0807EF80(0x000a) +sub_0807E9D4() +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E014() +sub_0807E004() +sub_0807E10C(0x0806d945) +sub_0807E2E4() +sub_0807E050(0x000e) +sub_0807E2A8(0x3030) +sub_0807E064(0x0020) +sub_0807E024(0xffe6) +sub_0807E864() +sub_0807E930(0x0010) +sub_0807E014() +sub_0807EAD0(0x1115,0x000c) +sub_0807EA94() +sub_0807E930(0x0018) +sub_0807E878() +sub_0807E024(0xffcc) +sub_0807E014() +sub_0807E864() +sub_0807E10C(0x0807f9a5) +sub_0807E10C(0x0807df29) +sub_0807EB8C() +sub_0807E10C(0x0806d945) +sub_0807E930(0x0010) +sub_0807EAD0(0x110f,0x000c) +sub_0807E930(0x0018) +sub_0807EBC0(0x0080) +sub_0807E10C(0x0806d909) +sub_0807EC1C(0x0050) +sub_0807EA94() +sub_0807E10C(0x0807df51) +sub_0807E878() +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E014() +sub_0807E004() +sub_0807E10C(0x0806d945) +sub_0807E2E4() +sub_0807E050(0x000e) +sub_0807E2A8(0x3030) +sub_0807E064(0x0020) +sub_0807E024(0xffe6) +sub_0807E864() +sub_0807E930(0x0010) +sub_0807E014() +sub_0807EAD0(0x1115,0x000c) +sub_0807EA94() +sub_0807E930(0x0018) +sub_0807E878() +sub_0807E024(0xffcc) +sub_0807E014() +sub_0807E864() +sub_0807E10C(0x0807f9a5) +sub_0807E10C(0x0807df29) +sub_0807EB8C() +sub_0807E10C(0x0806d945) +sub_0807E930(0x0010) +sub_0807EAD0(0x1110,0x000c) +sub_0807E930(0x0018) +sub_0807EBC0(0x0080) +sub_0807E10C(0x0806d909) +sub_0807EC1C(0x0050) +sub_0807E930(0x0018) +sub_0807EA94() +sub_0807E10C(0x0807df51) +sub_0807E878() +sub_0807E5F8(0x00000008) +sub_0807E6AC(0x00000004) +sub_0807E014() +sub_0807E004() +sub_0807E10C(0x0806d945) +sub_0807E2E4() +sub_0807E050(0x000e) +sub_0807E2A8(0x3030) +sub_0807E064(0x0020) +sub_0807E024(0xffe6) +sub_0807E864() +sub_0807E930(0x0010) +sub_0807E014() +sub_0807EAD0(0x1115,0x000c) +sub_0807EA94() +sub_0807E930(0x0018) +sub_0807E878() +sub_0807E024(0xffcc) +sub_0807E014() +sub_0807E864() +sub_0807E10C(0x0807f9a5) +sub_0807E10C(0x0807df29) +sub_0807EFE4() +sub_0807EF80(0x000b) +sub_0807EB8C() +sub_0807E10C(0x0806d945) +sub_0807E930(0x0010) +sub_0807EAD0(0x1111,0x000c) +sub_0807E930(0x0018) +sub_0807EBC0(0x0080) +sub_0807E10C(0x0806d8a1) +sub_0807EE30() +sub_0807E064(0xfffc) +sub_0807E930(0x001f) +sub_0807EA94() +sub_0807E8C4(0x08012b18) +sub_0807E10C(0x0806d9a5) +sub_0807EF80(0x0008) +sub_0807E680(0x0078) +sub_0807EFAC(0x000e) +sub_0807E004() +sub_0807E8E4() +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()*/ +// 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 new file mode 100644 index 00000000..39390241 --- /dev/null +++ b/tools/script_disassembler/script_disassembler.py @@ -0,0 +1,306 @@ +from dataclasses import dataclass +import struct + +# Disassembler for tmc scripts +# Input 'macros' to generate the macros for the script commands +# Input the script bytes as hex to disassemble the script + +@dataclass +class Context: + ptr: int + data: bytes + +def u16_to_hex(value): + return '0x' + (struct.pack('>H', value).hex()) + +def barray_to_u16_hex(barray): + count = len(barray)//2 + integers = struct.unpack('H'*count, barray) + return [u16_to_hex(x) for x in integers] + +def u32_to_hex(value): + return '0x' + (struct.pack('>I', value).hex()) + +def barray_to_u32_hex(barray): + count = len(barray)//4 + integers = struct.unpack('I'*count, barray) + return [u32_to_hex(x) for x in integers] + +""" +def GetNextScriptCommandWordAfterCommandMetadata(ctx): + return struct.unpack('I', ctx.data[ctx.ptr+2:ctx.ptr+6])[0] + + +def sub_0807E10C(ctx): + meta = GetNextScriptCommandWordAfterCommandMetadata(ctx) + print('function', hex(meta)) + + +def sub_0807E5F8(ctx): + curPtr = start + ctx.ptr + print('current', hex(curPtr)) + # gUnk_02033280.unk_00 |= GetNextScriptCommandWordAfterCommandMetadata(unk2->unk_00.raw); + meta = GetNextScriptCommandWordAfterCommandMetadata(ctx) + print('meta', meta) + newPtr = curPtr | meta + print('Start next script at: ', hex(newPtr)) +""" + +commands = [ + {'fun': 'nullsub_507', 'params': ''}, + {'fun': 'sub_0807E004', 'params': '', 'name': 'start executing scripts'}, + {'fun': 'sub_0807E014', 'params': '', 'name': 'stop executing scripts'}, + {'fun': 'sub_0807E024', 'params': 's', 'name': 'jump by offset'}, + {'fun': 'sub_0807E050', 'params': 's', 'name': 'jump if'}, + {'fun': 'sub_0807E064', 'params': 's', 'name': 'jump if not'}, + {'fun': 'sub_0807E078', 'params': 's'}, + {'fun': 'sub_0807E0A0', 'params': 'w','name': 'abs jump' }, + {'fun': 'sub_0807E0B8', 'params': 'w', 'name': 'abs jump if'}, + {'fun': 'sub_0807E0CC', 'params': 'w', 'name': 'abs jump if not'}, + {'fun': 'sub_0807E0E0', 'params': 'w'}, + {'fun': 'sub_0807E10C', 'params':'w', 'name': 'Execute function via pointer'},# 'exec': sub_0807E10C}, + {'fun': 'sub_0807E124', 'params': 'ww'}, + {'fun': 'sub_0807E148', 'params': 'w'}, + {'fun': 'sub_0807E158', 'params': 'w'}, + {'fun': 'sub_0807E188', 'params': 's'}, + {'fun': 'sub_0807E1D8', 'params': 's'}, + {'fun': 'sub_0807E4AC', 'params': 's'}, + {'fun': 'sub_0807E200'}, + {'fun': 'sub_0807E220'}, + {'fun': 'sub_0807E240'}, + {'fun': 'sub_0807E260', 'params': 's'}, + {'fun': 'sub_0807E280'}, + {'fun': 'sub_0807E2A8', 'params': 's'}, + {'fun': 'sub_0807E2E4', 'params': ''}, + {'fun': 'sub_0807E30C'}, + {'fun': 'sub_0807E390'}, + {'fun': 'sub_0807E3BC'}, + {'fun': 'sub_0807E3E8'}, + {'fun': 'sub_0807E40C'}, + {'fun': 'sub_0807E42C'}, + {'fun': 'sub_0807E48C'}, + {'fun': 'sub_0807E4CC'}, + {'fun': 'sub_0807E4EC'}, + {'fun': 'sub_0807E514'}, + {'fun': 'sub_0807E538'}, + {'fun': 'sub_0807E564'}, + {'fun': 'sub_0807E584'}, + {'fun': 'sub_0807E5A0'}, + {'fun': 'sub_0807E5CC'}, + {'fun': 'sub_0807E5F8', 'params': 'w'},# 'exec': sub_0807E5F8}, + {'fun': 'sub_0807E610'}, + {'fun': 'sub_0807E628'}, + {'fun': 'sub_0807E634'}, + {'fun': 'sub_0807E644'}, + {'fun': 'sub_0807E650'}, + {'fun': 'sub_0807E65C'}, + {'fun': 'sub_0807E668'}, + {'fun': 'sub_0807E674'}, + {'fun': 'sub_0807E680', 'params': 's'}, + {'fun': 'sub_0807E690'}, + {'fun': 'sub_0807E6AC', 'params': 'w'}, + {'fun': 'sub_0807E6DC'}, + {'fun': 'sub_0807E700'}, + {'fun': 'sub_0807E72C'}, + {'fun': 'sub_0807E75C'}, + {'fun': 'sub_0807E778'}, + {'fun': 'sub_0807E788'}, + {'fun': 'sub_0807E79C'}, + {'fun': 'nullsub_508'}, + {'fun': 'sub_0807E7B0'}, + {'fun': 'sub_0807E7C4'}, + {'fun': 'sub_0807E7D8'}, + {'fun': 'sub_0807E7EC'}, + {'fun': 'sub_0807E800'}, + {'fun': 'sub_0807E80C'}, + {'fun': 'sub_0807E858'}, + {'fun': 'sub_0807E864', 'params': ''}, + {'fun': 'sub_0807E878', 'params': ''}, + {'fun': 'sub_0807E888'}, + {'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_0807E908'}, + {'fun': 'sub_0807E914'}, + {'fun': 'sub_0807E924'}, + {'fun': 'sub_0807E930', 'params': 's'}, + {'fun': 'sub_0807E944'}, + {'fun': 'sub_0807E974'}, + {'fun': 'sub_0807E9D4', 'params': ''}, + {'fun': 'sub_0807E9DC', 'params': ''}, + {'fun': 'sub_0807E9E4'}, + {'fun': 'sub_0807E9F0'}, + {'fun': 'sub_0807EA4C'}, + {'fun': 'sub_0807EA88'}, + {'fun': 'sub_0807EA94', 'params': ''}, + {'fun': 'sub_0807EAB4'}, + {'fun': 'sub_0807EAC0'}, + {'fun': 'sub_0807EAD0', 'params': 'ss'}, + {'fun': 'sub_0807EAF0'}, + {'fun': 'sub_0807EB18'}, + {'fun': 'sub_0807EB28', 'params': 's'}, + {'fun': 'sub_0807EB38'}, + {'fun': 'sub_0807EB44'}, + {'fun': 'sub_0807EB4C'}, + {'fun': 'sub_0807EB74'}, + {'fun': 'sub_0807EB8C', 'params': ''}, + {'fun': 'sub_0807EBA8'}, + {'fun': 'sub_0807EBB0'}, + {'fun': 'sub_0807EBC0', 'params': 's'}, + {'fun': 'sub_0807EBC8'}, + {'fun': 'sub_0807EBD8'}, + {'fun': 'sub_0807EBF4'}, + {'fun': 'sub_0807EC08'}, + {'fun': 'nullsub_509'}, + {'fun': 'sub_0807EC1C', 'params': 's'}, + {'fun': 'sub_0807EC64'}, + {'fun': 'sub_0807EC94'}, + {'fun': 'sub_0807ECC4'}, + {'fun': 'sub_0807ECF4'}, + {'fun': 'sub_0807ED24'}, + {'fun': 'sub_0807EDD4'}, + {'fun': 'sub_0807EE04'}, + {'fun': 'sub_0807EE30', 'params': ''}, + {'fun': 'sub_0807EEB4'}, + {'fun': 'sub_0807EEF4'}, + {'fun': 'sub_0807EF3C'}, + {'fun': 'sub_0807EF80', 'params': 's'}, + {'fun': 'sub_0807EF90'}, + {'fun': 'sub_0807EFA0'}, + {'fun': 'sub_0807EFAC', 'params': 's'}, + {'fun': 'sub_0807EFD4'}, + {'fun': 'sub_0807EFE4', 'params': ''}, + {'fun': 'sub_0807EFF4'}, + {'fun': 'sub_0807F004'}, + {'fun': 'sub_0807F010'}, + {'fun': 'sub_0807F034'}, + {'fun': 'sub_0807F050'}, + {'fun': 'sub_0807F060'}, + {'fun': 'sub_0807F078'}, + {'fun': 'sub_0807F088'}, + {'fun': 'sub_0807F098'}, + {'fun': 'sub_0807F0A4'}, + {'fun': 'sub_0807F0B4'}, + {'fun': 'sub_0807F0C8'} +] + +# definitions for parameters +parameters = { + '': { + 'length':0, + 'param': '', + 'expr': '', + 'read': lambda ctx: '' + }, + 's': { + 'length': 1, + 'param': 's', + 'expr': '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),', + '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,', + '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),', + 'read': lambda ctx: ','.join(barray_to_u32_hex(ctx.data[ctx.ptr+2:ctx.ptr+10])) + }, +} + + +def ExecuteScriptCommandSet(ctx: Context): + cmd = struct.unpack('H', ctx.data[ctx.ptr:ctx.ptr+2])[0] + if cmd == 0 or cmd ==0xffff: + return 0 + + unk_06 = cmd >> 0xA + operationId = cmd & 0x3FF + #print(cmd) + #print('advance by', unk_06) + #print('command id', operationId) + command = commands[operationId] + #print(command) + param_length = unk_06 - 1 + if unk_06 > 1: + meta = struct.unpack( + 'H'*(unk_06-1), ctx.data[ctx.ptr+2:ctx.ptr+2*unk_06]) + #print('meta', meta) + + # Handle parameters + if not 'params' in command: + raise Exception('Parameters not defined for ' + command['fun'] + ' Should be of length ' + str(param_length)) + if not command['params'] in parameters: + raise Exception('Parameter configuration ' + command['params'] + ' not defined') + params = parameters[command['params']] + if unk_06-1 != params['length']: + raise Exception('Call with ' + (unk_06-1) +' length, while length of ' + params['length']+' defined') + + + print(command['fun'] + '(' + params['read'](ctx) + ')') + + # Execute script + ctx.ptr += unk_06*2 + return 1 + + +def disassemble_script(input_data): + input_bytes = bytearray.fromhex(input_data) + + ctx = Context(0, input_bytes) + + while True: + if not ExecuteScriptCommandSet(ctx): + break + + + # Print rest (did not manage to get there) + + print(',\n'.join(barray_to_u16_hex(ctx.data[ctx.ptr:]))) + +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('') + for num, command in enumerate(commands): + if not 'params' in command: + #raise Exception('Parameters not defined for ' + command['fun'] + ' Should be of length ' + str(param_length)) + continue # TODO + if not command['params'] in parameters: + raise Exception('Parameter configuration ' + command['params'] + ' not defined') + + params = parameters[command['params']] + id = ((params['length']+1) << 0xA) + num + print('#define ' + command['fun'] + '(' + params['param'] + ') '+u16_to_hex(id)+', ' + params['expr']) + + print ('#endif') + +def main(): + + # Read input + input_data = input() + + if input_data.strip() == 'macros': + generate_macros() + return + disassemble_script(input_data) + +main() \ No newline at end of file