portx64: and more s32 -> uintptr_t

This commit is contained in:
Raf committed 2024-07-30 16:46:02 +08:00
1 parent 315a5642da
commit 8a94af6a1c
20 files changed
+107 -107

No files matched your search

+3 -3
View File
@@ -113,7 +113,7 @@ struct portalcamcacheitem *g_PortalCameraCache;
struct bgsnake g_BgSnake;
s32 g_StageIndex = 1;
u32 var8007fc04 = 0;
uintptr_t var8007fc04 = 0;
u8 *var8007fc08 = NULL;
#if VERSION < VERSION_NTSC_1_0
@@ -1468,7 +1468,7 @@ void bgReset(s32 stagenum)
u32 section2compsize;
u32 section2start;
u32 section1compsize;
u32 scratch;
uintptr_t scratch;
var8007fc0c = 8;
@@ -3640,7 +3640,7 @@ bool bgTestHitOnObj(struct coord *arg0, struct coord *arg1, struct coord *arg2,
Gfx *imggdl = NULL;
s32 texturenum;
f32 lowestsqdist = MAXFLOAT;
s32 offset;
uintptr_t offset;
s32 numvertices;
Gfx *tri4gdl;
s32 count;
+22 -22
View File
@@ -3799,16 +3799,16 @@ void bgunTickGunLoad(void)
{
s32 i;
s32 numthistick;
u32 remaining;
u64 remaining;
s32 padding;
u32 allocsize;
u32 loadsize;
u64 allocsize;
u64 loadsize;
uintptr_t ptr;
struct player *player = g_Vars.currentplayer;
struct modeldef *modeldef;
struct fileinfo *fileinfo;
struct fileinfo *gunfileinfo;
s32 newvalue;
uintptr_t newvalue;
uintptr_t end;
u32 stack;
#if VERSION >= VERSION_NTSC_1_0
@@ -4095,8 +4095,8 @@ void bgunTickMasterLoad(void)
player->gunctrl.gunloadstate = GUNLOADSTATE_MODEL;
player->gunctrl.loadfilenum = handfilenum;
player->gunctrl.loadtomodeldef = &player->gunctrl.handmodeldef;
player->gunctrl.loadmemptr = (u32 *) &player->gunctrl.handmemloadptr;
player->gunctrl.loadmemremaining = (u32 *) &player->gunctrl.handmemloadremaining;
player->gunctrl.loadmemptr = (uintptr_t *) &player->gunctrl.handmemloadptr;
player->gunctrl.loadmemremaining = (uintptr_t*) &player->gunctrl.handmemloadremaining;
}
bgunTickGunLoad();
@@ -4123,8 +4123,8 @@ void bgunTickMasterLoad(void)
player->gunctrl.gunloadstate = GUNLOADSTATE_MODEL;
player->gunctrl.loadfilenum = filenum;
player->gunctrl.loadtomodeldef = &player->gunctrl.gunmodeldef;
player->gunctrl.loadmemptr = (u32 *) &player->gunctrl.memloadptr;
player->gunctrl.loadmemremaining = (u32 *) &player->gunctrl.memloadremaining;
player->gunctrl.loadmemptr = (uintptr_t*) &player->gunctrl.memloadptr;
player->gunctrl.loadmemremaining = (uintptr_t*) &player->gunctrl.memloadremaining;
}
bgunTickGunLoad();
@@ -4165,8 +4165,8 @@ void bgunTickMasterLoad(void)
player->gunctrl.loadfilenum = filenum;
player->gunctrl.gunloadstate = GUNLOADSTATE_MODEL;
player->gunctrl.loadtomodeldef = &player->gunctrl.cartmodeldef;
player->gunctrl.loadmemptr = (u32 *) &player->gunctrl.memloadptr;
player->gunctrl.loadmemremaining = (u32 *) &player->gunctrl.memloadremaining;
player->gunctrl.loadmemptr = (uintptr_t *) &player->gunctrl.memloadptr;
player->gunctrl.loadmemremaining = (uintptr_t*) &player->gunctrl.memloadremaining;
break;
}
@@ -4194,16 +4194,16 @@ void bgunTickMasterLoad(void)
hand->unk0dcc = (s32 *) player->gunctrl.memloadptr;
value = bgunCreateModelCmdList(&hand->gunmodel, player->gunctrl.gunmodeldef->rootnode, (s32 *) player->gunctrl.memloadptr);
value = bgunCreateModelCmdList(&hand->gunmodel, player->gunctrl.gunmodeldef->rootnode, (uintptr_t *) player->gunctrl.memloadptr);
sum += value;
player->gunctrl.memloadptr += value;
player->gunctrl.memloadremaining -= value;
if (player->gunctrl.handmodeldef != 0) {
hand->unk0dd0 = (s32 *) player->gunctrl.memloadptr;
hand->unk0dd0 = (uintptr_t*) player->gunctrl.memloadptr;
value = bgunCreateModelCmdList(&hand->handmodel, player->gunctrl.handmodeldef->rootnode, (s32 *) player->gunctrl.memloadptr);
value = bgunCreateModelCmdList(&hand->handmodel, player->gunctrl.handmodeldef->rootnode, (uintptr_t*) player->gunctrl.memloadptr);
sum += value;
player->gunctrl.memloadptr += value;
@@ -6423,7 +6423,7 @@ void bgunDisarm(struct prop *attackerprop)
*
* With this function stubbed, part of the CMP150 model does not render.
*/
void bgunExecuteModelCmdList(s32 *ptr)
void bgunExecuteModelCmdList(uintptr_t *ptr)
{
union modelrwdata *rwdata;
struct modelnode *node;
@@ -6480,7 +6480,7 @@ void bgunExecuteModelCmdList(s32 *ptr)
* iterate the command list to update part visibility rather than iterate the
* full model tree.
*/
s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *ptr)
s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, uintptr_t *ptr)
{
s32 len = 0;
struct modelnode *node = nodearg;
@@ -6501,7 +6501,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[2] = (uintptr_t)node;
ptr[3] = (uintptr_t)rodata->distance.target;
ptr += 4;
len += 16;
len += 4 * sizeof(uintptr_t);
break;
case MODELNODETYPE_TOGGLE:
rodata = node->rodata;
@@ -6513,7 +6513,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[2] = (uintptr_t)node;
ptr[3] = (uintptr_t)rodata->toggle.target;
ptr += 4;
len += 16;
len += 4 * sizeof(uintptr_t);
break;
case MODELNODETYPE_HEADSPOT:
rwdata = modelGetNodeRwData(model, node);
@@ -6522,7 +6522,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[0] = 2;
ptr[1] = (uintptr_t)rwdata;
ptr += 2;
len += 8;
len += 2 * sizeof(uintptr_t);
break;
case MODELNODETYPE_0B:
rwdata = modelGetNodeRwData(model, node);
@@ -6530,7 +6530,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[0] = 3;
ptr[1] = (uintptr_t)rwdata;
ptr += 2;
len += 8;
len += 2 * sizeof(uintptr_t);
break;
case MODELNODETYPE_CHRGUNFIRE:
rwdata = modelGetNodeRwData(model, node);
@@ -6538,7 +6538,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[0] = 4;
ptr[1] = (uintptr_t)rwdata;
ptr += 2;
len += 8;
len += 2 * sizeof(uintptr_t);
break;
case MODELNODETYPE_DL:
rodata = node->rodata;
@@ -6552,7 +6552,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
ptr[3] = (uintptr_t)rwdata->dl.gdl;
ptr[4] = (uintptr_t)rwdata->dl.colours;
ptr += 5;
len += 20;
len += 5 * sizeof(uintptr_t);
break;
}
@@ -6576,7 +6576,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 *
}
*ptr = 6;
len += 4;
len += sizeof(uintptr_t);
return len;
}
+9 -9
View File
@@ -4114,7 +4114,7 @@ u32 g_FileTable[] = {
(uintptr_t) &_filenamesSegmentRomStart,
};
#else // PLATFORM_N64
u32 g_FileTable[NUM_FILES + 1]; // TODO: this is only used to get the filenum, remove this
uintptr_t g_FileTable[NUM_FILES + 1]; // TODO: this is only used to get the filenum, remove this
#endif // PLATFORM_N64
romptr_t fileGetRomAddress(s32 filenum)
@@ -4126,7 +4126,7 @@ romptr_t fileGetRomAddress(s32 filenum)
#endif
}
u32 fileGetRomSizeByTableAddress(u32 *filetableaddr)
u32 fileGetRomSizeByTableAddress(uintptr_t *filetableaddr)
{
#ifdef PLATFORM_N64
u32 size;
@@ -4146,10 +4146,10 @@ u32 fileGetRomSizeByTableAddress(u32 *filetableaddr)
s32 fileGetRomSize(s32 filenum)
{
return fileGetRomSizeByTableAddress((u32 *)&g_FileTable[filenum]);
return fileGetRomSizeByTableAddress((uintptr_t*)&g_FileTable[filenum]);
}
u32 file0f166ea8(u32 *filetableaddr)
u32 file0f166ea8(uintptr_t *filetableaddr)
{
return 0;
}
@@ -4158,7 +4158,7 @@ void fileLoad(u8 *dst, u32 allocationlen, romptr_t *romaddrptr, struct fileinfo
{
#ifndef PLATFORM_N64
// load the file first
const s32 filenum = (u32 *)romaddrptr - g_FileTable;
const s32 filenum = (uintptr_t *)romaddrptr - g_FileTable;
u32 romsize = 0;
u8 *filedata = romdataFileLoad(filenum, &romsize);
if (!filedata) {
@@ -4176,7 +4176,7 @@ void fileLoad(u8 *dst, u32 allocationlen, romptr_t *romaddrptr, struct fileinfo
dmaExec(dst, *romaddrptr, romsize);
} else {
// DMA the compressed data to scratch space then inflate
u8 *scratch = (dst + allocationlen) - ((romsize + 7) & 0xfffffff8);
u8 *scratch = (dst + allocationlen) - ((romsize + 7) & 0xfffffffffffffff8);
if ((uintptr_t)scratch - (uintptr_t)dst < 8) {
info->loadedsize = 0;
@@ -4241,7 +4241,7 @@ void fileLoadPartToAddr(u16 filenum, void *memaddr, s32 offset, u32 len)
{
u32 stack[2];
if (fileGetRomSizeByTableAddress((u32 *)&g_FileTable[filenum])) {
if (fileGetRomSizeByTableAddress((uintptr_t*)&g_FileTable[filenum])) {
#ifdef PLATFORM_N64
dmaExec(memaddr, (romptr_t) g_FileTable[filenum] + offset, len);
#else
@@ -4317,7 +4317,7 @@ void *fileLoadToNew(s32 filenum, u32 method)
ptr = mempAlloc(info->loadedsize, MEMPOOL_STAGE);
info->allocsize = info->loadedsize;
fileLoad(ptr, info->loadedsize, (u32 *)&g_FileTable[filenum], info);
fileLoad(ptr, info->loadedsize, (uintptr_t*)&g_FileTable[filenum], info);
if (method != FILELOADMETHOD_EXTRAMEM) {
mempRealloc(ptr, info->loadedsize, MEMPOOL_STAGE);
@@ -4343,7 +4343,7 @@ void *fileLoadToAddr(s32 filenum, s32 method, u8 *ptr, u32 size)
if (method == FILELOADMETHOD_EXTRAMEM || method == FILELOADMETHOD_DEFAULT) {
info->allocsize = size;
fileLoad(ptr, size, (u32 *)&g_FileTable[filenum], info);
fileLoad(ptr, size, (uintptr_t*)&g_FileTable[filenum], info);
} else {
while (1);
}
+1 -1
View File
@@ -411,7 +411,7 @@ struct menudialogdef g_FilemgrErrorMenuDialog = {
* For a file listing, iterate the devices until the one at optionindex is found.
* Depending on operation, return the device name or index of the first file.
*/
s32 filemgrGetDeviceNameOrStartIndex(s32 listnum, s32 operation, s32 optionindex)
uintptr_t filemgrGetDeviceNameOrStartIndex(s32 listnum, s32 operation, s32 optionindex)
{
u16 names[] = {
L_OPTIONS_111, // "Game Pak"
+2 -2
View File
@@ -137,7 +137,7 @@ void modeldef0f1a7560(struct modeldef *modeldef, u16 filenum, u32 arg2, struct m
texCopyGdls((Gfx *)((uintptr_t)modeldef + (UNSEGADDR(gdl) & 0xffffff)),
(Gfx *)(v1 + (uintptr_t)modeldef),
loadedsize - (uintptr_t)(((uintptr_t)modeldef + (UNSEGADDR(gdl) & 0xffffff)) - (uintptr_t)modeldef));
texLoadFromConfigs(modeldef->texconfigs, modeldef->numtexconfigs, texpool, (uintptr_t)modeldef2 - arg2);
texLoadFromConfigs(modeldef->texconfigs, modeldef->numtexconfigs, texpool, (uintptr_t)modeldef2 - (uintptr_t)arg2);
while (node) {
prevnode = node;
@@ -190,7 +190,7 @@ struct modeldef *modeldefLoad(u16 fileid, u8 *dst, s32 size, struct texpool *arg
if (dst) {
modeldef = fileLoadToAddr(fileid, FILELOADMETHOD_EXTRAMEM, dst, size);
} else {
modeldef = fileLoadToNew(fileid, FILELOADMETHOD_EXTRAMEM);
modeldef = fileLoadToNew(fileid, FILELOADMETHOD_EXTRAMEM, FT_LANG);
}
modelPromoteTypeToPointer(modeldef);
+7 -7
View File
@@ -1237,7 +1237,7 @@ void setupLoadBriefing(s32 stagenum, u8 *buffer, s32 bufferlen, struct briefing
langLoadToAddr(briefing->langbank, langbuffer, langbufferlen);
start = (struct defaultobj *)((uintptr_t)setup + (u32)setup->props);
start = (struct defaultobj *)((uintptr_t)setup + (uintptr_t)setup->props);
if (start != NULL) {
struct defaultobj *obj;
@@ -1323,10 +1323,10 @@ void setupLoadFiles(s32 stagenum)
setup = (struct stagesetup *)g_GeCreditsData;
langLoad(langGetLangBankIndexFromStagenum(stagenum));
g_StageSetup.intro = (s32 *)((uintptr_t)setup + (u32)setup->intro);
g_StageSetup.props = (u32 *)((uintptr_t)setup + (u32)setup->props);
g_StageSetup.paths = (struct path *)((uintptr_t)setup + (u32)setup->paths);
g_StageSetup.ailists = (struct ailist *)((uintptr_t)setup + (u32)setup->ailists);
g_StageSetup.intro = (s32 *)((uintptr_t)setup + (uintptr_t)setup->intro);
g_StageSetup.props = (u32 *)((uintptr_t)setup + (uintptr_t)setup->props);
g_StageSetup.paths = (struct path *)((uintptr_t)setup + (uintptr_t)setup->paths);
g_StageSetup.ailists = (struct ailist *)((uintptr_t)setup + (uintptr_t)setup->ailists);
g_LoadType = LOADTYPE_PADS;
@@ -1339,7 +1339,7 @@ void setupLoadFiles(s32 stagenum)
// Convert ailist pointers from file-local to proper pointers
if (g_StageSetup.ailists) {
for (i = 0; g_StageSetup.ailists[i].list != NULL; i++) {
g_StageSetup.ailists[i].list = (u8 *)((uintptr_t)setup + (u32)g_StageSetup.ailists[i].list);
g_StageSetup.ailists[i].list = (u8 *)((uintptr_t)setup + (uintptr_t)g_StageSetup.ailists[i].list);
}
}
@@ -1383,7 +1383,7 @@ void setupLoadFiles(s32 stagenum)
// and calculate the path lengths
if (g_StageSetup.paths) {
for (i = 0; g_StageSetup.paths[i].pads != NULL; i++) {
g_StageSetup.paths[i].pads = (s32 *)((uintptr_t)g_StageSetup.paths[i].pads + (u32)setup);
g_StageSetup.paths[i].pads = (s32 *)((uintptr_t)g_StageSetup.paths[i].pads + (uintptr_t)setup);
for (j = 0; g_StageSetup.paths[i].pads[j] >= 0; j++);
+2 -2
View File
@@ -2381,12 +2381,12 @@ void texLoad(texnum_t *updateword, struct texpool *pool, bool unusedarg)
}
}
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texpool *pool, s32 arg3)
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texpool *pool, uintptr_t arg3)
{
s32 i;
for (i = 0; i < numconfigs; i++) {
if ((s32)configs[i].texturenum < NUM_TEXTURES) {
if ((uintptr_t)configs[i].texturenum < NUM_TEXTURES) {
texLoad(&configs[i].texturenum, pool, true);
configs[i].unk0b = 1;
} else {
+1 -1
View File
@@ -51,7 +51,7 @@
#define ALIGN2(val) (((val) | 1) ^ 0x1)
#define ALIGN8(val) ((((val) + 0x7) | 0x7) ^ 0x7)
#define ALIGN16(val) ((((val) + 0xf) | 0xf) ^ 0xf)
#define ALIGN64(val) (((((u32)(val)) + 0x3f) | 0x3f) ^ 0x3f)
#define ALIGN64(val) (((((uintptr_t)(val)) + 0x3f) | 0x3f) ^ 0x3f)
#define ARRAYCOUNT(a) (s32)(sizeof(a) / sizeof(a[0]))
#define CHRNAVSEED(chr) ((g_Vars.lvframe60 >> 9) * 128 + chr->chrnum * 8)
#define CHRRACE(chr) (chr ? chr->race : RACE_HUMAN)
+2 -2
View File
@@ -118,8 +118,8 @@ bool bgun0f0a27c8(void);
void bgunHandlePlayerDead(void);
bool bgunIsMissionCritical(s32 weaponnum);
void bgunDisarm(struct prop *attacker);
void bgunExecuteModelCmdList(s32 *arg0);
s32 bgunCreateModelCmdList(struct model *model, struct modelnode *node, s32 *ptr);
void bgunExecuteModelCmdList(uintptr_t *arg0);
s32 bgunCreateModelCmdList(struct model *model, struct modelnode *node, uintptr_t *ptr);
void bgunStartDetonateAnimation(s32 playernum);
void bgunUpdateGangsta(struct hand *hand, s32 handnum, struct coord *arg2, struct weaponfunc *funcdef, Mtxf *arg4, Mtxf *arg5);
void bgunUpdateSmoke(struct hand *hand, s32 handnum, s32 weaponnum, struct weaponfunc *funcdef);
+1 -1
View File
@@ -16,7 +16,7 @@ void filemgrSetFileToDelete(struct filelistfile *file, s32 filetype);
char *filemgrMenuTextFailReason(struct menuitem *item);
char *filemgrMenuTextDeviceNameForError(struct menuitem *item);
void filemgrPushErrorDialog(u16 errnum);
s32 filemgrGetDeviceNameOrStartIndex(s32 listnum, s32 operation, s32 optionindex);
uintptr_t filemgrGetDeviceNameOrStartIndex(s32 listnum, s32 operation, s32 optionindex);
char *filemgrMenuTextErrorTitle(struct menuitem *item);
char *filemgrMenuTextFileType(struct menuitem *item);
void func0f10898c(void);
+1 -1
View File
@@ -33,7 +33,7 @@ s32 texGetPoolFreeBytes(struct texpool *pool);
u8 *texGetPoolLeftPos(struct texpool *pool);
void texLoadFromDisplayList(Gfx *gdl, struct texpool *pool, s32 arg2);
void texLoad(texnum_t *updateword, struct texpool *pool, bool unusedarg);
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texpool *pool, s32 arg3);
void texLoadFromConfigs(struct textureconfig *configs, s32 numconfigs, struct texpool *pool, uintptr_t arg3);
void texLoadFromTextureNum(u32 arg0, struct texpool *pool);
#ifndef PLATFORM_N64
void texSwizzleInternal(u8 *dst, s32 width, s32 height, s32 format, u32 dstlen);
+7 -7
View File
@@ -6,13 +6,13 @@
void memaDefrag(void);
void memaInit(void);
void memaReset(void *ptr, u32 size);
void memaReset(void *ptr, u64 size);
void memaPrint(void);
void *memaAlloc(u32 size);
s32 memaGrow(s32 addr, u32 amount);
void _memaFree(s32 addr, s32 size);
void memaFree(void *addr, s32 size);
s32 memaGetLongestFree(void);
bool memaRealloc(s32 addr, u32 oldsize, u32 newsize);
void *memaAlloc(u64 size);
uintptr_t memaGrow(uintptr_t addr, u64 amount);
void _memaFree(uintptr_t addr, u64 size);
void memaFree(void *addr, u64 size);
u64 memaGetLongestFree(void);
bool memaRealloc(uintptr_t addr, u64 oldsize, u64 newsize);
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
#include "types.h"
void mp3Init(ALHeap *heap);
void mp3PlayFile(s32 romaddr, s32 filesize);
void mp3PlayFile(uintptr_t romaddr, s32 filesize);
void func00037e1c(void);
void func00037e38(void);
void func00037e68(void);
+5 -5
View File
@@ -12,11 +12,11 @@ void snd0000ea80(u16 volume);
void sndResetCurMp3(void);
void sndLoadSfxCtl(void);
void sndIncrementAges(void);
ALEnvelope *sndLoadEnvelope(u32 offset, u16 index);
ALKeyMap *sndLoadKeymap(u32 offset, u16 index);
ALADPCMBook *sndLoadAdpcmBook(u32 offset, u16 index);
ALADPCMloop *sndLoadAdpcmLoop(u32 offset, u16 index);
ALWaveTable *sndLoadWavetable(u32 offset, u16 index);
ALEnvelope *sndLoadEnvelope(uintptr_t offset, u16 index);
ALKeyMap *sndLoadKeymap(uintptr_t offset, u16 index);
ALADPCMBook* sndLoadAdpcmBook(uintptr_t offset, u16 index);
ALADPCMloop* sndLoadAdpcmLoop(uintptr_t offset, u16 index);
ALWaveTable* sndLoadWavetable(uintptr_t offset, u16 index);
void sndSetSoundMode(s32 mode);
ALSound *sndLoadSound(s16 soundnum);
void seqInit(struct seqinstance *seq);
+5 -5
View File
@@ -2307,7 +2307,7 @@ struct hand {
/*0x0dc0*/ u32 fspare8;
/*0x0dc4*/ struct abmag abmag;
/*0x0dcc*/ s32 *unk0dcc;
/*0x0dd0*/ s32 *unk0dd0;
/*0x0dd0*/ uintptr_t *unk0dd0;
/*0x0dd4*/ s32 unk0dd4;
/*0x0dd8*/ Mtxf *unk0dd8;
};
@@ -2354,8 +2354,8 @@ struct gunctrl {
/*0x15b1*/ u8 gunloadstate;
/*0x15b2*/ u16 loadfilenum;
/*0x15b4*/ struct modeldef **loadtomodeldef;
/*0x15b8*/ u32 *loadmemptr;
/*0x15bc*/ u32 *loadmemremaining;
/*0x15b8*/ uintptr_t *loadmemptr;
/*0x15bc*/ uintptr_t*loadmemremaining;
/*0x15c0*/ struct texpool texpool;
/*0x15d0*/ u32 nexttexturetoload;
/*0x15d4*/ struct fileinfo fileinfo;
@@ -3363,8 +3363,8 @@ struct handlerdata_label {
struct handlerdata_list {
union {
u32 value;
s32 values32;
uintptr_t value;
intptr_t values32;
};
union {
s32 unk04;
+16 -16
View File
@@ -38,8 +38,8 @@
#define MAX_SPACES 124
struct memaspace {
s32 addr;
u32 size;
uintptr_t addr;
u64 size;
};
/**
@@ -55,8 +55,8 @@ struct memaheap {
struct memaspace end2;
};
s32 g_MemaHeapStart;
s32 g_MemaHeapSize;
uintptr_t g_MemaHeapStart;
u64 g_MemaHeapSize;
struct memaheap g_MemaHeap;
#if VERSION == VERSION_PAL_BETA
@@ -65,8 +65,8 @@ u32 g_MemaLeastEverFree = 1000000;
void memaSwap(struct memaspace *a, struct memaspace *b)
{
u32 tempaddr = a->addr;
u32 tempsize = a->size;
uintptr_t tempaddr = a->addr;
u64 tempsize = a->size;
a->addr = b->addr;
a->size = b->size;
b->addr = tempaddr;
@@ -86,7 +86,7 @@ bool memaDefragPass(struct memaheap *heap)
struct memaspace *prev = &heap->start;
struct memaspace *curr = &heap->spaces[0];
struct memaspace *last = &heap->spaces[MAX_SPACES - 1];
u32 addr = 0;
uintptr_t addr = 0;
while (curr <= last) {
if (curr->size != 0) {
@@ -177,7 +177,7 @@ struct memaspace *memaMakeSlot(struct memaheap *heap)
return best;
}
void _memaFree(s32 addr, s32 size)
void _memaFree(uintptr_t addr, u64 size)
{
// Choose an index in the spaces array which we'll mark a space as free,
// based on how far into the heap the allocation is. This is a rough
@@ -215,7 +215,7 @@ void memaInit(void)
// empty
}
void memaReset(void *heapaddr, u32 heapsize)
void memaReset(void *heapaddr, u64 heapsize)
{
struct memaspace *space;
@@ -398,14 +398,14 @@ void memaPrint(void)
#endif
}
void *memaAlloc(u32 size)
void *memaAlloc(u64 size)
{
uintptr_t addr;
u32 diff;
uintptr_t diff;
s32 i;
struct memaspace *curr;
u32 bestdiff;
uintptr_t bestdiff;
struct memaspace *best;
if (1);
@@ -487,7 +487,7 @@ void *memaAlloc(u32 size)
/**
* Grow the allocation which currently *ends at* the given address.
*/
s32 memaGrow(s32 addr, u32 amount)
uintptr_t memaGrow(uintptr_t addr, u64 amount)
{
struct memaspace *curr = &g_MemaHeap.spaces[0];
@@ -512,7 +512,7 @@ found:
return addr;
}
void memaFree(void *addr, s32 size)
void memaFree(void *addr, u64 size)
{
_memaFree((uintptr_t) addr, size);
}
@@ -526,7 +526,7 @@ void mema00012cd4(void)
* Find and return the largest amount of contiguous free space in the pool.
* ie. the biggest allocation that mema can currently make.
*/
s32 memaGetLongestFree(void)
u64 memaGetLongestFree(void)
{
struct memaspace *curr;
s32 biggest = 0;
@@ -550,7 +550,7 @@ s32 memaGetLongestFree(void)
return 0;
}
bool memaRealloc(s32 addr, u32 oldsize, u32 newsize)
bool memaRealloc(uintptr_t addr, u64 oldsize, u64 newsize)
{
if (newsize > oldsize) {
if (!memaGrow(addr + oldsize, newsize - oldsize)) {
+2 -2
View File
@@ -88,7 +88,7 @@ void mp3Init(ALHeap *heap)
func00038b90(func00038ba8);
}
void mp3PlayFile(s32 romaddr, s32 filesize)
void mp3PlayFile(uintptr_t romaddr, s32 filesize)
{
if (g_Mp3Vars.var8009c3dc == NULL) {
return;
@@ -389,7 +389,7 @@ void func00038b90(void *fn)
s32 func00038ba8(s32 arg0, u8 *arg1, s32 arg2, s32 arg3)
{
u32 sp1c;
uintptr_t sp1c;
ALDMAproc proc;
if (arg3 != -1) {
+1 -1
View File
@@ -258,7 +258,7 @@ s32 n_alLoadParam(N_PVoice *filter, s32 paramID, void *param)
Acmd *_decodeChunk(Acmd *ptr, N_PVoice *f, s32 tsam, s32 nbytes, s16 outp, s16 inp, u32 flags)
{
s32 dramAlign, dramLoc;
intptr_t dramAlign, dramLoc;
if (nbytes > 0) {
dramLoc = (f->dc_dma)(f->dc_memin, nbytes, f->dc_dmaState);
+8 -8
View File
@@ -952,7 +952,7 @@ void sndLoadSfxCtl(void)
u8 *buffer;
ALBankFile *file;
ALBank *bank;
u32 romaddr;
romptr_t romaddr;
u32 size;
g_ALSoundRomOffsets = NULL;
@@ -966,14 +966,14 @@ void sndLoadSfxCtl(void)
// then load the first 256 bytes of the bank.
file = (ALBankFile *) buffer;
romaddr = (romptr_t) REF_SEG _sfxctlSegmentRomStart;
romaddr += (u32)file->bankArray[0];
romaddr += (uintptr_t)file->bankArray[0];
dmaExec(buffer, romaddr, size);
// Get the ROM address of the first (and only) instrument,
// then load the first 256 bytes of the instrument.
bank = (ALBank *) buffer;
romaddr = (romptr_t) REF_SEG _sfxctlSegmentRomStart;
romaddr += (u32)bank->instArray[0];
romaddr += (uintptr_t)bank->instArray[0];
dmaExec(buffer, romaddr, size);
// Get the soundCount (spoiler: there's 1545+1).
@@ -1027,7 +1027,7 @@ void sndIncrementAges(void)
}
#endif
ALEnvelope *sndLoadEnvelope(u32 offset, u16 cacheindex)
ALEnvelope *sndLoadEnvelope(uintptr_t offset, u16 cacheindex)
{
#if VERSION >= VERSION_NTSC_1_0
u8 spaf[0x90];
@@ -1074,7 +1074,7 @@ ALEnvelope *sndLoadEnvelope(u32 offset, u16 cacheindex)
return s1;
}
ALKeyMap *sndLoadKeymap(u32 offset, u16 cacheindex)
ALKeyMap *sndLoadKeymap(uintptr_t offset, u16 cacheindex)
{
#if VERSION >= VERSION_NTSC_1_0
u8 spaf[0x90];
@@ -1121,7 +1121,7 @@ ALKeyMap *sndLoadKeymap(u32 offset, u16 cacheindex)
return s1;
}
ALADPCMBook *sndLoadAdpcmBook(u32 offset, u16 cacheindex)
ALADPCMBook *sndLoadAdpcmBook(uintptr_t offset, u16 cacheindex)
{
#if VERSION >= VERSION_NTSC_1_0
u8 spaf[0x150];
@@ -1168,7 +1168,7 @@ ALADPCMBook *sndLoadAdpcmBook(u32 offset, u16 cacheindex)
return s1;
}
ALADPCMloop *sndLoadAdpcmLoop(u32 offset, u16 cacheindex)
ALADPCMloop *sndLoadAdpcmLoop(uintptr_t offset, u16 cacheindex)
{
#if VERSION >= VERSION_NTSC_1_0
u8 spaf[0x90];
@@ -1223,7 +1223,7 @@ ALADPCMloop *sndLoadAdpcmLoop(u32 offset, u16 cacheindex)
return s1;
}
ALWaveTable *sndLoadWavetable(u32 offset, u16 cacheindex)
ALWaveTable *sndLoadWavetable(uintptr_t offset, u16 cacheindex)
{
#if VERSION >= VERSION_NTSC_1_0
u8 spaf[0x90];
+11 -11
View File
@@ -3,14 +3,14 @@
#include <ultraerror.h>
#include "types.h"
void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table);
void _bnkfPatchInst(ALInstrument *inst, s32 offset, s32 table);
void _bnkfPatchSound(ALSound *s, s32 offset, s32 table);
void _bnkfPatchWaveTable(ALWaveTable *w, s32 offset, s32 table);
void _bnkfPatchBank(ALBank *bank, uintptr_t offset, uintptr_t table);
void _bnkfPatchInst(ALInstrument* inst, uintptr_t offset, uintptr_t table);
void _bnkfPatchSound(ALSound* s, uintptr_t offset, uintptr_t table);
void _bnkfPatchWaveTable(ALWaveTable* w, uintptr_t offset, uintptr_t table);
void alSeqFileNew(ALSeqFile *file, u8 *base)
{
intptr_t offset = (intptr_t) base;
uintptr_t offset = (uintptr_t) base;
s32 i;
/*
@@ -23,8 +23,8 @@ void alSeqFileNew(ALSeqFile *file, u8 *base)
void alBnkfNew(ALBankFile *file, u8 *table)
{
intptr_t offset = (intptr_t) file;
intptr_t woffset = (intptr_t) table;
uintptr_t offset = (uintptr_t) file;
uintptr_t woffset = (uintptr_t) table;
s32 i;
@@ -45,7 +45,7 @@ void alBnkfNew(ALBankFile *file, u8 *table)
}
}
void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table)
void _bnkfPatchBank(ALBank *bank, uintptr_t offset, uintptr_t table)
{
s32 i;
@@ -69,7 +69,7 @@ void _bnkfPatchBank(ALBank *bank, s32 offset, s32 table)
}
}
void _bnkfPatchInst(ALInstrument *inst, s32 offset, s32 table)
void _bnkfPatchInst(ALInstrument *inst, uintptr_t offset, uintptr_t table)
{
s32 i;
@@ -85,7 +85,7 @@ void _bnkfPatchInst(ALInstrument *inst, s32 offset, s32 table)
}
}
void _bnkfPatchSound(ALSound *s, s32 offset, s32 table)
void _bnkfPatchSound(ALSound *s, uintptr_t offset, uintptr_t table)
{
if (s->flags) {
return;
@@ -100,7 +100,7 @@ void _bnkfPatchSound(ALSound *s, s32 offset, s32 table)
_bnkfPatchWaveTable(s->wavetable, offset, table);
}
void _bnkfPatchWaveTable(ALWaveTable *w, s32 offset, s32 table)
void _bnkfPatchWaveTable(ALWaveTable *w, uintptr_t offset, uintptr_t table)
{
if (w->flags) {
return;