Enable -Wint-conversion warning (#1266)

* fixing some warnings

* more pointer fixing

* Use `-Wno-int-conversion` on audio files

* more progress

* fix

* more pointer fixes

* kinda progress

* Fix remaining casts

* Format

* fix merge

* fix warnings

* fix parameter

* use SEGMENT_ROM_START_OFFSET a bit more

* format

* fix audio warnings

* some more fixes

* fix en_go

* review

* review

* whoops, missing cast

* review

* review

* ->data

* format

* review

* fix

* asPtr

* fix

* Update src/code/sched.c

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* review

* fix in EnDnh

* improve format

* engo

* format

* fix

* format

* Update include/z64.h

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* TexturePtr

* fix warnings

* fix warnings

* format

* fix

* review

---------

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
Anghelo Carvajal
2023-11-02 10:07:38 +11:00
committed by GitHub
co-authored by Derek Hensley
parent 42e1c438e1
commit f276d2b0e6
53 changed files with 1753 additions and 1350 deletions
+1 -1
View File
@@ -108,7 +108,7 @@ endif
# Check code syntax with host compiler
ifneq ($(RUN_CC_CHECK),0)
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
CHECK_WARNINGS := -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -nostdinc $(CHECK_WARNINGS)
ifneq ($(WERROR), 0)
CC_CHECK += -Werror
+3 -3
View File
@@ -248,7 +248,7 @@ typedef enum {
* @param sfxState
*/
#define AUDIOCMD_CHANNEL_SET_SFX_STATE(seqPlayerIndex, channelIndex, sfxState) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), sfxState)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), (s32)sfxState)
/**
* Set the reverb index.
@@ -493,7 +493,7 @@ typedef enum {
* @param functionPtr
*/
#define AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(functionType, functionPtr) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), functionPtr)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), (s32)functionPtr)
/**
* Do something related to the unloaded-type audio data in the heap.
@@ -514,7 +514,7 @@ typedef enum {
* @param data
*/
#define AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, dataType, data) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), data)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), (s32)data)
/**
* Change the sound mode of audio
+2 -2
View File
@@ -541,8 +541,8 @@ void Color_RGB8_Lerp(Color_RGB8* from, Color_RGB8* to, f32 lerp, Color_RGB8* dst
void Lib_Nop801004FC(void);
void* Lib_SegmentedToVirtual(void* ptr);
void* Lib_SegmentedToVirtualNull(void* ptr);
void* Lib_VirtualToPhysical(void* ptr);
void* Lib_PhysicalToVirtual(void* ptr);
uintptr_t Lib_VirtualToPhysical(void* ptr);
void* Lib_PhysicalToVirtual(uintptr_t ptr);
void LifeMeter_Init(PlayState* play);
void LifeMeter_UpdateColors(PlayState* play);
s32 LifeMeter_SaveInterfaceHealth(PlayState* play);
+2 -2
View File
@@ -36,7 +36,7 @@ typedef struct OverlayRelocationSection {
} OverlayRelocationSection; // size >= 0x18
// Fragment overlay load functions
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd, void* allocatedRamAddr);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd);
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);
#endif
+1 -1
View File
@@ -9,7 +9,7 @@ extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern size_t gSystemHeapSize;
extern u32 gSegments[NUM_SEGMENTS];
extern uintptr_t gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern OSThread gGraphThread;
extern PadMgr gPadMgr;
+5 -3
View File
@@ -24,9 +24,11 @@
#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))
#define SEGMENT_ROM_START(segment) (_ ## segment ## SegmentRomStart)
#define SEGMENT_ROM_END(segment) (_ ## segment ## SegmentRomEnd)
#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
#define SEGMENT_ROM_START(segment) ((uintptr_t) _ ## segment ## SegmentRomStart)
#define SEGMENT_ROM_START_OFFSET(segment, offset) ((uintptr_t) (( _ ## segment ## SegmentRomStart ) + (offset)))
#define SEGMENT_ROM_END(segment) ((uintptr_t) _ ## segment ## SegmentRomEnd)
#define SEGMENT_ROM_SIZE(segment) (SEGMENT_ROM_END(segment) - SEGMENT_ROM_START(segment))
#define SEGMENT_ROM_SIZE_ALT(segment) ((size_t)( _ ## segment ## SegmentRomEnd - _ ## segment ## SegmentRomStart ))
#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
+1 -1
View File
@@ -5,7 +5,7 @@
typedef struct {
/* 0x00 */ s32 requestType;
/* 0x04 */ OSMesg response;
/* 0x04 */ s32 response;
/* 0x08 */ void* addr;
/* 0x0C */ s32 pageNum;
/* 0x10 */ s32 pageCount;
+2 -1
View File
@@ -3,6 +3,7 @@
#include "ultra64.h"
#include "libc/stdint.h"
#include "libc/stddef.h"
typedef struct TwoHeadArena {
/* 0x0 */ size_t size;
@@ -19,7 +20,7 @@ void* THA_AllocHeadByte(TwoHeadArena* tha);
void* THA_AllocTail(TwoHeadArena* tha, size_t size);
void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size);
void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask);
s32 THA_GetRemaining(TwoHeadArena* tha);
ptrdiff_t THA_GetRemaining(TwoHeadArena* tha);
u32 THA_IsCrash(TwoHeadArena* tha);
void THA_Reset(TwoHeadArena* tha);
void THA_Init(TwoHeadArena* tha, void* start, size_t size);
+2 -1
View File
@@ -597,6 +597,7 @@ typedef struct {
/* 0x4 */ s8 asSbyte;
/* 0x4 */ u8 asUbyte;
/* 0x4 */ u32 asUInt;
/* 0x4 */ void* asPtr;
};
} AudioCmd; // size = 0x8
@@ -931,7 +932,7 @@ typedef struct {
typedef void (*AudioCustomUpdateFunction)(void);
typedef u32 (*AudioCustomSeqFunction)(s8 value, SequenceChannel* channel);
typedef s32 (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
typedef void* (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
typedef Acmd* (*AudioCustomSynthFunction)(Acmd*, s32, s32);
extern OSVoiceHandle gVoiceHandle;
+2 -2
View File
@@ -199,8 +199,8 @@ typedef struct {
u16 wchar[640]; // msgBufWide
u64 force_structure_alignment_msg;
} msgBuf;
/* 0x11D80 */ u32 messageStart;
/* 0x11D84 */ u32 messageEnd;
/* 0x11D80 */ uintptr_t messageStart;
/* 0x11D84 */ uintptr_t messageEnd;
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
} Font; // size = 0x11D90
+1 -1
View File
@@ -1441,7 +1441,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {
sampleBankTable = gAudioCtx.sampleBankTable;
numFonts = gAudioCtx.soundFontTable->numEntries;
change.oldAddr = AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
change.oldAddr = (uintptr_t)AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
if (change.oldAddr == 0) {
return;
}
+22 -22
View File
@@ -32,7 +32,7 @@ typedef struct {
void AudioLoad_DiscardFont(s32 fontId);
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
u8* AudioLoad_SyncLoadSeq(s32 seqId);
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
SoundFontData* AudioLoad_SyncLoadFont(u32 fontId);
void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate);
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id);
@@ -414,7 +414,7 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3
AudioLoad_SyncLoadSeq(seqId);
}
if (arg2 != 0) {
osSendMesg(arg3, arg2 << 0x18, OS_MESG_NOBLOCK);
osSendMesg(arg3, (OSMesg)(arg2 << 0x18), OS_MESG_NOBLOCK);
}
}
}
@@ -431,10 +431,10 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
}
if (sample->medium == MEDIUM_UNK) {
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size,
AudioLoad_SyncDmaUnkMedium((uintptr_t)sample->sampleAddr, sampleAddr, sample->size,
gAudioCtx.sampleBankTable->unkMediumParam);
} else {
AudioLoad_SyncDma(sample->sampleAddr, sampleAddr, sample->size, sample->medium);
AudioLoad_SyncDma((uintptr_t)sample->sampleAddr, sampleAddr, sample->size, sample->medium);
}
sample->medium = MEDIUM_RAM;
sample->sampleAddr = sampleAddr;
@@ -471,7 +471,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {
void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
osSendMesg(retQueue, 0xFFFFFFFF, OS_MESG_NOBLOCK);
osSendMesg(retQueue, (OSMesg)0xFFFFFFFF, OS_MESG_NOBLOCK);
}
}
@@ -632,11 +632,11 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) {
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
}
u32 AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
uintptr_t AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
}
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
void* addr;
AudioTable* sampleBankTable;
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
@@ -651,7 +651,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
}
*outMedium = MEDIUM_RAM;
return addr;
return (uintptr_t)addr;
}
cachePolicy = sampleBankTable->entries[sampleBankId].cachePolicy;
@@ -664,7 +664,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
addr = AudioLoad_SyncLoad(SAMPLE_TABLE, sampleBankId, &noLoad);
if (addr != NULL) {
*outMedium = MEDIUM_RAM;
return addr;
return (uintptr_t)addr;
}
*outMedium = sampleBankTable->entries[sampleBankId].medium;
@@ -785,7 +785,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
size -= 0x10;
}
bcopy(romAddr, ramAddr, size);
bcopy((void*)romAddr, ramAddr, size);
} else if (medium2 == mediumUnk) {
AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam);
} else {
@@ -867,7 +867,7 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
* @param sampleBankReloc information on the sampleBank containing raw audio samples
*/
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
uintptr_t soundOffset;
void* soundOffset;
uintptr_t soundListOffset;
Instrument* inst;
Drum* drum;
@@ -876,7 +876,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
s32 numDrums = gAudioCtx.soundFontList[fontId].numDrums;
s32 numInstruments = gAudioCtx.soundFontList[fontId].numInstruments;
s32 numSfx = gAudioCtx.soundFontList[fontId].numSfx;
u32* fontData = (u32*)fontDataStartAddr;
uintptr_t* fontData = (uintptr_t*)fontDataStartAddr;
// Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
@@ -889,7 +889,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// If the soundFont has drums
if ((soundListOffset != 0) && (numDrums != 0)) {
fontData[0] = RELOC_TO_RAM(soundListOffset);
fontData[0] = (uintptr_t)RELOC_TO_RAM(soundListOffset);
// Loop through the drum offsets
for (i = 0; i < numDrums; i++) {
@@ -897,7 +897,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
soundOffset = ((Drum**)fontData[0])[i];
// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
if (soundOffset == 0) {
if (soundOffset == NULL) {
continue;
}
soundOffset = RELOC_TO_RAM(soundOffset);
@@ -925,7 +925,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// If the soundFont has sound effects
if ((soundListOffset != 0) && (numSfx != 0)) {
fontData[1] = RELOC_TO_RAM(soundListOffset);
fontData[1] = (uintptr_t)RELOC_TO_RAM(soundListOffset);
// Loop through the sound effects
for (i = 0; i < numSfx; i++) {
@@ -955,7 +955,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
for (i = 2; i <= 2 + numInstruments - 1; i++) {
// Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
if (fontData[i] != 0) {
fontData[i] = RELOC_TO_RAM(fontData[i]);
fontData[i] = (uintptr_t)RELOC_TO_RAM(fontData[i]);
inst = (Instrument*)fontData[i];
// The instrument may be in the list multiple times and already relocated
@@ -1097,7 +1097,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
ramAddr = AudioLoad_SearchCaches(tableType, realId);
if (ramAddr != NULL) {
loadStatus = LOAD_STATUS_COMPLETE;
osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
osSendMesg(retQueue, (OSMesg)MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
} else {
table = AudioLoad_GetLoadTable(tableType);
size = table->entries[realId].size;
@@ -1376,7 +1376,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
slowLoad->status = LOAD_STATUS_START;
slowLoad->bytesRemaining = ALIGN16(sample->size);
slowLoad->ramAddr = slowLoad->curRamAddr;
slowLoad->curDevAddr = sample->sampleAddr;
slowLoad->curDevAddr = (uintptr_t)sample->sampleAddr;
slowLoad->medium = sample->medium;
slowLoad->seqOrFontId = fontId;
slowLoad->instId = instId;
@@ -1464,7 +1464,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
if (slowLoad->medium == MEDIUM_UNK) {
size_t size = slowLoad->bytesRemaining;
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, size,
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, size,
slowLoad->unkMediumParam);
} else {
AudioLoad_DmaSlowCopy(slowLoad, slowLoad->bytesRemaining);
@@ -1472,7 +1472,7 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
slowLoad->bytesRemaining = 0;
} else {
if (slowLoad->medium == MEDIUM_UNK) {
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, 0x400,
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, 0x400,
slowLoad->unkMediumParam);
} else {
AudioLoad_DmaSlowCopy(slowLoad, 0x400);
@@ -1671,7 +1671,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
break;
}
doneMsg = asyncLoad->retMsg;
doneMsg = (OSMesg)asyncLoad->retMsg;
if (1) {}
asyncLoad->status = LOAD_STATUS_WAITING;
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
@@ -1743,7 +1743,7 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) {
size = ALIGN16(size);
Audio_InvalDCache(asyncLoad->curRamAddr, size);
osCreateMesgQueue(&asyncLoad->msgQueue, &asyncLoad->msg, 1);
bcopy(asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
bcopy((void*)asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
osSendMesg(&asyncLoad->msgQueue, NULL, OS_MESG_NOBLOCK);
}
+9 -9
View File
@@ -500,12 +500,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->leftSaveResampleBuf);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
&reverb->leftReverbBuf[entry->startPos]);
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);
if (entry->wrappedSize != 0) {
// Ring buffer wrapped
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
reverb->leftReverbBuf);
(uintptr_t)reverb->leftReverbBuf);
}
// Right Resample
@@ -514,12 +514,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->rightSaveResampleBuf);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
&reverb->rightReverbBuf[entry->startPos]);
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);
if (entry->wrappedSize != 0) {
// Ring buffer wrapped
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
reverb->rightReverbBuf);
(uintptr_t)reverb->rightReverbBuf);
}
return cmd;
@@ -716,16 +716,16 @@ Acmd* AudioSynth_SaveReverbSamples(Acmd* cmd, SynthesisReverb* reverb, s16 updat
if (entry->size != 0) {
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_LEFT_CH, entry->size,
&reverb->leftReverbBuf[entry->startPos]);
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_RIGHT_CH, entry->size,
&reverb->rightReverbBuf[entry->startPos]);
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);
}
if (entry->wrappedSize != 0) {
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_LEFT_CH, entry->wrappedSize,
reverb->leftReverbBuf);
(uintptr_t)reverb->leftReverbBuf);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_RIGHT_CH, entry->wrappedSize,
reverb->rightReverbBuf);
(uintptr_t)reverb->rightReverbBuf);
}
}
@@ -1170,7 +1170,7 @@ Acmd* AudioSynth_ProcessSample(s32 noteIndex, NoteSampleState* sampleState, Note
} else {
// This medium is not in ram, so dma the requested sample into ram
samplesToLoadAddr =
AudioLoad_DmaSampleData(sampleAddr + (zeroOffset + sampleAddrOffset),
AudioLoad_DmaSampleData((uintptr_t)(sampleAddr + (zeroOffset + sampleAddrOffset)),
ALIGN16((numFramesToDecode * frameSize) + SAMPLES_PER_FRAME), flags,
&synthState->sampleDmaIndex, sample->medium);
}
+11 -11
View File
@@ -47,7 +47,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
return NULL;
}
osSendMesg(gAudioCtx.taskStartQueueP, gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
osSendMesg(gAudioCtx.taskStartQueueP, (OSMesg)gAudioCtx.totalTaskCount, OS_MESG_NOBLOCK);
gAudioCtx.rspTaskIndex ^= 1;
gAudioCtx.curAiBufferIndex++;
gAudioCtx.curAiBufferIndex %= 3;
@@ -96,7 +96,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
if (gAudioCtx.resetStatus != 0) {
if (AudioHeap_ResetStep() == 0) {
if (gAudioCtx.resetStatus == 0) {
osSendMesg(gAudioCtx.audioResetQueueP, gAudioCtx.specId, OS_MESG_NOBLOCK);
osSendMesg(gAudioCtx.audioResetQueueP, (OSMesg)(uintptr_t)gAudioCtx.specId, OS_MESG_NOBLOCK);
}
sWaitingAudioTask = NULL;
@@ -146,7 +146,7 @@ AudioTask* AudioThread_UpdateImpl(void) {
}
if (gAudioSPDataPtr == (u64*)gAudioCtx.curAbiCmdBuf) {
return -1;
return (void*)-1;
}
gAudioCtx.curAbiCmdBuf =
@@ -297,16 +297,16 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
break;
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_UPDATE_FUNCTION:
gAudioCustomUpdateFunction = cmd->asUInt;
gAudioCustomUpdateFunction = cmd->asPtr;
break;
case AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION:
if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_REVERB) {
gAudioCustomReverbFunction = cmd->asUInt;
gAudioCustomReverbFunction = cmd->asPtr;
} else if (cmd->arg2 == AUDIO_CUSTOM_FUNCTION_SYNTH) {
gAudioCustomSynthFunction = cmd->asUInt;
gAudioCustomSynthFunction = cmd->asPtr;
} else {
gAudioCtx.customSeqFunctions[cmd->arg2] = cmd->asUInt;
gAudioCtx.customSeqFunctions[cmd->arg2] = cmd->asPtr;
}
break;
@@ -314,7 +314,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) {
case AUDIOCMD_OP_GLOBAL_SET_SFX_FONT:
case AUDIOCMD_OP_GLOBAL_SET_INSTRUMENT_FONT:
if (AudioPlayback_SetFontInstrument(cmd->op - AUDIOCMD_OP_GLOBAL_SET_DRUM_FONT, cmd->arg1, cmd->arg2,
cmd->asInt)) {}
cmd->asPtr)) {}
break;
case AUDIOCMD_OP_GLOBAL_DISABLE_ALL_SEQPLAYERS: {
@@ -791,13 +791,13 @@ void AudioThread_ProcessChannelCmd(SequenceChannel* channel, AudioCmd* cmd) {
break;
case AUDIOCMD_OP_CHANNEL_SET_SFX_STATE:
channel->sfxState = cmd->asUInt;
channel->sfxState = cmd->asPtr;
break;
case AUDIOCMD_OP_CHANNEL_SET_FILTER:
filterCutoff = cmd->arg2;
if (cmd->asUInt != 0) {
channel->filter = cmd->asUInt;
if (cmd->asPtr != NULL) {
channel->filter = cmd->asPtr;
}
if (channel->filter != NULL) {
AudioHeap_LoadFilter(channel->filter, filterCutoff >> 4, filterCutoff & 0xF);
+12 -12
View File
@@ -135,10 +135,10 @@ void Fragment_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelo
}
}
size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, void* allocatedRamAddr,
size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* allocatedRamAddr,
size_t allocatedBytes) {
size_t size = vromEnd - vromStart;
void* end;
uintptr_t end;
s32 pad;
OverlayRelocationSection* ovlRelocs;
@@ -148,7 +148,7 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
end = (uintptr_t)allocatedRamAddr + size;
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
if (gLoadLogSeverity >= 3) {}
@@ -161,11 +161,11 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
if (gLoadLogSeverity >= 3) {}
Fragment_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
Fragment_Relocate(allocatedRamAddr, ovlRelocs, (uintptr_t)vramStart);
if (ovlRelocs->bssSize != 0) {
if (gLoadLogSeverity >= 3) {}
bzero(end, ovlRelocs->bssSize);
bzero((void*)end, ovlRelocs->bssSize);
}
osWritebackDCache(allocatedRamAddr, allocatedBytes);
@@ -176,9 +176,9 @@ size_t Fragment_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart
return allocatedBytes;
}
void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart) {
void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart) {
size_t size = vromEnd - vromStart;
void* end;
uintptr_t end;
void* allocatedRamAddr;
uintptr_t ovlOffset;
OverlayRelocationSection* ovlRelocs;
@@ -195,8 +195,8 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t
if (gLoadLogSeverity >= 3) {}
ovlOffset = (uintptr_t)end - 4;
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
ovlOffset = end - sizeof(s32);
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
if (1) {}
@@ -212,15 +212,15 @@ void* Fragment_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t
}
end = (uintptr_t)allocatedRamAddr + size;
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - *(uintptr_t*)ovlOffset);
ovlRelocs = (OverlayRelocationSection*)(end - *(uintptr_t*)ovlOffset);
if (gLoadLogSeverity >= 3) {}
Fragment_Relocate(allocatedRamAddr, ovlRelocs, vramStart);
Fragment_Relocate(allocatedRamAddr, ovlRelocs, (uintptr_t)vramStart);
if (ovlRelocs->bssSize != 0) {
if (gLoadLogSeverity >= 3) {}
bzero(end, ovlRelocs->bssSize);
bzero((void*)end, ovlRelocs->bssSize);
}
osInvalICache(allocatedRamAddr, allocatedBytes);
+8 -8
View File
@@ -131,11 +131,11 @@ void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlReloc
}
}
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd,
void* allocatedRamAddr) {
s32 pad[2];
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr) {
uintptr_t vramStart = (uintptr_t)ramStart;
uintptr_t vramEnd = (uintptr_t)ramEnd;
s32 size = vromEnd - vromStart;
void* end;
uintptr_t end;
OverlayRelocationSection* ovlRelocs;
if (gOverlayLogSeverity >= 3) {}
@@ -144,7 +144,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
end = (uintptr_t)allocatedRamAddr + size;
DmaMgr_SendRequest0(allocatedRamAddr, vromStart, size);
ovlRelocs = (OverlayRelocationSection*)((uintptr_t)end - ((s32*)end)[-1]);
ovlRelocs = (OverlayRelocationSection*)(end - ((s32*)end)[-1]);
if (gOverlayLogSeverity >= 3) {}
if (gOverlayLogSeverity >= 3) {}
@@ -153,7 +153,7 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
if (ovlRelocs->bssSize != 0) {
if (gOverlayLogSeverity >= 3) {}
bzero(end, ovlRelocs->bssSize);
bzero((void*)end, ovlRelocs->bssSize);
}
size = vramEnd - vramStart;
@@ -166,8 +166,8 @@ size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart,
return size;
}
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd) {
void* allocatedRamAddr = SystemArena_MallocR(vramEnd - vramStart);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd) {
void* allocatedRamAddr = SystemArena_MallocR((uintptr_t)vramEnd - (uintptr_t)vramStart);
if (allocatedRamAddr != NULL) {
Overlay_Load(vromStart, vromEnd, vramStart, vramEnd, allocatedRamAddr);
+7 -7
View File
@@ -8,9 +8,9 @@
#include "global.h"
#include "system_malloc.h"
typedef void (*BlockFunc)(void*);
typedef void (*BlockFunc1)(void*, u32);
typedef void (*BlockFunc8)(void*, u32, u32, u32, u32, u32, u32, u32, u32);
typedef void (*BlockFunc)(uintptr_t);
typedef void (*BlockFunc1)(uintptr_t, u32);
typedef void (*BlockFunc8)(uintptr_t, u32, u32, u32, u32, u32, u32, u32, u32);
typedef struct InitFunc {
/* 0x0 */ uintptr_t nextOffset;
@@ -41,7 +41,7 @@ void SystemHeap_Free(void* ptr) {
}
void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc blockFunc) {
uintptr_t pos = blk;
uintptr_t pos = (uintptr_t)blk;
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
blockFunc(pos);
@@ -49,7 +49,7 @@ void SystemHeap_RunBlockFunc(void* blk, size_t nBlk, size_t blkSize, BlockFunc b
}
void SystemHeap_RunBlockFunc1(void* blk, size_t nBlk, size_t blkSize, BlockFunc1 blockFunc) {
uintptr_t pos = blk;
uintptr_t pos = (uintptr_t)blk;
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
blockFunc(pos, 2);
@@ -62,7 +62,7 @@ void* SystemHeap_RunBlockFunc8(void* blk, size_t nBlk, size_t blkSize, BlockFunc
}
if ((blk != NULL) && (blockFunc != NULL)) {
uintptr_t pos = blk;
uintptr_t pos = (uintptr_t)blk;
for (; pos < (uintptr_t)blk + (nBlk * blkSize); pos += (blkSize & ~0)) {
blockFunc(pos, 0, 0, 0, 0, 0, 0, 0, 0);
@@ -82,7 +82,7 @@ void SystemHeap_RunBlockFunc1Reverse(void* blk, size_t nBlk, size_t blkSize, Blo
}
if (blockFunc != NULL) {
start = blk;
start = (uintptr_t)blk;
maskedBlkSize = (blkSize & ~0);
pos = (uintptr_t)start + (nBlk * blkSize);
+2 -2
View File
@@ -68,8 +68,8 @@ void Main_Init(void) {
prevSize = gDmaMgrDmaBuffSize;
gDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &mq, NULL);
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code), SEGMENT_ROM_SIZE_ALT(code), 0, &mq,
NULL);
Main_InitScreen();
Main_InitMemory();
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
+4 -4
View File
@@ -32,7 +32,7 @@ void* THA_GetTail(TwoHeadArena* tha) {
void* THA_AllocHead(TwoHeadArena* tha, size_t size) {
void* start = tha->head;
tha->head = (u8*)tha->head + size;
tha->head = (void*)((uintptr_t)tha->head + size);
return start;
}
@@ -102,8 +102,8 @@ void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask) {
*
* @return Remaining size. A negative number indicates an overflow.
*/
s32 THA_GetRemaining(TwoHeadArena* tha) {
return (s32)((u8*)tha->tail - (u8*)tha->head);
ptrdiff_t THA_GetRemaining(TwoHeadArena* tha) {
return (uintptr_t)tha->tail - (uintptr_t)tha->head;
}
/**
@@ -115,7 +115,7 @@ u32 THA_IsCrash(TwoHeadArena* tha) {
void THA_Reset(TwoHeadArena* tha) {
tha->head = tha->start;
tha->tail = (u8*)tha->start + tha->size;
tha->tail = (void*)((uintptr_t)tha->start + tha->size);
}
/**
+3 -3
View File
@@ -44,7 +44,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx % 2];
gGfxMasterDL = &pool->master;
gSegments[0x0E] = gGfxMasterDL;
gSegments[0x0E] = (uintptr_t)gGfxMasterDL;
pool->headMagic = GFXPOOL_HEAD_MAGIC;
pool->tailMagic = GFXPOOL_TAIL_MAGIC;
@@ -62,7 +62,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) {
gfxCtx->debugBuffer = pool->debugBuffer;
gfxCtx->curFrameBuffer = SysCfb_GetFramebuffer(gfxCtx->framebufferIndex % 2);
gSegments[0x0F] = gfxCtx->curFrameBuffer;
gSegments[0x0F] = (uintptr_t)gfxCtx->curFrameBuffer;
gfxCtx->zbuffer = SysCfb_GetZBuffer();
@@ -180,7 +180,7 @@ retry:
task->dramStack = (u64*)gGfxSPTaskStack;
task->dramStackSize = sizeof(gGfxSPTaskStack);
task->outputBuff = gGfxSPTaskOutputBufferPtr;
task->outputBuffSize = gGfxSPTaskOutputBufferEnd;
task->outputBuffSize = (void*)gGfxSPTaskOutputBufferEnd;
task->dataPtr = (u64*)gGfxMasterDL;
task->dataSize = 0;
task->yieldDataPtr = (u64*)gGfxSPTaskYieldBuffer;

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