1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-20 13:40:02 +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
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

@ -1322,7 +1322,7 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChoose, SramContext* sram
void Sram_InitSave(FileChooseContext* fileChoose, SramContext* sramCtx);
void Sram_EraseSave(FileChooseContext* fileChoose, SramContext* sramCtx);
void Sram_CopySave(FileChooseContext* fileChoose, SramContext* sramCtx);
void Sram_Write16Bytes(SramContext* sramCtx);
void Sram_WriteSramHeader(SramContext* sramCtx);
void Sram_InitSram(GameState* gameState, SramContext* sramCtx);
void Sram_Alloc(GameState* gameState, SramContext* sramCtx);
void Sram_Init(GlobalContext* globalCtx, SramContext* sramCtx);
@ -1388,7 +1388,7 @@ void VisMono_DrawOld(VisMono* this);
void func_800AD920(struct_80166500* this);
void func_800AD950(struct_80166500* this);
void func_800AD958(struct_80166500* this, Gfx** gfxp);
void Skybox_Init(GlobalContext* globalCtx, SkyboxContext* skyboxCtx, s16 skyboxId);
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId);
Mtx* SkyboxDraw_UpdateMatrix(SkyboxContext* skyboxCtx, f32 x, f32 y, f32 z);
void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId, s16 blend, f32 x, f32 y, f32 z);
void SkyboxDraw_Update(SkyboxContext* skyboxCtx);
@ -2420,7 +2420,7 @@ void Select_Init(GameState* thisx);
void Select_Destroy(GameState* thisx);
void Opening_Init(GameState* thisx);
void Opening_Destroy(GameState* thisx);
void func_80811A20(GameState* thisx); // FileChoose_Init
void func_80811A18(GameState* thisx); // FileChoose_Destroy
void FileChoose_Init(GameState* thisx);
void FileChoose_Destroy(GameState* thisx);
#endif

View file

@ -8,8 +8,6 @@ typedef struct {
s32 value: 16;
} InitChainEntry;
#define OFFSETOF(structure, member) ((size_t)&(((structure*)0)->member))
typedef enum {
/* 0x0 */ ICHAINTYPE_U8, // sets byte
/* 0x1 */ ICHAINTYPE_S8,

View file

@ -13,6 +13,8 @@
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
#define ALIGN256(val) (((val) + 0xFF) & ~0xFF)
#define OFFSETOF(structure, member) ((size_t)&(((structure*)0)->member))
#define SQ(x) ((x)*(x))
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define DECR(x) ((x) == 0 ? 0 : --(x))

View file

@ -786,6 +786,14 @@ typedef struct {
} SramContext; // size = 0x4
#define SRAM_SIZE 0x8000
#define SRAM_HEADER_SIZE 0x10
typedef enum {
/* 0x00 */ SRAM_HEADER_SOUND,
/* 0x01 */ SRAM_HEADER_ZTARGET,
/* 0x02 */ SRAM_HEADER_LANGUAGE,
/* 0x03 */ SRAM_HEADER_MAGIC // must be the value of `sZeldaMagic` for save to be considered valid
} SramHeaderField;
typedef struct GameAllocEntry {
/* 0x00 */ struct GameAllocEntry* next;
@ -970,7 +978,7 @@ typedef struct {
typedef struct {
/* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* allocVtx1;
/* 0x000A4 */ Vtx* windowVtx;
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
/* 0x000B0 */ char unk_B0[0x8];
@ -979,82 +987,73 @@ typedef struct {
/* 0x001E4 */ char unk_1E4[0x4];
/* 0x001E8 */ SkyboxContext skyboxCtx;
/* 0x00348 */ MessageContext msgCtx;
/* 0x0E760 */ char kanfont[0xE188];
/* 0x0E760 */ Font font;
/* 0x1C8E8 */ EnvironmentContext envCtx;
/* 0x1C9E4 */ char unk_1C9E4[0x4];
/* 0x1C9E8 */ Vtx* allocVtx2;
/* 0x1C9EC */ Vtx* allocVtx3;
/* 0x1C9F0 */ Vtx* allocVtx4;
/* 0x1C9E8 */ Vtx* windowContentVtx;
/* 0x1C9EC */ Vtx* keyboardVtx;
/* 0x1C9F0 */ Vtx* nameEntryVtx;
/* 0x1C9F4 */ u8 n64ddFlag;
/* 0x1C9F6 */ u16 deaths[3];
/* 0x1C9FC */ u8 fileNames[3][8];
/* 0x1CA14 */ u16 healthCapacities[3];
/* 0x1CA1C */ u32 questItems[3];
/* 0x1CA28 */ s16 n64ddFlags[3];
/* 0x1CA2E */ s8 heartStatus[3];
/* 0x1CA32 */ u16 nowLife[3];
/* 0x1CA38 */ s16 btnIdx;
/* 0x1CA3A */ u16 yesNoButtonIdx;
/* 0x1CA3C */ s16 menuIdx;
/* 0x1CA3E */ s16 fileSelectStateIdx;
/* 0x1CA40 */ s16 unkActionIndex;
/* 0x1CA42 */ u16 nextFileSelectStateIdx;
/* 0x1CA44 */ s16 openFileStateIdx;
/* 0x1CA46 */ s16 selectedFileIdx;
/* 0x1CA2E */ s8 defense[3];
/* 0x1CA32 */ u16 health[3];
/* 0x1CA38 */ s16 buttonIndex;
/* 0x1CA3A */ s16 confirmButtonIndex; // 0: yes, 1: quit
/* 0x1CA3C */ s16 menuMode;
/* 0x1CA3E */ s16 configMode;
/* 0x1CA40 */ s16 prevConfigMode;
/* 0x1CA42 */ s16 nextConfigMode;
/* 0x1CA44 */ s16 selectMode;
/* 0x1CA46 */ s16 selectedFileIndex;
/* 0x1CA48 */ char unk_1CA48[0x2];
/* 0x1CA4A */ u16 fileNamesY[3];
/* 0x1CA50 */ u16 actionTimer;
/* 0x1CA52 */ u16 buttonsY[6];
/* 0x1CA5E */ s16 copyDestFileIdx;
/* 0x1CA60 */ u16 fileWarningTexIdx;
/* 0x1CA62 */ u16 warningFileIdx;
/* 0x1CA64 */ u16 titleTexIdx;
/* 0x1CA66 */ u16 nextTitleTexIdx;
/* 0x1CA68 */ s16 windowR;
/* 0x1CA6A */ s16 windowG;
/* 0x1CA6C */ s16 windowB;
/* 0x1CA6E */ u16 selectFileTitleA;
/* 0x1CA70 */ u16 openFileTitleA;
/* 0x1CA72 */ u16 windowA;
/* 0x1CA74 */ u16 fileButtonsA[3];
/* 0x1CA7A */ u16 fileNameBoxesA[3];
/* 0x1CA80 */ u16 fileNamesA[3];
/* 0x1CA86 */ u16 metalJointsA[3];
/* 0x1CA8C */ u16 fileInfoA;
/* 0x1CA8E */ u16 targetFileInfoBoxA;
/* 0x1CA90 */ u16 unkFileInfoBoxA;
/* 0x1CA92 */ u16 copyButtonA;
/* 0x1CA94 */ u16 eraseButtonA;
/* 0x1CA96 */ u16 yesBiuttonA;
/* 0x1CA98 */ u16 quitButtonA;
/* 0x1CA9A */ u16 optionButtonA;
/* 0x1CA9C */ u16 newFileNameBoxA;
/* 0x1CA9E */ u16 decideCancelTextA;
/* 0x1CAA0 */ u16 fileEmptyTextA;
/* 0x1CAA2 */ u16 highlightColorR;
/* 0x1CAA4 */ u16 highlightColorG;
/* 0x1CAA6 */ u16 highlightColorB;
/* 0x1CAA8 */ u16 highlightColorA;
/* 0x1CAAA */ u16 highlightColorAIncrease;
/* 0x1CAAC */ char unk_1CAAC[0x6];
/* 0x1CAB2 */ u16 stickXTimer;
/* 0x1CAB4 */ u16 stickYTimer;
/* 0x1CAB6 */ u16 idxXOff;
/* 0x1CAB8 */ u16 idxYOff;
/* 0x1CABA */ s16 stickX;
/* 0x1CABC */ s16 stickY;
/* 0x1CABE */ u16 newFileNameBoxX;
/* 0x1CAC0 */ u16 windowX;
/* 0x1CAC4 */ f32 windowRotX;
/* 0x1CAC8 */ u16 kbdButtonIdx;
/* 0x1CACA */ u16 unk_1CACA;
/* 0x1CACC */ u16 kbdCharBoxA;
/* 0x1CACE */ s16 kbdCharIdx;
/* 0x1CAD0 */ s16 kbdCharX;
/* 0x1CAD2 */ s16 kbdCharY;
/* 0x1CA4A */ s16 fileNamesY[3];
/* 0x1CA50 */ s16 actionTimer;
/* 0x1CA52 */ s16 buttonYOffsets[6];
/* 0x1CA5E */ s16 copyDestFileIndex;
/* 0x1CA60 */ s16 warningLabel;
/* 0x1CA62 */ s16 warningButtonIndex;
/* 0x1CA64 */ s16 titleLabel;
/* 0x1CA66 */ s16 nextTitleLabel;
/* 0x1CA68 */ s16 windowColor[3];
/* 0x1CA6E */ s16 titleAlpha[2];
/* 0x1CA72 */ s16 windowAlpha;
/* 0x1CA74 */ s16 fileButtonAlpha[3];
/* 0x1CA7A */ s16 nameBoxAlpha[3];
/* 0x1CA80 */ s16 nameAlpha[3];
/* 0x1CA86 */ s16 connectorAlpha[3];
/* 0x1CA8C */ s16 fileInfoAlpha[3];
/* 0x1CA92 */ s16 actionButtonAlpha[2];
/* 0x1CA96 */ s16 confirmButtonAlpha[2];
/* 0x1CA9A */ s16 optionButtonAlpha;
/* 0x1CA9C */ s16 nameEntryBoxAlpha;
/* 0x1CA9E */ s16 controlsAlpha;
/* 0x1CAA0 */ s16 emptyFileTextAlpha;
/* 0x1CAA2 */ s16 highlightColor[4];
/* 0x1CAAA */ s16 highlightPulseDir; // 0 fade out, 1 fade in
/* 0x1CAAC */ s16 unk_1CAAC; // initialized but never used
/* 0x1CAAE */ s16 confirmButtonTexIndices[2];
/* 0x1CAB2 */ s16 inputTimerX;
/* 0x1CAB4 */ s16 inputTimerY;
/* 0x1CAB6 */ s16 stickXDir;
/* 0x1CAB8 */ s16 stickYDir;
/* 0x1CABA */ s16 stickRelX;
/* 0x1CABC */ s16 stickRelY;
/* 0x1CABE */ s16 nameEntryBoxPosX;
/* 0x1CAC0 */ s16 windowPosX;
/* 0x1CAC4 */ f32 windowRot;
/* 0x1CAC8 */ s16 kbdButton; // only for buttons, not characters
/* 0x1CACA */ s16 charPage; // 0: hiragana, 1: katakana, 2: alphabet
/* 0x1CACC */ s16 charBgAlpha; // square shape the letter sits in
/* 0x1CACE */ s16 charIndex; // 0 - 64, top left to bottom right
/* 0x1CAD0 */ s16 kbdX; // (0, 0) is top left character
/* 0x1CAD2 */ s16 kbdY;
/* 0x1CAD4 */ s16 newFileNameCharCount;
/* 0x1CAD6 */ u16 unk_1CAD6[3];
} FileChooseContext; // size = 0x1CADC
/* 0x1CAD6 */ s16 unk_1CAD6[5];
} FileChooseContext; // size = 0x1CAE0
typedef enum {
DPM_UNK = 0,

View file

@ -153,7 +153,7 @@ typedef struct {
/* 0x1404 */ u16 minigameState;
/* 0x1406 */ u16 minigameScore; // "yabusame_total"
/* 0x1408 */ char unk_1408[0x0001];
/* 0x1409 */ u8 language;
/* 0x1409 */ u8 language; // NTSC 0: Japanese; 1: English | PAL 0: English; 1: German; 2: French
/* 0x140A */ u8 audioSetting;
/* 0x140B */ char unk_140B[0x0001];
/* 0x140C */ u8 zTargetSetting; // 0: Switch; 1: Hold