commit
b9d2c73ff7
8 changed files with 262 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -9,3 +9,4 @@ objdiff.json
|
|||
orig/*/*
|
||||
!orig/*/.gitkeep
|
||||
/*.txt
|
||||
ctx.c
|
||||
|
|
|
|||
|
|
@ -130,29 +130,29 @@ fn_8000AFF4 = .text:0x8000AFF4; // type:function size:0x15C
|
|||
DrawBox = .text:0x8000B150; // type:function size:0xAC
|
||||
fn_8000B1FC = .text:0x8000B1FC; // type:function size:0xEE8
|
||||
fn_8000C0E4 = .text:0x8000C0E4; // type:function size:0x3C0
|
||||
fn_8000C4A4 = .text:0x8000C4A4; // type:function size:0x14
|
||||
HuPrcInit = .text:0x8000C4A4; // type:function size:0x14
|
||||
HuPrcCreate = .text:0x8000C4B8; // type:function size:0x1E8
|
||||
fn_8000C6A0 = .text:0x8000C6A0; // type:function size:0x68
|
||||
fn_8000C708 = .text:0x8000C708; // type:function size:0x58
|
||||
fn_8000C760 = .text:0x8000C760; // type:function size:0x27C
|
||||
fn_8000C9DC = .text:0x8000C9DC; // type:function size:0x60
|
||||
fn_8000CA3C = .text:0x8000CA3C; // type:function size:0x8
|
||||
fn_8000CA44 = .text:0x8000CA44; // type:function size:0x50
|
||||
fn_8000CA94 = .text:0x8000CA94; // type:function size:0xD4
|
||||
fn_8000CB68 = .text:0x8000CB68; // type:function size:0x2A4
|
||||
fn_8000CE0C = .text:0x8000CE0C; // type:function size:0x100
|
||||
fn_8000CF0C = .text:0x8000CF0C; // type:function size:0x80
|
||||
fn_8000CF8C = .text:0x8000CF8C; // type:function size:0x54
|
||||
fn_8000CFE0 = .text:0x8000CFE0; // type:function size:0xC
|
||||
fn_8000CFEC = .text:0x8000CFEC; // type:function size:0x8
|
||||
fn_8000CFF4 = .text:0x8000CFF4; // type:function size:0x28
|
||||
fn_8000D01C = .text:0x8000D01C; // type:function size:0x184
|
||||
fn_8000D1A0 = .text:0x8000D1A0; // type:function size:0x4C
|
||||
fn_8000D1EC = .text:0x8000D1EC; // type:function size:0x30
|
||||
fn_8000D21C = .text:0x8000D21C; // type:function size:0x10
|
||||
fn_8000D22C = .text:0x8000D22C; // type:function size:0x14
|
||||
fn_8000D240 = .text:0x8000D240; // type:function size:0x84
|
||||
fn_8000D2C4 = .text:0x8000D2C4; // type:function size:0x84
|
||||
HuPrcChildLink = .text:0x8000C6A0; // type:function size:0x68
|
||||
HuPrcChildUnlink = .text:0x8000C708; // type:function size:0x58
|
||||
HuPrcChildCreate = .text:0x8000C760; // type:function size:0x27C
|
||||
HuPrcChildWatch = .text:0x8000C9DC; // type:function size:0x60
|
||||
HuPrcCurrentGet = .text:0x8000CA3C; // type:function size:0x8
|
||||
SetKillStatusProcess = .text:0x8000CA44; // type:function size:0x50 scope:local
|
||||
HuPrcKill = .text:0x8000CA94; // type:function size:0xD4
|
||||
HuPrcChildKill = .text:0x8000CB68; // type:function size:0x2A4
|
||||
HuPrcEnd = .text:0x8000CE0C; // type:function size:0x100
|
||||
HuPrcSleep = .text:0x8000CF0C; // type:function size:0x80
|
||||
HuPrcVSleep = .text:0x8000CF8C; // type:function size:0x54
|
||||
HuPrcWakeup = .text:0x8000CFE0; // type:function size:0xC
|
||||
HuPrcDestructorSet2 = .text:0x8000CFEC; // type:function size:0x8
|
||||
HuPrcDestructorSet = .text:0x8000CFF4; // type:function size:0x28
|
||||
HuPrcCall = .text:0x8000D01C; // type:function size:0x184
|
||||
HuPrcMemAlloc = .text:0x8000D1A0; // type:function size:0x4C
|
||||
HuPrcMemFree = .text:0x8000D1EC; // type:function size:0x30
|
||||
HuPrcSetStat = .text:0x8000D21C; // type:function size:0x10
|
||||
HuPrcResetStat = .text:0x8000D22C; // type:function size:0x14
|
||||
HuPrcAllPause = .text:0x8000D240; // type:function size:0x84
|
||||
HuPrcAllUPause = .text:0x8000D2C4; // type:function size:0x84
|
||||
HuSprInit = .text:0x8000D348; // type:function size:0xA0
|
||||
HuSprClose = .text:0x8000D3E8; // type:function size:0xB0
|
||||
HuSprExec = .text:0x8000D498; // type:function size:0x64
|
||||
|
|
|
|||
|
|
@ -15,4 +15,19 @@ typedef struct Vec3f {
|
|||
f32 z;
|
||||
} Vec3f;
|
||||
|
||||
#endif
|
||||
typedef struct unkStruct145A98 {
|
||||
s16 unk_00;
|
||||
char unk_02[10];
|
||||
s16 unk_0C;
|
||||
char unk_0E[6];
|
||||
u8 unk_14;
|
||||
char unk_15[0x53];
|
||||
} unkStruct145A98; // sizeof 0x68
|
||||
|
||||
typedef struct unkStruct1D3B44 {
|
||||
struct unkStruct1D3B44 *prev;
|
||||
char unk_04[0x1A];
|
||||
u16 unk_1E;
|
||||
} unkStruct1D3B44; // sizeof ???
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "common_structs.h"
|
||||
|
||||
void* HuPrcCreate(void (*), s32, s32, s32);
|
||||
void HuPrcSleep(s32, f32);
|
||||
void HuPrcVSleep(void);
|
||||
void Hu3DBGColorSet(u8, u8, u8);
|
||||
void Hu3DCameraCreate(s16);
|
||||
void Hu3DCameraPerspectiveSet(s16, f32, f32, f32, f32);
|
||||
|
|
@ -18,7 +20,6 @@ s32 fn_800578E4(void);
|
|||
void fn_1_26C(void);
|
||||
|
||||
void HuDecodeData(void *src, void *dst, u32 size, int decode_type);
|
||||
|
||||
void HuMemInitAll(void);
|
||||
void *HuMemInit(void *ptr, s32 size);
|
||||
void HuMemDCFlushAll();
|
||||
|
|
@ -44,4 +45,4 @@ void HuMemHeapDump(void *heap_ptr, s16 status);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
20
src/REL/subchrselDll/subchrselDll.c
Normal file
20
src/REL/subchrselDll/subchrselDll.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "subchrselDll.h"
|
||||
|
||||
void fn_1_A0(void) {
|
||||
void* sp8 = omInitObjMan(0x32, 0x2000);
|
||||
Hu3DBGColorSet(0U, 0U, 0U);
|
||||
fn_8000C760(&fn_1_164, 0x1000, 0x3000, 0, fn_8000CA3C());
|
||||
fn_800414AC(1, 0, -1);
|
||||
}
|
||||
|
||||
u16 fn_1_10C(void) {
|
||||
u16 var_r31;
|
||||
|
||||
var_r31 = lbl_801D3AD0;
|
||||
if (lbl_1_bss_0 != lbl_801D3AAC) {
|
||||
var_r31 |= lbl_801D3AAC;
|
||||
}
|
||||
return var_r31;
|
||||
}
|
||||
|
||||
// void fn_1_164(void)
|
||||
38
src/REL/subchrselDll/subchrselDll.h
Normal file
38
src/REL/subchrselDll/subchrselDll.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include "common.h"
|
||||
#include "REL/executor.h"
|
||||
|
||||
void fn_8000C760(void*, s32, s32, s32, s32);
|
||||
s32 fn_8000CA3C();
|
||||
void fn_800414AC(s16, s16, s16);
|
||||
|
||||
extern u8 lbl_1_bss_0;
|
||||
extern u8 lbl_801D3AAC;
|
||||
extern u16 lbl_801D3AD0;
|
||||
|
||||
typedef struct unkStruct192360 {
|
||||
char unk_00[0x34];
|
||||
f32 unk_34;
|
||||
} unkStruct192360;
|
||||
|
||||
s16 fn_8000AFF4(s16, s16, f32, char*, ...); /* extern */
|
||||
void fn_8000CF0C(s32, f32); /* extern */
|
||||
void fn_8000CF8C(); /* extern */
|
||||
void fn_8002EEC0(s32, s16, s32, s32); /* extern */
|
||||
void fn_8002EF20(s16, s16); /* extern */
|
||||
void fn_80032A58(s32); /* extern */
|
||||
void fn_80035A0C(void); /* extern */
|
||||
void fn_800414AC(s16, s16, s16); /* extern */
|
||||
extern s32 debugFontColor;
|
||||
extern u8 lbl_1_bss_0;
|
||||
extern char *lbl_1_data_20[4];
|
||||
extern char *lbl_1_data_64[8];
|
||||
extern char *lbl_1_data_B0[7];
|
||||
extern char lbl_1_data_CC[20];
|
||||
extern s16 lbl_8018FC10[];
|
||||
extern unkStruct192360 lbl_80192360;
|
||||
extern u8 lbl_801D3AAC;
|
||||
extern u16 lbl_801D3AD0;
|
||||
|
||||
void fn_1_A0(void);
|
||||
u16 fn_1_10C(void);
|
||||
void fn_1_164(void);
|
||||
89
src/unsplit/unsplit.c
Normal file
89
src/unsplit/unsplit.c
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include "common.h"
|
||||
|
||||
extern unkStruct145A98 lbl_80145A98[0x100];
|
||||
extern s32 debugFontColor;
|
||||
extern s16 lbl_801D3B2C;
|
||||
extern s16 lbl_801D3B2E;
|
||||
extern unkStruct1D3B44* lbl_801D3B44;
|
||||
|
||||
void fn_8000AEF0(void) {
|
||||
s32 i;
|
||||
|
||||
debugFontColor = 0xF;
|
||||
lbl_801D3B2E = 0;
|
||||
|
||||
for (i = 0; i < 0x100; i++) {
|
||||
lbl_80145A98[i].unk_14 = 0;
|
||||
}
|
||||
fn_8000AF54();
|
||||
}
|
||||
|
||||
void fn_8000AF54(void) {
|
||||
s32 i;
|
||||
|
||||
lbl_801D3B2E = 0;
|
||||
lbl_801D3B2C = 0;
|
||||
for (i = 0; i < 0x100; i++) {
|
||||
lbl_80145A98[i].unk_0C = (s16) (i + 1);
|
||||
lbl_80145A98[i].unk_00 = 0;
|
||||
if (lbl_80145A98[i].unk_14 != 0) {
|
||||
lbl_80145A98[i].unk_14 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HuPrcCall
|
||||
|
||||
// HuPrcMemAlloc
|
||||
|
||||
// HuPrcMemFree
|
||||
|
||||
void HuPrcSetStat(unkStruct1D3B44* arg0, u16 arg1) {
|
||||
arg0->unk_1E |= arg1;
|
||||
}
|
||||
|
||||
void HuPrcResetStat(unkStruct1D3B44* arg0, s32 arg1) {
|
||||
arg0->unk_1E &= ~arg1;
|
||||
}
|
||||
|
||||
void HuPrcAllPause(s32 arg0) {
|
||||
unkStruct1D3B44* var_r31;
|
||||
|
||||
var_r31 = lbl_801D3B44;
|
||||
if (arg0 != 0) {
|
||||
while (var_r31 != NULL) {
|
||||
if ((var_r31->unk_1E & 4) == 0) {
|
||||
var_r31->unk_1E |= (u16) 1;
|
||||
}
|
||||
var_r31 = var_r31->prev;
|
||||
}
|
||||
return;
|
||||
}
|
||||
while (var_r31 != NULL) {
|
||||
if ((var_r31->unk_1E & 1) != 0) {
|
||||
var_r31->unk_1E &= -2;
|
||||
}
|
||||
var_r31 = var_r31->prev;
|
||||
}
|
||||
}
|
||||
|
||||
void HuPrcAllUPause(s32 arg0) {
|
||||
unkStruct1D3B44* var_r31;
|
||||
|
||||
var_r31 = lbl_801D3B44;
|
||||
if (arg0 != 0) {
|
||||
while (var_r31 != NULL) {
|
||||
if ((var_r31->unk_1E & 8) == 0) {
|
||||
var_r31->unk_1E |= (u16) 2;
|
||||
}
|
||||
var_r31 = var_r31->prev;
|
||||
}
|
||||
return;
|
||||
}
|
||||
while (var_r31 != NULL) {
|
||||
if ((var_r31->unk_1E & 2) != 0) {
|
||||
var_r31->unk_1E &= -3;
|
||||
}
|
||||
var_r31 = var_r31->prev;
|
||||
}
|
||||
}
|
||||
73
tools/m2ctx.py
Normal file
73
tools/m2ctx.py
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
script_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
|
||||
src_dir = root_dir + "src/"
|
||||
|
||||
# Project-specific
|
||||
CPP_FLAGS = [
|
||||
"-Iinclude",
|
||||
"-Isrc",
|
||||
"-Ibuild/include",
|
||||
"-Iinclude/engine",
|
||||
"-D_LANGUAGE_C",
|
||||
"-DF3DEX_GBI_2",
|
||||
"-D_MIPS_SZLONG=32",
|
||||
"-D__attribute__(...)=",
|
||||
"-D__asm__(...)=",
|
||||
"-ffreestanding",
|
||||
"-DM2CTX",
|
||||
]
|
||||
|
||||
def import_c_file(in_file) -> str:
|
||||
in_file = os.path.relpath(in_file, root_dir)
|
||||
cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file]
|
||||
cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, in_file]
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
|
||||
stock_macros = subprocess.check_output(["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8")
|
||||
|
||||
out_text = ""
|
||||
try:
|
||||
out_text += subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
|
||||
out_text += subprocess.check_output(cpp_command2, cwd=root_dir, encoding="utf-8")
|
||||
except subprocess.CalledProcessError:
|
||||
print(
|
||||
"Failed to preprocess input file, when running command:\n"
|
||||
+ ' '.join(cpp_command),
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
if not out_text:
|
||||
print("Output is empty - aborting")
|
||||
sys.exit(1)
|
||||
|
||||
for line in stock_macros.strip().splitlines():
|
||||
out_text = out_text.replace(line + "\n", "")
|
||||
return out_text
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Create a context file which can be used for mips_to_c"""
|
||||
)
|
||||
parser.add_argument(
|
||||
"c_file",
|
||||
help="""File from which to create context""",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
output = import_c_file(args.c_file)
|
||||
|
||||
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
|
||||
f.write(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue