summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkipcode66 <kipcode66@gmail.com>2025-12-21 20:48:09 -0500
committerGitHub <noreply@github.com>2025-12-21 17:48:09 -0800
commit4045f16667fe6903243801e1155d086ae8df27b1 (patch)
treebaa2a62646926e1f2d4c994c95931bcc4d66e5f0 /src
parentb4f931f75f5d87fc7844e00eab7d7b99eceb3622 (diff)
next round of standard compiler fixes (#2969)
* next round of standard compiler fixes * Fix weak function order issue * fix missmatch with ShieldD version
Diffstat (limited to 'src')
-rw-r--r--src/JSystem/J3DGraphAnimator/J3DSkinDeform.cpp6
-rw-r--r--src/JSystem/J3DGraphBase/J3DTransform.cpp8
-rw-r--r--src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp10
-rw-r--r--src/JSystem/JAudio2/JASAudioThread.cpp3
-rw-r--r--src/JSystem/JAudio2/JASBNKParser.cpp10
-rw-r--r--src/JSystem/JAudio2/JASBasicWaveBank.cpp3
-rw-r--r--src/JSystem/JAudio2/JASCalc.cpp15
-rw-r--r--src/JSystem/JAudio2/JASSimpleWaveBank.cpp3
-rw-r--r--src/JSystem/JKernel/JKRDvdArchive.cpp6
-rw-r--r--src/JSystem/JKernel/JKRDvdFile.cpp3
-rw-r--r--src/JSystem/JKernel/JKRThread.cpp2
-rw-r--r--src/JSystem/JMessage/processor.cpp4
-rw-r--r--src/JSystem/JUtility/JUTCacheFont.cpp9
-rw-r--r--src/JSystem/JUtility/JUTGraphFifo.cpp3
-rw-r--r--src/JSystem/JUtility/JUTTexture.cpp4
-rw-r--r--src/d/d_camera.cpp2
16 files changed, 50 insertions, 41 deletions
diff --git a/src/JSystem/J3DGraphAnimator/J3DSkinDeform.cpp b/src/JSystem/J3DGraphAnimator/J3DSkinDeform.cpp
index 17112fb93c..d8ddfdea22 100644
--- a/src/JSystem/J3DGraphAnimator/J3DSkinDeform.cpp
+++ b/src/JSystem/J3DGraphAnimator/J3DSkinDeform.cpp
@@ -274,7 +274,7 @@ int J3DSkinDeform::initMtxIndexArray(J3DModelData* pModelData) {
u8* pDListPos = pDList;
int uVar13;
for (;
- (int)pDListPos - (int)pDList < pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize();
+ (intptr_t)pDListPos - (intptr_t)pDList < pModelData->getShapeNodePointer(i)->getShapeDraw(j)->getDisplayListSize();
pDListPos += r23 * uVar13
//TODO: This loop's logic has drastically different codegen between GCN and Shield
// in a way that so far can't be pinned down as just compiler differences. This
@@ -388,8 +388,8 @@ void J3DSkinDeform::changeFastSkinDL(J3DModelData* pModelData) {
dl = (u8*)dl + vtxSize * vtxCount;
}
- int dlistSize = ((int)dst - (int)displayListStart + 0x1f) & ~0x1f;
- while ((int)dst - (int)displayListStart < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
+ int dlistSize = ((intptr_t)dst - (intptr_t)displayListStart + 0x1f) & ~0x1f;
+ while ((intptr_t)dst - (intptr_t)displayListStart < pShapeNode->getShapeDraw(j)->getDisplayListSize()) {
*dst++ = 0;
}
diff --git a/src/JSystem/J3DGraphBase/J3DTransform.cpp b/src/JSystem/J3DGraphBase/J3DTransform.cpp
index b13262e852..cdc744c272 100644
--- a/src/JSystem/J3DGraphBase/J3DTransform.cpp
+++ b/src/JSystem/J3DGraphBase/J3DTransform.cpp
@@ -101,7 +101,7 @@ void J3DCalcYBBoardMtx(Mtx mtx) {
mtx[2][2] = vec.z * z;
}
-asm void J3DPSCalcInverseTranspose(__REGISTER Mtx src, __REGISTER Mtx33 dst) {
+ASM void J3DPSCalcInverseTranspose(__REGISTER Mtx src, __REGISTER Mtx33 dst) {
#ifdef __MWERKS__ // clang-format off
psq_l f0, 0(src), 1, 0
psq_l f1, 4(src), 0, 0
@@ -290,7 +290,7 @@ void J3DGetTextureMtxMayaOld(const J3DTextureSRTInfo& srt, Mtx dst) {
dst[2][2] = 1.0f;
}
-asm void J3DScaleNrmMtx(__REGISTER Mtx mtx, const __REGISTER Vec& scl) {
+ASM void J3DScaleNrmMtx(__REGISTER Mtx mtx, const __REGISTER Vec& scl) {
#ifdef __MWERKS__ // clang-format off
nofralloc;
@@ -326,7 +326,7 @@ asm void J3DScaleNrmMtx(__REGISTER Mtx mtx, const __REGISTER Vec& scl) {
#endif // clang-format on
}
-asm void J3DScaleNrmMtx33(__REGISTER Mtx33 mtx, const __REGISTER Vec& scale) {
+ASM void J3DScaleNrmMtx33(__REGISTER Mtx33 mtx, const __REGISTER Vec& scale) {
#ifdef __MWERKS__ // clang-format off
psq_l f0, 0(mtx), 0, 0
psq_l f6, 0(scale), 0, 0
@@ -352,7 +352,7 @@ asm void J3DScaleNrmMtx33(__REGISTER Mtx33 mtx, const __REGISTER Vec& scale) {
#endif // clang-format on
}
-asm void J3DMtxProjConcat(__REGISTER Mtx mtx1, __REGISTER Mtx mtx2, __REGISTER Mtx dst) {
+ASM void J3DMtxProjConcat(__REGISTER Mtx mtx1, __REGISTER Mtx mtx2, __REGISTER Mtx dst) {
#ifdef __MWERKS__ // clang-format off
psq_l f2, 0(mtx1), 0, 0
psq_l f3, 8(mtx1), 0, 0
diff --git a/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp b/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp
index 3abd6ea603..895652ef40 100644
--- a/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp
+++ b/src/JSystem/J3DGraphLoader/J3DClusterLoader.cpp
@@ -70,9 +70,9 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
mpDeformData->mVtxNrm = JSUConvertOffsetToPtr<f32>(block, block->mVtxNrm);
void* clusterPointer = block->mClusterPointer;
- int clusterKeyPointerSize = (int)block->mClusterKeyPointer - (int)clusterPointer;
- int clusterVertexPointerSize = (int)block->mClusterVertex - (int)clusterPointer;
- int vtxPosSize = (int)block->mVtxPos - (int)clusterPointer;
+ int clusterKeyPointerSize = (intptr_t)block->mClusterKeyPointer - (intptr_t)clusterPointer;
+ int clusterVertexPointerSize = (intptr_t)block->mClusterVertex - (intptr_t)clusterPointer;
+ int vtxPosSize = (intptr_t)block->mVtxPos - (intptr_t)clusterPointer;
u8* arr = new (0x20) u8[vtxPosSize];
memcpy(arr, JSUConvertOffsetToPtr<J3DCluster>(block, clusterPointer), vtxPosSize);
mpDeformData->mClusterPointer = (J3DCluster*)arr;
@@ -81,10 +81,10 @@ void J3DClusterLoader_v15::readCluster(const J3DClusterBlock* block) {
for (int i = 0; i < mpDeformData->getClusterNum(); i++) {
J3DCluster* cluster = &mpDeformData->mClusterPointer[i];
- cluster->mClusterKey = JSUConvertOffsetToPtr<J3DClusterKey>(arr - (int)clusterPointer, cluster->mClusterKey);
+ cluster->mClusterKey = JSUConvertOffsetToPtr<J3DClusterKey>(arr - (intptr_t)clusterPointer, cluster->mClusterKey);
cluster->field_0x18 = JSUConvertOffsetToPtr<u16>(block, cluster->field_0x18);
cluster->mClusterVertex =
- JSUConvertOffsetToPtr<J3DClusterVertex>(arr - (int)clusterPointer, cluster->mClusterVertex);
+ JSUConvertOffsetToPtr<J3DClusterVertex>(arr - (intptr_t)clusterPointer, cluster->mClusterVertex);
J3DDeformer* deformer = new J3DDeformer(mpDeformData);
if (cluster->field_0x14 != 0) {
deformer->field_0xc = new f32[cluster->field_0x14 * 3];
diff --git a/src/JSystem/JAudio2/JASAudioThread.cpp b/src/JSystem/JAudio2/JASAudioThread.cpp
index e689a9607f..fef909dd16 100644
--- a/src/JSystem/JAudio2/JASAudioThread.cpp
+++ b/src/JSystem/JAudio2/JASAudioThread.cpp
@@ -9,6 +9,7 @@
#include "JSystem/JAudio2/JASProbe.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "dolphin/dsp.h"
+#include "stdint.h"
JASAudioThread::JASAudioThread(int stackSize, int msgCount, u32 threadPriority)
:
@@ -60,7 +61,7 @@ void* JASAudioThread::run() {
while (true) {
OSMessage msg = waitMessageBlock();
- switch ((int)msg) {
+ switch ((intptr_t)msg) {
case AUDIOMSG_DMA:
if (sbPauseFlag) {
JASDriver::stopDMA();
diff --git a/src/JSystem/JAudio2/JASBNKParser.cpp b/src/JSystem/JAudio2/JASBNKParser.cpp
index dbaad63bee..0df05ca9b8 100644
--- a/src/JSystem/JAudio2/JASBNKParser.cpp
+++ b/src/JSystem/JAudio2/JASBNKParser.cpp
@@ -40,13 +40,13 @@ JASBasicBank* JASBNKParser::createBasicBank(void const* stream, JKRHeap* heap) {
JASBNKParser::Ver1::TChunk* JASBNKParser::Ver1::findChunk(void const* stream, u32 id) {
TFileHeader* header = (TFileHeader*)stream;
- void* end = (void*)((int)stream + header->mSize);
- TChunk* chunk = (TChunk*)((int)stream + 0x20);
+ void* end = (void*)((intptr_t)stream + header->mSize);
+ TChunk* chunk = (TChunk*)((intptr_t)stream + 0x20);
while (chunk < end) {
if (chunk->mID == id) {
return chunk;
}
- chunk = (TChunk*)(((int)chunk + 0xb + chunk->mSize) & ~3);
+ chunk = (TChunk*)(((intptr_t)chunk + 0xb + chunk->mSize) & ~3);
}
return NULL;
}
@@ -85,7 +85,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
bank->newInstTable(list_chunk->mCount, heap);
for (int i = 0; i < list_chunk->mCount; i++) {
if (list_chunk->mOffsets[i] != 0) {
- u32* data = (u32*)((int)stream + list_chunk->mOffsets[i]);
+ u32* data = (u32*)((intptr_t)stream + list_chunk->mOffsets[i]);
switch (*data++) {
case 'Inst': {
JASBasicInst* inst = new (heap, 0) JASBasicInst();
@@ -126,7 +126,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
u32 offset = *data++;
if (offset != 0) {
JASDrumSet::TPerc* perc = new (heap, 0) JASDrumSet::TPerc();
- u32* ptr = (u32*)((int)stream + offset);
+ u32* ptr = (u32*)((intptr_t)stream + offset);
TPercData* perc_data = (TPercData*)(ptr + 1);
perc->setVolume(perc_data->mVolume);
perc->setPitch(perc_data->mPitch);
diff --git a/src/JSystem/JAudio2/JASBasicWaveBank.cpp b/src/JSystem/JAudio2/JASBasicWaveBank.cpp
index 922d00a85f..f7417e174d 100644
--- a/src/JSystem/JAudio2/JASBasicWaveBank.cpp
+++ b/src/JSystem/JAudio2/JASBasicWaveBank.cpp
@@ -4,6 +4,7 @@
#include "JSystem/JAudio2/JASMutex.h"
#include "JSystem/JKernel/JKRHeap.h"
#include "JSystem/JUtility/JUTAssert.h"
+#include "stdint.h"
JASBasicWaveBank::JASBasicWaveBank() {
mWaveTable = NULL;
@@ -130,5 +131,5 @@ int JASBasicWaveBank::TWaveHandle::getWavePtr() const {
if (base == 0) {
return 0;
}
- return (int)base + field_0x4.field_0x08;
+ return (intptr_t)base + field_0x4.field_0x08;
}
diff --git a/src/JSystem/JAudio2/JASCalc.cpp b/src/JSystem/JAudio2/JASCalc.cpp
index 861b8dcd67..0578810cd6 100644
--- a/src/JSystem/JAudio2/JASCalc.cpp
+++ b/src/JSystem/JAudio2/JASCalc.cpp
@@ -6,8 +6,8 @@
void JASCalc::imixcopy(const s16* s1, const s16* s2, s16* dst, u32 n) {
for (n; n != 0; n--) {
- *dst++ = *((s16*)s1)++;
- *dst++ = *((s16*)s2)++;
+ *dst++ = *(s1)++;
+ *dst++ = *(s2)++;
}
}
@@ -21,10 +21,10 @@ void JASCalc::bcopyfast(const void* src, void* dest, u32 size) {
u32* udest = (u32*)dest;
for (size = size / (4 * sizeof(u32)); size != 0; size--) {
- copy1 = *((u32*)usrc)++;
- copy2 = *((u32*)usrc)++;
- copy3 = *((u32*)usrc)++;
- copy4 = *((u32*)usrc)++;
+ copy1 = *(usrc)++;
+ copy2 = *(usrc)++;
+ copy3 = *(usrc)++;
+ copy4 = *(usrc)++;
*udest++ = copy1;
*udest++ = copy2;
@@ -263,6 +263,9 @@ s16 const JASCalc::CUTOFF_TO_IIR_TABLE[128][4] = {
0x7FFF, 0x0000, 0x0000, 0x0000,
};
+template <>
+s16 JASCalc::clamp(s32);
+
// currently required because of missing functions
// JASCalc::hannWindow(short *, u32)
// JASCalc::hammWindow(short *, u32)
diff --git a/src/JSystem/JAudio2/JASSimpleWaveBank.cpp b/src/JSystem/JAudio2/JASSimpleWaveBank.cpp
index 98e6136b3d..a20d6cbdea 100644
--- a/src/JSystem/JAudio2/JASSimpleWaveBank.cpp
+++ b/src/JSystem/JAudio2/JASSimpleWaveBank.cpp
@@ -1,6 +1,7 @@
#include "JSystem/JSystem.h" // IWYU pragma: keep
#include "JSystem/JAudio2/JASSimpleWaveBank.h"
+#include "stdint.h"
JASSimpleWaveBank::JASSimpleWaveBank() {
mWaveTable = NULL;
@@ -42,7 +43,7 @@ int JASSimpleWaveBank::TWaveHandle::getWavePtr() const {
if (base == NULL) {
return NULL;
}
- return (int)base + mWaveInfo.field_0x08;
+ return (intptr_t)base + mWaveInfo.field_0x08;
}
JASSimpleWaveBank::TWaveHandle::TWaveHandle() {
diff --git a/src/JSystem/JKernel/JKRDvdArchive.cpp b/src/JSystem/JKernel/JKRDvdArchive.cpp
index de013a2834..f5ec5aed60 100644
--- a/src/JSystem/JKernel/JKRDvdArchive.cpp
+++ b/src/JSystem/JKernel/JKRDvdArchive.cpp
@@ -89,9 +89,9 @@ bool JKRDvdArchive::open(s32 entryNum) {
sizeof(SArcHeader), NULL, NULL);
DCInvalidateRange(mArcInfoBlock, arcHeader->file_data_offset);
- mNodes = (SDIDirEntry*)((int)&mArcInfoBlock->num_nodes + mArcInfoBlock->node_offset);
- mFiles = (SDIFileEntry*)((int)&mArcInfoBlock->num_nodes + mArcInfoBlock->file_entry_offset);
- mStringTable = (char*)((int)&mArcInfoBlock->num_nodes + mArcInfoBlock->string_table_offset);
+ mNodes = (SDIDirEntry*)((intptr_t)&mArcInfoBlock->num_nodes + mArcInfoBlock->node_offset);
+ mFiles = (SDIFileEntry*)((intptr_t)&mArcInfoBlock->num_nodes + mArcInfoBlock->file_entry_offset);
+ mStringTable = (char*)((intptr_t)&mArcInfoBlock->num_nodes + mArcInfoBlock->string_table_offset);
mExpandedSize = NULL;
u8 useCompression;
diff --git a/src/JSystem/JKernel/JKRDvdFile.cpp b/src/JSystem/JKernel/JKRDvdFile.cpp
index 9df201adb7..8cb3790993 100644
--- a/src/JSystem/JKernel/JKRDvdFile.cpp
+++ b/src/JSystem/JKernel/JKRDvdFile.cpp
@@ -3,6 +3,7 @@
#include "JSystem/JKernel/JKRDvdFile.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "JSystem/JUtility/JUTException.h"
+#include "stdint.h"
JSUList<JKRDvdFile> JKRDvdFile::sDvdList;
@@ -123,7 +124,7 @@ s32 JKRDvdFile::sync(void) {
OSReceiveMessage(&mMessageQueue2, &message, 1);
mOSThread = NULL;
OSUnlockMutex(&mMutex1);
- return (int)message;
+ return (intptr_t)message;
}
void JKRDvdFile::doneProcess(s32 id, DVDFileInfo* fileInfo) {
diff --git a/src/JSystem/JKernel/JKRThread.cpp b/src/JSystem/JKernel/JKRThread.cpp
index a884fcf615..510ccd3132 100644
--- a/src/JSystem/JKernel/JKRThread.cpp
+++ b/src/JSystem/JKernel/JKRThread.cpp
@@ -82,7 +82,7 @@ void JKRThread::setCommon_heapSpecified(JKRHeap* heap, u32 stack_size, int param
mStackMemory = JKRAllocFromHeap(mHeap, mStackSize, 0x20);
mThreadRecord = (OSThread*)JKRAllocFromHeap(mHeap, sizeof(OSThread), 0x20);
- void* stackBase = (void*)((int)mStackMemory + mStackSize);
+ void* stackBase = (void*)((intptr_t)mStackMemory + mStackSize);
OSCreateThread(mThreadRecord, start, this, stackBase, mStackSize, param_3, 1);
}
diff --git a/src/JSystem/JMessage/processor.cpp b/src/JSystem/JMessage/processor.cpp
index 2be956ef19..f110012717 100644
--- a/src/JSystem/JMessage/processor.cpp
+++ b/src/JSystem/JMessage/processor.cpp
@@ -331,9 +331,9 @@ const char* JMessage::TSequenceProcessor::process(char const* pszText) {
u32 queryResult = on_branch_queryResult();
if (queryResult > 0x7FFFFFFF) {
switch (queryResult) {
- case -1:
+ case 0xFFFFFFFF:
return pszCurrent_;
- case -2:
+ case 0xFFFFFFFE:
eStatus_ = STATUS_NORMAL;
break;
default:
diff --git a/src/JSystem/JUtility/JUTCacheFont.cpp b/src/JSystem/JUtility/JUTCacheFont.cpp
index 6ed26d4fb8..b1202d6e78 100644
--- a/src/JSystem/JUtility/JUTCacheFont.cpp
+++ b/src/JSystem/JUtility/JUTCacheFont.cpp
@@ -6,6 +6,7 @@
#include "JSystem/JUtility/JUTConsole.h"
#include "JSystem/JKernel/JKRAram.h"
#include "dolphin/gx.h"
+#include "stdint.h"
JUTCacheFont::JUTCacheFont(ResFONT const* p_fontRes, u32 cacheSize, JKRHeap* p_heap) {
initialize_state();
@@ -424,18 +425,18 @@ void JUTCacheFont::invalidiateAllCache() {
if (uVar2 == 0) {
iVar1 = 0;
} else {
- iVar1 = (int)piVar3 - field_0x94;
+ iVar1 = (intptr_t)piVar3 - field_0x94;
}
*piVar3 = iVar1;
if (uVar2 == mCachePage - 1) {
iVar1 = 0;
} else {
- iVar1 = (int)piVar3 + field_0x94;
+ iVar1 = (intptr_t)piVar3 + field_0x94;
}
piVar3[1] = iVar1;
- piVar3 = (int*)((int)piVar3 + field_0x94);
+ piVar3 = (int*)((intptr_t)piVar3 + field_0x94);
}
- field_0xa8 = (int)piVar3 - field_0x94;
+ field_0xa8 = (intptr_t)piVar3 - field_0x94;
field_0xa4 = (TGlyphCacheInfo*)mCacheBuffer;
field_0x9c = NULL;
field_0xa0 = NULL;
diff --git a/src/JSystem/JUtility/JUTGraphFifo.cpp b/src/JSystem/JUtility/JUTGraphFifo.cpp
index 2add552e85..98f7db2c39 100644
--- a/src/JSystem/JUtility/JUTGraphFifo.cpp
+++ b/src/JSystem/JUtility/JUTGraphFifo.cpp
@@ -2,6 +2,7 @@
#include "JSystem/JUtility/JUTGraphFifo.h"
#include "JSystem/JKernel/JKRHeap.h"
+#include "stdint.h"
static bool data_804514B8;
@@ -16,7 +17,7 @@ JUTGraphFifo::JUTGraphFifo(u32 size) {
GXInitFifoPtrs(mFifo, mBase, mBase);
} else {
mBase = JKRAllocFromSysHeap(mSize + 0xA0, 32);
- mBase = (void*)((int)mBase + 0x1F & ~0x1F);
+ mBase = (void*)((intptr_t)mBase + 0x1F & ~0x1F);
mFifo = GXInit(mBase, mSize);
data_804514B8 = true;
sCurrentFifo = this;
diff --git a/src/JSystem/JUtility/JUTTexture.cpp b/src/JSystem/JUtility/JUTTexture.cpp
index d62f8961ee..3a5926586d 100644
--- a/src/JSystem/JUtility/JUTTexture.cpp
+++ b/src/JSystem/JUtility/JUTTexture.cpp
@@ -18,10 +18,10 @@ void JUTTexture::storeTIMG(ResTIMG const* param_0, u8 param_1) {
if (param_0 && param_1 < 0x10) {
mTexInfo = param_0;
- mTexData = (void*)((int)mTexInfo + mTexInfo->imageOffset);
+ mTexData = (void*)((intptr_t)mTexInfo + mTexInfo->imageOffset);
if (mTexInfo->imageOffset == 0) {
- mTexData = (void*)((int)mTexInfo + 0x20);
+ mTexData = (void*)((intptr_t)mTexInfo + 0x20);
}
field_0x2c = NULL;
diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp
index af1d6d38c1..0b4a9ba890 100644
--- a/src/d/d_camera.cpp
+++ b/src/d/d_camera.cpp
@@ -9037,7 +9037,7 @@ bool dCamera_c::eventCamera(s32 param_0) {
mEventData.field_0xc == specialType[20] || mEventData.field_0xc == specialType[21] ||
mEventData.field_0xc == specialType[22] || mEventData.field_0xc == specialType[23] ||
mEventData.field_0xc == specialType[24] || mEventData.field_0xc == specialType[18]) &&
- *(int*)((int)&mEventData + 0xc) != -1) // fakematch to force additional load
+ *(int*)((intptr_t)&mEventData + 0xc) != -1) // fakematch to force additional load
{
var_r29 = 28;
} else if (mEventData.field_0xc == specialType[14] && var_r29 != 2) {