You've already forked hackerlibultra
mirror of
https://github.com/HackerN64/hackerlibultra.git
synced 2026-01-21 10:37:53 -08:00
Handle All Warnings (#2)
* set build options * remove COMPARE and MDOERN_* switches * remove tools makefile * AR patching is gone too since we want a fullly decomped version * AR is modern * remove cwd changes * edit my own tool to fix compile errors * compile files generated with my own tool instead of the originals * inline modern_gcc makefile * port mips toolchain detection logic * add util.mk for find-command * remove forced AR order and strip/mdebug removal commands * add -mabi=32 to as flags * cseq warning * csplayer * env * voicecheckword * voicestopreaddata * voicedata * voicecontwrite4 * voice done * sinf * sched * rg * cosf * timerintr * settimer * xprintf * xldtob * contram * conteepwrite * conteepread * dumpturbo * gt * aisetnextbuf * us2dex_emu * loadtextureblockmipmap * guloadtile_bug * kmcprintf * seq * sndplayer * synthesizer * seqplayer again * load * fix warnings * formatting * address csplayer, gu * remove if(0) * another explicit fallthrough * last explicit fallthrough * simplify triple multiply * its 4 multiplies * its an octuple multiply * CI formatting * sltu in alRaw16Pull * another sltu * handle all sltu's * sndplayer sltu --------- Co-authored-by: someone2639 <someone2639@gmail.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
|
||||
#define FALLTHROUGH __attribute__((fallthrough))
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x)
|
||||
#endif
|
||||
|
||||
@@ -59,7 +59,7 @@ void alCSeqNew(ALCSeq* seq, u8* ptr) {
|
||||
void alCSeqNextEvent(ALCSeq* seq, ALEvent* evt) {
|
||||
u32 i;
|
||||
u32 firstTime = 0xFFFFFFFF;
|
||||
u32 firstTrack;
|
||||
u32 firstTrack = 0;
|
||||
u32 lastTicks = seq->lastDeltaTicks;
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "seqp.h"
|
||||
#include "cseqp.h"
|
||||
#include "cseq.h"
|
||||
#include <PRinternal/macros.h>
|
||||
// TODO: this comes from a header
|
||||
#ident "$Revision: 1.17 $"
|
||||
static ALMicroTime __CSPVoiceHandler(void* node);
|
||||
@@ -534,7 +535,7 @@ static void __CSPHandleMIDIMsg(ALCSPlayer* seqp, ALEvent* event) {
|
||||
* velocity (Should never happen with compact midi sequence,
|
||||
* but could happen with real time midi.)
|
||||
*/
|
||||
|
||||
FALLTHROUGH;
|
||||
case (AL_MIDI_NoteOff):
|
||||
vstate = __lookupVoice((ALSeqPlayer*)seqp, key, chan);
|
||||
ALFlagFailIf(!vstate, seqp->debugFlags & NOTE_OFF_ERR_MASK, ERR_ALSEQP_OFF_VOICE);
|
||||
|
||||
@@ -482,7 +482,7 @@ static s16 _getRate(f64 vol, f64 tgt, s32 count, u16* ratel) {
|
||||
}
|
||||
}
|
||||
|
||||
a *= (a *= (a *= a));
|
||||
a = (a * a * a * a * a * a * a * a);
|
||||
s = (s16)a;
|
||||
*ratel = (s16)(0xffff * (a - (f32)s));
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
|
||||
inp = AL_DECODER_IN;
|
||||
aLoadADPCM(ptr++, f->bookSize, K0_TO_PHYS(f->table->waveInfo.adpcmWave.book->book));
|
||||
|
||||
looped = (outCount + f->sample > f->loop.end) && (f->loop.count != 0);
|
||||
looped = ((u32)(outCount + f->sample) > f->loop.end) && (f->loop.count != 0);
|
||||
if (looped)
|
||||
nSam = f->loop.end - f->sample;
|
||||
else
|
||||
@@ -121,13 +121,13 @@ Acmd* alAdpcmPull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
|
||||
* -1 is loop forever - the loop count is not exact now
|
||||
* for small loops!
|
||||
*/
|
||||
if ((f->loop.count != -1) && (f->loop.count != 0))
|
||||
if ((f->loop.count != 0xFFFFFFFF) && (f->loop.count != 0))
|
||||
f->loop.count--;
|
||||
|
||||
/*
|
||||
* What's left to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->loop.end - f->loop.start);
|
||||
nSam = MIN((u32)outCount, f->loop.end - f->loop.start);
|
||||
tsam = nSam - ADPCMFSIZE + f->lastsam;
|
||||
if (tsam < 0)
|
||||
tsam = 0;
|
||||
@@ -220,7 +220,7 @@ Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
|
||||
if (outCount == 0)
|
||||
return ptr;
|
||||
|
||||
if ((outCount + f->sample > f->loop.end) && (f->loop.count != 0)) {
|
||||
if (((u32)(outCount + f->sample) > f->loop.end) && (f->loop.count != 0)) {
|
||||
|
||||
nSam = f->loop.end - f->sample;
|
||||
nbytes = nSam << 1;
|
||||
@@ -254,13 +254,13 @@ Acmd* alRaw16Pull(void* filter, s16* outp, s32 outCount, s32 sampleOffset, Acmd*
|
||||
/*
|
||||
* -1 is loop forever
|
||||
*/
|
||||
if ((f->loop.count != -1) && (f->loop.count != 0))
|
||||
if ((f->loop.count != 0xFFFFFFFF) && (f->loop.count != 0))
|
||||
f->loop.count--;
|
||||
|
||||
/*
|
||||
* What to compute.
|
||||
*/
|
||||
nSam = MIN(outCount, f->loop.end - f->loop.start);
|
||||
nSam = MIN((u32)outCount, f->loop.end - f->loop.start);
|
||||
nbytes = nSam << 1;
|
||||
|
||||
/*
|
||||
@@ -418,6 +418,8 @@ s32 alLoadParam(void* filter, s32 paramID, void* param) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Acmd* _decodeChunk(Acmd* ptr, ALLoadFilter* f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags) {
|
||||
|
||||
@@ -240,8 +240,7 @@ void alSeqNewMarker(ALSeq* seq, ALSeqMarker* m, u32 ticks) {
|
||||
lastTicks = seq->lastTicks;
|
||||
break;
|
||||
}
|
||||
|
||||
} while (seq->lastTicks < ticks);
|
||||
} while ((u32)seq->lastTicks < ticks);
|
||||
|
||||
m->curPtr = lastPtr;
|
||||
m->lastStatus = lastStatus;
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <os_internal.h>
|
||||
#include <ultraerror.h>
|
||||
#include <assert.h>
|
||||
#include <PRinternal/macros.h>
|
||||
#include "seqp.h"
|
||||
#include "seq.h"
|
||||
|
||||
@@ -539,7 +540,7 @@ void __handleMIDIMsg(ALSeqPlayer* seqp, ALEvent* event) {
|
||||
* NOTE: intentional fall-through for note on with zero
|
||||
* velocity
|
||||
*/
|
||||
|
||||
FALLTHROUGH;
|
||||
case (AL_MIDI_NoteOff):
|
||||
vstate = __lookupVoice(seqp, key, chan);
|
||||
ALFlagFailIf(!vstate, (seqp->debugFlags & NOTE_OFF_ERR_MASK), ERR_ALSEQP_OFF_VOICE);
|
||||
|
||||
@@ -39,7 +39,7 @@ void alSndpNew(ALSndPlayer* sndp, ALSndpConfig* c) {
|
||||
sState = (ALSoundState*)alHeapAlloc(c->heap, 1, c->maxSounds * sizeof(ALSoundState));
|
||||
sndp->sndState = sState;
|
||||
|
||||
for (i = 0; i < c->maxSounds; i++)
|
||||
for (i = 0; i < (u32)c->maxSounds; i++)
|
||||
sState[i].sound = 0;
|
||||
|
||||
/*
|
||||
|
||||
@@ -250,11 +250,8 @@ void __freeParam(ALParam* param) {
|
||||
|
||||
void _collectPVoices(ALSynth* drvr) {
|
||||
ALLink* dl;
|
||||
PVoice* pv;
|
||||
|
||||
while ((dl = drvr->pLameList.next) != 0) {
|
||||
pv = (PVoice*)dl;
|
||||
|
||||
/* ### remove from mixer */
|
||||
|
||||
alUnlink(dl);
|
||||
|
||||
@@ -227,17 +227,16 @@ static void kmcErrorHandler(s16 code, s16 numArgs, ...);
|
||||
OSErrorHandler __kmcErrorHandler = kmcErrorHandler;
|
||||
|
||||
static void kmcErrorHandler(s16 code, s16 numArgs, ...) {
|
||||
int ans;
|
||||
va_list ap;
|
||||
char* fmt;
|
||||
const char* fmt;
|
||||
|
||||
fmt = __os_error_message[code];
|
||||
va_start(ap, numArgs);
|
||||
|
||||
if (__kmc_pt_mode) {
|
||||
ans = _Printf(kmc_proutSyncPrintf, NULL, fmt, ap);
|
||||
_Printf(kmc_proutSyncPrintf, NULL, fmt, ap);
|
||||
} else {
|
||||
ans = _Printf(proutSyncPrintf, NULL, fmt, ap);
|
||||
_Printf(proutSyncPrintf, NULL, fmt, ap);
|
||||
}
|
||||
|
||||
osSyncPrintf("\n");
|
||||
|
||||
@@ -28,7 +28,7 @@ static u32 textures[TX_MAX] ALIGNED(0x8);
|
||||
static u32 numtextures;
|
||||
|
||||
#define UNSEG_ADDR(sa) \
|
||||
((u32*)(((globp) ? (((int)(sa) & 0x00ffffff) + globp->sp.segBases[(int)(sa) >> 24]) : (int)(sa)) | 0x80000000))
|
||||
((u32*)(((globp) ? (((u32)(sa) & 0x00ffffff) + globp->sp.segBases[(u32)(sa) >> 24]) : (u32)(sa)) | 0x80000000))
|
||||
#define PHYS(a) ((int)((int)(a) & 0x7fffffff))
|
||||
#define UNPHYS(a) ((u32*)((int)(a) | 0x80000000))
|
||||
|
||||
@@ -38,7 +38,7 @@ static u32 numtextures;
|
||||
|
||||
#define UCODE_SIZE_MAX (4096 * 1)
|
||||
void gtDumpTurbo(OSTask* tp, u8 flags) {
|
||||
int i;
|
||||
u32 i;
|
||||
gtGfx* gtlistp;
|
||||
gtGlobState* globp = 0;
|
||||
gtState* statep;
|
||||
@@ -53,17 +53,17 @@ void gtDumpTurbo(OSTask* tp, u8 flags) {
|
||||
|
||||
#if 1
|
||||
PRINTF("? %08x\n", PHYS(tp->t.ucode_boot));
|
||||
for (i = (int)tp->t.ucode_boot; i < (int)tp->t.ucode_boot + tp->t.ucode_boot_size; i += 4) {
|
||||
for (i = (u32)tp->t.ucode_boot; i < (u32)(tp->t.ucode_boot + tp->t.ucode_boot_size); i += 4) {
|
||||
PRINTF("|%08x\n", (int)*((u32*)i));
|
||||
}
|
||||
|
||||
PRINTF("? %08x\n", PHYS(tp->t.ucode));
|
||||
for (i = (int)tp->t.ucode; i < (int)tp->t.ucode + UCODE_SIZE_MAX; i += 4) {
|
||||
for (i = (u32)tp->t.ucode; i < (u32)(tp->t.ucode + UCODE_SIZE_MAX); i += 4) {
|
||||
PRINTF("|%08x\n", (int)*((u32*)i));
|
||||
}
|
||||
|
||||
PRINTF("? %08x\n", PHYS(tp->t.ucode_data));
|
||||
for (i = (int)tp->t.ucode_data; i < (int)tp->t.ucode_data + tp->t.ucode_data_size; i += 4) {
|
||||
for (i = (u32)tp->t.ucode_data; i < (u32)(tp->t.ucode_data + tp->t.ucode_data_size); i += 4) {
|
||||
PRINTF("|%08x\n", (int)*((u32*)i));
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* Set the cached RDP othermode word in the gt state structure.
|
||||
*/
|
||||
void gtStateSetOthermode(Gfx* om, gtStateOthermode_t mode, int data) {
|
||||
int shift, length;
|
||||
int shift = 0, length = 0;
|
||||
u32 mask;
|
||||
|
||||
if (mode == GT_CLEAR) { /* special case */
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
/* coefficients for polynomial approximation of cos on +/- pi/2 */
|
||||
|
||||
static const du P[] = {
|
||||
{ 0x3ff00000, 0x00000000 }, { 0xbfc55554, 0xbc83656d }, { 0x3f8110ed, 0x3804c2a0 },
|
||||
{ 0xbf29f6ff, 0xeea56814 }, { 0x3ec5dbdf, 0x0e314bfe },
|
||||
{ { 0x3ff00000, 0x00000000 } }, { { 0xbfc55554, 0xbc83656d } }, { { 0x3f8110ed, 0x3804c2a0 } },
|
||||
{ { 0xbf29f6ff, 0xeea56814 } }, { { 0x3ec5dbdf, 0x0e314bfe } },
|
||||
};
|
||||
|
||||
static const du rpi = { 0x3fd45f30, 0x6dc9c883 };
|
||||
static const du rpi = { { 0x3fd45f30, 0x6dc9c883 } };
|
||||
|
||||
static const du pihi = { 0x400921fb, 0x50000000 };
|
||||
static const du pihi = { { 0x400921fb, 0x50000000 } };
|
||||
|
||||
static const du pilo = { 0x3e6110b4, 0x611a6263 };
|
||||
static const du pilo = { { 0x3e6110b4, 0x611a6263 } };
|
||||
|
||||
static const fu zero = { 0x00000000 };
|
||||
|
||||
|
||||
@@ -30,12 +30,11 @@ void guDPLoadTextureTile(Gfx* temp, void* timg, int texl_fmt, int texl_size, int
|
||||
int shiftt) {
|
||||
int line;
|
||||
int tile_width, tile_height; /*
|
||||
|
||||
* in texels
|
||||
*/
|
||||
* in texels
|
||||
*/
|
||||
int dxt;
|
||||
int sizeb;
|
||||
int lineb;
|
||||
int sizeb = 0;
|
||||
int lineb = 0;
|
||||
int line_size; /*
|
||||
|
||||
* in 64-bit words
|
||||
@@ -140,7 +139,6 @@ void guDPLoadTextureTile_4b(Gfx* temp, void* timg, int texl_fmt, int img_width,
|
||||
int line;
|
||||
int tile_width, tile_height;
|
||||
int dxt;
|
||||
int sizeb;
|
||||
int lineb;
|
||||
int line_size;
|
||||
int count;
|
||||
@@ -150,7 +148,6 @@ void guDPLoadTextureTile_4b(Gfx* temp, void* timg, int texl_fmt, int img_width,
|
||||
|
||||
tile_width = (lrs - uls + 1) >> 1;
|
||||
tile_height = lrt - ult + 1;
|
||||
sizeb = G_IM_SIZ_8b_BYTES;
|
||||
lineb = G_IM_SIZ_8b_LINE_BYTES;
|
||||
line_size = ((tile_width * lineb) + 7) >> 3;
|
||||
dxt = CALC_DXT_4b(tile_width);
|
||||
|
||||
@@ -43,7 +43,7 @@ struct Tile {
|
||||
|
||||
/* tram mipmaps */
|
||||
static struct Tile mipmap[MM_MAX_LEVEL + 1] ALIGNED(0x8);
|
||||
static struct texelSizeParams sizeParams[4] = { 16, 3, 1, 0, 8, 2, 2, 1, 4, 1, 4, 2, 2, 0, 8, 3 };
|
||||
static struct texelSizeParams sizeParams[4] = { { 16, 3, 1, 0 }, { 8, 2, 2, 1 }, { 4, 1, 4, 2 }, { 2, 0, 8, 3 } };
|
||||
|
||||
static int max_mipmap;
|
||||
static unsigned char* tram;
|
||||
@@ -493,7 +493,7 @@ int guLoadTextureBlockMipMap(Gfx** glistp, unsigned char* tbuf, Image* im, unsig
|
||||
/*
|
||||
* Add entries for texture loading and rendering in DL
|
||||
*/
|
||||
stuffDisplayList(glistp, im, tbuf, startTile, pal, cms, cmt, masks, maskt, shifts, shiftt);
|
||||
stuffDisplayList(glistp, im, (char*)tbuf, startTile, pal, cms, cmt, masks, maskt, shifts, shiftt);
|
||||
|
||||
return errNo;
|
||||
} /* end guLoadTextureBlockMipMap */
|
||||
@@ -532,7 +532,7 @@ static void stuffDisplayList(Gfx** glistp, Image* im, char* tbuf, unsigned char
|
||||
unsigned char shifts, unsigned char shiftt) {
|
||||
int tile;
|
||||
int Smask, Tmask;
|
||||
int Sshift, Tshift;
|
||||
int Sshift = 0, Tshift = 0;
|
||||
|
||||
/*
|
||||
* set LOADTILE for loading texture
|
||||
|
||||
@@ -37,15 +37,15 @@
|
||||
/* coefficients for polynomial approximation of sin on +/- pi/2 */
|
||||
|
||||
static const du P[] = {
|
||||
{ 0x3ff00000, 0x00000000 }, { 0xbfc55554, 0xbc83656d }, { 0x3f8110ed, 0x3804c2a0 },
|
||||
{ 0xbf29f6ff, 0xeea56814 }, { 0x3ec5dbdf, 0x0e314bfe },
|
||||
{ { 0x3ff00000, 0x00000000 } }, { { 0xbfc55554, 0xbc83656d } }, { { 0x3f8110ed, 0x3804c2a0 } },
|
||||
{ { 0xbf29f6ff, 0xeea56814 } }, { { 0x3ec5dbdf, 0x0e314bfe } },
|
||||
};
|
||||
|
||||
static const du rpi = { 0x3fd45f30, 0x6dc9c883 };
|
||||
static const du rpi = { { 0x3fd45f30, 0x6dc9c883 } };
|
||||
|
||||
static const du pihi = { 0x400921fb, 0x50000000 };
|
||||
static const du pihi = { { 0x400921fb, 0x50000000 } };
|
||||
|
||||
static const du pilo = { 0x3e6110b4, 0x611a6263 };
|
||||
static const du pilo = { { 0x3e6110b4, 0x611a6263 } };
|
||||
|
||||
static const fu zero = { 0x00000000 };
|
||||
|
||||
|
||||
@@ -62,9 +62,9 @@ static void tmemLoad_B(Gfx** pkt, u32 imagePtr, s16 loadLines, s16 tmemSH) {
|
||||
(*pkt)->words.w0 = (G_LOADTILE << 24) | 0x000000;
|
||||
/* addition 99/5/31(Y) */
|
||||
if (bgflg == 3)
|
||||
(*pkt)->words.w1 = 0x07000000 | (tmemSH - 1) << 16;
|
||||
(*pkt)->words.w1 = 0x07000000 | ((tmemSH - 1) << 16);
|
||||
else
|
||||
(*pkt)->words.w1 = 0x07000000 | (tmemSH - 1) << 16 | (loadLines << 2) - 1;
|
||||
(*pkt)->words.w1 = 0x07000000 | ((tmemSH - 1) << 16) | ((loadLines << 2) - 1);
|
||||
(*pkt)++;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ static void tmemLoad(Gfx** pkt, u32* imagePtr, s16* imageRemain, s16 drawLines,
|
||||
imagePtr1A = (*imagePtr) + iLoadable * imageSrcWsize;
|
||||
imagePtr1B = imageTop;
|
||||
SubSliceY1 = iLoadable;
|
||||
if (SubSliceL1 = iLoadable & 1) {
|
||||
if ((SubSliceL1 = iLoadable & 1)) {
|
||||
imagePtr1A -= imageSrcWsize;
|
||||
imagePtr1B -= imageSrcWsize;
|
||||
imagePtr1B = imageTopSeg | (imagePtr1B & 0x00ffffff); /*Segment countermeasure */
|
||||
@@ -477,10 +477,10 @@ void guS2DEmuBgRect1Cyc(Gfx** pkt, uObjBg* bg) {
|
||||
(*pkt)->words.w0 = (imageS<<16) | imageT;
|
||||
(*pkt)->words.w1 = (scaleW<<16) | scaleH;
|
||||
#else /* At RSP command creation time */
|
||||
(*pkt)->words.w0 = (G_RDPHALF_1 << 24);
|
||||
(*pkt)->words.w0 = ((u8)G_RDPHALF_1 << 24);
|
||||
(*pkt)->words.w1 = (imageS << 16) | imageT;
|
||||
(*pkt)++;
|
||||
(*pkt)->words.w0 = (G_RDPHALF_2 << 24);
|
||||
(*pkt)->words.w0 = ((u8)G_RDPHALF_2 << 24);
|
||||
(*pkt)->words.w1 = (scaleW << 16) | scaleH;
|
||||
#endif
|
||||
(*pkt)++;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
s32 osAiSetNextBuffer(void* bufPtr, u32 size) {
|
||||
static u8 hdwrBugFlag = FALSE;
|
||||
char* bptr;
|
||||
u8* bptr;
|
||||
|
||||
if (__osAiDeviceBusy()) {
|
||||
return -1;
|
||||
|
||||
@@ -28,12 +28,7 @@ s32 osEepromRead(OSMesgQueue* mq, u8 address, u8* buffer) {
|
||||
}
|
||||
break;
|
||||
case CONT_EEPROM | CONT_EEP16K:
|
||||
if (address >= EEP16K_MAXBLOCKS) {
|
||||
// not technically possible
|
||||
ret = CONT_RANGE_ERROR;
|
||||
} else {
|
||||
__osEepromRead16K = 1;
|
||||
}
|
||||
__osEepromRead16K = 1;
|
||||
break;
|
||||
default:
|
||||
ret = CONT_NO_RESPONSE_ERROR;
|
||||
|
||||
@@ -26,10 +26,7 @@ s32 osEepromWrite(OSMesgQueue* mq, u8 address, u8* buffer) {
|
||||
}
|
||||
break;
|
||||
case CONT_EEPROM | CONT_EEP16K:
|
||||
if (address >= EEP16K_MAXBLOCKS) {
|
||||
// not technically possible
|
||||
ret = CONT_RANGE_ERROR;
|
||||
} else if (__osEepromRead16K) {
|
||||
if (__osEepromRead16K) {
|
||||
__osEepromRead16K = 0;
|
||||
__osSiRelAccess();
|
||||
osEepromRead(mq, (address ^ 1), temp);
|
||||
@@ -99,7 +96,7 @@ s32 __osEepStatus(OSMesgQueue* mq, OSContStatus* data) {
|
||||
u8* ptr = (u8*)__osEepPifRam.ramarray;
|
||||
__OSContRequesFormat requestformat;
|
||||
|
||||
for (i = 0; i < ARRLEN(__osEepPifRam.ramarray) + 1; i++) {
|
||||
for (i = 0; i < ARRLEN(__osEepPifRam.ramarray); i++) {
|
||||
__osEepPifRam.ramarray[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user