1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-27 07:07:09 +00:00

Fix return UB (#958)

* Ydan_SP

* func_8002D7EC

* Gameplay_ChangeCameraStatus

* Graph_InitTHGA

* CollisioCheck_LineOC

* Fix more in camera and jpeg

* revert comment in player
This commit is contained in:
louist103 2021-09-12 07:02:45 -04:00 committed by GitHub
parent 90c841c435
commit e31e35658d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 11 deletions

View file

@ -381,7 +381,7 @@ void Actor_Kill(Actor* actor);
void Actor_SetFocus(Actor* actor, f32 offset);
void Actor_SetScale(Actor* actor, f32 scale);
void Actor_SetObjectDependency(GlobalContext* globalCtx, Actor* actor);
s16 func_8002D7EC(Actor* actor);
void func_8002D7EC(Actor* actor);
void func_8002D868(Actor* actor);
void Actor_MoveForward(Actor* actor);
void func_8002D908(Actor* actor);
@ -1614,7 +1614,7 @@ void GameAlloc_Init(GameAlloc* this);
void Graph_FaultClient();
void Graph_DisassembleUCode(Gfx* workBuf);
void Graph_UCodeFaultClient(Gfx* workBuf);
void* Graph_InitTHGA(GraphicsContext* gfxCtx);
void Graph_InitTHGA(GraphicsContext* gfxCtx);
GameStateOverlay* Graph_GetNextGameState(GameState* gameState);
void Graph_Init(GraphicsContext* gfxCtx);
void Graph_Destroy(GraphicsContext* gfxCtx);

View file

@ -79,7 +79,7 @@ void Graph_UCodeFaultClient(Gfx* workBuf) {
UCodeDisas_Destroy(&disassembler);
}
void* Graph_InitTHGA(GraphicsContext* gfxCtx) {
void Graph_InitTHGA(GraphicsContext* gfxCtx) {
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1];
pool->headMagic = GFXPOOL_HEAD_MAGIC;

View file

@ -845,7 +845,7 @@ void Actor_Destroy(Actor* actor, GlobalContext* globalCtx) {
}
}
s16 func_8002D7EC(Actor* actor) {
void func_8002D7EC(Actor* actor) {
f32 speedRate = R_UPDATE_RATE * 0.5f;
actor->world.pos.x += (actor->velocity.x * speedRate) + actor->colChkInfo.displacement.x;

View file

@ -2125,6 +2125,7 @@ s32 Camera_Parallel1(Camera* camera) {
camera->fov = Camera_LERPCeilF(para1->fovTarget, camera->fov, camera->fovUpdateRate, 1.0f);
camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5, 0xA);
camera->atLERPStepScale = Camera_ClampLERPScale(camera, sp6A ? para1->unk_1C : para1->unk_14);
//! @bug No return
}
s32 Camera_Parallel2(Camera* camera) {
@ -2929,7 +2930,7 @@ s32 Camera_Battle2(Camera* camera) {
}
s32 Camera_Battle3(Camera* camera) {
Camera_Noop(camera);
return Camera_Noop(camera);
}
/**

View file

@ -3175,7 +3175,7 @@ s32 CollisionCheck_LineOC(GlobalContext* globalCtx, CollisionCheckContext* colCh
* otherwise. Unused.
*/
s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b) {
CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, NULL, 0);
return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, NULL, 0);
}
/**
@ -3184,7 +3184,7 @@ s32 CollisionCheck_LineOCCheckAll(GlobalContext* globalCtx, CollisionCheckContex
*/
s32 CollisionCheck_LineOCCheck(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx, Vec3f* a, Vec3f* b,
Actor** exclusions, s32 numExclusions) {
CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, exclusions, numExclusions);
return CollisionCheck_LineOC(globalCtx, colChkCtx, a, b, exclusions, numExclusions);
}
/**

View file

@ -17,7 +17,7 @@
/**
* Configures and schedules a JPEG decoder task and waits for it to finish.
*/
u32 Jpeg_ScheduleDecoderTask(JpegContext* ctx) {
void Jpeg_ScheduleDecoderTask(JpegContext* ctx) {
static OSTask_t sJpegTask = {
M_NJPEGTASK, // type
0, // flags

View file

@ -1533,7 +1533,7 @@ s16 Gameplay_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status)
globalCtx->activeCamera = camIdx;
}
Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], status);
return Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], status);
}
void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) {

View file

@ -153,7 +153,7 @@ void BgYdanSp_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyTris(globalCtx, &this->trisCollider);
}
void* BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) {
void BgYdanSp_UpdateFloorWebCollision(BgYdanSp* this) {
s16 newY;
CollisionHeader* colHeader;

View file

@ -566,7 +566,7 @@ s32 EnSt_DecrStunTimer(EnSt* this) {
if (this->stunTimer == 0) {
return 0;
}
this->stunTimer--; //! @bug ? no return but v0 ends up being stunTimer before decrement
this->stunTimer--; //! @bug no return but v0 ends up being stunTimer before decrement
}
/**