papermario/tools/get_variable.py
Alexander Faßbender afab424519
Rename all si_funcs to evt_funcs (#403)
* resolve #397

* fix libultra

* Match func_80144E4C (#406)

* Update hud_element.c

* Update hud_element.h

* Update hud_element.h

* Delete func_80144E4C.s

* Trigger funcs (#405)

* remove old tools, fix warnings

* almost match si_handle_print_debug_var

* si_goto_end_loop and warnings

* is_trigger_bound and create_trigger

* Cleanup + matching 2 non-matchings

* update_triggers (trigger.c complete)

* fix warnings

* PR comments, m2ctx.py fix

* combine PR #398 with #403

* More entity decomp (#402)

* More entity decomp

* cleanup

* Vec3f instead of 3 floats in structE307C0

* resolve #397

* fix libultra

* combine PR #398 with #403

* decompile evt_goto_end_loop

Co-authored-by: JoshDuMan <40190173+JoshDuMan@users.noreply.github.com>
Co-authored-by: Ethan Roseman <ethteck@gmail.com>
Co-authored-by: JaThePlayer <50085307+JaThePlayer@users.noreply.github.com>
2021-08-29 23:34:42 +09:00

30 lines
1.1 KiB
Python
Executable File

#!/usr/bin/python3
def get_variable(arg):
v = arg - 2**32 # convert to s32
if v > -250000000:
if v <= -220000000: return f"EVT_FIXED({(v + 230000000) / 1024})"
elif v <= -200000000: return f"EVT_ARRAY_FLAG({v + 210000000})"
elif v <= -180000000: return f"EVT_ARRAY({v + 190000000})"
elif v <= -160000000: return f"EVT_SAVE_VAR({v + 170000000})"
elif v <= -140000000: return f"EVT_AREA_VAR({v + 150000000})"
elif v <= -120000000: return f"EVT_SAVE_FLAG({v + 130000000})"
elif v <= -100000000: return f"EVT_AREA_FLAG({v + 110000000})"
elif v <= -80000000: return f"EVT_MAP_FLAG({v + 90000000})"
elif v <= -60000000: return f"EVT_FLAG({v + 70000000})"
elif v <= -40000000: return f"EVT_MAP_VAR({v + 50000000})"
elif v <= -20000000: return f"EVT_VAR({v + 30000000})"
if arg == 0xFFFFFFFF:
return "-1"
elif (arg & 0xFF000000) == 0x80000000:
return f"0x{arg:X}"
elif arg >= 0x80000000:
return f"{arg - 0x100000000}"
else:
return f"{arg}"
if __name__ == "__main__":
import sys
print(get_variable(int(sys.argv[1], 0)))