Effect_6 done, splat, diff updates (#451)

* fx_6_appendGfx

* update_effects

* effect_6 done

* Update diff.py

* update configure for new splat

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "0efa552c5d"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "0efa552c5d"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* nu stuff / undefined_syms org
This commit is contained in:
Ethan Roseman 2021-09-30 18:48:03 +09:00 committed by GitHub
parent 3f468d79b4
commit 4c787f68c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 2487 additions and 1527 deletions

2948
diff.py

File diff suppressed because it is too large Load Diff

View File

@ -322,16 +322,12 @@ void clear_effect_data(void) {
void func_80059D48(void) {
}
// The third loop is doing some negative reference bs
#ifdef NON_MATCHING
void update_effects(void) {
EffectGraphics* effectGraphics;
s32 i;
if (!(gOverrideFlags & 0xC00)) {
for (i = 0; i < ARRAY_COUNT(gEffectGraphicsData); i++) {
effectGraphics = &gEffectGraphicsData[i];
EffectGraphics* effectGraphics;
s32 i;
for (i = 0, effectGraphics = gEffectGraphicsData; i < ARRAY_COUNT(gEffectGraphicsData); i++, effectGraphics++) {
if (effectGraphics->flags & FX_GRAPHICS_ENABLED) {
if (!(effectGraphics->flags & FX_GRAPHICS_2)) {
effectGraphics->flags |= FX_GRAPHICS_2;
@ -360,17 +356,15 @@ void update_effects(void) {
}
}
for (i = 0; i < ARRAY_COUNT(gEffectGraphicsData); i++) {
effectGraphics = &gEffectGraphicsData[i];
for (i = 0, effectGraphics = gEffectGraphicsData; i < ARRAY_COUNT(gEffectGraphicsData); i++, effectGraphics++) {
if (effectGraphics->flags & FX_GRAPHICS_ENABLED) {
if (effectGraphics->flags & FX_GRAPHICS_2) {
if (effectGraphics->freeDelay != 0) {
effectGraphics->freeDelay--;
} else {
if (effectGraphics->data[0] != NULL) {
if (effectGraphics->data != NULL) {
general_heap_free(effectGraphics->data);
effectGraphics->data[0] = NULL;
effectGraphics->data = NULL;
}
effectGraphics->flags = FX_GRAPHICS_DISABLED;
osUnmapTLB(i);
@ -380,9 +374,6 @@ void update_effects(void) {
}
}
}
#else
INCLUDE_ASM(s32, "341d0", update_effects);
#endif
s32 render_effects_world(void) {
s32 i;

View File

@ -27,9 +27,8 @@ void fx_6_update(EffectInstance* effect);
void fx_6_render(EffectInstance* effect);
void fx_6_appendGfx(EffectInstance* effect);
static s32 D_E000CC10[] = { 0x09002B20, 0x09002B40, 0x09002B60, 0x09002B60, 0x09002B60 };
static s32 D_E000CC24[] = { 0x09002780, 0x09002868, 0x09002950, 0x09002A38, 0x09002A38 };
static s32 sDlists[] = { 0x09002B20, 0x09002B40, 0x09002B60, 0x09002B60, 0x09002B60 };
static s32 sDlists2[] = { 0x09002780, 0x09002868, 0x09002950, 0x09002A38, 0x09002A38 };
static s8 D_E000CC38[] = { 0x00, 0x01, 0x02, 0x1A, 0x03, 0x1B, 0x04, 0x1C, 0x05, 0x15, 0x35, 0x46, 0x46, 0x46, 0xFF,
0x00 };
@ -38,14 +37,14 @@ static s8 D_E000CC48[] = { 0x00, 0x01, 0x02, 0x1A, 0x03, 0x1B, 0x04, 0x1C, 0x05,
0x67, 0xFF, 0x00, 0x00, 0x00 };
static s8 D_E000CC5C[] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x01, 0x09, 0x11, 0x19, 0x21, 0x29, 0x31,
0x39, 0x02, 0x02, 0x0A, 0x0A, 0x12, 0x12, 0x1A, 0x1A, 0x22, 0x22, 0x2A, 0x2A, 0x32, 0x32, 0x3A,
0x3A, 0x03, 0x03, 0x0B, 0x0B, 0x13, 0x13, 0x1B, 0x1B, 0x23, 0x23, 0x2B, 0x2B, 0x33, 0x33, 0x3B,
0x3B, 0x04, 0x04, 0x0C, 0x0C, 0x14, 0x14, 0x1C, 0x1C, 0x24, 0x24, 0x2C, 0x2C, 0x34, 0x34, 0x3C,
0x3C, 0x05, 0x05, 0x0D, 0x0D, 0x15, 0x15, 0x1D, 0x1D, 0x25, 0x25, 0x2D, 0x2D, 0x35, 0x35, 0x3D,
0x3D, 0x06, 0x06, 0x06, 0x0E, 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E, 0x1E, 0x1E, 0x26, 0x26, 0x26,
0x2E, 0x2E, 0x2E, 0x36, 0x36, 0x36, 0x3E, 0x3E, 0x3E, 0x47, 0x47, 0x47, 0x4F, 0x4F, 0x4F, 0x57,
0x57, 0x57, 0x5F, 0x5F, 0x5F, 0x67, 0x67, 0x67, 0x6F, 0x6F, 0x6F, 0x77, 0x77, 0x77, 0x7F, 0x7F,
0x7F, 0xFF, 0x00, 0x00, 0x00 };
0x39, 0x02, 0x02, 0x0A, 0x0A, 0x12, 0x12, 0x1A, 0x1A, 0x22, 0x22, 0x2A, 0x2A, 0x32, 0x32,
0x3A, 0x3A, 0x03, 0x03, 0x0B, 0x0B, 0x13, 0x13, 0x1B, 0x1B, 0x23, 0x23, 0x2B, 0x2B, 0x33,
0x33, 0x3B, 0x3B, 0x04, 0x04, 0x0C, 0x0C, 0x14, 0x14, 0x1C, 0x1C, 0x24, 0x24, 0x2C, 0x2C,
0x34, 0x34, 0x3C, 0x3C, 0x05, 0x05, 0x0D, 0x0D, 0x15, 0x15, 0x1D, 0x1D, 0x25, 0x25, 0x2D,
0x2D, 0x35, 0x35, 0x3D, 0x3D, 0x06, 0x06, 0x06, 0x0E, 0x0E, 0x0E, 0x16, 0x16, 0x16, 0x1E,
0x1E, 0x1E, 0x26, 0x26, 0x26, 0x2E, 0x2E, 0x2E, 0x36, 0x36, 0x36, 0x3E, 0x3E, 0x3E, 0x47,
0x47, 0x47, 0x4F, 0x4F, 0x4F, 0x57, 0x57, 0x57, 0x5F, 0x5F, 0x5F, 0x67, 0x67, 0x67, 0x6F,
0x6F, 0x6F, 0x77, 0x77, 0x77, 0x7F, 0x7F, 0x7F, 0xFF, 0x00, 0x00, 0x00 };
static s8 D_E000CCE0[] = { 0x00, 0x10, 0x20, 0x30, 0x01, 0x11, 0x21, 0x31, 0x02, 0x0A, 0x12, 0x1A, 0x22, 0x2A, 0x32,
0x3A, 0x03, 0x0B, 0x13, 0x1B, 0x23, 0x2B, 0x33, 0x3B, 0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C,
@ -55,8 +54,17 @@ static s8 D_E000CCE0[] = { 0x00, 0x10, 0x20, 0x30, 0x01, 0x11, 0x21, 0x31, 0x02,
static s8* D_E000CD24[4] = { &D_E000CC38, &D_E000CC48, &D_E000CC5C, &D_E000CCE0 };
void func_E000C000(Effect6* part);
INCLUDE_ASM(s32, "effects/effect_6", func_E000C000);
void func_E000C000(Effect6* part) {
part->unk_18 += part->unk_1C;
part->unk_14 += part->unk_18;
part->unk_10 += part->unk_14;
part->x += part->unk_10 * part->unk_30;
part->z += part->unk_10 * part->unk_34;
part->unk_28 += part->unk_2C;
part->unk_24 += part->unk_28;
part->unk_20 += part->unk_24;
part->y += part->unk_20;
}
void func_E000C094(Effect6* part) {
part->y += part->unk_20;
@ -262,4 +270,89 @@ void fx_6_render(EffectInstance* effect) {
retTask->renderMode |= RENDER_MODE_2;
}
INCLUDE_ASM(s32, "effects/effect_6", fx_6_appendGfx);
void fx_6_appendGfx(EffectInstance* effect) {
Effect6* part = effect->data;
s32 type = part->type;
s32 temp_t0 = part->unk_40;
Matrix4f mtx1;
Matrix4f mtx2;
Matrix4f mtx3;
s32 spD8;
s32 spDC;
s32 temp_lo;
s32 envAlpha;
s32 dlist1;
s32 dlist2;
s32 phi_a0;
s32 temp;
s32 i;
envAlpha = (temp_t0 & 0x38) * 4;
dlist1 = sDlists[type];
dlist2 = sDlists2[type];
gDPPipeSync(gMasterGfxPos++);
gSPSegment(gMasterGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(effect->effect->data));
gSPDisplayList(gMasterGfxPos++, dlist2);
spD8 = temp_t0 & 7;
spDC = temp_t0 & 0x40;
shim_guTranslateF(mtx1, part->x, part->y, part->z);
shim_guRotateF(mtx2, -gCameras[gCurrentCameraID].currentYaw, 0.0f, 1.0f, 0.0f);
shim_guMtxCatF(mtx2, mtx1, mtx3);
shim_guMtxF2L(mtx3, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMasterGfxPos++,
&gDisplayContext->matrixStack[gMatrixListPos++], G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
switch (type) {
case 0:
case 1:
gDPSetPrimColor(gMasterGfxPos++, 0, 0, 230, 222, 222, 110);
gDPSetEnvColor(gMasterGfxPos++, 0, 0, 0, envAlpha);
break;
case 2:
case 3:
case 4:
gDPSetPrimColor(gMasterGfxPos++, 0, 0, 230, 222, 222, 130);
gDPSetEnvColor(gMasterGfxPos++, 0, 0, 0, envAlpha);
break;
}
if (type == 0) {
phi_a0 = 24;
} else {
phi_a0 = 32;
}
temp_lo = spD8 * phi_a0;
temp = temp_lo + phi_a0;
gDPSetTileSize(gMasterGfxPos++, G_TX_RENDERTILE, temp_lo * 4, 0, temp * 4, phi_a0 * 4);
if (spDC) {
gDPSetTileSize(gMasterGfxPos++, 1, temp * 4, phi_a0 * 4, (temp_lo + (phi_a0 * 2)) * 4, phi_a0 * 8);
} else {
gDPSetTileSize(gMasterGfxPos++, 1, temp * 4, 0, (temp_lo + (phi_a0 * 2)) * 4, phi_a0 * 4);
}
if (type == 2) {
gSPDisplayList(gMasterGfxPos++, dlist1);
}
part++;
for (i = 1; i < effect->numParts; i++, part++) {
shim_guTranslateF(mtx1, part->x, part->y, part->z);
shim_guMtxF2L(mtx1, &gDisplayContext->matrixStack[gMatrixListPos]);
gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++],
G_MTX_PUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gSPDisplayList(gMasterGfxPos++, dlist1);
gSPPopMatrix(gMasterGfxPos++, G_MTX_MODELVIEW);
}
gSPPopMatrix(gMasterGfxPos++, G_MTX_MODELVIEW);
gDPPipeSync(gMasterGfxPos++);
}

View File

@ -40,7 +40,7 @@ void* heap_malloc(s32 size) {
}
s32 heap_free(void* ptr) {
if (gGameStatusPtr->isBattle != 0) {
if (gGameStatusPtr->isBattle) {
return _heap_free(&D_803DA800, ptr);
} else {
return general_heap_free(ptr);

View File

@ -1,7 +1,7 @@
#include "common.h"
#include "nu/nusys.h"
s32 contRmbControl(NUSiCommonMesg* mesg);
s32 contRmbRetrace(NUSiCommonMesg* mesg);
s32 contRmbCheckMesg(NUSiCommonMesg* mesg);
s32 contRmbStartMesg(NUSiCommonMesg* mesg);
s32 contRmbStopMesg(NUSiCommonMesg* mesg);
@ -10,18 +10,17 @@ s32 contRmbForceStopEndMesg(NUSiCommonMesg* mesg);
u32 nuContRmbSearchTime = 300;
s32 D_80093CE4[] = { contRmbControl, contRmbCheckMesg, contRmbStartMesg, contRmbStopMesg, contRmbForceStopMesg, contRmbForceStopEndMesg, NULL};
s32 D_80093CE4[] = { contRmbRetrace, contRmbCheckMesg, contRmbStartMesg, contRmbStopMesg, contRmbForceStopMesg, contRmbForceStopEndMesg, NULL};
NUCallBackList nuContRmbCallBack = {.next = NULL, .func = D_80093CE4, .majorNo = 0x300, .funcNum = 0};
s32 _osMotorStop(NUContRmbCtl* rmbCtl, u32 contNo) {
s32 contRmbControl(NUContRmbCtl* rmbCtl, u32 contNo) {
s32 ret = 0;
u32 cnt;
switch (rmbCtl->state) {
case NU_CONT_RMB_STATE_STOPPED:
break;
case NU_CONT_RMB_STATE_STOPPING:
if (rmbCtl->counter != 0) {
ret = osMotorStop(&nuContPfs[contNo]);
@ -30,7 +29,6 @@ s32 _osMotorStop(NUContRmbCtl* rmbCtl, u32 contNo) {
}
rmbCtl->counter--;
break;
case NU_CONT_RMB_STATE_RUN:
if (rmbCtl->frame > 0) {
rmbCtl->counter += rmbCtl->freq;
@ -48,7 +46,6 @@ s32 _osMotorStop(NUContRmbCtl* rmbCtl, u32 contNo) {
}
rmbCtl->frame--;
break;
case NU_CONT_RMB_STATE_FORCESTOP:
ret = osMotorInit(&nuSiMesgQ, &nuContPfs[contNo], contNo);
if (ret == 0) {
@ -61,7 +58,7 @@ s32 _osMotorStop(NUContRmbCtl* rmbCtl, u32 contNo) {
return ret;
}
s32 contRmbControl(NUSiCommonMesg* mesg) {
s32 contRmbRetrace(NUSiCommonMesg* mesg) {
u32 i;
NUContRmbCtl* cont;
@ -70,13 +67,11 @@ s32 contRmbControl(NUSiCommonMesg* mesg) {
switch (cont->mode) {
case NU_CONT_RMB_MODE_DISABLE:
break;
case NU_CONT_RMB_MODE_ENABLE:
if (_osMotorStop(cont, i)) {
if (contRmbControl(cont, i)) {
cont->mode = NU_CONT_RMB_MODE_DISABLE;
}
break;
case NU_CONT_RMB_MODE_AUTORUN:
if (cont->autorun == NU_CONT_RMB_AUTO_SEARCH) {
if ((cont->counter % nuContRmbSearchTime) == 0) {
@ -87,18 +82,17 @@ s32 contRmbControl(NUSiCommonMesg* mesg) {
}
cont->counter++;
} else {
if (_osMotorStop(cont, i)) {
if (contRmbControl(cont, i)) {
cont->counter = i;
cont->autorun = NU_CONT_RMB_AUTO_SEARCH;
cont->type = NU_CONT_PAK_TYPE_NONE;
}
}
break;
case (NU_CONT_RMB_MODE_ENABLE | NU_CONT_RMB_MODE_PAUSE):
case (NU_CONT_RMB_MODE_AUTORUN | NU_CONT_RMB_MODE_PAUSE):
if (cont->type == NU_CONT_PAK_TYPE_RUMBLE) {
_osMotorStop(cont, i);
contRmbControl(cont, i);
}
}
}

View File

@ -284,7 +284,7 @@ class Configure:
def write_ninja(self, ninja: ninja_syntax.Writer, skip_outputs: Set[str]):
import segtypes
import segtypes.n64.data
import segtypes.common.data
import segtypes.n64.Yay0
assert self.linker_entries is not None
@ -335,9 +335,9 @@ class Configure:
if isinstance(seg, segtypes.n64.header.N64SegHeader):
build(entry.object_path, entry.src_paths, "as")
elif isinstance(seg, segtypes.n64.asm.N64SegAsm) or (isinstance(seg, segtypes.n64.data.N64SegData) and not seg.type[0] == "."):
elif isinstance(seg, segtypes.common.asm.CommonSegAsm) or (isinstance(seg, segtypes.common.data.CommonSegData) and not seg.type[0] == "."):
build(entry.object_path, entry.src_paths, "as")
elif isinstance(seg, segtypes.n64.c.N64SegC) or (isinstance(seg, segtypes.n64.data.N64SegData) and seg.type[0] == "."):
elif isinstance(seg, segtypes.common.c.CommonSegC) or (isinstance(seg, segtypes.common.data.CommonSegData) and seg.type[0] == "."):
cflags = None
if isinstance(seg.yaml, dict):
cflags = seg.yaml.get("cflags")
@ -367,7 +367,7 @@ class Configure:
build(entry.object_path, entry.src_paths, task, variables={"cflags": cflags})
# images embedded inside data aren't linked, but they do need to be built into .inc.c files
if isinstance(seg, segtypes.n64.group.N64SegGroup):
if isinstance(seg, segtypes.common.group.CommonSegGroup):
for seg in seg.subsegments:
if isinstance(seg, segtypes.n64.img.N64SegImg):
flags = ""
@ -397,7 +397,7 @@ class Configure:
"img_flags": "",
})
build(inc_dir / (seg.name + ".pal.inc.c"), [bin_path], "bin_inc_c")
elif isinstance(seg, segtypes.n64.bin.N64SegBin):
elif isinstance(seg, segtypes.common.bin.CommonSegBin):
build(entry.object_path, entry.src_paths, "bin")
elif isinstance(seg, segtypes.n64.Yay0.N64SegYay0):
compressed_path = entry.object_path.with_suffix("") # remove .o

View File

@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/ethteck/splat.git
branch = master
commit = 7eb5744b2a3a5e2a4253996f587b7666db597c57
parent = 31629ad772cbb4cda8df2a96ce9d91b74883f752
commit = 0efa552c5d3cf866b6325486868714787261673d
parent = 35fa67cd8de20bf6dacdb92f1ac8411d3e5f09cf
method = merge
cmdver = 0.4.3

View File

@ -1,5 +1,11 @@
# splat Release Notes
### 0.7.10: WIP PSX support
* WIP PSX support has been added, thanks to @mkst! (https://github.com/ethteck/splat/pull/99)
* Many segments have moved to a "common" package
* Endianness of the input binary is now a configurable option
* Linker hack restored but is now optional and off by default
### 0.7.9
* Finally removed the dumb linker section alignment hack
* Added version number to output on execution

View File

View File

@ -0,0 +1,34 @@
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
from typing import Optional
from pathlib import Path
from util import options
class CommonSegAsm(CommonSegCodeSubsegment):
def out_path(self) -> Optional[Path]:
return options.get_asm_path() / self.dir / f"{self.name}.s"
def scan(self, rom_bytes: bytes):
if self.rom_start != "auto" and self.rom_end != "auto" and self.rom_start != self.rom_end:
self.funcs_text = self.disassemble_code(rom_bytes, options.get("asm_endlabels", False))
def get_file_header(self):
return []
def split(self, rom_bytes: bytes):
if not self.rom_start == self.rom_end:
out_path = self.out_path()
if out_path:
out_path.parent.mkdir(parents=True, exist_ok=True)
out_lines = self.get_file_header()
for func in self.funcs_text:
out_lines.extend(self.funcs_text[func][0])
out_lines.append("")
self.split_write(out_path, out_lines)
def split_write(self, out_path, out_lines):
with open(out_path, "w", newline="\n") as f:
f.write("\n".join(out_lines))

View File

@ -1,13 +1,13 @@
from pathlib import Path
from typing import Optional
from segtypes.n64.segment import N64Segment
from segtypes.common.segment import CommonSegment
from util import options
from util import log
class N64SegBin(N64Segment):
class CommonSegBin(CommonSegment):
def out_path(self) -> Optional[Path]:
return options.get_asset_path() / self.dir / f"{self.name}.bin"
def split(self, rom_bytes):
path = self.out_path()
path.parent.mkdir(parents=True, exist_ok=True)

View File

@ -1,7 +1,7 @@
from segtypes.n64.data import N64SegData
from segtypes.common.data import CommonSegData
from util import log
class N64SegBss(N64SegData):
class CommonSegBss(CommonSegData):
def get_linker_section(self) -> str:
return ".bss"

View File

@ -1,5 +1,5 @@
from segtypes.n64.codesubsegment import N64SegCodeSubsegment
from segtypes.n64.group import N64SegGroup
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
from segtypes.common.group import CommonSegGroup
from typing import Optional, Set
import os
import re
@ -8,7 +8,7 @@ from pathlib import Path
from util import log, options
class N64SegC(N64SegCodeSubsegment):
class CommonSegC(CommonSegCodeSubsegment):
defined_funcs: Set[str] = set()
global_asm_funcs: Set[str] = set()
@ -35,20 +35,20 @@ class N64SegC(N64SegCodeSubsegment):
return " "
else:
return s
return re.sub(N64SegC.STRIP_C_COMMENTS_RE, replacer, text)
return re.sub(CommonSegC.STRIP_C_COMMENTS_RE, replacer, text)
@staticmethod
def get_funcs_defined_in_c(c_file):
with open(c_file, "r") as f:
text = N64SegC.strip_c_comments(f.read())
text = CommonSegC.strip_c_comments(f.read())
return set(m.group(2) for m in N64SegC.C_FUNC_RE.finditer(text))
return set(m.group(2) for m in CommonSegC.C_FUNC_RE.finditer(text))
@staticmethod
def get_global_asm_funcs(c_file):
with open(c_file, "r") as f:
text = N64SegC.strip_c_comments(f.read())
return set(m.group(3) for m in N64SegC.C_GLOBAL_ASM_RE.finditer(text))
text = CommonSegC.strip_c_comments(f.read())
return set(m.group(3) for m in CommonSegC.C_GLOBAL_ASM_RE.finditer(text))
def out_path(self) -> Optional[Path]:
return options.get_src_path() / self.dir / f"{self.name}.c"
@ -124,7 +124,7 @@ class N64SegC(N64SegCodeSubsegment):
else:
out_lines = []
if self.parent and isinstance(self.parent, N64SegGroup):
if self.parent and isinstance(self.parent, CommonSegGroup):
if func in self.parent.rodata_syms:
func_rodata = list({s for s in self.parent.rodata_syms[func] if s.disasm_str})
func_rodata.sort(key=lambda s:s.vram_start)

View File

@ -1,11 +1,11 @@
from segtypes.n64.group import N64SegGroup
from segtypes.common.group import CommonSegGroup
from typing import Optional
from segtypes.segment import Segment
from util import symbols
from util.symbols import Symbol
# code group
class N64SegCode(N64SegGroup):
class CommonSegCode(CommonSegGroup):
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
@ -91,4 +91,3 @@ class N64SegCode(N64SegGroup):
ret.referenced = True
return ret

View File

@ -1,23 +1,28 @@
from typing import Optional
from util import options
from segtypes.n64.code import N64SegCode
from segtypes.common.code import CommonSegCode
from collections import OrderedDict
import re
from capstone import Cs, CS_ARCH_MIPS, CS_MODE_MIPS64, CS_MODE_BIG_ENDIAN
from capstone import Cs, CS_ARCH_MIPS, CS_MODE_MIPS64, CS_MODE_BIG_ENDIAN, CS_MODE_MIPS32, CS_MODE_LITTLE_ENDIAN
from capstone.mips import *
from segtypes.segment import Segment
# abstract class for c, asm, data, etc
class N64SegCodeSubsegment(Segment):
class CommonSegCodeSubsegment(Segment):
double_mnemonics = ["ldc1", "sdc1"]
word_mnemonics = ["addiu", "sw", "lw", "jtbl"]
float_mnemonics = ["lwc1", "swc1"]
short_mnemonics = ["addiu", "lh", "sh", "lhu"]
byte_mnemonics = ["lb", "sb", "lbu"]
md = Cs(CS_ARCH_MIPS, CS_MODE_MIPS64 + CS_MODE_BIG_ENDIAN)
if options.get_endianess() == "big":
capstone_mode = CS_MODE_MIPS64 | CS_MODE_BIG_ENDIAN
else:
capstone_mode = CS_MODE_MIPS32 | CS_MODE_LITTLE_ENDIAN
md = Cs(CS_ARCH_MIPS, capstone_mode)
md.detail = True
md.skipdata = True
@ -40,7 +45,7 @@ class N64SegCodeSubsegment(Segment):
return (mnemonic.startswith("b") and not mnemonic.startswith("binsl") and not mnemonic == "break") or mnemonic == "j"
def disassemble_code(self, rom_bytes, addsuffix=False):
insns = [insn for insn in N64SegCodeSubsegment.md.disasm(rom_bytes[self.rom_start : self.rom_end], self.vram_start)]
insns = [insn for insn in CommonSegCodeSubsegment.md.disasm(rom_bytes[self.rom_start : self.rom_end], self.vram_start)]
funcs = self.process_insns(insns, self.rom_start)
@ -53,8 +58,8 @@ class N64SegCodeSubsegment(Segment):
return self.add_labels(funcs, addsuffix)
def process_insns(self, insns, rom_addr):
assert(isinstance(self.parent, N64SegCode))
self.parent: N64SegCode = self.parent
assert(isinstance(self.parent, CommonSegCode))
self.parent: CommonSegCode = self.parent
ret = OrderedDict()
@ -63,6 +68,8 @@ class N64SegCodeSubsegment(Segment):
end_func = False
labels = []
big_endian = options.get_endianess() == "big"
# Collect labels
for insn in insns:
if self.is_branch_insn(insn.mnemonic):
@ -85,7 +92,9 @@ class N64SegCodeSubsegment(Segment):
if mnemonic == "move":
# Let's get the actual instruction out
opcode = insn.bytes[3] & 0b00111111
idx = 3 if big_endian else 0
opcode = insn.bytes[idx] & 0b00111111
op_str += ", $zero"
if opcode == 37:
@ -95,7 +104,7 @@ class N64SegCodeSubsegment(Segment):
elif opcode == 33:
mnemonic = "addu"
else:
print("INVALID INSTRUCTION " + insn)
print("INVALID INSTRUCTION " + str(insn), opcode)
elif mnemonic == "jal":
jal_addr = int(op_str, 0)
jump_func = self.parent.get_symbol(jal_addr, type="func", create=True, reference=True)
@ -115,8 +124,9 @@ class N64SegCodeSubsegment(Segment):
label_name = f".L{branch_target[2:].upper()}"
op_str = " ".join(op_str_split[:-1] + [label_name])
elif mnemonic == "mtc0" or mnemonic == "mfc0":
rd = (insn.bytes[2] & 0xF8) >> 3
elif mnemonic in ["mtc0", "mfc0", "mtc2", "mfc2"]:
idx = 2 if big_endian else 1
rd = (insn.bytes[idx] & 0xF8) >> 3
op_str = op_str.split(" ")[0] + " $" + str(rd)
func.append((insn, mnemonic, op_str, rom_addr))
@ -322,8 +332,8 @@ class N64SegCodeSubsegment(Segment):
if insn[0].mnemonic != "branch" and insn[0].mnemonic.startswith("b") or insn[0].mnemonic.startswith("j"):
indent_next = True
if addsuffix:
if addsuffix:
func_text.append(f"endlabel {sym.name}")
ret[func] = (func_text, rom_addr)
@ -373,6 +383,6 @@ class N64SegCodeSubsegment(Segment):
def should_scan(self) -> bool:
return options.mode_active("code") and self.rom_start != "auto" and self.rom_end != "auto"
def should_split(self) -> bool:
return self.extract and options.mode_active("code")

View File

@ -1,12 +1,12 @@
from segtypes.n64.code import N64SegCode
from segtypes.n64.codesubsegment import N64SegCodeSubsegment
from segtypes.n64.group import N64SegGroup
from segtypes.common.code import CommonSegCode
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
from segtypes.common.group import CommonSegGroup
from pathlib import Path
from typing import List, Optional
from util.symbols import Symbol
from util import floats, options
class N64SegData(N64SegCodeSubsegment, N64SegGroup):
class CommonSegData(CommonSegCodeSubsegment, CommonSegGroup):
def out_path(self) -> Optional[Path]:
if self.type.startswith("."):
if self.sibling:
@ -20,7 +20,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
return options.get_asm_path() / "data" / self.dir / f"{self.name}.{self.type}.s"
def scan(self, rom_bytes: bytes):
N64SegGroup.scan(self, rom_bytes)
CommonSegGroup.scan(self, rom_bytes)
if super().should_scan():
self.file_text = self.disassemble_data(rom_bytes)
@ -28,11 +28,11 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
self.file_text = None
def split(self, rom_bytes: bytes):
N64SegGroup.split(self, rom_bytes)
CommonSegGroup.split(self, rom_bytes)
if not self.type.startswith(".") and self.file_text:
path = self.out_path()
if path:
path.parent.mkdir(parents=True, exist_ok=True)
@ -46,15 +46,16 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
return True
def cache(self):
return [N64SegCodeSubsegment.cache(self), N64SegGroup.cache(self)]
return [CommonSegCodeSubsegment.cache(self), CommonSegGroup.cache(self)]
def get_linker_section(self) -> str:
return ".data"
def get_linker_entries(self):
return N64SegCodeSubsegment.get_linker_entries(self)
return CommonSegCodeSubsegment.get_linker_entries(self)
def check_jtbls(self, rom_bytes, syms: List[Symbol]):
endian = options.get_endianess()
for i, sym in enumerate(syms):
if sym.type == "jtbl":
start = self.get_most_parent().ram_to_rom(syms[i].vram_start)
@ -65,7 +66,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
b = 0
last_bits = 0
while b < len(sym_bytes):
bits = int.from_bytes(sym_bytes[b : b + 4], "big")
bits = int.from_bytes(sym_bytes[b : b + 4], endian)
if last_bits != 0 and bits != 0 and abs(last_bits - bits) > 0x100000:
new_sym_rom_start = start + b
@ -83,10 +84,11 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
def get_symbols(self, rom_bytes) -> List[Symbol]:
symset = set()
endian = options.get_endianess()
# Find inter-data symbols
for i in range(self.rom_start, self.rom_end, 4):
bits = int.from_bytes(rom_bytes[i : i + 4], "big")
bits = int.from_bytes(rom_bytes[i : i + 4], endian)
if self.contains_vram(bits):
symset.add(self.get_most_parent().get_symbol(bits, create=True, define=True, local_only=True))
@ -146,7 +148,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
# TODO: if we find null bytes in the middle, break this into multiple strings ?
if c == null_char:
if true_end is None:
if N64SegData.are_null(chars[i:]):
if CommonSegData.are_null(chars[i:]):
true_end = i
else:
pass
@ -181,8 +183,9 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
return True
return False
def disassemble_symbol(self, sym_bytes, sym_type):
endian = options.get_endianess()
if sym_type == "jtbl":
sym_str = ".word "
else:
@ -212,7 +215,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
i = 0
while i < len(sym_bytes):
adv_amt = min(slen, len(sym_bytes) - i)
bits = int.from_bytes(sym_bytes[i : i + adv_amt], "big")
bits = int.from_bytes(sym_bytes[i : i + adv_amt], endian)
if sym_type == "jtbl":
if bits == 0:
@ -254,7 +257,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
sym_str += ", "
return sym_str
def disassemble_data(self, rom_bytes):
rodata_encountered = "rodata" in self.type
ret = ".include \"macro.inc\"\n\n"
@ -268,7 +271,7 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
for i in range(len(syms) - 1):
mnemonic = syms[i].access_mnemonic
sym = self.get_most_parent().get_symbol(syms[i].vram_start, create=True, define=True, local_only=True)
sym_str = f"\n\nglabel {sym.name}\n"
dis_start = self.get_most_parent().ram_to_rom(syms[i].vram_start)
dis_end = self.get_most_parent().ram_to_rom(syms[i + 1].vram_start)
@ -284,13 +287,13 @@ class N64SegData(N64SegCodeSubsegment, N64SegGroup):
stype = "ascii"
elif syms[i].type == "jtbl":
stype = "jtbl"
elif len(sym_bytes) % 8 == 0 and mnemonic in N64SegCodeSubsegment.double_mnemonics:
elif len(sym_bytes) % 8 == 0 and mnemonic in CommonSegCodeSubsegment.double_mnemonics:
stype = "double"
elif len(sym_bytes) % 4 == 0 and mnemonic in N64SegCodeSubsegment.float_mnemonics:
elif len(sym_bytes) % 4 == 0 and mnemonic in CommonSegCodeSubsegment.float_mnemonics:
stype = "float"
elif len(sym_bytes) % 4 == 0 and sym.vram_start % 4 == 0 and (mnemonic in N64SegCodeSubsegment.word_mnemonics or not mnemonic):
elif len(sym_bytes) % 4 == 0 and sym.vram_start % 4 == 0 and (mnemonic in CommonSegCodeSubsegment.word_mnemonics or not mnemonic):
stype = "word"
elif len(sym_bytes) % 2 == 0 and sym.vram_start % 2 == 0 and (mnemonic in N64SegCodeSubsegment.short_mnemonics or not mnemonic):
elif len(sym_bytes) % 2 == 0 and sym.vram_start % 2 == 0 and (mnemonic in CommonSegCodeSubsegment.short_mnemonics or not mnemonic):
stype = "short"
else:
stype = "byte"

View File

@ -3,17 +3,17 @@ from typing import List, Dict
import sys
from util.range import Range
from util import log, options
from segtypes.n64.segment import N64Segment
from segtypes.common.segment import CommonSegment
from segtypes.segment import RomAddr, Segment
from util.symbols import Symbol
class N64SegGroup(N64Segment):
class CommonSegGroup(CommonSegment):
def __init__(self, rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml):
super().__init__(rom_start, rom_end, type, name, vram_start, extract, given_subalign, given_is_overlay, given_dir, args, yaml)
self.rodata_syms: Dict[int, List[Symbol]] = {}
# TODO: move this to N64SegCode
# TODO: move this to CommonSegCode
if isinstance(yaml, dict):
# TODO Note: These start/end vram options don't really do anything yet
data_vram = Range(yaml.get("data_vram_start"), yaml.get("data_vram_end"))
@ -229,7 +229,7 @@ class N64SegGroup(N64Segment):
def should_split(self) -> bool:
return self.extract
def should_scan(self) -> bool:
return self.extract
@ -238,7 +238,7 @@ class N64SegGroup(N64Segment):
for sub in self.subsegments:
c.append(sub.cache())
return c
def get_most_parent(self):

View File

@ -0,0 +1,39 @@
from segtypes.common.segment import CommonSegment
from pathlib import Path
from util import options
class CommonSegHeader(CommonSegment):
def should_split(self):
return self.extract and options.mode_active("code")
@staticmethod
def get_line(typ, data, comment):
if typ == "ascii":
text = data.decode("ASCII").strip()
text = text.replace("\x00", "\\0") # escape NUL chars
dstr = "\"" + text + "\""
else: # .word, .byte
dstr = "0x" + data.hex().upper()
dstr = dstr.ljust(20 - len(typ))
return f".{typ} {dstr} /* {comment} */"
def out_path(self) -> Path:
return options.get_asm_path() / self.dir / f"{self.name}.s"
def parse_header(self, rom_bytes):
return []
def split(self, rom_bytes):
header_lines = self.parse_header(rom_bytes)
src_path = self.out_path()
src_path.parent.mkdir(parents=True, exist_ok=True)
with open(src_path, "w", newline="\n") as f:
f.write("\n".join(header_lines))
self.log(f"Wrote {self.name} to {src_path}")
@staticmethod
def get_default_name(addr):
return "header"

View File

@ -0,0 +1,5 @@
from segtypes.common.data import CommonSegData
class CommonSegRodata(CommonSegData):
def get_linker_section(self) -> str:
return ".rodata"

View File

@ -0,0 +1,4 @@
from segtypes.segment import Segment
class CommonSegment(Segment):
pass

View File

@ -20,7 +20,7 @@ def clean_up_path(path: Path) -> Path:
return path_resolved.relative_to(cwd)
except ValueError:
pass
# If it wasn't relative to that too, then just return the path as-is
return path
@ -44,7 +44,7 @@ def to_cname(symbol: str) -> str:
if symbol[0] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']:
symbol = "_" + symbol
return symbol
def get_segment_cname(segment: Segment) -> str:
@ -86,6 +86,7 @@ class LinkerWriter():
self._write_symbol(f"{seg_name}_TEXT_START", ".")
force_new_section = False
text_ended = False
data_started = False
data_ended = False
@ -122,6 +123,18 @@ class LinkerWriter():
bss_started = True
self._write_symbol(f"{seg_name}_BSS_START", ".")
if options.get("enable_ld_alignment_hack", False):
start = entry.segment.rom_start
if isinstance(start, int):
# Create new sections for non-subalign alignment (hack)
if start % 0x10 != 0 and i != 0 or force_new_section:
self._end_block()
self._begin_segment(entry.segment, mid_segment=True)
force_new_section = False
if start % 0x10 != 0 and i != 0:
force_new_section = True
if entry.object_path and cur_section == ".data":
path_cname = re.sub(r"[^0-9a-zA-Z_]", "_", str(entry.segment.dir / entry.segment.name) + ".".join(entry.object_path.suffixes[:-1]))
self._write_symbol(path_cname, ".")
@ -206,7 +219,7 @@ class LinkerWriter():
vram_str = f"0x{vram:X} " if isinstance(vram, int) else ""
name = get_segment_cname(segment)
if mid_segment:
name += to_cname(segment.type)

View File

@ -1,14 +1,11 @@
from segtypes.n64.codesubsegment import N64SegCodeSubsegment
from segtypes.common.asm import CommonSegAsm
from typing import Optional
from pathlib import Path
from util import options
class N64SegAsm(N64SegCodeSubsegment):
def out_path(self) -> Optional[Path]:
return options.get_asm_path() / self.dir / f"{self.name}.s"
class N64SegAsm(CommonSegAsm):
@staticmethod
def get_file_header():
ret = []
@ -24,24 +21,3 @@ class N64SegAsm(N64SegCodeSubsegment):
ret.append("")
return ret
def scan(self, rom_bytes: bytes):
if self.rom_start != "auto" and self.rom_end != "auto" and self.rom_start != self.rom_end:
self.funcs_text = self.disassemble_code(rom_bytes, options.get("asm_endlabels", False))
def split(self, rom_bytes: bytes):
if not self.rom_start == self.rom_end:
out_path = self.out_path()
if out_path:
out_path.parent.mkdir(parents=True, exist_ok=True)
out_lines = self.get_file_header()
for func in self.funcs_text:
out_lines.extend(self.funcs_text[func][0])
out_lines.append("")
self.split_write(out_path, out_lines)
def split_write(self, out_path, out_lines):
with open(out_path, "w", newline="\n") as f:
f.write("\n".join(out_lines))

View File

@ -1,7 +1,7 @@
from segtypes.n64.asm import N64SegAsm
class N64SegHasm(N64SegAsm):
class N64SegHasm(N64SegAsm):
def split_write(self, out_path, out_lines):
if not out_path.exists():
with open(out_path, "w", newline="\n") as f:

View File

@ -1,26 +1,9 @@
from segtypes.n64.segment import N64Segment
from segtypes.common.header import CommonSegHeader
from pathlib import Path
from util import options
class N64SegHeader(N64Segment):
def should_split(self):
return self.extract and options.mode_active("code")
@staticmethod
def get_line(typ, data, comment):
if typ == "ascii":
dstr = "\"" + data.decode("ASCII").strip() + "\""
else: # .word, .byte
dstr = "0x" + data.hex().upper()
dstr = dstr.ljust(20 - len(typ))
return f".{typ} {dstr} /* {comment} */"
def out_path(self) -> Path:
return options.get_asm_path() / self.dir / f"{self.name}.s"
def split(self, rom_bytes):
class N64SegHeader(CommonSegHeader):
def parse_header(self, rom_bytes):
encoding = options.get("header_encoding", "ASCII")
header_lines = []
@ -47,12 +30,4 @@ class N64SegHeader(N64Segment):
header_lines.append(self.get_line("byte", rom_bytes[0x3F:0x40], "Version"))
header_lines.append("")
src_path = self.out_path()
src_path.parent.mkdir(parents=True, exist_ok=True)
with open(src_path, "w", newline="\n") as f:
f.write("\n".join(header_lines))
self.log(f"Wrote {self.name} to {src_path}")
@staticmethod
def get_default_name(addr):
return "header"
return header_lines

View File

@ -1,5 +0,0 @@
from segtypes.n64.data import N64SegData
class N64SegRodata(N64SegData):
def get_linker_section(self) -> str:
return ".rodata"

View File

@ -12,9 +12,9 @@ from pathlib import Path
from util.log import error
from util import options
from segtypes.n64.codesubsegment import N64SegCodeSubsegment
from segtypes.common.codesubsegment import CommonSegCodeSubsegment
class N64SegVtx(N64SegCodeSubsegment):
class N64SegVtx(CommonSegCodeSubsegment):
def __init__(self, rom_start, rom_end, type, name, vram_start, extract,
given_subalign, given_is_overlay, given_dir, args = [], yaml = {}):
super().__init__(rom_start, rom_end, type, name, vram_start, extract,
@ -61,12 +61,12 @@ class N64SegVtx(N64SegCodeSubsegment):
def split(self, rom_bytes: bytes):
if self.file_text and self.out_path():
self.out_path().parent.mkdir(parents=True, exist_ok=True)
with open(self.out_path(), "w", newline="\n") as f:
f.write(self.file_text)
def should_scan(self) -> bool:
return options.mode_active("vtx") and self.rom_start != "auto" and self.rom_end != "auto"
def should_split(self) -> bool:
return self.extract and options.mode_active("vtx")
return self.extract and options.mode_active("vtx")

View File

View File

@ -0,0 +1,22 @@
from segtypes.common.asm import CommonSegAsm
from typing import Optional
from pathlib import Path
from util import options
class PsxSegAsm(CommonSegAsm):
@staticmethod
def get_file_header():
ret = []
ret.append(".include \"macro.inc\"")
ret.append("")
ret.append("# assembler directives")
ret.append(".set noat # allow manual use of $at")
ret.append(".set noreorder # don't insert nops after branches")
ret.append("")
ret.append(".section .text, \"ax\"")
ret.append("")
return ret

View File

@ -0,0 +1,8 @@
from segtypes.psx.asm import PsxSegAsm
class PsxSegHasm(PsxSegAsm):
def split_write(self, out_path, out_lines):
if not out_path.exists():
with open(out_path, "w", newline="\n") as f:
f.write("\n".join(out_lines))

View File

@ -0,0 +1,34 @@
from segtypes.common.header import CommonSegHeader
from pathlib import Path
from util import options
class PsxSegHeader(CommonSegHeader):
# little endian so reverse words, TODO: use struct.unpack("<i",...) ?
def parse_header(self, rom_bytes):
header_lines = []
header_lines.append(f".section .data\n")
header_lines.append(self.get_line("ascii", rom_bytes[0x00:0x08], "magic number"))
header_lines.append(self.get_line("word", rom_bytes[0x08:0x0C], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x0C:0x10], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x10:0x14][::-1], ".data start"))
header_lines.append(self.get_line("word", rom_bytes[0x14:0x18], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x18:0x1C][::-1], ".text start"))
header_lines.append(self.get_line("word", rom_bytes[0x1C:0x20][::-1], ".text size"))
header_lines.append(self.get_line("word", rom_bytes[0x20:0x24], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x24:0x28], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x28:0x2C], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x2C:0x30], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x30:0x34][::-1], "$sp start"))
header_lines.append(self.get_line("word", rom_bytes[0x34:0x38], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x38:0x3C], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x3C:0x40], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x40:0x44], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x44:0x48], "pad"))
header_lines.append(self.get_line("word", rom_bytes[0x48:0x4C], "pad"))
header_lines.append(self.get_line("ascii", rom_bytes[0x4C:self.rom_end], "Sony Inc"))
header_lines.append("")
return header_lines

View File

@ -0,0 +1,5 @@
from segtypes.segment import Segment
class PsxSegment(Segment):
pass

View File

@ -48,13 +48,20 @@ class Segment:
@staticmethod
def get_base_segment_class(seg_type):
platform = options.get_platform()
is_platform_seg = False
# heirarchy is platform -> common -> fail
try:
segmodule = importlib.import_module(f"segtypes.{platform}.{seg_type}")
is_platform_seg = True
except ModuleNotFoundError:
return None
try:
segmodule = importlib.import_module(f"segtypes.common.{seg_type}")
except ModuleNotFoundError:
return None
return getattr(segmodule, f"{platform.upper()}Seg{seg_type[0].upper()}{seg_type[1:]}")
seg_prefix = platform.capitalize() if is_platform_seg else "Common"
return getattr(segmodule, f"{seg_prefix}Seg{seg_type.capitalize()}")
@staticmethod
def get_extension_segment_class(seg_type):

View File

@ -14,7 +14,7 @@ from util import options
from util import symbols
from util import palettes
VERSION = "0.7.9"
VERSION = "0.7.10"
parser = argparse.ArgumentParser(description="Split a rom given a rom, a config, and output directory")
parser.add_argument("config", help="path to a compatible config .yaml file")

View File

@ -29,6 +29,9 @@ def get(opt, default=None):
def get_platform() -> str:
return opts.get("platform", "n64")
def get_endianess() -> str:
return opts.get("endianess", "little" if get_platform().upper() == "PSX" else "big")
def get_compiler() -> str:
return opts.get("compiler", "IDO")

View File

@ -1,9 +1,9 @@
from typing import Dict
from segtypes.n64.palette import N64SegPalette as Palette
from segtypes.n64.ci8 import N64SegCi8 as Raster
from segtypes.n64.group import N64SegGroup
from segtypes.common.group import CommonSegGroup
# Resolve Raster#palette and Palette#raster links
# Resolve Raster#palette and Palette#raster links
def initialize(all_segments):
global palettes_remaining
@ -18,9 +18,9 @@ def initialize(all_segments):
if isinstance(segment, Raster):
raster_map[segment.name] = segment
if isinstance(segment, N64SegGroup):
if isinstance(segment, CommonSegGroup):
process(segment.subsegments)
for raster_name in raster_map:
raster = raster_map[raster_name]
#print(f"{raster_name} -> {raster.palette_name}")

View File

@ -1,121 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel update_effects
/* 35150 80059D50 3C02800A */ lui $v0, %hi(gOverrideFlags)
/* 35154 80059D54 8C42A650 */ lw $v0, %lo(gOverrideFlags)($v0)
/* 35158 80059D58 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 3515C 80059D5C AFBF0020 */ sw $ra, 0x20($sp)
/* 35160 80059D60 AFB3001C */ sw $s3, 0x1c($sp)
/* 35164 80059D64 AFB20018 */ sw $s2, 0x18($sp)
/* 35168 80059D68 AFB10014 */ sw $s1, 0x14($sp)
/* 3516C 80059D6C 30420C00 */ andi $v0, $v0, 0xc00
/* 35170 80059D70 14400059 */ bnez $v0, .L80059ED8
/* 35174 80059D74 AFB00010 */ sw $s0, 0x10($sp)
/* 35178 80059D78 0000902D */ daddu $s2, $zero, $zero
/* 3517C 80059D7C 3C10800A */ lui $s0, %hi(gEffectGraphicsData)
/* 35180 80059D80 26104000 */ addiu $s0, $s0, %lo(gEffectGraphicsData)
/* 35184 80059D84 24040003 */ addiu $a0, $zero, 3
.L80059D88:
/* 35188 80059D88 8E030000 */ lw $v1, ($s0)
/* 3518C 80059D8C 30620001 */ andi $v0, $v1, 1
/* 35190 80059D90 10400007 */ beqz $v0, .L80059DB0
/* 35194 80059D94 26520001 */ addiu $s2, $s2, 1
/* 35198 80059D98 30620002 */ andi $v0, $v1, 2
/* 3519C 80059D9C 14400004 */ bnez $v0, .L80059DB0
/* 351A0 80059DA0 00000000 */ nop
/* 351A4 80059DA4 34620002 */ ori $v0, $v1, 2
/* 351A8 80059DA8 AE020000 */ sw $v0, ($s0)
/* 351AC 80059DAC AE04000C */ sw $a0, 0xc($s0)
.L80059DB0:
/* 351B0 80059DB0 2A42000F */ slti $v0, $s2, 0xf
/* 351B4 80059DB4 1440FFF4 */ bnez $v0, .L80059D88
/* 351B8 80059DB8 26100020 */ addiu $s0, $s0, 0x20
/* 351BC 80059DBC 0000902D */ daddu $s2, $zero, $zero
/* 351C0 80059DC0 2413FFFD */ addiu $s3, $zero, -3
/* 351C4 80059DC4 3C11800B */ lui $s1, %hi(gEffectInstances)
/* 351C8 80059DC8 26314398 */ addiu $s1, $s1, %lo(gEffectInstances)
.L80059DCC:
/* 351CC 80059DCC 8E300000 */ lw $s0, ($s1)
/* 351D0 80059DD0 52000020 */ beql $s0, $zero, .L80059E54
/* 351D4 80059DD4 26520001 */ addiu $s2, $s2, 1
/* 351D8 80059DD8 8E020000 */ lw $v0, ($s0)
/* 351DC 80059DDC 30420001 */ andi $v0, $v0, 1
/* 351E0 80059DE0 5040001C */ beql $v0, $zero, .L80059E54
/* 351E4 80059DE4 26520001 */ addiu $s2, $s2, 1
/* 351E8 80059DE8 8E030010 */ lw $v1, 0x10($s0)
/* 351EC 80059DEC 8C620000 */ lw $v0, ($v1)
/* 351F0 80059DF0 3C048007 */ lui $a0, %hi(gGameStatusPtr)
/* 351F4 80059DF4 8C84419C */ lw $a0, %lo(gGameStatusPtr)($a0)
/* 351F8 80059DF8 00531024 */ and $v0, $v0, $s3
/* 351FC 80059DFC AC620000 */ sw $v0, ($v1)
/* 35200 80059E00 80820070 */ lb $v0, 0x70($a0)
/* 35204 80059E04 10400007 */ beqz $v0, .L80059E24
/* 35208 80059E08 00000000 */ nop
/* 3520C 80059E0C 8E020000 */ lw $v0, ($s0)
/* 35210 80059E10 30420004 */ andi $v0, $v0, 4
/* 35214 80059E14 5040000F */ beql $v0, $zero, .L80059E54
/* 35218 80059E18 26520001 */ addiu $s2, $s2, 1
/* 3521C 80059E1C 0801678D */ j .L80059E34
/* 35220 80059E20 00000000 */ nop
.L80059E24:
/* 35224 80059E24 8E020000 */ lw $v0, ($s0)
/* 35228 80059E28 30420004 */ andi $v0, $v0, 4
/* 3522C 80059E2C 54400009 */ bnel $v0, $zero, .L80059E54
/* 35230 80059E30 26520001 */ addiu $s2, $s2, 1
.L80059E34:
/* 35234 80059E34 8E020010 */ lw $v0, 0x10($s0)
/* 35238 80059E38 8C420010 */ lw $v0, 0x10($v0)
/* 3523C 80059E3C 0040F809 */ jalr $v0
/* 35240 80059E40 0200202D */ daddu $a0, $s0, $zero
/* 35244 80059E44 8E020000 */ lw $v0, ($s0)
/* 35248 80059E48 34420008 */ ori $v0, $v0, 8
/* 3524C 80059E4C AE020000 */ sw $v0, ($s0)
/* 35250 80059E50 26520001 */ addiu $s2, $s2, 1
.L80059E54:
/* 35254 80059E54 2A420060 */ slti $v0, $s2, 0x60
/* 35258 80059E58 1440FFDC */ bnez $v0, .L80059DCC
/* 3525C 80059E5C 26310004 */ addiu $s1, $s1, 4
/* 35260 80059E60 0000902D */ daddu $s2, $zero, $zero
/* 35264 80059E64 3C10800A */ lui $s0, %hi(gEffectGraphicsData)
/* 35268 80059E68 26104000 */ addiu $s0, $s0, %lo(gEffectGraphicsData)
/* 3526C 80059E6C 2611001C */ addiu $s1, $s0, 0x1c
.L80059E70:
/* 35270 80059E70 8E030000 */ lw $v1, ($s0)
/* 35274 80059E74 30620001 */ andi $v0, $v1, 1
/* 35278 80059E78 50400013 */ beql $v0, $zero, .L80059EC8
/* 3527C 80059E7C 26520001 */ addiu $s2, $s2, 1
/* 35280 80059E80 30620002 */ andi $v0, $v1, 2
/* 35284 80059E84 50400010 */ beql $v0, $zero, .L80059EC8
/* 35288 80059E88 26520001 */ addiu $s2, $s2, 1
/* 3528C 80059E8C 8E22FFF0 */ lw $v0, -0x10($s1)
/* 35290 80059E90 10400003 */ beqz $v0, .L80059EA0
/* 35294 80059E94 2442FFFF */ addiu $v0, $v0, -1
/* 35298 80059E98 080167B1 */ j .L80059EC4
/* 3529C 80059E9C AE22FFF0 */ sw $v0, -0x10($s1)
.L80059EA0:
/* 352A0 80059EA0 8E240000 */ lw $a0, ($s1)
/* 352A4 80059EA4 50800005 */ beql $a0, $zero, .L80059EBC
/* 352A8 80059EA8 AE000000 */ sw $zero, ($s0)
/* 352AC 80059EAC 0C00AB1E */ jal general_heap_free
/* 352B0 80059EB0 00000000 */ nop
/* 352B4 80059EB4 AE200000 */ sw $zero, ($s1)
/* 352B8 80059EB8 AE000000 */ sw $zero, ($s0)
.L80059EBC:
/* 352BC 80059EBC 0C019A48 */ jal osUnmapTLB
/* 352C0 80059EC0 0240202D */ daddu $a0, $s2, $zero
.L80059EC4:
/* 352C4 80059EC4 26520001 */ addiu $s2, $s2, 1
.L80059EC8:
/* 352C8 80059EC8 26310020 */ addiu $s1, $s1, 0x20
/* 352CC 80059ECC 2A42000F */ slti $v0, $s2, 0xf
/* 352D0 80059ED0 1440FFE7 */ bnez $v0, .L80059E70
/* 352D4 80059ED4 26100020 */ addiu $s0, $s0, 0x20
.L80059ED8:
/* 352D8 80059ED8 8FBF0020 */ lw $ra, 0x20($sp)
/* 352DC 80059EDC 8FB3001C */ lw $s3, 0x1c($sp)
/* 352E0 80059EE0 8FB20018 */ lw $s2, 0x18($sp)
/* 352E4 80059EE4 8FB10014 */ lw $s1, 0x14($sp)
/* 352E8 80059EE8 8FB00010 */ lw $s0, 0x10($sp)
/* 352EC 80059EEC 03E00008 */ jr $ra
/* 352F0 80059EF0 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,41 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel func_E000C000
/* 328110 E000C000 C4840018 */ lwc1 $f4, 0x18($a0)
/* 328114 E000C004 C480001C */ lwc1 $f0, 0x1c($a0)
/* 328118 E000C008 46002100 */ add.s $f4, $f4, $f0
/* 32811C E000C00C C4880014 */ lwc1 $f8, 0x14($a0)
/* 328120 E000C010 46044200 */ add.s $f8, $f8, $f4
/* 328124 E000C014 C4800010 */ lwc1 $f0, 0x10($a0)
/* 328128 E000C018 46080000 */ add.s $f0, $f0, $f8
/* 32812C E000C01C C4820030 */ lwc1 $f2, 0x30($a0)
/* 328130 E000C020 46020082 */ mul.s $f2, $f0, $f2
/* 328134 E000C024 00000000 */ nop
/* 328138 E000C028 E4800010 */ swc1 $f0, 0x10($a0)
/* 32813C E000C02C 46000286 */ mov.s $f10, $f0
/* 328140 E000C030 C4800034 */ lwc1 $f0, 0x34($a0)
/* 328144 E000C034 46005282 */ mul.s $f10, $f10, $f0
/* 328148 E000C038 00000000 */ nop
/* 32814C E000C03C C48C0004 */ lwc1 $f12, 4($a0)
/* 328150 E000C040 C4860020 */ lwc1 $f6, 0x20($a0)
/* 328154 E000C044 C4800028 */ lwc1 $f0, 0x28($a0)
/* 328158 E000C048 46026300 */ add.s $f12, $f12, $f2
/* 32815C E000C04C C482002C */ lwc1 $f2, 0x2c($a0)
/* 328160 E000C050 E4840018 */ swc1 $f4, 0x18($a0)
/* 328164 E000C054 46020000 */ add.s $f0, $f0, $f2
/* 328168 E000C058 C482000C */ lwc1 $f2, 0xc($a0)
/* 32816C E000C05C C4840024 */ lwc1 $f4, 0x24($a0)
/* 328170 E000C060 460A1080 */ add.s $f2, $f2, $f10
/* 328174 E000C064 E4880014 */ swc1 $f8, 0x14($a0)
/* 328178 E000C068 46002100 */ add.s $f4, $f4, $f0
/* 32817C E000C06C E4800028 */ swc1 $f0, 0x28($a0)
/* 328180 E000C070 C4800008 */ lwc1 $f0, 8($a0)
/* 328184 E000C074 46043180 */ add.s $f6, $f6, $f4
/* 328188 E000C078 E48C0004 */ swc1 $f12, 4($a0)
/* 32818C E000C07C E482000C */ swc1 $f2, 0xc($a0)
/* 328190 E000C080 46060000 */ add.s $f0, $f0, $f6
/* 328194 E000C084 E4840024 */ swc1 $f4, 0x24($a0)
/* 328198 E000C088 E4860020 */ swc1 $f6, 0x20($a0)
/* 32819C E000C08C 03E00008 */ jr $ra
/* 3281A0 E000C090 E4800008 */ swc1 $f0, 8($a0)

View File

@ -1,298 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel fx_6_appendGfx
/* 3288A8 E000C798 27BDFEF8 */ addiu $sp, $sp, -0x108
/* 3288AC E000C79C AFBE0100 */ sw $fp, 0x100($sp)
/* 3288B0 E000C7A0 0080F02D */ daddu $fp, $a0, $zero
/* 3288B4 E000C7A4 3C07DB06 */ lui $a3, 0xdb06
/* 3288B8 E000C7A8 34E70024 */ ori $a3, $a3, 0x24
/* 3288BC E000C7AC 27A40018 */ addiu $a0, $sp, 0x18
/* 3288C0 E000C7B0 AFB200E8 */ sw $s2, 0xe8($sp)
/* 3288C4 E000C7B4 3C120001 */ lui $s2, 1
/* 3288C8 E000C7B8 36521630 */ ori $s2, $s2, 0x1630
/* 3288CC E000C7BC AFB300EC */ sw $s3, 0xec($sp)
/* 3288D0 E000C7C0 3C13800A */ lui $s3, %hi(gMasterGfxPos)
/* 3288D4 E000C7C4 2673A66C */ addiu $s3, $s3, %lo(gMasterGfxPos)
/* 3288D8 E000C7C8 AFBF0104 */ sw $ra, 0x104($sp)
/* 3288DC E000C7CC AFB700FC */ sw $s7, 0xfc($sp)
/* 3288E0 E000C7D0 AFB600F8 */ sw $s6, 0xf8($sp)
/* 3288E4 E000C7D4 AFB500F4 */ sw $s5, 0xf4($sp)
/* 3288E8 E000C7D8 AFB400F0 */ sw $s4, 0xf0($sp)
/* 3288EC E000C7DC AFB100E4 */ sw $s1, 0xe4($sp)
/* 3288F0 E000C7E0 AFB000E0 */ sw $s0, 0xe0($sp)
/* 3288F4 E000C7E4 8E650000 */ lw $a1, ($s3)
/* 3288F8 E000C7E8 8FD4000C */ lw $s4, 0xc($fp)
/* 3288FC E000C7EC 00A0182D */ daddu $v1, $a1, $zero
/* 328900 E000C7F0 24A50008 */ addiu $a1, $a1, 8
/* 328904 E000C7F4 AE650000 */ sw $a1, ($s3)
/* 328908 E000C7F8 96950000 */ lhu $s5, ($s4)
/* 32890C E000C7FC 24A20008 */ addiu $v0, $a1, 8
/* 328910 E000C800 AE620000 */ sw $v0, ($s3)
/* 328914 E000C804 8E880040 */ lw $t0, 0x40($s4)
/* 328918 E000C808 00151080 */ sll $v0, $s5, 2
/* 32891C E000C80C 3C17E001 */ lui $s7, %hi(D_E000CC10)
/* 328920 E000C810 02E2B821 */ addu $s7, $s7, $v0
/* 328924 E000C814 8EF7CC10 */ lw $s7, %lo(D_E000CC10)($s7)
/* 328928 E000C818 3C06E001 */ lui $a2, %hi(D_E000CC24)
/* 32892C E000C81C 00C23021 */ addu $a2, $a2, $v0
/* 328930 E000C820 8CC6CC24 */ lw $a2, %lo(D_E000CC24)($a2)
/* 328934 E000C824 3C02E700 */ lui $v0, 0xe700
/* 328938 E000C828 AC620000 */ sw $v0, ($v1)
/* 32893C E000C82C AC600004 */ sw $zero, 4($v1)
/* 328940 E000C830 ACA70000 */ sw $a3, ($a1)
/* 328944 E000C834 8FC30010 */ lw $v1, 0x10($fp)
/* 328948 E000C838 24A20010 */ addiu $v0, $a1, 0x10
/* 32894C E000C83C AE620000 */ sw $v0, ($s3)
/* 328950 E000C840 3C02DE00 */ lui $v0, 0xde00
/* 328954 E000C844 8C63001C */ lw $v1, 0x1c($v1)
/* 328958 E000C848 310B0007 */ andi $t3, $t0, 7
/* 32895C E000C84C ACA20008 */ sw $v0, 8($a1)
/* 328960 E000C850 3C028000 */ lui $v0, 0x8000
/* 328964 E000C854 ACA6000C */ sw $a2, 0xc($a1)
/* 328968 E000C858 00621821 */ addu $v1, $v1, $v0
/* 32896C E000C85C 31020038 */ andi $v0, $t0, 0x38
/* 328970 E000C860 0002B080 */ sll $s6, $v0, 2
/* 328974 E000C864 ACA30004 */ sw $v1, 4($a1)
/* 328978 E000C868 8E850004 */ lw $a1, 4($s4)
/* 32897C E000C86C 8E860008 */ lw $a2, 8($s4)
/* 328980 E000C870 8E87000C */ lw $a3, 0xc($s4)
/* 328984 E000C874 31080040 */ andi $t0, $t0, 0x40
/* 328988 E000C878 AFAB00D8 */ sw $t3, 0xd8($sp)
/* 32898C E000C87C 0C080108 */ jal shim_guTranslateF
/* 328990 E000C880 AFA800DC */ sw $t0, 0xdc($sp)
/* 328994 E000C884 27B00058 */ addiu $s0, $sp, 0x58
/* 328998 E000C888 3C038007 */ lui $v1, %hi(gCurrentCameraID)
/* 32899C E000C88C 8C637410 */ lw $v1, %lo(gCurrentCameraID)($v1)
/* 3289A0 E000C890 44800000 */ mtc1 $zero, $f0
/* 3289A4 E000C894 00031080 */ sll $v0, $v1, 2
/* 3289A8 E000C898 00431021 */ addu $v0, $v0, $v1
/* 3289AC E000C89C 00021080 */ sll $v0, $v0, 2
/* 3289B0 E000C8A0 00431023 */ subu $v0, $v0, $v1
/* 3289B4 E000C8A4 000218C0 */ sll $v1, $v0, 3
/* 3289B8 E000C8A8 00431021 */ addu $v0, $v0, $v1
/* 3289BC E000C8AC 000210C0 */ sll $v0, $v0, 3
/* 3289C0 E000C8B0 44060000 */ mfc1 $a2, $f0
/* 3289C4 E000C8B4 3C01800B */ lui $at, %hi(gCameras+0x6C)
/* 3289C8 E000C8B8 00220821 */ addu $at, $at, $v0
/* 3289CC E000C8BC C4201DEC */ lwc1 $f0, %lo(gCameras+0x6C)($at)
/* 3289D0 E000C8C0 3C073F80 */ lui $a3, 0x3f80
/* 3289D4 E000C8C4 46000007 */ neg.s $f0, $f0
/* 3289D8 E000C8C8 44050000 */ mfc1 $a1, $f0
/* 3289DC E000C8CC 0200202D */ daddu $a0, $s0, $zero
/* 3289E0 E000C8D0 0C080104 */ jal shim_guRotateF
/* 3289E4 E000C8D4 AFA60010 */ sw $a2, 0x10($sp)
/* 3289E8 E000C8D8 0200202D */ daddu $a0, $s0, $zero
/* 3289EC E000C8DC 27A50018 */ addiu $a1, $sp, 0x18
/* 3289F0 E000C8E0 27B00098 */ addiu $s0, $sp, 0x98
/* 3289F4 E000C8E4 0C080114 */ jal shim_guMtxCatF
/* 3289F8 E000C8E8 0200302D */ daddu $a2, $s0, $zero
/* 3289FC E000C8EC 0200202D */ daddu $a0, $s0, $zero
/* 328A00 E000C8F0 3C108007 */ lui $s0, %hi(gMatrixListPos)
/* 328A04 E000C8F4 261041F0 */ addiu $s0, $s0, %lo(gMatrixListPos)
/* 328A08 E000C8F8 3C11800A */ lui $s1, %hi(gDisplayContext)
/* 328A0C E000C8FC 2631A674 */ addiu $s1, $s1, %lo(gDisplayContext)
/* 328A10 E000C900 96050000 */ lhu $a1, ($s0)
/* 328A14 E000C904 8E220000 */ lw $v0, ($s1)
/* 328A18 E000C908 00052980 */ sll $a1, $a1, 6
/* 328A1C E000C90C 00B22821 */ addu $a1, $a1, $s2
/* 328A20 E000C910 0C080118 */ jal shim_guMtxF2L
/* 328A24 E000C914 00452821 */ addu $a1, $v0, $a1
/* 328A28 E000C918 8E650000 */ lw $a1, ($s3)
/* 328A2C E000C91C 00A0202D */ daddu $a0, $a1, $zero
/* 328A30 E000C920 24A50008 */ addiu $a1, $a1, 8
/* 328A34 E000C924 AE650000 */ sw $a1, ($s3)
/* 328A38 E000C928 96020000 */ lhu $v0, ($s0)
/* 328A3C E000C92C 3C03DA38 */ lui $v1, 0xda38
/* 328A40 E000C930 AC830000 */ sw $v1, ($a0)
/* 328A44 E000C934 24430001 */ addiu $v1, $v0, 1
/* 328A48 E000C938 3042FFFF */ andi $v0, $v0, 0xffff
/* 328A4C E000C93C 00021180 */ sll $v0, $v0, 6
/* 328A50 E000C940 00521021 */ addu $v0, $v0, $s2
/* 328A54 E000C944 A6030000 */ sh $v1, ($s0)
/* 328A58 E000C948 8E230000 */ lw $v1, ($s1)
/* 328A5C E000C94C 02C0802D */ daddu $s0, $s6, $zero
/* 328A60 E000C950 00621821 */ addu $v1, $v1, $v0
/* 328A64 E000C954 06A0001D */ bltz $s5, .LE000C9CC
/* 328A68 E000C958 AC830004 */ sw $v1, 4($a0)
/* 328A6C E000C95C 2AA20002 */ slti $v0, $s5, 2
/* 328A70 E000C960 1040000D */ beqz $v0, .LE000C998
/* 328A74 E000C964 3C03E6DE */ lui $v1, 0xe6de
/* 328A78 E000C968 3463DE6E */ ori $v1, $v1, 0xde6e
/* 328A7C E000C96C 24A20008 */ addiu $v0, $a1, 8
/* 328A80 E000C970 AE620000 */ sw $v0, ($s3)
/* 328A84 E000C974 3C02FA00 */ lui $v0, 0xfa00
/* 328A88 E000C978 ACA20000 */ sw $v0, ($a1)
/* 328A8C E000C97C 24A20010 */ addiu $v0, $a1, 0x10
/* 328A90 E000C980 ACA30004 */ sw $v1, 4($a1)
/* 328A94 E000C984 AE620000 */ sw $v0, ($s3)
/* 328A98 E000C988 3C02FB00 */ lui $v0, 0xfb00
/* 328A9C E000C98C ACA20008 */ sw $v0, 8($a1)
/* 328AA0 E000C990 08003273 */ j .LE000C9CC
/* 328AA4 E000C994 ACB6000C */ sw $s6, 0xc($a1)
.LE000C998:
/* 328AA8 E000C998 2AA20005 */ slti $v0, $s5, 5
/* 328AAC E000C99C 1040000B */ beqz $v0, .LE000C9CC
/* 328AB0 E000C9A0 3463DE82 */ ori $v1, $v1, 0xde82
/* 328AB4 E000C9A4 24A20008 */ addiu $v0, $a1, 8
/* 328AB8 E000C9A8 AE620000 */ sw $v0, ($s3)
/* 328ABC E000C9AC 3C02FA00 */ lui $v0, 0xfa00
/* 328AC0 E000C9B0 ACA20000 */ sw $v0, ($a1)
/* 328AC4 E000C9B4 24A20010 */ addiu $v0, $a1, 0x10
/* 328AC8 E000C9B8 ACA30004 */ sw $v1, 4($a1)
/* 328ACC E000C9BC AE620000 */ sw $v0, ($s3)
/* 328AD0 E000C9C0 3C02FB00 */ lui $v0, 0xfb00
/* 328AD4 E000C9C4 ACA20008 */ sw $v0, 8($a1)
/* 328AD8 E000C9C8 ACB0000C */ sw $s0, 0xc($a1)
.LE000C9CC:
/* 328ADC E000C9CC 16A00002 */ bnez $s5, .LE000C9D8
/* 328AE0 E000C9D0 24040020 */ addiu $a0, $zero, 0x20
/* 328AE4 E000C9D4 24040018 */ addiu $a0, $zero, 0x18
.LE000C9D8:
/* 328AE8 E000C9D8 3C0A800A */ lui $t2, %hi(gMasterGfxPos)
/* 328AEC E000C9DC 254AA66C */ addiu $t2, $t2, %lo(gMasterGfxPos)
/* 328AF0 E000C9E0 3C09F200 */ lui $t1, 0xf200
/* 328AF4 E000C9E4 8FAB00D8 */ lw $t3, 0xd8($sp)
/* 328AF8 E000C9E8 8D450000 */ lw $a1, ($t2)
/* 328AFC E000C9EC 01640018 */ mult $t3, $a0
/* 328B00 E000C9F0 00043880 */ sll $a3, $a0, 2
/* 328B04 E000C9F4 00A0182D */ daddu $v1, $a1, $zero
/* 328B08 E000C9F8 24A50008 */ addiu $a1, $a1, 8
/* 328B0C E000C9FC AD450000 */ sw $a1, ($t2)
/* 328B10 E000CA00 00004012 */ mflo $t0
/* 328B14 E000CA04 00081380 */ sll $v0, $t0, 0xe
/* 328B18 E000CA08 00491025 */ or $v0, $v0, $t1
/* 328B1C E000CA0C AC620000 */ sw $v0, ($v1)
/* 328B20 E000CA10 01041021 */ addu $v0, $t0, $a0
/* 328B24 E000CA14 00023380 */ sll $a2, $v0, 0xe
/* 328B28 E000CA18 00C71025 */ or $v0, $a2, $a3
/* 328B2C E000CA1C AC620004 */ sw $v0, 4($v1)
/* 328B30 E000CA20 8FAB00DC */ lw $t3, 0xdc($sp)
/* 328B34 E000CA24 1160000C */ beqz $t3, .LE000CA58
/* 328B38 E000CA28 24A20008 */ addiu $v0, $a1, 8
/* 328B3C E000CA2C AD420000 */ sw $v0, ($t2)
/* 328B40 E000CA30 00E91025 */ or $v0, $a3, $t1
/* 328B44 E000CA34 00C21025 */ or $v0, $a2, $v0
/* 328B48 E000CA38 ACA20000 */ sw $v0, ($a1)
/* 328B4C E000CA3C 00041040 */ sll $v0, $a0, 1
/* 328B50 E000CA40 01021021 */ addu $v0, $t0, $v0
/* 328B54 E000CA44 00021380 */ sll $v0, $v0, 0xe
/* 328B58 E000CA48 000418C0 */ sll $v1, $a0, 3
/* 328B5C E000CA4C 3C040100 */ lui $a0, 0x100
/* 328B60 E000CA50 0800329E */ j .LE000CA78
/* 328B64 E000CA54 00641825 */ or $v1, $v1, $a0
.LE000CA58:
/* 328B68 E000CA58 AD420000 */ sw $v0, ($t2)
/* 328B6C E000CA5C 00C91025 */ or $v0, $a2, $t1
/* 328B70 E000CA60 ACA20000 */ sw $v0, ($a1)
/* 328B74 E000CA64 00041040 */ sll $v0, $a0, 1
/* 328B78 E000CA68 01021021 */ addu $v0, $t0, $v0
/* 328B7C E000CA6C 00021380 */ sll $v0, $v0, 0xe
/* 328B80 E000CA70 3C030100 */ lui $v1, 0x100
/* 328B84 E000CA74 00E31825 */ or $v1, $a3, $v1
.LE000CA78:
/* 328B88 E000CA78 00431025 */ or $v0, $v0, $v1
/* 328B8C E000CA7C ACA20004 */ sw $v0, 4($a1)
/* 328B90 E000CA80 24020002 */ addiu $v0, $zero, 2
/* 328B94 E000CA84 16A2000A */ bne $s5, $v0, .LE000CAB0
/* 328B98 E000CA88 00000000 */ nop
/* 328B9C E000CA8C 3C03800A */ lui $v1, %hi(gMasterGfxPos)
/* 328BA0 E000CA90 2463A66C */ addiu $v1, $v1, %lo(gMasterGfxPos)
/* 328BA4 E000CA94 8C620000 */ lw $v0, ($v1)
/* 328BA8 E000CA98 0040202D */ daddu $a0, $v0, $zero
/* 328BAC E000CA9C 24420008 */ addiu $v0, $v0, 8
/* 328BB0 E000CAA0 AC620000 */ sw $v0, ($v1)
/* 328BB4 E000CAA4 3C02DE00 */ lui $v0, 0xde00
/* 328BB8 E000CAA8 AC820000 */ sw $v0, ($a0)
/* 328BBC E000CAAC AC970004 */ sw $s7, 4($a0)
.LE000CAB0:
/* 328BC0 E000CAB0 8FC20008 */ lw $v0, 8($fp)
/* 328BC4 E000CAB4 24110001 */ addiu $s1, $zero, 1
/* 328BC8 E000CAB8 0222102A */ slt $v0, $s1, $v0
/* 328BCC E000CABC 10400036 */ beqz $v0, .LE000CB98
/* 328BD0 E000CAC0 26940044 */ addiu $s4, $s4, 0x44
/* 328BD4 E000CAC4 3C16800A */ lui $s6, %hi(gDisplayContext)
/* 328BD8 E000CAC8 26D6A674 */ addiu $s6, $s6, %lo(gDisplayContext)
/* 328BDC E000CACC 3C158007 */ lui $s5, %hi(gMatrixListPos)
/* 328BE0 E000CAD0 26B541F0 */ addiu $s5, $s5, %lo(gMatrixListPos)
/* 328BE4 E000CAD4 3C130001 */ lui $s3, 1
/* 328BE8 E000CAD8 36731630 */ ori $s3, $s3, 0x1630
/* 328BEC E000CADC 3C12800A */ lui $s2, %hi(gMasterGfxPos)
/* 328BF0 E000CAE0 2652A66C */ addiu $s2, $s2, %lo(gMasterGfxPos)
/* 328BF4 E000CAE4 2690000C */ addiu $s0, $s4, 0xc
.LE000CAE8:
/* 328BF8 E000CAE8 27A40018 */ addiu $a0, $sp, 0x18
/* 328BFC E000CAEC 26310001 */ addiu $s1, $s1, 1
/* 328C00 E000CAF0 8E05FFF8 */ lw $a1, -8($s0)
/* 328C04 E000CAF4 8E06FFFC */ lw $a2, -4($s0)
/* 328C08 E000CAF8 8E070000 */ lw $a3, ($s0)
/* 328C0C E000CAFC 0C080108 */ jal shim_guTranslateF
/* 328C10 E000CB00 26100044 */ addiu $s0, $s0, 0x44
/* 328C14 E000CB04 27A40018 */ addiu $a0, $sp, 0x18
/* 328C18 E000CB08 96A50000 */ lhu $a1, ($s5)
/* 328C1C E000CB0C 8EC20000 */ lw $v0, ($s6)
/* 328C20 E000CB10 00052980 */ sll $a1, $a1, 6
/* 328C24 E000CB14 00B32821 */ addu $a1, $a1, $s3
/* 328C28 E000CB18 0C080118 */ jal shim_guMtxF2L
/* 328C2C E000CB1C 00452821 */ addu $a1, $v0, $a1
/* 328C30 E000CB20 3C06D838 */ lui $a2, 0xd838
/* 328C34 E000CB24 8E440000 */ lw $a0, ($s2)
/* 328C38 E000CB28 34C60002 */ ori $a2, $a2, 2
/* 328C3C E000CB2C 0080282D */ daddu $a1, $a0, $zero
/* 328C40 E000CB30 24840008 */ addiu $a0, $a0, 8
/* 328C44 E000CB34 AE440000 */ sw $a0, ($s2)
/* 328C48 E000CB38 96A20000 */ lhu $v0, ($s5)
/* 328C4C E000CB3C 3C03DA38 */ lui $v1, 0xda38
/* 328C50 E000CB40 ACA30000 */ sw $v1, ($a1)
/* 328C54 E000CB44 24430001 */ addiu $v1, $v0, 1
/* 328C58 E000CB48 3042FFFF */ andi $v0, $v0, 0xffff
/* 328C5C E000CB4C 00021180 */ sll $v0, $v0, 6
/* 328C60 E000CB50 A6A30000 */ sh $v1, ($s5)
/* 328C64 E000CB54 8EC30000 */ lw $v1, ($s6)
/* 328C68 E000CB58 00531021 */ addu $v0, $v0, $s3
/* 328C6C E000CB5C 00621821 */ addu $v1, $v1, $v0
/* 328C70 E000CB60 24820008 */ addiu $v0, $a0, 8
/* 328C74 E000CB64 ACA30004 */ sw $v1, 4($a1)
/* 328C78 E000CB68 AE420000 */ sw $v0, ($s2)
/* 328C7C E000CB6C 3C02DE00 */ lui $v0, 0xde00
/* 328C80 E000CB70 AC820000 */ sw $v0, ($a0)
/* 328C84 E000CB74 24020040 */ addiu $v0, $zero, 0x40
/* 328C88 E000CB78 AC970004 */ sw $s7, 4($a0)
/* 328C8C E000CB7C AC860008 */ sw $a2, 8($a0)
/* 328C90 E000CB80 AC82000C */ sw $v0, 0xc($a0)
/* 328C94 E000CB84 8FC20008 */ lw $v0, 8($fp)
/* 328C98 E000CB88 24840010 */ addiu $a0, $a0, 0x10
/* 328C9C E000CB8C 0222102A */ slt $v0, $s1, $v0
/* 328CA0 E000CB90 1440FFD5 */ bnez $v0, .LE000CAE8
/* 328CA4 E000CB94 AE440000 */ sw $a0, ($s2)
.LE000CB98:
/* 328CA8 E000CB98 3C03D838 */ lui $v1, 0xd838
/* 328CAC E000CB9C 3C04800A */ lui $a0, %hi(gMasterGfxPos)
/* 328CB0 E000CBA0 2484A66C */ addiu $a0, $a0, %lo(gMasterGfxPos)
/* 328CB4 E000CBA4 8C820000 */ lw $v0, ($a0)
/* 328CB8 E000CBA8 34630002 */ ori $v1, $v1, 2
/* 328CBC E000CBAC 0040282D */ daddu $a1, $v0, $zero
/* 328CC0 E000CBB0 24420008 */ addiu $v0, $v0, 8
/* 328CC4 E000CBB4 AC820000 */ sw $v0, ($a0)
/* 328CC8 E000CBB8 ACA30000 */ sw $v1, ($a1)
/* 328CCC E000CBBC 24030040 */ addiu $v1, $zero, 0x40
/* 328CD0 E000CBC0 ACA30004 */ sw $v1, 4($a1)
/* 328CD4 E000CBC4 24430008 */ addiu $v1, $v0, 8
/* 328CD8 E000CBC8 AC830000 */ sw $v1, ($a0)
/* 328CDC E000CBCC 3C03E700 */ lui $v1, 0xe700
/* 328CE0 E000CBD0 AC430000 */ sw $v1, ($v0)
/* 328CE4 E000CBD4 AC400004 */ sw $zero, 4($v0)
/* 328CE8 E000CBD8 8FBF0104 */ lw $ra, 0x104($sp)
/* 328CEC E000CBDC 8FBE0100 */ lw $fp, 0x100($sp)
/* 328CF0 E000CBE0 8FB700FC */ lw $s7, 0xfc($sp)
/* 328CF4 E000CBE4 8FB600F8 */ lw $s6, 0xf8($sp)
/* 328CF8 E000CBE8 8FB500F4 */ lw $s5, 0xf4($sp)
/* 328CFC E000CBEC 8FB400F0 */ lw $s4, 0xf0($sp)
/* 328D00 E000CBF0 8FB300EC */ lw $s3, 0xec($sp)
/* 328D04 E000CBF4 8FB200E8 */ lw $s2, 0xe8($sp)
/* 328D08 E000CBF8 8FB100E4 */ lw $s1, 0xe4($sp)
/* 328D0C E000CBFC 8FB000E0 */ lw $s0, 0xe0($sp)
/* 328D10 E000CC00 03E00008 */ jr $ra
/* 328D14 E000CC04 27BD0108 */ addiu $sp, $sp, 0x108
/* 328D18 E000CC08 00000000 */ nop
/* 328D1C E000CC0C 00000000 */ nop

View File

@ -882,7 +882,7 @@ contPakFileState = 0x8005F8A4; // type:func rom:0x3ACA4
contPakFileNum = 0x8005F8D0; // type:func rom:0x3ACD0
contPakRepairId = 0x8005F8FC; // type:func rom:0x3ACFC
osMotorStop = 0x8005F920; // type:func rom:0x3AD20
contRmbControl = 0x8005FB10; // type:func rom:0x3AF10
contRmbRetrace = 0x8005FB10; // type:func rom:0x3AF10
nuContRmbMgrInit = 0x8005FC8C; // type:func rom:0x3B08C
nuContRmbMgrRemove = 0x8005FCEC; // type:func rom:0x3B0EC
contRmbCheckMesg = 0x8005FD10; // type:func rom:0x3B110
@ -4894,7 +4894,7 @@ func_E000C0C8 = 0xE000C0C8; // type:func rom:0x3281D8
fx_6_main = 0xE000C160; // type:func rom:0x328270
fx_6_init = 0xE000C64C; // type:func rom:0x32875C
fx_6_update = 0xE000C654; // type:func rom:0x328764
fx_6_renderWorld = 0xE000C754; // type:func rom:0x328864
fx_6_render = 0xE000C754; // type:func rom:0x328864
func_E000C798 = 0xE000C798; // type:func rom:0x3288A8
fx_7_main = 0xE000E000; // type:func rom:0x32C110
func_E000E16C = 0xE000E16C; // type:func rom:0x32C27C
@ -18529,9 +18529,7 @@ D_800DA47C = 0x800DA47C; // type:data
D_800DA4B4 = 0x800DA4B4; // type:data
D_800DA55C = 0x800DA55C; // type:data
D_800DAAA8 = 0x800DAAA8; // type:data
D_800DAAAC = 0x800DAAAC; // type:data
D_800DAAB8 = 0x800DAAB8; // type:data
D_800DAABC = 0x800DAABC; // type:data
D_800DAABD = 0x800DAABD; // type:data
D_800DAAC0 = 0x800DAAC0; // type:data
nuContPfs = 0x800DAAD8; //
@ -18539,10 +18537,6 @@ nuSiMesgQ = 0x800DAC78; //
D_800DAC90 = 0x800DAC90; // type:data
D_800DACA8 = 0x800DACA8; // type:data
gCurrentSaveFile = 0x800DACC0; //
D_800DBC70 = 0x800DBC70; // type:data
D_800DBD70 = 0x800DBD70; // type:data
D_800DBF70 = 0x800DBF70; // type:data
D_800DBF90 = 0x800DBF90; // type:data
nuContDataMutexQ = 0x800DC040; // type:data
D_800DC060 = 0x800DC060; // type:data
D_800DC064 = 0x800DC064; // type:data
@ -20584,7 +20578,7 @@ D_E00027B0 = 0xE00027B0; // type:data
D_E00027D8 = 0xE00027D8; // type:data
D_E0002800 = 0xE0002800; // type:data
D_E000CC10 = 0xE000CC10; // type:data
D_E000CC24 = 0xE000CC24; // type:data
sDlists2 = 0xE000CC24; // type:data
D_E000CD24 = 0xE000CD24; // type:data
jtbl_E000CD70 = 0xE000CD70; // type:data
D_E000E684 = 0xE000E684; // type:data

View File

@ -1411,7 +1411,6 @@ D_800A0F44 = 0x800A0F44;
D_800A0F50 = 0x800A0F50;
D_800A0F58 = 0x800A0F58;
D_800A1530 = 0x800A1530;
dead_gCurrentCamID = 0x800A158C;
D_800A15A4 = 0x800A15A4;
D_800A15A8 = 0x800A15A8;
D_800A15C4 = 0x800A15C4;
@ -1539,7 +1538,6 @@ D_800B4520 = 0x800B4520;
D_800B6590 = 0x800B6590;
D_800B7EF0 = 0x800B7EF0;
nuYieldBuf = 0x800B8590;
dead_gCameras = 0x800B8D80;
D_800B8DEC = 0x800B8DEC;
D_800B91A0 = 0x800B91A0;
D_800B91D0 = 0x800B91D0;
@ -1566,9 +1564,7 @@ D_800DA47C = 0x800DA47C;
D_800DA4B4 = 0x800DA4B4;
D_800DA55C = 0x800DA55C;
D_800DAAA8 = 0x800DAAA8;
D_800DAAAC = 0x800DAAAC;
D_800DAAB8 = 0x800DAAB8;
D_800DAABC = 0x800DAABC;
D_800DAABD = 0x800DAABD;
D_800DAAC0 = 0x800DAAC0;
nuContPfs = 0x800DAAD8;
@ -1576,10 +1572,6 @@ nuSiMesgQ = 0x800DAC78;
D_800DAC90 = 0x800DAC90;
D_800DACA8 = 0x800DACA8;
gCurrentSaveFile = 0x800DACC0;
D_800DBC70 = 0x800DBC70;
D_800DBD70 = 0x800DBD70;
D_800DBF70 = 0x800DBF70;
D_800DBF90 = 0x800DBF90;
nuContDataMutexQ = 0x800DC040;
D_800DC060 = 0x800DC060;
D_800DC064 = 0x800DC064;
@ -1599,6 +1591,8 @@ D_800DC4F0 = 0x800DC4F0;
D_800DC4F4 = 0x800DC4F4;
D_800DC4F8 = 0x800DC4F8;
D_800DC4FC = 0x800DC4FC;
// end of first segment's BSS
D_8010C920 = 0x8010C920;
D_8010C924 = 0x8010C924;
D_8010C928 = 0x8010C928;
@ -1722,6 +1716,8 @@ gSpinHistoryPosAngle = 0x8010F6B8;
// Invalid pointers from dead code
dead_atan2 = 0x8002AF70;
dead_gCurrentCamID = 0x800A158C;
dead_gCameras = 0x800B8D80;
D_80100060 = 0x80100060;
D_801000A0 = 0x801000A0;
dead_evt_get_variable = 0x802D4E8C;
@ -1741,8 +1737,8 @@ dead_get_enemy = 0x80042AF4;
dead_dist2D = 0x8002B1C4;
dead_get_clamped_angle_diff = 0x8002AF18;
dead_clamp_angle = 0x8002AE14;
dead_ai_enemy_play_sound = 0x8004D800;
dead_add_vec2D_polar = 0x8002B28C;
dead_ai_enemy_play_sound = 0x8004D800;
func_8004D9C0 = 0x8004D9C0;
func_8004DAD8 = 0x8004DAD8;
func_8004DF64 = 0x8004DF64;