From d2dd109a052d25b1074c1f7d979d38f40dc2a6d7 Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 03:57:01 +0800 Subject: [PATCH 1/7] portx64: a bunch of gcc14 fixes --- port/src/preprocess/common.h | 1 + port/src/preprocess/filemodel.c | 43 +++++++-------- port/src/preprocess/filesetup.c | 95 ++++++++++++++++----------------- port/src/preprocess/util_gbi.c | 2 +- src/game/file.c | 2 +- src/game/menuitem.c | 2 +- 6 files changed, 73 insertions(+), 72 deletions(-) diff --git a/port/src/preprocess/common.h b/port/src/preprocess/common.h index 0f9930d94..b75c6517f 100644 --- a/port/src/preprocess/common.h +++ b/port/src/preprocess/common.h @@ -4,6 +4,7 @@ #include #include #include +#include #include // this BS comes from windows.h diff --git a/port/src/preprocess/filemodel.c b/port/src/preprocess/filemodel.c index 5edece56e..79aa8a9f7 100644 --- a/port/src/preprocess/filemodel.c +++ b/port/src/preprocess/filemodel.c @@ -315,11 +315,11 @@ struct dst_texconfig { u8 unk0b; }; -static inline void *minPtr(void *a, void *b) { +static inline uintptr_t minPtr(uintptr_t a, uintptr_t b) { return (a && (a < b || !b)) ? a : b; } -static inline void *minPtr3(void *a, void *b, void *c) { +static inline uintptr_t minPtr3(uintptr_t a, uintptr_t b, uintptr_t c) { return minPtr(minPtr(a, b), c); } @@ -781,14 +781,14 @@ static u32 resolvePointer(u32 src_offset) static u8 *relinkPointers(u8 *dst, u8 *src) { - u8 *textures_end = 0; + uintptr_t textures_end = 0; for (int i = 0; i < m_NumMarkers; i++) { struct marker *marker = &m_Markers[i]; void *src_thing = &src[marker->src_offset]; void *dst_thing = &dst[marker->dst_offset]; - u8 *lowestptr = 0; + uintptr_t lowestptr = 0; switch (marker->type) { case CT_MODELDEF: @@ -913,6 +913,7 @@ static u8 *relinkPointers(u8 *dst, u8 *src) break; case CT_TEXDATA: case CT_VTXCOL: + case CT_VTXCOL4: case CT_GDL: case CT_RODATA_BBOX: case CT_RODATA_11: @@ -925,31 +926,17 @@ static u8 *relinkPointers(u8 *dst, u8 *src) textures_end = minPtr(textures_end, lowestptr); } - return textures_end; -} - -static int convertModel(u8 *dst, u8 *src, u32 srclen) -{ - u32 dstpos; - - populateMarkers(src); - sortMarkers(); - - dstpos = convertContent(dst, src, srclen); - u8 *tex_end = relinkPointers(dst, src); - preprocessModelTextures(dst, tex_end); - - return dstpos; + return (u8*)textures_end; } -void preprocessTextureRGBA32Embedded(u32* dest, u32 size_bytes) +static void preprocessTextureRGBA32Embedded(u32* dest, u32 size_bytes) { for (uint32_t i = 0; i < size_bytes; i += 4, ++dest) { *dest = PD_BE32(*dest); } } -void preprocessModelTextures(u8 *base, u8 *textures_end) +static void preprocessModelTextures(u8 *base, u8 *textures_end) { struct modeldef* mdl = (struct modeldef*)base; if (!mdl->texconfigs) return; @@ -976,6 +963,20 @@ void preprocessModelTextures(u8 *base, u8 *textures_end) } } +static int convertModel(u8* dst, u8* src, u32 srclen) +{ + u32 dstpos; + + populateMarkers(src); + sortMarkers(); + + dstpos = convertContent(dst, src, srclen); + u8* tex_end = relinkPointers(dst, src); + preprocessModelTextures(dst, tex_end); + + return dstpos; +} + u8 *preprocessModelFile(u8 *data, u32 size, u32 *outSize) { gbiReset(); diff --git a/port/src/preprocess/filesetup.c b/port/src/preprocess/filesetup.c index 2c4e8e977..3e22a71d0 100644 --- a/port/src/preprocess/filesetup.c +++ b/port/src/preprocess/filesetup.c @@ -40,7 +40,7 @@ static u32 convUnk(void* x, u32 y) { __debugbreak(); } for (int j = 0; j < ARRAYCOUNT(dst); j++) PD_CONV_VAL(dst[i][j], src[i][j]); \ } -#define PD_CONV_PTR(dst, src) dst = srctoh32(src) +#define PD_CONV_PTR(dst, src, type) dst = (type)srctoh32(src) static u32 obj_size(struct n64_defaultobj *obj) { @@ -109,10 +109,10 @@ static u32 obj_size(struct n64_defaultobj *obj) void conv_tvscreen(struct tvscreen* dstobj, struct n64_tvscreen* srcobj) { - PD_CONV_PTR(dstobj->cmdlist, srcobj->ptr_cmdlist); + PD_CONV_PTR(dstobj->cmdlist, srcobj->ptr_cmdlist, u32*); PD_CONV_VAL(dstobj->offset, srcobj->offset); PD_CONV_VAL(dstobj->pause60, srcobj->pause60); - PD_CONV_PTR(dstobj->tconfig, srcobj->ptr_tconfig); + PD_CONV_PTR(dstobj->tconfig, srcobj->ptr_tconfig, struct textureconfig*); PD_CONV_VAL(dstobj->rot, srcobj->rot); PD_CONV_VAL(dstobj->xscale, srcobj->xscale); PD_CONV_VAL(dstobj->xscalefrac, srcobj->xscalefrac); @@ -180,12 +180,11 @@ void convertDefaultObj(struct defaultobj* dstobj, struct n64_defaultobj* srcobj) PD_CONV_VAL(dstobj->flags, srcobj->flags); PD_CONV_VAL(dstobj->flags2, srcobj->flags2); PD_CONV_VAL(dstobj->flags3, srcobj->flags3); - PD_CONV_PTR(dstobj->prop, srcobj->ptr_prop); - PD_CONV_PTR(dstobj->model, srcobj->ptr_model); + PD_CONV_PTR(dstobj->prop, srcobj->ptr_prop, struct prop*); + PD_CONV_PTR(dstobj->model, srcobj->ptr_model, struct model*); PD_CONV_ARRAY2D(dstobj->realrot, srcobj->realrot); PD_CONV_VAL(dstobj->hidden, srcobj->hidden); - PD_CONV_PTR(dstobj->unkgeo, srcobj->ptr_unkgeo); - PD_CONV_PTR(dstobj->embedment, srcobj->ptr_embedment); + PD_CONV_PTR(dstobj->unkgeo, srcobj->ptr_unkgeo, struct geocyl*); PD_CONV_VAL(dstobj->damage, srcobj->damage); PD_CONV_VAL(dstobj->maxdamage, srcobj->maxdamage); PD_CONV_ARRAY(dstobj->shadecol, srcobj->shadecol); @@ -230,7 +229,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->opadist, srcobj->opadist); PD_CONV_VAL(dstobj->startpos, srcobj->startpos); PD_CONV_ARRAY2D(dstobj->mtx98, srcobj->mtx98); - PD_CONV_PTR(dstobj->sibling, srcobj->ptr_sibling); + PD_CONV_PTR(dstobj->sibling, srcobj->ptr_sibling, struct doorobj*); PD_CONV_VAL(dstobj->lastopen60, srcobj->lastopen60); PD_CONV_VAL(dstobj->portalnum, srcobj->portalnum); PD_CONV_VAL(dstobj->soundtype, srcobj->soundtype); @@ -337,7 +336,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->team, srcobj->team); - PD_CONV_PTR(dstobj->dualweapon, srcobj->ptr_dualweapon); + PD_CONV_PTR(dstobj->dualweapon, srcobj->ptr_dualweapon, struct weaponobj*); dst += sizeof(struct weaponobj); break; @@ -428,9 +427,9 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->lastseebond60, srcobj->lastseebond60); PD_CONV_VAL(dstobj->lastaimbond60, srcobj->lastaimbond60); PD_CONV_VAL(dstobj->allowsoundframe, srcobj->allowsoundframe); - PD_CONV_PTR(dstobj->beam, srcobj->ptr_beam); + PD_CONV_PTR(dstobj->beam, srcobj->ptr_beam, struct beam*); PD_CONV_VAL(dstobj->shotbondsum, srcobj->shotbondsum); - PD_CONV_PTR(dstobj->target, srcobj->ptr_target); + PD_CONV_PTR(dstobj->target, srcobj->ptr_target, struct prop*); PD_CONV_VAL(dstobj->targetteam, srcobj->targetteam); PD_CONV_VAL(dstobj->ammoquantity, srcobj->ammoquantity); PD_CONV_VAL(dstobj->nextchrtest, srcobj->nextchrtest); @@ -468,9 +467,9 @@ u32 convertProps(u8* dst, u8* src) struct linkliftdoorobj* dstobj = (struct linkliftdoorobj*)dst; convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); - PD_CONV_PTR(dstobj->door, srcobj->ptr_door); - PD_CONV_PTR(dstobj->lift, srcobj->ptr_lift); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->door, srcobj->ptr_door, struct prop*); + PD_CONV_PTR(dstobj->lift, srcobj->ptr_lift, struct prop*); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct linkliftdoorobj*); PD_CONV_VAL(dstobj->stopnum, srcobj->stopnum); dst += sizeof(struct linkliftdoorobj); @@ -513,8 +512,8 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); PD_CONV_VAL(dstobj->tagnum, srcobj->tagnum); PD_CONV_VAL(dstobj->cmdoffset, srcobj->cmdoffset); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); - PD_CONV_PTR(dstobj->obj, srcobj->ptr_obj); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct tag*); + PD_CONV_PTR(dstobj->obj, srcobj->ptr_obj, struct defaultobj*); dst += sizeof(struct tag); break; @@ -572,7 +571,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); PD_CONV_VAL(dstobj->obj, srcobj->obj); PD_CONV_VAL(dstobj->status, srcobj->status); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct criteria_holograph*); dst += sizeof(struct criteria_holograph); break; @@ -585,7 +584,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); PD_CONV_VAL(dstobj->pad, srcobj->pad); PD_CONV_VAL(dstobj->status, srcobj->status); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct criteria_roomentered*); dst += sizeof(struct criteria_roomentered); break; @@ -598,7 +597,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); PD_CONV_VAL(dstobj->pad, srcobj->pad); PD_CONV_VAL(dstobj->status, srcobj->status); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct criteria_throwinroom*); dst += sizeof(struct criteria_throwinroom); break; @@ -611,7 +610,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); PD_CONV_VAL(dstobj->type, srcobj->type); PD_CONV_VAL(dstobj->text, srcobj->text); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct briefingobj*); dst += sizeof(struct briefingobj); break; @@ -629,8 +628,8 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->inventorytext, srcobj->inventorytext); PD_CONV_VAL(dstobj->inventory2text, srcobj->inventory2text); PD_CONV_VAL(dstobj->pickuptext, srcobj->pickuptext); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); - PD_CONV_PTR(dstobj->obj, srcobj->ptr_obj); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct textoverride*); + PD_CONV_PTR(dstobj->obj, srcobj->ptr_obj, struct defaultobj*); dst += sizeof(struct textoverride); break; @@ -641,9 +640,9 @@ u32 convertProps(u8* dst, u8* src) struct padlockeddoorobj* dstobj = (struct padlockeddoorobj*)dst; convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); - PD_CONV_PTR(dstobj->door, srcobj->ptr_door); - PD_CONV_PTR(dstobj->lock, srcobj->ptr_lock); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->door, srcobj->ptr_door, struct doorobj*); + PD_CONV_PTR(dstobj->lock, srcobj->ptr_lock, struct defaultobj*); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct padlockeddoorobj*); dst += sizeof(struct padlockeddoorobj); break; @@ -655,7 +654,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObj(&dstobj->base, cmd); - PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist); + PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist, u8*); PD_CONV_VAL(dstobj->aioffset, srcobj->aioffset); PD_CONV_VAL(dstobj->aireturnlist, srcobj->aireturnlist); PD_CONV_VAL(dstobj->speed, srcobj->speed); @@ -665,7 +664,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->speedtime60, srcobj->speedtime60); PD_CONV_VAL(dstobj->turnrot60, srcobj->turnrot60); PD_CONV_VAL(dstobj->roty, srcobj->roty); - PD_CONV_PTR(dstobj->path, srcobj->ptr_path); + PD_CONV_PTR(dstobj->path, srcobj->ptr_path, struct path*); PD_CONV_VAL(dstobj->nextstep, srcobj->nextstep); dst += sizeof(struct truckobj); @@ -678,7 +677,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObj(&dstobj->base, cmd); - PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist); + PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist, u8*); PD_CONV_VAL(dstobj->aioffset, srcobj->aioffset); PD_CONV_VAL(dstobj->aireturnlist, srcobj->aireturnlist); PD_CONV_VAL(dstobj->rotoryrot, srcobj->rotoryrot); @@ -689,7 +688,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->speedaim, srcobj->speedaim); PD_CONV_VAL(dstobj->speedtime60, srcobj->speedtime60); PD_CONV_VAL(dstobj->yrot, srcobj->yrot); - PD_CONV_PTR(dstobj->path, srcobj->ptr_path); + PD_CONV_PTR(dstobj->path, srcobj->ptr_path, struct path*); PD_CONV_VAL(dstobj->nextstep, srcobj->nextstep); dst += sizeof(struct heliobj); @@ -712,10 +711,10 @@ u32 convertProps(u8* dst, u8* src) struct safeitemobj* dstobj = (struct safeitemobj*)dst; convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); - PD_CONV_PTR(dstobj->item, srcobj->ptr_item); - PD_CONV_PTR(dstobj->safe, srcobj->ptr_safe); - PD_CONV_PTR(dstobj->door, srcobj->ptr_door); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->item, srcobj->ptr_item, struct defaultobj*); + PD_CONV_PTR(dstobj->safe, srcobj->ptr_safe, struct safeobj*); + PD_CONV_PTR(dstobj->door, srcobj->ptr_door, struct doorobj*); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct safeitemobj*); dst += sizeof(struct safeitemobj); break; @@ -766,7 +765,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_ARRAY(dstobj->pads, srcobj->pads); for (int k = 0; k < 4; k++) - PD_CONV_PTR(dstobj->doors[k], srcobj->ptr_doors[k]); + PD_CONV_PTR(dstobj->doors[k], srcobj->ptr_doors[k], struct doorobj*); PD_CONV_VAL(dstobj->dist, srcobj->dist); PD_CONV_VAL(dstobj->speed, srcobj->speed); PD_CONV_VAL(dstobj->accel, srcobj->accel); @@ -785,10 +784,10 @@ u32 convertProps(u8* dst, u8* src) struct linksceneryobj* dstobj = (struct linksceneryobj*)dst; convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); - PD_CONV_PTR(dstobj->trigger, srcobj->ptr_trigger); - PD_CONV_PTR(dstobj->unexp, srcobj->ptr_unexp); - PD_CONV_PTR(dstobj->exp, srcobj->ptr_exp); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->trigger, srcobj->ptr_trigger, struct defaultobj*); + PD_CONV_PTR(dstobj->unexp, srcobj->ptr_unexp, struct defaultobj*); + PD_CONV_PTR(dstobj->exp, srcobj->ptr_exp, struct defaultobj*); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct linksceneryobj*); dst += sizeof(struct linksceneryobj); break; @@ -799,10 +798,10 @@ u32 convertProps(u8* dst, u8* src) struct blockedpathobj* dstobj = (struct blockedpathobj*)dst; convertDefaultObjHdr((struct defaultobj*)dstobj, cmd); - PD_CONV_PTR(dstobj->blocker, srcobj->ptr_blocker); + PD_CONV_PTR(dstobj->blocker, srcobj->ptr_blocker, struct defaultobj*); PD_CONV_VAL(dstobj->waypoint1, srcobj->waypoint1); PD_CONV_VAL(dstobj->waypoint2, srcobj->waypoint2); - PD_CONV_PTR(dstobj->next, srcobj->ptr_next); + PD_CONV_PTR(dstobj->next, srcobj->ptr_next, struct blockedpathobj*); dst += sizeof(struct blockedpathobj); break; @@ -898,7 +897,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObj(&dstobj->base, cmd); - PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist); + PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist, u8*); PD_CONV_VAL(dstobj->aioffset, srcobj->aioffset); PD_CONV_VAL(dstobj->aireturnlist, srcobj->aireturnlist); PD_CONV_VAL(dstobj->speed, srcobj->speed); @@ -910,7 +909,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->roty, srcobj->roty); PD_CONV_VAL(dstobj->rotx, srcobj->rotx); PD_CONV_VAL(dstobj->rotz, srcobj->rotz); - PD_CONV_PTR(dstobj->path, srcobj->ptr_path); + PD_CONV_PTR(dstobj->path, srcobj->ptr_path, struct path*); PD_CONV_VAL(dstobj->nextstep, srcobj->nextstep); PD_CONV_VAL(dstobj->status, srcobj->status); PD_CONV_VAL(dstobj->dead, srcobj->dead); @@ -939,7 +938,7 @@ u32 convertProps(u8* dst, u8* src) convertDefaultObj(&dstobj->base, cmd); - PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist); + PD_CONV_PTR(dstobj->ailist, srcobj->ptr_ailist, u8*); PD_CONV_VAL(dstobj->aioffset, srcobj->aioffset); PD_CONV_VAL(dstobj->aireturnlist, srcobj->aireturnlist); PD_CONV_VAL(dstobj->speed, srcobj->speed); @@ -951,7 +950,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->roty, srcobj->roty); PD_CONV_VAL(dstobj->rotx, srcobj->rotx); PD_CONV_VAL(dstobj->rotz, srcobj->rotz); - PD_CONV_PTR(dstobj->path, srcobj->ptr_path); + PD_CONV_PTR(dstobj->path, srcobj->ptr_path, struct path*); PD_CONV_VAL(dstobj->nextstep, srcobj->nextstep); PD_CONV_VAL(dstobj->weaponsarmed, srcobj->weaponsarmed); PD_CONV_VAL(dstobj->ontarget, srcobj->ontarget); @@ -976,7 +975,7 @@ u32 convertProps(u8* dst, u8* src) PD_CONV_VAL(dstobj->gunrotx, srcobj->gunrotx); PD_CONV_VAL(dstobj->barrelrotspeed, srcobj->barrelrotspeed); PD_CONV_VAL(dstobj->barrelrot, srcobj->barrelrot); - PD_CONV_PTR(dstobj->fireslotthing, srcobj->ptr_fireslotthing); + PD_CONV_PTR(dstobj->fireslotthing, srcobj->ptr_fireslotthing, struct fireslotthing*); PD_CONV_VAL(dstobj->dead, srcobj->dead); dst += sizeof(struct chopperobj); @@ -1050,7 +1049,7 @@ static u32 convertPaths(u8 *dst, u8 *src) struct path* dstpath = (struct path*)dst; while (true) { - PD_CONV_PTR(dstpath->pads, srcpath->ptr_pads); + PD_CONV_PTR(dstpath->pads, srcpath->ptr_pads, s32*); PD_CONV_VAL(dstpath->id, srcpath->id); PD_CONV_VAL(dstpath->flags, srcpath->flags); PD_CONV_VAL(dstpath->len, srcpath->len); @@ -1093,7 +1092,7 @@ static u32 convertAiLists(u8* dst, u8* src) while (true) { // at this point these fields are already converted, so we just assign - dstailist->list = srcailist->ptr_list; + dstailist->list = (u8*)srcailist->ptr_list; dstailist->id = srcailist->id; @@ -1123,7 +1122,7 @@ static u32 convertLists(u8 *dst, u8 *src, u32 dstpos, u32 src_ofs) for (struct n64_ailist *ailist = src_ailists; ailist->ptr_list; ailist++) { // update the src list pointers here uintptr_t src_ptr_list = (uintptr_t) ailist->ptr_list; - ailist->ptr_list = (u8*)dstpos; + ailist->ptr_list = dstpos; // multiple ailists can point to the same list, so we need to check if it was already copied struct ptrmarker *marker = findPtrMarker(src_ptr_list); diff --git a/port/src/preprocess/util_gbi.c b/port/src/preprocess/util_gbi.c index 75b4a621a..680d22e75 100644 --- a/port/src/preprocess/util_gbi.c +++ b/port/src/preprocess/util_gbi.c @@ -151,7 +151,7 @@ void gbiGdlRewriteAddrs(u8 *dst, u32 offset) do { cmd = *cmds; - Gfx* gfxcmd = cmds; + Gfx* gfxcmd = (Gfx *)cmds; int idx = 0; u8 opcode = (cmd >> 24) & 0xff; diff --git a/src/game/file.c b/src/game/file.c index 6c188338c..825ebf7c1 100644 --- a/src/game/file.c +++ b/src/game/file.c @@ -4259,7 +4259,7 @@ u32 fileGetInflatedSize(s32 filenum, FileType filetype) { u8 *ptr; u8 buffer[0x50]; - u32 *romaddrptr; + uintptr_t *romaddrptr; #if VERSION < VERSION_NTSC_1_0 char message[128]; #endif diff --git a/src/game/menuitem.c b/src/game/menuitem.c index f456bfe27..c95acb89e 100644 --- a/src/game/menuitem.c +++ b/src/game/menuitem.c @@ -799,7 +799,7 @@ bool menuitemListTick(struct menuitem *item, struct menuinputs *inputs, u32 tick void menuitemDropdownInit(struct menuitem *item, union menuitemdata *data) { - s32 (*handler)(s32 operation, struct menuitem *item, union handlerdata *data); + uintptr_t (*handler)(s32 operation, struct menuitem *item, union handlerdata *data); union handlerdata handlerdata; union handlerdata handlerdata2; From a5d9f021843fcd77e7527f92f6947627263a75eb Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 04:22:57 +0800 Subject: [PATCH 2/7] portx64: fixed pal --- port/src/preprocess/segfonts.c | 2 +- src/game/lang.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/port/src/preprocess/segfonts.c b/port/src/preprocess/segfonts.c index b2f9ab1b8..e201d21ee 100644 --- a/port/src/preprocess/segfonts.c +++ b/port/src/preprocess/segfonts.c @@ -59,7 +59,7 @@ u8 *preprocessFont(u8 *src, u32 srclen, u32 *outSize) if (src == _fonthandelgothicsmSegmentRomStart || src == _fonthandelgothicxsSegmentRomStart || src == _fonthandelgothicmdSegmentRomStart) { - numchars = 135; + num_chars = 135; } #endif diff --git a/src/game/lang.c b/src/game/lang.c index bd97e6c1f..65565b496 100644 --- a/src/game/lang.c +++ b/src/game/lang.c @@ -377,7 +377,7 @@ s32 langGetFileId(s32 bank) void langLoad(s32 bank) { #if VERSION >= VERSION_PAL_BETA - s32 len = fileGetInflatedSize(langGetFileId(bank)); + s32 len = fileGetInflatedSize(langGetFileId(bank), LOADTYPE_LANG); if ((uintptr_t)g_LangBuffer + len + g_LangBufferSize - (uintptr_t)g_LangBufferPos >= 0) { s32 len2 = (uintptr_t)g_LangBuffer + g_LangBufferSize - (uintptr_t)g_LangBufferPos; From e09aebebe7a10ae95c19592098f63dfb2f8f3b48 Mon Sep 17 00:00:00 2001 From: Raf Date: Fri, 9 Aug 2024 04:45:12 +0800 Subject: [PATCH 3/7] Update c-cpp.yml --- .github/workflows/c-cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 6b2b689b8..8c5d673f5 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -40,7 +40,7 @@ jobs: cp build/ntsc-final-port/pd.exe bin/ cp build/pal-final-port/pd.pal.exe bin/ cp build/jpn-final-port/pd.jpn.exe bin/ - cp /mingw64/bin/{SDL2.dll,zlib1.dll,libgcc_s_dw2-1.dll,libwinpthread-1.dll} bin/ + cp /mingw64/bin/{SDL2.dll,zlib1.dll,libwinpthread-1.dll} bin/ touch bin/data/put_your_rom_here.txt - name: Upload artifact uses: actions/upload-artifact@v4 From 2c4d3e7768210d653309db08bca6884df3b744ae Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 05:02:27 +0800 Subject: [PATCH 4/7] portx64: fixed linux build --- port/src/preprocess/common.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/port/src/preprocess/common.h b/port/src/preprocess/common.h index b75c6517f..4d2e6715d 100644 --- a/port/src/preprocess/common.h +++ b/port/src/preprocess/common.h @@ -6,11 +6,19 @@ #include #include +#ifdef PLATFORM_WIN32 + #include // this BS comes from windows.h #undef near #undef far +#else + +#include + +#endif + #include #include From cec92dbcb66e451157618a64a85082e24023219a Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 05:07:09 +0800 Subject: [PATCH 5/7] portx64: fixed linux build ops --- port/src/preprocess/common.h | 1 + 1 file changed, 1 insertion(+) diff --git a/port/src/preprocess/common.h b/port/src/preprocess/common.h index 4d2e6715d..3d6aa1671 100644 --- a/port/src/preprocess/common.h +++ b/port/src/preprocess/common.h @@ -5,6 +5,7 @@ #include #include #include +#include "platform.h" #ifdef PLATFORM_WIN32 From 40cc42a9410922a2e480454db0b98bce4261753f Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 21:49:10 +0800 Subject: [PATCH 6/7] portx64: fixed linux build, one more time --- include/PR/gbi.h | 1 + port/src/preprocess/filesetup.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/PR/gbi.h b/include/PR/gbi.h index c970c3997..84bbad552 100644 --- a/include/PR/gbi.h +++ b/include/PR/gbi.h @@ -22,6 +22,7 @@ #include #include "gbiex.h" +#include #ifndef PLATFORM_N64 #include "platform.h" diff --git a/port/src/preprocess/filesetup.c b/port/src/preprocess/filesetup.c index 3e22a71d0..b629e511b 100644 --- a/port/src/preprocess/filesetup.c +++ b/port/src/preprocess/filesetup.c @@ -20,7 +20,7 @@ static inline void convU16(u16 *dst, u32 src) { *dst = srctoh16(src); } static inline void convS16(s16 *dst, s32 src) { *dst = srctoh16(src); } static inline void cpyByte(u8 *dst, u8 src) { *dst = src; } static inline void convCoord(struct coord* dst, struct n64_coord src) { convF32(&dst->x, src.x); convF32(&dst->y, src.y); convF32(&dst->z, src.z); } -static u32 convUnk(void* x, u32 y) { __debugbreak(); } +static inline u32 swapUnk(u32 x) { assert(0 && "unknown type"); return x; } #define PD_CONV_VAL(dst, src) _Generic((dst), \ f32: convF32, \ From a721349cff3b97855fc0981be1b4305061176638 Mon Sep 17 00:00:00 2001 From: Raf <> Date: Fri, 9 Aug 2024 21:55:39 +0800 Subject: [PATCH 7/7] portx64: fixed linux build, one more time --- port/src/preprocess/filesetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/port/src/preprocess/filesetup.c b/port/src/preprocess/filesetup.c index b629e511b..10ec0bfcf 100644 --- a/port/src/preprocess/filesetup.c +++ b/port/src/preprocess/filesetup.c @@ -20,7 +20,7 @@ static inline void convU16(u16 *dst, u32 src) { *dst = srctoh16(src); } static inline void convS16(s16 *dst, s32 src) { *dst = srctoh16(src); } static inline void cpyByte(u8 *dst, u8 src) { *dst = src; } static inline void convCoord(struct coord* dst, struct n64_coord src) { convF32(&dst->x, src.x); convF32(&dst->y, src.y); convF32(&dst->z, src.z); } -static inline u32 swapUnk(u32 x) { assert(0 && "unknown type"); return x; } +static inline void convUnk(u32 x) { assert(0 && "unknown type"); } #define PD_CONV_VAL(dst, src) _Generic((dst), \ f32: convF32, \