1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-12 01:40:47 +00:00

File Select (z_file_choose) OK (#1012)

* matching split

* migrate progress

* split done and rodata migrated

* all data migrated to c

* start init

* progress

* progress

* progress

* progress

* progress

* progress

* copy done

* progress

* erase and settings done

* progress

* progress

* progress

* start keyboard

* progress

* progress

* progress

* progress

* Minor progress

* fix z_magic_dark issue

* func_80806F34 decomp'd

* verified equivalence

* one fix

* format

* merge petries work

* reorganizing

* lots of reorganizing and wraning fixing

* rename file

* remove language enum

* unwanted changes

* some symbol replacement, organization, and some names

* all symbols replaced, some organization

* some more cleanup

* continue docs

* Match the remaining functions in file_choose

* merge master

* select mode documented, all functions in file_choose.c named

* nameset functions named, some other cleaning

* some more general cleanup

* stub comments for cm, name a few things

* fix data and sizeof

* copy/erase functions and modes named

* rename assets, format

* change some struct members

* fixes

* review1

* fix maching error

* extract VTX data

* re add werror to ZAPD

* review 2

* fix

* remove file boundary padding

* remove zeroes

* review3

* change skybox stuff

* changes to  vs  etc

Co-authored-by: KrimtonZ <krimtonz@gmail.com>
Co-authored-by: Thar0 <17233964+Thar0@users.noreply.github.com>
Co-authored-by: mzxrules <mzxrules@gmail.com>
Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
Co-authored-by: Roman971 <romanlasnier@hotmail.com>
Co-authored-by: Louis <louist103@gmail.com>
This commit is contained in:
fig02 2021-11-15 16:33:44 -05:00 committed by GitHub
parent 768f0c2c88
commit a3b4dcf388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
101 changed files with 4513 additions and 15899 deletions

View file

@ -0,0 +1,219 @@
#ifndef _FILE_CHOOSE_H_
#define _FILE_CHOOSE_H_
#include "ultra64.h"
#include "global.h"
#include "vt.h"
#define GET_NEWF(sramCtx, slotNum, index) (sramCtx->readBuff[gSramSlotOffsets[slotNum] + OFFSETOF(SaveContext, newf[index])])
#define SLOT_OCCUPIED(sramCtx, slotNum) \
((GET_NEWF(sramCtx, slotNum, 0) == 'Z') || \
(GET_NEWF(sramCtx, slotNum, 1) == 'E') || \
(GET_NEWF(sramCtx, slotNum, 2) == 'L') || \
(GET_NEWF(sramCtx, slotNum, 3) == 'D') || \
(GET_NEWF(sramCtx, slotNum, 4) == 'A') || \
(GET_NEWF(sramCtx, slotNum, 5) == 'Z'))
// Init mode: Initial setup as the file select is starting up, fades and slides in various menu elements
// Config mode: Handles the bulk of the file select, various configuration tasks like picking a file, copy/erase, and the options menu
// Select mode: Displays the selected file with various details about it, and allows the player to confirm and open it
typedef enum {
/* 0 */ FS_MENU_MODE_INIT,
/* 1 */ FS_MENU_MODE_CONFIG,
/* 2 */ FS_MENU_MODE_SELECT
} MenuMode;
typedef enum {
/* 00 */ CM_FADE_IN_START,
/* 01 */ CM_FADE_IN_END,
/* 02 */ CM_MAIN_MENU,
/* 03 */ CM_SETUP_COPY_SOURCE,
/* 04 */ CM_SELECT_COPY_SOURCE,
/* 05 */ CM_SETUP_COPY_DEST_1,
/* 06 */ CM_SETUP_COPY_DEST_2,
/* 07 */ CM_SELECT_COPY_DEST,
/* 08 */ CM_EXIT_TO_COPY_SOURCE_1,
/* 09 */ CM_EXIT_TO_COPY_SOURCE_2,
/* 10 */ CM_SETUP_COPY_CONFIRM_1,
/* 11 */ CM_SETUP_COPY_CONFIRM_2,
/* 12 */ CM_COPY_CONFIRM,
/* 13 */ CM_RETURN_TO_COPY_DEST,
/* 14 */ CM_COPY_ANIM_1,
/* 15 */ CM_COPY_ANIM_2,
/* 16 */ CM_COPY_ANIM_3,
/* 17 */ CM_COPY_ANIM_4,
/* 18 */ CM_COPY_ANIM_5,
/* 19 */ CM_COPY_RETURN_MAIN,
/* 20 */ CM_SETUP_ERASE_SELECT,
/* 21 */ CM_ERASE_SELECT,
/* 22 */ CM_SETUP_ERASE_CONFIRM_1,
/* 23 */ CM_SETUP_ERASE_CONFIRM_2,
/* 24 */ CM_ERASE_CONFIRM,
/* 25 */ CM_EXIT_TO_ERASE_SELECT_1,
/* 26 */ CM_EXIT_TO_ERASE_SELECT_2,
/* 27 */ CM_ERASE_ANIM_1,
/* 28 */ CM_ERASE_ANIM_2,
/* 29 */ CM_ERASE_ANIM_3,
/* 30 */ CM_EXIT_ERASE_TO_MAIN,
/* 31 */ CM_UNUSED_31,
/* 32 */ CM_ROTATE_TO_NAME_ENTRY,
/* 33 */ CM_NAME_ENTRY,
/* 34 */ CM_START_NAME_ENTRY,
/* 35 */ CM_NAME_ENTRY_TO_MAIN,
/* 36 */ CM_MAIN_TO_OPTIONS,
/* 37 */ CM_OPTIONS_MENU,
/* 38 */ CM_START_OPTIONS,
/* 39 */ CM_OPTIONS_TO_MAIN,
/* 40 */ CM_UNUSED_DELAY
} ConfigMode;
typedef enum {
/* 0 */ SM_FADE_MAIN_TO_SELECT,
/* 1 */ SM_MOVE_FILE_TO_TOP,
/* 2 */ SM_FADE_IN_FILE_INFO,
/* 3 */ SM_CONFIRM_FILE,
/* 4 */ SM_FADE_OUT_FILE_INFO,
/* 5 */ SM_MOVE_FILE_TO_SLOT,
/* 6 */ SM_FADE_OUT,
/* 7 */ SM_LOAD_GAME
} SelectMode;
typedef enum {
/* 0 */ FS_TITLE_SELECT_FILE, // "Please select a file."
/* 1 */ FS_TITLE_OPEN_FILE, // "Open this file?"
/* 2 */ FS_TITLE_COPY_FROM, // "Copy which file?"
/* 3 */ FS_TITLE_COPY_TO, // "Copy to which file?"
/* 4 */ FS_TITLE_COPY_CONFIRM, // "Are you sure?"
/* 5 */ FS_TITLE_COPY_COMPLETE, // "File copied."
/* 6 */ FS_TITLE_ERASE_FILE, // "Erase which file?"
/* 7 */ FS_TITLE_ERASE_CONFIRM, // "Are you sure?"
/* 8 */ FS_TITLE_ERASE_COMPLETE // "File erased."
} TitleLabel;
typedef enum {
/* -1 */ FS_WARNING_NONE = -1,
/* 0 */ FS_WARNING_NO_FILE_COPY, // "No file to copy."
/* 1 */ FS_WARNING_NO_FILE_ERASE, // "No file to erase."
/* 2 */ FS_WARNING_NO_EMPTY_FILES, // "There is no empty file."
/* 3 */ FS_WARNING_FILE_EMPTY, // "This is an empty file."
/* 4 */ FS_WARNING_FILE_IN_USE // "This file is in use."
} WarningLabel;
typedef enum {
/* 0 */ FS_BTN_MAIN_FILE_1,
/* 1 */ FS_BTN_MAIN_FILE_2,
/* 2 */ FS_BTN_MAIN_FILE_3,
/* 3 */ FS_BTN_MAIN_COPY,
/* 4 */ FS_BTN_MAIN_ERASE,
/* 5 */ FS_BTN_MAIN_OPTIONS
} MainMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_COPY_FILE_1,
/* 1 */ FS_BTN_COPY_FILE_2,
/* 2 */ FS_BTN_COPY_FILE_3,
/* 3 */ FS_BTN_COPY_QUIT
} CopyMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_ERASE_FILE_1,
/* 1 */ FS_BTN_ERASE_FILE_2,
/* 2 */ FS_BTN_ERASE_FILE_3,
/* 3 */ FS_BTN_ERASE_QUIT
} EraseMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_SELECT_FILE_1,
/* 1 */ FS_BTN_SELECT_FILE_2,
/* 2 */ FS_BTN_SELECT_FILE_3,
/* 3 */ FS_BTN_SELECT_YES,
/* 4 */ FS_BTN_SELECT_QUIT
} SelectMenuButtonIndex;
typedef enum {
/* 0 */ FS_BTN_CONFIRM_YES,
/* 1 */ FS_BTN_CONFIRM_QUIT
} ConfirmButtonIndex;
typedef enum {
/* 0 */ FS_BTN_ACTION_COPY,
/* 1 */ FS_BTN_ACTION_ERASE
} ActionButtonIndex;
typedef enum {
/* 0 */ FS_SETTING_AUDIO,
/* 1 */ FS_SETTING_TARGET
} SettingIndex;
typedef enum {
/* 0 */ FS_AUDIO_STEREO,
/* 1 */ FS_AUDIO_MONO,
/* 2 */ FS_AUDIO_HEADSET,
/* 3 */ FS_AUDIO_SURROUND
} AudioOption;
typedef enum {
/* 0 */ FS_CHAR_PAGE_HIRA,
/* 1 */ FS_CHAR_PAGE_KATA,
/* 2 */ FS_CHAR_PAGE_ENG
} CharPage;
typedef enum {
/* 00 */ FS_KBD_BTN_HIRA,
/* 01 */ FS_KBD_BTN_KATA,
/* 02 */ FS_KBD_BTN_ENG,
/* 03 */ FS_KBD_BTN_BACKSPACE,
/* 04 */ FS_KBD_BTN_END,
/* 99 */ FS_KBD_BTN_NONE = 99
} KeyboardButton;
void FileChoose_SetupCopySource(GameState* thisx);
void FileChoose_SelectCopySource(GameState* thisx);
void FileChoose_SetupCopyDest1(GameState* thisx);
void FileChoose_SetupCopyDest2(GameState* thisx);
void FileChoose_SelectCopyDest(GameState* thisx);
void FileChoose_ExitToCopySource1(GameState* thisx);
void FileChoose_ExitToCopySource2(GameState* thisx);
void FileChoose_SetupCopyConfirm1(GameState* thisx);
void FileChoose_SetupCopyConfirm2(GameState* thisx);
void FileChoose_CopyConfirm(GameState* thisx);
void FileChoose_ReturnToCopyDest(GameState* thisx);
void FileChoose_CopyAnim1(GameState* thisx);
void FileChoose_CopyAnim2(GameState* thisx);
void FileChoose_CopyAnim3(GameState* thisx);
void FileChoose_CopyAnim4(GameState* thisx);
void FileChoose_CopyAnim5(GameState* thisx);
void FileChoose_ExitCopyToMain(GameState* thisx);
void FileChoose_SetupEraseSelect(GameState* thisx);
void FileChoose_EraseSelect(GameState* thisx);
void FileChoose_SetupEraseConfirm1(GameState* thisx);
void FileChoose_SetupEraseConfirm2(GameState* thisx);
void FileChoose_EraseConfirm(GameState* thisx);
void FileChoose_ExitToEraseSelect1(GameState* thisx);
void FileChoose_ExitToEraseSelect2(GameState* thisx);
void FileChoose_EraseAnim1(GameState* thisx);
void FileChoose_EraseAnim2(GameState* thisx);
void FileChoose_EraseAnim3(GameState* thisx);
void FileChoose_ExitEraseToMain(GameState* thisx);
void FileChoose_UpdateKeyboardCursor(GameState* thisx);
void FileChoose_StartNameEntry(GameState* thisx);
void FileChoose_UpdateOptionsMenu(GameState* thisx);
void FileChoose_StartOptions(GameState* thisx);
void FileChoose_InitModeDraw(GameState* thisx);
void FileChoose_ConfigModeDraw(GameState* thisx);
void FileChoose_SelectModeDraw(GameState* thisx);
void FileChoose_PulsateCursor(GameState* thisx);
void FileChoose_DrawOptions(GameState* thisx);
void FileChoose_DrawNameEntry(GameState* thisx);
void FileChoose_DrawCharacter(GraphicsContext* gfxCtx, void* texture, s16 vtx);
extern s16 D_808123F0[];
#endif

View file

@ -1,3 +1,5 @@
ovl_file_choose
z_file_nameset_data.c
z_file_copy_erase.c
z_file_nameset_PAL.c
z_file_choose.c

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,11 @@
#include "file_choose.h"
#include "assets/overlays/ovl_File_Choose/ovl_file_choose.c"
s16 D_808123F0[] = {
0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016,
0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, 0x0020, 0x0021, 0x0022, 0x0023,
0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, 0x0030,
0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D,
0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x0000, 0x0040, 0x003F, 0x003E,
};

View file

@ -25,11 +25,8 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) {
gSaveContext.unk_13F4 = 0;
gSaveContext.magicLevel = gSaveContext.magic;
}
gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.buttonStatus[3] = BTN_ENABLED;
gSaveContext.buttonStatus[2] = BTN_ENABLED;
gSaveContext.buttonStatus[1] = BTN_ENABLED;
gSaveContext.buttonStatus[0] = BTN_ENABLED;
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.unk_13E7 = gSaveContext.unk_13E8 = gSaveContext.unk_13EA = gSaveContext.unk_13EC = 0;
Audio_QueueSeqCmd(NA_BGM_STOP);
gSaveContext.entranceIndex = entranceIndex;
@ -195,19 +192,19 @@ static SceneSelectEntry sScenes[] = {
};
void Select_UpdateMenu(SelectContext* this) {
Input* controller1 = &this->state.input[0];
Input* input = &this->state.input[0];
s32 pad;
SceneSelectEntry* selectedScene;
if (this->verticalInputAccumulator == 0) {
if (CHECK_BTN_ALL(controller1->press.button, BTN_A) || CHECK_BTN_ALL(controller1->press.button, BTN_START)) {
if (CHECK_BTN_ALL(input->press.button, BTN_A) || CHECK_BTN_ALL(input->press.button, BTN_START)) {
selectedScene = &this->scenes[this->currentScene];
if (selectedScene->loadFunc != NULL) {
selectedScene->loadFunc(this, selectedScene->entranceIndex);
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_B)) {
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
gSaveContext.linkAge = 1;
} else {
@ -215,7 +212,7 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_Z)) {
if (CHECK_BTN_ALL(input->press.button, BTN_Z)) {
if (gSaveContext.cutsceneIndex == 0x8000) {
gSaveContext.cutsceneIndex = 0;
} else if (gSaveContext.cutsceneIndex == 0) {
@ -243,7 +240,7 @@ void Select_UpdateMenu(SelectContext* this) {
} else if (gSaveContext.cutsceneIndex == 0xFFFA) {
gSaveContext.cutsceneIndex = 0x8000;
}
} else if (CHECK_BTN_ALL(controller1->press.button, BTN_R)) {
} else if (CHECK_BTN_ALL(input->press.button, BTN_R)) {
if (gSaveContext.cutsceneIndex == 0x8000) {
gSaveContext.cutsceneIndex = 0xFFFA;
} else if (gSaveContext.cutsceneIndex == 0) {
@ -279,14 +276,14 @@ void Select_UpdateMenu(SelectContext* this) {
}
// user can change "opt", but it doesn't do anything
if (CHECK_BTN_ALL(controller1->press.button, BTN_CUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CUP)) {
this->opt--;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_CDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
this->opt++;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DUP)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
if (this->lockUp == true) {
this->timerUp = 0;
}
@ -298,12 +295,12 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DUP) && this->timerUp == 0) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DUP) && this->timerUp == 0) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DDOWN)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
if (this->lockDown == true) {
this->timerDown = 0;
}
@ -315,24 +312,23 @@ void Select_UpdateMenu(SelectContext* this) {
}
}
if (CHECK_BTN_ALL(controller1->cur.button, BTN_DDOWN) && (this->timerDown == 0)) {
if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN) && (this->timerDown == 0)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = -R_UPDATE_RATE * 3;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DLEFT) || CHECK_BTN_ALL(controller1->cur.button, BTN_DLEFT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) || CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = R_UPDATE_RATE;
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_DRIGHT) ||
CHECK_BTN_ALL(controller1->cur.button, BTN_DRIGHT)) {
if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT) || CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) {
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_IMPACT, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
this->verticalInput = -R_UPDATE_RATE;
}
}
if (CHECK_BTN_ALL(controller1->press.button, BTN_L)) {
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
this->pageDownIndex++;
this->pageDownIndex =
(this->pageDownIndex + ARRAY_COUNT(this->pageDownStops)) % ARRAY_COUNT(this->pageDownStops);