more pal funcs & npc sprites improvement (#1079)

* cod changes and fixes for npc sprites

* 6 mo

* Cleanup
This commit is contained in:
Ethan Roseman 2023-07-10 14:57:27 +09:00 committed by GitHub
parent 4d8b61d6a0
commit 4f77ffbc3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 441 additions and 1026 deletions

View File

@ -32,6 +32,7 @@
], ],
"python.analysis.extraPaths": [ "python.analysis.extraPaths": [
"./tools", "./tools",
"./tools/build",
"./tools/build/sprite", "./tools/build/sprite",
"./tools/splat", "./tools/splat",
"./tools/build/imgfx" "./tools/build/imgfx"

View File

@ -5940,6 +5940,9 @@ enum FileMenuMessages {
/* 32 */ FILE_MESSAGE_ENTER_A_FILE_NAME, // Enter a file name![End] /* 32 */ FILE_MESSAGE_ENTER_A_FILE_NAME, // Enter a file name![End]
/* 33 */ FILE_MESSAGE_QUESTION, // ?[End] /* 33 */ FILE_MESSAGE_QUESTION, // ?[End]
/* 34 */ FILE_MESSAGE_PERIOD_34, // .[End] /* 34 */ FILE_MESSAGE_PERIOD_34, // .[End]
#if VERSION_PAL
UNK3,
#endif
}; };
// specifically used with draw_msg, not to be confused with MsgStyles // specifically used with draw_msg, not to be confused with MsgStyles

View File

@ -26,8 +26,16 @@ extern HudScript HES_OptionStereoOn;
extern HudScript HES_OptionStereoOff; extern HudScript HES_OptionStereoOff;
#if VERSION_PAL #if VERSION_PAL
extern u8 D_filemenu_802508D0[4];
extern u8 D_filemenu_802508D4[4];
extern u8 D_filemenu_802508D8[4];
extern u8 D_filemenu_802508DC[4];
extern u8 D_filemenu_802508E0[4];
extern u8 D_filemenu_802508E4[4];
extern u8 D_filemenu_802508E8[4]; extern u8 D_filemenu_802508E8[4];
extern u8 D_filemenu_802508EC[4];
extern u8 D_filemenu_802508F0[4]; extern u8 D_filemenu_802508F0[4];
extern u8 D_filemenu_802508F4[4];
extern u8 D_filemenu_80250938[4]; extern u8 D_filemenu_80250938[4];
extern u8 D_filemenu_8025093C[4]; extern u8 D_filemenu_8025093C[4];
#define COPY_OFFSET_X (D_filemenu_8025093C[gCurrentLanguage]) #define COPY_OFFSET_X (D_filemenu_8025093C[gCurrentLanguage])
@ -72,15 +80,15 @@ extern HudScript HES_OptionMonoOff_es;
extern HudScript HES_OptionStereoOn_es; extern HudScript HES_OptionStereoOn_es;
extern HudScript HES_OptionStereoOff_es; extern HudScript HES_OptionStereoOff_es;
#if VERSION_PAL
HudScript* filemenu_main_hudElemScripts[][20] = { HudScript* filemenu_main_hudElemScripts[][20] = {
[LANGUAGE_EN] = { [LANGUAGE_DEFAULT] = {
&HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7, &HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7,
&HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing, &HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing,
&HES_Spirit6Missing, &HES_Spirit7Missing, &HES_JpFile, &HES_JpFileDisabled, &HES_OptionMonoOn, &HES_Spirit6Missing, &HES_Spirit7Missing, &HES_JpFile, &HES_JpFileDisabled, &HES_OptionMonoOn,
&HES_OptionMonoOff, &HES_OptionMonoOff,
&HES_OptionStereoOn, &HES_OptionStereoOff, &HES_OptionStereoOn, &HES_OptionStereoOff,
}, },
#if VERSION_PAL
[LANGUAGE_DE] = { [LANGUAGE_DE] = {
&HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7, &HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7,
&HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing, &HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing,
@ -102,15 +110,8 @@ HudScript* filemenu_main_hudElemScripts[][20] = {
&HES_OptionMonoOff_es, &HES_OptionMonoOff_es,
&HES_OptionStereoOn_es, &HES_OptionStereoOff_es, &HES_OptionStereoOn_es, &HES_OptionStereoOff_es,
} }
};
#else
HudScript* filemenu_main_hudElemScripts[] = {
&HES_Spirit1, &HES_Spirit2, &HES_Spirit3, &HES_Spirit4, &HES_Spirit5, &HES_Spirit6, &HES_Spirit7,
&HES_Spirit1Missing, &HES_Spirit2Missing, &HES_Spirit3Missing, &HES_Spirit4Missing, &HES_Spirit5Missing,
&HES_Spirit6Missing, &HES_Spirit7Missing, &HES_JpFile, &HES_JpFileDisabled, &HES_OptionMonoOn, &HES_OptionMonoOff,
&HES_OptionStereoOn, &HES_OptionStereoOff,
};
#endif #endif
};
u8 filemenu_main_gridData[] = { u8 filemenu_main_gridData[] = {
0, 0, 1, 2, 2, 3, 4, 5, 6, 0, 0, 1, 2, 2, 3, 4, 5, 6,
@ -435,7 +436,39 @@ void filemenu_draw_contents_option_left(
} }
#if VERSION_PAL #if VERSION_PAL
INCLUDE_ASM(void, "filemenu/filemenu_main", filemenu_draw_contents_option_center); void filemenu_draw_contents_option_center(
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
) {
s32 msgIdx;
s32 xOffset;
s32 yOffset;
switch (menu->page) {
case 1:
case 2:
case 3:
msgIdx = FILE_MESSAGE_CANCEL;
xOffset = D_filemenu_802508F4[gCurrentLanguage];
yOffset = 0;
if (menu->col == 1 && menu->row == 2) {
filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + xOffset - 10, baseY + 8);
}
break;
default:
msgIdx = FILE_MESSAGE_COPY_FILE;
xOffset = D_filemenu_802508EC[gCurrentLanguage];
yOffset = 0;
if (menu->col == 1 && menu->row == 2) {
filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_OPTION_CENTER, baseX + xOffset - 10, baseY + 8);
}
break;
}
filemenu_draw_message(filemenu_get_menu_message(msgIdx), baseX + xOffset, baseY + yOffset + 2, 255, 0, 1);
}
#else #else
void filemenu_draw_contents_option_center( void filemenu_draw_contents_option_center(
MenuPanel* menu, MenuPanel* menu,
@ -496,23 +529,13 @@ void filemenu_draw_contents_option_right(
#endif #endif
} }
#if VERSION_PAL
void filemenu_draw_contents_file_info(
s32 fileIdx,
MenuPanel* menu,
s32 baseX, s32 baseY,
s32 width, s32 height,
s32 opacity, s32 darkening
);
INCLUDE_ASM(void, "filemenu/filemenu_main", filemenu_draw_contents_file_info);
#else
void filemenu_draw_contents_file_info(s32 fileIdx, void filemenu_draw_contents_file_info(s32 fileIdx,
MenuPanel* menu, MenuPanel* menu,
s32 baseX, s32 baseY, s32 baseX, s32 baseY,
s32 width, s32 height, s32 width, s32 height,
s32 opacity, s32 darkening s32 opacity, s32 darkening
) { ) {
SaveMetadata* save; s32 xOffset;
s32 temp_s0_3; s32 temp_s0_3;
s32 temp_s1_2; s32 temp_s1_2;
s32 temp_s3_2; s32 temp_s3_2;
@ -522,36 +545,55 @@ void filemenu_draw_contents_file_info(s32 fileIdx,
const int MAX_DISPLAYED_TIME = 100*60*60*60 - 1; // 100 hours minus one frame at 60 fps const int MAX_DISPLAYED_TIME = 100*60*60*60 - 1; // 100 hours minus one frame at 60 fps
if (!gSaveSlotHasData[fileIdx]) { if (!gSaveSlotHasData[fileIdx]) {
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NEW), baseX + 50, baseY + 20, 0xFF, 0xA, 0); #if VERSION_PAL
xOffset = D_filemenu_802508E0[gCurrentLanguage];
#else
xOffset = 50;
#endif
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_NEW), baseX + xOffset, baseY + 20, 255, 0xA, 0);
return; return;
} }
save = &gSaveSlotMetadata[fileIdx]; if (gSaveSlotMetadata[fileIdx].timePlayed == 0) {
if (save->timePlayed == 0) { #if VERSION_PAL
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FIRST_PLAY), baseX + 30, baseY + 20, 0xFF, 0xA, 0); xOffset = D_filemenu_802508E4[gCurrentLanguage];
#else
xOffset = 30;
#endif
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_FIRST_PLAY), baseX + xOffset, baseY + 20, 255, 0xA, 0);
return; return;
} }
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_LEVEL), baseX + 0x22, baseY + 10, 0xFF, 0xA, 1); #if VERSION_PAL
temp_s3_2 = save->level; xOffset = D_filemenu_802508D8[gCurrentLanguage];
#else
xOffset = 0x22;
#endif
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_LEVEL), baseX + xOffset, baseY + 10, 255, 0xA, 1);
temp_s3_2 = gSaveSlotMetadata[fileIdx].level;
temp_s3 = temp_s3_2; temp_s3 = temp_s3_2;
draw_number(temp_s3 / 10, baseX + 79, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number(temp_s3 / 10, baseX + 79, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
draw_number(temp_s3 % 10, baseX + 88, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number(temp_s3 % 10, baseX + 88, baseY + 10 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PLAY_TIME), baseX + 11, baseY + 24, 0xFF, 0xA, 1); #if VERSION_PAL
xOffset = D_filemenu_802508DC[gCurrentLanguage];
#else
xOffset = 11;
#endif
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PLAY_TIME), baseX + xOffset, baseY + 24, 255, 0xA, 1);
temp_s3_2 = save->timePlayed; temp_s3_2 = gSaveSlotMetadata[fileIdx].timePlayed;
if (temp_s3_2 > MAX_DISPLAYED_TIME) { if (temp_s3_2 > MAX_DISPLAYED_TIME) {
temp_s3_2 = MAX_DISPLAYED_TIME; temp_s3_2 = MAX_DISPLAYED_TIME;
} }
draw_number((temp_s3_2 / 2160000) % 10, baseX + 76, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number((temp_s3_2 / 2160000) % 10, baseX + 76, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
temp_s1_2 = temp_s3_2 / 216000; temp_s1_2 = temp_s3_2 / 216000;
draw_number(temp_s1_2 - ((temp_s3_2 / 2160000) * 10), baseX + 85, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number(temp_s1_2 - ((temp_s3_2 / 2160000) * 10), baseX + 85, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_13), baseX + 95, baseY + 23, 0xFF, 0xA, 1); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_13), baseX + 95, baseY + 23, 255, 0xA, 1);
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_13), baseX + 95, baseY + 18, 0xFF, 0xA, 1); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_PERIOD_13), baseX + 95, baseY + 18, 255, 0xA, 1);
temp_s0_3 = temp_s3_2 / 36000; temp_s0_3 = temp_s3_2 / 36000;
draw_number(temp_s0_3 - (temp_s1_2 * 6), baseX + 100, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number(temp_s0_3 - (temp_s1_2 * 6), baseX + 100, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
draw_number((temp_s3_2 / 3600) - (temp_s0_3 * 10), baseX + 109, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 0xFF, DRAW_NUMBER_STYLE_MONOSPACE); draw_number((temp_s3_2 / 3600) - (temp_s0_3 * 10), baseX + 109, baseY + 24 + NUMBER_OFFSET_Y, DRAW_NUMBER_CHARSET_THIN, MSG_PAL_STANDARD, 255, DRAW_NUMBER_STYLE_MONOSPACE);
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
if (i < gSaveSlotMetadata[fileIdx].spiritsRescued) { if (i < gSaveSlotMetadata[fileIdx].spiritsRescued) {
@ -567,7 +609,6 @@ void filemenu_draw_contents_file_info(s32 fileIdx,
} }
} }
} }
#endif
#if VERSION_PAL #if VERSION_PAL
void filemenu_draw_contents_file_title( void filemenu_draw_contents_file_title(
@ -575,8 +616,32 @@ void filemenu_draw_contents_file_title(
MenuPanel* menu, MenuPanel* menu,
s32 baseX, s32 baseY, s32 baseX, s32 baseY,
s32 width, s32 height, s32 width, s32 height,
s32 opacity, s32 darkening); s32 opacity, s32 darkening)
INCLUDE_ASM(void, "filemenu/filemenu_main", filemenu_draw_contents_file_title); {
if (filemenu_currentMenu == 0 && menu->selected == fileIdx) {
filemenu_set_cursor_goal_pos(fileIdx + 60, baseX - 3, baseY + 8);
}
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_OK), baseX + FILE_X, baseY + 1, 255, 0, 1);
if (!gSaveSlotHasData[fileIdx]) {
filemenu_draw_message(filemenu_get_menu_message(fileIdx + UNK3),
baseX + D_filemenu_802508D0[gCurrentLanguage], baseY + 1, 255, 0, 1);
} else {
s32 tmp = D_filemenu_802508D0[gCurrentLanguage];
filemenu_draw_message(filemenu_get_menu_message(fileIdx + UNK3),
baseX + tmp, baseY + 1, 255, 0, 1);
tmp += D_filemenu_802508D4[gCurrentLanguage];
tmp += 6;
filemenu_draw_file_name(
gSaveSlotMetadata[fileIdx].filename,
ARRAY_COUNT(gSaveSlotMetadata[fileIdx].filename),
baseX + tmp,
baseY + 1, 255, 0, 1, 9);
}
}
#else #else
void filemenu_draw_contents_file_title( void filemenu_draw_contents_file_title(
s32 fileIdx, s32 fileIdx,
@ -675,8 +740,50 @@ void filemenu_draw_contents_file_3_title(
filemenu_draw_contents_file_title(3, menu, baseX, baseY, width, height, opacity, darkening); filemenu_draw_contents_file_title(3, menu, baseX, baseY, width, height, opacity, darkening);
} }
// TODO figure out how to merge these nicer
#if VERSION_PAL #if VERSION_PAL
INCLUDE_ASM(void, "filemenu/filemenu_main", filemenu_main_init); void filemenu_main_init(MenuPanel* menu) {
s32 halfWidth;
s32 i;
s32 tmp;
for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) {
filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]);
hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80);
}
for (i = 0; i < ARRAY_COUNT(filemenu_main_windowBPs); i++) {
filemenu_main_windowBPs[i].tab = menu;
}
setup_pause_menu_tab(filemenu_main_windowBPs, ARRAY_COUNT(filemenu_main_windowBPs));
menu->selected = MENU_PANEL_SELECTED_GRID_DATA(menu);
gWindows[WINDOW_ID_FILEMENU_TITLE].pos.y = 1;
gWindows[WINDOW_ID_FILEMENU_TITLE].width = 162;
gWindows[WINDOW_ID_FILEMENU_TITLE].height = 25;
halfWidth = gWindows[WINDOW_ID_FILEMENU_TITLE].width / 2;
gWindows[WINDOW_ID_FILEMENU_TITLE].pos.x = gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1
? (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth
: SCREEN_WIDTH / 2 - halfWidth;
tmp = 1;
halfWidth = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].width / 2;
gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].pos.x = gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1
? (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth
: SCREEN_WIDTH / 2 - halfWidth;
if (menu->page != 0) {
set_window_update(WINDOW_ID_FILEMENU_OPTION_LEFT, WINDOW_UPDATE_HIDE);
set_window_update(WINDOW_ID_FILEMENU_OPTION_RIGHT, WINDOW_UPDATE_HIDE);
set_window_update(WINDOW_ID_FILEMENU_STEREO, WINDOW_UPDATE_HIDE);
set_window_update(WINDOW_ID_FILEMENU_MONO, WINDOW_UPDATE_HIDE);
}
menu->initialized = tmp;
}
#else #else
void filemenu_main_init(MenuPanel* menu) { void filemenu_main_init(MenuPanel* menu) {
s32 halfWidth; s32 halfWidth;
@ -684,9 +791,10 @@ void filemenu_main_init(MenuPanel* menu) {
s16* posXPtr; s16* posXPtr;
s32 x; s32 x;
s32 i; s32 i;
s32 tmp;
for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) { for (i = 0; i < ARRAY_COUNT(filemenu_hudElemIDs); i++) {
filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[i]); filemenu_hudElemIDs[i] = hud_element_create(filemenu_main_hudElemScripts[gCurrentLanguage][i]);
hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80); hud_element_set_flags(filemenu_hudElemIDs[i], HUD_ELEMENT_FLAG_80);
} }
@ -712,7 +820,7 @@ void filemenu_main_init(MenuPanel* menu) {
if (gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1) { if (gWindows[WINDOW_ID_FILEMENU_TITLE].parent != -1) {
x = (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth; x = (gWindows[gWindows[WINDOW_ID_FILEMENU_TITLE].parent].width / 2) - halfWidth;
} else { } else {
x = 160 - halfWidth; x = SCREEN_WIDTH / 2 - halfWidth;
} }
*posXPtr = x; *posXPtr = x;
@ -721,7 +829,7 @@ void filemenu_main_init(MenuPanel* menu) {
if (gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1) { if (gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent != -1) {
x = (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth2; x = (gWindows[gWindows[WINDOW_ID_FILEMENU_OPTION_CENTER].parent].width / 2) - halfWidth2;
} else { } else {
x = 160 - halfWidth2; x = SCREEN_WIDTH / 2 - halfWidth2;
} }
*posXPtr = x; *posXPtr = x;

View File

@ -2,6 +2,8 @@
#include "filemenu.h" #include "filemenu.h"
#include "ld_addrs.h" #include "ld_addrs.h"
s32 msg_get_print_char_width(s32 character, s32 charset, s32 variation, f32 msgScale, s32 overrideCharWidth, u8 flags);
#if VERSION_IQUE #if VERSION_IQUE
// TODO: remove when charset segment is split for iQue // TODO: remove when charset segment is split for iQue
extern Addr charset_standard_OFFSET; extern Addr charset_standard_OFFSET;
@ -670,9 +672,6 @@ u8* filemenu_get_menu_message(s32 idx) {
} }
#endif #endif
#if VERSION_PAL
INCLUDE_ASM(void, "filemenu/filemenu_msg", filemenu_draw_file_name);
#else
void filemenu_draw_file_name(u8* filename, s32 length, s32 x, s32 y, s32 alpha, s32 arg5, s32 arg6, s32 charWidth) { void filemenu_draw_file_name(u8* filename, s32 length, s32 x, s32 y, s32 alpha, s32 arg5, s32 arg6, s32 charWidth) {
s32 i; s32 i;
@ -687,10 +686,13 @@ void filemenu_draw_file_name(u8* filename, s32 length, s32 x, s32 y, s32 alpha,
} else { } else {
filemenu_draw_message((u8*)c, x + (i * charWidth), y, alpha, arg5, arg6); filemenu_draw_message((u8*)c, x + (i * charWidth), y, alpha, arg5, arg6);
} }
#elif VERSION_PAL
s32 offset = (8 - msg_get_print_char_width(c, 0, 0, 1.0f, 0, 1)) / 2;
filemenu_draw_message((u8*)c, x + (i * charWidth) + offset, y, alpha, arg5, arg6);
#else #else
filemenu_draw_message((u8*)c, x + (i * charWidth), y, alpha, arg5, arg6); filemenu_draw_message((u8*)c, x + (i * charWidth), y, alpha, arg5, arg6);
#endif #endif
} }
} }
} }
#endif

View File

@ -83,9 +83,6 @@ MenuPanel filemenu_yesno_menuBP = {
.fpCleanup = &filemenu_yesno_cleanup .fpCleanup = &filemenu_yesno_cleanup
}; };
#if VERSION_PAL
INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_draw_options_contents);
#else
void filemenu_yesno_draw_options_contents( void filemenu_yesno_draw_options_contents(
MenuPanel* menu, MenuPanel* menu,
s32 baseX, s32 baseY, s32 baseX, s32 baseY,
@ -124,12 +121,14 @@ void filemenu_yesno_draw_options_contents(
xOffset2 = 28; xOffset2 = 28;
yOffset2 = 21; yOffset2 = 21;
break; break;
#if !VERSION_PAL
case 4: case 4:
xOffset1 = 28; xOffset1 = 28;
yOffset1 = 4; yOffset1 = 4;
xOffset2 = 28; xOffset2 = 28;
yOffset2 = 21; yOffset2 = 21;
break; break;
#endif
} }
filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 0xFF, 0, 0); filemenu_draw_message(filemenu_get_menu_message(FILE_MESSAGE_YES), baseX + xOffset1, baseY + yOffset1, 0xFF, 0, 0);
@ -146,7 +145,6 @@ void filemenu_yesno_draw_options_contents(
filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_YESNO_OPTIONS, baseX + cursorGoalXOffset, baseY + cursorGoalYOffset); filemenu_set_cursor_goal_pos(WINDOW_ID_FILEMENU_YESNO_OPTIONS, baseX + cursorGoalXOffset, baseY + cursorGoalYOffset);
} }
} }
#endif
#if VERSION_PAL #if VERSION_PAL
INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_draw_prompt_contents); INCLUDE_ASM(void, "filemenu/filemenu_yesno", filemenu_yesno_draw_prompt_contents);

0
tools/build/__init__.py Normal file
View File

24
tools/build/common.py Normal file
View File

@ -0,0 +1,24 @@
from functools import lru_cache
from itertools import zip_longest
import os
from pathlib import Path
from typing import Tuple
ASSETS_DIR = (
Path(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
/ "assets"
)
@lru_cache(maxsize=None)
def get_asset_path(asset: Path, asset_stack: Tuple[Path, ...]) -> Path:
for sdir in asset_stack:
potential_path = ASSETS_DIR / sdir / asset
if potential_path.exists():
return potential_path
raise FileNotFoundError(f"Could not find asset {asset}")
def iter_in_groups(iterable, n, fillvalue=None):
args = [iter(iterable)] * n
return zip_longest(*args, fillvalue=fillvalue)

View File

@ -205,7 +205,7 @@ def write_ninja_rules(
ninja.rule( ninja.rule(
"npc_sprite", "npc_sprite",
description="sprite $sprite_name", description="sprite $sprite_name",
command=f"$python {BUILD_TOOLS}/sprite/npc_sprite.py $out $sprite_dir", command=f"$python {BUILD_TOOLS}/sprite/npc_sprite.py $out $sprite_name $asset_stack",
) )
ninja.rule( ninja.rule(
@ -217,7 +217,7 @@ def write_ninja_rules(
ninja.rule( ninja.rule(
"sprite_header", "sprite_header",
description="sprite_header $sprite_name", description="sprite_header $sprite_name",
command=f"$python {BUILD_TOOLS}/sprite/header.py $out $sprite_dir $sprite_id", command=f"$python {BUILD_TOOLS}/sprite/header.py $out $sprite_name $sprite_id $asset_stack",
) )
ninja.rule( ninja.rule(
@ -735,19 +735,27 @@ class Configure:
yay0_path = bin_path.with_suffix(".Yay0") yay0_path = bin_path.with_suffix(".Yay0")
sprite_yay0s.append(yay0_path) sprite_yay0s.append(yay0_path)
variables = { build(
"sprite_id": sprite_id, bin_path,
"sprite_name": sprite_name, [sprite_dir],
"sprite_dir": self.resolve_asset_path(sprite_dir), "npc_sprite",
} variables={
"sprite_name": sprite_name,
build(bin_path, [sprite_dir], "npc_sprite", variables=variables) "asset_stack": ",".join(self.asset_stack),
},
)
build(yay0_path, [bin_path], "yay0") build(yay0_path, [bin_path], "yay0")
# NPC sprite header
build( build(
self.build_path() / "include/sprite/npc" / (sprite_name + ".h"), self.build_path() / "include/sprite/npc" / (sprite_name + ".h"),
[sprite_dir, yay0_path], [sprite_dir, yay0_path],
"sprite_header", "sprite_header",
variables=variables, variables={
"sprite_name": sprite_name,
"sprite_id": str(sprite_id),
"asset_stack": ",".join(self.asset_stack),
},
) )
# Sprites .bin # Sprites .bin

View File

@ -6,7 +6,6 @@ from glob import glob
import png # type: ignore import png # type: ignore
def unpack_color(s): def unpack_color(s):
r = (s >> 11) & 0x1F r = (s >> 11) & 0x1F
g = (s >> 6) & 0x1F g = (s >> 6) & 0x1F

View File

@ -3,26 +3,25 @@
from sys import argv, path from sys import argv, path
from pathlib import Path from pathlib import Path
path.append(str(Path(__file__).parent.parent.parent / "splat")) path.append(str(Path(__file__).parent.parent))
path.append(str(Path(__file__).parent.parent.parent / "splat_ext"))
from pm_sprites import NpcSprite from sprite.npc_sprite import from_dir as npc_from_dir
if __name__ == "__main__": if __name__ == "__main__":
if len(argv) < 4: if len(argv) < 4:
print("usage: gen_sprite_animations_h.py [OUT] [DIR] [ID]") print("usage: header.py [OUT] [NAME] [ID]")
exit(1) exit(1)
_, outfile, sprite_dir_in, s_in = argv _, outfile, sprite_name, s_in, asset_stack_raw = argv
asset_stack = tuple(Path(d) for d in asset_stack_raw.split(","))
with open(outfile, "w") as f: with open(outfile, "w") as f:
# get sprite index # get sprite index
s = int(s_in) s = int(s_in)
assert s >= 1 assert s >= 1
sprite_dir = Path(sprite_dir_in) sprite = npc_from_dir(sprite_name, asset_stack, load_images=False)
sprite = NpcSprite.from_dir(sprite_dir, read_images=False)
sprite_name = sprite_dir.stem
f.write(f"#ifndef _NPC_SPRITE_{sprite_name.upper()}_H_\n") f.write(f"#ifndef _NPC_SPRITE_{sprite_name.upper()}_H_\n")
f.write(f"#define _NPC_SPRITE_{sprite_name.upper()}_H_\n") f.write(f"#define _NPC_SPRITE_{sprite_name.upper()}_H_\n")

View File

@ -3,11 +3,24 @@
from math import floor from math import floor
from sys import argv, path from sys import argv, path
from pathlib import Path from pathlib import Path
from typing import List from typing import List, Tuple
import xml.etree.ElementTree as ET
import png # type: ignore
path.append(str(Path(__file__).parent.parent))
path.append(str(Path(__file__).parent.parent.parent))
path.append(str(Path(__file__).parent.parent.parent / "splat")) path.append(str(Path(__file__).parent.parent.parent / "splat"))
path.append(str(Path(__file__).parent.parent.parent / "splat_ext")) path.append(str(Path(__file__).parent.parent.parent / "splat_ext"))
from pm_sprites import NpcSprite
from common import get_asset_path, iter_in_groups
from splat_ext.pm_sprites import (
MAX_COMPONENTS_XML,
PALETTE_GROUPS_XML,
NpcRaster,
NpcSprite,
)
from splat_ext.sprite_common import AnimComponent
def pack_color(r, g, b, a): def pack_color(r, g, b, a):
@ -23,22 +36,108 @@ def pack_color(r, g, b, a):
return s return s
def iter_in_groups(iterable, n, fillvalue=None): def from_dir(
from itertools import zip_longest sprite_name: str,
asset_stack: Tuple[Path, ...],
load_images: bool = True,
) -> NpcSprite:
sprite_dir = Path(f"sprite/npc/{sprite_name}")
args = [iter(iterable)] * n sprite_sheet_xml_path = get_asset_path(sprite_dir / "SpriteSheet.xml", asset_stack)
return zip_longest(*args, fillvalue=fillvalue) xml = ET.parse(sprite_sheet_xml_path)
SpriteSheet = xml.getroot()
true_max_components = 0
if "a" in SpriteSheet.attrib:
max_components = int(SpriteSheet.attrib["a"])
else:
max_components = int(SpriteSheet.attrib[MAX_COMPONENTS_XML])
if "b" in SpriteSheet.attrib:
num_variations = int(SpriteSheet.attrib["b"])
else:
num_variations = int(SpriteSheet.attrib[PALETTE_GROUPS_XML])
variation_names = SpriteSheet.get("variations", default="").split(",")
palettes = []
palette_names: List[str] = []
for Palette in SpriteSheet.findall("./PaletteList/Palette"):
if asset_stack is not None and load_images:
img_name = Palette.attrib["src"]
img_path = str(get_asset_path(sprite_dir / img_name, asset_stack))
img = png.Reader(img_path)
img.preamble(True)
palette = img.palette(alpha="force")
palette = palette[0:16]
assert len(palette) == 16
palettes.append(palette)
palette_names.append(
Palette.get("name", Palette.attrib["src"].split(".png")[0])
)
images = []
image_names: List[str] = []
for Raster in SpriteSheet.findall("./RasterList/Raster"):
if asset_stack is not None and load_images:
img_name = Raster.attrib["src"]
img_path = str(get_asset_path(sprite_dir / img_name, asset_stack))
width, height, raster, info = png.Reader(img_path).read_flat()
palette_index = int(Raster.attrib["palette"], base=16)
image = NpcRaster(width, height, palette_index, raster)
assert (image.width % 8) == 0, f"{img_path} width is not a multiple of 8"
assert (image.height % 8) == 0, f"{img_path} height is not a multiple of 8"
images.append(image)
image_names.append(Raster.attrib["src"].split(".png")[0])
animations = []
animation_names: List[str] = []
for Animation in SpriteSheet.findall("./AnimationList/Animation"):
comps: List[AnimComponent] = []
for comp_xml in Animation:
comp: AnimComponent = AnimComponent.from_xml(comp_xml)
comps.append(comp)
animation_names.append(Animation.attrib["name"])
animations.append(comps)
if len(comps) > true_max_components:
true_max_components = len(comps)
max_components = true_max_components
# assert self.max_components == true_max_components, f"{true_max_components} component(s) used, but SpriteSheet.a = {self.max_components}"
return NpcSprite(
max_components,
num_variations,
animations,
palettes,
images,
image_names,
palette_names,
animation_names,
variation_names,
)
if __name__ == "__main__": if __name__ == "__main__":
if len(argv) != 3: if len(argv) != 4:
print("usage: sprite.py [OUTBIN] [DIR]") print("usage: sprite.py [OUTBIN] [SPRITE_NAME] [ASSET_STACK]")
exit(1) exit(1)
_, outfile, sprite_dir = argv _, outfile, sprite_name, asset_stack_raw = argv
asset_stack = tuple(Path(d) for d in asset_stack_raw.split(","))
try: try:
sprite = NpcSprite.from_dir(Path(sprite_dir)) sprite = from_dir(sprite_name, asset_stack)
except AssertionError as e: except AssertionError as e:
print("error:", e) print("error:", e)
exit(1) exit(1)

View File

@ -2,13 +2,15 @@
import argparse import argparse
from dataclasses import dataclass from dataclasses import dataclass
from functools import lru_cache
from pathlib import Path from pathlib import Path
import sys import sys
from typing import List from typing import List
sys.path.append(str(Path(__file__).parent.parent))
sys.path.append(str(Path(__file__).parent.parent.parent))
sys.path.append(str(Path(__file__).parent.parent.parent)) sys.path.append(str(Path(__file__).parent.parent.parent))
sys.path.append(str(Path(__file__).parent.parent.parent / "splat")) sys.path.append(str(Path(__file__).parent.parent.parent / "splat"))
from common import get_asset_path, iter_in_groups
from splat_ext.pm_sprites import ( from splat_ext.pm_sprites import (
BACK_PALETTE_XML, BACK_PALETTE_XML,
LIST_END_BYTES, LIST_END_BYTES,
@ -21,7 +23,7 @@ from splat_ext.pm_sprites import (
PlayerRaster, PlayerRaster,
RasterTableEntry, RasterTableEntry,
) )
from splat_ext.sprite_common import AnimComponent, iter_in_groups from splat_ext.sprite_common import AnimComponent
import os import os
import png # type: ignore import png # type: ignore
@ -47,8 +49,14 @@ def pack_color(r, g, b, a) -> int:
return (r << 11) | (g << 6) | (b << 1) | a return (r << 11) | (g << 6) | (b << 1) | a
def get_player_sprite_metadata() -> Tuple[str, List[str], List[str]]: def get_player_sprite_metadata(
orderings_tree = ET.parse(get_asset_path(PLAYER_SPRITE_MEDADATA_XML_FILENAME)) asset_stack: Tuple[Path, ...],
) -> Tuple[str, List[str], List[str]]:
orderings_tree = ET.parse(
get_asset_path(
Path("sprite") / PLAYER_SPRITE_MEDADATA_XML_FILENAME, asset_stack
)
)
build_info = str(orderings_tree.getroot()[0].text) build_info = str(orderings_tree.getroot()[0].text)
@ -63,8 +71,10 @@ def get_player_sprite_metadata() -> Tuple[str, List[str], List[str]]:
return build_info, sprite_order, raster_order return build_info, sprite_order, raster_order
def get_npc_sprite_metadata() -> List[str]: def get_npc_sprite_metadata(asset_stack: Tuple[Path, ...]) -> List[str]:
orderings_tree = ET.parse(get_asset_path(NPC_SPRITE_MEDADATA_XML_FILENAME)) orderings_tree = ET.parse(
get_asset_path(Path("sprite") / NPC_SPRITE_MEDADATA_XML_FILENAME, asset_stack)
)
sprite_order: List[str] = [] sprite_order: List[str] = []
for sprite_tag in orderings_tree.getroot()[0]: for sprite_tag in orderings_tree.getroot()[0]:
@ -95,20 +105,13 @@ SPECIAL_RASTER_BYTES = (
) )
@lru_cache(maxsize=None) def cache_player_rasters(raster_order: List[str], asset_stack: Tuple[Path, ...]):
def get_asset_path(asset: str) -> Path:
for sdir in ASSET_STACK:
potential_path = ASSET_DIR / sdir / "sprite" / asset
if potential_path.exists():
return potential_path
raise FileNotFoundError(f"Could not find asset {asset}")
def cache_player_rasters(raster_order: List[str]):
# Read all player rasters and cache them # Read all player rasters and cache them
cur_offset = 0 cur_offset = 0
for raster_name in raster_order: for raster_name in raster_order:
png_path = get_asset_path(Path("player/rasters") / f"{raster_name}.png") png_path = get_asset_path(
Path(f"sprite/player/rasters/{raster_name}.png"), asset_stack
)
# "Weird" raster # "Weird" raster
if os.path.getsize(png_path) == 0x10: if os.path.getsize(png_path) == 0x10:
@ -149,7 +152,7 @@ def player_raster_from_xml(xml: ET.Element, back: bool = False) -> PlayerRaster:
) )
def player_xml_to_bytes(xml: ET.Element) -> List[bytes]: def player_xml_to_bytes(xml: ET.Element, asset_stack: Tuple[Path, ...]) -> List[bytes]:
has_back = False has_back = False
out_bytes = b"" out_bytes = b""
@ -229,7 +232,9 @@ def player_xml_to_bytes(xml: ET.Element) -> List[bytes]:
source = palette_xml.attrib["src"] source = palette_xml.attrib["src"]
front_only = bool(palette_xml.get("front_only", False)) front_only = bool(palette_xml.get("front_only", False))
if source not in PALETTE_CACHE: if source not in PALETTE_CACHE:
palette_path = get_asset_path(Path("player/palettes") / source) palette_path = get_asset_path(
Path(f"sprite/player/palettes/{source}"), asset_stack
)
with open(palette_path, "rb") as f: with open(palette_path, "rb") as f:
img = png.Reader(f) img = png.Reader(f)
img.preamble(True) img.preamble(True)
@ -467,11 +472,15 @@ def write_player_sprite_header(
f.write(f"#endif // {ifdef_name}\n") f.write(f"#endif // {ifdef_name}\n")
def build_player_sprites(sprite_order: List[str], build_dir: Path) -> bytes: def build_player_sprites(
sprite_order: List[str], build_dir: Path, asset_stack: Tuple[Path, ...]
) -> bytes:
sprite_bytes: List[bytes] = [] sprite_bytes: List[bytes] = []
for sprite_name in sprite_order: for sprite_name in sprite_order:
sprite_bytes.extend(player_xml_to_bytes(PLAYER_XML_CACHE[sprite_name])) sprite_bytes.extend(
player_xml_to_bytes(PLAYER_XML_CACHE[sprite_name], asset_stack)
)
# Compress sprite bytes # Compress sprite bytes
compressed_sprite_bytes: bytes = b"" compressed_sprite_bytes: bytes = b""
@ -608,27 +617,23 @@ def build_player_rasters(sprite_order: List[str], raster_order: List[str]) -> by
return ret return ret
ASSET_STACK: List[Path]
def build( def build(
out_file: Path, out_file: Path,
player_header_path: Path, player_header_path: Path,
build_dir: Path, build_dir: Path,
asset_stack: List[Path], asset_stack: Tuple[Path, ...],
) -> None: ) -> None:
global ASSET_STACK build_info, player_sprite_order, player_raster_order = get_player_sprite_metadata(
ASSET_STACK = asset_stack asset_stack
)
npc_sprite_order = get_npc_sprite_metadata(asset_stack)
build_info, player_sprite_order, player_raster_order = get_player_sprite_metadata() cache_player_rasters(player_raster_order, asset_stack)
npc_sprite_order = get_npc_sprite_metadata()
cache_player_rasters(player_raster_order)
# Read and cache player XMLs # Read and cache player XMLs
for sprite_name in player_sprite_order: for sprite_name in player_sprite_order:
sprite_xml = ET.parse( sprite_xml = ET.parse(
get_asset_path(Path(f"player/{sprite_name}.xml")) get_asset_path(Path(f"sprite/player/{sprite_name}.xml"), asset_stack)
).getroot() ).getroot()
PLAYER_XML_CACHE[sprite_name] = sprite_xml PLAYER_XML_CACHE[sprite_name] = sprite_xml
@ -637,7 +642,7 @@ def build(
build_info_bytes += b"\0" * (0x10 - len(build_info_bytes)) build_info_bytes += b"\0" * (0x10 - len(build_info_bytes))
player_sprite_bytes = build_player_sprites( player_sprite_bytes = build_player_sprites(
player_sprite_order, build_dir / "player" player_sprite_order, build_dir / "player", asset_stack
) )
player_raster_bytes = build_player_rasters(player_sprite_order, player_raster_order) player_raster_bytes = build_player_rasters(player_sprite_order, player_raster_order)
npc_sprite_bytes = build_npc_sprites(npc_sprite_order, build_dir) npc_sprite_bytes = build_npc_sprites(npc_sprite_order, build_dir)
@ -680,5 +685,5 @@ if __name__ == "__main__":
Path(args.out), Path(args.out),
Path(args.player_header_out), Path(args.player_header_out),
Path(args.build_dir), Path(args.build_dir),
[Path(d) for d in args.asset_stack.split(",")], tuple(Path(d) for d in args.asset_stack.split(",")),
) )

View File

@ -22,6 +22,7 @@ rom_path = root_dir / "ver/current/baserom.z64"
OBJDUMP = "mips-linux-gnu-objdump" OBJDUMP = "mips-linux-gnu-objdump"
@dataclass @dataclass
class Symbol: class Symbol:
name: str name: str
@ -39,7 +40,6 @@ class Symbol:
@dataclass @dataclass
class Bytes: class Bytes:
offset: int
normalized: str normalized: str
bytes: bytes bytes: bytes
@ -60,10 +60,14 @@ def get_all_unmatched_functions():
def get_func_sizes() -> Dict[str, int]: def get_func_sizes() -> Dict[str, int]:
try: try:
result = subprocess.run(['mips-linux-gnu-objdump', '-x', elf_path], stdout=subprocess.PIPE) result = subprocess.run(
["mips-linux-gnu-objdump", "-x", elf_path], stdout=subprocess.PIPE
)
nm_lines = result.stdout.decode().split("\n") nm_lines = result.stdout.decode().split("\n")
except: except:
print(f"Error: Could not run objdump on {elf_path} - make sure that the project is built") print(
f"Error: Could not run objdump on {elf_path} - make sure that the project is built"
)
sys.exit(1) sys.exit(1)
sizes: Dict[str, int] = {} sizes: Dict[str, int] = {}
@ -77,6 +81,7 @@ def get_func_sizes() -> Dict[str, int]:
return sizes return sizes
def get_symbol_bytes(func: str) -> Optional[Bytes]: def get_symbol_bytes(func: str) -> Optional[Bytes]:
if func not in syms or syms[func].rom_end is None: if func not in syms or syms[func].rom_end is None:
return None return None
@ -204,8 +209,15 @@ def get_hashes(bytes: Bytes, window_size: int) -> list[str]:
return ret return ret
def group_matches(query: str, target: str, matches: list[Match], window_size: int, def group_matches(
min: Optional[int], max: Optional[int], contains: Optional[int]) -> list[Result]: query: str,
target: str,
matches: list[Match],
window_size: int,
min: Optional[int],
max: Optional[int],
contains: Optional[int],
) -> list[Result]:
ret = [] ret = []
matches.sort(key=lambda m: m.query_offset) matches.sort(key=lambda m: m.query_offset)
@ -228,7 +240,9 @@ def group_matches(query: str, target: str, matches: list[Match], window_size: in
continue continue
if max is not None and query_start > max: if max is not None and query_start > max:
continue continue
if contains is not None and (query_start > contains or query_start + length < contains): if contains is not None and (
query_start > contains or query_start + length < contains
):
continue continue
ret.append(Result(query, target, query_start, target_start, length)) ret.append(Result(query, target, query_start, target_start, length))
@ -295,8 +309,9 @@ def get_tu_offset(obj_file: Path, symbol: str) -> Optional[int]:
return int(pieces[0], 16) return int(pieces[0], 16)
return None return None
@dataclass @dataclass
class CRange(): class CRange:
start: Optional[int] = None start: Optional[int] = None
end: Optional[int] = None end: Optional[int] = None
start_exact = False start_exact = False
@ -350,7 +365,14 @@ def get_c_range(insn_start: int, insn_end: int, line_numbers: Dict[int, int]) ->
return range return range
def get_matches(query: str, window_size: int, min: Optional[int], max: Optional[int], contains: Optional[int], show_disasm: bool): def get_matches(
query: str,
window_size: int,
min: Optional[int],
max: Optional[int],
contains: Optional[int],
show_disasm: bool,
):
query_bytes: Optional[Bytes] = get_symbol_bytes(query) query_bytes: Optional[Bytes] = get_symbol_bytes(query)
if query_bytes is None: if query_bytes is None:
@ -376,7 +398,9 @@ def get_matches(query: str, window_size: int, min: Optional[int], max: Optional[
if not matches: if not matches:
continue continue
results: list[Result] = group_matches(query, symbol, matches, window_size, min, max, contains) results: list[Result] = group_matches(
query, symbol, matches, window_size, min, max, contains
)
if not results: if not results:
continue continue
@ -408,9 +432,7 @@ def get_matches(query: str, window_size: int, min: Optional[int], max: Optional[
) )
query_str = f"query [{result.query_start}-{result.query_end}]" query_str = f"query [{result.query_start}-{result.query_end}]"
target_str = ( target_str = f"{symbol} [insn {result.target_start}-{result.target_end}] ({result.length} total){target_range_str}"
f"{symbol} [insn {result.target_start}-{result.target_end}] ({result.length} total){target_range_str}"
)
print(f"\t{query_str} matches {target_str}") print(f"\t{query_str} matches {target_str}")
if show_disasm: if show_disasm:
@ -419,12 +441,20 @@ def get_matches(query: str, window_size: int, min: Optional[int], max: Optional[
except ImportError: except ImportError:
print("rabbitizer not found, cannot show disassembly") print("rabbitizer not found, cannot show disassembly")
sys.exit(1) sys.exit(1)
result_query_bytes = query_bytes.bytes[result.query_start * 4 : result.query_end * 4] result_query_bytes = query_bytes.bytes[
result_target_bytes = sym_bytes.bytes[result.target_start * 4 : result.target_end * 4] result.query_start * 4 : result.query_end * 4
]
result_target_bytes = sym_bytes.bytes[
result.target_start * 4 : result.target_end * 4
]
for i in range(0, len(result_query_bytes), 4): for i in range(0, len(result_query_bytes), 4):
q_insn = rabbitizer.Instruction(int.from_bytes(result_query_bytes[i:i+4], "big")) q_insn = rabbitizer.Instruction(
t_insn = rabbitizer.Instruction(int.from_bytes(result_target_bytes[i:i+4], "big")) int.from_bytes(result_query_bytes[i : i + 4], "big")
)
t_insn = rabbitizer.Instruction(
int.from_bytes(result_target_bytes[i : i + 4], "big")
)
print(f"\t\t{q_insn.disassemble():35} | {t_insn.disassemble()}") print(f"\t\t{q_insn.disassemble():35} | {t_insn.disassemble()}")
@ -447,10 +477,30 @@ parser.add_argument(
default=20, default=20,
required=False, required=False,
) )
parser.add_argument("--min", help="lower bound of instruction for matches against query", type=int, required=False) parser.add_argument(
parser.add_argument("--max", help="upper bound of instruction for matches against query", type=int, required=False) "--min",
parser.add_argument("--contains", help="All matches must contain this number'th instruction from the query", type=int, required=False) help="lower bound of instruction for matches against query",
parser.add_argument("--show-disasm", help="Show disassembly of matches", action="store_true", required=False) type=int,
required=False,
)
parser.add_argument(
"--max",
help="upper bound of instruction for matches against query",
type=int,
required=False,
)
parser.add_argument(
"--contains",
help="All matches must contain this number'th instruction from the query",
type=int,
required=False,
)
parser.add_argument(
"--show-disasm",
help="Show disassembly of matches",
action="store_true",
required=False,
)
args = parser.parse_args() args = parser.parse_args()
@ -460,4 +510,11 @@ if __name__ == "__main__":
func_sizes = get_func_sizes() func_sizes = get_func_sizes()
syms = parse_map() syms = parse_map()
do_query(args.query, args.window_size, args.min, args.max, args.contains, args.show_disasm) do_query(
args.query,
args.window_size,
args.min,
args.max,
args.contains,
args.show_disasm,
)

View File

@ -728,86 +728,6 @@ class NpcSprite:
xml.write(str(path / "SpriteSheet.xml"), encoding="unicode") xml.write(str(path / "SpriteSheet.xml"), encoding="unicode")
@staticmethod
def from_dir(path, read_images=True) -> "NpcSprite":
xml = ET.parse(str(path / "SpriteSheet.xml"))
SpriteSheet = xml.getroot()
true_max_components = 0
max_components = int(
SpriteSheet.get("a") or SpriteSheet.get(MAX_COMPONENTS_XML)
) # ignored
num_variations = int(
SpriteSheet.get("b") or SpriteSheet.get(PALETTE_GROUPS_XML)
)
variation_names = SpriteSheet.get("variations", default="").split(",")
palettes = []
palette_names: List[str] = []
for Palette in SpriteSheet.findall("./PaletteList/Palette"):
if read_images:
img = png.Reader(str(path / Palette.get("src")))
img.preamble(True)
palette = img.palette(alpha="force")
palette = palette[0:16]
assert len(palette) == 16
palettes.append(palette)
palette_names.append(
Palette.get("name", Palette.get("src").split(".png")[0])
)
images = []
image_names: List[str] = []
for Raster in SpriteSheet.findall("./RasterList/Raster"):
if read_images:
img_path = str(path / Raster.get("src"))
width, height, raster, info = png.Reader(img_path).read_flat()
palette_index = int(Raster.get("palette"), base=16)
image = NpcRaster(width, height, palette_index, raster)
assert (
image.width % 8
) == 0, f"{img_path} width is not a multiple of 8"
assert (
image.height % 8
) == 0, f"{img_path} height is not a multiple of 8"
images.append(image)
image_names.append(Raster.get("src").split(".png")[0])
animations = []
animation_names: List[str] = []
for Animation in SpriteSheet.findall("./AnimationList/Animation"):
comps: List[AnimComponent] = []
for comp_xml in Animation:
comp: AnimComponent = AnimComponent.from_xml(comp_xml)
comps.append(comp)
animation_names.append(Animation.attrib["name"])
animations.append(comps)
if len(comps) > true_max_components:
true_max_components = len(comps)
max_components = true_max_components
# assert self.max_components == true_max_components, f"{true_max_components} component(s) used, but SpriteSheet.a = {self.max_components}"
return NpcSprite(
max_components,
num_variations,
animations,
palettes,
images,
image_names,
palette_names,
animation_names,
variation_names,
)
class N64SegPm_sprites(N64Segment): class N64SegPm_sprites(N64Segment):
DEFAULT_NPC_SPRITE_NAMES = [f"{i:02X}" for i in range(0xEA)] DEFAULT_NPC_SPRITE_NAMES = [f"{i:02X}" for i in range(0xEA)]
@ -940,7 +860,6 @@ class N64SegPm_sprites(N64Segment):
def get_linker_entries(self): def get_linker_entries(self):
from segtypes.linker_entry import LinkerEntry from segtypes.linker_entry import LinkerEntry
# TODO collect
src_paths = [options.opts.asset_path / "sprite"] src_paths = [options.opts.asset_path / "sprite"]
# for NPC # for NPC

View File

@ -1,320 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_draw_contents_file_info
/* 171AFC 802490DC 27BDFFB0 */ addiu $sp, $sp, -0x50
/* 171B00 802490E0 AFBF004C */ sw $ra, 0x4C($sp)
/* 171B04 802490E4 AFBE0048 */ sw $fp, 0x48($sp)
/* 171B08 802490E8 AFB70044 */ sw $s7, 0x44($sp)
/* 171B0C 802490EC AFB60040 */ sw $s6, 0x40($sp)
/* 171B10 802490F0 AFB5003C */ sw $s5, 0x3C($sp)
/* 171B14 802490F4 AFB40038 */ sw $s4, 0x38($sp)
/* 171B18 802490F8 AFB30034 */ sw $s3, 0x34($sp)
/* 171B1C 802490FC AFB20030 */ sw $s2, 0x30($sp)
/* 171B20 80249100 AFB1002C */ sw $s1, 0x2C($sp)
/* 171B24 80249104 AFB00028 */ sw $s0, 0x28($sp)
/* 171B28 80249108 AFA60058 */ sw $a2, 0x58($sp)
/* 171B2C 8024910C AFA7005C */ sw $a3, 0x5C($sp)
/* 171B30 80249110 3C028007 */ lui $v0, %hi(gSaveSlotHasData)
/* 171B34 80249114 00441021 */ addu $v0, $v0, $a0
/* 171B38 80249118 90423D74 */ lbu $v0, %lo(gSaveSlotHasData)($v0)
/* 171B3C 8024911C 14400008 */ bnez $v0, .Lfilemenu_80249140
/* 171B40 80249120 00041840 */ sll $v1, $a0, 1
/* 171B44 80249124 3C028015 */ lui $v0, %hi(gCurrentLanguage)
/* 171B48 80249128 8C42AE4C */ lw $v0, %lo(gCurrentLanguage)($v0)
/* 171B4C 8024912C 3C108025 */ lui $s0, %hi(D_filemenu_802508E0)
/* 171B50 80249130 02028021 */ addu $s0, $s0, $v0
/* 171B54 80249134 921008E0 */ lbu $s0, %lo(D_filemenu_802508E0)($s0)
/* 171B58 80249138 0809245E */ j .Lfilemenu_80249178
/* 171B5C 8024913C 24040005 */ addiu $a0, $zero, 0x5
.Lfilemenu_80249140:
/* 171B60 80249140 3C028007 */ lui $v0, %hi(gSaveSlotMetadata)
/* 171B64 80249144 24423D14 */ addiu $v0, $v0, %lo(gSaveSlotMetadata)
/* 171B68 80249148 00641821 */ addu $v1, $v1, $a0
/* 171B6C 8024914C 000318C0 */ sll $v1, $v1, 3
/* 171B70 80249150 0062A821 */ addu $s5, $v1, $v0
/* 171B74 80249154 8EA20000 */ lw $v0, 0x0($s5)
/* 171B78 80249158 14400015 */ bnez $v0, .Lfilemenu_802491B0
/* 171B7C 8024915C 3C086666 */ lui $t0, (0x66666667 >> 16)
/* 171B80 80249160 3C028015 */ lui $v0, %hi(gCurrentLanguage)
/* 171B84 80249164 8C42AE4C */ lw $v0, %lo(gCurrentLanguage)($v0)
/* 171B88 80249168 2404000B */ addiu $a0, $zero, 0xB
/* 171B8C 8024916C 3C108025 */ lui $s0, %hi(D_filemenu_802508E4)
/* 171B90 80249170 02028021 */ addu $s0, $s0, $v0
/* 171B94 80249174 921008E4 */ lbu $s0, %lo(D_filemenu_802508E4)($s0)
.Lfilemenu_80249178:
/* 171B98 80249178 0C093A16 */ jal filemenu_get_menu_message
/* 171B9C 8024917C 00000000 */ nop
/* 171BA0 80249180 0040202D */ daddu $a0, $v0, $zero
/* 171BA4 80249184 8FA8005C */ lw $t0, 0x5C($sp)
/* 171BA8 80249188 240700FF */ addiu $a3, $zero, 0xFF
/* 171BAC 8024918C 25060014 */ addiu $a2, $t0, 0x14
/* 171BB0 80249190 8FA80058 */ lw $t0, 0x58($sp)
/* 171BB4 80249194 2402000A */ addiu $v0, $zero, 0xA
/* 171BB8 80249198 AFA20010 */ sw $v0, 0x10($sp)
/* 171BBC 8024919C AFA00014 */ sw $zero, 0x14($sp)
/* 171BC0 802491A0 0C0939C7 */ jal filemenu_draw_message
/* 171BC4 802491A4 01102821 */ addu $a1, $t0, $s0
/* 171BC8 802491A8 0809255B */ j .Lfilemenu_8024956C
/* 171BCC 802491AC 00000000 */ nop
.Lfilemenu_802491B0:
/* 171BD0 802491B0 3C128015 */ lui $s2, %hi(gCurrentLanguage)
/* 171BD4 802491B4 2652AE4C */ addiu $s2, $s2, %lo(gCurrentLanguage)
/* 171BD8 802491B8 8E420000 */ lw $v0, 0x0($s2)
/* 171BDC 802491BC 35086667 */ ori $t0, $t0, (0x66666667 & 0xFFFF)
/* 171BE0 802491C0 AFA80020 */ sw $t0, 0x20($sp)
/* 171BE4 802491C4 3C108025 */ lui $s0, %hi(D_filemenu_802508D8)
/* 171BE8 802491C8 02028021 */ addu $s0, $s0, $v0
/* 171BEC 802491CC 921008D8 */ lbu $s0, %lo(D_filemenu_802508D8)($s0)
/* 171BF0 802491D0 0C093A16 */ jal filemenu_get_menu_message
/* 171BF4 802491D4 24040006 */ addiu $a0, $zero, 0x6
/* 171BF8 802491D8 0040202D */ daddu $a0, $v0, $zero
/* 171BFC 802491DC 8FA8005C */ lw $t0, 0x5C($sp)
/* 171C00 802491E0 240700FF */ addiu $a3, $zero, 0xFF
/* 171C04 802491E4 2511000A */ addiu $s1, $t0, 0xA
/* 171C08 802491E8 2408000A */ addiu $t0, $zero, 0xA
/* 171C0C 802491EC AFA80010 */ sw $t0, 0x10($sp)
/* 171C10 802491F0 24080001 */ addiu $t0, $zero, 0x1
/* 171C14 802491F4 AFA80014 */ sw $t0, 0x14($sp)
/* 171C18 802491F8 8FA80058 */ lw $t0, 0x58($sp)
/* 171C1C 802491FC 0220302D */ daddu $a2, $s1, $zero
/* 171C20 80249200 0C0939C7 */ jal filemenu_draw_message
/* 171C24 80249204 01102821 */ addu $a1, $t0, $s0
/* 171C28 80249208 0220302D */ daddu $a2, $s1, $zero
/* 171C2C 8024920C 24070001 */ addiu $a3, $zero, 0x1
/* 171C30 80249210 8FA80058 */ lw $t0, 0x58($sp)
/* 171C34 80249214 92A20006 */ lbu $v0, 0x6($s5)
/* 171C38 80249218 2505004F */ addiu $a1, $t0, 0x4F
/* 171C3C 8024921C 2408000A */ addiu $t0, $zero, 0xA
/* 171C40 80249220 00021600 */ sll $v0, $v0, 24
/* 171C44 80249224 00029E03 */ sra $s3, $v0, 24
/* 171C48 80249228 AFA80010 */ sw $t0, 0x10($sp)
/* 171C4C 8024922C 8FA80020 */ lw $t0, 0x20($sp)
/* 171C50 80249230 000217C3 */ sra $v0, $v0, 31
/* 171C54 80249234 02680018 */ mult $s3, $t0
/* 171C58 80249238 240800FF */ addiu $t0, $zero, 0xFF
/* 171C5C 8024923C AFA80014 */ sw $t0, 0x14($sp)
/* 171C60 80249240 24080002 */ addiu $t0, $zero, 0x2
/* 171C64 80249244 AFA80018 */ sw $t0, 0x18($sp)
/* 171C68 80249248 00004010 */ mfhi $t0
/* 171C6C 8024924C 00088083 */ sra $s0, $t0, 2
/* 171C70 80249250 02028023 */ subu $s0, $s0, $v0
/* 171C74 80249254 0C04986F */ jal draw_number
/* 171C78 80249258 0200202D */ daddu $a0, $s0, $zero
/* 171C7C 8024925C 00102080 */ sll $a0, $s0, 2
/* 171C80 80249260 00902021 */ addu $a0, $a0, $s0
/* 171C84 80249264 00042040 */ sll $a0, $a0, 1
/* 171C88 80249268 02642023 */ subu $a0, $s3, $a0
/* 171C8C 8024926C 0220302D */ daddu $a2, $s1, $zero
/* 171C90 80249270 8FA80058 */ lw $t0, 0x58($sp)
/* 171C94 80249274 24070001 */ addiu $a3, $zero, 0x1
/* 171C98 80249278 25050058 */ addiu $a1, $t0, 0x58
/* 171C9C 8024927C 2408000A */ addiu $t0, $zero, 0xA
/* 171CA0 80249280 AFA80010 */ sw $t0, 0x10($sp)
/* 171CA4 80249284 240800FF */ addiu $t0, $zero, 0xFF
/* 171CA8 80249288 AFA80014 */ sw $t0, 0x14($sp)
/* 171CAC 8024928C 24080002 */ addiu $t0, $zero, 0x2
/* 171CB0 80249290 0C04986F */ jal draw_number
/* 171CB4 80249294 AFA80018 */ sw $t0, 0x18($sp)
/* 171CB8 80249298 8E420000 */ lw $v0, 0x0($s2)
/* 171CBC 8024929C 3C108025 */ lui $s0, %hi(D_filemenu_802508DC)
/* 171CC0 802492A0 02028021 */ addu $s0, $s0, $v0
/* 171CC4 802492A4 921008DC */ lbu $s0, %lo(D_filemenu_802508DC)($s0)
/* 171CC8 802492A8 0C093A16 */ jal filemenu_get_menu_message
/* 171CCC 802492AC 24040007 */ addiu $a0, $zero, 0x7
/* 171CD0 802492B0 0040202D */ daddu $a0, $v0, $zero
/* 171CD4 802492B4 8FA8005C */ lw $t0, 0x5C($sp)
/* 171CD8 802492B8 240700FF */ addiu $a3, $zero, 0xFF
/* 171CDC 802492BC 251E0018 */ addiu $fp, $t0, 0x18
/* 171CE0 802492C0 2408000A */ addiu $t0, $zero, 0xA
/* 171CE4 802492C4 AFA80010 */ sw $t0, 0x10($sp)
/* 171CE8 802492C8 24080001 */ addiu $t0, $zero, 0x1
/* 171CEC 802492CC AFA80014 */ sw $t0, 0x14($sp)
/* 171CF0 802492D0 8FA80058 */ lw $t0, 0x58($sp)
/* 171CF4 802492D4 03C0302D */ daddu $a2, $fp, $zero
/* 171CF8 802492D8 0C0939C7 */ jal filemenu_draw_message
/* 171CFC 802492DC 01102821 */ addu $a1, $t0, $s0
/* 171D00 802492E0 3C020149 */ lui $v0, (0x14996FF >> 16)
/* 171D04 802492E4 8EB30000 */ lw $s3, 0x0($s5)
/* 171D08 802492E8 344296FF */ ori $v0, $v0, (0x14996FF & 0xFFFF)
/* 171D0C 802492EC 0053102A */ slt $v0, $v0, $s3
/* 171D10 802492F0 10400003 */ beqz $v0, .Lfilemenu_80249300
/* 171D14 802492F4 3C021F11 */ lui $v0, (0x1F11A4A5 >> 16)
/* 171D18 802492F8 3C130149 */ lui $s3, (0x14996FF >> 16)
/* 171D1C 802492FC 367396FF */ ori $s3, $s3, (0x14996FF & 0xFFFF)
.Lfilemenu_80249300:
/* 171D20 80249300 3442A4A5 */ ori $v0, $v0, (0x1F11A4A5 & 0xFFFF)
/* 171D24 80249304 03C0302D */ daddu $a2, $fp, $zero
/* 171D28 80249308 24070001 */ addiu $a3, $zero, 0x1
/* 171D2C 8024930C 0000A02D */ daddu $s4, $zero, $zero
/* 171D30 80249310 24170011 */ addiu $s7, $zero, 0x11
/* 171D34 80249314 2416001C */ addiu $s6, $zero, 0x1C
/* 171D38 80249318 02620018 */ mult $s3, $v0
/* 171D3C 8024931C 8FA80058 */ lw $t0, 0x58($sp)
/* 171D40 80249320 001397C3 */ sra $s2, $s3, 31
/* 171D44 80249324 AFB50024 */ sw $s5, 0x24($sp)
/* 171D48 80249328 3C158025 */ lui $s5, %hi(filemenu_hudElemIDs)
/* 171D4C 8024932C 26B51770 */ addiu $s5, $s5, %lo(filemenu_hudElemIDs)
/* 171D50 80249330 2505004C */ addiu $a1, $t0, 0x4C
/* 171D54 80249334 00004010 */ mfhi $t0
/* 171D58 80249338 00088483 */ sra $s0, $t0, 18
/* 171D5C 8024933C 02128023 */ subu $s0, $s0, $s2
/* 171D60 80249340 8FA80020 */ lw $t0, 0x20($sp)
/* 171D64 80249344 00101FC3 */ sra $v1, $s0, 31
/* 171D68 80249348 02080018 */ mult $s0, $t0
/* 171D6C 8024934C 2408000A */ addiu $t0, $zero, 0xA
/* 171D70 80249350 AFA80010 */ sw $t0, 0x10($sp)
/* 171D74 80249354 240800FF */ addiu $t0, $zero, 0xFF
/* 171D78 80249358 AFA80014 */ sw $t0, 0x14($sp)
/* 171D7C 8024935C 24080002 */ addiu $t0, $zero, 0x2
/* 171D80 80249360 AFA80018 */ sw $t0, 0x18($sp)
/* 171D84 80249364 00004010 */ mfhi $t0
/* 171D88 80249368 00081083 */ sra $v0, $t0, 2
/* 171D8C 8024936C 00431023 */ subu $v0, $v0, $v1
/* 171D90 80249370 00022080 */ sll $a0, $v0, 2
/* 171D94 80249374 00822021 */ addu $a0, $a0, $v0
/* 171D98 80249378 00E42004 */ sllv $a0, $a0, $a3
/* 171D9C 8024937C 0C04986F */ jal draw_number
/* 171DA0 80249380 02042023 */ subu $a0, $s0, $a0
/* 171DA4 80249384 3C029B58 */ lui $v0, (0x9B583739 >> 16)
/* 171DA8 80249388 34423739 */ ori $v0, $v0, (0x9B583739 & 0xFFFF)
/* 171DAC 8024938C 03C0302D */ daddu $a2, $fp, $zero
/* 171DB0 80249390 24070001 */ addiu $a3, $zero, 0x1
/* 171DB4 80249394 00102080 */ sll $a0, $s0, 2
/* 171DB8 80249398 00902021 */ addu $a0, $a0, $s0
/* 171DBC 8024939C 00E42004 */ sllv $a0, $a0, $a3
/* 171DC0 802493A0 8FA80058 */ lw $t0, 0x58($sp)
/* 171DC4 802493A4 02620018 */ mult $s3, $v0
/* 171DC8 802493A8 25050055 */ addiu $a1, $t0, 0x55
/* 171DCC 802493AC 2408000A */ addiu $t0, $zero, 0xA
/* 171DD0 802493B0 AFA80010 */ sw $t0, 0x10($sp)
/* 171DD4 802493B4 240800FF */ addiu $t0, $zero, 0xFF
/* 171DD8 802493B8 AFA80014 */ sw $t0, 0x14($sp)
/* 171DDC 802493BC 24080002 */ addiu $t0, $zero, 0x2
/* 171DE0 802493C0 AFA80018 */ sw $t0, 0x18($sp)
/* 171DE4 802493C4 00004010 */ mfhi $t0
/* 171DE8 802493C8 01138821 */ addu $s1, $t0, $s3
/* 171DEC 802493CC 02F18807 */ srav $s1, $s1, $s7
/* 171DF0 802493D0 02328823 */ subu $s1, $s1, $s2
/* 171DF4 802493D4 0C04986F */ jal draw_number
/* 171DF8 802493D8 02242023 */ subu $a0, $s1, $a0
/* 171DFC 802493DC 0C093A16 */ jal filemenu_get_menu_message
/* 171E00 802493E0 2404000C */ addiu $a0, $zero, 0xC
/* 171E04 802493E4 0040202D */ daddu $a0, $v0, $zero
/* 171E08 802493E8 8FA80058 */ lw $t0, 0x58($sp)
/* 171E0C 802493EC 240700FF */ addiu $a3, $zero, 0xFF
/* 171E10 802493F0 2510005F */ addiu $s0, $t0, 0x5F
/* 171E14 802493F4 8FA8005C */ lw $t0, 0x5C($sp)
/* 171E18 802493F8 0200282D */ daddu $a1, $s0, $zero
/* 171E1C 802493FC 25060017 */ addiu $a2, $t0, 0x17
/* 171E20 80249400 2408000A */ addiu $t0, $zero, 0xA
/* 171E24 80249404 AFA80010 */ sw $t0, 0x10($sp)
/* 171E28 80249408 24080001 */ addiu $t0, $zero, 0x1
/* 171E2C 8024940C 0C0939C7 */ jal filemenu_draw_message
/* 171E30 80249410 AFA80014 */ sw $t0, 0x14($sp)
/* 171E34 80249414 0C093A16 */ jal filemenu_get_menu_message
/* 171E38 80249418 2404000C */ addiu $a0, $zero, 0xC
/* 171E3C 8024941C 0040202D */ daddu $a0, $v0, $zero
/* 171E40 80249420 0200282D */ daddu $a1, $s0, $zero
/* 171E44 80249424 8FA8005C */ lw $t0, 0x5C($sp)
/* 171E48 80249428 240700FF */ addiu $a3, $zero, 0xFF
/* 171E4C 8024942C 25060012 */ addiu $a2, $t0, 0x12
/* 171E50 80249430 2408000A */ addiu $t0, $zero, 0xA
/* 171E54 80249434 AFA80010 */ sw $t0, 0x10($sp)
/* 171E58 80249438 24080001 */ addiu $t0, $zero, 0x1
/* 171E5C 8024943C 0C0939C7 */ jal filemenu_draw_message
/* 171E60 80249440 AFA80014 */ sw $t0, 0x14($sp)
/* 171E64 80249444 3C027482 */ lui $v0, (0x7482296B >> 16)
/* 171E68 80249448 3442296B */ ori $v0, $v0, (0x7482296B & 0xFFFF)
/* 171E6C 8024944C 03C0302D */ daddu $a2, $fp, $zero
/* 171E70 80249450 24070001 */ addiu $a3, $zero, 0x1
/* 171E74 80249454 00F12004 */ sllv $a0, $s1, $a3
/* 171E78 80249458 00912021 */ addu $a0, $a0, $s1
/* 171E7C 8024945C 00E42004 */ sllv $a0, $a0, $a3
/* 171E80 80249460 8FA80058 */ lw $t0, 0x58($sp)
/* 171E84 80249464 02620018 */ mult $s3, $v0
/* 171E88 80249468 25050064 */ addiu $a1, $t0, 0x64
/* 171E8C 8024946C 2408000A */ addiu $t0, $zero, 0xA
/* 171E90 80249470 AFA80010 */ sw $t0, 0x10($sp)
/* 171E94 80249474 240800FF */ addiu $t0, $zero, 0xFF
/* 171E98 80249478 AFA80014 */ sw $t0, 0x14($sp)
/* 171E9C 8024947C 24080002 */ addiu $t0, $zero, 0x2
/* 171EA0 80249480 AFA80018 */ sw $t0, 0x18($sp)
/* 171EA4 80249484 00004010 */ mfhi $t0
/* 171EA8 80249488 00088383 */ sra $s0, $t0, 14
/* 171EAC 8024948C 02128023 */ subu $s0, $s0, $s2
/* 171EB0 80249490 0C04986F */ jal draw_number
/* 171EB4 80249494 02042023 */ subu $a0, $s0, $a0
/* 171EB8 80249498 3C0291A2 */ lui $v0, (0x91A2B3C5 >> 16)
/* 171EBC 8024949C 3442B3C5 */ ori $v0, $v0, (0x91A2B3C5 & 0xFFFF)
/* 171EC0 802494A0 03C0302D */ daddu $a2, $fp, $zero
/* 171EC4 802494A4 24070001 */ addiu $a3, $zero, 0x1
/* 171EC8 802494A8 00102080 */ sll $a0, $s0, 2
/* 171ECC 802494AC 00902021 */ addu $a0, $a0, $s0
/* 171ED0 802494B0 00E42004 */ sllv $a0, $a0, $a3
/* 171ED4 802494B4 8FA80058 */ lw $t0, 0x58($sp)
/* 171ED8 802494B8 02620018 */ mult $s3, $v0
/* 171EDC 802494BC 2505006D */ addiu $a1, $t0, 0x6D
/* 171EE0 802494C0 2408000A */ addiu $t0, $zero, 0xA
/* 171EE4 802494C4 AFA80010 */ sw $t0, 0x10($sp)
/* 171EE8 802494C8 240800FF */ addiu $t0, $zero, 0xFF
/* 171EEC 802494CC AFA80014 */ sw $t0, 0x14($sp)
/* 171EF0 802494D0 24080002 */ addiu $t0, $zero, 0x2
/* 171EF4 802494D4 AFA80018 */ sw $t0, 0x18($sp)
/* 171EF8 802494D8 00004010 */ mfhi $t0
/* 171EFC 802494DC 01131021 */ addu $v0, $t0, $s3
/* 171F00 802494E0 000212C3 */ sra $v0, $v0, 11
/* 171F04 802494E4 00521023 */ subu $v0, $v0, $s2
/* 171F08 802494E8 0C04986F */ jal draw_number
/* 171F0C 802494EC 00442023 */ subu $a0, $v0, $a0
.Lfilemenu_802494F0:
/* 171F10 802494F0 8FA80024 */ lw $t0, 0x24($sp)
/* 171F14 802494F4 91020004 */ lbu $v0, 0x4($t0)
/* 171F18 802494F8 0282102A */ slt $v0, $s4, $v0
/* 171F1C 802494FC 10400003 */ beqz $v0, .Lfilemenu_8024950C
/* 171F20 80249500 00000000 */ nop
/* 171F24 80249504 08092547 */ j .Lfilemenu_8024951C
/* 171F28 80249508 8EB00000 */ lw $s0, 0x0($s5)
.Lfilemenu_8024950C:
/* 171F2C 8024950C 3C088025 */ lui $t0, %hi(filemenu_hudElemIDs)
/* 171F30 80249510 25081770 */ addiu $t0, $t0, %lo(filemenu_hudElemIDs)
/* 171F34 80249514 02C81021 */ addu $v0, $s6, $t0
/* 171F38 80249518 8C500000 */ lw $s0, 0x0($v0)
.Lfilemenu_8024951C:
/* 171F3C 8024951C 8FA80058 */ lw $t0, 0x58($sp)
/* 171F40 80249520 01172821 */ addu $a1, $t0, $s7
/* 171F44 80249524 8FA8005C */ lw $t0, 0x5C($sp)
/* 171F48 80249528 0200202D */ daddu $a0, $s0, $zero
/* 171F4C 8024952C 0C050D4D */ jal hud_element_set_render_pos
/* 171F50 80249530 2506002C */ addiu $a2, $t0, 0x2C
/* 171F54 80249534 16800005 */ bnez $s4, .Lfilemenu_8024954C
/* 171F58 80249538 00000000 */ nop
/* 171F5C 8024953C 0C050CE4 */ jal hud_element_draw_without_clipping
/* 171F60 80249540 0200202D */ daddu $a0, $s0, $zero
/* 171F64 80249544 08092556 */ j .Lfilemenu_80249558
/* 171F68 80249548 26F70010 */ addiu $s7, $s7, 0x10
.Lfilemenu_8024954C:
/* 171F6C 8024954C 0C050CDD */ jal hud_element_draw_next
/* 171F70 80249550 0200202D */ daddu $a0, $s0, $zero
/* 171F74 80249554 26F70010 */ addiu $s7, $s7, 0x10
.Lfilemenu_80249558:
/* 171F78 80249558 26D60004 */ addiu $s6, $s6, 0x4
/* 171F7C 8024955C 26940001 */ addiu $s4, $s4, 0x1
/* 171F80 80249560 2A820007 */ slti $v0, $s4, 0x7
/* 171F84 80249564 1440FFE2 */ bnez $v0, .Lfilemenu_802494F0
/* 171F88 80249568 26B50004 */ addiu $s5, $s5, 0x4
.Lfilemenu_8024956C:
/* 171F8C 8024956C 8FBF004C */ lw $ra, 0x4C($sp)
/* 171F90 80249570 8FBE0048 */ lw $fp, 0x48($sp)
/* 171F94 80249574 8FB70044 */ lw $s7, 0x44($sp)
/* 171F98 80249578 8FB60040 */ lw $s6, 0x40($sp)
/* 171F9C 8024957C 8FB5003C */ lw $s5, 0x3C($sp)
/* 171FA0 80249580 8FB40038 */ lw $s4, 0x38($sp)
/* 171FA4 80249584 8FB30034 */ lw $s3, 0x34($sp)
/* 171FA8 80249588 8FB20030 */ lw $s2, 0x30($sp)
/* 171FAC 8024958C 8FB1002C */ lw $s1, 0x2C($sp)
/* 171FB0 80249590 8FB00028 */ lw $s0, 0x28($sp)
/* 171FB4 80249594 03E00008 */ jr $ra
/* 171FB8 80249598 27BD0050 */ addiu $sp, $sp, 0x50

View File

@ -1,107 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_draw_contents_file_title
/* 171FBC 8024959C 3C028025 */ lui $v0, %hi(filemenu_currentMenu)
/* 171FC0 802495A0 80421758 */ lb $v0, %lo(filemenu_currentMenu)($v0)
/* 171FC4 802495A4 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 171FC8 802495A8 AFB20028 */ sw $s2, 0x28($sp)
/* 171FCC 802495AC 0080902D */ daddu $s2, $a0, $zero
/* 171FD0 802495B0 AFB50034 */ sw $s5, 0x34($sp)
/* 171FD4 802495B4 00C0A82D */ daddu $s5, $a2, $zero
/* 171FD8 802495B8 AFB00020 */ sw $s0, 0x20($sp)
/* 171FDC 802495BC 00E0802D */ daddu $s0, $a3, $zero
/* 171FE0 802495C0 AFBF0038 */ sw $ra, 0x38($sp)
/* 171FE4 802495C4 AFB40030 */ sw $s4, 0x30($sp)
/* 171FE8 802495C8 AFB3002C */ sw $s3, 0x2C($sp)
/* 171FEC 802495CC 14400007 */ bnez $v0, .Lfilemenu_802495EC
/* 171FF0 802495D0 AFB10024 */ sw $s1, 0x24($sp)
/* 171FF4 802495D4 90A20003 */ lbu $v0, 0x3($a1)
/* 171FF8 802495D8 14520004 */ bne $v0, $s2, .Lfilemenu_802495EC
/* 171FFC 802495DC 2644003C */ addiu $a0, $s2, 0x3C
/* 172000 802495E0 26A5FFFD */ addiu $a1, $s5, -0x3
/* 172004 802495E4 0C091B44 */ jal filemenu_set_cursor_goal_pos
/* 172008 802495E8 26060008 */ addiu $a2, $s0, 0x8
.Lfilemenu_802495EC:
/* 17200C 802495EC 0C093A16 */ jal filemenu_get_menu_message
/* 172010 802495F0 24040014 */ addiu $a0, $zero, 0x14
/* 172014 802495F4 0040202D */ daddu $a0, $v0, $zero
/* 172018 802495F8 26A50005 */ addiu $a1, $s5, 0x5
/* 17201C 802495FC 26130001 */ addiu $s3, $s0, 0x1
/* 172020 80249600 0260302D */ daddu $a2, $s3, $zero
/* 172024 80249604 240700FF */ addiu $a3, $zero, 0xFF
/* 172028 80249608 24140001 */ addiu $s4, $zero, 0x1
/* 17202C 8024960C AFA00010 */ sw $zero, 0x10($sp)
/* 172030 80249610 0C0939C7 */ jal filemenu_draw_message
/* 172034 80249614 AFB40014 */ sw $s4, 0x14($sp)
/* 172038 80249618 3C028007 */ lui $v0, %hi(gSaveSlotHasData)
/* 17203C 8024961C 00521021 */ addu $v0, $v0, $s2
/* 172040 80249620 90423D74 */ lbu $v0, %lo(gSaveSlotHasData)($v0)
/* 172044 80249624 14400011 */ bnez $v0, .Lfilemenu_8024966C
/* 172048 80249628 00000000 */ nop
/* 17204C 8024962C 0C093A16 */ jal filemenu_get_menu_message
/* 172050 80249630 26440024 */ addiu $a0, $s2, 0x24
/* 172054 80249634 0040202D */ daddu $a0, $v0, $zero
/* 172058 80249638 3C028015 */ lui $v0, %hi(gCurrentLanguage)
/* 17205C 8024963C 8C42AE4C */ lw $v0, %lo(gCurrentLanguage)($v0)
/* 172060 80249640 0260302D */ daddu $a2, $s3, $zero
/* 172064 80249644 3C058025 */ lui $a1, %hi(D_filemenu_802508D0)
/* 172068 80249648 00A22821 */ addu $a1, $a1, $v0
/* 17206C 8024964C 90A508D0 */ lbu $a1, %lo(D_filemenu_802508D0)($a1)
/* 172070 80249650 240700FF */ addiu $a3, $zero, 0xFF
/* 172074 80249654 AFA00010 */ sw $zero, 0x10($sp)
/* 172078 80249658 AFB40014 */ sw $s4, 0x14($sp)
/* 17207C 8024965C 0C0939C7 */ jal filemenu_draw_message
/* 172080 80249660 02A52821 */ addu $a1, $s5, $a1
/* 172084 80249664 080925C0 */ j .Lfilemenu_80249700
/* 172088 80249668 00000000 */ nop
.Lfilemenu_8024966C:
/* 17208C 8024966C 3C118015 */ lui $s1, %hi(gCurrentLanguage)
/* 172090 80249670 2631AE4C */ addiu $s1, $s1, %lo(gCurrentLanguage)
/* 172094 80249674 8E220000 */ lw $v0, 0x0($s1)
/* 172098 80249678 3C108025 */ lui $s0, %hi(D_filemenu_802508D0)
/* 17209C 8024967C 02028021 */ addu $s0, $s0, $v0
/* 1720A0 80249680 921008D0 */ lbu $s0, %lo(D_filemenu_802508D0)($s0)
/* 1720A4 80249684 0C093A16 */ jal filemenu_get_menu_message
/* 1720A8 80249688 26440024 */ addiu $a0, $s2, 0x24
/* 1720AC 8024968C 0040202D */ daddu $a0, $v0, $zero
/* 1720B0 80249690 0260302D */ daddu $a2, $s3, $zero
/* 1720B4 80249694 240700FF */ addiu $a3, $zero, 0xFF
/* 1720B8 80249698 AFA00010 */ sw $zero, 0x10($sp)
/* 1720BC 8024969C AFB40014 */ sw $s4, 0x14($sp)
/* 1720C0 802496A0 0C0939C7 */ jal filemenu_draw_message
/* 1720C4 802496A4 02B02821 */ addu $a1, $s5, $s0
/* 1720C8 802496A8 00122040 */ sll $a0, $s2, 1
/* 1720CC 802496AC 00922021 */ addu $a0, $a0, $s2
/* 1720D0 802496B0 000420C0 */ sll $a0, $a0, 3
/* 1720D4 802496B4 3C028007 */ lui $v0, %hi(gSaveSlotMetadata+0x7)
/* 1720D8 802496B8 24423D1B */ addiu $v0, $v0, %lo(gSaveSlotMetadata+0x7)
/* 1720DC 802496BC 00822021 */ addu $a0, $a0, $v0
/* 1720E0 802496C0 24050008 */ addiu $a1, $zero, 0x8
/* 1720E4 802496C4 8E220000 */ lw $v0, 0x0($s1)
/* 1720E8 802496C8 0260382D */ daddu $a3, $s3, $zero
/* 1720EC 802496CC 3C038025 */ lui $v1, %hi(D_filemenu_802508D4)
/* 1720F0 802496D0 00621821 */ addu $v1, $v1, $v0
/* 1720F4 802496D4 906308D4 */ lbu $v1, %lo(D_filemenu_802508D4)($v1)
/* 1720F8 802496D8 240200FF */ addiu $v0, $zero, 0xFF
/* 1720FC 802496DC AFA20010 */ sw $v0, 0x10($sp)
/* 172100 802496E0 24020009 */ addiu $v0, $zero, 0x9
/* 172104 802496E4 AFA00014 */ sw $zero, 0x14($sp)
/* 172108 802496E8 AFB40018 */ sw $s4, 0x18($sp)
/* 17210C 802496EC AFA2001C */ sw $v0, 0x1C($sp)
/* 172110 802496F0 02038021 */ addu $s0, $s0, $v1
/* 172114 802496F4 26100006 */ addiu $s0, $s0, 0x6
/* 172118 802496F8 0C093A20 */ jal filemenu_draw_file_name
/* 17211C 802496FC 02B03021 */ addu $a2, $s5, $s0
.Lfilemenu_80249700:
/* 172120 80249700 8FBF0038 */ lw $ra, 0x38($sp)
/* 172124 80249704 8FB50034 */ lw $s5, 0x34($sp)
/* 172128 80249708 8FB40030 */ lw $s4, 0x30($sp)
/* 17212C 8024970C 8FB3002C */ lw $s3, 0x2C($sp)
/* 172130 80249710 8FB20028 */ lw $s2, 0x28($sp)
/* 172134 80249714 8FB10024 */ lw $s1, 0x24($sp)
/* 172138 80249718 8FB00020 */ lw $s0, 0x20($sp)
/* 17213C 8024971C 03E00008 */ jr $ra
/* 172140 80249720 27BD0040 */ addiu $sp, $sp, 0x40

View File

@ -1,75 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_draw_contents_option_center
/* 171954 80248F34 27BDFFD0 */ addiu $sp, $sp, -0x30
/* 171958 80248F38 0080382D */ daddu $a3, $a0, $zero
/* 17195C 80248F3C AFB1001C */ sw $s1, 0x1C($sp)
/* 171960 80248F40 00A0882D */ daddu $s1, $a1, $zero
/* 171964 80248F44 AFBF002C */ sw $ra, 0x2C($sp)
/* 171968 80248F48 AFB40028 */ sw $s4, 0x28($sp)
/* 17196C 80248F4C AFB30024 */ sw $s3, 0x24($sp)
/* 171970 80248F50 AFB20020 */ sw $s2, 0x20($sp)
/* 171974 80248F54 AFB00018 */ sw $s0, 0x18($sp)
/* 171978 80248F58 80E30004 */ lb $v1, 0x4($a3)
/* 17197C 80248F5C 28620004 */ slti $v0, $v1, 0x4
/* 171980 80248F60 10400010 */ beqz $v0, .Lfilemenu_80248FA4
/* 171984 80248F64 00C0902D */ daddu $s2, $a2, $zero
/* 171988 80248F68 1860000E */ blez $v1, .Lfilemenu_80248FA4
/* 17198C 80248F6C 24130009 */ addiu $s3, $zero, 0x9
/* 171990 80248F70 0000A02D */ daddu $s4, $zero, $zero
/* 171994 80248F74 3C0500FF */ lui $a1, (0xFFFF00 >> 16)
/* 171998 80248F78 34A5FF00 */ ori $a1, $a1, (0xFFFF00 & 0xFFFF)
/* 17199C 80248F7C 3C040001 */ lui $a0, (0x10200 >> 16)
/* 1719A0 80248F80 34840200 */ ori $a0, $a0, (0x10200 & 0xFFFF)
/* 1719A4 80248F84 8CE20000 */ lw $v0, 0x0($a3)
/* 1719A8 80248F88 3C038015 */ lui $v1, %hi(gCurrentLanguage)
/* 1719AC 80248F8C 8C63AE4C */ lw $v1, %lo(gCurrentLanguage)($v1)
/* 1719B0 80248F90 3C108025 */ lui $s0, %hi(D_filemenu_802508F4)
/* 1719B4 80248F94 02038021 */ addu $s0, $s0, $v1
/* 1719B8 80248F98 921008F4 */ lbu $s0, %lo(D_filemenu_802508F4)($s0)
/* 1719BC 80248F9C 080923F6 */ j .Lfilemenu_80248FD8
/* 1719C0 80248FA0 00451024 */ and $v0, $v0, $a1
.Lfilemenu_80248FA4:
/* 1719C4 80248FA4 2413000A */ addiu $s3, $zero, 0xA
/* 1719C8 80248FA8 0000A02D */ daddu $s4, $zero, $zero
/* 1719CC 80248FAC 3C0500FF */ lui $a1, (0xFFFF00 >> 16)
/* 1719D0 80248FB0 34A5FF00 */ ori $a1, $a1, (0xFFFF00 & 0xFFFF)
/* 1719D4 80248FB4 3C040001 */ lui $a0, (0x10200 >> 16)
/* 1719D8 80248FB8 34840200 */ ori $a0, $a0, (0x10200 & 0xFFFF)
/* 1719DC 80248FBC 8CE20000 */ lw $v0, 0x0($a3)
/* 1719E0 80248FC0 3C038015 */ lui $v1, %hi(gCurrentLanguage)
/* 1719E4 80248FC4 8C63AE4C */ lw $v1, %lo(gCurrentLanguage)($v1)
/* 1719E8 80248FC8 00451024 */ and $v0, $v0, $a1
/* 1719EC 80248FCC 3C108025 */ lui $s0, %hi(D_filemenu_802508EC)
/* 1719F0 80248FD0 02038021 */ addu $s0, $s0, $v1
/* 1719F4 80248FD4 921008EC */ lbu $s0, %lo(D_filemenu_802508EC)($s0)
.Lfilemenu_80248FD8:
/* 1719F8 80248FD8 14440005 */ bne $v0, $a0, .Lfilemenu_80248FF0
/* 1719FC 80248FDC 24040036 */ addiu $a0, $zero, 0x36
/* 171A00 80248FE0 02302821 */ addu $a1, $s1, $s0
/* 171A04 80248FE4 24A5FFF6 */ addiu $a1, $a1, -0xA
/* 171A08 80248FE8 0C091B44 */ jal filemenu_set_cursor_goal_pos
/* 171A0C 80248FEC 26460008 */ addiu $a2, $s2, 0x8
.Lfilemenu_80248FF0:
/* 171A10 80248FF0 0C093A16 */ jal filemenu_get_menu_message
/* 171A14 80248FF4 0260202D */ daddu $a0, $s3, $zero
/* 171A18 80248FF8 0040202D */ daddu $a0, $v0, $zero
/* 171A1C 80248FFC 02302821 */ addu $a1, $s1, $s0
/* 171A20 80249000 02543021 */ addu $a2, $s2, $s4
/* 171A24 80249004 24C60002 */ addiu $a2, $a2, 0x2
/* 171A28 80249008 24020001 */ addiu $v0, $zero, 0x1
/* 171A2C 8024900C 240700FF */ addiu $a3, $zero, 0xFF
/* 171A30 80249010 AFA00010 */ sw $zero, 0x10($sp)
/* 171A34 80249014 0C0939C7 */ jal filemenu_draw_message
/* 171A38 80249018 AFA20014 */ sw $v0, 0x14($sp)
/* 171A3C 8024901C 8FBF002C */ lw $ra, 0x2C($sp)
/* 171A40 80249020 8FB40028 */ lw $s4, 0x28($sp)
/* 171A44 80249024 8FB30024 */ lw $s3, 0x24($sp)
/* 171A48 80249028 8FB20020 */ lw $s2, 0x20($sp)
/* 171A4C 8024902C 8FB1001C */ lw $s1, 0x1C($sp)
/* 171A50 80249030 8FB00018 */ lw $s0, 0x18($sp)
/* 171A54 80249034 03E00008 */ jr $ra
/* 171A58 80249038 27BD0030 */ addiu $sp, $sp, 0x30

View File

@ -1,145 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_main_init
/* 1723C4 802499A4 27BDFFD8 */ addiu $sp, $sp, -0x28
/* 1723C8 802499A8 AFB20018 */ sw $s2, 0x18($sp)
/* 1723CC 802499AC 0080902D */ daddu $s2, $a0, $zero
/* 1723D0 802499B0 AFB00010 */ sw $s0, 0x10($sp)
/* 1723D4 802499B4 0000802D */ daddu $s0, $zero, $zero
/* 1723D8 802499B8 AFB3001C */ sw $s3, 0x1C($sp)
/* 1723DC 802499BC 3C138025 */ lui $s3, %hi(filemenu_main_hudElemScripts)
/* 1723E0 802499C0 2673EC60 */ addiu $s3, $s3, %lo(filemenu_main_hudElemScripts)
/* 1723E4 802499C4 AFB10014 */ sw $s1, 0x14($sp)
/* 1723E8 802499C8 3C118025 */ lui $s1, %hi(filemenu_hudElemIDs)
/* 1723EC 802499CC 26311770 */ addiu $s1, $s1, %lo(filemenu_hudElemIDs)
/* 1723F0 802499D0 AFBF0020 */ sw $ra, 0x20($sp)
.Lfilemenu_802499D4:
/* 1723F4 802499D4 3C048015 */ lui $a0, %hi(gCurrentLanguage)
/* 1723F8 802499D8 8C84AE4C */ lw $a0, %lo(gCurrentLanguage)($a0)
/* 1723FC 802499DC 00101880 */ sll $v1, $s0, 2
/* 172400 802499E0 00041080 */ sll $v0, $a0, 2
/* 172404 802499E4 00441021 */ addu $v0, $v0, $a0
/* 172408 802499E8 00021100 */ sll $v0, $v0, 4
/* 17240C 802499EC 00621821 */ addu $v1, $v1, $v0
/* 172410 802499F0 00731821 */ addu $v1, $v1, $s3
/* 172414 802499F4 8C640000 */ lw $a0, 0x0($v1)
/* 172418 802499F8 0C050015 */ jal hud_element_create
/* 17241C 802499FC 26100001 */ addiu $s0, $s0, 0x1
/* 172420 80249A00 0040202D */ daddu $a0, $v0, $zero
/* 172424 80249A04 24050080 */ addiu $a1, $zero, 0x80
/* 172428 80249A08 0C050D6C */ jal hud_element_set_flags
/* 17242C 80249A0C AE240000 */ sw $a0, 0x0($s1)
/* 172430 80249A10 2A020014 */ slti $v0, $s0, 0x14
/* 172434 80249A14 1440FFEF */ bnez $v0, .Lfilemenu_802499D4
/* 172438 80249A18 26310004 */ addiu $s1, $s1, 0x4
/* 17243C 80249A1C 2410000D */ addiu $s0, $zero, 0xD
/* 172440 80249A20 3C028025 */ lui $v0, %hi(filemenu_main_windowBPs+0x1D4)
/* 172444 80249A24 2442EF98 */ addiu $v0, $v0, %lo(filemenu_main_windowBPs+0x1D4)
.Lfilemenu_80249A28:
/* 172448 80249A28 AC520010 */ sw $s2, 0x10($v0)
/* 17244C 80249A2C 2610FFFF */ addiu $s0, $s0, -0x1
/* 172450 80249A30 0601FFFD */ bgez $s0, .Lfilemenu_80249A28
/* 172454 80249A34 2442FFDC */ addiu $v0, $v0, -0x24
/* 172458 80249A38 3C048025 */ lui $a0, %hi(filemenu_main_windowBPs)
/* 17245C 80249A3C 2484EDC4 */ addiu $a0, $a0, %lo(filemenu_main_windowBPs)
/* 172460 80249A40 0C051AB8 */ jal setup_pause_menu_tab
/* 172464 80249A44 2405000E */ addiu $a1, $zero, 0xE
/* 172468 80249A48 82420004 */ lb $v0, 0x4($s2)
/* 17246C 80249A4C 82430005 */ lb $v1, 0x5($s2)
/* 172470 80249A50 00430018 */ mult $v0, $v1
/* 172474 80249A54 00003012 */ mflo $a2
/* 172478 80249A58 82420006 */ lb $v0, 0x6($s2)
/* 17247C 80249A5C 00000000 */ nop
/* 172480 80249A60 00C20018 */ mult $a2, $v0
/* 172484 80249A64 00002012 */ mflo $a0
/* 172488 80249A68 82420002 */ lb $v0, 0x2($s2)
/* 17248C 80249A6C 00000000 */ nop
/* 172490 80249A70 00620018 */ mult $v1, $v0
/* 172494 80249A74 00001812 */ mflo $v1
/* 172498 80249A78 00831821 */ addu $v1, $a0, $v1
/* 17249C 80249A7C 82440001 */ lb $a0, 0x1($s2)
/* 1724A0 80249A80 8E420008 */ lw $v0, 0x8($s2)
/* 1724A4 80249A84 00641821 */ addu $v1, $v1, $a0
/* 1724A8 80249A88 00431021 */ addu $v0, $v0, $v1
/* 1724AC 80249A8C 3C048016 */ lui $a0, %hi(gWindows)
/* 1724B0 80249A90 24848910 */ addiu $a0, $a0, %lo(gWindows)
/* 1724B4 80249A94 90420000 */ lbu $v0, 0x0($v0)
/* 1724B8 80249A98 A2420003 */ sb $v0, 0x3($s2)
/* 1724BC 80249A9C 808305A3 */ lb $v1, 0x5A3($a0)
/* 1724C0 80249AA0 24020001 */ addiu $v0, $zero, 0x1
/* 1724C4 80249AA4 A48205AE */ sh $v0, 0x5AE($a0)
/* 1724C8 80249AA8 240200A2 */ addiu $v0, $zero, 0xA2
/* 1724CC 80249AAC A48205B0 */ sh $v0, 0x5B0($a0)
/* 1724D0 80249AB0 24020019 */ addiu $v0, $zero, 0x19
/* 1724D4 80249AB4 A48205B2 */ sh $v0, 0x5B2($a0)
/* 1724D8 80249AB8 2402FFFF */ addiu $v0, $zero, -0x1
/* 1724DC 80249ABC 1062000B */ beq $v1, $v0, .Lfilemenu_80249AEC
/* 1724E0 80249AC0 248505AC */ addiu $a1, $a0, 0x5AC
/* 1724E4 80249AC4 00031140 */ sll $v0, $v1, 5
/* 1724E8 80249AC8 00441021 */ addu $v0, $v0, $a0
/* 1724EC 80249ACC 94420010 */ lhu $v0, 0x10($v0)
/* 1724F0 80249AD0 00021400 */ sll $v0, $v0, 16
/* 1724F4 80249AD4 00021C03 */ sra $v1, $v0, 16
/* 1724F8 80249AD8 000217C2 */ srl $v0, $v0, 31
/* 1724FC 80249ADC 00621821 */ addu $v1, $v1, $v0
/* 172500 80249AE0 00031843 */ sra $v1, $v1, 1
/* 172504 80249AE4 080926BE */ j .Lfilemenu_80249AF8
/* 172508 80249AE8 2463FFAF */ addiu $v1, $v1, -0x51
.Lfilemenu_80249AEC:
/* 17250C 80249AEC 2403004F */ addiu $v1, $zero, 0x4F
/* 172510 80249AF0 3C048016 */ lui $a0, %hi(gWindows)
/* 172514 80249AF4 24848910 */ addiu $a0, $a0, %lo(gWindows)
.Lfilemenu_80249AF8:
/* 172518 80249AF8 A4A30000 */ sh $v1, 0x0($a1)
/* 17251C 80249AFC 948206D0 */ lhu $v0, 0x6D0($a0)
/* 172520 80249B00 00021400 */ sll $v0, $v0, 16
/* 172524 80249B04 00021C03 */ sra $v1, $v0, 16
/* 172528 80249B08 000217C2 */ srl $v0, $v0, 31
/* 17252C 80249B0C 00621821 */ addu $v1, $v1, $v0
/* 172530 80249B10 00032843 */ sra $a1, $v1, 1
/* 172534 80249B14 808306C3 */ lb $v1, 0x6C3($a0)
/* 172538 80249B18 2402FFFF */ addiu $v0, $zero, -0x1
/* 17253C 80249B1C 1062000B */ beq $v1, $v0, .Lfilemenu_80249B4C
/* 172540 80249B20 248606CC */ addiu $a2, $a0, 0x6CC
/* 172544 80249B24 00031140 */ sll $v0, $v1, 5
/* 172548 80249B28 00441021 */ addu $v0, $v0, $a0
/* 17254C 80249B2C 94420010 */ lhu $v0, 0x10($v0)
/* 172550 80249B30 00021400 */ sll $v0, $v0, 16
/* 172554 80249B34 00021C03 */ sra $v1, $v0, 16
/* 172558 80249B38 000217C2 */ srl $v0, $v0, 31
/* 17255C 80249B3C 00621821 */ addu $v1, $v1, $v0
/* 172560 80249B40 00031843 */ sra $v1, $v1, 1
/* 172564 80249B44 080926D5 */ j .Lfilemenu_80249B54
/* 172568 80249B48 00651023 */ subu $v0, $v1, $a1
.Lfilemenu_80249B4C:
/* 17256C 80249B4C 240200A0 */ addiu $v0, $zero, 0xA0
/* 172570 80249B50 00451023 */ subu $v0, $v0, $a1
.Lfilemenu_80249B54:
/* 172574 80249B54 A4C20000 */ sh $v0, 0x0($a2)
/* 172578 80249B58 82420004 */ lb $v0, 0x4($s2)
/* 17257C 80249B5C 1040000C */ beqz $v0, .Lfilemenu_80249B90
/* 172580 80249B60 24040035 */ addiu $a0, $zero, 0x35
/* 172584 80249B64 0C051A8B */ jal set_window_update
/* 172588 80249B68 24050002 */ addiu $a1, $zero, 0x2
/* 17258C 80249B6C 24040037 */ addiu $a0, $zero, 0x37
/* 172590 80249B70 0C051A8B */ jal set_window_update
/* 172594 80249B74 24050002 */ addiu $a1, $zero, 0x2
/* 172598 80249B78 24040033 */ addiu $a0, $zero, 0x33
/* 17259C 80249B7C 0C051A8B */ jal set_window_update
/* 1725A0 80249B80 24050002 */ addiu $a1, $zero, 0x2
/* 1725A4 80249B84 24040034 */ addiu $a0, $zero, 0x34
/* 1725A8 80249B88 0C051A8B */ jal set_window_update
/* 1725AC 80249B8C 24050002 */ addiu $a1, $zero, 0x2
.Lfilemenu_80249B90:
/* 1725B0 80249B90 24020001 */ addiu $v0, $zero, 0x1
/* 1725B4 80249B94 A2420000 */ sb $v0, 0x0($s2)
/* 1725B8 80249B98 8FBF0020 */ lw $ra, 0x20($sp)
/* 1725BC 80249B9C 8FB3001C */ lw $s3, 0x1C($sp)
/* 1725C0 80249BA0 8FB20018 */ lw $s2, 0x18($sp)
/* 1725C4 80249BA4 8FB10014 */ lw $s1, 0x14($sp)
/* 1725C8 80249BA8 8FB00010 */ lw $s0, 0x10($sp)
/* 1725CC 80249BAC 03E00008 */ jr $ra
/* 1725D0 80249BB0 27BD0028 */ addiu $sp, $sp, 0x28

View File

@ -1,73 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_draw_file_name
/* 1772A0 8024E880 27BDFFC0 */ addiu $sp, $sp, -0x40
/* 1772A4 8024E884 AFBE0038 */ sw $fp, 0x38($sp)
/* 1772A8 8024E888 8FBE0058 */ lw $fp, 0x58($sp)
/* 1772AC 8024E88C AFB70034 */ sw $s7, 0x34($sp)
/* 1772B0 8024E890 8FB7005C */ lw $s7, 0x5C($sp)
/* 1772B4 8024E894 AFB30024 */ sw $s3, 0x24($sp)
/* 1772B8 8024E898 00A0982D */ daddu $s3, $a1, $zero
/* 1772BC 8024E89C AFB1001C */ sw $s1, 0x1C($sp)
/* 1772C0 8024E8A0 0000882D */ daddu $s1, $zero, $zero
/* 1772C4 8024E8A4 AFBF003C */ sw $ra, 0x3C($sp)
/* 1772C8 8024E8A8 AFB60030 */ sw $s6, 0x30($sp)
/* 1772CC 8024E8AC AFB5002C */ sw $s5, 0x2C($sp)
/* 1772D0 8024E8B0 AFB40028 */ sw $s4, 0x28($sp)
/* 1772D4 8024E8B4 AFB20020 */ sw $s2, 0x20($sp)
/* 1772D8 8024E8B8 AFB00018 */ sw $s0, 0x18($sp)
/* 1772DC 8024E8BC AFA40040 */ sw $a0, 0x40($sp)
/* 1772E0 8024E8C0 1A600020 */ blez $s3, .Lfilemenu_8024E944
/* 1772E4 8024E8C4 AFA7004C */ sw $a3, 0x4C($sp)
/* 1772E8 8024E8C8 241600F7 */ addiu $s6, $zero, 0xF7
/* 1772EC 8024E8CC 24150001 */ addiu $s5, $zero, 0x1
/* 1772F0 8024E8D0 24140008 */ addiu $s4, $zero, 0x8
/* 1772F4 8024E8D4 00C0902D */ daddu $s2, $a2, $zero
.Lfilemenu_8024E8D8:
/* 1772F8 8024E8D8 8FA80040 */ lw $t0, 0x40($sp)
/* 1772FC 8024E8DC 01111021 */ addu $v0, $t0, $s1
/* 177300 8024E8E0 90500000 */ lbu $s0, 0x0($v0)
/* 177304 8024E8E4 12160013 */ beq $s0, $s6, .Lfilemenu_8024E934
/* 177308 8024E8E8 0200202D */ daddu $a0, $s0, $zero
/* 17730C 8024E8EC 0000282D */ daddu $a1, $zero, $zero
/* 177310 8024E8F0 3C073F80 */ lui $a3, (0x3F800000 >> 16)
/* 177314 8024E8F4 00A0302D */ daddu $a2, $a1, $zero
/* 177318 8024E8F8 AFA00010 */ sw $zero, 0x10($sp)
/* 17731C 8024E8FC 0C0491E9 */ jal msg_get_print_char_width
/* 177320 8024E900 AFB50014 */ sw $s5, 0x14($sp)
/* 177324 8024E904 0200202D */ daddu $a0, $s0, $zero
/* 177328 8024E908 02821023 */ subu $v0, $s4, $v0
/* 17732C 8024E90C 00021FC2 */ srl $v1, $v0, 31
/* 177330 8024E910 00431021 */ addu $v0, $v0, $v1
/* 177334 8024E914 00021043 */ sra $v0, $v0, 1
/* 177338 8024E918 8FA6004C */ lw $a2, 0x4C($sp)
/* 17733C 8024E91C 8FA70050 */ lw $a3, 0x50($sp)
/* 177340 8024E920 8FA80054 */ lw $t0, 0x54($sp)
/* 177344 8024E924 02422821 */ addu $a1, $s2, $v0
/* 177348 8024E928 AFBE0014 */ sw $fp, 0x14($sp)
/* 17734C 8024E92C 0C0939C7 */ jal filemenu_draw_message
/* 177350 8024E930 AFA80010 */ sw $t0, 0x10($sp)
.Lfilemenu_8024E934:
/* 177354 8024E934 26310001 */ addiu $s1, $s1, 0x1
/* 177358 8024E938 0233102A */ slt $v0, $s1, $s3
/* 17735C 8024E93C 1440FFE6 */ bnez $v0, .Lfilemenu_8024E8D8
/* 177360 8024E940 02579021 */ addu $s2, $s2, $s7
.Lfilemenu_8024E944:
/* 177364 8024E944 8FBF003C */ lw $ra, 0x3C($sp)
/* 177368 8024E948 8FBE0038 */ lw $fp, 0x38($sp)
/* 17736C 8024E94C 8FB70034 */ lw $s7, 0x34($sp)
/* 177370 8024E950 8FB60030 */ lw $s6, 0x30($sp)
/* 177374 8024E954 8FB5002C */ lw $s5, 0x2C($sp)
/* 177378 8024E958 8FB40028 */ lw $s4, 0x28($sp)
/* 17737C 8024E95C 8FB30024 */ lw $s3, 0x24($sp)
/* 177380 8024E960 8FB20020 */ lw $s2, 0x20($sp)
/* 177384 8024E964 8FB1001C */ lw $s1, 0x1C($sp)
/* 177388 8024E968 8FB00018 */ lw $s0, 0x18($sp)
/* 17738C 8024E96C 03E00008 */ jr $ra
/* 177390 8024E970 27BD0040 */ addiu $sp, $sp, 0x40
/* 177394 8024E974 00000000 */ nop
/* 177398 8024E978 00000000 */ nop
/* 17739C 8024E97C 00000000 */ nop

View File

@ -1,87 +0,0 @@
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
/* Generated by spimdisasm 1.11.1 */
glabel filemenu_yesno_draw_options_contents
/* 1737E0 8024ADC0 27BDFFC8 */ addiu $sp, $sp, -0x38
/* 1737E4 8024ADC4 AFB60030 */ sw $s6, 0x30($sp)
/* 1737E8 8024ADC8 0080B02D */ daddu $s6, $a0, $zero
/* 1737EC 8024ADCC AFB40028 */ sw $s4, 0x28($sp)
/* 1737F0 8024ADD0 00A0A02D */ daddu $s4, $a1, $zero
/* 1737F4 8024ADD4 AFB5002C */ sw $s5, 0x2C($sp)
/* 1737F8 8024ADD8 AFBF0034 */ sw $ra, 0x34($sp)
/* 1737FC 8024ADDC AFB30024 */ sw $s3, 0x24($sp)
/* 173800 8024ADE0 AFB20020 */ sw $s2, 0x20($sp)
/* 173804 8024ADE4 AFB1001C */ sw $s1, 0x1C($sp)
/* 173808 8024ADE8 AFB00018 */ sw $s0, 0x18($sp)
/* 17380C 8024ADEC 82C30004 */ lb $v1, 0x4($s6)
/* 173810 8024ADF0 24020001 */ addiu $v0, $zero, 0x1
/* 173814 8024ADF4 1062000C */ beq $v1, $v0, .Lfilemenu_8024AE28
/* 173818 8024ADF8 00C0A82D */ daddu $s5, $a2, $zero
/* 17381C 8024ADFC 28620002 */ slti $v0, $v1, 0x2
/* 173820 8024AE00 10400005 */ beqz $v0, .Lfilemenu_8024AE18
/* 173824 8024AE04 24020002 */ addiu $v0, $zero, 0x2
/* 173828 8024AE08 50600008 */ beql $v1, $zero, .Lfilemenu_8024AE2C
/* 17382C 8024AE0C 2413001C */ addiu $s3, $zero, 0x1C
/* 173830 8024AE10 08092B8E */ j .Lfilemenu_8024AE38
/* 173834 8024AE14 00000000 */ nop
.Lfilemenu_8024AE18:
/* 173838 8024AE18 10620003 */ beq $v1, $v0, .Lfilemenu_8024AE28
/* 17383C 8024AE1C 24020003 */ addiu $v0, $zero, 0x3
/* 173840 8024AE20 14620005 */ bne $v1, $v0, .Lfilemenu_8024AE38
/* 173844 8024AE24 00000000 */ nop
.Lfilemenu_8024AE28:
/* 173848 8024AE28 2413001C */ addiu $s3, $zero, 0x1C
.Lfilemenu_8024AE2C:
/* 17384C 8024AE2C 24120004 */ addiu $s2, $zero, 0x4
/* 173850 8024AE30 0260882D */ daddu $s1, $s3, $zero
/* 173854 8024AE34 24100015 */ addiu $s0, $zero, 0x15
.Lfilemenu_8024AE38:
/* 173858 8024AE38 0C093A16 */ jal filemenu_get_menu_message
/* 17385C 8024AE3C 2404000D */ addiu $a0, $zero, 0xD
/* 173860 8024AE40 0040202D */ daddu $a0, $v0, $zero
/* 173864 8024AE44 02932821 */ addu $a1, $s4, $s3
/* 173868 8024AE48 02B23021 */ addu $a2, $s5, $s2
/* 17386C 8024AE4C 240700FF */ addiu $a3, $zero, 0xFF
/* 173870 8024AE50 AFA00010 */ sw $zero, 0x10($sp)
/* 173874 8024AE54 0C0939C7 */ jal filemenu_draw_message
/* 173878 8024AE58 AFA00014 */ sw $zero, 0x14($sp)
/* 17387C 8024AE5C 0C093A16 */ jal filemenu_get_menu_message
/* 173880 8024AE60 2404000E */ addiu $a0, $zero, 0xE
/* 173884 8024AE64 0040202D */ daddu $a0, $v0, $zero
/* 173888 8024AE68 02912821 */ addu $a1, $s4, $s1
/* 17388C 8024AE6C 02B03021 */ addu $a2, $s5, $s0
/* 173890 8024AE70 240700FF */ addiu $a3, $zero, 0xFF
/* 173894 8024AE74 AFA00010 */ sw $zero, 0x10($sp)
/* 173898 8024AE78 0C0939C7 */ jal filemenu_draw_message
/* 17389C 8024AE7C AFA00014 */ sw $zero, 0x14($sp)
/* 1738A0 8024AE80 3C038025 */ lui $v1, %hi(filemenu_currentMenu)
/* 1738A4 8024AE84 80631758 */ lb $v1, %lo(filemenu_currentMenu)($v1)
/* 1738A8 8024AE88 24020001 */ addiu $v0, $zero, 0x1
/* 1738AC 8024AE8C 1462000C */ bne $v1, $v0, .Lfilemenu_8024AEC0
/* 1738B0 8024AE90 00000000 */ nop
/* 1738B4 8024AE94 92C20003 */ lbu $v0, 0x3($s6)
/* 1738B8 8024AE98 14400004 */ bnez $v0, .Lfilemenu_8024AEAC
/* 1738BC 8024AE9C 2623FFF6 */ addiu $v1, $s1, -0xA
/* 1738C0 8024AEA0 2663FFF6 */ addiu $v1, $s3, -0xA
/* 1738C4 8024AEA4 08092BAC */ j .Lfilemenu_8024AEB0
/* 1738C8 8024AEA8 26420008 */ addiu $v0, $s2, 0x8
.Lfilemenu_8024AEAC:
/* 1738CC 8024AEAC 26020008 */ addiu $v0, $s0, 0x8
.Lfilemenu_8024AEB0:
/* 1738D0 8024AEB0 24040032 */ addiu $a0, $zero, 0x32
/* 1738D4 8024AEB4 02832821 */ addu $a1, $s4, $v1
/* 1738D8 8024AEB8 0C091B44 */ jal filemenu_set_cursor_goal_pos
/* 1738DC 8024AEBC 02A23021 */ addu $a2, $s5, $v0
.Lfilemenu_8024AEC0:
/* 1738E0 8024AEC0 8FBF0034 */ lw $ra, 0x34($sp)
/* 1738E4 8024AEC4 8FB60030 */ lw $s6, 0x30($sp)
/* 1738E8 8024AEC8 8FB5002C */ lw $s5, 0x2C($sp)
/* 1738EC 8024AECC 8FB40028 */ lw $s4, 0x28($sp)
/* 1738F0 8024AED0 8FB30024 */ lw $s3, 0x24($sp)
/* 1738F4 8024AED4 8FB20020 */ lw $s2, 0x20($sp)
/* 1738F8 8024AED8 8FB1001C */ lw $s1, 0x1C($sp)
/* 1738FC 8024AEDC 8FB00018 */ lw $s0, 0x18($sp)
/* 173900 8024AEE0 03E00008 */ jr $ra
/* 173904 8024AEE4 27BD0038 */ addiu $sp, $sp, 0x38