incremental clean-up, more function names

This commit is contained in:
mzxrules
2022-08-19 22:46:52 -04:00
parent 1da0fa1ac5
commit a65750c33a
9 changed files with 889 additions and 689 deletions
+12 -5
View File
@@ -6,7 +6,14 @@
/* z_map_data */
#define MAPDATA_SOURCE_MAP_I_STATIC 1
#define MAPDATA_MID_GAMEPLAY_DANGEON_KEEP 0
#define MAPDATA_MID_GRAND_MAP_STATIC 1
#define MAPDATA_MID_MAP_I_STATIC 2
#define MAPDATA_CPID_GRAND_MAP_STATIC 0
#define MAPDATA_CPID_MAP_I_STATIC 1
#define MAPDATA_CPID_2 2
typedef struct {
/* 0x00 */ TexturePtr lmapTex; //minimap texture
@@ -17,7 +24,7 @@ typedef struct {
/* 0x08 */ u8 unk8;
/* 0x09 */ u8 unk9;
/* 0x0A */ s16 unkA;
} T_801BED4C; // size 0x0C?
} T_801BED4C; // size 0x0C
typedef struct {
u8 unk0;
@@ -94,13 +101,13 @@ TexturePtr func_8010958C(s32);
s16 func_80109F78(s32);
s32 func_80109BA0(s32);
s32 func_80109714(s32);
s32 MapData_GetIMapSize(s32);
s32 MapData_GetMapSize(s32);
s32 func_80109A98(s32);
s32 func_80109AD8(s32);
s32 func_801096D4(s32 arg0);
void func_8010983C(s32 arg0, s32 *arg1);
void func_801097C8(s32 arg0, s32* arg1, s32* arg2);
void func_80109754(s32 arg0, s32 *arg1, s32 *arg2);
void func_801097C8(s32 arg0, s32* arg1, s32* arg2);
void MapData_GetMapScale(s32 mapId, s32 *scale);
void func_80109D40(s32, s32*, s32*);
void func_80109DD8(s32, s32*, s32*);
#endif
+2 -2
View File
@@ -305,7 +305,7 @@ typedef struct {
} TransitionActorList;
typedef struct {
/* 0x00 */ u16 unk0;
/* 0x00 */ u16 mapId;
/* 0x02 */ s16 unk2;
/* 0x04 */ s16 unk4;
/* 0x06 */ s16 unk6;
@@ -319,7 +319,7 @@ typedef struct {
typedef struct {
/* 0x00 */ MinimapEntry* entry;
/* 0x04 */ s16 unk4;
/* 0x04 */ s16 scale;
} MinimapList2; // size = 0x8
typedef struct {
-1
View File
@@ -491,7 +491,6 @@ beginseg
include "build/data/code/z_map_disp.data.o"
include "build/data/code/z_map_disp.bss.o"
include "build/src/code/z_map_data.o"
include "build/data/code/z_map_data.data.o"
include "build/src/code/z_map_exp.o"
include "build/src/code/z_msgevent.o"
include "build/data/code/z_msgevent.data.o"
+306 -203
View File
File diff suppressed because it is too large Load Diff
+497 -469
View File
File diff suppressed because it is too large Load Diff
@@ -255,8 +255,7 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play) {
if (this->actor.room >= 0) {
s32 transitionActorId = DOORSHUTTER_GET_FC00(&this->actor);
play->transitionActors.list[transitionActorId].id =
-play->transitionActors.list[transitionActorId].id;
play->transitionActors.list[transitionActorId].id = -play->transitionActors.list[transitionActorId].id;
}
}
@@ -678,8 +677,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
}
if (sp44->unk_04 != 0) {
TransitionActorEntry* transitionEntry =
&play->transitionActors.list[DOORSHUTTER_GET_FC00(&this->actor)];
TransitionActorEntry* transitionEntry = &play->transitionActors.list[DOORSHUTTER_GET_FC00(&this->actor)];
if ((play->roomCtx.prevRoom.num >= 0) ||
(transitionEntry->sides[0].room == transitionEntry->sides[1].room)) {
+3 -3
View File
@@ -1909,7 +1909,7 @@
0x80102EF0:("func_80102EF0",),
0x80102F9C:("func_80102F9C",),
0x80103090:("func_80103090",),
0x801030B4:("func_801030B4",),
0x801030B4:("MapDisp_GetMapScale",),
0x801030F4:("func_801030F4",),
0x801031D0:("func_801031D0",),
0x801039EC:("MapDisp_IsDataRotated",),
@@ -1972,7 +1972,7 @@
0x80109714:("func_80109714",),
0x80109754:("func_80109754",),
0x801097C8:("func_801097C8",),
0x8010983C:("func_8010983C",),
0x8010983C:("MapData_GetMapScale",),
0x801098A0:("func_801098A0",),
0x80109908:("func_80109908",),
0x80109964:("func_80109964",),
@@ -1988,7 +1988,7 @@
0x80109BA0:("func_80109BA0",),
0x80109BF4:("func_80109BF4",),
0x80109C38:("func_80109C38",),
0x80109CBC:("MapData_GetIMapSize",),
0x80109CBC:("MapData_GetMapSize",),
0x80109D40:("func_80109D40",),
0x80109DD8:("func_80109DD8",),
0x80109E70:("func_80109E70",),
+2 -2
View File
@@ -1033,10 +1033,10 @@
0x801BED40:("D_801BED40","UNK_TYPE1","",0x1),
0x801BED4C:("D_801BED4C","UNK_TYPE1","",0x3C),
0x801BED88:("D_801BED88","UNK_TYPE1","",0x1),
0x801BEFC8:("D_801BEFC8","UNK_TYPE1","",0x1),
0x801BF15C:("D_801BF15C","UNK_TYPE1","",0x1),
0x801BF170:("D_801BF170","UNK_TYPE1","",0x244),
0x801BF3B4:("D_801BF3B4","UNK_TYPE1","",0x1),
0x801BF3B4:("D_801BF3B4","s32","",0x14),
0x801BF3C8:("D_801BF3C8","s32","",0x188),
0x801BF550:("D_801BF550","UNK_TYPE2","",0x2),
0x801BF554:("D_801BF554","UNK_TYPE2","",0x2),
0x801BF558:("D_801BF558","UNK_TYPE2","",0x2),
+65
View File
@@ -0,0 +1,65 @@
#!/usr/bin/env python3
# mzxrules 2022
# Extracts z_map_data.c data
import argparse, os, struct, math
D_801BF170_ROM = 0x1196B0
CODE_START_VRAM = 0x800A5AC0
MAP_DATA_DATA_START = 0x801BED40
MAP_DATA_DATA_END = 0x801BF550
typeInfo = {
"Color_RGBA8" : [ 0x04, ">BBBB", "{{ {0}, {1}, {2}, {3} }}" ],
"T_801BED4C" : [ 0x0C, ">IBBBBBBh", "{{ D_{0:08X}, 0x{1:02X}, 0x{2:02X}, 0x{3:02X}, 0x{4:02X}, 0x{5:02X}, 0x{6:02X}, {7} }}"],
"T_801BF170" : [ 0x0A, ">BBhhBBh", "{{ 0x{0:02X}, 0x{1:02X}, {2}, {3}, 0x{4:02X}, 0x{5:02X}, {6} }}"],
"s32" : [ 0x04, ">I", "0x{0:02X}"]
}
script_dir = os.path.dirname(os.path.realpath(__file__))
repo = script_dir + os.sep + ".." + os.sep + ".." + os.sep
def GetCodeOff(vram):
return vram-CODE_START_VRAM
def GetDataOff(vram):
return vram-MAP_DATA_DATA_START
def dumpList(data, vram, keyword, typeKey, varName, length):
if keyword is None:
keyword = ""
else:
keyword = f"{keyword} "
cstr = f"{keyword}{typeKey} {varName}[{length}] = {{\n"
ty = typeInfo[typeKey]
off = GetDataOff(vram)
for i in range(length):
val = struct.unpack_from(ty[1], data, off)
off += ty[0]
cstr += f" {ty[2].format(*val)},\n"
cstr += "};\n"
return cstr
def dump():
data = []
cstr = ""
with open(repo + "baserom/code","rb") as codefile:
codefile.seek(GetCodeOff(MAP_DATA_DATA_START))
data = codefile.read(MAP_DATA_DATA_END - MAP_DATA_DATA_START)
cstr += dumpList(data, 0x801BED40, "static", "Color_RGBA8", "D_801BED40", 3)
cstr += dumpList(data, 0x801BED4C, "static", "T_801BED4C", "D_801BED4C", 5)
cstr += dumpList(data, 0x801BED88, "static", "T_801BF170", "D_801BED88", 0x62)
cstr += dumpList(data, 0x801BF15C, "static", "s32", "D_801BF15C", 5)
cstr += dumpList(data, 0x801BF170, "static", "T_801BF170", "D_801BF170", 0x3A)
cstr += dumpList(data, 0x801BF3B4, "static", "s32", "D_801BF3B4", 5)
cstr += dumpList(data, 0x801BF3C8, "static", "s32", "D_801BF3C8", 0x62)
print(cstr)
parser = argparse.ArgumentParser(description="Extracts z_map_data.data")
args = parser.parse_args()
dump()