1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-25 22:26:12 +00:00

Match retail code data sizes (#1741)

* Match retail audio data

* Fix various small code data problems

* Disable terminal colors in debug builds

* Match z_actor_dlftbls.c .rodata

* Use _3 for unused nameString macro parameter

* Move sDebugCutsceneScriptBuf to be in-function static

* Comment on actor name being NULL

* Split out padding the fault_drawer.bss.s
This commit is contained in:
cadmic 2024-02-26 23:23:19 -08:00 committed by GitHub
parent c3faefc061
commit c6e3ef4570
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 79 additions and 13 deletions

View file

@ -13,6 +13,7 @@
glabel sFaultDrawer
.space 0x3C
.space 0x04 # padding
glabel D_8016B6BC
.space 0x24
glabel D_8016B6C0
.space 0x20

View file

@ -28,12 +28,24 @@
#define VT_SGR(n) VT_ESC VT_CSI n "m"
// Add more macros if necessary
#if OOT_DEBUG
#define VT_COL(back, fore) VT_SGR(VT_COLOR(BACKGROUND, back) ";" VT_COLOR(FOREGROUND, fore))
#define VT_FGCOL(color) VT_SGR(VT_COLOR(FOREGROUND, color))
#define VT_BGCOL(color) VT_SGR(VT_COLOR(BACKGROUND, color))
#define VT_RST VT_SGR("")
#define VT_CLS VT_ED(2)
#else
#define VT_COL(back, fore) ""
#define VT_FGCOL(color) ""
#define VT_BGCOL(color) ""
#define VT_RST ""
#define VT_CLS ""
#endif
// ASCII BEL character, plays an alert tone
#define BEL '\a'

View file

@ -143,13 +143,17 @@ extern u16 D_801333D0;
extern Vec3f gSfxDefaultPos;
extern f32 gSfxDefaultFreqAndVolScale;
extern s8 gSfxDefaultReverb;
#if OOT_DEBUG
extern u8 D_801333F0;
extern u8 gAudioSfxSwapOff;
extern u8 D_801333F8;
#endif
extern u8 gSeqCmdWritePos;
extern u8 gSeqCmdReadPos;
extern u8 gStartSeqDisabled;
#if OOT_DEBUG
extern u8 gAudioDebugPrintSeqCmd;
#endif
extern u8 gSoundModeList[];
extern u8 gAudioSpecId;
extern u8 D_80133418;

View file

@ -44,18 +44,20 @@ s8 gSfxDefaultReverb = 0;
s32 D_801333EC = 0; // unused
#if OOT_DEBUG
u8 D_801333F0 = 0;
u8 gAudioSfxSwapOff = 0;
u8 D_801333F8 = 0;
s32 D_801333FC = 0; // unused
#endif
u8 gSeqCmdWritePos = 0;
u8 gSeqCmdReadPos = 0;
u8 gStartSeqDisabled = false;
#if OOT_DEBUG
u8 gAudioDebugPrintSeqCmd = true;
#endif
u8 gSoundModeList[] = {
SOUNDMODE_STEREO,

View file

@ -1212,8 +1212,10 @@ OcarinaSongButtons gOcarinaSongButtons[OCARINA_SONG_MAX] = {
{ 0, { 0 } },
};
#if OOT_DEBUG
u32 sAudioUpdateStartTime;
u32 sAudioUpdateEndTime;
#endif
f32 D_8016B7A8;
f32 D_8016B7AC;
f32 D_8016B7B0;
@ -1223,20 +1225,26 @@ FreqLerp sWaterfallFreqScaleLerp;
f32 D_8016B7D8;
s8 D_8016B7DC;
f32 D_8016B7E0;
#if OOT_DEBUG
u16 D_8016B7E4;
struct {
char str[5];
u16 num;
} sAudioScrPrtBuf[SCROLL_PRINT_BUF_SIZE];
#endif
u8 sRiverSoundMainBgmVol;
u8 sRiverSoundMainBgmCurrentVol;
u8 sRiverSoundMainBgmLower;
u8 sRiverSoundMainBgmRestore;
u8 sGanonsTowerVol;
SfxPlayerState sSfxChannelState[0x10];
#if OOT_DEBUG
char sBinToStrBuf[0x20];
#endif
u8 sMalonSingingTimer;
#if OOT_DEBUG
u8 sAudioSpecPeakNumNotes[0x12];
#endif
u8 sMalonSingingDisabled;
u8 D_8016B9F3;
u8 sFanfareStartTimer;
@ -1264,8 +1272,10 @@ u16 sMusicStaffCurHeldLength[OCARINA_SONG_MAX];
u16 sMusicStaffExpectedLength[OCARINA_SONG_MAX];
u8 sMusicStaffExpectedPitch[OCARINA_SONG_MAX];
OcarinaNote sScarecrowsLongSongSecondNote;
#if OOT_DEBUG
u8 sIsMalonSinging;
f32 sMalonSingingDist;
#endif
void PadMgr_RequestPadData(PadMgr* padMgr, Input* inputs, s32 gameRequest);

View file

@ -33,9 +33,12 @@ ActiveSfx gActiveSfx[7][3];
u8 sCurSfxPlayerChannelIndex;
u8 gSfxBankMuted[7];
UnusedBankLerp sUnusedBankLerp[7];
#if OOT_DEBUG
u16 gAudioSfxSwapSource[10];
u16 gAudioSfxSwapTarget[10];
u8 gAudioSfxSwapMode[10];
#endif
void Audio_SetSfxBanksMute(u16 muteMask) {
u8 bankId;

View file

@ -102,11 +102,11 @@ FaultDrawer sFaultDrawerDefault = {
#ifndef NON_MATCHING
// TODO: match .bss (has reordering issues)
extern FaultDrawer sFaultDrawer;
extern char D_8016B6BC[0x24];
extern char D_8016B6C0[0x20];
#else
// Non-matching version for struct shiftability
FaultDrawer sFaultDrawer;
char D_8016B6BC[0x24];
char D_8016B6C0[0x20];
#endif
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {

View file

@ -6,10 +6,11 @@ VisCvg sVisCvg;
VisZBuf sVisZBuf;
VisMono sVisMono;
ViMode sViMode;
#if OOT_DEBUG
FaultClient sGameFaultClient;
u16 sLastButtonPressed;
#if OOT_DEBUG
void GameState_FaultPrint(void) {
static char sBtnChars[] = "ABZSuldr*+LRudlr";
s32 i;

View file

@ -14,8 +14,13 @@ OSTime sGraphPrevUpdateEndTime;
*/
OSTime sGraphPrevTaskTimeStart;
#if OOT_DEBUG
FaultClient sGraphFaultClient;
#endif
CfbInfo sGraphCfbInfos[3];
#if OOT_DEBUG
FaultClient sGraphUcodeFaultClient;
UCodeInfo D_8012D230[3] = {
@ -30,7 +35,6 @@ UCodeInfo D_8012D248[3] = {
{ UCODE_S2DEX, gspS2DEX2d_fifoTextStart },
};
#if OOT_DEBUG
void Graph_FaultClient(void) {
void* nextFb = osViGetNextFramebuffer();
void* newFb = (SysCfb_GetFbPtr(0) != nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1);

View file

@ -45,14 +45,14 @@
#define RDP_DONE_MSG 668
#define NOTIFY_MSG 670 // original name: ENTRY_MSG
vs32 sSchedDebugPrintfEnabled = false;
OSTime sRSPGfxTimeStart;
OSTime sRSPAudioTimeStart;
OSTime sRSPOtherTimeStart;
OSTime sRDPTimeStart;
#if OOT_DEBUG
vs32 sSchedDebugPrintfEnabled = false;
#define SCHED_DEBUG_PRINTF \
if (sSchedDebugPrintfEnabled) \
PRINTF

View file

@ -23,6 +23,8 @@
#undef DEFINE_ACTOR_UNSET
// Actor Overlay Table definition
#if OOT_DEBUG
#define DEFINE_ACTOR(name, _1, allocType, nameString) \
{ (uintptr_t)_ovl_##name##SegmentRomStart, \
(uintptr_t)_ovl_##name##SegmentRomEnd, \
@ -37,6 +39,24 @@
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, nameString) \
{ 0, 0, NULL, NULL, NULL, &name##_InitVars, nameString, allocType, 0 },
#else
// Actor name is set to NULL in retail builds
#define DEFINE_ACTOR(name, _1, allocType, _3) \
{ (uintptr_t)_ovl_##name##SegmentRomStart, \
(uintptr_t)_ovl_##name##SegmentRomEnd, \
_ovl_##name##SegmentStart, \
_ovl_##name##SegmentEnd, \
NULL, \
&name##_InitVars, \
NULL, \
allocType, \
0 },
#define DEFINE_ACTOR_INTERNAL(name, _1, allocType, _3) { 0, 0, NULL, NULL, NULL, &name##_InitVars, NULL, allocType, 0 },
#endif
#define DEFINE_ACTOR_UNSET(_0) { 0 },
ActorOverlay gActorOverlayTable[] = {

View file

@ -29,6 +29,7 @@ Color_RGBA8 sDebugCamTextColors[] = {
{ 128, 255, 32, 128 }, // DEBUG_CAM_TEXT_GREEN
};
#if OOT_DEBUG
InputCombo sRegGroupInputCombos[REG_GROUPS] = {
{ BTN_L, BTN_CUP }, // REG
{ BTN_L, BTN_CLEFT }, // SREG
@ -93,6 +94,7 @@ char sRegGroupChars[REG_GROUPS] = {
'k', // kREG
'b', // bREG
};
#endif
void Regs_Init(void) {
s32 i;

View file

@ -10,9 +10,12 @@ TransitionTile sTransitionTile;
s32 gTransitionTileState;
VisMono sPlayVisMono;
Color_RGBA8_u32 gVisMonoColor;
#if OOT_DEBUG
FaultClient D_801614B8;
#endif
s16 sTransitionFillTimer;
u64 sDebugCutsceneScriptBuf[0xA00];
void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn);
@ -451,7 +454,10 @@ void Play_Init(GameState* thisx) {
AnimationContext_Update(this, &this->animationCtx);
gSaveContext.respawnFlag = 0;
if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) {
#if OOT_DEBUG
if (R_USE_DEBUG_CUTSCENE) {
static u64 sDebugCutsceneScriptBuf[0xA00];
gDebugCutsceneScript = sDebugCutsceneScriptBuf;
PRINTF("\nkawauso_data=[%x]", gDebugCutsceneScript);
@ -459,6 +465,7 @@ void Play_Init(GameState* thisx) {
// Presumably the ROM was larger at a previous point in development when this debug feature was used.
DmaMgr_DmaRomToRam(0x03FEB000, gDebugCutsceneScript, sizeof(sDebugCutsceneScriptBuf));
}
#endif
}
void Play_Update(PlayState* this) {