mirror of
https://github.com/zeldaret/af.git
synced 2026-09-26 13:33:16 -04:00
@@ -74,7 +74,7 @@ cKF_c_obj_s_toudai_tbl = 0x0607EE30; // segment:object_00D5E000 rom:0xDDCE30
|
||||
cKF_ds_obj_s_toudai_tbl = 0x0607EE60; // segment:object_00D5E000 rom:0xDDCE60
|
||||
cKF_ba_r_obj_s_toudai = 0x0607EE6C; // segment:object_00D5E000 rom:0xDDCE6C
|
||||
|
||||
obj_w_toudai_v = 0x0607EE90; // segment:object_00D5E000 rom:0xDDCE90 size:0x990
|
||||
obj_w_toudai_v = 0x0607EE90; // segment:object_00D5E000 rom:0xDDCE90 size:0x950
|
||||
obj_w_toudai_mirror_model = 0x0607F7E0; // segment:object_00D5E000 rom:0xDDD7E0
|
||||
obj_w_toudai_glass_model = 0x0607F8A8; // segment:object_00D5E000 rom:0xDDD8A8
|
||||
obj_w_toudai_body_model = 0x0607F978; // segment:object_00D5E000 rom:0xDDD978
|
||||
|
||||
@@ -4175,8 +4175,6 @@ func_800FEE10_jp = 0x800FEE10; // type:func
|
||||
func_800FEF9C_jp = 0x800FEF9C; // type:func
|
||||
func_800FF060_jp = 0x800FF060; // type:func
|
||||
gspS2DEX2_fifoTextStart = 0x800FF370; // type:u64 size:0x18C0 name_end:gspS2DEX2_fifoTextEnd
|
||||
func_801002CC_jp = 0x801002CC; // type:func
|
||||
D_801002F0_jp = 0x801002F0; //
|
||||
|
||||
// .data
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ D_FLT_8003CFA0_jp = 0x8003CFA0; // type:f32
|
||||
osViModeNtscLan1 = 0x8003CFB0; // size:0x50 (vi, false)
|
||||
osViModeMpalLan1 = 0x8003D000; // size:0x50 (vi, false)
|
||||
|
||||
vi = 0x8003D050; // size:0x70 (vi, false)
|
||||
vi = 0x8003D050; // size:0x60 (vi, false)
|
||||
__osViCurr = 0x8003D0B0; // size:0x4 (vi, true)
|
||||
__osViNext = 0x8003D0B4; // size:0x4 (vi, true)
|
||||
|
||||
|
||||
+26
-12
@@ -17,6 +17,7 @@ CPP_FLAGS = [
|
||||
"-Ibin",
|
||||
"-Ilib/ultralib/include",
|
||||
"-Ilib/ultralib/include/PR",
|
||||
"-Ilib/ultralib/include/ido",
|
||||
|
||||
"-D_LANGUAGE_C",
|
||||
"-DF3DEX_GBI_2",
|
||||
@@ -34,19 +35,16 @@ CPP_FLAGS = [
|
||||
"-std=gnu89",
|
||||
]
|
||||
|
||||
def import_c_file(in_file, version: str) -> str:
|
||||
def import_c_file(in_file) -> str:
|
||||
in_file = os.path.relpath(in_file, root_dir)
|
||||
|
||||
cpp_command = ["gcc", "-E", "-P", "-undef", "-dM", *CPP_FLAGS, in_file]
|
||||
cpp_command2 = ["gcc", "-E", "-P", "-undef", *CPP_FLAGS, in_file]
|
||||
cpp_command = ["gcc", "-E", "-P", "-dD", *CPP_FLAGS, in_file]
|
||||
|
||||
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
|
||||
stock_macros = subprocess.check_output(["gcc", "-E", "-P", "-undef", "-dM", tmp.name], cwd=root_dir, encoding="utf-8")
|
||||
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")
|
||||
out_text = subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
|
||||
except subprocess.CalledProcessError:
|
||||
print(
|
||||
"Failed to preprocess input file, when running command:\n"
|
||||
@@ -59,22 +57,37 @@ def import_c_file(in_file, version: str) -> str:
|
||||
print("Output is empty - aborting")
|
||||
sys.exit(1)
|
||||
|
||||
defines = {}
|
||||
source_lines = []
|
||||
for line in out_text.splitlines(keepends=True):
|
||||
if line.startswith("#define"):
|
||||
sym = line.split()[1].split("(")[0]
|
||||
defines[sym] = line
|
||||
elif line.startswith("#undef"):
|
||||
sym = line.split()[1]
|
||||
if sym in defines:
|
||||
del defines[sym]
|
||||
else:
|
||||
source_lines.append(line)
|
||||
|
||||
for line in stock_macros.strip().splitlines():
|
||||
out_text = out_text.replace(line + "\n", "")
|
||||
return out_text
|
||||
sym = line.split()[1].split("(")[0]
|
||||
if sym in defines:
|
||||
del defines[sym]
|
||||
|
||||
return "".join(defines.values()) + "".join(source_lines)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="""Create a context file which can be used for m2c"""
|
||||
description="""Create a context file which can be used for m2c / decomp.me"""
|
||||
)
|
||||
parser.add_argument(
|
||||
"c_file",
|
||||
help="""File from which to create context""",
|
||||
)
|
||||
parser.add_argument("-v", "--version", help="Which version should be processed", default="us", choices=["us", "cn"])
|
||||
args = parser.parse_args()
|
||||
|
||||
output = import_c_file(args.c_file, args.version)
|
||||
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)
|
||||
@@ -82,3 +95,4 @@ def main():
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user