Clean up AVOID_UB ifdefs
This commit is contained in:
1 parent
f40a1978d9
commit
5afa901fcf
35 files changed
+26
-275
No files matched your search
@@ -132,7 +132,7 @@ index 25b27983..2ff11930 100644
|
||||
+ // Get the camera speed based on the user's setting
|
||||
+ f32 cameraSpeed = set_camera_speed();
|
||||
|
||||
radial_camera_input(c, 0.f);
|
||||
radial_camera_input(c);
|
||||
|
||||
- if (gPlayer1Controller->buttonPressed & R_CBUTTONS) {
|
||||
- s8DirModeYawOffset += DEGREES(45);
|
||||
@@ -270,7 +270,7 @@ index 25b27983..2ff11930 100644
|
||||
}
|
||||
|
||||
void play_sound_button_change_blocked(void) {
|
||||
@@ -5013,7 +5074,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
|
||||
@@ -5013,7 +5074,7 @@ void radial_camera_input(struct Camera *c) {
|
||||
}
|
||||
|
||||
// Zoom in / enter C-Up
|
||||
@@ -279,7 +279,7 @@ index 25b27983..2ff11930 100644
|
||||
if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) {
|
||||
gCameraMovementFlags &= ~CAM_MOVE_ZOOMED_OUT;
|
||||
play_sound_cbutton_up();
|
||||
@@ -5023,7 +5084,7 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
|
||||
@@ -5023,7 +5084,7 @@ void radial_camera_input(struct Camera *c) {
|
||||
}
|
||||
|
||||
// Zoom out
|
||||
@@ -288,7 +288,7 @@ index 25b27983..2ff11930 100644
|
||||
if (gCameraMovementFlags & CAM_MOVE_ZOOMED_OUT) {
|
||||
gCameraMovementFlags |= CAM_MOVE_ALREADY_ZOOMED_OUT;
|
||||
#ifndef VERSION_JP
|
||||
@@ -5035,6 +5096,12 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
|
||||
@@ -5035,6 +5096,12 @@ void radial_camera_input(struct Camera *c) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-11
@@ -21,23 +21,13 @@
|
||||
#define DEBUG_ASSERT(exp)
|
||||
#endif
|
||||
|
||||
// Pointer casting is technically UB, and avoiding it gets rid of endian issues
|
||||
// as well as a nice side effect.
|
||||
#ifdef AVOID_UB
|
||||
// Pointer casting is technically UB, and avoiding it gets rid of endian issues as well as a nice side effect.
|
||||
#define GET_HIGH_U16_OF_32(var) ((u16)((var) >> 16))
|
||||
#define GET_HIGH_S16_OF_32(var) ((s16)((var) >> 16))
|
||||
#define GET_LOW_U16_OF_32(var) ((u16)((var) & 0xFFFF))
|
||||
#define GET_LOW_S16_OF_32(var) ((s16)((var) & 0xFFFF))
|
||||
#define SET_HIGH_U16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
|
||||
#define SET_HIGH_S16_OF_32(var, x) ((var) = ((var) & 0xFFFF) | ((x) << 16))
|
||||
#else
|
||||
#define GET_HIGH_U16_OF_32(var) (((u16 *)&(var))[0])
|
||||
#define GET_HIGH_S16_OF_32(var) (((s16 *)&(var))[0])
|
||||
#define GET_LOW_U16_OF_32(var) (((u16 *)&(var))[1])
|
||||
#define GET_LOW_S16_OF_32(var) (((s16 *)&(var))[1])
|
||||
#define SET_HIGH_U16_OF_32(var, x) ((((u16 *)&(var))[0]) = (x))
|
||||
#define SET_HIGH_S16_OF_32(var, x) ((((s16 *)&(var))[0]) = (x))
|
||||
#endif
|
||||
|
||||
// Layers
|
||||
#if SILHOUETTE
|
||||
|
||||
@@ -255,11 +255,7 @@ f32 gSineTable[] = {
|
||||
0.999830604f, 0.999857664f, 0.999882340f, 0.999904692f,
|
||||
0.999924719f, 0.999942362f, 0.999957621f, 0.999970615f,
|
||||
0.999981165f, 0.999989390f, 0.999995291f, 0.999998808f,
|
||||
#ifndef AVOID_UB
|
||||
};
|
||||
|
||||
f32 gCosineTable[0x1000] = {
|
||||
#endif
|
||||
// cosine
|
||||
1.000000000f, 0.999998808f, 0.999995291f, 0.999989390f,
|
||||
0.999981165f, 0.999970615f, 0.999957621f, 0.999942362f,
|
||||
|
||||
@@ -1539,11 +1539,7 @@ void *unk_pool1_alloc(s32 poolIndex, s32 arg1, u32 size) {
|
||||
gUnkPool1.entries[pos].id = arg1;
|
||||
gUnkPool1.entries[pos].size = size;
|
||||
|
||||
#ifdef AVOID_UB
|
||||
//! @bug UB: missing return. "ret" is in v0 at this point, but doing an
|
||||
// explicit return uses an additional register.
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
u8 *func_sh_802f1d40(u32 size, s32 bank, u8 *arg2, s8 medium) {
|
||||
|
||||
@@ -365,9 +365,7 @@ s32 func_sh_802f2f38(struct AudioBankSample *sample, s32 bankId) {
|
||||
sample->medium = 0;
|
||||
sample->sampleAddr = sp24;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2) {
|
||||
@@ -395,9 +393,7 @@ s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2) {
|
||||
func_sh_802f2f38(drum->sound.sample, bankId);
|
||||
return 0;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void func_sh_802f30f4(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue *arg3) {
|
||||
|
||||
+1
-17
@@ -2298,10 +2298,6 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
if (osRecvMesg(&seqPlayer->seqDmaMesgQueue, NULL, 0) == -1) {
|
||||
return;
|
||||
}
|
||||
#ifndef AVOID_UB
|
||||
if (temp) {
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if (seqPlayer->seqDmaMesg == NULL) {
|
||||
return;
|
||||
@@ -2351,10 +2347,6 @@ void sequence_player_process_sequence(struct SequencePlayer *seqPlayer) {
|
||||
|
||||
state = &seqPlayer->scriptState;
|
||||
if (seqPlayer->delay > 1) {
|
||||
#ifndef AVOID_UB
|
||||
if (temp) {
|
||||
}
|
||||
#endif
|
||||
seqPlayer->delay--;
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
@@ -2809,15 +2801,7 @@ void init_sequence_players(void) {
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(gSequenceChannels); i++) {
|
||||
#endif
|
||||
// @bug Size of wrong array. Zeroes out second half of gSequenceChannels[0],
|
||||
// all of gSequenceChannels[1..31], and part of gSequenceLayers[0].
|
||||
// However, this is only called at startup, so it's harmless.
|
||||
#ifdef AVOID_UB
|
||||
#define LAYERS_SIZE LAYERS_MAX
|
||||
#else
|
||||
#define LAYERS_SIZE ARRAY_COUNT(gSequenceLayers)
|
||||
#endif
|
||||
for (j = 0; j < LAYERS_SIZE; j++) {
|
||||
for (j = 0; j < LAYERS_MAX; j++) {
|
||||
gSequenceChannels[i].layers[j] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1652,10 +1652,6 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
|
||||
pitch = (bufLen << 0xf) / (bufLen + panShift - prevPanShift);
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) && !defined(AVOID_UB)
|
||||
if (unkDebug) { // UB
|
||||
}
|
||||
#endif
|
||||
aSetBuffer(cmd++, 0, DMEM_ADDR_NOTE_PAN_TEMP, DMEM_ADDR_TEMP, panShift + bufLen - prevPanShift);
|
||||
aResample(cmd++, 0, pitch, VIRTUAL_TO_PHYSICAL2(note->synthesisBuffers->panResampleState));
|
||||
}
|
||||
|
||||
@@ -22,11 +22,7 @@
|
||||
* Thus, for non-IDO compilers we use the standard-compliant version.
|
||||
*/
|
||||
extern f32 gSineTable[];
|
||||
#ifdef AVOID_UB
|
||||
#define gCosineTable (gSineTable + 0x400)
|
||||
#else
|
||||
extern f32 gCosineTable[];
|
||||
#endif
|
||||
|
||||
#define sins(x) gSineTable[(u16) (x) >> 4]
|
||||
#define coss(x) gCosineTable[(u16) (x) >> 4]
|
||||
|
||||
@@ -78,10 +78,7 @@ void bowling_ball_set_waypoints(void) {
|
||||
|
||||
void bhv_bowling_ball_roll_loop(void) {
|
||||
s16 collisionFlags;
|
||||
s32 pathResult;
|
||||
#ifdef AVOID_UB
|
||||
pathResult = 0;
|
||||
#endif
|
||||
s32 pathResult = 0;
|
||||
|
||||
bowling_ball_set_waypoints();
|
||||
collisionFlags = object_step();
|
||||
@@ -111,10 +108,7 @@ void bhv_bowling_ball_roll_loop(void) {
|
||||
}
|
||||
|
||||
void bhv_bowling_ball_initializeLoop(void) {
|
||||
s32 pathResult;
|
||||
#ifdef AVOID_UB
|
||||
pathResult = 0;
|
||||
#endif
|
||||
s32 pathResult = 0;
|
||||
|
||||
bowling_ball_set_waypoints();
|
||||
|
||||
|
||||
@@ -61,12 +61,8 @@ static void camera_lakitu_intro_act_spawn_cloud(void) {
|
||||
* Circle down to mario, show the dialog, then fly away.
|
||||
*/
|
||||
static void camera_lakitu_intro_act_show_dialog(void) {
|
||||
s16 targetMovePitch;
|
||||
s16 targetMoveYaw;
|
||||
#ifdef AVOID_UB
|
||||
targetMovePitch = 0;
|
||||
targetMoveYaw = 0;
|
||||
#endif
|
||||
s16 targetMovePitch = 0;
|
||||
s16 targetMoveYaw = 0;
|
||||
|
||||
cur_obj_play_sound_1(SOUND_AIR_LAKITU_FLY);
|
||||
|
||||
|
||||
@@ -42,10 +42,7 @@ void bhv_manta_ray_init(void) {
|
||||
|
||||
static void manta_ray_move(void) {
|
||||
s16 animFrame;
|
||||
s32 pathStatus;
|
||||
#ifdef AVOID_UB
|
||||
pathStatus = 0;
|
||||
#endif
|
||||
s32 pathStatus = 0;
|
||||
|
||||
animFrame = o->header.gfx.animInfo.animFrame;
|
||||
gCurrentObject->oPathedStartWaypoint = (struct Waypoint *) sMantaRayTraj;
|
||||
|
||||
@@ -110,12 +110,9 @@ void bhv_mips_act_wait_for_nearby_mario(void) {
|
||||
*/
|
||||
void bhv_mips_act_follow_path(void) {
|
||||
s16 collisionFlags = 0;
|
||||
s32 followStatus;
|
||||
s32 followStatus = 0;
|
||||
struct Waypoint **pathBase;
|
||||
struct Waypoint *waypoint;
|
||||
#ifdef AVOID_UB
|
||||
followStatus = 0;
|
||||
#endif
|
||||
|
||||
// Retrieve current waypoint.
|
||||
pathBase = segmented_to_virtual(&inside_castle_seg7_trajectory_mips);
|
||||
|
||||
@@ -129,28 +129,19 @@ struct Object *spawn_star(struct Object *starObj, f32 x, f32 y, f32 z) {
|
||||
}
|
||||
|
||||
void spawn_default_star(f32 x, f32 y, f32 z) {
|
||||
struct Object *starObj;
|
||||
#ifdef AVOID_UB
|
||||
starObj = 0;
|
||||
#endif
|
||||
struct Object *starObj = NULL;
|
||||
starObj = spawn_star(starObj, x, y, z);
|
||||
starObj->oBehParams2ndByte = 0;
|
||||
}
|
||||
|
||||
void spawn_red_coin_cutscene_star(f32 x, f32 y, f32 z) {
|
||||
struct Object *starObj;
|
||||
#ifdef AVOID_UB
|
||||
starObj = 0;
|
||||
#endif
|
||||
struct Object *starObj = NULL;
|
||||
starObj = spawn_star(starObj, x, y, z);
|
||||
starObj->oBehParams2ndByte = 1;
|
||||
}
|
||||
|
||||
void spawn_no_exit_star(f32 x, f32 y, f32 z) {
|
||||
struct Object *starObj;
|
||||
#ifdef AVOID_UB
|
||||
starObj = 0;
|
||||
#endif
|
||||
struct Object *starObj = NULL;
|
||||
starObj = spawn_star(starObj, x, y, z);
|
||||
starObj->oBehParams2ndByte = 1;
|
||||
starObj->oInteractionSubtype |= INT_SUBTYPE_NO_EXIT;
|
||||
@@ -158,11 +149,11 @@ void spawn_no_exit_star(f32 x, f32 y, f32 z) {
|
||||
|
||||
void bhv_hidden_red_coin_star_init(void) {
|
||||
s16 numRedCoinsRemaining;
|
||||
struct Object *starObj;
|
||||
struct Object *starObj = NULL;
|
||||
|
||||
if (gCurrCourseNum != COURSE_JRB)
|
||||
if (gCurrCourseNum != COURSE_JRB) {
|
||||
spawn_object(o, MODEL_TRANSPARENT_STAR, bhvRedCoinStarMarker);
|
||||
|
||||
}
|
||||
numRedCoinsRemaining = count_objects_with_behavior(bhvRedCoin);
|
||||
if (numRedCoinsRemaining == 0) {
|
||||
starObj = spawn_object_abs_with_rot(o, 0, MODEL_STAR, bhvStar, o->oPosX, o->oPosY, o->oPosZ, 0, 0, 0);
|
||||
|
||||
@@ -153,9 +153,7 @@ void wiggler_init_segments(void) {
|
||||
cur_obj_unhide();
|
||||
}
|
||||
|
||||
#if defined(VERSION_EU) || defined(AVOID_UB)
|
||||
o->oHealth = 4; // This fixes Wiggler reading UB on his first frame of his acceleration, as his health is not set.
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -233,10 +231,6 @@ static void wiggler_act_walk(void) {
|
||||
o->oWigglerTextStatus = WIGGLER_TEXT_STATUS_COMPLETED_DIALOG;
|
||||
}
|
||||
} else {
|
||||
//! Every object's health is initially 2048, and wiggler's doesn't change
|
||||
// to 4 until after this runs the first time. It indexes out of bounds
|
||||
// and uses the value 113762.3 for one frame on US. This is fixed up
|
||||
// in wiggler_init_segments if AVOID_UB is defined.
|
||||
obj_forward_vel_approach(sWigglerSpeeds[o->oHealth - 1], 1.0f);
|
||||
|
||||
if (o->oWigglerWalkAwayFromWallTimer != 0) {
|
||||
|
||||
+4
-17
@@ -1124,7 +1124,7 @@ void lakitu_zoom(f32 rangeDist, s16 rangePitch) {
|
||||
}
|
||||
|
||||
void radial_camera_input_default(struct Camera *c) {
|
||||
radial_camera_input(c, 0.f);
|
||||
radial_camera_input(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1175,10 +1175,9 @@ void mode_radial_camera(struct Camera *c) {
|
||||
*/
|
||||
void mode_8_directions_camera(struct Camera *c) {
|
||||
Vec3f pos;
|
||||
UNUSED u8 unused[8];
|
||||
s16 oldAreaYaw = sAreaYaw;
|
||||
|
||||
radial_camera_input(c, 0.f);
|
||||
radial_camera_input(c);
|
||||
|
||||
if (gPlayer1Controller->buttonPressed & R_CBUTTONS) {
|
||||
s8DirModeYawOffset += DEGREES(45);
|
||||
@@ -1725,9 +1724,7 @@ struct ParallelTrackingPoint sBBHLibraryParTrackPath[] = {
|
||||
};
|
||||
|
||||
s32 unused_update_mode_5_camera(UNUSED struct Camera *c, UNUSED Vec3f focus, UNUSED Vec3f pos) {
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
UNUSED static void stub_camera_1(UNUSED s32 unused) {
|
||||
@@ -1745,7 +1742,7 @@ void mode_boss_fight_camera(struct Camera *c) {
|
||||
void mode_parallel_tracking_camera(struct Camera *c) {
|
||||
s16 dummy;
|
||||
|
||||
radial_camera_input(c, 0.f);
|
||||
radial_camera_input(c);
|
||||
set_fov_function(CAM_FOV_DEFAULT);
|
||||
c->nextYaw = update_parallel_tracking_camera(c, c->focus, c->pos);
|
||||
camera_approach_s16_symmetric_bool(&dummy, 0, 0x0400);
|
||||
@@ -2053,9 +2050,7 @@ void mode_behind_mario_camera(struct Camera *c) {
|
||||
}
|
||||
|
||||
s32 nop_update_water_camera(UNUSED struct Camera *c, UNUSED Vec3f focus, UNUSED Vec3f pos) {
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4907,12 +4902,7 @@ void play_sound_if_cam_switched_to_lakitu_or_mario(void) {
|
||||
/**
|
||||
* Handles input for radial, outwards radial, parallel tracking, and 8 direction mode.
|
||||
*/
|
||||
s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
|
||||
s16 dummy;
|
||||
#ifdef AVOID_UB
|
||||
dummy = 0;
|
||||
#endif
|
||||
|
||||
void radial_camera_input(struct Camera *c) {
|
||||
if ((gCameraMovementFlags & CAM_MOVE_ENTERED_ROTATE_SURFACE) || !(gCameraMovementFlags & CAM_MOVE_ROTATE)) {
|
||||
|
||||
// If C-L or C-R are pressed, the camera is rotating
|
||||
@@ -5008,9 +4998,6 @@ s32 radial_camera_input(struct Camera *c, UNUSED f32 unused) {
|
||||
play_sound_cbutton_down();
|
||||
}
|
||||
}
|
||||
|
||||
//! returning uninitialized variable
|
||||
return dummy;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -740,7 +740,7 @@ void play_sound_cbutton_side(void);
|
||||
void play_sound_button_change_blocked(void);
|
||||
void play_sound_rbutton_changed(void);
|
||||
void play_sound_if_cam_switched_to_lakitu_or_mario(void);
|
||||
s32 radial_camera_input(struct Camera *c, UNUSED f32 unused);
|
||||
void radial_camera_input(struct Camera *c);
|
||||
s32 trigger_cutscene_dialog(s32 trigger);
|
||||
void handle_c_button_movement(struct Camera *c);
|
||||
void start_cutscene(struct Camera *c, u8 cutscene);
|
||||
|
||||
@@ -1346,22 +1346,12 @@ s32 act_air_hit_wall(struct MarioState *m) {
|
||||
return set_mario_action(m, ACT_SOFT_BONK, 0);
|
||||
}
|
||||
|
||||
/*#ifdef AVOID_UB
|
||||
return
|
||||
#endif*/
|
||||
#if FIRSTY_LAST_FRAME > 1
|
||||
set_mario_animation(m, MARIO_ANIM_START_WALLKICK);
|
||||
m->marioObj->header.gfx.angle[1] = atan2s(m->wall->normal.z, m->wall->normal.x);
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
|
||||
//! Missing return statement. The returned value is the result of the call
|
||||
// to set_mario_animation. In practice, this value is nonzero.
|
||||
// This results in this action "cancelling" into itself. It is supposed to
|
||||
// execute on two frames, but instead it executes twice on the same frame.
|
||||
// This results in firsties only being possible for a single frame, instead
|
||||
// of two.
|
||||
}
|
||||
|
||||
s32 act_forward_rollout(struct MarioState *m) {
|
||||
|
||||
@@ -54,10 +54,7 @@ s32 detect_object_hitbox_overlap(struct Object *a, struct Object *b) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//! no return value
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
s32 detect_object_hurtbox_overlap(struct Object *a, struct Object *b) {
|
||||
@@ -88,10 +85,7 @@ s32 detect_object_hurtbox_overlap(struct Object *a, struct Object *b) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
//! no return value
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void clear_object_collision(struct Object *a) {
|
||||
|
||||
@@ -124,18 +124,7 @@ Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUS
|
||||
return dlStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @bug Every geo function declares the 3 parameters of callContext, node, and
|
||||
* the matrix array. This one (see also geo_switch_area) doesn't. When executed,
|
||||
* the node function executor passes the 3rd argument to a function that doesn't
|
||||
* declare it. This is undefined behavior, but harmless in practice due to the
|
||||
* o32 calling convention.
|
||||
*/
|
||||
#ifdef AVOID_UB
|
||||
Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node, UNUSED void *context) {
|
||||
#else
|
||||
Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node) {
|
||||
#endif
|
||||
struct Object *obj;
|
||||
struct GraphNodeSwitchCase *switchCase;
|
||||
|
||||
@@ -163,12 +152,7 @@ Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//! @bug Same issue as geo_switch_anim_state.
|
||||
#ifdef AVOID_UB
|
||||
Gfx *geo_switch_area(s32 callContext, struct GraphNode *node, UNUSED void *context) {
|
||||
#else
|
||||
Gfx *geo_switch_area(s32 callContext, struct GraphNode *node) {
|
||||
#endif
|
||||
s16 roomCase;
|
||||
struct Surface *floor;
|
||||
UNUSED struct Object *obj = (struct Object *) gCurGraphNodeObject; // TODO: change global type to Object pointer
|
||||
|
||||
@@ -60,13 +60,8 @@ struct SpawnParticlesInfo
|
||||
|
||||
Gfx *geo_update_projectile_pos_from_parent(s32 callContext, UNUSED struct GraphNode *node, Mat4 mtx);
|
||||
Gfx *geo_update_layer_transparency(s32 callContext, struct GraphNode *node, UNUSED void *context);
|
||||
#ifdef AVOID_UB
|
||||
Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node, UNUSED void *context);
|
||||
Gfx *geo_switch_area(s32 callContext, struct GraphNode *node, UNUSED void *context);
|
||||
#else
|
||||
Gfx *geo_switch_anim_state(s32 callContext, struct GraphNode *node);
|
||||
Gfx *geo_switch_area(s32 callContext, struct GraphNode *node);
|
||||
#endif
|
||||
void obj_update_pos_from_parent_transformation(Mat4 mtx, struct Object *obj);
|
||||
void obj_apply_scale_to_matrix(struct Object *obj, Mat4 dst, Mat4 src);
|
||||
void create_transformation_from_matrices(Mat4 dst, Mat4 a1, Mat4 a2);
|
||||
|
||||
@@ -254,9 +254,7 @@ f32 painting_ripple_y(struct Painting *painting, s8 ySource) {
|
||||
return painting->size / 2.0; // some concentric ripples don't care about Mario
|
||||
break;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,9 +280,7 @@ f32 painting_nearest_4th(struct Painting *painting) {
|
||||
} else if (painting->floorEntered & ENTER_RIGHT) {
|
||||
return thirdQuarter;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -316,9 +312,7 @@ f32 painting_ripple_x(struct Painting *painting, s8 xSource) {
|
||||
return painting->size / 2.0;
|
||||
break;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0.0f;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -239,9 +239,7 @@ s32 render_screen_transition(s8 fadeTimer, s8 transType, u8 transTime, struct Wa
|
||||
return render_textured_transition(fadeTimer, transTime, transData, TEX_TRANS_BOWSER, TRANS_TYPE_MIRROR);
|
||||
break;
|
||||
}
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
Gfx *render_cannon_circle_base(void) {
|
||||
|
||||
@@ -187,11 +187,6 @@ f32 get_water_level_below_shadow(struct Shadow *s, struct Surface **waterFloor)
|
||||
return waterLevel;
|
||||
}
|
||||
return waterLevel;
|
||||
//! @bug Missing return statement. This compiles to return `waterLevel`
|
||||
//! incidentally.
|
||||
#ifdef AVOID_UB
|
||||
return waterLevel;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef GD_BAD_DECLARATIONS_H
|
||||
#define GD_BAD_DECLARATIONS_H
|
||||
|
||||
#include "gd_types.h"
|
||||
|
||||
/**
|
||||
* @file bad_declarations.h
|
||||
*
|
||||
* Match incorrect type promotion for two declared functions.
|
||||
*
|
||||
* There is an issue with the compiled code for these function calls in files
|
||||
* outside of the files in which they were defined: instead of passing f32's,
|
||||
* the caller passes f64's.
|
||||
*
|
||||
* The only possible reason I can come up with for this behavior is that
|
||||
* goddard only declared (not prototyped) his functions in the headers,
|
||||
* and didn't include the header in the function's defining .c file.
|
||||
* (Even IDO 5.3 cares about illegal promotion of types!) This results in
|
||||
* default argument promotion, which is incorrect in this case.
|
||||
*
|
||||
* Since that's an awful practice to emulate, include this file (first!) to prevent
|
||||
* the proper prototypes of these functions from being seen by files with the
|
||||
* the incorrectly compiled calls.
|
||||
*/
|
||||
|
||||
#ifndef AVOID_UB
|
||||
|
||||
#define GD_USE_BAD_DECLARATIONS
|
||||
|
||||
/* shape_helper.h */
|
||||
extern struct ObjFace *make_face_with_colour();
|
||||
/* should be: make_face_with_colour(f32, f32, f32) */
|
||||
|
||||
/* old_menu.h */
|
||||
extern struct ObjLabel *make_label();
|
||||
/* should be: make_label(struct ObjValPtr *, char *, s32, f32, f32, f32) */
|
||||
|
||||
#endif /* !AVOID_UB */
|
||||
|
||||
#endif // GD_BAD_DECLARATIONS_H
|
||||
@@ -153,9 +153,7 @@ void remove_all_memtrackers(void) {
|
||||
sMemTrackers[i].total = 0.0f;
|
||||
}
|
||||
|
||||
#ifdef AVOID_UB
|
||||
sNumActiveMemTrackers = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -459,11 +457,7 @@ void fatal_printf(const char *fmt, ...) {
|
||||
gd_printf("%s", va_arg(vl, char *));
|
||||
break;
|
||||
case 'c':
|
||||
#ifdef AVOID_UB
|
||||
gd_printf("%c", (char)va_arg(vl, int));
|
||||
#else
|
||||
gd_printf("%c", va_arg(vl, char));
|
||||
#endif
|
||||
break;
|
||||
case 'x':
|
||||
gd_printf("%x", va_arg(vl, s32));
|
||||
|
||||
@@ -1125,12 +1125,7 @@ void unref_8017AEDC(struct ObjGroup *grp) {
|
||||
* @bug Nothing is returned if the DL is created
|
||||
* @note Contains string literals that suggest a removed `printf` call
|
||||
*/
|
||||
#ifdef AVOID_UB
|
||||
void
|
||||
#else
|
||||
s32
|
||||
#endif
|
||||
create_shape_gddl(struct ObjShape *s) {
|
||||
void create_shape_gddl(struct ObjShape *s) {
|
||||
struct ObjShape *shape = s; // 24
|
||||
s32 shapedl; // 20
|
||||
UNUSED s32 enddl; // 1C
|
||||
@@ -1138,11 +1133,7 @@ create_shape_gddl(struct ObjShape *s) {
|
||||
create_shape_mtl_gddls(shape);
|
||||
shapedl = gd_startdisplist(7);
|
||||
if (shapedl == 0) {
|
||||
#ifdef AVOID_UB
|
||||
return;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
setup_lights();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include <PR/ultratypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bad_declarations.h"
|
||||
#include "debug_utils.h"
|
||||
#include "draw_objects.h"
|
||||
#include "dynlist_proc.h"
|
||||
@@ -627,12 +626,7 @@ struct GdObj *d_makeobj(enum DObjTypes type, DynObjName name) {
|
||||
case D_DATA_GRP:
|
||||
d_makeobj(D_GROUP, name);
|
||||
((struct ObjGroup *) sDynListCurObj)->linkType = 1;
|
||||
//! @bug Returns garbage when making `D_DATA_GRP` object
|
||||
#ifdef AVOID_UB
|
||||
return NULL;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
case D_CAMERA:
|
||||
dobj = &make_camera(0, NULL)->header;
|
||||
break;
|
||||
|
||||
@@ -347,10 +347,7 @@ struct ObjZone *make_zone(struct ObjGroup *a0, struct GdBoundingBox *bbox, struc
|
||||
newZone->unk2C = a2;
|
||||
newZone->unk30 = a0;
|
||||
|
||||
//! @bug Created `ObjZone` is not returned
|
||||
#ifdef AVOID_UB
|
||||
return newZone;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* @ 22AF70 for 0x60 */
|
||||
@@ -923,14 +920,8 @@ s32 apply_to_obj_types_in_group(s32 types, applyproc_t func, struct ObjGroup *gr
|
||||
|
||||
fnAppliedCount = 0;
|
||||
|
||||
//! @bug When `group` pointer is NULL, garbage is returned, not the
|
||||
//! count of `fn` calls
|
||||
if (group == NULL) {
|
||||
#ifdef AVOID_UB
|
||||
return fnAppliedCount;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (group->linkType & 1) { // compressed data, not an Obj
|
||||
|
||||
@@ -10,10 +10,6 @@ void get_objvalue(union ObjVarVal *dst, enum ValPtrType type, void *base, size_t
|
||||
struct ObjGadget *make_gadget(UNUSED s32 a0, s32 a1);
|
||||
void reset_gadget(struct ObjGadget *gdgt);
|
||||
void reset_gadgets_in_grp(struct ObjGroup *grp);
|
||||
|
||||
// see bad_declarations.h
|
||||
#ifndef GD_USE_BAD_DECLARATIONS
|
||||
struct ObjLabel *make_label(struct ObjValPtr *ptr, char *str, s32 a2, f32 x, f32 y, f32 z);
|
||||
#endif
|
||||
|
||||
#endif // GD_OLD_MENU_H
|
||||
@@ -1456,12 +1456,7 @@ struct GdDisplayList *create_child_gdl(s32 id, struct GdDisplayList *srcDl) {
|
||||
newDl = alloc_displaylist(id);
|
||||
newDl->parent = srcDl;
|
||||
cpy_remaining_gddl(newDl, srcDl);
|
||||
//! @bug No return statement, despite return value being used.
|
||||
//! Goddard lucked out that `v0` return from alloc_displaylist()
|
||||
//! is not overwriten, as that pointer is what should be returned
|
||||
#ifdef AVOID_UB
|
||||
return newDl;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 24B7F8 -> 24BA48; orig name: func_8019D028 */
|
||||
@@ -2719,14 +2714,7 @@ s32 setup_view_buffers(const char *name, struct ObjView *view, UNUSED s32 ulx, U
|
||||
view->parent = D_801A86E0;
|
||||
}
|
||||
|
||||
//! @bug No actual return, but the return value is used.
|
||||
//! There is no obvious value to return. Since the function
|
||||
//! doesn't use four of its parameters, this function may have
|
||||
//! had a fair amount of its code commented out. In game, the
|
||||
//! returned value is always 0, so the fix returns that value
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 252AF8 -> 252BAC; orig name: _InitControllers */
|
||||
|
||||
@@ -24,10 +24,6 @@ void animate_mario_head_gameover(struct ObjAnimator *self);
|
||||
void animate_mario_head_normal(struct ObjAnimator *self);
|
||||
s32 load_mario_head(void (*aniFn)(struct ObjAnimator *));
|
||||
void load_shapes2(void);
|
||||
|
||||
// see bad_declarations.h
|
||||
#ifndef GD_USE_BAD_DECLARATIONS
|
||||
struct ObjFace* make_face_with_colour(f32 r, f32 g, f32 b);
|
||||
#endif
|
||||
|
||||
#endif // GD_SHAPE_HELPER_H
|
||||
@@ -2386,10 +2386,7 @@ s32 lvl_init_menu_values_and_cursor_pos(UNUSED s32 arg, UNUSED s32 unused) {
|
||||
sMainMenuTimer = 0;
|
||||
sEraseYesNoHoverState = MENU_ERASE_HOVER_NONE;
|
||||
sSoundMode = save_file_get_sound_mode();
|
||||
//! no return value
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -436,13 +436,9 @@ Gfx *geo_intro_face_easter_egg(s32 state, struct GraphNode *node, UNUSED void *c
|
||||
Gfx *geo_intro_rumble_pak_graphic(s32 state, struct GraphNode *node, UNUSED void *context) {
|
||||
struct GraphNodeGenerated *genNode = (struct GraphNodeGenerated *)node;
|
||||
Gfx *dlIter;
|
||||
Gfx *dl;
|
||||
Gfx *dl = NULL;
|
||||
s32 introContext;
|
||||
s8 backgroundTileSix;
|
||||
#ifdef AVOID_UB
|
||||
dl = NULL;
|
||||
backgroundTileSix = 0;
|
||||
#endif
|
||||
s8 backgroundTileSix = 0;
|
||||
|
||||
if (state != 1) {
|
||||
dl = NULL;
|
||||
|
||||
@@ -395,13 +395,8 @@ void print_act_selector_strings(void) {
|
||||
|
||||
/**
|
||||
* Geo function that Print act selector strings.
|
||||
*!@bug: This geo function is missing the third param. Harmless in practice due to o32 convention.
|
||||
*/
|
||||
#ifdef AVOID_UB
|
||||
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node, UNUSED void *context) {
|
||||
#else
|
||||
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node) {
|
||||
#endif
|
||||
if (callContext == GEO_CONTEXT_RENDER) {
|
||||
print_act_selector_strings();
|
||||
}
|
||||
@@ -426,10 +421,7 @@ s32 lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused) {
|
||||
sObtainedStars--;
|
||||
}
|
||||
|
||||
//! no return value
|
||||
#ifdef AVOID_UB
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,11 +13,7 @@ enum StarSelectorTypes
|
||||
STAR_SELECTOR_100_COINS
|
||||
};
|
||||
|
||||
#ifdef AVOID_UB
|
||||
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node, UNUSED void *context);
|
||||
#else
|
||||
Gfx *geo_act_selector_strings(s16 callContext, UNUSED struct GraphNode *node);
|
||||
#endif
|
||||
s32 lvl_init_act_selector_values_and_stars(UNUSED s32 arg, UNUSED s32 unused);
|
||||
s32 lvl_update_obj_and_load_act_button_actions(UNUSED s32 arg, UNUSED s32 unused);
|
||||
|
||||
|
||||
Reference in new issue
Block a user