1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-05 15:34:41 +00:00

libc cleanup (#1568)

* libc cleanup

* Suggested changes, small alloca tweak

* Remove printf include
This commit is contained in:
Tharo 2023-10-27 15:06:44 +01:00 committed by GitHub
parent 4e55168eaa
commit 3475651701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
46 changed files with 571 additions and 432 deletions

View file

@ -1,5 +1,4 @@
#include "global.h"
#include "fp.h"
s32 gUseAtanContFrac;

View file

@ -242,7 +242,7 @@ void FaultDrawer_FillScreen(void) {
FaultDrawer_SetCursor(sFaultDrawer.xStart, sFaultDrawer.yStart);
}
void* FaultDrawer_PrintCallback(void* arg, const char* str, u32 count) {
void* FaultDrawer_PrintCallback(void* arg, const char* str, size_t count) {
for (; count != 0; count--, str++) {
s32 curXStart;
s32 curXEnd;

View file

@ -301,7 +301,7 @@ void GfxPrint_PrintString(GfxPrint* this, const char* str) {
}
}
void* GfxPrint_Callback(void* arg, const char* str, u32 size) {
void* GfxPrint_Callback(void* arg, const char* str, size_t size) {
GfxPrint* this = arg;
GfxPrint_PrintStringWithSize(this, str, sizeof(char), size);

View file

@ -46,7 +46,7 @@ s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void*
// "Clear BSS area (% 08x-% 08x)"
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovlRelocs->bssSize);
}
bzero((void*)end, ovlRelocs->bssSize);
bzero((void*)end, (s32)ovlRelocs->bssSize);
}
size = (uintptr_t)&ovlRelocs->relocations[ovlRelocs->nRelocations] - (uintptr_t)ovlRelocs;

View file

@ -810,7 +810,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
Actor_SetScale(actor, 0.01f);
actor->targetMode = 3;
actor->minVelocityY = -20.0f;
actor->xyzDistToPlayerSq = FLT_MAX;
actor->xyzDistToPlayerSq = MAXFLOAT;
actor->naviEnemyId = NAVI_ENEMY_NONE;
actor->uncullZoneForward = 1000.0f;
actor->uncullZoneScale = 350.0f;
@ -1468,7 +1468,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) {
if (player->unk_664 != NULL) {
if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_27)) {
return FLT_MAX;
return MAXFLOAT;
} else {
f32 ret =
actor->xyzDistToPlayerSq - actor->xyzDistToPlayerSq * 0.8f * ((0x4000 - yawTempAbs) * (1.0f / 0x8000));
@ -1478,7 +1478,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) {
}
if (yawTempAbs > 0x2AAA) {
return FLT_MAX;
return MAXFLOAT;
}
return actor->xyzDistToPlayerSq;
@ -1513,7 +1513,7 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) {
f32 dist;
if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) {
dist = FLT_MAX;
dist = MAXFLOAT;
} else {
dist = actor->xyzDistToPlayerSq;
}
@ -3067,7 +3067,7 @@ Actor* func_80032AF0(PlayState* play, ActorContext* actorCtx, Actor** actorPtr,
u8* entry;
D_8015BBE8 = D_8015BBEC = NULL;
D_8015BBF0 = sbgmEnemyDistSq = FLT_MAX;
D_8015BBF0 = sbgmEnemyDistSq = MAXFLOAT;
D_8015BBF8 = 0x7FFFFFFF;
if (!Player_InCsMode(play)) {

View file

@ -3227,8 +3227,6 @@ void Collider_SetTrisDim(PlayState* play, ColliderTris* collider, s32 index, Col
// by the compiler between structs like TriNorm and/or Vec3f, so they don't take space in bss.
static s8 sBssDummy11;
static s8 sBssDummy12;
static s8 sBssDummy13;
static s8 sBssDummy14;
/**
* Updates the world spheres for all of the collider's JntSph elements attached to the specified limb