next round of standard compiler fixes

This commit is contained in:
kipcode66 2025-12-19 12:35:48 -05:00
parent 9771ae6879
commit f69b3bc90e
21 changed files with 66 additions and 53 deletions

View File

@ -181,7 +181,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
/* 0x000 */ JASSeqCtrl mSeqCtrl;
/* 0x05C */ JASTrackPort mTrackPort;
/* 0x080 */ JASRegisterParam mRegisterParam;
/* 0x09C */ union {
/* 0x09C */ union MoveParam_u {
struct {
MoveParam_ volume;
MoveParam_ pitch;
@ -191,6 +191,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
MoveParam_ distFilter;
} params;
MoveParam_ array[6];
MoveParam_u() {}
} mMoveParam;
/* 0x0e4 */ JASOscillator::Data mOscParam[2];
/* 0x114 */ JASOscillator::Point mOscPoint[4];

View File

@ -92,7 +92,7 @@ struct TParseValue : public Parser {
}
static const void* advance(const void* data, s32 advanceNum) {
return (char*)data + (advanceNum * sizeof(Parser::ParseType));
return (char*)data + (advanceNum * sizeof(typename Parser::ParseType));
}
};

View File

@ -262,7 +262,7 @@ struct TLinkList_factory : public TLinkList<T, I> {
}
typename TLinkList<T, I>::iterator Erase_destroy(T* param_0) {
typename TLinkList<T, I>::iterator spC(Erase(param_0));
typename TLinkList<T, I>::iterator spC(this->Erase(param_0));
Do_destroy(param_0);
return spC;
}

View File

@ -2,7 +2,7 @@
#define D_D_PATH_H
#include "dolphin/types.h"
#include "mtx.h"
#include "dolphin/mtx.h"
class cBgS_PolyInfo;
struct cXyz;

View File

@ -131,4 +131,10 @@ static const float INF = 2000000000.0f;
#define SJIS(character, value) ((u32)value)
#endif
#ifdef __MWERKS__
#define ASM asm
#else
#define ASM
#endif
#endif

View File

@ -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;
}

View File

@ -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

View File

@ -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];

View File

@ -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();

View File

@ -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);

View File

@ -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;
}

View File

@ -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,14 +263,6 @@ s16 const JASCalc::CUTOFF_TO_IIR_TABLE[128][4] = {
0x7FFF, 0x0000, 0x0000, 0x0000,
};
// currently required because of missing functions
// JASCalc::hannWindow(short *, u32)
// JASCalc::hammWindow(short *, u32)
// JASCalc::fft(float *, float *, u32, s32)
f32 JASCalc::fake1() { return 0.5f; }
f32 JASCalc::fake2(s32 x) { return JASCalc::clamp<s16, s32>(x); }
f32 JASCalc::fake3() { return 0.0f; }
f32 JASCalc::pow2(f32 x) {
s32 frac_index = 0;
union {
@ -325,3 +317,11 @@ s16 JASCalc::clamp(s32 x) {
return std::numeric_limits<s16>::max();
return x;
}
// currently required because of missing functions
// JASCalc::hannWindow(short *, u32)
// JASCalc::hammWindow(short *, u32)
// JASCalc::fft(float *, float *, u32, s32)
f32 JASCalc::fake1() { return 0.5f; }
f32 JASCalc::fake2(s32 x) { return JASCalc::clamp<s16, s32>(x); }
f32 JASCalc::fake3() { return 0.0f; }

View File

@ -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() {

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}

View File

@ -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:

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -9035,7 +9035,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) {