diff --git a/Makefile.port b/Makefile.port index 650f02474..4c451c939 100644 --- a/Makefile.port +++ b/Makefile.port @@ -86,12 +86,8 @@ endif # Set whether the target arch is 64- or 32-bit. ifneq (,$(findstring 64,$(TARGET_PLATFORM))$(findstring armv8,$(TARGET_PLATFORM))) - # TODO: we're not 64-bit compatible yet, error out if building the actual game - ifeq (,$(findstring clean,$(MAKECMDGOALS))) - $(error 64-bit target platforms are not supported yet) - endif TARGET_64BIT = 1 -else # TODO +else TARGET_64BIT = 0 endif @@ -151,7 +147,7 @@ G_DIR := src/generated/$(ROMID) ifneq (,$(findstring windows,$(TARGET_PLATFORM))) TARGET_CFLAGS := $(shell pkg-config sdl2 --cflags-only-I) - TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lz -lopengl32 -ldbghelp + TARGET_LDFLAGS := $(shell pkg-config sdl2 --libs) -lz -lopengl32 -ldbghelp -lws2_32 # on windows/mingw we need this to be built with a 32-bit compiler so it finds the correct libs TOOLCHAIN ?= i686-w64-mingw32- # on GCC link libstdc++ statically diff --git a/include/PR/gbi.h b/include/PR/gbi.h index e36f15ec2..27993ea61 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -1596,7 +1596,11 @@ typedef struct { */ typedef union { Gwords words; +#ifdef PLATFORM_64BIT + u8 bytes[16]; +#else u8 bytes[8]; +#endif Gdma dma; Gvtx vtx; Gtri tri; @@ -1619,7 +1623,11 @@ typedef union { Gloadtlut loadtlut; #endif GunkC0 unkc0; +#ifdef PLATFORM_64BIT + __int128 force_structure_alignment; +#else long long int force_structure_alignment; +#endif } Gfx; #ifdef PLATFORM_BIG_ENDIAN @@ -1642,12 +1650,12 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24); \ - _g->words.w1 = (unsigned int)(s); \ + _g->words.w1 = (uintptr_t)(s); \ } #define gsDma0p(c, s, l) \ { \ - _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (unsigned int)(s) \ + _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (uintptr_t)(s) \ } #define gDma1p(pkt, c, s, l, p) \ @@ -1656,14 +1664,14 @@ typedef union { \ _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ _SHIFTL((l), 0, 16)); \ - _g->words.w1 = (unsigned int)(s); \ + _g->words.w1 = (uintptr_t)(s); \ } #define gsDma1p(c, s, l, p) \ { \ (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ _SHIFTL((l), 0, 16)), \ - (uintptr_t)(s) \ + (uintptr_t)(s) \ } #define gDma2p(pkt, c, adrs, len, idx, ofs) \ @@ -1671,14 +1679,14 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \ - _g->words.w1 = (unsigned int)(adrs); \ + _g->words.w1 = (uintptr_t)(adrs); \ } #define gsDma2p(c, adrs, len, idx, ofs) \ { \ (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)), \ - (unsigned int)(adrs) \ + (uintptr_t)(adrs) \ } #define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0) @@ -1727,12 +1735,12 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL((c), 24, 8); \ - _g->words.w1 = (unsigned int)(p0); \ + _g->words.w1 = (uintptr_t)(p0); \ } #define gsImmp1(c, p0) \ { \ - _SHIFTL((c), 24, 8), (unsigned int)(p0) \ + _SHIFTL((c), 24, 8), (uintptr_t)(p0) \ } #define gImmp2(pkt, c, p0, p1) \ @@ -1769,13 +1777,13 @@ typedef union { \ _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | \ _SHIFTL((p1), 0, 8)); \ - _g->words.w1 = (unsigned int) (dat); \ + _g->words.w1 = (uintptr_t) (dat); \ } #define gsImmp21(c, p0, p1, dat) \ { \ _SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | _SHIFTL((p1), 0, 8), \ - (unsigned int) (dat) \ + (uintptr_t) (dat) \ } #define gMoveWd(pkt, index, offset, data) \ @@ -1918,7 +1926,7 @@ typedef union { \ _g->words.w0 = _SHIFTL(G_CULLDL, 24, 8) | \ ((0x0f & (vstart))*40); \ - _g->words.w1 = (unsigned int)((0x0f & ((vend)+1))*40); \ + _g->words.w1 = (uintptr_t)((0x0f & ((vend)+1))*40); \ } // Removed in PD @@ -2239,12 +2247,12 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_SETGEOMETRYMODE, 24, 8); \ - _g->words.w1 = (unsigned int)(word); \ + _g->words.w1 = (uintptr_t)(word); \ } #define gsSPSetGeometryMode(word) \ { \ - _SHIFTL(G_SETGEOMETRYMODE, 24, 8), (unsigned int)(word) \ + _SHIFTL(G_SETGEOMETRYMODE, 24, 8), (uintptr_t)(word) \ } #define gSPClearGeometryMode(pkt, word) \ @@ -2252,12 +2260,12 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8); \ - _g->words.w1 = (unsigned int)(word); \ + _g->words.w1 = (uintptr_t)(word); \ } #define gsSPClearGeometryMode(word) \ { \ - _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8), (unsigned int)(word) \ + _SHIFTL(G_CLEARGEOMETRYMODE, 24, 8), (uintptr_t)(word) \ } #define gSPSetOtherMode(pkt, cmd, sft, len, data) \ @@ -2266,13 +2274,13 @@ typedef union { \ _g->words.w0 = (_SHIFTL(cmd, 24, 8) | _SHIFTL(sft, 8, 8) | \ _SHIFTL(len, 0, 8)); \ - _g->words.w1 = (unsigned int)(data); \ + _g->words.w1 = (uintptr_t)(data); \ } #define gsSPSetOtherMode(cmd, sft, len, data) \ { \ _SHIFTL(cmd, 24, 8) | _SHIFTL(sft, 8, 8) | _SHIFTL(len, 0, 8), \ - (unsigned int)(data) \ + (uintptr_t)(data) \ } /* @@ -2323,14 +2331,14 @@ typedef union { \ _g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12); \ - _g->words.w1 = (unsigned int)(i); \ + _g->words.w1 = (uintptr_t)(i); \ } #define gsSetImage(cmd, fmt, siz, width, i) \ { \ _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12), \ - (unsigned int)(i) \ + (uintptr_t)(i) \ } #define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i) @@ -2356,13 +2364,13 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_SETCOMBINE, 24, 8) | _SHIFTL(muxs0, 0, 24); \ - _g->words.w1 = (unsigned int)(muxs1); \ + _g->words.w1 = (uintptr_t)(muxs1); \ } #define gsDPSetCombine(muxs0, muxs1) \ { \ _SHIFTL(G_SETCOMBINE, 24, 8) | _SHIFTL(muxs0, 0, 24), \ - (unsigned int)(muxs1) \ + (uintptr_t)(muxs1) \ } #define GCCc0w0(saRGB0, mRGB0, saA0, mA0) \ @@ -2435,12 +2443,12 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(c, 24, 8); \ - _g->words.w1 = (unsigned int)(d); \ + _g->words.w1 = (uintptr_t)(d); \ } #define gsDPSetColor(c, d) \ { \ - _SHIFTL(c, 24, 8), (unsigned int)(d) \ + _SHIFTL(c, 24, 8), (uintptr_t)(d) \ } #define DPRGBColor(pkt, cmd, r, g, b, a) \ @@ -2521,13 +2529,13 @@ typedef union { Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24); \ - _g->words.w1 = (unsigned int)(mode1); \ + _g->words.w1 = (uintptr_t)(mode1); \ } #define gsDPSetOtherMode(mode0, mode1) \ { \ _SHIFTL(G_RDPSETOTHERMODE,24,8)|_SHIFTL(mode0,0,24), \ - (unsigned int)(mode1) \ + (uintptr_t)(mode1) \ } /* diff --git a/port/src/pdmain.c b/port/src/pdmain.c index 2cd9baffb..959574d4c 100644 --- a/port/src/pdmain.c +++ b/port/src/pdmain.c @@ -570,7 +570,7 @@ void mainTick(void) viUpdateMode(); } - rdpCreateTask(gdlstart, gdl, 0, (s32) &msg); + rdpCreateTask(gdlstart, gdl, 0, (uintptr_t) &msg); memaPrint(); profileSetMarker(PROFILE_MAINTICK_END); } diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 8c99e39c1..e6fc19619 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -6489,9 +6489,9 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata->distance.visible = false; node->child = rodata->distance.target; ptr[0] = 0; - ptr[1] = (s32)rwdata; - ptr[2] = (s32)node; - ptr[3] = (s32)rodata->distance.target; + ptr[1] = (uintptr_t)rwdata; + ptr[2] = (uintptr_t)node; + ptr[3] = (uintptr_t)rodata->distance.target; ptr += 4; len += 16; break; @@ -6501,9 +6501,9 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata->toggle.visible = true; node->child = rodata->toggle.target; ptr[0] = 1; - ptr[1] = (s32)rwdata; - ptr[2] = (s32)node; - ptr[3] = (s32)rodata->toggle.target; + ptr[1] = (uintptr_t)rwdata; + ptr[2] = (uintptr_t)node; + ptr[3] = (uintptr_t)rodata->toggle.target; ptr += 4; len += 16; break; @@ -6512,7 +6512,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata->headspot.headmodeldef = NULL; rwdata->headspot.rwdatas = NULL; ptr[0] = 2; - ptr[1] = (s32)rwdata; + ptr[1] = (uintptr_t)rwdata; ptr += 2; len += 8; break; @@ -6520,7 +6520,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata = modelGetNodeRwData(model, node); rwdata->type0b.unk00 = 0; ptr[0] = 3; - ptr[1] = (s32)rwdata; + ptr[1] = (uintptr_t)rwdata; ptr += 2; len += 8; break; @@ -6528,7 +6528,7 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata = modelGetNodeRwData(model, node); rwdata->chrgunfire.visible = false; ptr[0] = 4; - ptr[1] = (s32)rwdata; + ptr[1] = (uintptr_t)rwdata; ptr += 2; len += 8; break; @@ -6539,10 +6539,10 @@ s32 bgunCreateModelCmdList(struct model *model, struct modelnode *nodearg, s32 * rwdata->dl.gdl = rodata->dl.opagdl; rwdata->dl.colours = (void *)ALIGN8((uintptr_t)&rodata->dl.vertices[rodata->dl.numvertices]); ptr[0] = 5; - ptr[1] = (s32)rwdata; - ptr[2] = (s32)rwdata->dl.vertices; - ptr[3] = (s32)rwdata->dl.gdl; - ptr[4] = (s32)rwdata->dl.colours; + ptr[1] = (uintptr_t)rwdata; + ptr[2] = (uintptr_t)rwdata->dl.vertices; + ptr[3] = (uintptr_t)rwdata->dl.gdl; + ptr[4] = (uintptr_t)rwdata->dl.colours; ptr += 5; len += 20; break; diff --git a/src/game/setup.c b/src/game/setup.c index 912284624..ec9337667 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -1844,7 +1844,7 @@ void setupCreateProps(s32 stagenum) truck->speedtime60 = -1; truck->turnrot60 = 0; truck->roty = 0; - truck->ailist = ailistFindById((u32)truck->ailist); + truck->ailist = ailistFindById((uintptr_t)truck->ailist); truck->aioffset = 0; truck->aireturnlist = -1; truck->path = NULL; @@ -1866,7 +1866,7 @@ void setupCreateProps(s32 stagenum) car->roty = 0; car->rotx = 0; car->speedtime60 = -1; - car->ailist = ailistFindById((s32)car->ailist); + car->ailist = ailistFindById((uintptr_t)car->ailist); car->aioffset = 0; car->aireturnlist = -1; car->path = NULL; @@ -1895,7 +1895,7 @@ void setupCreateProps(s32 stagenum) chopper->gunrotx = 0; chopper->barrelrot = 0; chopper->barrelrotspeed = 0; - chopper->ailist = ailistFindById((u32)chopper->ailist); + chopper->ailist = ailistFindById((uintptr_t)chopper->ailist); chopper->aioffset = 0; chopper->aireturnlist = -1; chopper->path = NULL; @@ -1942,7 +1942,7 @@ void setupCreateProps(s32 stagenum) heli->yrot = 0; heli->speedtime60 = -1; heli->rotoryspeedtime = -1; - heli->ailist = ailistFindById((u32)heli->ailist); + heli->ailist = ailistFindById((uintptr_t)heli->ailist); heli->aioffset = 0; heli->aireturnlist = -1; heli->path = NULL; @@ -2131,8 +2131,8 @@ void setupCreateProps(s32 stagenum) case OBJTYPE_LINKLIFTDOOR: { struct linkliftdoorobj *link = (struct linkliftdoorobj *)obj; - s32 dooroffset = (s32)link->door; - s32 liftoffset = (s32)link->lift; + uintptr_t dooroffset = (uintptr_t)link->door; + uintptr_t liftoffset = (uintptr_t)link->lift; struct defaultobj *door = setupGetObjByCmdIndex(index + dooroffset); struct defaultobj *lift = setupGetObjByCmdIndex(index + liftoffset); @@ -2149,9 +2149,9 @@ void setupCreateProps(s32 stagenum) case OBJTYPE_SAFEITEM: { struct safeitemobj *link = (struct safeitemobj *)obj; - s32 itemoffset = (s32)link->item; - s32 safeoffset = (s32)link->safe; - s32 dooroffset = (s32)link->door; + uintptr_t itemoffset = (uintptr_t)link->item; + uintptr_t safeoffset = (uintptr_t)link->safe; + uintptr_t dooroffset = (uintptr_t)link->door; struct defaultobj *item = setupGetObjByCmdIndex(index + itemoffset); struct defaultobj *safe = setupGetObjByCmdIndex(index + safeoffset); struct defaultobj *door = setupGetObjByCmdIndex(index + dooroffset); @@ -2173,8 +2173,8 @@ void setupCreateProps(s32 stagenum) case OBJTYPE_PADLOCKEDDOOR: { struct padlockeddoorobj *link = (struct padlockeddoorobj *)obj; - s32 dooroffset = (s32)link->door; - s32 lockoffset = (s32)link->lock; + uintptr_t dooroffset = (uintptr_t)link->door; + uintptr_t lockoffset = (uintptr_t)link->lock; struct defaultobj *door = setupGetObjByCmdIndex(index + dooroffset); struct defaultobj *lock = setupGetObjByCmdIndex(index + lockoffset); @@ -2192,9 +2192,9 @@ void setupCreateProps(s32 stagenum) case OBJTYPE_CONDITIONALSCENERY: { struct linksceneryobj *link = (struct linksceneryobj *)obj; - s32 triggeroffset = (s32)link->trigger; - s32 unexpoffset = (s32)link->unexp; - s32 expoffset = (s32)link->exp; + uintptr_t triggeroffset = (uintptr_t)link->trigger; + uintptr_t unexpoffset = (uintptr_t)link->unexp; + uintptr_t expoffset = (uintptr_t)link->exp; struct defaultobj *trigger = setupGetObjByCmdIndex(index + triggeroffset); struct defaultobj *unexp = NULL; struct defaultobj *exp = NULL; @@ -2244,7 +2244,7 @@ void setupCreateProps(s32 stagenum) case OBJTYPE_BLOCKEDPATH: { struct blockedpathobj *blockedpath = (struct blockedpathobj *)obj; - s32 objoffset = (s32)blockedpath->blocker; + uintptr_t objoffset = (uintptr_t)blockedpath->blocker; struct defaultobj *blocker = setupGetObjByCmdIndex(index + objoffset); if (blocker && blocker->prop) { diff --git a/src/game/tex.c b/src/game/tex.c index 953b5a464..f63a00c23 100644 --- a/src/game/tex.c +++ b/src/game/tex.c @@ -861,7 +861,11 @@ s32 texLoadFromGdl(Gfx *instart, s32 gdlsizeinbytes, Gfx *outstart, struct texpo ingdl = instart; outgdl = outstart; +#ifdef PLATFORM_64BIT + numcmdsremaining = gdlsizeinbytes >> 4; +#else numcmdsremaining = gdlsizeinbytes >> 3; +#endif texResetTiles(); @@ -1157,7 +1161,12 @@ s32 texLoadFromGdl(Gfx *instart, s32 gdlsizeinbytes, Gfx *outstart, struct texpo void texCopyGdls(Gfx *src, Gfx *dst, s32 count) { +#ifdef PLATFORM_64BIT + count = (count >> 4); +#else count = (count >> 3); +#endif + src = src + (count - 1); dst = dst + (count - 1); diff --git a/src/game/texdecompress.c b/src/game/texdecompress.c index a6a4ce296..71d7b961d 100644 --- a/src/game/texdecompress.c +++ b/src/game/texdecompress.c @@ -2269,7 +2269,7 @@ void texLoad(texnum_t *updateword, struct texpool *pool, bool unusedarg) // Copy the compressed texture to RAM dmaExec(alignedcompbuffer, (romptr_t) REF_SEG _texturesdataSegmentRomStart + (thisoffset & 0xfffffff8), - ((u32) (nextoffset - thisoffset) + 0x1f) >> 4 << 4); + ((uintptr_t) (nextoffset - thisoffset) + 0x1f) >> 4 << 4); compptr = (u8 *) alignedcompbuffer + (thisoffset & 7); } thisoffset = 0; diff --git a/src/game/texreset.c b/src/game/texreset.c index 1daf8c737..85297c81a 100644 --- a/src/game/texreset.c +++ b/src/game/texreset.c @@ -144,7 +144,7 @@ void texReset(void) g_BlurFbDirty = true; #endif - g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * 4), MEMPOOL_STAGE); + g_TexWords = mempAlloc(ALIGN16(g_TexNumConfigs * sizeof(uintptr_t)), MEMPOOL_STAGE); for (i = 0; i < g_TexNumConfigs; i++) { g_TexWords[i] = NULL; diff --git a/src/game/texselect.c b/src/game/texselect.c index ee0ad8acd..c2abcf58b 100644 --- a/src/game/texselect.c +++ b/src/game/texselect.c @@ -302,7 +302,7 @@ void texSelect(Gfx **gdlptr, struct textureconfig *tconfig, u32 arg2, s32 arg3, #ifdef __sgi index = tconfig - g_TexWallhitConfigs; #else - index = ((s32) tconfig - (s32) g_TexWallhitConfigs) / sizeof(struct textureconfig); + index = ((uintptr_t) tconfig - (uintptr_t) g_TexWallhitConfigs) / sizeof(struct textureconfig); #endif if (index >= 0 && index < g_TexNumConfigs) { diff --git a/src/game/title.c b/src/game/title.c index db1a78531..c37103a2e 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -838,8 +838,8 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, rwdata = modelGetNodeRwData(model, node2); } - s1 = (Col *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (s32)s5rodata->vertices); - s2 = (Col *)ALIGN8(s1rodata->numvertices * (s32) sizeof(Vtx) + (s32)s1rodata->vertices); + s1 = (Col *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (uintptr_t)s5rodata->vertices); + s2 = (Col *)ALIGN8(s1rodata->numvertices * sizeof(Vtx) + (uintptr_t)s1rodata->vertices); a3 = s5rodata->vertices; t0 = s1rodata->vertices; @@ -882,8 +882,8 @@ Gfx *titleRenderPdLogoModel(Gfx *gdl, struct model *model, bool arg2, f32 arg3, spfc[j].a = alpha2; } - sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (s32)sp100); - spfc = (void *)ALIGN8(s5rodata->numcolours * sizeof(u32) + (s32)spfc); + sp100 = (void *)ALIGN8(s5rodata->numvertices * sizeof(Vtx) + (uintptr_t)sp100); + spfc = (void *)ALIGN8(s5rodata->numcolours * sizeof(u32) + (uintptr_t)spfc); } } diff --git a/src/game/vtxstore.c b/src/game/vtxstore.c index de494845e..4999ea6de 100644 --- a/src/game/vtxstore.c +++ b/src/game/vtxstore.c @@ -64,8 +64,8 @@ void vtxstoreFixRefs(void *find, void *replacement) case MODELNODETYPE_DL: rodata = &node->rodata->dl; - if (model->rwdatas[rodata->rwdataindex] == (u32) find) { - model->rwdatas[rodata->rwdataindex] = (u32) replacement; + if (model->rwdatas[rodata->rwdataindex] == (uintptr_t) find) { + model->rwdatas[rodata->rwdataindex] = (uintptr_t) replacement; } break; case MODELNODETYPE_DISTANCE: diff --git a/src/include/bss.h b/src/include/bss.h index e07a9d931..e59e90b29 100644 --- a/src/include/bss.h +++ b/src/include/bss.h @@ -250,7 +250,7 @@ extern struct seqchannel g_SeqChannels[3]; extern u32 g_AudioXReasonsActive[4]; extern s32 g_MusicXReasonMinDurations[4]; extern s32 g_MusicXReasonMaxDurations[4]; -extern u32 *g_LangBanks[69]; +extern uintptr_t *g_LangBanks[69]; extern struct jpncharpixels *g_JpnCharCachePixels; extern struct jpncacheitem *g_JpnCacheCacheItems; extern struct texture *g_Textures; diff --git a/src/include/game/title.h b/src/include/game/title.h index 6dc4ed517..02ecfb690 100644 --- a/src/include/game/title.h +++ b/src/include/game/title.h @@ -4,7 +4,7 @@ #include "data.h" #include "types.h" -#define TITLE_ALLOCSIZE 1024 * 286 +#define TITLE_ALLOCSIZE 1024 * 332 extern u32 var800624d4; extern u32 var800624d8; diff --git a/src/include/lib/model.h b/src/include/lib/model.h index 8d6cef0c8..1e75e6b3b 100644 --- a/src/include/lib/model.h +++ b/src/include/lib/model.h @@ -97,7 +97,7 @@ void modelRenderNodeChrGunfire(struct modelrenderdata *renderdata, struct model void modelRender(struct modelrenderdata *renderdata, struct model *model); bool modelTestBboxNodeForHit(struct modelrodata_bbox *bbox, Mtxf *mtx, struct coord *arg2, struct coord *arg3); s32 modelTestForHit(struct model *model, struct coord *arg1, struct coord *arg2, struct modelnode **startnode); -void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, u32 fileramaddr); +void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, uintptr_t fileramaddr); void modelPromoteOffsetsToPointers(struct modeldef *modeldef, u32 arg1, uintptr_t arg2); s32 modelCalculateRwDataIndexes(struct modelnode *node); void modelAllocateRwData(struct modeldef *modeldef); diff --git a/src/include/lib/rdp.h b/src/include/lib/rdp.h index 6d54e5e44..ee489b81b 100644 --- a/src/include/lib/rdp.h +++ b/src/include/lib/rdp.h @@ -5,6 +5,6 @@ #include "types.h" void rdpInit(void); -void rdpCreateTask(Gfx *gdlstart, Gfx *gdlend, u32 arg2, s32 msg); +void rdpCreateTask(Gfx *gdlstart, Gfx *gdlend, u32 arg2, uintptr_t msg); #endif diff --git a/src/include/types.h b/src/include/types.h index ae575c805..88812911c 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2856,9 +2856,9 @@ struct cover { struct padsfileheader { s32 numpads; s32 numcovers; - s32 waypointsoffset; - s32 waygroupsoffset; - s32 coversoffset; + uintptr_t waypointsoffset; + uintptr_t waygroupsoffset; + uintptr_t coversoffset; u16 padoffsets[1]; }; @@ -5168,7 +5168,7 @@ struct shieldhit { }; struct bgroom { - u32 unk00; + uintptr_t unk00; struct coord pos; u8 br_light_min; u8 br_light_max; diff --git a/src/lib/dma.c b/src/lib/dma.c index e3701a677..698802c0b 100644 --- a/src/lib/dma.c +++ b/src/lib/dma.c @@ -181,8 +181,8 @@ void dmaExecHighPriority(void *memaddr, romptr_t romaddr, u32 len) */ void *dmaExecWithAutoAlign(void *memaddr, romptr_t romaddr, u32 len) { - u32 alignedrom = ALIGN2(romaddr); - u32 alignedmem = ALIGN16((uintptr_t) memaddr); + uintptr_t alignedrom = ALIGN2(romaddr); + uintptr_t alignedmem = ALIGN16((uintptr_t) memaddr); u32 offset = romaddr - alignedrom; // 0 or 1 u32 alignedlen = ALIGN16(offset + len); diff --git a/src/lib/main.c b/src/lib/main.c index 12ea8095c..c03da5235 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -489,7 +489,7 @@ void mainInit(void) if (*(s16 *) receivedmsg == OS_SC_RETRACE_MSG) { viUpdateMode(); - rdpCreateTask(var8005dcc8, var8005dcc8 + ARRAYCOUNT(var8005dcc8), 0, (s32) &scdonemsg); + rdpCreateTask(var8005dcc8, var8005dcc8 + ARRAYCOUNT(var8005dcc8), 0, (uintptr_t) &scdonemsg); j++; } } @@ -611,7 +611,7 @@ void mainInit(void) if (*(s16 *) receivedmsg == OS_SC_RETRACE_MSG) { viUpdateMode(); - rdpCreateTask(var8005dcc8, var8005dcc8 + ARRAYCOUNT(var8005dcc8), 0, (s32) &scdonemsg); + rdpCreateTask(var8005dcc8, var8005dcc8 + ARRAYCOUNT(var8005dcc8), 0, (uintptr_t) &scdonemsg); i++; } } @@ -1092,7 +1092,7 @@ void mainTick(void) viUpdateMode(); } - rdpCreateTask(gdlstart, gdl, 0, (s32) &msg); + rdpCreateTask(gdlstart, gdl, 0, (uintptr_t) &msg); g_MainNumGfxTasks++; memaPrint(); func0f16cf94(); diff --git a/src/lib/mema.c b/src/lib/mema.c index 7cbe894c0..e0dccdf14 100644 --- a/src/lib/mema.c +++ b/src/lib/mema.c @@ -400,7 +400,7 @@ void memaPrint(void) void *memaAlloc(u32 size) { - u32 addr; + uintptr_t addr; u32 diff; s32 i; diff --git a/src/lib/model.c b/src/lib/model.c index ee446a962..929f5c7b4 100644 --- a/src/lib/model.c +++ b/src/lib/model.c @@ -3853,10 +3853,10 @@ s32 modelTestForHit(struct model *model, struct coord *arg1, struct coord *arg2, if (var) \ var = (void *)((uintptr_t)var + diff) -void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, u32 fileramaddr) +void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, uintptr_t fileramaddr) { union modelrodata *rodata; - s32 diff = fileramaddr - vma; + uintptr_t diff = fileramaddr - vma; while (node) { u32 type = node->type & 0xff; @@ -3949,7 +3949,7 @@ void modelPromoteNodeOffsetsToPointers(struct modelnode *node, u32 vma, u32 file */ void modelPromoteOffsetsToPointers(struct modeldef *modeldef, u32 vma, uintptr_t fileramaddr) { - s32 diff = fileramaddr - vma; + uintptr_t diff = fileramaddr - vma; s32 i; s16 *partnums; diff --git a/src/lib/modelasm_c.c b/src/lib/modelasm_c.c index c443b9b91..ea24e12c8 100644 --- a/src/lib/modelasm_c.c +++ b/src/lib/modelasm_c.c @@ -1158,6 +1158,18 @@ static u32 modelasmReadFrameData(void) * Each value is the byte offset into the rodata struct where that node type's * rwdataindex property can be found, or 0xff is there is none. */ + +#ifdef PLATFORM_64BIT +u8 var8005ef90[] = { + 0xff, 0x08, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, + 0x10, 0x2a, 0xff, 0x48, + 0x24, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x08, 0xff, + 0xff, 0xff, 0xff, 0x00, + 0x24, 0x00, +}; +#else u8 var8005ef90[] = { 0xff, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, @@ -1167,6 +1179,7 @@ u8 var8005ef90[] = { 0xff, 0xff, 0xff, 0x00, 0x14, 0x00, }; +#endif static union modelrwdata *modelasmGetNodeRwData(struct model *model, struct modelnode *node, bool is_head) { diff --git a/src/lib/rdp.c b/src/lib/rdp.c index f5c05f614..1782b372f 100644 --- a/src/lib/rdp.c +++ b/src/lib/rdp.c @@ -75,7 +75,7 @@ void rdpInit(void) g_RdpOutBufferEnd = (u16 *) ((uintptr_t) g_RdpOutBufferStart + size); } -void rdpCreateTask(Gfx *gdlstart, Gfx *gdlend, u32 arg2, s32 msg) +void rdpCreateTask(Gfx *gdlstart, Gfx *gdlend, u32 arg2, uintptr_t msg) { OSScTask *sctask; OSTask *task; diff --git a/src/lib/vi.c b/src/lib/vi.c index f76788821..992264dcb 100644 --- a/src/lib/vi.c +++ b/src/lib/vi.c @@ -220,7 +220,11 @@ void viReset(s32 stagenum) ptr = mempAlloc(fbsize * sizeof(u16) + 0x40, MEMPOOL_STAGE); +#ifdef PLATFORM_64BIT + ptr = (u8*)(((uintptr_t)ptr + 0x3f) & 0xffffffffffffffc0); +#else ptr = (u8 *)(((uintptr_t) ptr + 0x3f) & 0xffffffc0); +#endif g_FrameBuffers[0] = (u16 *) ptr; g_FrameBuffers[1] = (u16 *) (fbsize + ptr);