From f71ebdca828a94ed6525a3d32fe8153960e5e102 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 18 Apr 2024 15:06:13 -0600 Subject: [PATCH] Fixed some weird casts --- CMakeLists.txt | 7 +++++++ assets/yaml/us/rev1/ast_map.yaml | 16 ++++++++-------- include/sf64audio_provisional.h | 10 +++++----- src/audio/audio_heap.c | 27 +++++++++++++-------------- src/audio/audio_load.c | 6 +++--- src/audio/audio_seqplayer.c | 2 +- src/audio/audio_synthesis.c | 2 +- src/audio/audio_thread.c | 2 +- 8 files changed, 39 insertions(+), 33 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 718a3288..8377fe22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,7 @@ endif() # Set game compilation version set(VERSION us) set(USE_NETWORKING OFF) +set(SKIP_XCODE_VERSION_CHECK ON) # Add compile definitions for the target add_compile_definitions( @@ -394,9 +395,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces + -Wno-int-conversion $<$: -Werror-implicit-function-declaration -Wno-incompatible-pointer-types + -fpermissive > $<$:-fpermissive> $<$: @@ -420,9 +423,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces + -Wno-int-conversion $<$: -Werror-implicit-function-declaration -Wno-incompatible-pointer-types + -fpermissive > $<$:-fpermissive> $<$: @@ -469,9 +474,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces + -Wno-int-conversion $<$: -Werror-implicit-function-declaration -Wno-incompatible-pointer-types + -fpermissive > $<$:-fpermissive> $<$:-Wno-deprecated-enum-enum-conversion> diff --git a/assets/yaml/us/rev1/ast_map.yaml b/assets/yaml/us/rev1/ast_map.yaml index 18189455..b63f5488 100644 --- a/assets/yaml/us/rev1/ast_map.yaml +++ b/assets/yaml/us/rev1/ast_map.yaml @@ -141,11 +141,11 @@ D_MAP_6016760: # Zones # Toxic Waste Area -D_MAP_6017640: +D_MAP_6017640: { type: TEXTURE, format: IA8, offset: 0x6017640, width: 112, height: 28, ctype: u8, symbol: D_MAP_6017640 } # Invasion Aftermath -D_MAP_6018280: +D_MAP_6018280: { type: TEXTURE, format: IA8, offset: 0x6018280, width: 184, height: 19, ctype: u8, symbol: D_MAP_6018280 } aMapPrologueTextFadeTex: @@ -159,7 +159,7 @@ aMapOptionBgTex: { type: TEXTURE, format: IA8, offset: 0x601B4B0, width: 32, height: 32, ctype: u8, symbol: aMapOptionBgTex } # Some text in japanese -D_MAP_601B8B0: +D_MAP_601B8B0: { type: TEXTURE, format: IA8, offset: 0x601B8B0, width: 80, height: 26, ctype: u8, symbol: D_MAP_1B8B0 } aMapSectorXDL: @@ -421,7 +421,7 @@ ast_map_seg6_vtx_4AD50: D_MAP_604B510: { type: TEXTURE, ctype: u8, format: CI4, width: 16, height: 16, offset: 0x0604B510, symbol: D_MAP_604B510, tlut: 0x0604B590 } -D_MAP_604B590: +D_MAP_604B590: { type: TEXTURE, ctype: u16, format: TLUT, colors: 16, offset: 0x0604B590, symbol: D_MAP_604B590 } D_MAP_604B5B0: @@ -440,25 +440,25 @@ aMapBolseDL: D_MAP_604BC48: { type: TEXTURE, ctype: u8, format: CI4, width: 32, height: 32, offset: 0x0604BC48, symbol: D_MAP_604BC48, tlut: 0x0604BC48 } -D_MAP_604BE48: +D_MAP_604BE48: { type: TEXTURE, ctype: u16, format: TLUT, colors: 16, offset: 0x0604BE48, symbol: D_MAP_604BE48 } D_MAP_604BE68: { type: TEXTURE, ctype: u8, format: CI4, width: 32, height: 32, offset: 0x0604BE68, symbol: D_MAP_604BE68, tlut: 0x0604C068 } -D_MAP_604C068: +D_MAP_604C068: { type: TEXTURE, ctype: u16, format: TLUT, colors: 16, offset: 0x0604C068, symbol: D_MAP_604C068 } D_MAP_604C088: { type: TEXTURE, ctype: u8, format: CI4, width: 32, height: 32, offset: 0x0604C088, symbol: D_MAP_604C088, tlut: 0x0604C288 } -D_MAP_604C288: +D_MAP_604C288: { type: TEXTURE, ctype: u16, format: TLUT, colors: 16, offset: 0x0604C288, symbol: D_MAP_604C288 } D_MAP_604C2A8: { type: TEXTURE, ctype: u8, format: CI4, width: 16, height: 16, offset: 0x0604C2A8, symbol: D_MAP_604C2A8, tlut: 0x0604C328 } -D_MAP_604C328: +D_MAP_604C328: { type: TEXTURE, ctype: u16, format: TLUT, colors: 16, offset: 0x0604C328, symbol: D_MAP_604C328 } # Television outcoming light Model, used during briefing. diff --git a/include/sf64audio_provisional.h b/include/sf64audio_provisional.h index 54e556f3..d259396a 100644 --- a/include/sf64audio_provisional.h +++ b/include/sf64audio_provisional.h @@ -703,7 +703,7 @@ typedef struct { /* 0x02 */ s8 sampleBankId; /* 0x03 */ char unk_03[0x5]; /* 0x08 */ u8* allocatedAddr; - /* 0x0C */ void* sampleAddr; + /* 0x0C */ uintptr_t sampleAddr; /* 0x10 */ u32 size; } SampleCacheEntry; // size = 0x14 @@ -844,7 +844,7 @@ typedef struct { typedef struct SampleDma { /* 0x00 */ u8* ramAddr; - /* 0x04 */ u32 devAddr; + /* 0x04 */ uintptr_t devAddr; /* 0x08 */ u16 sizeUnused; /* 0x0A */ u16 size; /* 0x0C */ u8 unused; @@ -1036,12 +1036,12 @@ void* AudioHeap_Alloc(AudioAllocPool* pool, u32 size); void AudioHeap_InitPool(AudioAllocPool* pool, void* ramAddr, u32 size); void AudioHeap_InitMainPools(s32 initPoolSize); void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id); -void* AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id); +uintptr_t AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id); s32 AudioHeap_ResetStep(void); void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id); u8* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size); -void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium); -void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium); +void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium); +void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium); // audio_load void AudioLoad_DecreaseSampleDmaTtls(void); diff --git a/src/audio/audio_heap.c b/src/audio/audio_heap.c index 9d6ca238..ddd50d0d 100644 --- a/src/audio/audio_heap.c +++ b/src/audio/audio_heap.c @@ -401,7 +401,7 @@ void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id) { break; case 1: temporaryCache->entries[1].ramAddr = - (((u32) &temporaryPool->startRamAddr[temporaryPool->size] - size) & ~0xF); + (u8*) ((uintptr_t) &temporaryPool->startRamAddr[temporaryPool->size] - size & ~0xF); temporaryCache->entries[1].id = id; temporaryCache->entries[1].size = size; if ((temporaryCache->entries[0].id != -1) && @@ -442,18 +442,18 @@ void* AudioHeap_AllocCached(s32 tableType, s32 size, s32 cache, s32 id) { return loadedCache->persistent.entries[loadedCache->persistent.numEntries++].ramAddr; } -void* AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id) { +uintptr_t AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id) { void* ramAddr; // Always search the permanent cache in addition to the regular ones. ramAddr = AudioHeap_SearchPermanentCache(tableType, id); if (ramAddr != NULL) { - return ramAddr; + return (uintptr_t) ramAddr; } if (cache == CACHE_PERMANENT) { - return NULL; + return (uintptr_t) NULL; } - return AudioHeap_SearchRegularCaches(tableType, cache, id); + return (uintptr_t) AudioHeap_SearchRegularCaches(tableType, cache, id); } void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id) { @@ -497,7 +497,7 @@ void* AudioHeap_SearchRegularCaches(s32 tableType, s32 cache, s32 id) { } if (cache == CACHE_EITHER) { - return AudioHeap_SearchCaches(tableType, CACHE_TEMPORARY, id); + return (void*) AudioHeap_SearchCaches(tableType, CACHE_TEMPORARY, id); } return NULL; } @@ -778,7 +778,7 @@ u8* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size) { #endif } -void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium) { +void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium) { SampleCacheEntry* entry = AudioHeap_AllocTemporarySampleCacheEntry(size); if (entry != NULL) { @@ -791,7 +791,7 @@ void* AudioHeap_AllocTemporarySampleCache(s32 size, s32 fontId, s32 sampleAddr, } } -void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, s32 sampleAddr, s8 medium) { +void* AudioHeap_AllocPersistentSampleCache(s32 size, s32 fontId, uintptr_t sampleAddr, s8 medium) { SampleCacheEntry* entry = AudioHeap_AllocPersistentSampleCacheEntry(size); if (entry != NULL) { @@ -920,10 +920,9 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) { sampleBankId1 = gSoundFontList[fondId].sampleBankId1; sampleBankId2 = gSoundFontList[fondId].sampleBankId2; if (((sampleBankId1 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId1)) || - ((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) || - (entry->sampleBankId == SAMPLES_SFX)) { - if ((AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fondId) != NULL) && - ((gFontLoadStatus[fondId] > 1) != 0)) { + ((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) || (entry->sampleBankId == SAMPLES_SFX)) { + if (((void*) AudioHeap_SearchCaches(FONT_TABLE, CACHE_EITHER, fondId) != NULL) && + (gFontLoadStatus[fondId] > 1) != 0) { for (instId = 0; instId < gSoundFontList[fondId].numInstruments; instId++) { instrument = Audio_GetInstrument(fondId, instId); if (instrument != NULL) { @@ -949,7 +948,7 @@ void AudioHeap_DiscardSampleCacheEntry(SampleCacheEntry* entry) { void AudioHeap_UnapplySampleCache(SampleCacheEntry* entry, Sample* sample) { if ((sample != NULL) && (sample->sampleAddr == entry->allocatedAddr)) { - sample->sampleAddr = entry->sampleAddr; + sample->sampleAddr = (u8*) entry->sampleAddr; sample->medium = entry->origMedium; } } @@ -994,7 +993,7 @@ void AudioHeap_DiscardSampleCaches(void) { if (((sampleBankId1 != SAMPLES_NONE_U) && (entry->sampleBankId == sampleBankId1)) || ((sampleBankId2 != SAMPLES_NONE) && (entry->sampleBankId == sampleBankId2)) || (entry->sampleBankId == SAMPLES_SFX)) { - if ((AudioHeap_SearchCaches(FONT_TABLE, CACHE_PERMANENT, fontId) != NULL) && + if (((void*) AudioHeap_SearchCaches(FONT_TABLE, CACHE_PERMANENT, fontId) != NULL) && ((gFontLoadStatus[fontId] > 1) != 0)) { for (i = 0; i < gPersistentSampleCache.numEntries; i++) { entry = &gPersistentSampleCache.entries[i]; diff --git a/src/audio/audio_load.c b/src/audio/audio_load.c index bd979269..6a9930de 100644 --- a/src/audio/audio_load.c +++ b/src/audio/audio_load.c @@ -261,15 +261,15 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) { u8* sampleAddr; if ((sample->isRelocated == true) && (sample->medium != MEDIUM_RAM)) { - sampleAddr = AudioHeap_AllocPersistentSampleCache(sample->size, fontId, sample->sampleAddr, sample->medium); + sampleAddr = AudioHeap_AllocPersistentSampleCache(sample->size, fontId, (uintptr_t) sample->sampleAddr, sample->medium); if (sampleAddr == NULL) { return -1; } if (sample->medium == MEDIUM_UNK) { - AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size, + AudioLoad_SyncDmaUnkMedium((uintptr_t) sample->sampleAddr, sampleAddr, sample->size, gSampleBankTable->base.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; diff --git a/src/audio/audio_seqplayer.c b/src/audio/audio_seqplayer.c index 2c4851df..34108dec 100644 --- a/src/audio/audio_seqplayer.c +++ b/src/audio/audio_seqplayer.c @@ -268,7 +268,7 @@ void* func_800145FC(AudioListItem* list) { list->prev = item->prev; item->prev = NULL; list->u.count--; - return item->u.count; + return (void*) item->u.count; } void func_8001463C(void) { diff --git a/src/audio/audio_synthesis.c b/src/audio/audio_synthesis.c index b144d846..ed6d361d 100644 --- a/src/audio/audio_synthesis.c +++ b/src/audio/audio_synthesis.c @@ -578,7 +578,7 @@ u8* func_800097A8(Sample* sample, s32 length, u32 flags, UnkStruct_800097A8* arg if (1) {} //! FAKE sp1C->ttl = 2; - sp1C->devAddr = sample->sampleAddr; + sp1C->devAddr = (uintptr_t) sample->sampleAddr; sp1C->sizeUnused = length * 2; pad2 = arg3->unk_14; pad2->ttl = 2; diff --git a/src/audio/audio_thread.c b/src/audio/audio_thread.c index 81f83f20..d72016ad 100644 --- a/src/audio/audio_thread.c +++ b/src/audio/audio_thread.c @@ -167,7 +167,7 @@ void AudioThread_ProcessGlobalCmd(AudioCmd* cmd) { case AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER: case AUDIOCMD_OP_GLOBAL_INIT_SEQPLAYER_ALT: AudioLoad_SyncInitSeqPlayer(cmd->arg0, cmd->arg1, cmd->arg2); - AudioThread_SetFadeInTimer(cmd->arg0, cmd->data); + AudioThread_SetFadeInTimer(cmd->arg0, (s32) cmd->data); break; case AUDIOCMD_OP_GLOBAL_DISABLE_SEQPLAYER: if (gSeqPlayers[cmd->arg0].enabled) {