Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
Macros | Functions | Variables
file_select.c File Reference
#include <ultra64.h>
#include "sm64.h"
#include "audio/external.h"
#include "behavior_data.h"
#include "engine/behavior_script.h"
#include "game.h"
#include "ingame_menu.h"
#include "object_helpers.h"
#include "engine/math_util.h"
#include "area.h"
#include "save_file.h"
#include "spawn_object.h"
#include "file_select.h"
#include "object_list_processor.h"
#include "text_strings.h"

Macros

#define FILE_SELECT_SOUND   SOUND_MENU_STARSOUNDOKEYDOKEY
 
#define TIMER_VAR1   0xA9
 
#define TIMER_VAR2   0x8C
 
#define LENGTH   8
 
#define PADDING   1
 
#define PRINT_COURSE_SCORES(course, pad)
 

Functions

void beh_yellow_background_menu_init (void)
 
void beh_yellow_background_menu_loop (void)
 
static s32 button_clicked_test (s16 x, s16 y, f32 depth)
 
static void bhvMenuButton_growing_from_main_menu (struct Object *button)
 
static void bhvMenuButton_shrinking_to_main_menu (struct Object *button)
 
static void bhvMenuButton_growing_from_submenu (struct Object *button)
 
static void bhvMenuButton_shrinking_to_submenu (struct Object *button)
 
static void bhvMenuButton_zoom_in_out (struct Object *button)
 
static void bhvMenuButton_zoom_in (struct Object *button)
 
static void bhvMenuButton_zoom_out (struct Object *button)
 
void bhvMenuButton_init (void)
 
void bhvMenuButton_loop (void)
 
static void score_menu_file_exiting (struct Object *scoreFileButton, s8 scoreButtonId)
 
static void score_menu_create_buttons (struct Object *scoreButton)
 
static void score_menu_check_clicked_buttons (struct Object *scoreButton)
 
static void copy_menu_create_buttons (struct Object *copyButton)
 
static void CopyMenuCopyFile (struct Object *copyButton, s32 copyFileButtonId)
 
static void copy_menu_check_clicked_buttons (struct Object *copyButton)
 
static void erase_menu_create_buttons (struct Object *eraseButton)
 
static void erase_menu_erase_file (struct Object *eraseButton, s32 eraseFileButtonId)
 
static void erase_menu_check_clicked_buttons (struct Object *eraseButton)
 
static void sound_mode_menu_create_buttons (struct Object *soundModeButton)
 
static void sound_mode_menu_check_clicked_buttons (struct Object *soundModeButton)
 
static void main_menu_file_selected (struct Object *fileButton, s32 fileNum)
 
static void return_to_main_menu (s16 prevMenuButtonId, struct Object *sourceButton)
 
static void score_menu_init_from_submenu (s16 prevMenuButtonId, struct Object *sourceButton)
 
static void copy_menu_init_from_submenu (s16 prevMenuButtonId, struct Object *sourceButton)
 
static void erase_menu_init_from_submenu (s16 prevMenuButtonId, struct Object *sourceButton)
 
void bhvMenuButtonManager_init (void)
 
static void main_menu_check_clicked_buttons (void)
 
void bhvMenuButtonManager_loop (void)
 
static void handle_button_presses (void)
 
static void handle_controller_input (void)
 
static void draw_cursor (void)
 
static void menu_print_title_text (s8 type, s16 x, s16 y, const unsigned char *text)
 
static void menu_print_generic_text (s16 x, s16 y, const unsigned char *text)
 
static s32 update_text_fade_out (void)
 
static void display_file_star_count (s8 fileNum, s16 x, s16 y)
 
static void draw_main_menu (void)
 
static void score_menu_display_message (s8 messageID)
 
static void draw_score_menu (void)
 
static void copy_menu_display_message (s8 messageId)
 
static void copy_menu_update_message (void)
 
static void draw_copy_menu (void)
 
static void erase_menu_yes_no_prompt (s16 x, s16 y)
 
static void erase_menu_display_message (s8 messageId)
 
static void erase_menu_update_message (void)
 
static void draw_erase_menu (void)
 
static void draw_sound_mode_menu (void)
 
static void score_file_print_castle_secret_stars (s8 fileNum, s16 x, s16 y)
 
static void score_file_print_course_coin_score (s8 fileNum, s16 courseNum, s16 x, s16 y)
 
static void score_file_print_course_star_score (s8 fileNum, s16 courseNum, s16 x, s16 y)
 
static void draw_file_scores (s8 fileNum)
 
static void draw_current_menu (void)
 
GfxGeo18_80176688 (s32 run, UNUSED struct GraphNode *node, UNUSED f32 mtx[4][4])
 
void LevelProc_801766DC (UNUSED s32 a, UNUSED s32 b)
 
int LevelProc_801768A0 (UNUSED s32 a, UNUSED s32 b)
 

Variables

static s16 sSoundTextX
 
static struct ObjectsMainMenuButtons [32]
 
static u8 sYesNoColor [2]
 
static s8 sSelectedButtonID = MENU_BUTTON_NONE
 
static s8 sCurrentMenuLevel
 
static u8 sTextBaseAlpha
 
static f32 sCursorPos [] = { 0, 0 }
 
static s16 sCursorClickingTimer = 0
 
static s16 sClickPos []
 
static s8 sSelectedFile
 
static s8 sFadeOutText = 0
 
static s8 sStatusMessageId = 0
 
static u8 sTextTransparency = 0
 
static s16 sMainMenuTimer = 0
 
static s8 sSoundMode = 0
 
static s8 D_801A7C04 = 0
 
static s8 sAllFilesExist = 0
 
static s8 D_801A7C0C = 0
 
static s8 sScoreFileCoinScoreMode = 0
 
static unsigned char textReturn [] = { TEXT_RETURN }
 
static unsigned char textViewScore [] = { TEXT_CHECK_SCORE }
 
static unsigned char textCopyFileButton [] = { TEXT_COPY_FILE_BUTTON }
 
static unsigned char textEraseFileButton [] = { TEXT_ERASE_FILE_BUTTON }
 
static unsigned char textSoundModes [][8] = { { TEXT_STEREO }, { TEXT_MONO }, { TEXT_HEADSET } }
 
static unsigned char textMarioA [] = { TEXT_FILE_MARIO_A }
 
static unsigned char textMarioB [] = { TEXT_FILE_MARIO_B }
 
static unsigned char textMarioC [] = { TEXT_FILE_MARIO_C }
 
static unsigned char textMarioD [] = { TEXT_FILE_MARIO_D }
 
static unsigned char textNew [] = { TEXT_NEW }
 
static unsigned char starIcon [] = { 0x35, 0xff }
 
static unsigned char xIcon [] = { 0x32, 0xff }
 
static unsigned char textSelectFile [] = { TEXT_SELECT_FILE }
 
static unsigned char textScore [] = { TEXT_SCORE }
 
static unsigned char textCopy [] = { TEXT_COPY }
 
static unsigned char textErase [] = { TEXT_ERASE }
 
static unsigned char textCheckFile [] = { TEXT_CHECK_FILE }
 
static unsigned char textNoSavedDataExists [] = { TEXT_NO_SAVED_DATA_EXISTS }
 
static unsigned char textCopyFile [] = { TEXT_COPY_FILE }
 
static unsigned char textCopyItToWhere [] = { TEXT_COPY_IT_TO_WHERE }
 
static unsigned char textNoSavedDataExists2 [] = { TEXT_NO_SAVED_DATA_EXISTS }
 
static unsigned char textCopyFinished [] = { TEXT_COPYING_COMPLETED }
 
static unsigned char textSavedDataExists [] = { TEXT_SAVED_DATA_EXISTS }
 
static unsigned char textNoFileToCopyFrom [] = { TEXT_NO_FILE_TO_COPY_FROM }
 
static unsigned char textYes [] = { TEXT_YES }
 
static unsigned char textNo [] = { TEXT_NO }
 
static unsigned char textStarX [] = { TEXT_STAR_X }
 

Macro Definition Documentation

◆ FILE_SELECT_SOUND

#define FILE_SELECT_SOUND   SOUND_MENU_STARSOUNDOKEYDOKEY

◆ LENGTH

#define LENGTH   8

◆ PADDING

#define PADDING   1

◆ PRINT_COURSE_SCORES

#define PRINT_COURSE_SCORES (   course,
  pad 
)
Value:
PrintRegularText(23 + (pad * 3), 35 + 12 * course, segmented_to_virtual(levelNameTable[course])); \
score_file_print_course_star_score(fileNum, course, 171, 35 + 12 * course); \
score_file_print_course_coin_score(fileNum, course, 213, 35 + 12 * course);
void PrintRegularText(s16 x, s16 y, const u8 *str)
Definition: ingame_menu.c:690
void * segmented_to_virtual(void *addr)
Definition: memory.c:66

◆ TIMER_VAR1

#define TIMER_VAR1   0xA9

◆ TIMER_VAR2

#define TIMER_VAR2   0x8C

Function Documentation

◆ beh_yellow_background_menu_init()

void beh_yellow_background_menu_init ( void  )

◆ beh_yellow_background_menu_loop()

void beh_yellow_background_menu_loop ( void  )

◆ bhvMenuButton_growing_from_main_menu()

static void bhvMenuButton_growing_from_main_menu ( struct Object button)
static

◆ bhvMenuButton_growing_from_submenu()

static void bhvMenuButton_growing_from_submenu ( struct Object button)
static

◆ bhvMenuButton_init()

void bhvMenuButton_init ( void  )

◆ bhvMenuButton_loop()

void bhvMenuButton_loop ( void  )

◆ bhvMenuButton_shrinking_to_main_menu()

static void bhvMenuButton_shrinking_to_main_menu ( struct Object button)
static

◆ bhvMenuButton_shrinking_to_submenu()

static void bhvMenuButton_shrinking_to_submenu ( struct Object button)
static

◆ bhvMenuButton_zoom_in()

static void bhvMenuButton_zoom_in ( struct Object button)
static

◆ bhvMenuButton_zoom_in_out()

static void bhvMenuButton_zoom_in_out ( struct Object button)
static

◆ bhvMenuButton_zoom_out()

static void bhvMenuButton_zoom_out ( struct Object button)
static

◆ bhvMenuButtonManager_init()

void bhvMenuButtonManager_init ( void  )

◆ bhvMenuButtonManager_loop()

void bhvMenuButtonManager_loop ( void  )

◆ button_clicked_test()

static s32 button_clicked_test ( s16  x,
s16  y,
f32  depth 
)
static

◆ copy_menu_check_clicked_buttons()

static void copy_menu_check_clicked_buttons ( struct Object copyButton)
static

◆ copy_menu_create_buttons()

static void copy_menu_create_buttons ( struct Object copyButton)
static

◆ copy_menu_display_message()

static void copy_menu_display_message ( s8  messageId)
static

◆ copy_menu_init_from_submenu()

static void copy_menu_init_from_submenu ( s16  prevMenuButtonId,
struct Object sourceButton 
)
static

Not possible, this is checking if the copy menu was opened from the copy menu!

◆ copy_menu_update_message()

static void copy_menu_update_message ( void  )
static

◆ CopyMenuCopyFile()

static void CopyMenuCopyFile ( struct Object copyButton,
s32  copyFileButtonId 
)
static

◆ display_file_star_count()

static void display_file_star_count ( s8  fileNum,
s16  x,
s16  y 
)
static

◆ draw_copy_menu()

static void draw_copy_menu ( void  )
static

◆ draw_current_menu()

static void draw_current_menu ( void  )
static

◆ draw_cursor()

static void draw_cursor ( void  )
static

◆ draw_erase_menu()

static void draw_erase_menu ( void  )
static

◆ draw_file_scores()

static void draw_file_scores ( s8  fileNum)
static

Print course scores (for loops exist for a reason!)

◆ draw_main_menu()

static void draw_main_menu ( void  )
static

◆ draw_score_menu()

static void draw_score_menu ( void  )
static

◆ draw_sound_mode_menu()

static void draw_sound_mode_menu ( void  )
static

◆ erase_menu_check_clicked_buttons()

static void erase_menu_check_clicked_buttons ( struct Object eraseButton)
static

◆ erase_menu_create_buttons()

static void erase_menu_create_buttons ( struct Object eraseButton)
static

◆ erase_menu_display_message()

static void erase_menu_display_message ( s8  messageId)
static

◆ erase_menu_erase_file()

static void erase_menu_erase_file ( struct Object eraseButton,
s32  eraseFileButtonId 
)
static

◆ erase_menu_init_from_submenu()

static void erase_menu_init_from_submenu ( s16  prevMenuButtonId,
struct Object sourceButton 
)
static

Not possible, this is checking if the erase menu was opened from the erase menu!

◆ erase_menu_update_message()

static void erase_menu_update_message ( void  )
static

◆ erase_menu_yes_no_prompt()

static void erase_menu_yes_no_prompt ( s16  x,
s16  y 
)
static

◆ Geo18_80176688()

Gfx* Geo18_80176688 ( s32  run,
UNUSED struct GraphNode node,
UNUSED f32  mtx[4][4] 
)

◆ handle_button_presses()

static void handle_button_presses ( void  )
static

◆ handle_controller_input()

static void handle_controller_input ( void  )
static

◆ LevelProc_801766DC()

void LevelProc_801766DC ( UNUSED s32  a,
UNUSED s32  b 
)

◆ LevelProc_801768A0()

int LevelProc_801768A0 ( UNUSED s32  a,
UNUSED s32  b 
)

◆ main_menu_check_clicked_buttons()

static void main_menu_check_clicked_buttons ( void  )
static

◆ main_menu_file_selected()

static void main_menu_file_selected ( struct Object fileButton,
s32  fileNum 
)
static

◆ menu_print_generic_text()

static void menu_print_generic_text ( s16  x,
s16  y,
const unsigned char text 
)
static

◆ menu_print_title_text()

static void menu_print_title_text ( s8  type,
s16  x,
s16  y,
const unsigned char text 
)
static

◆ return_to_main_menu()

static void return_to_main_menu ( s16  prevMenuButtonId,
struct Object sourceButton 
)
static

◆ score_file_print_castle_secret_stars()

static void score_file_print_castle_secret_stars ( s8  fileNum,
s16  x,
s16  y 
)
static

◆ score_file_print_course_coin_score()

static void score_file_print_course_coin_score ( s8  fileNum,
s16  courseNum,
s16  x,
s16  y 
)
static

◆ score_file_print_course_star_score()

static void score_file_print_course_star_score ( s8  fileNum,
s16  courseNum,
s16  x,
s16  y 
)
static

◆ score_menu_check_clicked_buttons()

static void score_menu_check_clicked_buttons ( struct Object scoreButton)
static

◆ score_menu_create_buttons()

static void score_menu_create_buttons ( struct Object scoreButton)
static

◆ score_menu_display_message()

static void score_menu_display_message ( s8  messageID)
static

◆ score_menu_file_exiting()

static void score_menu_file_exiting ( struct Object scoreFileButton,
s8  scoreButtonId 
)
static

◆ score_menu_init_from_submenu()

static void score_menu_init_from_submenu ( s16  prevMenuButtonId,
struct Object sourceButton 
)
static

Not possible, this is checking if the score menu was opened from the score menu!

◆ sound_mode_menu_check_clicked_buttons()

static void sound_mode_menu_check_clicked_buttons ( struct Object soundModeButton)
static

◆ sound_mode_menu_create_buttons()

static void sound_mode_menu_create_buttons ( struct Object soundModeButton)
static

◆ update_text_fade_out()

static s32 update_text_fade_out ( void  )
static

Variable Documentation

◆ D_801A7C04

s8 D_801A7C04 = 0
static

◆ D_801A7C0C

s8 D_801A7C0C = 0
static

◆ sAllFilesExist

s8 sAllFilesExist = 0
static

◆ sClickPos

s16 sClickPos[]
static
Initial value:
= {
-10000, -10000
}

◆ sCurrentMenuLevel

s8 sCurrentMenuLevel
static
Initial value:
=
#define MENU_LAYER_MAIN
Definition: file_select.h:6

◆ sCursorClickingTimer

s16 sCursorClickingTimer = 0
static

◆ sCursorPos

f32 sCursorPos[] = { 0, 0 }
static

◆ sFadeOutText

s8 sFadeOutText = 0
static

◆ sMainMenuButtons

struct Object* sMainMenuButtons[32]
static

◆ sMainMenuTimer

s16 sMainMenuTimer = 0
static

◆ sScoreFileCoinScoreMode

s8 sScoreFileCoinScoreMode = 0
static

◆ sSelectedButtonID

s8 sSelectedButtonID = MENU_BUTTON_NONE
static

◆ sSelectedFile

s8 sSelectedFile
static
Initial value:
=
-1

◆ sSoundMode

s8 sSoundMode = 0
static

◆ sSoundTextX

s16 sSoundTextX
static

◆ sStatusMessageId

s8 sStatusMessageId = 0
static

◆ starIcon

unsigned char starIcon[] = { 0x35, 0xff }
static

◆ sTextBaseAlpha

u8 sTextBaseAlpha
static
Initial value:
=
0

◆ sTextTransparency

u8 sTextTransparency = 0
static

◆ sYesNoColor

u8 sYesNoColor[2]
static

◆ textCheckFile

unsigned char textCheckFile[] = { TEXT_CHECK_FILE }
static

◆ textCopy

unsigned char textCopy[] = { TEXT_COPY }
static

◆ textCopyFile

unsigned char textCopyFile[] = { TEXT_COPY_FILE }
static

◆ textCopyFileButton

unsigned char textCopyFileButton[] = { TEXT_COPY_FILE_BUTTON }
static

◆ textCopyFinished

unsigned char textCopyFinished[] = { TEXT_COPYING_COMPLETED }
static

◆ textCopyItToWhere

unsigned char textCopyItToWhere[] = { TEXT_COPY_IT_TO_WHERE }
static

◆ textErase

unsigned char textErase[] = { TEXT_ERASE }
static

◆ textEraseFileButton

unsigned char textEraseFileButton[] = { TEXT_ERASE_FILE_BUTTON }
static

◆ textMarioA

unsigned char textMarioA[] = { TEXT_FILE_MARIO_A }
static

◆ textMarioB

unsigned char textMarioB[] = { TEXT_FILE_MARIO_B }
static

◆ textMarioC

unsigned char textMarioC[] = { TEXT_FILE_MARIO_C }
static

◆ textMarioD

unsigned char textMarioD[] = { TEXT_FILE_MARIO_D }
static

◆ textNew

unsigned char textNew[] = { TEXT_NEW }
static

◆ textNo

unsigned char textNo[] = { TEXT_NO }
static

◆ textNoFileToCopyFrom

unsigned char textNoFileToCopyFrom[] = { TEXT_NO_FILE_TO_COPY_FROM }
static

◆ textNoSavedDataExists

unsigned char textNoSavedDataExists[] = { TEXT_NO_SAVED_DATA_EXISTS }
static

◆ textNoSavedDataExists2

unsigned char textNoSavedDataExists2[] = { TEXT_NO_SAVED_DATA_EXISTS }
static

◆ textReturn

unsigned char textReturn[] = { TEXT_RETURN }
static

◆ textSavedDataExists

unsigned char textSavedDataExists[] = { TEXT_SAVED_DATA_EXISTS }
static

◆ textScore

unsigned char textScore[] = { TEXT_SCORE }
static

◆ textSelectFile

unsigned char textSelectFile[] = { TEXT_SELECT_FILE }
static

◆ textSoundModes

unsigned char textSoundModes[][8] = { { TEXT_STEREO }, { TEXT_MONO }, { TEXT_HEADSET } }
static

◆ textStarX

unsigned char textStarX[] = { TEXT_STAR_X }
static

◆ textViewScore

unsigned char textViewScore[] = { TEXT_CHECK_SCORE }
static

◆ textYes

unsigned char textYes[] = { TEXT_YES }
static

◆ xIcon

unsigned char xIcon[] = { 0x32, 0xff }
static