fix some array definitions, fix invalid GX command, add AVOID_UB define and fix one UB instance

This commit is contained in:
Rainchus 2025-04-16 01:46:00 -05:00
parent af7c7a0064
commit 4c4f6377f6
10 changed files with 26 additions and 18 deletions

View file

@ -28,7 +28,7 @@ elseif (MSVC)
add_compile_options(/bigobj)
endif ()
add_compile_options(-fsanitize=address)
#add_compile_options(-fsanitize=address)
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
add_subdirectory(extern/musyx EXCLUDE_FROM_ALL)
@ -148,7 +148,7 @@ endif ()
add_library(dol SHARED ${DOLPHIN_FILES} ${GAME_FILES} ${PORT_FILES})
target_compile_definitions(dol PRIVATE TARGET_PC NON_MATCHING TARGET_DOL VERSION=${VERSION} MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4)
target_compile_definitions(dol PRIVATE TARGET_PC AVOID_UB NON_MATCHING TARGET_DOL VERSION=${VERSION} MUSY_VERSION_MAJOR=1 MUSY_VERSION_MINOR=5 MUSY_VERSION_PATCH=4)
target_include_directories(dol PRIVATE include build/GMPE01_00/include)
target_link_libraries(dol PRIVATE aurora::core aurora::gx aurora::si aurora::vi aurora::pad musyx)
if (MSVC)
@ -164,7 +164,7 @@ else ()
endif ()
add_executable(marioparty4 src/port/portmain.c)
target_compile_definitions(marioparty4 PRIVATE TARGET_PC NON_MATCHING VERSION=${VERSION})
target_compile_definitions(marioparty4 PRIVATE TARGET_PC AVOID_UB NON_MATCHING VERSION=${VERSION})
target_include_directories(marioparty4 PRIVATE include)
target_link_libraries(marioparty4 PRIVATE dol aurora::main)
@ -183,7 +183,7 @@ foreach (dir ${REL_DIRS})
if (dir MATCHES "^w..Dll")
target_sources(${dir} PRIVATE src/REL/board_executor.c)
endif()
target_compile_definitions(${dir} PRIVATE TARGET_PC NON_MATCHING VERSION=${VERSION})
target_compile_definitions(${dir} PRIVATE TARGET_PC AVOID_UB NON_MATCHING VERSION=${VERSION})
target_include_directories(${dir} PRIVATE include build/GMPE01_00/include)
if (MSVC)
set_target_properties(${dir} PROPERTIES LINK_FLAGS "/EXPORT:ObjectSetup")

View file

@ -468,12 +468,12 @@ void fn_1_10B8(Work19C8 *arg0)
{
s32 temp_r31;
s32 temp_r30;
u8 sp16C[12][17] = {};
u8 sp6C[12] = {};
u8 sp16C[12][17] = {0};
u8 sp6C[12] = {0};
s32 temp_r22 = (arg0->unk48[0]->unk18 - 4 < 0) ? 0 : (arg0->unk48[0]->unk18 - 4);
s32 temp_r21 = (arg0->unk48[0]->unk18 + 4 > 11) ? 11 : (arg0->unk48[0]->unk18 + 4);
s32 sp44[2] = {};
s32 sp3C[2] = {};
s32 sp44[2] = {0};
s32 sp3C[2] = {0};
s32 sp34[2] = { 9, 9 };
s32 temp_r20 = 0;
s32 temp_r19 = 0;
@ -722,12 +722,11 @@ void fn_1_19C8(omObjData *object)
HuSprAttrReset(temp_r31->unkA4, 0, HUSPR_ATTR_DISPOFF);
HuSprAttrReset(temp_r31->unkA4, 0, HUSPR_ATTR_REVERSE);
{
s32 sp258[12] = {};
s32 sp258[12] = {0};
s32 sp194;
for (sp194 = 0; sp194 < 3; sp194++) {
StructBss2A6C *sp190;
for (sp190 = lbl_1_bss_7884[sp194 + (temp_r31->unk10 * 3)]; sp190; sp190 = sp190->unk48) {
sp258[sp194] += (sp190 && sp190->unk0 && (sp190->unk1 & 0x2) == 0 && sp258[sp194] < 9);
}
}
@ -942,7 +941,7 @@ void fn_1_8AC8(StructBss2A6C *arg0, StructSp14C8 *arg1);
void fn_1_52A4(s32 arg0)
{
omObjData *sp1EC = lbl_1_bss_30;
StructBss2A6C *sp2E48[14][19] = {};
StructBss2A6C *sp2E48[14][19] = {NULL};
StructBss2A6C *sp1E8 = NULL;
StructBss2A6C *temp_r31;
StructBss2A6C *temp_r30;

View file

@ -744,7 +744,7 @@ void fn_1_27A0(Vec *arg0, Vec *arg1, float arg2)
arg1->z = fn_1_26F8(arg2, arg0[0].z, arg0[1].z, arg0[2].z, arg0[3].z);
}
float lbl_1_data_184[2] = {};
float lbl_1_data_184[2] = {0.0f, 0.0f};
void fn_1_2AF4(s32 arg0, s32 arg1, float arg2);

View file

@ -133,7 +133,7 @@ static u16 keyDStkDown;
static u16 btnDownAll[4];
static u16 keyDStkAll[4];
static u16 keyDStkAllDown[4];
static u16 keyDStkAllPrev[4] = {};
static u16 keyDStkAllPrev[4] = {0, 0, 0, 0};
static void SMInit(omObjData *object);
static void SMRand8Tick(omObjData *object);

View file

@ -154,7 +154,11 @@ void ClusterMotionExec(ModelData *arg0)
HsfTrack *var_r30;
MotionData *var_r23;
#ifdef AVOID_UB
//var_r31 = temp_r27->track;
#else
var_r31 = temp_r27->track;
#endif
for (i = 0; i < 4; i++) {
if (arg0->unk_10[i] != -1) {
var_r20 = arg0->unk_10[i];

View file

@ -27,7 +27,7 @@ static void MarkKillBox(void);
static void InitBox(s32 arg0);
static const float boxOfs[2] = {-150.0f, 150.0f};
static omObjData *boxObj[2] = {};
static omObjData *boxObj[2] = {NULL, NULL};
static s16 itemMdl = -1;
static s8 itemResult;
static u8 pickerChoice;

View file

@ -185,7 +185,7 @@ static s32 boardSparkSfxTblAlt[] = {
0x2E3,
};
static omObjData *megaSquishObj[4] = {};
static omObjData *megaSquishObj[4] = {NULL, NULL, NULL, NULL};
static s32 megaSquishSfxTbl[] = {
0x128,

View file

@ -752,7 +752,7 @@ static char seqFontKanaTbl[] = { "アイウエオカキク"
static char seqFontNumTbl[] = "0123456789";
static s32 *letterBufTbl[5] = {};
static s32 *letterBufTbl[5] = {NULL, NULL, NULL, NULL, NULL};
static char wordStartE[] = "START!";

View file

@ -20,10 +20,10 @@
extern s32 HuDvdErrWait;
static s32 SR_PreRstChk[4] = {};
static s32 SR_PreRstChk[4] = {0, 0, 0, 0};
#if VERSION_JP
static s32 padding[4] = {};
static s32 padding[4] = {0, 0, 0, 0};
#endif
#if VERSION_ENG

View file

@ -404,7 +404,12 @@ static void MesDispFunc(HuSprite *sprite)
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
#ifdef TARGET_PC
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
#else
//@bug: this passes GX_CLR_RGB but then uses GX_RGBA8 (should use either alpha variants of both or neither)
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGB, GX_RGBA8, 0);
#endif
GXSetCullMode(GX_CULL_NONE);
GXSetNumTexGens(1);
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);