From 4fa13e4132cf8adb2f07bb34927e62e525c8cc79 Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sat, 2 Sep 2023 15:34:29 -0400 Subject: Move libultra function declarations to libultra headers (#1196) * Delete unused headers * Move PR and io to ultra64 * move headers to ultra64 * more cleanups * more reorganizing * i think that should be all * format * ifdef guards cleanup * Add IO_READ and IO_WRITE macros for future use * warnings * review Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> * warnings again * warn * ifdef guards * fix merge * fix merge * fix merge * bss * padutils.h * bss * bss * bss * fix merge * bss * bss * bss * fix merge * fixes * fixes * bss * bss * fix merge * fix * fix * fix includepaths * fix paths * bss * fix * ultra64/ -> PR/ * header guards * fix ehader guards * fix * fix++ * format * bss is borken * prevent 2 * :despair: * bss * rename assert to dbg_hungup * fix * a * fix * bss * fix * bss * bss --------- Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com> --- src/code/game.c | 5 +++-- src/code/padmgr.c | 4 ++-- src/code/z_actor_dlftbls.c | 1 + src/code/z_bgcheck.c | 1 - src/code/z_camera.c | 1 + src/code/z_demo.c | 3 ++- src/code/z_eventmgr.c | 2 ++ src/code/z_pause.c | 2 ++ src/code/z_play.c | 5 +++-- src/code/z_player_lib.c | 1 + src/code/z_room.c | 7 ++++--- src/code/z_vimode.c | 5 +++-- 12 files changed, 24 insertions(+), 13 deletions(-) (limited to 'src/code') diff --git a/src/code/game.c b/src/code/game.c index dc1e1b93e..4f2df63cd 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -11,6 +11,7 @@ #include "z64vismono.h" #include "z64viszbuf.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" +#include "debug.h" s32 gFramerateDivisor = 1; f32 gFramerateDivisorF = 1.0f; @@ -168,7 +169,7 @@ void GameState_InitArena(GameState* gameState, size_t size) { } THA_Init(&gameState->heap, NULL, 0); - __assert("../game.c", 1035); + _dbg_hungup("../game.c", 1035); } void GameState_Realloc(GameState* gameState, size_t size) { @@ -192,7 +193,7 @@ void GameState_Realloc(GameState* gameState, size_t size) { THA_Init(&gameState->heap, gameArena, size); } else { THA_Init(&gameState->heap, NULL, 0); - __assert("../game.c", 1074); + _dbg_hungup("../game.c", 1074); } } diff --git a/src/code/padmgr.c b/src/code/padmgr.c index eb6a811b7..ae40fc1a4 100644 --- a/src/code/padmgr.c +++ b/src/code/padmgr.c @@ -32,8 +32,8 @@ */ #include "global.h" -#include "io/controller.h" -#include "ultra64/motor.h" +#include "PR/controller.h" +#include "PR/os_motor.h" #include "fault.h" #define PADMGR_RETRACE_MSG (1 << 0) diff --git a/src/code/z_actor_dlftbls.c b/src/code/z_actor_dlftbls.c index 012c118fb..d48ed24bc 100644 --- a/src/code/z_actor_dlftbls.c +++ b/src/code/z_actor_dlftbls.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" #include "fault.h" diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 924000f92..ae871c8a6 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,4 +1,3 @@ -#include "prevent_bss_reordering.h" #include "global.h" #include "fault.h" #include "fixed_point.h" diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 95d2e36f9..c2e00e206 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -44,6 +44,7 @@ */ #include "global.h" +#include "libc/string.h" #include "z64quake.h" #include "z64shrink_window.h" #include "z64view.h" diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 24371cdbe..ba9199dbb 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,5 +1,6 @@ -#include "prevent_bss_reordering.h" #include "PR/ultratypes.h" +#include "prevent_bss_reordering.h" +#include "prevent_bss_reordering2.h" // Variables are put before most headers as a hacky way to bypass bss reordering struct CutsceneCamera; diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 88ec794fc..fed5ec48c 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -3,8 +3,10 @@ * * Manages all cutscenes except for manual */ + #include "global.h" #include "z64shrink_window.h" +#include "libc/string.h" ActorCutscene sGlobalCutsceneList[] = { // CS_ID_GLOBAL_78 diff --git a/src/code/z_pause.c b/src/code/z_pause.c index 5f212b7ae..b16cc62c1 100644 --- a/src/code/z_pause.c +++ b/src/code/z_pause.c @@ -20,6 +20,8 @@ */ #include "z64frameadvance.h" +#include "libc/stdbool.h" +#include "padutils.h" #include "macros.h" void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { diff --git a/src/code/z_play.c b/src/code/z_play.c index ccbf1f0c4..48fbb1f2d 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -32,6 +32,7 @@ u8 sMotionBlurStatus; #include "overlays/gamestates/ovl_opening/z_opening.h" #include "overlays/gamestates/ovl_file_choose/z_file_select.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" +#include "debug.h" s32 gDbgCamEnabled = false; u8 D_801D0D54 = false; @@ -335,11 +336,11 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) { default: fbdemoType = -1; - __assert("../z_play.c", 1420); + _dbg_hungup("../z_play.c", 1420); } } else { fbdemoType = -1; - __assert("../z_play.c", 1423); + _dbg_hungup("../z_play.c", 1423); } transitionCtx->transitionType = transitionType; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index e272bbfea..a890090ff 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -3,6 +3,7 @@ * Description: Set of library functions to interact with the Player system */ +#include "prevent_bss_reordering.h" #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" diff --git a/src/code/z_room.c b/src/code/z_room.c index 78eb5f98e..28a297499 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -1,4 +1,5 @@ #include "global.h" +#include "debug.h" void Room_Noop(PlayState* play, Room* room, Input* input, s32 arg3) { } @@ -380,7 +381,7 @@ RoomShapeImageMultiBgEntry* Room_GetImageMultiBgEntry(RoomShapeImageMulti* roomS bgEntry++; } - __assert("../z_room.c", 849); + _dbg_hungup("../z_room.c", 849); return NULL; } @@ -461,7 +462,7 @@ void Room_DrawImage(PlayState* play, Room* room, u32 flags) { } else if (roomShape->amountType == ROOM_SHAPE_IMAGE_AMOUNT_MULTI) { Room_DrawImageMulti(play, room, flags); } else { - __assert("../z_room.c", 965); + _dbg_hungup("../z_room.c", 965); } } @@ -516,7 +517,7 @@ size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) { roomCtx->roomMemPages[0] = THA_AllocTailAlign16(&play->state.heap, maxRoomSize); if (roomCtx->roomMemPages[0] == NULL) { - __assert("../z_room.c", 1078); + _dbg_hungup("../z_room.c", 1078); } roomCtx->roomMemPages[1] = (void*)((uintptr_t)roomCtx->roomMemPages[0] + maxRoomSize); roomCtx->activeMemPage = 0; diff --git a/src/code/z_vimode.c b/src/code/z_vimode.c index 778c89c14..8e3d1c59f 100644 --- a/src/code/z_vimode.c +++ b/src/code/z_vimode.c @@ -1,6 +1,7 @@ #include "global.h" +#include "debug.h" #include "z64vimode.h" -#include "ultra64/viint.h" +#include "PR/viint.h" typedef struct { /* 0x00 */ u32 burst; @@ -143,7 +144,7 @@ void ViMode_Configure(OSViMode* viMode, s32 type, s32 tvType, s32 loRes, s32 ant viMode->fldRegs[0].vBurst = ptr->vBurst; viMode->fldRegs[1].vBurst = ptr->vBurst; } else { - __assert("../z_vimode.c", 216); + _dbg_hungup("../z_vimode.c", 216); } viMode->comRegs.hStart += (leftAdjust << 16) + (s16)rightAdjust; -- cgit v1.2.3