mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
[ntsc-1.2] Decompile fault.c (#2046)
* wip decomp ntsc-1.2 fault.c * more ntsc-1.2 fault.c * decompiled fault_v1.c * name fault_v1 functions, wip * try to clean up build system (two versions of the fault system coexisting) * cleanup * cleanup2 * fix build gc-eu-mq-dbg * match 2 more, ty anon * matched * review * more review * fixup spec * `(uintptr_t)ptr op int` instead of `ptr op (type*)int` * move fault.h out of global headers, properly include fault.h and versions.h * compile all fault_*.c files regardless of version by overriding FAULT_VERSION * n64 FaultMgr.framebuffer s32 -> u16* * FaultMgr.framebuffer -> FaultMgr.fb * make gc FaultMgr.fb u16* (yes, thats everything) * bss * fix Fault_Printf return type * noop FaultDrawer_SetFontColor, FaultDrawer_SetCharPad in fault_n64 * fault_color_ stuff is only for fault_gc * rm empty line in makefile * I guess `D_80105A90_unknown` is `[sg]TotalAllocFailures` * bss * `Fault_WaitInput` -> `Fault_WaitForInput` * use named fault funcs in pointers array * FAULT_OOT{N64,GC} -> FAULT_{N64,GC} * Apply suggestions from code review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com> * review, sync fault_{gc,n64} * Apply `FPCSR_CE` suggestions from code review Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> --------- Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: Anghelo Carvajal <angheloalf95@gmail.com>
This commit is contained in:
parent
aa97586659
commit
68818044db
34 changed files with 1031 additions and 80 deletions
|
@ -25,16 +25,16 @@ def get_c_file(directory):
|
|||
return file
|
||||
|
||||
|
||||
def import_c_file(in_file):
|
||||
def import_c_file(in_file, version):
|
||||
in_file = os.path.relpath(in_file, root_dir)
|
||||
cpp_command = ["gcc", "-E", "-P", "-Iinclude", "-Isrc", "-undef", "-DM2CTX", "-D__sgi", "-D_LANGUAGE_C",
|
||||
cpp_command = ["gcc", "-nostdinc", "-E", "-P", "-Iinclude", "-Iinclude/libc", "-Isrc", f"-Ibuild/{version}", "-I.", f"-Iextracted/{version}", "-undef", "-DM2CTX", "-D__sgi", "-D_LANGUAGE_C",
|
||||
"-DNON_MATCHING", "-D_Static_assert(x, y)=", "-D__attribute__(x)=", in_file]
|
||||
try:
|
||||
return subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
|
||||
except subprocess.CalledProcessError:
|
||||
print(
|
||||
"Failed to preprocess input file, when running command:\n"
|
||||
+ cpp_command,
|
||||
+ " ".join(cpp_command),
|
||||
file=sys.stderr,
|
||||
)
|
||||
sys.exit(1)
|
||||
|
@ -45,8 +45,11 @@ def main():
|
|||
description="Creates a ctx.c file for mips2c. "
|
||||
"Output will be saved as oot/ctx.c")
|
||||
parser.add_argument('filepath', help="path of c file to be processed")
|
||||
parser.add_argument("-v", "--oot-version", dest="oot_version", required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
version = args.oot_version
|
||||
|
||||
if args.filepath:
|
||||
c_file_path = args.filepath
|
||||
print("Using file: {}".format(c_file_path))
|
||||
|
@ -60,7 +63,7 @@ def main():
|
|||
c_file_path = os.path.join(c_dir_path, c_file)
|
||||
print("Using file: {}".format(c_file_path))
|
||||
|
||||
output = import_c_file(c_file_path)
|
||||
output = import_c_file(c_file_path, version)
|
||||
|
||||
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
|
||||
f.write(output)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue