mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
fix issues 2
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
* Disable every debug feature
|
||||
* This will enable Jumper pak compatibility
|
||||
*/
|
||||
#define DISABLE_DEBUG_FEATURES false
|
||||
#define DISABLE_DEBUG_FEATURES true
|
||||
|
||||
/**
|
||||
* Disable autoscroll on crash debugger
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef CONFIG_DEBUG_FEATURES_H
|
||||
// #define CONFIG_DEBUG_FEATURES_H
|
||||
#define CONFIG_DEBUG_FEATURES_H
|
||||
|
||||
/******************
|
||||
* DEBUG FEATURES *
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
/**** [DEBUG HEAP] ****/
|
||||
// ``IS_DEBUG_HEAP_ENABLED``
|
||||
#define ENABLE_DEBUG_HEAP false
|
||||
|
||||
// The memory space to allocate for the debug heap (used by the Camera Debugger)
|
||||
@@ -25,32 +26,42 @@
|
||||
#define DEBUG_HEAP_SIZE 0x600000
|
||||
|
||||
/**** [NO CLIP] ****/
|
||||
// ``IS_NO_CLIP_ENABLED``
|
||||
#define ENABLE_NO_CLIP true
|
||||
|
||||
/**** [INPUT DISPLAY] ****/
|
||||
// ``CAN_SHOW_INPUT_DISPLAY``
|
||||
#define SHOW_INPUT_DISPLAY false
|
||||
|
||||
/**** [CUTSCENE FEATURES] ****/
|
||||
// ``CAN_SHOW_CS_INFOS``
|
||||
#define SHOW_CS_INFOS false
|
||||
// ``IS_CS_CONTROL_ENABLED``
|
||||
#define ENABLE_CS_CONTROL false
|
||||
|
||||
// Allow skip on the title screen (if using ``ENABLE_CS_CONTROL``)
|
||||
// ``CS_CAN_SKIP_TITLE_SCREEN``
|
||||
#define CS_CTRL_SKIP_TITLE_SCREEN false
|
||||
|
||||
/**** [TIME INFORMATIONS] ****/
|
||||
// ``CAN_SHOW_TIME_INFOS``
|
||||
#define SHOW_TIME_INFOS false
|
||||
|
||||
/**** [FRAMERATE OPTIONS] ****/
|
||||
// TODO: check for frame advance for drawing, improve how it works
|
||||
// ``ARE_FRAMERATE_OPTIONS_ENABLED``
|
||||
#define ENABLE_FRAMERATE_OPTIONS false
|
||||
|
||||
/**** [MAP SELECT] ****/
|
||||
// ``IS_MAP_SELECT_ENABLED``
|
||||
#define ENABLE_MAP_SELECT false
|
||||
|
||||
/**** [DEBUG FILE 1] ****/
|
||||
// ``IS_DEBUG_SAVE_ENABLED``
|
||||
#define ENABLE_DEBUG_SAVE true
|
||||
|
||||
/**** [TEST SCENES] ****/
|
||||
// ``CAN_INCLUDE_TEST_SCENES``
|
||||
#define INCLUDE_TEST_SCENES false
|
||||
|
||||
// -------------------------------------------
|
||||
@@ -60,12 +71,15 @@
|
||||
*/
|
||||
|
||||
/**** [INVENTORY EDITOR] ****/
|
||||
// ``IS_INV_EDITOR_ENABLED``
|
||||
#define ENABLE_INV_EDITOR false
|
||||
|
||||
/**** [EVENT EDITOR] ****/
|
||||
// ``IS_EVENT_EDITOR_ENABLED``
|
||||
#define ENABLE_EVENT_EDITOR false
|
||||
|
||||
/**** [REGISTERS EDITOR] ****/
|
||||
// ``IS_REG_EDITOR_ENABLED``
|
||||
#define ENABLE_REG_EDITOR false
|
||||
|
||||
// -------------------------------------------
|
||||
@@ -75,19 +89,24 @@
|
||||
*/
|
||||
|
||||
/**** [CAMERA DEBUGGER] ****/
|
||||
// ``IS_CAMERA_DEBUG_ENABLED``
|
||||
// Includes a cutscene debugger/exporter
|
||||
#define ENABLE_CAMERA_DEBUGGER false
|
||||
|
||||
/**** [AUDIO DEBUGGER] ****/
|
||||
// ``IS_AUDIO_DEBUG_ENABLED``
|
||||
#define ENABLE_AUDIO_DEBUGGER false
|
||||
|
||||
/**** [ACTOR DEBUGGER] ****/
|
||||
// ``IS_ACTOR_DEBUG_ENABLED``
|
||||
#define ENABLE_ACTOR_DEBUGGER false
|
||||
|
||||
/**** [MESSAGES DEBUGGER] ****/
|
||||
// ``IS_MSG_DEBUG_ENABLED``
|
||||
#define ENABLE_MSG_DEBUGGER false
|
||||
|
||||
/**** [SPEEDMETER] ****/
|
||||
// ``IS_SPEEDMETER_ENABLED``
|
||||
// This looks like a profiler
|
||||
#define ENABLE_SPEEDMETER false
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#undef ENABLE_MSG_DEBUGGER
|
||||
#undef ENABLE_DEBUG_SAVE
|
||||
#undef MAP_SELECT_ON_FILE_1
|
||||
#undef ENABLE_DEBUG_HEAP
|
||||
|
||||
#define SHOW_CS_INFOS false
|
||||
#define SHOW_INPUT_DISPLAY false
|
||||
@@ -65,6 +66,7 @@
|
||||
#define ENABLE_MSG_DEBUGGER false
|
||||
#define ENABLE_DEBUG_SAVE false
|
||||
#define MAP_SELECT_ON_FILE_1 false
|
||||
#define ENABLE_DEBUG_HEAP false
|
||||
#endif
|
||||
|
||||
|
||||
@@ -168,31 +170,31 @@
|
||||
/**
|
||||
* Used in if statements
|
||||
*/
|
||||
#define IS_DEBUG OOT_DEBUG && ENABLE_HACKEROOT
|
||||
#define IS_DEBUG (OOT_DEBUG && ENABLE_HACKEROOT)
|
||||
|
||||
// General features
|
||||
#define IS_DEBUG_HEAP_ENABLED IS_DEBUG && ENABLE_DEBUG_HEAP
|
||||
#define IS_NO_CLIP_ENABLED IS_DEBUG && ENABLE_NO_CLIP
|
||||
#define CAN_SHOW_INPUT_DISPLAY IS_DEBUG && SHOW_INPUT_DISPLAY
|
||||
#define CAN_SHOW_CS_INFOS IS_DEBUG && SHOW_CS_INFOS
|
||||
#define IS_CS_CONTROL_ENABLED IS_DEBUG && ENABLE_CS_CONTROL
|
||||
#define CS_CAN_SKIP_TITLE_SCREEN IS_CS_CONTROL_ENABLED && CS_CTRL_SKIP_TITLE_SCREEN
|
||||
#define CAN_SHOW_TIME_INFOS IS_DEBUG && SHOW_TIME_INFOS
|
||||
#define ARE_FRAMERATE_OPTIONS_ENABLED IS_DEBUG && ENABLE_FRAMERATE_OPTIONS
|
||||
#define IS_MAP_SELECT_ENABLED IS_DEBUG && ENABLE_MAP_SELECT
|
||||
#define IS_DEBUG_SAVE_ENABLED IS_DEBUG && ENABLE_DEBUG_SAVE
|
||||
#define CAN_INCLUDE_TEST_SCENES !ENABLE_HACKEROOT || (IS_DEBUG && INCLUDE_TEST_SCENES)
|
||||
#define IS_DEBUG_HEAP_ENABLED (IS_DEBUG && ENABLE_DEBUG_HEAP)
|
||||
#define IS_NO_CLIP_ENABLED (IS_DEBUG && ENABLE_NO_CLIP)
|
||||
#define CAN_SHOW_INPUT_DISPLAY (IS_DEBUG && SHOW_INPUT_DISPLAY)
|
||||
#define CAN_SHOW_CS_INFOS (IS_DEBUG && SHOW_CS_INFOS)
|
||||
#define IS_CS_CONTROL_ENABLED (IS_DEBUG && ENABLE_CS_CONTROL)
|
||||
#define CS_CAN_SKIP_TITLE_SCREEN (IS_CS_CONTROL_ENABLED && CS_CTRL_SKIP_TITLE_SCREEN)
|
||||
#define CAN_SHOW_TIME_INFOS (IS_DEBUG && SHOW_TIME_INFOS)
|
||||
#define ARE_FRAMERATE_OPTIONS_ENABLED (IS_DEBUG && ENABLE_FRAMERATE_OPTIONS)
|
||||
#define IS_MAP_SELECT_ENABLED (IS_DEBUG && ENABLE_MAP_SELECT)
|
||||
#define IS_DEBUG_SAVE_ENABLED (IS_DEBUG && ENABLE_DEBUG_SAVE)
|
||||
#define CAN_INCLUDE_TEST_SCENES (!ENABLE_HACKEROOT || (IS_DEBUG && INCLUDE_TEST_SCENES))
|
||||
|
||||
// In-game editors
|
||||
#define IS_INV_EDITOR_ENABLED IS_DEBUG && ENABLE_INV_EDITOR
|
||||
#define IS_EVENT_EDITOR_ENABLED IS_DEBUG && ENABLE_EVENT_EDITOR
|
||||
#define IS_REG_EDITOR_ENABLED IS_DEBUG && ENABLE_REG_EDITOR
|
||||
#define IS_INV_EDITOR_ENABLED (IS_DEBUG && ENABLE_INV_EDITOR)
|
||||
#define IS_EVENT_EDITOR_ENABLED (IS_DEBUG && ENABLE_EVENT_EDITOR)
|
||||
#define IS_REG_EDITOR_ENABLED (IS_DEBUG && ENABLE_REG_EDITOR)
|
||||
|
||||
// In-game debuggers
|
||||
#define IS_CAMERA_DEBUG_ENABLED IS_DEBUG && ENABLE_CAMERA_DEBUGGER
|
||||
#define IS_AUDIO_DEBUG_ENABLED IS_DEBUG && ENABLE_AUDIO_DEBUGGER
|
||||
#define IS_ACTOR_DEBUG_ENABLED IS_DEBUG && ENABLE_ACTOR_DEBUGGER
|
||||
#define IS_MSG_DEBUG_ENABLED IS_DEBUG && ENABLE_MSG_DEBUGGER
|
||||
#define IS_SPEEDMETER_ENABLED IS_DEBUG && ENABLE_SPEEDMETER
|
||||
#define IS_CAMERA_DEBUG_ENABLED (IS_DEBUG && ENABLE_CAMERA_DEBUGGER)
|
||||
#define IS_AUDIO_DEBUG_ENABLED (IS_DEBUG && ENABLE_AUDIO_DEBUGGER)
|
||||
#define IS_ACTOR_DEBUG_ENABLED (IS_DEBUG && ENABLE_ACTOR_DEBUGGER)
|
||||
#define IS_MSG_DEBUG_ENABLED (IS_DEBUG && ENABLE_MSG_DEBUGGER)
|
||||
#define IS_SPEEDMETER_ENABLED (IS_DEBUG && ENABLE_SPEEDMETER)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -33,11 +33,11 @@ void Yaz0_DecompressImpl(u8* src, u8* dst);
|
||||
void Yaz0_Decompress(uintptr_t romStart, u8* dst, size_t size);
|
||||
void Locale_Init(void);
|
||||
void Locale_ResetRegion(void);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void isPrintfInit(void);
|
||||
#endif
|
||||
void rmonPrintf(const char* fmt, ...);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void* is_proutSyncPrintf(void* arg, const char* str, size_t count);
|
||||
NORETURN void func_80002384(const char* exp, const char* file, u32 line);
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@ void StackCheck_Cleanup(StackEntry* entry);
|
||||
u32 StackCheck_GetState(StackEntry* entry);
|
||||
u32 StackCheck_CheckAll(void);
|
||||
u32 StackCheck_Check(StackEntry* entry);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void LogUtils_LogHexDump(void* ptr, s32 size0);
|
||||
void LogUtils_CheckNullPointer(const char* exp, void* ptr, const char* file, s32 line);
|
||||
void LogUtils_CheckValidPointer(const char* exp, void* ptr, const char* file, s32 line);
|
||||
@@ -613,7 +613,7 @@ u16 WaterBox_GetBgCamSetting(CollisionContext* colCtx, WaterBox* waterBox);
|
||||
u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox);
|
||||
s32 func_80042708(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* point, Vec3f* closestPoint);
|
||||
s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec3f* pointB, Vec3f* closestPoint);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void BgCheck_DrawDynaCollision(PlayState*, CollisionContext*);
|
||||
void BgCheck_DrawStaticCollision(PlayState*, CollisionContext*);
|
||||
#endif
|
||||
@@ -661,7 +661,7 @@ s32 func_8005B198(void);
|
||||
s16 Camera_SetFinishedFlag(Camera* camera);
|
||||
DamageTable* DamageTable_Get(s32 index);
|
||||
void DamageTable_Clear(DamageTable* table);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void Collider_DrawRedPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC);
|
||||
void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC, u8 r, u8 g, u8 b);
|
||||
#endif
|
||||
@@ -712,7 +712,7 @@ void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colCh
|
||||
void CollisionCheck_ClearContext(PlayState* play, CollisionCheckContext* colChkCtx);
|
||||
void CollisionCheck_EnableSAC(PlayState* play, CollisionCheckContext* colChkCtx);
|
||||
void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void Collider_Draw(PlayState* play, Collider* col);
|
||||
void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChkCtx);
|
||||
#endif
|
||||
@@ -757,9 +757,7 @@ s32 func_800635D0(s32);
|
||||
void Regs_Init(void);
|
||||
void DebugCamera_ScreenText(u8 x, u8 y, const char* text); // ENABLE_NO_CLIP
|
||||
void DebugCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text); // ENABLE_CAMERA_DEBUGGER
|
||||
#if OOT_DEBUG
|
||||
void Regs_UpdateEditor(Input* input); // ENABLE_REG_EDITOR
|
||||
#endif
|
||||
void Debug_DrawText(GraphicsContext* gfxCtx); // ENABLE_CAMERA_DEBUGGER || ENABLE_REG_EDITOR
|
||||
void DebugDisplay_Init(void);
|
||||
DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX,
|
||||
@@ -912,7 +910,7 @@ void ZeldaArena_Check(void);
|
||||
void ZeldaArena_Init(void* start, u32 size);
|
||||
void ZeldaArena_Cleanup(void);
|
||||
u8 ZeldaArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action);
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
@@ -1189,7 +1187,7 @@ s32 View_ApplyOrthoToOverlay(View* view);
|
||||
s32 View_ApplyPerspectiveToOverlay(View* view);
|
||||
s32 View_UpdateViewingMatrix(View* view);
|
||||
s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ);
|
||||
#endif
|
||||
void ViMode_LogPrint(OSViMode* osViMode);
|
||||
@@ -1302,7 +1300,8 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf,
|
||||
void PreRender_Init(PreRender* this);
|
||||
void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf);
|
||||
void PreRender_Destroy(PreRender* this);
|
||||
#if ENABLE_PAUSE_BG_AA
|
||||
|
||||
// ENABLE_PAUSE_BG_AA
|
||||
void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a);
|
||||
void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave);
|
||||
void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP);
|
||||
@@ -1314,7 +1313,7 @@ void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP);
|
||||
void PreRender_ApplyFilters(PreRender* this);
|
||||
void GameState_SetFBFilter(Gfx** gfxP);
|
||||
#endif
|
||||
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx);
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx);
|
||||
void GameState_ReqPadData(GameState* gameState);
|
||||
@@ -1325,7 +1324,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
void GameState_Destroy(GameState* gameState);
|
||||
GameStateFunc GameState_GetInit(GameState* gameState);
|
||||
u32 GameState_IsRunning(GameState* gameState);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line);
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line);
|
||||
#endif
|
||||
@@ -1342,7 +1341,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState);
|
||||
void Graph_ThreadEntry(void*);
|
||||
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size);
|
||||
void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line);
|
||||
void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line);
|
||||
#endif
|
||||
@@ -1446,7 +1445,7 @@ void Matrix_RotateZYX(s16 x, s16 y, s16 z, u8 mode);
|
||||
void Matrix_TranslateRotateZYX(Vec3f* translation, Vec3s* rotation);
|
||||
void Matrix_SetTranslateRotateYXZ(f32 translateX, f32 translateY, f32 translateZ, Vec3s* rot);
|
||||
Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line);
|
||||
Mtx* Matrix_NewMtx(GraphicsContext* gfxCtx, char* file, s32 line);
|
||||
#else
|
||||
@@ -1462,7 +1461,7 @@ void Matrix_ReplaceRotation(MtxF* mf);
|
||||
void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
||||
void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
||||
void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode);
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line);
|
||||
#endif
|
||||
void Matrix_SetTranslateScaleMtx2(Mtx* mtx, f32 scaleX, f32 scaleY, f32 scaleZ, f32 translateX, f32 translateY,
|
||||
@@ -1484,14 +1483,16 @@ void DebugArena_Check(void);
|
||||
void DebugArena_Init(void* start, u32 size);
|
||||
void DebugArena_Cleanup(void);
|
||||
u8 DebugArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action); // IS_DEBUG_HEAP_ENABLED
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void DebugArena_Display(void);
|
||||
#endif
|
||||
void DebugArena_Display(void);
|
||||
|
||||
void UCodeDisas_Init(UCodeDisas*);
|
||||
void UCodeDisas_Destroy(UCodeDisas*);
|
||||
void UCodeDisas_Disassemble(UCodeDisas*, Gfx*);
|
||||
@@ -1786,13 +1787,15 @@ void SystemArena_Check(void);
|
||||
void SystemArena_Init(void* start, u32 size);
|
||||
void SystemArena_Cleanup(void);
|
||||
u8 SystemArena_IsInitialized(void);
|
||||
#if OOT_DEBUG
|
||||
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, s32 line);
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line);
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line);
|
||||
void SystemArena_Display(void);
|
||||
#endif
|
||||
void SystemArena_Display(void); // IS_SPEEDMETER_ENABLED
|
||||
|
||||
u32 Rand_Next(void);
|
||||
void Rand_Seed(u32 seed);
|
||||
f32 Rand_ZeroOne(void);
|
||||
@@ -1811,13 +1814,14 @@ void __osFree(Arena* arena, void* ptr);
|
||||
void* __osRealloc(Arena* arena, void* ptr, u32 newSize);
|
||||
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc);
|
||||
u32 __osCheckArena(Arena* arena);
|
||||
#if OOT_DEBUG
|
||||
|
||||
// debug
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line);
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line);
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line);
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line);
|
||||
void __osDisplayArena(Arena* arena);
|
||||
#endif
|
||||
|
||||
s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args);
|
||||
s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...);
|
||||
void Sleep_Cycles(OSTime cycles);
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
// ensure that these do not use the IDO workaround to avoid errors.
|
||||
#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !PERMUTER && !M2CTX)
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
#define PRINTF osSyncPrintf
|
||||
#elif IDO_PRINTF_WORKAROUND
|
||||
#define PRINTF(args) (void)0
|
||||
@@ -124,7 +124,7 @@
|
||||
#define PRINTF(format, ...) (void)0
|
||||
#endif
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
#define LOG(exp, value, format, file, line) \
|
||||
do { \
|
||||
LogUtils_LogThreadId(file, line); \
|
||||
@@ -170,7 +170,7 @@ extern struct GraphicsContext* __gfxCtx;
|
||||
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
|
||||
#define OVERLAY_DISP __gfxCtx->overlay.p
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
|
||||
// __gfxCtx shouldn't be used directly.
|
||||
// Use the DISP macros defined above when writing to display buffers.
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
#ifndef MEMPAK_H
|
||||
#define MEMPAK_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if ENABLE_MEMPAK
|
||||
|
||||
#include "ultra64.h"
|
||||
|
||||
s32 Mempak_Init(s32 controllerNum);
|
||||
@@ -23,5 +19,3 @@ s32 Mempak_GetFileSize(s32 controllerNum, char letter);
|
||||
#define MEMPAK_INDEX_TO_LETTER(i) ((i) + 'A')
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct {
|
||||
#define VIEW_FORCE_PROJECTION_PERSPECTIVE (VIEW_PROJECTION_PERSPECTIVE << 4)
|
||||
#define VIEW_FORCE_PROJECTION_ORTHO (VIEW_PROJECTION_ORTHO << 4)
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
#define VIEW_ERROR_CHECK_EYE_POS(x, y, z) View_ErrorCheckEyePosition((x), (y), (z))
|
||||
#else
|
||||
#define VIEW_ERROR_CHECK_EYE_POS(x, y, z) (void)0
|
||||
|
||||
2
spec
2
spec
@@ -2,7 +2,7 @@
|
||||
* ROM spec file
|
||||
*/
|
||||
|
||||
//#include "config.h"
|
||||
#include "include/config.h"
|
||||
|
||||
beginseg
|
||||
name "makerom"
|
||||
|
||||
@@ -21,7 +21,7 @@ void bootproc(void) {
|
||||
|
||||
gCartHandle = osCartRomInit();
|
||||
osDriveRomInit();
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
isPrintfInit();
|
||||
#endif
|
||||
Locale_Init();
|
||||
|
||||
@@ -5,7 +5,7 @@ OSPiHandle* sISVHandle; // official name : is_Handle
|
||||
#define gISVDbgPrnAdrs ((ISVDbg*)0xB3FF0000)
|
||||
#define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0)))
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void isPrintfInit(void) {
|
||||
sISVHandle = osCartRomInit();
|
||||
osEPiWriteIo(sISVHandle, (u32)&gISVDbgPrnAdrs->put, 0);
|
||||
@@ -18,7 +18,7 @@ void osSyncPrintfUnused(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
_Printf(is_proutSyncPrintf, NULL, fmt, args);
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,7 @@ void osSyncPrintf(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
_Printf(is_proutSyncPrintf, NULL, fmt, args);
|
||||
#endif
|
||||
|
||||
@@ -41,14 +41,14 @@ void rmonPrintf(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
_Printf(is_proutSyncPrintf, NULL, fmt, args);
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void* is_proutSyncPrintf(void* arg, const char* str, size_t count) {
|
||||
u32 data;
|
||||
s32 pos;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min,
|
||||
const char* maxName, f32 max) {
|
||||
if (value < min || max < value) {
|
||||
|
||||
@@ -102,7 +102,7 @@ u32 StackCheck_GetState(StackEntry* entry) {
|
||||
entry->name != NULL ? entry->name : "(null)");
|
||||
PRINTF(VT_RST);
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
if (ret != STACK_STATUS_OK) {
|
||||
LogUtils_LogHexDump(entry->head, (uintptr_t)entry->tail - (uintptr_t)entry->head);
|
||||
}
|
||||
|
||||
@@ -777,31 +777,30 @@ void PreRender_DivotFilter(PreRender* this) {
|
||||
* Applies the Video Interface anti-aliasing filter and (optionally) the divot filter to `this->fbufSave` using
|
||||
* `this->cvgSave`
|
||||
*/
|
||||
#if ENABLE_PAUSE_BG_AA
|
||||
|
||||
void PreRender_ApplyFilters(PreRender* this) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
if (ENABLE_PAUSE_BG_AA) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
|
||||
if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) {
|
||||
// Apply AA filter
|
||||
for (y = 0; y < this->height; y++) {
|
||||
for (x = 0; x < this->width; x++) {
|
||||
s32 cvg = this->cvgSave[x + y * this->width];
|
||||
if ((this->cvgSave != NULL) && (this->fbufSave != NULL)) {
|
||||
// Apply AA filter
|
||||
for (y = 0; y < this->height; y++) {
|
||||
for (x = 0; x < this->width; x++) {
|
||||
s32 cvg = this->cvgSave[x + y * this->width];
|
||||
|
||||
cvg >>= 5;
|
||||
cvg++;
|
||||
if (cvg != 8) {
|
||||
// If this pixel has only partial coverage, perform the Video Filter interpolation on it
|
||||
PreRender_AntiAliasFilter(this, x, y);
|
||||
cvg >>= 5;
|
||||
cvg++;
|
||||
if (cvg != 8) {
|
||||
// If this pixel has only partial coverage, perform the Video Filter interpolation on it
|
||||
PreRender_AntiAliasFilter(this, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
// Apply divot filter
|
||||
PreRender_DivotFilter(this);
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
// Apply divot filter
|
||||
PreRender_DivotFilter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -229,133 +229,142 @@ u8 __osMallocIsInitialized(Arena* arena) {
|
||||
return arena->isInit;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) {
|
||||
ArenaNode* node2 = node;
|
||||
u32* start;
|
||||
u32* end;
|
||||
u32* iter;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
ArenaNode* node2 = node;
|
||||
u32* start;
|
||||
u32* end;
|
||||
u32* iter;
|
||||
|
||||
if (__osMalloc_FreeBlockTest_Enable) {
|
||||
start = (u32*)((u32)node + sizeof(ArenaNode));
|
||||
end = (u32*)((u32)start + node2->size);
|
||||
iter = start;
|
||||
if (__osMalloc_FreeBlockTest_Enable) {
|
||||
start = (u32*)((u32)node + sizeof(ArenaNode));
|
||||
end = (u32*)((u32)start + node2->size);
|
||||
iter = start;
|
||||
|
||||
while (iter < end) {
|
||||
if (*iter != BLOCK_UNINIT_MAGIC_32 && *iter != BLOCK_FREE_MAGIC_32) {
|
||||
osSyncPrintf(
|
||||
VT_COL(RED, WHITE) "緊急事態!メモリリーク検出! (block=%08x s=%08x e=%08x p=%08x)\n" VT_RST, node,
|
||||
start, end, iter);
|
||||
__osDisplayArena(arena);
|
||||
return;
|
||||
while (iter < end) {
|
||||
if (*iter != BLOCK_UNINIT_MAGIC_32 && *iter != BLOCK_FREE_MAGIC_32) {
|
||||
osSyncPrintf(
|
||||
VT_COL(RED, WHITE) "緊急事態!メモリリーク検出! (block=%08x s=%08x e=%08x p=%08x)\n" VT_RST, node,
|
||||
start, end, iter);
|
||||
__osDisplayArena(arena);
|
||||
return;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
ArenaNode* iter;
|
||||
u32 blockSize;
|
||||
ArenaNode* newNode;
|
||||
void* alloc = NULL;
|
||||
ArenaNode* next;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
ArenaNode* iter;
|
||||
u32 blockSize;
|
||||
ArenaNode* newNode;
|
||||
void* alloc = NULL;
|
||||
ArenaNode* next;
|
||||
|
||||
iter = arena->head;
|
||||
size = ALIGN16(size);
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
iter = arena->head;
|
||||
size = ALIGN16(size);
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + blockSize);
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = iter->size - blockSize;
|
||||
newNode->isFree = true;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + blockSize);
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = iter->size - blockSize;
|
||||
newNode->isFree = true;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size = size;
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
iter->next = newNode;
|
||||
iter->size = size;
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
iter->isFree = false;
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
FILL_ALLOC_BLOCK(arena, alloc, size);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
iter->isFree = false;
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
FILL_ALLOC_BLOCK(arena, alloc, size);
|
||||
|
||||
break;
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
}
|
||||
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
return alloc;
|
||||
}
|
||||
|
||||
return alloc;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
void* alloc;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
void* alloc;
|
||||
|
||||
ArenaImpl_Lock(arena);
|
||||
alloc = __osMalloc_NoLockDebug(arena, size, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
ArenaImpl_Lock(arena);
|
||||
alloc = __osMalloc_NoLockDebug(arena, size, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return alloc;
|
||||
return alloc;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* newNode;
|
||||
u32 blockSize;
|
||||
ArenaNode* next;
|
||||
void* allocR = NULL;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* newNode;
|
||||
u32 blockSize;
|
||||
ArenaNode* next;
|
||||
void* allocR = NULL;
|
||||
|
||||
size = ALIGN16(size);
|
||||
ArenaImpl_Lock(arena);
|
||||
iter = ArenaImpl_GetLastBlock(arena);
|
||||
size = ALIGN16(size);
|
||||
ArenaImpl_Lock(arena);
|
||||
iter = ArenaImpl_GetLastBlock(arena);
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = size;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = size;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size -= blockSize;
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
iter->next = newNode;
|
||||
iter->size -= blockSize;
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
iter = newNode;
|
||||
}
|
||||
iter = newNode;
|
||||
|
||||
iter->isFree = false;
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
allocR = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
FILL_ALLOC_BLOCK(arena, allocR, size);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
iter->isFree = false;
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
allocR = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
FILL_ALLOC_BLOCK(arena, allocR, size);
|
||||
|
||||
break;
|
||||
iter = NODE_GET_PREV(iter);
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
iter = NODE_GET_PREV(iter);
|
||||
return allocR;
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return allocR;
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* __osMalloc_NoLock(Arena* arena, u32 size) {
|
||||
ArenaNode* iter;
|
||||
@@ -527,71 +536,73 @@ void __osFree(Arena* arena, void* ptr) {
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
||||
ArenaNode* node;
|
||||
ArenaNode* next;
|
||||
ArenaNode* prev;
|
||||
ArenaNode* newNext;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
ArenaNode* node;
|
||||
ArenaNode* next;
|
||||
ArenaNode* prev;
|
||||
ArenaNode* newNext;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
|
||||
if (node == NULL || node->magic != NODE_MAGIC) {
|
||||
// "__osFree: Unauthorized release (%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
return;
|
||||
}
|
||||
if (node->isFree) {
|
||||
// "__osFree: Double release (%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:二重解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
return;
|
||||
}
|
||||
if (arena != node->arena && arena != NULL) {
|
||||
// "__osFree:Tried to release in a different way than when it was secured (%08x:%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
return;
|
||||
}
|
||||
|
||||
next = NODE_GET_NEXT(node);
|
||||
prev = NODE_GET_PREV(node);
|
||||
node->isFree = true;
|
||||
SET_DEBUG_INFO(node, file, line, arena);
|
||||
|
||||
FILL_FREE_BLOCK_CONTENTS(arena, node);
|
||||
|
||||
newNext = node->next;
|
||||
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
|
||||
newNext = NODE_GET_NEXT(next);
|
||||
if (newNext != NULL) {
|
||||
newNext->prev = node;
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
node->size += next->size + sizeof(ArenaNode);
|
||||
FILL_FREE_BLOCK_HEADER(arena, next);
|
||||
node->next = newNext;
|
||||
next = newNext;
|
||||
}
|
||||
|
||||
if (prev != NULL && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) {
|
||||
if (next != NULL) {
|
||||
next->prev = prev;
|
||||
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
|
||||
if (node == NULL || node->magic != NODE_MAGIC) {
|
||||
// "__osFree: Unauthorized release (%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
return;
|
||||
}
|
||||
if (node->isFree) {
|
||||
// "__osFree: Double release (%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:二重解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
return;
|
||||
}
|
||||
if (arena != node->arena && arena != NULL) {
|
||||
// "__osFree:Tried to release in a different way than when it was secured (%08x:%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
return;
|
||||
}
|
||||
|
||||
next = NODE_GET_NEXT(node);
|
||||
prev = NODE_GET_PREV(node);
|
||||
node->isFree = true;
|
||||
SET_DEBUG_INFO(node, file, line, arena);
|
||||
|
||||
FILL_FREE_BLOCK_CONTENTS(arena, node);
|
||||
|
||||
newNext = node->next;
|
||||
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
|
||||
newNext = NODE_GET_NEXT(next);
|
||||
if (newNext != NULL) {
|
||||
newNext->prev = node;
|
||||
}
|
||||
|
||||
node->size += next->size + sizeof(ArenaNode);
|
||||
FILL_FREE_BLOCK_HEADER(arena, next);
|
||||
node->next = newNext;
|
||||
next = newNext;
|
||||
}
|
||||
|
||||
if (prev != NULL && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) {
|
||||
if (next != NULL) {
|
||||
next->prev = prev;
|
||||
}
|
||||
prev->next = next;
|
||||
prev->size += node->size + sizeof(ArenaNode);
|
||||
FILL_FREE_BLOCK_HEADER(arena, node);
|
||||
}
|
||||
prev->next = next;
|
||||
prev->size += node->size + sizeof(ArenaNode);
|
||||
FILL_FREE_BLOCK_HEADER(arena, node);
|
||||
}
|
||||
}
|
||||
|
||||
void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
||||
ArenaImpl_Lock(arena);
|
||||
__osFree_NoLockDebug(arena, ptr, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
ArenaImpl_Lock(arena);
|
||||
__osFree_NoLockDebug(arena, ptr, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
||||
ArenaNode* node;
|
||||
@@ -694,11 +705,12 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
return __osRealloc(arena, ptr, newSize);
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
return __osRealloc(arena, ptr, newSize);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaNode* iter;
|
||||
@@ -726,70 +738,70 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osDisplayArena(Arena* arena) {
|
||||
u32 freeSize;
|
||||
u32 allocatedSize;
|
||||
u32 maxFree;
|
||||
ArenaNode* iter;
|
||||
ArenaNode* next;
|
||||
if (OOT_DEBUG && !DISABLE_DEBUG_FEATURES) {
|
||||
u32 freeSize;
|
||||
u32 allocatedSize;
|
||||
u32 maxFree;
|
||||
ArenaNode* iter;
|
||||
ArenaNode* next;
|
||||
|
||||
if (!__osMallocIsInitialized(arena)) {
|
||||
osSyncPrintf("アリーナは初期化されていません\n"); // "Arena is not initialized"
|
||||
return;
|
||||
}
|
||||
if (!__osMallocIsInitialized(arena)) {
|
||||
osSyncPrintf("アリーナは初期化されていません\n"); // "Arena is not initialized"
|
||||
return;
|
||||
}
|
||||
|
||||
ArenaImpl_Lock(arena);
|
||||
ArenaImpl_Lock(arena);
|
||||
|
||||
maxFree = 0;
|
||||
freeSize = 0;
|
||||
allocatedSize = 0;
|
||||
maxFree = 0;
|
||||
freeSize = 0;
|
||||
allocatedSize = 0;
|
||||
|
||||
osSyncPrintf("アリーナの内容 (0x%08x)\n", arena); // "Arena contents (0x%08x)"
|
||||
// "Memory node range status size [time s ms us ns: TID: src: line]"
|
||||
osSyncPrintf("メモリブロック範囲 status サイズ [時刻 s ms us ns: TID:src:行]\n");
|
||||
osSyncPrintf("アリーナの内容 (0x%08x)\n", arena); // "Arena contents (0x%08x)"
|
||||
// "Memory node range status size [time s ms us ns: TID: src: line]"
|
||||
osSyncPrintf("メモリブロック範囲 status サイズ [時刻 s ms us ns: TID:src:行]\n");
|
||||
|
||||
iter = arena->head;
|
||||
while (iter != NULL) {
|
||||
if (iter != NULL && iter->magic == NODE_MAGIC) {
|
||||
next = iter->next;
|
||||
osSyncPrintf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size),
|
||||
(next == NULL) ? '$' : (iter != next->prev ? '!' : ' '),
|
||||
iter->isFree ? "空き" : "確保", //? "Free" : "Secure"
|
||||
iter->size);
|
||||
iter = arena->head;
|
||||
while (iter != NULL) {
|
||||
if (iter != NULL && iter->magic == NODE_MAGIC) {
|
||||
next = iter->next;
|
||||
osSyncPrintf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size),
|
||||
(next == NULL) ? '$' : (iter != next->prev ? '!' : ' '),
|
||||
iter->isFree ? "空き" : "確保", //? "Free" : "Secure"
|
||||
iter->size);
|
||||
|
||||
if (!iter->isFree) {
|
||||
osSyncPrintf(" [%016llu:%2d:%s:%d]", OS_CYCLES_TO_NSEC(iter->time), iter->threadId,
|
||||
iter->filename != NULL ? iter->filename : "**NULL**", iter->line);
|
||||
}
|
||||
if (!iter->isFree) {
|
||||
osSyncPrintf(" [%016llu:%2d:%s:%d]", OS_CYCLES_TO_NSEC(iter->time), iter->threadId,
|
||||
iter->filename != NULL ? iter->filename : "**NULL**", iter->line);
|
||||
}
|
||||
|
||||
osSyncPrintf("\n");
|
||||
osSyncPrintf("\n");
|
||||
|
||||
if (iter->isFree) {
|
||||
freeSize += iter->size;
|
||||
if (maxFree < iter->size) {
|
||||
maxFree = iter->size;
|
||||
if (iter->isFree) {
|
||||
freeSize += iter->size;
|
||||
if (maxFree < iter->size) {
|
||||
maxFree = iter->size;
|
||||
}
|
||||
} else {
|
||||
allocatedSize += iter->size;
|
||||
}
|
||||
} else {
|
||||
allocatedSize += iter->size;
|
||||
osSyncPrintf("%08x Block Invalid\n", iter);
|
||||
next = NULL;
|
||||
}
|
||||
} else {
|
||||
osSyncPrintf("%08x Block Invalid\n", iter);
|
||||
next = NULL;
|
||||
iter = next;
|
||||
}
|
||||
iter = next;
|
||||
|
||||
// "Total reserved node size 0x%08x bytes"
|
||||
osSyncPrintf("確保ブロックサイズの合計 0x%08x バイト\n", allocatedSize);
|
||||
// "Total free node size 0x%08x bytes"
|
||||
osSyncPrintf("空きブロックサイズの合計 0x%08x バイト\n", freeSize);
|
||||
// "Maximum free node size 0x%08x bytes"
|
||||
osSyncPrintf("最大空きブロックサイズ 0x%08x バイト\n", maxFree);
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
// "Total reserved node size 0x%08x bytes"
|
||||
osSyncPrintf("確保ブロックサイズの合計 0x%08x バイト\n", allocatedSize);
|
||||
// "Total free node size 0x%08x bytes"
|
||||
osSyncPrintf("空きブロックサイズの合計 0x%08x バイト\n", freeSize);
|
||||
// "Maximum free node size 0x%08x bytes"
|
||||
osSyncPrintf("最大空きブロックサイズ 0x%08x バイト\n", maxFree);
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ArenaImpl_FaultClient(Arena* arena) {
|
||||
u32 freeSize;
|
||||
|
||||
@@ -97,13 +97,13 @@ void* DebugArena_Calloc(u32 num, u32 size) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void DebugArena_Display(void) {
|
||||
// "Zelda heap display" ("Zelda" should probably have been changed to "Debug")
|
||||
PRINTF("ゼルダヒープ表示\n");
|
||||
__osDisplayArena(&sDebugArena);
|
||||
if (IS_DEBUG_HEAP_ENABLED) {
|
||||
// "Zelda heap display" ("Zelda" should probably have been changed to "Debug")
|
||||
PRINTF("ゼルダヒープ表示\n");
|
||||
__osDisplayArena(&sDebugArena);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaImpl_GetSizes(&sDebugArena, outMaxFree, outFree, outAlloc);
|
||||
|
||||
@@ -100,7 +100,10 @@ void func_800C4344(GameState* gameState) {
|
||||
gDmaMgrVerbose = HREG(60);
|
||||
gDmaMgrDmaBuffSize = SREG(21) != 0 ? ALIGN16(SREG(21)) : DMAMGR_DEFAULT_BUFSIZE;
|
||||
gSystemArenaLogSeverity = HREG(61);
|
||||
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
gZeldaArenaLogSeverity = HREG(62);
|
||||
#endif
|
||||
|
||||
if (R_HREG_MODE == HREG_MODE_PRINT_MEMORY) {
|
||||
if (R_PRINT_MEMORY_INIT != HREG_MODE_PRINT_MEMORY) {
|
||||
@@ -113,7 +116,9 @@ void func_800C4344(GameState* gameState) {
|
||||
if (R_PRINT_MEMORY_TRIGGER < 0) {
|
||||
R_PRINT_MEMORY_TRIGGER = 0;
|
||||
hexDumpSize = (u32)(R_PRINT_MEMORY_SIZE == 0 ? 0x100 : R_PRINT_MEMORY_SIZE * 0x10);
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
LogUtils_LogHexDump((void*)(0x80000000 + (R_PRINT_MEMORY_ADDR << 8)), hexDumpSize);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -399,9 +404,9 @@ void GameState_Realloc(GameState* gameState, size_t size) {
|
||||
THA_Init(&gameState->tha, NULL, 0);
|
||||
PRINTF("ハイラル再確保失敗\n"); // "Failure to secure Hyral"
|
||||
|
||||
#if OOT_DEBUG
|
||||
SystemArena_Display();
|
||||
#endif
|
||||
if (IS_SPEEDMETER_ENABLED) {
|
||||
SystemArena_Display();
|
||||
}
|
||||
HUNGUP_AND_CRASH("../game.c", 1044);
|
||||
}
|
||||
}
|
||||
@@ -490,10 +495,10 @@ void GameState_Destroy(GameState* gameState) {
|
||||
THA_Destroy(&gameState->tha);
|
||||
GameAlloc_Cleanup(&gameState->alloc);
|
||||
|
||||
#if OOT_DEBUG
|
||||
SystemArena_Display();
|
||||
Fault_RemoveClient(&sGameFaultClient);
|
||||
#endif
|
||||
if (IS_SPEEDMETER_ENABLED) {
|
||||
SystemArena_Display();
|
||||
Fault_RemoveClient(&sGameFaultClient);
|
||||
}
|
||||
|
||||
PRINTF("game デストラクタ終了\n"); // "game destructor end"
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ void GameAlloc_Log(GameAlloc* this) {
|
||||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line);
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
||||
osStopTimer(&timer);
|
||||
|
||||
if (msg == (OSMesg)666) {
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
PRINTF("RCPが帰ってきませんでした。"); // "RCP did not return."
|
||||
PRINTF(VT_RST);
|
||||
@@ -327,7 +327,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 1028);
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
if (R_HREG_MODE == HREG_MODE_PLAY && R_PLAY_ENABLE_UCODE_DISAS == 2) {
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_TOGGLE = -1;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_MEMPAK
|
||||
|
||||
/**
|
||||
* @file mempak.c
|
||||
*
|
||||
@@ -276,5 +272,3 @@ s32 Mempak_GetFileSize(s32 controllerNum, char letter) {
|
||||
}
|
||||
return state.file_size;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -603,7 +603,7 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
|
||||
return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest);
|
||||
@@ -969,7 +969,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) {
|
||||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
#if OOT_DEBUG && !DISABLE_DEBUG_FEATURES
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) {
|
||||
s32 i, j;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user