diff --git a/include/functions.h b/include/functions.h index 0072baf4b4..c056003523 100644 --- a/include/functions.h +++ b/include/functions.h @@ -682,9 +682,6 @@ void func_8006D684(PlayState* play, Player* player); void func_8006DC68(PlayState* play, Player* player); void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2); -void KaleidoSetup_Update(PlayState* play); -void KaleidoSetup_Init(PlayState* play); -void KaleidoSetup_Destroy(PlayState* play); s32 Kanji_OffsetFromShiftJIS(s32 character); void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex); void Font_LoadChar(Font* font, u8 character, u16 codePointIndex); @@ -1052,16 +1049,6 @@ void DebugCamera_Update(DebugCam* debugCam, Camera* cam); void DebugCamera_Reset(Camera* cam, DebugCam* debugCam); void func_800BB0A0(f32 u, Vec3f* pos, f32* roll, f32* viewAngle, f32* point0, f32* point1, f32* point2, f32* point3); s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s16* keyFrame, f32* curFrame); -void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); -void KaleidoManager_Init(PlayState* play); -void KaleidoManager_Destroy(void); -void* KaleidoManager_GetRamAddr(void* vram); -void KaleidoScopeCall_LoadPlayer(void); -void KaleidoScopeCall_Init(PlayState* play); -void KaleidoScopeCall_Destroy(PlayState* play); -void KaleidoScopeCall_Update(PlayState* play); -void KaleidoScopeCall_Draw(PlayState* play); s32 func_800C0D34(PlayState* this, Actor* actor, s16* yaw); s32 func_800C0DB4(PlayState* this, Vec3f* pos); @@ -1349,15 +1336,6 @@ void Audio_InitSound(void); void func_800F7170(void); void func_800F71BC(s32 arg0); -void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a); -void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y); -void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y); -void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y); -void GfxPrint_Init(GfxPrint* this); -void GfxPrint_Destroy(GfxPrint* this); -void GfxPrint_Open(GfxPrint* this, Gfx* dList); -Gfx* GfxPrint_Close(GfxPrint* this); -s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...); void RcpUtils_PrintRegisterStatus(void); void RcpUtils_Reset(void); void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd); @@ -1514,11 +1492,7 @@ void guMtxF2L(f32 mf[4][4], Mtx* m); void* osViGetCurrentFramebuffer(void); s32 __osSpSetPc(void* pc); f32 absf(f32); -void* memset(void* dest, int val, size_t len); -void* memmove(void* dest, const void* src, size_t len); -void Interface_Destroy(PlayState* play); -void Interface_Init(PlayState* play); void Regs_InitData(PlayState* play); void Setup_Init(GameState* thisx); diff --git a/include/gfxprint.h b/include/gfxprint.h index 86879c4805..039b564b4b 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -39,4 +39,14 @@ typedef struct GfxPrint { #endif #define GFXP_FLAG_OPEN (1 << 7) +void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a); +void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y); +void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y); +void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y); +void GfxPrint_Init(GfxPrint* this); +void GfxPrint_Destroy(GfxPrint* this); +void GfxPrint_Open(GfxPrint* this, Gfx* dList); +Gfx* GfxPrint_Close(GfxPrint* this); +s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...); + #endif diff --git a/include/kaleido_manager.h b/include/kaleido_manager.h new file mode 100644 index 0000000000..ce116752a4 --- /dev/null +++ b/include/kaleido_manager.h @@ -0,0 +1,39 @@ +#ifndef KALEIDO_MANAGER_H +#define KALEIDO_MANAGER_H + +#include "ultra64.h" +#include "romfile.h" + +struct PlayState; + +typedef struct KaleidoMgrOverlay { + /* 0x00 */ void* loadedRamAddr; + /* 0x04 */ RomFile file; + /* 0x0C */ void* vramStart; + /* 0x10 */ void* vramEnd; + /* 0x14 */ u32 offset; // loadedRamAddr - vramStart + /* 0x18 */ const char* name; +} KaleidoMgrOverlay; // size = 0x1C + +typedef enum KaleidoOverlayType { + /* 0 */ KALEIDO_OVL_KALEIDO_SCOPE, + /* 1 */ KALEIDO_OVL_PLAYER_ACTOR, + /* 2 */ KALEIDO_OVL_MAX +} KaleidoOverlayType; + +void KaleidoManager_LoadOvl(KaleidoMgrOverlay* ovl); +void KaleidoManager_ClearOvl(KaleidoMgrOverlay* ovl); +void KaleidoManager_Init(struct PlayState* play); +void KaleidoManager_Destroy(void); +void* KaleidoManager_GetRamAddr(void* vram); + +extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX]; +extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; + +void KaleidoScopeCall_LoadPlayer(void); +void KaleidoScopeCall_Init(struct PlayState* play); +void KaleidoScopeCall_Destroy(struct PlayState* play); +void KaleidoScopeCall_Update(struct PlayState* play); +void KaleidoScopeCall_Draw(struct PlayState* play); + +#endif diff --git a/include/libc/string.h b/include/libc/string.h index 3f9a5cee71..3e2e6be592 100644 --- a/include/libc/string.h +++ b/include/libc/string.h @@ -7,5 +7,7 @@ char* strchr(const char*, int); size_t strlen(const char*); void* memcpy(void*, const void*, size_t); +void* memmove(void* dest, const void* src, size_t len); +void* memset(void* dest, int val, size_t len); #endif diff --git a/include/variables.h b/include/variables.h index 92f68735b2..269f455373 100644 --- a/include/variables.h +++ b/include/variables.h @@ -94,8 +94,6 @@ extern u16 gSramSlotOffsets[]; // 4 16-colors palettes extern u64 gMojiFontTLUTs[4][4]; // original name: "moji_tlut" extern u64 gMojiFontTex[]; // original name: "font_ff" -extern KaleidoMgrOverlay gKaleidoMgrOverlayTable[KALEIDO_OVL_MAX]; -extern KaleidoMgrOverlay* gKaleidoMgrCurOvl; extern u8 gBossMarkState; #if OOT_DEBUG diff --git a/include/z64.h b/include/z64.h index a4871aa830..4c797ffaed 100644 --- a/include/z64.h +++ b/include/z64.h @@ -71,6 +71,7 @@ #include "main.h" #include "segmented_address.h" #include "stackcheck.h" +#include "kaleido_manager.h" #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 240 @@ -102,21 +103,6 @@ #define THREAD_ID_DMAMGR 18 #define THREAD_ID_IRQMGR 19 -typedef struct KaleidoMgrOverlay { - /* 0x00 */ void* loadedRamAddr; - /* 0x04 */ RomFile file; - /* 0x0C */ void* vramStart; - /* 0x10 */ void* vramEnd; - /* 0x14 */ u32 offset; // loadedRamAddr - vramStart - /* 0x18 */ const char* name; -} KaleidoMgrOverlay; // size = 0x1C - -typedef enum KaleidoOverlayType { - /* 0 */ KALEIDO_OVL_KALEIDO_SCOPE, - /* 1 */ KALEIDO_OVL_PLAYER_ACTOR, - /* 2 */ KALEIDO_OVL_MAX -} KaleidoOverlayType; - typedef enum LensMode { /* 0 */ LENS_MODE_SHOW_ACTORS, // lens actors are invisible by default, and shown by using lens (for example, invisible enemies) /* 1 */ LENS_MODE_HIDE_ACTORS // lens actors are visible by default, and hidden by using lens (for example, fake walls) diff --git a/include/z64interface.h b/include/z64interface.h index 6ee09afe9b..e9284499ab 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -275,5 +275,7 @@ void Interface_SetSubTimerToFinalSecond(struct PlayState* play); void Interface_SetTimer(s16 seconds); void Interface_Draw(struct PlayState* play); void Interface_Update(struct PlayState* play); +void Interface_Destroy(struct PlayState* play); +void Interface_Init(struct PlayState* play); #endif diff --git a/include/z64pause.h b/include/z64pause.h index d560963a12..8802521787 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -6,6 +6,7 @@ #include "z64view.h" struct OcarinaStaff; +struct PlayState; #define PAUSE_ITEM_NONE 999 @@ -229,4 +230,8 @@ typedef struct PauseMapMarkData { typedef PauseMapMarkData PauseMapMarksData[3]; +void KaleidoSetup_Update(struct PlayState* play); +void KaleidoSetup_Init(struct PlayState* play); +void KaleidoSetup_Destroy(struct PlayState* play); + #endif diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index ea27b5edc4..ea5bf96722 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -212,7 +212,7 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:96 gc-jp-ce:96 gc-jp-mq:96 gc-us:96 gc-us-mq:96" +#pragma increment_block_number "gc-eu:112 gc-eu-mq:112 gc-jp:96 gc-jp-ce:96 gc-jp-mq:96 gc-us:96 gc-us-mq:96" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/libc/memmove.c b/src/libc/memmove.c index 8ff5ec5f6c..302981f580 100644 --- a/src/libc/memmove.c +++ b/src/libc/memmove.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "string.h" /** * memmove: copies `len` bytes from memory starting at `src` to memory starting at `dest`. @@ -12,8 +12,8 @@ * @return dest */ void* memmove(void* dest, const void* src, size_t len) { - u8* d = dest; - const u8* s = src; + char* d = dest; + const char* s = src; if (d == s) { return dest; diff --git a/src/libc/memset.c b/src/libc/memset.c index ec699c7ce3..31dba02ed8 100644 --- a/src/libc/memset.c +++ b/src/libc/memset.c @@ -1,4 +1,4 @@ -#include "global.h" +#include "string.h" /** * memset: sets `len` bytes to `val` starting at address `dest`. @@ -12,7 +12,7 @@ * @return dest */ void* memset(void* dest, int val, size_t len) { - u8* ptr = dest; + char* ptr = dest; while (len--) { *ptr++ = val; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 77f1c0325d..dc3691ef03 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -15,7 +15,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:140 gc-eu-mq:140 gc-jp:142 gc-jp-ce:142 gc-jp-mq:142 gc-us:142 gc-us-mq:142" +#pragma increment_block_number "gc-eu:139 gc-eu-mq:139 gc-jp:141 gc-jp-ce:141 gc-jp-mq:141 gc-us:141 gc-us-mq:141" #define FLAGS ACTOR_FLAG_4