1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-06-08 17:41:56 +00:00

questionable UNUSED and STACK_PAD more usage

This commit is contained in:
Dragorn421 2025-06-07 05:51:14 +02:00
parent 58287f21a8
commit 578642e33b
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
18 changed files with 54 additions and 20 deletions

View file

@ -477,9 +477,9 @@ void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer) {
* original name: Nas_ReleaseGroup * original name: Nas_ReleaseGroup
*/ */
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) { void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer) {
#if !(OOT_VERSION < NTSC_1_1 || !PLATFORM_N64)
s32 finished = 0; s32 finished = 0;
#if !(OOT_VERSION < NTSC_1_1 || !PLATFORM_N64)
if (seqPlayer->finished == 1) { if (seqPlayer->finished == 1) {
finished = 1; finished = 1;
} }

View file

@ -299,7 +299,7 @@ void* gzip_malloc(size_t size) {
return ret; return ret;
} }
void gzip_free(void* ptr) { void gzip_free(UNUSED void* ptr) {
gzip_malloc_tmp = 0; gzip_malloc_tmp = 0;
gzip_malloc_addr = gzip_mem_buff; gzip_malloc_addr = gzip_mem_buff;
} }

View file

@ -1,5 +1,6 @@
#include "libu64/debug.h" #include "libu64/debug.h"
#include "alignment.h" #include "alignment.h"
#include "attributes.h"
#include "carthandle.h" #include "carthandle.h"
#include "line_numbers.h" #include "line_numbers.h"
#include "padmgr.h" #include "padmgr.h"
@ -29,6 +30,9 @@ typedef struct LocaleCartInfo {
void Locale_Init(void) { void Locale_Init(void) {
#if !PLATFORM_GC #if !PLATFORM_GC
ALIGNED(4) u8 regionInfo[4]; ALIGNED(4) u8 regionInfo[4];
#if PLATFORM_IQUE
UNUSED
#endif
u8 countryCode; u8 countryCode;
osEPiReadIo(gCartHandle, 0x3C, (u32*)regionInfo); osEPiReadIo(gCartHandle, 0x3C, (u32*)regionInfo);

View file

@ -380,7 +380,9 @@ void DmaMgr_ProcessRequest(DmaRequest* req) {
u8 found = false; u8 found = false;
DmaEntry* iter; DmaEntry* iter;
UNUSED_NDEBUG const char* filename; UNUSED_NDEBUG const char* filename;
#if !PLATFORM_GC
s32 i = 0; s32 i = 0;
#endif
#if DEBUG_FEATURES #if DEBUG_FEATURES
// Get the filename (for debugging) // Get the filename (for debugging)

View file

@ -1902,7 +1902,6 @@ void CollisionCheck_ATCylVsACJntSph(PlayState* play, UNUSED CollisionCheckContex
Vec3f hitPos; Vec3f hitPos;
Vec3f atPos; Vec3f atPos;
Vec3f acPos; Vec3f acPos;
f32 acToHit;
atPos.x = atCyl->dim.pos.x; atPos.x = atCyl->dim.pos.x;
atPos.y = atCyl->dim.pos.y; atPos.y = atCyl->dim.pos.y;

View file

@ -1,4 +1,5 @@
#include "kanread.h" #include "kanread.h"
#include "attributes.h"
#include "message_data_static.h" #include "message_data_static.h"
#include "printf.h" #include "printf.h"
#include "segment_symbols.h" #include "segment_symbols.h"
@ -12,11 +13,13 @@
* Loads a texture from kanji for the requested `character` into the character texture buffer * Loads a texture from kanji for the requested `character` into the character texture buffer
* at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character. * at `codePointIndex`. The value of `character` is the SHIFT-JIS encoding of the character.
*/ */
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
#if OOT_NTSC #if OOT_NTSC
void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) {
DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex],
(uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE, (uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE,
"../z_kanfont.c", UNK_LINE); "../z_kanfont.c", UNK_LINE);
#else
void Font_LoadCharWide(UNUSED Font* font, UNUSED u16 character, UNUSED u16 codePointIndex) {
#endif #endif
} }
@ -63,7 +66,9 @@ void Font_LoadOrderedFont(Font* font) {
s32 fontBufIndex; s32 fontBufIndex;
u32 offset; u32 offset;
const char* messageDataStart; const char* messageDataStart;
#if PLATFORM_IQUE
u16* msgBufWide; u16* msgBufWide;
#endif
#if OOT_NTSC && !PLATFORM_IQUE #if OOT_NTSC && !PLATFORM_IQUE
messageDataStart = (const char*)_jpn_message_data_staticSegmentStart; messageDataStart = (const char*)_jpn_message_data_staticSegmentStart;

View file

@ -1769,7 +1769,11 @@ void Message_Decode(PlayState* play) {
s32 charTexIdx = 0; s32 charTexIdx = 0;
s16 i; s16 i;
#if !(PLATFORM_GC && OOT_PAL) #if !(PLATFORM_GC && OOT_PAL)
#if OOT_NTSC
s16 j; s16 j;
#else
STACK_PAD(s16);
#endif
#endif #endif
s16 decodedBufPos = 0; s16 decodedBufPos = 0;
s16 numLines = 0; s16 numLines = 0;
@ -1780,8 +1784,12 @@ void Message_Decode(PlayState* play) {
u16 value; u16 value;
u8 curChar; u8 curChar;
#if !(PLATFORM_GC && OOT_PAL) #if !(PLATFORM_GC && OOT_PAL)
#if OOT_NTSC
u16 curCharWide; u16 curCharWide;
u8* fontBuf; u8* fontBuf;
#else
STACK_PADS(s32, 2);
#endif
#endif #endif
msgCtx->textDelayTimer = 0; msgCtx->textDelayTimer = 0;
@ -4147,9 +4155,9 @@ void Message_Update(PlayState* play) {
0x0015, 0x0016, 0x0017, 0x0003, 0x0000, 0x270B, 0x00C8, 0x012C, 0x012D, 0xFFDA, 0x0014, 0x0016, 0x0014, 0x0016, 0x0015, 0x0016, 0x0017, 0x0003, 0x0000, 0x270B, 0x00C8, 0x012C, 0x012D, 0xFFDA, 0x0014, 0x0016, 0x0014, 0x0016,
}; };
#if OOT_VERSION < GC_US #if OOT_VERSION < GC_US
static s32 sUnknown = 0; UNUSED static s32 sUnknown = 0;
#elif PLATFORM_IQUE #elif PLATFORM_IQUE
static u16 sUnknown = 0; UNUSED static u16 sUnknown = 0;
#endif #endif
static char D_80153D74 = 0; static char D_80153D74 = 0;
MessageContext* msgCtx = &play->msgCtx; MessageContext* msgCtx = &play->msgCtx;

View file

@ -2814,6 +2814,9 @@ void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) {
void Interface_DrawItemButtons(PlayState* play) { void Interface_DrawItemButtons(PlayState* play) {
static void* cUpLabelTextures[] = LANGUAGE_ARRAY(gNaviCUpJPNTex, gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex); static void* cUpLabelTextures[] = LANGUAGE_ARRAY(gNaviCUpJPNTex, gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex);
#if OOT_VERSION >= PAL_1_0 #if OOT_VERSION >= PAL_1_0
#if OOT_NTSC
UNUSED
#endif
static s16 startButtonLeftPos[] = { 132, 130, 130 }; static s16 startButtonLeftPos[] = { 132, 130, 130 };
#endif #endif
InterfaceContext* interfaceCtx = &play->interfaceCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx;

View file

@ -10,7 +10,9 @@ StackEntry* sStackInfoListEnd = NULL;
void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace, void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 initValue, s32 minSpace,
const char* name) { const char* name) {
#if !PLATFORM_N64
StackEntry* iter; StackEntry* iter;
#endif
u32* addr; u32* addr;
if (entry == NULL) { if (entry == NULL) {

View file

@ -2,6 +2,7 @@
#include "synthInternals.h" #include "synthInternals.h"
#include "stdbool.h" #include "stdbool.h"
#include "stddef.h" #include "stddef.h"
#include "attributes.h"
// WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC WITH SCALING IN MICROCODE!!! // WARNING: THE FOLLOWING CONSTANT MUST BE KEPT IN SYNC WITH SCALING IN MICROCODE!!!
#define SCALE 16384 #define SCALE 16384
@ -211,7 +212,7 @@ void alEnvmixerNew(ALEnvMixer* e, ALHeap* hp) {
} }
void alLoadNew(ALLoadFilter* f, ALDMANew dmaNew, ALHeap* hp) { void alLoadNew(ALLoadFilter* f, ALDMANew dmaNew, ALHeap* hp) {
s32 i; UNUSED s32 i;
// init filter superclass // init filter superclass
alFilterNew(&f->filter, alAdpcmPull, alLoadParam, AL_ADPCM); alFilterNew(&f->filter, alAdpcmPull, alLoadParam, AL_ADPCM);

View file

@ -3,6 +3,7 @@
#include "stdbool.h" #include "stdbool.h"
#include "stddef.h" #include "stddef.h"
#include "ultra64/convert.h" #include "ultra64/convert.h"
#include "attributes.h"
#define EQPOWER_LENGTH 128 #define EQPOWER_LENGTH 128
static s16 eqpower[EQPOWER_LENGTH] = { static s16 eqpower[EQPOWER_LENGTH] = {
@ -20,7 +21,7 @@ static Acmd* _pullSubFrame(void* filter, s16* inp, s16* outp, s32 outCount, s32
static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel); static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel);
static f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel); static f32 _getVol(f32 ivol, s32 samples, s16 ratem, u16 ratel);
Acmd* alEnvmixerPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* p) { Acmd* alEnvmixerPull(void* filter, UNUSED s16* outp, s32 outCount, s32 sampleOffset, Acmd* p) {
Acmd* ptr = p; Acmd* ptr = p;
ALEnvMixer* e = (ALEnvMixer*)filter; ALEnvMixer* e = (ALEnvMixer*)filter;
s16 inp; s16 inp;

View file

@ -1,8 +1,9 @@
#include "libaudio.h" #include "libaudio.h"
#include "synthInternals.h" #include "synthInternals.h"
#include "stddef.h" #include "stddef.h"
#include "attributes.h"
void* alHeapDBAlloc(u8* file, s32 line, ALHeap* hp, s32 num, s32 size) { void* alHeapDBAlloc(UNUSED u8* file, UNUSED s32 line, ALHeap* hp, s32 num, s32 size) {
s32 bytes; s32 bytes;
u8* ptr = NULL; u8* ptr = NULL;

View file

@ -4,6 +4,7 @@
#include "stddef.h" #include "stddef.h"
#include "stdint.h" #include "stdint.h"
#include "ultra64/R4300.h" #include "ultra64/R4300.h"
#include "attributes.h"
#ifndef MIN #ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b))
@ -14,7 +15,7 @@
static Acmd* _decodeChunk(Acmd* ptr, ALLoadFilter* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags); static Acmd* _decodeChunk(Acmd* ptr, ALLoadFilter* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags);
Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* p) { Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, UNUSED s32 sampleOffset, Acmd* p) {
Acmd* ptr = p; Acmd* ptr = p;
s16 inp; s16 inp;
s32 tsam; s32 tsam;
@ -155,7 +156,7 @@ Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
return ptr; return ptr;
} }
Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* p) { Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, UNUSED s32 sampleOffset, Acmd* p) {
Acmd* ptr = p; Acmd* ptr = p;
s32 nbytes; s32 nbytes;
s32 dramLoc; s32 dramLoc;
@ -166,7 +167,7 @@ Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
s32 nSam; s32 nSam;
s32 op; s32 op;
ALLoadFilter* f = (ALLoadFilter*)filter; ALLoadFilter* f = (ALLoadFilter*)filter;
ALFilter* a = (ALFilter*)filter; UNUSED ALFilter* a = (ALFilter*)filter;
if (outCount == 0) { if (outCount == 0) {
return ptr; return ptr;

View file

@ -4,6 +4,7 @@
#include "stddef.h" #include "stddef.h"
#include "stdint.h" #include "stdint.h"
#include "ultra64/convert.h" #include "ultra64/convert.h"
#include "attributes.h"
#define RANGE 2.0 #define RANGE 2.0
@ -26,10 +27,10 @@ Acmd* alFxPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd* p)
s16 output; s16 output;
s16* in_ptr; s16* in_ptr;
s16* out_ptr; s16* out_ptr;
s16 gain; UNUSED s16 gain;
s16* prev_out_ptr = NULL; s16* prev_out_ptr = NULL;
ALDelay* d; ALDelay* d;
ALDelay* pd; UNUSED ALDelay* pd;
// pull channels going into this effect first // pull channels going into this effect first
ptr = (*source->handler)(source, outp, outCount, sampleOffset, p); ptr = (*source->handler)(source, outp, outCount, sampleOffset, p);

View file

@ -1,6 +1,7 @@
#include "libaudio.h" #include "libaudio.h"
#include "synthInternals.h" #include "synthInternals.h"
#include "stddef.h" #include "stddef.h"
#include "attributes.h"
#ifndef MIN #ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) #define MIN(a, b) (((a) < (b)) ? (a) : (b))
@ -11,9 +12,9 @@ static s32 _timeToSamplesNoRound(ALSynth* synth, s32 micros);
void alSynNew(ALSynth* drvr, ALSynConfig* c) { void alSynNew(ALSynth* drvr, ALSynConfig* c) {
s32 i; s32 i;
ALVoice* vv; UNUSED ALVoice* vv;
PVoice* pv; PVoice* pv;
ALVoice* vvoices; UNUSED ALVoice* vvoices;
PVoice* pvoices; PVoice* pvoices;
ALHeap* hp = c->heap; ALHeap* hp = c->heap;
ALSave* save; ALSave* save;

View file

@ -1,4 +1,5 @@
#include "ultra64.h" #include "ultra64.h"
#include "attributes.h"
#define MOTOR_ID 0x80 #define MOTOR_ID 0x80
@ -6,8 +7,8 @@
OSPifRam __MotorDataBuf[MAXCONTROLLERS]; OSPifRam __MotorDataBuf[MAXCONTROLLERS];
#endif #endif
s32 __osMotorAccess(OSPfs* pfs, s32 vibrate) {
#ifndef BBPLAYER #ifndef BBPLAYER
s32 __osMotorAccess(OSPfs* pfs, s32 vibrate) {
s32 i; s32 i;
s32 ret; s32 ret;
u8* ptr = (u8*)&__MotorDataBuf[pfs->channel]; u8* ptr = (u8*)&__MotorDataBuf[pfs->channel];
@ -47,6 +48,7 @@ s32 __osMotorAccess(OSPfs* pfs, s32 vibrate) {
return ret; return ret;
#else #else
s32 __osMotorAccess(UNUSED OSPfs* pfs, UNUSED s32 vibrate) {
return PFS_ERR_INVALID; return PFS_ERR_INVALID;
#endif #endif
} }
@ -76,8 +78,8 @@ void _MakeMotorData(s32 channel, OSPifRam* mdata) {
} }
#endif #endif
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel) {
#ifndef BBPLAYER #ifndef BBPLAYER
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel) {
s32 ret; s32 ret;
u8 temp[BLOCKSIZE]; u8 temp[BLOCKSIZE];
@ -133,6 +135,7 @@ s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel) {
pfs->status = PFS_MOTOR_INITIALIZED; pfs->status = PFS_MOTOR_INITIALIZED;
return 0; // "Recognized rumble pak" return 0; // "Recognized rumble pak"
#else #else
s32 osMotorInit(UNUSED OSMesgQueue* ctrlrqueue, UNUSED OSPfs* pfs, UNUSED s32 channel) {
return PFS_ERR_DEVICE; return PFS_ERR_DEVICE;
#endif #endif
} }

View file

@ -292,9 +292,9 @@ s32 EnKz_UpdateTalking(PlayState* play, Actor* thisx, s16* talkState, f32 intera
void func_80A9CB18(EnKz* this, PlayState* play) { void func_80A9CB18(EnKz* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
#if OOT_VERSION < PAL_1_0
f32 yaw; f32 yaw;
#if OOT_VERSION < PAL_1_0
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
yaw -= this->actor.shape.rot.y; yaw -= this->actor.shape.rot.y;
if (fabsf(yaw) > 1820.0f) { if (fabsf(yaw) > 1820.0f) {

View file

@ -402,12 +402,14 @@ void FileSelect_InitModeUpdate(GameState* thisx) {
#endif #endif
} }
void FileSelect_InitModeDraw(GameState* thisx) {
#if OOT_PAL_N64 #if OOT_PAL_N64
void FileSelect_InitModeDraw(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx; FileSelectState* this = (FileSelectState*)thisx;
Gfx_SetupDL_39Opa(this->state.gfxCtx); Gfx_SetupDL_39Opa(this->state.gfxCtx);
FileSelect_DrawInitialLanguageMenu(this); FileSelect_DrawInitialLanguageMenu(this);
#else
void FileSelect_InitModeDraw(UNUSED GameState* thisx) {
#endif #endif
} }