From 3c19c4c6f75f368dc7084f48883c72b93229620f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:07:01 +0000 Subject: [PATCH 01/25] decomp: define the boot messages and formats of ten units in C printfloat, init_once, print_register_values_and_halt, dec_bs0, mpeg_error, snd_start_sound_system, snd_returns, snd_bank_load_from_ee_cb and snd_send_iop_command_no_wait now define the strings only they read; their RODATA/SDATA entries place them. --- configure.py | 13 ++++++++++--- src/audio/banks/snd_bank_load_from_ee_cb.c | 7 +++++-- src/audio/rpc/snd_returns.c | 4 +++- src/audio/rpc/snd_send_iop_command_no_wait.c | 5 ++++- src/audio/snd_start_sound_system.c | 11 +++++++---- src/movies/decoder/callbacks/mpeg_error.c | 4 +++- src/movies/decoder/dec_bs0.c | 8 +++++--- src/runtime/debug/print_register_values_and_halt.c | 9 +++++---- src/runtime/startup/init_once.c | 13 +++++++++---- src/sdk/deci2/printfloat.c | 9 ++++++--- 10 files changed, 57 insertions(+), 26 deletions(-) diff --git a/configure.py b/configure.py index 6428bc6117..1ec25699e0 100755 --- a/configure.py +++ b/configure.py @@ -946,11 +946,16 @@ # as the splat symbol jtbl_00153AA0, so the compiled .rodata must land at # the same VMA/file offset for the relocations to resolve content-equal. "_getpic": (0x153AA0, 0x54A20, 20), - "sdk/deci2/printfloat": (0x152798, 0x53718, 24), # its three f64 literals (0.1, 0.1, 1e6) + "sdk/deci2/printfloat": (0x152780, 0x53700, 48), # its three formats and three f64 literals (0.1, 0.1, 1e6) "sdk/deci2/printf_impl": (0x1527B0, 0x53730, 292), # _printf's format switch table (jtbl_001527B0) "audio/rpc/snd_send_iop_command_and_wait": (0x153D20, 0x54CA0, 26), # its RPC-collision message "audio/banks/snd_bank_load_by_loc": (0x153DA8, 0x54D28, 77), # its two error messages - "audio/rpc/snd_send_iop_command_no_wait": (0x154010, 0x54F90, 96), # its buffer-full message + "audio/rpc/snd_send_iop_command_no_wait": (0x154010, 0x54F90, 141), # its buffer-full and continuing messages + "audio/snd_start_sound_system": (0x153C50, 0x54BD0, 70), # its bind error and source file name + "audio/rpc/snd_returns": (0x153C98, 0x54C18, 82), # its no-returns message + "audio/banks/snd_bank_load_from_ee_cb": (0x153EC0, 0x54E40, 89), # its two error messages + "runtime/debug/print_register_values_and_halt": (0x1E8A08, 0xE9988, 71), # its three messages + "movies/decoder/dec_bs0": (0x1E8B38, 0xE9AB8, 57), # its two messages "sdk/mpeg/errors/print_mpeg_error": (0x153AD8, 0x54A58, 16), # its error message "sdk/graph/sce_gs_set_def_load_image": (0x1530B0, 0x54030, 284), # its error message and switch table "update_menu_resource_stream": (0x1E87F0, 0xE9770, 28), # stream-state switch table @@ -972,7 +977,7 @@ "mobys/animation/update_resident_dialogue_animation_state": (0x1E8A90, 0xE9A10, 52), # switch table "update_help_state": (0x1E7A40, 0xE89C0, 36), # switch table "memcard_update_state": (0x1E8200, 0xE9180, 348), # switch table - "init_once": (0x1E7B30, 0xE8AB0, 20), # switch table + "init_once": (0x1E7AE0, 0xE8A60, 100), # its three strings and switch table "actuator_calc_power": (0x1E7640, 0xE85C0, 24), # switch table "resolve_moby_hit_response": (0x1E84E0, 0xE9460, 128), # switch table "service_level_archive_load": (0x1E7CE0, 0xE8C60, 32), # switch table @@ -1033,6 +1038,8 @@ "rendering/frame/swap_render_buffer_chain": (0x160F04, 0x61E84, 4), "rendering/texture/dma_tie_textures": (0x160F74, 0x61EF4, 4), "ui/hud/update_hud": (0x15F688, 0x60608, 4), + "movies/decoder/callbacks/mpeg_error": (0x161220, 0x621A0, 4), # its "%s\n" format + "runtime/startup/init_once": (0x15FA88, 0x60A08, 14), # its reboot message } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/audio/banks/snd_bank_load_from_ee_cb.c b/src/audio/banks/snd_bank_load_from_ee_cb.c index 7fb1315339..1af06dd749 100644 --- a/src/audio/banks/snd_bank_load_from_ee_cb.c +++ b/src/audio/banks/snd_bank_load_from_ee_cb.c @@ -9,8 +9,6 @@ extern s64 snd_cd_callback_data __asm__("D_0015ECD8"); extern u32 snd_cd_callback_arg __asm__("D_0015ED00"); extern s32 snd_cd_bank_load_request[4] __asm__("D_00137B40"); extern u8 sound_stream_client[] __asm__("D_0015EBE8"); -extern char snd_bank_load_from_ee_progress_string[] __asm__("D_00153EC0"); -extern char snd_bank_load_from_ee_cd_busy_string[] __asm__("D_00153EF8"); extern char snd_non_idle_error_string[] __asm__("D_00153D20"); extern s32 snd_stream_safe_cd_sync(s32) __asm__("func_0012EE08"); extern s32 snd_flush_sound_commands(void) __asm__("func_0012DC80"); @@ -20,6 +18,11 @@ extern s32 FlushCache(s32); // HI16/LO16 pair instead of a gp-relative reference. void snd_bank_load_from_ee_cb(s32 cmd, s32 arg, s64 data) __asm__("FUN_0012e088"); +const char snd_bank_load_from_ee_progress_string[] __asm__("D_00153EC0") = + "snd_BankLoadFromEE_CB: Load already in progress!\n"; +const char snd_bank_load_from_ee_cd_busy_string[] __asm__("D_00153EF8") = + "snd_BankLoadFromEE_CB: CD BUSY!\n"; + void snd_bank_load_from_ee_cb(s32 cmd, s32 callback_address, s64 callback_user_data) { snd_cd_load_error = 0; if (snd_cd_callback_pending != 0) { diff --git a/src/audio/rpc/snd_returns.c b/src/audio/rpc/snd_returns.c index adbc3b1529..eccdc09322 100644 --- a/src/audio/rpc/snd_returns.c +++ b/src/audio/rpc/snd_returns.c @@ -8,9 +8,11 @@ gp-relative, which needs their definitions ahead of them. */ s32 *snd_current_buffer __asm__("D_0015EC80") = 0; s32 snd_current_buffer_index __asm__("D_0015EC84") = 0; -extern u8 snd_no_return_error_string[] __asm__("D_00153C98"); extern void FlushCache(); +const char snd_no_return_error_string[] __asm__("D_00153C98") = + "989snd.c: Sif says RPC isn't busy, but we still don't have returns from the IOP!\n"; + s32 snd_got_returns(void) __asm__("FUN_0012de70"); s32 snd_got_returns(void) { diff --git a/src/audio/rpc/snd_send_iop_command_no_wait.c b/src/audio/rpc/snd_send_iop_command_no_wait.c index 417a7c0ff5..970c2c6312 100644 --- a/src/audio/rpc/snd_send_iop_command_no_wait.c +++ b/src/audio/rpc/snd_send_iop_command_no_wait.c @@ -17,7 +17,7 @@ extern s32 snd_batch_free_bytes[2] __asm__("D_0015ECA8") __attribute__ extern struct SndCb *snd_stream_buffers[2] __asm__("D_0015ECB0") __attribute__((sda)); extern u8 sound_command_client[] __asm__("D_0015EBC0"); extern char snd_non_idle_error_string[] __asm__("D_00153D20"); -extern char snd_no_wait_continuing_string[] __asm__("D_00154070"); +extern const char snd_no_wait_continuing_string[] __asm__("D_00154070"); extern s32 snd_flush_sound_commands(void) __asm__("func_0012DC80"); extern void snd_post_message(void) __asm__("func_0012E9A0"); extern s32 FlushCache(s32); @@ -88,3 +88,6 @@ extern __typeof__(snd_send_iop_command_no_wait) func_0012E6E0 __attribute__((alias("FUN_0012e6e0"))); s32 snd_sync_buffer[4] = {0}; + +const char snd_no_wait_continuing_string[] __asm__("D_00154070") = + "snd_SendIOPCommandNoWait: continueing (%d).\n"; diff --git a/src/audio/snd_start_sound_system.c b/src/audio/snd_start_sound_system.c index 41880d6332..ffada4ad80 100644 --- a/src/audio/snd_start_sound_system.c +++ b/src/audio/snd_start_sound_system.c @@ -13,8 +13,6 @@ struct SifClientDataStartSound { void *volatile server; }; -extern u8 snd_sif_bind_rpc_error_string[] __asm__("D_00153C50"); -extern u8 snd_989_snd_source_file[] __asm__("D_00153C78"); extern struct SifClientDataStartSound sound_command_client __asm__("D_0015EBC0"); extern struct SifClientDataStartSound sound_stream_client __asm__("D_0015EBE8"); extern s32 *snd_batch_command_buffers[2] __asm__("D_0015ECA0") __attribute__((sda)); @@ -31,6 +29,11 @@ extern s32 snd_send_iop_command_and_wait(s32, s32, void *) __asm__("func_0012E54 s32 snd_start_sound_system(void) __asm__("FUN_0012da28"); +const char snd_sif_bind_rpc_error_string[] __asm__("D_00153C50") = + "error: sceSifBindRpc in %s, at line %d\n"; +/* __FILE__ of the retail 989snd.c, which this function's messages name. */ +const char snd_989_snd_source_file[] __asm__("D_00153C78") = "/usr/local/989snd/ee/989snd.c"; + s32 snd_start_sound_system(void) { s32 bind_result; s32 command_arg; @@ -48,7 +51,7 @@ s32 snd_start_sound_system(void) { for (;;) { bind_result = sceSifBindRpc(&sound_command_client, 0x123456, 0); if (bind_result < 0) { - Printf((const char *)snd_sif_bind_rpc_error_string, snd_989_snd_source_file, 0x73); + Printf(snd_sif_bind_rpc_error_string, snd_989_snd_source_file, 0x73); for (;;) { } } @@ -68,7 +71,7 @@ s32 snd_start_sound_system(void) { do { bind_result = sceSifBindRpc(&sound_stream_client, 0x123457, 0); if (bind_result < 0) { - Printf((const char *)snd_sif_bind_rpc_error_string, snd_989_snd_source_file, 0x88); + Printf(snd_sif_bind_rpc_error_string, snd_989_snd_source_file, 0x88); for (;;) { } } diff --git a/src/movies/decoder/callbacks/mpeg_error.c b/src/movies/decoder/callbacks/mpeg_error.c index 7dc29ca454..336085b337 100644 --- a/src/movies/decoder/callbacks/mpeg_error.c +++ b/src/movies/decoder/callbacks/mpeg_error.c @@ -6,7 +6,7 @@ struct MpegErrorData { s32 unk4; }; -extern u8 video_error_message[] __asm__("D_00161220"); +extern const char video_error_message[] __asm__("D_00161220"); s32 mpeg_error(s32 unused_mpeg, struct MpegErrorData *cb_data) __asm__("FUN_0023d080"); s32 mpeg_error(s32 unused_mpeg, struct MpegErrorData *cb_data) { @@ -21,3 +21,5 @@ extern __typeof__(mpeg_error) D_0023D080 __attribute__((alias("FUN_0023d080"))); /* Recovered original symbol name. */ extern __typeof__(mpeg_error) mpegError__FP7sceMpegP18sceMpegCbDataErrorPv __attribute__((alias("FUN_0023d080"))); + +const char video_error_message[] __asm__("D_00161220") = "%s\n"; diff --git a/src/movies/decoder/dec_bs0.c b/src/movies/decoder/dec_bs0.c index 3ad58a17e0..e279b15339 100644 --- a/src/movies/decoder/dec_bs0.c +++ b/src/movies/decoder/dec_bs0.c @@ -13,12 +13,14 @@ extern struct MoviePlayer *movie_player_macro __asm__("D_0016120C") MACRO_ADDR; #define voBuf (movie_player_macro->vo_buf) extern void set_image_tag(void *, int, int, int) __asm__("func_0023B210"); /* setImageTag */ extern void switch_thread(void) __asm__("func_0023A770"); /* switchThread */ -extern void err_message(char *) __asm__("func_0023AB78"); /* ErrMessage */ -extern char decode_thread_aborted_message[] __asm__("D_001E8B38"); -extern char mpeg_get_picture_decode_error_message[] __asm__("D_001E8B50"); +extern void err_message(const char *) __asm__("func_0023AB78"); /* ErrMessage */ /* decBs0(VideoDec *) */ int dec_bs0(struct VideoDec *vd) __asm__("FUN_0023cec8"); +const char decode_thread_aborted_message[] __asm__("D_001E8B38") = "decode thread: aborted\n"; +const char mpeg_get_picture_decode_error_message[] __asm__("D_001E8B50") = + "sceMpegGetPicture() decode error"; + int dec_bs0(struct VideoDec *vd) { enum { DEC_BS0_COMPLETED = 1 diff --git a/src/runtime/debug/print_register_values_and_halt.c b/src/runtime/debug/print_register_values_and_halt.c index 66d14df03e..32e48e9aed 100644 --- a/src/runtime/debug/print_register_values_and_halt.c +++ b/src/runtime/debug/print_register_values_and_halt.c @@ -1,10 +1,11 @@ #include "types.h" #include "rnc/sdk/debug.h" -extern u8 dmac_bus_error_message[] __asm__("D_001E8A08"); -extern u8 dma1_register_values_format[] __asm__("D_001E8A20"); -extern u8 dma_halt_question_message[] __asm__("D_001E8A38"); -void print_register_values_and_halt(void) __asm__("FUN_00233f00"); +void print_register_values_and_halt(void) __asm__("FUN_00233f00"); + +const char dmac_bus_error_message[] __asm__("D_001E8A08") = "DMAC(15) - Bus Error\n"; +const char dma1_register_values_format[] __asm__("D_001E8A20") = "D1_CHCR=%X\nD1_TADR=%X"; +const char dma_halt_question_message[] __asm__("D_001E8A38") = "Why doesn't this work?"; void print_register_values_and_halt(void) { volatile u32 *dma1_chcr_register = (volatile u32 *)0x10009000; diff --git a/src/runtime/startup/init_once.c b/src/runtime/startup/init_once.c index ac585e485c..1c017543b3 100644 --- a/src/runtime/startup/init_once.c +++ b/src/runtime/startup/init_once.c @@ -23,10 +23,7 @@ #include "rnc/ui/text/font.h" extern u8 vu0_micro_program[] __asm__("D_0010E4C0"); -extern u8 rebooted_iop_message[] __asm__("D_0015FA88"); -extern u8 iop_reboot_image_path[] __asm__("D_001E7AE0"); -extern u8 loaded_irx_modules_message[] __asm__("D_001E7AF8"); -extern u8 unsupported_lang_message[] __asm__("D_001E7B10"); +extern const char rebooted_iop_message[] __asm__("D_0015FA88"); extern s32 DIntr(); extern s32 EnableCache(); extern s32 fill_transfer_words() __asm__("func_001F97E8"); @@ -47,6 +44,10 @@ extern s32 vu0_load_micro_program() __asm__("func_002334D8"); extern s32 vu1_init_chain() __asm__("func_002335D0"); void init_once(void) __asm__("FUN_00201650"); +const char iop_reboot_image_path[] __asm__("D_001E7AE0") = "cdrom0:\\IOPRP243.IMG;1"; +const char loaded_irx_modules_message[] __asm__("D_001E7AF8") = "loaded irx modules\n"; +const char unsupported_lang_message[] __asm__("D_001E7B10") = "Unsupported language %d\n"; + /* The boot archive as decompress_wad unpacks it: the IRX modules to load, each as an offset from the archive start and a size. */ struct BootIrxModule { @@ -179,3 +180,7 @@ void init_once(void) { extern __typeof__(init_once) func_00201650 __attribute__((alias("FUN_00201650"))); u8 image_clear_buffer[4096] = {0}; + +/* Retail keeps this message in small data; init_once reaches it with lui/addiu. */ +const char rebooted_iop_message[] __asm__("D_0015FA88") __attribute__((section(".sdata"))) = + "Rebooted IOP\n"; diff --git a/src/sdk/deci2/printfloat.c b/src/sdk/deci2/printfloat.c index 21a04d058d..ba95019651 100644 --- a/src/sdk/deci2/printfloat.c +++ b/src/sdk/deci2/printfloat.c @@ -2,14 +2,17 @@ #include "rnc/data_labels.h" #include "rnc/sdk/soft_float.h" -extern char significand_format[] __asm__("D_00152780"); -extern char nonnegative_exponent_format[] __asm__("D_00152788"); -extern char negative_exponent_format[] __asm__("D_00152790"); extern f64 dpsub_f(f64 left, f64 right) __asm__("dpsub"); extern f64 dpdiv_f(f64 left, f64 right) __asm__("dpdiv"); extern s64 ftoi(s64 bits); extern s32 kprintf(); +/* Explicit .rodata: at 8 bytes or less they would go to .sdata. */ +const char significand_format[] __asm__("D_00152780") __attribute__((section(".rodata"))) = "0.%d"; +const char nonnegative_exponent_format[] __asm__("D_00152788") __attribute__((section(".rodata"))) = + "e+%d"; +const char negative_exponent_format[] __asm__("D_00152790") __attribute__((section(".rodata"))) = "e%d"; + void printfloat(f64 x) { s32 exponent; s64 significand; From d0a6eff1f7a37022ccaf81b6cd8135757408f0a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:14:47 +0000 Subject: [PATCH 02/25] decomp: define the messages of 40 SDK, audio, save and movie units in C Each string is read by one unit only; the unit defines it before its functions (after them where retail placed it behind the unit's literals or in small data) and its RODATA/SDATA entry places it. --- configure.py | 52 ++++++++++++++++--- src/audio/banks/snd_bank_load_by_loc.c | 5 +- src/audio/streaming/start_audio_stream_read.c | 3 +- src/audio/voices/set_sound_handle_id.c | 4 +- src/movies/decoder/callbacks/video_callback.c | 2 +- .../decoder/video_input/vi_buf_add_dma.c | 2 +- src/movies/player/err_message.c | 5 +- src/save/memcard_initialize.c | 2 +- src/save/memcard_restore_game.c | 2 +- src/save/memcard_update_state.c | 8 ++- src/sdk/deci2/sce_tty_handler.c | 9 ++-- src/sdk/graph/sce_gs_set_def_disp_env.c | 3 +- src/sdk/input/dbc/sceDbcCreateSocket.c | 3 +- src/sdk/input/dbc/sceDbcGetDepNumber.c | 3 +- src/sdk/input/dbc/sceDbcInit.c | 5 +- src/sdk/input/dbc/sceDbcSetWorkAddr.c | 3 +- src/sdk/input/dbc/scedbcreceivedata.c | 2 +- src/sdk/ipu/wait_bdec_out.c | 2 +- src/sdk/kernel/topThread.c | 3 +- src/sdk/mpeg/api/alloc_work_area.c | 2 +- src/sdk/mpeg/api/sce_mpeg_create.c | 3 +- src/sdk/mpeg/demux/_PES_packet.c | 3 +- src/sdk/mpeg/headers/_quantMatrixExtension.c | 3 +- src/sdk/mpeg/headers/sequence_extension.c | 5 +- src/sdk/mpeg/headers/sequenceheader.c | 2 +- src/sdk/mpeg/macroblock/_decMB0.c | 3 +- src/sdk/mpeg/macroblock/_slice0.c | 3 +- src/sdk/mpeg/macroblock/domc.c | 2 +- src/sdk/mpeg/macroblock/skip_mb0.c | 3 +- src/sdk/mpeg/macroblock/slicea0.c | 4 +- src/sdk/mpeg/picture/_lastFrame.c | 2 +- src/sdk/mpeg/picture/_pictureData0.c | 3 +- src/sdk/mpeg/picture/decpicture.c | 6 ++- src/sdk/mpeg/ref_images/_getAllRefs.c | 9 ++-- src/sdk/rpc/iop/sce_sif_reboot_iop.c | 5 +- src/sdk/scf/GetRomName.c | 7 ++- src/sdk/storage/cdvd/cd_check_ncmd.c | 4 +- src/sdk/storage/cdvd/cd_check_scmd.c | 4 +- src/sdk/storage/cdvd/sceCdDiskReady.c | 7 +-- src/sdk/storage/cdvd/sceCdInit.c | 4 +- src/sdk/storage/cdvd/sceCdRead.c | 4 +- src/sdk/storage/cdvd/sceCdSyncS.c | 2 +- src/sdk/storage/cdvd/scecdreadclock.c | 6 ++- src/sdk/storage/cdvd/scecdsync.c | 2 +- src/sdk/storage/memory_card/sce_mc_init.c | 8 +-- 45 files changed, 155 insertions(+), 69 deletions(-) diff --git a/configure.py b/configure.py index 1ec25699e0..eb7a11c8ac 100755 --- a/configure.py +++ b/configure.py @@ -949,7 +949,7 @@ "sdk/deci2/printfloat": (0x152780, 0x53700, 48), # its three formats and three f64 literals (0.1, 0.1, 1e6) "sdk/deci2/printf_impl": (0x1527B0, 0x53730, 292), # _printf's format switch table (jtbl_001527B0) "audio/rpc/snd_send_iop_command_and_wait": (0x153D20, 0x54CA0, 26), # its RPC-collision message - "audio/banks/snd_bank_load_by_loc": (0x153DA8, 0x54D28, 77), # its two error messages + "audio/banks/snd_bank_load_by_loc": (0x153DA8, 0x54D28, 136), # its three error messages "audio/rpc/snd_send_iop_command_no_wait": (0x154010, 0x54F90, 141), # its buffer-full and continuing messages "audio/snd_start_sound_system": (0x153C50, 0x54BD0, 70), # its bind error and source file name "audio/rpc/snd_returns": (0x153C98, 0x54C18, 82), # its no-returns message @@ -984,25 +984,58 @@ "mode_freeze_init": (0x1E78D0, 0xE8850, 28), # switch table "update_menu_entry_actions": (0x1E8770, 0xE96F0, 48), # menu action switch table "draw_dialog_text": (0x1E7920, 0xE88A0, 124), # switch table - "sdk/rpc/iop/sce_sif_reboot_iop": (0x152960, 0x538E0, 11), - "sdk/storage/cdvd/cd_check_ncmd": (0x152EB0, 0x53E30, 39), - "sdk/storage/cdvd/cd_check_scmd": (0x152F10, 0x53E90, 39), + "sdk/rpc/iop/sce_sif_reboot_iop": (0x152960, 0x538E0, 41), + "sdk/storage/cdvd/cd_check_ncmd": (0x152EB0, 0x53E30, 64), + "sdk/storage/cdvd/cd_check_scmd": (0x152F10, 0x53E90, 64), "sdk/storage/cdvd/checkModelVersion": (0x153030, 0x53FB0, 12), "sdk/dma/wait_dma": (0x1533E0, 0x54360, 22), - "sdk/input/dbc/sceDbcInit": (0x153518, 0x54498, 57), + "sdk/input/dbc/sceDbcInit": (0x1534D8, 0x54458, 121), "sdk/mpeg/macroblock/mb_address_increment": (0x1537A8, 0x54728, 50), - "sdk/mpeg/macroblock/slicea0": (0x153800, 0x54780, 38), - "sdk/mpeg/headers/_quantMatrixExtension": (0x153910, 0x54890, 44), + "sdk/mpeg/macroblock/slicea0": (0x153800, 0x54780, 66), + "sdk/mpeg/headers/_quantMatrixExtension": (0x1538E8, 0x54868, 84), "sdk/mpeg/ref_images/is_out_size_ok": (0x153980, 0x54900, 41), "sdk/mpeg/errors/report_mpeg_sequence_scalable_unsupported": (0x153B48, 0x54AC8, 48), "sdk/mpeg/errors/report_unknown_mpeg_extension": (0x153B78, 0x54AF8, 18), "sdk/mpeg/errors/report_mpeg_picture_spatial_scalable_unsupported": (0x153B90, 0x54B10, 50), "sdk/mpeg/errors/report_mpeg_picture_temporal_scalable_unsupported": (0x153BC8, 0x54B48, 51), - "sdk/scf/GetRomName": (0x153C00, 0x54B80, 12), + "sdk/scf/GetRomName": (0x153C00, 0x54B80, 62), "draw_scrolling_sky_shells": (0x1E88F0, 0xE9870, 20), # switch table "update_streamed_moby_animation": (0x1E88B0, 0xE9830, 28), # switch table "update_mode_freeze": (0x1E79A0, 0xE8920, 124), # switch table "render_vendor_capture_pass_sequence": (0x1E8AD0, 0xE9A50, 24), # switch table + "sdk/kernel/topThread": (0x1526E8, 0x53668, 34), # its message + "sdk/deci2/sce_tty_handler": (0x152710, 0x53690, 112), # its four messages + "sdk/storage/cdvd/scecdsync": (0x152EF0, 0x53E70, 12), # its message + "sdk/storage/cdvd/sceCdSyncS": (0x152F00, 0x53E80, 12), # its message + "sdk/storage/cdvd/sceCdInit": (0x152F50, 0x53ED0, 46), # its two messages + "sdk/storage/cdvd/sceCdDiskReady": (0x152F80, 0x53F00, 65), # its three messages + "sdk/storage/cdvd/sceCdRead": (0x152FC8, 0x53F48, 36), # its two messages + "sdk/storage/cdvd/scecdreadclock": (0x152FF0, 0x53F70, 59), # its two messages + "sdk/graph/sce_gs_set_def_disp_env": (0x153040, 0x53FC0, 52), # its message + "sdk/storage/memory_card/sce_mc_init": (0x153450, 0x543D0, 101), # its three messages + "sdk/input/dbc/sceDbcSetWorkAddr": (0x153558, 0x544D8, 30), # its message + "sdk/input/dbc/sceDbcCreateSocket": (0x153578, 0x544F8, 31), # its message + "sdk/input/dbc/sceDbcGetDepNumber": (0x1535B8, 0x54538, 31), # its message + "sdk/input/dbc/scedbcreceivedata": (0x1536A0, 0x54620, 30), # its message + "sdk/mpeg/ref_images/_getAllRefs": (0x153710, 0x54690, 94), # its three messages + "sdk/mpeg/macroblock/domc": (0x153770, 0x546F0, 17), # its message + "sdk/ipu/wait_bdec_out": (0x153788, 0x54708, 26), # its message + "sdk/mpeg/picture/_pictureData0": (0x1537E0, 0x54760, 29), # its message + "sdk/mpeg/macroblock/_slice0": (0x153848, 0x547C8, 32), # its message + "sdk/mpeg/macroblock/skip_mb0": (0x153868, 0x547E8, 45), # its message + "sdk/mpeg/macroblock/_decMB0": (0x153898, 0x54818, 32), # its message + "sdk/mpeg/picture/decpicture": (0x153940, 0x548C0, 59), # its two messages + "sdk/mpeg/demux/_PES_packet": (0x1539D8, 0x54958, 46), # its message + "sdk/mpeg/api/sce_mpeg_create": (0x153A10, 0x54990, 35), # its message + "sdk/mpeg/api/alloc_work_area": (0x153A38, 0x549B8, 28), # its message + "sdk/mpeg/picture/_lastFrame": (0x153AB8, 0x54A38, 28), # its message + "sdk/mpeg/headers/sequenceheader": (0x153AE8, 0x54A68, 21), # its message + "sdk/mpeg/headers/sequence_extension": (0x153B00, 0x54A80, 66), # its two messages + "save/memcard_restore_game": (0x1E81D0, 0xE9150, 19), # its message + "save/memcard_initialize": (0x1E8360, 0xE92E0, 35), # its message + "audio/streaming/start_audio_stream_read": (0x1E8650, 0xE95D0, 36), # its message + "movies/decoder/callbacks/video_callback": (0x1E8B08, 0xE9A88, 21), # its message + "movies/decoder/video_input/vi_buf_add_dma": (0x1E8B20, 0xE9AA0, 20), # its message } # Recovered C units that define the small-data variables their original @@ -1040,6 +1073,9 @@ "ui/hud/update_hud": (0x15F688, 0x60608, 4), "movies/decoder/callbacks/mpeg_error": (0x161220, 0x621A0, 4), # its "%s\n" format "runtime/startup/init_once": (0x15FA88, 0x60A08, 14), # its reboot message + "save/memcard_update_state": (0x15FE98, 0x60E18, 21), # its delete path format and message + "audio/voices/set_sound_handle_id": (0x160068, 0x60FE8, 5), # its handle-conflict diagnostic + "movies/player/err_message": (0x1611F8, 0x62178, 14), # its error format } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/audio/banks/snd_bank_load_by_loc.c b/src/audio/banks/snd_bank_load_by_loc.c index dcb21ecfb5..5657514abe 100644 --- a/src/audio/banks/snd_bank_load_by_loc.c +++ b/src/audio/banks/snd_bank_load_by_loc.c @@ -5,7 +5,7 @@ extern s32 snd_cd_bank_load_request[] __asm__("D_00137B40"); extern char snd_non_idle_error_string[] __asm__("D_00153D20"); -extern u8 snd_bank_load_by_loc_rpc_error_string[] __asm__("D_00153DF8"); +extern const char snd_bank_load_by_loc_rpc_error_string[] __asm__("D_00153DF8"); extern u8 sound_stream_client[] __asm__("D_0015EBE8"); extern s32 snd_cd_load_error __asm__("D_0015EC88") __attribute__((sda)); extern u32 snd_cd_callback_arg __asm__("D_0015ED00"); @@ -49,3 +49,6 @@ s32 snd_bank_load_by_loc(s32 location, s32 byte_offset) { } extern __typeof__(snd_bank_load_by_loc) func_0012DF20 __attribute__((alias("FUN_0012df20"))); + +const char snd_bank_load_by_loc_rpc_error_string[] __asm__("D_00153DF8") = + "989snd.c: RPC call has failed inside snd_BankLoadByLoc\n"; diff --git a/src/audio/streaming/start_audio_stream_read.c b/src/audio/streaming/start_audio_stream_read.c index 3f0578b7ab..0b01adc9de 100644 --- a/src/audio/streaming/start_audio_stream_read.c +++ b/src/audio/streaming/start_audio_stream_read.c @@ -2,7 +2,8 @@ #include "rnc/audio/music/music_stream_state.h" #include "rnc/sdk/debug.h" -extern u8 cd_read_start_failure_message[] __asm__("D_001E8650"); +const char cd_read_start_failure_message[] __asm__("D_001E8650") = + "****Load file failed to start!****\n"; extern s32 RaiseKernelTrap(); extern s32 snd_stream_safe_cd_read() __asm__("func_0012ED58"); s32 start_audio_stream_read(s32 dst, s32 sector, s32 sector_count) __asm__("FUN_00216788"); diff --git a/src/audio/voices/set_sound_handle_id.c b/src/audio/voices/set_sound_handle_id.c index ebd4101572..a90127f685 100644 --- a/src/audio/voices/set_sound_handle_id.c +++ b/src/audio/voices/set_sound_handle_id.c @@ -7,7 +7,7 @@ struct Handle { s16 state; }; -extern char sound_handle_id_conflict_diagnostic[] __asm__("D_00160068"); +extern const char sound_handle_id_conflict_diagnostic[] __asm__("D_00160068"); void set_sound_handle_id(u32 id, s64 arg) __asm__("FUN_00216b68"); void set_sound_handle_id(u32 id, s64 playback_record_address) { @@ -26,3 +26,5 @@ void set_sound_handle_id(u32 id, s64 playback_record_address) { } extern __typeof__(set_sound_handle_id) func_00216B68 __attribute__((alias("FUN_00216b68"))); + +const char sound_handle_id_conflict_diagnostic[] __asm__("D_00160068") = "wtf\n"; diff --git a/src/movies/decoder/callbacks/video_callback.c b/src/movies/decoder/callbacks/video_callback.c index 0cd26841bc..38f3229788 100644 --- a/src/movies/decoder/callbacks/video_callback.c +++ b/src/movies/decoder/callbacks/video_callback.c @@ -12,7 +12,7 @@ struct VdecCb { #include "rnc/movies/decoder/decoder_globals.h" #include "rnc/movies/player/movie_player.h" -extern u8 pts_buffer_overflow_message[] __asm__("D_001E8B08"); +const char pts_buffer_overflow_message[] __asm__("D_001E8B08") = "pts buffer overflow\n"; extern void err_message(u8 *) __asm__("func_0023AB78"); extern s32 cpy2area(u32, s32, u32, s32, u8 *, s32, struct ReadBuf *, s32) __asm__("func_0023B810"); extern void diff --git a/src/movies/decoder/video_input/vi_buf_add_dma.c b/src/movies/decoder/video_input/vi_buf_add_dma.c index 986691e32a..c8819b41db 100644 --- a/src/movies/decoder/video_input/vi_buf_add_dma.c +++ b/src/movies/decoder/video_input/vi_buf_add_dma.c @@ -29,7 +29,7 @@ typedef struct { extern s32 WaitSema(s32 semaphore); extern s32 SignalSema(s32 semaphore); -extern char dma_add_not_active_message[] __asm__("D_001E8B20"); +const char dma_add_not_active_message[] __asm__("D_001E8B20") = "DMA ADD not active\n"; extern void set_d4_chcr(s32 control) __asm__("FUN_0023bbb0"); s32 vi_buf_add_dma(ViBuf *f) __asm__("FUN_0023bf70"); diff --git a/src/movies/player/err_message.c b/src/movies/player/err_message.c index e9e3bbd627..b0f9509ac4 100644 --- a/src/movies/player/err_message.c +++ b/src/movies/player/err_message.c @@ -1,7 +1,7 @@ #include "types.h" #include "rnc/sdk/debug.h" -extern u8 movie_error_message[] __asm__("D_001611F8"); +extern const char movie_error_message[] __asm__("D_001611F8"); void err_message(s32 error_code) __asm__("FUN_0023ab78"); /* Moby class 676 */ @@ -10,3 +10,6 @@ void err_message(s32 error_code) { } extern void func_0023AB78(s32 error_code) __attribute__((alias("FUN_0023ab78"))); + +const char movie_error_message[] __asm__("D_001611F8") __attribute__((section(".sdata"))) = + "[ Error ] %s\n"; diff --git a/src/save/memcard_initialize.c b/src/save/memcard_initialize.c index b6232d039d..43fedb3216 100644 --- a/src/save/memcard_initialize.c +++ b/src/save/memcard_initialize.c @@ -2,7 +2,7 @@ #include "rnc/sdk/debug.h" #include "rnc/sdk/storage/memory_card.h" -extern u8 memcard_error_message[] __asm__("D_001E8360"); +const char memcard_error_message[] __asm__("D_001E8360") = "ERROR: could not init memcard lib\n"; void memcard_initialize(void) __asm__("FUN_0020ac58"); void memcard_initialize(void) { diff --git a/src/save/memcard_restore_game.c b/src/save/memcard_restore_game.c index 471b154a45..aed29a829e 100644 --- a/src/save/memcard_restore_game.c +++ b/src/save/memcard_restore_game.c @@ -5,7 +5,7 @@ #include "rnc/save/memory_card_state.h" #include "rnc/sdk/debug.h" -extern char out_of_date_save_message[] __asm__("D_001E81D0"); +const char out_of_date_save_message[] __asm__("D_001E81D0") = "Out of date save!\n"; extern void memcard_restore_data(u8 *, s32, void *) __asm__("func_0020AF20"); void memcard_restore_game(u8 *p) __asm__("FUN_00209298"); diff --git a/src/save/memcard_update_state.c b/src/save/memcard_update_state.c index 5820f219a0..df33ff4e6f 100644 --- a/src/save/memcard_update_state.c +++ b/src/save/memcard_update_state.c @@ -26,8 +26,8 @@ extern char D_0013D200[]; extern char D_0013D220[]; extern char D_0013D240[]; extern char D_0013D270[]; -extern char memcard_delete_entry_path_format[] __asm__("D_0015FE98"); -extern char memcard_deleting_entry_message[] __asm__("D_0015FEA0"); +extern const char memcard_delete_entry_path_format[] __asm__("D_0015FE98"); +extern const char memcard_deleting_entry_message[] __asm__("D_0015FEA0"); extern u8 D_001A0880[]; extern char D_001A08A0[]; extern char memcard_deleting_directory_message[] __asm__("D_001E81E8"); @@ -1004,3 +1004,7 @@ extern __typeof__(memcard_update_state) func_002093D8 __attribute__((alias("FUN_ u8 memcard_game_data_buffer[MEMCARD_GAME_DATA_SIZE] = {0}; u8 memcard_level_data_buffer[MEMCARD_LEVEL_DATA_SIZE] = {0}; + +const char memcard_delete_entry_path_format[] __asm__("D_0015FE98") = "%s/%s"; +const char memcard_deleting_entry_message[] __asm__("D_0015FEA0") __attribute__((section(".sdata"))) = + "deleting %s\n"; diff --git a/src/sdk/deci2/sce_tty_handler.c b/src/sdk/deci2/sce_tty_handler.c index 9c8085ac6f..7c5726d56e 100644 --- a/src/sdk/deci2/sce_tty_handler.c +++ b/src/sdk/deci2/sce_tty_handler.c @@ -20,10 +20,11 @@ typedef struct { TtyQueue *queue; } TtyState; -extern u8 tty_packet_size_error_message[] __asm__("D_00152710"); -extern u8 tty_receive_error_message[] __asm__("D_00152738"); -extern u8 tty_send_error_format[] __asm__("D_00152750"); -extern u8 tty_pending_send_bytes_error_format[] __asm__("D_00152768"); +const char tty_packet_size_error_message[] __asm__("D_00152710") = + "TTY: packet size larger than expect\n"; +const char tty_receive_error_message[] __asm__("D_00152738") = "TTY: receive error"; +const char tty_send_error_format[] __asm__("D_00152750") = "TTY: send err %d\n"; +const char tty_pending_send_bytes_error_format[] __asm__("D_00152768") = "TTY: err ti->wlen=%08x\n"; extern void QueuePeekWriteDone(TtyQueue *queue); void sceTtyHandler(s32 event, s32 param, TtyState *tty) { diff --git a/src/sdk/graph/sce_gs_set_def_disp_env.c b/src/sdk/graph/sce_gs_set_def_disp_env.c index 4d75a534b1..a6eb1e876d 100644 --- a/src/sdk/graph/sce_gs_set_def_disp_env.c +++ b/src/sdk/graph/sce_gs_set_def_disp_env.c @@ -14,7 +14,8 @@ typedef struct { extern void _GetGsDxDyOffset(s32 mode, s32 *horizontal, s32 *vertical, s32 *display_width, s32 *display_height); -extern char unsupported_display_mode_format[] __asm__("D_00153040"); +const char unsupported_display_mode_format[] __asm__("D_00153040") = + "sceGsDefDispEnv:Not support displaymode for 0x%x!!\n"; /* The progressive arms spell this out three times: cc1 merges the divides but keeps each zero check, and retail's load order needs all three. */ diff --git a/src/sdk/input/dbc/sceDbcCreateSocket.c b/src/sdk/input/dbc/sceDbcCreateSocket.c index 5f9fca03c5..2e87565776 100644 --- a/src/sdk/input/dbc/sceDbcCreateSocket.c +++ b/src/sdk/input/dbc/sceDbcCreateSocket.c @@ -4,7 +4,8 @@ #include "rnc/sdk/rpc/rpc.h" extern s32 D_0015B080[]; -extern u8 socket_create_rpc_error_message[] __asm__("D_00153578"); +const char socket_create_rpc_error_message[] __asm__("D_00153578") = + "sceDbcCreateSocket: rpc error\n"; extern void debug_print_stub(u8 *) __asm__("func_00124A20"); /* The header words are copied as pointers: their alias set differs from diff --git a/src/sdk/input/dbc/sceDbcGetDepNumber.c b/src/sdk/input/dbc/sceDbcGetDepNumber.c index 210bcd6672..69f4b05357 100644 --- a/src/sdk/input/dbc/sceDbcGetDepNumber.c +++ b/src/sdk/input/dbc/sceDbcGetDepNumber.c @@ -19,7 +19,8 @@ struct DbCState { s32 unk2C; }; -extern u8 dbc_get_dep_number_rpc_error_message[] __asm__("D_001535B8"); +const char dbc_get_dep_number_rpc_error_message[] __asm__("D_001535B8") = + "sceDbcGetDepNumber: rpc error\n"; extern u8 D_0015B480[]; extern u8 D_0015B500[]; extern s32 DIntr(); diff --git a/src/sdk/input/dbc/sceDbcInit.c b/src/sdk/input/dbc/sceDbcInit.c index d5848bfebd..906875941f 100644 --- a/src/sdk/input/dbc/sceDbcInit.c +++ b/src/sdk/input/dbc/sceDbcInit.c @@ -6,8 +6,9 @@ #include "rnc/sdk/rpc/rpc.h" extern struct sceSifClientData dbc_transfer_rpc_client __asm__("D_0015B030"); -extern char dbc_rpc_bind_failure_message[] __asm__("D_001534D8"); -extern char dbc_module_version_mismatch_message[] __asm__("D_001534F0"); +const char dbc_rpc_bind_failure_message[] __asm__("D_001534D8") = "libdbc: bind failed\n"; +const char dbc_module_version_mismatch_message[] __asm__("D_001534F0") = + "libdbc: Module version mismatch "; const char D_00153518[] = "[libdbc.a = %d.%d, dbcman.irx = %d.%d]\n"; const char D_00153540[] = "SifDmaAddr %08x\n"; extern void debug_print_stub(const char *fmt, ...) __asm__("func_00124A20"); diff --git a/src/sdk/input/dbc/sceDbcSetWorkAddr.c b/src/sdk/input/dbc/sceDbcSetWorkAddr.c index 622ec24704..386fb0a600 100644 --- a/src/sdk/input/dbc/sceDbcSetWorkAddr.c +++ b/src/sdk/input/dbc/sceDbcSetWorkAddr.c @@ -15,7 +15,8 @@ struct DbCState { s32 unk2C; }; -extern u8 dbc_set_work_address_rpc_error_message[] __asm__("D_00153558"); +const char dbc_set_work_address_rpc_error_message[] __asm__("D_00153558") = + "sceDbcSetWorkAddr: rpc error\n"; extern s32 debug_print_stub() __asm__("func_00124A20"); extern struct DbCState RpcReceiveData __asm__("D_0015B080"); diff --git a/src/sdk/input/dbc/scedbcreceivedata.c b/src/sdk/input/dbc/scedbcreceivedata.c index 65cade3867..22eda300a3 100644 --- a/src/sdk/input/dbc/scedbcreceivedata.c +++ b/src/sdk/input/dbc/scedbcreceivedata.c @@ -11,7 +11,7 @@ struct DbCState { s32 unk8C; }; -extern u8 dbc_receive_rpc_error_message[] __asm__("D_001536A0"); +const char dbc_receive_rpc_error_message[] __asm__("D_001536A0") = "sceDbcReceiveData: rpc error\n"; extern s32 debug_print_stub() __asm__("func_00124A20"); extern struct DbCState RpcReceiveData __asm__("D_0015B080"); s32 sceDbcReceiveData(s32 rpc_request_word_0, diff --git a/src/sdk/ipu/wait_bdec_out.c b/src/sdk/ipu/wait_bdec_out.c index b92ecf5afb..0fbba152b6 100644 --- a/src/sdk/ipu/wait_bdec_out.c +++ b/src/sdk/ipu/wait_bdec_out.c @@ -12,7 +12,7 @@ typedef struct { void *cbData; } MpegDec; -extern char bdec_error_message[] __asm__("D_00153788"); +const char bdec_error_message[] __asm__("D_00153788") = "Error code detected(BDEC)"; extern s32 DIntr(void); #define IPU_CTRL ((volatile u32 *)0x10002010) diff --git a/src/sdk/kernel/topThread.c b/src/sdk/kernel/topThread.c index 0c494d9015..bc9d16f621 100644 --- a/src/sdk/kernel/topThread.c +++ b/src/sdk/kernel/topThread.c @@ -4,7 +4,8 @@ #include "rnc/sdk/top_thread.h" #include "rnc/sdk/deci2.h" -extern u8 thread_command_error_message[] __asm__("D_001526E8"); +const char thread_command_error_message[] __asm__("D_001526E8") = + "## internel error in libkernl.a!\n"; extern s32 WaitSema(s32 sema); extern s32 WakeupThread(s32 id); diff --git a/src/sdk/mpeg/api/alloc_work_area.c b/src/sdk/mpeg/api/alloc_work_area.c index e312324cb5..684ead2d29 100644 --- a/src/sdk/mpeg/api/alloc_work_area.c +++ b/src/sdk/mpeg/api/alloc_work_area.c @@ -1,7 +1,7 @@ #include "rnc/sdk/mpeg_work_area.h" #include "rnc/sdk/mpeg/errors.h" -extern u8 work_area_too_small_message[] __asm__("D_00153A38"); +const char work_area_too_small_message[] __asm__("D_00153A38") = "work area size is too small"; s32 alloc_work_area(s32 decoder_state, struct MpegWorkArea *area, diff --git a/src/sdk/mpeg/api/sce_mpeg_create.c b/src/sdk/mpeg/api/sce_mpeg_create.c index 10534fb390..a1f5fcc3ac 100644 --- a/src/sdk/mpeg/api/sce_mpeg_create.c +++ b/src/sdk/mpeg/api/sce_mpeg_create.c @@ -1,7 +1,8 @@ #include "types.h" #define W(p, o) (*(s32 *)((u8 *)(p) + (o))) #define L(p, o) (*(s64 *)((u8 *)(p) + (o))) -extern u8 mpeg_work_area_too_small_message[] __asm__("D_00153A10"); +const char mpeg_work_area_too_small_message[] __asm__("D_00153A10") = + "The size of work area is too small"; extern void D_0012CB30(); extern void D_0012CB40(); extern void *memset(void *, s32, u32); diff --git a/src/sdk/mpeg/demux/_PES_packet.c b/src/sdk/mpeg/demux/_PES_packet.c index a2f9442f04..9001ece7f4 100644 --- a/src/sdk/mpeg/demux/_PES_packet.c +++ b/src/sdk/mpeg/demux/_PES_packet.c @@ -6,7 +6,8 @@ #include "types.h" extern u8 pes_header_skip_bit_counts[] __asm__("D_001539C8"); -extern u8 invalid_pack_header_field_message[] __asm__("D_001539D8"); +const char invalid_pack_header_field_message[] __asm__("D_001539D8") = + "pack_header_field_flag needs to be '0' in PS\n"; extern s32 _Error(); extern s32 _sysbitGet(); extern s32 _sysbitJump(); diff --git a/src/sdk/mpeg/headers/_quantMatrixExtension.c b/src/sdk/mpeg/headers/_quantMatrixExtension.c index 3e1dc245d1..85149dd44f 100644 --- a/src/sdk/mpeg/headers/_quantMatrixExtension.c +++ b/src/sdk/mpeg/headers/_quantMatrixExtension.c @@ -4,7 +4,8 @@ #include "rnc/sdk/mpeg/bitstream.h" #include "rnc/sdk/mpeg/errors.h" -extern u8 chroma_intra_matrix_error_message[] __asm__("D_001538E8"); +const char chroma_intra_matrix_error_message[] __asm__("D_001538E8") = + "load_chroma_intra_quantizer_matrix == 1"; const u8 D_00153910[] = "load_chroma_non_intra_quantizer_matrix == 1"; void _quantMatrixExtension(struct MpegDecoder *mpeg) { diff --git a/src/sdk/mpeg/headers/sequence_extension.c b/src/sdk/mpeg/headers/sequence_extension.c index 8857eb983a..7eb4d28480 100644 --- a/src/sdk/mpeg/headers/sequence_extension.c +++ b/src/sdk/mpeg/headers/sequence_extension.c @@ -26,8 +26,9 @@ typedef struct SeqExtContext { extern void _Error(); extern s32 _nextBit(); extern void _ipuSetMPEG1(); -extern u8 unsupported_chroma_format_message[] __asm__("D_00153B00"); -extern u8 unsupported_profile_level_message[] __asm__("D_00153B28"); +const char unsupported_chroma_format_message[] __asm__("D_00153B00") = + "_chroma_format needs to be 1: 420"; +const char unsupported_profile_level_message[] __asm__("D_00153B28") = "Unsupported profile/level"; void _sequenceExtension(SeqExtContext *ctx) { u32 bits; diff --git a/src/sdk/mpeg/headers/sequenceheader.c b/src/sdk/mpeg/headers/sequenceheader.c index 7ef316ecac..98845075cd 100644 --- a/src/sdk/mpeg/headers/sequenceheader.c +++ b/src/sdk/mpeg/headers/sequenceheader.c @@ -7,7 +7,7 @@ extern u8 default_intra_quantiser_matrix[] __asm__("D_00132FC0"); extern u8 default_non_intra_quantiser_matrix[] __asm__("D_00133000"); -extern u8 vertical_size_limit_error_message[] __asm__("D_00153AE8"); +const char vertical_size_limit_error_message[] __asm__("D_00153AE8") = "vertical size > 2800"; void _sequenceHeader(struct MpegDecoder *decoder) { u32 bits; diff --git a/src/sdk/mpeg/macroblock/_decMB0.c b/src/sdk/mpeg/macroblock/_decMB0.c index 359283ba9a..361943d8ec 100644 --- a/src/sdk/mpeg/macroblock/_decMB0.c +++ b/src/sdk/mpeg/macroblock/_decMB0.c @@ -16,7 +16,8 @@ struct MpegMbState { int unk1C; }; -extern u8 invalid_macroblock_type_error_message[] __asm__("D_00153898"); +const char invalid_macroblock_type_error_message[] __asm__("D_00153898") = + "Invalid macroblock_type code: 0"; int _decMB0(struct MpegDecoder *decoder, int *mb_type, int *motion_type, diff --git a/src/sdk/mpeg/macroblock/_slice0.c b/src/sdk/mpeg/macroblock/_slice0.c index c48e5be9fc..feb3f0151d 100644 --- a/src/sdk/mpeg/macroblock/_slice0.c +++ b/src/sdk/mpeg/macroblock/_slice0.c @@ -5,7 +5,8 @@ #include "rnc/sdk/mpeg/errors.h" #include "rnc/sdk/mpeg/macroblock.h" -extern u8 too_many_macroblocks_error_message[] __asm__("D_00153848"); +const char too_many_macroblocks_error_message[] __asm__("D_00153848") = + "Too many macroblocks in picture"; extern s32 _motionComp0(); s32 _slice0(struct MpegDecoder *mp, s32 nmb) { diff --git a/src/sdk/mpeg/macroblock/domc.c b/src/sdk/mpeg/macroblock/domc.c index 59c15f0003..d7203ee12a 100644 --- a/src/sdk/mpeg/macroblock/domc.c +++ b/src/sdk/mpeg/macroblock/domc.c @@ -2,7 +2,7 @@ #include "rnc/sdk/libmpeg.h" #include "rnc/sdk/mpeg/errors.h" -extern u8 intra_skip_mb_error_message[] __asm__("D_00153770"); +const char intra_skip_mb_error_message[] __asm__("D_00153770") = "intra && skip MB"; extern void func_001271D8(); extern void func_00127178(); diff --git a/src/sdk/mpeg/macroblock/skip_mb0.c b/src/sdk/mpeg/macroblock/skip_mb0.c index fb0ba37a7d..4265fa44ed 100644 --- a/src/sdk/mpeg/macroblock/skip_mb0.c +++ b/src/sdk/mpeg/macroblock/skip_mb0.c @@ -15,7 +15,8 @@ struct MpegMotionRef { s32 unk4; }; -extern u8 skipped_macroblock_in_i_picture_error_message[] __asm__("D_00153868"); +const char skipped_macroblock_in_i_picture_error_message[] __asm__("D_00153868") = + "skiped macroblock in I picure is not allowed"; s32 _skipMB0(struct MpegDecoder *decoder, struct MpegSkipState *skip_state, s32 *picture_structure_mode, diff --git a/src/sdk/mpeg/macroblock/slicea0.c b/src/sdk/mpeg/macroblock/slicea0.c index 1b5b18c136..3617063eff 100644 --- a/src/sdk/mpeg/macroblock/slicea0.c +++ b/src/sdk/mpeg/macroblock/slicea0.c @@ -14,7 +14,7 @@ struct MpegMotionState { }; const u8 D_00153800[] = "slice_start_code(0x%08x) out of range"; -extern u8 slice_setup_error_message[] __asm__("D_00153828"); +extern const char slice_setup_error_message[] __asm__("D_00153828"); extern s32 _Error(); extern s32 _Error1(); extern s32 _flushBuf(); @@ -64,3 +64,5 @@ s32 _sliceA0(struct MpegSliceDecoder *decoder, motion->values[3] = 0; return 0; } + +const char slice_setup_error_message[] __asm__("D_00153828") = "_sliceA0(): error happens"; diff --git a/src/sdk/mpeg/picture/_lastFrame.c b/src/sdk/mpeg/picture/_lastFrame.c index 48155b3c60..b6c4c0a264 100644 --- a/src/sdk/mpeg/picture/_lastFrame.c +++ b/src/sdk/mpeg/picture/_lastFrame.c @@ -1,7 +1,7 @@ #include "types.h" #include "rnc/sdk/libmpeg.h" -extern u8 missing_second_field_message[] __asm__("D_00153AB8"); +const char missing_second_field_message[] __asm__("D_00153AB8") = "the second field is missing"; extern s32 _Error(struct MpegDecoder *, u8 *, s32); extern s32 _dispRefImage(struct MpegDecoder *, struct MpegRefImage *, s32); extern s32 diff --git a/src/sdk/mpeg/picture/_pictureData0.c b/src/sdk/mpeg/picture/_pictureData0.c index 5cd7397f5d..5775f3b648 100644 --- a/src/sdk/mpeg/picture/_pictureData0.c +++ b/src/sdk/mpeg/picture/_pictureData0.c @@ -14,7 +14,8 @@ typedef struct { s32 unk814; } MpegDec; -extern char skip_to_next_picture_error_message[] __asm__("D_001537E0"); +const char skip_to_next_picture_error_message[] __asm__("D_001537E0") = + "= Skip to the next picture ="; s32 _pictureData0(MpegDec *decoder) { enum { diff --git a/src/sdk/mpeg/picture/decpicture.c b/src/sdk/mpeg/picture/decpicture.c index c85c6f264a..b268d57337 100644 --- a/src/sdk/mpeg/picture/decpicture.c +++ b/src/sdk/mpeg/picture/decpicture.c @@ -22,8 +22,10 @@ struct MpegReferenceImage { s32 decoded; }; -extern u8 odd_field_picture_count_error_message[] __asm__("D_00153940"); -extern u8 unknown_picture_structure_error_message[] __asm__("D_00153960"); +const char odd_field_picture_count_error_message[] __asm__("D_00153940") = + "odd number of field pictures"; +const char unknown_picture_structure_error_message[] __asm__("D_00153960") = + "unknown picture sutructure"; s32 _decPicture(struct MpegDecoderState *decoder) { enum { diff --git a/src/sdk/mpeg/ref_images/_getAllRefs.c b/src/sdk/mpeg/ref_images/_getAllRefs.c index 9d15affb6d..85c1e37014 100644 --- a/src/sdk/mpeg/ref_images/_getAllRefs.c +++ b/src/sdk/mpeg/ref_images/_getAllRefs.c @@ -8,9 +8,12 @@ /* libmpeg motion compensation: builds the forward and backward predictions of one macroblock (the MPEG-2 reference decoder's form_predictions, on the library's decoder state). */ -extern char forward_frame_invalid_motion_type_format[] __asm__("D_00153710"); -extern char forward_field_invalid_motion_type_format[] __asm__("D_00153730"); -extern char backward_field_invalid_motion_type_format[] __asm__("D_00153750"); +const char forward_frame_invalid_motion_type_format[] __asm__("D_00153710") = + "(a) invalid motion_type(%d)-0"; +const char forward_field_invalid_motion_type_format[] __asm__("D_00153730") = + "(b) invalid motion_type(%d)-1"; +const char backward_field_invalid_motion_type_format[] __asm__("D_00153750") = + "(c) invalid motion_type(%d)-2"; extern void _Error1(struct MpegDecoder *d, char *fmt, int code); extern void _dualPrimeVector(struct MpegDecoder *d, int dmv[2][2], int *dmvector, int mvx, int mvy); diff --git a/src/sdk/rpc/iop/sce_sif_reboot_iop.c b/src/sdk/rpc/iop/sce_sif_reboot_iop.c index 0758513d71..bcb7f80d85 100644 --- a/src/sdk/rpc/iop/sce_sif_reboot_iop.c +++ b/src/sdk/rpc/iop/sce_sif_reboot_iop.c @@ -4,7 +4,7 @@ #include "rnc/sdk/rpc/rpc.h" const char D_00152960[] = "rom0:UDNL "; -extern char iop_reboot_parameter_too_long_format[] __asm__("D_00152970"); +extern const char iop_reboot_parameter_too_long_format[] __asm__("D_00152970"); s32 sceSifRebootIop(const char *img) { const char *prefix = D_00152960; @@ -32,3 +32,6 @@ s32 sceSifRebootIop(const char *img) { *command_write_cursor = 0; return sceSifResetIop(param, 0); } + +const char iop_reboot_parameter_too_long_format[] __asm__("D_00152970") = + "too long parameter '%s'\n"; diff --git a/src/sdk/scf/GetRomName.c b/src/sdk/scf/GetRomName.c index 7322a77b2f..6386ccd124 100644 --- a/src/sdk/scf/GetRomName.c +++ b/src/sdk/scf/GetRomName.c @@ -5,8 +5,8 @@ #include "rnc/sdk/storage/fileio/sceopen.h" const u8 D_00153C00[] = "rom0:ROMVER"; -extern u8 rom_version_open_error_message[] __asm__("D_00153C10"); -extern u8 rom_version_read_error_message[] __asm__("D_00153C28"); +extern const char rom_version_open_error_message[] __asm__("D_00153C10"); +extern const char rom_version_read_error_message[] __asm__("D_00153C28"); s8 *GetRomName(void) { s32 file_descriptor; @@ -23,3 +23,6 @@ s8 *GetRomName(void) { } return (s8 *)&RomNameStateData; } + +const char rom_version_open_error_message[] __asm__("D_00153C10") = "Can't open rom0:ROMVER\n"; +const char rom_version_read_error_message[] __asm__("D_00153C28") = "Can't read rom error\n"; diff --git a/src/sdk/storage/cdvd/cd_check_ncmd.c b/src/sdk/storage/cdvd/cd_check_ncmd.c index 09fede2fce..11f8bf3e3c 100644 --- a/src/sdk/storage/cdvd/cd_check_ncmd.c +++ b/src/sdk/storage/cdvd/cd_check_ncmd.c @@ -7,7 +7,7 @@ extern s32 D_001312F8[]; const u8 D_00152EB0[] = "Ncmd fail sema cur_cmd:%d keep_cmd:%d\n"; -extern u8 cd_ncmd_bind_error_message[] __asm__("D_00152ED8"); +extern const char cd_ncmd_bind_error_message[] __asm__("D_00152ED8"); extern s32 D_00159750[]; extern u8 D_00159758[]; extern s32 PollSema(); @@ -56,3 +56,5 @@ s32 cd_check_ncmd(s32 cmd) { } extern __typeof__(cd_check_ncmd) func_00120A28 __attribute__((alias("FUN_00120a28"))); + +const char cd_ncmd_bind_error_message[] __asm__("D_00152ED8") = "Libcdvd bind err N CMD\n"; diff --git a/src/sdk/storage/cdvd/cd_check_scmd.c b/src/sdk/storage/cdvd/cd_check_scmd.c index 576fb80a01..980c0ac02f 100644 --- a/src/sdk/storage/cdvd/cd_check_scmd.c +++ b/src/sdk/storage/cdvd/cd_check_scmd.c @@ -7,7 +7,7 @@ extern s32 D_00131308[]; const u8 D_00152F10[] = "Scmd fail sema cur_cmd:%d keep_cmd:%d\n"; -extern u8 cd_s_command_bind_error_message[] __asm__("D_00152F38"); +extern const char cd_s_command_bind_error_message[] __asm__("D_00152F38"); extern s32 D_00159750[]; extern u8 D_00159758[]; extern s32 PollSema(); @@ -56,3 +56,5 @@ s32 cd_check_scmd(s32 cmd) { } extern __typeof__(cd_check_scmd) func_00120D40 __attribute__((alias("FUN_00120d40"))); + +const char cd_s_command_bind_error_message[] __asm__("D_00152F38") = "Libcdvd bind err S cmd\n"; diff --git a/src/sdk/storage/cdvd/sceCdDiskReady.c b/src/sdk/storage/cdvd/sceCdDiskReady.c index 01d349f164..f891ceb7ec 100644 --- a/src/sdk/storage/cdvd/sceCdDiskReady.c +++ b/src/sdk/storage/cdvd/sceCdDiskReady.c @@ -8,9 +8,10 @@ extern s32 D_00131304[]; extern struct sceSifClientData cd_disk_ready_rpc_client __asm__("D_00159990"); extern s32 D_001599D0[]; -extern u8 cd_disk_ready_entry_message[] __asm__("D_00152F80"); -extern u8 cd_disk_ready_bind_error_message[] __asm__("D_00152F90"); -extern u8 cd_disk_ready_completion_message[] __asm__("D_00152FB0"); +const char cd_disk_ready_entry_message[] __asm__("D_00152F80") = "DiskReady 0\n"; +const char cd_disk_ready_bind_error_message[] __asm__("D_00152F90") = + "Libcdvd bind err CdDiskReady\n"; +const char cd_disk_ready_completion_message[] __asm__("D_00152FB0") = "DiskReady ended\n"; extern s32 PollSema(); extern void SignalSema(); extern void sceSifWriteBackDCache(); diff --git a/src/sdk/storage/cdvd/sceCdInit.c b/src/sdk/storage/cdvd/sceCdInit.c index 684c3694d5..64019e25c4 100644 --- a/src/sdk/storage/cdvd/sceCdInit.c +++ b/src/sdk/storage/cdvd/sceCdInit.c @@ -24,8 +24,8 @@ extern s32 D_00131304[]; extern s32 D_00131308[]; extern s32 cd_init_rpc_bind_state[] __asm__("D_0013130C"); extern s32 cd_initialization_count[] __asm__("D_00131310"); -extern char cd_init_bind_error_format[] __asm__("D_00152F50"); -extern char cd_exit_message[] __asm__("D_00152F70"); +const char cd_init_bind_error_format[] __asm__("D_00152F50") = "Libcdvd bind err %d CD_Init %d\n"; +const char cd_exit_message[] __asm__("D_00152F70") = "Libcdvd Exit\n"; extern s32 D_00159750[]; extern sceSifClientData cd_init_rpc_client __asm__("D_00159968"); extern s32 cd_init_mode_request[] __asm__("D_001599C0"); diff --git a/src/sdk/storage/cdvd/sceCdRead.c b/src/sdk/storage/cdvd/sceCdRead.c index e7d021b8a6..0195cd3eaa 100644 --- a/src/sdk/storage/cdvd/sceCdRead.c +++ b/src/sdk/storage/cdvd/sceCdRead.c @@ -18,8 +18,8 @@ extern volatile u32 D_00131314[]; extern struct CdReadCommand native_cd_read_request __asm__("D_001313C0"); extern u8 native_cd_read_completion_buffer[] __asm__("D_001323C0"); extern u8 native_cd_read_response[] __asm__("D_00132480"); -extern u8 native_cd_read_submit_debug_message[] __asm__("D_00152FC8"); -extern u8 native_cd_read_queued_debug_message[] __asm__("D_00152FE0"); +const char native_cd_read_submit_debug_message[] __asm__("D_00152FC8") = "call cdread cmd\n"; +const char native_cd_read_queued_debug_message[] __asm__("D_00152FE0") = "cdread end\n"; extern void process_native_cd_read_completion(void *) __asm__("func_00120788"); extern s32 SignalSema(u32 semaphore); extern s32 cd_check_ncmd() __asm__("func_00120A28"); diff --git a/src/sdk/storage/cdvd/sceCdSyncS.c b/src/sdk/storage/cdvd/sceCdSyncS.c index 9b478e9343..7bedc92589 100644 --- a/src/sdk/storage/cdvd/sceCdSyncS.c +++ b/src/sdk/storage/cdvd/sceCdSyncS.c @@ -5,7 +5,7 @@ #include "rnc/sdk/rpc/rpc.h" #include "rnc/sdk/storage/cdvd.h" -extern u8 cd_s_command_wait_message[] __asm__("D_00152F00"); +const char cd_s_command_wait_message[] __asm__("D_00152F00") = "S cmd wait\n"; s32 sceCdSyncS(s32 mode) { enum { diff --git a/src/sdk/storage/cdvd/scecdreadclock.c b/src/sdk/storage/cdvd/scecdreadclock.c index e907843608..6609cde5a8 100644 --- a/src/sdk/storage/cdvd/scecdreadclock.c +++ b/src/sdk/storage/cdvd/scecdreadclock.c @@ -8,8 +8,10 @@ struct unaligned64 { u64 v; } __attribute__((packed)); -extern u8 cd_read_clock_before_rpc_debug_message[] __asm__("D_00152FF0"); -extern u8 cd_read_clock_after_copy_debug_message[] __asm__("D_00153010"); +const char cd_read_clock_before_rpc_debug_message[] __asm__("D_00152FF0") = + "Libcdvd call Clock read 1\n"; +const char cd_read_clock_after_copy_debug_message[] __asm__("D_00153010") = + "Libcdvd call Clock read 2\n"; extern s32 SignalSema(); extern s32 cd_check_scmd() __asm__("func_00120D40"); extern void *memcpy(); diff --git a/src/sdk/storage/cdvd/scecdsync.c b/src/sdk/storage/cdvd/scecdsync.c index fe78be4be0..c19fb5b5aa 100644 --- a/src/sdk/storage/cdvd/scecdsync.c +++ b/src/sdk/storage/cdvd/scecdsync.c @@ -4,7 +4,7 @@ #include "rnc/sdk/rpc/rpc.h" #include "rnc/sdk/storage/cdvd.h" -extern u8 cd_sync_wait_debug_message[] __asm__("D_00152EF0"); +const char cd_sync_wait_debug_message[] __asm__("D_00152EF0") = "N cmd wait\n"; s32 sceCdSync(s32 mode) { enum { diff --git a/src/sdk/storage/memory_card/sce_mc_init.c b/src/sdk/storage/memory_card/sce_mc_init.c index ddaa93969c..cf77a47d4f 100644 --- a/src/sdk/storage/memory_card/sce_mc_init.c +++ b/src/sdk/storage/memory_card/sce_mc_init.c @@ -5,9 +5,11 @@ #include "rnc/sdk/rpc/rpc.h" #include "rnc/sdk/storage/memory_card.h" -extern char mc_rpc_bind_error_message[] __asm__("D_00153450"); -extern char mcserv_old_release_message[] __asm__("D_00153468"); -extern char mcman_old_release_message[] __asm__("D_00153490"); +const char mc_rpc_bind_error_message[] __asm__("D_00153450") = "bind error libmc \n"; +const char mcserv_old_release_message[] __asm__("D_00153468") = + "libmc: too old release of mcserv.irx\n"; +const char mcman_old_release_message[] __asm__("D_00153490") = + "libmc: too old release of mcman.irx\n"; extern u8 D_00159A80[]; extern s32 CreateSema(struct SemaParam *); extern s32 WaitSema(s32); From b6dc0764269eeaae2202536f074498951985e8d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:24:50 +0000 Subject: [PATCH 03/25] decomp: define the C-locale lconv, dtoa strings and p05 table in C _localeconv_r (struct lconv and its two strings), _dtoa_r (Infinity/NaN/0) and pow5mult (5, 25, 125) each own the read-only data only they read. --- configure.py | 5 ++- src/sdk/libc/locale/_localeconv_r.c | 54 +++++++++++++++++++++++++++-- src/sdk/libc/mprec/_dtoa_r.c | 6 +++- src/sdk/libc/mprec/pow5mult.c | 3 +- src/sdk/libc/stdlib/_strtol_r.c | 44 +++++++++++++++++------ 5 files changed, 97 insertions(+), 15 deletions(-) diff --git a/configure.py b/configure.py index eb7a11c8ac..6501ed70a5 100755 --- a/configure.py +++ b/configure.py @@ -940,12 +940,15 @@ # link fails when the section is not SIZE bytes. Both the assembly-backed and # the promoted (normalized) unit names resolve to the same retail bytes. RODATA_OVERLAYS = { - "_dtoa_r": (0x152330, 0x532B0, 56), + "sdk/libc/stdlib/_strtol_r": (0x152200, 0x53180, 257), # newlib _ctype_ + "_dtoa_r": (0x152310, 0x53290, 88), # Infinity/NaN/0 strings, f64 literals, switch table # _getpic's switch emits a 5-entry jump table (0x14 bytes) that retail # stored at 0x153AA0 inside core_rdata; the expected object references it # as the splat symbol jtbl_00153AA0, so the compiled .rodata must land at # the same VMA/file offset for the relocations to resolve content-equal. "_getpic": (0x153AA0, 0x54A20, 20), + "sdk/libc/locale/_localeconv_r": (0x152370, 0x532F0, 58), # the C locale lconv and its strings + "sdk/libc/mprec/pow5mult": (0x1523B8, 0x53338, 12), # small_powers_of_five "sdk/deci2/printfloat": (0x152780, 0x53700, 48), # its three formats and three f64 literals (0.1, 0.1, 1e6) "sdk/deci2/printf_impl": (0x1527B0, 0x53730, 292), # _printf's format switch table (jtbl_001527B0) "audio/rpc/snd_send_iop_command_and_wait": (0x153D20, 0x54CA0, 26), # its RPC-collision message diff --git a/src/sdk/libc/locale/_localeconv_r.c b/src/sdk/libc/locale/_localeconv_r.c index 59f6785e26..7b6793dc5a 100644 --- a/src/sdk/libc/locale/_localeconv_r.c +++ b/src/sdk/libc/locale/_localeconv_r.c @@ -1,10 +1,60 @@ #include "types.h" /* newlib _localeconv_r: the one static struct lconv. */ +#define CHAR_MAX 0x7F + +struct lconv { + const char *decimal_point; + const char *thousands_sep; + const char *grouping; + const char *int_curr_symbol; + const char *currency_symbol; + const char *mon_decimal_point; + const char *mon_thousands_sep; + const char *mon_grouping; + const char *positive_sign; + const char *negative_sign; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; +}; + int *_localeconv_r(void *state_resource) __asm__("func_001144D8"); -extern char D_00152370[0x100]; +extern const char lconv_empty_string[] __asm__("D_001523A0"); +extern const char lconv_decimal_point[] __asm__("D_001523A8"); + +/* The "C" locale: only the decimal point is set. */ +const struct lconv lconv __asm__("D_00152370") = { + lconv_decimal_point, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + lconv_empty_string, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, + CHAR_MAX, +}; + +/* Its strings, in .rodata like the literals they were (they would go to .sdata). */ +const char lconv_empty_string[] __asm__("D_001523A0") __attribute__((section(".rodata"))) = ""; +const char lconv_decimal_point[] __asm__("D_001523A8") __attribute__((section(".rodata"))) = "."; int *_localeconv_r(void *state_resource) { - return (int *)D_00152370; + return (int *)&lconv; } diff --git a/src/sdk/libc/mprec/_dtoa_r.c b/src/sdk/libc/mprec/_dtoa_r.c index 7c24d436fa..b7ab7156c4 100644 --- a/src/sdk/libc/mprec/_dtoa_r.c +++ b/src/sdk/libc/mprec/_dtoa_r.c @@ -85,7 +85,11 @@ union double_union { #define Bcopy(x, y) memcpy(&(x)->_sign, &(y)->_sign, (y)->_wds * sizeof(u32) + 2 * sizeof(s32)) extern const f64 tens[23], bigtens[5]; extern const f64 dtoa_quick_overflow_divisor[] __asm__("D_001524B0"); -extern char D_00152310[], D_00152320[], D_00152328[]; +/* The strings _dtoa_r returns for infinity, NaN and zero, in .rodata like + the literals they were (at 8 bytes or less they would go to .sdata). */ +const char D_00152310[] __attribute__((section(".rodata"))) = "Infinity"; +const char D_00152320[] __attribute__((section(".rodata"))) = "NaN"; +const char D_00152328[] __attribute__((section(".rodata"))) = "0"; extern _Bigint *Balloc(struct _reent *, s32); extern _Bigint *d2b(struct _reent *, f64, s32 *, s32 *); extern _Bigint *i2b(struct _reent *, s32) __asm__("func_00115808"); diff --git a/src/sdk/libc/mprec/pow5mult.c b/src/sdk/libc/mprec/pow5mult.c index cd8cf38ba4..0480d1064e 100644 --- a/src/sdk/libc/mprec/pow5mult.c +++ b/src/sdk/libc/mprec/pow5mult.c @@ -94,7 +94,8 @@ typedef struct _reent { _Bigint *_p5s; } _reent; -extern s32 small_powers_of_five[] __asm__("D_001523B8"); +/* 5^1..5^3, indexed by (k & 3) - 1. */ +const s32 small_powers_of_five[3] __asm__("D_001523B8") = {5, 25, 125}; extern _Bigint *__i2b(struct _reent *, s32) __asm__("func_00115808"); extern _Bigint *_multiply(struct _reent *, _Bigint *, _Bigint *); extern _Bigint *_multadd(struct _reent *, _Bigint *, s32, s32); diff --git a/src/sdk/libc/stdlib/_strtol_r.c b/src/sdk/libc/stdlib/_strtol_r.c index daa8fc5567..72ccde80a6 100644 --- a/src/sdk/libc/stdlib/_strtol_r.c +++ b/src/sdk/libc/stdlib/_strtol_r.c @@ -18,7 +18,7 @@ /* Source: newlib (UC Berkeley). */ /* _strtol_r: newlib-2000-02-17 strtol.c adapted to the game's 64-bit long and - * ctype table D_00152201 (= _ctype_ + 1). */ + * ctype table _ctype_. */ #include "types.h" #include "rnc/sdk/soft_float.h" @@ -27,17 +27,41 @@ typedef struct _reent { s32 _errno; } _reent; -extern u8 D_00152201[]; +#define _U 01 /* upper case */ +#define _L 02 /* lower case */ +#define _D 04 /* digit */ +#define _S 0x08 /* white space */ +#define _P 0x10 /* punctuation */ +#define _C 0x20 /* control */ +#define _X 0x40 /* hex digit */ +#define _B 0x80 /* blank */ -#define _U 01 -#define _L 02 -#define _D 04 -#define _S 0x08 +/* newlib's _ctype_: entry c + 1 classifies character c (EOF is entry 0); + characters 128-255 are unclassified. */ +const char _ctype_[1 + 256] __asm__("D_00152200") = { + 0, + _C, _C, _C, _C, _C, _C, _C, _C, + _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, + _C, _C, _C, _C, _C, _C, _C, _C, + _C, _C, _C, _C, _C, _C, _C, _C, + _S|_B, _P, _P, _P, _P, _P, _P, _P, + _P, _P, _P, _P, _P, _P, _P, _P, + _D, _D, _D, _D, _D, _D, _D, _D, + _D, _D, _P, _P, _P, _P, _P, _P, + _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, + _U, _U, _U, _U, _U, _U, _U, _U, + _U, _U, _U, _U, _U, _U, _U, _U, + _U, _U, _U, _P, _P, _P, _P, _P, + _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, + _L, _L, _L, _L, _L, _L, _L, _L, + _L, _L, _L, _L, _L, _L, _L, _L, + _L, _L, _L, _P, _P, _P, _P, _C, +}; -#define isspace(c) ((D_00152201[(c)] & _S) != 0) -#define isdigit(c) ((D_00152201[(c)] & _D) != 0) -#define isalpha(c) ((D_00152201[(c)] & (_U | _L)) != 0) -#define isupper(c) ((D_00152201[(c)] & _U) != 0) +#define isspace(c) (((_ctype_ + 1)[(c)] & _S) != 0) +#define isdigit(c) (((_ctype_ + 1)[(c)] & _D) != 0) +#define isalpha(c) (((_ctype_ + 1)[(c)] & (_U | _L)) != 0) +#define isupper(c) (((_ctype_ + 1)[(c)] & _U) != 0) s64 _strtol_r(_reent *rptr, const s8 *nptr, s8 **endptr, s32 radix) { register const s8 *s = nptr; From 50bcc4cdbbf97a7b3c325d76464ef5d260edf0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:32:37 +0000 Subject: [PATCH 04/25] decomp: define the DMA channel tables, MPEG extension parsers and PES skip table in C sceDmaReset (DmaChannelsUsed), sceDmaPutEnv (STS/STD/MFD channel codes), _extensionAndUserData (parser per extension id) and _PES_packet (optional-field skip bits) own their read-only tables. _ctype_ goes back to assembly: check-cleanup counts its 129 class-flag entries as raw bytes. Drops the symbol_addrs/undefined_syms lines of labels C now defines. --- config/us/symbol_addrs.txt | 1 - config/us/undefined_syms.txt | 2 - configure.py | 6 ++- src/sdk/dma/sce_dma_put_env.c | 11 +++-- src/sdk/dma/sce_dma_reset.c | 4 +- src/sdk/libc/stdlib/_strtol_r.c | 44 +++++--------------- src/sdk/mpeg/demux/_PES_packet.c | 5 ++- src/sdk/mpeg/headers/_extensionAndUserData.c | 26 +++++++++++- 8 files changed, 54 insertions(+), 45 deletions(-) diff --git a/config/us/symbol_addrs.txt b/config/us/symbol_addrs.txt index 5beefeb9b0..519024837d 100644 --- a/config/us/symbol_addrs.txt +++ b/config/us/symbol_addrs.txt @@ -1,6 +1,5 @@ D_0013C940 = 0x0013C940; D_0012F76C = 0x0012F76C; -D_00152370 = 0x00152370; D_00154940 = 0x00154940; D_0015EE74 = 0x0015EE74; D_0015F49C = 0x0015F49C; diff --git a/config/us/undefined_syms.txt b/config/us/undefined_syms.txt index e9c7fe854a..dfea041505 100644 --- a/config/us/undefined_syms.txt +++ b/config/us/undefined_syms.txt @@ -1,6 +1,5 @@ D_0013C940 = 0x0013C940; D_0012F76C = 0x0012F76C; -D_00152370 = 0x00152370; D_00154940 = 0x00154940; D_0015EE74 = 0x0015EE74; D_0015F49C = 0x0015F49C; @@ -30,7 +29,6 @@ D_0015F60C_2 = 0x0015F60C; D_0015FEFC_2 = 0x0015FEFC; D_001E83C0 = 0x001E83C0; D_00160F00_abs = 0x00160F00; -D_001E8360 = 0x001E8360; D_00159750 = 0x00159750; D_00159758 = 0x00159758; D_0015EBE8 = 0x0015EBE8; diff --git a/configure.py b/configure.py index 6501ed70a5..dd6e2fd355 100755 --- a/configure.py +++ b/configure.py @@ -940,7 +940,6 @@ # link fails when the section is not SIZE bytes. Both the assembly-backed and # the promoted (normalized) unit names resolve to the same retail bytes. RODATA_OVERLAYS = { - "sdk/libc/stdlib/_strtol_r": (0x152200, 0x53180, 257), # newlib _ctype_ "_dtoa_r": (0x152310, 0x53290, 88), # Infinity/NaN/0 strings, f64 literals, switch table # _getpic's switch emits a 5-entry jump table (0x14 bytes) that retail # stored at 0x153AA0 inside core_rdata; the expected object references it @@ -992,6 +991,8 @@ "sdk/storage/cdvd/cd_check_scmd": (0x152F10, 0x53E90, 64), "sdk/storage/cdvd/checkModelVersion": (0x153030, 0x53FB0, 12), "sdk/dma/wait_dma": (0x1533E0, 0x54360, 22), + "sdk/dma/sce_dma_reset": (0x1533F8, 0x54378, 40), # DmaChannelsUsed + "sdk/dma/sce_dma_put_env": (0x153420, 0x543A0, 42), # its STS/STD/MFD channel codes "sdk/input/dbc/sceDbcInit": (0x1534D8, 0x54458, 121), "sdk/mpeg/macroblock/mb_address_increment": (0x1537A8, 0x54728, 50), "sdk/mpeg/macroblock/slicea0": (0x153800, 0x54780, 66), @@ -1027,8 +1028,9 @@ "sdk/mpeg/macroblock/_slice0": (0x153848, 0x547C8, 32), # its message "sdk/mpeg/macroblock/skip_mb0": (0x153868, 0x547E8, 45), # its message "sdk/mpeg/macroblock/_decMB0": (0x153898, 0x54818, 32), # its message + "sdk/mpeg/headers/_extensionAndUserData": (0x1538B8, 0x54838, 44), # its extension parser table "sdk/mpeg/picture/decpicture": (0x153940, 0x548C0, 59), # its two messages - "sdk/mpeg/demux/_PES_packet": (0x1539D8, 0x54958, 46), # its message + "sdk/mpeg/demux/_PES_packet": (0x1539C8, 0x54948, 62), # its header skip table and message "sdk/mpeg/api/sce_mpeg_create": (0x153A10, 0x54990, 35), # its message "sdk/mpeg/api/alloc_work_area": (0x153A38, 0x549B8, 28), # its message "sdk/mpeg/picture/_lastFrame": (0x153AB8, 0x54A38, 28), # its message diff --git a/src/sdk/dma/sce_dma_put_env.c b/src/sdk/dma/sce_dma_put_env.c index 2964bb4f49..0f665fbfcf 100644 --- a/src/sdk/dma/sce_dma_put_env.c +++ b/src/sdk/dma/sce_dma_put_env.c @@ -13,9 +13,14 @@ typedef struct { u32 rbmsk; } sceDmaEnv; -extern u8 dma_sts_control_encodings[] __asm__("D_00153420"); -extern u8 dma_std_control_encodings[] __asm__("D_00153430"); -extern u8 dma_mfd_control_encodings[] __asm__("D_00153440"); +/* D_CTRL field codes by DMA channel (0 VIF0, 1 VIF1, 2 GIF, 3 fromIPU, 4 toIPU, + 5 SIF0, 6 SIF1, 7 SIF2, 8 fromSPR, 9 toSPR); 0 = the channel cannot take that role. */ +/* STS (stall source): 1 SIF0, 2 fromSPR, 3 fromIPU. */ +const u8 dma_sts_control_encodings[10] __asm__("D_00153420") = {0, 0, 0, 3, 0, 1, 0, 0, 2, 0}; +/* STD (stall drain): 1 VIF1, 2 GIF, 3 SIF1. */ +const u8 dma_std_control_encodings[10] __asm__("D_00153430") = {0, 1, 2, 0, 0, 0, 3, 0, 0, 0}; +/* MFD (MFIFO drain): 2 VIF1, 3 GIF. */ +const u8 dma_mfd_control_encodings[10] __asm__("D_00153440") = {0, 2, 3, 0, 0, 0, 0, 0, 0, 0}; extern sceDmaEnv dma_last_applied_environment __asm__("D_001599D8"); s32 sceDmaPutEnv(sceDmaEnv *env) { diff --git a/src/sdk/dma/sce_dma_reset.c b/src/sdk/dma/sce_dma_reset.c index ce28c0f2a9..033e236ff5 100644 --- a/src/sdk/dma/sce_dma_reset.c +++ b/src/sdk/dma/sce_dma_reset.c @@ -25,7 +25,9 @@ #include "rnc/sdk/dma.h" #include "rnc/sdk/graph.h" -extern s32 DmaChannelsUsed[] __asm__("D_001533F8"); +/* By DMA channel: 1 = sceDmaReset clears its registers (all but the SIF + channels 5-7). */ +const s32 DmaChannelsUsed[10] __asm__("D_001533F8") = {1, 1, 1, 1, 1, 0, 0, 0, 1, 1}; s32 sceDmaReset(s32 enable_dma) { s32 dma_environment[5]; diff --git a/src/sdk/libc/stdlib/_strtol_r.c b/src/sdk/libc/stdlib/_strtol_r.c index 72ccde80a6..daa8fc5567 100644 --- a/src/sdk/libc/stdlib/_strtol_r.c +++ b/src/sdk/libc/stdlib/_strtol_r.c @@ -18,7 +18,7 @@ /* Source: newlib (UC Berkeley). */ /* _strtol_r: newlib-2000-02-17 strtol.c adapted to the game's 64-bit long and - * ctype table _ctype_. */ + * ctype table D_00152201 (= _ctype_ + 1). */ #include "types.h" #include "rnc/sdk/soft_float.h" @@ -27,41 +27,17 @@ typedef struct _reent { s32 _errno; } _reent; -#define _U 01 /* upper case */ -#define _L 02 /* lower case */ -#define _D 04 /* digit */ -#define _S 0x08 /* white space */ -#define _P 0x10 /* punctuation */ -#define _C 0x20 /* control */ -#define _X 0x40 /* hex digit */ -#define _B 0x80 /* blank */ +extern u8 D_00152201[]; -/* newlib's _ctype_: entry c + 1 classifies character c (EOF is entry 0); - characters 128-255 are unclassified. */ -const char _ctype_[1 + 256] __asm__("D_00152200") = { - 0, - _C, _C, _C, _C, _C, _C, _C, _C, - _C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C, - _C, _C, _C, _C, _C, _C, _C, _C, - _C, _C, _C, _C, _C, _C, _C, _C, - _S|_B, _P, _P, _P, _P, _P, _P, _P, - _P, _P, _P, _P, _P, _P, _P, _P, - _D, _D, _D, _D, _D, _D, _D, _D, - _D, _D, _P, _P, _P, _P, _P, _P, - _P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U, - _U, _U, _U, _U, _U, _U, _U, _U, - _U, _U, _U, _U, _U, _U, _U, _U, - _U, _U, _U, _P, _P, _P, _P, _P, - _P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L, - _L, _L, _L, _L, _L, _L, _L, _L, - _L, _L, _L, _L, _L, _L, _L, _L, - _L, _L, _L, _P, _P, _P, _P, _C, -}; +#define _U 01 +#define _L 02 +#define _D 04 +#define _S 0x08 -#define isspace(c) (((_ctype_ + 1)[(c)] & _S) != 0) -#define isdigit(c) (((_ctype_ + 1)[(c)] & _D) != 0) -#define isalpha(c) (((_ctype_ + 1)[(c)] & (_U | _L)) != 0) -#define isupper(c) (((_ctype_ + 1)[(c)] & _U) != 0) +#define isspace(c) ((D_00152201[(c)] & _S) != 0) +#define isdigit(c) ((D_00152201[(c)] & _D) != 0) +#define isalpha(c) ((D_00152201[(c)] & (_U | _L)) != 0) +#define isupper(c) ((D_00152201[(c)] & _U) != 0) s64 _strtol_r(_reent *rptr, const s8 *nptr, s8 **endptr, s32 radix) { register const s8 *s = nptr; diff --git a/src/sdk/mpeg/demux/_PES_packet.c b/src/sdk/mpeg/demux/_PES_packet.c index 9001ece7f4..ee01e67b5c 100644 --- a/src/sdk/mpeg/demux/_PES_packet.c +++ b/src/sdk/mpeg/demux/_PES_packet.c @@ -5,7 +5,10 @@ #include "types.h" -extern u8 pes_header_skip_bit_counts[] __asm__("D_001539C8"); +/* Bits to skip for the optional header fields whose flags are set in the + index: bit 0 adds 16, bit 1 adds 8, bit 2 adds 8, bit 3 adds 24. */ +const u8 pes_header_skip_bit_counts[16] __asm__("D_001539C8") = { + 0, 16, 8, 24, 8, 24, 16, 32, 24, 40, 32, 48, 32, 48, 40, 56}; const char invalid_pack_header_field_message[] __asm__("D_001539D8") = "pack_header_field_flag needs to be '0' in PS\n"; extern s32 _Error(); diff --git a/src/sdk/mpeg/headers/_extensionAndUserData.c b/src/sdk/mpeg/headers/_extensionAndUserData.c index e30bd8f360..99e49cf598 100644 --- a/src/sdk/mpeg/headers/_extensionAndUserData.c +++ b/src/sdk/mpeg/headers/_extensionAndUserData.c @@ -7,7 +7,31 @@ typedef struct { ExtFunc f[11]; } ExtTable; -extern ExtTable mpeg_extension_dispatch_table __asm__("D_001538B8"); +extern void report_unknown_mpeg_extension(void *) __asm__("FUN_0012cb00"); +extern void _sequenceExtension(void *); +extern void _sequenceDisplayExtension(void *); +extern void _quantMatrixExtension(void *); +extern void _copyrightExtension(void *); +extern void report_mpeg_sequence_scalable_unsupported(void *) __asm__("FUN_0012caf0"); +extern void _pictureDisplayExtension(void *); +extern void _pictureCodingExtension(void *); +extern void report_mpeg_picture_spatial_scalable_unsupported(void *) __asm__("FUN_0012cb10"); +extern void report_mpeg_picture_temporal_scalable_unsupported(void *) __asm__("FUN_0012cb20"); + +/* Parser by extension_start_code_identifier (ISO 13818-2 table 6-2). */ +const ExtTable mpeg_extension_dispatch_table __asm__("D_001538B8") = {{ + report_unknown_mpeg_extension, /* 0: reserved */ + _sequenceExtension, /* 1: sequence */ + _sequenceDisplayExtension, /* 2: sequence display */ + _quantMatrixExtension, /* 3: quant matrix */ + _copyrightExtension, /* 4: copyright */ + report_mpeg_sequence_scalable_unsupported, /* 5: sequence scalable */ + report_unknown_mpeg_extension, /* 6: reserved */ + _pictureDisplayExtension, /* 7: picture display */ + _pictureCodingExtension, /* 8: picture coding */ + report_mpeg_picture_spatial_scalable_unsupported, /* 9: picture spatial scalable */ + report_mpeg_picture_temporal_scalable_unsupported, /* 10: picture temporal scalable */ +}}; void _extensionAndUserData(void *decoder_state) { ExtTable extension_handlers = mpeg_extension_dispatch_table; From 5be0f380988ea3a151b686f5e48bc743bc571b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:36:38 +0000 Subject: [PATCH 05/25] decomp: define the memory card save paths in memcard_get_name memcard_get_name writes the disc's region and product code into these six path strings, so it owns them; the other readers keep their externs. --- configure.py | 1 + src/save/memcard_get_name.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/configure.py b/configure.py index dd6e2fd355..02a04a46ca 100755 --- a/configure.py +++ b/configure.py @@ -1091,6 +1091,7 @@ "sdk/ipu/send_ipu_command": (0x132E70, 0x33DF0, 64), "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), + "save/memcard_get_name": (0x13D1D0, 0x3E150, 192), # the save directory and file paths "rendering/texture/append_palette_transfer_packet": (0x151B60, 0x52AE0, 656), "rendering/effects/render_queued_rotated_sprites": (0x189300, 0x8A280, 196), "camera/backup_current_cam": (0x1893D0, 0x8A350, 2112), diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index 5986d13504..b21a86eb60 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -28,3 +28,12 @@ void memcard_get_name(u8 *rom_configuration) { } extern __typeof__(memcard_get_name) func_00209030 __attribute__((alias("FUN_00209030"))); + +/* The save directory and file paths; memcard_get_name writes the disc's + region and product code over the '*'s of each. */ +char D_0013D1D0[] = "/BA****-*****RATCHET"; +char D_0013D1E8[] = "/************RATCHET/*"; +char D_0013D200[] = "/************RATCHET/icon.sys"; +char D_0013D220[] = "/************RATCHET/static.ico"; +char D_0013D240[] = "/************RATCHET/************RATCHET"; +char D_0013D270[] = "/************RATCHET/save%d.bin"; From 5f77010a8b98e7dfe12114f38afe7e6d98686142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:46:26 +0000 Subject: [PATCH 06/25] decomp: define two GS timeout messages, the MPEG flush code, a memcard counter and the T10K time zone in C sceGsPutDrawEnv and sceGsExecLoadImage own their DMA timeout messages, video_dec_flush its sequence end code, memcard_restore_data its gp-relative differing-block counter (defined ahead of the function, which drops the _gp alias), sceScfGetTimeZone the T10K time zone. --- configure.py | 5 +++++ src/movies/decoder/video_dec_flush.c | 5 ++++- src/save/memcard_restore_data.c | 6 ++++-- src/sdk/graph/sce_gs_exec_load_image.c | 3 ++- src/sdk/graph/sce_gs_put_draw_env.c | 3 ++- src/sdk/scf/sce_scf_get_time_zone.c | 7 +++++-- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/configure.py b/configure.py index 02a04a46ca..e8f5ee4d4e 100755 --- a/configure.py +++ b/configure.py @@ -1016,6 +1016,8 @@ "sdk/storage/cdvd/sceCdRead": (0x152FC8, 0x53F48, 36), # its two messages "sdk/storage/cdvd/scecdreadclock": (0x152FF0, 0x53F70, 59), # its two messages "sdk/graph/sce_gs_set_def_disp_env": (0x153040, 0x53FC0, 52), # its message + "sdk/graph/sce_gs_put_draw_env": (0x153078, 0x53FF8, 47), # its DMA timeout message + "sdk/graph/sce_gs_exec_load_image": (0x1531D0, 0x54150, 50), # its DMA timeout message "sdk/storage/memory_card/sce_mc_init": (0x153450, 0x543D0, 101), # its three messages "sdk/input/dbc/sceDbcSetWorkAddr": (0x153558, 0x544D8, 30), # its message "sdk/input/dbc/sceDbcCreateSocket": (0x153578, 0x544F8, 31), # its message @@ -1076,8 +1078,10 @@ "rendering/frame/swap_render_buffer_chain": (0x160F04, 0x61E84, 4), "rendering/texture/dma_tie_textures": (0x160F74, 0x61EF4, 4), "ui/hud/update_hud": (0x15F688, 0x60608, 4), + "movies/decoder/video_dec_flush": (0x161218, 0x62198, 4), # the sequence end code it appends "movies/decoder/callbacks/mpeg_error": (0x161220, 0x621A0, 4), # its "%s\n" format "runtime/startup/init_once": (0x15FA88, 0x60A08, 14), # its reboot message + "save/memcard_restore_data": (0x15FE90, 0x60E10, 4), # its differing-block counter "save/memcard_update_state": (0x15FE98, 0x60E18, 21), # its delete path format and message "audio/voices/set_sound_handle_id": (0x160068, 0x60FE8, 5), # its handle-conflict diagnostic "movies/player/err_message": (0x1611F8, 0x62178, 14), # its error format @@ -1089,6 +1093,7 @@ "sdk/kernel/supplement_crt0": (0x130320, 0x312A0, 8), "sdk/graph/sce_gs_get_gparam": (0x132D40, 0x33CC0, 16), "sdk/ipu/send_ipu_command": (0x132E70, 0x33DF0, 64), + "sdk/scf/sce_scf_get_time_zone": (0x1330D0, 0x34050, 2), # t10k_time_zone "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), "save/memcard_get_name": (0x13D1D0, 0x3E150, 192), # the save directory and file paths diff --git a/src/movies/decoder/video_dec_flush.c b/src/movies/decoder/video_dec_flush.c index 02060eff5d..22e38d1c97 100644 --- a/src/movies/decoder/video_dec_flush.c +++ b/src/movies/decoder/video_dec_flush.c @@ -8,7 +8,7 @@ struct Code4 { u8 b[4]; }; -extern struct Code4 video_dec_flush_code[] __asm__("D_00161218"); +extern const struct Code4 video_dec_flush_code[] __asm__("D_00161218"); extern void video_dec_begin_put(struct VideoDec *, u32 *, s32 *, u32 *, s32 *) __asm__("func_0023CBF0"); extern s32 cpy2area(u32, s32, u32, s32, void *, s32, s32, s32) __asm__("func_0023B810"); @@ -45,3 +45,6 @@ s32 video_dec_flush(struct VideoDec *vd) { } extern __typeof__(video_dec_flush) func_0023CD08 __attribute__((alias("FUN_0023cd08"))); + +/* The MPEG sequence_end_code (00 00 01 B7) appended to flush the decoder. */ +const struct Code4 video_dec_flush_code[1] __asm__("D_00161218") = {{{0x00, 0x00, 0x01, 0xB7}}}; diff --git a/src/save/memcard_restore_data.c b/src/save/memcard_restore_data.c index a5af8adbb9..dfd5d0e358 100644 --- a/src/save/memcard_restore_data.c +++ b/src/save/memcard_restore_data.c @@ -34,7 +34,9 @@ extern CardState D_0013D290; #include "rnc/save/memcard_restore_data_globals.h" -extern s32 memcard_restore_differing_block_count_gp __asm__("D_0015FE90") __attribute__((sda)); +/* Blocks whose restored bytes differed from memory; defined ahead of the + function, which reaches it gp-relative. */ +s32 memcard_restore_differing_block_count __asm__("D_0015FE90") = 0; extern s32 validate_data_crc(u8 *header) __asm__("func_0020AD38"); extern s32 memcmp(const void *, const void *, s32); extern void copy_memory_aligned(void *, void *, s32) __asm__("func_001F9838"); @@ -90,7 +92,7 @@ s32 memcard_restore_data(u8 *save_packet, s32 slot, struct RestoreEntry *restore } if (memcmp(slot_destination, ((struct RestoreBlock *)save_packet)->data, copySize) != 0) { - memcard_restore_differing_block_count_gp++; + memcard_restore_differing_block_count++; } copy_memory_aligned( slot_destination, ((struct RestoreBlock *)save_packet)->data, copySize); diff --git a/src/sdk/graph/sce_gs_exec_load_image.c b/src/sdk/graph/sce_gs_exec_load_image.c index a04fc77285..ff21a9b2de 100644 --- a/src/sdk/graph/sce_gs_exec_load_image.c +++ b/src/sdk/graph/sce_gs_exec_load_image.c @@ -1,7 +1,8 @@ #include "types.h" #include "rnc/sdk/deci2.h" -extern u8 gs_load_image_dma_timeout_message[] __asm__("D_001531D0"); +const char gs_load_image_dma_timeout_message[] __asm__("D_001531D0") = + "sceGsExecLoadImage: DMA Ch.2 does not terminate\r\n"; s32 sceGsExecLoadImage(u8 *lp, u8 *image_payload) { u32 count; diff --git a/src/sdk/graph/sce_gs_put_draw_env.c b/src/sdk/graph/sce_gs_put_draw_env.c index 56bf655c30..b31e0b6960 100644 --- a/src/sdk/graph/sce_gs_put_draw_env.c +++ b/src/sdk/graph/sce_gs_put_draw_env.c @@ -1,7 +1,8 @@ #include "types.h" #include "rnc/sdk/deci2.h" -extern u8 gs_draw_env_dma_timeout_message[] __asm__("D_00153078"); +const char gs_draw_env_dma_timeout_message[] __asm__("D_00153078") = + "sceGsPutDrawEnv: DMA Ch.2 does not terminate\r\n"; s32 sceGsPutDrawEnv(u64 *env) { u32 count; diff --git a/src/sdk/scf/sce_scf_get_time_zone.c b/src/sdk/scf/sce_scf_get_time_zone.c index fb0a3091a3..8e0e4cfbdf 100644 --- a/src/sdk/scf/sce_scf_get_time_zone.c +++ b/src/sdk/scf/sce_scf_get_time_zone.c @@ -2,14 +2,14 @@ #include "rnc/sdk/scf.h" extern void GetOsdConfigParam(int *config); -extern short D_001330D0[] NOT_SDA; +extern short t10k_time_zone __asm__("D_001330D0") NOT_SDA; int sceScfGetTimeZone(void) { int config; int timezone; if (IsT10K() != 0) { - timezone = D_001330D0[0]; + timezone = t10k_time_zone; } else { GetOsdConfigParam(&config); timezone = config >> 21; @@ -19,3 +19,6 @@ int sceScfGetTimeZone(void) { } return timezone; } + +/* The T10K's time zone, in minutes from UTC (540: UTC+9), like the fallback above. */ +short t10k_time_zone __asm__("D_001330D0") NOT_SDA = 0x21C; From dea229a75cec536a948634294927a35dce624c10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:50:15 +0000 Subject: [PATCH 07/25] decomp: define sceCdRead's request and the pad2 DMA state words in C sceCdRead's request is sized by the sizeof(*command) its RPC sends; scePad2Init and scePad2CheckDma own the flag and the two words only they touch. --- configure.py | 3 +++ src/sdk/input/sce_pad2_check_dma.c | 3 +++ src/sdk/input/sce_pad2_init.c | 2 ++ src/sdk/storage/cdvd/sceCdRead.c | 3 +++ 4 files changed, 11 insertions(+) diff --git a/configure.py b/configure.py index e8f5ee4d4e..83aa17c3b8 100755 --- a/configure.py +++ b/configure.py @@ -1092,7 +1092,10 @@ DATA_OVERLAYS = { "sdk/kernel/supplement_crt0": (0x130320, 0x312A0, 8), "sdk/graph/sce_gs_get_gparam": (0x132D40, 0x33CC0, 16), + "sdk/input/sce_pad2_init": (0x132DD0, 0x33D50, 4), # pad2_initialized + "sdk/input/sce_pad2_check_dma": (0x132DD8, 0x33D58, 8), # last DMA sequence words "sdk/ipu/send_ipu_command": (0x132E70, 0x33DF0, 64), + "sdk/storage/cdvd/sceCdRead": (0x1313C0, 0x32340, 24), # native_cd_read_request "sdk/scf/sce_scf_get_time_zone": (0x1330D0, 0x34050, 2), # t10k_time_zone "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), diff --git a/src/sdk/input/sce_pad2_check_dma.c b/src/sdk/input/sce_pad2_check_dma.c index 2d1fa436bf..e8c50dce62 100644 --- a/src/sdk/input/sce_pad2_check_dma.c +++ b/src/sdk/input/sce_pad2_check_dma.c @@ -34,3 +34,6 @@ s32 scePad2CheckDma(s32 socket_index) { D_00132DD8.last1 = *(s32 *)(sides[1] + 0x7C); return 1; } + +/* The DMA sequence words both sides showed at the last new transfer. */ +DmaState D_00132DD8 __attribute__((section(".data"))) = {0, 0}; diff --git a/src/sdk/input/sce_pad2_init.c b/src/sdk/input/sce_pad2_init.c index cb114d3029..f8f62bd2a5 100644 --- a/src/sdk/input/sce_pad2_init.c +++ b/src/sdk/input/sce_pad2_init.c @@ -25,3 +25,5 @@ s32 scePad2Init(void) { } while ((s32)pad2_socket_record < (s32)(D_0015B540 + 0x3300)); return 1; } + +u32 pad2_initialized[1] __asm__("D_00132DD0") __attribute__((section(".data"))) = {0}; diff --git a/src/sdk/storage/cdvd/sceCdRead.c b/src/sdk/storage/cdvd/sceCdRead.c index 0195cd3eaa..4feff83e48 100644 --- a/src/sdk/storage/cdvd/sceCdRead.c +++ b/src/sdk/storage/cdvd/sceCdRead.c @@ -91,3 +91,6 @@ s32 sceCdRead(u32 sector, u32 count, void *buffer, struct sceCdRMode *mode) { } return 1; } + +/* The read request sceCdRead sends to the CD server (sizeof above is its size). */ +struct CdReadCommand native_cd_read_request __asm__("D_001313C0") = {0}; From c83c695a51fd0ff084293800f8b7eeebfb7cc4ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:55:05 +0000 Subject: [PATCH 08/25] decomp: define the sound batch buffer pointers in snd_start_sound_system snd_start_sound_system sets snd_batch_command_buffers, snd_batch_free_bytes, snd_stream_buffers and snd_batch_return_buffers, so it defines them (with the same initial values) ahead of the function, which reaches them gp-relative. --- configure.py | 1 + src/audio/snd_start_sound_system.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/configure.py b/configure.py index 83aa17c3b8..c429d1b287 100755 --- a/configure.py +++ b/configure.py @@ -1054,6 +1054,7 @@ # preserved small-data blobs (core.lit / .lit). Placed like RODATA_OVERLAYS. SDATA_OVERLAYS = { "audio/rpc/snd_returns": (0x15EC80, 0x5FC00, 8), + "audio/snd_start_sound_system": (0x15ECA0, 0x5FC20, 32), # the batch buffer pointers it sets up "rendering/debug/print_debug_text": (0x15F000, 0x5FF80, 8), "runtime/decrement_resource_counter": (0x15F8F8, 0x60878, 4), "runtime/callbacks/count_vsync": (0x15ED40, 0x5FCC0, 24), diff --git a/src/audio/snd_start_sound_system.c b/src/audio/snd_start_sound_system.c index ffada4ad80..8f3c3fa6e3 100644 --- a/src/audio/snd_start_sound_system.c +++ b/src/audio/snd_start_sound_system.c @@ -15,11 +15,7 @@ struct SifClientDataStartSound { extern struct SifClientDataStartSound sound_command_client __asm__("D_0015EBC0"); extern struct SifClientDataStartSound sound_stream_client __asm__("D_0015EBE8"); -extern s32 *snd_batch_command_buffers[2] __asm__("D_0015ECA0") __attribute__((sda)); -extern s32 snd_batch_free_bytes __asm__("D_0015ECA8") __attribute__((sda)); -extern s32 D_0015ECAC MACRO_ADDR; -extern struct SndCommandCallback *snd_stream_buffers[2] __asm__("D_0015ECB0") __attribute__((sda)); -extern s32 *snd_batch_return_buffers[2] __asm__("D_0015ECB8") __attribute__((sda)); +extern s32 D_0015ECAC MACRO_ADDR; /* snd_batch_free_bytes[1], stored through the macro form */ extern s32 snd_cd_callback_pending __asm__("D_0015ECC8") __attribute__((sda)); extern s32 snd_cd_callback_fn __asm__("D_0015ECD0") __attribute__((sda)); extern s64 snd_cd_callback_data __asm__("D_0015ECD8") MACRO_ADDR; @@ -29,6 +25,15 @@ extern s32 snd_send_iop_command_and_wait(s32, s32, void *) __asm__("func_0012E54 s32 snd_start_sound_system(void) __asm__("FUN_0012da28"); +/* The two command batches: their buffers, free bytes, callback records and + reply buffers. snd_start_sound_system stores the same values again. */ +s32 *snd_batch_command_buffers[2] __asm__("D_0015ECA0") = {snd_command_buffer1, + snd_command_buffer2}; +s32 snd_batch_free_bytes[2] __asm__("D_0015ECA8") = {0xFFC, 0xFFC}; +struct SndCommandCallback *snd_stream_buffers[2] __asm__("D_0015ECB0") = {snd_stream_buffer1, + snd_stream_buffer2}; +s32 *snd_batch_return_buffers[2] __asm__("D_0015ECB8") = {snd_return_buffer1, snd_return_buffer2}; + const char snd_sif_bind_rpc_error_string[] __asm__("D_00153C50") = "error: sceSifBindRpc in %s, at line %d\n"; /* __FILE__ of the retail 989snd.c, which this function's messages name. */ @@ -84,7 +89,7 @@ s32 snd_start_sound_system(void) { sound_read_work.read_active = 0; snd_command_buffer2[0] = 0; sound_read_work.read_error = 0; - snd_batch_free_bytes = 0xFFC; + snd_batch_free_bytes[0] = 0xFFC; D_0015ECAC = 0xFFC; command_arg = (s32)(u32)&sound_read_work.read_active; return snd_send_iop_command_and_wait(0, 4, &command_arg); From 37fdba7e80701988fcb97bfd38dcdfe194548528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:15:28 +0000 Subject: [PATCH 09/25] decomp: define rendering profiler labels, vu1 messages and environment mesh tables in C --- configure.py | 11 ++++- src/rendering/debug/draw_debug_profiler.c | 41 +++++++++++++------ src/rendering/debug/print_debug_text.c | 4 ++ .../configure_graphics_setup_dma_chain.c | 4 +- src/rendering/mobys/draw_mobys_clean_up.c | 7 +++- src/rendering/mobys/draw_mobys_setup.c | 4 +- .../mobys/render_environment_mapped_object.c | 38 ++++++++++++++--- src/rendering/shrubs/draw_shrubs.c | 7 +++- src/rendering/sky/setup_sky_gif_paging.c | 4 +- src/rendering/tfrags/draw_tfrag.c | 7 +++- src/rendering/vu1/vu1_chain.c | 7 +++- 11 files changed, 103 insertions(+), 31 deletions(-) diff --git a/configure.py b/configure.py index c429d1b287..ac875829b6 100755 --- a/configure.py +++ b/configure.py @@ -1043,6 +1043,14 @@ "audio/streaming/start_audio_stream_read": (0x1E8650, 0xE95D0, 36), # its message "movies/decoder/callbacks/video_callback": (0x1E8B08, 0xE9A88, 21), # its message "movies/decoder/video_input/vi_buf_add_dma": (0x1E8B20, 0xE9AA0, 20), # its message + "rendering/debug/draw_debug_profiler": (0x15F380, 0x60300, 179), # profiler section names + "rendering/frame/configure_graphics_setup_dma_chain": (0x15FEC0, 0x60E40, 12), # its profiler label + "rendering/mobys/draw_mobys_setup": (0x15FED0, 0x60E50, 10), # its profiler label + "rendering/mobys/draw_mobys_clean_up": (0x15FEE0, 0x60E60, 26), # its profiler labels + "rendering/shrubs/draw_shrubs": (0x1603B0, 0x61330, 27), # its profiler labels + "rendering/sky/setup_sky_gif_paging": (0x160450, 0x613D0, 9), # its profiler label + "rendering/tfrags/draw_tfrag": (0x160E70, 0x61DF0, 27), # its profiler labels + "rendering/vu1/vu1_chain": (0x1E89C8, 0xE9948, 61), # its two debug messages } # Recovered C units that define the small-data variables their original @@ -1055,7 +1063,7 @@ SDATA_OVERLAYS = { "audio/rpc/snd_returns": (0x15EC80, 0x5FC00, 8), "audio/snd_start_sound_system": (0x15ECA0, 0x5FC20, 32), # the batch buffer pointers it sets up - "rendering/debug/print_debug_text": (0x15F000, 0x5FF80, 8), + "rendering/debug/print_debug_text": (0x15F000, 0x5FF80, 11), "runtime/decrement_resource_counter": (0x15F8F8, 0x60878, 4), "runtime/callbacks/count_vsync": (0x15ED40, 0x5FCC0, 24), "runtime/set_video_timing": (0x15ED60, 0x5FCE0, 32), @@ -1086,6 +1094,7 @@ "save/memcard_update_state": (0x15FE98, 0x60E18, 21), # its delete path format and message "audio/voices/set_sound_handle_id": (0x160068, 0x60FE8, 5), # its handle-conflict diagnostic "movies/player/err_message": (0x1611F8, 0x62178, 14), # its error format + "rendering/mobys/render_environment_mapped_object": (0x160520, 0x614A0, 96), # per-class mesh tables } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/rendering/debug/draw_debug_profiler.c b/src/rendering/debug/draw_debug_profiler.c index 4ece0321f5..9ec5cd5028 100644 --- a/src/rendering/debug/draw_debug_profiler.c +++ b/src/rendering/debug/draw_debug_profiler.c @@ -26,19 +26,19 @@ extern u8 subtitles_enabled __asm__("D_0015EE40") MACRO_ADDR; extern s32 screen_overlay_enabled __asm__("D_0015F34C") __attribute__((sda)); extern s32 screen_color_effect_now __asm__("D_0015F350") __attribute__((sda)); extern s32 occl_debug_overlay_enabled[2] __asm__("D_0015F370") __attribute__((sda)); -extern u8 render_setup_label[] __asm__("D_0015F380"); -extern u8 sky_draw_label[] __asm__("D_0015F390"); -extern u8 pre_effects_label[] __asm__("D_0015F3A0"); -extern u8 vu_effects_label[] __asm__("D_0015F3B0"); -extern u8 moby_effects_label[] __asm__("D_0015F3C0"); -extern u8 part_draw_label[] __asm__("D_0015F3D0"); -extern u8 post_effects_label[] __asm__("D_0015F3E0"); -extern u8 aa_blur_label[] __asm__("D_0015F3F0"); -extern u8 hud_label[] __asm__("D_0015F3F8"); -extern u8 screen_overlays_label[] __asm__("D_0015F400"); -extern u8 dma_sync_empty_label[] __asm__("D_0015F410"); -extern u8 tie_patch_light_label[] __asm__("D_0015F418"); -extern u8 moby_patch_label[] __asm__("D_0015F428"); +extern const char render_setup_label[] __asm__("D_0015F380"); +extern const char sky_draw_label[] __asm__("D_0015F390"); +extern const char pre_effects_label[] __asm__("D_0015F3A0"); +extern const char vu_effects_label[] __asm__("D_0015F3B0"); +extern const char moby_effects_label[] __asm__("D_0015F3C0"); +extern const char part_draw_label[] __asm__("D_0015F3D0"); +extern const char post_effects_label[] __asm__("D_0015F3E0"); +extern const char aa_blur_label[] __asm__("D_0015F3F0"); +extern const char hud_label[] __asm__("D_0015F3F8"); +extern const char screen_overlays_label[] __asm__("D_0015F400"); +extern const char dma_sync_empty_label[] __asm__("D_0015F410"); +extern const char tie_patch_light_label[] __asm__("D_0015F418"); +extern const char moby_patch_label[] __asm__("D_0015F428"); extern s32 draw_enable_mask __asm__("D_0015F434") MACRO_ADDR; extern f32 D_0015F440 MACRO_ADDR; extern s32 draw_callback_count __asm__("D_0015F464") __attribute__((sda)); @@ -319,3 +319,18 @@ extern __typeof__(draw_debug_profiler) func_001F39D0 __attribute__((alias("FUN_0 /* Defined below its only user, so retail reaches it with lui. */ u8 subtitles_enabled __asm__("D_0015EE40") MACRO_ADDR = 0; + +/* Section names handed to the profiler callbacks above. */ +const char render_setup_label[] __asm__("D_0015F380") = "render setup"; +const char sky_draw_label[] __asm__("D_0015F390") = "sky draw"; +const char pre_effects_label[] __asm__("D_0015F3A0") = "pre effects"; +const char vu_effects_label[] __asm__("D_0015F3B0") = "vu effects"; +const char moby_effects_label[] __asm__("D_0015F3C0") = "moby effects"; +const char part_draw_label[] __asm__("D_0015F3D0") = "part draw"; +const char post_effects_label[] __asm__("D_0015F3E0") = "post effects"; +const char aa_blur_label[] __asm__("D_0015F3F0") __attribute__((section(".rodata"))) = "aa blur"; +const char hud_label[] __asm__("D_0015F3F8") __attribute__((section(".rodata"))) = "hud"; +const char screen_overlays_label[] __asm__("D_0015F400") = "screen overlays"; +const char dma_sync_empty_label[] __asm__("D_0015F410") __attribute__((section(".rodata"))) = ""; +const char tie_patch_light_label[] __asm__("D_0015F418") = "tie patch-light"; +const char moby_patch_label[] __asm__("D_0015F428") = "moby patch"; diff --git a/src/rendering/debug/print_debug_text.c b/src/rendering/debug/print_debug_text.c index dc4b0153cf..cef9c144fd 100644 --- a/src/rendering/debug/print_debug_text.c +++ b/src/rendering/debug/print_debug_text.c @@ -1,5 +1,6 @@ #include "types.h" #include "rnc/sdk/libc/stdio.h" +#include "sda.h" struct DebugText { s32 x; @@ -26,3 +27,6 @@ void print_debug_text(s32 x, s32 y, s32 color, char *text) { } extern __typeof__(print_debug_text) func_001F0BD0 __attribute__((alias("FUN_001f0bd0"))); + +/* Defined below its only user, so retail reaches it with lui. */ +char font_text_format[] __asm__("D_0015F008") MACRO_ADDR = "%s"; diff --git a/src/rendering/frame/configure_graphics_setup_dma_chain.c b/src/rendering/frame/configure_graphics_setup_dma_chain.c index ed8eefc7e3..e4e2291501 100644 --- a/src/rendering/frame/configure_graphics_setup_dma_chain.c +++ b/src/rendering/frame/configure_graphics_setup_dma_chain.c @@ -6,7 +6,7 @@ extern struct TagPtr D_0015FF40; #include "rnc/rendering/frame/configure_graphics_setup_dma_chain_globals.h" extern u8 D_001C8680[]; -extern u8 moby_shadow_callback_label[] __asm__("D_0015FEC0"); +extern const char moby_shadow_callback_label[] __asm__("D_0015FEC0"); extern void FUN_00227740(void); extern void submit_graphics_setup_command_stream(void *) __asm__("FUN_00227548"); extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); @@ -43,3 +43,5 @@ void configure_graphics_setup_dma_chain(void) { extern __typeof__(configure_graphics_setup_dma_chain) func_0020D060 __attribute__((alias("FUN_0020d060"))); + +const char moby_shadow_callback_label[] __asm__("D_0015FEC0") = "moby shadow"; diff --git a/src/rendering/mobys/draw_mobys_clean_up.c b/src/rendering/mobys/draw_mobys_clean_up.c index 3dbe8df8d1..ed4c135507 100644 --- a/src/rendering/mobys/draw_mobys_clean_up.c +++ b/src/rendering/mobys/draw_mobys_clean_up.c @@ -2,8 +2,8 @@ #include "rnc/rendering/draw_config.h" #include "rnc/data_labels.h" -extern u8 moby_draw_callback_label[] __asm__("D_0015FEE0"); -extern u8 moby_skin_callback_label[] __asm__("D_0015FEF0"); +extern const char moby_draw_callback_label[] __asm__("D_0015FEE0"); +extern const char moby_skin_callback_label[] __asm__("D_0015FEF0"); #include "rnc/rendering/mobys/draw_mobys_clean_up_globals.h" @@ -33,3 +33,6 @@ void draw_mobys_clean_up(void) { } } } + +const char moby_draw_callback_label[] __asm__("D_0015FEE0") = "moby draw"; +const char moby_skin_callback_label[] __asm__("D_0015FEF0") = "moby skin"; diff --git a/src/rendering/mobys/draw_mobys_setup.c b/src/rendering/mobys/draw_mobys_setup.c index fcbcfffd6e..bcf85c16da 100644 --- a/src/rendering/mobys/draw_mobys_setup.c +++ b/src/rendering/mobys/draw_mobys_setup.c @@ -7,7 +7,7 @@ #include "rnc/rendering/vu1_registers.h" extern u8 moby_draw_vu0_micro_program[] __asm__("D_00100080"); -extern u8 moby_texture_label[] __asm__("D_0015FED0"); +extern const char moby_texture_label[] __asm__("D_0015FED0"); extern s32 vu1_chain_limit __asm__("D_00160F08"); extern void noop_core_callback_secondary() __asm__("func_001F21B8"); extern void vu0_load_micro_program() __asm__("func_002334D8"); @@ -38,3 +38,5 @@ void draw_mobys_setup(void) { } extern __typeof__(draw_mobys_setup) func_0020D278 __attribute__((alias("FUN_0020d278"))); + +const char moby_texture_label[] __asm__("D_0015FED0") = "moby texs"; diff --git a/src/rendering/mobys/render_environment_mapped_object.c b/src/rendering/mobys/render_environment_mapped_object.c index 475d393dbd..5af53dee96 100644 --- a/src/rendering/mobys/render_environment_mapped_object.c +++ b/src/rendering/mobys/render_environment_mapped_object.c @@ -22,12 +22,37 @@ typedef struct { extern s32 environment_mapping_was_active_gp __asm__("D_001604A8") __attribute__((sda)); extern s32 D_001604AC __attribute__((sda)); -extern s32 environment_mesh_colors[2] __asm__("D_00160520") __attribute__((sda)); -extern s32 environment_mesh_vertex_counts[2] __asm__("D_00160530") __attribute__((sda)); -extern s32 environment_mesh_quad_counts[2] __asm__("D_00160540") __attribute__((sda)); -extern Vec4 *environment_mesh_normals[2] __asm__("D_00160550") __attribute__((sda)); -extern Vec4 *environment_mesh_positions[2] __asm__("D_00160560") __attribute__((sda)); -extern IndexedQuad *environment_mesh_quads[2] __asm__("D_00160570") __attribute__((sda)); + +/* One entry per environment-mapped class, 0x212 to 0x215 (the four meshes + defined below), indexed by class id - 0x212. Small data in retail, defined + ahead of the function so it reaches them gp-relative. */ +s32 environment_mesh_colors[4] __asm__("D_00160520") __attribute__((section(".sdata"))) = { + 0x50807060, 0x30807060, 0x30807060, 0x302080FF, +}; +s32 environment_mesh_vertex_counts[4] __asm__("D_00160530") __attribute__((section(".sdata"))) = { + 102, 39, 49, 42, +}; +s32 environment_mesh_quad_counts[4] __asm__("D_00160540") __attribute__((section(".sdata"))) = { + 74, 24, 48, 30, +}; +Vec4 *environment_mesh_normals[4] __asm__("D_00160550") __attribute__((section(".sdata"))) = { + (Vec4 *)environment_mesh_0_normals, + (Vec4 *)environment_mesh_1_normals, + (Vec4 *)environment_mesh_2_normals, + (Vec4 *)environment_mesh_3_normals, +}; +Vec4 *environment_mesh_positions[4] __asm__("D_00160560") __attribute__((section(".sdata"))) = { + (Vec4 *)environment_mesh_0_positions, + (Vec4 *)environment_mesh_1_positions, + (Vec4 *)environment_mesh_2_positions, + (Vec4 *)environment_mesh_3_positions, +}; +IndexedQuad *environment_mesh_quads[4] __asm__("D_00160570") __attribute__((section(".sdata"))) = { + environment_mesh_0_quads, + environment_mesh_1_quads, + environment_mesh_2_quads, + environment_mesh_3_quads, +}; #include "rnc/ui/menus/menu_globals.h" @@ -864,3 +889,4 @@ Vec4 environment_mapping_transformed_vertex_positions[102] = {0}; float environment_mapping_vertex_uvs[102][2] = {0}; float environment_mapping_saved_vertex_uvs[102][2] = {0}; + diff --git a/src/rendering/shrubs/draw_shrubs.c b/src/rendering/shrubs/draw_shrubs.c index fb7eb2435c..5ef136b185 100644 --- a/src/rendering/shrubs/draw_shrubs.c +++ b/src/rendering/shrubs/draw_shrubs.c @@ -3,8 +3,8 @@ #include "rnc/rendering/dma_tag.h" #include "rnc/data_labels.h" -extern u8 shrub_textures_label[] __asm__("D_001603B0"); -extern u8 shrub_draw_label[] __asm__("D_001603C0"); +extern const char shrub_textures_label[] __asm__("D_001603B0"); +extern const char shrub_draw_label[] __asm__("D_001603C0"); struct ShrubDrawState { s32 unk0; @@ -41,3 +41,6 @@ void draw_shrubs(void) { } extern __typeof__(draw_shrubs) func_00228B38 __attribute__((alias("FUN_00228b38"))); + +const char shrub_textures_label[] __asm__("D_001603B0") = "shrub texs"; +const char shrub_draw_label[] __asm__("D_001603C0") = "shrub draw"; diff --git a/src/rendering/sky/setup_sky_gif_paging.c b/src/rendering/sky/setup_sky_gif_paging.c index 8846c6c165..fc159dbbf9 100644 --- a/src/rendering/sky/setup_sky_gif_paging.c +++ b/src/rendering/sky/setup_sky_gif_paging.c @@ -18,7 +18,7 @@ struct SkyVisibilityList { }; extern struct DmaTag *D_00160470; -extern u8 sky_textures_label[] __asm__("D_00160450"); +extern const char sky_textures_label[] __asm__("D_00160450"); extern struct SkyVisibilityList *level_sky_effect_data __asm__("D_0016045C"); extern void noop_core_callback_secondary(void *, s32) __asm__("func_001F21B8"); @@ -43,3 +43,5 @@ void setup_sky_gif_paging(void) { } extern __typeof__(setup_sky_gif_paging) func_0022B4C8 __attribute__((alias("FUN_0022b4c8"))); + +const char sky_textures_label[] __asm__("D_00160450") = "sky texs"; diff --git a/src/rendering/tfrags/draw_tfrag.c b/src/rendering/tfrags/draw_tfrag.c index a1c6df6a85..79cdef7781 100644 --- a/src/rendering/tfrags/draw_tfrag.c +++ b/src/rendering/tfrags/draw_tfrag.c @@ -15,8 +15,8 @@ struct Locals { f32 v3C; }; -extern u8 tfrag_textures_callback_label[] __asm__("D_00160E70"); -extern u8 tfrag_draw_callback_label[] __asm__("D_00160E80"); +extern const char tfrag_textures_callback_label[] __asm__("D_00160E70"); +extern const char tfrag_draw_callback_label[] __asm__("D_00160E80"); extern void FlushCache(s32); extern void WriteDmaChannel(u32, u32, u32); extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); @@ -64,3 +64,6 @@ void draw_tfrag(void) { } extern __typeof__(draw_tfrag) func_002333A8 __attribute__((alias("FUN_002333a8"))); + +const char tfrag_textures_callback_label[] __asm__("D_00160E70") = "tfrag texs"; +const char tfrag_draw_callback_label[] __asm__("D_00160E80") = "tfrag draw"; diff --git a/src/rendering/vu1/vu1_chain.c b/src/rendering/vu1/vu1_chain.c index 8695dd019b..1f05e5bf94 100644 --- a/src/rendering/vu1/vu1_chain.c +++ b/src/rendering/vu1/vu1_chain.c @@ -18,8 +18,8 @@ volatile s32 vif_chain_flags __asm__("D_00160EE0") = 0; #include "rnc/rendering/vu1_chain_globals.h" -extern char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0"); -extern u8 vu1_chain_overflow_message[] __asm__("D_001E89C8"); +extern const char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0"); +extern const char vu1_chain_overflow_message[] __asm__("D_001E89C8"); extern void FlushCache(s32); void vu1_send_chain(void) __asm__("FUN_002336a0"); @@ -74,3 +74,6 @@ void vu1_sync_chain(s32 mask) { } extern __typeof__(vu1_sync_chain) func_002337B0 __attribute__((alias("FUN_002337b0"))); + +const char vu1_chain_overflow_message[] __asm__("D_001E89C8") = "vu1 chain overflow\n"; +const char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0") = "vu1 syncChain sit-and-spin timeout.\n"; From 7165df2b292af1a224079de931d4b893f76151c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:22:23 +0000 Subject: [PATCH 10/25] decomp: define rendering GS packets, variant tables and the vu chain sizes in C --- configure.py | 10 +++++++ src/math/rotations/matrix_to_quaternion.c | 4 +++ .../effects/append_billboard_batch.c | 8 +++++- ...ild_resident_indexed_texture_warp_meshes.c | 8 ++++-- .../effects/build_variant_effect_quads.c | 4 ++- .../packets/emit_textured_rectangle.c | 9 +++++- .../submit_graphics_setup_command_stream.c | 28 +++++++++++++++++-- src/rendering/vu1/select_level_vu_chain.c | 9 +++++- src/rendering/vu1/vu1_gs_regs_alt.c | 9 +++++- src/rendering/vu1/vu1_gs_regs_normal.c | 9 +++++- src/rendering/vu1/vu1_tex_flush.c | 9 +++++- 11 files changed, 94 insertions(+), 13 deletions(-) diff --git a/configure.py b/configure.py index ac875829b6..0c91b19c75 100755 --- a/configure.py +++ b/configure.py @@ -1095,6 +1095,11 @@ "audio/voices/set_sound_handle_id": (0x160068, 0x60FE8, 5), # its handle-conflict diagnostic "movies/player/err_message": (0x1611F8, 0x62178, 14), # its error format "rendering/mobys/render_environment_mapped_object": (0x160520, 0x614A0, 96), # per-class mesh tables + "rendering/effects/build_variant_effect_quads": (0x1604C0, 0x61440, 12), # quads per content variant + "rendering/effects/build_resident_indexed_texture_warp_meshes": (0x1604D0, 0x61450, 12), # trail width per content variant + "math/rotations/matrix_to_quaternion": (0x15FFD8, 0x60F58, 12), # next-axis table + "rendering/packets/emit_textured_rectangle": (0x160860, 0x617E0, 16), # its GIF tag + "rendering/effects/append_billboard_batch": (0x1608E0, 0x61860, 16), # its GIF tag } # The same for a unit's `.data`: data only that unit reads, defined in it. @@ -1193,6 +1198,11 @@ "ui/menus/selection/build_filtered_menu_item_list": (0x1D61B8, 0xD7138, 256), "ui/menus/item_preview/advance_preview_animation_queue": (0x1D5EC0, 0xD6E40, 448), "ui/menus/system/close_menu_system": (0x1D5D90, 0xD6D10, 56), + "rendering/vu1/select_level_vu_chain": (0x1DDFB8, 0xDEF38, 76), # render buffer size per level + "rendering/packets/submit_graphics_setup_command_stream": (0x1D7E50, 0xD8DD0, 224), # NTSC and PAL GS setup packets + "rendering/vu1/vu1_gs_regs_normal": (0x1DE3C0, 0xDF340, 48), # its GS register packet + "rendering/vu1/vu1_gs_regs_alt": (0x1DE3F0, 0xDF370, 48), # its GS register packet + "rendering/vu1/vu1_tex_flush": (0x1DEE00, 0xDFD80, 48), # its GS register packet } # Uninitialised variables a unit defines. `.sbss` (small ones) sits in the diff --git a/src/math/rotations/matrix_to_quaternion.c b/src/math/rotations/matrix_to_quaternion.c index 35db219aae..c739fb911a 100644 --- a/src/math/rotations/matrix_to_quaternion.c +++ b/src/math/rotations/matrix_to_quaternion.c @@ -63,3 +63,7 @@ void matrix_to_quaternion(void *output_quaternion, void *rotation_matrix) { } extern __typeof__(matrix_to_quaternion) func_00214260 __attribute__((alias("FUN_00214260"))); + +/* The axis after i, cyclically: 0 -> 1 -> 2 -> 0. Small data in retail, + defined below its only user, so the function reaches it with lui. */ +QuatNext matrix_to_quaternion_next_axis_table __attribute__((section(".sdata"))) = {{1, 2, 0}}; diff --git a/src/rendering/effects/append_billboard_batch.c b/src/rendering/effects/append_billboard_batch.c index 335c7fb560..91015e364b 100644 --- a/src/rendering/effects/append_billboard_batch.c +++ b/src/rendering/effects/append_billboard_batch.c @@ -31,7 +31,7 @@ typedef struct { #include "rnc/rendering/dma_tag.h" -extern char billboard_quad_header[] __asm__("D_001608E0"); +extern u64 billboard_quad_header[2] __asm__("D_001608E0"); extern BillboardViewContext view_context __asm__("D_0018CD00"); extern s32 clip_transform __asm__("D_0018CE80"); extern void fill_transfer_words(void *, s32, s32) __asm__("func_001F97E8"); @@ -138,3 +138,9 @@ void append_billboard_batch(void) { extern __typeof__(append_billboard_batch) func_001F92B0 __attribute__((alias("FUN_001f92b0"))); BillboardRecord billboard_records[16] = {0}; + +/* GIF tag of each billboard quad: NLOOP 1, EOP, REGLIST, 15 registers. Small + data in retail, defined below its only user, so it is reached with lui. */ +u64 billboard_quad_header[2] __attribute__((section(".sdata"), aligned(16))) = { + 0xF400000000008001ULL, 0x0531531531531068ULL, +}; diff --git a/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c b/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c index 19b5ad0607..01e448c109 100644 --- a/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c +++ b/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c @@ -10,7 +10,9 @@ extern s32 game_mode_macro __asm__("D_0015F604") MACRO_ADDR; -extern f32 warp_trail_widths __asm__("D_001604D0") __attribute__((sda)); +/* Warp trail width per content variant (0, 1 or 2). Small data in retail, + defined ahead of the function so it reaches the table gp-relative. */ +f32 warp_trail_widths[3] __asm__("D_001604D0") __attribute__((section(".sdata"))) = {0.8f, 0.8f, 0.8f}; extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void draw_geometry_quad(void *, s32, s32) __asm__("func_001F7D30"); @@ -138,7 +140,7 @@ void build_resident_indexed_texture_warp_meshes(void) { fast_vec_normalize( position, &workspace.edge_normals[vertex], - progress * (&warp_trail_widths)[level_render_state.content_variant]); + progress * warp_trail_widths[level_render_state.content_variant]); fast_vec_add( position, position, @@ -160,7 +162,7 @@ void build_resident_indexed_texture_warp_meshes(void) { side_position, side_normal, (1.0f - progress * progress) * - (&warp_trail_widths)[level_render_state.content_variant]); + warp_trail_widths[level_render_state.content_variant]); fast_vec_add( side_position, side_position, diff --git a/src/rendering/effects/build_variant_effect_quads.c b/src/rendering/effects/build_variant_effect_quads.c index cf0b6e0579..eaa55d53bd 100644 --- a/src/rendering/effects/build_variant_effect_quads.c +++ b/src/rendering/effects/build_variant_effect_quads.c @@ -21,7 +21,9 @@ void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); float convert_integer_to_float(int) __asm__("func_001FA6C0"); void draw_geometry_quad(void *, void *, int) __asm__("func_001F7D30"); -extern int variant_effect_quad_counts[1] __asm__("D_001604C0") __attribute__((sda)); +/* Quads per content variant (0, 1 or 2). Small data in retail, defined ahead + of the function so it reaches the table gp-relative. */ +int variant_effect_quad_counts[3] __asm__("D_001604C0") __attribute__((section(".sdata"))) = {8, 2, 2}; void build_variant_effect_quads(struct ResidentRenderObject *quad_source) __asm__("FUN_0022e1b0"); void build_variant_effect_quads(struct ResidentRenderObject *quad_source) { diff --git a/src/rendering/packets/emit_textured_rectangle.c b/src/rendering/packets/emit_textured_rectangle.c index 4dbdbc7b18..e3e13f319f 100644 --- a/src/rendering/packets/emit_textured_rectangle.c +++ b/src/rendering/packets/emit_textured_rectangle.c @@ -5,7 +5,8 @@ #include "rnc/rendering/screen.h" #include "rnc/math/asm_helpers.h" -extern char textured_rectangle_packet_header_template[] __asm__("D_00160860"); +/* The GIF tag ahead of the rectangle's register list, copied as one quadword. */ +extern u64 textured_rectangle_packet_header_template[2] __asm__("D_00160860"); void emit_textured_rectangle(f32 x, f32 y, @@ -75,3 +76,9 @@ void emit_textured_rectangle(f32 x, } extern __typeof__(emit_textured_rectangle) func_001F5808 __attribute__((alias("FUN_001f5808"))); + +/* GIF tag: NLOOP 1, EOP, REGLIST, 13 registers. Small data in retail, + defined below its only user, so the function reaches it with lui. */ +u64 textured_rectangle_packet_header_template[2] __attribute__((section(".sdata"), aligned(16))) = { + 0xD400000000008001ULL, 0x0008535353531806ULL, +}; diff --git a/src/rendering/packets/submit_graphics_setup_command_stream.c b/src/rendering/packets/submit_graphics_setup_command_stream.c index cbfe191c02..3715eb1543 100644 --- a/src/rendering/packets/submit_graphics_setup_command_stream.c +++ b/src/rendering/packets/submit_graphics_setup_command_stream.c @@ -7,9 +7,11 @@ #include "rnc/rendering/dma_tag.h" #include "rnc/rendering/vu1_registers.h" -/* GIF packets that program the GS for the NTSC and PAL video modes. */ -extern u8 ntsc_graphics_setup_packet[0x70] __asm__("D_001D7E50"); -extern u8 pal_graphics_setup_packet[0x70] __asm__("D_001D7EC0"); +/* GIF packets that program the GS for the NTSC and PAL video modes: a GIF + tag and six A+D register writes, the 7 quadwords the DMA tag below sends. */ +#define GRAPHICS_SETUP_PACKET_QWC 7 +extern u64 ntsc_graphics_setup_packet[GRAPHICS_SETUP_PACKET_QWC][2] __asm__("D_001D7E50"); +extern u64 pal_graphics_setup_packet[GRAPHICS_SETUP_PACKET_QWC][2] __asm__("D_001D7EC0"); struct GraphicsSetupRecord { s32 command_count; @@ -81,3 +83,23 @@ void submit_graphics_setup_command_stream(u8 *command_stream) { extern __typeof__(submit_graphics_setup_command_stream) func_00227548 __attribute__((alias("FUN_00227548"))); + +u64 ntsc_graphics_setup_packet[GRAPHICS_SETUP_PACKET_QWC][2] = { + {0x1000000000008006ULL, 0xEEEEEEULL}, /* GIF tag: NLOOP 6, EOP, one A+D register */ + {0x00FFFFFF00080070ULL, 0x4CULL}, /* FRAME_1: FBP 0x70, FBW 8 */ + {0x0000000000000000ULL, 0x4AULL}, /* FBA_1 */ + {0x0000000000000000ULL, 0x08ULL}, /* CLAMP_1 */ + {0x0000000000000001ULL, 0x14ULL}, /* TEX1_1 */ + {0x0000000664020E00ULL, 0x06ULL}, /* TEX0_1 */ + {0x0000008000000044ULL, 0x42ULL}, /* ALPHA_1 */ +}; + +u64 pal_graphics_setup_packet[GRAPHICS_SETUP_PACKET_QWC][2] = { + {0x1000000000008006ULL, 0xEEEEEEULL}, /* GIF tag: NLOOP 6, EOP, one A+D register */ + {0x00FFFFFF00080080ULL, 0x4CULL}, /* FRAME_1: FBP 0x80, FBW 8 */ + {0x0000000000000000ULL, 0x4AULL}, /* FBA_1 */ + {0x0000000000000000ULL, 0x08ULL}, /* CLAMP_1 */ + {0x0000000000000001ULL, 0x14ULL}, /* TEX1_1 */ + {0x0000000664021000ULL, 0x06ULL}, /* TEX0_1 */ + {0x0000008000000044ULL, 0x42ULL}, /* ALPHA_1 */ +}; diff --git a/src/rendering/vu1/select_level_vu_chain.c b/src/rendering/vu1/select_level_vu_chain.c index 83c4ea9c00..4b72cd483d 100644 --- a/src/rendering/vu1/select_level_vu_chain.c +++ b/src/rendering/vu1/select_level_vu_chain.c @@ -3,7 +3,7 @@ #include "rnc/data_labels.h" #include "rnc/rendering/render_globals.h" -extern s32 vu_chain_table[] __asm__("D_001DDFB8"); +extern s32 vu_chain_table[0x13] __asm__("D_001DDFB8"); void select_level_vu_chain(void) __asm__("CalculateDmaTransferAddress"); @@ -16,3 +16,10 @@ void select_level_vu_chain(void) { } current_vu_chain = vu_chain_table[i]; } + +/* Render buffer size in bytes per level (current_vu_chain), levels 0..0x12. */ +s32 vu_chain_table[0x13] = { + 0x1C0000, 0x160000, 0x1A0000, 0x170000, 0x1A0000, 0x160000, 0x160000, + 0x1A0000, 0x1A0000, 0x1A0000, 0x1A0000, 0x170000, 0x170000, 0x170000, + 0x180000, 0x170000, 0x170000, 0x1A0000, 0x170000, +}; diff --git a/src/rendering/vu1/vu1_gs_regs_alt.c b/src/rendering/vu1/vu1_gs_regs_alt.c index 02666275c6..c3d8403080 100644 --- a/src/rendering/vu1/vu1_gs_regs_alt.c +++ b/src/rendering/vu1/vu1_gs_regs_alt.c @@ -3,7 +3,8 @@ #define RENDER_PACKET_CURSOR_ATTR MACRO_ADDR #include "rnc/rendering/dma_tag.h" -extern u8 vu1_gs_regs_alt_dma_source[] __asm__("D_001DE3F0"); +/* A GIF tag and two A+D register writes: the 3 quadwords the DMA tag below sends. */ +extern u64 vu1_gs_regs_alt_dma_source[3][2] __asm__("D_001DE3F0"); void vu1_gs_regs_alt(void) __asm__("FUN_00233c28"); @@ -18,3 +19,9 @@ void vu1_gs_regs_alt(void) { extern __typeof__(vu1_gs_regs_alt) func_00233C28 __attribute__((alias("FUN_00233c28"))); /* Recovered original symbol name. */ extern __typeof__(vu1_gs_regs_alt) VU1_gsRegsAlt__Fv __attribute__((alias("FUN_00233c28"))); + +u64 vu1_gs_regs_alt_dma_source[3][2] = { + {0x2000000000008001ULL, 0xEEULL}, /* GIF tag: NLOOP 1, EOP, two A+D registers */ + {0x000000000005380BULL, 0x47ULL}, /* TEST_1 */ + {0x0000000000000044ULL, 0x42ULL}, /* ALPHA_1 */ +}; diff --git a/src/rendering/vu1/vu1_gs_regs_normal.c b/src/rendering/vu1/vu1_gs_regs_normal.c index 4e0c3e0f66..ece0113b57 100644 --- a/src/rendering/vu1/vu1_gs_regs_normal.c +++ b/src/rendering/vu1/vu1_gs_regs_normal.c @@ -3,7 +3,8 @@ #define RENDER_PACKET_CURSOR_ATTR MACRO_ADDR #include "rnc/rendering/dma_tag.h" -extern u8 normal_gs_regs_dma_payload[] __asm__("D_001DE3C0"); +/* A GIF tag and two A+D register writes: the 3 quadwords the DMA tag below sends. */ +extern u64 normal_gs_regs_dma_payload[3][2] __asm__("D_001DE3C0"); void vu1_gs_regs_normal(void) __asm__("FUN_00233bc8"); void vu1_gs_regs_normal(void) { @@ -15,3 +16,9 @@ void vu1_gs_regs_normal(void) { } extern __typeof__(vu1_gs_regs_normal) func_00233BC8 __attribute__((alias("FUN_00233bc8"))); + +u64 normal_gs_regs_dma_payload[3][2] = { + {0x2000000000008001ULL, 0xEEULL}, /* GIF tag: NLOOP 1, EOP, two A+D registers */ + {0x000000000005360BULL, 0x47ULL}, /* TEST_1 */ + {0x0000000000000044ULL, 0x42ULL}, /* ALPHA_1 */ +}; diff --git a/src/rendering/vu1/vu1_tex_flush.c b/src/rendering/vu1/vu1_tex_flush.c index 65b4145161..37e1a95fa0 100644 --- a/src/rendering/vu1/vu1_tex_flush.c +++ b/src/rendering/vu1/vu1_tex_flush.c @@ -3,7 +3,8 @@ #define RENDER_PACKET_CURSOR_ATTR MACRO_ADDR #include "rnc/rendering/dma_tag.h" -extern u8 vu1_gs_regs_tex_flush[] __asm__("D_001DEE00"); +/* A GIF tag and two A+D register writes: the 3 quadwords the DMA tag below sends. */ +extern u64 vu1_gs_regs_tex_flush[3][2] __asm__("D_001DEE00"); void vu1_tex_flush(void) __asm__("FUN_00233b68"); void vu1_tex_flush(void) { @@ -15,3 +16,9 @@ void vu1_tex_flush(void) { } extern __typeof__(vu1_tex_flush) func_00233B68 __attribute__((alias("FUN_00233b68"))); + +u64 vu1_gs_regs_tex_flush[3][2] = { + {0x2000000000008001ULL, 0xEEULL}, /* GIF tag: NLOOP 1, EOP, two A+D registers */ + {0x0000000000000001ULL, 0x3FULL}, /* TEXFLUSH */ + {0x8000000511304000ULL, 0x06ULL}, /* TEX0_1 */ +}; From cbf0d1869cb6a1eb876e1997a43cc3d6da916e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:31:02 +0000 Subject: [PATCH 11/25] decomp: define the sky paging bypass tag and view projection constants in C --- configure.py | 2 ++ src/rendering/sky/do_sky_gif_paging.c | 2 ++ src/rendering/view/update_view_context.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/configure.py b/configure.py index 0c91b19c75..170e7f4eca 100755 --- a/configure.py +++ b/configure.py @@ -1100,6 +1100,8 @@ "math/rotations/matrix_to_quaternion": (0x15FFD8, 0x60F58, 12), # next-axis table "rendering/packets/emit_textured_rectangle": (0x160860, 0x617E0, 16), # its GIF tag "rendering/effects/append_billboard_batch": (0x1608E0, 0x61860, 16), # its GIF tag + "rendering/sky/do_sky_gif_paging": (0x160474, 0x613F4, 4), # its paging bypass tag + "rendering/view/update_view_context": (0x160720, 0x616A0, 16), # projection scale and bias } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/rendering/sky/do_sky_gif_paging.c b/src/rendering/sky/do_sky_gif_paging.c index 5368fa31d3..4e1ad56cfc 100644 --- a/src/rendering/sky/do_sky_gif_paging.c +++ b/src/rendering/sky/do_sky_gif_paging.c @@ -41,3 +41,5 @@ void do_sky_gif_paging(void) { } extern __typeof__(do_sky_gif_paging) func_0022B558 __attribute__((alias("FUN_0022b558"))); + +struct TagPtr sky_gif_paging_bypass_tag = {0}; diff --git a/src/rendering/view/update_view_context.c b/src/rendering/view/update_view_context.c index e43865c8ce..5d25c977ff 100644 --- a/src/rendering/view/update_view_context.c +++ b/src/rendering/view/update_view_context.c @@ -236,3 +236,7 @@ void update_view_context(void) { } extern __typeof__(update_view_context) func_001F2D98 __attribute__((alias("FUN_001f2d98"))); + +/* Filled above each frame; part_proc loads it as one vector. Small data in + retail, defined below the function, so it is reached with lui. */ +f32 view_projection_scale_bias_constants[4] __attribute__((section(".sdata"))) = {0}; From f2763a2de4002e9f73d12b487a80943f5eb3d240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:11:35 +0000 Subject: [PATCH 12/25] decomp: define the small data of ten ui units in C Format strings, glyph labels, layout values and colours that one unit reads, placed through SDATA_OVERLAYS. --- configure.py | 11 +++++ src/ui/hud/banks/load_hud_banks.c | 7 +++ src/ui/menus/pause/draw_pause_ring.c | 4 ++ src/ui/menus/save_data/draw_save_slot_list.c | 5 +++ .../emit_selected_graphics_dma_packets.c | 3 +- src/ui/menus/system/process_menu_entry.c | 20 ++++++--- src/ui/menus/system/setup_menu_display_text.c | 3 ++ .../menus/weapons/draw_selected_item_ammo.c | 4 ++ .../menus/widgets/draw_menu_side_indicator.c | 4 ++ src/ui/menus/widgets/draw_prompt_box.c | 3 ++ .../widgets/render_configured_text_label.c | 6 +++ src/ui/text/draw_dialog_text.c | 43 ++++++++++++++++--- 12 files changed, 101 insertions(+), 12 deletions(-) diff --git a/configure.py b/configure.py index 170e7f4eca..18d581609b 100755 --- a/configure.py +++ b/configure.py @@ -1102,6 +1102,17 @@ "rendering/effects/append_billboard_batch": (0x1608E0, 0x61860, 16), # its GIF tag "rendering/sky/do_sky_gif_paging": (0x160474, 0x613F4, 4), # its paging bypass tag "rendering/view/update_view_context": (0x160720, 0x616A0, 16), # projection scale and bias + "ui/text/draw_dialog_text": (0x15F4E8, 0x60468, 187), # layout values, colours, format strings + "ui/hud/banks/load_hud_banks": (0x15FBB0, 0x60B30, 75), # allocation tag and stash labels + "ui/menus/system/process_menu_entry": (0x160070, 0x60FF0, 41), # help hud item, separators and formats + "ui/menus/save_data/draw_save_slot_list": (0x160300, 0x61280, 47), # save slot formats + "ui/menus/system/setup_menu_display_text": (0x1602A8, 0x61228, 12), # display text format + "ui/menus/weapons/draw_selected_item_ammo": (0x1602B8, 0x61238, 17), # ammo count formats + "ui/menus/pause/draw_pause_ring": (0x1602D8, 0x61258, 10), # ring glyph labels + "ui/menus/widgets/draw_prompt_box": (0x1602E8, 0x61268, 8), # fallback prompt + "ui/menus/widgets/draw_menu_side_indicator": (0x1602F0, 0x61270, 10), # indicator glyphs + "ui/menus/system/emit_selected_graphics_dma_packets": (0x160360, 0x612E0, 8), # payload words + "ui/menus/widgets/render_configured_text_label": (0x160270, 0x611F0, 31), # label strings } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/ui/hud/banks/load_hud_banks.c b/src/ui/hud/banks/load_hud_banks.c index 94459c43e3..2208d6a578 100644 --- a/src/ui/hud/banks/load_hud_banks.c +++ b/src/ui/hud/banks/load_hud_banks.c @@ -109,3 +109,10 @@ void load_hud_banks(void) { } extern __typeof__(load_hud_banks) func_00202A98 __attribute__((alias("FUN_00202a98"))); + +/* Small data reached with lui/addiu: the allocation tag and the stash labels. */ +char hud_allocation_source_file[] __asm__("D_0015FBB0") __attribute__((section(".sdata"))) = "loaders.cpp"; +char hud_bank_0_stash_label[] __asm__("D_0015FBC0") __attribute__((section(".sdata"))) = "hud bank 0"; +char hud_bank_2_stash_label[] __asm__("D_0015FBD0") __attribute__((section(".sdata"))) = "hud bank 2"; +char hud_bank_3_stash_label[] __asm__("D_0015FBE0") __attribute__((section(".sdata"))) = "hud bank 3"; +char hud_bank_4_stash_label[] __asm__("D_0015FBF0") __attribute__((section(".sdata"))) = "hud bank 4"; diff --git a/src/ui/menus/pause/draw_pause_ring.c b/src/ui/menus/pause/draw_pause_ring.c index 98f91cae2c..9d05633476 100644 --- a/src/ui/menus/pause/draw_pause_ring.c +++ b/src/ui/menus/pause/draw_pause_ring.c @@ -103,3 +103,7 @@ s32 draw_pause_ring(struct PauseState *pause_state) { } extern __typeof__(draw_pause_ring) func_00220B20 __attribute__((alias("FUN_00220b20"))); + +/* Small data reached with lui/addiu: one-glyph labels (font glyphs 0x14, 0x15). */ +u8 pause_ring_left_label_text[] __asm__("D_001602D8") __attribute__((section(".sdata"))) = "\x14"; +u8 pause_ring_right_label_text[] __asm__("D_001602E0") __attribute__((section(".sdata"))) = "\x15"; diff --git a/src/ui/menus/save_data/draw_save_slot_list.c b/src/ui/menus/save_data/draw_save_slot_list.c index dc3812ff0c..689ab3bc4a 100644 --- a/src/ui/menus/save_data/draw_save_slot_list.c +++ b/src/ui/menus/save_data/draw_save_slot_list.c @@ -128,3 +128,8 @@ s32 draw_save_slot_list(SaveMenu *menu) { } extern __typeof__(draw_save_slot_list) func_002239E0 __attribute__((alias("FUN_002239e0"))); + +/* Small data reached with lui/addiu: the save slot formats. */ +char save_slot_play_time_format[] __asm__("D_00160300") __attribute__((section(".sdata"))) = "%02d:%02d"; +char save_slot_grouped_bolts_format[] __asm__("D_00160310") __attribute__((section(".sdata"))) = "%d,%03d,%03d"; +char save_slot_hex_triplet_format[] __asm__("D_00160320") __attribute__((section(".sdata"))) = "%02x/%02x/%02x"; diff --git a/src/ui/menus/system/emit_selected_graphics_dma_packets.c b/src/ui/menus/system/emit_selected_graphics_dma_packets.c index f7d1b551d4..622de02466 100644 --- a/src/ui/menus/system/emit_selected_graphics_dma_packets.c +++ b/src/ui/menus/system/emit_selected_graphics_dma_packets.c @@ -6,7 +6,8 @@ struct Mat { }; extern struct Mat graphics_dma_reference_records[] __asm__("D_001D7D90"); -extern s32 graphics_packet_payload_words_by_slot[2] __asm__("D_00160360") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +s32 graphics_packet_payload_words_by_slot[2] __asm__("D_00160360") = {0x7F8080FF, (s32)0x8280FF80}; extern void FUN_00228598(s32, s32); void emit_selected_graphics_dma_packets(s32 render_selector, diff --git a/src/ui/menus/system/process_menu_entry.c b/src/ui/menus/system/process_menu_entry.c index 3a7006eb18..6db2022cc0 100644 --- a/src/ui/menus/system/process_menu_entry.c +++ b/src/ui/menus/system/process_menu_entry.c @@ -40,7 +40,8 @@ typedef struct { #include "rnc/ui/menus/system/process_menu_entry_globals.h" -extern s32 menu_help_hud_item_gp __asm__("D_00160070") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +s32 menu_help_hud_item __asm__("D_00160070") = -1; extern s32 world_update_time_macro __asm__("D_0015F60C") MACRO_ADDR; extern Suffixes menu_bolt_threshold_thousands_separators __asm__("D_001E8680"); extern char help_text_integer_placeholder[] __asm__("D_00160088"); @@ -103,8 +104,8 @@ void process_menu_entry(void *callback_context, Menu *menu, s32 follow_entry_lin if (current_menu_entry->unk4 & 0x4000) { noop_callback_n((s16)(current_menu_entry->unk4 ^ 0x4000)); } else { - remove_hud_item(menu_help_hud_item_gp); - menu_help_hud_item_gp = -1; + remove_hud_item(menu_help_hud_item); + menu_help_hud_item = -1; noop_callback_o((s16)current_menu_entry->unk4); } } @@ -134,9 +135,9 @@ void process_menu_entry(void *callback_context, Menu *menu, s32 follow_entry_lin } if (menu_entry_context[5] != 0) { copy_text_to_shared_buffer(formatted_help_text); - } else if (menu_help_hud_item_gp != -1) { - remove_hud_item(menu_help_hud_item_gp); - menu_help_hud_item_gp = -1; + } else if (menu_help_hud_item != -1) { + remove_hud_item(menu_help_hud_item); + menu_help_hud_item = -1; } if (current_menu_entry->unk8 == 0) { return; @@ -186,3 +187,10 @@ void process_menu_entry(void *callback_context, Menu *menu, s32 follow_entry_lin extern __typeof__(process_menu_entry) func_00216C48 __attribute__((alias("FUN_00216c48"))); s32 menu_entry_context[6] = {0}; + +/* Small data reached with lui/addiu: the thousands separators that + * menu_bolt_threshold_thousands_separators points to, and the formats. */ +char thousands_separator_comma[] __asm__("D_00160078") __attribute__((section(".sdata"))) = ","; +char thousands_separator_period[] __asm__("D_00160080") __attribute__((section(".sdata"))) = "."; +char help_text_integer_placeholder[] __asm__("D_00160088") __attribute__((section(".sdata"))) = "%d"; +char bolt_threshold_number_format[] __asm__("D_00160090") __attribute__((section(".sdata"))) = "%d%s%03d"; diff --git a/src/ui/menus/system/setup_menu_display_text.c b/src/ui/menus/system/setup_menu_display_text.c index a5a2eca164..08039b962b 100644 --- a/src/ui/menus/system/setup_menu_display_text.c +++ b/src/ui/menus/system/setup_menu_display_text.c @@ -57,3 +57,6 @@ int setup_menu_display_text(struct MenuScreen *menu) { } extern __typeof__(setup_menu_display_text) func_0021EF78 __attribute__((alias("FUN_0021ef78"))); + +/* Small data reached with lui/addiu. */ +char setup_menu_text_format[] __asm__("D_001602A8") __attribute__((section(".sdata"))) = "%s %d %s %d"; diff --git a/src/ui/menus/weapons/draw_selected_item_ammo.c b/src/ui/menus/weapons/draw_selected_item_ammo.c index 143a71feef..1881ef05fa 100644 --- a/src/ui/menus/weapons/draw_selected_item_ammo.c +++ b/src/ui/menus/weapons/draw_selected_item_ammo.c @@ -75,3 +75,7 @@ s32 draw_selected_item_ammo(s32 image_descriptor_input) { do_gif_paging(); return 2; } + +/* Small data reached with lui/addiu: the ammo count formats. */ +u8 ammo_count_decimal_format[] __asm__("D_001602B8") __attribute__((section(".sdata"))) = "%d/"; +u8 ammo_count_grouped_decimal_format[] __asm__("D_001602C0") __attribute__((section(".sdata"))) = "%d,%03d/"; diff --git a/src/ui/menus/widgets/draw_menu_side_indicator.c b/src/ui/menus/widgets/draw_menu_side_indicator.c index e3fd492051..a9505dd5c9 100644 --- a/src/ui/menus/widgets/draw_menu_side_indicator.c +++ b/src/ui/menus/widgets/draw_menu_side_indicator.c @@ -52,3 +52,7 @@ int draw_menu_side_indicator(struct MenuScreen *menu) { } extern __typeof__(draw_menu_side_indicator) func_00221F58 __attribute__((alias("FUN_00221f58"))); + +/* Small data reached with lui/addiu: one-glyph strings (font glyphs 0x10, 0x11). */ +char menu_side_indicator_set_glyph_string[] __asm__("D_001602F0") __attribute__((section(".sdata"))) = "\x10"; +char menu_side_indicator_clear_glyph_string[] __asm__("D_001602F8") __attribute__((section(".sdata"))) = "\x11"; diff --git a/src/ui/menus/widgets/draw_prompt_box.c b/src/ui/menus/widgets/draw_prompt_box.c index ef98b0c1a6..4dd8c28c88 100644 --- a/src/ui/menus/widgets/draw_prompt_box.c +++ b/src/ui/menus/widgets/draw_prompt_box.c @@ -56,3 +56,6 @@ int draw_prompt_box(struct MenuScreen *prompt) { } extern __typeof__(draw_prompt_box) func_00221B50 __attribute__((alias("FUN_00221b50"))); + +/* Small data reached with lui/addiu. */ +char fallback_prompt_text[] __asm__("D_001602E8") __attribute__((section(".sdata"))) = "(error)"; diff --git a/src/ui/menus/widgets/render_configured_text_label.c b/src/ui/menus/widgets/render_configured_text_label.c index 0cacf6c19b..d708781c7f 100644 --- a/src/ui/menus/widgets/render_configured_text_label.c +++ b/src/ui/menus/widgets/render_configured_text_label.c @@ -299,3 +299,9 @@ int render_configured_text_label(struct MenuScreen *label) { extern __typeof__(render_configured_text_label) func_0021A328 __attribute__((alias("FUN_0021a328"))); + +/* Small data reached with lui/addiu: the label strings. */ +char empty_label_text[] __asm__("D_00160270") __attribute__((section(".sdata"))) = "default"; +char unavailable_label_text[] __asm__("D_00160278") __attribute__((section(".sdata"))) = ""; +char label_format[] __asm__("D_00160280") __attribute__((section(".sdata"))) = "%s %s"; +char fallback_label_text[] __asm__("D_00160288") __attribute__((section(".sdata"))) = "(null)"; diff --git a/src/ui/text/draw_dialog_text.c b/src/ui/text/draw_dialog_text.c index 9663660889..958a5633aa 100644 --- a/src/ui/text/draw_dialog_text.c +++ b/src/ui/text/draw_dialog_text.c @@ -13,7 +13,6 @@ #include "rnc/math/asm_helpers.h" #include "rnc/rendering/vu1_registers.h" -extern s32 freeze_wave_period __asm__("D_0015F520") __attribute__((sda)); extern char freeze_default_text[] __asm__("D_0015F548"); extern char freeze_fmt_scsc[] __asm__("D_0015F550"); extern char freeze_fmt_indent[] __asm__("D_0015F560"); @@ -47,18 +46,40 @@ extern void draw_rotated_sprite( void draw_dialog_text(void) __asm__("FUN_001fbc50"); -extern s32 freeze_ans2 __asm__("D_0015F4E8") __attribute__((sda)); -extern s32 freeze_ans1 __asm__("D_0015F4EC") __attribute__((sda)); #include "rnc/ui/text/draw_dialog_text_globals.h" -extern s32 freeze_bevel_a_text __asm__("D_0015F508") __attribute__((sda)); -extern s32 freeze_stats_text __asm__("D_0015F51C") __attribute__((sda)); extern char freeze_fmt_race_first_place[] __asm__("D_0015F568"); extern char freeze_fmt_race_second_place[] __asm__("D_0015F570"); extern char freeze_fmt_race_third_place[] __asm__("D_0015F578"); extern char freeze_fmt_race_other_place[] __asm__("D_0015F580"); extern char freeze_fmt_record_label[] __asm__("D_0015F588"); +/* Small data, in retail order: layout values and RGBA colours (0xAABBGGRR). + * Defined above the code, so it reaches them $gp-relative. */ +s32 freeze_ans2 __asm__("D_0015F4E8") = 115; +s32 freeze_ans1 __asm__("D_0015F4EC") = 130; +s32 freeze_fading_dialog_text_base_color __asm__("D_0015F4F0") = 0x00FFA888; +s32 freeze_fading_dialog_text_blend_target_color __asm__("D_0015F4F4") = (s32)0x80FFA888; +s32 freeze_three_line_outline_center_x __asm__("D_0015F4F8") = 256; +s32 freeze_three_line_outline_center_y __asm__("D_0015F4FC") = 185; +s32 freeze_three_line_outline_half_width __asm__("D_0015F500") = 100; +s32 freeze_three_line_outline_half_height __asm__("D_0015F504") = 50; +s32 freeze_bevel_a_text __asm__("D_0015F508") = 150; +s32 freeze_stats_outline_center_x __asm__("D_0015F50C") = 256; +s32 freeze_stats_outline_center_y __asm__("D_0015F510") = 205; +s32 freeze_stats_outline_half_width __asm__("D_0015F514") = 100; +s32 freeze_stats_outline_half_height __asm__("D_0015F518") = 120; +s32 freeze_stats_text __asm__("D_0015F51C") = 110; +s32 freeze_wave_period __asm__("D_0015F520") = 180; +s32 freeze_outline_pulse_base_color __asm__("D_0015F524") = (s32)0x80E08060; +s32 freeze_outline_pulse_blend_target_color __asm__("D_0015F528") = (s32)0x80D06050; +s32 freeze_shared_dialog_text_base_color __asm__("D_0015F52C") = 0x00FFC0C0; +s32 freeze_shared_dialog_text_blend_target_color __asm__("D_0015F530") = (s32)0x80FFC0C0; +s32 freeze_matched_record_text_base_color __asm__("D_0015F534") = 0x0060EF60; +s32 freeze_matched_record_text_blend_target_color __asm__("D_0015F538") = (s32)0x8060EF60; +s32 freeze_unmatched_record_text_base_color __asm__("D_0015F53C") = 0x006060EF; +s32 freeze_unmatched_record_text_blend_target_color __asm__("D_0015F540") = (s32)0x806060EF; + struct TextRegion D_001E78F0 = {0x50, 0x154, 0x60, 0x1a0, 0x100, 0x54, 0, 0, 0x10, 1, 0, 0}; struct TextRegion D_001E7908 = {0x64, 0x12c, 0x60, 0x1a0, 0x100, 0x68, 0, 0, 0x10, 1, 0, 0}; @@ -529,3 +550,15 @@ void draw_dialog_text(void) { } extern __typeof__(draw_dialog_text) func_001FBC50 __attribute__((alias("FUN_001fbc50"))); + +/* Format strings, small data reached with lui/addiu. */ +char freeze_default_text[] __asm__("D_0015F548") __attribute__((section(".sdata"))) = ""; +char freeze_fmt_scsc[] __asm__("D_0015F550") __attribute__((section(".sdata"))) = "%s%c%c%s"; +char freeze_fmt_indent[] __asm__("D_0015F560") __attribute__((section(".sdata"))) = " %s"; +char freeze_fmt_race_first_place[] __asm__("D_0015F568") __attribute__((section(".sdata"))) = "%dst"; +char freeze_fmt_race_second_place[] __asm__("D_0015F570") __attribute__((section(".sdata"))) = "%dnd"; +char freeze_fmt_race_third_place[] __asm__("D_0015F578") __attribute__((section(".sdata"))) = "%drd"; +char freeze_fmt_race_other_place[] __asm__("D_0015F580") __attribute__((section(".sdata"))) = "%dth"; +char freeze_fmt_record_label[] __asm__("D_0015F588") __attribute__((section(".sdata"))) = "%s"; +char freeze_fmt_time[] __asm__("D_0015F590") __attribute__((section(".sdata"))) = "%d:%02d:%02d"; +char freeze_fmt_score[] __asm__("D_0015F5A0") __attribute__((section(".sdata"))) = "%d"; From ad141c783ee7b46008fd4bf648c0b77ead71a80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:18:56 +0000 Subject: [PATCH 13/25] decomp: define one-reader data of map, menu, moby, camera and transition units Small-data values, format strings, the quad GIF tag and the nibble bit-count table of the units that alone read them. --- config/us/undefined_syms.txt | 1 - configure.py | 12 ++++++++++++ src/camera/sample_surface_height_map.c | 3 ++- src/game/transitions/do_space_transition.c | 4 +++- .../update_resident_dialogue_animation_state.c | 10 ++++------ src/mobys/resolve_moby_hit_response.c | 3 ++- src/ui/loading/append_scrolling_textured_quad.c | 7 ++++++- src/ui/map/coverage/downsample_map_coverage.c | 6 +++++- src/ui/map/draw_map_markers.c | 2 ++ src/ui/map/draw_map_overlay.c | 2 ++ .../map/level_selection/draw_level_selection_map.c | 3 ++- src/ui/map/map_filters.c | 3 ++- src/ui/menus/widgets/format_menu_item_text.c | 4 ++++ src/ui/text/set_scrolling_status_message.c | 5 ++++- 14 files changed, 50 insertions(+), 15 deletions(-) diff --git a/config/us/undefined_syms.txt b/config/us/undefined_syms.txt index dfea041505..deb6aab558 100644 --- a/config/us/undefined_syms.txt +++ b/config/us/undefined_syms.txt @@ -38,7 +38,6 @@ D_0018E340 = 0x0018E340; /* Interior sceLseek label referenced by music_start_track_30000. */ D_0011C178 = 0x0011C178; -D_0015FFC8 = 0x0015FFC8; D_00137EA8 = 0x00137EA8; D_00137F20 = 0x00137F20; D_00137F98 = 0x00137F98; diff --git a/configure.py b/configure.py index 18d581609b..f23bafb719 100755 --- a/configure.py +++ b/configure.py @@ -1051,6 +1051,9 @@ "rendering/sky/setup_sky_gif_paging": (0x160450, 0x613D0, 9), # its profiler label "rendering/tfrags/draw_tfrag": (0x160E70, 0x61DF0, 27), # its profiler labels "rendering/vu1/vu1_chain": (0x1E89C8, 0xE9948, 61), # its two debug messages + "game/transitions/do_space_transition": (0x1E8988, 0xE9908, 28), # unloaded sound bank message + "ui/text/set_scrolling_status_message": (0x1E8A70, 0xE99F0, 21), # status message format + "ui/map/coverage/downsample_map_coverage": (0x1E8080, 0xE9000, 64), # nibble bit-count table } # Recovered C units that define the small-data variables their original @@ -1113,6 +1116,14 @@ "ui/menus/widgets/draw_menu_side_indicator": (0x1602F0, 0x61270, 10), # indicator glyphs "ui/menus/system/emit_selected_graphics_dma_packets": (0x160360, 0x612E0, 8), # payload words "ui/menus/widgets/render_configured_text_label": (0x160270, 0x611F0, 31), # label strings + "mobys/resolve_moby_hit_response": (0x15FFC8, 0x60F48, 8), # damage override table + "mobys/animation/update_resident_dialogue_animation_state": (0x161030, 0x61FB0, 24), # wait thresholds + "camera/sample_surface_height_map": (0x1610E0, 0x62060, 4), # surface height layer + "ui/map/level_selection/draw_level_selection_map": (0x15F690, 0x60610, 4), # large font height + "ui/map/draw_map_markers": (0x15FDB0, 0x60D30, 4), # marker half size + "ui/map/map_filters": (0x15FD64, 0x60CE4, 4), # menu selection count + "ui/menus/widgets/format_menu_item_text": (0x15FDA0, 0x60D20, 14), # item text formats + "ui/loading/append_scrolling_textured_quad": (0x160850, 0x617D0, 16), # quad GIF tag } # The same for a unit's `.data`: data only that unit reads, defined in it. @@ -1216,6 +1227,7 @@ "rendering/vu1/vu1_gs_regs_normal": (0x1DE3C0, 0xDF340, 48), # its GS register packet "rendering/vu1/vu1_gs_regs_alt": (0x1DE3F0, 0xDF370, 48), # its GS register packet "rendering/vu1/vu1_tex_flush": (0x1DEE00, 0xDFD80, 48), # its GS register packet + "ui/map/draw_map_overlay": (0x1E8068, 0xE8FE8, 17), # no map text } # Uninitialised variables a unit defines. `.sbss` (small ones) sits in the diff --git a/src/camera/sample_surface_height_map.c b/src/camera/sample_surface_height_map.c index d5c52c5761..1a482c11ae 100644 --- a/src/camera/sample_surface_height_map.c +++ b/src/camera/sample_surface_height_map.c @@ -3,7 +3,8 @@ #include "rnc/math/asm_helpers.h" extern SurfaceHeightTile *surface_height_tiles __asm__("D_00161190"); -extern s32 surface_height_layer __asm__("D_001610E0") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +s32 surface_height_layer __asm__("D_001610E0") = 2; extern s32 find_zone_at_point(f32, f32, f32) __asm__("func_00239D60"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); diff --git a/src/game/transitions/do_space_transition.c b/src/game/transitions/do_space_transition.c index 3030829a40..fce49734a5 100644 --- a/src/game/transitions/do_space_transition.c +++ b/src/game/transitions/do_space_transition.c @@ -40,7 +40,7 @@ extern s32 game_frame_counter_macro __asm__("D_0015F438") M extern s32 space_load_in_progress __asm__("D_0015F618") MACRO_ADDR; extern struct Globals_0015F634 *level_sound_defs __asm__("D_0015F634"); extern struct Globals_00194100 coll_output __asm__("D_00194100"); -extern u8 unloaded_sound_bank_format[] __asm__("D_001E8988"); +extern const char unloaded_sound_bank_format[] __asm__("D_001E8988"); extern void FlushCache(s32); extern void snd_flush_sound_commands(void) __asm__("func_0012DC80"); @@ -239,3 +239,5 @@ void do_space_transition(void) { } extern __typeof__(do_space_transition) func_00231FF0 __attribute__((alias("FUN_00231ff0"))); + +const char unloaded_sound_bank_format[] __asm__("D_001E8988") = "unloaded sound bank %#010x\n"; diff --git a/src/mobys/animation/update_resident_dialogue_animation_state.c b/src/mobys/animation/update_resident_dialogue_animation_state.c index fac998151d..ddcd02b44b 100644 --- a/src/mobys/animation/update_resident_dialogue_animation_state.c +++ b/src/mobys/animation/update_resident_dialogue_animation_state.c @@ -36,12 +36,10 @@ typedef struct { extern s32 D_001516EC NOT_SDA; extern s16 D_0015172A NOT_SDA; -extern s32 resident_dialogue_after_completion_wait_thresholds[2] __asm__("D_00161030") - __attribute__((sda)); -extern s32 resident_dialogue_after_start_wait_thresholds[2] __asm__("D_00161038") - __attribute__((sda)); -extern s32 resident_dialogue_before_timed_idle_restore_thresholds[2] __asm__("D_00161040") - __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +s32 resident_dialogue_after_completion_wait_thresholds[2] __asm__("D_00161030") = {100, 100}; +s32 resident_dialogue_after_start_wait_thresholds[2] __asm__("D_00161038") = {200, 100}; +s32 resident_dialogue_before_timed_idle_restore_thresholds[2] __asm__("D_00161040") = {44, 100}; extern s32 D_001610B0 MACRO_ADDR; extern s32 D_001610B4 MACRO_ADDR; extern BossVars D_001E63C0; diff --git a/src/mobys/resolve_moby_hit_response.c b/src/mobys/resolve_moby_hit_response.c index 05d2f4da10..87be175900 100644 --- a/src/mobys/resolve_moby_hit_response.c +++ b/src/mobys/resolve_moby_hit_response.c @@ -52,7 +52,8 @@ typedef struct { } O_25a478; extern u8 D_0013E533[]; -extern f32 hit_damage_override_table[2] __asm__("D_0015FFC8") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +f32 hit_damage_override_table[2] __asm__("D_0015FFC8") = {1.0f, 0.667f}; extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern f32 fast_arc_tan(f32, f32) __asm__("func_001F9E90"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); diff --git a/src/ui/loading/append_scrolling_textured_quad.c b/src/ui/loading/append_scrolling_textured_quad.c index ee972e9316..7c7aa867e8 100644 --- a/src/ui/loading/append_scrolling_textured_quad.c +++ b/src/ui/loading/append_scrolling_textured_quad.c @@ -5,7 +5,7 @@ #include "rnc/rendering/screen.h" -extern char loading_quad_packet_header_template[] __asm__("D_00160850"); +extern u64 loading_quad_packet_header_template[2] __asm__("D_00160850"); typedef union { struct { @@ -82,3 +82,8 @@ void append_scrolling_textured_quad(int x, extern __typeof__(append_scrolling_textured_quad) func_002316E8 __attribute__((alias("FUN_002316e8"))); + +/* GIF tag of the quad packet (NLOOP 1, EOP, REGLIST, NREG 11) and its + * register list. Small data reached with lui/addiu. */ +u64 loading_quad_packet_header_template[2] __asm__("D_00160850") __attribute__((section(".sdata"))) __attribute__((aligned(16))) = { + 0xB400000000008001, 0x0000052525252106}; diff --git a/src/ui/map/coverage/downsample_map_coverage.c b/src/ui/map/coverage/downsample_map_coverage.c index 94737ed75a..d3673988c3 100644 --- a/src/ui/map/coverage/downsample_map_coverage.c +++ b/src/ui/map/coverage/downsample_map_coverage.c @@ -5,7 +5,7 @@ struct Table16 { }; extern u8 *D_001A00FC[]; -extern struct Table16 map_coverage_nibble_contribution_table __asm__("D_001E8080"); +extern const struct Table16 map_coverage_nibble_contribution_table __asm__("D_001E8080"); extern void fill_transfer_words(void *dst, s32 value, s32 size) __asm__("func_001F97E8"); /* Builds a 1bpp mask from the 4bpp map at D_001A00FC[0]: each nibble is @@ -57,3 +57,7 @@ void downsample_map_coverage(u8 *coverage_mask) { } extern __typeof__(downsample_map_coverage) func_00208030 __attribute__((alias("FUN_00208030"))); + +/* Entry n is the number of set bits in nibble n. */ +const struct Table16 map_coverage_nibble_contribution_table __asm__("D_001E8080") = { + {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}}; diff --git a/src/ui/map/draw_map_markers.c b/src/ui/map/draw_map_markers.c index aa424b96a2..809ccb2601 100644 --- a/src/ui/map/draw_map_markers.c +++ b/src/ui/map/draw_map_markers.c @@ -64,3 +64,5 @@ void draw_map_markers(s32 left, s32 top, s32 right, s32 bottom) { } extern __typeof__(draw_map_markers) func_00208508 __attribute__((alias("FUN_00208508"))); + +s32 marker_half_size __asm__("D_0015FDB0") MACRO_ADDR = 32; diff --git a/src/ui/map/draw_map_overlay.c b/src/ui/map/draw_map_overlay.c index 46b7b52a76..7bda95d6e9 100644 --- a/src/ui/map/draw_map_overlay.c +++ b/src/ui/map/draw_map_overlay.c @@ -516,3 +516,5 @@ void draw_map_overlay(void) { } extern __typeof__(draw_map_overlay) func_00205640 __attribute__((alias("FUN_00205640"))); + +u8 no_map_available_text[] __asm__("D_001E8068") = "No Map Available"; diff --git a/src/ui/map/level_selection/draw_level_selection_map.c b/src/ui/map/level_selection/draw_level_selection_map.c index 6cdd3aadc6..770ecd4d37 100644 --- a/src/ui/map/level_selection/draw_level_selection_map.c +++ b/src/ui/map/level_selection/draw_level_selection_map.c @@ -6,7 +6,8 @@ #include "rnc/globals.h" #include "rnc/game/game_globals.h" -extern s32 large_font_height __asm__("D_0015F690") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +s32 large_font_height __asm__("D_0015F690") = 17; extern void setup_gif_paging(s32) __asm__("func_001F4280"); extern void do_gif_paging(void) __asm__("func_001F4398"); extern s32 measure_text_width_regular(u8 *, s32) __asm__("func_001F6250"); diff --git a/src/ui/map/map_filters.c b/src/ui/map/map_filters.c index 86029912f7..e999df0782 100644 --- a/src/ui/map/map_filters.c +++ b/src/ui/map/map_filters.c @@ -122,7 +122,8 @@ int map_filter_l01_5(int reveal_test_selector, return (reveal_test_value >= 95.0f) ? 1 : 0; } -extern u32 menu_selection_count __asm__("D_0015FD64") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +u32 menu_selection_count __asm__("D_0015FD64") = 0; s32 map_filter_l03_0(void) __asm__("func_00206B78"); diff --git a/src/ui/menus/widgets/format_menu_item_text.c b/src/ui/menus/widgets/format_menu_item_text.c index cfbef75770..0600527afd 100644 --- a/src/ui/menus/widgets/format_menu_item_text.c +++ b/src/ui/menus/widgets/format_menu_item_text.c @@ -54,3 +54,7 @@ void format_menu_item_text(s32 map_icon_index, u8 *output_text_cursor) { } extern __typeof__(format_menu_item_text) func_00208280 __attribute__((alias("FUN_00208280"))); + +/* Small data reached with lui/addiu. */ +char menu_item_decimal_format[] __asm__("D_0015FDA0") __attribute__((section(".sdata"))) = "%d"; +char menu_item_placeholder_error_text[] __asm__("D_0015FDA8") __attribute__((section(".sdata"))) = "error"; diff --git a/src/ui/text/set_scrolling_status_message.c b/src/ui/text/set_scrolling_status_message.c index 80653ed580..a3163a3dd3 100644 --- a/src/ui/text/set_scrolling_status_message.c +++ b/src/ui/text/set_scrolling_status_message.c @@ -9,7 +9,7 @@ struct ScrollingStatus { }; extern struct ScrollingStatus D_001E63C0; -extern u8 scrolling_status_message_format[] __asm__("D_001E8A70"); +extern const char scrolling_status_message_format[] __asm__("D_001E8A70"); void set_scrolling_status_message(s32 message) __asm__("FUN_00237e90"); void set_scrolling_status_message(s32 message) { @@ -18,3 +18,6 @@ void set_scrolling_status_message(s32 message) { } extern void func_00237E90(s32 arg0) __attribute__((alias("FUN_00237e90"))); + +/* Eighteen spaces of indent before the message. */ +const char scrolling_status_message_format[] __asm__("D_001E8A70") = " %s"; From c63960016587eff9d3e7fc809025ef9de5755157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:27:27 +0000 Subject: [PATCH 14/25] decomp: define map icon lists, preview slot flags and hud, freeze and world small data in C map_icon_lists_by_level (19 levels, the reader bounds the index) and menu_preview_slot_draw_enabled (24 slots, the loop bound) go to DATA_OVERLAYS; scalars and the hud allocation tag one unit reads go to SDATA_OVERLAYS, and update_hud takes its two neighbouring counters. --- config/us/undefined_syms.txt | 19 ++++++++ configure.py | 9 +++- src/game/startlevel.c | 2 + src/game/update_mode_freeze.c | 4 ++ src/mobys/update_visible_mobys.c | 3 +- src/ui/hud/init_hud.c | 3 ++ src/ui/hud/update_hud.c | 2 + src/ui/map/update_map_icons.c | 46 ++++++++++++++++++- .../item_preview/draw_menu_preview_objects.c | 6 ++- .../select_world_object_resource_tables.c | 3 ++ 10 files changed, 93 insertions(+), 4 deletions(-) diff --git a/config/us/undefined_syms.txt b/config/us/undefined_syms.txt index deb6aab558..c0d5cc0732 100644 --- a/config/us/undefined_syms.txt +++ b/config/us/undefined_syms.txt @@ -67,3 +67,22 @@ FUN_0021d168 = 0x0021D168; FUN_0021e7c8 = 0x0021E7C8; FUN_00221800 = 0x00221800; FUN_00221ab8 = 0x00221AB8; +D_001A0910 = 0x001A0910; +D_001A0A28 = 0x001A0A28; +D_001A0BE0 = 0x001A0BE0; +D_001A0E60 = 0x001A0E60; +D_001A10E0 = 0x001A10E0; +D_001A1270 = 0x001A1270; +D_001A14C8 = 0x001A14C8; +D_001A1680 = 0x001A1680; +D_001A1860 = 0x001A1860; +D_001A1A18 = 0x001A1A18; +D_001A1C20 = 0x001A1C20; +D_001A1EC8 = 0x001A1EC8; +D_001A2148 = 0x001A2148; +D_001A22B0 = 0x001A22B0; +D_001A2490 = 0x001A2490; +D_001A26C0 = 0x001A26C0; +D_001A28C8 = 0x001A28C8; +D_001A2A08 = 0x001A2A08; +D_001A2AF8 = 0x001A2AF8; diff --git a/configure.py b/configure.py index f23bafb719..c206ecb406 100755 --- a/configure.py +++ b/configure.py @@ -1089,7 +1089,7 @@ "rendering/texture/dma_tfrag_textures": (0x160EC4, 0x61E44, 4), "rendering/frame/swap_render_buffer_chain": (0x160F04, 0x61E84, 4), "rendering/texture/dma_tie_textures": (0x160F74, 0x61EF4, 4), - "ui/hud/update_hud": (0x15F688, 0x60608, 4), + "ui/hud/update_hud": (0x15F680, 0x60600, 12), "movies/decoder/video_dec_flush": (0x161218, 0x62198, 4), # the sequence end code it appends "movies/decoder/callbacks/mpeg_error": (0x161220, 0x621A0, 4), # its "%s\n" format "runtime/startup/init_once": (0x15FA88, 0x60A08, 14), # its reboot message @@ -1124,6 +1124,11 @@ "ui/map/map_filters": (0x15FD64, 0x60CE4, 4), # menu selection count "ui/menus/widgets/format_menu_item_text": (0x15FDA0, 0x60D20, 14), # item text formats "ui/loading/append_scrolling_textured_quad": (0x160850, 0x617D0, 16), # quad GIF tag + "game/update_mode_freeze": (0x15EE38, 0x5FDB8, 8), # two counters + "game/startlevel": (0x15EF5C, 0x5FEDC, 4), # boot image buffer + "mobys/update_visible_mobys": (0x15FF24, 0x60EA4, 4), # visible moby list + "world/select_world_object_resource_tables": (0x15FF44, 0x60EC4, 8), # resource tag and count + "ui/hud/init_hud": (0x15F6D8, 0x60658, 8), # allocation tag } # The same for a unit's `.data`: data only that unit reads, defined in it. @@ -1228,6 +1233,8 @@ "rendering/vu1/vu1_gs_regs_alt": (0x1DE3F0, 0xDF370, 48), # its GS register packet "rendering/vu1/vu1_tex_flush": (0x1DEE00, 0xDFD80, 48), # its GS register packet "ui/map/draw_map_overlay": (0x1E8068, 0xE8FE8, 17), # no map text + "ui/map/update_map_icons": (0x1A2BC0, 0xA3B40, 76), # icon list of each level + "ui/menus/item_preview/draw_menu_preview_objects": (0x1D5020, 0xD5FA0, 96), # slot draw flags } # Uninitialised variables a unit defines. `.sbss` (small ones) sits in the diff --git a/src/game/startlevel.c b/src/game/startlevel.c index 9b0ba6a4d2..ef747040d0 100644 --- a/src/game/startlevel.c +++ b/src/game/startlevel.c @@ -228,3 +228,5 @@ volatile SoundDef boot_sound_defs_b[5] = { {.unk4 = 128.0f, .near_volume = 0x400, .sound = 6}, {.unk4 = 128.0f, .near_volume = 0x400, .sound = 7}, }; + +s32 boot_image_buffer __asm__("D_0015EF5C") MACRO_ADDR = 0; diff --git a/src/game/update_mode_freeze.c b/src/game/update_mode_freeze.c index 52c70596eb..7b46156857 100644 --- a/src/game/update_mode_freeze.c +++ b/src/game/update_mode_freeze.c @@ -396,3 +396,7 @@ void update_mode_freeze(void) { } extern __typeof__(update_mode_freeze) func_001FCE28 __attribute__((alias("FUN_001fce28"))); + +/* Small data: two counters only this file reads and bumps. */ +s32 D_0015EE38 = 0; +s32 D_0015EE3C = 0; diff --git a/src/mobys/update_visible_mobys.c b/src/mobys/update_visible_mobys.c index d3eea080d5..3e42714553 100644 --- a/src/mobys/update_visible_mobys.c +++ b/src/mobys/update_visible_mobys.c @@ -7,7 +7,8 @@ #define MOBY_SKIP_ANIMATION 0x40 #define MOBY_SKIP_BOUNDS 0x4 -extern struct Moby *visible_moby_list __asm__("D_0015FF24") __attribute__((sda)); +/* Small data, defined above the code so it is reached $gp-relative. */ +struct Moby *visible_moby_list __asm__("D_0015FF24") = 0; extern struct Moby *build_resident_visibility_list(void) __asm__("FUN_0020d868"); extern void advance_moby_animation(struct Moby *) __asm__("FUN_0020d580"); void update_visible_mobys(void) __asm__("FUN_00212e28"); diff --git a/src/ui/hud/init_hud.c b/src/ui/hud/init_hud.c index ee515d2357..f2b67b486b 100644 --- a/src/ui/hud/init_hud.c +++ b/src/ui/hud/init_hud.c @@ -68,3 +68,6 @@ void init_hud(void) { clear_blocks_16(hud_bank_main, 0x2800); hud_bank_main->unk20 = 0xFF; } + +/* Small data reached with lui/addiu: the allocation tag. */ +u8 hud_file_str[] __asm__("D_0015F6D8") __attribute__((section(".sdata"))) = "hud.cpp"; diff --git a/src/ui/hud/update_hud.c b/src/ui/hud/update_hud.c index 228430731a..c5abff09cf 100644 --- a/src/ui/hud/update_hud.c +++ b/src/ui/hud/update_hud.c @@ -125,4 +125,6 @@ void update_hud(void) { __attribute__((alias("FUN_001ff780"))) extern void func_001FF780(void); +s32 hud_msg_count __asm__("D_0015F680") = 0; +s32 D_0015F684 = 0; s32 hud_msg_y = 0; diff --git a/src/ui/map/update_map_icons.c b/src/ui/map/update_map_icons.c index 4ca699d667..2ae6845978 100644 --- a/src/ui/map/update_map_icons.c +++ b/src/ui/map/update_map_icons.c @@ -18,7 +18,8 @@ typedef struct { #include "rnc/game/level_state.h" -extern struct MapIcon *map_icon_lists_by_level[] __asm__("D_001A2BC0"); +/* The icon list of each level (update_map_icons only reads it for level < 19). */ +extern struct MapIcon *map_icon_lists_by_level[19] __asm__("D_001A2BC0"); extern s32 D_001A01F4[]; extern s32 D_0015FD60 __attribute__((sda)); @@ -164,3 +165,46 @@ void update_map_icons(s32 level, s32 flag) { } extern __typeof__(update_map_icons) func_0020BF90 __attribute__((alias("FUN_0020bf90"))); + +/* Icon arrays of the levels, still in assembly. */ +extern struct MapIcon D_001A0910[]; +extern struct MapIcon D_001A0A28[]; +extern struct MapIcon D_001A0BE0[]; +extern struct MapIcon D_001A0E60[]; +extern struct MapIcon D_001A10E0[]; +extern struct MapIcon D_001A1270[]; +extern struct MapIcon D_001A14C8[]; +extern struct MapIcon D_001A1680[]; +extern struct MapIcon D_001A1860[]; +extern struct MapIcon D_001A1A18[]; +extern struct MapIcon D_001A1C20[]; +extern struct MapIcon D_001A1EC8[]; +extern struct MapIcon D_001A2148[]; +extern struct MapIcon D_001A22B0[]; +extern struct MapIcon D_001A2490[]; +extern struct MapIcon D_001A26C0[]; +extern struct MapIcon D_001A28C8[]; +extern struct MapIcon D_001A2A08[]; +extern struct MapIcon D_001A2AF8[]; + +struct MapIcon *map_icon_lists_by_level[19] __asm__("D_001A2BC0") = { + D_001A0910, + D_001A0A28, + D_001A0BE0, + D_001A0E60, + D_001A10E0, + D_001A1270, + D_001A14C8, + D_001A1680, + D_001A1860, + D_001A1A18, + D_001A1C20, + D_001A1EC8, + D_001A2148, + D_001A22B0, + D_001A2490, + D_001A26C0, + D_001A28C8, + D_001A2A08, + D_001A2AF8, +}; diff --git a/src/ui/menus/item_preview/draw_menu_preview_objects.c b/src/ui/menus/item_preview/draw_menu_preview_objects.c index aa1212149c..866a430ad3 100644 --- a/src/ui/menus/item_preview/draw_menu_preview_objects.c +++ b/src/ui/menus/item_preview/draw_menu_preview_objects.c @@ -12,7 +12,7 @@ struct MenuPreviewObjects { u8 held[24]; }; -extern s32 menu_preview_slot_draw_enabled[] __asm__("D_001D5020"); +extern s32 menu_preview_slot_draw_enabled[24] __asm__("D_001D5020"); extern void draw_moby_list(void *, s32) __asm__("func_0020D330"); s32 draw_menu_preview_objects(struct MenuPreviewObjects *preview) __asm__("FUN_0021ddf8"); @@ -57,3 +57,7 @@ s32 draw_menu_preview_objects(struct MenuPreviewObjects *preview) { } extern __typeof__(draw_menu_preview_objects) func_0021DDF8 __attribute__((alias("FUN_0021ddf8"))); + +/* Nonzero: the preview draws slot i (the loop above walks the 24 slots). */ +s32 menu_preview_slot_draw_enabled[24] __asm__("D_001D5020") = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; diff --git a/src/world/select_world_object_resource_tables.c b/src/world/select_world_object_resource_tables.c index 2abb0dacdb..b6a73bc331 100644 --- a/src/world/select_world_object_resource_tables.c +++ b/src/world/select_world_object_resource_tables.c @@ -142,3 +142,6 @@ extern void func_00204A40(s32 class_id, s32 buffer_index) __attribute__((alias(" char class_material_maps[24][16] = {0}; s16 class_runtime_indices[24][16] = {0}; + +s32 runtime_resource_tag __asm__("D_0015FF44") MACRO_ADDR = 0; +s32 class_resource_count __asm__("D_0015FF48") MACRO_ADDR = 0; From 30086d39a75b894b69b251b4cfc4cd3c91d4b067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 11:32:30 +0000 Subject: [PATCH 15/25] decomp: define the integer formats of format_scaled_display_value in C --- configure.py | 1 + src/ui/menus/widgets/format_scaled_display_value.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/configure.py b/configure.py index c206ecb406..5b1eafe8ad 100755 --- a/configure.py +++ b/configure.py @@ -1129,6 +1129,7 @@ "mobys/update_visible_mobys": (0x15FF24, 0x60EA4, 4), # visible moby list "world/select_world_object_resource_tables": (0x15FF44, 0x60EC4, 8), # resource tag and count "ui/hud/init_hud": (0x15F6D8, 0x60658, 8), # allocation tag + "ui/menus/widgets/format_scaled_display_value": (0x161078, 0x61FF8, 11), # display value formats } # The same for a unit's `.data`: data only that unit reads, defined in it. diff --git a/src/ui/menus/widgets/format_scaled_display_value.c b/src/ui/menus/widgets/format_scaled_display_value.c index 6d77b7156f..033ee411e9 100644 --- a/src/ui/menus/widgets/format_scaled_display_value.c +++ b/src/ui/menus/widgets/format_scaled_display_value.c @@ -14,3 +14,7 @@ void format_scaled_display_value(u8 *destination, s32 value) { } extern __typeof__(format_scaled_display_value) func_00238688 __attribute__((alias("FUN_00238688"))); + +/* Small data reached with lui/addiu. */ +u8 thousands_grouped_integer_format[] __asm__("D_00161078") __attribute__((section(".sdata"))) = "%d,%03d"; +u8 plain_integer_format[] __asm__("D_00161080") __attribute__((section(".sdata"))) = "%d"; From 9999a4a53b8ba10025fba02ac6d9a05d17385318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:14:40 +0000 Subject: [PATCH 16/25] decomp: define the shrub class table, level select texts and normal LUT in C shrub_render_classes[64] goes to its registrar, whose range starts right after it. The level map labels are the label field of a 19-entry level select text table at D_001DDD40, which the menu widgets and a pause menu label read too; it is defined as that table. normal_lut is the 256 cos/sin pairs process_moby_anim_data copies (0x800 bytes) into scratchpad. --- config/us/undefined_syms.txt | 1 - configure.py | 5 +- include/rnc/data_labels.h | 1 - include/rnc/mobys/animation.h | 4 + include/rnc/ui/map/level_map.h | 9 +- src/audio/voices/pause_all_sounds.c | 6 +- src/mobys/animation/process_moby_anim_data.c | 261 +++++++++++++++++- .../shrubs/register_shrub_render_class.c | 2 + .../draw_level_selection_map.c | 25 +- .../menus/widgets/draw_menu_selection_text.c | 5 +- .../widgets/draw_selected_menu_item_text.c | 5 +- 11 files changed, 308 insertions(+), 16 deletions(-) diff --git a/config/us/undefined_syms.txt b/config/us/undefined_syms.txt index c0d5cc0732..88e4aa77ad 100644 --- a/config/us/undefined_syms.txt +++ b/config/us/undefined_syms.txt @@ -60,7 +60,6 @@ D_001601E8 = 0x001601E8; D_001601F0 = 0x001601F0; D_00160200 = 0x00160200; D_001D62B8 = 0x001D62B8; -D_001DDD4C = 0x001DDD4C; D_001DDD50 = 0x001DDD50; FUN_00219d80 = 0x00219D80; FUN_0021d168 = 0x0021D168; diff --git a/configure.py b/configure.py index 5b1eafe8ad..989e464041 100755 --- a/configure.py +++ b/configure.py @@ -1155,7 +1155,7 @@ "rendering/effects/render_level_effects_and_screen_sprites": (0x1CE2C0, 0xCF240, 56), "weapons/load_hand_gadget": (0x1D52E8, 0xD6268, 1776), "ui/menus/item_preview/update_preview_animation_and_attachments": (0x1D6080, 0xD7000, 56), - "rendering/shrubs/register_shrub_render_class": (0x1D8030, 0xD8FB0, 128), + "rendering/shrubs/register_shrub_render_class": (0x1D7F30, 0xD8EB0, 384), "rendering/effects/build_variant_effect_quads": (0x1D9890, 0xDA810, 384), "rendering/effects/build_resident_indexed_texture_warp_meshes": (0x1D9A10, 0xDA990, 56), "rendering/effects/draw_light_flare": (0x1D97B0, 0xDA730, 224), @@ -1166,7 +1166,7 @@ "rendering/mobys/render_environment_mapped_object": (0x1D9CE0, 0xDAC60, 13504), "streaming/stash/init_stash": (0x1DD1A0, 0xDE120, 1080), "ui/text/update_scrolling_status_message": (0x1E5FB8, 0xE6F38, 96), - "ui/map/level_selection/draw_level_selection_map": (0x1DDE28, 0xDEDA8, 320), + "ui/map/level_selection/draw_level_selection_map": (0x1DDD40, 0xDECC0, 552), "rendering/ties/register_object_render_class": (0x1E1700, 0xE2680, 768), "rendering/texture/initialize_alpha_lookup_table": (0x18E740, 0x8F6C0, 1024), "mobys/resolve_moby_hit_response": (0x1CC080, 0xCD000, 200), @@ -1209,6 +1209,7 @@ "ui/menus/system/process_menu_entry": (0x1993C0, 0x9A340, 24), "rendering/occlusion/build_occlusion_visibility": (0x193FC0, 0x94F40, 256), "input/actuator_calc_power": (0x165480, 0x66400, 128), + "mobys/animation/process_moby_anim_data": (0x165500, 0x66480, 2048), "game/startlevel": (0x186100, 0x87080, 384), "game/transitions/transition_do_transition": (0x1862B0, 0x87230, 96), "rendering/effects/draw_lens_flare": (0x187300, 0x88280, 272), diff --git a/include/rnc/data_labels.h b/include/rnc/data_labels.h index 4b0615ec3b..baec807d35 100644 --- a/include/rnc/data_labels.h +++ b/include/rnc/data_labels.h @@ -116,7 +116,6 @@ extern char D_001B2C00[]; extern s32 D_001CDF80[]; extern s32 D_001D2640[]; extern u8 D_001D8EB0[]; -extern u8 D_001DDD40[]; extern u8 D_001E1300[]; extern u8 D_002169C0[]; extern u8 D_1FF8000[]; diff --git a/include/rnc/mobys/animation.h b/include/rnc/mobys/animation.h index 39bb5e4460..bdc2346569 100644 --- a/include/rnc/mobys/animation.h +++ b/include/rnc/mobys/animation.h @@ -6,6 +6,10 @@ struct InterpolatedAnim; s32 is_value_within_interpolated_window(struct InterpolatedAnim *, f32) __asm__("FUN_00214cc8"); +/* cos and sin of k * 2pi / 256; process_moby_anim_data copies it whole (0x800 bytes) + into scratchpad for the moby and tfrag lighting code. */ +extern f32 normal_lut[256][2] __asm__("D_00165500"); + s32 queue_animation_update(s32, s32, s32, s32, s32, s32, s32) __asm__("FUN_001ff308"); #endif /* LOMBYTE_RNC_MOBYS_ANIMATION_H */ diff --git a/include/rnc/ui/map/level_map.h b/include/rnc/ui/map/level_map.h index 5a389f1aa4..42e5f8d36b 100644 --- a/include/rnc/ui/map/level_map.h +++ b/include/rnc/ui/map/level_map.h @@ -10,12 +10,15 @@ typedef struct { s32 label_offset_y; } LevelMapMarker; +/* One per level id: the level select menu prints description_text and + label_text (draw_menu_selection_text), the map prints label_text. */ typedef struct { + s32 description_text; s32 label_text; - s32 pad4[2]; -} LevelMapMarkerText; + s32 unk8; +} LevelSelectText; -extern LevelMapMarkerText level_map_labels[19] __asm__("D_001DDD44"); +extern LevelSelectText level_select_texts[19] __asm__("D_001DDD40"); extern LevelMapMarker level_map_markers[20] __asm__("D_001DDE28"); #endif /* LOMBYTE_RNC_UI_MAP_LEVEL_MAP_H */ diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index 34e701a7d3..587ad08170 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -13,6 +13,7 @@ #include "rnc/game/missions.h" #include "rnc/rendering/effects.h" #include "rnc/ui/map.h" +#include "rnc/ui/map/level_map.h" #include "rnc/ui/menus/item_preview.h" #include "rnc/ui/menus/missions.h" #include "rnc/ui/menus/pause.h" @@ -169,7 +170,6 @@ extern void FUN_0021d168(struct MenuScreen *, s32); extern struct MenuStreamEntry D_00138008[]; extern struct MenuStreamEntry D_00138080[]; -extern u8 D_001DDD4C[]; extern u8 D_001DDD50[]; struct MenuScreen menu_placeholder_screen = { @@ -573,7 +573,7 @@ struct MenuPage map_circle_destination_page = { struct MenuLabelScreen map_location_label = { { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | -MENU_LABEL_CENTER_X, (s32)D_001DDD4C, +MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, 0xC } }; @@ -622,7 +622,7 @@ struct MenuStreamScreen missions_picture_screen = { struct MenuLabelScreen missions_location_label = { { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | -MENU_LABEL_CENTER_X, (s32)D_001DDD4C, +MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, 0xC } }; diff --git a/src/mobys/animation/process_moby_anim_data.c b/src/mobys/animation/process_moby_anim_data.c index d3e7812029..3d0fdc32f8 100644 --- a/src/mobys/animation/process_moby_anim_data.c +++ b/src/mobys/animation/process_moby_anim_data.c @@ -1,7 +1,7 @@ #include "types.h" #include "rnc/data_labels.h" +#include "rnc/mobys/animation.h" -extern u8 normal_lut[] __asm__("D_00165500"); extern s32 FlushCache(); extern s32 fast_mem_copy() __asm__("FUN_001f98d0"); extern s32 moby_anim_proc() __asm__("FUN_00211728"); @@ -12,3 +12,262 @@ void process_moby_anim_data(void) { fast_mem_copy(0x70003800, normal_lut, 0x800); moby_anim_proc(*(s32 *)0x0015F638, D_0015F63C); } + +f32 normal_lut[256][2] = { + {1.0f, 0.0f}, + {0.9996988f, 0.024541229f}, + {0.99879545f, 0.049067676f}, + {0.99729043f, 0.07356457f}, + {0.9951847f, 0.09801714f}, + {0.99247956f, 0.12241067f}, + {0.9891765f, 0.14673047f}, + {0.98527765f, 0.17096189f}, + {0.98078525f, 0.19509032f}, + {0.9757021f, 0.21910124f}, + {0.97003126f, 0.24298018f}, + {0.96377605f, 0.26671275f}, + {0.95694035f, 0.29028466f}, + {0.94952816f, 0.31368172f}, + {0.94154406f, 0.33688983f}, + {0.9329928f, 0.35989505f}, + {0.9238795f, 0.38268346f}, + {0.9142098f, 0.4052413f}, + {0.9039893f, 0.42755508f}, + {0.8932243f, 0.44961134f}, + {0.8819213f, 0.4713967f}, + {0.870087f, 0.49289817f}, + {0.8577286f, 0.51410276f}, + {0.8448536f, 0.53499764f}, + {0.8314696f, 0.55557024f}, + {0.8175848f, 0.5758082f}, + {0.8032076f, 0.59569925f}, + {0.78834647f, 0.6152316f}, + {0.7730105f, 0.6343933f}, + {0.7572088f, 0.65317285f}, + {0.7409511f, 0.671559f}, + {0.7242471f, 0.68954057f}, + {0.70710677f, 0.70710677f}, + {0.68954057f, 0.72424704f}, + {0.671559f, 0.7409511f}, + {0.65317285f, 0.7572088f}, + {0.6343933f, 0.77301043f}, + {0.6152316f, 0.7883464f}, + {0.5956993f, 0.8032075f}, + {0.5758082f, 0.8175848f}, + {0.55557024f, 0.8314696f}, + {0.53499764f, 0.8448536f}, + {0.5141028f, 0.8577286f}, + {0.4928982f, 0.87008697f}, + {0.47139677f, 0.88192123f}, + {0.4496114f, 0.89322424f}, + {0.4275551f, 0.9039893f}, + {0.40524137f, 0.9142097f}, + {0.38268343f, 0.9238795f}, + {0.35989508f, 0.93299276f}, + {0.33688983f, 0.94154406f}, + {0.31368175f, 0.94952816f}, + {0.29028475f, 0.9569403f}, + {0.26671275f, 0.96377605f}, + {0.24298024f, 0.97003126f}, + {0.21910122f, 0.9757021f}, + {0.19509035f, 0.98078525f}, + {0.17096186f, 0.98527765f}, + {0.1467305f, 0.9891765f}, + {0.12241074f, 0.9924795f}, + {0.098017134f, 0.9951847f}, + {0.07356461f, 0.99729043f}, + {0.04906765f, 0.99879545f}, + {0.024541255f, 0.9996988f}, + {0.0f, 1.0f}, + {-0.024541223f, 0.9996988f}, + {-0.04906762f, 0.99879545f}, + {-0.073564574f, 0.99729043f}, + {-0.098017104f, 0.9951847f}, + {-0.12241071f, 0.9924795f}, + {-0.14673045f, 0.9891765f}, + {-0.17096183f, 0.98527765f}, + {-0.19509032f, 0.98078525f}, + {-0.21910119f, 0.97570217f}, + {-0.2429802f, 0.97003126f}, + {-0.26671273f, 0.96377605f}, + {-0.29028472f, 0.9569403f}, + {-0.31368172f, 0.94952816f}, + {-0.3368898f, 0.94154406f}, + {-0.35989505f, 0.9329928f}, + {-0.3826834f, 0.92387956f}, + {-0.40524134f, 0.9142097f}, + {-0.42755508f, 0.9039893f}, + {-0.44961137f, 0.8932243f}, + {-0.47139663f, 0.8819213f}, + {-0.49289817f, 0.870087f}, + {-0.51410276f, 0.8577286f}, + {-0.5349975f, 0.84485364f}, + {-0.5555702f, 0.83146966f}, + {-0.57580817f, 0.8175848f}, + {-0.5956992f, 0.80320764f}, + {-0.6152315f, 0.78834647f}, + {-0.6343933f, 0.7730105f}, + {-0.65317285f, 0.7572088f}, + {-0.67155886f, 0.74095124f}, + {-0.6895405f, 0.7242471f}, + {-0.70710677f, 0.70710677f}, + {-0.724247f, 0.6895407f}, + {-0.74095106f, 0.67155904f}, + {-0.7572088f, 0.65317285f}, + {-0.7730105f, 0.6343933f}, + {-0.78834635f, 0.6152317f}, + {-0.8032075f, 0.59569937f}, + {-0.8175848f, 0.57580817f}, + {-0.83146954f, 0.55557036f}, + {-0.8448535f, 0.5349977f}, + {-0.8577286f, 0.51410276f}, + {-0.870087f, 0.49289814f}, + {-0.88192123f, 0.47139683f}, + {-0.8932243f, 0.44961137f}, + {-0.9039893f, 0.42755505f}, + {-0.9142097f, 0.40524143f}, + {-0.9238795f, 0.3826835f}, + {-0.9329928f, 0.35989505f}, + {-0.9415441f, 0.3368898f}, + {-0.94952816f, 0.31368184f}, + {-0.95694035f, 0.29028472f}, + {-0.96377605f, 0.26671273f}, + {-0.9700312f, 0.2429803f}, + {-0.9757021f, 0.2191013f}, + {-0.9807853f, 0.19509031f}, + {-0.98527765f, 0.17096181f}, + {-0.9891765f, 0.14673057f}, + {-0.9924795f, 0.1224107f}, + {-0.9951847f, 0.0980171f}, + {-0.99729043f, 0.073564686f}, + {-0.99879545f, 0.049067724f}, + {-0.9996988f, 0.02454121f}, + {-1.0f, 0.0f}, + {-0.9996988f, -0.024541147f}, + {-0.99879545f, -0.04906766f}, + {-0.99729043f, -0.07356462f}, + {-0.9951847f, -0.09801703f}, + {-0.99247956f, -0.12241063f}, + {-0.9891765f, -0.1467305f}, + {-0.98527765f, -0.17096175f}, + {-0.9807853f, -0.19509025f}, + {-0.9757021f, -0.21910124f}, + {-0.97003126f, -0.24298024f}, + {-0.9637761f, -0.26671267f}, + {-0.95694035f, -0.29028463f}, + {-0.94952816f, -0.31368178f}, + {-0.9415441f, -0.33688974f}, + {-0.9329928f, -0.359895f}, + {-0.9238795f, -0.38268343f}, + {-0.9142097f, -0.4052414f}, + {-0.9039893f, -0.42755502f}, + {-0.8932243f, -0.4496113f}, + {-0.88192123f, -0.47139677f}, + {-0.870087f, -0.49289808f}, + {-0.85772866f, -0.5141027f}, + {-0.8448536f, -0.53499764f}, + {-0.83146954f, -0.5555703f}, + {-0.8175849f, -0.5758081f}, + {-0.8032075f, -0.5956993f}, + {-0.7883464f, -0.61523163f}, + {-0.77301055f, -0.6343932f}, + {-0.7572089f, -0.6531728f}, + {-0.7409511f, -0.671559f}, + {-0.72424704f, -0.6895406f}, + {-0.7071068f, -0.7071067f}, + {-0.68954057f, -0.7242471f}, + {-0.6715589f, -0.7409512f}, + {-0.6531729f, -0.75720876f}, + {-0.63439333f, -0.77301043f}, + {-0.6152316f, -0.78834647f}, + {-0.5956992f, -0.8032076f}, + {-0.5758084f, -0.81758463f}, + {-0.5555704f, -0.8314695f}, + {-0.53499776f, -0.84485346f}, + {-0.5141028f, -0.85772854f}, + {-0.4928982f, -0.87008697f}, + {-0.47139668f, -0.8819213f}, + {-0.44961163f, -0.8932241f}, + {-0.42755535f, -0.9039892f}, + {-0.40524152f, -0.91420966f}, + {-0.38268358f, -0.9238795f}, + {-0.3598951f, -0.93299276f}, + {-0.33688986f, -0.94154406f}, + {-0.3136817f, -0.9495282f}, + {-0.29028502f, -0.95694023f}, + {-0.26671302f, -0.963776f}, + {-0.24298038f, -0.9700312f}, + {-0.21910137f, -0.9757021f}, + {-0.19509038f, -0.98078525f}, + {-0.17096189f, -0.98527765f}, + {-0.14673041f, -0.9891765f}, + {-0.122411005f, -0.9924795f}, + {-0.0980174f, -0.9951847f}, + {-0.07356476f, -0.99729043f}, + {-0.049067803f, -0.99879545f}, + {-0.024541287f, -0.9996988f}, + {0.0f, -1.0f}, + {0.02454131f, -0.9996988f}, + {0.04906735f, -0.99879545f}, + {0.073564306f, -0.9972905f}, + {0.098016955f, -0.9951847f}, + {0.12241056f, -0.99247956f}, + {0.14673042f, -0.9891765f}, + {0.17096192f, -0.98527765f}, + {0.19509041f, -0.98078525f}, + {0.21910094f, -0.9757022f}, + {0.24297994f, -0.9700313f}, + {0.26671258f, -0.9637761f}, + {0.29028457f, -0.95694035f}, + {0.3136817f, -0.9495282f}, + {0.3368899f, -0.94154406f}, + {0.35989514f, -0.93299276f}, + {0.38268316f, -0.9238796f}, + {0.4052411f, -0.91420984f}, + {0.42755494f, -0.9039894f}, + {0.44961125f, -0.89322436f}, + {0.4713967f, -0.8819213f}, + {0.49289823f, -0.87008697f}, + {0.5141028f, -0.85772854f}, + {0.53499734f, -0.8448537f}, + {0.55557007f, -0.8314697f}, + {0.57580805f, -0.81758493f}, + {0.59569925f, -0.8032076f}, + {0.6152316f, -0.7883464f}, + {0.63439333f, -0.77301043f}, + {0.6531729f, -0.75720876f}, + {0.67155874f, -0.7409513f}, + {0.6895404f, -0.7242472f}, + {0.70710665f, -0.7071069f}, + {0.72424704f, -0.6895406f}, + {0.7409511f, -0.671559f}, + {0.7572089f, -0.6531728f}, + {0.77301055f, -0.63439316f}, + {0.78834623f, -0.6152318f}, + {0.8032074f, -0.5956995f}, + {0.81758475f, -0.5758083f}, + {0.8314696f, -0.5555703f}, + {0.8448536f, -0.53499764f}, + {0.85772866f, -0.5141027f}, + {0.8700871f, -0.49289808f}, + {0.8819211f, -0.47139698f}, + {0.89322424f, -0.4496115f}, + {0.90398926f, -0.4275552f}, + {0.9142097f, -0.40524137f}, + {0.92387956f, -0.38268343f}, + {0.9329928f, -0.35989496f}, + {0.9415441f, -0.3368897f}, + {0.9495281f, -0.313682f}, + {0.9569403f, -0.29028484f}, + {0.96377605f, -0.26671287f}, + {0.97003126f, -0.24298023f}, + {0.9757021f, -0.21910122f}, + {0.9807853f, -0.19509023f}, + {0.98527765f, -0.17096172f}, + {0.98917645f, -0.14673072f}, + {0.9924795f, -0.12241085f}, + {0.9951847f, -0.098017246f}, + {0.99729043f, -0.0735646f}, + {0.99879545f, -0.04906764f}, + {0.9996988f, -0.024541123f}, +}; diff --git a/src/rendering/shrubs/register_shrub_render_class.c b/src/rendering/shrubs/register_shrub_render_class.c index c0f0985eb5..acddce9976 100644 --- a/src/rendering/shrubs/register_shrub_render_class.c +++ b/src/rendering/shrubs/register_shrub_render_class.c @@ -228,4 +228,6 @@ void register_shrub_render_class(ShrubRenderClass *render_class, extern __typeof__(register_shrub_render_class) func_00203B08 __attribute__((alias("FUN_00203b08"))); +ShrubRenderClass *shrub_render_classes[64] = {0}; + s16 shrub_render_class_ids[64] = {0}; diff --git a/src/ui/map/level_selection/draw_level_selection_map.c b/src/ui/map/level_selection/draw_level_selection_map.c index 770ecd4d37..ac8044a1c2 100644 --- a/src/ui/map/level_selection/draw_level_selection_map.c +++ b/src/ui/map/level_selection/draw_level_selection_map.c @@ -97,7 +97,7 @@ void draw_level_selection_map(s32 left, s32 right, s32 top, s32 bottom) { line_fraction = direction_length - 8000; line_start_x = label_x + (marker_x - label_x) * line_fraction / direction_length; line_start_y = label_y + (marker_y - label_y) * line_fraction / direction_length; - label_text = get_help_message_text(level_map_labels[level_index].label_text); + label_text = get_help_message_text(level_select_texts[level_index].label_text); text_width = measure_text_width_regular(label_text, -1); if (level_map_markers[level_index].label_offset_x <= -1) { line_end_x = label_x - text_width; @@ -120,6 +120,28 @@ void draw_level_selection_map(s32 left, s32 right, s32 top, s32 bottom) { do_gif_paging(); } +LevelSelectText level_select_texts[19] = { + {0x4eb9, 0x4ede, 0}, + {0x4eba, 0x4ecd, 6}, + {0x4ebb, 0x4ece, 0x3f1}, + {0x4ebc, 0x4ecf, 0x3f2}, + {0x4ebd, 0x4ed0, 0xbc6}, + {0x4ebe, 0x4ed1, 0x177b}, + {0x4ebf, 0x4ed2, 0xfa6}, + {0x4ec0, 0x4ed3, 0x1394}, + {0x4ec1, 0x4ed4, 0x1b58}, + {0x4ec2, 0x4ed5, 0x1f47}, + {0x4ec3, 0x4ed6, 0x1f48}, + {0x4ec4, 0x4ed7, 0x2719}, + {0x4ec5, 0x4ed8, 0x271a}, + {0x4ec6, 0x4ed9, 0x2ee5}, + {0x4ec7, 0x4eda, 0x32c9}, + {0x4ec8, 0x4edb, 0x36b1}, + {0x4ec9, 0x4edc, 0x3aa1}, + {0x4eca, 0x4edd, 0x3aa2}, + {0x4ecb, 0x4ede, 0x4269}, +}; + LevelMapMarker level_map_markers[20] = { {0}, {0x50, 0x5f, 0x14, -20}, @@ -144,3 +166,4 @@ LevelMapMarker level_map_markers[20] = { }; extern __typeof__(draw_level_selection_map) func_001FD748 __attribute__((alias("FUN_001fd748"))); + diff --git a/src/ui/menus/widgets/draw_menu_selection_text.c b/src/ui/menus/widgets/draw_menu_selection_text.c index 1c5a160217..bbb8237ec4 100644 --- a/src/ui/menus/widgets/draw_menu_selection_text.c +++ b/src/ui/menus/widgets/draw_menu_selection_text.c @@ -3,6 +3,7 @@ #include "rnc/save/memory_card_state.h" #include "rnc/ui/menus/menu_screen.h" #include "rnc/data_labels.h" +#include "rnc/ui/map/level_map.h" extern void setup_gif_paging(s32) __asm__("func_001F4280"); extern s32 do_gif_paging() __asm__("func_001F4398"); @@ -44,7 +45,7 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { mid_x, 4, 0x80FFA888, - get_help_message_text(*((s32 *)((void *)(entry_offset + D_001DDD40)))), + get_help_message_text(*((s32 *)((void *)(entry_offset + (u8 *)level_select_texts)))), -1); width2 = menu->width; if (1) { @@ -53,7 +54,7 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { center_x2, 0x14, 0x80FFA888, - get_help_message_text(*((s32 *)(((u8 *)(D_001DDD40 + entry_offset)) + 0x4))), + get_help_message_text(*((s32 *)(((u8 *)((u8 *)level_select_texts + entry_offset)) + 0x4))), -1); } } diff --git a/src/ui/menus/widgets/draw_selected_menu_item_text.c b/src/ui/menus/widgets/draw_selected_menu_item_text.c index 7af5e51414..a28e7d4056 100644 --- a/src/ui/menus/widgets/draw_selected_menu_item_text.c +++ b/src/ui/menus/widgets/draw_selected_menu_item_text.c @@ -2,6 +2,7 @@ #include "rnc/ui/menus/menu_screen.h" #include "rnc/ui/menus/menu_system.h" #include "rnc/data_labels.h" +#include "rnc/ui/map/level_map.h" extern void setup_gif_paging(s32) __asm__("func_001F4280"); extern s32 do_gif_paging() __asm__("func_001F4398"); @@ -46,7 +47,7 @@ s32 draw_selected_menu_item_text(struct MenuScreen *menu) { font_print_center(mid_x, upper_y, 0x80FFA888, - get_help_message_text(*(s32 *)(void *)(entry_offset + D_001DDD40)), + get_help_message_text(*(s32 *)(void *)(entry_offset + (u8 *)level_select_texts)), -1); width2 = menu->width; center_x2 = (s32)(width2 + ((u32)width2 >> 0x1F)) >> 1; @@ -54,7 +55,7 @@ s32 draw_selected_menu_item_text(struct MenuScreen *menu) { font_print_center(center_x2, lower_y, 0x80FFA888, - get_help_message_text(*(s32 *)((u8 *)(D_001DDD40 + entry_offset) + 0x4)), + get_help_message_text(*(s32 *)((u8 *)((u8 *)level_select_texts + entry_offset) + 0x4)), -1); block_5: do_gif_paging(); From 58af3a8eab26f0a4d0fc8c117d2463798af86108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:22:54 +0000 Subject: [PATCH 17/25] decomp: define the per-level progress records in C The per-level records between the help history and the memory card buffers (0x141EA0-0x14EED0) join memcard_update_state's data range. Their sizes come from the mc_leveldata save table (row sizes, 20 level records as memcard_make_whole_save loops) and, for the respawn counters and the 16 mission counters at the end, from the level code that reads them. The map coverage pages and gold bolt flags get names from their readers; the Veldin 2 gold bolt row is now read through the gold bolt array. --- configure.py | 2 +- include/rnc/data_labels.h | 4 +-- include/rnc/game/bolt_sources.h | 4 ++- include/rnc/game/game_globals.h | 2 +- include/rnc/game/item_state.h | 4 +-- include/rnc/game/level_progress.h | 29 +++++++++++++++++++ .../load_level_zero_preserving_progress.c | 4 +-- src/game/missions/check_mission_condition.c | 2 +- src/game/process_global_state_flags.c | 6 ++-- src/save/memcard_save_data.c | 4 +-- src/save/memcard_update_state.c | 22 ++++++++++++++ src/ui/map/draw_map_screen.c | 4 +-- src/ui/menus/save_data/prepare_save_game.c | 2 +- src/ui/menus/system/setup_menu_display_text.c | 2 +- src/ui/menus/weapons/count_gold_bolts.c | 2 +- 15 files changed, 72 insertions(+), 21 deletions(-) create mode 100644 include/rnc/game/level_progress.h diff --git a/configure.py b/configure.py index 989e464041..a25abbc4e8 100755 --- a/configure.py +++ b/configure.py @@ -1195,7 +1195,7 @@ "ui/menus/selection/update_menu_item_slots": (0x141848, 0x427C8, 288), "ui/help/update_help_state": (0x141968, 0x428E8, 1184), "ui/help/push_help_history": (0x141E08, 0x42D88, 150), - "save/memcard_update_state": (0x14EED0, 0x4FE50, 10240), + "save/memcard_update_state": (0x141EA0, 0x42E20, 63536), "rendering/frame/reset_gs_registers": (0x13CFC0, 0x3DF40, 304), "audio/snd_start_sound_system": (0x133280, 0x34200, 18504), "camera/update_all_cameras": (0x187410, 0x88390, 7680), diff --git a/include/rnc/data_labels.h b/include/rnc/data_labels.h index baec807d35..6bd64c332b 100644 --- a/include/rnc/data_labels.h +++ b/include/rnc/data_labels.h @@ -2,6 +2,7 @@ #define LOMBYTE_RNC_DATA_LABELS_H #include "types.h" +#include "rnc/game/level_progress.h" /* Globals several files read whose meaning is not known yet, by address. Name one and move it to its subsystem header. */ @@ -47,9 +48,6 @@ extern s32 D_001413D0[]; extern int D_001413DC[]; extern u8 D_001413F5[]; extern unsigned char D_0014161B[]; -extern char D_00141EC0[]; -extern u8 D_0014BEC0[]; -extern u8 D_0014BF10[]; extern s32 D_0014EE90[16]; extern short D_001516F0 __attribute__((section(".data"))); extern u8 D_00154A80[]; diff --git a/include/rnc/game/bolt_sources.h b/include/rnc/game/bolt_sources.h index 3c82e21584..4ccd2bb5cf 100644 --- a/include/rnc/game/bolt_sources.h +++ b/include/rnc/game/bolt_sources.h @@ -9,6 +9,8 @@ typedef struct BoltSourceStats { s16 bolts; /* bolts collected from this source */ } BoltSourceStats; -extern BoltSourceStats bolt_source_stats[][64] __asm__("D_0014D590"); +/* One row per level record (20), see rnc/game/level_progress.h. */ +extern BoltSourceStats bolt_source_stats[20][64] __asm__("D_0014D590"); + #endif /* LOMBYTE_RNC_GAME_BOLT_SOURCES_H */ diff --git a/include/rnc/game/game_globals.h b/include/rnc/game/game_globals.h index 3898d728d7..b399444dcc 100644 --- a/include/rnc/game/game_globals.h +++ b/include/rnc/game/game_globals.h @@ -2,11 +2,11 @@ #define LOMBYTE_RNC_GAME_GAME_GLOBALS_H #include "types.h" +#include "rnc/game/level_progress.h" extern s32 ship_substate[] __asm__("D_0013E050"); extern s16 ship_index[] __asm__("D_0013E056"); extern char item_usage[] __asm__("D_00141680"); -extern unsigned char visited52[] __asm__("D_0014C050"); extern s16 cd_read_active[] __asm__("D_001516D8"); extern s32 hero_max_health __asm__("D_0015EDA0"); extern s32 *level_root __asm__("D_0015EE4C"); diff --git a/include/rnc/game/item_state.h b/include/rnc/game/item_state.h index a878347dd3..8a9d23de1f 100644 --- a/include/rnc/game/item_state.h +++ b/include/rnc/game/item_state.h @@ -3,6 +3,7 @@ #include "types.h" #include "sda.h" +#include "rnc/game/level_progress.h" /* Per-item flag tables of the save state, indexed by item id. */ extern u8 alternate_item_available[128] __asm__("D_0013D388"); @@ -13,9 +14,8 @@ extern u8 discount_purchase_pricing[5] __asm__("D_0013D4E3") NOT_SDA; extern u8 item_text_variant[40] __asm__("D_0013E520"); extern u8 D_0015EDD0[] __attribute__((sda)); -extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); extern u8 items_acquired[] __asm__("D_0013D4E8"); -extern s32 pause_iop_sprite_lists[] __asm__("D_00141EA0"); +extern s32 pause_iop_sprite_lists[8] __asm__("D_00141EA0"); extern s32 D_00141660; #endif /* LOMBYTE_RNC_GAME_ITEM_STATE_H */ diff --git a/include/rnc/game/level_progress.h b/include/rnc/game/level_progress.h new file mode 100644 index 0000000000..fc3f7ab699 --- /dev/null +++ b/include/rnc/game/level_progress.h @@ -0,0 +1,29 @@ +#ifndef LOMBYTE_RNC_GAME_LEVEL_PROGRESS_H +#define LOMBYTE_RNC_GAME_LEVEL_PROGRESS_H + +#include "types.h" +#include "rnc/game/bolt_sources.h" + +/* Per-level progress records, one row per level slot (20; the level save + file holds 20 records, memcard_make_whole_save). The save table + mc_leveldata lists each array with its row size. */ +#define LEVEL_RECORD_COUNT 20 + +/* Explored map pages: save_map_coverage packs one 0x800-byte page per level. */ +#define MAP_COVERAGE_PAGE_SIZE 0x800 +extern u8 map_coverage_pages[LEVEL_RECORD_COUNT * MAP_COVERAGE_PAGE_SIZE] __asm__("D_00141EC0"); +/* Gold bolts collected, 4 per level, indexed level * 4 + bolt. */ +extern u8 gold_bolts_collected[LEVEL_RECORD_COUNT * 4] __asm__("D_0014BEC0"); +/* Buried bolt states dug up with the metal detector, 16 bytes per level. */ +extern u8 D_0014BF10[LEVEL_RECORD_COUNT * 16]; +/* Mission state per level slot (0xFF: done), indexed slot + level * 16. */ +extern unsigned char visited52[LEVEL_RECORD_COUNT * 16] __asm__("D_0014C050"); +/* One bit per moby save id, per level. */ +extern s32 D_0014C190_257218[LEVEL_RECORD_COUNT][64] __asm__("D_0014C190"); +/* bolt_source_stats (D_0014D590, rnc/game/bolt_sources.h) follows. */ +/* Hero respawns per level and damage source category; level code counts them. */ +extern s32 hero_respawn_counts_by_level_and_source_category[LEVEL_RECORD_COUNT][16] __asm__("D_0014E990"); +/* Per-mission counters the level loader clears (16 slots). */ +extern s32 D_0014EE90[16]; + +#endif /* LOMBYTE_RNC_GAME_LEVEL_PROGRESS_H */ diff --git a/src/game/load_level_zero_preserving_progress.c b/src/game/load_level_zero_preserving_progress.c index dfd43d3328..bab91e3fd0 100644 --- a/src/game/load_level_zero_preserving_progress.c +++ b/src/game/load_level_zero_preserving_progress.c @@ -60,7 +60,7 @@ void load_level_zero_preserving_progress(s32 slot) { copy_memory_aligned((void *)0x70000000, item_text_variant, 0x28); copy_memory_aligned((void *)0x70000030, item_available, 0x25); copy_memory_aligned((void *)0x70000060, weapon_ammo_counts, 0x94); - copy_memory_aligned((void *)0x70000100, D_0014BEC0, 0x50); + copy_memory_aligned((void *)0x70000100, gold_bolts_collected, 0x50); copy_memory_aligned((void *)0x70000150, pause_iop_sprite_lists, 0x20); copy_memory_aligned((void *)0x70000170, D_0015EDD0_macro, 0xC); copy_memory_aligned((void *)0x70000180, item_unlocked, 0x20); @@ -76,7 +76,7 @@ void load_level_zero_preserving_progress(s32 slot) { bytes[item_availability_restore_indices[j]]; } copy_memory_aligned(weapon_ammo_counts, (void *)0x70000060, 0x94); - copy_memory_aligned(D_0014BEC0, (void *)0x70000100, 0x50); + copy_memory_aligned(gold_bolts_collected, (void *)0x70000100, 0x50); for (i = 0; i < 8; i++) { s32 saved_item_index = items[i]; pause_iop_sprite_lists[i] = item_available[saved_item_index] ? saved_item_index : 0; diff --git a/src/game/missions/check_mission_condition.c b/src/game/missions/check_mission_condition.c index 7e0807dbee..1b2903e952 100644 --- a/src/game/missions/check_mission_condition.c +++ b/src/game/missions/check_mission_condition.c @@ -43,7 +43,7 @@ s32 check_mission_condition(s16 kind, s32 condition_operand) { case MISSION_CONDITION_CALLBACK_NONZERO: return ((s32(*)(void))condition_operand)() != 0; case MISSION_CONDITION_GOLD_BOLT_COLLECTED: - return D_0014BEC0[(condition_operand & 0xFFFF) + (condition_operand >> 16) * 4] != 0; + return gold_bolts_collected[(condition_operand & 0xFFFF) + (condition_operand >> 16) * 4] != 0; case MISSION_CONDITION_ALWAYS_FALSE: return 0; } diff --git a/src/game/process_global_state_flags.c b/src/game/process_global_state_flags.c index 1657500e74..863877ba47 100644 --- a/src/game/process_global_state_flags.c +++ b/src/game/process_global_state_flags.c @@ -8,8 +8,8 @@ #include "rnc/input/pad_state.h" #include "rnc/data_labels.h" #include "rnc/game/transitions.h" +#include "rnc/world/level_id.h" -extern u8 preserved_gold_bolt_flags[] __asm__("D_0014BF08"); extern u8 circle_target_menu_page[] __asm__("D_001D4EC0"); extern void fade_to_black(s32) __asm__("func_001F4A58"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); @@ -37,12 +37,12 @@ s32 process_global_state_flags(void) { } else if ((controller_state.pressed & PAD_CROSS) != 0) { old_value = item_unlocked[0x1D]; for (i = 0; i < 4; i++) { - backup[i] = preserved_gold_bolt_flags[i]; + backup[i] = (&gold_bolts_collected[LEVEL_VELDIN2 * 4])[i]; } memcard_restore_game(menu_system.unkE0); item_unlocked[0x1D] = old_value; for (i = 0; i < 4; i++) { - preserved_gold_bolt_flags[i] = backup[i]; + (&gold_bolts_collected[LEVEL_VELDIN2 * 4])[i] = backup[i]; } D_0015EEA0 = 1; memcard_save_data(0, -1); diff --git a/src/save/memcard_save_data.c b/src/save/memcard_save_data.c index f01834a0ca..5cd70bbb52 100644 --- a/src/save/memcard_save_data.c +++ b/src/save/memcard_save_data.c @@ -1,6 +1,7 @@ /* Ported from rac1-decomp (src/game/memcard.c, func_0020BFC8). */ #include "sda.h" #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/ui/map/copy_level_object_positions.h" #include "rnc/sdk/scf.h" #include "rnc/sdk/storage/cdvd.h" @@ -8,7 +9,6 @@ extern int memcard_prepare_data(void *dst, int i, int *table) __asm__("func_0020AD78"); extern void save_map_coverage(void *) __asm__("func_00207B08"); extern char D_0015EE98[] MACRO_ADDR; -extern char D_00141EC0[]; #include "rnc/game/level_state.h" #include "rnc/save/mc_data.h" @@ -34,7 +34,7 @@ int memcard_save_data(int slot, int flags) { sceCdReadClock(D_0015EE98); sceScfGetLocalTimefromRTC(D_0015EE98); copy_level_object_positions(); - save_map_coverage(D_00141EC0 + (current_level_index << 11)); + save_map_coverage(map_coverage_pages + (current_level_index << 11)); { struct MemoryCardState *card_state = &memory_card_state; int active = card_state->active_card; diff --git a/src/save/memcard_update_state.c b/src/save/memcard_update_state.c index df33ff4e6f..e805999b93 100644 --- a/src/save/memcard_update_state.c +++ b/src/save/memcard_update_state.c @@ -19,6 +19,9 @@ typedef struct { #include "rnc/game/game_globals.h" #include "rnc/ui/menus/menu_globals.h" #include "rnc/save/mc_data.h" +#include "rnc/game/item_state.h" +#include "rnc/game/bolt_sources.h" +#include "rnc/game/level_progress.h" extern char D_0013D1D0[]; extern char D_0013D1E8[]; @@ -1001,6 +1004,25 @@ void memcard_update_state(void) { extern __typeof__(memcard_update_state) func_002093D8 __attribute__((alias("FUN_002093d8"))); +/* Defined in retail order, in front of the memory card buffers. */ +s32 pause_iop_sprite_lists[8] = {0}; + +u8 map_coverage_pages[LEVEL_RECORD_COUNT * MAP_COVERAGE_PAGE_SIZE] = {0}; + +u8 gold_bolts_collected[LEVEL_RECORD_COUNT * 4] = {0}; + +u8 D_0014BF10[LEVEL_RECORD_COUNT * 16] = {0}; + +unsigned char visited52[LEVEL_RECORD_COUNT * 16] = {0}; + +s32 D_0014C190_257218[LEVEL_RECORD_COUNT][64] = {0}; + +BoltSourceStats bolt_source_stats[LEVEL_RECORD_COUNT][64] = {0}; + +s32 hero_respawn_counts_by_level_and_source_category[LEVEL_RECORD_COUNT][16] = {0}; + +s32 D_0014EE90[16] = {0}; + u8 memcard_game_data_buffer[MEMCARD_GAME_DATA_SIZE] = {0}; u8 memcard_level_data_buffer[MEMCARD_LEVEL_DATA_SIZE] = {0}; diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index 3a9533f552..c5b6cbb26b 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -1,5 +1,6 @@ #include "rnc/ui/map/map_state.h" #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/input/pad_state.h" #include "rnc/audio/music/music_stream_state.h" #include "rnc/globals.h" @@ -30,7 +31,6 @@ extern u8 D_0013D4E1[]; #include "rnc/game/level_state.h" #include "rnc/ui/menus/menu_globals.h" -extern char D_00141EC0[]; extern struct MapEntry D_001383A0[]; extern struct MapEntry D_00138438[]; @@ -155,7 +155,7 @@ s32 draw_map_screen(struct MenuScreen *screen) { } else { if (level_visit_state[level_map_selection.level] != 0) { load_map_chunk(map_mask_buffer, - D_00141EC0 + (level_map_selection.level << 11), + map_coverage_pages + (level_map_selection.level << 11), map_header_base + hdr->unk4); } else { decode_map_mask(map_mask_buffer, a, a, map_header_base); diff --git a/src/ui/menus/save_data/prepare_save_game.c b/src/ui/menus/save_data/prepare_save_game.c index bfd1c6dbce..8fa02fd56b 100644 --- a/src/ui/menus/save_data/prepare_save_game.c +++ b/src/ui/menus/save_data/prepare_save_game.c @@ -23,7 +23,7 @@ void prepare_save_game(int save_data, int slot) { sceCdReadClock(D_0015EE98); sceScfGetLocalTimefromRTC(D_0015EE98); copy_level_object_positions(); - save_map_coverage(D_00141EC0 + (current_level_index << 11)); + save_map_coverage(map_coverage_pages + (current_level_index << 11)); memcard_make_whole_save((char *)save_data); card_state->unkF4 = saving; card_state->buf = (void *)save_data; diff --git a/src/ui/menus/system/setup_menu_display_text.c b/src/ui/menus/system/setup_menu_display_text.c index 08039b962b..58f76b8da2 100644 --- a/src/ui/menus/system/setup_menu_display_text.c +++ b/src/ui/menus/system/setup_menu_display_text.c @@ -37,7 +37,7 @@ int setup_menu_display_text(struct MenuScreen *menu) { { int k; for (k = 0; k < 4; k++) { - if (D_0014BEC0[level_map_selection.level * 4 + k] != 0) { + if (gold_bolts_collected[level_map_selection.level * 4 + k] != 0) { count = count + 1; } } diff --git a/src/ui/menus/weapons/count_gold_bolts.c b/src/ui/menus/weapons/count_gold_bolts.c index d18301153c..ce50349f74 100644 --- a/src/ui/menus/weapons/count_gold_bolts.c +++ b/src/ui/menus/weapons/count_gold_bolts.c @@ -10,7 +10,7 @@ s32 count_gold_bolts(void) { for (row = 0; row < 0x14; row++) { for (k = 0; k < 4; k++) { - if (D_0014BEC0[row * 4 + k] != 0) { + if (gold_bolts_collected[row * 4 + k] != 0) { count++; } } From 946ec4e0bdb219870a91e2f400ed39cf3c4e8927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:30:04 +0000 Subject: [PATCH 18/25] decomp: read voice pool and item flag fields through their objects pause_sound_volume was voice_pool.group_2_volume (loading_data_menu sets the same field to the same 80 % value), so set_pause_sound_volume writes the field and no longer defines a variable inside voice_pool. item_available and items_acquired hold 37 items (mc_gamedata saves 0x25 bytes of each); the heli-pack, map id shift and vendor discount flags that were declared as separate variables are elements of item_available. --- configure.py | 1 - include/rnc/data_labels.h | 1 - include/rnc/game/item_state.h | 11 ++++++++--- include/rnc/game/options.h | 1 - src/game/missions/get_map_point_mission_status.c | 4 ++-- src/ui/map/draw_map_screen.c | 4 ++-- src/ui/map/slots/pick_next_map.c | 6 +++--- src/ui/menus/options/set_pause_sound_volume.c | 5 ++--- .../menus/pause/assign_heli_pack_label_text_table.c | 4 ++-- src/ui/vendor/render_vendor_buy_label_pass.c | 2 +- src/ui/vendor/render_vendor_item_details_pass.c | 3 +-- src/ui/vendor/render_vendor_purchase_prompt_pass.c | 2 +- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/configure.py b/configure.py index a25abbc4e8..e2d6a5f9f8 100755 --- a/configure.py +++ b/configure.py @@ -1191,7 +1191,6 @@ "audio/rpc/snd_send_iop_command_no_wait": (0x133100, 0x34080, 16), "rendering/frame/reset_gs_registers_pr": (0x151788, 0x52708, 24), "ui/help/find_help_entry": (0x199710, 0x9A690, 600), - "ui/menus/options/set_pause_sound_volume": (0x13E5A0, 0x3F520, 4), "ui/menus/selection/update_menu_item_slots": (0x141848, 0x427C8, 288), "ui/help/update_help_state": (0x141968, 0x428E8, 1184), "ui/help/push_help_history": (0x141E08, 0x42D88, 150), diff --git a/include/rnc/data_labels.h b/include/rnc/data_labels.h index 6bd64c332b..9091e61340 100644 --- a/include/rnc/data_labels.h +++ b/include/rnc/data_labels.h @@ -31,7 +31,6 @@ extern s32 D_0013D384 __attribute__((section(".data"))); extern unsigned char D_0013D3DD __attribute__((section(".data"))); extern unsigned char D_0013D3E2[]; extern unsigned char D_0013D3E9 __attribute__((section(".data"))); -extern u8 D_0013D4C2[]; extern unsigned char D_0013D4C6[]; extern unsigned char D_0013D4DA __attribute__((section(".data"))); extern unsigned char D_0013D4DC[]; diff --git a/include/rnc/game/item_state.h b/include/rnc/game/item_state.h index 8a9d23de1f..0c94fd1405 100644 --- a/include/rnc/game/item_state.h +++ b/include/rnc/game/item_state.h @@ -9,12 +9,17 @@ extern u8 alternate_item_available[128] __asm__("D_0013D388"); extern u8 item_unlocked[32] __asm__("D_0013D408"); extern s32 weapon_ammo_counts[37] __asm__("D_0013D428"); -extern u8 item_available[35] __asm__("D_0013D4C0"); -extern u8 discount_purchase_pricing[5] __asm__("D_0013D4E3") NOT_SDA; +/* item_available and items_acquired hold 37 items: mc_gamedata saves 0x25 bytes of each. + Single items read by name: 2 the heli-pack (hero jump code), 33 shifts map ids by + 0x100 (pick_next_map), 35 the vendor discount. */ +extern u8 item_available[37] __asm__("D_0013D4C0"); +#define ITEM_HELI_PACK 2 +#define ITEM_MAP_SHIFT 33 +#define ITEM_VENDOR_DISCOUNT 35 extern u8 item_text_variant[40] __asm__("D_0013E520"); extern u8 D_0015EDD0[] __attribute__((sda)); -extern u8 items_acquired[] __asm__("D_0013D4E8"); +extern u8 items_acquired[37] __asm__("D_0013D4E8"); extern s32 pause_iop_sprite_lists[8] __asm__("D_00141EA0"); extern s32 D_00141660; diff --git a/include/rnc/game/options.h b/include/rnc/game/options.h index ac9427d570..6c3330711d 100644 --- a/include/rnc/game/options.h +++ b/include/rnc/game/options.h @@ -3,7 +3,6 @@ #include "types.h" -extern int pause_sound_volume __asm__("D_0013E5A0") __attribute__((section(".data"))); extern u8 big_head_cheat_enabled __asm__("D_0015EDB0"); extern unsigned char opt_mirror_anim __asm__("D_0015EDB5"); extern int invert52 __asm__("D_0015EDDC"); diff --git a/src/game/missions/get_map_point_mission_status.c b/src/game/missions/get_map_point_mission_status.c index 160b4d5244..3f2e358653 100644 --- a/src/game/missions/get_map_point_mission_status.c +++ b/src/game/missions/get_map_point_mission_status.c @@ -2,7 +2,7 @@ #include "sda.h" #include "rnc/game/level_object_states.h" -extern unsigned char D_0013D4C2 NOT_SDA; +#include "rnc/game/item_state.h" /* Two flat `&&` returns over level_object_states[20/24/22].state; retail's reuse of the %hi register comes out by itself. */ int get_map_point_mission_status(void) __asm__("FUN_0020be80"); @@ -11,7 +11,7 @@ int get_map_point_mission_status(void) { if (level_object_states[20].state != 0 && level_object_states[24].state == 0) { return 1; } - if (level_object_states[24].state != 0 && D_0013D4C2 != 0 && + if (level_object_states[24].state != 0 && item_available[ITEM_HELI_PACK] != 0 && level_object_states[22].state == 0) { return 2; } diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index c5b6cbb26b..77a70f50f7 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -26,7 +26,7 @@ struct MapEntry { extern u8 map_cross_destination_page[] __asm__("D_001CF678"); extern u8 map_circle_destination_page[] __asm__("D_001CF418"); -extern u8 D_0013D4E1[]; +#include "rnc/game/item_state.h" #include "rnc/game/level_state.h" #include "rnc/ui/menus/menu_globals.h" @@ -130,7 +130,7 @@ s32 draw_map_screen(struct MenuScreen *screen) { } id = level_map_selection.level; - if (D_0013D4E1[0] != 0) { + if (item_available[ITEM_MAP_SHIFT] != 0) { id += 0x100; } slot = find_map_entry_slot(id); diff --git a/src/ui/map/slots/pick_next_map.c b/src/ui/map/slots/pick_next_map.c index fd7c28492d..c90bd19036 100644 --- a/src/ui/map/slots/pick_next_map.c +++ b/src/ui/map/slots/pick_next_map.c @@ -5,9 +5,9 @@ #include "rnc/ui/menus/menu_globals.h" #include "rnc/ui/map/slots/find_map_entry_slot.h" -extern unsigned char D_0013D4E1 NOT_SDA; +#include "rnc/game/item_state.h" /* Picks the map to load next: the current map id (level_map_selection.level, - +0x100 when D_0013D4E1 is set) unless find_map_entry_slot finds it already + +0x100 when item_available[ITEM_MAP_SHIFT] is set) unless find_map_entry_slot finds it already in a slot, otherwise the nearest entry of the 20-id list D_001601E0 around the current one (+1, -1, +2, -2, +3, -3) that is not loaded; -1 if none. The two bounds tests are nested so that fold does not @@ -16,7 +16,7 @@ extern unsigned char D_0013D4E1 NOT_SDA; int pick_next_map(void) __asm__("FUN_002050e8"); int pick_next_map(void) { - int map_id_offset = D_0013D4E1 ? 0x100 : 0; + int map_id_offset = item_available[ITEM_MAP_SHIFT] ? 0x100 : 0; int key; int i; int step; diff --git a/src/ui/menus/options/set_pause_sound_volume.c b/src/ui/menus/options/set_pause_sound_volume.c index c66edc4e21..2053e4ba6e 100644 --- a/src/ui/menus/options/set_pause_sound_volume.c +++ b/src/ui/menus/options/set_pause_sound_volume.c @@ -2,15 +2,14 @@ #include "types.h" #include "rnc/data_labels.h" #include "rnc/game/options.h" +#include "rnc/audio/voice_pool.h" extern s32 sound_volume_macro __asm__("D_0015EDF0") MACRO_ADDR; int set_pause_sound_volume(void) __asm__("FUN_0021cb00"); int set_pause_sound_volume(void) { - pause_sound_volume = sound_volume_macro * 8 / 10; + voice_pool.group_2_volume = sound_volume_macro * 8 / 10; return 0; } extern __typeof__(set_pause_sound_volume) func_0021CB00 __attribute__((alias("FUN_0021cb00"))); - -int pause_sound_volume NOT_SDA = 0; diff --git a/src/ui/menus/pause/assign_heli_pack_label_text_table.c b/src/ui/menus/pause/assign_heli_pack_label_text_table.c index adaeeb2d19..c97a5d1e35 100644 --- a/src/ui/menus/pause/assign_heli_pack_label_text_table.c +++ b/src/ui/menus/pause/assign_heli_pack_label_text_table.c @@ -2,7 +2,7 @@ #include "sda.h" #include "types.h" -extern unsigned char D_0013D4C2 NOT_SDA; +#include "rnc/game/item_state.h" extern s32 heli_pack_label_text_ids[14] __asm__("D_001D06D0"); extern s32 no_heli_pack_label_text_ids[14] __asm__("D_001D0708"); @@ -10,7 +10,7 @@ int assign_heli_pack_label_text_table(void *destination) __asm__("FUN_0021ca98") int assign_heli_pack_label_text_table(void *destination) { *(s32 **)((char *)destination + 0x34) = - (D_0013D4C2 != 0) ? heli_pack_label_text_ids : no_heli_pack_label_text_ids; + (item_available[ITEM_HELI_PACK] != 0) ? heli_pack_label_text_ids : no_heli_pack_label_text_ids; return 0; } diff --git a/src/ui/vendor/render_vendor_buy_label_pass.c b/src/ui/vendor/render_vendor_buy_label_pass.c index e0a6ee4142..78c2b94cb8 100644 --- a/src/ui/vendor/render_vendor_buy_label_pass.c +++ b/src/ui/vendor/render_vendor_buy_label_pass.c @@ -74,7 +74,7 @@ void render_vendor_buy_label_pass(char *unused, int width, int height) { message_id = 0x5234; } else { int cost; - if (discount_purchase_pricing[0] != 0) { + if (item_available[ITEM_VENDOR_DISCOUNT] != 0) { cost = vendor_item_prices [vendor_state_ptr->entries[vendor_state_ptr->selected_entry].item_index] diff --git a/src/ui/vendor/render_vendor_item_details_pass.c b/src/ui/vendor/render_vendor_item_details_pass.c index f030874086..abe3dbaeb2 100644 --- a/src/ui/vendor/render_vendor_item_details_pass.c +++ b/src/ui/vendor/render_vendor_item_details_pass.c @@ -33,8 +33,7 @@ extern Menu D_001E63C0; extern StatEntry D_001DFFB0[]; #include "rnc/game/item_state.h" -/* discount_purchase_pricing[0] (D_0013D4E3), read off the item_available base as retail does. */ -#define ITEM_DISCOUNT_FLAG item_available[0x23] +#define ITEM_DISCOUNT_FLAG item_available[ITEM_VENDOR_DISCOUNT] extern void draw_framebuffer_rect(s32, s32, s32, s32, s32, s32, s32) __asm__("func_001FB8F0"); extern void draw_moby_list(s32, s32) __asm__("func_0020D330"); diff --git a/src/ui/vendor/render_vendor_purchase_prompt_pass.c b/src/ui/vendor/render_vendor_purchase_prompt_pass.c index 6a333087ff..ba7eaf3913 100644 --- a/src/ui/vendor/render_vendor_purchase_prompt_pass.c +++ b/src/ui/vendor/render_vendor_purchase_prompt_pass.c @@ -63,7 +63,7 @@ void render_vendor_purchase_prompt_pass(void) { } id = 0x4EE0; } else { - if (discount_purchase_pricing[0] != 0) { + if (item_available[ITEM_VENDOR_DISCOUNT] != 0) { cost = D_001DFFB0[vendor_shop->slots[vendor_shop->cur].id].boltsHard; } else { cost = D_001DFFB0[vendor_shop->slots[vendor_shop->cur].id].bolts; From 4ed159cae039822a72a514626db4c4be7ad32910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:33:10 +0000 Subject: [PATCH 19/25] decomp: define the memory card state after the save paths memory_card_state (sizeof 0xF8) starts where memcard_get_name's save directory and file paths end; in retail link order it belongs to the same memory card unit. --- configure.py | 2 +- src/save/memcard_get_name.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index e2d6a5f9f8..ce4d92c569 100755 --- a/configure.py +++ b/configure.py @@ -1144,7 +1144,7 @@ "sdk/scf/sce_scf_get_time_zone": (0x1330D0, 0x34050, 2), # t10k_time_zone "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), - "save/memcard_get_name": (0x13D1D0, 0x3E150, 192), # the save directory and file paths + "save/memcard_get_name": (0x13D1D0, 0x3E150, 440), # the save paths and the memory card state "rendering/texture/append_palette_transfer_packet": (0x151B60, 0x52AE0, 656), "rendering/effects/render_queued_rotated_sprites": (0x189300, 0x8A280, 196), "camera/backup_current_cam": (0x1893D0, 0x8A350, 2112), diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index b21a86eb60..62567698ee 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -1,5 +1,6 @@ #include "types.h" #include "rnc/data_labels.h" +#include "rnc/save/memory_card_state.h" extern char *strncpy(char *, const char *, u32); void memcard_get_name(u8 *src) __asm__("FUN_00209030"); @@ -37,3 +38,5 @@ char D_0013D200[] = "/************RATCHET/icon.sys"; char D_0013D220[] = "/************RATCHET/static.ico"; char D_0013D240[] = "/************RATCHET/************RATCHET"; char D_0013D270[] = "/************RATCHET/save%d.bin"; + +struct MemoryCardState memory_card_state = {{{0, 0, 0, 0, 0, -3, 0, 0, {0}, 0, 0, 0}}, 0, 0, -1, 0, 0, 1, -1, 0, 0, -1, -1, 0, -1, 0, 0, 1}; From 22085e17717b16c3839d06ce20e48f320f2db43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:36:30 +0000 Subject: [PATCH 20/25] decomp: define the saved item tables after the memory card state alternate_item_available, item_unlocked, weapon_ammo_counts, item_available and items_acquired follow memory_card_state in the same unit, with the sizes the mc_gamedata save table gives (0x80, 0x20, 0x94, 0x25, 0x25). --- configure.py | 2 +- src/save/memcard_get_name.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index ce4d92c569..53057266c6 100755 --- a/configure.py +++ b/configure.py @@ -1144,7 +1144,7 @@ "sdk/scf/sce_scf_get_time_zone": (0x1330D0, 0x34050, 2), # t10k_time_zone "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), - "save/memcard_get_name": (0x13D1D0, 0x3E150, 440), # the save paths and the memory card state + "save/memcard_get_name": (0x13D1D0, 0x3E150, 829), # save paths, card state, item tables "rendering/texture/append_palette_transfer_packet": (0x151B60, 0x52AE0, 656), "rendering/effects/render_queued_rotated_sprites": (0x189300, 0x8A280, 196), "camera/backup_current_cam": (0x1893D0, 0x8A350, 2112), diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index 62567698ee..ac1dae5042 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -1,6 +1,8 @@ #include "types.h" #include "rnc/data_labels.h" #include "rnc/save/memory_card_state.h" +#include "rnc/game/item_state.h" +#include "rnc/game/item_state.h" extern char *strncpy(char *, const char *, u32); void memcard_get_name(u8 *src) __asm__("FUN_00209030"); @@ -40,3 +42,13 @@ char D_0013D240[] = "/************RATCHET/************RATCHET"; char D_0013D270[] = "/************RATCHET/save%d.bin"; struct MemoryCardState memory_card_state = {{{0, 0, 0, 0, 0, -3, 0, 0, {0}, 0, 0, 0}}, 0, 0, -1, 0, 0, 1, -1, 0, 0, -1, -1, 0, -1, 0, 0, 1}; + +u8 alternate_item_available[128] = {0}; + +u8 item_unlocked[32] = {0}; + +s32 weapon_ammo_counts[37] = {0}; + +u8 item_available[37] = {0}; + +u8 items_acquired[37] = {0}; From 1793f361cd4edfe847ad62d33169bc9cc20043ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:40:34 +0000 Subject: [PATCH 21/25] decomp: define the rest of the saved globals before the level render state The save-table globals from D_0013D510 to the per-level hero counters (0x13D510-0x13E028) continue memcard_get_name's range. Sizes: mc_gamedata and mc_leveldata rows (0x50, 0x790 = 121 level object records, 0x14, 0x94 = 37 weapon counters, 4 bytes x 20 levels); the per-level coverage best between them has one slot per level record. Weapon counter names come from the level code that reads them. --- configure.py | 2 +- include/rnc/data_labels.h | 1 - include/rnc/game/item_state.h | 4 ++++ include/rnc/game/level_object_states.h | 4 +++- include/rnc/game/level_progress.h | 9 +++++++++ src/save/memcard_get_name.c | 25 ++++++++++++++++++++++++- src/ui/map/coverage/save_map_coverage.c | 2 +- 7 files changed, 42 insertions(+), 5 deletions(-) diff --git a/configure.py b/configure.py index 53057266c6..1072fda194 100755 --- a/configure.py +++ b/configure.py @@ -1144,7 +1144,7 @@ "sdk/scf/sce_scf_get_time_zone": (0x1330D0, 0x34050, 2), # t10k_time_zone "sdk/scf/sce_scf_get_language": (0x1330D4, 0x34054, 1), "movies/display/set_pal_mode": (0x13D100, 0x3E080, 8), - "save/memcard_get_name": (0x13D1D0, 0x3E150, 829), # save paths, card state, item tables + "save/memcard_get_name": (0x13D1D0, 0x3E150, 3672), # save paths, card state, saved globals "rendering/texture/append_palette_transfer_packet": (0x151B60, 0x52AE0, 656), "rendering/effects/render_queued_rotated_sprites": (0x189300, 0x8A280, 196), "camera/backup_current_cam": (0x1893D0, 0x8A350, 2112), diff --git a/include/rnc/data_labels.h b/include/rnc/data_labels.h index 9091e61340..e923119862 100644 --- a/include/rnc/data_labels.h +++ b/include/rnc/data_labels.h @@ -37,7 +37,6 @@ extern unsigned char D_0013D4DC[]; extern unsigned char D_0013D504[]; extern int D_0013D8AC __attribute__((section(".data"))); extern unsigned char D_0013DD4A __attribute__((section(".data"))); -extern s32 D_0013DF88[]; extern u8 D_0013E05A[]; extern char D_0013E533[]; extern char D_0013F3D0[]; diff --git a/include/rnc/game/item_state.h b/include/rnc/game/item_state.h index 0c94fd1405..8daa0e3b66 100644 --- a/include/rnc/game/item_state.h +++ b/include/rnc/game/item_state.h @@ -20,6 +20,10 @@ extern u8 item_text_variant[40] __asm__("D_0013E520"); extern u8 D_0015EDD0[] __attribute__((sda)); extern u8 items_acquired[37] __asm__("D_0013D4E8"); +/* Per-weapon totals (37 items, mc_gamedata blocks 0x3E8-0x3EA of 0x94 bytes). */ +extern s32 D_0013DD70[37]; +extern s32 weapon_ammo_pickup_totals[37] __asm__("D_0013DE08"); +extern s32 weapon_ammo_used_counts[37] __asm__("D_0013DEA0"); extern s32 pause_iop_sprite_lists[8] __asm__("D_00141EA0"); extern s32 D_00141660; diff --git a/include/rnc/game/level_object_states.h b/include/rnc/game/level_object_states.h index 07f52ab6e5..086037bf68 100644 --- a/include/rnc/game/level_object_states.h +++ b/include/rnc/game/level_object_states.h @@ -16,6 +16,8 @@ struct LevelObjectState { s32 state; /* 0xC: 0 untouched, set to 1 once triggered; mission checks also test >= 2 */ }; -extern struct LevelObjectState level_object_states[] __asm__("D_0013D5B0"); +/* mc_gamedata saves the whole table: 0x790 bytes, 121 records. */ +#define LEVEL_OBJECT_STATE_COUNT 121 +extern struct LevelObjectState level_object_states[LEVEL_OBJECT_STATE_COUNT] __asm__("D_0013D5B0"); #endif /* LOMBYTE_RNC_GAME_LEVEL_OBJECT_STATES_H */ diff --git a/include/rnc/game/level_progress.h b/include/rnc/game/level_progress.h index fc3f7ab699..6e22527f6f 100644 --- a/include/rnc/game/level_progress.h +++ b/include/rnc/game/level_progress.h @@ -9,6 +9,15 @@ mc_leveldata lists each array with its row size. */ #define LEVEL_RECORD_COUNT 20 +/* Per-level counters of the main save (mc_gamedata saves 0x50 bytes of each). */ +extern s32 D_0013D510[LEVEL_RECORD_COUNT]; +/* Best coverage result save_map_coverage got per level (one slot per level record). */ +extern s32 max_coverage_save_result_by_level[LEVEL_RECORD_COUNT] __asm__("D_0013D560"); +/* Per-level counters the hero code bumps; mc_leveldata saves 4 bytes of each per level. */ +extern s32 D_0013DF38[LEVEL_RECORD_COUNT]; +extern s32 D_0013DF88[LEVEL_RECORD_COUNT]; +extern s32 hero_respawn_counts_by_level[LEVEL_RECORD_COUNT] __asm__("D_0013DFD8"); + /* Explored map pages: save_map_coverage packs one 0x800-byte page per level. */ #define MAP_COVERAGE_PAGE_SIZE 0x800 extern u8 map_coverage_pages[LEVEL_RECORD_COUNT * MAP_COVERAGE_PAGE_SIZE] __asm__("D_00141EC0"); diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index ac1dae5042..00b15e6c7a 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -2,7 +2,8 @@ #include "rnc/data_labels.h" #include "rnc/save/memory_card_state.h" #include "rnc/game/item_state.h" -#include "rnc/game/item_state.h" +#include "rnc/game/level_object_states.h" +#include "rnc/game/level_state.h" extern char *strncpy(char *, const char *, u32); void memcard_get_name(u8 *src) __asm__("FUN_00209030"); @@ -52,3 +53,25 @@ s32 weapon_ammo_counts[37] = {0}; u8 item_available[37] = {0}; u8 items_acquired[37] = {0}; + +s32 D_0013D510[LEVEL_RECORD_COUNT] = {0}; + +s32 max_coverage_save_result_by_level[LEVEL_RECORD_COUNT] = {0}; + +struct LevelObjectState level_object_states[LEVEL_OBJECT_STATE_COUNT] = {0}; + +u8 level_available[20] = {0}; + +u8 level_visit_state[20] = {0}; + +s32 D_0013DD70[37] = {0}; + +s32 weapon_ammo_pickup_totals[37] = {0}; + +s32 weapon_ammo_used_counts[37] = {0}; + +s32 D_0013DF38[LEVEL_RECORD_COUNT] = {0}; + +s32 D_0013DF88[LEVEL_RECORD_COUNT] = {0}; + +s32 hero_respawn_counts_by_level[LEVEL_RECORD_COUNT] = {0}; diff --git a/src/ui/map/coverage/save_map_coverage.c b/src/ui/map/coverage/save_map_coverage.c index 51ac414836..2d637440ec 100644 --- a/src/ui/map/coverage/save_map_coverage.c +++ b/src/ui/map/coverage/save_map_coverage.c @@ -1,9 +1,9 @@ #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/globals.h" #include "rnc/ui/map/map_state.h" #include "rnc/runtime/callbacks.h" -extern s32 max_coverage_save_result_by_level[] __asm__("D_0013D560"); extern void fill_transfer_words() __asm__("func_001F97E8"); extern s32 func_001FA860(); extern void downsample_map_coverage() __asm__("func_00208030"); From 6d23440914c18cc46ca87e30cb1634f27dbd0be0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:46:42 +0000 Subject: [PATCH 22/25] decomp: define small data in the one unit that reads it through $gp Each of these scalars is reached with a gp-relative access in exactly one unit (the defining file under SN's small-data rule) and with lui in the others: the sound options volumes, the help history record count, the pending space load flag, process_moby_anim_data's second argument, the zone lookup tables of find_zone_at_point and the shrub instance pointer next to initialize_level_render_state's other small data. --- configure.py | 7 ++++++- src/game/transitions/transition_do_transition.c | 2 ++ src/mobys/animation/process_moby_anim_data.c | 2 ++ src/rendering/frame/initialize_level_render_state.c | 2 ++ src/ui/help/push_help_history.c | 2 ++ src/ui/menus/options/sound_options_menu.c | 7 +++++++ src/world/find_zone_at_point.c | 6 ++++++ 7 files changed, 27 insertions(+), 1 deletion(-) diff --git a/configure.py b/configure.py index 1072fda194..6e49f66315 100755 --- a/configure.py +++ b/configure.py @@ -1064,6 +1064,11 @@ # file offset, size) of the unit's `.sdata`, which retail kept inside the # preserved small-data blobs (core.lit / .lit). Placed like RODATA_OVERLAYS. SDATA_OVERLAYS = { + "ui/menus/options/sound_options_menu": (0x15EDE8, 0x5FD68, 12), + "ui/help/push_help_history": (0x15EE30, 0x5FDB0, 4), + "game/transitions/transition_do_transition": (0x15F5B0, 0x60530, 4), + "mobys/animation/process_moby_anim_data": (0x15F63C, 0x605BC, 4), + "world/find_zone_at_point": (0x161190, 0x62110, 12), "audio/rpc/snd_returns": (0x15EC80, 0x5FC00, 8), "audio/snd_start_sound_system": (0x15ECA0, 0x5FC20, 32), # the batch buffer pointers it sets up "rendering/debug/print_debug_text": (0x15F000, 0x5FF80, 11), @@ -1082,7 +1087,7 @@ "rendering/texture/reset_gs_texture_allocation": (0x15EF20, 0x5FEA0, 4), "game/load_level_zero_preserving_progress": (0x15EDA0, 0x5FD20, 4), "game/transitions/tick_space_transition": (0x15F5EC, 0x6056C, 4), - "rendering/frame/initialize_level_render_state": (0x1603D0, 0x61350, 4), + "rendering/frame/initialize_level_render_state": (0x1603D0, 0x61350, 8), "camera/resolve_camera_surface_height": (0x1611A0, 0x62120, 4), "rendering/view/update_fog": (0x1610C4, 0x62044, 3), "rendering/texture/dma_shrub_textures": (0x1603F8, 0x61378, 4), diff --git a/src/game/transitions/transition_do_transition.c b/src/game/transitions/transition_do_transition.c index 5925849f4d..b3ff0b67bc 100644 --- a/src/game/transitions/transition_do_transition.c +++ b/src/game/transitions/transition_do_transition.c @@ -230,3 +230,5 @@ SoundCue transition_sound_cues[6] = { {0x114, 0x12c, 1, -1}, { -1, 0, 0, 0}, }; + +s32 space_load_pending = 0; diff --git a/src/mobys/animation/process_moby_anim_data.c b/src/mobys/animation/process_moby_anim_data.c index 3d0fdc32f8..60d4a4cc15 100644 --- a/src/mobys/animation/process_moby_anim_data.c +++ b/src/mobys/animation/process_moby_anim_data.c @@ -271,3 +271,5 @@ f32 normal_lut[256][2] = { {0.99879545f, -0.04906764f}, {0.9996988f, -0.024541123f}, }; + +s32 D_0015F63C = 0; diff --git a/src/rendering/frame/initialize_level_render_state.c b/src/rendering/frame/initialize_level_render_state.c index 6eaf562224..0a0d410017 100644 --- a/src/rendering/frame/initialize_level_render_state.c +++ b/src/rendering/frame/initialize_level_render_state.c @@ -477,3 +477,5 @@ s32 shrub_count = 0; MobyGrids moby_grids = {0}; u32 moby_grid_block_bitmap[24] = {0}; + +ShrubInstance *shrubs = 0; diff --git a/src/ui/help/push_help_history.c b/src/ui/help/push_help_history.c index 35d003d22b..d6e4926ca3 100644 --- a/src/ui/help/push_help_history.c +++ b/src/ui/help/push_help_history.c @@ -29,3 +29,5 @@ void push_help_history(s32 id) { extern __typeof__(push_help_history) func_001FED30 __attribute__((alias("FUN_001fed30"))); u8 active_message_records[HELP_ENTRY_COUNT] = {0}; + +s32 active_message_record_count = 1; diff --git a/src/ui/menus/options/sound_options_menu.c b/src/ui/menus/options/sound_options_menu.c index 421b92fdb0..a9173f9e49 100644 --- a/src/ui/menus/options/sound_options_menu.c +++ b/src/ui/menus/options/sound_options_menu.c @@ -4,6 +4,7 @@ #include "sda.h" #include "rnc/audio/mixer/snd_set_playback_mode.h" #include "rnc/audio/voice_pool.h" +#include "rnc/game/options.h" struct SoundMenu { u8 pad_0[0x14]; @@ -96,3 +97,9 @@ s32 sound_options_menu(struct SoundMenu *menu) { } return 0; } + +s32 playback_mode = 1; + +s32 music_volume = 0x2cc; + +s32 sound_volume = 0x400; diff --git a/src/world/find_zone_at_point.c b/src/world/find_zone_at_point.c index 1f044d390e..48138f6708 100644 --- a/src/world/find_zone_at_point.c +++ b/src/world/find_zone_at_point.c @@ -54,3 +54,9 @@ int find_zone_at_point(float x, float y, float z) { } extern __typeof__(find_zone_at_point) func_00239D60 __attribute__((alias("FUN_00239d60"))); + +s32 surface_height_tiles = 0; + +s32 occl_cell_table = 0; + +s32 occl_cell_count = 0; From 066548b716620a810d5e021316a16e8c64645148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 12:56:13 +0000 Subject: [PATCH 23/25] decomp: read the item flags through item_available in level code and prove the level copies of the new boot data --- config/us/levels/exe_data.tsv | 1063 ++++++++++++++++- src/overlays/l11/mobys/fred_pokitaru.c | 4 +- src/overlays/l11/mobys/pokitaru_pickup.c | 5 +- .../shared/vendor/draw_vendor_purchase_text.c | 2 +- src/overlays/shared/vendor/vendor_menu.c | 2 +- 5 files changed, 1013 insertions(+), 63 deletions(-) diff --git a/config/us/levels/exe_data.tsv b/config/us/levels/exe_data.tsv index 6d6030227a..efcf15fb23 100644 --- a/config/us/levels/exe_data.tsv +++ b/config/us/levels/exe_data.tsv @@ -3,17 +3,52 @@ # level address size 00 0015EF4C 4 00 0015EF58 12 +00 0015F340 179 00 0015F5AC 4 -00 0015F648 4 +00 0015F5FC 4 +00 0015F640 12 +00 0015F748 8 +00 0015FAF8 14 +00 0015FC30 75 +00 0015FF30 21 +00 0015FF80 12 +00 0015FF90 10 +00 0015FFA0 26 00 0015FFBC 4 +00 00160004 8 +00 00160090 12 +00 00160128 5 +00 00160130 41 +00 00160330 31 +00 00160368 12 +00 00160378 17 +00 00160398 10 +00 001603A8 8 +00 001603B0 10 +00 001603C0 47 +00 00160470 27 +00 00160490 8 00 001604B8 4 +00 00160510 9 +00 00160534 4 +00 001607E0 16 +00 00160910 16 +00 00160920 16 +00 001609A0 16 +00 00160F30 27 00 00160F84 4 00 00160FE4 4 +00 00161158 11 00 001611A0 4 00 001611C4 4 00 00161204 3 +00 001612D0 12 00 001612E0 4 +00 00161338 14 +00 00161358 4 +00 00161360 4 00 00166000 128 +00 00166080 2048 00 00167040 272 00 00167150 7680 00 00169040 196 @@ -34,6 +69,7 @@ 00 0017E530 80 00 00182A70 304 00 001844B0 20 +00 00186CC0 76 00 00196CC0 64 00 00196F80 896 00 00197300 4288 @@ -44,6 +80,7 @@ 00 001AFCE0 1152 00 001B0180 200 00 001B1860 16 +00 001B9120 96 00 001B9198 588 00 001B93E8 1776 00 001B9CA0 80 @@ -53,7 +90,8 @@ 00 001BA1B8 40 00 001BA1E0 212 00 001BA2B8 256 -00 001BC130 128 +00 001BBF50 224 +00 001BC030 384 00 001BD8B0 224 00 001BD990 384 00 001BDB10 56 @@ -63,7 +101,8 @@ 00 001BDD80 96 00 001BDDE0 13504 00 001C12A0 1080 -00 001C1F28 320 +00 001C1E40 552 +00 001C20B8 76 00 001C28F0 64 00 001C44B8 80 00 001C5800 768 @@ -72,22 +111,67 @@ 00 001CA318 96 00 001CA4FC 4 00 001CA720 64 +00 001E8B18 17 +00 001E8B30 64 +00 001E8C80 19 +00 001E8E10 35 +00 001E90F8 36 00 001E91C8 60 00 001E9270 24 +00 001E9428 28 +00 001E94B0 21 +00 001E9570 71 00 001E9700 18 +00 001E9718 21 +00 001E9730 20 +00 001E9748 57 01 0015EF4C 4 01 0015EF58 12 +01 0015F340 179 01 0015F5AC 4 -01 0015F648 4 +01 0015F5FC 4 +01 0015F640 12 +01 0015F748 8 +01 0015FAF8 14 +01 0015FC30 75 +01 0015FF30 21 +01 0015FF80 12 +01 0015FF90 10 +01 0015FFA0 26 01 0015FFBC 4 +01 00160004 8 +01 00160090 12 +01 00160128 5 +01 00160130 41 +01 00160330 31 +01 00160368 12 +01 00160378 17 +01 00160398 10 +01 001603A8 8 +01 001603B0 10 +01 001603C0 47 +01 00160470 27 +01 00160490 8 01 001604B8 4 +01 00160510 9 +01 00160534 4 +01 001607E0 16 +01 00160910 16 +01 00160920 16 +01 001609A0 16 +01 00160F30 27 01 00160F84 4 01 00160FE4 4 +01 00161158 11 01 001611A0 4 01 001611C4 4 01 00161204 3 +01 001612D0 12 01 001612E0 4 +01 00161358 4 +01 00161360 4 01 00166480 128 +01 00166500 2048 01 001674C0 272 01 001675D0 7680 01 001694C0 196 @@ -108,6 +192,7 @@ 01 0017E9B0 80 01 00182EF0 304 01 00184930 20 +01 00187140 76 01 00197140 64 01 00197400 896 01 00197780 4288 @@ -118,6 +203,7 @@ 01 001B0160 1152 01 001B0600 200 01 001B1CE0 16 +01 001B95A0 96 01 001B9618 588 01 001B9868 1776 01 001BA120 80 @@ -127,7 +213,8 @@ 01 001BA638 40 01 001BA660 212 01 001BA738 256 -01 001BC5B0 128 +01 001BC3D0 224 +01 001BC4B0 384 01 001BDD30 224 01 001BDE10 384 01 001BDF90 56 @@ -137,7 +224,8 @@ 01 001BE200 96 01 001BE260 13504 01 001C1720 1080 -01 001C23A8 320 +01 001C22C0 552 +01 001C2538 76 01 001C2D70 64 01 001C4938 80 01 001C5C80 768 @@ -146,22 +234,68 @@ 01 001CA798 96 01 001CA97C 4 01 001CABA0 64 +01 00209B78 17 +01 00209B90 64 +01 00209CE0 19 +01 00209E70 35 +01 0020A158 36 01 0020A228 60 01 0020A2D0 24 +01 0020A488 28 +01 0020A510 21 +01 0020A5D0 71 01 0020A760 18 +01 0020A778 21 +01 0020A790 20 +01 0020A7A8 57 02 0015EF4C 4 02 0015EF58 12 +02 0015F340 179 02 0015F5AC 4 -02 0015F648 4 +02 0015F5FC 4 +02 0015F640 12 +02 0015F748 8 +02 0015FAF8 14 +02 0015FC30 75 +02 0015FF30 21 +02 0015FF80 12 +02 0015FF90 10 +02 0015FFA0 26 02 0015FFBC 4 +02 00160004 8 +02 00160090 12 +02 00160128 5 +02 00160130 41 +02 00160330 31 +02 00160368 12 +02 00160378 17 +02 00160398 10 +02 001603A8 8 +02 001603B0 10 +02 001603C0 47 +02 00160470 27 +02 00160490 8 02 001604B8 4 +02 00160510 9 +02 00160534 4 +02 001607E0 16 +02 00160910 16 +02 00160920 16 +02 001609A0 16 +02 00160F30 27 02 00160F84 4 02 00160FE4 4 +02 00161158 11 02 001611A0 4 02 001611C4 4 02 00161204 3 +02 001612D0 12 02 001612E0 4 +02 00161338 14 +02 00161358 4 +02 00161360 4 02 00166600 128 +02 00166680 2048 02 00167640 272 02 00167750 7680 02 00169640 196 @@ -182,6 +316,7 @@ 02 0017EB30 80 02 00183070 304 02 00184AB0 20 +02 001872C0 76 02 001972C0 64 02 00197580 896 02 00197900 4288 @@ -192,6 +327,7 @@ 02 001B02E0 1152 02 001B0780 200 02 001B1E60 16 +02 001B9720 96 02 001B9798 588 02 001B99E8 1776 02 001BA2A0 80 @@ -201,7 +337,8 @@ 02 001BA7B8 40 02 001BA7E0 212 02 001BA8B8 256 -02 001BC730 128 +02 001BC550 224 +02 001BC630 384 02 001BDEB0 224 02 001BDF90 384 02 001BE110 56 @@ -211,7 +348,8 @@ 02 001BE380 96 02 001BE3E0 13504 02 001C18A0 1080 -02 001C2528 320 +02 001C2440 552 +02 001C26B8 76 02 001C2EF0 64 02 001C4AB8 80 02 001C5E00 768 @@ -220,22 +358,68 @@ 02 001CA918 96 02 001CAAFC 4 02 001CAD20 64 +02 001F9418 17 +02 001F9430 64 +02 001F9580 19 +02 001F9710 35 +02 001F99F8 36 02 001F9AC8 60 02 001F9B70 24 +02 001F9D28 28 +02 001F9DB0 21 +02 001F9E70 71 02 001FA000 18 +02 001FA018 21 +02 001FA030 20 +02 001FA048 57 03 0015EF4C 4 03 0015EF58 12 +03 0015F340 179 03 0015F5AC 4 -03 0015F648 4 +03 0015F5FC 4 +03 0015F640 12 +03 0015F748 8 +03 0015FAF8 14 +03 0015FC30 75 +03 0015FF30 21 +03 0015FF80 12 +03 0015FF90 10 +03 0015FFA0 26 03 0015FFBC 4 +03 00160004 8 +03 00160090 12 +03 00160128 5 +03 00160130 41 +03 00160330 31 +03 00160368 12 +03 00160378 17 +03 00160398 10 +03 001603A8 8 +03 001603B0 10 +03 001603C0 47 +03 00160470 27 +03 00160490 8 03 001604B8 4 +03 00160510 9 +03 00160534 4 +03 001607E0 16 +03 00160910 16 +03 00160920 16 +03 001609A0 16 +03 00160F30 27 03 00160F84 4 03 00160FE4 4 +03 00161158 11 03 001611A0 4 03 001611C4 4 03 00161204 3 +03 001612D0 12 03 001612E0 4 +03 00161338 14 +03 00161358 4 +03 00161360 4 03 00166100 128 +03 00166180 2048 03 00167140 272 03 00167250 7680 03 00169140 196 @@ -256,6 +440,7 @@ 03 0017E630 80 03 00182B70 304 03 001845B0 20 +03 00186DC0 76 03 00196DC0 64 03 00197080 896 03 00197400 4288 @@ -266,6 +451,7 @@ 03 001AFDE0 1152 03 001B0280 200 03 001B1960 16 +03 001B9220 96 03 001B9298 588 03 001B94E8 1776 03 001B9DA0 80 @@ -275,7 +461,8 @@ 03 001BA2B8 40 03 001BA2E0 212 03 001BA3B8 256 -03 001BC230 128 +03 001BC050 224 +03 001BC130 384 03 001BD9B0 224 03 001BDA90 384 03 001BDC10 56 @@ -285,7 +472,8 @@ 03 001BDE80 96 03 001BDEE0 13504 03 001C13A0 1080 -03 001C2028 320 +03 001C1F40 552 +03 001C21B8 76 03 001C29F0 64 03 001C45B8 80 03 001C5900 768 @@ -294,22 +482,68 @@ 03 001CA418 96 03 001CA5FC 4 03 001CA820 64 +03 001E1798 17 +03 001E17B0 64 +03 001E1900 19 +03 001E1A90 35 +03 001E1D78 36 03 001E1E48 60 03 001E1EF0 24 +03 001E20A8 28 +03 001E2130 21 +03 001E21F0 71 03 001E2380 18 +03 001E2398 21 +03 001E23B0 20 +03 001E23C8 57 04 0015EF4C 4 04 0015EF58 12 +04 0015F340 179 04 0015F5AC 4 -04 0015F648 4 +04 0015F5FC 4 +04 0015F640 12 +04 0015F748 8 +04 0015FAF8 14 +04 0015FC30 75 +04 0015FF30 21 +04 0015FF80 12 +04 0015FF90 10 +04 0015FFA0 26 04 0015FFBC 4 +04 00160004 8 +04 00160090 12 +04 00160128 5 +04 00160130 41 +04 00160330 31 +04 00160368 12 +04 00160378 17 +04 00160398 10 +04 001603A8 8 +04 001603B0 10 +04 001603C0 47 +04 00160470 27 +04 00160490 8 04 001604B8 4 +04 00160510 9 +04 00160534 4 +04 001607E0 16 +04 00160910 16 +04 00160920 16 +04 001609A0 16 +04 00160F30 27 04 00160F84 4 04 00160FE4 4 +04 00161158 11 04 001611A0 4 04 001611C4 4 04 00161204 3 +04 001612D0 12 04 001612E0 4 +04 00161338 14 +04 00161358 4 +04 00161360 4 04 00166180 128 +04 00166200 2048 04 001671C0 272 04 001672D0 7680 04 001691C0 196 @@ -330,6 +564,7 @@ 04 0017E6B0 80 04 00182BF0 304 04 00184630 20 +04 00186E40 76 04 00196E40 64 04 00197100 896 04 00197480 4288 @@ -340,6 +575,7 @@ 04 001AFE60 1152 04 001B0300 200 04 001B19E0 16 +04 001B92A0 96 04 001B9318 588 04 001B9568 1776 04 001B9E20 80 @@ -349,7 +585,8 @@ 04 001BA338 40 04 001BA360 212 04 001BA438 256 -04 001BC2B0 128 +04 001BC0D0 224 +04 001BC1B0 384 04 001BDA30 224 04 001BDB10 384 04 001BDC90 56 @@ -359,7 +596,8 @@ 04 001BDF00 96 04 001BDF60 13504 04 001C1420 1080 -04 001C20A8 320 +04 001C1FC0 552 +04 001C2238 76 04 001C2A70 64 04 001C4638 80 04 001C5980 768 @@ -368,22 +606,68 @@ 04 001CA498 96 04 001CA67C 4 04 001CA8A0 64 +04 001DA8B8 17 +04 001DA8D0 64 +04 001DAA20 19 +04 001DABB0 35 +04 001DAE98 36 04 001DAF68 60 04 001DB010 24 +04 001DB1C8 28 +04 001DB250 21 +04 001DB310 71 04 001DB4A0 18 +04 001DB4B8 21 +04 001DB4D0 20 +04 001DB4E8 57 05 0015EF4C 4 05 0015EF58 12 +05 0015F340 179 05 0015F5AC 4 -05 0015F648 4 +05 0015F5FC 4 +05 0015F640 12 +05 0015F758 8 +05 0015FB08 14 +05 0015FC30 75 +05 0015FF30 21 +05 0015FF80 12 +05 0015FF90 10 +05 0015FFA0 26 05 0015FFBC 4 +05 00160004 8 +05 00160090 12 +05 00160128 5 +05 00160130 41 +05 00160330 31 +05 00160368 12 +05 00160378 17 +05 00160398 10 +05 001603A8 8 +05 001603B0 10 +05 001603C0 47 +05 00160470 27 +05 00160490 8 05 001604B8 4 +05 00160510 9 +05 00160534 4 +05 001607E0 16 +05 00160910 16 +05 00160920 16 +05 001609A0 16 +05 00160F30 27 05 00160F84 4 05 00160FE4 4 +05 00161158 11 05 001611A0 4 05 001611C4 4 05 00161204 3 +05 001612D0 12 05 001612E0 4 +05 00161338 14 +05 00161358 4 +05 00161360 4 05 00166400 128 +05 00166480 2048 05 00167440 272 05 00167550 7680 05 00169440 196 @@ -404,6 +688,7 @@ 05 0017E9B0 80 05 00182EF0 304 05 00184930 20 +05 00187140 76 05 00197140 64 05 00197400 896 05 00197780 4288 @@ -414,6 +699,7 @@ 05 001B0160 1152 05 001B0600 200 05 001B1CE0 16 +05 001B95A0 96 05 001B9618 588 05 001B9868 1776 05 001BA120 80 @@ -423,7 +709,8 @@ 05 001BA638 40 05 001BA660 212 05 001BA738 256 -05 001BC5B0 128 +05 001BC3D0 224 +05 001BC4B0 384 05 001BDD30 224 05 001BDE10 384 05 001BDF90 56 @@ -433,7 +720,8 @@ 05 001BE200 96 05 001BE260 13504 05 001C1720 1080 -05 001C23A8 320 +05 001C22C0 552 +05 001C2538 76 05 001C2D70 64 05 001C4938 80 05 001C5C80 768 @@ -442,22 +730,68 @@ 05 001CA798 96 05 001CA97C 4 05 001CABA0 64 +05 00217228 17 +05 00217240 64 +05 00217390 19 +05 00217520 35 +05 00217808 36 05 002178D8 60 05 00217980 24 +05 00217B38 28 +05 00217BC0 21 +05 00217C80 71 05 00217E10 18 +05 00217E28 21 +05 00217E40 20 +05 00217E58 57 06 0015EF4C 4 06 0015EF58 12 +06 0015F340 179 06 0015F5AC 4 -06 0015F648 4 +06 0015F5FC 4 +06 0015F640 12 +06 0015F748 8 +06 0015FAF8 14 +06 0015FC30 75 +06 0015FF30 21 +06 0015FF80 12 +06 0015FF90 10 +06 0015FFA0 26 06 0015FFBC 4 +06 00160004 8 +06 00160090 12 +06 00160128 5 +06 00160130 41 +06 00160330 31 +06 00160368 12 +06 00160378 17 +06 00160398 10 +06 001603A8 8 +06 001603B0 10 +06 001603C0 47 +06 00160470 27 +06 00160490 8 06 001604B8 4 +06 00160510 9 +06 00160534 4 +06 001607E0 16 +06 00160910 16 +06 00160920 16 +06 001609A0 16 +06 00160F30 27 06 00160F84 4 06 00160FE4 4 +06 00161158 11 06 001611A0 4 06 001611C4 4 06 00161204 3 +06 001612D0 12 06 001612E0 4 +06 00161338 14 +06 00161358 4 +06 00161360 4 06 00166780 128 +06 00166800 2048 06 001677C0 272 06 001678D0 7680 06 001697C0 196 @@ -478,6 +812,7 @@ 06 0017ECB0 80 06 001831F0 304 06 00184C30 20 +06 00187440 76 06 00197440 64 06 00197700 896 06 00197A80 4288 @@ -488,6 +823,7 @@ 06 001B0460 1152 06 001B0900 200 06 001B1FE0 16 +06 001B98A0 96 06 001B9918 588 06 001B9B68 1776 06 001BA420 80 @@ -497,7 +833,8 @@ 06 001BA938 40 06 001BA960 212 06 001BAA38 256 -06 001BC8B0 128 +06 001BC6D0 224 +06 001BC7B0 384 06 001BE030 224 06 001BE110 384 06 001BE290 56 @@ -507,7 +844,8 @@ 06 001BE500 96 06 001BE560 13504 06 001C1A20 1080 -06 001C26A8 320 +06 001C25C0 552 +06 001C2838 76 06 001C3070 64 06 001C4C38 80 06 001C5F80 768 @@ -516,22 +854,68 @@ 06 001CAA98 96 06 001CAC7C 4 06 001CAEA0 64 +06 001FFF18 17 +06 001FFF30 64 +06 00200080 19 +06 00200210 35 +06 002004F8 36 06 002005C8 60 06 00200670 24 +06 00200828 28 +06 002008B0 21 +06 00200970 71 06 00200B00 18 +06 00200B18 21 +06 00200B30 20 +06 00200B48 57 07 0015EF4C 4 07 0015EF58 12 +07 0015F340 179 07 0015F5AC 4 -07 0015F648 4 +07 0015F5FC 4 +07 0015F640 12 +07 0015F748 8 +07 0015FAF8 14 +07 0015FC30 75 +07 0015FF30 21 +07 0015FF80 12 +07 0015FF90 10 +07 0015FFA0 26 07 0015FFBC 4 +07 00160004 8 +07 00160090 12 +07 00160128 5 +07 00160130 41 +07 00160330 31 +07 00160368 12 +07 00160378 17 +07 00160398 10 +07 001603A8 8 +07 001603B0 10 +07 001603C0 47 +07 00160470 27 +07 00160490 8 07 001604B8 4 +07 00160510 9 +07 00160534 4 +07 001607E0 16 +07 00160910 16 +07 00160920 16 +07 001609A0 16 +07 00160F30 27 07 00160F84 4 07 00160FE4 4 +07 00161158 11 07 001611A0 4 07 001611C4 4 07 00161204 3 +07 001612D0 12 07 001612E0 4 +07 00161338 14 +07 00161358 4 +07 00161360 4 07 00166080 128 +07 00166100 2048 07 001670C0 272 07 001671D0 7680 07 001690C0 196 @@ -552,6 +936,7 @@ 07 0017E5B0 80 07 00182AF0 304 07 00184530 20 +07 00186D40 76 07 00196D40 64 07 00197000 896 07 00197380 4288 @@ -562,6 +947,7 @@ 07 001AFD60 1152 07 001B0200 200 07 001B18E0 16 +07 001B91A0 96 07 001B9218 588 07 001B9468 1776 07 001B9D20 80 @@ -571,7 +957,8 @@ 07 001BA238 40 07 001BA260 212 07 001BA338 256 -07 001BC1B0 128 +07 001BBFD0 224 +07 001BC0B0 384 07 001BD930 224 07 001BDA10 384 07 001BDB90 56 @@ -581,7 +968,8 @@ 07 001BDE00 96 07 001BDE60 13504 07 001C1320 1080 -07 001C1FA8 320 +07 001C1EC0 552 +07 001C2138 76 07 001C2970 64 07 001C4538 80 07 001C5880 768 @@ -590,22 +978,68 @@ 07 001CA398 96 07 001CA57C 4 07 001CA7A0 64 +07 0020FDB8 17 +07 0020FDD0 64 +07 0020FF20 19 +07 002100B0 35 +07 00210398 36 07 00210468 60 07 00210510 24 +07 002106C8 28 +07 00210750 21 +07 00210810 71 07 002109A0 18 +07 002109B8 21 +07 002109D0 20 +07 002109E8 57 08 0015EF4C 4 08 0015EF58 12 +08 0015F340 179 08 0015F5AC 4 -08 0015F648 4 +08 0015F5FC 4 +08 0015F640 12 +08 0015F748 8 +08 0015FAF8 14 +08 0015FC30 75 +08 0015FF30 21 +08 0015FF80 12 +08 0015FF90 10 +08 0015FFA0 26 08 0015FFBC 4 +08 00160004 8 +08 00160090 12 +08 00160128 5 +08 00160130 41 +08 00160330 31 +08 00160368 12 +08 00160378 17 +08 00160398 10 +08 001603A8 8 +08 001603B0 10 +08 001603C0 47 +08 00160470 27 +08 00160490 8 08 001604B8 4 +08 00160510 9 +08 00160534 4 +08 001607E0 16 +08 00160910 16 +08 00160920 16 +08 001609A0 16 +08 00160F30 27 08 00160F84 4 08 00160FE4 4 +08 00161158 11 08 001611A0 4 08 001611C4 4 08 00161204 3 +08 001612D0 12 08 001612E0 4 +08 00161338 14 +08 00161358 4 +08 00161360 4 08 00166800 128 +08 00166880 2048 08 00167840 272 08 00167950 7680 08 00169840 196 @@ -626,6 +1060,7 @@ 08 0017ED30 80 08 00183270 304 08 00184CB0 20 +08 001874C0 76 08 001974C0 64 08 00197780 896 08 00197B00 4288 @@ -636,6 +1071,7 @@ 08 001B04E0 1152 08 001B0980 200 08 001B2060 16 +08 001B9920 96 08 001B9998 588 08 001B9BE8 1776 08 001BA4A0 80 @@ -645,7 +1081,8 @@ 08 001BA9B8 40 08 001BA9E0 212 08 001BAAB8 256 -08 001BC930 128 +08 001BC750 224 +08 001BC830 384 08 001BE0B0 224 08 001BE190 384 08 001BE310 56 @@ -655,7 +1092,8 @@ 08 001BE580 96 08 001BE5E0 13504 08 001C1AA0 1080 -08 001C2728 320 +08 001C2640 552 +08 001C28B8 76 08 001C30F0 64 08 001C4CB8 80 08 001C6000 768 @@ -664,22 +1102,68 @@ 08 001CAB18 96 08 001CACFC 4 08 001CAF20 64 +08 001FAA58 17 +08 001FAA70 64 +08 001FABC0 19 +08 001FAD50 35 +08 001FB038 36 08 001FB108 60 08 001FB1B0 24 +08 001FB368 28 +08 001FB3F0 21 +08 001FB4B0 71 08 001FB640 18 +08 001FB658 21 +08 001FB670 20 +08 001FB688 57 09 0015EF4C 4 09 0015EF58 12 +09 0015F340 179 09 0015F5AC 4 -09 0015F648 4 +09 0015F5FC 4 +09 0015F640 12 +09 0015F748 8 +09 0015FAF8 14 +09 0015FC30 75 +09 0015FF30 21 +09 0015FF80 12 +09 0015FF90 10 +09 0015FFA0 26 09 0015FFBC 4 +09 00160004 8 +09 00160090 12 +09 00160128 5 +09 00160130 41 +09 00160330 31 +09 00160368 12 +09 00160378 17 +09 00160398 10 +09 001603A8 8 +09 001603B0 10 +09 001603C0 47 +09 00160470 27 +09 00160490 8 09 001604B8 4 +09 00160510 9 +09 00160534 4 +09 001607E0 16 +09 00160910 16 +09 00160920 16 +09 001609A0 16 +09 00160F30 27 09 00160F84 4 09 00160FE4 4 +09 00161158 11 09 001611A0 4 09 001611C4 4 09 00161204 3 +09 001612D0 12 09 001612E0 4 +09 00161338 14 +09 00161358 4 +09 00161360 4 09 00166180 128 +09 00166200 2048 09 001671C0 272 09 001672D0 7680 09 001691C0 196 @@ -700,6 +1184,7 @@ 09 0017E6B0 80 09 00182BF0 304 09 00184630 20 +09 00186E40 76 09 00196E40 64 09 00197100 896 09 00197480 4288 @@ -710,6 +1195,7 @@ 09 001AFE60 1152 09 001B0300 200 09 001B19E0 16 +09 001B92A0 96 09 001B9318 588 09 001B9568 1776 09 001B9E20 80 @@ -719,7 +1205,8 @@ 09 001BA338 40 09 001BA360 212 09 001BA438 256 -09 001BC2B0 128 +09 001BC0D0 224 +09 001BC1B0 384 09 001BDA30 224 09 001BDB10 384 09 001BDC90 56 @@ -729,7 +1216,8 @@ 09 001BDF00 96 09 001BDF60 13504 09 001C1420 1080 -09 001C20A8 320 +09 001C1FC0 552 +09 001C2238 76 09 001C2A70 64 09 001C4638 80 09 001C5980 768 @@ -738,22 +1226,68 @@ 09 001CA498 96 09 001CA67C 4 09 001CA8A0 64 +09 00207628 17 +09 00207640 64 +09 00207790 19 +09 00207920 35 +09 00207C08 36 09 00207CD8 60 09 00207D80 24 +09 00207F38 28 +09 00207FC0 21 +09 00208080 71 09 00208210 18 +09 00208228 21 +09 00208240 20 +09 00208258 57 10 0015EF4C 4 10 0015EF58 12 +10 0015F340 179 10 0015F5AC 4 -10 0015F648 4 +10 0015F5FC 4 +10 0015F640 12 +10 0015F748 8 +10 0015FAF8 14 +10 0015FC30 75 +10 0015FF30 21 +10 0015FF80 12 +10 0015FF90 10 +10 0015FFA0 26 10 0015FFBC 4 +10 00160004 8 +10 00160090 12 +10 00160128 5 +10 00160130 41 +10 00160330 31 +10 00160368 12 +10 00160378 17 +10 00160398 10 +10 001603A8 8 +10 001603B0 10 +10 001603C0 47 +10 00160470 27 +10 00160490 8 10 001604B8 4 +10 00160510 9 +10 00160534 4 +10 001607E0 16 +10 00160910 16 +10 00160920 16 +10 001609A0 16 +10 00160F30 27 10 00160F84 4 10 00160FE4 4 +10 00161158 11 10 001611A0 4 10 001611C4 4 10 00161204 3 +10 001612D0 12 10 001612E0 4 +10 00161338 14 +10 00161358 4 +10 00161360 4 10 00166480 128 +10 00166500 2048 10 001674C0 272 10 001675D0 7680 10 001694C0 196 @@ -774,6 +1308,7 @@ 10 0017E9B0 80 10 00182EF0 304 10 00184930 20 +10 00187140 76 10 00197140 64 10 00197400 896 10 00197780 4288 @@ -784,6 +1319,7 @@ 10 001B0160 1152 10 001B0600 200 10 001B1CE0 16 +10 001B95A0 96 10 001B9618 588 10 001B9868 1776 10 001BA120 80 @@ -793,7 +1329,8 @@ 10 001BA638 40 10 001BA660 212 10 001BA738 256 -10 001BC5B0 128 +10 001BC3D0 224 +10 001BC4B0 384 10 001BDD30 224 10 001BDE10 384 10 001BDF90 56 @@ -803,7 +1340,8 @@ 10 001BE200 96 10 001BE260 13504 10 001C1720 1080 -10 001C23A8 320 +10 001C22C0 552 +10 001C2538 76 10 001C2D70 64 10 001C4938 80 10 001C5C80 768 @@ -812,22 +1350,68 @@ 10 001CA798 96 10 001CA97C 4 10 001CABA0 64 +10 001DB898 17 +10 001DB8B0 64 +10 001DBA00 19 +10 001DBB90 35 +10 001DBE78 36 10 001DBF48 60 10 001DBFF0 24 +10 001DC1A8 28 +10 001DC230 21 +10 001DC2F0 71 10 001DC480 18 +10 001DC498 21 +10 001DC4B0 20 +10 001DC4C8 57 11 0015EF4C 4 11 0015EF58 12 +11 0015F340 179 11 0015F5AC 4 -11 0015F648 4 +11 0015F5FC 4 +11 0015F640 12 +11 0015F748 8 +11 0015FAF8 14 +11 0015FC30 75 +11 0015FF30 21 +11 0015FF80 12 +11 0015FF90 10 +11 0015FFA0 26 11 0015FFBC 4 +11 00160004 8 +11 00160090 12 +11 00160128 5 +11 00160130 41 +11 00160330 31 +11 00160368 12 +11 00160378 17 +11 00160398 10 +11 001603A8 8 +11 001603B0 10 +11 001603C0 47 +11 00160470 27 +11 00160490 8 11 001604B8 4 +11 00160510 9 +11 00160534 4 +11 001607E0 16 +11 00160910 16 +11 00160920 16 +11 001609A0 16 +11 00160F30 27 11 00160F84 4 11 00160FE4 4 +11 00161158 11 11 001611A0 4 11 001611C4 4 11 00161204 3 +11 001612D0 12 11 001612E0 4 +11 00161338 14 +11 00161358 4 +11 00161360 4 11 00166A00 128 +11 00166A80 2048 11 00167A40 272 11 00167B50 7680 11 00169A40 196 @@ -848,6 +1432,7 @@ 11 0017EF30 80 11 00183470 304 11 00184EB0 20 +11 001876C0 76 11 001976C0 64 11 00197980 896 11 00197D00 4288 @@ -858,6 +1443,7 @@ 11 001B06E0 1152 11 001B0B80 200 11 001B2260 16 +11 001B9B20 96 11 001B9B98 588 11 001B9DE8 1776 11 001BA6A0 80 @@ -867,7 +1453,8 @@ 11 001BABB8 40 11 001BABE0 212 11 001BACB8 256 -11 001BCB30 128 +11 001BC950 224 +11 001BCA30 384 11 001BE2B0 224 11 001BE390 384 11 001BE510 56 @@ -877,7 +1464,8 @@ 11 001BE780 96 11 001BE7E0 13504 11 001C1CA0 1080 -11 001C2928 320 +11 001C2840 552 +11 001C2AB8 76 11 001C32F0 64 11 001C4EB8 80 11 001C6200 768 @@ -886,22 +1474,68 @@ 11 001CAD18 96 11 001CAEFC 4 11 001CB120 64 +11 00219C68 17 +11 00219C80 64 +11 00219DD0 19 +11 00219F60 35 +11 0021A248 36 11 0021A318 60 11 0021A3C0 24 +11 0021A578 28 +11 0021A600 21 +11 0021A6C0 71 11 0021A850 18 +11 0021A868 21 +11 0021A880 20 +11 0021A898 57 12 0015EF4C 4 12 0015EF58 12 +12 0015F340 179 12 0015F5AC 4 -12 0015F648 4 +12 0015F5FC 4 +12 0015F640 12 +12 0015F748 8 +12 0015FAF8 14 +12 0015FC30 75 +12 0015FF30 21 +12 0015FF80 12 +12 0015FF90 10 +12 0015FFA0 26 12 0015FFBC 4 +12 00160004 8 +12 00160090 12 +12 00160128 5 +12 00160130 41 +12 00160330 31 +12 00160368 12 +12 00160378 17 +12 00160398 10 +12 001603A8 8 +12 001603B0 10 +12 001603C0 47 +12 00160470 27 +12 00160490 8 12 001604B8 4 +12 00160510 9 +12 00160534 4 +12 001607E0 16 +12 00160910 16 +12 00160920 16 +12 001609A0 16 +12 00160F30 27 12 00160F84 4 12 00160FE4 4 +12 00161158 11 12 001611A0 4 12 001611C4 4 12 00161204 3 +12 001612D0 12 12 001612E0 4 +12 00161338 14 +12 00161358 4 +12 00161360 4 12 00166480 128 +12 00166500 2048 12 001674C0 272 12 001675D0 7680 12 001694C0 196 @@ -922,6 +1556,7 @@ 12 0017E9B0 80 12 00182EF0 304 12 00184930 20 +12 00187140 76 12 00197140 64 12 00197400 896 12 00197780 4288 @@ -932,6 +1567,7 @@ 12 001B0160 1152 12 001B0600 200 12 001B1CE0 16 +12 001B95A0 96 12 001B9618 588 12 001B9868 1776 12 001BA120 80 @@ -941,7 +1577,8 @@ 12 001BA638 40 12 001BA660 212 12 001BA738 256 -12 001BC5B0 128 +12 001BC3D0 224 +12 001BC4B0 384 12 001BDD30 224 12 001BDE10 384 12 001BDF90 56 @@ -951,7 +1588,8 @@ 12 001BE200 96 12 001BE260 13504 12 001C1720 1080 -12 001C23A8 320 +12 001C22C0 552 +12 001C2538 76 12 001C2D70 64 12 001C4938 80 12 001C5C80 768 @@ -960,22 +1598,68 @@ 12 001CA798 96 12 001CA97C 4 12 001CABA0 64 +12 0020AFF8 17 +12 0020B010 64 +12 0020B160 19 +12 0020B2F0 35 +12 0020B5D8 36 12 0020B6A8 60 12 0020B750 24 +12 0020B908 28 +12 0020B990 21 +12 0020BA50 71 12 0020BBE0 18 +12 0020BBF8 21 +12 0020BC10 20 +12 0020BC28 57 13 0015EF4C 4 13 0015EF58 12 +13 0015F340 179 13 0015F5AC 4 -13 0015F648 4 +13 0015F5FC 4 +13 0015F640 12 +13 0015F748 8 +13 0015FAF8 14 +13 0015FC30 75 +13 0015FF30 21 +13 0015FF80 12 +13 0015FF90 10 +13 0015FFA0 26 13 0015FFBC 4 +13 00160004 8 +13 00160090 12 +13 00160128 5 +13 00160130 41 +13 00160330 31 +13 00160368 12 +13 00160378 17 +13 00160398 10 +13 001603A8 8 +13 001603B0 10 +13 001603C0 47 +13 00160470 27 +13 00160490 8 13 001604B8 4 +13 00160510 9 +13 00160534 4 +13 001607E0 16 +13 00160910 16 +13 00160920 16 +13 001609A0 16 +13 00160F30 27 13 00160F84 4 13 00160FE4 4 +13 00161158 11 13 001611A0 4 13 001611C4 4 13 00161204 3 +13 001612D0 12 13 001612E0 4 +13 00161338 14 +13 00161358 4 +13 00161360 4 13 00166300 128 +13 00166380 2048 13 00167340 272 13 00167450 7680 13 00169340 196 @@ -996,6 +1680,7 @@ 13 0017E830 80 13 00182D70 304 13 001847B0 20 +13 00186FC0 76 13 00196FC0 64 13 00197280 896 13 00197600 4288 @@ -1006,6 +1691,7 @@ 13 001AFFE0 1152 13 001B0480 200 13 001B1B60 16 +13 001B9420 96 13 001B9498 588 13 001B96E8 1776 13 001B9FA0 80 @@ -1015,7 +1701,8 @@ 13 001BA4B8 40 13 001BA4E0 212 13 001BA5B8 256 -13 001BC430 128 +13 001BC250 224 +13 001BC330 384 13 001BDBB0 224 13 001BDC90 384 13 001BDE10 56 @@ -1025,7 +1712,8 @@ 13 001BE080 96 13 001BE0E0 13504 13 001C15A0 1080 -13 001C2228 320 +13 001C2140 552 +13 001C23B8 76 13 001C2BF0 64 13 001C47B8 80 13 001C5B00 768 @@ -1034,22 +1722,68 @@ 13 001CA618 96 13 001CA7FC 4 13 001CAA20 64 +13 001F3588 17 +13 001F35A0 64 +13 001F36F0 19 +13 001F3880 35 +13 001F3B68 36 13 001F3C38 60 13 001F3CE0 24 +13 001F3E98 28 +13 001F3F20 21 +13 001F3FE0 71 13 001F4170 18 +13 001F4188 21 +13 001F41A0 20 +13 001F41B8 57 14 0015EF4C 4 14 0015EF58 12 +14 0015F340 179 14 0015F5AC 4 -14 0015F648 4 +14 0015F5FC 4 +14 0015F640 12 +14 0015F748 8 +14 0015FAF8 14 +14 0015FC30 75 +14 0015FF30 21 +14 0015FF80 12 +14 0015FF90 10 +14 0015FFA0 26 14 0015FFBC 4 +14 00160004 8 +14 00160090 12 +14 00160128 5 +14 00160130 41 +14 00160330 31 +14 00160368 12 +14 00160378 17 +14 00160398 10 +14 001603A8 8 +14 001603B0 10 +14 001603C0 47 +14 00160470 27 +14 00160490 8 14 001604B8 4 +14 00160510 9 +14 00160534 4 +14 001607E0 16 +14 00160910 16 +14 00160920 16 +14 001609A0 16 +14 00160F30 27 14 00160F84 4 14 00160FE4 4 +14 00161158 11 14 001611A0 4 14 001611C4 4 14 00161204 3 +14 001612D0 12 14 001612E0 4 +14 00161338 14 +14 00161358 4 +14 00161360 4 14 00166700 128 +14 00166780 2048 14 00167740 272 14 00167850 7680 14 00169740 196 @@ -1070,6 +1804,7 @@ 14 0017EC30 80 14 00183170 304 14 00184BB0 20 +14 001873C0 76 14 001973C0 64 14 00197680 896 14 00197A00 4288 @@ -1080,6 +1815,7 @@ 14 001B03E0 1152 14 001B0880 200 14 001B1F60 16 +14 001B9820 96 14 001B9898 588 14 001B9AE8 1776 14 001BA3A0 80 @@ -1089,7 +1825,8 @@ 14 001BA8B8 40 14 001BA8E0 212 14 001BA9B8 256 -14 001BC830 128 +14 001BC650 224 +14 001BC730 384 14 001BDFB0 224 14 001BE090 384 14 001BE210 56 @@ -1099,7 +1836,8 @@ 14 001BE480 96 14 001BE4E0 13504 14 001C19A0 1080 -14 001C2628 320 +14 001C2540 552 +14 001C27B8 76 14 001C2FF0 64 14 001C4BB8 80 14 001C5F00 768 @@ -1108,22 +1846,68 @@ 14 001CAA18 96 14 001CABFC 4 14 001CAE20 64 +14 001FAE68 17 +14 001FAE80 64 +14 001FAFD0 19 +14 001FB160 35 +14 001FB448 36 14 001FB518 60 14 001FB5C0 24 +14 001FB778 28 +14 001FB800 21 +14 001FB8C0 71 14 001FBA50 18 +14 001FBA68 21 +14 001FBA80 20 +14 001FBA98 57 15 0015EF4C 4 15 0015EF58 12 +15 0015F340 179 15 0015F5AC 4 -15 0015F648 4 +15 0015F5FC 4 +15 0015F640 12 +15 0015F748 8 +15 0015FAF8 14 +15 0015FC30 75 +15 0015FF30 21 +15 0015FF80 12 +15 0015FF90 10 +15 0015FFA0 26 15 0015FFBC 4 +15 00160004 8 +15 00160090 12 +15 00160128 5 +15 00160130 41 +15 00160330 31 +15 00160368 12 +15 00160378 17 +15 00160398 10 +15 001603A8 8 +15 001603B0 10 +15 001603C0 47 +15 00160470 27 +15 00160490 8 15 001604B8 4 +15 00160510 9 +15 00160534 4 +15 001607E0 16 +15 00160910 16 +15 00160920 16 +15 001609A0 16 +15 00160F30 27 15 00160F84 4 15 00160FE4 4 +15 00161158 11 15 001611A0 4 15 001611C4 4 15 00161204 3 +15 001612D0 12 15 001612E0 4 +15 00161338 14 +15 00161358 4 +15 00161360 4 15 00166600 128 +15 00166680 2048 15 00167640 272 15 00167750 7680 15 00169640 196 @@ -1144,6 +1928,7 @@ 15 0017EB30 80 15 00183070 304 15 00184AB0 20 +15 001872C0 76 15 001972C0 64 15 00197580 896 15 00197900 4288 @@ -1154,6 +1939,7 @@ 15 001B02E0 1152 15 001B0780 200 15 001B1E60 16 +15 001B9720 96 15 001B9798 588 15 001B99E8 1776 15 001BA2A0 80 @@ -1163,7 +1949,8 @@ 15 001BA7B8 40 15 001BA7E0 212 15 001BA8B8 256 -15 001BC730 128 +15 001BC550 224 +15 001BC630 384 15 001BDEB0 224 15 001BDF90 384 15 001BE110 56 @@ -1173,7 +1960,8 @@ 15 001BE380 96 15 001BE3E0 13504 15 001C18A0 1080 -15 001C2528 320 +15 001C2440 552 +15 001C26B8 76 15 001C2EF0 64 15 001C4AB8 80 15 001C5E00 768 @@ -1182,22 +1970,68 @@ 15 001CA918 96 15 001CAAFC 4 15 001CAD20 64 +15 001E16D8 17 +15 001E16F0 64 +15 001E1840 19 +15 001E19D0 35 +15 001E1CB8 36 15 001E1D88 60 15 001E1E30 24 +15 001E1FE8 28 +15 001E2070 21 +15 001E2130 71 15 001E22C0 18 +15 001E22D8 21 +15 001E22F0 20 +15 001E2308 57 16 0015EF4C 4 16 0015EF58 12 +16 0015F340 179 16 0015F5AC 4 -16 0015F648 4 +16 0015F5FC 4 +16 0015F640 12 +16 0015F758 8 +16 0015FB08 14 +16 0015FC30 75 +16 0015FF30 21 +16 0015FF80 12 +16 0015FF90 10 +16 0015FFA0 26 16 0015FFBC 4 +16 00160004 8 +16 00160090 12 +16 00160128 5 +16 00160130 41 +16 00160330 31 +16 00160368 12 +16 00160378 17 +16 00160398 10 +16 001603A8 8 +16 001603B0 10 +16 001603C0 47 +16 00160470 27 +16 00160490 8 16 001604B8 4 +16 00160510 9 +16 00160534 4 +16 001607E0 16 +16 00160910 16 +16 00160920 16 +16 001609A0 16 +16 00160F30 27 16 00160F84 4 16 00160FE4 4 +16 00161158 11 16 001611A0 4 16 001611C4 4 16 00161204 3 +16 001612D0 12 16 001612E0 4 +16 00161338 14 +16 00161358 4 +16 00161360 4 16 00166400 128 +16 00166480 2048 16 00167440 272 16 00167550 7680 16 00169440 196 @@ -1218,6 +2052,7 @@ 16 0017E9B0 80 16 00182EF0 304 16 00184930 20 +16 00187140 76 16 00197140 64 16 00197400 896 16 00197780 4288 @@ -1228,6 +2063,7 @@ 16 001B0160 1152 16 001B0600 200 16 001B1CE0 16 +16 001B95A0 96 16 001B9618 588 16 001B9868 1776 16 001BA120 80 @@ -1237,7 +2073,8 @@ 16 001BA638 40 16 001BA660 212 16 001BA738 256 -16 001BC5B0 128 +16 001BC3D0 224 +16 001BC4B0 384 16 001BDD30 224 16 001BDE10 384 16 001BDF90 56 @@ -1247,7 +2084,8 @@ 16 001BE200 96 16 001BE260 13504 16 001C1720 1080 -16 001C23A8 320 +16 001C22C0 552 +16 001C2538 76 16 001C2D70 64 16 001C4938 80 16 001C5C80 768 @@ -1256,22 +2094,68 @@ 16 001CA798 96 16 001CA97C 4 16 001CABA0 64 +16 001E6DE8 17 +16 001E6E00 64 +16 001E6F50 19 +16 001E70E0 35 +16 001E73C8 36 16 001E7498 60 16 001E7540 24 +16 001E76F8 28 +16 001E7780 21 +16 001E7840 71 16 001E79D0 18 +16 001E79E8 21 +16 001E7A00 20 +16 001E7A18 57 17 0015EF4C 4 17 0015EF58 12 +17 0015F340 179 17 0015F5AC 4 -17 0015F648 4 +17 0015F5FC 4 +17 0015F640 12 +17 0015F748 8 +17 0015FAF8 14 +17 0015FC30 75 +17 0015FF30 21 +17 0015FF80 12 +17 0015FF90 10 +17 0015FFA0 26 17 0015FFBC 4 +17 00160004 8 +17 00160090 12 +17 00160128 5 +17 00160130 41 +17 00160330 31 +17 00160368 12 +17 00160378 17 +17 00160398 10 +17 001603A8 8 +17 001603B0 10 +17 001603C0 47 +17 00160470 27 +17 00160490 8 17 001604B8 4 +17 00160510 9 +17 00160534 4 +17 001607E0 16 +17 00160910 16 +17 00160920 16 +17 001609A0 16 +17 00160F30 27 17 00160F84 4 17 00160FE4 4 +17 00161158 11 17 001611A0 4 17 001611C4 4 17 00161204 3 +17 001612D0 12 17 001612E0 4 +17 00161338 14 +17 00161358 4 +17 00161360 4 17 00166900 128 +17 00166980 2048 17 00167940 272 17 00167A50 7680 17 00169940 196 @@ -1292,6 +2176,7 @@ 17 0017EE30 80 17 00183370 304 17 00184DB0 20 +17 001875C0 76 17 001975C0 64 17 00197880 896 17 00197C00 4288 @@ -1302,6 +2187,7 @@ 17 001B05E0 1152 17 001B0A80 200 17 001B2160 16 +17 001B9A20 96 17 001B9A98 588 17 001B9CE8 1776 17 001BA5A0 80 @@ -1311,7 +2197,8 @@ 17 001BAAB8 40 17 001BAAE0 212 17 001BABB8 256 -17 001BCA30 128 +17 001BC850 224 +17 001BC930 384 17 001BE1B0 224 17 001BE290 384 17 001BE410 56 @@ -1321,7 +2208,8 @@ 17 001BE680 96 17 001BE6E0 13504 17 001C1BA0 1080 -17 001C2828 320 +17 001C2740 552 +17 001C29B8 76 17 001C31F0 64 17 001C4DB8 80 17 001C6100 768 @@ -1330,22 +2218,68 @@ 17 001CAC18 96 17 001CADFC 4 17 001CB020 64 +17 001E54D8 17 +17 001E54F0 64 +17 001E5640 19 +17 001E57D0 35 +17 001E5AB8 36 17 001E5B88 60 17 001E5C30 24 +17 001E5DE8 28 +17 001E5E70 21 +17 001E5F30 71 17 001E60C0 18 +17 001E60D8 21 +17 001E60F0 20 +17 001E6108 57 18 0015EF4C 4 18 0015EF58 12 +18 0015F340 179 18 0015F5AC 4 -18 0015F648 4 +18 0015F5FC 4 +18 0015F640 12 +18 0015F748 8 +18 0015FAF8 14 +18 0015FC30 75 +18 0015FF30 21 +18 0015FF80 12 +18 0015FF90 10 +18 0015FFA0 26 18 0015FFBC 4 +18 00160004 8 +18 00160090 12 +18 00160128 5 +18 00160130 41 +18 00160330 31 +18 00160368 12 +18 00160378 17 +18 00160398 10 +18 001603A8 8 +18 001603B0 10 +18 001603C0 47 +18 00160470 27 +18 00160490 8 18 001604B8 4 +18 00160510 9 +18 00160534 4 +18 001607E0 16 +18 00160910 16 +18 00160920 16 +18 001609A0 16 +18 00160F30 27 18 00160F84 4 18 00160FE4 4 +18 00161158 11 18 001611A0 4 18 001611C4 4 18 00161204 3 +18 001612D0 12 18 001612E0 4 +18 00161338 14 +18 00161358 4 +18 00161360 4 18 00166A00 128 +18 00166A80 2048 18 00167A40 272 18 00167B50 7680 18 00169A40 196 @@ -1366,6 +2300,7 @@ 18 0017EF30 80 18 00183470 304 18 00184EB0 20 +18 001876C0 76 18 001976C0 64 18 00197980 896 18 00197D00 4288 @@ -1376,6 +2311,7 @@ 18 001B06E0 1152 18 001B0B80 200 18 001B2260 16 +18 001B9B20 96 18 001B9B98 588 18 001B9DE8 1776 18 001BA6A0 80 @@ -1385,7 +2321,8 @@ 18 001BABB8 40 18 001BABE0 212 18 001BACB8 256 -18 001BCB30 128 +18 001BC950 224 +18 001BCA30 384 18 001BE2B0 224 18 001BE390 384 18 001BE510 56 @@ -1395,7 +2332,8 @@ 18 001BE780 96 18 001BE7E0 13504 18 001C1CA0 1080 -18 001C2928 320 +18 001C2840 552 +18 001C2AB8 76 18 001C32F0 64 18 001C4EB8 80 18 001C6200 768 @@ -1404,6 +2342,17 @@ 18 001CAD18 96 18 001CAEFC 4 18 001CB120 64 +18 001F1248 17 +18 001F1260 64 +18 001F13B0 19 +18 001F1540 35 +18 001F1828 36 18 001F18F8 60 18 001F19A0 24 +18 001F1B58 28 +18 001F1BE0 21 +18 001F1CA0 71 18 001F1E30 18 +18 001F1E48 21 +18 001F1E60 20 +18 001F1E78 57 diff --git a/src/overlays/l11/mobys/fred_pokitaru.c b/src/overlays/l11/mobys/fred_pokitaru.c index 54b5be0fcf..3ce11b1d2f 100644 --- a/src/overlays/l11/mobys/fred_pokitaru.c +++ b/src/overlays/l11/mobys/fred_pokitaru.c @@ -101,7 +101,7 @@ void fred_pokitaru_update(struct Moby *moby) { begin_dialogue_camera_transition(moby, 3.0f); moby->state = FRED_POKITARU_WAIT_FOR_DIALOGUE_END; } - if (alternate_item_available[1] == 0 && discount_purchase_pricing[0] == 0) { + if (alternate_item_available[1] == 0 && item_available[ITEM_VENDOR_DISCOUNT] == 0) { if (fast_vec_dist(&moby->pos, hero.motion.pos.f) < 4.0f) { int help_frame_delta = scale_game_frames(D_0015EEA4) - help_records[0x86].latest_time_bucket * 600; @@ -128,7 +128,7 @@ void fred_pokitaru_update(struct Moby *moby) { moby->state = FRED_POKITARU_CHECK_DIALOGUE; if (moby_vars->dialogue_result == 2) { alternate_item_available[1] = 0; - discount_purchase_pricing[0] = 1; + item_available[ITEM_VENDOR_DISCOUNT] = 1; D_0013D50B = 1; queue_dialogue_message(0x2B06, scale_game_frames(300)); memcard_save_data(0, -1); diff --git a/src/overlays/l11/mobys/pokitaru_pickup.c b/src/overlays/l11/mobys/pokitaru_pickup.c index 99bcf8ffd1..49c9d96bc5 100644 --- a/src/overlays/l11/mobys/pokitaru_pickup.c +++ b/src/overlays/l11/mobys/pokitaru_pickup.c @@ -6,6 +6,7 @@ #include "asm.h" #include "rnc/mobys/moby.h" #include "rnc/data_labels.h" +#include "rnc/game/item_state.h" #include "rnc/math/asm_helpers.h" #include "rnc/overlay/shared/ui/help/help_request.h" #include "rnc/save/memcard_save_data.h" @@ -27,7 +28,7 @@ void pokitaru_pickup_update(struct Moby *moby) { }; switch (moby->state) { case PICKUP_INITIALIZE: - if (D_0013D4C2[4] != 0) { + if (item_available[6] != 0) { mark_moby_for_removal(moby); } else { moby->pos.z += 0.75f; @@ -40,7 +41,7 @@ void pokitaru_pickup_update(struct Moby *moby) { case PICKUP_CHECK_PROXIMITY: fast_add_rotations(moby->rot.z, frame_time * 4.7123890f); if (vector_distance_xy(&moby->pos, D_0013E533 + 0xE9D) < 2.0f) { - D_0013D4C2[4] = 1; + item_available[6] = 1; D_0013D4E3[0xB] = 1; memcard_save_data(0, -1); help_request(0x2AF8, 0x3A); diff --git a/src/overlays/shared/vendor/draw_vendor_purchase_text.c b/src/overlays/shared/vendor/draw_vendor_purchase_text.c index 602b306400..bbbccc1ea4 100644 --- a/src/overlays/shared/vendor/draw_vendor_purchase_text.c +++ b/src/overlays/shared/vendor/draw_vendor_purchase_text.c @@ -105,7 +105,7 @@ void draw_vendor_purchase_text(void *moby, s32 x, s32 y) { font_print_window_small((void *)&box, 0x80F0F0F0L, get_help_message_text(message_id), -1); return; purchase: - cost = discount_purchase_pricing[0] ? SELECTED_ITEM.f4 : SELECTED_ITEM.f0; + cost = item_available[ITEM_VENDOR_DISCOUNT] ? SELECTED_ITEM.f4 : SELECTED_ITEM.f0; if (current_bolt_count_macro >= cost) { font_print_small(6, 6, 0x80F0F0F0L, get_help_message_text(0x5239), -1); font_print_small(2, 0x20, 0x80F0F0F0L, get_help_message_text(0x524E), -1); diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 0e80d9aa89..a7afcc213b 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -777,7 +777,7 @@ void initialize_vendor_selected_item_mobys(void) { if (vendor_menu_lui.rows[vendor_menu_lui.cursor].is_ammo == 0) { float item_z_offset = D_L00_001C8920[vendor_menu_lui.rows[vendor_menu_lui.cursor].item][3]; item_local_position[2] += item_z_offset; - if (discount_purchase_pricing[0]) { + if (item_available[ITEM_VENDOR_DISCOUNT]) { item_local_position[2] += item_z_offset; } } From 2f5b4928c65412cc863d292e773862e4b78c3349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 13:05:08 +0000 Subject: [PATCH 24/25] decomp: format the new data definitions and give the save globals one name in boot and level code --- include/rnc/game/bolt_sources.h | 1 - include/rnc/game/game_globals.h | 12 +- include/rnc/game/item_state.h | 14 +- include/rnc/game/level_progress.h | 5 +- include/rnc/ui/map/level_map.h | 2 +- src/audio/banks/snd_bank_load_by_loc.c | 16 +- src/audio/snd_start_sound_system.c | 19 +- src/audio/streaming/start_audio_stream_read.c | 4 +- src/audio/voices/pause_all_sounds.c | 8 +- src/audio/voices/set_sound_handle_id.c | 2 +- src/game/missions/check_mission_condition.c | 3 +- .../missions/get_map_point_mission_status.c | 1 + src/game/transitions/do_space_transition.c | 2 +- src/math/rotations/matrix_to_quaternion.c | 4 +- src/mobys/animation/process_moby_anim_data.c | 512 +++++++++--------- ...update_resident_dialogue_animation_state.c | 3 + src/mobys/resolve_moby_hit_response.c | 3 +- src/mobys/update_visible_mobys.c | 2 +- src/movies/decoder/callbacks/mpeg_error.c | 2 +- src/movies/decoder/callbacks/video_callback.c | 2 +- src/movies/decoder/dec_bs0.c | 2 +- .../decoder/video_input/vi_buf_add_dma.c | 2 +- src/movies/player/err_message.c | 6 +- src/overlays/l08/mobys/batalia_bolt_pickup.c | 7 +- src/overlays/l08/mobys/bolt_pickup.c | 2 +- .../shared/game/run_level_main_loop.c | 3 +- src/overlays/shared/pickups/bolt.c | 2 +- src/overlays/shared/pickups/gold_bolt.c | 10 +- src/overlays/shared/vendor/vendor_menu.c | 3 +- .../effects/append_billboard_batch.c | 3 +- ...ild_resident_indexed_texture_warp_meshes.c | 3 +- .../effects/build_variant_effect_quads.c | 14 +- .../configure_graphics_setup_dma_chain.c | 10 +- src/rendering/mobys/draw_mobys_setup.c | 10 +- .../mobys/render_environment_mapped_object.c | 25 +- .../packets/emit_textured_rectangle.c | 3 +- src/rendering/tfrags/draw_tfrag.c | 12 +- src/rendering/vu1/vu1_chain.c | 5 +- src/rendering/vu1/vu1_gs_regs_normal.c | 2 +- src/rendering/vu1/vu1_tex_flush.c | 2 +- src/runtime/startup/init_once.c | 44 +- src/save/memcard_get_name.c | 7 +- src/save/memcard_initialize.c | 2 +- src/save/memcard_restore_data.c | 2 +- src/save/memcard_restore_game.c | 2 +- src/save/memcard_update_state.c | 22 +- src/sdk/deci2/printfloat.c | 15 +- src/sdk/deci2/sce_tty_handler.c | 4 +- src/sdk/dma/sce_dma_put_env.c | 3 + src/sdk/input/dbc/sceDbcCreateSocket.c | 6 +- src/sdk/input/dbc/sceDbcInit.c | 8 +- src/sdk/input/dbc/scedbcreceivedata.c | 2 +- src/sdk/ipu/wait_bdec_out.c | 2 +- src/sdk/kernel/topThread.c | 4 +- src/sdk/libc/locale/_localeconv_r.c | 16 +- src/sdk/libc/mprec/_dtoa_r.c | 26 +- src/sdk/libc/mprec/pow5mult.c | 3 +- src/sdk/mpeg/api/sce_mpeg_create.c | 4 +- src/sdk/mpeg/demux/_PES_packet.c | 1 + src/sdk/mpeg/headers/_extensionAndUserData.c | 28 +- src/sdk/mpeg/headers/_quantMatrixExtension.c | 2 +- src/sdk/mpeg/headers/sequence_extension.c | 4 +- src/sdk/mpeg/headers/sequenceheader.c | 4 +- src/sdk/mpeg/macroblock/_decMB0.c | 14 +- src/sdk/mpeg/macroblock/_slice0.c | 4 +- src/sdk/mpeg/macroblock/domc.c | 2 +- src/sdk/mpeg/macroblock/skip_mb0.c | 10 +- src/sdk/mpeg/macroblock/slicea0.c | 16 +- src/sdk/mpeg/picture/_pictureData0.c | 4 +- src/sdk/mpeg/picture/decpicture.c | 8 +- src/sdk/rpc/iop/sce_sif_reboot_iop.c | 6 +- src/sdk/scf/GetRomName.c | 2 +- src/sdk/storage/cdvd/cd_check_ncmd.c | 14 +- src/sdk/storage/cdvd/cd_check_scmd.c | 14 +- src/sdk/storage/cdvd/sceCdDiskReady.c | 12 +- src/sdk/storage/cdvd/sceCdInit.c | 20 +- src/sdk/storage/cdvd/sceCdRead.c | 12 +- src/sdk/storage/cdvd/scecdreadclock.c | 8 +- src/sdk/storage/memory_card/sce_mc_init.c | 16 +- src/ui/hud/banks/load_hud_banks.c | 15 +- .../loading/append_scrolling_textured_quad.c | 4 +- src/ui/map/coverage/downsample_map_coverage.c | 7 +- src/ui/map/draw_map_screen.c | 1 + .../draw_level_selection_map.c | 15 +- src/ui/map/slots/pick_next_map.c | 1 + src/ui/map/update_map_icons.c | 22 +- .../item_preview/draw_menu_preview_objects.c | 4 +- .../pause/assign_heli_pack_label_text_table.c | 10 +- src/ui/menus/save_data/draw_save_slot_list.c | 9 +- .../emit_selected_graphics_dma_packets.c | 1 + src/ui/menus/system/process_menu_entry.c | 6 +- src/ui/menus/system/setup_menu_display_text.c | 3 +- .../menus/weapons/draw_selected_item_ammo.c | 3 +- .../menus/widgets/draw_menu_selection_text.c | 15 +- .../menus/widgets/draw_menu_side_indicator.c | 6 +- .../widgets/draw_selected_menu_item_text.c | 22 +- src/ui/menus/widgets/format_menu_item_text.c | 3 +- .../widgets/format_scaled_display_value.c | 3 +- src/ui/text/draw_dialog_text.c | 69 +-- src/ui/text/set_scrolling_status_message.c | 2 +- 100 files changed, 692 insertions(+), 645 deletions(-) diff --git a/include/rnc/game/bolt_sources.h b/include/rnc/game/bolt_sources.h index 4ccd2bb5cf..8cddc3a76a 100644 --- a/include/rnc/game/bolt_sources.h +++ b/include/rnc/game/bolt_sources.h @@ -12,5 +12,4 @@ typedef struct BoltSourceStats { /* One row per level record (20), see rnc/game/level_progress.h. */ extern BoltSourceStats bolt_source_stats[20][64] __asm__("D_0014D590"); - #endif /* LOMBYTE_RNC_GAME_BOLT_SOURCES_H */ diff --git a/include/rnc/game/game_globals.h b/include/rnc/game/game_globals.h index b399444dcc..fafd50c1d0 100644 --- a/include/rnc/game/game_globals.h +++ b/include/rnc/game/game_globals.h @@ -4,12 +4,12 @@ #include "types.h" #include "rnc/game/level_progress.h" -extern s32 ship_substate[] __asm__("D_0013E050"); -extern s16 ship_index[] __asm__("D_0013E056"); -extern char item_usage[] __asm__("D_00141680"); -extern s16 cd_read_active[] __asm__("D_001516D8"); -extern s32 hero_max_health __asm__("D_0015EDA0"); -extern s32 *level_root __asm__("D_0015EE4C"); +extern s32 ship_substate[] __asm__("D_0013E050"); +extern s16 ship_index[] __asm__("D_0013E056"); +extern char item_usage[] __asm__("D_00141680"); +extern s16 cd_read_active[] __asm__("D_001516D8"); +extern s32 hero_max_health __asm__("D_0015EDA0"); +extern s32 *level_root __asm__("D_0015EE4C"); extern s32 freeze_stats_time_ref[] __asm__("D_0015EE58") __attribute__((section(".sdata"))); extern s32 freeze_stats_score_ref_a[] __asm__("D_0015EE68") __attribute__((section(".sdata"))); extern s32 intro_overlay_alpha __asm__("D_0015EF50"); diff --git a/include/rnc/game/item_state.h b/include/rnc/game/item_state.h index 8daa0e3b66..1861ab543a 100644 --- a/include/rnc/game/item_state.h +++ b/include/rnc/game/item_state.h @@ -12,16 +12,16 @@ extern s32 weapon_ammo_counts[37] __asm__("D_0013D428"); /* item_available and items_acquired hold 37 items: mc_gamedata saves 0x25 bytes of each. Single items read by name: 2 the heli-pack (hero jump code), 33 shifts map ids by 0x100 (pick_next_map), 35 the vendor discount. */ -extern u8 item_available[37] __asm__("D_0013D4C0"); -#define ITEM_HELI_PACK 2 -#define ITEM_MAP_SHIFT 33 +extern u8 item_available[37] __asm__("D_0013D4C0"); +#define ITEM_HELI_PACK 2 +#define ITEM_MAP_SHIFT 33 #define ITEM_VENDOR_DISCOUNT 35 -extern u8 item_text_variant[40] __asm__("D_0013E520"); +extern u8 item_text_variant[40] __asm__("D_0013E520"); -extern u8 D_0015EDD0[] __attribute__((sda)); -extern u8 items_acquired[37] __asm__("D_0013D4E8"); +extern u8 D_0015EDD0[] __attribute__((sda)); +extern u8 items_acquired[37] __asm__("D_0013D4E8"); /* Per-weapon totals (37 items, mc_gamedata blocks 0x3E8-0x3EA of 0x94 bytes). */ -extern s32 D_0013DD70[37]; +extern s32 ammo_bought_stats[37] __asm__("D_0013DD70"); extern s32 weapon_ammo_pickup_totals[37] __asm__("D_0013DE08"); extern s32 weapon_ammo_used_counts[37] __asm__("D_0013DEA0"); extern s32 pause_iop_sprite_lists[8] __asm__("D_00141EA0"); diff --git a/include/rnc/game/level_progress.h b/include/rnc/game/level_progress.h index 6e22527f6f..ebe8d0ec24 100644 --- a/include/rnc/game/level_progress.h +++ b/include/rnc/game/level_progress.h @@ -14,7 +14,7 @@ extern s32 D_0013D510[LEVEL_RECORD_COUNT]; /* Best coverage result save_map_coverage got per level (one slot per level record). */ extern s32 max_coverage_save_result_by_level[LEVEL_RECORD_COUNT] __asm__("D_0013D560"); /* Per-level counters the hero code bumps; mc_leveldata saves 4 bytes of each per level. */ -extern s32 D_0013DF38[LEVEL_RECORD_COUNT]; +extern s32 level_bolts[LEVEL_RECORD_COUNT] __asm__("D_0013DF38"); /* bolts collected per level */ extern s32 D_0013DF88[LEVEL_RECORD_COUNT]; extern s32 hero_respawn_counts_by_level[LEVEL_RECORD_COUNT] __asm__("D_0013DFD8"); @@ -31,7 +31,8 @@ extern unsigned char visited52[LEVEL_RECORD_COUNT * 16] __asm__("D_0014C050"); extern s32 D_0014C190_257218[LEVEL_RECORD_COUNT][64] __asm__("D_0014C190"); /* bolt_source_stats (D_0014D590, rnc/game/bolt_sources.h) follows. */ /* Hero respawns per level and damage source category; level code counts them. */ -extern s32 hero_respawn_counts_by_level_and_source_category[LEVEL_RECORD_COUNT][16] __asm__("D_0014E990"); +extern s32 + hero_respawn_counts_by_level_and_source_category[LEVEL_RECORD_COUNT][16] __asm__("D_0014E990"); /* Per-mission counters the level loader clears (16 slots). */ extern s32 D_0014EE90[16]; diff --git a/include/rnc/ui/map/level_map.h b/include/rnc/ui/map/level_map.h index 42e5f8d36b..2492ac0f83 100644 --- a/include/rnc/ui/map/level_map.h +++ b/include/rnc/ui/map/level_map.h @@ -19,6 +19,6 @@ typedef struct { } LevelSelectText; extern LevelSelectText level_select_texts[19] __asm__("D_001DDD40"); -extern LevelMapMarker level_map_markers[20] __asm__("D_001DDE28"); +extern LevelMapMarker level_map_markers[20] __asm__("D_001DDE28"); #endif /* LOMBYTE_RNC_UI_MAP_LEVEL_MAP_H */ diff --git a/src/audio/banks/snd_bank_load_by_loc.c b/src/audio/banks/snd_bank_load_by_loc.c index 5657514abe..758980c846 100644 --- a/src/audio/banks/snd_bank_load_by_loc.c +++ b/src/audio/banks/snd_bank_load_by_loc.c @@ -3,15 +3,15 @@ #include "rnc/sdk/libc/stdio.h" #include "rnc/sdk/rpc/rpc.h" -extern s32 snd_cd_bank_load_request[] __asm__("D_00137B40"); -extern char snd_non_idle_error_string[] __asm__("D_00153D20"); +extern s32 snd_cd_bank_load_request[] __asm__("D_00137B40"); +extern char snd_non_idle_error_string[] __asm__("D_00153D20"); extern const char snd_bank_load_by_loc_rpc_error_string[] __asm__("D_00153DF8"); -extern u8 sound_stream_client[] __asm__("D_0015EBE8"); -extern s32 snd_cd_load_error __asm__("D_0015EC88") __attribute__((sda)); -extern u32 snd_cd_callback_arg __asm__("D_0015ED00"); -extern s32 snd_stream_safe_cd_sync(s32) __asm__("func_0012EE08"); -extern void snd_flush_sound_commands(void) __asm__("func_0012DC80"); -extern void FlushCache(s32); +extern u8 sound_stream_client[] __asm__("D_0015EBE8"); +extern s32 snd_cd_load_error __asm__("D_0015EC88") __attribute__((sda)); +extern u32 snd_cd_callback_arg __asm__("D_0015ED00"); +extern s32 snd_stream_safe_cd_sync(s32) __asm__("func_0012EE08"); +extern void snd_flush_sound_commands(void) __asm__("func_0012DC80"); +extern void FlushCache(s32); s32 snd_bank_load_by_loc(s32 location, s32 byte_offset) __asm__("FUN_0012df20"); diff --git a/src/audio/snd_start_sound_system.c b/src/audio/snd_start_sound_system.c index 8f3c3fa6e3..1aa1f8390e 100644 --- a/src/audio/snd_start_sound_system.c +++ b/src/audio/snd_start_sound_system.c @@ -16,10 +16,10 @@ struct SifClientDataStartSound { extern struct SifClientDataStartSound sound_command_client __asm__("D_0015EBC0"); extern struct SifClientDataStartSound sound_stream_client __asm__("D_0015EBE8"); extern s32 D_0015ECAC MACRO_ADDR; /* snd_batch_free_bytes[1], stored through the macro form */ -extern s32 snd_cd_callback_pending __asm__("D_0015ECC8") __attribute__((sda)); -extern s32 snd_cd_callback_fn __asm__("D_0015ECD0") __attribute__((sda)); -extern s64 snd_cd_callback_data __asm__("D_0015ECD8") MACRO_ADDR; -extern u32 snd_cd_callback_arg __asm__("D_0015ED00") MACRO_ADDR; +extern s32 snd_cd_callback_pending __asm__("D_0015ECC8") __attribute__((sda)); +extern s32 snd_cd_callback_fn __asm__("D_0015ECD0") __attribute__((sda)); +extern s64 snd_cd_callback_data __asm__("D_0015ECD8") MACRO_ADDR; +extern u32 snd_cd_callback_arg __asm__("D_0015ED00") MACRO_ADDR; extern s32 snd_send_iop_command_and_wait(s32, s32, void *) __asm__("func_0012E548"); @@ -27,11 +27,14 @@ s32 snd_start_sound_system(void) __asm__("FUN_0012da28"); /* The two command batches: their buffers, free bytes, callback records and reply buffers. snd_start_sound_system stores the same values again. */ -s32 *snd_batch_command_buffers[2] __asm__("D_0015ECA0") = {snd_command_buffer1, - snd_command_buffer2}; -s32 snd_batch_free_bytes[2] __asm__("D_0015ECA8") = {0xFFC, 0xFFC}; +s32 *snd_batch_command_buffers[2] __asm__("D_0015ECA0") = {snd_command_buffer1, + snd_command_buffer2}; + +s32 snd_batch_free_bytes[2] __asm__("D_0015ECA8") = {0xFFC, 0xFFC}; + struct SndCommandCallback *snd_stream_buffers[2] __asm__("D_0015ECB0") = {snd_stream_buffer1, - snd_stream_buffer2}; + snd_stream_buffer2}; + s32 *snd_batch_return_buffers[2] __asm__("D_0015ECB8") = {snd_return_buffer1, snd_return_buffer2}; const char snd_sif_bind_rpc_error_string[] __asm__("D_00153C50") = diff --git a/src/audio/streaming/start_audio_stream_read.c b/src/audio/streaming/start_audio_stream_read.c index 0b01adc9de..33b26a5f10 100644 --- a/src/audio/streaming/start_audio_stream_read.c +++ b/src/audio/streaming/start_audio_stream_read.c @@ -2,8 +2,8 @@ #include "rnc/audio/music/music_stream_state.h" #include "rnc/sdk/debug.h" -const char cd_read_start_failure_message[] __asm__("D_001E8650") = - "****Load file failed to start!****\n"; +const char + cd_read_start_failure_message[] __asm__("D_001E8650") = "****Load file failed to start!****\n"; extern s32 RaiseKernelTrap(); extern s32 snd_stream_safe_cd_read() __asm__("func_0012ED58"); s32 start_audio_stream_read(s32 dst, s32 sector, s32 sector_count) __asm__("FUN_00216788"); diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index 587ad08170..8a751a1911 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -571,9 +571,9 @@ struct MenuPage map_circle_destination_page = { }; struct MenuLabelScreen map_location_label = { - { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, + { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | -MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, +MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, 0xC } }; @@ -620,9 +620,9 @@ struct MenuStreamScreen missions_picture_screen = { }; struct MenuLabelScreen missions_location_label = { - { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, + { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | -MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, +MENU_LABEL_CENTER_X, (s32)&level_select_texts[1].description_text, 0xC } }; diff --git a/src/audio/voices/set_sound_handle_id.c b/src/audio/voices/set_sound_handle_id.c index a90127f685..0efc889e0e 100644 --- a/src/audio/voices/set_sound_handle_id.c +++ b/src/audio/voices/set_sound_handle_id.c @@ -8,7 +8,7 @@ struct Handle { }; extern const char sound_handle_id_conflict_diagnostic[] __asm__("D_00160068"); -void set_sound_handle_id(u32 id, s64 arg) __asm__("FUN_00216b68"); +void set_sound_handle_id(u32 id, s64 arg) __asm__("FUN_00216b68"); void set_sound_handle_id(u32 id, s64 playback_record_address) { struct Handle *playback_record = (struct Handle *)(s32)playback_record_address; diff --git a/src/game/missions/check_mission_condition.c b/src/game/missions/check_mission_condition.c index 1b2903e952..01402722e4 100644 --- a/src/game/missions/check_mission_condition.c +++ b/src/game/missions/check_mission_condition.c @@ -43,7 +43,8 @@ s32 check_mission_condition(s16 kind, s32 condition_operand) { case MISSION_CONDITION_CALLBACK_NONZERO: return ((s32(*)(void))condition_operand)() != 0; case MISSION_CONDITION_GOLD_BOLT_COLLECTED: - return gold_bolts_collected[(condition_operand & 0xFFFF) + (condition_operand >> 16) * 4] != 0; + return gold_bolts_collected[(condition_operand & 0xFFFF) + (condition_operand >> 16) * 4] != + 0; case MISSION_CONDITION_ALWAYS_FALSE: return 0; } diff --git a/src/game/missions/get_map_point_mission_status.c b/src/game/missions/get_map_point_mission_status.c index 3f2e358653..f6bdf3008e 100644 --- a/src/game/missions/get_map_point_mission_status.c +++ b/src/game/missions/get_map_point_mission_status.c @@ -3,6 +3,7 @@ #include "rnc/game/level_object_states.h" #include "rnc/game/item_state.h" + /* Two flat `&&` returns over level_object_states[20/24/22].state; retail's reuse of the %hi register comes out by itself. */ int get_map_point_mission_status(void) __asm__("FUN_0020be80"); diff --git a/src/game/transitions/do_space_transition.c b/src/game/transitions/do_space_transition.c index fce49734a5..ade38ede9a 100644 --- a/src/game/transitions/do_space_transition.c +++ b/src/game/transitions/do_space_transition.c @@ -40,7 +40,7 @@ extern s32 game_frame_counter_macro __asm__("D_0015F438") M extern s32 space_load_in_progress __asm__("D_0015F618") MACRO_ADDR; extern struct Globals_0015F634 *level_sound_defs __asm__("D_0015F634"); extern struct Globals_00194100 coll_output __asm__("D_00194100"); -extern const char unloaded_sound_bank_format[] __asm__("D_001E8988"); +extern const char unloaded_sound_bank_format[] __asm__("D_001E8988"); extern void FlushCache(s32); extern void snd_flush_sound_commands(void) __asm__("func_0012DC80"); diff --git a/src/math/rotations/matrix_to_quaternion.c b/src/math/rotations/matrix_to_quaternion.c index c739fb911a..b7d979bd3e 100644 --- a/src/math/rotations/matrix_to_quaternion.c +++ b/src/math/rotations/matrix_to_quaternion.c @@ -66,4 +66,6 @@ extern __typeof__(matrix_to_quaternion) func_00214260 __attribute__((alias("FUN_ /* The axis after i, cyclically: 0 -> 1 -> 2 -> 0. Small data in retail, defined below its only user, so the function reaches it with lui. */ -QuatNext matrix_to_quaternion_next_axis_table __attribute__((section(".sdata"))) = {{1, 2, 0}}; +QuatNext matrix_to_quaternion_next_axis_table __attribute__((section(".sdata"))) = { + {1, 2, 0} +}; diff --git a/src/mobys/animation/process_moby_anim_data.c b/src/mobys/animation/process_moby_anim_data.c index 60d4a4cc15..ae3c04f0c7 100644 --- a/src/mobys/animation/process_moby_anim_data.c +++ b/src/mobys/animation/process_moby_anim_data.c @@ -14,262 +14,262 @@ void process_moby_anim_data(void) { } f32 normal_lut[256][2] = { - {1.0f, 0.0f}, - {0.9996988f, 0.024541229f}, - {0.99879545f, 0.049067676f}, - {0.99729043f, 0.07356457f}, - {0.9951847f, 0.09801714f}, - {0.99247956f, 0.12241067f}, - {0.9891765f, 0.14673047f}, - {0.98527765f, 0.17096189f}, - {0.98078525f, 0.19509032f}, - {0.9757021f, 0.21910124f}, - {0.97003126f, 0.24298018f}, - {0.96377605f, 0.26671275f}, - {0.95694035f, 0.29028466f}, - {0.94952816f, 0.31368172f}, - {0.94154406f, 0.33688983f}, - {0.9329928f, 0.35989505f}, - {0.9238795f, 0.38268346f}, - {0.9142098f, 0.4052413f}, - {0.9039893f, 0.42755508f}, - {0.8932243f, 0.44961134f}, - {0.8819213f, 0.4713967f}, - {0.870087f, 0.49289817f}, - {0.8577286f, 0.51410276f}, - {0.8448536f, 0.53499764f}, - {0.8314696f, 0.55557024f}, - {0.8175848f, 0.5758082f}, - {0.8032076f, 0.59569925f}, - {0.78834647f, 0.6152316f}, - {0.7730105f, 0.6343933f}, - {0.7572088f, 0.65317285f}, - {0.7409511f, 0.671559f}, - {0.7242471f, 0.68954057f}, - {0.70710677f, 0.70710677f}, - {0.68954057f, 0.72424704f}, - {0.671559f, 0.7409511f}, - {0.65317285f, 0.7572088f}, - {0.6343933f, 0.77301043f}, - {0.6152316f, 0.7883464f}, - {0.5956993f, 0.8032075f}, - {0.5758082f, 0.8175848f}, - {0.55557024f, 0.8314696f}, - {0.53499764f, 0.8448536f}, - {0.5141028f, 0.8577286f}, - {0.4928982f, 0.87008697f}, - {0.47139677f, 0.88192123f}, - {0.4496114f, 0.89322424f}, - {0.4275551f, 0.9039893f}, - {0.40524137f, 0.9142097f}, - {0.38268343f, 0.9238795f}, - {0.35989508f, 0.93299276f}, - {0.33688983f, 0.94154406f}, - {0.31368175f, 0.94952816f}, - {0.29028475f, 0.9569403f}, - {0.26671275f, 0.96377605f}, - {0.24298024f, 0.97003126f}, - {0.21910122f, 0.9757021f}, - {0.19509035f, 0.98078525f}, - {0.17096186f, 0.98527765f}, - {0.1467305f, 0.9891765f}, - {0.12241074f, 0.9924795f}, - {0.098017134f, 0.9951847f}, - {0.07356461f, 0.99729043f}, - {0.04906765f, 0.99879545f}, - {0.024541255f, 0.9996988f}, - {0.0f, 1.0f}, - {-0.024541223f, 0.9996988f}, - {-0.04906762f, 0.99879545f}, - {-0.073564574f, 0.99729043f}, - {-0.098017104f, 0.9951847f}, - {-0.12241071f, 0.9924795f}, - {-0.14673045f, 0.9891765f}, - {-0.17096183f, 0.98527765f}, - {-0.19509032f, 0.98078525f}, - {-0.21910119f, 0.97570217f}, - {-0.2429802f, 0.97003126f}, - {-0.26671273f, 0.96377605f}, - {-0.29028472f, 0.9569403f}, - {-0.31368172f, 0.94952816f}, - {-0.3368898f, 0.94154406f}, - {-0.35989505f, 0.9329928f}, - {-0.3826834f, 0.92387956f}, - {-0.40524134f, 0.9142097f}, - {-0.42755508f, 0.9039893f}, - {-0.44961137f, 0.8932243f}, - {-0.47139663f, 0.8819213f}, - {-0.49289817f, 0.870087f}, - {-0.51410276f, 0.8577286f}, - {-0.5349975f, 0.84485364f}, - {-0.5555702f, 0.83146966f}, - {-0.57580817f, 0.8175848f}, - {-0.5956992f, 0.80320764f}, - {-0.6152315f, 0.78834647f}, - {-0.6343933f, 0.7730105f}, - {-0.65317285f, 0.7572088f}, - {-0.67155886f, 0.74095124f}, - {-0.6895405f, 0.7242471f}, - {-0.70710677f, 0.70710677f}, - {-0.724247f, 0.6895407f}, - {-0.74095106f, 0.67155904f}, - {-0.7572088f, 0.65317285f}, - {-0.7730105f, 0.6343933f}, - {-0.78834635f, 0.6152317f}, - {-0.8032075f, 0.59569937f}, - {-0.8175848f, 0.57580817f}, - {-0.83146954f, 0.55557036f}, - {-0.8448535f, 0.5349977f}, - {-0.8577286f, 0.51410276f}, - {-0.870087f, 0.49289814f}, - {-0.88192123f, 0.47139683f}, - {-0.8932243f, 0.44961137f}, - {-0.9039893f, 0.42755505f}, - {-0.9142097f, 0.40524143f}, - {-0.9238795f, 0.3826835f}, - {-0.9329928f, 0.35989505f}, - {-0.9415441f, 0.3368898f}, - {-0.94952816f, 0.31368184f}, - {-0.95694035f, 0.29028472f}, - {-0.96377605f, 0.26671273f}, - {-0.9700312f, 0.2429803f}, - {-0.9757021f, 0.2191013f}, - {-0.9807853f, 0.19509031f}, - {-0.98527765f, 0.17096181f}, - {-0.9891765f, 0.14673057f}, - {-0.9924795f, 0.1224107f}, - {-0.9951847f, 0.0980171f}, - {-0.99729043f, 0.073564686f}, - {-0.99879545f, 0.049067724f}, - {-0.9996988f, 0.02454121f}, - {-1.0f, 0.0f}, - {-0.9996988f, -0.024541147f}, - {-0.99879545f, -0.04906766f}, - {-0.99729043f, -0.07356462f}, - {-0.9951847f, -0.09801703f}, - {-0.99247956f, -0.12241063f}, - {-0.9891765f, -0.1467305f}, - {-0.98527765f, -0.17096175f}, - {-0.9807853f, -0.19509025f}, - {-0.9757021f, -0.21910124f}, - {-0.97003126f, -0.24298024f}, - {-0.9637761f, -0.26671267f}, - {-0.95694035f, -0.29028463f}, - {-0.94952816f, -0.31368178f}, - {-0.9415441f, -0.33688974f}, - {-0.9329928f, -0.359895f}, - {-0.9238795f, -0.38268343f}, - {-0.9142097f, -0.4052414f}, - {-0.9039893f, -0.42755502f}, - {-0.8932243f, -0.4496113f}, - {-0.88192123f, -0.47139677f}, - {-0.870087f, -0.49289808f}, - {-0.85772866f, -0.5141027f}, - {-0.8448536f, -0.53499764f}, - {-0.83146954f, -0.5555703f}, - {-0.8175849f, -0.5758081f}, - {-0.8032075f, -0.5956993f}, - {-0.7883464f, -0.61523163f}, - {-0.77301055f, -0.6343932f}, - {-0.7572089f, -0.6531728f}, - {-0.7409511f, -0.671559f}, - {-0.72424704f, -0.6895406f}, - {-0.7071068f, -0.7071067f}, - {-0.68954057f, -0.7242471f}, - {-0.6715589f, -0.7409512f}, - {-0.6531729f, -0.75720876f}, - {-0.63439333f, -0.77301043f}, - {-0.6152316f, -0.78834647f}, - {-0.5956992f, -0.8032076f}, - {-0.5758084f, -0.81758463f}, - {-0.5555704f, -0.8314695f}, - {-0.53499776f, -0.84485346f}, - {-0.5141028f, -0.85772854f}, - {-0.4928982f, -0.87008697f}, - {-0.47139668f, -0.8819213f}, - {-0.44961163f, -0.8932241f}, - {-0.42755535f, -0.9039892f}, - {-0.40524152f, -0.91420966f}, - {-0.38268358f, -0.9238795f}, - {-0.3598951f, -0.93299276f}, - {-0.33688986f, -0.94154406f}, - {-0.3136817f, -0.9495282f}, - {-0.29028502f, -0.95694023f}, - {-0.26671302f, -0.963776f}, - {-0.24298038f, -0.9700312f}, - {-0.21910137f, -0.9757021f}, - {-0.19509038f, -0.98078525f}, - {-0.17096189f, -0.98527765f}, - {-0.14673041f, -0.9891765f}, - {-0.122411005f, -0.9924795f}, - {-0.0980174f, -0.9951847f}, - {-0.07356476f, -0.99729043f}, - {-0.049067803f, -0.99879545f}, - {-0.024541287f, -0.9996988f}, - {0.0f, -1.0f}, - {0.02454131f, -0.9996988f}, - {0.04906735f, -0.99879545f}, - {0.073564306f, -0.9972905f}, - {0.098016955f, -0.9951847f}, - {0.12241056f, -0.99247956f}, - {0.14673042f, -0.9891765f}, - {0.17096192f, -0.98527765f}, - {0.19509041f, -0.98078525f}, - {0.21910094f, -0.9757022f}, - {0.24297994f, -0.9700313f}, - {0.26671258f, -0.9637761f}, - {0.29028457f, -0.95694035f}, - {0.3136817f, -0.9495282f}, - {0.3368899f, -0.94154406f}, - {0.35989514f, -0.93299276f}, - {0.38268316f, -0.9238796f}, - {0.4052411f, -0.91420984f}, - {0.42755494f, -0.9039894f}, - {0.44961125f, -0.89322436f}, - {0.4713967f, -0.8819213f}, - {0.49289823f, -0.87008697f}, - {0.5141028f, -0.85772854f}, - {0.53499734f, -0.8448537f}, - {0.55557007f, -0.8314697f}, - {0.57580805f, -0.81758493f}, - {0.59569925f, -0.8032076f}, - {0.6152316f, -0.7883464f}, - {0.63439333f, -0.77301043f}, - {0.6531729f, -0.75720876f}, - {0.67155874f, -0.7409513f}, - {0.6895404f, -0.7242472f}, - {0.70710665f, -0.7071069f}, - {0.72424704f, -0.6895406f}, - {0.7409511f, -0.671559f}, - {0.7572089f, -0.6531728f}, - {0.77301055f, -0.63439316f}, - {0.78834623f, -0.6152318f}, - {0.8032074f, -0.5956995f}, - {0.81758475f, -0.5758083f}, - {0.8314696f, -0.5555703f}, - {0.8448536f, -0.53499764f}, - {0.85772866f, -0.5141027f}, - {0.8700871f, -0.49289808f}, - {0.8819211f, -0.47139698f}, - {0.89322424f, -0.4496115f}, - {0.90398926f, -0.4275552f}, - {0.9142097f, -0.40524137f}, - {0.92387956f, -0.38268343f}, - {0.9329928f, -0.35989496f}, - {0.9415441f, -0.3368897f}, - {0.9495281f, -0.313682f}, - {0.9569403f, -0.29028484f}, - {0.96377605f, -0.26671287f}, - {0.97003126f, -0.24298023f}, - {0.9757021f, -0.21910122f}, - {0.9807853f, -0.19509023f}, - {0.98527765f, -0.17096172f}, - {0.98917645f, -0.14673072f}, - {0.9924795f, -0.12241085f}, - {0.9951847f, -0.098017246f}, - {0.99729043f, -0.0735646f}, - {0.99879545f, -0.04906764f}, - {0.9996988f, -0.024541123f}, + { 1.0f, 0.0f}, + { 0.9996988f, 0.024541229f}, + { 0.99879545f, 0.049067676f}, + { 0.99729043f, 0.07356457f}, + { 0.9951847f, 0.09801714f}, + { 0.99247956f, 0.12241067f}, + { 0.9891765f, 0.14673047f}, + { 0.98527765f, 0.17096189f}, + { 0.98078525f, 0.19509032f}, + { 0.9757021f, 0.21910124f}, + { 0.97003126f, 0.24298018f}, + { 0.96377605f, 0.26671275f}, + { 0.95694035f, 0.29028466f}, + { 0.94952816f, 0.31368172f}, + { 0.94154406f, 0.33688983f}, + { 0.9329928f, 0.35989505f}, + { 0.9238795f, 0.38268346f}, + { 0.9142098f, 0.4052413f}, + { 0.9039893f, 0.42755508f}, + { 0.8932243f, 0.44961134f}, + { 0.8819213f, 0.4713967f}, + { 0.870087f, 0.49289817f}, + { 0.8577286f, 0.51410276f}, + { 0.8448536f, 0.53499764f}, + { 0.8314696f, 0.55557024f}, + { 0.8175848f, 0.5758082f}, + { 0.8032076f, 0.59569925f}, + { 0.78834647f, 0.6152316f}, + { 0.7730105f, 0.6343933f}, + { 0.7572088f, 0.65317285f}, + { 0.7409511f, 0.671559f}, + { 0.7242471f, 0.68954057f}, + { 0.70710677f, 0.70710677f}, + { 0.68954057f, 0.72424704f}, + { 0.671559f, 0.7409511f}, + { 0.65317285f, 0.7572088f}, + { 0.6343933f, 0.77301043f}, + { 0.6152316f, 0.7883464f}, + { 0.5956993f, 0.8032075f}, + { 0.5758082f, 0.8175848f}, + { 0.55557024f, 0.8314696f}, + { 0.53499764f, 0.8448536f}, + { 0.5141028f, 0.8577286f}, + { 0.4928982f, 0.87008697f}, + { 0.47139677f, 0.88192123f}, + { 0.4496114f, 0.89322424f}, + { 0.4275551f, 0.9039893f}, + { 0.40524137f, 0.9142097f}, + { 0.38268343f, 0.9238795f}, + { 0.35989508f, 0.93299276f}, + { 0.33688983f, 0.94154406f}, + { 0.31368175f, 0.94952816f}, + { 0.29028475f, 0.9569403f}, + { 0.26671275f, 0.96377605f}, + { 0.24298024f, 0.97003126f}, + { 0.21910122f, 0.9757021f}, + { 0.19509035f, 0.98078525f}, + { 0.17096186f, 0.98527765f}, + { 0.1467305f, 0.9891765f}, + { 0.12241074f, 0.9924795f}, + { 0.098017134f, 0.9951847f}, + { 0.07356461f, 0.99729043f}, + { 0.04906765f, 0.99879545f}, + { 0.024541255f, 0.9996988f}, + { 0.0f, 1.0f}, + {-0.024541223f, 0.9996988f}, + { -0.04906762f, 0.99879545f}, + {-0.073564574f, 0.99729043f}, + {-0.098017104f, 0.9951847f}, + { -0.12241071f, 0.9924795f}, + { -0.14673045f, 0.9891765f}, + { -0.17096183f, 0.98527765f}, + { -0.19509032f, 0.98078525f}, + { -0.21910119f, 0.97570217f}, + { -0.2429802f, 0.97003126f}, + { -0.26671273f, 0.96377605f}, + { -0.29028472f, 0.9569403f}, + { -0.31368172f, 0.94952816f}, + { -0.3368898f, 0.94154406f}, + { -0.35989505f, 0.9329928f}, + { -0.3826834f, 0.92387956f}, + { -0.40524134f, 0.9142097f}, + { -0.42755508f, 0.9039893f}, + { -0.44961137f, 0.8932243f}, + { -0.47139663f, 0.8819213f}, + { -0.49289817f, 0.870087f}, + { -0.51410276f, 0.8577286f}, + { -0.5349975f, 0.84485364f}, + { -0.5555702f, 0.83146966f}, + { -0.57580817f, 0.8175848f}, + { -0.5956992f, 0.80320764f}, + { -0.6152315f, 0.78834647f}, + { -0.6343933f, 0.7730105f}, + { -0.65317285f, 0.7572088f}, + { -0.67155886f, 0.74095124f}, + { -0.6895405f, 0.7242471f}, + { -0.70710677f, 0.70710677f}, + { -0.724247f, 0.6895407f}, + { -0.74095106f, 0.67155904f}, + { -0.7572088f, 0.65317285f}, + { -0.7730105f, 0.6343933f}, + { -0.78834635f, 0.6152317f}, + { -0.8032075f, 0.59569937f}, + { -0.8175848f, 0.57580817f}, + { -0.83146954f, 0.55557036f}, + { -0.8448535f, 0.5349977f}, + { -0.8577286f, 0.51410276f}, + { -0.870087f, 0.49289814f}, + { -0.88192123f, 0.47139683f}, + { -0.8932243f, 0.44961137f}, + { -0.9039893f, 0.42755505f}, + { -0.9142097f, 0.40524143f}, + { -0.9238795f, 0.3826835f}, + { -0.9329928f, 0.35989505f}, + { -0.9415441f, 0.3368898f}, + { -0.94952816f, 0.31368184f}, + { -0.95694035f, 0.29028472f}, + { -0.96377605f, 0.26671273f}, + { -0.9700312f, 0.2429803f}, + { -0.9757021f, 0.2191013f}, + { -0.9807853f, 0.19509031f}, + { -0.98527765f, 0.17096181f}, + { -0.9891765f, 0.14673057f}, + { -0.9924795f, 0.1224107f}, + { -0.9951847f, 0.0980171f}, + { -0.99729043f, 0.073564686f}, + { -0.99879545f, 0.049067724f}, + { -0.9996988f, 0.02454121f}, + { -1.0f, 0.0f}, + { -0.9996988f, -0.024541147f}, + { -0.99879545f, -0.04906766f}, + { -0.99729043f, -0.07356462f}, + { -0.9951847f, -0.09801703f}, + { -0.99247956f, -0.12241063f}, + { -0.9891765f, -0.1467305f}, + { -0.98527765f, -0.17096175f}, + { -0.9807853f, -0.19509025f}, + { -0.9757021f, -0.21910124f}, + { -0.97003126f, -0.24298024f}, + { -0.9637761f, -0.26671267f}, + { -0.95694035f, -0.29028463f}, + { -0.94952816f, -0.31368178f}, + { -0.9415441f, -0.33688974f}, + { -0.9329928f, -0.359895f}, + { -0.9238795f, -0.38268343f}, + { -0.9142097f, -0.4052414f}, + { -0.9039893f, -0.42755502f}, + { -0.8932243f, -0.4496113f}, + { -0.88192123f, -0.47139677f}, + { -0.870087f, -0.49289808f}, + { -0.85772866f, -0.5141027f}, + { -0.8448536f, -0.53499764f}, + { -0.83146954f, -0.5555703f}, + { -0.8175849f, -0.5758081f}, + { -0.8032075f, -0.5956993f}, + { -0.7883464f, -0.61523163f}, + { -0.77301055f, -0.6343932f}, + { -0.7572089f, -0.6531728f}, + { -0.7409511f, -0.671559f}, + { -0.72424704f, -0.6895406f}, + { -0.7071068f, -0.7071067f}, + { -0.68954057f, -0.7242471f}, + { -0.6715589f, -0.7409512f}, + { -0.6531729f, -0.75720876f}, + { -0.63439333f, -0.77301043f}, + { -0.6152316f, -0.78834647f}, + { -0.5956992f, -0.8032076f}, + { -0.5758084f, -0.81758463f}, + { -0.5555704f, -0.8314695f}, + { -0.53499776f, -0.84485346f}, + { -0.5141028f, -0.85772854f}, + { -0.4928982f, -0.87008697f}, + { -0.47139668f, -0.8819213f}, + { -0.44961163f, -0.8932241f}, + { -0.42755535f, -0.9039892f}, + { -0.40524152f, -0.91420966f}, + { -0.38268358f, -0.9238795f}, + { -0.3598951f, -0.93299276f}, + { -0.33688986f, -0.94154406f}, + { -0.3136817f, -0.9495282f}, + { -0.29028502f, -0.95694023f}, + { -0.26671302f, -0.963776f}, + { -0.24298038f, -0.9700312f}, + { -0.21910137f, -0.9757021f}, + { -0.19509038f, -0.98078525f}, + { -0.17096189f, -0.98527765f}, + { -0.14673041f, -0.9891765f}, + {-0.122411005f, -0.9924795f}, + { -0.0980174f, -0.9951847f}, + { -0.07356476f, -0.99729043f}, + {-0.049067803f, -0.99879545f}, + {-0.024541287f, -0.9996988f}, + { 0.0f, -1.0f}, + { 0.02454131f, -0.9996988f}, + { 0.04906735f, -0.99879545f}, + { 0.073564306f, -0.9972905f}, + { 0.098016955f, -0.9951847f}, + { 0.12241056f, -0.99247956f}, + { 0.14673042f, -0.9891765f}, + { 0.17096192f, -0.98527765f}, + { 0.19509041f, -0.98078525f}, + { 0.21910094f, -0.9757022f}, + { 0.24297994f, -0.9700313f}, + { 0.26671258f, -0.9637761f}, + { 0.29028457f, -0.95694035f}, + { 0.3136817f, -0.9495282f}, + { 0.3368899f, -0.94154406f}, + { 0.35989514f, -0.93299276f}, + { 0.38268316f, -0.9238796f}, + { 0.4052411f, -0.91420984f}, + { 0.42755494f, -0.9039894f}, + { 0.44961125f, -0.89322436f}, + { 0.4713967f, -0.8819213f}, + { 0.49289823f, -0.87008697f}, + { 0.5141028f, -0.85772854f}, + { 0.53499734f, -0.8448537f}, + { 0.55557007f, -0.8314697f}, + { 0.57580805f, -0.81758493f}, + { 0.59569925f, -0.8032076f}, + { 0.6152316f, -0.7883464f}, + { 0.63439333f, -0.77301043f}, + { 0.6531729f, -0.75720876f}, + { 0.67155874f, -0.7409513f}, + { 0.6895404f, -0.7242472f}, + { 0.70710665f, -0.7071069f}, + { 0.72424704f, -0.6895406f}, + { 0.7409511f, -0.671559f}, + { 0.7572089f, -0.6531728f}, + { 0.77301055f, -0.63439316f}, + { 0.78834623f, -0.6152318f}, + { 0.8032074f, -0.5956995f}, + { 0.81758475f, -0.5758083f}, + { 0.8314696f, -0.5555703f}, + { 0.8448536f, -0.53499764f}, + { 0.85772866f, -0.5141027f}, + { 0.8700871f, -0.49289808f}, + { 0.8819211f, -0.47139698f}, + { 0.89322424f, -0.4496115f}, + { 0.90398926f, -0.4275552f}, + { 0.9142097f, -0.40524137f}, + { 0.92387956f, -0.38268343f}, + { 0.9329928f, -0.35989496f}, + { 0.9415441f, -0.3368897f}, + { 0.9495281f, -0.313682f}, + { 0.9569403f, -0.29028484f}, + { 0.96377605f, -0.26671287f}, + { 0.97003126f, -0.24298023f}, + { 0.9757021f, -0.21910122f}, + { 0.9807853f, -0.19509023f}, + { 0.98527765f, -0.17096172f}, + { 0.98917645f, -0.14673072f}, + { 0.9924795f, -0.12241085f}, + { 0.9951847f, -0.098017246f}, + { 0.99729043f, -0.0735646f}, + { 0.99879545f, -0.04906764f}, + { 0.9996988f, -0.024541123f}, }; s32 D_0015F63C = 0; diff --git a/src/mobys/animation/update_resident_dialogue_animation_state.c b/src/mobys/animation/update_resident_dialogue_animation_state.c index ddcd02b44b..75c4593a0b 100644 --- a/src/mobys/animation/update_resident_dialogue_animation_state.c +++ b/src/mobys/animation/update_resident_dialogue_animation_state.c @@ -38,8 +38,11 @@ extern s32 D_001516EC NOT_SDA; extern s16 D_0015172A NOT_SDA; /* Small data, defined above the code so it is reached $gp-relative. */ s32 resident_dialogue_after_completion_wait_thresholds[2] __asm__("D_00161030") = {100, 100}; + s32 resident_dialogue_after_start_wait_thresholds[2] __asm__("D_00161038") = {200, 100}; + s32 resident_dialogue_before_timed_idle_restore_thresholds[2] __asm__("D_00161040") = {44, 100}; + extern s32 D_001610B0 MACRO_ADDR; extern s32 D_001610B4 MACRO_ADDR; extern BossVars D_001E63C0; diff --git a/src/mobys/resolve_moby_hit_response.c b/src/mobys/resolve_moby_hit_response.c index 87be175900..987423b530 100644 --- a/src/mobys/resolve_moby_hit_response.c +++ b/src/mobys/resolve_moby_hit_response.c @@ -51,9 +51,10 @@ typedef struct { f32 x, y; } O_25a478; -extern u8 D_0013E533[]; +extern u8 D_0013E533[]; /* Small data, defined above the code so it is reached $gp-relative. */ f32 hit_damage_override_table[2] __asm__("D_0015FFC8") = {1.0f, 0.667f}; + extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern f32 fast_arc_tan(f32, f32) __asm__("func_001F9E90"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); diff --git a/src/mobys/update_visible_mobys.c b/src/mobys/update_visible_mobys.c index 3e42714553..6eab3dc185 100644 --- a/src/mobys/update_visible_mobys.c +++ b/src/mobys/update_visible_mobys.c @@ -8,7 +8,7 @@ #define MOBY_SKIP_BOUNDS 0x4 /* Small data, defined above the code so it is reached $gp-relative. */ -struct Moby *visible_moby_list __asm__("D_0015FF24") = 0; +struct Moby *visible_moby_list __asm__("D_0015FF24") = 0; extern struct Moby *build_resident_visibility_list(void) __asm__("FUN_0020d868"); extern void advance_moby_animation(struct Moby *) __asm__("FUN_0020d580"); void update_visible_mobys(void) __asm__("FUN_00212e28"); diff --git a/src/movies/decoder/callbacks/mpeg_error.c b/src/movies/decoder/callbacks/mpeg_error.c index 336085b337..729834b257 100644 --- a/src/movies/decoder/callbacks/mpeg_error.c +++ b/src/movies/decoder/callbacks/mpeg_error.c @@ -7,7 +7,7 @@ struct MpegErrorData { }; extern const char video_error_message[] __asm__("D_00161220"); -s32 mpeg_error(s32 unused_mpeg, struct MpegErrorData *cb_data) __asm__("FUN_0023d080"); +s32 mpeg_error(s32 unused_mpeg, struct MpegErrorData *cb_data) __asm__("FUN_0023d080"); s32 mpeg_error(s32 unused_mpeg, struct MpegErrorData *cb_data) { DebugPrint(video_error_message, cb_data->unk4); diff --git a/src/movies/decoder/callbacks/video_callback.c b/src/movies/decoder/callbacks/video_callback.c index 38f3229788..d445701909 100644 --- a/src/movies/decoder/callbacks/video_callback.c +++ b/src/movies/decoder/callbacks/video_callback.c @@ -12,7 +12,7 @@ struct VdecCb { #include "rnc/movies/decoder/decoder_globals.h" #include "rnc/movies/player/movie_player.h" -const char pts_buffer_overflow_message[] __asm__("D_001E8B08") = "pts buffer overflow\n"; +const char pts_buffer_overflow_message[] __asm__("D_001E8B08") = "pts buffer overflow\n"; extern void err_message(u8 *) __asm__("func_0023AB78"); extern s32 cpy2area(u32, s32, u32, s32, u8 *, s32, struct ReadBuf *, s32) __asm__("func_0023B810"); extern void diff --git a/src/movies/decoder/dec_bs0.c b/src/movies/decoder/dec_bs0.c index e279b15339..fb53bfa150 100644 --- a/src/movies/decoder/dec_bs0.c +++ b/src/movies/decoder/dec_bs0.c @@ -13,7 +13,7 @@ extern struct MoviePlayer *movie_player_macro __asm__("D_0016120C") MACRO_ADDR; #define voBuf (movie_player_macro->vo_buf) extern void set_image_tag(void *, int, int, int) __asm__("func_0023B210"); /* setImageTag */ extern void switch_thread(void) __asm__("func_0023A770"); /* switchThread */ -extern void err_message(const char *) __asm__("func_0023AB78"); /* ErrMessage */ +extern void err_message(const char *) __asm__("func_0023AB78"); /* ErrMessage */ /* decBs0(VideoDec *) */ int dec_bs0(struct VideoDec *vd) __asm__("FUN_0023cec8"); diff --git a/src/movies/decoder/video_input/vi_buf_add_dma.c b/src/movies/decoder/video_input/vi_buf_add_dma.c index c8819b41db..f26d23a80c 100644 --- a/src/movies/decoder/video_input/vi_buf_add_dma.c +++ b/src/movies/decoder/video_input/vi_buf_add_dma.c @@ -29,7 +29,7 @@ typedef struct { extern s32 WaitSema(s32 semaphore); extern s32 SignalSema(s32 semaphore); -const char dma_add_not_active_message[] __asm__("D_001E8B20") = "DMA ADD not active\n"; +const char dma_add_not_active_message[] __asm__("D_001E8B20") = "DMA ADD not active\n"; extern void set_d4_chcr(s32 control) __asm__("FUN_0023bbb0"); s32 vi_buf_add_dma(ViBuf *f) __asm__("FUN_0023bf70"); diff --git a/src/movies/player/err_message.c b/src/movies/player/err_message.c index b0f9509ac4..4329138ffb 100644 --- a/src/movies/player/err_message.c +++ b/src/movies/player/err_message.c @@ -2,7 +2,7 @@ #include "rnc/sdk/debug.h" extern const char movie_error_message[] __asm__("D_001611F8"); -void err_message(s32 error_code) __asm__("FUN_0023ab78"); +void err_message(s32 error_code) __asm__("FUN_0023ab78"); /* Moby class 676 */ void err_message(s32 error_code) { @@ -11,5 +11,5 @@ void err_message(s32 error_code) { extern void func_0023AB78(s32 error_code) __attribute__((alias("FUN_0023ab78"))); -const char movie_error_message[] __asm__("D_001611F8") __attribute__((section(".sdata"))) = - "[ Error ] %s\n"; +const char movie_error_message[] __asm__("D_001611F8") + __attribute__((section(".sdata"))) = "[ Error ] %s\n"; diff --git a/src/overlays/l08/mobys/batalia_bolt_pickup.c b/src/overlays/l08/mobys/batalia_bolt_pickup.c index 9ad9dbfc44..fd92d24636 100644 --- a/src/overlays/l08/mobys/batalia_bolt_pickup.c +++ b/src/overlays/l08/mobys/batalia_bolt_pickup.c @@ -1,5 +1,6 @@ /* Level 08 batalia bolt pickup: update, surface pose and rotating quad (no caller or class table entry found). */ #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/game/bolt_sources.h" #include "rnc/mobys/moby_class_id.h" #include "rnc/globals.h" @@ -126,11 +127,9 @@ extern int transform_attachment_pose(void *, int, void *, void *, void *, void *) __asm__("FUN_L00_002604f0"); extern int queue_animation_update(s32, s32, void *, void *, void *, void *, s32) __asm__("FUN_001ff308"); -extern s32 level_bolts[] __asm__("D_0013DF38"); extern unsigned char *FUN_L00_002603d0(int); extern unsigned char *FUN_L00_00272060( float *pos, int a, float x, float y, int col, int mode, int b, float *vel, float z); -extern unsigned char D_0014BEC0[][4]; extern unsigned char D_L08_0015FC88_macro[] __asm__("D_L08_0015FC88") MACRO_ADDR; extern void FUN_L00_0025f730_c(void *a, float x) __asm__("FUN_L00_0025f730"); extern void convert_pose_to_reference_local(void *, int, void *, void *, void *, void *) __asm__("FUN_L00_00260668"); @@ -457,11 +456,11 @@ void update_batalia_bolt_pickup(struct Moby *moby) { int j; int n; - D_0014BEC0[current_level_index][moby->command] = 1; + gold_bolts_collected[moby->command + current_level_index * 4] = 1; n = 0; for (i = 0; i < 20; i++) { for (j = 0; j < 4; j++) { - if (D_0014BEC0[i][j] != 0) { + if (gold_bolts_collected[j + i * 4] != 0) { n++; } } diff --git a/src/overlays/l08/mobys/bolt_pickup.c b/src/overlays/l08/mobys/bolt_pickup.c index 6dbe36708a..6e69fe73a4 100644 --- a/src/overlays/l08/mobys/bolt_pickup.c +++ b/src/overlays/l08/mobys/bolt_pickup.c @@ -1,5 +1,6 @@ /* Level 08 moby class 0x98: bolt pickup. */ #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/hero/hero.h" #include "rnc/globals.h" #include "asm.h" @@ -85,7 +86,6 @@ extern void draw_bolt_counter_hud_panel(void) __asm__("FUN_L00_00239df8"); extern char D_L08_001746D8_2B94B0[] __asm__("D_L08_00174658"); extern int D_L08_00174658_lui __asm__("D_L08_00174658") NOT_SDA; extern char D_L08_00174700_2B94B0[] __asm__("D_L08_00174680"); -extern s32 level_bolts[] __asm__("D_0013DF38"); void bolt_pickup_update(Moby_2B94B0 *moby) __asm__("FUN_L08_002b82a0"); extern int D_L08_0015F5CC; diff --git a/src/overlays/shared/game/run_level_main_loop.c b/src/overlays/shared/game/run_level_main_loop.c index e9d4060dfc..a10462fc8e 100644 --- a/src/overlays/shared/game/run_level_main_loop.c +++ b/src/overlays/shared/game/run_level_main_loop.c @@ -391,7 +391,6 @@ extern void decode_map_mask(int *dst, unsigned char *src, short *offs) __asm__(" extern void load_map_chunk(void *dst, unsigned char *src, int) __asm__("FUN_00207bb0"); extern struct DiscFile D_00138438[]; extern char D_001383A0[]; -extern char D_00141EC0[]; void initialize_level_map_archive(void) { int i; @@ -469,7 +468,7 @@ void initialize_level_map_archive(void) { D_L00_001841F0.slots[i].buffer = D_L00_001841F0.scratch_data + i * 0x200; } mask_buffer = hud_heap_alloc(0x8000, 0, render_archive_source_file, 0x2FC); - level_data = ((char *)&D_00141EC0) + D_L00_001841F0.archive_index * 0x800; + level_data = ((char *)map_coverage_pages) + D_L00_001841F0.archive_index * 0x800; D_L00_001841F0.mask_data = mask_buffer; if (level_data[0] != 0) { load_map_chunk((void *)D_L00_001841F0.mask_data, level_data, D_L00_001841F0.second_raw); diff --git a/src/overlays/shared/pickups/bolt.c b/src/overlays/shared/pickups/bolt.c index 1295dab330..2c9048d185 100644 --- a/src/overlays/shared/pickups/bolt.c +++ b/src/overlays/shared/pickups/bolt.c @@ -1,5 +1,6 @@ /* Shared moby class bolt (and bolt_hexnut, bolt_starnut, bolt_circlenut): bolts dropped and collected. */ #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/game/bolt_sources.h" #include "rnc/mobys/moby_class_id.h" #include "rnc/hero/hero.h" @@ -153,7 +154,6 @@ extern void FUN_L00_002a7210_c(Bolt *, void *, f32, f32) __asm__("FUN_L00_002a72 extern s32 D_0015EE2C; /* bolts counted when the bolt's pvars[0x40] is set or it is an early moby */ -extern s32 level_bolts[] __asm__("D_0013DF38"); /* bolts collected per level */ extern s32 D_L00_0015F598; extern void *D_L00_0015FFDC_u __asm__("D_L00_0015FFDC"); extern void diff --git a/src/overlays/shared/pickups/gold_bolt.c b/src/overlays/shared/pickups/gold_bolt.c index 6102fd31fb..567b16dfd3 100644 --- a/src/overlays/shared/pickups/gold_bolt.c +++ b/src/overlays/shared/pickups/gold_bolt.c @@ -1,6 +1,7 @@ /* Shared moby class gold_bolt: the gold bolt pickup, its glow rings, particles and pickup camera. */ #include "types.h" +#include "rnc/game/level_progress.h" #include "rnc/hero/hero.h" #include "rnc/globals.h" #include "rnc/math_consts.h" @@ -30,7 +31,7 @@ enum { }; typedef struct { - s32 id; /* collected flag index (D_0014BEC0 + level * 4), -1 none */ + s32 id; /* collected flag index (gold_bolts_collected + level * 4), -1 none */ u8 pad4[8]; s16 unkC; /* nonzero: collect at once, no cutscene */ u8 padE[2]; @@ -81,7 +82,6 @@ extern s32 D_0015ED84; extern char camera_pos[] __asm__("D_L01_00167240"); extern int D_0015ED84; /* no foreign declaration */ extern int cutscene_active __asm__("D_L01_0015F404"); -extern u8 D_0014BEC0[]; /* MACRO_ADDR aliases: retail loads these with the one-register lui form */ extern f32 frame_time_macro __asm__("D_0015ED6C"); extern s32 current_level_index_macro __asm__("D_0015ED84"); @@ -487,7 +487,7 @@ void gold_bolt_update(struct Moby *moby) { switch (moby->state) { case GOLD_BOLT_INITIALIZE: if (gold_bolt_instance_vars->id == -1 || - D_0014BEC0[gold_bolt_instance_vars->id + D_0015ED84 * 4] != 0) { + gold_bolts_collected[gold_bolt_instance_vars->id + D_0015ED84 * 4] != 0) { goto remove; } qcopy(&gold_bolt_instance_vars->home, &moby->pos); @@ -537,7 +537,7 @@ void gold_bolt_update(struct Moby *moby) { if (gold_bolt_instance_vars->unkC != 0) { D_L01_0015F640 = scale_game_frames(180); queue_dialogue_message(0x53B3, -1); - D_0014BEC0[gold_bolt_instance_vars->id + current_level_index_macro * 4] = 1; + gold_bolts_collected[gold_bolt_instance_vars->id + current_level_index_macro * 4] = 1; memcard_save_data(0, -1); remove: mark_moby_for_removal(moby); @@ -610,7 +610,7 @@ void gold_bolt_update(struct Moby *moby) { } D_L01_0015F640 = scale_game_frames(180); queue_dialogue_message(0x53B3, -1); - D_0014BEC0[gold_bolt_instance_vars->id + current_level_index_macro * 4] = 1; + gold_bolts_collected[gold_bolt_instance_vars->id + current_level_index_macro * 4] = 1; cutscene_active = 0; set_race_camera(&hero_ptr->motion.pos, &hero_ptr->motion.rot, 0, 0); jet_end_mount(0); diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index a7afcc213b..7801b65535 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -894,9 +894,8 @@ extern void FUN_002049f0(s32); /* FUN_L00_0029ba78 - Level-00 shared: per-frame state machine (states 0..4) that * drives advance_moby_animation/FUN_L00_00250df8 on g->f20+0x400 and updates the - * progress tables D_L00_001C40B0 / weapon_ammo_counts / D_0013DD70 / D_0015ED98. */ + * progress tables D_L00_001C40B0 / weapon_ammo_counts / ammo_bought_stats / D_0015ED98. */ -extern s32 ammo_bought_stats[] __asm__("D_0013DD70"); extern u8 D_0013D4E3[]; extern s32 D_0015ED98; extern u8 vendor_item_0x18_purchased[] __asm__("D_00141345"); diff --git a/src/rendering/effects/append_billboard_batch.c b/src/rendering/effects/append_billboard_batch.c index 91015e364b..f49e6998a5 100644 --- a/src/rendering/effects/append_billboard_batch.c +++ b/src/rendering/effects/append_billboard_batch.c @@ -142,5 +142,6 @@ BillboardRecord billboard_records[16] = {0}; /* GIF tag of each billboard quad: NLOOP 1, EOP, REGLIST, 15 registers. Small data in retail, defined below its only user, so it is reached with lui. */ u64 billboard_quad_header[2] __attribute__((section(".sdata"), aligned(16))) = { - 0xF400000000008001ULL, 0x0531531531531068ULL, + 0xF400000000008001ULL, + 0x0531531531531068ULL, }; diff --git a/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c b/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c index 01e448c109..b25f462a06 100644 --- a/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c +++ b/src/rendering/effects/build_resident_indexed_texture_warp_meshes.c @@ -12,7 +12,8 @@ extern s32 game_mode_macro __asm__("D_0015F604") MACRO_ADDR; /* Warp trail width per content variant (0, 1 or 2). Small data in retail, defined ahead of the function so it reaches the table gp-relative. */ -f32 warp_trail_widths[3] __asm__("D_001604D0") __attribute__((section(".sdata"))) = {0.8f, 0.8f, 0.8f}; +f32 warp_trail_widths[3] __asm__("D_001604D0") + __attribute__((section(".sdata"))) = {0.8f, 0.8f, 0.8f}; extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void draw_geometry_quad(void *, s32, s32) __asm__("func_001F7D30"); diff --git a/src/rendering/effects/build_variant_effect_quads.c b/src/rendering/effects/build_variant_effect_quads.c index eaa55d53bd..e07a7c966d 100644 --- a/src/rendering/effects/build_variant_effect_quads.c +++ b/src/rendering/effects/build_variant_effect_quads.c @@ -16,14 +16,16 @@ extern QuadOffset quad_positions_variant1[2] __asm__("D_001D9930") NOT_SDA; extern QuadOffset quad_positions_variant2[2] __asm__("D_001D9950") NOT_SDA; extern QuadOffset quad_corners[10] __asm__("D_001D9970") NOT_SDA; -void fast_vec_scale(float, void *, void *) __asm__("FUN_001f9a68"); -void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); -void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -float convert_integer_to_float(int) __asm__("func_001FA6C0"); -void draw_geometry_quad(void *, void *, int) __asm__("func_001F7D30"); +void fast_vec_scale(float, void *, void *) __asm__("FUN_001f9a68"); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); +float convert_integer_to_float(int) __asm__("func_001FA6C0"); +void draw_geometry_quad(void *, void *, int) __asm__("func_001F7D30"); /* Quads per content variant (0, 1 or 2). Small data in retail, defined ahead of the function so it reaches the table gp-relative. */ -int variant_effect_quad_counts[3] __asm__("D_001604C0") __attribute__((section(".sdata"))) = {8, 2, 2}; +int variant_effect_quad_counts[3] __asm__("D_001604C0") + __attribute__((section(".sdata"))) = {8, 2, 2}; + void build_variant_effect_quads(struct ResidentRenderObject *quad_source) __asm__("FUN_0022e1b0"); void build_variant_effect_quads(struct ResidentRenderObject *quad_source) { diff --git a/src/rendering/frame/configure_graphics_setup_dma_chain.c b/src/rendering/frame/configure_graphics_setup_dma_chain.c index e4e2291501..5197b3c2e1 100644 --- a/src/rendering/frame/configure_graphics_setup_dma_chain.c +++ b/src/rendering/frame/configure_graphics_setup_dma_chain.c @@ -5,12 +5,12 @@ extern struct TagPtr D_0015FF40; #include "rnc/rendering/frame/configure_graphics_setup_dma_chain_globals.h" -extern u8 D_001C8680[]; +extern u8 D_001C8680[]; extern const char moby_shadow_callback_label[] __asm__("D_0015FEC0"); -extern void FUN_00227740(void); -extern void submit_graphics_setup_command_stream(void *) __asm__("FUN_00227548"); -extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); -void configure_graphics_setup_dma_chain(void) __asm__("FUN_0020d060"); +extern void FUN_00227740(void); +extern void submit_graphics_setup_command_stream(void *) __asm__("FUN_00227548"); +extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); +void configure_graphics_setup_dma_chain(void) __asm__("FUN_0020d060"); void configure_graphics_setup_dma_chain(void) { struct DmaTag *tag; diff --git a/src/rendering/mobys/draw_mobys_setup.c b/src/rendering/mobys/draw_mobys_setup.c index bcf85c16da..b4cacd42a8 100644 --- a/src/rendering/mobys/draw_mobys_setup.c +++ b/src/rendering/mobys/draw_mobys_setup.c @@ -6,12 +6,12 @@ #include "rnc/game/game_globals.h" #include "rnc/rendering/vu1_registers.h" -extern u8 moby_draw_vu0_micro_program[] __asm__("D_00100080"); +extern u8 moby_draw_vu0_micro_program[] __asm__("D_00100080"); extern const char moby_texture_label[] __asm__("D_0015FED0"); -extern s32 vu1_chain_limit __asm__("D_00160F08"); -extern void noop_core_callback_secondary() __asm__("func_001F21B8"); -extern void vu0_load_micro_program() __asm__("func_002334D8"); -extern void vu1_add_data_ref() __asm__("func_00233830"); +extern s32 vu1_chain_limit __asm__("D_00160F08"); +extern void noop_core_callback_secondary() __asm__("func_001F21B8"); +extern void vu0_load_micro_program() __asm__("func_002334D8"); +extern void vu1_add_data_ref() __asm__("func_00233830"); void draw_mobys_setup(void) __asm__("FUN_0020d278"); diff --git a/src/rendering/mobys/render_environment_mapped_object.c b/src/rendering/mobys/render_environment_mapped_object.c index 5af53dee96..cfe3c268e4 100644 --- a/src/rendering/mobys/render_environment_mapped_object.c +++ b/src/rendering/mobys/render_environment_mapped_object.c @@ -20,33 +20,47 @@ typedef struct { #include "rnc/game/game_globals.h" #include "rnc/camera/camera_globals.h" -extern s32 environment_mapping_was_active_gp __asm__("D_001604A8") __attribute__((sda)); -extern s32 D_001604AC __attribute__((sda)); +extern s32 environment_mapping_was_active_gp __asm__("D_001604A8") __attribute__((sda)); +extern s32 D_001604AC __attribute__((sda)); /* One entry per environment-mapped class, 0x212 to 0x215 (the four meshes defined below), indexed by class id - 0x212. Small data in retail, defined ahead of the function so it reaches them gp-relative. */ s32 environment_mesh_colors[4] __asm__("D_00160520") __attribute__((section(".sdata"))) = { - 0x50807060, 0x30807060, 0x30807060, 0x302080FF, + 0x50807060, + 0x30807060, + 0x30807060, + 0x302080FF, }; + s32 environment_mesh_vertex_counts[4] __asm__("D_00160530") __attribute__((section(".sdata"))) = { - 102, 39, 49, 42, + 102, + 39, + 49, + 42, }; + s32 environment_mesh_quad_counts[4] __asm__("D_00160540") __attribute__((section(".sdata"))) = { - 74, 24, 48, 30, + 74, + 24, + 48, + 30, }; + Vec4 *environment_mesh_normals[4] __asm__("D_00160550") __attribute__((section(".sdata"))) = { (Vec4 *)environment_mesh_0_normals, (Vec4 *)environment_mesh_1_normals, (Vec4 *)environment_mesh_2_normals, (Vec4 *)environment_mesh_3_normals, }; + Vec4 *environment_mesh_positions[4] __asm__("D_00160560") __attribute__((section(".sdata"))) = { (Vec4 *)environment_mesh_0_positions, (Vec4 *)environment_mesh_1_positions, (Vec4 *)environment_mesh_2_positions, (Vec4 *)environment_mesh_3_positions, }; + IndexedQuad *environment_mesh_quads[4] __asm__("D_00160570") __attribute__((section(".sdata"))) = { environment_mesh_0_quads, environment_mesh_1_quads, @@ -889,4 +903,3 @@ Vec4 environment_mapping_transformed_vertex_positions[102] = {0}; float environment_mapping_vertex_uvs[102][2] = {0}; float environment_mapping_saved_vertex_uvs[102][2] = {0}; - diff --git a/src/rendering/packets/emit_textured_rectangle.c b/src/rendering/packets/emit_textured_rectangle.c index e3e13f319f..feca10c15b 100644 --- a/src/rendering/packets/emit_textured_rectangle.c +++ b/src/rendering/packets/emit_textured_rectangle.c @@ -80,5 +80,6 @@ extern __typeof__(emit_textured_rectangle) func_001F5808 __attribute__((alias("F /* GIF tag: NLOOP 1, EOP, REGLIST, 13 registers. Small data in retail, defined below its only user, so the function reaches it with lui. */ u64 textured_rectangle_packet_header_template[2] __attribute__((section(".sdata"), aligned(16))) = { - 0xD400000000008001ULL, 0x0008535353531806ULL, + 0xD400000000008001ULL, + 0x0008535353531806ULL, }; diff --git a/src/rendering/tfrags/draw_tfrag.c b/src/rendering/tfrags/draw_tfrag.c index 79cdef7781..4bca10d019 100644 --- a/src/rendering/tfrags/draw_tfrag.c +++ b/src/rendering/tfrags/draw_tfrag.c @@ -17,12 +17,12 @@ struct Locals { extern const char tfrag_textures_callback_label[] __asm__("D_00160E70"); extern const char tfrag_draw_callback_label[] __asm__("D_00160E80"); -extern void FlushCache(s32); -extern void WriteDmaChannel(u32, u32, u32); -extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); -extern void noop_core_callback_secondary(void *, s32) __asm__("func_001F21B8"); -extern void dma_tfrag_textures(void) __asm__("func_002331C0"); -extern void tfrag_proc(void) __asm__("func_00233FB0"); +extern void FlushCache(s32); +extern void WriteDmaChannel(u32, u32, u32); +extern void noop_core_callback(void *, s32) __asm__("func_001F21B0"); +extern void noop_core_callback_secondary(void *, s32) __asm__("func_001F21B8"); +extern void dma_tfrag_textures(void) __asm__("func_002331C0"); +extern void tfrag_proc(void) __asm__("func_00233FB0"); /* Draws the level terrain (tfrags). Each tfrag has a 0x40-byte header: * 0x10 where its data starts * 0x16, 0x18, 0x1a where its data lists start (shared, lower detail, full detail) diff --git a/src/rendering/vu1/vu1_chain.c b/src/rendering/vu1/vu1_chain.c index 1f05e5bf94..01fe2bf0ce 100644 --- a/src/rendering/vu1/vu1_chain.c +++ b/src/rendering/vu1/vu1_chain.c @@ -20,7 +20,7 @@ volatile s32 vif_chain_flags __asm__("D_00160EE0") = 0; extern const char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0"); extern const char vu1_chain_overflow_message[] __asm__("D_001E89C8"); -extern void FlushCache(s32); +extern void FlushCache(s32); void vu1_send_chain(void) __asm__("FUN_002336a0"); @@ -76,4 +76,5 @@ void vu1_sync_chain(s32 mask) { extern __typeof__(vu1_sync_chain) func_002337B0 __attribute__((alias("FUN_002337b0"))); const char vu1_chain_overflow_message[] __asm__("D_001E89C8") = "vu1 chain overflow\n"; -const char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0") = "vu1 syncChain sit-and-spin timeout.\n"; +const char vu1_chain_sync_timeout_message[] __asm__("D_001E89E0") = + "vu1 syncChain sit-and-spin timeout.\n"; diff --git a/src/rendering/vu1/vu1_gs_regs_normal.c b/src/rendering/vu1/vu1_gs_regs_normal.c index ece0113b57..8df9ba454d 100644 --- a/src/rendering/vu1/vu1_gs_regs_normal.c +++ b/src/rendering/vu1/vu1_gs_regs_normal.c @@ -5,7 +5,7 @@ /* A GIF tag and two A+D register writes: the 3 quadwords the DMA tag below sends. */ extern u64 normal_gs_regs_dma_payload[3][2] __asm__("D_001DE3C0"); -void vu1_gs_regs_normal(void) __asm__("FUN_00233bc8"); +void vu1_gs_regs_normal(void) __asm__("FUN_00233bc8"); void vu1_gs_regs_normal(void) { *render_packet_cursor.words = 0x30000003; diff --git a/src/rendering/vu1/vu1_tex_flush.c b/src/rendering/vu1/vu1_tex_flush.c index 37e1a95fa0..fb9b569ee2 100644 --- a/src/rendering/vu1/vu1_tex_flush.c +++ b/src/rendering/vu1/vu1_tex_flush.c @@ -5,7 +5,7 @@ /* A GIF tag and two A+D register writes: the 3 quadwords the DMA tag below sends. */ extern u64 vu1_gs_regs_tex_flush[3][2] __asm__("D_001DEE00"); -void vu1_tex_flush(void) __asm__("FUN_00233b68"); +void vu1_tex_flush(void) __asm__("FUN_00233b68"); void vu1_tex_flush(void) { *render_packet_cursor.words = 0x30000003; diff --git a/src/runtime/startup/init_once.c b/src/runtime/startup/init_once.c index 1c017543b3..a38184a074 100644 --- a/src/runtime/startup/init_once.c +++ b/src/runtime/startup/init_once.c @@ -22,27 +22,27 @@ #include "rnc/streaming.h" #include "rnc/ui/text/font.h" -extern u8 vu0_micro_program[] __asm__("D_0010E4C0"); +extern u8 vu0_micro_program[] __asm__("D_0010E4C0"); extern const char rebooted_iop_message[] __asm__("D_0015FA88"); -extern s32 DIntr(); -extern s32 EnableCache(); -extern s32 fill_transfer_words() __asm__("func_001F97E8"); -extern void FlushCache(); -extern s32 reset_vif1_gif() __asm__("FUN_001204b8"); -extern s32 load_disc_sectors_into_global_buffer() __asm__("func_0012F2B8"); -extern s32 init_view_context() __asm__("func_001F2C60"); -extern s32 set_pal_mode() __asm__("func_001F34E8"); -extern s32 initialize_alpha_lookup_table() __asm__("func_001F7A30"); -extern s32 load_irx_module() __asm__("func_00201520"); -extern s32 init_mem_slots() __asm__("func_002015D8"); -extern s32 memcard_get_name() __asm__("func_00209030"); -extern s32 memcard_initialize() __asm__("func_0020AC58"); -extern s32 init_dma() __asm__("func_0020B418"); -extern s32 decompress_wad() __asm__("FUN_0020b618"); -extern s32 init_pads() __asm__("func_00217048"); -extern s32 vu0_load_micro_program() __asm__("func_002334D8"); -extern s32 vu1_init_chain() __asm__("func_002335D0"); -void init_once(void) __asm__("FUN_00201650"); +extern s32 DIntr(); +extern s32 EnableCache(); +extern s32 fill_transfer_words() __asm__("func_001F97E8"); +extern void FlushCache(); +extern s32 reset_vif1_gif() __asm__("FUN_001204b8"); +extern s32 load_disc_sectors_into_global_buffer() __asm__("func_0012F2B8"); +extern s32 init_view_context() __asm__("func_001F2C60"); +extern s32 set_pal_mode() __asm__("func_001F34E8"); +extern s32 initialize_alpha_lookup_table() __asm__("func_001F7A30"); +extern s32 load_irx_module() __asm__("func_00201520"); +extern s32 init_mem_slots() __asm__("func_002015D8"); +extern s32 memcard_get_name() __asm__("func_00209030"); +extern s32 memcard_initialize() __asm__("func_0020AC58"); +extern s32 init_dma() __asm__("func_0020B418"); +extern s32 decompress_wad() __asm__("FUN_0020b618"); +extern s32 init_pads() __asm__("func_00217048"); +extern s32 vu0_load_micro_program() __asm__("func_002334D8"); +extern s32 vu1_init_chain() __asm__("func_002335D0"); +void init_once(void) __asm__("FUN_00201650"); const char iop_reboot_image_path[] __asm__("D_001E7AE0") = "cdrom0:\\IOPRP243.IMG;1"; const char loaded_irx_modules_message[] __asm__("D_001E7AF8") = "loaded irx modules\n"; @@ -182,5 +182,5 @@ extern __typeof__(init_once) func_00201650 __attribute__((alias("FUN_00201650")) u8 image_clear_buffer[4096] = {0}; /* Retail keeps this message in small data; init_once reaches it with lui/addiu. */ -const char rebooted_iop_message[] __asm__("D_0015FA88") __attribute__((section(".sdata"))) = - "Rebooted IOP\n"; +const char rebooted_iop_message[] __asm__("D_0015FA88") + __attribute__((section(".sdata"))) = "Rebooted IOP\n"; diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index 00b15e6c7a..56388fe354 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -42,7 +42,8 @@ char D_0013D220[] = "/************RATCHET/static.ico"; char D_0013D240[] = "/************RATCHET/************RATCHET"; char D_0013D270[] = "/************RATCHET/save%d.bin"; -struct MemoryCardState memory_card_state = {{{0, 0, 0, 0, 0, -3, 0, 0, {0}, 0, 0, 0}}, 0, 0, -1, 0, 0, 1, -1, 0, 0, -1, -1, 0, -1, 0, 0, 1}; +struct MemoryCardState memory_card_state = { + {{0, 0, 0, 0, 0, -3, 0, 0, {0}, 0, 0, 0}}, 0, 0, -1, 0, 0, 1, -1, 0, 0, -1, -1, 0, -1, 0, 0, 1}; u8 alternate_item_available[128] = {0}; @@ -64,13 +65,13 @@ u8 level_available[20] = {0}; u8 level_visit_state[20] = {0}; -s32 D_0013DD70[37] = {0}; +s32 ammo_bought_stats[37] __asm__("D_0013DD70") = {0}; s32 weapon_ammo_pickup_totals[37] = {0}; s32 weapon_ammo_used_counts[37] = {0}; -s32 D_0013DF38[LEVEL_RECORD_COUNT] = {0}; +s32 level_bolts[LEVEL_RECORD_COUNT] __asm__("D_0013DF38") = {0}; s32 D_0013DF88[LEVEL_RECORD_COUNT] = {0}; diff --git a/src/save/memcard_initialize.c b/src/save/memcard_initialize.c index 43fedb3216..0070d31088 100644 --- a/src/save/memcard_initialize.c +++ b/src/save/memcard_initialize.c @@ -3,7 +3,7 @@ #include "rnc/sdk/storage/memory_card.h" const char memcard_error_message[] __asm__("D_001E8360") = "ERROR: could not init memcard lib\n"; -void memcard_initialize(void) __asm__("FUN_0020ac58"); +void memcard_initialize(void) __asm__("FUN_0020ac58"); void memcard_initialize(void) { if (sceMcInit() != 0) { diff --git a/src/save/memcard_restore_data.c b/src/save/memcard_restore_data.c index dfd5d0e358..7d74f978a4 100644 --- a/src/save/memcard_restore_data.c +++ b/src/save/memcard_restore_data.c @@ -36,7 +36,7 @@ extern CardState D_0013D290; /* Blocks whose restored bytes differed from memory; defined ahead of the function, which reaches it gp-relative. */ -s32 memcard_restore_differing_block_count __asm__("D_0015FE90") = 0; +s32 memcard_restore_differing_block_count __asm__("D_0015FE90") = 0; extern s32 validate_data_crc(u8 *header) __asm__("func_0020AD38"); extern s32 memcmp(const void *, const void *, s32); extern void copy_memory_aligned(void *, void *, s32) __asm__("func_001F9838"); diff --git a/src/save/memcard_restore_game.c b/src/save/memcard_restore_game.c index aed29a829e..8b9f0f417f 100644 --- a/src/save/memcard_restore_game.c +++ b/src/save/memcard_restore_game.c @@ -5,7 +5,7 @@ #include "rnc/save/memory_card_state.h" #include "rnc/sdk/debug.h" -const char out_of_date_save_message[] __asm__("D_001E81D0") = "Out of date save!\n"; +const char out_of_date_save_message[] __asm__("D_001E81D0") = "Out of date save!\n"; extern void memcard_restore_data(u8 *, s32, void *) __asm__("func_0020AF20"); void memcard_restore_game(u8 *p) __asm__("FUN_00209298"); diff --git a/src/save/memcard_update_state.c b/src/save/memcard_update_state.c index e805999b93..39845bfbbd 100644 --- a/src/save/memcard_update_state.c +++ b/src/save/memcard_update_state.c @@ -23,17 +23,17 @@ typedef struct { #include "rnc/game/bolt_sources.h" #include "rnc/game/level_progress.h" -extern char D_0013D1D0[]; -extern char D_0013D1E8[]; -extern char D_0013D200[]; -extern char D_0013D220[]; -extern char D_0013D240[]; -extern char D_0013D270[]; +extern char D_0013D1D0[]; +extern char D_0013D1E8[]; +extern char D_0013D200[]; +extern char D_0013D220[]; +extern char D_0013D240[]; +extern char D_0013D270[]; extern const char memcard_delete_entry_path_format[] __asm__("D_0015FE98"); extern const char memcard_deleting_entry_message[] __asm__("D_0015FEA0"); -extern u8 D_001A0880[]; -extern char D_001A08A0[]; -extern char memcard_deleting_directory_message[] __asm__("D_001E81E8"); +extern u8 D_001A0880[]; +extern char D_001A08A0[]; +extern char memcard_deleting_directory_message[] __asm__("D_001E81E8"); extern void RaiseKernelTrap(); extern void calculate_ring_buffer_bounds(s32, McChunk **, s32 *) __asm__("func_001FD6E0"); @@ -1028,5 +1028,5 @@ u8 memcard_game_data_buffer[MEMCARD_GAME_DATA_SIZE] = {0}; u8 memcard_level_data_buffer[MEMCARD_LEVEL_DATA_SIZE] = {0}; const char memcard_delete_entry_path_format[] __asm__("D_0015FE98") = "%s/%s"; -const char memcard_deleting_entry_message[] __asm__("D_0015FEA0") __attribute__((section(".sdata"))) = - "deleting %s\n"; +const char memcard_deleting_entry_message[] __asm__("D_0015FEA0") + __attribute__((section(".sdata"))) = "deleting %s\n"; diff --git a/src/sdk/deci2/printfloat.c b/src/sdk/deci2/printfloat.c index ba95019651..3a7238b708 100644 --- a/src/sdk/deci2/printfloat.c +++ b/src/sdk/deci2/printfloat.c @@ -2,16 +2,17 @@ #include "rnc/data_labels.h" #include "rnc/sdk/soft_float.h" -extern f64 dpsub_f(f64 left, f64 right) __asm__("dpsub"); -extern f64 dpdiv_f(f64 left, f64 right) __asm__("dpdiv"); -extern s64 ftoi(s64 bits); -extern s32 kprintf(); +extern f64 dpsub_f(f64 left, f64 right) __asm__("dpsub"); +extern f64 dpdiv_f(f64 left, f64 right) __asm__("dpdiv"); +extern s64 ftoi(s64 bits); +extern s32 kprintf(); /* Explicit .rodata: at 8 bytes or less they would go to .sdata. */ const char significand_format[] __asm__("D_00152780") __attribute__((section(".rodata"))) = "0.%d"; -const char nonnegative_exponent_format[] __asm__("D_00152788") __attribute__((section(".rodata"))) = - "e+%d"; -const char negative_exponent_format[] __asm__("D_00152790") __attribute__((section(".rodata"))) = "e%d"; +const char nonnegative_exponent_format[] __asm__("D_00152788") + __attribute__((section(".rodata"))) = "e+%d"; +const char negative_exponent_format[] __asm__("D_00152790") + __attribute__((section(".rodata"))) = "e%d"; void printfloat(f64 x) { s32 exponent; diff --git a/src/sdk/deci2/sce_tty_handler.c b/src/sdk/deci2/sce_tty_handler.c index 7c5726d56e..afc1970ed6 100644 --- a/src/sdk/deci2/sce_tty_handler.c +++ b/src/sdk/deci2/sce_tty_handler.c @@ -20,8 +20,8 @@ typedef struct { TtyQueue *queue; } TtyState; -const char tty_packet_size_error_message[] __asm__("D_00152710") = - "TTY: packet size larger than expect\n"; +const char + tty_packet_size_error_message[] __asm__("D_00152710") = "TTY: packet size larger than expect\n"; const char tty_receive_error_message[] __asm__("D_00152738") = "TTY: receive error"; const char tty_send_error_format[] __asm__("D_00152750") = "TTY: send err %d\n"; const char tty_pending_send_bytes_error_format[] __asm__("D_00152768") = "TTY: err ti->wlen=%08x\n"; diff --git a/src/sdk/dma/sce_dma_put_env.c b/src/sdk/dma/sce_dma_put_env.c index 0f665fbfcf..d708e8f6fc 100644 --- a/src/sdk/dma/sce_dma_put_env.c +++ b/src/sdk/dma/sce_dma_put_env.c @@ -17,10 +17,13 @@ typedef struct { 5 SIF0, 6 SIF1, 7 SIF2, 8 fromSPR, 9 toSPR); 0 = the channel cannot take that role. */ /* STS (stall source): 1 SIF0, 2 fromSPR, 3 fromIPU. */ const u8 dma_sts_control_encodings[10] __asm__("D_00153420") = {0, 0, 0, 3, 0, 1, 0, 0, 2, 0}; + /* STD (stall drain): 1 VIF1, 2 GIF, 3 SIF1. */ const u8 dma_std_control_encodings[10] __asm__("D_00153430") = {0, 1, 2, 0, 0, 0, 3, 0, 0, 0}; + /* MFD (MFIFO drain): 2 VIF1, 3 GIF. */ const u8 dma_mfd_control_encodings[10] __asm__("D_00153440") = {0, 2, 3, 0, 0, 0, 0, 0, 0, 0}; + extern sceDmaEnv dma_last_applied_environment __asm__("D_001599D8"); s32 sceDmaPutEnv(sceDmaEnv *env) { diff --git a/src/sdk/input/dbc/sceDbcCreateSocket.c b/src/sdk/input/dbc/sceDbcCreateSocket.c index 2e87565776..e2dbcc4c8b 100644 --- a/src/sdk/input/dbc/sceDbcCreateSocket.c +++ b/src/sdk/input/dbc/sceDbcCreateSocket.c @@ -3,9 +3,9 @@ #include "rnc/sdk/library/sdk_globals.h" #include "rnc/sdk/rpc/rpc.h" -extern s32 D_0015B080[]; -const char socket_create_rpc_error_message[] __asm__("D_00153578") = - "sceDbcCreateSocket: rpc error\n"; +extern s32 D_0015B080[]; +const char + socket_create_rpc_error_message[] __asm__("D_00153578") = "sceDbcCreateSocket: rpc error\n"; extern void debug_print_stub(u8 *) __asm__("func_00124A20"); /* The header words are copied as pointers: their alias set differs from diff --git a/src/sdk/input/dbc/sceDbcInit.c b/src/sdk/input/dbc/sceDbcInit.c index 906875941f..bb1978c780 100644 --- a/src/sdk/input/dbc/sceDbcInit.c +++ b/src/sdk/input/dbc/sceDbcInit.c @@ -9,10 +9,10 @@ extern struct sceSifClientData dbc_transfer_rpc_client __asm__("D_0015B030"); const char dbc_rpc_bind_failure_message[] __asm__("D_001534D8") = "libdbc: bind failed\n"; const char dbc_module_version_mismatch_message[] __asm__("D_001534F0") = "libdbc: Module version mismatch "; -const char D_00153518[] = "[libdbc.a = %d.%d, dbcman.irx = %d.%d]\n"; -const char D_00153540[] = "SifDmaAddr %08x\n"; -extern void debug_print_stub(const char *fmt, ...) __asm__("func_00124A20"); -extern void exit(s32); +const char D_00153518[] = "[libdbc.a = %d.%d, dbcman.irx = %d.%d]\n"; +const char D_00153540[] = "SifDmaAddr %08x\n"; +extern void debug_print_stub(const char *fmt, ...) __asm__("func_00124A20"); +extern void exit(s32); s32 sceDbcInit(void) { s32 ver; diff --git a/src/sdk/input/dbc/scedbcreceivedata.c b/src/sdk/input/dbc/scedbcreceivedata.c index 22eda300a3..bb855eb110 100644 --- a/src/sdk/input/dbc/scedbcreceivedata.c +++ b/src/sdk/input/dbc/scedbcreceivedata.c @@ -12,7 +12,7 @@ struct DbCState { }; const char dbc_receive_rpc_error_message[] __asm__("D_001536A0") = "sceDbcReceiveData: rpc error\n"; -extern s32 debug_print_stub() __asm__("func_00124A20"); +extern s32 debug_print_stub() __asm__("func_00124A20"); extern struct DbCState RpcReceiveData __asm__("D_0015B080"); s32 sceDbcReceiveData(s32 rpc_request_word_0, s32 rpc_request_word_1, diff --git a/src/sdk/ipu/wait_bdec_out.c b/src/sdk/ipu/wait_bdec_out.c index 0fbba152b6..18846cecd4 100644 --- a/src/sdk/ipu/wait_bdec_out.c +++ b/src/sdk/ipu/wait_bdec_out.c @@ -13,7 +13,7 @@ typedef struct { } MpegDec; const char bdec_error_message[] __asm__("D_00153788") = "Error code detected(BDEC)"; -extern s32 DIntr(void); +extern s32 DIntr(void); #define IPU_CTRL ((volatile u32 *)0x10002010) #define IPU_BP ((volatile u32 *)0x10002020) diff --git a/src/sdk/kernel/topThread.c b/src/sdk/kernel/topThread.c index bc9d16f621..8327fe0fb1 100644 --- a/src/sdk/kernel/topThread.c +++ b/src/sdk/kernel/topThread.c @@ -4,8 +4,8 @@ #include "rnc/sdk/top_thread.h" #include "rnc/sdk/deci2.h" -const char thread_command_error_message[] __asm__("D_001526E8") = - "## internel error in libkernl.a!\n"; +const char + thread_command_error_message[] __asm__("D_001526E8") = "## internel error in libkernl.a!\n"; extern s32 WaitSema(s32 sema); extern s32 WakeupThread(s32 id); diff --git a/src/sdk/libc/locale/_localeconv_r.c b/src/sdk/libc/locale/_localeconv_r.c index 7b6793dc5a..782dffc090 100644 --- a/src/sdk/libc/locale/_localeconv_r.c +++ b/src/sdk/libc/locale/_localeconv_r.c @@ -14,14 +14,14 @@ struct lconv { const char *mon_grouping; const char *positive_sign; const char *negative_sign; - char int_frac_digits; - char frac_digits; - char p_cs_precedes; - char p_sep_by_space; - char n_cs_precedes; - char n_sep_by_space; - char p_sign_posn; - char n_sign_posn; + char int_frac_digits; + char frac_digits; + char p_cs_precedes; + char p_sep_by_space; + char n_cs_precedes; + char n_sep_by_space; + char p_sign_posn; + char n_sign_posn; }; int *_localeconv_r(void *state_resource) __asm__("func_001144D8"); diff --git a/src/sdk/libc/mprec/_dtoa_r.c b/src/sdk/libc/mprec/_dtoa_r.c index b7ab7156c4..a876f156b6 100644 --- a/src/sdk/libc/mprec/_dtoa_r.c +++ b/src/sdk/libc/mprec/_dtoa_r.c @@ -87,19 +87,19 @@ extern const f64 tens[23], bigtens[5]; extern const f64 dtoa_quick_overflow_divisor[] __asm__("D_001524B0"); /* The strings _dtoa_r returns for infinity, NaN and zero, in .rodata like the literals they were (at 8 bytes or less they would go to .sdata). */ -const char D_00152310[] __attribute__((section(".rodata"))) = "Infinity"; -const char D_00152320[] __attribute__((section(".rodata"))) = "NaN"; -const char D_00152328[] __attribute__((section(".rodata"))) = "0"; -extern _Bigint *Balloc(struct _reent *, s32); -extern _Bigint *d2b(struct _reent *, f64, s32 *, s32 *); -extern _Bigint *i2b(struct _reent *, s32) __asm__("func_00115808"); -extern _Bigint *mult(struct _reent *, _Bigint *, _Bigint *); -extern _Bigint *pow5mult(struct _reent *, _Bigint *, s32); -extern s32 cmp(_Bigint *, _Bigint *); -extern _Bigint *diff(struct _reent *, _Bigint *, _Bigint *); -extern _Bigint *multadd(struct _reent *, _Bigint *, s32, s32); -extern s32 quorem(_Bigint *, _Bigint *); -extern void *memcpy(void *, const void *, u32); +const char D_00152310[] __attribute__((section(".rodata"))) = "Infinity"; +const char D_00152320[] __attribute__((section(".rodata"))) = "NaN"; +const char D_00152328[] __attribute__((section(".rodata"))) = "0"; +extern _Bigint *Balloc(struct _reent *, s32); +extern _Bigint *d2b(struct _reent *, f64, s32 *, s32 *); +extern _Bigint *i2b(struct _reent *, s32) __asm__("func_00115808"); +extern _Bigint *mult(struct _reent *, _Bigint *, _Bigint *); +extern _Bigint *pow5mult(struct _reent *, _Bigint *, s32); +extern s32 cmp(_Bigint *, _Bigint *); +extern _Bigint *diff(struct _reent *, _Bigint *, _Bigint *); +extern _Bigint *multadd(struct _reent *, _Bigint *, s32, s32); +extern s32 quorem(_Bigint *, _Bigint *); +extern void *memcpy(void *, const void *, u32); /* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. * diff --git a/src/sdk/libc/mprec/pow5mult.c b/src/sdk/libc/mprec/pow5mult.c index 0480d1064e..4214da698d 100644 --- a/src/sdk/libc/mprec/pow5mult.c +++ b/src/sdk/libc/mprec/pow5mult.c @@ -95,7 +95,8 @@ typedef struct _reent { } _reent; /* 5^1..5^3, indexed by (k & 3) - 1. */ -const s32 small_powers_of_five[3] __asm__("D_001523B8") = {5, 25, 125}; +const s32 small_powers_of_five[3] __asm__("D_001523B8") = {5, 25, 125}; + extern _Bigint *__i2b(struct _reent *, s32) __asm__("func_00115808"); extern _Bigint *_multiply(struct _reent *, _Bigint *, _Bigint *); extern _Bigint *_multadd(struct _reent *, _Bigint *, s32, s32); diff --git a/src/sdk/mpeg/api/sce_mpeg_create.c b/src/sdk/mpeg/api/sce_mpeg_create.c index a1f5fcc3ac..8e10770045 100644 --- a/src/sdk/mpeg/api/sce_mpeg_create.c +++ b/src/sdk/mpeg/api/sce_mpeg_create.c @@ -1,8 +1,8 @@ #include "types.h" #define W(p, o) (*(s32 *)((u8 *)(p) + (o))) #define L(p, o) (*(s64 *)((u8 *)(p) + (o))) -const char mpeg_work_area_too_small_message[] __asm__("D_00153A10") = - "The size of work area is too small"; +const char + mpeg_work_area_too_small_message[] __asm__("D_00153A10") = "The size of work area is too small"; extern void D_0012CB30(); extern void D_0012CB40(); extern void *memset(void *, s32, u32); diff --git a/src/sdk/mpeg/demux/_PES_packet.c b/src/sdk/mpeg/demux/_PES_packet.c index ee01e67b5c..95c25e5791 100644 --- a/src/sdk/mpeg/demux/_PES_packet.c +++ b/src/sdk/mpeg/demux/_PES_packet.c @@ -9,6 +9,7 @@ index: bit 0 adds 16, bit 1 adds 8, bit 2 adds 8, bit 3 adds 24. */ const u8 pes_header_skip_bit_counts[16] __asm__("D_001539C8") = { 0, 16, 8, 24, 8, 24, 16, 32, 24, 40, 32, 48, 32, 48, 40, 56}; + const char invalid_pack_header_field_message[] __asm__("D_001539D8") = "pack_header_field_flag needs to be '0' in PS\n"; extern s32 _Error(); diff --git a/src/sdk/mpeg/headers/_extensionAndUserData.c b/src/sdk/mpeg/headers/_extensionAndUserData.c index 99e49cf598..cabb7dbdbe 100644 --- a/src/sdk/mpeg/headers/_extensionAndUserData.c +++ b/src/sdk/mpeg/headers/_extensionAndUserData.c @@ -19,19 +19,21 @@ extern void report_mpeg_picture_spatial_scalable_unsupported(void *) __asm__("FU extern void report_mpeg_picture_temporal_scalable_unsupported(void *) __asm__("FUN_0012cb20"); /* Parser by extension_start_code_identifier (ISO 13818-2 table 6-2). */ -const ExtTable mpeg_extension_dispatch_table __asm__("D_001538B8") = {{ - report_unknown_mpeg_extension, /* 0: reserved */ - _sequenceExtension, /* 1: sequence */ - _sequenceDisplayExtension, /* 2: sequence display */ - _quantMatrixExtension, /* 3: quant matrix */ - _copyrightExtension, /* 4: copyright */ - report_mpeg_sequence_scalable_unsupported, /* 5: sequence scalable */ - report_unknown_mpeg_extension, /* 6: reserved */ - _pictureDisplayExtension, /* 7: picture display */ - _pictureCodingExtension, /* 8: picture coding */ - report_mpeg_picture_spatial_scalable_unsupported, /* 9: picture spatial scalable */ - report_mpeg_picture_temporal_scalable_unsupported, /* 10: picture temporal scalable */ -}}; +const ExtTable mpeg_extension_dispatch_table __asm__("D_001538B8") = { + { + report_unknown_mpeg_extension, /* 0: reserved */ + _sequenceExtension, /* 1: sequence */ + _sequenceDisplayExtension, /* 2: sequence display */ + _quantMatrixExtension, /* 3: quant matrix */ + _copyrightExtension, /* 4: copyright */ + report_mpeg_sequence_scalable_unsupported, /* 5: sequence scalable */ + report_unknown_mpeg_extension, /* 6: reserved */ + _pictureDisplayExtension, /* 7: picture display */ + _pictureCodingExtension, /* 8: picture coding */ + report_mpeg_picture_spatial_scalable_unsupported, /* 9: picture spatial scalable */ + report_mpeg_picture_temporal_scalable_unsupported, /* 10: picture temporal scalable */ + } +}; void _extensionAndUserData(void *decoder_state) { ExtTable extension_handlers = mpeg_extension_dispatch_table; diff --git a/src/sdk/mpeg/headers/_quantMatrixExtension.c b/src/sdk/mpeg/headers/_quantMatrixExtension.c index 85149dd44f..4cf2d569cd 100644 --- a/src/sdk/mpeg/headers/_quantMatrixExtension.c +++ b/src/sdk/mpeg/headers/_quantMatrixExtension.c @@ -6,7 +6,7 @@ const char chroma_intra_matrix_error_message[] __asm__("D_001538E8") = "load_chroma_intra_quantizer_matrix == 1"; -const u8 D_00153910[] = "load_chroma_non_intra_quantizer_matrix == 1"; +const u8 D_00153910[] = "load_chroma_non_intra_quantizer_matrix == 1"; void _quantMatrixExtension(struct MpegDecoder *mpeg) { s32 load_non_intra; diff --git a/src/sdk/mpeg/headers/sequence_extension.c b/src/sdk/mpeg/headers/sequence_extension.c index 7eb4d28480..e5f06fdcc6 100644 --- a/src/sdk/mpeg/headers/sequence_extension.c +++ b/src/sdk/mpeg/headers/sequence_extension.c @@ -26,8 +26,8 @@ typedef struct SeqExtContext { extern void _Error(); extern s32 _nextBit(); extern void _ipuSetMPEG1(); -const char unsupported_chroma_format_message[] __asm__("D_00153B00") = - "_chroma_format needs to be 1: 420"; +const char + unsupported_chroma_format_message[] __asm__("D_00153B00") = "_chroma_format needs to be 1: 420"; const char unsupported_profile_level_message[] __asm__("D_00153B28") = "Unsupported profile/level"; void _sequenceExtension(SeqExtContext *ctx) { diff --git a/src/sdk/mpeg/headers/sequenceheader.c b/src/sdk/mpeg/headers/sequenceheader.c index 98845075cd..1be42d2774 100644 --- a/src/sdk/mpeg/headers/sequenceheader.c +++ b/src/sdk/mpeg/headers/sequenceheader.c @@ -5,8 +5,8 @@ #include "rnc/sdk/mpeg/errors.h" #include "rnc/sdk/mpeg/headers.h" -extern u8 default_intra_quantiser_matrix[] __asm__("D_00132FC0"); -extern u8 default_non_intra_quantiser_matrix[] __asm__("D_00133000"); +extern u8 default_intra_quantiser_matrix[] __asm__("D_00132FC0"); +extern u8 default_non_intra_quantiser_matrix[] __asm__("D_00133000"); const char vertical_size_limit_error_message[] __asm__("D_00153AE8") = "vertical size > 2800"; void _sequenceHeader(struct MpegDecoder *decoder) { diff --git a/src/sdk/mpeg/macroblock/_decMB0.c b/src/sdk/mpeg/macroblock/_decMB0.c index 361943d8ec..6c0030fed4 100644 --- a/src/sdk/mpeg/macroblock/_decMB0.c +++ b/src/sdk/mpeg/macroblock/_decMB0.c @@ -18,14 +18,14 @@ struct MpegMbState { const char invalid_macroblock_type_error_message[] __asm__("D_00153898") = "Invalid macroblock_type code: 0"; -int _decMB0(struct MpegDecoder *decoder, - int *mb_type, - int *motion_type, - int *dct_type_out, - struct MpegMbState *motion_vector_state, - int *motion_field_select, +int _decMB0(struct MpegDecoder *decoder, + int *mb_type, + int *motion_type, + int *dct_type_out, + struct MpegMbState *motion_vector_state, + int *motion_field_select, - int differential_motion_vector) { + int differential_motion_vector) { enum { DCT_TYPE_FRAME = 0, MOTION_TYPE_FIELD = 1, diff --git a/src/sdk/mpeg/macroblock/_slice0.c b/src/sdk/mpeg/macroblock/_slice0.c index feb3f0151d..349953f941 100644 --- a/src/sdk/mpeg/macroblock/_slice0.c +++ b/src/sdk/mpeg/macroblock/_slice0.c @@ -5,8 +5,8 @@ #include "rnc/sdk/mpeg/errors.h" #include "rnc/sdk/mpeg/macroblock.h" -const char too_many_macroblocks_error_message[] __asm__("D_00153848") = - "Too many macroblocks in picture"; +const char + too_many_macroblocks_error_message[] __asm__("D_00153848") = "Too many macroblocks in picture"; extern s32 _motionComp0(); s32 _slice0(struct MpegDecoder *mp, s32 nmb) { diff --git a/src/sdk/mpeg/macroblock/domc.c b/src/sdk/mpeg/macroblock/domc.c index d7203ee12a..6e1419902d 100644 --- a/src/sdk/mpeg/macroblock/domc.c +++ b/src/sdk/mpeg/macroblock/domc.c @@ -2,7 +2,7 @@ #include "rnc/sdk/libmpeg.h" #include "rnc/sdk/mpeg/errors.h" -const char intra_skip_mb_error_message[] __asm__("D_00153770") = "intra && skip MB"; +const char intra_skip_mb_error_message[] __asm__("D_00153770") = "intra && skip MB"; extern void func_001271D8(); extern void func_00127178(); diff --git a/src/sdk/mpeg/macroblock/skip_mb0.c b/src/sdk/mpeg/macroblock/skip_mb0.c index 4265fa44ed..0d3200527e 100644 --- a/src/sdk/mpeg/macroblock/skip_mb0.c +++ b/src/sdk/mpeg/macroblock/skip_mb0.c @@ -17,12 +17,12 @@ struct MpegMotionRef { const char skipped_macroblock_in_i_picture_error_message[] __asm__("D_00153868") = "skiped macroblock in I picure is not allowed"; -s32 _skipMB0(struct MpegDecoder *decoder, - struct MpegSkipState *skip_state, - s32 *picture_structure_mode, - struct MpegMotionRef *motion_reference, +s32 _skipMB0(struct MpegDecoder *decoder, + struct MpegSkipState *skip_state, + s32 *picture_structure_mode, + struct MpegMotionRef *motion_reference, - s32 *flags) { + s32 *flags) { enum { MPEG_PICTURE_CODING_TYPE_I = 1 }; diff --git a/src/sdk/mpeg/macroblock/slicea0.c b/src/sdk/mpeg/macroblock/slicea0.c index 3617063eff..21870a2fe0 100644 --- a/src/sdk/mpeg/macroblock/slicea0.c +++ b/src/sdk/mpeg/macroblock/slicea0.c @@ -13,15 +13,15 @@ struct MpegMotionState { s32 values[8]; }; -const u8 D_00153800[] = "slice_start_code(0x%08x) out of range"; +const u8 D_00153800[] = "slice_start_code(0x%08x) out of range"; extern const char slice_setup_error_message[] __asm__("D_00153828"); -extern s32 _Error(); -extern s32 _Error1(); -extern s32 _flushBuf(); -extern s32 _mbAddressIncrement(); -extern s32 _nextStartCode(); -extern s32 _peepBit(); -extern s32 _sliceB(); +extern s32 _Error(); +extern s32 _Error1(); +extern s32 _flushBuf(); +extern s32 _mbAddressIncrement(); +extern s32 _nextStartCode(); +extern s32 _peepBit(); +extern s32 _sliceB(); s32 _sliceA0(struct MpegSliceDecoder *decoder, s32 unused, diff --git a/src/sdk/mpeg/picture/_pictureData0.c b/src/sdk/mpeg/picture/_pictureData0.c index 5775f3b648..641b9cb695 100644 --- a/src/sdk/mpeg/picture/_pictureData0.c +++ b/src/sdk/mpeg/picture/_pictureData0.c @@ -14,8 +14,8 @@ typedef struct { s32 unk814; } MpegDec; -const char skip_to_next_picture_error_message[] __asm__("D_001537E0") = - "= Skip to the next picture ="; +const char + skip_to_next_picture_error_message[] __asm__("D_001537E0") = "= Skip to the next picture ="; s32 _pictureData0(MpegDec *decoder) { enum { diff --git a/src/sdk/mpeg/picture/decpicture.c b/src/sdk/mpeg/picture/decpicture.c index b268d57337..56b2f814f1 100644 --- a/src/sdk/mpeg/picture/decpicture.c +++ b/src/sdk/mpeg/picture/decpicture.c @@ -22,10 +22,10 @@ struct MpegReferenceImage { s32 decoded; }; -const char odd_field_picture_count_error_message[] __asm__("D_00153940") = - "odd number of field pictures"; -const char unknown_picture_structure_error_message[] __asm__("D_00153960") = - "unknown picture sutructure"; +const char + odd_field_picture_count_error_message[] __asm__("D_00153940") = "odd number of field pictures"; +const char + unknown_picture_structure_error_message[] __asm__("D_00153960") = "unknown picture sutructure"; s32 _decPicture(struct MpegDecoderState *decoder) { enum { diff --git a/src/sdk/rpc/iop/sce_sif_reboot_iop.c b/src/sdk/rpc/iop/sce_sif_reboot_iop.c index bcb7f80d85..cbad003f5b 100644 --- a/src/sdk/rpc/iop/sce_sif_reboot_iop.c +++ b/src/sdk/rpc/iop/sce_sif_reboot_iop.c @@ -3,7 +3,7 @@ #include "rnc/sdk/rpc/iop.h" #include "rnc/sdk/rpc/rpc.h" -const char D_00152960[] = "rom0:UDNL "; +const char D_00152960[] = "rom0:UDNL "; extern const char iop_reboot_parameter_too_long_format[] __asm__("D_00152970"); s32 sceSifRebootIop(const char *img) { @@ -33,5 +33,5 @@ s32 sceSifRebootIop(const char *img) { return sceSifResetIop(param, 0); } -const char iop_reboot_parameter_too_long_format[] __asm__("D_00152970") = - "too long parameter '%s'\n"; +const char + iop_reboot_parameter_too_long_format[] __asm__("D_00152970") = "too long parameter '%s'\n"; diff --git a/src/sdk/scf/GetRomName.c b/src/sdk/scf/GetRomName.c index 6386ccd124..7fad753ed6 100644 --- a/src/sdk/scf/GetRomName.c +++ b/src/sdk/scf/GetRomName.c @@ -4,7 +4,7 @@ #include "rnc/sdk/storage/fileio.h" #include "rnc/sdk/storage/fileio/sceopen.h" -const u8 D_00153C00[] = "rom0:ROMVER"; +const u8 D_00153C00[] = "rom0:ROMVER"; extern const char rom_version_open_error_message[] __asm__("D_00153C10"); extern const char rom_version_read_error_message[] __asm__("D_00153C28"); diff --git a/src/sdk/storage/cdvd/cd_check_ncmd.c b/src/sdk/storage/cdvd/cd_check_ncmd.c index 11f8bf3e3c..11d7b82079 100644 --- a/src/sdk/storage/cdvd/cd_check_ncmd.c +++ b/src/sdk/storage/cdvd/cd_check_ncmd.c @@ -5,14 +5,14 @@ #include "rnc/sdk/rpc/rpc.h" #include "rnc/sdk/storage/cdvd.h" -extern s32 D_001312F8[]; -const u8 D_00152EB0[] = "Ncmd fail sema cur_cmd:%d keep_cmd:%d\n"; +extern s32 D_001312F8[]; +const u8 D_00152EB0[] = "Ncmd fail sema cur_cmd:%d keep_cmd:%d\n"; extern const char cd_ncmd_bind_error_message[] __asm__("D_00152ED8"); -extern s32 D_00159750[]; -extern u8 D_00159758[]; -extern s32 PollSema(); -extern void ReferThreadStatus(); -extern void SignalSema(); +extern s32 D_00159750[]; +extern u8 D_00159758[]; +extern s32 PollSema(); +extern void ReferThreadStatus(); +extern void SignalSema(); s32 cd_check_ncmd(s32 cmd) __asm__("FUN_00120a28"); diff --git a/src/sdk/storage/cdvd/cd_check_scmd.c b/src/sdk/storage/cdvd/cd_check_scmd.c index 980c0ac02f..07265848c8 100644 --- a/src/sdk/storage/cdvd/cd_check_scmd.c +++ b/src/sdk/storage/cdvd/cd_check_scmd.c @@ -5,14 +5,14 @@ #include "rnc/sdk/rpc/rpc.h" #include "rnc/sdk/storage/cdvd.h" -extern s32 D_00131308[]; -const u8 D_00152F10[] = "Scmd fail sema cur_cmd:%d keep_cmd:%d\n"; +extern s32 D_00131308[]; +const u8 D_00152F10[] = "Scmd fail sema cur_cmd:%d keep_cmd:%d\n"; extern const char cd_s_command_bind_error_message[] __asm__("D_00152F38"); -extern s32 D_00159750[]; -extern u8 D_00159758[]; -extern s32 PollSema(); -extern void ReferThreadStatus(); -extern void SignalSema(); +extern s32 D_00159750[]; +extern u8 D_00159758[]; +extern s32 PollSema(); +extern void ReferThreadStatus(); +extern void SignalSema(); s32 cd_check_scmd(s32 cmd) __asm__("FUN_00120d40"); diff --git a/src/sdk/storage/cdvd/sceCdDiskReady.c b/src/sdk/storage/cdvd/sceCdDiskReady.c index f891ceb7ec..6823b5842a 100644 --- a/src/sdk/storage/cdvd/sceCdDiskReady.c +++ b/src/sdk/storage/cdvd/sceCdDiskReady.c @@ -9,12 +9,12 @@ extern s32 D_00131304[]; extern struct sceSifClientData cd_disk_ready_rpc_client __asm__("D_00159990"); extern s32 D_001599D0[]; const char cd_disk_ready_entry_message[] __asm__("D_00152F80") = "DiskReady 0\n"; -const char cd_disk_ready_bind_error_message[] __asm__("D_00152F90") = - "Libcdvd bind err CdDiskReady\n"; -const char cd_disk_ready_completion_message[] __asm__("D_00152FB0") = "DiskReady ended\n"; -extern s32 PollSema(); -extern void SignalSema(); -extern void sceSifWriteBackDCache(); +const char + cd_disk_ready_bind_error_message[] __asm__("D_00152F90") = "Libcdvd bind err CdDiskReady\n"; +const char cd_disk_ready_completion_message[] __asm__("D_00152FB0") = "DiskReady ended\n"; +extern s32 PollSema(); +extern void SignalSema(); +extern void sceSifWriteBackDCache(); /* libcdvd disk-ready query (the sceCdDiskReady pattern): take the S-command semaphore, bind the 0x8000059A server once, send mode and return the diff --git a/src/sdk/storage/cdvd/sceCdInit.c b/src/sdk/storage/cdvd/sceCdInit.c index 64019e25c4..d05b9e26d0 100644 --- a/src/sdk/storage/cdvd/sceCdInit.c +++ b/src/sdk/storage/cdvd/sceCdInit.c @@ -15,18 +15,18 @@ typedef struct { u8 pad28[0x10]; } sceSifClientData; -extern s32 D_001312E4[]; -extern s32 D_001312F4[]; -extern s32 D_001312F8[]; -extern s32 D_001312FC[]; -extern s32 D_00131300[]; -extern s32 D_00131304[]; -extern s32 D_00131308[]; -extern s32 cd_init_rpc_bind_state[] __asm__("D_0013130C"); -extern s32 cd_initialization_count[] __asm__("D_00131310"); +extern s32 D_001312E4[]; +extern s32 D_001312F4[]; +extern s32 D_001312F8[]; +extern s32 D_001312FC[]; +extern s32 D_00131300[]; +extern s32 D_00131304[]; +extern s32 D_00131308[]; +extern s32 cd_init_rpc_bind_state[] __asm__("D_0013130C"); +extern s32 cd_initialization_count[] __asm__("D_00131310"); const char cd_init_bind_error_format[] __asm__("D_00152F50") = "Libcdvd bind err %d CD_Init %d\n"; const char cd_exit_message[] __asm__("D_00152F70") = "Libcdvd Exit\n"; -extern s32 D_00159750[]; +extern s32 D_00159750[]; extern sceSifClientData cd_init_rpc_client __asm__("D_00159968"); extern s32 cd_init_mode_request[] __asm__("D_001599C0"); diff --git a/src/sdk/storage/cdvd/sceCdRead.c b/src/sdk/storage/cdvd/sceCdRead.c index 4feff83e48..ffcc53aef3 100644 --- a/src/sdk/storage/cdvd/sceCdRead.c +++ b/src/sdk/storage/cdvd/sceCdRead.c @@ -18,12 +18,12 @@ extern volatile u32 D_00131314[]; extern struct CdReadCommand native_cd_read_request __asm__("D_001313C0"); extern u8 native_cd_read_completion_buffer[] __asm__("D_001323C0"); extern u8 native_cd_read_response[] __asm__("D_00132480"); -const char native_cd_read_submit_debug_message[] __asm__("D_00152FC8") = "call cdread cmd\n"; -const char native_cd_read_queued_debug_message[] __asm__("D_00152FE0") = "cdread end\n"; -extern void process_native_cd_read_completion(void *) __asm__("func_00120788"); -extern s32 SignalSema(u32 semaphore); -extern s32 cd_check_ncmd() __asm__("func_00120A28"); -extern void sceSifWriteBackDCache(void *ptr, s32 size); +const char native_cd_read_submit_debug_message[] __asm__("D_00152FC8") = "call cdread cmd\n"; +const char native_cd_read_queued_debug_message[] __asm__("D_00152FE0") = "cdread end\n"; +extern void process_native_cd_read_completion(void *) __asm__("func_00120788"); +extern s32 SignalSema(u32 semaphore); +extern s32 cd_check_ncmd() __asm__("func_00120A28"); +extern void sceSifWriteBackDCache(void *ptr, s32 size); s32 sceCdRead(u32 sector, u32 count, void *buffer, struct sceCdRMode *mode) { enum { diff --git a/src/sdk/storage/cdvd/scecdreadclock.c b/src/sdk/storage/cdvd/scecdreadclock.c index 6609cde5a8..2b6410ad4e 100644 --- a/src/sdk/storage/cdvd/scecdreadclock.c +++ b/src/sdk/storage/cdvd/scecdreadclock.c @@ -8,10 +8,10 @@ struct unaligned64 { u64 v; } __attribute__((packed)); -const char cd_read_clock_before_rpc_debug_message[] __asm__("D_00152FF0") = - "Libcdvd call Clock read 1\n"; -const char cd_read_clock_after_copy_debug_message[] __asm__("D_00153010") = - "Libcdvd call Clock read 2\n"; +const char + cd_read_clock_before_rpc_debug_message[] __asm__("D_00152FF0") = "Libcdvd call Clock read 1\n"; +const char + cd_read_clock_after_copy_debug_message[] __asm__("D_00153010") = "Libcdvd call Clock read 2\n"; extern s32 SignalSema(); extern s32 cd_check_scmd() __asm__("func_00120D40"); extern void *memcpy(); diff --git a/src/sdk/storage/memory_card/sce_mc_init.c b/src/sdk/storage/memory_card/sce_mc_init.c index cf77a47d4f..a976597104 100644 --- a/src/sdk/storage/memory_card/sce_mc_init.c +++ b/src/sdk/storage/memory_card/sce_mc_init.c @@ -6,14 +6,14 @@ #include "rnc/sdk/storage/memory_card.h" const char mc_rpc_bind_error_message[] __asm__("D_00153450") = "bind error libmc \n"; -const char mcserv_old_release_message[] __asm__("D_00153468") = - "libmc: too old release of mcserv.irx\n"; -const char mcman_old_release_message[] __asm__("D_00153490") = - "libmc: too old release of mcman.irx\n"; -extern u8 D_00159A80[]; -extern s32 CreateSema(struct SemaParam *); -extern s32 WaitSema(s32); -extern s32 SignalSema(s32); +const char + mcserv_old_release_message[] __asm__("D_00153468") = "libmc: too old release of mcserv.irx\n"; +const char + mcman_old_release_message[] __asm__("D_00153490") = "libmc: too old release of mcman.irx\n"; +extern u8 D_00159A80[]; +extern s32 CreateSema(struct SemaParam *); +extern s32 WaitSema(s32); +extern s32 SignalSema(s32); s32 sceMcInit(void) { struct SemaParam param; diff --git a/src/ui/hud/banks/load_hud_banks.c b/src/ui/hud/banks/load_hud_banks.c index 2208d6a578..92c46c3430 100644 --- a/src/ui/hud/banks/load_hud_banks.c +++ b/src/ui/hud/banks/load_hud_banks.c @@ -111,8 +111,13 @@ void load_hud_banks(void) { extern __typeof__(load_hud_banks) func_00202A98 __attribute__((alias("FUN_00202a98"))); /* Small data reached with lui/addiu: the allocation tag and the stash labels. */ -char hud_allocation_source_file[] __asm__("D_0015FBB0") __attribute__((section(".sdata"))) = "loaders.cpp"; -char hud_bank_0_stash_label[] __asm__("D_0015FBC0") __attribute__((section(".sdata"))) = "hud bank 0"; -char hud_bank_2_stash_label[] __asm__("D_0015FBD0") __attribute__((section(".sdata"))) = "hud bank 2"; -char hud_bank_3_stash_label[] __asm__("D_0015FBE0") __attribute__((section(".sdata"))) = "hud bank 3"; -char hud_bank_4_stash_label[] __asm__("D_0015FBF0") __attribute__((section(".sdata"))) = "hud bank 4"; +char hud_allocation_source_file[] __asm__("D_0015FBB0") + __attribute__((section(".sdata"))) = "loaders.cpp"; +char hud_bank_0_stash_label[] __asm__("D_0015FBC0") + __attribute__((section(".sdata"))) = "hud bank 0"; +char hud_bank_2_stash_label[] __asm__("D_0015FBD0") + __attribute__((section(".sdata"))) = "hud bank 2"; +char hud_bank_3_stash_label[] __asm__("D_0015FBE0") + __attribute__((section(".sdata"))) = "hud bank 3"; +char hud_bank_4_stash_label[] __asm__("D_0015FBF0") + __attribute__((section(".sdata"))) = "hud bank 4"; diff --git a/src/ui/loading/append_scrolling_textured_quad.c b/src/ui/loading/append_scrolling_textured_quad.c index 7c7aa867e8..d522eb5156 100644 --- a/src/ui/loading/append_scrolling_textured_quad.c +++ b/src/ui/loading/append_scrolling_textured_quad.c @@ -85,5 +85,5 @@ extern __typeof__(append_scrolling_textured_quad) func_002316E8 /* GIF tag of the quad packet (NLOOP 1, EOP, REGLIST, NREG 11) and its * register list. Small data reached with lui/addiu. */ -u64 loading_quad_packet_header_template[2] __asm__("D_00160850") __attribute__((section(".sdata"))) __attribute__((aligned(16))) = { - 0xB400000000008001, 0x0000052525252106}; +u64 loading_quad_packet_header_template[2] __asm__("D_00160850") __attribute__((section(".sdata"))) +__attribute__((aligned(16))) = {0xB400000000008001, 0x0000052525252106}; diff --git a/src/ui/map/coverage/downsample_map_coverage.c b/src/ui/map/coverage/downsample_map_coverage.c index d3673988c3..26ec506eeb 100644 --- a/src/ui/map/coverage/downsample_map_coverage.c +++ b/src/ui/map/coverage/downsample_map_coverage.c @@ -4,9 +4,9 @@ struct Table16 { s32 v[16]; }; -extern u8 *D_001A00FC[]; +extern u8 *D_001A00FC[]; extern const struct Table16 map_coverage_nibble_contribution_table __asm__("D_001E8080"); -extern void fill_transfer_words(void *dst, s32 value, s32 size) __asm__("func_001F97E8"); +extern void fill_transfer_words(void *dst, s32 value, s32 size) __asm__("func_001F97E8"); /* Builds a 1bpp mask from the 4bpp map at D_001A00FC[0]: each nibble is weighted through the 16-entry table D_001E8080, four source rows are summed @@ -60,4 +60,5 @@ extern __typeof__(downsample_map_coverage) func_00208030 __attribute__((alias("F /* Entry n is the number of set bits in nibble n. */ const struct Table16 map_coverage_nibble_contribution_table __asm__("D_001E8080") = { - {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}}; + {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4} +}; diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index 77a70f50f7..6bae987f1b 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -26,6 +26,7 @@ struct MapEntry { extern u8 map_cross_destination_page[] __asm__("D_001CF678"); extern u8 map_circle_destination_page[] __asm__("D_001CF418"); + #include "rnc/game/item_state.h" #include "rnc/game/level_state.h" diff --git a/src/ui/map/level_selection/draw_level_selection_map.c b/src/ui/map/level_selection/draw_level_selection_map.c index ac8044a1c2..e117a6d0a2 100644 --- a/src/ui/map/level_selection/draw_level_selection_map.c +++ b/src/ui/map/level_selection/draw_level_selection_map.c @@ -7,7 +7,7 @@ #include "rnc/game/game_globals.h" /* Small data, defined above the code so it is reached $gp-relative. */ -s32 large_font_height __asm__("D_0015F690") = 17; +s32 large_font_height __asm__("D_0015F690") = 17; extern void setup_gif_paging(s32) __asm__("func_001F4280"); extern void do_gif_paging(void) __asm__("func_001F4398"); extern s32 measure_text_width_regular(u8 *, s32) __asm__("func_001F6250"); @@ -121,13 +121,13 @@ void draw_level_selection_map(s32 left, s32 right, s32 top, s32 bottom) { } LevelSelectText level_select_texts[19] = { - {0x4eb9, 0x4ede, 0}, - {0x4eba, 0x4ecd, 6}, - {0x4ebb, 0x4ece, 0x3f1}, - {0x4ebc, 0x4ecf, 0x3f2}, - {0x4ebd, 0x4ed0, 0xbc6}, + {0x4eb9, 0x4ede, 0}, + {0x4eba, 0x4ecd, 6}, + {0x4ebb, 0x4ece, 0x3f1}, + {0x4ebc, 0x4ecf, 0x3f2}, + {0x4ebd, 0x4ed0, 0xbc6}, {0x4ebe, 0x4ed1, 0x177b}, - {0x4ebf, 0x4ed2, 0xfa6}, + {0x4ebf, 0x4ed2, 0xfa6}, {0x4ec0, 0x4ed3, 0x1394}, {0x4ec1, 0x4ed4, 0x1b58}, {0x4ec2, 0x4ed5, 0x1f47}, @@ -166,4 +166,3 @@ LevelMapMarker level_map_markers[20] = { }; extern __typeof__(draw_level_selection_map) func_001FD748 __attribute__((alias("FUN_001fd748"))); - diff --git a/src/ui/map/slots/pick_next_map.c b/src/ui/map/slots/pick_next_map.c index c90bd19036..9825590e59 100644 --- a/src/ui/map/slots/pick_next_map.c +++ b/src/ui/map/slots/pick_next_map.c @@ -6,6 +6,7 @@ #include "rnc/ui/map/slots/find_map_entry_slot.h" #include "rnc/game/item_state.h" + /* Picks the map to load next: the current map id (level_map_selection.level, +0x100 when item_available[ITEM_MAP_SHIFT] is set) unless find_map_entry_slot finds it already in a slot, otherwise the nearest entry of the 20-id list D_001601E0 diff --git a/src/ui/map/update_map_icons.c b/src/ui/map/update_map_icons.c index 2ae6845978..53047b502d 100644 --- a/src/ui/map/update_map_icons.c +++ b/src/ui/map/update_map_icons.c @@ -188,23 +188,7 @@ extern struct MapIcon D_001A2A08[]; extern struct MapIcon D_001A2AF8[]; struct MapIcon *map_icon_lists_by_level[19] __asm__("D_001A2BC0") = { - D_001A0910, - D_001A0A28, - D_001A0BE0, - D_001A0E60, - D_001A10E0, - D_001A1270, - D_001A14C8, - D_001A1680, - D_001A1860, - D_001A1A18, - D_001A1C20, - D_001A1EC8, - D_001A2148, - D_001A22B0, - D_001A2490, - D_001A26C0, - D_001A28C8, - D_001A2A08, - D_001A2AF8, + D_001A0910, D_001A0A28, D_001A0BE0, D_001A0E60, D_001A10E0, D_001A1270, D_001A14C8, + D_001A1680, D_001A1860, D_001A1A18, D_001A1C20, D_001A1EC8, D_001A2148, D_001A22B0, + D_001A2490, D_001A26C0, D_001A28C8, D_001A2A08, D_001A2AF8, }; diff --git a/src/ui/menus/item_preview/draw_menu_preview_objects.c b/src/ui/menus/item_preview/draw_menu_preview_objects.c index 866a430ad3..36315894bf 100644 --- a/src/ui/menus/item_preview/draw_menu_preview_objects.c +++ b/src/ui/menus/item_preview/draw_menu_preview_objects.c @@ -59,5 +59,5 @@ s32 draw_menu_preview_objects(struct MenuPreviewObjects *preview) { extern __typeof__(draw_menu_preview_objects) func_0021DDF8 __attribute__((alias("FUN_0021ddf8"))); /* Nonzero: the preview draws slot i (the loop above walks the 24 slots). */ -s32 menu_preview_slot_draw_enabled[24] __asm__("D_001D5020") = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +s32 menu_preview_slot_draw_enabled[24] __asm__("D_001D5020") = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; diff --git a/src/ui/menus/pause/assign_heli_pack_label_text_table.c b/src/ui/menus/pause/assign_heli_pack_label_text_table.c index c97a5d1e35..412902bc1c 100644 --- a/src/ui/menus/pause/assign_heli_pack_label_text_table.c +++ b/src/ui/menus/pause/assign_heli_pack_label_text_table.c @@ -3,14 +3,16 @@ #include "types.h" #include "rnc/game/item_state.h" -extern s32 heli_pack_label_text_ids[14] __asm__("D_001D06D0"); -extern s32 no_heli_pack_label_text_ids[14] __asm__("D_001D0708"); + +extern s32 heli_pack_label_text_ids[14] __asm__("D_001D06D0"); +extern s32 no_heli_pack_label_text_ids[14] __asm__("D_001D0708"); int assign_heli_pack_label_text_table(void *destination) __asm__("FUN_0021ca98"); int assign_heli_pack_label_text_table(void *destination) { - *(s32 **)((char *)destination + 0x34) = - (item_available[ITEM_HELI_PACK] != 0) ? heli_pack_label_text_ids : no_heli_pack_label_text_ids; + *(s32 **)((char *)destination + 0x34) = (item_available[ITEM_HELI_PACK] != 0) + ? heli_pack_label_text_ids + : no_heli_pack_label_text_ids; return 0; } diff --git a/src/ui/menus/save_data/draw_save_slot_list.c b/src/ui/menus/save_data/draw_save_slot_list.c index 689ab3bc4a..1a2f143fc3 100644 --- a/src/ui/menus/save_data/draw_save_slot_list.c +++ b/src/ui/menus/save_data/draw_save_slot_list.c @@ -130,6 +130,9 @@ s32 draw_save_slot_list(SaveMenu *menu) { extern __typeof__(draw_save_slot_list) func_002239E0 __attribute__((alias("FUN_002239e0"))); /* Small data reached with lui/addiu: the save slot formats. */ -char save_slot_play_time_format[] __asm__("D_00160300") __attribute__((section(".sdata"))) = "%02d:%02d"; -char save_slot_grouped_bolts_format[] __asm__("D_00160310") __attribute__((section(".sdata"))) = "%d,%03d,%03d"; -char save_slot_hex_triplet_format[] __asm__("D_00160320") __attribute__((section(".sdata"))) = "%02x/%02x/%02x"; +char save_slot_play_time_format[] __asm__("D_00160300") + __attribute__((section(".sdata"))) = "%02d:%02d"; +char save_slot_grouped_bolts_format[] __asm__("D_00160310") + __attribute__((section(".sdata"))) = "%d,%03d,%03d"; +char save_slot_hex_triplet_format[] __asm__("D_00160320") + __attribute__((section(".sdata"))) = "%02x/%02x/%02x"; diff --git a/src/ui/menus/system/emit_selected_graphics_dma_packets.c b/src/ui/menus/system/emit_selected_graphics_dma_packets.c index 622de02466..d4aa387f95 100644 --- a/src/ui/menus/system/emit_selected_graphics_dma_packets.c +++ b/src/ui/menus/system/emit_selected_graphics_dma_packets.c @@ -8,6 +8,7 @@ struct Mat { extern struct Mat graphics_dma_reference_records[] __asm__("D_001D7D90"); /* Small data, defined above the code so it is reached $gp-relative. */ s32 graphics_packet_payload_words_by_slot[2] __asm__("D_00160360") = {0x7F8080FF, (s32)0x8280FF80}; + extern void FUN_00228598(s32, s32); void emit_selected_graphics_dma_packets(s32 render_selector, diff --git a/src/ui/menus/system/process_menu_entry.c b/src/ui/menus/system/process_menu_entry.c index 6db2022cc0..756cb01507 100644 --- a/src/ui/menus/system/process_menu_entry.c +++ b/src/ui/menus/system/process_menu_entry.c @@ -192,5 +192,7 @@ s32 menu_entry_context[6] = {0}; * menu_bolt_threshold_thousands_separators points to, and the formats. */ char thousands_separator_comma[] __asm__("D_00160078") __attribute__((section(".sdata"))) = ","; char thousands_separator_period[] __asm__("D_00160080") __attribute__((section(".sdata"))) = "."; -char help_text_integer_placeholder[] __asm__("D_00160088") __attribute__((section(".sdata"))) = "%d"; -char bolt_threshold_number_format[] __asm__("D_00160090") __attribute__((section(".sdata"))) = "%d%s%03d"; +char help_text_integer_placeholder[] __asm__("D_00160088") + __attribute__((section(".sdata"))) = "%d"; +char bolt_threshold_number_format[] __asm__("D_00160090") + __attribute__((section(".sdata"))) = "%d%s%03d"; diff --git a/src/ui/menus/system/setup_menu_display_text.c b/src/ui/menus/system/setup_menu_display_text.c index 58f76b8da2..06e8f22be6 100644 --- a/src/ui/menus/system/setup_menu_display_text.c +++ b/src/ui/menus/system/setup_menu_display_text.c @@ -59,4 +59,5 @@ int setup_menu_display_text(struct MenuScreen *menu) { extern __typeof__(setup_menu_display_text) func_0021EF78 __attribute__((alias("FUN_0021ef78"))); /* Small data reached with lui/addiu. */ -char setup_menu_text_format[] __asm__("D_001602A8") __attribute__((section(".sdata"))) = "%s %d %s %d"; +char setup_menu_text_format[] __asm__("D_001602A8") + __attribute__((section(".sdata"))) = "%s %d %s %d"; diff --git a/src/ui/menus/weapons/draw_selected_item_ammo.c b/src/ui/menus/weapons/draw_selected_item_ammo.c index 1881ef05fa..692b31c548 100644 --- a/src/ui/menus/weapons/draw_selected_item_ammo.c +++ b/src/ui/menus/weapons/draw_selected_item_ammo.c @@ -78,4 +78,5 @@ s32 draw_selected_item_ammo(s32 image_descriptor_input) { /* Small data reached with lui/addiu: the ammo count formats. */ u8 ammo_count_decimal_format[] __asm__("D_001602B8") __attribute__((section(".sdata"))) = "%d/"; -u8 ammo_count_grouped_decimal_format[] __asm__("D_001602C0") __attribute__((section(".sdata"))) = "%d,%03d/"; +u8 ammo_count_grouped_decimal_format[] __asm__("D_001602C0") + __attribute__((section(".sdata"))) = "%d,%03d/"; diff --git a/src/ui/menus/widgets/draw_menu_selection_text.c b/src/ui/menus/widgets/draw_menu_selection_text.c index bbb8237ec4..79faf4416e 100644 --- a/src/ui/menus/widgets/draw_menu_selection_text.c +++ b/src/ui/menus/widgets/draw_menu_selection_text.c @@ -41,12 +41,12 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { menu_width = menu->width; entry_offset = entry_index * 0xC; mid_x = ((s32)(menu_width + ((((u32)menu_width) >> 24) >> 7))) >> 1; - font_print_center( - mid_x, - 4, - 0x80FFA888, - get_help_message_text(*((s32 *)((void *)(entry_offset + (u8 *)level_select_texts)))), - -1); + font_print_center(mid_x, + 4, + 0x80FFA888, + get_help_message_text( + *((s32 *)((void *)(entry_offset + (u8 *)level_select_texts)))), + -1); width2 = menu->width; if (1) { center_x2 = ((s32)(width2 + (((u32)width2) >> 0x1F))) >> 1; @@ -54,7 +54,8 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { center_x2, 0x14, 0x80FFA888, - get_help_message_text(*((s32 *)(((u8 *)((u8 *)level_select_texts + entry_offset)) + 0x4))), + get_help_message_text( + *((s32 *)(((u8 *)((u8 *)level_select_texts + entry_offset)) + 0x4))), -1); } } diff --git a/src/ui/menus/widgets/draw_menu_side_indicator.c b/src/ui/menus/widgets/draw_menu_side_indicator.c index a9505dd5c9..bf35b61ed8 100644 --- a/src/ui/menus/widgets/draw_menu_side_indicator.c +++ b/src/ui/menus/widgets/draw_menu_side_indicator.c @@ -54,5 +54,7 @@ int draw_menu_side_indicator(struct MenuScreen *menu) { extern __typeof__(draw_menu_side_indicator) func_00221F58 __attribute__((alias("FUN_00221f58"))); /* Small data reached with lui/addiu: one-glyph strings (font glyphs 0x10, 0x11). */ -char menu_side_indicator_set_glyph_string[] __asm__("D_001602F0") __attribute__((section(".sdata"))) = "\x10"; -char menu_side_indicator_clear_glyph_string[] __asm__("D_001602F8") __attribute__((section(".sdata"))) = "\x11"; +char menu_side_indicator_set_glyph_string[] __asm__("D_001602F0") + __attribute__((section(".sdata"))) = "\x10"; +char menu_side_indicator_clear_glyph_string[] __asm__("D_001602F8") + __attribute__((section(".sdata"))) = "\x11"; diff --git a/src/ui/menus/widgets/draw_selected_menu_item_text.c b/src/ui/menus/widgets/draw_selected_menu_item_text.c index a28e7d4056..06abff473f 100644 --- a/src/ui/menus/widgets/draw_selected_menu_item_text.c +++ b/src/ui/menus/widgets/draw_selected_menu_item_text.c @@ -44,19 +44,21 @@ s32 draw_selected_menu_item_text(struct MenuScreen *menu) { menu_width = menu->width; mid_x = (s32)(menu_width + ((u32)menu_width >> 0x1F)) >> 1; upper_y = ((s32)menu->height / 3) - 8; - font_print_center(mid_x, - upper_y, - 0x80FFA888, - get_help_message_text(*(s32 *)(void *)(entry_offset + (u8 *)level_select_texts)), - -1); + font_print_center( + mid_x, + upper_y, + 0x80FFA888, + get_help_message_text(*(s32 *)(void *)(entry_offset + (u8 *)level_select_texts)), + -1); width2 = menu->width; center_x2 = (s32)(width2 + ((u32)width2 >> 0x1F)) >> 1; lower_y = ((s32)(menu->height * 2) / 3) - 8; - font_print_center(center_x2, - lower_y, - 0x80FFA888, - get_help_message_text(*(s32 *)((u8 *)((u8 *)level_select_texts + entry_offset) + 0x4)), - -1); + font_print_center( + center_x2, + lower_y, + 0x80FFA888, + get_help_message_text(*(s32 *)((u8 *)((u8 *)level_select_texts + entry_offset) + 0x4)), + -1); block_5: do_gif_paging(); return 2; diff --git a/src/ui/menus/widgets/format_menu_item_text.c b/src/ui/menus/widgets/format_menu_item_text.c index 0600527afd..5bfb82ee95 100644 --- a/src/ui/menus/widgets/format_menu_item_text.c +++ b/src/ui/menus/widgets/format_menu_item_text.c @@ -57,4 +57,5 @@ extern __typeof__(format_menu_item_text) func_00208280 __attribute__((alias("FUN /* Small data reached with lui/addiu. */ char menu_item_decimal_format[] __asm__("D_0015FDA0") __attribute__((section(".sdata"))) = "%d"; -char menu_item_placeholder_error_text[] __asm__("D_0015FDA8") __attribute__((section(".sdata"))) = "error"; +char menu_item_placeholder_error_text[] __asm__("D_0015FDA8") + __attribute__((section(".sdata"))) = "error"; diff --git a/src/ui/menus/widgets/format_scaled_display_value.c b/src/ui/menus/widgets/format_scaled_display_value.c index 033ee411e9..465b818a5f 100644 --- a/src/ui/menus/widgets/format_scaled_display_value.c +++ b/src/ui/menus/widgets/format_scaled_display_value.c @@ -16,5 +16,6 @@ void format_scaled_display_value(u8 *destination, s32 value) { extern __typeof__(format_scaled_display_value) func_00238688 __attribute__((alias("FUN_00238688"))); /* Small data reached with lui/addiu. */ -u8 thousands_grouped_integer_format[] __asm__("D_00161078") __attribute__((section(".sdata"))) = "%d,%03d"; +u8 thousands_grouped_integer_format[] __asm__("D_00161078") + __attribute__((section(".sdata"))) = "%d,%03d"; u8 plain_integer_format[] __asm__("D_00161080") __attribute__((section(".sdata"))) = "%d"; diff --git a/src/ui/text/draw_dialog_text.c b/src/ui/text/draw_dialog_text.c index 958a5633aa..22c8188c37 100644 --- a/src/ui/text/draw_dialog_text.c +++ b/src/ui/text/draw_dialog_text.c @@ -46,39 +46,38 @@ extern void draw_rotated_sprite( void draw_dialog_text(void) __asm__("FUN_001fbc50"); - #include "rnc/ui/text/draw_dialog_text_globals.h" -extern char freeze_fmt_race_first_place[] __asm__("D_0015F568"); -extern char freeze_fmt_race_second_place[] __asm__("D_0015F570"); -extern char freeze_fmt_race_third_place[] __asm__("D_0015F578"); -extern char freeze_fmt_race_other_place[] __asm__("D_0015F580"); -extern char freeze_fmt_record_label[] __asm__("D_0015F588"); +extern char freeze_fmt_race_first_place[] __asm__("D_0015F568"); +extern char freeze_fmt_race_second_place[] __asm__("D_0015F570"); +extern char freeze_fmt_race_third_place[] __asm__("D_0015F578"); +extern char freeze_fmt_race_other_place[] __asm__("D_0015F580"); +extern char freeze_fmt_record_label[] __asm__("D_0015F588"); /* Small data, in retail order: layout values and RGBA colours (0xAABBGGRR). * Defined above the code, so it reaches them $gp-relative. */ -s32 freeze_ans2 __asm__("D_0015F4E8") = 115; -s32 freeze_ans1 __asm__("D_0015F4EC") = 130; -s32 freeze_fading_dialog_text_base_color __asm__("D_0015F4F0") = 0x00FFA888; -s32 freeze_fading_dialog_text_blend_target_color __asm__("D_0015F4F4") = (s32)0x80FFA888; -s32 freeze_three_line_outline_center_x __asm__("D_0015F4F8") = 256; -s32 freeze_three_line_outline_center_y __asm__("D_0015F4FC") = 185; -s32 freeze_three_line_outline_half_width __asm__("D_0015F500") = 100; -s32 freeze_three_line_outline_half_height __asm__("D_0015F504") = 50; -s32 freeze_bevel_a_text __asm__("D_0015F508") = 150; -s32 freeze_stats_outline_center_x __asm__("D_0015F50C") = 256; -s32 freeze_stats_outline_center_y __asm__("D_0015F510") = 205; -s32 freeze_stats_outline_half_width __asm__("D_0015F514") = 100; -s32 freeze_stats_outline_half_height __asm__("D_0015F518") = 120; -s32 freeze_stats_text __asm__("D_0015F51C") = 110; -s32 freeze_wave_period __asm__("D_0015F520") = 180; -s32 freeze_outline_pulse_base_color __asm__("D_0015F524") = (s32)0x80E08060; -s32 freeze_outline_pulse_blend_target_color __asm__("D_0015F528") = (s32)0x80D06050; -s32 freeze_shared_dialog_text_base_color __asm__("D_0015F52C") = 0x00FFC0C0; -s32 freeze_shared_dialog_text_blend_target_color __asm__("D_0015F530") = (s32)0x80FFC0C0; -s32 freeze_matched_record_text_base_color __asm__("D_0015F534") = 0x0060EF60; -s32 freeze_matched_record_text_blend_target_color __asm__("D_0015F538") = (s32)0x8060EF60; -s32 freeze_unmatched_record_text_base_color __asm__("D_0015F53C") = 0x006060EF; -s32 freeze_unmatched_record_text_blend_target_color __asm__("D_0015F540") = (s32)0x806060EF; +s32 freeze_ans2 __asm__("D_0015F4E8") = 115; +s32 freeze_ans1 __asm__("D_0015F4EC") = 130; +s32 freeze_fading_dialog_text_base_color __asm__("D_0015F4F0") = 0x00FFA888; +s32 freeze_fading_dialog_text_blend_target_color __asm__("D_0015F4F4") = (s32)0x80FFA888; +s32 freeze_three_line_outline_center_x __asm__("D_0015F4F8") = 256; +s32 freeze_three_line_outline_center_y __asm__("D_0015F4FC") = 185; +s32 freeze_three_line_outline_half_width __asm__("D_0015F500") = 100; +s32 freeze_three_line_outline_half_height __asm__("D_0015F504") = 50; +s32 freeze_bevel_a_text __asm__("D_0015F508") = 150; +s32 freeze_stats_outline_center_x __asm__("D_0015F50C") = 256; +s32 freeze_stats_outline_center_y __asm__("D_0015F510") = 205; +s32 freeze_stats_outline_half_width __asm__("D_0015F514") = 100; +s32 freeze_stats_outline_half_height __asm__("D_0015F518") = 120; +s32 freeze_stats_text __asm__("D_0015F51C") = 110; +s32 freeze_wave_period __asm__("D_0015F520") = 180; +s32 freeze_outline_pulse_base_color __asm__("D_0015F524") = (s32)0x80E08060; +s32 freeze_outline_pulse_blend_target_color __asm__("D_0015F528") = (s32)0x80D06050; +s32 freeze_shared_dialog_text_base_color __asm__("D_0015F52C") = 0x00FFC0C0; +s32 freeze_shared_dialog_text_blend_target_color __asm__("D_0015F530") = (s32)0x80FFC0C0; +s32 freeze_matched_record_text_base_color __asm__("D_0015F534") = 0x0060EF60; +s32 freeze_matched_record_text_blend_target_color __asm__("D_0015F538") = (s32)0x8060EF60; +s32 freeze_unmatched_record_text_base_color __asm__("D_0015F53C") = 0x006060EF; +s32 freeze_unmatched_record_text_blend_target_color __asm__("D_0015F540") = (s32)0x806060EF; struct TextRegion D_001E78F0 = {0x50, 0x154, 0x60, 0x1a0, 0x100, 0x54, 0, 0, 0x10, 1, 0, 0}; @@ -555,10 +554,14 @@ extern __typeof__(draw_dialog_text) func_001FBC50 __attribute__((alias("FUN_001f char freeze_default_text[] __asm__("D_0015F548") __attribute__((section(".sdata"))) = ""; char freeze_fmt_scsc[] __asm__("D_0015F550") __attribute__((section(".sdata"))) = "%s%c%c%s"; char freeze_fmt_indent[] __asm__("D_0015F560") __attribute__((section(".sdata"))) = " %s"; -char freeze_fmt_race_first_place[] __asm__("D_0015F568") __attribute__((section(".sdata"))) = "%dst"; -char freeze_fmt_race_second_place[] __asm__("D_0015F570") __attribute__((section(".sdata"))) = "%dnd"; -char freeze_fmt_race_third_place[] __asm__("D_0015F578") __attribute__((section(".sdata"))) = "%drd"; -char freeze_fmt_race_other_place[] __asm__("D_0015F580") __attribute__((section(".sdata"))) = "%dth"; +char freeze_fmt_race_first_place[] __asm__("D_0015F568") + __attribute__((section(".sdata"))) = "%dst"; +char freeze_fmt_race_second_place[] __asm__("D_0015F570") + __attribute__((section(".sdata"))) = "%dnd"; +char freeze_fmt_race_third_place[] __asm__("D_0015F578") + __attribute__((section(".sdata"))) = "%drd"; +char freeze_fmt_race_other_place[] __asm__("D_0015F580") + __attribute__((section(".sdata"))) = "%dth"; char freeze_fmt_record_label[] __asm__("D_0015F588") __attribute__((section(".sdata"))) = "%s"; char freeze_fmt_time[] __asm__("D_0015F590") __attribute__((section(".sdata"))) = "%d:%02d:%02d"; char freeze_fmt_score[] __asm__("D_0015F5A0") __attribute__((section(".sdata"))) = "%d"; diff --git a/src/ui/text/set_scrolling_status_message.c b/src/ui/text/set_scrolling_status_message.c index a3163a3dd3..49b91fe912 100644 --- a/src/ui/text/set_scrolling_status_message.c +++ b/src/ui/text/set_scrolling_status_message.c @@ -9,7 +9,7 @@ struct ScrollingStatus { }; extern struct ScrollingStatus D_001E63C0; -extern const char scrolling_status_message_format[] __asm__("D_001E8A70"); +extern const char scrolling_status_message_format[] __asm__("D_001E8A70"); void set_scrolling_status_message(s32 message) __asm__("FUN_00237e90"); void set_scrolling_status_message(s32 message) { From 1568d807c44e23f2d086d241221d31f2c4638f40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20K=C5=82ysz?= Date: Tue, 3 Nov 2026 14:10:13 +0000 Subject: [PATCH 25/25] decomp: audit the new data definitions: real types, field access and names from evidence Give the zone tables their pointer types in one header, read level texts through their fields, type strings as char, keep includes and externs at the top, name the save paths, dtoa strings, buried bolt states and the O2 mask item, use LEVEL_RECORD_COUNT and LEVEL_COUNT for per-level sizes, and write memory_card_state with designated fields. --- include/rnc/data_labels.h | 6 -- include/rnc/game/item_state.h | 6 +- include/rnc/game/level_progress.h | 2 +- include/rnc/game/level_state.h | 5 +- include/rnc/rendering/render_globals.h | 3 - include/rnc/save/memory_card_state.h | 9 +++ .../rnc/world/collision/surface_height_grid.h | 13 +++++ src/audio/snd_start_sound_system.c | 13 +++-- src/audio/voices/pause_all_sounds.c | 4 ++ src/camera/resolve_camera_surface_height.c | 1 + src/camera/sample_surface_height_map.c | 1 - .../missions/get_map_point_mission_status.c | 1 - src/game/process_global_state_flags.c | 2 + src/game/update_resident_gameplay_state.c | 6 +- src/overlays/l11/mobys/pokitaru_pickup.c | 8 +-- .../cutscenes/update_cutscene_playback.c | 4 +- .../hero/try_transition_hero_water_state.c | 2 +- src/overlays/shared/pickups/buried_bolts.c | 2 +- src/overlays/shared/vendor/vendor_menu.c | 7 +-- src/overlays/shared/weapons/metal_detector.c | 7 +-- src/rendering/frame/reset_draw_globals.c | 1 + src/rendering/vu1/select_level_vu_chain.c | 9 +-- src/save/check_memory_card.c | 7 +-- src/save/memcard_get_name.c | 48 +++++++++------- src/save/memcard_update_state.c | 55 ++++++++----------- src/sdk/libc/mprec/_dtoa_r.c | 13 +++-- src/ui/hud/init_hud.c | 4 +- .../loading/append_scrolling_textured_quad.c | 4 +- src/ui/map/draw_map_overlay.c | 28 +++++----- src/ui/map/draw_map_screen.c | 13 ++--- src/ui/map/slots/pick_next_map.c | 1 - src/ui/map/update_map_icons.c | 48 ++++++++-------- .../pause/assign_heli_pack_label_text_table.c | 1 - src/ui/menus/pause/draw_pause_ring.c | 9 +-- .../menus/weapons/draw_selected_item_ammo.c | 8 +-- .../menus/widgets/draw_menu_selection_text.c | 26 ++++----- .../widgets/draw_selected_menu_item_text.c | 24 ++++---- .../widgets/format_scaled_display_value.c | 10 ++-- src/world/find_zone_at_point.c | 14 +---- 39 files changed, 210 insertions(+), 215 deletions(-) diff --git a/include/rnc/data_labels.h b/include/rnc/data_labels.h index e923119862..56d5359d79 100644 --- a/include/rnc/data_labels.h +++ b/include/rnc/data_labels.h @@ -21,12 +21,6 @@ extern s32 D_001312E4[]; extern s32 D_00131314[]; extern unsigned char D_0013A4E0[]; extern s32 D_0013CB14[]; -extern char D_0013D1D0[]; -extern char D_0013D1E8[]; -extern char D_0013D200[]; -extern char D_0013D220[]; -extern char D_0013D240[]; -extern char D_0013D270[]; extern s32 D_0013D384 __attribute__((section(".data"))); extern unsigned char D_0013D3DD __attribute__((section(".data"))); extern unsigned char D_0013D3E2[]; diff --git a/include/rnc/game/item_state.h b/include/rnc/game/item_state.h index 1861ab543a..5d33ee653e 100644 --- a/include/rnc/game/item_state.h +++ b/include/rnc/game/item_state.h @@ -10,10 +10,12 @@ extern u8 alternate_item_available[128] __asm__("D_0013D388"); extern u8 item_unlocked[32] __asm__("D_0013D408"); extern s32 weapon_ammo_counts[37] __asm__("D_0013D428"); /* item_available and items_acquired hold 37 items: mc_gamedata saves 0x25 bytes of each. - Single items read by name: 2 the heli-pack (hero jump code), 33 shifts map ids by - 0x100 (pick_next_map), 35 the vendor discount. */ + Single items read by name: 2 the heli-pack (hero jump code), 6 the O2 mask (no air + loss when swimming, Fred gives it on Pokitaru), 33 shifts map ids by 0x100 + (pick_next_map), 35 the vendor discount. */ extern u8 item_available[37] __asm__("D_0013D4C0"); #define ITEM_HELI_PACK 2 +#define ITEM_O2_MASK 6 #define ITEM_MAP_SHIFT 33 #define ITEM_VENDOR_DISCOUNT 35 extern u8 item_text_variant[40] __asm__("D_0013E520"); diff --git a/include/rnc/game/level_progress.h b/include/rnc/game/level_progress.h index ebe8d0ec24..673700dfde 100644 --- a/include/rnc/game/level_progress.h +++ b/include/rnc/game/level_progress.h @@ -24,7 +24,7 @@ extern u8 map_coverage_pages[LEVEL_RECORD_COUNT * MAP_COVERAGE_PAGE_SIZE] __asm_ /* Gold bolts collected, 4 per level, indexed level * 4 + bolt. */ extern u8 gold_bolts_collected[LEVEL_RECORD_COUNT * 4] __asm__("D_0014BEC0"); /* Buried bolt states dug up with the metal detector, 16 bytes per level. */ -extern u8 D_0014BF10[LEVEL_RECORD_COUNT * 16]; +extern u8 buried_bolt_states[LEVEL_RECORD_COUNT * 16] __asm__("D_0014BF10"); /* Mission state per level slot (0xFF: done), indexed slot + level * 16. */ extern unsigned char visited52[LEVEL_RECORD_COUNT * 16] __asm__("D_0014C050"); /* One bit per moby save id, per level. */ diff --git a/include/rnc/game/level_state.h b/include/rnc/game/level_state.h index 40b80a3cfd..9debdfc23e 100644 --- a/include/rnc/game/level_state.h +++ b/include/rnc/game/level_state.h @@ -3,13 +3,14 @@ #include "types.h" #include "sda.h" +#include "rnc/game/level_progress.h" /* * Per-level flags of the save state, one byte per level index. The level * loops (map selection, marker drawing, memory card save) run to index 19, * and the two tables sit 0x18 bytes apart, each padded to a word. */ -extern u8 level_available[20] __asm__("D_0013DD40") NOT_SDA; /* shows the level on the map */ -extern u8 level_visit_state[20] __asm__("D_0013DD58") NOT_SDA; /* 0 new, 1 entered, 2 done */ +extern u8 level_available[LEVEL_RECORD_COUNT] __asm__("D_0013DD40") NOT_SDA; /* shows the level on the map */ +extern u8 level_visit_state[LEVEL_RECORD_COUNT] __asm__("D_0013DD58") NOT_SDA; /* 0 new, 1 entered, 2 done */ #endif /* LOMBYTE_RNC_GAME_LEVEL_STATE_H */ diff --git a/include/rnc/rendering/render_globals.h b/include/rnc/rendering/render_globals.h index cbd4c8f300..fb61ebcf47 100644 --- a/include/rnc/rendering/render_globals.h +++ b/include/rnc/rendering/render_globals.h @@ -28,9 +28,6 @@ extern f32 fog_far_intensity __asm__("D_0015F494"); extern s32 part_clip_dist __asm__("D_001600BC"); extern char textured_quad_header[] __asm__("D_00160840"); extern s32 current_vu_chain __asm__("D_00160F0C"); -extern s32 surface_height_tiles __asm__("D_00161190"); -extern s32 occl_cell_table __asm__("D_00161194"); -extern s32 occl_cell_count __asm__("D_00161198"); /* Draw callbacks and their arguments: add_draw_callback and enqueue_callback_list_4 take at most 0x40 of each. */ extern void (*draw_callback_funcs[0x40])(s32) __asm__("D_0018DB40"); diff --git a/include/rnc/save/memory_card_state.h b/include/rnc/save/memory_card_state.h index dfb137c893..b72b6cded7 100644 --- a/include/rnc/save/memory_card_state.h +++ b/include/rnc/save/memory_card_state.h @@ -196,4 +196,13 @@ struct MemoryCardState { extern struct MemoryCardState memory_card_state __asm__("D_0013D290"); +/* The save directory and file paths; memcard_get_name writes the disc's + region and product code over the '*'s of each. */ +extern char save_directory_path[] __asm__("D_0013D1D0"); +extern char save_directory_pattern[] __asm__("D_0013D1E8"); +extern char save_icon_sys_path[] __asm__("D_0013D200"); +extern char save_icon_path[] __asm__("D_0013D220"); +extern char save_main_file_path[] __asm__("D_0013D240"); +extern char save_slot_path_format[] __asm__("D_0013D270"); + #endif /* LOMBYTE_RNC_SAVE_MEMORY_CARD_STATE_H */ diff --git a/include/rnc/world/collision/surface_height_grid.h b/include/rnc/world/collision/surface_height_grid.h index 2d7f93a6de..8272bd1e76 100644 --- a/include/rnc/world/collision/surface_height_grid.h +++ b/include/rnc/world/collision/surface_height_grid.h @@ -11,6 +11,15 @@ typedef struct { f32 cell_height; } SurfaceHeightGrid; +/* One occlusion zone's box, in 1/1024 units and 0x800 deep. */ +typedef struct { + int x; + int y; + int z; + unsigned short w; + unsigned short h; +} ZoneBox; + typedef struct { f32 samples[16][16]; f32 pad_400[0x20]; @@ -34,5 +43,9 @@ typedef struct { } SurfaceHeightTile; extern SurfaceHeightGrid surface_height_grid __asm__("D_001E66E0"); +/* The level's zones: occl_cell_count boxes and one height tile each. */ +extern SurfaceHeightTile *surface_height_tiles __asm__("D_00161190"); +extern ZoneBox *occl_cell_table __asm__("D_00161194"); +extern s32 occl_cell_count __asm__("D_00161198"); #endif /* LOMBYTE_RNC_WORLD_COLLISION_SURFACE_HEIGHT_GRID_H */ diff --git a/src/audio/snd_start_sound_system.c b/src/audio/snd_start_sound_system.c index 1aa1f8390e..c309473756 100644 --- a/src/audio/snd_start_sound_system.c +++ b/src/audio/snd_start_sound_system.c @@ -15,11 +15,12 @@ struct SifClientDataStartSound { extern struct SifClientDataStartSound sound_command_client __asm__("D_0015EBC0"); extern struct SifClientDataStartSound sound_stream_client __asm__("D_0015EBE8"); -extern s32 D_0015ECAC MACRO_ADDR; /* snd_batch_free_bytes[1], stored through the macro form */ -extern s32 snd_cd_callback_pending __asm__("D_0015ECC8") __attribute__((sda)); -extern s32 snd_cd_callback_fn __asm__("D_0015ECD0") __attribute__((sda)); -extern s64 snd_cd_callback_data __asm__("D_0015ECD8") MACRO_ADDR; -extern u32 snd_cd_callback_arg __asm__("D_0015ED00") MACRO_ADDR; +extern s32 + snd_batch1_free_bytes_macro __asm__("D_0015ECAC") MACRO_ADDR; /* snd_batch_free_bytes[1] */ +extern s32 snd_cd_callback_pending __asm__("D_0015ECC8") __attribute__((sda)); +extern s32 snd_cd_callback_fn __asm__("D_0015ECD0") __attribute__((sda)); +extern s64 snd_cd_callback_data __asm__("D_0015ECD8") MACRO_ADDR; +extern u32 snd_cd_callback_arg __asm__("D_0015ED00") MACRO_ADDR; extern s32 snd_send_iop_command_and_wait(s32, s32, void *) __asm__("func_0012E548"); @@ -93,7 +94,7 @@ s32 snd_start_sound_system(void) { snd_command_buffer2[0] = 0; sound_read_work.read_error = 0; snd_batch_free_bytes[0] = 0xFFC; - D_0015ECAC = 0xFFC; + snd_batch1_free_bytes_macro = 0xFFC; command_arg = (s32)(u32)&sound_read_work.read_active; return snd_send_iop_command_and_wait(0, 4, &command_arg); } diff --git a/src/audio/voices/pause_all_sounds.c b/src/audio/voices/pause_all_sounds.c index 8a751a1911..3416a71e46 100644 --- a/src/audio/voices/pause_all_sounds.c +++ b/src/audio/voices/pause_all_sounds.c @@ -570,6 +570,8 @@ struct MenuPage map_circle_destination_page = { SCREEN(map_legend_screen)} }; +/* BY_SELECTED_LEVEL steps 0xC bytes per (selected level - 1), so the text base + is entry 1 and the label shows level_select_texts[level]. */ struct MenuLabelScreen map_location_label = { { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | @@ -619,6 +621,8 @@ struct MenuStreamScreen missions_picture_screen = { { D_00138080, MENU_STREAM_UNPACK | MENU_STREAM_FIXED_ENTRY, 219, 175} }; +/* BY_SELECTED_LEVEL steps 0xC bytes per (selected level - 1), so the text base + is entry 1 and the label shows level_select_texts[level]. */ struct MenuLabelScreen missions_location_label = { { FUN_00219d80, render_configured_text_label,clear_menu_selected_index}, {MENU_LABEL_BY_SELECTED_LEVEL | MENU_LABEL_LARGE_FONT | MENU_LABEL_CENTER_Y | diff --git a/src/camera/resolve_camera_surface_height.c b/src/camera/resolve_camera_surface_height.c index 50dedd334d..cdc35d860f 100644 --- a/src/camera/resolve_camera_surface_height.c +++ b/src/camera/resolve_camera_surface_height.c @@ -2,6 +2,7 @@ #include "rnc/data_labels.h" #include "rnc/game/game_globals.h" #include "rnc/rendering/render_globals.h" +#include "rnc/world/collision/surface_height_grid.h" #include "rnc/math/fast_math.h" struct CameraProbePosition { diff --git a/src/camera/sample_surface_height_map.c b/src/camera/sample_surface_height_map.c index 1a482c11ae..5a56b9693f 100644 --- a/src/camera/sample_surface_height_map.c +++ b/src/camera/sample_surface_height_map.c @@ -2,7 +2,6 @@ #include "rnc/world/collision/surface_height_grid.h" #include "rnc/math/asm_helpers.h" -extern SurfaceHeightTile *surface_height_tiles __asm__("D_00161190"); /* Small data, defined above the code so it is reached $gp-relative. */ s32 surface_height_layer __asm__("D_001610E0") = 2; diff --git a/src/game/missions/get_map_point_mission_status.c b/src/game/missions/get_map_point_mission_status.c index f6bdf3008e..e2ca6f5989 100644 --- a/src/game/missions/get_map_point_mission_status.c +++ b/src/game/missions/get_map_point_mission_status.c @@ -1,7 +1,6 @@ /* Ported from rac1-decomp (src/game/missionfunc.c, func_0020CCD0). */ #include "sda.h" #include "rnc/game/level_object_states.h" - #include "rnc/game/item_state.h" /* Two flat `&&` returns over level_object_states[20/24/22].state; retail's reuse of diff --git a/src/game/process_global_state_flags.c b/src/game/process_global_state_flags.c index 863877ba47..11ccca8324 100644 --- a/src/game/process_global_state_flags.c +++ b/src/game/process_global_state_flags.c @@ -35,6 +35,8 @@ s32 process_global_state_flags(void) { *(u16 *)D_0013E05A = 1; } } else if ((controller_state.pressed & PAD_CROSS) != 0) { + /* Load the save but keep item_unlocked[0x1D] and the four Veldin 2 + gold bolts of the game in progress. */ old_value = item_unlocked[0x1D]; for (i = 0; i < 4; i++) { backup[i] = (&gold_bolts_collected[LEVEL_VELDIN2 * 4])[i]; diff --git a/src/game/update_resident_gameplay_state.c b/src/game/update_resident_gameplay_state.c index 776fe7583a..0da07965b0 100644 --- a/src/game/update_resident_gameplay_state.c +++ b/src/game/update_resident_gameplay_state.c @@ -332,7 +332,7 @@ void update_resident_gameplay_state(void) { refresh_moby_spatial_bounds(playback_object); if (playback_object->class_id == 0) { if (level_render_state.state == LEVEL_RENDER_STATE_PLAYBACK_TO_MENU) { - if (current_level_index == LEVEL_ORXON && item_available[6] == 0) { + if (current_level_index == LEVEL_ORXON && item_available[ITEM_O2_MASK] == 0) { playback_object->unk7F = 0; } else if (render_sequence.time <= scale_game_frames(0x3E)) { playback_object->unk7F = 0x18; @@ -340,7 +340,7 @@ void update_resident_gameplay_state(void) { playback_object->unk7F = 0; } } else if (scale_game_frames(360) < render_sequence.time) { - if (current_level_index == LEVEL_ORXON && item_available[6] == 0) { + if (current_level_index == LEVEL_ORXON && item_available[ITEM_O2_MASK] == 0) { playback_object->unk7F = 0; } else { playback_object->unk7F = 0x18; @@ -369,7 +369,7 @@ void update_resident_gameplay_state(void) { } if (playback_object->class_id == 0) { noop_callback_e(playback_object); - if ((current_level_index == LEVEL_ORXON && item_available[6] != 0) || + if ((current_level_index == LEVEL_ORXON && item_available[ITEM_O2_MASK] != 0) || current_level_index == LEVEL_OLTANIS_ORBIT) { if (level_render_state.attachment == 0) { level_render_state.attachment = create_moby(0x509); diff --git a/src/overlays/l11/mobys/pokitaru_pickup.c b/src/overlays/l11/mobys/pokitaru_pickup.c index 49c9d96bc5..e2112aeb9f 100644 --- a/src/overlays/l11/mobys/pokitaru_pickup.c +++ b/src/overlays/l11/mobys/pokitaru_pickup.c @@ -15,8 +15,6 @@ /* Per-frame update of a pickup moby: waits for the player to come near, then grants the item. */ /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_002CC828.c: func_L11_002CC828), where it is exact; names translated to the US level program. */ -extern unsigned char D_0013D4E3[]; - void pokitaru_pickup_update(struct Moby *moby) __asm__("FUN_L11_002cb668"); /* Moby class 23 */ @@ -28,7 +26,7 @@ void pokitaru_pickup_update(struct Moby *moby) { }; switch (moby->state) { case PICKUP_INITIALIZE: - if (item_available[6] != 0) { + if (item_available[ITEM_O2_MASK] != 0) { mark_moby_for_removal(moby); } else { moby->pos.z += 0.75f; @@ -41,8 +39,8 @@ void pokitaru_pickup_update(struct Moby *moby) { case PICKUP_CHECK_PROXIMITY: fast_add_rotations(moby->rot.z, frame_time * 4.7123890f); if (vector_distance_xy(&moby->pos, D_0013E533 + 0xE9D) < 2.0f) { - item_available[6] = 1; - D_0013D4E3[0xB] = 1; + item_available[ITEM_O2_MASK] = 1; + items_acquired[ITEM_O2_MASK] = 1; memcard_save_data(0, -1); help_request(0x2AF8, 0x3A); mark_moby_for_removal(moby); diff --git a/src/overlays/shared/cutscenes/update_cutscene_playback.c b/src/overlays/shared/cutscenes/update_cutscene_playback.c index 4510836653..c6eb55456d 100644 --- a/src/overlays/shared/cutscenes/update_cutscene_playback.c +++ b/src/overlays/shared/cutscenes/update_cutscene_playback.c @@ -9,6 +9,7 @@ #include "rnc/mobys/moby.h" #include "rnc/audio/music/music_stream_state.h" #include "rnc/globals.h" +#include "rnc/save/memory_card_state.h" #include "asm.h" #include "rnc/streaming/disc_table.h" #include "rnc/math/vector.h" @@ -1133,7 +1134,6 @@ void end_slideshow(void) { } extern s16 cd_read_active[] __asm__("D_001516D8"); -extern char D_0013D1D0[]; extern s32 slideshow_frame_thresholds[] __asm__("D_L00_00173BF0"); extern void FUN_0022ca50(void); @@ -1156,7 +1156,7 @@ void update_slideshow(void) { fade_level_gp = 0.0f; } skip_check = 1; - if ((u8)D_0013D1D0[2] != 'A') { + if ((u8)save_directory_path[2] != 'A') { skip_check = 0; } if (slideshow.state == SLIDESHOW_STATE_WAIT_FOR_TRANSITION) { diff --git a/src/overlays/shared/hero/try_transition_hero_water_state.c b/src/overlays/shared/hero/try_transition_hero_water_state.c index e58484c247..e3cd5edbe9 100644 --- a/src/overlays/shared/hero/try_transition_hero_water_state.c +++ b/src/overlays/shared/hero/try_transition_hero_water_state.c @@ -30,7 +30,7 @@ int try_transition_hero_water_state(void) { int state; if (hero.state.control_mode == HERO_MODE_SWIM) { - if (item_available[6] != 0) { + if (item_available[ITEM_O2_MASK] != 0) { decrement = 0; } else { decrement = 10000 / (scale_game_frames(0x3C) * 15); diff --git a/src/overlays/shared/pickups/buried_bolts.c b/src/overlays/shared/pickups/buried_bolts.c index 3cb4b89406..9736b83a39 100644 --- a/src/overlays/shared/pickups/buried_bolts.c +++ b/src/overlays/shared/pickups/buried_bolts.c @@ -52,7 +52,7 @@ void buried_bolts_update(struct Moby *moby) { moby->flags |= 0x41; moby->state = AREA_MOBY_STATE_INITIALIZED; if (moby->command == 0 && D_0015ED84 < 20) { - k = D_0014BF10[D_L01_00161AF0 / 2 + D_0015ED84 * 16]; + k = buried_bolt_states[D_L01_00161AF0 / 2 + D_0015ED84 * 16]; if (D_L01_00161AF0 & 1) { k &= 0xF; } else { diff --git a/src/overlays/shared/vendor/vendor_menu.c b/src/overlays/shared/vendor/vendor_menu.c index 7801b65535..e4a5f949f9 100644 --- a/src/overlays/shared/vendor/vendor_menu.c +++ b/src/overlays/shared/vendor/vendor_menu.c @@ -896,7 +896,6 @@ extern void FUN_002049f0(s32); * drives advance_moby_animation/FUN_L00_00250df8 on g->f20+0x400 and updates the * progress tables D_L00_001C40B0 / weapon_ammo_counts / ammo_bought_stats / D_0015ED98. */ -extern u8 D_0013D4E3[]; extern s32 D_0015ED98; extern u8 vendor_item_0x18_purchased[] __asm__("D_00141345"); extern s32 vendor_purchase_confirmed_gp __asm__("D_L00_00161E0C") __attribute__((sda)); @@ -947,7 +946,7 @@ void update_vendor_purchase(void) { vendor_ammo_quantity_adjustment_enabled_gp = 1; } } else { - s32 nn = D_0013D4E3[0] ? CUR_TB.f4 : CUR_TB.f0; + s32 nn = item_available[ITEM_VENDOR_DISCOUNT] ? CUR_TB.f4 : CUR_TB.f0; if (D_0015ED98 < nn) { allocate_voice_for_target_entry(2, 0, vendor_menu.vendor_moby); } @@ -1050,7 +1049,7 @@ void update_vendor_purchase(void) { if (CUR_ITEM.is_ammo == vendor_purchase_confirmed_gp) { need = vendor_menu.mode ? CUR_TB.hA * D_L00_00161E34 : CUR_TB.h8 * D_L00_00161E34; - } else if (D_0013D4E3[0]) { + } else if (item_available[ITEM_VENDOR_DISCOUNT]) { need = CUR_TB.f4; } else { need = CUR_TB.f0; @@ -1088,7 +1087,7 @@ void update_vendor_purchase(void) { allocate_voice_for_target_entry(0, 0, vendor_menu.vendor_moby); } } else { - purchase_cost = D_0013D4E3[0] ? CUR_TB.f4 : CUR_TB.f0; + purchase_cost = item_available[ITEM_VENDOR_DISCOUNT] ? CUR_TB.f4 : CUR_TB.f0; if (D_0015ED98 >= purchase_cost) { handle_vendor_auxiliary_moby_event(2); grant_inventory_item(CUR_ITEM.item, 1); diff --git a/src/overlays/shared/weapons/metal_detector.c b/src/overlays/shared/weapons/metal_detector.c index f8a3da2039..2345281a48 100644 --- a/src/overlays/shared/weapons/metal_detector.c +++ b/src/overlays/shared/weapons/metal_detector.c @@ -3,6 +3,7 @@ #include "rnc/mobys/moby.h" #include "rnc/hero/hero.h" #include "rnc/globals.h" +#include "rnc/game/level_progress.h" #include "qcopy.h" #include "rnc/math/fast_math.h" #include "sda.h" @@ -96,8 +97,6 @@ extern int get_effect_texture(int) __asm__("FUN_001f44b8"); extern void func_L00_001FF4B0_2D3F40(void *, void *, float) __asm__("FUN_001f9bf8"); extern void func_L00_001FD1D8_2D3F40(void *, void *, int) __asm__("FUN_001f7d30"); -extern unsigned char D_0014BF10[]; - extern u8 voice_pool_lui[] __asm__("D_0013E550") NOT_SDA; extern u128 D_L00_001E1160 NOT_SDA; extern u8 D_L00_001E1170[] NOT_SDA; @@ -195,14 +194,14 @@ void increment_metal_detector_collection_counter(unsigned char *moby) { if (row < 20) { int index = MOBY(moby)->command - 1; if (index & 1) { - unsigned char *p = D_0014BF10 + (index / 2 + row * 16); + unsigned char *p = buried_bolt_states + (index / 2 + row * 16); unsigned int value = *p; int n = (value & 15) + 1; if (n >= 16) n = 15; *p = (value & 240) | n; } else { - unsigned char *p = D_0014BF10 + (index / 2 + row * 16); + unsigned char *p = buried_bolt_states + (index / 2 + row * 16); unsigned int value = *p; int n = (value >> 4) + 1; if (n >= 16) diff --git a/src/rendering/frame/reset_draw_globals.c b/src/rendering/frame/reset_draw_globals.c index 0c81d7c502..7bf17777aa 100644 --- a/src/rendering/frame/reset_draw_globals.c +++ b/src/rendering/frame/reset_draw_globals.c @@ -1,6 +1,7 @@ #include "types.h" #include "rnc/data_labels.h" #include "rnc/rendering/render_globals.h" +#include "rnc/world/collision/surface_height_grid.h" extern s32 D_0015F330; extern s32 D_0015F334; diff --git a/src/rendering/vu1/select_level_vu_chain.c b/src/rendering/vu1/select_level_vu_chain.c index 4b72cd483d..9649c53802 100644 --- a/src/rendering/vu1/select_level_vu_chain.c +++ b/src/rendering/vu1/select_level_vu_chain.c @@ -2,8 +2,9 @@ #include "rnc/globals.h" #include "rnc/data_labels.h" #include "rnc/rendering/render_globals.h" +#include "rnc/world/level_id.h" -extern s32 vu_chain_table[0x13] __asm__("D_001DDFB8"); +extern s32 vu_chain_table[LEVEL_COUNT] __asm__("D_001DDFB8"); void select_level_vu_chain(void) __asm__("CalculateDmaTransferAddress"); @@ -11,14 +12,14 @@ void select_level_vu_chain(void) { s32 i; i = current_level_index; - if (i >= 0x13) { + if (i >= LEVEL_COUNT) { i = 0; } current_vu_chain = vu_chain_table[i]; } -/* Render buffer size in bytes per level (current_vu_chain), levels 0..0x12. */ -s32 vu_chain_table[0x13] = { +/* Render buffer size in bytes per level (current_vu_chain). */ +s32 vu_chain_table[LEVEL_COUNT] = { 0x1C0000, 0x160000, 0x1A0000, 0x170000, 0x1A0000, 0x160000, 0x160000, 0x1A0000, 0x1A0000, 0x1A0000, 0x1A0000, 0x170000, 0x170000, 0x170000, 0x180000, 0x170000, 0x170000, 0x1A0000, 0x170000, diff --git a/src/save/check_memory_card.c b/src/save/check_memory_card.c index ab5004e5d8..43df863555 100644 --- a/src/save/check_memory_card.c +++ b/src/save/check_memory_card.c @@ -11,8 +11,7 @@ struct McDirBlk { #include "rnc/save/memory_card_state.h" -extern char D_0013D1D0[]; -extern u8 memory_card_info_sync_outputs[] __asm__("D_0013D348"); +extern u8 memory_card_info_sync_outputs[] __asm__("D_0013D348"); s32 check_memory_card(void) __asm__("FUN_00209168"); @@ -50,8 +49,8 @@ s32 check_memory_card(void) { if (format == 0) { return 0; } - card_command_result = - sceMcGetDir(memory_card_state.card[0].port, card_state->unk4, D_0013D1D0, 0, -1, 0); + card_command_result = sceMcGetDir( + memory_card_state.card[0].port, card_state->unk4, save_directory_path, 0, -1, 0); while (sceMcSync(1, &cmd_code, &card_command_result) == 0) { sceGsSyncV(0); } diff --git a/src/save/memcard_get_name.c b/src/save/memcard_get_name.c index 56388fe354..48fbf6f621 100644 --- a/src/save/memcard_get_name.c +++ b/src/save/memcard_get_name.c @@ -12,38 +12,44 @@ void memcard_get_name(u8 *rom_configuration) { s32 i; if (rom_configuration[0x12] == 'E') { - D_0013D1D0[2] = rom_configuration[0x12]; + save_directory_path[2] = rom_configuration[0x12]; } for (i = 3; i < 7; i++) { - D_0013D1D0[i] = rom_configuration[i + 0xD]; + save_directory_path[i] = rom_configuration[i + 0xD]; } for (i = 8; i < 11; i++) { - D_0013D1D0[i] = rom_configuration[i + 0xD]; + save_directory_path[i] = rom_configuration[i + 0xD]; } for (i = 11; i < 13; i++) { - D_0013D1D0[i] = rom_configuration[i + 0xE]; + save_directory_path[i] = rom_configuration[i + 0xE]; } - strncpy(D_0013D1E8, D_0013D1D0, 13); - strncpy(D_0013D200, D_0013D1D0, 13); - strncpy(D_0013D220, D_0013D1D0, 13); - strncpy(D_0013D240, D_0013D1D0, 13); - strncpy(D_0013D240 + 0x14, D_0013D1D0, 13); - strncpy(D_0013D270, D_0013D1D0, 13); + strncpy(save_directory_pattern, save_directory_path, 13); + strncpy(save_icon_sys_path, save_directory_path, 13); + strncpy(save_icon_path, save_directory_path, 13); + strncpy(save_main_file_path, save_directory_path, 13); + strncpy(save_main_file_path + 0x14, save_directory_path, 13); + strncpy(save_slot_path_format, save_directory_path, 13); } extern __typeof__(memcard_get_name) func_00209030 __attribute__((alias("FUN_00209030"))); -/* The save directory and file paths; memcard_get_name writes the disc's - region and product code over the '*'s of each. */ -char D_0013D1D0[] = "/BA****-*****RATCHET"; -char D_0013D1E8[] = "/************RATCHET/*"; -char D_0013D200[] = "/************RATCHET/icon.sys"; -char D_0013D220[] = "/************RATCHET/static.ico"; -char D_0013D240[] = "/************RATCHET/************RATCHET"; -char D_0013D270[] = "/************RATCHET/save%d.bin"; +char save_directory_path[] __asm__("D_0013D1D0") = "/BA****-*****RATCHET"; +char save_directory_pattern[] __asm__("D_0013D1E8") = "/************RATCHET/*"; +char save_icon_sys_path[] __asm__("D_0013D200") = "/************RATCHET/icon.sys"; +char save_icon_path[] __asm__("D_0013D220") = "/************RATCHET/static.ico"; +char save_main_file_path[] __asm__("D_0013D240") = "/************RATCHET/************RATCHET"; +char save_slot_path_format[] __asm__("D_0013D270") = "/************RATCHET/save%d.bin"; struct MemoryCardState memory_card_state = { - {{0, 0, 0, 0, 0, -3, 0, 0, {0}, 0, 0, 0}}, 0, 0, -1, 0, 0, 1, -1, 0, 0, -1, -1, 0, -1, 0, 0, 1}; + .card = {{.save_index = -3}}, + .active_card = -1, + .busy = 1, + .fd = -1, + .pending_state = -1, + .pending_card = -1, + .err_card = -1, + .unkF4 = 1, +}; u8 alternate_item_available[128] = {0}; @@ -61,9 +67,9 @@ s32 max_coverage_save_result_by_level[LEVEL_RECORD_COUNT] = {0}; struct LevelObjectState level_object_states[LEVEL_OBJECT_STATE_COUNT] = {0}; -u8 level_available[20] = {0}; +u8 level_available[LEVEL_RECORD_COUNT] = {0}; -u8 level_visit_state[20] = {0}; +u8 level_visit_state[LEVEL_RECORD_COUNT] = {0}; s32 ammo_bought_stats[37] __asm__("D_0013DD70") = {0}; diff --git a/src/save/memcard_update_state.c b/src/save/memcard_update_state.c index 39845bfbbd..af173fe29e 100644 --- a/src/save/memcard_update_state.c +++ b/src/save/memcard_update_state.c @@ -6,6 +6,13 @@ #include "rnc/sdk/debug.h" #include "rnc/sdk/libc/stdio.h" #include "rnc/sdk/storage/memory_card.h" +#include "rnc/save/memory_card_state.h" +#include "rnc/game/game_globals.h" +#include "rnc/ui/menus/menu_globals.h" +#include "rnc/save/mc_data.h" +#include "rnc/game/item_state.h" +#include "rnc/game/bolt_sources.h" +#include "rnc/game/level_progress.h" typedef struct { s32 x0; @@ -15,20 +22,6 @@ typedef struct { s32 x10; } McChunk; -#include "rnc/save/memory_card_state.h" -#include "rnc/game/game_globals.h" -#include "rnc/ui/menus/menu_globals.h" -#include "rnc/save/mc_data.h" -#include "rnc/game/item_state.h" -#include "rnc/game/bolt_sources.h" -#include "rnc/game/level_progress.h" - -extern char D_0013D1D0[]; -extern char D_0013D1E8[]; -extern char D_0013D200[]; -extern char D_0013D220[]; -extern char D_0013D240[]; -extern char D_0013D270[]; extern const char memcard_delete_entry_path_format[] __asm__("D_0015FE98"); extern const char memcard_deleting_entry_message[] __asm__("D_0015FEA0"); extern u8 D_001A0880[]; @@ -144,7 +137,7 @@ void memcard_update_state(void) { break; case MEMCARD_REQUEST_CHDIR: - if (sceMcChdir(CARD.port, CARD.slot, D_0013D1D0, 0) == 0) { + if (sceMcChdir(CARD.port, CARD.slot, save_directory_path, 0) == 0) { MC.sub = 0; MC.state = MEMCARD_PROBE_SAVE_HEADER; } @@ -175,7 +168,7 @@ void memcard_update_state(void) { } break; case MEMCARD_PROBE_REQUEST_OPEN: - sprintf(name, D_0013D270, 0); + sprintf(name, save_slot_path_format, 0); if (sceMcOpen(CARD.port, CARD.slot, name, 1) == 0) { MC.sub++; } @@ -277,7 +270,7 @@ void memcard_update_state(void) { MC.busy = 0; break; case MEMCARD_CREATE_REQUEST_MKDIR: - if (sceMcMkdir(CARD.port, CARD.slot, D_0013D1D0) == 0) { + if (sceMcMkdir(CARD.port, CARD.slot, save_directory_path) == 0) { MC.sub = 2; } break; @@ -321,16 +314,16 @@ void memcard_update_state(void) { case MEMCARD_CREATE_REQUEST_AUXILIARY_FILE_OPEN: switch (MC.sub) { case MEMCARD_CREATE_REQUEST_ICON_SYS_OPEN: - strcpy(name, D_0013D200); + strcpy(name, save_icon_sys_path); break; case MEMCARD_CREATE_REQUEST_STATIC_ICON_OPEN: - strcpy(name, D_0013D220); + strcpy(name, save_icon_path); break; case MEMCARD_CREATE_REQUEST_AUXILIARY_FILE_OPEN: - strcpy(name, D_0013D240); + strcpy(name, save_main_file_path); break; case MEMCARD_CREATE_REQUEST_SAVE_OPEN: - sprintf(name, D_0013D270, CARD.save_index); + sprintf(name, save_slot_path_format, CARD.save_index); break; } if (sceMcOpen(CARD.port, CARD.slot, name, 0x203) == 0) { @@ -456,13 +449,13 @@ void memcard_update_state(void) { case MEMCARD_DELETE_SAVE_DIRECTORY: switch (MC.sub) { case MEMCARD_DELETE_REQUEST_FIRST_DIRECTORY_ENTRY: - if (sceMcGetDir(CARD.port, CARD.slot, D_0013D1E8, 0, 1, D_001A0880) == 0) { + if (sceMcGetDir(CARD.port, CARD.slot, save_directory_pattern, 0, 1, D_001A0880) == 0) { MC.sub = 1; } break; case MEMCARD_DELETE_PROCESS_ENTRY_AND_REQUEST_DELETE: if (MC.result == 1) { - sprintf(name, memcard_delete_entry_path_format, D_0013D1D0, D_001A08A0); + sprintf(name, memcard_delete_entry_path_format, save_directory_path, D_001A08A0); DebugPrint(memcard_deleting_entry_message, name); if (sceMcDelete(CARD.port, CARD.slot, name) == 0) { MC.sub = 2; @@ -488,13 +481,13 @@ void memcard_update_state(void) { } break; case MEMCARD_DELETE_REQUEST_NEXT_DIRECTORY_ENTRY: - if (sceMcGetDir(CARD.port, CARD.slot, D_0013D1E8, 1, 1, D_001A0880) == 0) { + if (sceMcGetDir(CARD.port, CARD.slot, save_directory_pattern, 1, 1, D_001A0880) == 0) { MC.sub = 1; } break; case MEMCARD_DELETE_REQUEST_DIRECTORY_DELETE: - if (sceMcDelete(CARD.port, CARD.slot, D_0013D1D0) == 0) { - DebugPrint(memcard_deleting_directory_message, D_0013D1D0); + if (sceMcDelete(CARD.port, CARD.slot, save_directory_path) == 0) { + DebugPrint(memcard_deleting_directory_message, save_directory_path); MC.sub = 4; } break; @@ -553,9 +546,9 @@ void memcard_update_state(void) { switch (MC.sub) { case MEMCARD_READ_SAVE_REQUEST_OPEN: if (MC.state == MEMCARD_READ_SCANNED_SAVE_INFO) { - sprintf(name, D_0013D270, CARD.scan_save_index); + sprintf(name, save_slot_path_format, CARD.scan_save_index); } else { - sprintf(name, D_0013D270, CARD.save_index); + sprintf(name, save_slot_path_format, CARD.save_index); } if (sceMcOpen(CARD.port, CARD.slot, name, 1) == 0) { MC.sub++; @@ -748,7 +741,7 @@ void memcard_update_state(void) { case MEMCARD_UPDATE_SAVE: switch (MC.sub) { case MEMCARD_UPDATE_SAVE_REQUEST_OPEN: - sprintf(name, D_0013D270, CARD.save_index); + sprintf(name, save_slot_path_format, CARD.save_index); if (sceMcOpen(CARD.port, CARD.slot, name, 2) == 0) { MC.sub = 1; } @@ -935,7 +928,7 @@ void memcard_update_state(void) { case MEMCARD_WRITE_FULL_SAVE: switch (MC.sub) { case MEMCARD_WRITE_FULL_SAVE_REQUEST_OPEN: - sprintf(name, D_0013D270, CARD.save_index); + sprintf(name, save_slot_path_format, CARD.save_index); if (sceMcOpen(CARD.port, CARD.slot, name, 2) == 0) { MC.sub = 1; } @@ -1011,7 +1004,7 @@ u8 map_coverage_pages[LEVEL_RECORD_COUNT * MAP_COVERAGE_PAGE_SIZE] = {0}; u8 gold_bolts_collected[LEVEL_RECORD_COUNT * 4] = {0}; -u8 D_0014BF10[LEVEL_RECORD_COUNT * 16] = {0}; +u8 buried_bolt_states[LEVEL_RECORD_COUNT * 16] __asm__("D_0014BF10") = {0}; unsigned char visited52[LEVEL_RECORD_COUNT * 16] = {0}; diff --git a/src/sdk/libc/mprec/_dtoa_r.c b/src/sdk/libc/mprec/_dtoa_r.c index a876f156b6..844cfc4170 100644 --- a/src/sdk/libc/mprec/_dtoa_r.c +++ b/src/sdk/libc/mprec/_dtoa_r.c @@ -87,9 +87,10 @@ extern const f64 tens[23], bigtens[5]; extern const f64 dtoa_quick_overflow_divisor[] __asm__("D_001524B0"); /* The strings _dtoa_r returns for infinity, NaN and zero, in .rodata like the literals they were (at 8 bytes or less they would go to .sdata). */ -const char D_00152310[] __attribute__((section(".rodata"))) = "Infinity"; -const char D_00152320[] __attribute__((section(".rodata"))) = "NaN"; -const char D_00152328[] __attribute__((section(".rodata"))) = "0"; +const char dtoa_infinity_text[] __asm__("D_00152310") + __attribute__((section(".rodata"))) = "Infinity"; +const char dtoa_nan_text[] __asm__("D_00152320") __attribute__((section(".rodata"))) = "NaN"; +const char dtoa_zero_text[] __asm__("D_00152328") __attribute__((section(".rodata"))) = "0"; extern _Bigint *Balloc(struct _reent *, s32); extern _Bigint *d2b(struct _reent *, f64, s32 *, s32 *); extern _Bigint *i2b(struct _reent *, s32) __asm__("func_00115808"); @@ -211,9 +212,9 @@ _dtoa_r(struct _reent *ptr, f64 _d, s32 mode, s32 ndigits, s32 *decpt, s32 *sign *decpt = 9999; s = #ifdef IEEE_Arith - !word1(d) && !(word0(d) & 0xfffff) ? D_00152310 : + !word1(d) && !(word0(d) & 0xfffff) ? dtoa_infinity_text : #endif - D_00152320; + dtoa_nan_text; if (rve) *rve = #ifdef IEEE_Arith @@ -228,7 +229,7 @@ _dtoa_r(struct _reent *ptr, f64 _d, s32 mode, s32 ndigits, s32 *decpt, s32 *sign #endif if (!d.d) { *decpt = 1; - s = D_00152328; + s = dtoa_zero_text; if (rve) *rve = s + 1; return s; diff --git a/src/ui/hud/init_hud.c b/src/ui/hud/init_hud.c index f2b67b486b..0cd3e62268 100644 --- a/src/ui/hud/init_hud.c +++ b/src/ui/hud/init_hud.c @@ -20,7 +20,7 @@ struct HudSlot { #include "rnc/ui/hud/hud_state.h" -extern u8 hud_file_str[] __asm__("D_0015F6D8"); +extern char hud_file_str[] __asm__("D_0015F6D8"); extern struct Globals_0015FA00 *hud_bank_main __asm__("D_0015FA00"); #include "rnc/ui/hud/init_hud_globals.h" @@ -70,4 +70,4 @@ void init_hud(void) { } /* Small data reached with lui/addiu: the allocation tag. */ -u8 hud_file_str[] __asm__("D_0015F6D8") __attribute__((section(".sdata"))) = "hud.cpp"; +char hud_file_str[] __asm__("D_0015F6D8") __attribute__((section(".sdata"))) = "hud.cpp"; diff --git a/src/ui/loading/append_scrolling_textured_quad.c b/src/ui/loading/append_scrolling_textured_quad.c index d522eb5156..477dcc67d5 100644 --- a/src/ui/loading/append_scrolling_textured_quad.c +++ b/src/ui/loading/append_scrolling_textured_quad.c @@ -84,6 +84,6 @@ extern __typeof__(append_scrolling_textured_quad) func_002316E8 __attribute__((alias("FUN_002316e8"))); /* GIF tag of the quad packet (NLOOP 1, EOP, REGLIST, NREG 11) and its - * register list. Small data reached with lui/addiu. */ + register list. Small data reached with lui/addiu. */ u64 loading_quad_packet_header_template[2] __asm__("D_00160850") __attribute__((section(".sdata"))) -__attribute__((aligned(16))) = {0xB400000000008001, 0x0000052525252106}; +__attribute__((aligned(16))) = {0xB400000000008001ULL, 0x0000052525252106ULL}; diff --git a/src/ui/map/draw_map_overlay.c b/src/ui/map/draw_map_overlay.c index 7bda95d6e9..ef4281f79e 100644 --- a/src/ui/map/draw_map_overlay.c +++ b/src/ui/map/draw_map_overlay.c @@ -21,17 +21,17 @@ typedef struct { #define SPR ((MapIconBounds *)0x70000000) -extern u8 D_0013D5BC[]; -extern u16 occl_cam_param1[] __asm__("D_001518D2"); -extern u8 D_0015EDB4; -extern s32 D_0015FD60 __attribute__((sda)); -extern f32 D_0015FD80 __attribute__((sda)); -extern f32 D_0015FD84 __attribute__((sda)); -extern f32 D_0015FD88 __attribute__((sda)); -extern f32 D_0015FD8C __attribute__((sda)); -extern f32 D_0015FD90 __attribute__((sda)); -extern f32 D_0015FD94 __attribute__((sda)); -extern u8 no_map_available_text[] __asm__("D_001E8068"); +extern u8 D_0013D5BC[]; +extern u16 occl_cam_param1[] __asm__("D_001518D2"); +extern u8 D_0015EDB4; +extern s32 D_0015FD60 __attribute__((sda)); +extern f32 D_0015FD80 __attribute__((sda)); +extern f32 D_0015FD84 __attribute__((sda)); +extern f32 D_0015FD88 __attribute__((sda)); +extern f32 D_0015FD8C __attribute__((sda)); +extern f32 D_0015FD90 __attribute__((sda)); +extern f32 D_0015FD94 __attribute__((sda)); +extern char no_map_available_text[] __asm__("D_001E8068"); extern void print_debug_text_centered(s32, s32, s32, u8 *) __asm__("func_001F0C50"); extern void setup_gif_paging(s32) __asm__("func_001F4280"); @@ -88,10 +88,10 @@ void draw_map_overlay(void) { s32 tile_limit; if (level_map_selection.unk24 == 0) { - u8 *font = no_map_available_text; + char *text = no_map_available_text; setup_gif_paging(0); - print_debug_text_centered(0x100, (s16)occl_cam_param1[0] >> 1, 0x80909090, font); + print_debug_text_centered(0x100, (s16)occl_cam_param1[0] >> 1, 0x80909090, text); do_gif_paging(); return; } @@ -517,4 +517,4 @@ void draw_map_overlay(void) { extern __typeof__(draw_map_overlay) func_00205640 __attribute__((alias("FUN_00205640"))); -u8 no_map_available_text[] __asm__("D_001E8068") = "No Map Available"; +char no_map_available_text[] __asm__("D_001E8068") = "No Map Available"; diff --git a/src/ui/map/draw_map_screen.c b/src/ui/map/draw_map_screen.c index 6bae987f1b..e5ee7c9910 100644 --- a/src/ui/map/draw_map_screen.c +++ b/src/ui/map/draw_map_screen.c @@ -5,6 +5,11 @@ #include "rnc/audio/music/music_stream_state.h" #include "rnc/globals.h" #include "rnc/world/data/find_id_in_terminated_table.h" +#include "rnc/ui/menus/menu_system.h" +#include "rnc/ui/menus/menu_screen.h" +#include "rnc/game/item_state.h" +#include "rnc/game/level_state.h" +#include "rnc/ui/menus/menu_globals.h" struct MapHdr { s32 unk0; @@ -21,17 +26,9 @@ struct MapEntry { s32 b; }; -#include "rnc/ui/menus/menu_system.h" -#include "rnc/ui/menus/menu_screen.h" - extern u8 map_cross_destination_page[] __asm__("D_001CF678"); extern u8 map_circle_destination_page[] __asm__("D_001CF418"); -#include "rnc/game/item_state.h" - -#include "rnc/game/level_state.h" -#include "rnc/ui/menus/menu_globals.h" - extern struct MapEntry D_001383A0[]; extern struct MapEntry D_00138438[]; diff --git a/src/ui/map/slots/pick_next_map.c b/src/ui/map/slots/pick_next_map.c index 9825590e59..7f03d24525 100644 --- a/src/ui/map/slots/pick_next_map.c +++ b/src/ui/map/slots/pick_next_map.c @@ -4,7 +4,6 @@ #include "types.h" #include "rnc/ui/menus/menu_globals.h" #include "rnc/ui/map/slots/find_map_entry_slot.h" - #include "rnc/game/item_state.h" /* Picks the map to load next: the current map id (level_map_selection.level, diff --git a/src/ui/map/update_map_icons.c b/src/ui/map/update_map_icons.c index 53047b502d..838fec9d3f 100644 --- a/src/ui/map/update_map_icons.c +++ b/src/ui/map/update_map_icons.c @@ -6,6 +6,8 @@ #include "rnc/ui/map/map_state.h" #include "rnc/globals.h" #include "rnc/mobys/moby.h" +#include "rnc/game/level_state.h" +#include "rnc/ui/menus/menu_globals.h" /* Map screen icon refresh: places the fixed icons (-1..-9), projects the others through world_to_map_coords, then sizes each label box. */ @@ -16,15 +18,11 @@ typedef struct { u8 pad26[2]; } MapIconLink; -#include "rnc/game/level_state.h" - /* The icon list of each level (update_map_icons only reads it for level < 19). */ extern struct MapIcon *map_icon_lists_by_level[19] __asm__("D_001A2BC0"); extern s32 D_001A01F4[]; extern s32 D_0015FD60 __attribute__((sda)); -#include "rnc/ui/menus/menu_globals.h" - extern s32 D_0013D5BC[]; extern struct { @@ -32,6 +30,27 @@ extern struct { MapIconLink *links; } D_001A2C10; +/* Icon arrays of the levels, still in assembly. */ +extern struct MapIcon D_001A0910[]; +extern struct MapIcon D_001A0A28[]; +extern struct MapIcon D_001A0BE0[]; +extern struct MapIcon D_001A0E60[]; +extern struct MapIcon D_001A10E0[]; +extern struct MapIcon D_001A1270[]; +extern struct MapIcon D_001A14C8[]; +extern struct MapIcon D_001A1680[]; +extern struct MapIcon D_001A1860[]; +extern struct MapIcon D_001A1A18[]; +extern struct MapIcon D_001A1C20[]; +extern struct MapIcon D_001A1EC8[]; +extern struct MapIcon D_001A2148[]; +extern struct MapIcon D_001A22B0[]; +extern struct MapIcon D_001A2490[]; +extern struct MapIcon D_001A26C0[]; +extern struct MapIcon D_001A28C8[]; +extern struct MapIcon D_001A2A08[]; +extern struct MapIcon D_001A2AF8[]; + extern void world_to_map_coords(f32 x, f32 y, f32 *map_x, f32 *map_y, s32 level) __asm__("func_00208408"); extern void format_menu_item_text(s32 idx, char *dst) __asm__("func_00208280"); @@ -166,27 +185,6 @@ void update_map_icons(s32 level, s32 flag) { extern __typeof__(update_map_icons) func_0020BF90 __attribute__((alias("FUN_0020bf90"))); -/* Icon arrays of the levels, still in assembly. */ -extern struct MapIcon D_001A0910[]; -extern struct MapIcon D_001A0A28[]; -extern struct MapIcon D_001A0BE0[]; -extern struct MapIcon D_001A0E60[]; -extern struct MapIcon D_001A10E0[]; -extern struct MapIcon D_001A1270[]; -extern struct MapIcon D_001A14C8[]; -extern struct MapIcon D_001A1680[]; -extern struct MapIcon D_001A1860[]; -extern struct MapIcon D_001A1A18[]; -extern struct MapIcon D_001A1C20[]; -extern struct MapIcon D_001A1EC8[]; -extern struct MapIcon D_001A2148[]; -extern struct MapIcon D_001A22B0[]; -extern struct MapIcon D_001A2490[]; -extern struct MapIcon D_001A26C0[]; -extern struct MapIcon D_001A28C8[]; -extern struct MapIcon D_001A2A08[]; -extern struct MapIcon D_001A2AF8[]; - struct MapIcon *map_icon_lists_by_level[19] __asm__("D_001A2BC0") = { D_001A0910, D_001A0A28, D_001A0BE0, D_001A0E60, D_001A10E0, D_001A1270, D_001A14C8, D_001A1680, D_001A1860, D_001A1A18, D_001A1C20, D_001A1EC8, D_001A2148, D_001A22B0, diff --git a/src/ui/menus/pause/assign_heli_pack_label_text_table.c b/src/ui/menus/pause/assign_heli_pack_label_text_table.c index 412902bc1c..96ef3f443e 100644 --- a/src/ui/menus/pause/assign_heli_pack_label_text_table.c +++ b/src/ui/menus/pause/assign_heli_pack_label_text_table.c @@ -1,7 +1,6 @@ /* Ported from rac1-decomp (src/game/pause.c, func_0021DA98). */ #include "sda.h" #include "types.h" - #include "rnc/game/item_state.h" extern s32 heli_pack_label_text_ids[14] __asm__("D_001D06D0"); diff --git a/src/ui/menus/pause/draw_pause_ring.c b/src/ui/menus/pause/draw_pause_ring.c index 9d05633476..a89fea89d5 100644 --- a/src/ui/menus/pause/draw_pause_ring.c +++ b/src/ui/menus/pause/draw_pause_ring.c @@ -27,8 +27,8 @@ struct PauseState { #include "rnc/game/item_state.h" -extern u8 pause_ring_left_label_text[] __asm__("D_001602D8"); -extern u8 pause_ring_right_label_text[] __asm__("D_001602E0"); +extern char pause_ring_left_label_text[] __asm__("D_001602D8"); +extern char pause_ring_right_label_text[] __asm__("D_001602E0"); extern u8 D_001863D0[]; extern s32 SubtractIntegerWithClamp(s32); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); @@ -105,5 +105,6 @@ s32 draw_pause_ring(struct PauseState *pause_state) { extern __typeof__(draw_pause_ring) func_00220B20 __attribute__((alias("FUN_00220b20"))); /* Small data reached with lui/addiu: one-glyph labels (font glyphs 0x14, 0x15). */ -u8 pause_ring_left_label_text[] __asm__("D_001602D8") __attribute__((section(".sdata"))) = "\x14"; -u8 pause_ring_right_label_text[] __asm__("D_001602E0") __attribute__((section(".sdata"))) = "\x15"; +char pause_ring_left_label_text[] __asm__("D_001602D8") __attribute__((section(".sdata"))) = "\x14"; +char pause_ring_right_label_text[] __asm__("D_001602E0") + __attribute__((section(".sdata"))) = "\x15"; diff --git a/src/ui/menus/weapons/draw_selected_item_ammo.c b/src/ui/menus/weapons/draw_selected_item_ammo.c index 692b31c548..9a4b948568 100644 --- a/src/ui/menus/weapons/draw_selected_item_ammo.c +++ b/src/ui/menus/weapons/draw_selected_item_ammo.c @@ -8,8 +8,8 @@ #include "rnc/ui/text/text_region.h" extern char D_001602A0[]; -extern u8 ammo_count_decimal_format[] __asm__("D_001602B8"); -extern u8 ammo_count_grouped_decimal_format[] __asm__("D_001602C0"); +extern char ammo_count_decimal_format[] __asm__("D_001602B8"); +extern char ammo_count_grouped_decimal_format[] __asm__("D_001602C0"); extern char D_001602D0[]; struct ImageEntry { @@ -77,6 +77,6 @@ s32 draw_selected_item_ammo(s32 image_descriptor_input) { } /* Small data reached with lui/addiu: the ammo count formats. */ -u8 ammo_count_decimal_format[] __asm__("D_001602B8") __attribute__((section(".sdata"))) = "%d/"; -u8 ammo_count_grouped_decimal_format[] __asm__("D_001602C0") +char ammo_count_decimal_format[] __asm__("D_001602B8") __attribute__((section(".sdata"))) = "%d/"; +char ammo_count_grouped_decimal_format[] __asm__("D_001602C0") __attribute__((section(".sdata"))) = "%d,%03d/"; diff --git a/src/ui/menus/widgets/draw_menu_selection_text.c b/src/ui/menus/widgets/draw_menu_selection_text.c index 79faf4416e..be83feca9c 100644 --- a/src/ui/menus/widgets/draw_menu_selection_text.c +++ b/src/ui/menus/widgets/draw_menu_selection_text.c @@ -16,7 +16,6 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { s32 center_x2; s32 entry_index; s32 center_x; - s32 entry_offset; s32 mid_x; u32 height; u32 menu_width; @@ -39,24 +38,21 @@ s32 draw_menu_selection_text(struct MenuScreen *menu) { font_print_center(center_x, center_y, 0x80FFA888, get_help_message_text(0x5217), -1); } else { menu_width = menu->width; - entry_offset = entry_index * 0xC; mid_x = ((s32)(menu_width + ((((u32)menu_width) >> 24) >> 7))) >> 1; - font_print_center(mid_x, - 4, - 0x80FFA888, - get_help_message_text( - *((s32 *)((void *)(entry_offset + (u8 *)level_select_texts)))), - -1); + font_print_center( + mid_x, + 4, + 0x80FFA888, + get_help_message_text(level_select_texts[entry_index].description_text), + -1); width2 = menu->width; if (1) { center_x2 = ((s32)(width2 + (((u32)width2) >> 0x1F))) >> 1; - font_print_center( - center_x2, - 0x14, - 0x80FFA888, - get_help_message_text( - *((s32 *)(((u8 *)((u8 *)level_select_texts + entry_offset)) + 0x4))), - -1); + font_print_center(center_x2, + 0x14, + 0x80FFA888, + get_help_message_text(level_select_texts[entry_index].label_text), + -1); } } } diff --git a/src/ui/menus/widgets/draw_selected_menu_item_text.c b/src/ui/menus/widgets/draw_selected_menu_item_text.c index 06abff473f..8c18675542 100644 --- a/src/ui/menus/widgets/draw_selected_menu_item_text.c +++ b/src/ui/menus/widgets/draw_selected_menu_item_text.c @@ -19,7 +19,6 @@ s32 draw_selected_menu_item_text(struct MenuScreen *menu) { s32 upper_y; s32 center_x2; s32 entry_index; - s32 entry_offset; u32 menu_width; u32 width; u32 width2; @@ -40,25 +39,22 @@ s32 draw_selected_menu_item_text(struct MenuScreen *menu) { font_print_center(center_x, center_y, 0x80FFA888, get_help_message_text(0x5019), -1); goto block_5; block_4: - entry_offset = entry_index * 0xC; menu_width = menu->width; mid_x = (s32)(menu_width + ((u32)menu_width >> 0x1F)) >> 1; upper_y = ((s32)menu->height / 3) - 8; - font_print_center( - mid_x, - upper_y, - 0x80FFA888, - get_help_message_text(*(s32 *)(void *)(entry_offset + (u8 *)level_select_texts)), - -1); + font_print_center(mid_x, + upper_y, + 0x80FFA888, + get_help_message_text(level_select_texts[entry_index].description_text), + -1); width2 = menu->width; center_x2 = (s32)(width2 + ((u32)width2 >> 0x1F)) >> 1; lower_y = ((s32)(menu->height * 2) / 3) - 8; - font_print_center( - center_x2, - lower_y, - 0x80FFA888, - get_help_message_text(*(s32 *)((u8 *)((u8 *)level_select_texts + entry_offset) + 0x4)), - -1); + font_print_center(center_x2, + lower_y, + 0x80FFA888, + get_help_message_text(level_select_texts[entry_index].label_text), + -1); block_5: do_gif_paging(); return 2; diff --git a/src/ui/menus/widgets/format_scaled_display_value.c b/src/ui/menus/widgets/format_scaled_display_value.c index 465b818a5f..948a035eb9 100644 --- a/src/ui/menus/widgets/format_scaled_display_value.c +++ b/src/ui/menus/widgets/format_scaled_display_value.c @@ -1,9 +1,9 @@ #include "types.h" #include "rnc/sdk/libc/stdio.h" -extern u8 thousands_grouped_integer_format[] __asm__("D_00161078"); -extern u8 plain_integer_format[] __asm__("D_00161080"); -void format_scaled_display_value(u8 *buf, s32 value) __asm__("FUN_00238688"); +extern char thousands_grouped_integer_format[] __asm__("D_00161078"); +extern char plain_integer_format[] __asm__("D_00161080"); +void format_scaled_display_value(u8 *buf, s32 value) __asm__("FUN_00238688"); void format_scaled_display_value(u8 *destination, s32 value) { if (value >= 0x3E8) { @@ -16,6 +16,6 @@ void format_scaled_display_value(u8 *destination, s32 value) { extern __typeof__(format_scaled_display_value) func_00238688 __attribute__((alias("FUN_00238688"))); /* Small data reached with lui/addiu. */ -u8 thousands_grouped_integer_format[] __asm__("D_00161078") +char thousands_grouped_integer_format[] __asm__("D_00161078") __attribute__((section(".sdata"))) = "%d,%03d"; -u8 plain_integer_format[] __asm__("D_00161080") __attribute__((section(".sdata"))) = "%d"; +char plain_integer_format[] __asm__("D_00161080") __attribute__((section(".sdata"))) = "%d"; diff --git a/src/world/find_zone_at_point.c b/src/world/find_zone_at_point.c index 48138f6708..2de4f1f020 100644 --- a/src/world/find_zone_at_point.c +++ b/src/world/find_zone_at_point.c @@ -1,15 +1,5 @@ /* Ported from rac1-decomp (src/game/vendor.c, func_0023B018). */ #include "sda.h" -#include "rnc/rendering/render_globals.h" - -typedef struct { - int x; - int y; - int z; - unsigned short w; - unsigned short h; -} ZoneBox; - #include "rnc/world/collision/surface_height_grid.h" extern SurfaceHeightTile *surface_height_tiles_macro __asm__("D_00161190") MACRO_ADDR; @@ -55,8 +45,8 @@ int find_zone_at_point(float x, float y, float z) { extern __typeof__(find_zone_at_point) func_00239D60 __attribute__((alias("FUN_00239d60"))); -s32 surface_height_tiles = 0; +SurfaceHeightTile *surface_height_tiles = 0; -s32 occl_cell_table = 0; +ZoneBox *occl_cell_table = 0; s32 occl_cell_count = 0;