mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Animation system updated, some more boot files decompiled (+6%), z_fcurve_data_skelanime decompiled (1 non-matching), some asm files split, etc (#89)
* Progress on various files * gfxprint stuff * split some rodata, add iconv for rodata string parsing * z_std_dma rodata * 2 nonmatchings in gfxprint * mtxuty-cvt ok * more * match a function in idle.c * progress * Cleanup * Rename BgPolygon to CollisionPoly * progress * some effect stuff * more effect progress * updates * made suggested changes * z_effect_soft_sprite_old_init mostly ok * remove old effects enum * gamealloc.c OK * added more files * motor.c almost done * motor.c OK * updates * migration of two files * listalloc.c oK * z_fcurve_data_skelanime split * z_fcurve_data_skelanime.c decompiled * more files split * z_malloc.c OK * contpfs.c OK * fault.c rodata migrated * migrated fault_drawer rodata * update * update preprocess.py * renamed functions in z_skelanime * started z_skelanime cleanup * like halfway through fixing z_skelanime * animation system updated to meet oot standards * remove unused animation structs * rename matrix structs to fit oot * Add -woff 712 * fix diff_settings.py because i accidentally broke it before * fixed merge conflict, doesn't match though * It matches now * Updates * Fixed warnings...added gcc code syntax checking * Remove gcc check, added in Tharo's PR * warnings fixed (i think) * fixed all warnings i think * ok * not sure what to do * Fix all warnings i think (z_en_a_keep needs some file cleanup thouguh) * it matches if i do this * remove comment * accidentally put osPfsFreeBlocks in epilinkhandle.c * memcmp -> bcmp * change u32 size to size_t size, delete string.h because it caused unnecessary confusion with defining size_t twice * format.sh * MTXMODE_NEW and MTXMODE_APPLY to matrix functions * Made suggested changes * pragma sFaultDrawerFont instead of including in repo * add some functions to functions.h * Bss reordering fixed in z_collision_check...added hack to disasm.py * Updated z_en_a_keep.c * Missed suggestion in EnAObj_Destroy * . * update z_fcurve_Data_skelanime and z_skelanime with suggestions * devmgr.c ok * minor changes * Addressed comments * remove redundant file * gfxp -> dlist in game.c * updated actorfixer.py * fixed warnings in z_malloc * Change void* back to Actor* * format * Add the soft_sprit comments back * Rename SV->Flex * remove .common * run format * Update src/code/z_skelanime.c * u32 channel Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com> Co-authored-by: angie <angheloalf95@gmail.com> Co-authored-by: Kenix3 <kenixwhisperwind@gmail.com>
This commit is contained in:
co-authored by
Lucas Shaw
angie
Kenix3
parent
961913f18f
commit
dcf44596d2
@@ -17,7 +17,7 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf,
|
||||
|
||||
void PreRender_Init(PreRender* this) {
|
||||
bzero(this, sizeof(PreRender));
|
||||
func_80174AA0(&this->alloc);
|
||||
ListAlloc_Init(&this->alloc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, voi
|
||||
}
|
||||
|
||||
void PreRender_Destroy(PreRender* this) {
|
||||
func_80174BA0(&this->alloc);
|
||||
ListAlloc_FreeAll(&this->alloc);
|
||||
}
|
||||
|
||||
void func_8016FDB8(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 arg4) {
|
||||
|
||||
@@ -12,7 +12,7 @@ void* THA_GetTail(TwoHeadArena* tha) {
|
||||
return tha->tail;
|
||||
}
|
||||
|
||||
void* THA_AllocStart(TwoHeadArena* tha, u32 size) {
|
||||
void* THA_AllocStart(TwoHeadArena* tha, size_t size) {
|
||||
void* start = tha->head;
|
||||
|
||||
tha->head = (u32)tha->head + size;
|
||||
@@ -23,7 +23,7 @@ void* THA_AllocStart1(TwoHeadArena* tha) {
|
||||
return THA_AllocStart(tha, 1);
|
||||
}
|
||||
|
||||
void* THA_AllocEnd(TwoHeadArena* tha, u32 size) {
|
||||
void* THA_AllocEnd(TwoHeadArena* tha, size_t size) {
|
||||
u32 mask;
|
||||
|
||||
if (size >= 0x10) {
|
||||
@@ -42,14 +42,14 @@ void* THA_AllocEnd(TwoHeadArena* tha, u32 size) {
|
||||
return tha->tail;
|
||||
}
|
||||
|
||||
void* THA_AllocEndAlign16(TwoHeadArena* tha, u32 size) {
|
||||
void* THA_AllocEndAlign16(TwoHeadArena* tha, size_t size) {
|
||||
u32 mask = ~0xF;
|
||||
|
||||
tha->tail = (((u32)tha->tail & mask) - size) & mask;
|
||||
return tha->tail;
|
||||
}
|
||||
|
||||
void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask) {
|
||||
void* THA_AllocEndAlign(TwoHeadArena* tha, size_t size, u32 mask) {
|
||||
tha->tail = (((u32)tha->tail & mask) - size) & mask;
|
||||
return tha->tail;
|
||||
}
|
||||
@@ -67,7 +67,7 @@ void THA_Init(TwoHeadArena* tha) {
|
||||
tha->tail = (u32)tha->bufp + tha->size;
|
||||
}
|
||||
|
||||
void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size) {
|
||||
void THA_Ct(TwoHeadArena* tha, void* ptr, size_t size) {
|
||||
bzero(tha, sizeof(TwoHeadArena));
|
||||
tha->bufp = ptr;
|
||||
tha->size = size;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "global.h"
|
||||
|
||||
void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size) {
|
||||
void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, size_t size) {
|
||||
THA_Ct((TwoHeadArena*)thga, start, size);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga) {
|
||||
return THGA_AllocStart8(thga);
|
||||
}
|
||||
|
||||
Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size) {
|
||||
Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, size_t size) {
|
||||
return THA_AllocEnd((TwoHeadArena*)thga, size);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F23E0/func_800F23E0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800F23E0/func_800F2478.s")
|
||||
@@ -1,5 +0,0 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80122660/func_80122660.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80122660/func_80122670.s")
|
||||
+91
-90
@@ -22,7 +22,7 @@ void Game_SetFramerateDivisor(GameState* gameState, s32 divisor) {
|
||||
}
|
||||
|
||||
void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
||||
Gfx* _gfx = *gfx;
|
||||
Gfx* dlist = *gfx;
|
||||
|
||||
if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) {
|
||||
D_801F8010.type = R_FB_FILTER_TYPE;
|
||||
@@ -30,7 +30,7 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
||||
D_801F8010.color.g = R_FB_FILTER_PRIM_COLOR(1);
|
||||
D_801F8010.color.b = R_FB_FILTER_PRIM_COLOR(2);
|
||||
D_801F8010.color.a = R_FB_FILTER_A;
|
||||
func_80140D10(&D_801F8010, &_gfx, arg1);
|
||||
func_80140D10(&D_801F8010, &dlist, arg1);
|
||||
} else {
|
||||
if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) {
|
||||
D_801F8020.useRgba = (R_FB_FILTER_TYPE == 6);
|
||||
@@ -42,7 +42,7 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
||||
D_801F8020.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
D_801F8020.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
D_801F8020.envColor.a = R_FB_FILTER_A;
|
||||
func_80142100(&D_801F8020, &_gfx, arg1);
|
||||
func_80142100(&D_801F8020, &dlist, arg1);
|
||||
} else {
|
||||
if (R_FB_FILTER_TYPE == 7) {
|
||||
sMonoColors.unk_00 = 0;
|
||||
@@ -54,27 +54,24 @@ void GameState_SetFBFilter(Gfx** gfx, u32 arg1) {
|
||||
sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1);
|
||||
sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2);
|
||||
sMonoColors.envColor.a = R_FB_FILTER_A;
|
||||
VisMono_Draw(&sMonoColors, &_gfx, arg1);
|
||||
VisMono_Draw(&sMonoColors, &dlist, arg1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*gfx = _gfx;
|
||||
*gfx = dlist;
|
||||
}
|
||||
|
||||
void Game_Nop80173534(GameState* gamestate) {
|
||||
;
|
||||
void Game_Nop80173534(GameState* gameState) {
|
||||
}
|
||||
|
||||
void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx) {
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
||||
Gfx* nextDisplayList;
|
||||
Gfx* polyOpa;
|
||||
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
polyOpa = POLY_OPA_DISP;
|
||||
nextDisplayList = Graph_GfxPlusOne(POLY_OPA_DISP);
|
||||
|
||||
nextDisplayList = Graph_GfxPlusOne(polyOpa = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
|
||||
|
||||
if (R_FB_FILTER_TYPE && R_FB_FILTER_ENV_COLOR(3) == 0) {
|
||||
@@ -98,119 +95,123 @@ void GameState_Draw(GameState* gamestate, GraphicsContext* gfxCtx) {
|
||||
|
||||
if (R_ENABLE_ARENA_DBG != 0) {
|
||||
SpeedMeter_DrawTimeEntries(&D_801F7FF0, gfxCtx);
|
||||
SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, gamestate);
|
||||
SpeedMeter_DrawAllocEntries(&D_801F7FF0, gfxCtx, gameState);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void Game_ResetSegments(GraphicsContext* gfxCtx) {
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0, 0);
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 0, 0);
|
||||
gSPSegment(gfxCtx->polyXlu.p++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(gfxCtx->overlay.p++, 0, 0);
|
||||
gSPSegment(gfxCtx->overlay.p++, 0xF, gfxCtx->framebuffer);
|
||||
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) {
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(POLY_XLU_DISP++, 0, NULL);
|
||||
gSPSegment(POLY_XLU_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
gSPSegment(OVERLAY_DISP++, 0, NULL);
|
||||
gSPSegment(OVERLAY_DISP++, 0xF, gfxCtx->framebuffer);
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void func_801736DC(GraphicsContext* gfxCtx) {
|
||||
Gfx* nextDisplayList;
|
||||
Gfx* _polyOpa;
|
||||
Gfx* polyOpa;
|
||||
|
||||
nextDisplayList = Graph_GfxPlusOne(_polyOpa = gfxCtx->polyOpa.p);
|
||||
gSPDisplayList(gfxCtx->overlay.p++, nextDisplayList);
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
nextDisplayList = Graph_GfxPlusOne(polyOpa = gfxCtx->polyOpa.p);
|
||||
gSPDisplayList(OVERLAY_DISP++, nextDisplayList);
|
||||
gSPEndDisplayList(nextDisplayList++);
|
||||
Graph_BranchDlist(_polyOpa, nextDisplayList);
|
||||
Graph_BranchDlist(polyOpa, nextDisplayList);
|
||||
|
||||
gfxCtx->polyOpa.p = nextDisplayList;
|
||||
POLY_OPA_DISP = nextDisplayList;
|
||||
|
||||
CLOSE_DISPS(gfxCtx);
|
||||
}
|
||||
|
||||
void Game_UpdateInput(GameState* gamestate) {
|
||||
Padmgr_GetInput(gamestate->input, 1);
|
||||
void Game_UpdateInput(GameState* gameState) {
|
||||
Padmgr_GetInput(gameState->input, 1);
|
||||
}
|
||||
|
||||
void Game_Update(GameState* gamestate) {
|
||||
GraphicsContext* _gCtx;
|
||||
_gCtx = gamestate->gfxCtx;
|
||||
void Game_Update(GameState* gameState) {
|
||||
GraphicsContext* gfxCtx = gameState->gfxCtx;
|
||||
|
||||
Game_ResetSegments(gamestate->gfxCtx);
|
||||
GameState_SetFrameBuffer(gameState->gfxCtx);
|
||||
|
||||
gamestate->main(gamestate);
|
||||
gameState->main(gameState);
|
||||
|
||||
if (R_PAUSE_MENU_MODE != 2) {
|
||||
GameState_Draw(gamestate, _gCtx);
|
||||
func_801736DC(_gCtx);
|
||||
GameState_Draw(gameState, gfxCtx);
|
||||
func_801736DC(gfxCtx);
|
||||
}
|
||||
}
|
||||
|
||||
void Game_IncrementFrameCount(GameState* gamestate) {
|
||||
Game_Nop80173534(gamestate);
|
||||
gamestate->frames++;
|
||||
void Game_IncrementFrameCount(GameState* gameState) {
|
||||
Game_Nop80173534(gameState);
|
||||
gameState->frames++;
|
||||
}
|
||||
|
||||
void Game_InitHeap(GameState* gamestate, u32 size) {
|
||||
GameState* _ctx;
|
||||
void* buf;
|
||||
|
||||
_ctx = gamestate;
|
||||
buf = Gamealloc_Alloc(&_ctx->alloc, size);
|
||||
void GameState_InitArena(GameState* gameState, size_t size) {
|
||||
GameAlloc* alloc = &gameState->alloc;
|
||||
void* buf = GameAlloc_Malloc(alloc, size);
|
||||
|
||||
if (buf) {
|
||||
THA_Ct(&gamestate->heap, buf, size);
|
||||
THA_Ct(&gameState->heap, buf, size);
|
||||
return;
|
||||
}
|
||||
|
||||
THA_Ct(&gamestate->heap, NULL, 0);
|
||||
__assert("../game.c", 0x40B);
|
||||
THA_Ct(&gameState->heap, NULL, 0);
|
||||
__assert("../game.c", 1035);
|
||||
}
|
||||
|
||||
void Game_ResizeHeap(GameState* gamestate, u32 size) {
|
||||
void GameState_Realloc(GameState* gameState, size_t size) {
|
||||
GameAlloc* alloc;
|
||||
void* buf;
|
||||
u32 systemMaxFree;
|
||||
u32 bytesFree;
|
||||
u32 bytesAllocated;
|
||||
void* gameArena;
|
||||
size_t systemMaxFree;
|
||||
size_t bytesFree;
|
||||
size_t bytesAllocated;
|
||||
void* heapStart;
|
||||
|
||||
heapStart = gamestate->heap.bufp;
|
||||
alloc = &gamestate->alloc;
|
||||
THA_Dt(&gamestate->heap);
|
||||
Gamealloc_Free(alloc, heapStart);
|
||||
heapStart = gameState->heap.bufp;
|
||||
alloc = &gameState->alloc;
|
||||
THA_Dt(&gameState->heap);
|
||||
GameAlloc_Free(alloc, heapStart);
|
||||
SystemArena_AnalyzeArena(&systemMaxFree, &bytesFree, &bytesAllocated);
|
||||
size = ((systemMaxFree - (sizeof(ArenaNode))) < size) ? (0) : (size);
|
||||
if (!size) {
|
||||
if (size == 0) {
|
||||
size = systemMaxFree - (sizeof(ArenaNode));
|
||||
}
|
||||
|
||||
if ((buf = Gamealloc_Alloc(alloc, size)) != NULL) {
|
||||
THA_Ct(&gamestate->heap, buf, size);
|
||||
if ((gameArena = GameAlloc_Malloc(alloc, size)) != NULL) {
|
||||
THA_Ct(&gameState->heap, gameArena, size);
|
||||
} else {
|
||||
THA_Ct(&gamestate->heap, 0, 0);
|
||||
__assert("../game.c", 0x432);
|
||||
THA_Ct(&gameState->heap, 0, 0);
|
||||
__assert("../game.c", 1074);
|
||||
}
|
||||
}
|
||||
|
||||
void Game_StateInit(GameState* gamestate, GameStateFunc gameStateInit, GraphicsContext* gfxCtx) {
|
||||
gamestate->gfxCtx = gfxCtx;
|
||||
gamestate->frames = 0U;
|
||||
gamestate->main = NULL;
|
||||
gamestate->destroy = NULL;
|
||||
gamestate->running = 1;
|
||||
gfxCtx->unk274 = D_801FBB88;
|
||||
void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* gfxCtx) {
|
||||
gameState->gfxCtx = gfxCtx;
|
||||
gameState->frames = 0U;
|
||||
gameState->main = NULL;
|
||||
gameState->destroy = NULL;
|
||||
gameState->running = 1;
|
||||
gfxCtx->viMode = D_801FBB88;
|
||||
gfxCtx->viConfigFeatures = gViConfigFeatures;
|
||||
gfxCtx->viConfigXScale = gViConfigXScale;
|
||||
gfxCtx->viConfigYScale = gViConfigYScale;
|
||||
gamestate->nextGameStateInit = NULL;
|
||||
gamestate->nextGameStateSize = 0U;
|
||||
gameState->nextGameStateInit = NULL;
|
||||
gameState->nextGameStateSize = 0U;
|
||||
|
||||
{
|
||||
s32 requiredScopeTemp;
|
||||
|
||||
Gamealloc_Init(&gamestate->alloc);
|
||||
Game_InitHeap(gamestate, 0x100000);
|
||||
Game_SetFramerateDivisor(gamestate, 3);
|
||||
GameAlloc_Init(&gameState->alloc);
|
||||
GameState_InitArena(gameState, 0x100000);
|
||||
Game_SetFramerateDivisor(gameState, 3);
|
||||
|
||||
gameStateInit(gamestate);
|
||||
init(gameState);
|
||||
|
||||
func_80140CE0(&D_801F8010);
|
||||
func_801420C0(&D_801F8020);
|
||||
@@ -219,17 +220,17 @@ void Game_StateInit(GameState* gamestate, GameStateFunc gameStateInit, GraphicsC
|
||||
func_801773A0(&D_801F7FF0);
|
||||
func_8013ED9C();
|
||||
|
||||
osSendMesg(&gamestate->gfxCtx->unk5C, NULL, 1);
|
||||
osSendMesg(&gameState->gfxCtx->unk5C, NULL, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void Game_StateFini(GameState* gamestate) {
|
||||
void GameState_Destroy(GameState* gameState) {
|
||||
func_80172BC0();
|
||||
func_8019E014();
|
||||
osRecvMesg(&gamestate->gfxCtx->unk5C, 0, 1);
|
||||
osRecvMesg(&gameState->gfxCtx->unk5C, NULL, OS_MESG_BLOCK);
|
||||
|
||||
if (gamestate->destroy != 0) {
|
||||
gamestate->destroy(gamestate);
|
||||
if (gameState->destroy != NULL) {
|
||||
gameState->destroy(gameState);
|
||||
}
|
||||
|
||||
func_8013EDD0();
|
||||
@@ -238,28 +239,28 @@ void Game_StateFini(GameState* gamestate) {
|
||||
func_801420F4(&D_801F8020);
|
||||
func_80141900(&sMonoColors);
|
||||
func_80140900(&D_801F8048);
|
||||
THA_Dt(&gamestate->heap);
|
||||
Gamealloc_FreeAll(&gamestate->alloc);
|
||||
THA_Dt(&gameState->heap);
|
||||
GameAlloc_Cleanup(&gameState->alloc);
|
||||
}
|
||||
|
||||
GameStateFunc Game_GetNextStateInit(GameState* gamestate) {
|
||||
return gamestate->nextGameStateInit;
|
||||
GameStateFunc GameState_GetNextStateInit(GameState* gameState) {
|
||||
return gameState->nextGameStateInit;
|
||||
}
|
||||
|
||||
u32 Game_GetNextStateSize(GameState* gamestate) {
|
||||
return gamestate->nextGameStateSize;
|
||||
size_t Game_GetNextStateSize(GameState* gameState) {
|
||||
return gameState->nextGameStateSize;
|
||||
}
|
||||
|
||||
u32 Game_GetShouldContinue(GameState* gamestate) {
|
||||
return gamestate->running;
|
||||
u32 GameState_IsRunning(GameState* gameState) {
|
||||
return gameState->running;
|
||||
}
|
||||
|
||||
s32 Game_GetHeapFreeSize(GameState* gamestate) {
|
||||
return THA_GetSize(&gamestate->heap);
|
||||
s32 GameState_GetArenaSize(GameState* gameState) {
|
||||
return THA_GetSize(&gameState->heap);
|
||||
}
|
||||
|
||||
s32 func_80173B48(GameState* gamestate) {
|
||||
s32 result;
|
||||
result = OS_CYCLES_TO_NSEC(gamestate->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
|
||||
s32 func_80173B48(GameState* gameState) {
|
||||
s32 result = OS_CYCLES_TO_NSEC(gameState->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(D_801FBAF0);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+53
-5
@@ -1,11 +1,59 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/func_80173BF0.s")
|
||||
void GameAlloc_Log(GameAlloc* this) {
|
||||
GameAllocEntry* iter;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Alloc.s")
|
||||
iter = this->base.next;
|
||||
while (iter != &this->base) {
|
||||
iter = iter->next;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Free.s")
|
||||
void* GameAlloc_Malloc(GameAlloc* this, size_t size) {
|
||||
GameAllocEntry* ptr = SystemArena_Malloc(size + sizeof(GameAllocEntry));
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_FreeAll.s")
|
||||
if (ptr != NULL) {
|
||||
ptr->size = size;
|
||||
ptr->prev = this->head;
|
||||
this->head->next = ptr;
|
||||
this->head = ptr;
|
||||
ptr->next = &this->base;
|
||||
this->base.prev = this->head;
|
||||
return ptr + 1;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/gamealloc/Gamealloc_Init.s")
|
||||
void GameAlloc_Free(GameAlloc* this, void* data) {
|
||||
GameAllocEntry* ptr;
|
||||
|
||||
if (data != NULL) {
|
||||
ptr = &((GameAllocEntry*)data)[-1];
|
||||
ptr->prev->next = ptr->next;
|
||||
ptr->next->prev = ptr->prev;
|
||||
this->head = this->base.prev;
|
||||
SystemArena_Free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void GameAlloc_Cleanup(GameAlloc* this) {
|
||||
GameAllocEntry* next = this->base.next;
|
||||
GameAllocEntry* cur;
|
||||
|
||||
while (&this->base != next) {
|
||||
cur = next;
|
||||
next = next->next;
|
||||
SystemArena_Free(cur);
|
||||
}
|
||||
|
||||
this->head = &this->base;
|
||||
this->base.next = &this->base;
|
||||
this->base.prev = &this->base;
|
||||
}
|
||||
|
||||
void GameAlloc_Init(GameAlloc* this) {
|
||||
this->head = &this->base;
|
||||
this->base.next = &this->base;
|
||||
this->base.prev = &this->base;
|
||||
}
|
||||
|
||||
+57
-4
@@ -1,9 +1,62 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174AA0.s")
|
||||
ListAlloc* ListAlloc_Init(ListAlloc* this) {
|
||||
this->prev = NULL;
|
||||
this->next = NULL;
|
||||
return this;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174AB4.s")
|
||||
void* ListAlloc_Alloc(ListAlloc* this, size_t size) {
|
||||
ListAlloc* ptr = SystemArena_Malloc(size + sizeof(ListAlloc));
|
||||
ListAlloc* next;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174B20.s")
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/listalloc/func_80174BA0.s")
|
||||
next = this->next;
|
||||
if (next != NULL) {
|
||||
next->next = ptr;
|
||||
}
|
||||
|
||||
ptr->prev = next;
|
||||
ptr->next = NULL;
|
||||
this->next = ptr;
|
||||
|
||||
if (this->prev == NULL) {
|
||||
this->prev = ptr;
|
||||
}
|
||||
|
||||
return (u8*)ptr + sizeof(ListAlloc);
|
||||
}
|
||||
|
||||
void ListAlloc_Free(ListAlloc* this, void* data) {
|
||||
ListAlloc* ptr = &((ListAlloc*)data)[-1];
|
||||
|
||||
if (ptr->prev != NULL) {
|
||||
ptr->prev->next = ptr->next;
|
||||
}
|
||||
|
||||
if (ptr->next != NULL) {
|
||||
ptr->next->prev = ptr->prev;
|
||||
}
|
||||
|
||||
if (this->prev == ptr) {
|
||||
this->prev = ptr->next;
|
||||
}
|
||||
|
||||
if (this->next == ptr) {
|
||||
this->next = ptr->prev;
|
||||
}
|
||||
|
||||
SystemArena_Free(ptr);
|
||||
}
|
||||
|
||||
void ListAlloc_FreeAll(ListAlloc* this) {
|
||||
ListAlloc* iter = this->prev;
|
||||
|
||||
while (iter != NULL) {
|
||||
ListAlloc_Free(this, (u8*)iter + sizeof(ListAlloc));
|
||||
iter = this->prev;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-11
@@ -28,36 +28,36 @@ void Main(void* arg) {
|
||||
|
||||
R_ENABLE_ARENA_DBG = 0;
|
||||
|
||||
osCreateMesgQueue(&siEventCallbackQueue, siEventCallbackBuffer, ARRAY_COUNT(siEventCallbackBuffer));
|
||||
osSetEventMesg(OS_EVENT_SI, &siEventCallbackQueue, NULL);
|
||||
osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, ARRAY_COUNT(sSiIntMsgBuf));
|
||||
osSetEventMesg(OS_EVENT_SI, &sSiIntMsgQ, NULL);
|
||||
|
||||
osCreateMesgQueue(&mainIrqmgrCallbackQueue, mainIrqCallbackBuffer, ARRAY_COUNT(mainIrqCallbackBuffer));
|
||||
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
|
||||
|
||||
StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched");
|
||||
Sched_Init(&gSchedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
|
||||
|
||||
CIC6105_AddRomInfoFaultPage();
|
||||
|
||||
IrqMgr_AddClient(&gIrqMgr, &mainIrqmgrCallbackNode, &mainIrqmgrCallbackQueue);
|
||||
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
|
||||
|
||||
StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio");
|
||||
AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
|
||||
|
||||
StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr");
|
||||
Padmgr_Start(&siEventCallbackQueue, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
|
||||
PadMgr_Init(&sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
|
||||
|
||||
AudioMgr_Unlock(&audioContext);
|
||||
|
||||
StackCheck_Init(&graphStackEntry, graphStack, graphStack + sizeof(graphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&graphOSThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, graphStack + sizeof(graphStack),
|
||||
StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack + sizeof(sGraphStack), 0, 0x100, "graph");
|
||||
osCreateThread(&sGraphThread, Z_THREAD_ID_GRAPH, Graph_ThreadEntry, arg, sGraphStack + sizeof(sGraphStack),
|
||||
Z_PRIORITY_GRAPH);
|
||||
osStartThread(&graphOSThread);
|
||||
osStartThread(&sGraphThread);
|
||||
|
||||
exit = false;
|
||||
|
||||
while (!exit) {
|
||||
msg = NULL;
|
||||
osRecvMesg(&mainIrqmgrCallbackQueue, (OSMesg)&msg, OS_MESG_BLOCK);
|
||||
osRecvMesg(&irqMgrMsgQ, (OSMesg)&msg, OS_MESG_BLOCK);
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
}
|
||||
@@ -72,6 +72,6 @@ void Main(void* arg) {
|
||||
}
|
||||
}
|
||||
|
||||
IrqMgr_RemoveClient(&gIrqMgr, &mainIrqmgrCallbackNode);
|
||||
osDestroyThread(&graphOSThread);
|
||||
IrqMgr_RemoveClient(&gIrqMgr, &irqClient);
|
||||
osDestroyThread(&sGraphThread);
|
||||
}
|
||||
|
||||
+1
-1
@@ -54,4 +54,4 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_ThreadEntry.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/Padmgr_Start.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_Init.s")
|
||||
|
||||
+34
-34
@@ -1,92 +1,92 @@
|
||||
#include "global.h"
|
||||
|
||||
void SysMatrix_StateAlloc(GameState* gamestate) {
|
||||
sMatrixStack = (MtxF*)THA_AllocEndAlign16(&gamestate->heap, 0x500);
|
||||
void Matrix_StateAlloc(GameState* gameState) {
|
||||
sMatrixStack = (MtxF*)THA_AllocEndAlign16(&gameState->heap, 0x500);
|
||||
sCurrentMatrix = sMatrixStack;
|
||||
}
|
||||
|
||||
void SysMatrix_StatePush(void) {
|
||||
void Matrix_StatePush(void) {
|
||||
MtxF* prev = sCurrentMatrix;
|
||||
|
||||
sCurrentMatrix++;
|
||||
Matrix_MtxFCopy(sCurrentMatrix, prev);
|
||||
}
|
||||
|
||||
void SysMatrix_StatePop(void) {
|
||||
void Matrix_StatePop(void) {
|
||||
sCurrentMatrix--;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_CopyCurrentState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetCurrentState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetCurrentState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetCurrentState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertMatrix.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertMatrix.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertTranslation.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertTranslation.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_Scale.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_s.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertXRotation_s.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_f.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertXRotation_f.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_RotateStateAroundXAxis.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_RotateStateAroundXAxis.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetStateXRotation.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetStateXRotation.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_RotateY.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertYRotation_f.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertYRotation_f.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_s.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertZRotation_s.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_f.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertZRotation_f.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotation.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotation.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_RotateAndTranslateState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_JointPosition.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_SetStateRotationAndTranslation.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_SetStateRotationAndTranslation.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_ToRSPMatrix.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_ToRSPMatrix.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateAsRSPMatrix.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_ToMtx.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_NewMtx.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_AppendToPolyOpaDisp.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_AppendToPolyOpaDisp.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fByState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslation.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslation.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledX.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledX.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledY.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledY.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledZ.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_GetStateTranslationAndScaledZ.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fXZByCurrentState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fXZByCurrentState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MtxFCopy.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_FromRSPMatrix.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_FromRSPMatrix.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByMatrix.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_MultiplyVector3fByMatrix.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_TransposeXYZ.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_TransposeXYZ.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_NormalizeXYZ.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_NormalizeXYZ.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_8018219C.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_801822C4.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_f.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_f.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_s.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/Matrix_InsertRotationAroundUnitVector_s.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_matrix/func_80182C90.s")
|
||||
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
#include "global.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/DLF_LoadGameState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_LoadGameState.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/DLF_FreeGameState.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_DLF/Overlay_FreeGameState.s")
|
||||
|
||||
+3
-3
@@ -53,7 +53,7 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gf
|
||||
}
|
||||
|
||||
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
|
||||
SysMatrix_SetCurrentState(&mtx);
|
||||
Matrix_SetCurrentState(&mtx);
|
||||
|
||||
if (dlist != D_04076BC0) {
|
||||
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
|
||||
@@ -117,7 +117,7 @@ void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3,
|
||||
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
|
||||
arg6 *= (4.5f - (light->l.dir[1] * 0.035f));
|
||||
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
|
||||
SysMatrix_SetCurrentState(arg2);
|
||||
Matrix_SetCurrentState(arg2);
|
||||
Matrix_RotateY(sp58, MTXMODE_APPLY);
|
||||
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
|
||||
|
||||
@@ -744,7 +744,7 @@ void Actor_FreeOverlay(ActorOverlay* entry) {
|
||||
if ((entry->allocType & 1) != 0) {
|
||||
entry->loadedRamAddr = NULL;
|
||||
} else {
|
||||
zelda_free(ramAddr);
|
||||
ZeldaArena_Free(ramAddr);
|
||||
entry->loadedRamAddr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ void* ActorOverlayTable_FaultAddrConv(void* arg0, void* arg1) {
|
||||
s32 i;
|
||||
u8* ramStart;
|
||||
u8* ramEnd;
|
||||
u32 size;
|
||||
size_t size;
|
||||
u32 offset;
|
||||
|
||||
for (i = 0; i < gMaxActorId; i++, overlayEntry++) {
|
||||
|
||||
@@ -327,7 +327,7 @@ s32 Collider_FreeJntSph(GlobalContext* globalCtx, ColliderJntSph* collider) {
|
||||
|
||||
collider->count = 0;
|
||||
if (collider->elements != NULL) {
|
||||
zelda_free(collider->elements);
|
||||
ZeldaArena_Free(collider->elements);
|
||||
}
|
||||
collider->elements = NULL;
|
||||
return 1;
|
||||
@@ -359,7 +359,7 @@ s32 Collider_SetJntSphToActor(GlobalContext* globalCtx, ColliderJntSph* collider
|
||||
|
||||
Collider_SetBaseToActor(globalCtx, &collider->base, &src->base);
|
||||
collider->count = src->count;
|
||||
collider->elements = zelda_malloc(src->count * sizeof(ColliderJntSphElement));
|
||||
collider->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement));
|
||||
|
||||
if (collider->elements == NULL) {
|
||||
collider->count = 0;
|
||||
@@ -385,7 +385,7 @@ s32 Collider_SetJntSphAllocType1(GlobalContext* globalCtx, ColliderJntSph* spher
|
||||
|
||||
Collider_SetBaseType1(globalCtx, &sphereGroup->base, actor, &src->base);
|
||||
sphereGroup->count = src->count;
|
||||
sphereGroup->elements = zelda_malloc(src->count * sizeof(ColliderJntSphElement));
|
||||
sphereGroup->elements = ZeldaArena_Malloc(src->count * sizeof(ColliderJntSphElement));
|
||||
|
||||
if (sphereGroup->elements == NULL) {
|
||||
sphereGroup->count = 0;
|
||||
@@ -681,7 +681,7 @@ s32 Collider_FreeTris(GlobalContext* globalCtx, ColliderTris* tris) {
|
||||
|
||||
tris->count = 0;
|
||||
if (tris->elements != NULL) {
|
||||
zelda_free(tris->elements);
|
||||
ZeldaArena_Free(tris->elements);
|
||||
}
|
||||
tris->elements = NULL;
|
||||
|
||||
@@ -714,7 +714,7 @@ s32 Collider_SetTrisAllocType1(GlobalContext* globalCtx, ColliderTris* tris, Act
|
||||
|
||||
Collider_SetBaseType1(globalCtx, &tris->base, actor, &src->base);
|
||||
tris->count = src->count;
|
||||
tris->elements = zelda_malloc(tris->count * sizeof(ColliderTrisElement));
|
||||
tris->elements = ZeldaArena_Malloc(tris->count * sizeof(ColliderTrisElement));
|
||||
|
||||
if (tris->elements == NULL) {
|
||||
tris->count = 0;
|
||||
@@ -3691,7 +3691,7 @@ void Collider_UpdateSpheres(s32 limb, ColliderJntSph* collider) {
|
||||
D_801EE1C0.x = collider->elements[i].dim.modelSphere.center.x;
|
||||
D_801EE1C0.y = collider->elements[i].dim.modelSphere.center.y;
|
||||
D_801EE1C0.z = collider->elements[i].dim.modelSphere.center.z;
|
||||
SysMatrix_MultiplyVector3fByState(&D_801EE1C0, &D_801EE1D0);
|
||||
Matrix_MultiplyVector3fByState(&D_801EE1C0, &D_801EE1D0);
|
||||
collider->elements[i].dim.worldSphere.center.x = D_801EE1D0.x;
|
||||
collider->elements[i].dim.worldSphere.center.y = D_801EE1D0.y;
|
||||
collider->elements[i].dim.worldSphere.center.z = D_801EE1D0.z;
|
||||
@@ -3733,7 +3733,7 @@ void Collider_UpdateSphere(s32 limb, ColliderSphere* collider) {
|
||||
D_801EE1E0.x = collider->dim.modelSphere.center.x;
|
||||
D_801EE1E0.y = collider->dim.modelSphere.center.y;
|
||||
D_801EE1E0.z = collider->dim.modelSphere.center.z;
|
||||
SysMatrix_MultiplyVector3fByState(&D_801EE1E0, &D_801EE1F0);
|
||||
Matrix_MultiplyVector3fByState(&D_801EE1E0, &D_801EE1F0);
|
||||
collider->dim.worldSphere.center.x = D_801EE1F0.x;
|
||||
collider->dim.worldSphere.center.y = D_801EE1F0.y;
|
||||
collider->dim.worldSphere.center.z = D_801EE1F0.z;
|
||||
|
||||
@@ -106,8 +106,8 @@ void EffFootmark_Draw(GlobalContext* globalCtx) {
|
||||
|
||||
for (footmark = globalCtx->footprintInfo, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
SysMatrix_SetCurrentState(&footmark->displayMatrix);
|
||||
Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
|
||||
Matrix_SetCurrentState(&footmark->displayMatrix);
|
||||
Matrix_Scale(footmark->size * (1.0f / 0x100) * 0.7f, 1, footmark->size * (1.0f / 0x100), MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ void EffectSS_Clear(GlobalContext* globalCtx) {
|
||||
for (i = 0; i < EFFECT_SS_MAX; i++) {
|
||||
addr = overlay->loadedRamAddr;
|
||||
if (addr != NULL) {
|
||||
zelda_free(addr);
|
||||
ZeldaArena_Free(addr);
|
||||
}
|
||||
|
||||
overlay->loadedRamAddr = 0;
|
||||
@@ -175,7 +175,7 @@ void EffectSs_Spawn(GlobalContext* globalCtx, s32 type, s32 priority, void* init
|
||||
initInfo = entry->initInfo;
|
||||
} else {
|
||||
if (entry->loadedRamAddr == NULL) {
|
||||
entry->loadedRamAddr = zelda_mallocR(overlaySize);
|
||||
entry->loadedRamAddr = ZeldaArena_MallocR(overlaySize);
|
||||
|
||||
if (entry->loadedRamAddr == NULL) {
|
||||
return;
|
||||
|
||||
@@ -403,7 +403,7 @@ void EffectSsGSpk_SpawnSmall(GlobalContext* globalCtx, Actor* actor, Vec3f* pos,
|
||||
|
||||
// EffectSsDFire Spawn Functions
|
||||
void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 scale, s16 scaleStep,
|
||||
s16 alpha, s16 fadeDelay, s16 life, s32 arg9) {
|
||||
s16 alpha, s16 fadeDelay, s16 arg8, s32 life) {
|
||||
EffectSsDFireInitParams initParams;
|
||||
|
||||
Math_Vec3f_Copy(&initParams.pos, pos);
|
||||
@@ -413,8 +413,8 @@ void EffectSsDFire_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
|
||||
initParams.scaleStep = scaleStep;
|
||||
initParams.alpha = alpha;
|
||||
initParams.fadeDelay = fadeDelay;
|
||||
initParams.unk_2C = arg8;
|
||||
initParams.life = life;
|
||||
initParams.unk_30 = arg9;
|
||||
|
||||
EffectSs_Spawn(globalCtx, EFFECT_SS_D_FIRE, 128, &initParams);
|
||||
}
|
||||
@@ -535,8 +535,8 @@ void EffectSsDtBubble_SpawnCustomColor(GlobalContext* globalCtx, Vec3f* pos, Vec
|
||||
/**
|
||||
* Spawn a single fragment
|
||||
*
|
||||
* Notes:
|
||||
* - if a display list is not provided, D_0400C0D0 (wilted deku fragment) will be used as default
|
||||
* * Notes:
|
||||
* - if a display list is not provided, an unknown default will be used as default
|
||||
* - the unused arg does not do anything, any value can be passed here
|
||||
* - due to how life is implemented it is capped at 200. Any value over 200 is accepted, but the fragment will
|
||||
* only live for 200 frames
|
||||
@@ -960,6 +960,7 @@ void EffectSsExtra_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity,
|
||||
}
|
||||
|
||||
// EffectSsDeadDb Spawn Functions
|
||||
|
||||
void EffectSsDeadDb_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, Color_RGBA8* prim,
|
||||
Color_RGBA8* env, s16 scale, s16 scaleStep, s32 unk) {
|
||||
EffectSsDeadDbInitParams initParams;
|
||||
|
||||
+40
-31
@@ -1,48 +1,57 @@
|
||||
#include "global.h"
|
||||
|
||||
void EnAObj_Init(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
ActorEnAObj* s0 = (ActorEnAObj*)this;
|
||||
s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
|
||||
s0->base.params = (s0->base.params & 0xFF) - 9;
|
||||
Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar);
|
||||
ActorShape_Init(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
|
||||
Collider_InitAndSetCylinder(globalCtx, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
|
||||
Collider_UpdateCylinder((Actor*)s0, &s0->collision);
|
||||
s0->base.colChkInfo.mass = 255;
|
||||
s0->update = (ActorFunc)EnAObj_Update1;
|
||||
#define THIS ((EnAObj*)thisx)
|
||||
|
||||
void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx);
|
||||
void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx);
|
||||
|
||||
void EnAObj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnAObj* this = THIS;
|
||||
|
||||
this->actor.textId = ((this->actor.params >> 8) & 0xFF) | 0x300;
|
||||
this->actor.params = (this->actor.params & 0xFF) - 9;
|
||||
Actor_ProcessInitChain(&this->actor, &enAObjInitVar);
|
||||
ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 12);
|
||||
Collider_InitAndSetCylinder(globalCtx, &this->collision, &this->actor, &enAObjCylinderInit);
|
||||
Collider_UpdateCylinder(&this->actor, &this->collision);
|
||||
this->actor.colChkInfo.mass = 255;
|
||||
this->actionFunc = EnAObj_Update1;
|
||||
}
|
||||
|
||||
void EnAObj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
ColliderCylinder* a2 = &this->collision;
|
||||
Collider_DestroyCylinder(globalCtx, a2);
|
||||
void EnAObj_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnAObj* this = THIS;
|
||||
|
||||
Collider_DestroyCylinder(globalCtx, &this->collision);
|
||||
}
|
||||
|
||||
void EnAObj_Update1(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
s16 v0;
|
||||
s32 v1;
|
||||
if (func_800B84D0((Actor*)this, globalCtx) != 0) {
|
||||
this->update = (ActorFunc)EnAObj_Update2;
|
||||
void EnAObj_Update1(EnAObj* this, GlobalContext* globalCtx) {
|
||||
s32 yawDiff;
|
||||
|
||||
if (func_800B84D0(&this->actor, globalCtx)) {
|
||||
this->actionFunc = EnAObj_Update2;
|
||||
} else {
|
||||
v0 = this->base.yawTowardsPlayer - this->base.shape.rot.y;
|
||||
v1 = (v0 < 0) ? -v0 : v0;
|
||||
if ((v1 < 10240) || ((this->base.params == 1) && (v1 > 22528))) {
|
||||
func_800B863C((Actor*)this, globalCtx);
|
||||
yawDiff = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
|
||||
|
||||
if ((yawDiff < 0x2800) || ((this->actor.params == 1) && (yawDiff > 0x5800))) {
|
||||
func_800B863C(&this->actor, globalCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EnAObj_Update2(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
if (func_800B867C((Actor*)this, globalCtx) != 0) {
|
||||
this->update = (ActorFunc)EnAObj_Update1;
|
||||
void EnAObj_Update2(EnAObj* this, GlobalContext* globalCtx) {
|
||||
if (func_800B867C(&this->actor, globalCtx)) {
|
||||
this->actionFunc = EnAObj_Update1;
|
||||
}
|
||||
}
|
||||
|
||||
void EnAObj_Update(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
(this->update)((Actor*)this, (GlobalContext*)globalCtx);
|
||||
Actor_SetHeight((Actor*)this, 45.0f);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, (Collider*)&this->collision);
|
||||
void EnAObj_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnAObj* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
Actor_SetHeight(&this->actor, 45.0f);
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collision.base);
|
||||
}
|
||||
|
||||
void EnAObj_Draw(ActorEnAObj* this, GlobalContext* globalCtx) {
|
||||
func_800BDFC0(globalCtx, enAObjDisplayLists[this->base.params]);
|
||||
void EnAObj_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_800BDFC0(globalCtx, enAObjDisplayLists[thisx->params]);
|
||||
}
|
||||
|
||||
@@ -660,7 +660,7 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->unk152 = -2;
|
||||
}
|
||||
} else {
|
||||
Matrix_Scale(16.0f, 16.0f, 16.0f, 1);
|
||||
Matrix_Scale(16.0f, 16.0f, 16.0f, MTXMODE_APPLY);
|
||||
GetItem_Draw(globalCtx, 8);
|
||||
}
|
||||
break;
|
||||
@@ -785,7 +785,7 @@ void EnItem00_DrawHeartContainer(EnItem00* actor, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
func_8012C2DC(globalCtx->state.gfxCtx);
|
||||
Matrix_Scale(20.0f, 20.0f, 20.0f, 1);
|
||||
Matrix_Scale(20.0f, 20.0f, 20.0f, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user