Merge remote-tracking branch 'decomp/main' into decomp_merge

This commit is contained in:
Yanis002
2025-02-23 00:34:01 +01:00
60 changed files with 532 additions and 405 deletions

View File

@@ -0,0 +1,28 @@
#ifndef CONSOLE_LOGO_STATE_H
#define CONSOLE_LOGO_STATE_H
#include "ultra64.h"
#include "z64game.h"
#include "z64view.h"
#include "z64sram.h"
typedef struct ConsoleLogoState {
/* 0x0000 */ GameState state;
/* 0x00A4 */ u8* staticSegment;
/* 0x00A8 */ View view;
/* 0x01D0 */ SramContext sramCtx;
/* 0x01D4 */ s16 timer; // not used in mq dbg (some sort of timer that doesn't seem to affect anything)
/* 0x01D6 */ s16 coverAlpha;
/* 0x01D8 */ s16 addAlpha;
/* 0x01DA */ s16 visibleDuration;
/* 0x01DC */ s16 ult;
/* 0x01DE */ s16 uls;
/* 0x01E0 */ u8 unk_1E0;
/* 0x01E1 */ u8 exit;
/* 0x01E2 */ char unk_1E2[0x06];
} ConsoleLogoState; // size = 0x1E8
void ConsoleLogo_Init(GameState* thisx);
void ConsoleLogo_Destroy(GameState* thisx);
#endif

View File

@@ -0,0 +1,97 @@
#ifndef FILE_SELECT_STATE_H
#define FILE_SELECT_STATE_H
#include "ultra64.h"
#include "z64game.h"
#include "z64view.h"
#include "z64sram.h"
#include "z64skybox.h"
#include "z64message.h"
#include "z64environment.h"
typedef struct FileSelectState {
/* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* windowVtx;
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
#if OOT_PAL
/* 0x000B0 */ u8* objectMagSegment;
#endif
/* 0x000B8 */ View view;
/* 0x001E0 */ SramContext sramCtx;
/* 0x001E4 */ char unk_1E4[0x4];
/* 0x001E8 */ SkyboxContext skyboxCtx;
/* 0x00348 */ MessageContext msgCtx;
/* 0x0E760 */ Font font;
/* 0x1C8E8 */ EnvironmentContext envCtx;
/* 0x1C9E4 */ char unk_1C9E4[0x4];
/* 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 defense[3];
#if OOT_PAL
/* 0x1CA32 */ u16 health[3];
#endif
/* 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 */ 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[4]; // also contains the alphas for the confirm buttons
/* 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 stickAdjX;
/* 0x1CABC */ s16 stickAdjY;
/* 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 */ s16 unk_1CAD6[5];
} FileSelectState; // size = 0x1CAE0
void FileSelect_Init(GameState* thisx);
void FileSelect_Destroy(GameState* thisx);
#endif

View File

@@ -36,25 +36,8 @@ void* MemCpy(void* dest, const void* src, s32 len);
void MapMark_Init(PlayState* play);
void MapMark_ClearPointers(PlayState* play);
void MapMark_Draw(PlayState* play);
void PreNmiBuff_Init(PreNmiBuff* this);
void PreNmiBuff_SetReset(PreNmiBuff* this);
u32 PreNmiBuff_IsResetting(PreNmiBuff* this);
void Sched_FlushTaskQueue(void);
void PreNMI_Init(GameState* thisx);
void Sample_Destroy(GameState* thisx);
void Sample_Init(GameState* thisx);
void ViMode_LogPrint(OSViMode* osViMode);
void ViMode_Configure(ViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 antialiasOff, s32 modeN, s32 fb16Bit,
s32 width, s32 height, s32 leftAdjust, s32 rightAdjust, s32 upperAdjust, s32 lowerAdjust);
void ViMode_Save(ViMode* viMode);
void ViMode_Load(ViMode* viMode);
void ViMode_Init(ViMode* viMode);
void ViMode_Destroy(ViMode* viMode);
void ViMode_ConfigureFeatures(ViMode* viMode, s32 viFeatures);
void ViMode_Update(ViMode* viMode, Input* input);
void PlayerCall_InitFuncPtrs(void);
void TransitionTile_Destroy(TransitionTile* this);
TransitionTile* TransitionTile_Init(TransitionTile* this, s32 cols, s32 rows);
@@ -138,48 +121,13 @@ void func_800D3210(void);
void RcpUtils_PrintRegisterStatus(void);
void RcpUtils_Reset(void);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);
void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart);
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr);
// ? func_800FC800(?);
// ? func_800FC83C(?);
// ? func_800FCAB4(?);
void SystemHeap_Init(void* start, u32 size);
f32 absf(f32);
void Regs_InitData(PlayState* play);
void Setup_Init(GameState* thisx);
void Setup_Destroy(GameState* thisx);
void ConsoleLogo_Init(GameState* thisx);
void ConsoleLogo_Destroy(GameState* thisx);
// ENABLE_MAP_SELECT
void MapSelect_Init(GameState* thisx);
void MapSelect_Destroy(GameState* thisx);
void DebugOpening_Init(GameState* thisx);
void DebugOpening_Destroy(GameState* thisx);
void TitleSetup_Init(GameState* thisx);
void TitleSetup_Destroy(GameState* thisx);
void FileSelect_Init(GameState* thisx);
void FileSelect_Destroy(GameState* thisx);
#if ENABLE_MOTION_BLUR
void Play_DrawMotionBlur(PlayState* this);
void Play_InitMotionBlur(PlayState* this);
void Play_DestroyMotionBlur(void);
void Play_SetMotionBlurPriorityAlpha(u32 alpha);
void Play_EnableMotionBlurPriority(u32 alpha);
void Play_DisableMotionBlurPriority(void);
#endif
void Play_SetMotionBlurAlpha(u32 alpha);
void Play_EnableMotionBlur(u32 alpha);
void Play_DisableMotionBlur(void);
#if ENABLE_F3DEX3
void OcclusionPlane_Draw_Phase(PlayState* play, OcclusionPlanePhase phase);
void OcclusionPlane_Draw_PostCamUpdate(PlayState* play);

40
include/libu64/overlay.h Normal file
View File

@@ -0,0 +1,40 @@
#ifndef LIBU64_OVERLAY_H
#define LIBU64_OVERLAY_H
#include "ultra64.h"
/* Relocation entry field getters */
#define RELOC_SECTION(reloc) ((reloc) >> 30)
#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF)
#define RELOC_TYPE_MASK(reloc) ((reloc) & 0x3F000000)
#define RELOC_TYPE_SHIFT 24
/* MIPS Relocation Types, matches the MIPS ELF spec */
#define R_MIPS_32 2
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6
/* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */
typedef enum RelocSectionId {
/* 0 */ RELOC_SECTION_NULL,
/* 1 */ RELOC_SECTION_TEXT,
/* 2 */ RELOC_SECTION_DATA,
/* 3 */ RELOC_SECTION_RODATA,
/* 4 */ RELOC_SECTION_MAX
} RelocSectionId;
typedef struct OverlayRelocationSection {
/* 0x00 */ u32 textSize;
/* 0x04 */ u32 dataSize;
/* 0x08 */ u32 rodataSize;
/* 0x0C */ u32 bssSize;
/* 0x10 */ u32 nRelocations;
/* 0x14 */ u32 relocations[1]; // size is nRelocations
} OverlayRelocationSection; // size >= 0x18
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);
void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart);
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr);
#endif

View File

@@ -0,0 +1,54 @@
#ifndef MAP_SELECT_STATE_H
#define MAP_SELECT_STATE_H
#include "ultra64.h"
#include "z64game.h"
#include "z64view.h"
struct MapSelectState;
typedef struct MapSelectEntry {
/* 0x00 */ char* name;
/* 0x04 */ void (*loadFunc)(struct MapSelectState*, s32);
/* 0x08 */ s32 entranceIndex;
} MapSelectEntry; // size = 0xC
typedef struct MapSelectState {
/* 0x0000 */ GameState state;
/* 0x00A8 */ View view;
/* 0x01D0 */ s32 sceneTotal;
/* 0x01D4 */ MapSelectEntry* scenes;
/* 0x01D8 */ s32 currentScene;
/* 0x01DC */ s32 pageDownIndex; // Index of pageDownStops
/* 0x01E0 */ s32 pageDownStops[7];
/* 0x01FC */ s32 topDisplayedScene; // The scene which is currently at the top of the screen
/* 0x0200 */ s32 verticalInputAccumulator;
/* 0x0204 */ s32 verticalInput;
/* 0x0208 */ s32 timerUp;
/* 0x020A */ s32 timerDown;
/* 0x020C */ s32 lockUp;
/* 0x0210 */ s32 lockDown;
/* 0x0214 */ u8 showControls;
/* 0x0218 */ u8 toggleBGM;
/* 0x021A */ u8 isBGMPlaying;
/* 0x021C */ u8 sceneLayer;
/* 0x0220 */ u8 selectedSceneColor;
} MapSelectState; // size = 0x240
void MapSelect_Init(GameState* thisx);
void MapSelect_Main(GameState* thisx);
void MapSelect_Draw(MapSelectState* this);
void MapSelect_Destroy(GameState* thisx);
void MapSelect_UpdateMenu(MapSelectState* this);
void MapSelect_DrawMenu(MapSelectState* this);
void MapSelect_DrawLoadingScreen(MapSelectState* this);
void MapSelect_LoadTitle(MapSelectState* this);
void MapSelect_LoadDebugOpening(MapSelectState* this);
void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex);
void MapSelect_PrintMenu(MapSelectState* this, GfxPrint* printer);
void MapSelect_PrintLoadingMessage(MapSelectState* this, GfxPrint* printer, u8 yPos);
void MapSelect_PrintAgeSetting(MapSelectState* this, GfxPrint* printer, s32 age);
void MapSelect_PrintSceneLayerSetting(MapSelectState* this, GfxPrint* printer);
void MapSelect_PrintControls(MapSelectState* this, GfxPrint* printer);
#endif

25
include/prenmi_buff.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef PRENMI_BUFF_H
#define PRENMI_BUFF_H
#include "ultra64.h"
#include "alignment.h"
// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access
// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32
// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute
// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing
// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code.
ALIGNED(4) typedef struct PreNmiBuff {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused)
extern PreNmiBuff* gAppNmiBufferPtr;
void PreNmiBuff_Init(PreNmiBuff* this);
void PreNmiBuff_SetReset(PreNmiBuff* this);
u32 PreNmiBuff_IsResetting(PreNmiBuff* this);
#endif

16
include/prenmi_state.h Normal file
View File

@@ -0,0 +1,16 @@
#ifndef PRENMI_STATE_H
#define PRENMI_STATE_H
#include "ultra64.h"
#include "z64game.h"
typedef struct PreNMIState {
/* 0x00 */ GameState state;
/* 0xA4 */ u32 timer;
/* 0xA8 */ s32 unk_A8;
} PreNMIState; // size = 0xAC
void PreNMI_Init(GameState* thisx);
void PreNMI_Destroy(GameState* thisx);
#endif

17
include/sample_state.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef SAMPLE_STATE_H
#define SAMPLE_STATE_H
#include "ultra64.h"
#include "z64game.h"
#include "z64view.h"
typedef struct SampleState {
/* 0x0000 */ GameState state;
/* 0x00A4 */ u8* staticSegment;
/* 0x00A8 */ View view;
} SampleState; // size = 0x1D0
void Sample_Init(GameState* thisx);
void Sample_Destroy(GameState* thisx);
#endif

13
include/setup_state.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef SETUP_STATE_H
#define SETUP_STATE_H
#include "z64game.h"
typedef struct SetupState {
/* 0x00 */ GameState state;
} SetupState; // size = 0xA4
void Setup_Init(GameState* thisx);
void Setup_Destroy(GameState* thisx);
#endif

View File

@@ -0,0 +1,15 @@
#ifndef TITLE_SETUP_STATE_H
#define TITLE_SETUP_STATE_H
#include "z64game.h"
#include "z64view.h"
typedef struct TitleSetupState {
/* 0x0000 */ GameState state;
/* 0x00A8 */ View view;
} TitleSetupState; // size = 0x1D0
void TitleSetup_Init(GameState* thisx);
void TitleSetup_Destroy(GameState* thisx);
#endif

View File

@@ -78,7 +78,6 @@ extern u32 __osTimerCounter;
extern EffectSsOverlay gEffectSsOverlayTable[EFFECT_SS_TYPE_MAX];
extern ActorOverlay gActorOverlayTable[ACTOR_ID_MAX]; // original name: "actor_dlftbls" 801162A0
extern s32 gMaxActorId; // original name: "MaxProfile"
extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX];
extern s32 gZeldaArenaLogSeverity;
extern MapData gMapDataTable;
extern s16 gSpoilingItems[3];
@@ -163,7 +162,6 @@ extern f32 gBossMarkScale;
extern u32 D_8016139C;
extern PauseMapMarksData* gLoadedPauseMarkDataTable;
extern PreNmiBuff* gAppNmiBufferPtr;
extern Scheduler gScheduler;
extern PadMgr gPadMgr;
extern IrqMgr gIrqMgr;

45
include/vi_mode.h Normal file
View File

@@ -0,0 +1,45 @@
#ifndef VI_MODE_H
#define VI_MODE_H
#include "ultra64.h"
#include "libu64/pad.h"
#include "versions.h"
typedef enum ViModeEditState {
#if OOT_VERSION < PAL_1_0
/* -2 */ VI_MODE_EDIT_STATE_NEGATIVE_2 = -2,
/* -1 */ VI_MODE_EDIT_STATE_NEGATIVE_1,
/* 0 */ VI_MODE_EDIT_STATE_INACTIVE,
/* 1 */ VI_MODE_EDIT_STATE_2, // active, more adjustments
/* 2 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode
#else
/* 0 */ VI_MODE_EDIT_STATE_INACTIVE,
/* 1 */ VI_MODE_EDIT_STATE_ACTIVE,
/* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments
/* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode
#endif
} ViModeEditState;
typedef struct ViMode {
/* 0x00 */ OSViMode customViMode;
/* 0x50 */ s32 viHeight;
/* 0x54 */ s32 viWidth;
/* 0x58 */ s32 rightAdjust;
/* 0x5C */ s32 leftAdjust;
/* 0x60 */ s32 lowerAdjust;
/* 0x64 */ s32 upperAdjust;
/* 0x68 */ s32 editState;
/* 0x6C */ s32 tvType;
/* 0x70 */ u32 loRes;
/* 0x74 */ u32 antialiasOff;
/* 0x78 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution
/* 0x7C */ u32 fb16Bit;
/* 0x80 */ u32 viFeatures;
/* 0x84 */ u32 unk_84;
} ViMode; // size = 0x88
void ViMode_Init(ViMode* viMode);
void ViMode_Destroy(ViMode* viMode);
void ViMode_Update(ViMode* viMode, Input* input);
#endif

View File

@@ -73,299 +73,6 @@
#include "libc64/sprintf.h"
#include "libu64/debug.h"
typedef struct SetupState {
/* 0x00 */ GameState state;
} SetupState; // size = 0xA4
typedef struct ConsoleLogoState {
/* 0x0000 */ GameState state;
/* 0x00A4 */ u8* staticSegment;
/* 0x00A8 */ View view;
/* 0x01D0 */ SramContext sramCtx;
/* 0x01D4 */ s16 timer; // not used in mq dbg (some sort of timer that doesn't seem to affect anything)
/* 0x01D6 */ s16 coverAlpha;
/* 0x01D8 */ s16 addAlpha;
/* 0x01DA */ s16 visibleDuration;
/* 0x01DC */ s16 ult;
/* 0x01DE */ s16 uls;
/* 0x01E0 */ u8 unk_1E0;
/* 0x01E1 */ u8 exit;
/* 0x01E2 */ char unk_1E2[0x06];
} ConsoleLogoState; // size = 0x1E8
typedef struct DebugOpeningState {
GameState state;
View view;
s32 currentOption;
char* controlGuideString;
u8 page;
SkyboxContext skyboxCtx;
EnvironmentContext envCtx;
} DebugOpeningState;
// vvv IS_MAP_SELECT_ENABLED vvv
struct MapSelectState;
typedef struct SceneSelectEntry {
/* 0x00 */ char* name;
/* 0x04 */ void (*loadFunc)(struct MapSelectState*, s32);
/* 0x08 */ s32 entranceIndex;
} SceneSelectEntry; // size = 0xC
typedef struct MapSelectState {
/* 0x0000 */ GameState state;
/* 0x00A8 */ View view;
/* 0x01D0 */ s32 sceneTotal;
/* 0x01D4 */ SceneSelectEntry* scenes;
/* 0x01D8 */ s32 currentScene;
/* 0x01DC */ s32 pageDownIndex; // Index of pageDownStops
/* 0x01E0 */ s32 pageDownStops[7];
/* 0x01FC */ s32 topDisplayedScene; // The scene which is currently at the top of the screen
/* 0x0200 */ s32 verticalInputAccumulator;
/* 0x0204 */ s32 verticalInput;
/* 0x0208 */ s32 timerUp;
/* 0x020A */ s32 timerDown;
/* 0x020C */ s32 lockUp;
/* 0x0210 */ s32 lockDown;
/* 0x0214 */ u8 showControls;
/* 0x0218 */ u8 toggleBGM;
/* 0x021A */ u8 isBGMPlaying;
/* 0x021C */ u8 sceneLayer;
/* 0x0220 */ u8 selectedSceneColor;
} MapSelectState; // size = 0x240
// ^^^ IS_MAP_SELECT_ENABLED ^^^
typedef struct SampleState {
/* 0x0000 */ GameState state;
/* 0x00A4 */ u8* staticSegment;
/* 0x00A8 */ View view;
} SampleState; // size = 0x1D0
typedef enum PauseBgPreRenderState {
/* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing.
/* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background.
/* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters.
/* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used.
/* 4 */ PAUSE_BG_PRERENDER_MAX
} PauseBgPreRenderState;
typedef enum TransitionTileState {
/* 0 */ TRANS_TILE_OFF, // Inactive, do nothing
/* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers
/* 2 */ TRANS_TILE_PROCESS, // Initialize the transition
/* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame
} TransitionTileState;
typedef struct TitleSetupState {
/* 0x0000 */ GameState state;
/* 0x00A8 */ View view;
} TitleSetupState; // size = 0x1D0
typedef struct FileSelectState {
/* 0x00000 */ GameState state;
/* 0x000A4 */ Vtx* windowVtx;
/* 0x000A8 */ u8* staticSegment;
/* 0x000AC */ u8* parameterSegment;
#if OOT_PAL
/* 0x000B0 */ u8* objectMagSegment;
#endif
/* 0x000B8 */ View view;
/* 0x001E0 */ SramContext sramCtx;
/* 0x001E4 */ char unk_1E4[0x4];
/* 0x001E8 */ SkyboxContext skyboxCtx;
/* 0x00348 */ MessageContext msgCtx;
/* 0x0E760 */ Font font;
/* 0x1C8E8 */ EnvironmentContext envCtx;
/* 0x1C9E4 */ char unk_1C9E4[0x4];
/* 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 defense[3];
#if OOT_PAL
/* 0x1CA32 */ u16 health[3];
#endif
/* 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 */ 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[4]; // also contains the alphas for the confirm buttons
/* 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 stickAdjX;
/* 0x1CABC */ s16 stickAdjY;
/* 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 */ s16 unk_1CAD6[5];
} FileSelectState; // size = 0x1CAE0
typedef struct GameStateOverlay {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ RomFile file; // if applicable
/* 0x0C */ void* vramStart; // if applicable
/* 0x10 */ void* vramEnd; // if applicable
/* 0x14 */ void* unk_14;
/* 0x18 */ void* init; // initializes and executes the given context
/* 0x1C */ void* destroy; // deconstructs the context, and sets the next context to load
/* 0x20 */ void* unk_20;
/* 0x24 */ void* unk_24;
/* 0x28 */ UNK_TYPE4 unk_28;
/* 0x2C */ u32 instanceSize;
} GameStateOverlay; // size = 0x30
typedef struct PreNMIState {
/* 0x00 */ GameState state;
/* 0xA4 */ u32 timer;
/* 0xA8 */ UNK_TYPE4 unk_A8;
} PreNMIState; // size = 0xAC
typedef struct ISVDbg {
/* 0x00 */ u32 magic; // IS64
/* 0x04 */ u32 get;
/* 0x08 */ u8 unk_08[0x14-0x08];
/* 0x14 */ u32 put;
/* 0x18 */ u8 unk_18[0x20-0x18];
/* 0x20 */ u8 data[0x10000-0x20];
} ISVDbg;
typedef struct LocaleCartInfo {
/* 0x00 */ char name[0x18];
/* 0x18 */ u32 mediaFormat;
/* 0x1C */ union {
struct {
u16 cartId;
u8 countryCode;
u8 version;
};
u32 regionInfo;
};
} LocaleCartInfo; // size = 0x20
typedef struct Yaz0Header {
/* 0x00 */ char magic[4]; // Yaz0
/* 0x04 */ u32 decSize;
/* 0x08 */ u32 compInfoOffset; // only used in mio0
/* 0x0C */ u32 uncompDataOffset; // only used in mio0
} Yaz0Header; // size = 0x10
/* Relocation entry field getters */
#define RELOC_SECTION(reloc) ((reloc) >> 30)
#define RELOC_OFFSET(reloc) ((reloc) & 0xFFFFFF)
#define RELOC_TYPE_MASK(reloc) ((reloc) & 0x3F000000)
#define RELOC_TYPE_SHIFT 24
/* MIPS Relocation Types, matches the MIPS ELF spec */
#define R_MIPS_32 2
#define R_MIPS_26 4
#define R_MIPS_HI16 5
#define R_MIPS_LO16 6
/* Reloc section id, must fit in 2 bits otherwise the relocation format must be modified */
typedef enum RelocSectionId {
/* 0 */ RELOC_SECTION_NULL,
/* 1 */ RELOC_SECTION_TEXT,
/* 2 */ RELOC_SECTION_DATA,
/* 3 */ RELOC_SECTION_RODATA,
/* 4 */ RELOC_SECTION_MAX
} RelocSectionId;
typedef struct OverlayRelocationSection {
/* 0x00 */ u32 textSize;
/* 0x04 */ u32 dataSize;
/* 0x08 */ u32 rodataSize;
/* 0x0C */ u32 bssSize;
/* 0x10 */ u32 nRelocations;
/* 0x14 */ u32 relocations[1]; // size is nRelocations
} OverlayRelocationSection; // size >= 0x18
// This struct is used at osAppNMIBuffer which is not at an 8-byte aligned address. This causes an unaligned access
// crash if the OSTime variables use 64-bit load/store instructions, which is the case in any MIPS ABI other than O32
// where 64-bit load/store instructions are emulated with 2x 32-bit load/store instructions. The alignment attribute
// conveys that this structure will not always be 8-bytes aligned, allowing a modern compiler to generate non-crashing
// code for accessing these. This is not an issue in the original compiler as it only output O32 ABI code.
ALIGNED(4) typedef struct PreNmiBuff {
/* 0x00 */ u32 resetting;
/* 0x04 */ u32 resetCount;
/* 0x08 */ OSTime duration;
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused)
typedef enum ViModeEditState {
#if OOT_VERSION < PAL_1_0
/* -2 */ VI_MODE_EDIT_STATE_NEGATIVE_2 = -2,
/* -1 */ VI_MODE_EDIT_STATE_NEGATIVE_1,
/* 0 */ VI_MODE_EDIT_STATE_INACTIVE,
/* 1 */ VI_MODE_EDIT_STATE_2, // active, more adjustments
/* 2 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode
#else
/* 0 */ VI_MODE_EDIT_STATE_INACTIVE,
/* 1 */ VI_MODE_EDIT_STATE_ACTIVE,
/* 2 */ VI_MODE_EDIT_STATE_2, // active, more adjustments
/* 3 */ VI_MODE_EDIT_STATE_3 // active, more adjustments, print comparison with NTSC LAN1 mode
#endif
} ViModeEditState;
typedef struct ViMode {
/* 0x00 */ OSViMode customViMode;
/* 0x50 */ s32 viHeight;
/* 0x54 */ s32 viWidth;
/* 0x58 */ s32 rightAdjust;
/* 0x5C */ s32 leftAdjust;
/* 0x60 */ s32 lowerAdjust;
/* 0x64 */ s32 upperAdjust;
/* 0x68 */ s32 editState;
/* 0x6C */ s32 tvType;
/* 0x70 */ u32 loRes;
/* 0x74 */ u32 antialiasOff;
/* 0x78 */ u32 modeN; // Controls interlacing, the meaning of this mode is different based on choice of resolution
/* 0x7C */ u32 fb16Bit;
/* 0x80 */ u32 viFeatures;
/* 0x84 */ u32 unk_84;
} ViMode; // size = 0x88
// TODO: include all files listed above into the right place, and then delete this file.
#endif

View File

@@ -5,6 +5,7 @@
#include "ultra64/ultratypes.h"
#include "libu64/pad.h"
#include "gamealloc.h"
#include "romfile.h"
#include "tha.h"
#include "config.h"
@@ -21,6 +22,22 @@ typedef enum GameStateId {
#undef DEFINE_GAMESTATE
#undef DEFINE_GAMESTATE_INTERNAL
typedef struct GameStateOverlay {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ RomFile file; // if applicable
/* 0x0C */ void* vramStart; // if applicable
/* 0x10 */ void* vramEnd; // if applicable
/* 0x14 */ void* unk_14;
/* 0x18 */ void* init;
/* 0x1C */ void* destroy;
/* 0x20 */ void* unk_20;
/* 0x24 */ void* unk_24;
/* 0x28 */ s32 unk_28;
/* 0x2C */ u32 instanceSize;
} GameStateOverlay; // size = 0x30
extern GameStateOverlay gGameStateOverlayTable[GAMESTATE_ID_MAX];
struct GameState;
typedef void (*GameStateFunc)(struct GameState* gameState);

View File

@@ -33,6 +33,21 @@ struct Player;
struct QuestHintCmd;
struct VisMono;
typedef enum PauseBgPreRenderState {
/* 0 */ PAUSE_BG_PRERENDER_OFF, // Inactive, do nothing.
/* 1 */ PAUSE_BG_PRERENDER_SETUP, // The current frame is only drawn for the purpose of serving as the pause background.
/* 2 */ PAUSE_BG_PRERENDER_PROCESS, // The previous frame was PAUSE_BG_PRERENDER_SETUP, now apply prerender filters.
/* 3 */ PAUSE_BG_PRERENDER_READY, // The pause background is ready to be used.
/* 4 */ PAUSE_BG_PRERENDER_MAX
} PauseBgPreRenderState;
typedef enum TransitionTileState {
/* 0 */ TRANS_TILE_OFF, // Inactive, do nothing
/* 1 */ TRANS_TILE_SETUP, // Save the necessary buffers
/* 2 */ TRANS_TILE_PROCESS, // Initialize the transition
/* 3 */ TRANS_TILE_READY // The transition is ready, so will update and draw each frame
} TransitionTileState;
typedef struct SceneSequences {
/* 0x00 */ u8 seqId;
/* 0x01 */ u8 natureAmbienceId;
@@ -129,8 +144,6 @@ void Play_SetViewpoint(PlayState* this, s16 viewpoint);
s32 Play_CheckViewpoint(PlayState* this, s16 viewpoint);
void Play_SetShopBrowsingViewpoint(PlayState* this);
Gfx* Play_SetFog(PlayState* this, Gfx* gfx);
void Play_Destroy(GameState* thisx);
void Play_Init(GameState* thisx);
void Play_Main(GameState* thisx);
int Play_InCsMode(PlayState* this);
f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos);
@@ -158,11 +171,27 @@ int Play_CamIsNotFixed(PlayState* this);
s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw);
s32 func_800C0DB4(PlayState* this, Vec3f* pos);
void Play_Init(GameState* thisx);
void Play_Destroy(GameState* thisx);
#if ENABLE_CUTSCENE_IMPROVEMENTS
u16 Play_GetActorCsCamSetting(PlayState* this, s32 csCamDataIndex);
Vec3s* Play_GetActorCsCamFuncData(PlayState* this, s32 csCamDataIndex);
#endif
#if ENABLE_MOTION_BLUR
void Play_DrawMotionBlur(PlayState* this);
void Play_InitMotionBlur(PlayState* this);
void Play_DestroyMotionBlur(void);
void Play_SetMotionBlurPriorityAlpha(u32 alpha);
void Play_EnableMotionBlurPriority(u32 alpha);
void Play_DisableMotionBlurPriority(void);
#endif
void Play_SetMotionBlurAlpha(u32 alpha);
void Play_EnableMotionBlur(u32 alpha);
void Play_DisableMotionBlur(void);
#if DEBUG_FEATURES
extern void* gDebugCutsceneScript;
#endif

View File

@@ -1,5 +1,14 @@
#include "global.h"
typedef struct ISVDbg {
/* 0x00 */ u32 magic; // "IS64"
/* 0x04 */ u32 get;
/* 0x08 */ u8 unk_08[0xC];
/* 0x14 */ u32 put;
/* 0x18 */ u8 unk_18[0x8];
/* 0x20 */ u8 data[0xFFE0];
} ISVDbg; // size = 0x10000
#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000)
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))

View File

@@ -6,6 +6,19 @@
s32 gCurrentRegion = 0;
typedef struct LocaleCartInfo {
/* 0x00 */ char name[0x18];
/* 0x18 */ u32 mediaFormat;
/* 0x1C */ union {
struct {
u16 cartId;
u8 countryCode;
u8 version;
};
u32 regionInfo;
};
} LocaleCartInfo; // size = 0x20
void Locale_Init(void) {
#if !PLATFORM_GC
ALIGNED(4) u8 regionInfo[4];

View File

@@ -34,7 +34,7 @@
#include "global.h"
#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \
"ntsc-1.2:20 pal-1.0:18 pal-1.1:18"
"ntsc-1.2:76 pal-1.0:74 pal-1.1:74"
StackEntry sDmaMgrStackInfo;
OSMesgQueue sDmaMgrMsgQueue;

View File

@@ -40,8 +40,8 @@
* DPad-Up may be pressed to enable sending fault pages over osSyncPrintf as well as displaying them on-screen.
* DPad-Down disables sending fault pages over osSyncPrintf.
*/
#pragma increment_block_number "gc-eu:96 gc-eu-mq:96 gc-eu-mq-dbg:96 gc-jp:112 gc-jp-ce:112 gc-jp-mq:112 gc-us:112" \
"gc-us-mq:112 ique-cn:112"
#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160" \
"gc-us-mq:160 ique-cn:160"
#include "global.h"
#include "libc64/sleep.h"

View File

@@ -13,7 +13,7 @@
#include "macros.h"
#include "global.h"
#pragma increment_block_number "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128"
#pragma increment_block_number "ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192"
typedef struct FaultMgr {
OSThread thread;

Some files were not shown because too many files have changed in this diff Show More