Goemon's Great Adventure notes --------------------------- file 0x00C 5E66B8.bin global object module table file 0x00D 5E8AB8.bin global level module table file 0x00E 5EA1E8.bin global level models & collision(?) table file 0x0C2 6B29E8.bin "EDO 1-1" level module file 0x18E 71679A.bin "EDO 1-1" level model table file 0x352 C89FEA.bin "EDO 1-1" level collision? --------------------------- Level loading routine (Level 0x14, "EDO 1-1") Level entry struct from file 0x0D (5E8AB8.bin+0xF0) 08000D64 08000000 000000C2 // struct for "EDO 1-1", references file 0x0C2 struct LevelEntry { void* szName; // ascii name of level, also contained in file 0x0D void* szUnk04; int fileIndex; // index of level module file in "Nisitenma-Ichigo" table }; Level module is loaded, TLB mapped to 0x08000000, and executed (file 0xC2 for "EDO 1-1", 6B29E8.bin) Level modules contain code and object placement lists. The "EDO 1-1" module code calls the following function to initialise the level models/collision(?), player starting position, and object placements. func_800DC25C( int a0 = 0x01 // level models/collision, index of file 0x0E (5EA1E8.bin) int a1 = 0x01 // ? affects goemon's starting position f32 a2 = 0x43160000 // goemon's initial X position f32 a3 = 0x41A00000 // goemon's initial Y position f32 sp10 = 0x00000000 // goemon's initial Z position void *sp14 = 0x08000214 // offset of module's object placement list s32 sp18 = 0x00000087 // number of placements void *sp1C = 0x08000A84 // offset of more placements? s32 sp20 = 0x00000018 // ? ); Arguments passed to this function are hardcoded in the level module's assembly. File 0xC2's object placement list (6B29E8.bin+0x214): struct ObjectPlacement { s16 unk00; s16 x; s16 y; s16 z; s16 objectId; s16 unk0A; s32 unk0C; }; unk x y z objectId unk unk 0000 0000 0000 0000 0237 0000 00000000 0000 0000 0000 0000 00DE 0000 00000000 0000 0000 0000 0000 00DA 0000 00000000 0000 0000 0000 0000 0206 0000 00000000 0000 0000 0000 0000 00DC 0000 00000000 0000 0000 0000 0000 0204 0000 00000000 0000 0000 0000 0000 00E3 0000 00000000 0000 0000 0000 0000 00E6 0000 00000000 ... The object ID field indexes the object module table in file 0x0C (5E66B8.bin) Object definition table in file 0x0C (5E66B8.bin): struct ObjectDefinition { void *unk00; s32 unk04; s16 unk06; // todo check types s16 fileId; s32 unk0C; // todo check types }; unk unk unk fileId unk 0237: 08000000 010100BA 0000 00B2 01070700 // Object 0x237 -> file 0xB2 object module 00DE: 080009A8 01000125 0000 005D 01070700 // Object 0x0DE -> file 0x5D object module 00DA: 08000FD4 01000122 0000 0053 01070700 // ... 0206: 08000DF4 01000122 0000 0054 01070700 00DC: 0800014C 01000005 0000 0058 02070700 0204: 080002B0 0101005B 0000 0096 01070700 00E3: 08000160 0100003A 0000 004F 02070700 00E6: 08001290 01000000 0000 004E 01070700 ... Entry 0x01 in file 0x0E (5EA1E8.bin+0x60): ... 00000352 // ? file 0x352 (C89FEA.bin), maybe collision related 0000018E // model table, file 0x18E (71679A.bin) 0301DA9C // offset of something in file 0x352 0301B9FC // offset of something in file 0x352 0031 0000 03000000 // num vec3f's, offset of vec3f's in file 0x352 0031 0000 03000264 // num vec3f's, offset of vec3f's in file 0x352 0031 0000 030004C8 // num vec3f's, offset of vec3f's in file 0x352 00000000 // unknown 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ... File 0x352 (C89FEA.bin), EDO 1-1 collision? 00000: vec3f's 00264: vec3f's 004C8: vec3f's 0072C: probably padding bytes 00730: array of some struct, 0x28 bytes each 11DC8: ? 1566C: ? 1B9FC: a header (references 0301566C, 03011DC8, 03000730) 1BA30: ? 1C5BC: ? 1DA40: ? 1DA9C: a header (references 0301C5BC 0301BA30 0301DAE0 0301DA40) 1DAE0: ? Model table, file 0x18E (71679A.bin): struct Model { void *displayList s16 unk02; s16 modelFileId; s16 otherFileIds[10]; }; dlist unk modelFileId otherFileIds 00000000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 03000390 0000 0369 0324 0000 0000 0000 0000 0000 0000 0000 0000 0000 03000160 0000 036A 0325 0326 0000 0000 0000 0000 0000 0000 0000 0000 03000330 0000 036B 0325 0326 0000 0000 0000 0000 0000 0000 0000 0000 03000220 0000 036C 0325 0326 0000 0000 0000 0000 0000 0000 0000 0000 03000190 0000 036D 0325 0326 0000 0000 0000 0000 0000 0000 0000 0000 03000190 0000 036E 0325 0326 0000 0000 0000 0000 0000 0000 0000 0000 03000340 0000 0353 0324 0327 0000 0000 0000 0000 0000 0000 0000 0000 030004C0 0000 0354 0324 0327 0328 0000 0000 0000 0000 0000 0000 0000 03000240 0000 036F 0324 0327 0000 0000 0000 0000 0000 0000 0000 0000 ... --------------------------- func_800DB6A0(int levelIndex); // load level func_800DB7C8(int index, void *dst) // get model entry from file 0x0E func_80003E04(int fileIndex, void *dst) // load file func_80003E50(int fileIndex, void *dst) // load file func_80001CF8(s32 romOffset, void *dst, s32 size) // DMA copy func_8001ABB0(void *dst, void *src, u32 size) // memcpy --------------------------------- RAM state while in "Lost'n Road" level, first area 80222030 / 030005D8 level model display list around here 800500D8 master dlist 0 800600D8 master dlist 1 800700D8 master dlist 2 80108BE0 HUD display list 80221A58 RSP segment 03 (level model vertex data, dlist) 801F31D8 RSP segment 04 801F41E8 RSP segment 05 80219C48 RSP segment 06 8021BC68 RSP segment 07 802B0210 RSP segment 03 (goemon) 8031BBD0 RSP segment 04 (goemon model vertex data, dlist, image data, light colors) 803185E0 RSP segment 06 803185E0 RSP segment 07 --------------------------------- player stats structure (P1 at 80088282, P2 at 8008828C) struct PlayerStats { /*0x00*/ s8 characterId; // 00: Goemon, 01: Ebisumaru, 02: Sasuke, 03: Yae, FF: None /*0x01*/ s8 numLives; // HUD shows this minus 1 /*0x02*/ s8 numHealthPoints; /*0x03*/ s8 numShieldPoints; /*0x04*/ s16 numCoins; /*0x06*/ s8 unk06; /*0x07*/ s8 weaponId; // May be 00, 01, 02 /*0x08*/ s8 foodId; // 00: None, 01: Rice balls, 02: Plum rice balls, 03: Fish rice balls /*0x09*/ u8 unk09; }; -------------------- player structure (about 0x284 bytes) (P1 at 80170998) 0x000 u32 ? player object starts moving around on its own if set to 4 ... 0x008 u32 current action ID ... 0x01C u32 previous action ID 0x020 u32 timer for "impatient" animations 0x024 u32 time since entering room ... 0x048 u16 controller button flags ... 0x050 f32 X position 0x054 f32 Y position 0x058 f32 Z position ... 0x160 u32 invincibility timer 0x164 u32 other invincibility timer? ... 0x220 f32 animation speed ... ---------------------- Player action IDs 00000000 idle 00000001 run 00000002 run 00000003 run 00000004 run 00000005 crawl 00000006 begin prone 00000007 end prone 00000008 prone 0000000E begin jump 0000000F fall 00000010 jump 00000012 land 0000002B dying 00000030 getting hurt 00000031 getting hurt 2 00000034 swing pipe 00000035 swing pipe midair 00000037 swing pipe up 00000038 swing pipe up midair 0000003B swing pipe while prone 00000070 impatient (tapping foot) 00000071 impatient (twirling pipe) 00000079 exhausted 000000C2 "naruto pose" 000000C5 "naruto run" 000000CA begin npc dialog 000000CB idle on horse 000000CD horse kick 000000D7 npc dialog ----------- active object struct (0x80 bytes) (eg: 80170CF8) /*0x00*/ u16 gfx flags? (object is invisible if 2's bit is 0) /*0x02*/ u8 ? /*0x03*/ ? /*0x04*/ ? /*0x08*/ void* object (prev?) /*0x0C*/ void* object (next?) /*0x10*/ void* object /*0x14*/ void* object /*0x18*/ s32 ? /*0x1C*/ func* native func (sometimes a TLB address) /*0x20*/ s8 behavior phase /*0x21*/ s8 link state? /*0x22*/ ? /*0x23*/ ? /*0x24*/ void* ? /*0x28*/ u8 ? /*0x29*/ s8 ? /*0x2A*/ u8 ? /*0x2B*/ ? /*0x2C*/ void* pointer to secondary object struct (eg: 801BE0F0) /*0x30*/ f32 X position /*0x34*/ f32 Y position /*0x38*/ f32 Z position /*0x3C*/ f32 X rotation /*0x40*/ f32 Y rotation /*0x44*/ f32 Z rotation /*0x48*/ f32 X speed /*0x4C*/ f32 Y speed /*0x50*/ f32 Z speed /*0x54*/ void* pointer to secondary object struct? /*0x58*/ void* pointer to secondary object struct? /*0x5C*/ void* pointer to secondary object struct? /*0x60*/ ? /*0x64*/ ? /*0x68*/ s32 ? some flags /*0x6C*/ ? /*0x70*/ to 0x7F ? secondary active object struct (0x60 bytes) /*0x00*/ u16 ? /*0x02*/ u16 ? /*0x04*/ void* pointer to secondary object struct /*0x08*/ s32 ? /*0x0C*/ void* pointer to secondary object struct /*0x10*/ s32 ? /*0x14*/ f32 Z position /*0x18*/ f32 Y position /*0x1C*/ f32 X position /*0x20*/ f32 Z rotation? /*0x24*/ f32 Y rotation /*0x28*/ f32 X rotation? /*0x2C*/ f32 Z scale? /*0x30*/ f32 Y scale /*0x34*/ f32 X scale? /*0x38*/ u16 ? /*0x3A*/ ? /*0x3B*/ ? /*0x3C*/ f32 animation phase /*0x40*/ s32 ? /*0x44*/ s32 ? /*0x48*/ void* animation and/or vertex data? /*0x4C*/ void* image data /*0x50*/ to 0x5F ?