mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-12 19:04:38 +00:00
Merge branch 'main' into doc_pause_menu
This commit is contained in:
commit
740535129d
200 changed files with 28572 additions and 8184 deletions
|
@ -95,8 +95,8 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) {
|
|||
gSPTextureRectangle(gfx++, uls << 2, ult << 2, lrs << 2, lrt << 2, G_TX_RENDERTILE, uls << 5, ult << 5, 4 << 10,
|
||||
1 << 10);
|
||||
|
||||
rowsRemaining -= nRows;
|
||||
curRow += nRows;
|
||||
rowsRemaining -= nRows;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -140,7 +140,9 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) {
|
|||
s32 uly;
|
||||
|
||||
// Make sure that we don't load past the end of the source image
|
||||
nRows = MIN(rowsRemaining, nRows);
|
||||
if (nRows > rowsRemaining) {
|
||||
nRows = rowsRemaining;
|
||||
}
|
||||
|
||||
// Determine the upper and lower bounds of the rect to draw
|
||||
ult = this->ulySave + curRow;
|
||||
|
@ -156,8 +158,8 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) {
|
|||
gSPTextureRectangle(gfx++, this->ulx << 2, uly << 2, this->lrx << 2, (uly + nRows - 1) << 2, G_TX_RENDERTILE,
|
||||
this->ulxSave << 5, ult << 5, 4 << 10, 1 << 10);
|
||||
|
||||
rowsRemaining -= nRows;
|
||||
curRow += nRows;
|
||||
rowsRemaining -= nRows;
|
||||
}
|
||||
|
||||
// Reset the color image and scissor
|
||||
|
@ -226,8 +228,8 @@ void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r,
|
|||
gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5,
|
||||
ult << 5, 1 << 10, 1 << 10);
|
||||
|
||||
rowsRemaining -= nRows;
|
||||
curRow += nRows;
|
||||
rowsRemaining -= nRows;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -287,7 +289,9 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void*
|
|||
s32 lrt;
|
||||
|
||||
// Make sure that we don't load past the end of the source image
|
||||
nRows = MIN(rowsRemaining, nRows);
|
||||
if (nRows > rowsRemaining) {
|
||||
nRows = rowsRemaining;
|
||||
}
|
||||
|
||||
// Determine the upper and lower bounds of the rect to draw
|
||||
ult = curRow;
|
||||
|
@ -319,8 +323,8 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void*
|
|||
ult << 5, 1 << 10, 1 << 10);
|
||||
|
||||
// Update the number of rows remaining and index of the row being drawn
|
||||
rowsRemaining -= nRows;
|
||||
curRow += nRows;
|
||||
rowsRemaining -= nRows;
|
||||
}
|
||||
|
||||
// Reset the color image to the current framebuffer
|
||||
|
@ -477,8 +481,8 @@ void func_800C213C(PreRender* this, Gfx** gfxP) {
|
|||
gSPTextureRectangle(gfx++, uls << 2, ult << 2, (lrs + 1) << 2, (lrt + 1) << 2, G_TX_RENDERTILE, uls << 5,
|
||||
ult << 5, 1 << 10, 1 << 10);
|
||||
|
||||
rowsRemaining -= nRows;
|
||||
curRow += nRows;
|
||||
rowsRemaining -= nRows;
|
||||
}
|
||||
|
||||
gDPPipeSync(gfx++);
|
||||
|
@ -545,7 +549,7 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) {
|
|||
s32 buffB[5 * 3];
|
||||
s32 xi;
|
||||
s32 yi;
|
||||
s32 pad;
|
||||
s32 invCvg;
|
||||
s32 pmaxR;
|
||||
s32 pmaxG;
|
||||
s32 pmaxB;
|
||||
|
@ -583,10 +587,12 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) {
|
|||
buffCvg[i] = this->cvgSave[xi + yi * this->width] >> 5;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (buffCvg[7] == 7) {
|
||||
PRINTF("Error, should not be in here \n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
pmaxR = pminR = buffR[7];
|
||||
pmaxG = pminG = buffG[7];
|
||||
|
@ -658,9 +664,10 @@ void PreRender_AntiAliasFilter(PreRender* this, s32 x, s32 y) {
|
|||
// BackGround = (pMax + pMin) - (ForeGround) * 2
|
||||
|
||||
// OutputColor = cvg * ForeGround + (1.0 - cvg) * BackGround
|
||||
outR = buffR[7] + ((s32)((7 - buffCvg[7]) * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3);
|
||||
outG = buffG[7] + ((s32)((7 - buffCvg[7]) * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3);
|
||||
outB = buffB[7] + ((s32)((7 - buffCvg[7]) * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3);
|
||||
invCvg = 7 - buffCvg[7];
|
||||
outR = buffR[7] + ((s32)(invCvg * (pmaxR + pminR - (buffR[7] * 2)) + 4) >> 3);
|
||||
outG = buffG[7] + ((s32)(invCvg * (pmaxG + pminG - (buffG[7] * 2)) + 4) >> 3);
|
||||
outB = buffB[7] + ((s32)(invCvg * (pmaxB + pminB - (buffB[7] * 2)) + 4) >> 3);
|
||||
|
||||
pxOut.r = outR >> 3;
|
||||
pxOut.g = outG >> 3;
|
||||
|
@ -796,9 +803,11 @@ void PreRender_ApplyFilters(PreRender* this) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if ((R_HREG_MODE == HREG_MODE_PRERENDER ? R_PRERENDER_DIVOT_CONTROL : 0) != 0) {
|
||||
// Apply divot filter
|
||||
PreRender_DivotFilter(this);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "global.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#define FILL_ALLOCBLOCK (1 << 0)
|
||||
#define FILL_FREEBLOCK (1 << 1)
|
||||
#define CHECK_FREE_BLOCK (1 << 2)
|
||||
#define FILL_ALLOC_BLOCK_FLAG (1 << 0)
|
||||
#define FILL_FREE_BLOCK_FLAG (1 << 1)
|
||||
#define CHECK_FREE_BLOCK_FLAG (1 << 2)
|
||||
|
||||
#define NODE_MAGIC (0x7373)
|
||||
|
||||
|
@ -14,37 +14,90 @@
|
|||
#define BLOCK_FREE_MAGIC (0xEF)
|
||||
#define BLOCK_FREE_MAGIC_32 (0xEFEFEFEF)
|
||||
|
||||
#define NODE_IS_VALID(node) (((node) != NULL) && ((node)->magic == NODE_MAGIC))
|
||||
|
||||
#if OOT_DEBUG
|
||||
|
||||
#define NODE_GET_NEXT(node) ArenaImpl_GetNextBlock(node)
|
||||
#define NODE_GET_PREV(node) ArenaImpl_GetPrevBlock(node)
|
||||
|
||||
#define SET_DEBUG_INFO(node, file, line, arena) ArenaImpl_SetDebugInfo(node, file, line, arena)
|
||||
|
||||
#define FILL_ALLOC_BLOCK(arena, alloc, size) \
|
||||
if ((arena)->flag & FILL_ALLOC_BLOCK_FLAG) \
|
||||
__osMemset(alloc, BLOCK_ALLOC_MAGIC, size)
|
||||
|
||||
#define FILL_FREE_BLOCK_HEADER(arena, node) \
|
||||
if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \
|
||||
__osMemset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode))
|
||||
|
||||
#define FILL_FREE_BLOCK_CONTENTS(arena, node) \
|
||||
if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \
|
||||
__osMemset((void*)((u32)(node) + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, (node)->size)
|
||||
|
||||
#define CHECK_FREE_BLOCK(arena, node) \
|
||||
if ((arena)->flag & CHECK_FREE_BLOCK_FLAG) \
|
||||
__osMalloc_FreeBlockTest(arena, node)
|
||||
|
||||
#define CHECK_ALLOC_FAILURE(arena, ptr) (void)0
|
||||
|
||||
#else
|
||||
|
||||
#define NODE_GET_NEXT(node) (NODE_IS_VALID((node)->next) ? (node)->next : NULL)
|
||||
#define NODE_GET_PREV(node) (NODE_IS_VALID((node)->prev) ? (node)->prev : NULL)
|
||||
|
||||
#define SET_DEBUG_INFO(node, file, line, arena) (void)0
|
||||
#define FILL_ALLOC_BLOCK(arena, alloc, size) (void)0
|
||||
#define FILL_FREE_BLOCK_HEADER(arena, node) (void)0
|
||||
#define FILL_FREE_BLOCK_CONTENTS(arena, node) (void)0
|
||||
#define CHECK_FREE_BLOCK(arena, node) (void)0
|
||||
|
||||
// Number of allocation failures across all arenas.
|
||||
u32 sTotalAllocFailures = 0;
|
||||
|
||||
#define CHECK_ALLOC_FAILURE(arena, ptr) \
|
||||
do { \
|
||||
if ((ptr) == NULL) { \
|
||||
sTotalAllocFailures++; \
|
||||
(arena)->allocFailures++; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
OSMesg sArenaLockMsg;
|
||||
|
||||
#if OOT_DEBUG
|
||||
u32 __osMalloc_FreeBlockTest_Enable;
|
||||
|
||||
u32 ArenaImpl_GetFillAllocBlock(Arena* arena) {
|
||||
return (arena->flag & FILL_ALLOCBLOCK) != 0;
|
||||
return (arena->flag & FILL_ALLOC_BLOCK_FLAG) != 0;
|
||||
}
|
||||
u32 ArenaImpl_GetFillFreeBlock(Arena* arena) {
|
||||
return (arena->flag & FILL_FREEBLOCK) != 0;
|
||||
return (arena->flag & FILL_FREE_BLOCK_FLAG) != 0;
|
||||
}
|
||||
u32 ArenaImpl_GetCheckFreeBlock(Arena* arena) {
|
||||
return (arena->flag & CHECK_FREE_BLOCK) != 0;
|
||||
return (arena->flag & CHECK_FREE_BLOCK_FLAG) != 0;
|
||||
}
|
||||
|
||||
void ArenaImpl_SetFillAllocBlock(Arena* arena) {
|
||||
arena->flag |= FILL_ALLOCBLOCK;
|
||||
arena->flag |= FILL_ALLOC_BLOCK_FLAG;
|
||||
}
|
||||
void ArenaImpl_SetFillFreeBlock(Arena* arena) {
|
||||
arena->flag |= FILL_FREEBLOCK;
|
||||
arena->flag |= FILL_FREE_BLOCK_FLAG;
|
||||
}
|
||||
void ArenaImpl_SetCheckFreeBlock(Arena* arena) {
|
||||
arena->flag |= CHECK_FREE_BLOCK;
|
||||
arena->flag |= CHECK_FREE_BLOCK_FLAG;
|
||||
}
|
||||
|
||||
void ArenaImpl_UnsetFillAllocBlock(Arena* arena) {
|
||||
arena->flag &= ~FILL_ALLOCBLOCK;
|
||||
arena->flag &= ~FILL_ALLOC_BLOCK_FLAG;
|
||||
}
|
||||
void ArenaImpl_UnsetFillFreeBlock(Arena* arena) {
|
||||
arena->flag &= ~FILL_FREEBLOCK;
|
||||
arena->flag &= ~FILL_FREE_BLOCK_FLAG;
|
||||
}
|
||||
void ArenaImpl_UnsetCheckFreeBlock(Arena* arena) {
|
||||
arena->flag &= ~CHECK_FREE_BLOCK;
|
||||
arena->flag &= ~CHECK_FREE_BLOCK_FLAG;
|
||||
}
|
||||
|
||||
void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena) {
|
||||
|
@ -54,6 +107,7 @@ void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena*
|
|||
node->arena = arena;
|
||||
node->time = osGetTime();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ArenaImpl_LockInit(Arena* arena) {
|
||||
osCreateMesgQueue(&arena->lockQueue, &sArenaLockMsg, 1);
|
||||
|
@ -67,6 +121,7 @@ void ArenaImpl_Unlock(Arena* arena) {
|
|||
osRecvMesg(&arena->lockQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node) {
|
||||
ArenaNode* next = node->next;
|
||||
|
||||
|
@ -88,16 +143,17 @@ ArenaNode* ArenaImpl_GetPrevBlock(ArenaNode* node) {
|
|||
}
|
||||
return prev;
|
||||
}
|
||||
#endif
|
||||
|
||||
ArenaNode* ArenaImpl_GetLastBlock(Arena* arena) {
|
||||
ArenaNode* last = NULL;
|
||||
ArenaNode* iter;
|
||||
|
||||
if (arena != NULL && arena->head != NULL && arena->head->magic == NODE_MAGIC) {
|
||||
if (arena != NULL && NODE_IS_VALID(arena->head)) {
|
||||
iter = arena->head;
|
||||
while (iter != NULL) {
|
||||
last = iter;
|
||||
iter = ArenaImpl_GetNextBlock(iter);
|
||||
iter = NODE_GET_NEXT(last);
|
||||
}
|
||||
}
|
||||
return last;
|
||||
|
@ -122,7 +178,9 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) {
|
|||
size2 = (size - diff) & ~0xF;
|
||||
|
||||
if (size2 > (s32)sizeof(ArenaNode)) {
|
||||
#if OOT_DEBUG
|
||||
__osMemset(firstNode, BLOCK_UNINIT_MAGIC, size2);
|
||||
#endif
|
||||
firstNode->next = NULL;
|
||||
firstNode->prev = NULL;
|
||||
firstNode->size = size2 - sizeof(ArenaNode);
|
||||
|
@ -142,6 +200,7 @@ void __osMallocAddBlock(Arena* arena, void* start, s32 size) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void ArenaImpl_RemoveAllBlocks(Arena* arena) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* next;
|
||||
|
@ -150,16 +209,19 @@ void ArenaImpl_RemoveAllBlocks(Arena* arena) {
|
|||
|
||||
iter = arena->head;
|
||||
while (iter != NULL) {
|
||||
next = ArenaImpl_GetNextBlock(iter);
|
||||
next = NODE_GET_NEXT(iter);
|
||||
__osMemset(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode));
|
||||
iter = next;
|
||||
}
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void __osMallocCleanup(Arena* arena) {
|
||||
#if OOT_DEBUG
|
||||
ArenaImpl_RemoveAllBlocks(arena);
|
||||
#endif
|
||||
bzero(arena, sizeof(*arena));
|
||||
}
|
||||
|
||||
|
@ -167,6 +229,7 @@ u8 __osMallocIsInitialized(Arena* arena) {
|
|||
return arena->isInit;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osMalloc_FreeBlockTest(Arena* arena, ArenaNode* node) {
|
||||
ArenaNode* node2 = node;
|
||||
u32* start;
|
||||
|
@ -204,13 +267,11 @@ void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line)
|
|||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
if (arena->flag & CHECK_FREE_BLOCK) {
|
||||
__osMalloc_FreeBlockTest(arena, iter);
|
||||
}
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + blockSize);
|
||||
newNode->next = ArenaImpl_GetNextBlock(iter);
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = iter->size - blockSize;
|
||||
newNode->isFree = true;
|
||||
|
@ -218,23 +279,21 @@ void* __osMalloc_NoLockDebug(Arena* arena, u32 size, const char* file, s32 line)
|
|||
|
||||
iter->next = newNode;
|
||||
iter->size = size;
|
||||
next = ArenaImpl_GetNextBlock(newNode);
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
iter->isFree = false;
|
||||
ArenaImpl_SetDebugInfo(iter, file, line, arena);
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
if (arena->flag & FILL_ALLOCBLOCK) {
|
||||
__osMemset(alloc, BLOCK_ALLOC_MAGIC, size);
|
||||
}
|
||||
FILL_ALLOC_BLOCK(arena, alloc, size);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
iter = ArenaImpl_GetNextBlock(iter);
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
}
|
||||
|
||||
return alloc;
|
||||
|
@ -263,21 +322,19 @@ void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
|||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
if (arena->flag & CHECK_FREE_BLOCK) {
|
||||
__osMalloc_FreeBlockTest(arena, iter);
|
||||
}
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
newNode->next = ArenaImpl_GetNextBlock(iter);
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = size;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size -= blockSize;
|
||||
next = ArenaImpl_GetNextBlock(newNode);
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
|
@ -285,21 +342,20 @@ void* __osMallocRDebug(Arena* arena, u32 size, const char* file, s32 line) {
|
|||
}
|
||||
|
||||
iter->isFree = false;
|
||||
ArenaImpl_SetDebugInfo(iter, file, line, arena);
|
||||
SET_DEBUG_INFO(iter, file, line, arena);
|
||||
allocR = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
if (arena->flag & FILL_ALLOCBLOCK) {
|
||||
__osMemset(allocR, BLOCK_ALLOC_MAGIC, size);
|
||||
}
|
||||
FILL_ALLOC_BLOCK(arena, allocR, size);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
iter = ArenaImpl_GetPrevBlock(iter);
|
||||
iter = NODE_GET_PREV(iter);
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return allocR;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* __osMalloc_NoLock(Arena* arena, u32 size) {
|
||||
ArenaNode* iter;
|
||||
|
@ -308,20 +364,17 @@ void* __osMalloc_NoLock(Arena* arena, u32 size) {
|
|||
void* alloc = NULL;
|
||||
ArenaNode* next;
|
||||
|
||||
iter = arena->head;
|
||||
size = ALIGN16(size);
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
iter = arena->head;
|
||||
|
||||
while (iter != NULL) {
|
||||
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
if (arena->flag & CHECK_FREE_BLOCK) {
|
||||
__osMalloc_FreeBlockTest(arena, iter);
|
||||
}
|
||||
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + blockSize);
|
||||
newNode->next = ArenaImpl_GetNextBlock(iter);
|
||||
newNode->next = NODE_GET_NEXT(iter);
|
||||
newNode->prev = iter;
|
||||
newNode->size = iter->size - blockSize;
|
||||
newNode->isFree = true;
|
||||
|
@ -329,24 +382,24 @@ void* __osMalloc_NoLock(Arena* arena, u32 size) {
|
|||
|
||||
iter->next = newNode;
|
||||
iter->size = size;
|
||||
next = ArenaImpl_GetNextBlock(newNode);
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
iter->isFree = false;
|
||||
ArenaImpl_SetDebugInfo(iter, NULL, 0, arena);
|
||||
SET_DEBUG_INFO(iter, NULL, 0, arena);
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
if (arena->flag & FILL_ALLOCBLOCK) {
|
||||
__osMemset(alloc, BLOCK_ALLOC_MAGIC, size);
|
||||
}
|
||||
FILL_ALLOC_BLOCK(arena, alloc, size);
|
||||
break;
|
||||
}
|
||||
|
||||
iter = ArenaImpl_GetNextBlock(iter);
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
}
|
||||
|
||||
CHECK_ALLOC_FAILURE(arena, alloc);
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
|
@ -362,32 +415,33 @@ void* __osMalloc(Arena* arena, u32 size) {
|
|||
|
||||
void* __osMallocR(Arena* arena, u32 size) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* allocNode;
|
||||
ArenaNode* newNode;
|
||||
u32 blockSize;
|
||||
ArenaNode* next;
|
||||
void* alloc = NULL;
|
||||
u32 blockSize;
|
||||
|
||||
size = ALIGN16(size);
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
ArenaImpl_Lock(arena);
|
||||
iter = ArenaImpl_GetLastBlock(arena);
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
if (arena->flag & CHECK_FREE_BLOCK) {
|
||||
__osMalloc_FreeBlockTest(arena, iter);
|
||||
}
|
||||
CHECK_FREE_BLOCK(arena, iter);
|
||||
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
newNode->next = ArenaImpl_GetNextBlock(iter);
|
||||
allocNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
allocNode->next = NODE_GET_NEXT(iter);
|
||||
|
||||
newNode = allocNode;
|
||||
newNode->prev = iter;
|
||||
newNode->size = size;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size -= blockSize;
|
||||
next = ArenaImpl_GetNextBlock(newNode);
|
||||
next = NODE_GET_NEXT(newNode);
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
|
@ -395,15 +449,16 @@ void* __osMallocR(Arena* arena, u32 size) {
|
|||
}
|
||||
|
||||
iter->isFree = false;
|
||||
ArenaImpl_SetDebugInfo(iter, NULL, 0, arena);
|
||||
SET_DEBUG_INFO(iter, NULL, 0, arena);
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
if (arena->flag & FILL_ALLOCBLOCK) {
|
||||
__osMemset(alloc, BLOCK_ALLOC_MAGIC, size);
|
||||
}
|
||||
FILL_ALLOC_BLOCK(arena, alloc, size);
|
||||
break;
|
||||
}
|
||||
iter = ArenaImpl_GetPrevBlock(iter);
|
||||
iter = NODE_GET_PREV(iter);
|
||||
}
|
||||
|
||||
CHECK_ALLOC_FAILURE(arena, alloc);
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return alloc;
|
||||
|
@ -413,7 +468,6 @@ void __osFree_NoLock(Arena* arena, void* ptr) {
|
|||
ArenaNode* node;
|
||||
ArenaNode* next;
|
||||
ArenaNode* prev;
|
||||
ArenaNode* newNext;
|
||||
|
||||
if (ptr == NULL) {
|
||||
return;
|
||||
|
@ -422,40 +476,37 @@ void __osFree_NoLock(Arena* arena, void* ptr) {
|
|||
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
|
||||
if (node == NULL || node->magic != NODE_MAGIC) {
|
||||
// "__osFree: Unauthorized release (%08x)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x)\n" VT_RST, ptr);
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:不正解放(%08x)\n" VT_RST, ptr);
|
||||
return;
|
||||
}
|
||||
if (node->isFree) {
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, ptr); // "__osFree: Double release (%08x)"
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, ptr); // "__osFree: Double release (%08x)"
|
||||
return;
|
||||
}
|
||||
#if OOT_DEBUG
|
||||
if (arena != node->arena && arena != NULL) {
|
||||
// "__osFree:Tried to release in a different way than when it was secured (%08x:%08x)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
next = ArenaImpl_GetNextBlock(node);
|
||||
prev = ArenaImpl_GetPrevBlock(node);
|
||||
next = NODE_GET_NEXT(node);
|
||||
prev = NODE_GET_PREV(node);
|
||||
node->isFree = true;
|
||||
ArenaImpl_SetDebugInfo(node, NULL, 0, arena);
|
||||
SET_DEBUG_INFO(node, NULL, 0, arena);
|
||||
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset((void*)((u32)node + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, node->size);
|
||||
}
|
||||
FILL_FREE_BLOCK_CONTENTS(arena, node);
|
||||
|
||||
newNext = next;
|
||||
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
|
||||
newNext = ArenaImpl_GetNextBlock(next);
|
||||
ArenaNode* newNext = NODE_GET_NEXT(next);
|
||||
if (newNext != NULL) {
|
||||
newNext->prev = node;
|
||||
}
|
||||
|
||||
node->size += next->size + sizeof(ArenaNode);
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
|
||||
}
|
||||
FILL_FREE_BLOCK_HEADER(arena, next);
|
||||
node->next = newNext;
|
||||
next = newNext;
|
||||
}
|
||||
|
@ -466,9 +517,7 @@ void __osFree_NoLock(Arena* arena, void* ptr) {
|
|||
}
|
||||
prev->next = next;
|
||||
prev->size += node->size + sizeof(ArenaNode);
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
|
||||
}
|
||||
FILL_FREE_BLOCK_HEADER(arena, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -478,6 +527,7 @@ 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;
|
||||
|
@ -491,41 +541,37 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
|||
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
|
||||
if (node == NULL || node->magic != NODE_MAGIC) {
|
||||
// "__osFree: Unauthorized release (%08x)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
return;
|
||||
}
|
||||
if (node->isFree) {
|
||||
// "__osFree: Double release (%08x)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x) [%s:%d ]\n" VT_RST, ptr, file, line);
|
||||
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)"
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
PRINTF(VT_COL(RED, WHITE) "__osFree:確保時と違う方法で解放しようとした (%08x:%08x)\n" VT_RST, arena,
|
||||
node->arena);
|
||||
return;
|
||||
}
|
||||
|
||||
next = ArenaImpl_GetNextBlock(node);
|
||||
prev = ArenaImpl_GetPrevBlock(node);
|
||||
next = NODE_GET_NEXT(node);
|
||||
prev = NODE_GET_PREV(node);
|
||||
node->isFree = true;
|
||||
ArenaImpl_SetDebugInfo(node, file, line, arena);
|
||||
SET_DEBUG_INFO(node, file, line, arena);
|
||||
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset((void*)((u32)node + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, node->size);
|
||||
}
|
||||
FILL_FREE_BLOCK_CONTENTS(arena, node);
|
||||
|
||||
newNext = node->next;
|
||||
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
|
||||
newNext = ArenaImpl_GetNextBlock(next);
|
||||
newNext = NODE_GET_NEXT(next);
|
||||
if (newNext != NULL) {
|
||||
newNext->prev = node;
|
||||
}
|
||||
|
||||
node->size += next->size + sizeof(ArenaNode);
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
|
||||
}
|
||||
FILL_FREE_BLOCK_HEADER(arena, next);
|
||||
node->next = newNext;
|
||||
next = newNext;
|
||||
}
|
||||
|
@ -536,9 +582,7 @@ void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
|||
}
|
||||
prev->next = next;
|
||||
prev->size += node->size + sizeof(ArenaNode);
|
||||
if (arena->flag & FILL_FREEBLOCK) {
|
||||
__osMemset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
|
||||
}
|
||||
FILL_FREE_BLOCK_HEADER(arena, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -547,10 +591,11 @@ void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line) {
|
|||
__osFree_NoLockDebug(arena, ptr, file, line);
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
||||
void* newAlloc;
|
||||
ArenaNode* node;
|
||||
void* newAlloc;
|
||||
ArenaNode* next;
|
||||
ArenaNode* newNext;
|
||||
ArenaNode* overNext;
|
||||
|
@ -577,20 +622,20 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
|||
// "Does nothing because the memory block size does not change"
|
||||
osSyncPrintf("メモリブロックサイズが変わらないためなにもしません\n");
|
||||
} else if (node->size < newSize) {
|
||||
next = ArenaImpl_GetNextBlock(node);
|
||||
next = NODE_GET_NEXT(node);
|
||||
sizeDiff = newSize - node->size;
|
||||
if ((u32)next == ((u32)node + node->size + sizeof(ArenaNode)) && next->isFree && next->size >= sizeDiff) {
|
||||
// "Merge because there is a free block after the current memory block"
|
||||
osSyncPrintf("現メモリブロックの後ろにフリーブロックがあるので結合します\n");
|
||||
next->size -= sizeDiff;
|
||||
overNext = ArenaImpl_GetNextBlock(next);
|
||||
overNext = NODE_GET_NEXT(next);
|
||||
newNext = (ArenaNode*)((u32)next + sizeDiff);
|
||||
if (overNext != NULL) {
|
||||
overNext->prev = newNext;
|
||||
}
|
||||
node->next = newNext;
|
||||
node->size = newSize;
|
||||
__osMemmove(newNext, next, sizeof(ArenaNode));
|
||||
__osMemmove(node->next, next, sizeof(ArenaNode));
|
||||
} else {
|
||||
// "Allocate a new memory block and move the contents"
|
||||
osSyncPrintf("新たにメモリブロックを確保して内容を移動します\n");
|
||||
|
@ -602,9 +647,10 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
|||
ptr = newAlloc;
|
||||
}
|
||||
} else if (newSize < node->size) {
|
||||
next2 = ArenaImpl_GetNextBlock(node);
|
||||
next2 = NODE_GET_NEXT(node);
|
||||
if (next2 != NULL && next2->isFree) {
|
||||
blockSize = ALIGN16(newSize) + sizeof(ArenaNode);
|
||||
|
||||
// "Increased free block behind current memory block"
|
||||
osSyncPrintf("現メモリブロックの後ろのフリーブロックを大きくしました\n");
|
||||
newNext2 = (ArenaNode*)((u32)node + blockSize);
|
||||
|
@ -613,23 +659,24 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
|||
newNext2->size += node->size - newSize;
|
||||
node->next = newNext2;
|
||||
node->size = newSize;
|
||||
overNext2 = ArenaImpl_GetNextBlock(newNext2);
|
||||
overNext2 = NODE_GET_NEXT(newNext2);
|
||||
if (overNext2 != NULL) {
|
||||
overNext2->prev = newNext2;
|
||||
}
|
||||
} else if (newSize + sizeof(ArenaNode) < node->size) {
|
||||
blockSize = ALIGN16(newSize) + sizeof(ArenaNode);
|
||||
|
||||
// "Generated because there is no free block after the current memory block"
|
||||
osSyncPrintf("現メモリブロックの後ろにフリーブロックがないので生成します\n");
|
||||
newNext2 = (ArenaNode*)((u32)node + blockSize);
|
||||
newNext2->next = ArenaImpl_GetNextBlock(node);
|
||||
newNext2->next = NODE_GET_NEXT(node);
|
||||
newNext2->prev = node;
|
||||
newNext2->size = node->size - blockSize;
|
||||
newNext2->isFree = true;
|
||||
newNext2->magic = NODE_MAGIC;
|
||||
node->next = newNext2;
|
||||
node->size = newSize;
|
||||
overNext2 = ArenaImpl_GetNextBlock(newNext2);
|
||||
overNext2 = NODE_GET_NEXT(newNext2);
|
||||
if (overNext2 != NULL) {
|
||||
overNext2->prev = newNext2;
|
||||
}
|
||||
|
@ -639,15 +686,19 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) {
|
|||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
CHECK_ALLOC_FAILURE(arena, ptr);
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
return __osRealloc(arena, ptr, newSize);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaNode* iter;
|
||||
|
@ -669,12 +720,13 @@ void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAll
|
|||
*outAlloc += iter->size;
|
||||
}
|
||||
|
||||
iter = ArenaImpl_GetNextBlock(iter);
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
}
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void __osDisplayArena(Arena* arena) {
|
||||
u32 freeSize;
|
||||
u32 allocatedSize;
|
||||
|
@ -737,6 +789,7 @@ void __osDisplayArena(Arena* arena) {
|
|||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ArenaImpl_FaultClient(Arena* arena) {
|
||||
u32 freeSize;
|
||||
|
@ -803,7 +856,7 @@ u32 __osCheckArena(Arena* arena) {
|
|||
error = 1;
|
||||
break;
|
||||
}
|
||||
iter = ArenaImpl_GetNextBlock(iter);
|
||||
iter = NODE_GET_NEXT(iter);
|
||||
}
|
||||
if (error == 0) {
|
||||
osSyncPrintf("アリーナはまだ、いけそうです\n"); // "The arena is still going well"
|
||||
|
@ -813,6 +866,8 @@ u32 __osCheckArena(Arena* arena) {
|
|||
return error;
|
||||
}
|
||||
|
||||
u8 func_800FF334(Arena* arena) {
|
||||
return arena->unk_20;
|
||||
#if OOT_DEBUG
|
||||
u8 ArenaImpl_GetAllocFailures(Arena* arena) {
|
||||
return arena->allocFailures;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,7 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) {
|
|||
// Skip update, no rsp task produced
|
||||
rspTask = NULL;
|
||||
} else {
|
||||
rspTask = func_800E4FE0();
|
||||
rspTask = AudioThread_Update();
|
||||
}
|
||||
|
||||
gAudioThreadUpdateTimeAcc += osGetTime() - gAudioThreadUpdateTimeStart;
|
||||
|
|
|
@ -36,6 +36,7 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act
|
|||
SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos);
|
||||
carriedActor->world.pos = pos;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y ||
|
||||
pos.y <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.z || pos.z <= -BGCHECK_XYZ_ABSMAX) {
|
||||
|
||||
|
@ -47,6 +48,7 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act
|
|||
pos.x, pos.y, pos.z);
|
||||
PRINTF(VT_RST);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
*/
|
||||
void DynaPolyActor_Init(DynaPolyActor* dynaActor, s32 transformFlags) {
|
||||
dynaActor->bgId = -1;
|
||||
dynaActor->transformFlags = transformFlags;
|
||||
dynaActor->interactFlags = 0;
|
||||
dynaActor->unk_150 = 0.0f;
|
||||
dynaActor->unk_154 = 0.0f;
|
||||
dynaActor->transformFlags = transformFlags;
|
||||
dynaActor->interactFlags = 0;
|
||||
}
|
||||
|
||||
void DynaPolyActor_UnsetAllInteractFlags(DynaPolyActor* dynaActor) {
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
#include "global.h"
|
||||
#include "terminal.h"
|
||||
|
||||
#if OOT_DEBUG
|
||||
u32 gIsCtrlr2Valid = false;
|
||||
#endif
|
||||
|
||||
NORETURN void func_800D31A0(void) {
|
||||
PRINTF(VT_FGCOL(RED) "\n**** Freeze!! ****\n" VT_RST);
|
||||
while (true) {
|
||||
for (;;) {
|
||||
Sleep_Msec(1000);
|
||||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void func_800D31F0(void) {
|
||||
gIsCtrlr2Valid = (gPadMgr.validCtrlrsMask & 2) != 0;
|
||||
}
|
||||
|
@ -17,3 +20,4 @@ void func_800D31F0(void) {
|
|||
void func_800D3210(void) {
|
||||
gIsCtrlr2Valid = false;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,7 +26,11 @@ void* func_800FC800(u32 size) {
|
|||
size = 1;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
return __osMallocDebug(&gSystemArena, size, sNew, 0);
|
||||
#else
|
||||
return __osMalloc(&gSystemArena, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
// possibly some kind of delete() function
|
||||
|
|
|
@ -1538,18 +1538,18 @@ char DebugCamera_InitCut(s32 idx, DebugCamSub* sub) {
|
|||
D_80161250[0x3F + sDebugCamCuts[idx].letter] = 'O';
|
||||
|
||||
i = sub->nPoints * sizeof(CutsceneCameraPoint);
|
||||
sDebugCamCuts[idx].lookAt = DebugArena_MallocDebug(i, "../db_camera.c", 2748);
|
||||
sDebugCamCuts[idx].lookAt = DEBUG_ARENA_MALLOC(i, "../db_camera.c", 2748);
|
||||
if (sDebugCamCuts[idx].lookAt == NULL) {
|
||||
// "Debug camera memory allocation failure"
|
||||
PRINTF("%s: %d: デバッグカメラ メモリ確保失敗!!\n", "../db_camera.c", 2751);
|
||||
return '?';
|
||||
}
|
||||
|
||||
sDebugCamCuts[idx].position = DebugArena_MallocDebug(i, "../db_camera.c", 2754);
|
||||
sDebugCamCuts[idx].position = DEBUG_ARENA_MALLOC(i, "../db_camera.c", 2754);
|
||||
if (sDebugCamCuts[idx].position == NULL) {
|
||||
// "Debug camera memory allocation failure"
|
||||
PRINTF("%s: %d: デバッグカメラ メモリ確保失敗!!\n", "../db_camera.c", 2757);
|
||||
DebugArena_FreeDebug(sDebugCamCuts[idx].lookAt, "../db_camera.c", 2758);
|
||||
DEBUG_ARENA_FREE(sDebugCamCuts[idx].lookAt, "../db_camera.c", 2758);
|
||||
sDebugCamCuts[idx].lookAt = NULL;
|
||||
return '?';
|
||||
}
|
||||
|
@ -1572,8 +1572,8 @@ void DebugCamera_ResetCut(s32 idx, s32 shouldFree) {
|
|||
}
|
||||
|
||||
if (shouldFree) {
|
||||
DebugArena_FreeDebug(sDebugCamCuts[idx].lookAt, "../db_camera.c", 2784);
|
||||
DebugArena_FreeDebug(sDebugCamCuts[idx].position, "../db_camera.c", 2785);
|
||||
DEBUG_ARENA_FREE(sDebugCamCuts[idx].lookAt, "../db_camera.c", 2784);
|
||||
DEBUG_ARENA_FREE(sDebugCamCuts[idx].position, "../db_camera.c", 2785);
|
||||
}
|
||||
|
||||
sDebugCamCuts[idx].letter = '?';
|
||||
|
@ -1623,7 +1623,7 @@ s32 DebugCamera_LoadCallback(char* c) {
|
|||
if (sDebugCamCuts[i].letter != '?') {
|
||||
size = sDebugCamCuts[i].nPoints * sizeof(CutsceneCameraPoint);
|
||||
|
||||
sDebugCamCuts[i].lookAt = DebugArena_MallocDebug(ALIGN32(size), "../db_camera.c", 2844);
|
||||
sDebugCamCuts[i].lookAt = DEBUG_ARENA_MALLOC(ALIGN32(size), "../db_camera.c", 2844);
|
||||
if (sDebugCamCuts[i].lookAt == NULL) {
|
||||
// "Debug camera memory allocation failure"
|
||||
PRINTF("%s: %d: デバッグカメラ メモリ確保失敗!!\n", "../db_camera.c", 2847);
|
||||
|
@ -1634,7 +1634,7 @@ s32 DebugCamera_LoadCallback(char* c) {
|
|||
}
|
||||
off += ALIGN32(size);
|
||||
|
||||
sDebugCamCuts[i].position = DebugArena_MallocDebug(ALIGN32(size), "../db_camera.c", 2855);
|
||||
sDebugCamCuts[i].position = DEBUG_ARENA_MALLOC(ALIGN32(size), "../db_camera.c", 2855);
|
||||
if (sDebugCamCuts[i].position == NULL) {
|
||||
// "Debug camera memory allocation failure"
|
||||
PRINTF("%s: %d: デバッグカメラ メモリ確保失敗!!\n", "../db_camera.c", 2858);
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
#define LOG_SEVERITY_ERROR 2
|
||||
#define LOG_SEVERITY_VERBOSE 3
|
||||
|
||||
s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR;
|
||||
Arena sDebugArena;
|
||||
|
||||
#if OOT_DEBUG
|
||||
s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR;
|
||||
|
||||
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) {
|
||||
if (ptr == NULL) {
|
||||
if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR) {
|
||||
|
@ -21,53 +23,66 @@ void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char*
|
|||
}
|
||||
}
|
||||
|
||||
#define DEBUG_ARENA_CHECK_POINTER(ptr, size, name, action) DebugArena_CheckPointer(ptr, size, name, action)
|
||||
#else
|
||||
#define DEBUG_ARENA_CHECK_POINTER(ptr, size, name, action) (void)0
|
||||
#endif
|
||||
|
||||
void* DebugArena_Malloc(u32 size) {
|
||||
void* ptr = __osMalloc(&sDebugArena, size);
|
||||
|
||||
DebugArena_CheckPointer(ptr, size, "debug_malloc", "確保"); // "Secure"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocDebug(&sDebugArena, size, file, line);
|
||||
|
||||
DebugArena_CheckPointer(ptr, size, "debug_malloc_DEBUG", "確保"); // "Secure"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* DebugArena_MallocR(u32 size) {
|
||||
void* ptr = __osMallocR(&sDebugArena, size);
|
||||
|
||||
DebugArena_CheckPointer(ptr, size, "debug_malloc_r", "確保"); // "Secure"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_r", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocRDebug(&sDebugArena, size, file, line);
|
||||
|
||||
DebugArena_CheckPointer(ptr, size, "debug_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, size, "debug_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* DebugArena_Realloc(void* ptr, u32 newSize) {
|
||||
ptr = __osRealloc(&sDebugArena, ptr, newSize);
|
||||
DebugArena_CheckPointer(ptr, newSize, "debug_realloc", "再確保"); // "Re-securing"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* DebugArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
ptr = __osReallocDebug(&sDebugArena, ptr, newSize, file, line);
|
||||
DebugArena_CheckPointer(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
DEBUG_ARENA_CHECK_POINTER(ptr, newSize, "debug_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void DebugArena_Free(void* ptr) {
|
||||
__osFree(&sDebugArena, ptr);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void DebugArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
__osFreeDebug(&sDebugArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
void* DebugArena_Calloc(u32 num, u32 size) {
|
||||
void* ret;
|
||||
|
@ -78,15 +93,17 @@ void* DebugArena_Calloc(u32 num, u32 size) {
|
|||
bzero(ret, n);
|
||||
}
|
||||
|
||||
DebugArena_CheckPointer(ret, n, "debug_calloc", "確保");
|
||||
DEBUG_ARENA_CHECK_POINTER(ret, n, "debug_calloc", "確保");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void DebugArena_Display(void) {
|
||||
// "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);
|
||||
|
@ -97,12 +114,16 @@ void DebugArena_Check(void) {
|
|||
}
|
||||
|
||||
void DebugArena_Init(void* start, u32 size) {
|
||||
#if OOT_DEBUG
|
||||
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocInit(&sDebugArena, start, size);
|
||||
}
|
||||
|
||||
void DebugArena_Cleanup(void) {
|
||||
#if OOT_DEBUG
|
||||
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocCleanup(&sDebugArena);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ void FlagSet_Update(PlayState* play) {
|
|||
s32 pad;
|
||||
|
||||
polyOpa = POLY_OPA_DISP;
|
||||
gfx = Graph_GfxPlusOne(polyOpa);
|
||||
gfx = Gfx_Open(polyOpa);
|
||||
gSPDisplayList(OVERLAY_DISP++, gfx);
|
||||
|
||||
GfxPrint_Init(&printer);
|
||||
|
@ -171,7 +171,7 @@ void FlagSet_Update(PlayState* play) {
|
|||
GfxPrint_Destroy(&printer);
|
||||
|
||||
gSPEndDisplayList(gfx++);
|
||||
Graph_BranchDlist(polyOpa, gfx);
|
||||
Gfx_Close(polyOpa, gfx);
|
||||
POLY_OPA_DISP = gfx;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ ViMode sViMode;
|
|||
FaultClient sGameFaultClient;
|
||||
u16 sLastButtonPressed;
|
||||
|
||||
#if OOT_DEBUG
|
||||
void GameState_FaultPrint(void) {
|
||||
static char sBtnChars[] = "ABZSuldr*+LRudlr";
|
||||
s32 i;
|
||||
|
@ -21,6 +22,7 @@ void GameState_FaultPrint(void) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void GameState_SetFBFilter(Gfx** gfxP) {
|
||||
Gfx* gfx = *gfxP;
|
||||
|
@ -62,6 +64,7 @@ void GameState_SetFBFilter(Gfx** gfxP) {
|
|||
}
|
||||
|
||||
void func_800C4344(GameState* gameState) {
|
||||
#if OOT_DEBUG
|
||||
Input* selectedInput;
|
||||
s32 hexDumpSize;
|
||||
u16 inputCompareValue;
|
||||
|
@ -111,8 +114,10 @@ void func_800C4344(GameState* gameState) {
|
|||
LogUtils_LogHexDump((void*)(0x80000000 + (R_PRINT_MEMORY_ADDR << 8)), hexDumpSize);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) {
|
||||
static const u16 sInpDispBtnColors[] = {
|
||||
GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1),
|
||||
|
@ -143,6 +148,7 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) {
|
|||
|
||||
*gfxP = gfx;
|
||||
}
|
||||
#endif
|
||||
|
||||
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
||||
Gfx* newDList;
|
||||
|
@ -150,13 +156,14 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../game.c", 746);
|
||||
|
||||
newDList = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP);
|
||||
newDList = Gfx_Open(polyOpaP = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, newDList);
|
||||
|
||||
if (R_ENABLE_FB_FILTER == 1) {
|
||||
GameState_SetFBFilter(&newDList);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button;
|
||||
if (R_DISABLE_INPUT_DISPLAY == 0) {
|
||||
GameState_DrawInputDisplay(sLastButtonPressed, &newDList);
|
||||
|
@ -172,19 +179,21 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
|
|||
newDList = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (R_ENABLE_ARENA_DBG < 0) {
|
||||
#if OOT_DEBUG
|
||||
s32 pad;
|
||||
|
||||
DebugArena_Display();
|
||||
SystemArena_Display();
|
||||
// "%08x bytes left until the death of Hyrule (game_alloc)"
|
||||
PRINTF("ハイラル滅亡まであと %08x バイト(game_alloc)\n", THA_GetRemaining(&gameState->tha));
|
||||
#endif
|
||||
R_ENABLE_ARENA_DBG = 0;
|
||||
}
|
||||
|
||||
gSPEndDisplayList(newDList++);
|
||||
Graph_BranchDlist(polyOpaP, newDList);
|
||||
Gfx_Close(polyOpaP, newDList);
|
||||
POLY_OPA_DISP = newDList;
|
||||
|
||||
if (1) {}
|
||||
|
@ -221,11 +230,11 @@ void func_800C49F4(GraphicsContext* gfxCtx) {
|
|||
|
||||
OPEN_DISPS(gfxCtx, "../game.c", 846);
|
||||
|
||||
newDlist = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP);
|
||||
newDlist = Gfx_Open(polyOpaP = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, newDlist);
|
||||
|
||||
gSPEndDisplayList(newDlist++);
|
||||
Graph_BranchDlist(polyOpaP, newDlist);
|
||||
Gfx_Close(polyOpaP, newDlist);
|
||||
POLY_OPA_DISP = newDlist;
|
||||
|
||||
if (1) {}
|
||||
|
@ -248,6 +257,7 @@ void GameState_Update(GameState* gameState) {
|
|||
|
||||
func_800C4344(gameState);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (SREG(63) == 1u) {
|
||||
if (R_VI_MODE_EDIT_STATE < VI_MODE_EDIT_STATE_INACTIVE) {
|
||||
R_VI_MODE_EDIT_STATE = VI_MODE_EDIT_STATE_INACTIVE;
|
||||
|
@ -321,6 +331,7 @@ void GameState_Update(GameState* gameState) {
|
|||
D_80009430 = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (R_PAUSE_BG_PRERENDER_STATE != (u32)PAUSE_BG_PRERENDER_PROCESS) {
|
||||
GameState_Draw(gameState, gfxCtx);
|
||||
|
@ -334,14 +345,15 @@ void GameState_InitArena(GameState* gameState, size_t size) {
|
|||
void* arena;
|
||||
|
||||
PRINTF("ハイラル確保 サイズ=%u バイト\n"); // "Hyrule reserved size = %u bytes"
|
||||
arena = GameAlloc_MallocDebug(&gameState->alloc, size, "../game.c", 992);
|
||||
arena = GAME_ALLOC_MALLOC(&gameState->alloc, size, "../game.c", 992);
|
||||
|
||||
if (arena != NULL) {
|
||||
THA_Init(&gameState->tha, arena, size);
|
||||
PRINTF("ハイラル確保成功\n"); // "Successful Hyral"
|
||||
} else {
|
||||
THA_Init(&gameState->tha, NULL, 0);
|
||||
PRINTF("ハイラル確保失敗\n"); // "Failure to secure Hyrule"
|
||||
Fault_AddHungupAndCrash("../game.c", 999);
|
||||
HUNGUP_AND_CRASH("../game.c", 999);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,15 +381,19 @@ void GameState_Realloc(GameState* gameState, size_t size) {
|
|||
}
|
||||
|
||||
PRINTF("ハイラル再確保 サイズ=%u バイト\n", size); // "Hyral reallocate size = %u bytes"
|
||||
gameArena = GameAlloc_MallocDebug(alloc, size, "../game.c", 1033);
|
||||
|
||||
gameArena = GAME_ALLOC_MALLOC(alloc, size, "../game.c", 1033);
|
||||
if (gameArena != NULL) {
|
||||
THA_Init(&gameState->tha, gameArena, size);
|
||||
PRINTF("ハイラル再確保成功\n"); // "Successful reacquisition of Hyrule"
|
||||
} else {
|
||||
THA_Init(&gameState->tha, NULL, 0);
|
||||
PRINTF("ハイラル再確保失敗\n"); // "Failure to secure Hyral"
|
||||
|
||||
#if OOT_DEBUG
|
||||
SystemArena_Display();
|
||||
Fault_AddHungupAndCrash("../game.c", 1044);
|
||||
#endif
|
||||
HUNGUP_AND_CRASH("../game.c", 1044);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,24 +408,25 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
gameState->destroy = NULL;
|
||||
gameState->running = 1;
|
||||
startTime = osGetTime();
|
||||
gameState->size = 0;
|
||||
gameState->init = NULL;
|
||||
endTime = osGetTime();
|
||||
gameState->size = gameState->init = 0;
|
||||
|
||||
// "game_set_next_game_null processing time %d us"
|
||||
PRINTF("game_set_next_game_null 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
|
||||
startTime = endTime;
|
||||
GameAlloc_Init(&gameState->alloc);
|
||||
{
|
||||
s32 requiredScopeTemp;
|
||||
endTime = osGetTime();
|
||||
// "game_set_next_game_null processing time %d us"
|
||||
PRINTF("game_set_next_game_null 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
|
||||
startTime = endTime;
|
||||
GameAlloc_Init(&gameState->alloc);
|
||||
}
|
||||
|
||||
endTime = osGetTime();
|
||||
// "gamealloc_init processing time %d us"
|
||||
PRINTF("gamealloc_init 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
|
||||
|
||||
startTime = endTime;
|
||||
GameState_InitArena(gameState, 0x100000);
|
||||
|
||||
R_UPDATE_RATE = 3;
|
||||
init(gameState);
|
||||
|
||||
endTime = osGetTime();
|
||||
// "init processing time %d us"
|
||||
PRINTF("init 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
|
||||
|
@ -419,18 +436,19 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
VisCvg_Init(&sVisCvg);
|
||||
VisZBuf_Init(&sVisZBuf);
|
||||
VisMono_Init(&sVisMono);
|
||||
if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) {
|
||||
if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) {
|
||||
ViMode_Init(&sViMode);
|
||||
}
|
||||
SpeedMeter_Init(&D_801664D0);
|
||||
Rumble_Init();
|
||||
osSendMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
|
||||
endTime = osGetTime();
|
||||
// "Other initialization processing time %d us"
|
||||
PRINTF("その他初期化 処理時間 %d us\n", OS_CYCLES_TO_USEC(endTime - startTime));
|
||||
|
||||
#if OOT_DEBUG
|
||||
Fault_AddClient(&sGameFaultClient, GameState_FaultPrint, NULL, NULL);
|
||||
#endif
|
||||
|
||||
PRINTF("game コンストラクタ終了\n"); // "game constructor end"
|
||||
}
|
||||
|
@ -438,7 +456,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
|||
void GameState_Destroy(GameState* gameState) {
|
||||
PRINTF("game デストラクタ開始\n"); // "game destructor start"
|
||||
AudioMgr_StopAllSfx();
|
||||
func_800F3054();
|
||||
Audio_Update();
|
||||
osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
LOG_UTILS_CHECK_NULL_POINTER("this->cleanup", gameState->destroy, "../game.c", 1139);
|
||||
if (gameState->destroy != NULL) {
|
||||
|
@ -449,13 +467,16 @@ void GameState_Destroy(GameState* gameState) {
|
|||
VisCvg_Destroy(&sVisCvg);
|
||||
VisZBuf_Destroy(&sVisZBuf);
|
||||
VisMono_Destroy(&sVisMono);
|
||||
if (R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) {
|
||||
if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !OOT_DEBUG) {
|
||||
ViMode_Destroy(&sViMode);
|
||||
}
|
||||
THA_Destroy(&gameState->tha);
|
||||
GameAlloc_Cleanup(&gameState->alloc);
|
||||
|
||||
#if OOT_DEBUG
|
||||
SystemArena_Display();
|
||||
Fault_RemoveClient(&sGameFaultClient);
|
||||
#endif
|
||||
|
||||
PRINTF("game デストラクタ終了\n"); // "game destructor end"
|
||||
}
|
||||
|
@ -472,6 +493,7 @@ u32 GameState_IsRunning(GameState* gameState) {
|
|||
return gameState->running;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) {
|
||||
void* ret;
|
||||
|
||||
|
@ -501,6 +523,7 @@ void* GameState_Alloc(GameState* gameState, size_t size, char* file, s32 line) {
|
|||
void* GameState_AllocEndAlign16(GameState* gameState, size_t size) {
|
||||
return THA_AllocTailAlign16(&gameState->tha, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
s32 GameState_GetArenaSize(GameState* gameState) {
|
||||
return THA_GetRemaining(&gameState->tha);
|
||||
|
|
|
@ -12,6 +12,7 @@ void GameAlloc_Log(GameAlloc* this) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line) {
|
||||
GameAllocEntry* ptr = SystemArena_MallocDebug(size + sizeof(GameAllocEntry), file, line);
|
||||
|
||||
|
@ -27,6 +28,7 @@ void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 lin
|
|||
return NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void* GameAlloc_Malloc(GameAlloc* this, u32 size) {
|
||||
GameAllocEntry* ptr = SYSTEM_ARENA_MALLOC(size + sizeof(GameAllocEntry), "../gamealloc.c", 93);
|
||||
|
|
25
src/code/gfxalloc.c
Normal file
25
src/code/gfxalloc.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "global.h"
|
||||
|
||||
Gfx* Gfx_Open(Gfx* gfx) {
|
||||
return gfx + 1;
|
||||
}
|
||||
|
||||
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst) {
|
||||
gSPBranchList(gfx, dst);
|
||||
return dst;
|
||||
}
|
||||
|
||||
void* Gfx_Alloc(Gfx** gfxP, u32 size) {
|
||||
u8* ptr;
|
||||
Gfx* dst;
|
||||
|
||||
size = ALIGN8(size);
|
||||
|
||||
ptr = (u8*)(*gfxP + 1);
|
||||
|
||||
dst = (Gfx*)(ptr + size);
|
||||
gSPBranchList(*gfxP, dst);
|
||||
|
||||
*gfxP = dst;
|
||||
return ptr;
|
||||
}
|
247
src/code/graph.c
247
src/code/graph.c
|
@ -30,6 +30,7 @@ UCodeInfo D_8012D248[3] = {
|
|||
{ UCODE_S2DEX, gspS2DEX2d_fifoTextStart },
|
||||
};
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Graph_FaultClient(void) {
|
||||
void* nextFb = osViGetNextFramebuffer();
|
||||
void* newFb = (SysCfb_GetFbPtr(0) != nextFb) ? SysCfb_GetFbPtr(0) : SysCfb_GetFbPtr(1);
|
||||
|
@ -93,6 +94,7 @@ void Graph_UCodeFaultClient(Gfx* workBuf) {
|
|||
UCodeDisas_Disassemble(&disassembler, workBuf);
|
||||
UCodeDisas_Destroy(&disassembler);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Graph_InitTHGA(GraphicsContext* gfxCtx) {
|
||||
GfxPool* pool = &gGfxPools[gfxCtx->gfxPoolIdx & 1];
|
||||
|
@ -139,13 +141,17 @@ void Graph_Init(GraphicsContext* gfxCtx) {
|
|||
gfxCtx->xScale = gViConfigXScale;
|
||||
gfxCtx->yScale = gViConfigYScale;
|
||||
osCreateMesgQueue(&gfxCtx->queue, gfxCtx->msgBuff, ARRAY_COUNT(gfxCtx->msgBuff));
|
||||
#if OOT_DEBUG
|
||||
func_800D31F0();
|
||||
Fault_AddClient(&sGraphFaultClient, Graph_FaultClient, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Graph_Destroy(GraphicsContext* gfxCtx) {
|
||||
#if OOT_DEBUG
|
||||
func_800D3210();
|
||||
Fault_RemoveClient(&sGraphFaultClient);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
||||
|
@ -157,109 +163,122 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
|
|||
OSMesg msg;
|
||||
OSTask_t* task = &gfxCtx->task.list.t;
|
||||
OSScTask* scTask = &gfxCtx->task;
|
||||
CfbInfo* cfb;
|
||||
|
||||
gGfxTaskSentToNextReadyMinusAudioThreadUpdateTime =
|
||||
osGetTime() - sGraphPrevTaskTimeStart - gAudioThreadUpdateTimeAcc;
|
||||
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666);
|
||||
{
|
||||
CfbInfo* cfb;
|
||||
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
||||
osStopTimer(&timer);
|
||||
osSetTimer(&timer, OS_USEC_TO_CYCLES(3000000), 0, &gfxCtx->queue, (OSMesg)666);
|
||||
|
||||
if (msg == (OSMesg)666) {
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
PRINTF("RCPが帰ってきませんでした。"); // "RCP did not return."
|
||||
PRINTF(VT_RST);
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_BLOCK);
|
||||
osStopTimer(&timer);
|
||||
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(SP_BASE_REG), 0x20);
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(DPC_BASE_REG), 0x20);
|
||||
LogUtils_LogHexDump(gGfxSPTaskYieldBuffer, sizeof(gGfxSPTaskYieldBuffer));
|
||||
if (msg == (OSMesg)666) {
|
||||
#if OOT_DEBUG
|
||||
PRINTF(VT_FGCOL(RED));
|
||||
PRINTF("RCPが帰ってきませんでした。"); // "RCP did not return."
|
||||
PRINTF(VT_RST);
|
||||
|
||||
SREG(6) = -1;
|
||||
if (sPrevTaskWorkBuffer != NULL) {
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_TOGGLE = 1;
|
||||
R_UCODE_DISAS_LOG_LEVEL = 2;
|
||||
Graph_DisassembleUCode(sPrevTaskWorkBuffer);
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(SP_BASE_REG), 0x20);
|
||||
LogUtils_LogHexDump((void*)PHYS_TO_K1(DPC_BASE_REG), 0x20);
|
||||
LogUtils_LogHexDump(gGfxSPTaskYieldBuffer, sizeof(gGfxSPTaskYieldBuffer));
|
||||
|
||||
SREG(6) = -1;
|
||||
if (sPrevTaskWorkBuffer != NULL) {
|
||||
R_HREG_MODE = HREG_MODE_UCODE_DISAS;
|
||||
R_UCODE_DISAS_TOGGLE = 1;
|
||||
R_UCODE_DISAS_LOG_LEVEL = 2;
|
||||
Graph_DisassembleUCode(sPrevTaskWorkBuffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
||||
}
|
||||
|
||||
Fault_AddHungupAndCrashImpl("RCP is HUNG UP!!", "Oh! MY GOD!!");
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK);
|
||||
|
||||
#if OOT_DEBUG
|
||||
sPrevTaskWorkBuffer = gfxCtx->workBuffer;
|
||||
#endif
|
||||
|
||||
if (gfxCtx->callback != NULL) {
|
||||
gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
|
||||
}
|
||||
|
||||
timeNow = osGetTime();
|
||||
if (gAudioThreadUpdateTimeStart != 0) {
|
||||
// The audio thread update is running
|
||||
// Add the time already spent to the accumulator and leave the rest for the next cycle
|
||||
|
||||
gAudioThreadUpdateTimeAcc += timeNow - gAudioThreadUpdateTimeStart;
|
||||
gAudioThreadUpdateTimeStart = timeNow;
|
||||
}
|
||||
gAudioThreadUpdateTimeTotalPerGfxTask = gAudioThreadUpdateTimeAcc;
|
||||
gAudioThreadUpdateTimeAcc = 0;
|
||||
|
||||
sGraphPrevTaskTimeStart = osGetTime();
|
||||
|
||||
task->type = M_GFXTASK;
|
||||
task->flags = OS_SC_DRAM_DLIST;
|
||||
task->ucode_boot = SysUcode_GetUCodeBoot();
|
||||
task->ucode_boot_size = SysUcode_GetUCodeBootSize();
|
||||
task->ucode = SysUcode_GetUCode();
|
||||
task->ucode_data = SysUcode_GetUCodeData();
|
||||
task->ucode_size = SP_UCODE_SIZE;
|
||||
task->ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
task->dram_stack = gGfxSPTaskStack;
|
||||
task->dram_stack_size = sizeof(gGfxSPTaskStack);
|
||||
task->output_buff = gGfxSPTaskOutputBuffer;
|
||||
task->output_buff_size = gGfxSPTaskOutputBuffer + ARRAY_COUNT(gGfxSPTaskOutputBuffer);
|
||||
task->data_ptr = (u64*)gfxCtx->workBuffer;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../graph.c", 828);
|
||||
task->data_size = (uintptr_t)WORK_DISP - (uintptr_t)gfxCtx->workBuffer;
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 830);
|
||||
|
||||
task->yield_data_ptr = gGfxSPTaskYieldBuffer;
|
||||
|
||||
if (1) {}
|
||||
|
||||
task->yield_data_size = sizeof(gGfxSPTaskYieldBuffer);
|
||||
|
||||
scTask->next = NULL;
|
||||
scTask->flags = OS_SC_NEEDS_RSP | OS_SC_NEEDS_RDP | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
|
||||
if (R_GRAPH_TASKSET00_FLAGS & 1) {
|
||||
R_GRAPH_TASKSET00_FLAGS &= ~1;
|
||||
scTask->flags &= ~OS_SC_SWAPBUFFER;
|
||||
gfxCtx->fbIdx--;
|
||||
}
|
||||
|
||||
scTask->msgQueue = &gfxCtx->queue;
|
||||
scTask->msg = NULL;
|
||||
|
||||
{ s16 pad; }
|
||||
|
||||
cfb = &sGraphCfbInfos[sGraphCfbInfoIdx];
|
||||
|
||||
sGraphCfbInfoIdx = (sGraphCfbInfoIdx + 1) % ARRAY_COUNT(sGraphCfbInfos);
|
||||
cfb->framebuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->swapBuffer = gfxCtx->curFrameBuffer;
|
||||
|
||||
cfb->viMode = gfxCtx->viMode;
|
||||
cfb->viFeatures = gfxCtx->viFeatures;
|
||||
cfb->xScale = gfxCtx->xScale;
|
||||
cfb->yScale = gfxCtx->yScale;
|
||||
cfb->unk_10 = 0;
|
||||
cfb->updateRate = R_UPDATE_RATE;
|
||||
|
||||
scTask->framebuffer = cfb;
|
||||
|
||||
{ s16 pad2; }
|
||||
|
||||
gfxCtx->schedMsgQueue = &gScheduler.cmdQueue;
|
||||
|
||||
osSendMesg(&gScheduler.cmdQueue, (OSMesg)scTask, OS_MESG_BLOCK);
|
||||
Sched_Notify(&gScheduler);
|
||||
}
|
||||
|
||||
osRecvMesg(&gfxCtx->queue, &msg, OS_MESG_NOBLOCK);
|
||||
|
||||
sPrevTaskWorkBuffer = gfxCtx->workBuffer;
|
||||
if (gfxCtx->callback != NULL) {
|
||||
gfxCtx->callback(gfxCtx, gfxCtx->callbackParam);
|
||||
}
|
||||
|
||||
timeNow = osGetTime();
|
||||
if (gAudioThreadUpdateTimeStart != 0) {
|
||||
// The audio thread update is running
|
||||
// Add the time already spent to the accumulator and leave the rest for the next cycle
|
||||
|
||||
gAudioThreadUpdateTimeAcc += timeNow - gAudioThreadUpdateTimeStart;
|
||||
gAudioThreadUpdateTimeStart = timeNow;
|
||||
}
|
||||
gAudioThreadUpdateTimeTotalPerGfxTask = gAudioThreadUpdateTimeAcc;
|
||||
gAudioThreadUpdateTimeAcc = 0;
|
||||
|
||||
sGraphPrevTaskTimeStart = osGetTime();
|
||||
|
||||
task->type = M_GFXTASK;
|
||||
task->flags = OS_SC_DRAM_DLIST;
|
||||
task->ucode_boot = SysUcode_GetUCodeBoot();
|
||||
task->ucode_boot_size = SysUcode_GetUCodeBootSize();
|
||||
task->ucode = SysUcode_GetUCode();
|
||||
task->ucode_data = SysUcode_GetUCodeData();
|
||||
task->ucode_size = SP_UCODE_SIZE;
|
||||
task->ucode_data_size = SP_UCODE_DATA_SIZE;
|
||||
task->dram_stack = gGfxSPTaskStack;
|
||||
task->dram_stack_size = sizeof(gGfxSPTaskStack);
|
||||
task->output_buff = gGfxSPTaskOutputBuffer;
|
||||
task->output_buff_size = gGfxSPTaskOutputBuffer + ARRAY_COUNT(gGfxSPTaskOutputBuffer);
|
||||
task->data_ptr = (u64*)gfxCtx->workBuffer;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../graph.c", 828);
|
||||
task->data_size = (uintptr_t)WORK_DISP - (uintptr_t)gfxCtx->workBuffer;
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 830);
|
||||
|
||||
{ s32 pad2; } // Necessary to match stack usage
|
||||
|
||||
task->yield_data_ptr = gGfxSPTaskYieldBuffer;
|
||||
task->yield_data_size = sizeof(gGfxSPTaskYieldBuffer);
|
||||
|
||||
scTask->next = NULL;
|
||||
scTask->flags = OS_SC_NEEDS_RSP | OS_SC_NEEDS_RDP | OS_SC_SWAPBUFFER | OS_SC_LAST_TASK;
|
||||
if (R_GRAPH_TASKSET00_FLAGS & 1) {
|
||||
R_GRAPH_TASKSET00_FLAGS &= ~1;
|
||||
scTask->flags &= ~OS_SC_SWAPBUFFER;
|
||||
gfxCtx->fbIdx--;
|
||||
}
|
||||
|
||||
scTask->msgQueue = &gfxCtx->queue;
|
||||
scTask->msg = NULL;
|
||||
|
||||
cfb = &sGraphCfbInfos[sGraphCfbInfoIdx++];
|
||||
cfb->framebuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->swapBuffer = gfxCtx->curFrameBuffer;
|
||||
cfb->viMode = gfxCtx->viMode;
|
||||
cfb->viFeatures = gfxCtx->viFeatures;
|
||||
cfb->xScale = gfxCtx->xScale;
|
||||
cfb->yScale = gfxCtx->yScale;
|
||||
cfb->unk_10 = 0;
|
||||
cfb->updateRate = R_UPDATE_RATE;
|
||||
|
||||
scTask->framebuffer = cfb;
|
||||
sGraphCfbInfoIdx %= ARRAY_COUNT(sGraphCfbInfos);
|
||||
|
||||
if (1) {}
|
||||
|
||||
gfxCtx->schedMsgQueue = &gScheduler.cmdQueue;
|
||||
|
||||
osSendMesg(&gScheduler.cmdQueue, (OSMesg)scTask, OS_MESG_BLOCK);
|
||||
Sched_Notify(&gScheduler);
|
||||
}
|
||||
|
||||
void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
||||
|
@ -268,6 +287,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
gameState->inPreNMIState = false;
|
||||
Graph_InitTHGA(gfxCtx);
|
||||
|
||||
#if OOT_DEBUG
|
||||
OPEN_DISPS(gfxCtx, "../graph.c", 966);
|
||||
|
||||
gDPNoOpString(WORK_DISP++, "WORK_DISP 開始", 0);
|
||||
|
@ -276,10 +296,12 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 開始", 0);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 975);
|
||||
#endif
|
||||
|
||||
GameState_ReqPadData(gameState);
|
||||
GameState_Update(gameState);
|
||||
|
||||
#if OOT_DEBUG
|
||||
OPEN_DISPS(gfxCtx, "../graph.c", 987);
|
||||
|
||||
gDPNoOpString(WORK_DISP++, "WORK_DISP 終了", 0);
|
||||
|
@ -288,6 +310,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
gDPNoOpString(OVERLAY_DISP++, "OVERLAY_DISP 終了", 0);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 996);
|
||||
#endif
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../graph.c", 999);
|
||||
|
||||
|
@ -300,6 +323,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
|
||||
CLOSE_DISPS(gfxCtx, "../graph.c", 1028);
|
||||
|
||||
#if OOT_DEBUG
|
||||
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;
|
||||
|
@ -326,6 +350,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
R_UCODE_DISAS_TOGGLE = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
problem = false;
|
||||
|
||||
|
@ -373,11 +398,11 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
gfxCtx->fbIdx++;
|
||||
}
|
||||
|
||||
func_800F3054();
|
||||
Audio_Update();
|
||||
|
||||
{
|
||||
OSTime timeNow = osGetTime();
|
||||
s32 pad[4];
|
||||
s32 pad;
|
||||
|
||||
gRSPGfxTimeTotal = gRSPGfxTimeAcc;
|
||||
gRSPAudioTimeTotal = gRSPAudioTimeAcc;
|
||||
|
@ -392,6 +417,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
sGraphPrevUpdateEndTime = timeNow;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) &&
|
||||
CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) {
|
||||
gSaveContext.gameMode = GAMEMODE_NORMAL;
|
||||
|
@ -405,6 +431,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) {
|
|||
SET_NEXT_GAMESTATE(gameState, PreNMI_Init, PreNMIState);
|
||||
gameState->running = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Graph_ThreadEntry(void* arg0) {
|
||||
|
@ -413,7 +440,6 @@ void Graph_ThreadEntry(void* arg0) {
|
|||
u32 size;
|
||||
GameStateOverlay* nextOvl = &gGameStateOverlayTable[GAMESTATE_SETUP];
|
||||
GameStateOverlay* ovl;
|
||||
char faultMsg[0x50];
|
||||
|
||||
PRINTF("グラフィックスレッド実行開始\n"); // "Start graphic thread execution"
|
||||
Graph_Init(&gfxCtx);
|
||||
|
@ -428,10 +454,15 @@ void Graph_ThreadEntry(void* arg0) {
|
|||
gameState = SYSTEM_ARENA_MALLOC(size, "../graph.c", 1196);
|
||||
|
||||
if (gameState == NULL) {
|
||||
#if OOT_DEBUG
|
||||
char faultMsg[0x50];
|
||||
PRINTF("確保失敗\n"); // "Failure to secure"
|
||||
|
||||
sprintf(faultMsg, "CLASS SIZE= %d bytes", size);
|
||||
Fault_AddHungupAndCrashImpl("GAME CLASS MALLOC FAILED", faultMsg);
|
||||
#else
|
||||
Fault_AddHungupAndCrash("../graph.c", 1200);
|
||||
#endif
|
||||
}
|
||||
|
||||
GameState_Init(gameState, ovl->init, &gfxCtx);
|
||||
|
@ -469,6 +500,7 @@ void* Graph_Alloc2(GraphicsContext* gfxCtx, size_t size) {
|
|||
return THGA_AllocTail(&gfxCtx->polyOpa, ALIGN16(size));
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Graph_OpenDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file, s32 line) {
|
||||
if (R_HREG_MODE == HREG_MODE_UCODE_DISAS && R_UCODE_DISAS_LOG_MODE != 4) {
|
||||
dispRefs[0] = gfxCtx->polyOpa.p;
|
||||
|
@ -502,27 +534,4 @@ void Graph_CloseDisps(Gfx** dispRefs, GraphicsContext* gfxCtx, const char* file,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* Graph_GfxPlusOne(Gfx* gfx) {
|
||||
return gfx + 1;
|
||||
}
|
||||
|
||||
Gfx* Graph_BranchDlist(Gfx* gfx, Gfx* dst) {
|
||||
gSPBranchList(gfx, dst);
|
||||
return dst;
|
||||
}
|
||||
|
||||
void* Graph_DlistAlloc(Gfx** gfxP, u32 size) {
|
||||
u8* ptr;
|
||||
Gfx* dst;
|
||||
|
||||
size = ALIGN8(size);
|
||||
|
||||
ptr = (u8*)(*gfxP + 1);
|
||||
|
||||
dst = (Gfx*)(ptr + size);
|
||||
gSPBranchList(*gfxP, dst);
|
||||
|
||||
*gfxP = dst;
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -253,31 +253,36 @@ void IrqMgr_ThreadEntry(void* arg) {
|
|||
case IRQ_RETRACE_MSG:
|
||||
IrqMgr_HandleRetrace(irqMgr);
|
||||
break;
|
||||
|
||||
case IRQ_PRENMI_MSG:
|
||||
PRINTF("PRE_NMI_MSG\n");
|
||||
// "Scheduler: Receives PRE_NMI message"
|
||||
PRINTF("スケジューラ:PRE_NMIメッセージを受信\n");
|
||||
IrqMgr_HandlePreNMI(irqMgr);
|
||||
break;
|
||||
|
||||
case IRQ_PRENMI450_MSG:
|
||||
PRINTF("PRENMI450_MSG\n");
|
||||
// "Scheduler: Receives PRENMI450 message"
|
||||
PRINTF("スケジューラ:PRENMI450メッセージを受信\n");
|
||||
IrqMgr_HandlePreNMI450(irqMgr);
|
||||
break;
|
||||
|
||||
case IRQ_PRENMI480_MSG:
|
||||
PRINTF("PRENMI480_MSG\n");
|
||||
// "Scheduler: Receives PRENMI480 message"
|
||||
PRINTF("スケジューラ:PRENMI480メッセージを受信\n");
|
||||
IrqMgr_HandlePreNMI480(irqMgr);
|
||||
break;
|
||||
|
||||
case IRQ_PRENMI500_MSG:
|
||||
PRINTF("PRENMI500_MSG\n");
|
||||
// "Scheduler: Receives PRENMI500 message"
|
||||
PRINTF("スケジューラ:PRENMI500メッセージを受信\n");
|
||||
exit = true;
|
||||
IrqMgr_HandlePreNMI500(irqMgr);
|
||||
exit = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// "Unexpected message received"
|
||||
PRINTF("irqmgr.c:予期しないメッセージを受け取りました(%08x)\n", msg);
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
|
||||
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd, void* allocatedRamAddr) {
|
||||
s32 pad[3];
|
||||
uintptr_t end;
|
||||
OverlayRelocationSection* ovlRelocs;
|
||||
u32 relocSectionOffset;
|
||||
size_t size;
|
||||
|
||||
size = vromEnd - vromStart;
|
||||
end = (uintptr_t)allocatedRamAddr + size;
|
||||
u32 relocSectionOffset = 0;
|
||||
s32 size = vromEnd - vromStart;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Start loading dynamic link function"
|
||||
PRINTF("\nダイナミックリンクファンクションのロードを開始します\n");
|
||||
}
|
||||
|
||||
size = vromEnd - vromStart;
|
||||
end = (uintptr_t)allocatedRamAddr + size;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x)"
|
||||
PRINTF("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedRamAddr, end);
|
||||
|
@ -46,10 +46,10 @@ s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void*
|
|||
// "Clear BSS area (% 08x-% 08x)"
|
||||
PRINTF("BSS領域をクリアします(%08x-%08x)\n", end, end + ovlRelocs->bssSize);
|
||||
}
|
||||
bzero((void*)end, (s32)ovlRelocs->bssSize);
|
||||
bzero((void*)end, ovlRelocs->bssSize);
|
||||
}
|
||||
|
||||
size = (uintptr_t)&ovlRelocs->relocations[ovlRelocs->nRelocations] - (uintptr_t)ovlRelocs;
|
||||
size = (uintptr_t)(ovlRelocs->relocations + ovlRelocs->nRelocations) - (uintptr_t)ovlRelocs;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
// "Clear REL area (%08x-%08x)"
|
||||
|
@ -68,5 +68,6 @@ s32 Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void*
|
|||
// "Finish loading dynamic link function"
|
||||
PRINTF("ダイナミックリンクファンクションのロードを終了します\n\n");
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
|
|
@ -25,12 +25,14 @@ AudioMgr gAudioMgr;
|
|||
OSMesgQueue sSerialEventQueue;
|
||||
OSMesg sSerialMsgBuf[1];
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Main_LogSystemHeap(void) {
|
||||
PRINTF(VT_FGCOL(GREEN));
|
||||
// "System heap size% 08x (% dKB) Start address% 08x"
|
||||
PRINTF("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
|
||||
PRINTF(VT_RST);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Main(void* arg) {
|
||||
IrqMgrClient irqClient;
|
||||
|
@ -38,9 +40,6 @@ void Main(void* arg) {
|
|||
OSMesg irqMgrMsgBuf[60];
|
||||
uintptr_t systemHeapStart;
|
||||
uintptr_t fb;
|
||||
void* debugHeapStart;
|
||||
u32 debugHeapSize;
|
||||
s16* msg;
|
||||
|
||||
PRINTF("mainproc 実行開始\n"); // "Start running"
|
||||
gScreenWidth = SCREEN_WIDTH;
|
||||
|
@ -55,15 +54,25 @@ void Main(void* arg) {
|
|||
// "System heap initalization"
|
||||
PRINTF("システムヒープ初期化 %08x-%08x %08x\n", systemHeapStart, fb, gSystemHeapSize);
|
||||
SystemHeap_Init((void*)systemHeapStart, gSystemHeapSize); // initializes the system heap
|
||||
if (osMemSize >= 0x800000) {
|
||||
debugHeapStart = SysCfb_GetFbEnd();
|
||||
debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart;
|
||||
} else {
|
||||
debugHeapSize = 0x400;
|
||||
debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565);
|
||||
|
||||
#if OOT_DEBUG
|
||||
{
|
||||
void* debugHeapStart;
|
||||
u32 debugHeapSize;
|
||||
|
||||
if (osMemSize >= 0x800000) {
|
||||
debugHeapStart = SysCfb_GetFbEnd();
|
||||
debugHeapSize = PHYS_TO_K0(0x600000) - (uintptr_t)debugHeapStart;
|
||||
} else {
|
||||
debugHeapSize = 0x400;
|
||||
debugHeapStart = SYSTEM_ARENA_MALLOC(debugHeapSize, "../main.c", 565);
|
||||
}
|
||||
|
||||
PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
|
||||
DebugArena_Init(debugHeapStart, debugHeapSize);
|
||||
}
|
||||
PRINTF("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
|
||||
DebugArena_Init(debugHeapStart, debugHeapSize);
|
||||
#endif
|
||||
|
||||
Regs_Init();
|
||||
|
||||
R_ENABLE_ARENA_DBG = 0;
|
||||
|
@ -71,7 +80,9 @@ void Main(void* arg) {
|
|||
osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf));
|
||||
osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL);
|
||||
|
||||
#if OOT_DEBUG
|
||||
Main_LogSystemHeap();
|
||||
#endif
|
||||
|
||||
osCreateMesgQueue(&irqMgrMsgQueue, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
|
||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
|
||||
|
@ -97,7 +108,8 @@ void Main(void* arg) {
|
|||
osSetThreadPri(NULL, THREAD_PRI_MAIN);
|
||||
|
||||
while (true) {
|
||||
msg = NULL;
|
||||
s16* msg = NULL;
|
||||
|
||||
osRecvMesg(&irqMgrMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "terminal.h"
|
||||
|
||||
#define PADMGR_LOG(controllerNum, msg) \
|
||||
if (1) { \
|
||||
if (OOT_DEBUG) { \
|
||||
PRINTF(VT_FGCOL(YELLOW)); \
|
||||
/* padmgr: Controller %d: %s */ \
|
||||
PRINTF("padmgr: %dコン: %s\n", (controllerNum) + 1, (msg)); \
|
||||
|
@ -66,7 +66,11 @@ s32 gPadMgrLogSeverity = LOG_SEVERITY_CRITICAL;
|
|||
* @see PadMgr_ReleaseSerialEventQueue
|
||||
*/
|
||||
OSMesgQueue* PadMgr_AcquireSerialEventQueue(PadMgr* padMgr) {
|
||||
OSMesgQueue* serialEventQueue = NULL;
|
||||
OSMesgQueue* serialEventQueue;
|
||||
|
||||
#if OOT_DEBUG
|
||||
serialEventQueue = NULL;
|
||||
#endif
|
||||
|
||||
if (gPadMgrLogSeverity >= LOG_SEVERITY_VERBOSE) {
|
||||
// "serialMsgQ Waiting for lock"
|
||||
|
@ -135,13 +139,10 @@ void PadMgr_UnlockPadData(PadMgr* padMgr) {
|
|||
void PadMgr_UpdateRumble(PadMgr* padMgr) {
|
||||
static u32 sRumbleErrorCount = 0; // original name: "errcnt"
|
||||
static u32 sRumbleUpdateCounter;
|
||||
s32 motorStart = MOTOR_START; // required for matching?
|
||||
s32 triedRumbleComm;
|
||||
OSMesgQueue* serialEventQueue = PadMgr_AcquireSerialEventQueue(padMgr);
|
||||
s32 ret;
|
||||
s32 i;
|
||||
|
||||
triedRumbleComm = false;
|
||||
s32 ret;
|
||||
OSMesgQueue* serialEventQueue = PadMgr_AcquireSerialEventQueue(padMgr);
|
||||
s32 triedRumbleComm = false;
|
||||
|
||||
for (i = 0; i < MAXCONTROLLERS; i++) {
|
||||
if (padMgr->ctrlrIsConnected[i]) {
|
||||
|
@ -153,9 +154,7 @@ void PadMgr_UpdateRumble(PadMgr* padMgr) {
|
|||
// "Rumble pack brrr"
|
||||
PADMGR_LOG(i, "振動パック ぶるぶるぶるぶる");
|
||||
|
||||
// This should be the osMotorStart macro, however the temporary variable motorStart is
|
||||
// currently required for matching
|
||||
if (__osMotorAccess(&padMgr->rumblePfs[i], motorStart) != 0) {
|
||||
if (osMotorStart(&padMgr->rumblePfs[i]) != 0) {
|
||||
padMgr->pakType[i] = CONT_PAK_NONE;
|
||||
|
||||
// "A communication error has occurred with the vibration pack"
|
||||
|
@ -186,7 +185,7 @@ void PadMgr_UpdateRumble(PadMgr* padMgr) {
|
|||
}
|
||||
} else {
|
||||
if (padMgr->pakType[i] != CONT_PAK_NONE) {
|
||||
if (padMgr->pakType[i] == CONT_PAK_RUMBLE) {
|
||||
if (padMgr->pakType[i] == CONT_PAK_RUMBLE || !OOT_DEBUG) {
|
||||
// "It seems that a vibration pack was pulled out"
|
||||
PADMGR_LOG(i, "振動パックが抜かれたようです");
|
||||
padMgr->pakType[i] = CONT_PAK_NONE;
|
||||
|
@ -352,9 +351,9 @@ void PadMgr_UpdateInputs(PadMgr* padMgr) {
|
|||
}
|
||||
|
||||
void PadMgr_HandleRetrace(PadMgr* padMgr) {
|
||||
s32 i;
|
||||
OSMesgQueue* serialEventQueue = PadMgr_AcquireSerialEventQueue(padMgr);
|
||||
u32 mask;
|
||||
s32 i;
|
||||
|
||||
// Begin reading controller data
|
||||
osContStartReadData(serialEventQueue);
|
||||
|
@ -368,6 +367,12 @@ void PadMgr_HandleRetrace(PadMgr* padMgr) {
|
|||
osRecvMesg(serialEventQueue, NULL, OS_MESG_BLOCK);
|
||||
osContGetReadData(padMgr->pads);
|
||||
|
||||
#if !OOT_DEBUG
|
||||
// Clear controllers 2 and 4
|
||||
bzero(&padMgr->pads[1], sizeof(OSContPad));
|
||||
bzero(&padMgr->pads[3], sizeof(OSContPad));
|
||||
#endif
|
||||
|
||||
// If resetting, clear all controllers
|
||||
if (padMgr->isResetting) {
|
||||
bzero(padMgr->pads, sizeof(padMgr->pads));
|
||||
|
|
|
@ -33,19 +33,19 @@
|
|||
* - [29:24] 6-bit relocation type describing which relocation operation should be performed. Same as ELF32 MIPS.
|
||||
* - [23: 0] 24-bit section-relative offset indicating where in the section to apply this relocation.
|
||||
*
|
||||
* @param allocatedRamAddress Memory address the binary was loaded at.
|
||||
* @param allocatedRamAddr Memory address the binary was loaded at.
|
||||
* @param ovlRelocs Overlay relocation section containing overlay section layout and runtime relocations.
|
||||
* @param vramStart Virtual RAM address that the overlay was compiled at.
|
||||
*/
|
||||
void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRelocs, void* vramStart) {
|
||||
void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, void* vramStart) {
|
||||
uintptr_t sections[RELOC_SECTION_MAX];
|
||||
u32 relocatedValue;
|
||||
u32 dbg;
|
||||
u32 relocOffset;
|
||||
u32 relocData;
|
||||
uintptr_t unrelocatedAddress;
|
||||
u32 i;
|
||||
u32* relocDataP;
|
||||
u32 reloc;
|
||||
u32 relocData;
|
||||
u32 isLoNeg;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedRamAddr;
|
||||
u32 i;
|
||||
u32* regValP;
|
||||
//! MIPS ELF relocation does not generally require tracking register values, so at first glance it appears this
|
||||
//! register tracking was an unnecessary complication. However there is a bug in the IDO compiler that can cause
|
||||
//! relocations to be emitted in the wrong order under rare circumstances when the compiler attempts to reuse a
|
||||
|
@ -54,21 +54,16 @@ void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRe
|
|||
//! due to the incorrect ordering.
|
||||
u32* luiRefs[32];
|
||||
u32 luiVals[32];
|
||||
uintptr_t relocatedAddress;
|
||||
u32 reloc;
|
||||
u32* luiInstRef;
|
||||
uintptr_t allocu32 = (uintptr_t)allocatedRamAddress;
|
||||
u32* regValP;
|
||||
u32 isLoNeg;
|
||||
u32 dbg;
|
||||
s32 relocOffset = 0;
|
||||
u32 relocatedValue = 0;
|
||||
uintptr_t unrelocatedAddress = 0;
|
||||
uintptr_t relocatedAddress = 0;
|
||||
s32 pad;
|
||||
|
||||
relocOffset = 0;
|
||||
relocatedValue = 0;
|
||||
unrelocatedAddress = 0;
|
||||
relocatedAddress = 0;
|
||||
|
||||
if (gOverlayLogSeverity >= 3) {
|
||||
PRINTF("DoRelocation(%08x, %08x, %08x)\n", allocatedRamAddress, ovlRelocs, vramStart);
|
||||
PRINTF("DoRelocation(%08x, %08x, %08x)\n", allocatedRamAddr, ovlRelocs, vramStart);
|
||||
PRINTF("text=%08x, data=%08x, rodata=%08x, bss=%08x\n", ovlRelocs->textSize, ovlRelocs->dataSize,
|
||||
ovlRelocs->rodataSize, ovlRelocs->bssSize);
|
||||
}
|
||||
|
@ -105,12 +100,13 @@ void Overlay_Relocate(void* allocatedRamAddress, OverlayRelocationSection* ovlRe
|
|||
// Handles 26-bit address relocation, used for jumps and jals.
|
||||
// Extract the address from the target field of the J-type MIPS instruction.
|
||||
// Relocate the address and update the instruction.
|
||||
|
||||
unrelocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(*relocDataP));
|
||||
relocOffset = unrelocatedAddress - (uintptr_t)vramStart;
|
||||
relocatedValue = (*relocDataP & 0xFC000000) | (((allocu32 + relocOffset) & 0x0FFFFFFF) >> 2);
|
||||
relocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(relocatedValue));
|
||||
*relocDataP = relocatedValue;
|
||||
if (1) {
|
||||
relocOffset = PHYS_TO_K0(MIPS_JUMP_TARGET(*relocDataP)) - (uintptr_t)vramStart;
|
||||
unrelocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(*relocDataP));
|
||||
relocatedValue = (*relocDataP & 0xFC000000) | (((allocu32 + relocOffset) & 0x0FFFFFFF) >> 2);
|
||||
relocatedAddress = PHYS_TO_K0(MIPS_JUMP_TARGET(relocatedValue));
|
||||
*relocDataP = relocatedValue;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_MIPS_HI16 << RELOC_TYPE_SHIFT:
|
||||
|
|
127
src/code/sched.c
127
src/code/sched.c
|
@ -45,34 +45,43 @@
|
|||
#define RDP_DONE_MSG 668
|
||||
#define NOTIFY_MSG 670 // original name: ENTRY_MSG
|
||||
|
||||
vs32 sLogScheduler = false;
|
||||
vs32 sSchedDebugPrintfEnabled = false;
|
||||
|
||||
OSTime sRSPGfxTimeStart;
|
||||
OSTime sRSPAudioTimeStart;
|
||||
OSTime sRSPOtherTimeStart;
|
||||
OSTime sRDPTimeStart;
|
||||
|
||||
#if OOT_DEBUG
|
||||
#define SCHED_DEBUG_PRINTF \
|
||||
if (sSchedDebugPrintfEnabled) \
|
||||
PRINTF
|
||||
#elif IDO_PRINTF_WORKAROUND
|
||||
#define SCHED_DEBUG_PRINTF(args) (void)0
|
||||
#else
|
||||
#define SCHED_DEBUG_PRINTF(format, ...) (void)0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the current framebuffer to the swapbuffer pointed to by the provided cfb
|
||||
*/
|
||||
void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) {
|
||||
u16 width;
|
||||
|
||||
LOG_UTILS_CHECK_VALID_POINTER("cfbinfo->swapbuffer", cfbInfo->swapBuffer, "../sched.c", 340);
|
||||
|
||||
if (cfbInfo->swapBuffer != NULL) {
|
||||
// Register the swapbuffer to display on next VI
|
||||
osViSwapBuffer(cfbInfo->swapBuffer);
|
||||
cfbInfo->updateTimer = cfbInfo->updateRate;
|
||||
SCHED_DEBUG_PRINTF("osViSwapBuffer %08x %08x %08x\n", osViGetCurrentFramebuffer(), osViGetNextFramebuffer(),
|
||||
(cfbInfo != NULL) ? cfbInfo->swapBuffer : NULL);
|
||||
|
||||
if (sLogScheduler) {
|
||||
PRINTF("osViSwapBuffer %08x %08x %08x\n", osViGetCurrentFramebuffer(), osViGetNextFramebuffer(),
|
||||
(cfbInfo != NULL) ? cfbInfo->swapBuffer : NULL);
|
||||
{
|
||||
u16 width = (cfbInfo->viMode != NULL) ? cfbInfo->viMode->comRegs.width : (u32)gScreenWidth;
|
||||
|
||||
Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16);
|
||||
}
|
||||
|
||||
width = (cfbInfo->viMode != NULL) ? cfbInfo->viMode->comRegs.width : (u32)gScreenWidth;
|
||||
Fault_SetFrameBuffer(cfbInfo->swapBuffer, width, 16);
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (R_HREG_MODE == HREG_MODE_SCHED && R_SCHED_INIT != HREG_MODE_SCHED) {
|
||||
R_SCHED_TOGGLE_SPECIAL_FEATURES = 0;
|
||||
R_SCHED_GAMMA_ON = 0;
|
||||
|
@ -100,6 +109,7 @@ void Sched_SwapFrameBufferImpl(CfbInfo* cfbInfo) {
|
|||
osViSetSpecialFeatures(R_SCHED_GAMMA_DITHER_ON ? OS_VI_GAMMA_DITHER_ON : OS_VI_GAMMA_DITHER_OFF);
|
||||
osViSetSpecialFeatures(R_SCHED_DIVOT_ON ? OS_VI_DIVOT_ON : OS_VI_DIVOT_OFF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
cfbInfo->unk_10 = 0;
|
||||
|
@ -117,6 +127,7 @@ void Sched_SwapFrameBuffer(Scheduler* sc, CfbInfo* cfbInfo) {
|
|||
}
|
||||
|
||||
void Sched_HandlePreNMI(Scheduler* sc) {
|
||||
#if OOT_DEBUG
|
||||
OSTime now;
|
||||
|
||||
if (sc->curRSPTask != NULL) {
|
||||
|
@ -143,6 +154,7 @@ void Sched_HandlePreNMI(Scheduler* sc) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Sched_HandleNMI(Scheduler* sc) {
|
||||
|
@ -161,10 +173,9 @@ void Sched_QueueTask(Scheduler* sc, OSScTask* task) {
|
|||
463);
|
||||
|
||||
if (type == M_AUDTASK) {
|
||||
if (sLogScheduler) {
|
||||
// "You have entered an audio task"
|
||||
PRINTF("オーディオタスクをエントリしました\n");
|
||||
}
|
||||
// "You have entered an audio task"
|
||||
SCHED_DEBUG_PRINTF("オーディオタスクをエントリしました\n");
|
||||
|
||||
// Add to audio queue
|
||||
if (sc->audioListTail != NULL) {
|
||||
sc->audioListTail->next = task;
|
||||
|
@ -176,10 +187,10 @@ void Sched_QueueTask(Scheduler* sc, OSScTask* task) {
|
|||
// Set audio flag
|
||||
sc->doAudio = true;
|
||||
} else {
|
||||
if (sLogScheduler) {
|
||||
// "Entered graph task"
|
||||
PRINTF("グラフタスクをエントリしました\n");
|
||||
}
|
||||
|
||||
// "Entered graph task"
|
||||
SCHED_DEBUG_PRINTF("グラフタスクをエントリしました\n");
|
||||
|
||||
// Add to graphics queue
|
||||
if (sc->gfxListTail != NULL) {
|
||||
sc->gfxListTail->next = task;
|
||||
|
@ -202,9 +213,7 @@ void Sched_Yield(Scheduler* sc) {
|
|||
// Send yield request
|
||||
osSpTaskYield();
|
||||
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08d:osSpTaskYield\n", (u32)(OS_CYCLES_TO_USEC(osGetTime())));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08d:osSpTaskYield\n", (u32)(OS_CYCLES_TO_USEC(osGetTime())));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -405,11 +414,9 @@ void Sched_RunTask(Scheduler* sc, OSScTask* spTask, OSScTask* dpTask) {
|
|||
// Run RSP
|
||||
osSpTaskStartGo(&spTask->list);
|
||||
|
||||
if (sLogScheduler) {
|
||||
PRINTF(
|
||||
"%08d:osSpTaskStartGo(%08x) %s\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), &spTask->list,
|
||||
(spTask->list.t.type == M_AUDTASK ? "AUDIO" : (spTask->list.t.type == M_GFXTASK ? "GRAPH" : "OTHER")));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF(
|
||||
"%08d:osSpTaskStartGo(%08x) %s\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), &spTask->list,
|
||||
(spTask->list.t.type == M_AUDTASK ? "AUDIO" : (spTask->list.t.type == M_GFXTASK ? "GRAPH" : "OTHER")));
|
||||
|
||||
// Set currently running RSP task
|
||||
sc->curRSPTask = spTask;
|
||||
|
@ -442,9 +449,8 @@ void Sched_HandleNotification(Scheduler* sc) {
|
|||
// signal to the currently running task to yield the RSP so that the audio task may
|
||||
// be ran as soon as possible.
|
||||
if (sc->doAudio && sc->curRSPTask != NULL) {
|
||||
if (sLogScheduler) {
|
||||
PRINTF("[YIELD B]");
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("[YIELD B]");
|
||||
|
||||
Sched_Yield(sc);
|
||||
return;
|
||||
}
|
||||
|
@ -454,15 +460,12 @@ void Sched_HandleNotification(Scheduler* sc) {
|
|||
if (Sched_Schedule(sc, &nextRSP, &nextRDP, state) != state) {
|
||||
Sched_RunTask(sc, nextRSP, nextRDP);
|
||||
}
|
||||
if (sLogScheduler) {
|
||||
PRINTF("EN sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("EN sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
|
||||
void Sched_HandleRetrace(Scheduler* sc) {
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08d:scHandleRetrace %08x\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), osViGetCurrentFramebuffer());
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08d:scHandleRetrace %08x\n", (u32)OS_CYCLES_TO_USEC(osGetTime()), osViGetCurrentFramebuffer());
|
||||
|
||||
ViConfig_UpdateBlack();
|
||||
sc->retraceCount++;
|
||||
|
||||
|
@ -490,11 +493,9 @@ void Sched_HandleRetrace(Scheduler* sc) {
|
|||
}
|
||||
}
|
||||
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08x %08x %08x %d\n", osViGetCurrentFramebuffer(), osViGetNextFramebuffer(),
|
||||
(sc->pendingSwapBuf1 != NULL) ? sc->pendingSwapBuf1->swapBuffer : NULL,
|
||||
(sc->curBuf != NULL) ? sc->curBuf->updateTimer : 0);
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08x %08x %08x %d\n", osViGetCurrentFramebuffer(), osViGetNextFramebuffer(),
|
||||
(sc->pendingSwapBuf1 != NULL) ? sc->pendingSwapBuf1->swapBuffer : NULL,
|
||||
(sc->curBuf != NULL) ? sc->curBuf->updateTimer : 0);
|
||||
|
||||
// Run the notification handler to enqueue any waiting tasks and possibly run one
|
||||
Sched_HandleNotification(sc);
|
||||
|
@ -524,14 +525,11 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
|||
curRSPTask = sc->curRSPTask;
|
||||
sc->curRSPTask = NULL;
|
||||
|
||||
if (sLogScheduler) {
|
||||
PRINTF("RSP DONE %d %d", curRSPTask->state & OS_SC_YIELD, osSpTaskYielded(&curRSPTask->list));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("RSP DONE %d %d", curRSPTask->state & OS_SC_YIELD, osSpTaskYielded(&curRSPTask->list));
|
||||
|
||||
if ((curRSPTask->state & OS_SC_YIELD) && osSpTaskYielded(&curRSPTask->list)) {
|
||||
if (sLogScheduler) {
|
||||
PRINTF("[YIELDED]\n");
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("[YIELDED]\n");
|
||||
|
||||
// Task yielded, set yielded state
|
||||
curRSPTask->state |= OS_SC_YIELDED;
|
||||
// Add it to the front of the queue
|
||||
|
@ -541,9 +539,7 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
|||
sc->gfxListTail = curRSPTask;
|
||||
}
|
||||
} else {
|
||||
if (sLogScheduler) {
|
||||
PRINTF("[NOT YIELDED]\n");
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("[NOT YIELDED]\n");
|
||||
// Task has completed on the RSP, unset RSP flag and check if the task is fully complete
|
||||
curRSPTask->state &= ~OS_SC_SP;
|
||||
Sched_TaskComplete(sc, curRSPTask);
|
||||
|
@ -554,9 +550,7 @@ void Sched_HandleRSPDone(Scheduler* sc) {
|
|||
if (Sched_Schedule(sc, &nextRSP, &nextRDP, state) != state) {
|
||||
Sched_RunTask(sc, nextRSP, nextRDP);
|
||||
}
|
||||
if (sLogScheduler) {
|
||||
PRINTF("SP sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("SP sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -588,9 +582,7 @@ void Sched_HandleRDPDone(Scheduler* sc) {
|
|||
if (Sched_Schedule(sc, &nextRSP, &nextRDP, state) != state) {
|
||||
Sched_RunTask(sc, nextRSP, nextRDP);
|
||||
}
|
||||
if (sLogScheduler) {
|
||||
PRINTF("DP sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("DP sc:%08x sp:%08x dp:%08x state:%x\n", sc, nextRSP, nextRDP, state);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -601,9 +593,7 @@ void Sched_HandleRDPDone(Scheduler* sc) {
|
|||
* Original name: osScKickEntryMsg
|
||||
*/
|
||||
void Sched_Notify(Scheduler* sc) {
|
||||
if (sLogScheduler) {
|
||||
PRINTF("osScKickEntryMsg\n");
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("osScKickEntryMsg\n");
|
||||
|
||||
osSendMesg(&sc->interruptQueue, (OSMesg)NOTIFY_MSG, OS_MESG_BLOCK);
|
||||
}
|
||||
|
@ -613,41 +603,38 @@ void Sched_ThreadEntry(void* arg) {
|
|||
Scheduler* sc = (Scheduler*)arg;
|
||||
|
||||
while (true) {
|
||||
if (sLogScheduler) {
|
||||
// "%08d: standby"
|
||||
PRINTF("%08d:待機中\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
}
|
||||
// "%08d: standby"
|
||||
SCHED_DEBUG_PRINTF("%08d:待機中\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
|
||||
// Await interrupt messages, either from the OS, IrqMgr, or another thread
|
||||
osRecvMesg(&sc->interruptQueue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
switch ((s32)msg) {
|
||||
case NOTIFY_MSG:
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08d:ENTRY_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08d:ENTRY_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
Sched_HandleNotification(sc);
|
||||
continue;
|
||||
|
||||
case RSP_DONE_MSG:
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08d:RSP_DONE_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08d:RSP_DONE_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
Sched_HandleRSPDone(sc);
|
||||
continue;
|
||||
|
||||
case RDP_DONE_MSG:
|
||||
if (sLogScheduler) {
|
||||
PRINTF("%08d:RDP_DONE_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
}
|
||||
SCHED_DEBUG_PRINTF("%08d:RDP_DONE_MSG\n", (u32)OS_CYCLES_TO_USEC(osGetTime()));
|
||||
Sched_HandleRDPDone(sc);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (((OSScMsg*)msg)->type) {
|
||||
case OS_SC_RETRACE_MSG:
|
||||
Sched_HandleRetrace(sc);
|
||||
continue;
|
||||
|
||||
case OS_SC_PRE_NMI_MSG:
|
||||
Sched_HandlePreNMI(sc);
|
||||
continue;
|
||||
|
||||
case OS_SC_NMI_MSG:
|
||||
Sched_HandleNMI(sc);
|
||||
continue;
|
||||
|
|
|
@ -86,7 +86,7 @@ void Letterbox_Update(s32 updateRate) {
|
|||
sLetterboxState = LETTERBOX_STATE_IDLE;
|
||||
}
|
||||
|
||||
if (R_HREG_MODE == HREG_MODE_LETTERBOX) {
|
||||
if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_LETTERBOX)) {
|
||||
if (R_LETTERBOX_INIT != HREG_MODE_LETTERBOX) {
|
||||
R_LETTERBOX_INIT = HREG_MODE_LETTERBOX;
|
||||
R_LETTERBOX_ENABLE_LOGS = 0;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "terminal.h"
|
||||
|
||||
/**
|
||||
* How much time the audio update on the audio thread (`func_800E4FE0`) took in total, between scheduling the last two
|
||||
* graphics tasks.
|
||||
* How much time the audio update on the audio thread (`AudioThread_Update`) took in total, between scheduling the last
|
||||
* two graphics tasks.
|
||||
*/
|
||||
volatile OSTime gAudioThreadUpdateTimeTotalPerGfxTask;
|
||||
|
||||
|
|
|
@ -13,11 +13,19 @@ void SysCfb_Init(s32 n64dd) {
|
|||
tmpFbEnd = 0x8044BE80;
|
||||
if (n64dd == 1) {
|
||||
PRINTF("RAM 8M mode (N64DD対応)\n"); // "RAM 8M mode (N64DD compatible)"
|
||||
#if OOT_DEBUG
|
||||
sSysCfbEnd = 0x805FB000;
|
||||
#else
|
||||
sSysCfbEnd = 0x80600000;
|
||||
#endif
|
||||
} else {
|
||||
// "The margin for this version is %dK bytes"
|
||||
PRINTF("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
|
||||
#if OOT_DEBUG
|
||||
sSysCfbEnd = tmpFbEnd;
|
||||
#else
|
||||
sSysCfbEnd = 0x80400000;
|
||||
#endif
|
||||
}
|
||||
} else if (osMemSize >= 0x400000) {
|
||||
PRINTF("RAM4M mode\n");
|
||||
|
@ -28,6 +36,9 @@ void SysCfb_Init(s32 n64dd) {
|
|||
|
||||
screenSize = SCREEN_WIDTH * SCREEN_HEIGHT;
|
||||
sSysCfbEnd &= ~0x3F;
|
||||
|
||||
if (1) {}
|
||||
|
||||
// "The final address used by the system is %08x"
|
||||
PRINTF("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
|
||||
sSysCfbFbPtr[0] = sSysCfbEnd - (screenSize * 4);
|
||||
|
|
|
@ -922,8 +922,7 @@ f32 Math3D_Plane(Plane* plane, Vec3f* pointOnPlane) {
|
|||
* `nx`, `ny`, `nz`, and `originDist`
|
||||
*/
|
||||
f32 Math3D_UDistPlaneToPos(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* p) {
|
||||
|
||||
if (IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) {
|
||||
if (OOT_DEBUG && IS_ZERO(sqrtf(SQ(nx) + SQ(ny) + SQ(nz)))) {
|
||||
PRINTF(VT_COL(YELLOW, BLACK));
|
||||
// "Math3DLengthPlaneAndPos(): Normal size is near zero %f %f %f"
|
||||
PRINTF("Math3DLengthPlaneAndPos():法線size がゼロ近いです%f %f %f\n", nx, ny, nz);
|
||||
|
@ -1823,7 +1822,6 @@ s32 Math3D_CylTriVsIntersect(Cylinder16* cyl, TriNorm* tri, Vec3f* intersect) {
|
|||
Vec3f cylIntersectCenter;
|
||||
Vec3f midpointv0v1;
|
||||
Vec3f diffMidpointIntersect;
|
||||
f32 distFromCylYIntersectTov0v1;
|
||||
s32 pad;
|
||||
|
||||
cylBottom = (f32)cyl->pos.y + cyl->yShift;
|
||||
|
@ -1865,6 +1863,7 @@ s32 Math3D_CylTriVsIntersect(Cylinder16* cyl, TriNorm* tri, Vec3f* intersect) {
|
|||
if (Math3D_TriChkLineSegParaYIntersect(&tri->vtx[0], &tri->vtx[1], &tri->vtx[2], tri->plane.normal.x,
|
||||
tri->plane.normal.y, tri->plane.normal.z, tri->plane.originDist, cyl->pos.z,
|
||||
cyl->pos.x, &yIntersect, cylBottom, cylTop)) {
|
||||
f32 distFromCylYIntersectTov0v1;
|
||||
|
||||
cylIntersectCenter.x = cyl->pos.x;
|
||||
cylIntersectCenter.y = yIntersect;
|
||||
|
@ -2145,8 +2144,10 @@ s32 Math3D_YZInSphere(Sphere16* sphere, f32 y, f32 z) {
|
|||
return false;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Math3D_DrawSphere(PlayState* play, Sphere16* sph) {
|
||||
}
|
||||
|
||||
void Math3D_DrawCylinder(PlayState* play, Cylinder16* cyl) {
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -603,7 +603,7 @@ Mtx* Matrix_MtxFToMtx(MtxF* src, Mtx* dest) {
|
|||
return dest;
|
||||
}
|
||||
|
||||
#ifdef OOT_DEBUG
|
||||
#if OOT_DEBUG
|
||||
|
||||
Mtx* Matrix_ToMtx(Mtx* dest, char* file, s32 line) {
|
||||
return Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(sCurrentMatrix, file, line), dest);
|
||||
|
@ -969,6 +969,7 @@ void Matrix_RotateAxis(f32 angle, Vec3f* axis, u8 mode) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) {
|
||||
s32 i, j;
|
||||
|
||||
|
@ -989,20 +990,21 @@ MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line) {
|
|||
|
||||
return mf;
|
||||
}
|
||||
#endif
|
||||
|
||||
void Matrix_SetTranslateUniformScaleMtxF(MtxF* mf, f32 scale, f32 translateX, f32 translateY, f32 translateZ) {
|
||||
mf->xx = scale;
|
||||
mf->yx = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->yy = scale;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xx = scale;
|
||||
mf->yy = scale;
|
||||
mf->zz = scale;
|
||||
mf->wz = 0.0f;
|
||||
mf->xw = translateX;
|
||||
mf->yw = translateY;
|
||||
mf->zw = translateZ;
|
||||
|
|
|
@ -147,5 +147,7 @@ void RumbleMgr_Init(RumbleMgr* rumbleMgr) {
|
|||
}
|
||||
|
||||
void RumbleMgr_Destroy(RumbleMgr* rumbleMgr) {
|
||||
#if OOT_DEBUG
|
||||
bzero(rumbleMgr, sizeof(RumbleMgr));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
#define LOG_SEVERITY_ERROR 2
|
||||
#define LOG_SEVERITY_VERBOSE 3
|
||||
|
||||
s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
Arena gSystemArena;
|
||||
|
||||
#if OOT_DEBUG
|
||||
s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
|
||||
void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) {
|
||||
if (ptr == NULL) {
|
||||
if (gSystemArenaLogSeverity >= LOG_SEVERITY_ERROR) {
|
||||
|
@ -21,53 +23,66 @@ void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char*
|
|||
}
|
||||
}
|
||||
|
||||
#define SYSTEM_ARENA_CHECK_POINTER(ptr, size, name, action) SystemArena_CheckPointer(ptr, size, name, action)
|
||||
#else
|
||||
#define SYSTEM_ARENA_CHECK_POINTER(ptr, size, name, action) (void)0
|
||||
#endif
|
||||
|
||||
void* SystemArena_Malloc(u32 size) {
|
||||
void* ptr = __osMalloc(&gSystemArena, size);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc", "確保"); // "Secure"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocDebug(&gSystemArena, size, file, line);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); // "Secure"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* SystemArena_MallocR(u32 size) {
|
||||
void* ptr = __osMallocR(&gSystemArena, size);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc_r", "確保"); // "Secure"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_r", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocRDebug(&gSystemArena, size, file, line);
|
||||
|
||||
SystemArena_CheckPointer(ptr, size, "malloc_r_DEBUG", "確保"); // "Secure"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, size, "malloc_r_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* SystemArena_Realloc(void* ptr, u32 newSize) {
|
||||
ptr = __osRealloc(&gSystemArena, ptr, newSize);
|
||||
SystemArena_CheckPointer(ptr, newSize, "realloc", "再確保"); // "Re-securing"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, newSize, "realloc", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* SystemArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
ptr = __osReallocDebug(&gSystemArena, ptr, newSize, file, line);
|
||||
SystemArena_CheckPointer(ptr, newSize, "realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
SYSTEM_ARENA_CHECK_POINTER(ptr, newSize, "realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SystemArena_Free(void* ptr) {
|
||||
__osFree(&gSystemArena, ptr);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
__osFreeDebug(&gSystemArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
void* SystemArena_Calloc(u32 num, u32 size) {
|
||||
void* ret;
|
||||
|
@ -78,14 +93,16 @@ void* SystemArena_Calloc(u32 num, u32 size) {
|
|||
bzero(ret, n);
|
||||
}
|
||||
|
||||
SystemArena_CheckPointer(ret, n, "calloc", "確保");
|
||||
SYSTEM_ARENA_CHECK_POINTER(ret, n, "calloc", "確保");
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void SystemArena_Display(void) {
|
||||
PRINTF("システムヒープ表示\n"); // "System heap display"
|
||||
__osDisplayArena(&gSystemArena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaImpl_GetSizes(&gSystemArena, outMaxFree, outFree, outAlloc);
|
||||
|
@ -96,12 +113,16 @@ void SystemArena_Check(void) {
|
|||
}
|
||||
|
||||
void SystemArena_Init(void* start, u32 size) {
|
||||
#if OOT_DEBUG
|
||||
gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocInit(&gSystemArena, start, size);
|
||||
}
|
||||
|
||||
void SystemArena_Cleanup(void) {
|
||||
#if OOT_DEBUG
|
||||
gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocCleanup(&gSystemArena);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,12 @@ F3dzexFlag sUCodeDisasMtxFlags[] = {
|
|||
F3DZEX_FLAG(G_MTX_PUSH, G_MTX_NOPUSH),
|
||||
};
|
||||
|
||||
typedef enum { COMBINER_A = 1, COMBINER_B, COMBINER_C, COMBINER_D } CombinerArg;
|
||||
typedef enum {
|
||||
COMBINER_A = 1,
|
||||
COMBINER_B,
|
||||
COMBINER_C,
|
||||
COMBINER_D
|
||||
} CombinerArg;
|
||||
|
||||
const char* UCodeDisas_GetCombineColorName(u32 value, u32 arg) {
|
||||
const char* ret = "?";
|
||||
|
|
|
@ -11,6 +11,16 @@
|
|||
static CollisionPoly* sCurCeilingPoly;
|
||||
static s32 sCurCeilingBgId;
|
||||
|
||||
#if OOT_DEBUG
|
||||
#define ACTOR_DEBUG_PRINTF \
|
||||
if (R_ENABLE_ACTOR_DEBUG_PRINTF) \
|
||||
PRINTF
|
||||
#elif IDO_PRINTF_WORKAROUND
|
||||
#define ACTOR_DEBUG_PRINTF(args) (void)0
|
||||
#else
|
||||
#define ACTOR_DEBUG_PRINTF(format, ...) (void)0
|
||||
#endif
|
||||
|
||||
void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) {
|
||||
shape->yOffset = yOffset;
|
||||
shape->shadowDraw = shadowDraw;
|
||||
|
@ -23,43 +33,44 @@ void ActorShadow_Draw(Actor* actor, Lights* lights, PlayState* play, Gfx* dlist,
|
|||
f32 temp2;
|
||||
MtxF sp60;
|
||||
|
||||
if (actor->floorPoly != NULL) {
|
||||
temp1 = actor->world.pos.y - actor->floorHeight;
|
||||
if (actor->floorPoly == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (temp1 >= -50.0f && temp1 < 500.0f) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1553);
|
||||
temp1 = actor->world.pos.y - actor->floorHeight;
|
||||
|
||||
POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44);
|
||||
if (temp1 >= -50.0f && temp1 < 500.0f) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 1553);
|
||||
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
|
||||
COMBINED);
|
||||
POLY_OPA_DISP = Gfx_SetupDL(POLY_OPA_DISP, SETUPDL_44);
|
||||
|
||||
temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1);
|
||||
temp2 = 1.0f - (temp1 * (1.0f / 350));
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
|
||||
COMBINED);
|
||||
|
||||
if (color != NULL) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->r, color->g, color->b,
|
||||
(u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
||||
}
|
||||
temp1 = (temp1 < 0.0f) ? 0.0f : ((temp1 > 150.0f) ? 150.0f : temp1);
|
||||
temp2 = 1.0f - (temp1 * (1.0f / 350));
|
||||
|
||||
func_80038A28(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &sp60);
|
||||
Matrix_Put(&sp60);
|
||||
|
||||
if (dlist != gCircleShadowDL) {
|
||||
Matrix_RotateY(BINANG_TO_RAD(actor->shape.rot.y), MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale;
|
||||
Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 1588),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, dlist);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1594);
|
||||
if (color != NULL) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->r, color->g, color->b,
|
||||
(u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u32)(actor->shape.shadowAlpha * temp2) & 0xFF);
|
||||
}
|
||||
|
||||
func_80038A28(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &sp60);
|
||||
Matrix_Put(&sp60);
|
||||
|
||||
if (dlist != gCircleShadowDL) {
|
||||
Matrix_RotateY(BINANG_TO_RAD(actor->shape.rot.y), MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
temp2 = (1.0f - (temp1 * (1.0f / 350))) * actor->shape.shadowScale;
|
||||
Matrix_Scale(actor->scale.x * temp2, 1.0f, actor->scale.z * temp2, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 1588), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, dlist);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 1594);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,6 +159,8 @@ void ActorShadow_DrawFeet(Actor* actor, Lights* lights, PlayState* play) {
|
|||
actor->shape.feetFloorFlag <<= 1;
|
||||
distToFloor = feetPosPtr->y - *floorHeightPtr;
|
||||
|
||||
if (1) {}
|
||||
|
||||
if ((-1.0f <= distToFloor) && (distToFloor < 500.0f)) {
|
||||
if (distToFloor <= 0.0f) {
|
||||
actor->shape.feetFloorFlag++;
|
||||
|
@ -284,13 +297,11 @@ void Actor_SetNaviToActor(TargetContext* targetCtx, Actor* actor, s32 actorCateg
|
|||
}
|
||||
|
||||
void func_8002C0C0(TargetContext* targetCtx, Actor* actor, PlayState* play) {
|
||||
targetCtx->arrowPointedActor = NULL;
|
||||
targetCtx->targetedActor = NULL;
|
||||
targetCtx->unk_40 = 0.0f;
|
||||
targetCtx->unk_8C = NULL;
|
||||
targetCtx->bgmEnemy = NULL;
|
||||
targetCtx->arrowPointedActor = targetCtx->targetedActor = targetCtx->unk_8C = targetCtx->bgmEnemy = NULL;
|
||||
|
||||
targetCtx->unk_4B = 0;
|
||||
targetCtx->unk_4C = 0;
|
||||
targetCtx->unk_40 = 0.0f;
|
||||
Actor_SetNaviToActor(targetCtx, actor, actor->category, play);
|
||||
func_8002BE98(targetCtx, actor->category, play);
|
||||
}
|
||||
|
@ -304,13 +315,12 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) {
|
|||
TargetContextEntry* entry;
|
||||
Player* player;
|
||||
s16 spCE;
|
||||
f32 temp1;
|
||||
f32 var1;
|
||||
Vec3f projTargetCenter;
|
||||
s32 spB8;
|
||||
f32 projTargetCappedInvW;
|
||||
s32 spB0;
|
||||
s32 spAC;
|
||||
f32 var1;
|
||||
f32 var2;
|
||||
s32 i;
|
||||
|
||||
|
@ -417,13 +427,6 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Pl
|
|||
s32 actorCategory;
|
||||
Vec3f projectedFocusPos;
|
||||
f32 cappedInvWDest;
|
||||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 temp4;
|
||||
f32 temp5;
|
||||
f32 temp6;
|
||||
s32 lockOnSfxId;
|
||||
|
||||
unkActor = NULL;
|
||||
|
||||
|
@ -458,10 +461,12 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Pl
|
|||
}
|
||||
|
||||
if (Math_StepToF(&targetCtx->unk_40, 0.0f, 0.25f) == 0) {
|
||||
temp1 = 0.25f / targetCtx->unk_40;
|
||||
temp2 = unkActor->world.pos.x - targetCtx->naviRefPos.x;
|
||||
temp3 = (unkActor->world.pos.y + (unkActor->targetArrowOffset * unkActor->scale.y)) - targetCtx->naviRefPos.y;
|
||||
temp4 = unkActor->world.pos.z - targetCtx->naviRefPos.z;
|
||||
f32 temp1 = 0.25f / targetCtx->unk_40;
|
||||
f32 temp2 = unkActor->world.pos.x - targetCtx->naviRefPos.x;
|
||||
f32 temp3 =
|
||||
(unkActor->world.pos.y + (unkActor->targetArrowOffset * unkActor->scale.y)) - targetCtx->naviRefPos.y;
|
||||
f32 temp4 = unkActor->world.pos.z - targetCtx->naviRefPos.z;
|
||||
|
||||
targetCtx->naviRefPos.x += temp2 * temp1;
|
||||
targetCtx->naviRefPos.y += temp3 * temp1;
|
||||
targetCtx->naviRefPos.z += temp4 * temp1;
|
||||
|
@ -479,6 +484,8 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Pl
|
|||
|
||||
if (actorArg != NULL) {
|
||||
if (actorArg != targetCtx->targetedActor) {
|
||||
s32 lockOnSfxId;
|
||||
|
||||
func_8002BE98(targetCtx, actorArg->category, play);
|
||||
targetCtx->targetedActor = actorArg;
|
||||
|
||||
|
@ -496,8 +503,9 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Pl
|
|||
targetCtx->targetCenterPos.z = actorArg->world.pos.z;
|
||||
|
||||
if (targetCtx->unk_4B == 0) {
|
||||
temp5 = (500.0f - targetCtx->unk_44) * 3.0f;
|
||||
temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5);
|
||||
f32 temp5 = (500.0f - targetCtx->unk_44) * 3.0f;
|
||||
f32 temp6 = (temp5 < 30.0f) ? 30.0f : ((100.0f < temp5) ? 100.0f : temp5);
|
||||
|
||||
if (Math_StepToF(&targetCtx->unk_44, 80.0f, temp6) != 0) {
|
||||
targetCtx->unk_4B++;
|
||||
}
|
||||
|
@ -715,9 +723,9 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) {
|
|||
if (titleCtx->alpha != 0) {
|
||||
width = titleCtx->width;
|
||||
height = titleCtx->height;
|
||||
doubleWidth = width * 2;
|
||||
titleX = (titleCtx->x * 4) - (width * 2);
|
||||
titleY = (titleCtx->y * 4) - (height * 2);
|
||||
doubleWidth = width * 2;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2824);
|
||||
|
||||
|
@ -832,11 +840,13 @@ void Actor_Destroy(Actor* actor, PlayState* play) {
|
|||
actor->destroy(actor, play);
|
||||
actor->destroy = NULL;
|
||||
} else {
|
||||
#if OOT_DEBUG
|
||||
overlayEntry = actor->overlayEntry;
|
||||
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
||||
|
||||
// "No Actor class destruct [%s]"
|
||||
PRINTF("Actorクラス デストラクトがありません [%s]\n" VT_RST, name);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1291,12 +1301,6 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
f32 sp74;
|
||||
s32 pad;
|
||||
Vec3f sp64;
|
||||
s32 bgId;
|
||||
CollisionPoly* wallPoly;
|
||||
f32 sp58;
|
||||
WaterBox* waterBox;
|
||||
f32 waterBoxYSurface;
|
||||
Vec3f ripplePos;
|
||||
|
||||
sp74 = actor->world.pos.y - actor->prevPos.y;
|
||||
|
||||
|
@ -1305,12 +1309,16 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
}
|
||||
|
||||
if (flags & UPDBGCHECKINFO_FLAG_0) {
|
||||
s32 bgId;
|
||||
|
||||
if ((!(flags & UPDBGCHECKINFO_FLAG_7) &&
|
||||
BgCheck_EntitySphVsWall3(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius,
|
||||
&actor->wallPoly, &bgId, actor, wallCheckHeight)) ||
|
||||
((flags & UPDBGCHECKINFO_FLAG_7) &&
|
||||
BgCheck_EntitySphVsWall4(&play->colCtx, &sp64, &actor->world.pos, &actor->prevPos, wallCheckRadius,
|
||||
&actor->wallPoly, &bgId, actor, wallCheckHeight))) {
|
||||
CollisionPoly* wallPoly;
|
||||
|
||||
wallPoly = actor->wallPoly;
|
||||
Math_Vec3f_Copy(&actor->world.pos, &sp64);
|
||||
actor->wallYaw = Math_Atan2S(wallPoly->normal.z, wallPoly->normal.x);
|
||||
|
@ -1325,6 +1333,8 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
sp64.z = actor->world.pos.z;
|
||||
|
||||
if (flags & UPDBGCHECKINFO_FLAG_1) {
|
||||
f32 sp58;
|
||||
|
||||
sp64.y = actor->prevPos.y + 10.0f;
|
||||
if (BgCheck_EntityCheckCeiling(&play->colCtx, &sp58, &sp64, (ceilingCheckHeight + sp74) - 10.0f,
|
||||
&sCurCeilingPoly, &sCurCeilingBgId, actor)) {
|
||||
|
@ -1336,6 +1346,9 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
}
|
||||
|
||||
if (flags & UPDBGCHECKINFO_FLAG_2) {
|
||||
WaterBox* waterBox;
|
||||
f32 waterBoxYSurface;
|
||||
|
||||
sp64.y = actor->prevPos.y;
|
||||
func_8002E2AC(play, actor, &sp64, flags);
|
||||
waterBoxYSurface = actor->world.pos.y;
|
||||
|
@ -1346,6 +1359,8 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight,
|
|||
actor->bgCheckFlags &= ~(BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH);
|
||||
} else {
|
||||
if (!(actor->bgCheckFlags & BGCHECKFLAG_WATER)) {
|
||||
Vec3f ripplePos;
|
||||
|
||||
actor->bgCheckFlags |= BGCHECKFLAG_WATER_TOUCH;
|
||||
if (!(flags & UPDBGCHECKINFO_FLAG_6)) {
|
||||
ripplePos.x = actor->world.pos.x;
|
||||
|
@ -1377,12 +1392,15 @@ Gfx* func_8002E830(Vec3f* object, Vec3f* eye, Vec3f* lightDir, GraphicsContext*
|
|||
|
||||
*hilite = GRAPH_ALLOC(gfxCtx, sizeof(Hilite));
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (R_HREG_MODE == HREG_MODE_PRINT_HILITE_INFO) {
|
||||
PRINTF("z_actor.c 3529 eye=[%f(%f) %f %f] object=[%f %f %f] light_direction=[%f %f %f]\n", correctedEyeX,
|
||||
eye->x, eye->y, eye->z, object->x, object->y, object->z, lightDir->x, lightDir->y, lightDir->z);
|
||||
}
|
||||
#endif
|
||||
|
||||
VIEW_ERROR_CHECK_EYE_POS(correctedEyeX, eye->y, eye->z);
|
||||
|
||||
View_ErrorCheckEyePosition(correctedEyeX, eye->y, eye->z);
|
||||
guLookAtHilite(&D_8015BBA8, lookAt, *hilite, correctedEyeX, eye->y, eye->z, object->x, object->y, object->z, 0.0f,
|
||||
1.0f, 0.0f, lightDir->x, lightDir->y, lightDir->z, lightDir->x, lightDir->y, lightDir->z, 16, 16);
|
||||
|
||||
|
@ -1773,8 +1791,8 @@ void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4,
|
|||
|
||||
player->unk_8A0 = arg6;
|
||||
player->unk_8A1 = arg5;
|
||||
player->unk_8A2 = arg3;
|
||||
player->unk_8A4 = arg2;
|
||||
player->unk_8A2 = arg3;
|
||||
player->unk_8A8 = arg4;
|
||||
}
|
||||
|
||||
|
@ -1903,11 +1921,12 @@ void func_8002FA60(PlayState* play) {
|
|||
gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z = 0.0f;
|
||||
}
|
||||
|
||||
lightPos.x = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x;
|
||||
lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f;
|
||||
lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z;
|
||||
|
||||
// clang-format off
|
||||
lightPos.x = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.x; \
|
||||
lightPos.y = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y + 80.0f; \
|
||||
lightPos.z = gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z; \
|
||||
Lights_PointNoGlowSetInfo(&D_8015BC00, lightPos.x, lightPos.y, lightPos.z, 0xFF, 0xFF, 0xFF, -1);
|
||||
// clang-format on
|
||||
|
||||
D_8015BC10 = LightContext_InsertLight(play, &play->lightCtx, &D_8015BC00);
|
||||
D_8015BC14 = 0;
|
||||
|
@ -2137,7 +2156,7 @@ u32 sCategoryFreezeMasks[ACTORCAT_MAX] = {
|
|||
};
|
||||
|
||||
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
||||
Actor* refActor;
|
||||
s32 i;
|
||||
Actor* actor;
|
||||
Player* player;
|
||||
u32* categoryFreezeMaskP;
|
||||
|
@ -2145,7 +2164,6 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
|||
u32 canFreezeCategory;
|
||||
Actor* sp74;
|
||||
ActorEntry* actorEntry;
|
||||
s32 i;
|
||||
|
||||
player = GET_PLAYER(play);
|
||||
|
||||
|
@ -2169,12 +2187,15 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
|
|||
actorCtx->unk_02--;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (KREG(0) == -100) {
|
||||
refActor = &GET_PLAYER(play)->actor;
|
||||
Actor* player = &GET_PLAYER(play)->actor;
|
||||
|
||||
KREG(0) = 0;
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, refActor->world.pos.y + 100.0f,
|
||||
refActor->world.pos.z, 0, 0, 0, 1);
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, player->world.pos.x, player->world.pos.y + 100.0f,
|
||||
player->world.pos.z, 0, 0, 0, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
categoryFreezeMaskP = &sCategoryFreezeMasks[0];
|
||||
|
||||
|
@ -2288,10 +2309,14 @@ void Actor_FaultPrint(Actor* actor, char* command) {
|
|||
FaultDrawer_Printf("ACTOR NAME is NULL");
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
overlayEntry = actor->overlayEntry;
|
||||
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
||||
|
||||
PRINTF("アクターの名前(%08x:%s)\n", actor, name); // "Actor name (%08x:%s)"
|
||||
#else
|
||||
name = "";
|
||||
#endif
|
||||
|
||||
if (command != NULL) {
|
||||
PRINTF("コメント:%s\n", command); // "Command:%s"
|
||||
|
@ -2537,20 +2562,22 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
|||
gDPNoOpString(POLY_OPA_DISP++, actorName, i);
|
||||
gDPNoOpString(POLY_XLU_DISP++, actorName, i);
|
||||
|
||||
HREG(66) = i;
|
||||
if (OOT_DEBUG) {
|
||||
HREG(66) = i;
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(68) == 0)) {
|
||||
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &actor->world.pos, &actor->projectedPos,
|
||||
&actor->projectedW);
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(69) == 0)) {
|
||||
if (actor->sfx != 0) {
|
||||
func_80030ED8(actor);
|
||||
}
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(70) == 0)) {
|
||||
if (func_800314B0(play, actor)) {
|
||||
actor->flags |= ACTOR_FLAG_6;
|
||||
} else {
|
||||
|
@ -2560,7 +2587,7 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
|||
|
||||
actor->isDrawn = false;
|
||||
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) {
|
||||
if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) {
|
||||
if ((actor->flags & ACTOR_FLAG_REACT_TO_LENS) &&
|
||||
((play->roomCtx.curRoom.lensMode == LENS_MODE_HIDE_ACTORS) || play->actorCtx.lensActive ||
|
||||
|
@ -2570,7 +2597,8 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
|||
invisibleActors[invisibleActorCounter] = actor;
|
||||
invisibleActorCounter++;
|
||||
} else {
|
||||
if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(72) == 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) ||
|
||||
(HREG(72) == 0)) {
|
||||
Actor_Draw(play, actor);
|
||||
actor->isDrawn = true;
|
||||
}
|
||||
|
@ -2582,15 +2610,15 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || (HREG(73) != 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(73) != 0)) {
|
||||
Effect_DrawAll(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || (HREG(74) != 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(74) != 0)) {
|
||||
EffectSs_DrawAll(play);
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || (HREG(72) != 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(72) != 0)) {
|
||||
if (play->actorCtx.lensActive) {
|
||||
Actor_DrawLensActors(play, invisibleActorCounter, invisibleActors);
|
||||
if ((play->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(play)) {
|
||||
|
@ -2605,13 +2633,15 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
|
|||
Lights_DrawGlow(play);
|
||||
}
|
||||
|
||||
if ((HREG(64) != 1) || (HREG(75) != 0)) {
|
||||
if (!OOT_DEBUG || (HREG(64) != 1) || (HREG(75) != 0)) {
|
||||
TitleCard_Draw(play, &actorCtx->titleCtx);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if ((HREG(64) != 1) || (HREG(76) != 0)) {
|
||||
CollisionCheck_DrawCollision(play, &play->colChkCtx);
|
||||
}
|
||||
#endif
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6563);
|
||||
}
|
||||
|
@ -2693,9 +2723,7 @@ void func_80031C3C(ActorContext* actorCtx, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("絶対魔法領域解放\n"); // "Absolute magic field deallocation"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("絶対魔法領域解放\n"); // "Absolute magic field deallocation"
|
||||
|
||||
if (actorCtx->absoluteSpace != NULL) {
|
||||
ZELDA_ARENA_FREE(actorCtx->absoluteSpace, "../z_actor.c", 6731);
|
||||
|
@ -2765,32 +2793,24 @@ void Actor_FreeOverlay(ActorOverlay* actorOverlay) {
|
|||
PRINTF(VT_FGCOL(CYAN));
|
||||
|
||||
if (actorOverlay->numLoaded == 0) {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("アクタークライアントが0になりました\n"); // "Actor client is now 0"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("アクタークライアントが0になりました\n"); // "Actor client is now 0"
|
||||
|
||||
if (actorOverlay->loadedRamAddr != NULL) {
|
||||
if (actorOverlay->allocType & ACTOROVL_ALLOC_PERSISTENT) {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("オーバーレイ解放しません\n"); // "Overlay will not be deallocated"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("オーバーレイ解放しません\n"); // "Overlay will not be deallocated"
|
||||
} else if (actorOverlay->allocType & ACTOROVL_ALLOC_ABSOLUTE) {
|
||||
if (HREG(20) != 0) {
|
||||
// "Absolute magic field reserved, so deallocation will not occur"
|
||||
PRINTF("絶対魔法領域確保なので解放しません\n");
|
||||
}
|
||||
// "Absolute magic field reserved, so deallocation will not occur"
|
||||
ACTOR_DEBUG_PRINTF("絶対魔法領域確保なので解放しません\n");
|
||||
actorOverlay->loadedRamAddr = NULL;
|
||||
} else {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("オーバーレイ解放します\n"); // "Overlay deallocated"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("オーバーレイ解放します\n"); // "Overlay deallocated"
|
||||
ZELDA_ARENA_FREE(actorOverlay->loadedRamAddr, "../z_actor.c", 6834);
|
||||
actorOverlay->loadedRamAddr = NULL;
|
||||
}
|
||||
}
|
||||
} else if (HREG(20) != 0) {
|
||||
} else {
|
||||
// "%d of actor client remains"
|
||||
PRINTF("アクタークライアントはあと %d 残っています\n", actorOverlay->numLoaded);
|
||||
ACTOR_DEBUG_PRINTF("アクタークライアントはあと %d 残っています\n", actorOverlay->numLoaded);
|
||||
}
|
||||
|
||||
PRINTF(VT_RST);
|
||||
|
@ -2810,13 +2830,14 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
overlayEntry = &gActorOverlayTable[actorId];
|
||||
ASSERT(actorId < ACTOR_ID_MAX, "profile < ACTOR_DLF_MAX", "../z_actor.c", 6883);
|
||||
|
||||
#if OOT_DEBUG
|
||||
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
||||
#endif
|
||||
|
||||
overlaySize = (uintptr_t)overlayEntry->vramEnd - (uintptr_t)overlayEntry->vramStart;
|
||||
|
||||
if (HREG(20) != 0) {
|
||||
// "Actor class addition [%d:%s]"
|
||||
PRINTF("アクタークラス追加 [%d:%s]\n", actorId, name);
|
||||
}
|
||||
// "Actor class addition [%d:%s]"
|
||||
ACTOR_DEBUG_PRINTF("アクタークラス追加 [%d:%s]\n", actorId, name);
|
||||
|
||||
if (actorCtx->total > ACTOR_NUMBER_MAX) {
|
||||
// "Actor set number exceeded"
|
||||
|
@ -2825,16 +2846,12 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
}
|
||||
|
||||
if (overlayEntry->vramStart == NULL) {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("オーバーレイではありません\n"); // "Not an overlay"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("オーバーレイではありません\n"); // "Not an overlay"
|
||||
|
||||
actorInit = overlayEntry->initInfo;
|
||||
} else {
|
||||
if (overlayEntry->loadedRamAddr != NULL) {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("既にロードされています\n"); // "Already loaded"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("既にロードされています\n"); // "Already loaded"
|
||||
} else {
|
||||
if (overlayEntry->allocType & ACTOROVL_ALLOC_ABSOLUTE) {
|
||||
ASSERT(overlaySize <= ACTOROVL_ABSOLUTE_SPACE_SIZE, "actor_segsize <= AM_FIELD_SIZE", "../z_actor.c",
|
||||
|
@ -2843,10 +2860,8 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
if (actorCtx->absoluteSpace == NULL) {
|
||||
// "AMF: absolute magic field"
|
||||
actorCtx->absoluteSpace = ZELDA_ARENA_MALLOC_R(ACTOROVL_ABSOLUTE_SPACE_SIZE, "AMF:絶対魔法領域", 0);
|
||||
if (HREG(20) != 0) {
|
||||
// "Absolute magic field reservation - %d bytes reserved"
|
||||
PRINTF("絶対魔法領域確保 %d バイト確保\n", ACTOROVL_ABSOLUTE_SPACE_SIZE);
|
||||
}
|
||||
// "Absolute magic field reservation - %d bytes reserved"
|
||||
ACTOR_DEBUG_PRINTF("絶対魔法領域確保 %d バイト確保\n", ACTOROVL_ABSOLUTE_SPACE_SIZE);
|
||||
}
|
||||
|
||||
overlayEntry->loadedRamAddr = actorCtx->absoluteSpace;
|
||||
|
@ -2908,10 +2923,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
|
|||
|
||||
overlayEntry->numLoaded++;
|
||||
|
||||
if (HREG(20) != 0) {
|
||||
// "Actor client No. %d"
|
||||
PRINTF("アクタークライアントは %d 個目です\n", overlayEntry->numLoaded);
|
||||
}
|
||||
if (1) {}
|
||||
|
||||
// "Actor client No. %d"
|
||||
ACTOR_DEBUG_PRINTF("アクタークライアントは %d 個目です\n", overlayEntry->numLoaded);
|
||||
|
||||
Lib_MemSet((u8*)actor, actorInit->instanceSize, 0);
|
||||
actor->overlayEntry = overlayEntry;
|
||||
|
@ -3009,9 +3024,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
|
|||
overlayEntry = actor->overlayEntry;
|
||||
name = overlayEntry->name != NULL ? overlayEntry->name : "";
|
||||
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("アクタークラス削除 [%s]\n", name); // "Actor class deleted [%s]"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("アクタークラス削除 [%s]\n", name); // "Actor class deleted [%s]"
|
||||
|
||||
if ((player != NULL) && (actor == player->unk_664)) {
|
||||
func_8008EDF0(player);
|
||||
|
@ -3038,9 +3051,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
|
|||
ZELDA_ARENA_FREE(actor, "../z_actor.c", 7242);
|
||||
|
||||
if (overlayEntry->vramStart == NULL) {
|
||||
if (HREG(20) != 0) {
|
||||
PRINTF("オーバーレイではありません\n"); // "Not an overlay"
|
||||
}
|
||||
ACTOR_DEBUG_PRINTF("オーバーレイではありません\n"); // "Not an overlay"
|
||||
} else {
|
||||
ASSERT(overlayEntry->loadedRamAddr != NULL, "actor_dlftbl->allocp != NULL", "../z_actor.c", 7251);
|
||||
ASSERT(overlayEntry->numLoaded > 0, "actor_dlftbl->clients > 0", "../z_actor.c", 7252);
|
||||
|
@ -3714,7 +3725,7 @@ void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) {
|
|||
f32 chainRotZ;
|
||||
f32 chainsTranslateX;
|
||||
f32 chainsTranslateY;
|
||||
f32 rotZStep;
|
||||
s32 pad;
|
||||
|
||||
entry = &sDoorLocksInfo[type];
|
||||
chainRotZ = entry->chainsRotZInit;
|
||||
|
@ -3724,28 +3735,34 @@ void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type) {
|
|||
Matrix_Translate(0.0f, entry->yShift, 500.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&baseMtxF);
|
||||
|
||||
chainsTranslateX = sinf(entry->chainAngle - chainRotZ) * -(10 - frame) * 0.1f * entry->chainLength;
|
||||
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
||||
{
|
||||
f32 rotZStep;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
Matrix_Put(&baseMtxF);
|
||||
Matrix_RotateZ(chainRotZ, MTXMODE_APPLY);
|
||||
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
||||
chainsTranslateX = sinf(entry->chainAngle - chainRotZ) * -(10 - frame) * 0.1f * entry->chainLength;
|
||||
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;
|
||||
|
||||
if (entry->chainsScale != 1.0f) {
|
||||
Matrix_Scale(entry->chainsScale, entry->chainsScale, entry->chainsScale, MTXMODE_APPLY);
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
||||
Matrix_Put(&baseMtxF);
|
||||
Matrix_RotateZ(chainRotZ, MTXMODE_APPLY);
|
||||
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
|
||||
|
||||
if (entry->chainsScale != 1.0f) {
|
||||
Matrix_Scale(entry->chainsScale, entry->chainsScale, entry->chainsScale, MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 8299),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, entry->chainDL);
|
||||
|
||||
if (i % 2) {
|
||||
rotZStep = 2.0f * entry->chainAngle;
|
||||
} else {
|
||||
rotZStep = M_PI - (2.0f * entry->chainAngle);
|
||||
}
|
||||
|
||||
chainRotZ += rotZStep;
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_actor.c", 8299), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, entry->chainDL);
|
||||
|
||||
if (i % 2) {
|
||||
rotZStep = 2.0f * entry->chainAngle;
|
||||
} else {
|
||||
rotZStep = M_PI - (2.0f * entry->chainAngle);
|
||||
}
|
||||
|
||||
chainRotZ += rotZStep;
|
||||
}
|
||||
|
||||
Matrix_Put(&baseMtxF);
|
||||
|
@ -4404,19 +4421,19 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3,
|
|||
}
|
||||
|
||||
void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2) {
|
||||
f32 floorPolyNormalX;
|
||||
f32 floorPolyNormalY;
|
||||
f32 floorPolyNormalZ;
|
||||
f32 sp38;
|
||||
f32 sp34;
|
||||
f32 sp30;
|
||||
f32 sp2C;
|
||||
f32 sp28;
|
||||
f32 sp24;
|
||||
CollisionPoly* floorPoly;
|
||||
s32 pad;
|
||||
|
||||
if (actor->floorPoly != NULL) {
|
||||
f32 floorPolyNormalX;
|
||||
f32 floorPolyNormalY;
|
||||
f32 floorPolyNormalZ;
|
||||
f32 sp38;
|
||||
f32 sp34;
|
||||
f32 sp30;
|
||||
f32 sp2C;
|
||||
f32 sp28;
|
||||
f32 sp24;
|
||||
CollisionPoly* floorPoly;
|
||||
s32 pad;
|
||||
|
||||
floorPoly = actor->floorPoly;
|
||||
floorPolyNormalX = COLPOLY_GET_NORMAL(floorPoly->normal.x);
|
||||
floorPolyNormalY = COLPOLY_GET_NORMAL(floorPoly->normal.y);
|
||||
|
|
|
@ -52,6 +52,7 @@ s32 gMaxActorId = 0;
|
|||
static FaultClient sFaultClient;
|
||||
|
||||
void ActorOverlayTable_LogPrint(void) {
|
||||
#if OOT_DEBUG
|
||||
ActorOverlay* overlayEntry;
|
||||
u32 i;
|
||||
|
||||
|
@ -63,6 +64,7 @@ void ActorOverlayTable_LogPrint(void) {
|
|||
overlayEntry->vramStart, overlayEntry->vramEnd, overlayEntry->loadedRamAddr, &overlayEntry->initInfo->id,
|
||||
overlayEntry->name != NULL ? overlayEntry->name : "?");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
|
||||
|
@ -80,7 +82,7 @@ void ActorOverlayTable_FaultPrint(void* arg0, void* arg1) {
|
|||
if (overlayEntry->loadedRamAddr != NULL) {
|
||||
FaultDrawer_Printf("%3d %08x-%08x %3d %s\n", i, overlayEntry->loadedRamAddr,
|
||||
(uintptr_t)overlayEntry->loadedRamAddr + overlaySize, overlayEntry->numLoaded,
|
||||
overlayEntry->name != NULL ? overlayEntry->name : "");
|
||||
(OOT_DEBUG && overlayEntry->name != NULL) ? overlayEntry->name : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4409,6 +4409,7 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec
|
|||
return result;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Draw a list of dyna polys, specified by `ssList`
|
||||
*/
|
||||
|
@ -4556,3 +4557,4 @@ void BgCheck_DrawStaticCollision(PlayState* play, CollisionContext* colCtx) {
|
|||
BgCheck_DrawStaticPolyList(play, colCtx, &lookup->ceiling, 255, 0, 0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@ typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*);
|
|||
typedef void (*ColChkVsFunc)(PlayState*, CollisionCheckContext*, Collider*, Collider*);
|
||||
typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec3f*, Vec3f*);
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Draws a red triangle with vertices vA, vB, and vC.
|
||||
*/
|
||||
|
@ -69,6 +70,7 @@ void Collider_DrawPoly(GraphicsContext* gfxCtx, Vec3f* vA, Vec3f* vB, Vec3f* vC,
|
|||
|
||||
CLOSE_DISPS(gfxCtx, "../z_collision_check.c", 757);
|
||||
}
|
||||
#endif
|
||||
|
||||
s32 Collider_InitBase(PlayState* play, Collider* col) {
|
||||
static Collider init = {
|
||||
|
@ -1000,9 +1002,12 @@ s32 Collider_ResetLineOC(PlayState* play, OcLine* line) {
|
|||
void CollisionCheck_InitContext(PlayState* play, CollisionCheckContext* colChkCtx) {
|
||||
colChkCtx->sacFlags = 0;
|
||||
CollisionCheck_ClearContext(play, colChkCtx);
|
||||
|
||||
#if OOT_DEBUG
|
||||
AREG(21) = true;
|
||||
AREG(22) = true;
|
||||
AREG(23) = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CollisionCheck_DestroyContext(PlayState* play, CollisionCheckContext* colChkCtx) {
|
||||
|
@ -1052,6 +1057,7 @@ void CollisionCheck_DisableSAC(PlayState* play, CollisionCheckContext* colChkCtx
|
|||
colChkCtx->sacFlags &= ~SAC_ENABLE;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Draws a collider of any shape.
|
||||
* Math3D_DrawSphere and Math3D_DrawCylinder are noops, so JntSph and Cylinder are not drawn.
|
||||
|
@ -1130,6 +1136,7 @@ void CollisionCheck_DrawCollision(PlayState* play, CollisionCheckContext* colChk
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static ColChkResetFunc sATResetFuncs[] = {
|
||||
Collider_ResetJntSphAT,
|
||||
|
@ -2153,8 +2160,6 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
|||
ColliderTris* atTris = (ColliderTris*)atCol;
|
||||
ColliderTrisElement* atTrisElem;
|
||||
ColliderCylinder* acCyl = (ColliderCylinder*)acCol;
|
||||
Vec3f atPos;
|
||||
Vec3f acPos;
|
||||
|
||||
if (acCyl->dim.radius > 0 && acCyl->dim.height > 0 && atTris->count > 0 && atTris->elements != NULL) {
|
||||
if (CollisionCheck_SkipElementBump(&acCyl->elem) == true) {
|
||||
|
@ -2169,6 +2174,9 @@ void CollisionCheck_ATTrisVsACCyl(PlayState* play, CollisionCheckContext* colChk
|
|||
}
|
||||
|
||||
if (Math3D_CylTriVsIntersect(&acCyl->dim, &atTrisElem->dim, &hitPos) == true) {
|
||||
Vec3f atPos;
|
||||
Vec3f acPos;
|
||||
|
||||
atPos.x = (atTrisElem->dim.vtx[0].x + atTrisElem->dim.vtx[1].x + atTrisElem->dim.vtx[2].x) * (1.0f / 3);
|
||||
atPos.y = (atTrisElem->dim.vtx[0].y + atTrisElem->dim.vtx[1].y + atTrisElem->dim.vtx[2].y) * (1.0f / 3);
|
||||
atPos.z = (atTrisElem->dim.vtx[0].z + atTrisElem->dim.vtx[1].z + atTrisElem->dim.vtx[2].z) * (1.0f / 3);
|
||||
|
@ -2512,11 +2520,12 @@ void CollisionCheck_ATQuadVsACQuad(PlayState* play, CollisionCheckContext* colCh
|
|||
void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) {
|
||||
ColliderJntSph* jntSph = (ColliderJntSph*)col;
|
||||
ColliderJntSphElement* jntSphElem;
|
||||
Vec3f hitPos;
|
||||
|
||||
for (jntSphElem = jntSph->elements; jntSphElem < jntSph->elements + jntSph->count; jntSphElem++) {
|
||||
if ((jntSphElem->base.bumperFlags & BUMP_DRAW_HITMARK) && (jntSphElem->base.acHitElem != NULL) &&
|
||||
!(jntSphElem->base.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) {
|
||||
Vec3f hitPos;
|
||||
|
||||
Math_Vec3s_ToVec3f(&hitPos, &jntSphElem->base.bumper.hitPos);
|
||||
CollisionCheck_HitEffects(play, jntSphElem->base.acHit, jntSphElem->base.acHitElem, &jntSph->base,
|
||||
&jntSphElem->base, &hitPos);
|
||||
|
@ -2528,10 +2537,11 @@ void CollisionCheck_SetJntSphHitFX(PlayState* play, CollisionCheckContext* colCh
|
|||
|
||||
void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) {
|
||||
ColliderCylinder* cyl = (ColliderCylinder*)col;
|
||||
Vec3f hitPos;
|
||||
|
||||
if ((cyl->elem.bumperFlags & BUMP_DRAW_HITMARK) && (cyl->elem.acHitElem != NULL) &&
|
||||
!(cyl->elem.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) {
|
||||
Vec3f hitPos;
|
||||
|
||||
Math_Vec3s_ToVec3f(&hitPos, &cyl->elem.bumper.hitPos);
|
||||
CollisionCheck_HitEffects(play, cyl->elem.acHit, cyl->elem.acHitElem, &cyl->base, &cyl->elem, &hitPos);
|
||||
cyl->elem.acHitElem->toucherFlags |= TOUCH_DREW_HITMARK;
|
||||
|
@ -2541,11 +2551,12 @@ void CollisionCheck_SetCylHitFX(PlayState* play, CollisionCheckContext* colChkCt
|
|||
void CollisionCheck_SetTrisHitFX(PlayState* play, CollisionCheckContext* colChkCtx, Collider* col) {
|
||||
ColliderTris* tris = (ColliderTris*)col;
|
||||
ColliderTrisElement* trisElem;
|
||||
Vec3f hitPos;
|
||||
|
||||
for (trisElem = tris->elements; trisElem < tris->elements + tris->count; trisElem++) {
|
||||
if ((trisElem->base.bumperFlags & BUMP_DRAW_HITMARK) && (trisElem->base.acHitElem != NULL) &&
|
||||
!(trisElem->base.acHitElem->toucherFlags & TOUCH_DREW_HITMARK)) {
|
||||
Vec3f hitPos;
|
||||
|
||||
Math_Vec3s_ToVec3f(&hitPos, &trisElem->base.bumper.hitPos);
|
||||
CollisionCheck_HitEffects(play, trisElem->base.acHit, trisElem->base.acHitElem, &tris->base,
|
||||
&trisElem->base, &hitPos);
|
||||
|
@ -2807,8 +2818,7 @@ void CollisionCheck_OC_JntSphVsJntSph(PlayState* play, CollisionCheckContext* co
|
|||
continue;
|
||||
}
|
||||
if (Math3D_SphVsSphOverlap(&leftJntSphElem->dim.worldSphere, &rightJntSphElem->dim.worldSphere,
|
||||
&overlapSize) ==
|
||||
true) {
|
||||
&overlapSize) == true) {
|
||||
Vec3f leftPos;
|
||||
Vec3f rightPos;
|
||||
|
||||
|
@ -3689,6 +3699,9 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags) {
|
|||
damage = 8;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
KREG(7) = damage;
|
||||
#endif
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@ void Interface_Init(PlayState* play) {
|
|||
|
||||
View_Init(&interfaceCtx->view, play->state.gfxCtx);
|
||||
|
||||
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
|
||||
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
|
||||
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
|
||||
|
||||
interfaceCtx->unk_22E = 0;
|
||||
interfaceCtx->lensMagicConsumptionTimer = 16;
|
||||
interfaceCtx->unk_1F4 = 0.0f;
|
||||
|
|
|
@ -153,6 +153,7 @@ void DebugCamera_DrawScreenText(GfxPrint* printer) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Updates the state of the Reg Editor according to user input.
|
||||
* Also contains a controller rumble test that can be interfaced with via related REGs.
|
||||
|
@ -269,6 +270,7 @@ void Regs_DrawEditor(GfxPrint* printer) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Draws the Reg Editor and Debug Camera text on screen
|
||||
|
@ -283,7 +285,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) {
|
|||
|
||||
GfxPrint_Init(&printer);
|
||||
opaStart = POLY_OPA_DISP;
|
||||
gfx = Graph_GfxPlusOne(POLY_OPA_DISP);
|
||||
gfx = Gfx_Open(POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, gfx);
|
||||
GfxPrint_Open(&printer, gfx);
|
||||
|
||||
|
@ -291,15 +293,17 @@ void Debug_DrawText(GraphicsContext* gfxCtx) {
|
|||
DebugCamera_DrawScreenText(&printer);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (gRegEditor->regPage != 0) {
|
||||
Regs_DrawEditor(&printer);
|
||||
}
|
||||
#endif
|
||||
|
||||
sDebugCamTextEntryCount = 0;
|
||||
|
||||
gfx = GfxPrint_Close(&printer);
|
||||
gSPEndDisplayList(gfx++);
|
||||
Graph_BranchDlist(opaStart, gfx);
|
||||
Gfx_Close(opaStart, gfx);
|
||||
POLY_OPA_DISP = gfx;
|
||||
|
||||
if (1) {}
|
||||
|
|
|
@ -130,6 +130,7 @@ s16 sQuakeIndex;
|
|||
|
||||
void Cutscene_SetupScripted(PlayState* play, CutsceneContext* csCtx);
|
||||
|
||||
#if OOT_DEBUG
|
||||
void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx) {
|
||||
GfxPrint printer;
|
||||
s32 pad[2];
|
||||
|
@ -149,6 +150,7 @@ void Cutscene_DrawDebugInfo(PlayState* play, Gfx** dlist, CutsceneContext* csCtx
|
|||
*dlist = GfxPrint_Close(&printer);
|
||||
GfxPrint_Destroy(&printer);
|
||||
}
|
||||
#endif
|
||||
|
||||
void Cutscene_InitContext(PlayState* play, CutsceneContext* csCtx) {
|
||||
csCtx->state = CS_STATE_IDLE;
|
||||
|
@ -173,20 +175,24 @@ void Cutscene_UpdateManual(PlayState* play, CutsceneContext* csCtx) {
|
|||
}
|
||||
|
||||
void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) {
|
||||
Input* input = &play->state.input[0];
|
||||
#if OOT_DEBUG
|
||||
{
|
||||
Input* input = &play->state.input[0];
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) {
|
||||
gUseCutsceneCam = false;
|
||||
gSaveContext.save.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
}
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) {
|
||||
gUseCutsceneCam = false;
|
||||
gSaveContext.save.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
}
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER &&
|
||||
!gDebugCamEnabled) {
|
||||
gUseCutsceneCam = true;
|
||||
gSaveContext.save.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER &&
|
||||
!gDebugCamEnabled) {
|
||||
gUseCutsceneCam = true;
|
||||
gSaveContext.save.cutsceneIndex = 0xFFFD;
|
||||
gSaveContext.cutsceneTrigger = 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((gSaveContext.cutsceneTrigger != 0) && (play->transitionTrigger == TRANS_TRIGGER_START)) {
|
||||
gSaveContext.cutsceneTrigger = 0;
|
||||
|
@ -562,7 +568,7 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
|
|||
}
|
||||
|
||||
if ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped ||
|
||||
((csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) &&
|
||||
(OOT_DEBUG && (csCtx->curFrame > 20) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) &&
|
||||
(gSaveContext.fileNum != 0xFEDC))) {
|
||||
csCtx->state = CS_STATE_RUN_UNSTOPPABLE;
|
||||
Audio_SetCutsceneFlag(0);
|
||||
|
@ -717,7 +723,9 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
|
|||
break;
|
||||
|
||||
case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION:
|
||||
SET_EVENTCHKINF(EVENTCHKINF_4F);
|
||||
#if OOT_DEBUG
|
||||
SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS);
|
||||
#endif
|
||||
play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4;
|
||||
play->transitionTrigger = TRANS_TRIGGER_START;
|
||||
play->transitionType = TRANS_TYPE_FADE_BLACK;
|
||||
|
@ -886,7 +894,9 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
|
|||
break;
|
||||
|
||||
case CS_DEST_TEMPLE_OF_TIME_AFTER_LIGHT_MEDALLION_ALT:
|
||||
SET_EVENTCHKINF(EVENTCHKINF_4F);
|
||||
#if OOT_DEBUG
|
||||
SET_EVENTCHKINF(EVENTCHKINF_WATCHED_SHEIK_AFTER_MASTER_SWORD_CS);
|
||||
#endif
|
||||
play->nextEntranceIndex = ENTR_TEMPLE_OF_TIME_4;
|
||||
play->transitionTrigger = TRANS_TRIGGER_START;
|
||||
play->transitionType = TRANS_TYPE_FADE_BLACK_FAST;
|
||||
|
@ -941,8 +951,10 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti
|
|||
break;
|
||||
|
||||
case CS_DEST_GERUDO_VALLEY_CREDITS:
|
||||
#if OOT_DEBUG
|
||||
gSaveContext.gameMode = GAMEMODE_END_CREDITS;
|
||||
Audio_SetSfxBanksMute(0x6F);
|
||||
#endif
|
||||
play->linkAgeOnLoad = LINK_AGE_CHILD;
|
||||
play->nextEntranceIndex = ENTR_GERUDO_VALLEY_0;
|
||||
gSaveContext.save.cutsceneIndex = 0xFFF2;
|
||||
|
@ -1779,10 +1791,12 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script)
|
|||
return;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) {
|
||||
csCtx->state = CS_STATE_STOP;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < totalEntries; i++) {
|
||||
MemCpy(&cmdType, script, sizeof(cmdType));
|
||||
|
@ -2189,31 +2203,26 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script)
|
|||
}
|
||||
|
||||
void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) {
|
||||
Gfx* displayList;
|
||||
Gfx* prevDisplayList;
|
||||
|
||||
if (0) {} // Necessary to match
|
||||
|
||||
if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {
|
||||
if (0) {} // Also necessary to match
|
||||
if (OOT_DEBUG && BREG(0) != 0) {
|
||||
Gfx* displayList;
|
||||
Gfx* prevDisplayList;
|
||||
|
||||
if (BREG(0) != 0) {
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101);
|
||||
|
||||
prevDisplayList = POLY_OPA_DISP;
|
||||
displayList = Graph_GfxPlusOne(POLY_OPA_DISP);
|
||||
displayList = Gfx_Open(POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, displayList);
|
||||
Cutscene_DrawDebugInfo(play, &displayList, csCtx);
|
||||
gSPEndDisplayList(displayList++);
|
||||
Graph_BranchDlist(prevDisplayList, displayList);
|
||||
Gfx_Close(prevDisplayList, displayList);
|
||||
POLY_OPA_DISP = displayList;
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108);
|
||||
}
|
||||
|
||||
csCtx->curFrame++;
|
||||
|
||||
if (R_USE_DEBUG_CUTSCENE) {
|
||||
if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) {
|
||||
Cutscene_ProcessScript(play, csCtx, gDebugCutsceneScript);
|
||||
} else {
|
||||
Cutscene_ProcessScript(play, csCtx, play->csCtx.script);
|
||||
|
|
|
@ -768,6 +768,8 @@ void GetItem_DrawSmallRupee(PlayState* play, s16 drawId) {
|
|||
|
||||
Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY);
|
||||
|
||||
if (1) {}
|
||||
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
gSPMatrix(POLY_OPA_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, sDrawItemTable[drawId].dlists[1]);
|
||||
|
|
|
@ -4,16 +4,10 @@
|
|||
void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
||||
EffectBlureElement* elem;
|
||||
s32 numElements;
|
||||
Vec3f sp16C;
|
||||
Vec3f sp160;
|
||||
Vec3f sp154;
|
||||
f32 scale;
|
||||
MtxF sp110;
|
||||
MtxF spD0;
|
||||
MtxF sp90;
|
||||
MtxF sp50;
|
||||
Vec3f sp44;
|
||||
Vec3f sp38;
|
||||
|
||||
// Necessary to match
|
||||
if (this) {}
|
||||
if (this) {}
|
||||
|
||||
if (this != NULL) {
|
||||
numElements = this->numElements;
|
||||
|
@ -34,6 +28,17 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
|||
elem->p2.y = p2->y;
|
||||
elem->p2.z = p2->z;
|
||||
} else {
|
||||
Vec3f sp16C;
|
||||
Vec3f sp160;
|
||||
Vec3f sp154;
|
||||
f32 scale;
|
||||
MtxF sp110;
|
||||
MtxF spD0;
|
||||
MtxF sp90;
|
||||
MtxF sp50;
|
||||
Vec3f sp44;
|
||||
Vec3f sp38;
|
||||
|
||||
sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f;
|
||||
sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f;
|
||||
sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f;
|
||||
|
@ -255,19 +260,16 @@ void EffectBlure_UpdateFlags(EffectBlureElement* elem) {
|
|||
Vec3f sp58;
|
||||
Vec3f sp4C;
|
||||
Vec3f sp40;
|
||||
EffectBlureElement* prev = elem - 1;
|
||||
EffectBlureElement* next = elem + 1;
|
||||
f32 sp34;
|
||||
f32 sp30;
|
||||
f32 sp2C;
|
||||
|
||||
if (((elem - 1)->state == 0) || ((elem + 1)->state == 0)) {
|
||||
elem->flags &= ~3;
|
||||
elem->flags |= 2;
|
||||
} else {
|
||||
EffectBlureElement* prev = elem - 1;
|
||||
EffectBlureElement* next = elem + 1;
|
||||
f32 sp34;
|
||||
f32 sp30;
|
||||
f32 sp2C;
|
||||
|
||||
if (1) {} // Necessary to match
|
||||
|
||||
Math_Vec3s_DiffToVec3f(&sp64, &elem->p1, &prev->p1);
|
||||
Math_Vec3s_DiffToVec3f(&sp58, &elem->p2, &prev->p2);
|
||||
Math_Vec3s_DiffToVec3f(&sp4C, &next->p1, &elem->p1);
|
||||
|
@ -1013,11 +1015,11 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
flag = 0;
|
||||
j = 0;
|
||||
|
||||
gSPVertex(POLY_XLU_DISP++, vtx, 32, 0);
|
||||
|
||||
flag = 0;
|
||||
for (i = 0; i < this->numElements; i++) {
|
||||
elem = &this->elements[i];
|
||||
|
||||
|
|
|
@ -114,7 +114,6 @@ s32 EffectShieldParticle_Update(void* thisx) {
|
|||
|
||||
void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* primColor, Color_RGBA8* envColor) {
|
||||
s32 halfDuration = this->duration * 0.5f;
|
||||
f32 ratio;
|
||||
|
||||
if (halfDuration == 0) {
|
||||
primColor->r = this->primColorStart.r;
|
||||
|
@ -126,7 +125,8 @@ void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* pri
|
|||
envColor->b = this->envColorStart.b;
|
||||
envColor->a = this->envColorStart.a;
|
||||
} else if (this->timer < halfDuration) {
|
||||
ratio = this->timer / (f32)halfDuration;
|
||||
f32 ratio = this->timer / (f32)halfDuration;
|
||||
|
||||
primColor->r = this->primColorStart.r + (this->primColorMid.r - this->primColorStart.r) * ratio;
|
||||
primColor->g = this->primColorStart.g + (this->primColorMid.g - this->primColorStart.g) * ratio;
|
||||
primColor->b = this->primColorStart.b + (this->primColorMid.b - this->primColorStart.b) * ratio;
|
||||
|
@ -136,7 +136,8 @@ void EffectShieldParticle_GetColors(EffectShieldParticle* this, Color_RGBA8* pri
|
|||
envColor->b = this->envColorStart.b + (this->envColorMid.b - this->envColorStart.b) * ratio;
|
||||
envColor->a = this->envColorStart.a + (this->envColorMid.a - this->envColorStart.a) * ratio;
|
||||
} else {
|
||||
ratio = (this->timer - halfDuration) / (f32)halfDuration;
|
||||
f32 ratio = (this->timer - halfDuration) / (f32)halfDuration;
|
||||
|
||||
primColor->r = this->primColorMid.r + (this->primColorEnd.r - this->primColorMid.r) * ratio;
|
||||
primColor->g = this->primColorMid.g + (this->primColorEnd.g - this->primColorMid.g) * ratio;
|
||||
primColor->b = this->primColorMid.b + (this->primColorEnd.b - this->primColorMid.b) * ratio;
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
void EffectSpark_Init(void* thisx, void* initParamsx) {
|
||||
EffectSpark* this = (EffectSpark*)thisx;
|
||||
EffectSparkInit* initParams = (EffectSparkInit*)initParamsx;
|
||||
EffectSparkElement* elem;
|
||||
f32 velocityNorm;
|
||||
s32 i;
|
||||
|
||||
|
@ -61,7 +60,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) {
|
|||
}
|
||||
|
||||
for (i = 0; i < this->numElements; i++) {
|
||||
elem = &this->elements[i];
|
||||
EffectSparkElement* elem = &this->elements[i];
|
||||
|
||||
elem->position.x = this->position.x;
|
||||
elem->position.y = this->position.y;
|
||||
|
|
|
@ -8,11 +8,13 @@ void EffectSs_InitInfo(PlayState* play, s32 tableSize) {
|
|||
EffectSs* effectSs;
|
||||
EffectSsOverlay* overlay;
|
||||
|
||||
#if OOT_DEBUG
|
||||
for (i = 0; i < ARRAY_COUNT(gEffectSsOverlayTable); i++) {
|
||||
overlay = &gEffectSsOverlayTable[i];
|
||||
PRINTF("effect index %3d:size=%6dbyte romsize=%6dbyte\n", i,
|
||||
(uintptr_t)overlay->vramEnd - (uintptr_t)overlay->vramStart, overlay->vromEnd - overlay->vromStart);
|
||||
}
|
||||
#endif
|
||||
|
||||
sEffectSsInfo.table =
|
||||
GAME_STATE_ALLOC(&play->state, tableSize * sizeof(EffectSs), "../z_effect_soft_sprite.c", 289);
|
||||
|
|
|
@ -130,6 +130,16 @@ typedef struct {
|
|||
} struct_8011F9B8;
|
||||
|
||||
void func_8006D684(PlayState* play, Player* player) {
|
||||
static struct_8011F9B8 D_8011F9B8[] = {
|
||||
{ SCENE_GERUDOS_FORTRESS, 0xFFF0, { 3600, 1413, 360 }, 0x8001, 8 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF0, { -250, 1, -1580 }, 0x4000, 6 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF1, { 0, 0, 0 }, 0x0000, 5 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF5, { 0, 0, 0 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF3, { -2961, 313, 7700 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF4, { -1900, 313, 7015 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF5, { -4043, 313, 6933 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF6, { -4043, 313, 6933 }, 0x0000, 7 },
|
||||
};
|
||||
s32 pad;
|
||||
s32 i;
|
||||
Vec3s spawnPos;
|
||||
|
@ -177,17 +187,6 @@ void func_8006D684(PlayState* play, Player* player) {
|
|||
player->rideActor->room = -1;
|
||||
}
|
||||
} else {
|
||||
static struct_8011F9B8 D_8011F9B8[] = {
|
||||
{ SCENE_GERUDOS_FORTRESS, 0xFFF0, { 3600, 1413, 360 }, 0x8001, 8 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF0, { -250, 1, -1580 }, 0x4000, 6 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF1, { 0, 0, 0 }, 0x0000, 5 },
|
||||
{ SCENE_LON_LON_RANCH, 0xFFF5, { 0, 0, 0 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF3, { -2961, 313, 7700 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF4, { -1900, 313, 7015 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF5, { -4043, 313, 6933 }, 0x0000, 7 },
|
||||
{ SCENE_HYRULE_FIELD, 0xFFF6, { -4043, 313, 6933 }, 0x0000, 7 },
|
||||
};
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
|
||||
if ((play->sceneId == D_8011F9B8[i].sceneId) &&
|
||||
(((void)0, gSaveContext.save.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
|
||||
|
|
|
@ -958,11 +958,11 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682);
|
||||
|
||||
prevDisplayList = POLY_OPA_DISP;
|
||||
displayList = Graph_GfxPlusOne(POLY_OPA_DISP);
|
||||
displayList = Gfx_Open(POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, displayList);
|
||||
Environment_PrintDebugInfo(play, &displayList);
|
||||
gSPEndDisplayList(displayList++);
|
||||
Graph_BranchDlist(prevDisplayList, displayList);
|
||||
Gfx_Close(prevDisplayList, displayList);
|
||||
POLY_OPA_DISP = displayList;
|
||||
if (1) {}
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690);
|
||||
|
|
|
@ -407,8 +407,10 @@ void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain) {
|
|||
* instead, with a minimum step of minStep. Returns remaining distance to target.
|
||||
*/
|
||||
f32 Math_SmoothStepToF(f32* pValue, f32 target, f32 fraction, f32 step, f32 minStep) {
|
||||
f32 stepSize;
|
||||
|
||||
if (*pValue != target) {
|
||||
f32 stepSize = (target - *pValue) * fraction;
|
||||
stepSize = (target - *pValue) * fraction;
|
||||
|
||||
if ((stepSize >= minStep) || (stepSize <= -minStep)) {
|
||||
if (stepSize > step) {
|
||||
|
|
|
@ -64,13 +64,12 @@ void Lights_Draw(Lights* lights, GraphicsContext* gfxCtx) {
|
|||
gSPNumLights(POLY_OPA_DISP++, lights->numLights);
|
||||
gSPNumLights(POLY_XLU_DISP++, lights->numLights);
|
||||
|
||||
i = 0;
|
||||
light = &lights->l.l[0];
|
||||
i = 0;
|
||||
|
||||
while (i < lights->numLights) {
|
||||
gSPLight(POLY_OPA_DISP++, light, ++i);
|
||||
gSPLight(POLY_XLU_DISP++, light, i);
|
||||
light++;
|
||||
gSPLight(POLY_XLU_DISP++, light++, i);
|
||||
}
|
||||
|
||||
// ambient light is total number of lights + 1
|
||||
|
@ -314,22 +313,20 @@ Lights* Lights_New(GraphicsContext* gfxCtx, u8 ambientR, u8 ambientG, u8 ambient
|
|||
}
|
||||
|
||||
void Lights_GlowCheck(PlayState* play) {
|
||||
LightNode* node;
|
||||
LightPoint* params;
|
||||
Vec3f pos;
|
||||
Vec3f multDest;
|
||||
f32 cappedInvWDest;
|
||||
f32 wX;
|
||||
f32 wY;
|
||||
s32 wZ;
|
||||
s32 zBuf;
|
||||
|
||||
node = play->lightCtx.listHead;
|
||||
LightNode* node = play->lightCtx.listHead;
|
||||
|
||||
while (node != NULL) {
|
||||
params = &node->info->params.point;
|
||||
LightPoint* params = &node->info->params.point;
|
||||
|
||||
if (node->info->type == LIGHT_POINT_GLOW) {
|
||||
Vec3f pos;
|
||||
Vec3f multDest;
|
||||
f32 cappedInvWDest;
|
||||
f32 wX;
|
||||
f32 wY;
|
||||
s32 wZ;
|
||||
s32 zBuf;
|
||||
|
||||
pos.x = params->x;
|
||||
pos.y = params->y;
|
||||
pos.z = params->z;
|
||||
|
@ -362,9 +359,7 @@ void Lights_GlowCheck(PlayState* play) {
|
|||
|
||||
void Lights_DrawGlow(PlayState* play) {
|
||||
s32 pad;
|
||||
LightNode* node;
|
||||
|
||||
node = play->lightCtx.listHead;
|
||||
LightNode* node = play->lightCtx.listHead;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_lights.c", 887);
|
||||
|
||||
|
@ -374,23 +369,20 @@ void Lights_DrawGlow(PlayState* play) {
|
|||
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleTextureLoadDL);
|
||||
|
||||
while (node != NULL) {
|
||||
LightInfo* info;
|
||||
LightPoint* params;
|
||||
f32 scale;
|
||||
s32 pad[4];
|
||||
if ((node->info->type == LIGHT_POINT_GLOW)) {
|
||||
s32 pad[6];
|
||||
LightPoint* params = &node->info->params.point;
|
||||
|
||||
info = node->info;
|
||||
params = &info->params.point;
|
||||
if (params->drawGlow) {
|
||||
f32 scale = SQ(params->radius) * 0.0000026f;
|
||||
|
||||
if ((info->type == LIGHT_POINT_GLOW) && (params->drawGlow)) {
|
||||
scale = SQ(params->radius) * 0.0000026f;
|
||||
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_lights.c", 918),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
Matrix_Translate(params->x, params->y, params->z, MTXMODE_NEW);
|
||||
Matrix_Scale(scale, scale, scale, MTXMODE_APPLY);
|
||||
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEW(play->state.gfxCtx, "../z_lights.c", 918),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_XLU_DISP++, gGlowCircleDL);
|
||||
}
|
||||
}
|
||||
|
||||
node = node->next;
|
||||
|
|
|
@ -4,9 +4,11 @@
|
|||
#define LOG_SEVERITY_ERROR 2
|
||||
#define LOG_SEVERITY_VERBOSE 3
|
||||
|
||||
s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR;
|
||||
Arena sZeldaArena;
|
||||
|
||||
#if OOT_DEBUG
|
||||
s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR;
|
||||
|
||||
void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action) {
|
||||
if (ptr == NULL) {
|
||||
if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR) {
|
||||
|
@ -20,53 +22,66 @@ void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char*
|
|||
}
|
||||
}
|
||||
|
||||
#define ZELDA_ARENA_CHECK_POINTER(ptr, size, name, action) ZeldaArena_CheckPointer(ptr, size, name, action)
|
||||
#else
|
||||
#define ZELDA_ARENA_CHECK_POINTER(ptr, size, name, action) (void)0
|
||||
#endif
|
||||
|
||||
void* ZeldaArena_Malloc(u32 size) {
|
||||
void* ptr = __osMalloc(&sZeldaArena, size);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc", "確保"); // "Secure"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocDebug(&sZeldaArena, size, file, line);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_DEBUG", "確保"); // "Secure"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* ZeldaArena_MallocR(u32 size) {
|
||||
void* ptr = __osMallocR(&sZeldaArena, size);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r", "確保"); // "Secure"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_r", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line) {
|
||||
void* ptr = __osMallocRDebug(&sZeldaArena, size, file, line);
|
||||
|
||||
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, size, "zelda_malloc_r_DEBUG", "確保"); // "Secure"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void* ZeldaArena_Realloc(void* ptr, u32 newSize) {
|
||||
ptr = __osRealloc(&sZeldaArena, ptr, newSize);
|
||||
ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc", "再確保"); // "Re-securing"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void* ZeldaArena_ReallocDebug(void* ptr, u32 newSize, const char* file, s32 line) {
|
||||
ptr = __osReallocDebug(&sZeldaArena, ptr, newSize, file, line);
|
||||
ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
ZELDA_ARENA_CHECK_POINTER(ptr, newSize, "zelda_realloc_DEBUG", "再確保"); // "Re-securing"
|
||||
return ptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ZeldaArena_Free(void* ptr) {
|
||||
__osFree(&sZeldaArena, ptr);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line) {
|
||||
__osFreeDebug(&sZeldaArena, ptr, file, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
void* ZeldaArena_Calloc(u32 num, u32 size) {
|
||||
void* ret;
|
||||
|
@ -77,14 +92,16 @@ void* ZeldaArena_Calloc(u32 num, u32 size) {
|
|||
bzero(ret, n);
|
||||
}
|
||||
|
||||
ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保"); // "Secure"
|
||||
ZELDA_ARENA_CHECK_POINTER(ret, n, "zelda_calloc", "確保"); // "Secure"
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
void ZeldaArena_Display(void) {
|
||||
PRINTF("ゼルダヒープ表示\n"); // "Zelda heap display"
|
||||
__osDisplayArena(&sZeldaArena);
|
||||
}
|
||||
#endif
|
||||
|
||||
void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaImpl_GetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc);
|
||||
|
@ -95,12 +112,16 @@ void ZeldaArena_Check(void) {
|
|||
}
|
||||
|
||||
void ZeldaArena_Init(void* start, u32 size) {
|
||||
#if OOT_DEBUG
|
||||
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocInit(&sZeldaArena, start, size);
|
||||
}
|
||||
|
||||
void ZeldaArena_Cleanup(void) {
|
||||
#if OOT_DEBUG
|
||||
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
|
||||
#endif
|
||||
__osMallocCleanup(&sZeldaArena);
|
||||
}
|
||||
|
||||
|
|
|
@ -3013,19 +3013,19 @@ void Message_Draw(PlayState* play) {
|
|||
watchVar = gSaveContext.save.info.scarecrowLongSongSet;
|
||||
Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx);
|
||||
if (BREG(0) != 0 && play->msgCtx.textId != 0) {
|
||||
plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP);
|
||||
plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, plusOne);
|
||||
Message_DrawDebugText(play, &plusOne);
|
||||
gSPEndDisplayList(plusOne++);
|
||||
Graph_BranchDlist(polyOpaP, plusOne);
|
||||
Gfx_Close(polyOpaP, plusOne);
|
||||
POLY_OPA_DISP = plusOne;
|
||||
}
|
||||
if (1) {}
|
||||
plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP);
|
||||
plusOne = Gfx_Open(polyOpaP = POLY_OPA_DISP);
|
||||
gSPDisplayList(OVERLAY_DISP++, plusOne);
|
||||
Message_DrawMain(play, &plusOne);
|
||||
gSPEndDisplayList(plusOne++);
|
||||
Graph_BranchDlist(polyOpaP, plusOne);
|
||||
Gfx_Close(polyOpaP, plusOne);
|
||||
POLY_OPA_DISP = plusOne;
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3582);
|
||||
}
|
||||
|
|
|
@ -1096,17 +1096,22 @@ void func_80083108(PlayState* play) {
|
|||
|
||||
void Interface_SetSceneRestrictions(PlayState* play) {
|
||||
InterfaceContext* interfaceCtx = &play->interfaceCtx;
|
||||
s16 i;
|
||||
s16 i = 0;
|
||||
u8 sceneId;
|
||||
s32 pad[3];
|
||||
|
||||
interfaceCtx->restrictions.hGauge = interfaceCtx->restrictions.bButton = interfaceCtx->restrictions.aButton =
|
||||
interfaceCtx->restrictions.bottles = interfaceCtx->restrictions.tradeItems =
|
||||
interfaceCtx->restrictions.hookshot = interfaceCtx->restrictions.ocarina =
|
||||
interfaceCtx->restrictions.warpSongs = interfaceCtx->restrictions.sunsSong =
|
||||
interfaceCtx->restrictions.farores = interfaceCtx->restrictions.dinsNayrus =
|
||||
interfaceCtx->restrictions.all = 0;
|
||||
|
||||
i = 0;
|
||||
interfaceCtx->restrictions.all = 0;
|
||||
interfaceCtx->restrictions.dinsNayrus = 0;
|
||||
interfaceCtx->restrictions.farores = 0;
|
||||
interfaceCtx->restrictions.sunsSong = 0;
|
||||
interfaceCtx->restrictions.warpSongs = 0;
|
||||
interfaceCtx->restrictions.ocarina = 0;
|
||||
interfaceCtx->restrictions.hookshot = 0;
|
||||
interfaceCtx->restrictions.tradeItems = 0;
|
||||
interfaceCtx->restrictions.bottles = 0;
|
||||
interfaceCtx->restrictions.aButton = 0;
|
||||
interfaceCtx->restrictions.bButton = 0;
|
||||
interfaceCtx->restrictions.hGauge = 0;
|
||||
|
||||
// "Data settings related to button display scene_data_ID=%d\n"
|
||||
PRINTF("ボタン表示関係データ設定 scene_data_ID=%d\n", play->sceneId);
|
||||
|
@ -1271,7 +1276,7 @@ void Inventory_SwapAgeEquipment(void) {
|
|||
}
|
||||
|
||||
shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.save.info.equips.equipment;
|
||||
if (shieldEquipValue != 0) {
|
||||
if (shieldEquipValue) {
|
||||
shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD];
|
||||
if (!CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, shieldEquipValue - 1)) {
|
||||
gSaveContext.save.info.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SHIELD];
|
||||
|
@ -1849,7 +1854,7 @@ u8 Item_Give(PlayState* play, u8 item) {
|
|||
u8 Item_CheckObtainability(u8 item) {
|
||||
s16 i;
|
||||
s16 slot = SLOT(item);
|
||||
s32 temp;
|
||||
s16 temp;
|
||||
|
||||
if (item >= ITEM_DEKU_STICKS_5) {
|
||||
slot = SLOT(sExtraItemBases[item - ITEM_DEKU_STICKS_5]);
|
||||
|
@ -2014,35 +2019,27 @@ s32 Inventory_ReplaceItem(PlayState* play, u16 oldItem, u16 newItem) {
|
|||
}
|
||||
|
||||
s32 Inventory_HasEmptyBottle(void) {
|
||||
u8* items = gSaveContext.save.info.inventory.items;
|
||||
s32 slot;
|
||||
|
||||
if (items[SLOT_BOTTLE_1] == ITEM_BOTTLE_EMPTY) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_2] == ITEM_BOTTLE_EMPTY) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_3] == ITEM_BOTTLE_EMPTY) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_4] == ITEM_BOTTLE_EMPTY) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_4; slot++) {
|
||||
if (gSaveContext.save.info.inventory.items[slot] == ITEM_BOTTLE_EMPTY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
s32 Inventory_HasSpecificBottle(u8 bottleItem) {
|
||||
u8* items = gSaveContext.save.info.inventory.items;
|
||||
s32 slot;
|
||||
|
||||
if (items[SLOT_BOTTLE_1] == bottleItem) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_2] == bottleItem) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_3] == bottleItem) {
|
||||
return true;
|
||||
} else if (items[SLOT_BOTTLE_4] == bottleItem) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
for (slot = SLOT_BOTTLE_1; slot <= SLOT_BOTTLE_4; slot++) {
|
||||
if (gSaveContext.save.info.inventory.items[slot] == bottleItem) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) {
|
||||
|
@ -3938,9 +3935,11 @@ void Interface_Draw(PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (pauseCtx->debugState == 3) {
|
||||
FlagSet_Update(play);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (interfaceCtx->unk_244 != 0) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
|
@ -3961,18 +3960,23 @@ void Interface_Update(PlayState* play) {
|
|||
s16 dimmingAlpha;
|
||||
s16 risingAlpha;
|
||||
u16 action;
|
||||
Input* debugInput = &play->state.input[2];
|
||||
|
||||
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
|
||||
gSaveContext.language = LANGUAGE_ENG;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) {
|
||||
gSaveContext.language = LANGUAGE_GER;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) {
|
||||
gSaveContext.language = LANGUAGE_FRA;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
#if OOT_DEBUG
|
||||
{
|
||||
Input* debugInput = &play->state.input[2];
|
||||
|
||||
if (CHECK_BTN_ALL(debugInput->press.button, BTN_DLEFT)) {
|
||||
gSaveContext.language = LANGUAGE_ENG;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DUP)) {
|
||||
gSaveContext.language = LANGUAGE_GER;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
} else if (CHECK_BTN_ALL(debugInput->press.button, BTN_DRIGHT)) {
|
||||
gSaveContext.language = LANGUAGE_FRA;
|
||||
PRINTF("J_N=%x J_N=%x\n", gSaveContext.language, &gSaveContext.language);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!IS_PAUSED(&play->pauseCtx)) {
|
||||
if ((gSaveContext.minigameState == 1) || !IS_CUTSCENE_LAYER ||
|
||||
|
|
|
@ -18,12 +18,16 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn);
|
|||
|
||||
// This macro prints the number "1" with a file and line number if R_ENABLE_PLAY_LOGS is enabled.
|
||||
// For example, it can be used to trace the play state execution at a high level.
|
||||
#if OOT_DEBUG
|
||||
#define PLAY_LOG(line) \
|
||||
do { \
|
||||
if (R_ENABLE_PLAY_LOGS) { \
|
||||
LOG_NUM("1", 1, "../z_play.c", line); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define PLAY_LOG(line) (void)0
|
||||
#endif
|
||||
|
||||
void Play_RequestViewpointBgCam(PlayState* this) {
|
||||
Camera_RequestBgCam(GET_ACTIVE_CAM(this), this->viewpoint - 1);
|
||||
|
@ -156,7 +160,7 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
|
|||
break;
|
||||
|
||||
default:
|
||||
Fault_AddHungupAndCrash("../z_play.c", 2290);
|
||||
HUNGUP_AND_CRASH("../z_play.c", 2290);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -175,6 +179,8 @@ void Play_Destroy(GameState* thisx) {
|
|||
PlayState* this = (PlayState*)thisx;
|
||||
Player* player = GET_PLAYER(this);
|
||||
|
||||
if (1) {}
|
||||
|
||||
this->state.gfxCtx->callback = NULL;
|
||||
this->state.gfxCtx->callbackParam = NULL;
|
||||
|
||||
|
@ -211,7 +217,10 @@ void Play_Destroy(GameState* thisx) {
|
|||
KaleidoScopeCall_Destroy(this);
|
||||
KaleidoManager_Destroy();
|
||||
ZeldaArena_Cleanup();
|
||||
|
||||
#if OOT_DEBUG
|
||||
Fault_RemoveClient(&D_801614B8);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Play_Init(GameState* thisx) {
|
||||
|
@ -233,7 +242,10 @@ void Play_Init(GameState* thisx) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
SystemArena_Display();
|
||||
#endif
|
||||
|
||||
GameState_Realloc(&this->state, 0x1D4790);
|
||||
KaleidoManager_Init(this);
|
||||
View_Init(&this->view, gfxCtx);
|
||||
|
@ -403,7 +415,10 @@ void Play_Init(GameState* thisx) {
|
|||
// "Zelda Heap"
|
||||
PRINTF("ゼルダヒープ %08x-%08x\n", zAllocAligned, (u8*)zAllocAligned + zAllocSize - (s32)(zAllocAligned - zAlloc));
|
||||
|
||||
#if OOT_DEBUG
|
||||
Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL);
|
||||
#endif
|
||||
|
||||
Actor_InitContext(this, &this->actorCtx, this->playerEntry);
|
||||
|
||||
while (!func_800973FC(this, &this->roomCtx)) {
|
||||
|
@ -436,7 +451,7 @@ void Play_Init(GameState* thisx) {
|
|||
AnimationContext_Update(this, &this->animationCtx);
|
||||
gSaveContext.respawnFlag = 0;
|
||||
|
||||
if (R_USE_DEBUG_CUTSCENE) {
|
||||
if (OOT_DEBUG && R_USE_DEBUG_CUTSCENE) {
|
||||
gDebugCutsceneScript = sDebugCutsceneScriptBuf;
|
||||
PRINTF("\nkawauso_data=[%x]", gDebugCutsceneScript);
|
||||
|
||||
|
@ -447,20 +462,20 @@ void Play_Init(GameState* thisx) {
|
|||
}
|
||||
|
||||
void Play_Update(PlayState* this) {
|
||||
s32 pad1;
|
||||
Input* input = this->state.input;
|
||||
s32 isPaused;
|
||||
Input* input;
|
||||
u32 i;
|
||||
s32 pad2;
|
||||
|
||||
input = this->state.input;
|
||||
s32 pad1;
|
||||
|
||||
#if OOT_DEBUG
|
||||
if ((SREG(1) < 0) || (DREG(0) != 0)) {
|
||||
SREG(1) = 0;
|
||||
ZeldaArena_Display();
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE == HREG_MODE_PRINT_OBJECT_TABLE) && (R_PRINT_OBJECT_TABLE_TRIGGER < 0)) {
|
||||
u32 i;
|
||||
s32 pad2;
|
||||
|
||||
R_PRINT_OBJECT_TABLE_TRIGGER = 0;
|
||||
PRINTF("object_exchange_rom_address %u\n", gObjectTableSize);
|
||||
PRINTF("RomStart RomEnd Size\n");
|
||||
|
@ -482,6 +497,7 @@ void Play_Update(PlayState* this) {
|
|||
HREG(82) = 0;
|
||||
ActorOverlayTable_LogPrint();
|
||||
}
|
||||
#endif
|
||||
|
||||
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
|
||||
|
@ -541,11 +557,15 @@ void Play_Update(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (!R_TRANS_DBG_ENABLED) {
|
||||
Play_SetupTransition(this, this->transitionType);
|
||||
} else {
|
||||
Play_SetupTransition(this, R_TRANS_DBG_TYPE);
|
||||
}
|
||||
#else
|
||||
Play_SetupTransition(this, this->transitionType);
|
||||
#endif
|
||||
|
||||
if (this->transitionMode >= TRANS_MODE_FILL_WHITE_INIT) {
|
||||
// non-instance modes break out of this switch
|
||||
|
@ -855,6 +875,8 @@ void Play_Update(PlayState* this) {
|
|||
PLAY_LOG(3555);
|
||||
AnimationContext_Reset(&this->animationCtx);
|
||||
|
||||
if (!OOT_DEBUG) {}
|
||||
|
||||
PLAY_LOG(3561);
|
||||
Object_UpdateEntries(&this->objectCtx);
|
||||
|
||||
|
@ -989,7 +1011,6 @@ skip:
|
|||
PLAY_LOG(3801);
|
||||
|
||||
if (!isPaused || gDebugCamEnabled) {
|
||||
s32 pad3[5];
|
||||
s32 i;
|
||||
|
||||
this->nextCamId = this->activeCamId;
|
||||
|
@ -1058,7 +1079,7 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_DRAW) {
|
||||
POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP);
|
||||
POLY_XLU_DISP = Play_SetFog(this, POLY_XLU_DISP);
|
||||
|
||||
|
@ -1081,11 +1102,11 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx);
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) {
|
||||
Gfx* gfxP;
|
||||
Gfx* sp1CC = POLY_OPA_DISP;
|
||||
|
||||
gfxP = Graph_GfxPlusOne(sp1CC);
|
||||
gfxP = Gfx_Open(sp1CC);
|
||||
gSPDisplayList(OVERLAY_DISP++, gfxP);
|
||||
|
||||
if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) ||
|
||||
|
@ -1109,7 +1130,7 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
|
||||
gSPEndDisplayList(gfxP++);
|
||||
Graph_BranchDlist(sp1CC, gfxP);
|
||||
Gfx_Close(sp1CC, gfxP);
|
||||
POLY_OPA_DISP = gfxP;
|
||||
}
|
||||
|
||||
|
@ -1145,7 +1166,7 @@ void Play_Draw(PlayState* this) {
|
|||
goto Play_Draw_DrawOverlayElements;
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) {
|
||||
if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) {
|
||||
Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx);
|
||||
|
@ -1158,32 +1179,32 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SUN_AND_MOON)) {
|
||||
if (!this->envCtx.sunMoonDisabled) {
|
||||
Environment_DrawSunAndMoon(this);
|
||||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_SKYBOX_FILTERS)) {
|
||||
Environment_DrawSkyboxFilters(this);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTNING)) {
|
||||
Environment_UpdateLightningStrike(this);
|
||||
Environment_DrawLightning(this, 0);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ENV_FLAGS & PLAY_ENV_DRAW_LIGHTS)) {
|
||||
sp228 = LightContext_NewLights(&this->lightCtx, gfxCtx);
|
||||
Lights_BindAll(sp228, this->lightCtx.listHead, NULL);
|
||||
Lights_Draw(sp228, gfxCtx);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
if (VREG(94) == 0) {
|
||||
s32 roomDrawFlags;
|
||||
|
||||
if (R_HREG_MODE != HREG_MODE_PLAY) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY)) {
|
||||
roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU;
|
||||
} else {
|
||||
roomDrawFlags = R_PLAY_DRAW_ROOM_FLAGS;
|
||||
|
@ -1194,7 +1215,7 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
|
||||
if ((this->skyboxCtx.drawType != SKYBOX_DRAW_128) &&
|
||||
(GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
|
||||
Vec3f quakeOffset;
|
||||
|
@ -1209,15 +1230,15 @@ void Play_Draw(PlayState* this) {
|
|||
Environment_DrawRain(this, &this->view, gfxCtx);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
|
||||
Environment_FillScreen(gfxCtx, 0, 0, 0, this->bgCoverAlpha, FILL_SCREEN_OPA);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_ACTORS) {
|
||||
func_800315AC(this, &this->actorCtx);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_LENS_FLARES) {
|
||||
if (!this->envCtx.sunMoonDisabled) {
|
||||
sp21C.x = this->view.eye.x + this->envCtx.sunPos.x;
|
||||
sp21C.y = this->view.eye.y + this->envCtx.sunPos.y;
|
||||
|
@ -1227,7 +1248,7 @@ void Play_Draw(PlayState* this) {
|
|||
Environment_DrawCustomLensFlare(this);
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SCREEN_FILLS) {
|
||||
if (MREG(64) != 0) {
|
||||
Environment_FillScreen(gfxCtx, MREG(65), MREG(66), MREG(67), MREG(68),
|
||||
FILL_SCREEN_OPA | FILL_SCREEN_XLU);
|
||||
|
@ -1244,13 +1265,13 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SANDSTORM) {
|
||||
if (this->envCtx.sandstormState != SANDSTORM_OFF) {
|
||||
Environment_DrawSandstorm(this, this->envCtx.sandstormState);
|
||||
}
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_DEBUG_OBJECTS) {
|
||||
DebugDisplay_DrawObjects(this);
|
||||
}
|
||||
|
||||
|
@ -1277,7 +1298,7 @@ void Play_Draw(PlayState* this) {
|
|||
}
|
||||
|
||||
Play_Draw_DrawOverlayElements:
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) {
|
||||
Play_DrawOverlayElements(this);
|
||||
}
|
||||
}
|
||||
|
@ -1307,7 +1328,7 @@ void Play_Main(GameState* thisx) {
|
|||
|
||||
PLAY_LOG(4556);
|
||||
|
||||
if ((R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) {
|
||||
if (OOT_DEBUG && (R_HREG_MODE == HREG_MODE_PLAY) && (R_PLAY_INIT != HREG_MODE_PLAY)) {
|
||||
R_PLAY_RUN_UPDATE = true;
|
||||
R_PLAY_RUN_DRAW = true;
|
||||
R_PLAY_DRAW_SKYBOX = true;
|
||||
|
@ -1325,7 +1346,7 @@ void Play_Main(GameState* thisx) {
|
|||
R_PLAY_INIT = HREG_MODE_PLAY;
|
||||
}
|
||||
|
||||
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) {
|
||||
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_RUN_UPDATE) {
|
||||
Play_Update(this);
|
||||
}
|
||||
|
||||
|
@ -1346,18 +1367,13 @@ f32 func_800BFCB8(PlayState* this, MtxF* mf, Vec3f* pos) {
|
|||
f32 temp1;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
f32 floorY;
|
||||
f32 nx;
|
||||
f32 ny;
|
||||
f32 nz;
|
||||
s32 pad[5];
|
||||
|
||||
floorY = BgCheck_AnyRaycastDown1(&this->colCtx, &poly, pos);
|
||||
f32 floorY = BgCheck_AnyRaycastDown1(&this->colCtx, &poly, pos);
|
||||
|
||||
if (floorY > BGCHECK_Y_MIN) {
|
||||
nx = COLPOLY_GET_NORMAL(poly.normal.x);
|
||||
ny = COLPOLY_GET_NORMAL(poly.normal.y);
|
||||
nz = COLPOLY_GET_NORMAL(poly.normal.z);
|
||||
f32 nx = COLPOLY_GET_NORMAL(poly.normal.x);
|
||||
f32 ny = COLPOLY_GET_NORMAL(poly.normal.y);
|
||||
f32 nz = COLPOLY_GET_NORMAL(poly.normal.z);
|
||||
s32 pad[5];
|
||||
|
||||
temp1 = sqrtf(1.0f - SQ(nx));
|
||||
|
||||
|
|
|
@ -1107,9 +1107,13 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx**
|
|||
Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY);
|
||||
}
|
||||
} else if (limbIndex == PLAYER_LIMB_L_THIGH) {
|
||||
s32 pad;
|
||||
|
||||
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN,
|
||||
PLAYER_LIMB_L_FOOT);
|
||||
} else if (limbIndex == PLAYER_LIMB_R_THIGH) {
|
||||
s32 pad;
|
||||
|
||||
func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN,
|
||||
PLAYER_LIMB_R_FOOT);
|
||||
} else {
|
||||
|
@ -1407,42 +1411,6 @@ Color_RGB8 sBottleColors[] = {
|
|||
{ 80, 80, 255 }, // Fairy
|
||||
};
|
||||
|
||||
Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f };
|
||||
|
||||
BowSlingshotStringData sBowSlingshotStringData[] = {
|
||||
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // Bow
|
||||
{ gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // Slingshot
|
||||
};
|
||||
|
||||
// Coordinates of the shield quad collider vertices, in the right hand limb's own model space.
|
||||
Vec3f sRightHandLimbModelShieldQuadVertices[] = {
|
||||
{ -4500.0f, -3000.0f, -600.0f },
|
||||
{ 1500.0f, -3000.0f, -600.0f },
|
||||
{ -4500.0f, 3000.0f, -600.0f },
|
||||
{ 1500.0f, 3000.0f, -600.0f },
|
||||
};
|
||||
|
||||
Vec3f D_80126184 = { 100.0f, 1500.0f, 0.0f };
|
||||
Vec3f D_80126190 = { 100.0f, 1640.0f, 0.0f };
|
||||
|
||||
// Coordinates of the shield quad collider vertices, in the sheath limb's own model space.
|
||||
Vec3f sSheathLimbModelShieldQuadVertices[] = {
|
||||
{ -3000.0f, -3000.0f, -900.0f },
|
||||
{ 3000.0f, -3000.0f, -900.0f },
|
||||
{ -3000.0f, 3000.0f, -900.0f },
|
||||
{ 3000.0f, 3000.0f, -900.0f },
|
||||
};
|
||||
|
||||
// Position and rotation of the shield on Link's back, in the sheath limb's own model space.
|
||||
Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f };
|
||||
Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF };
|
||||
|
||||
// Position of Link's foot, in the foot limb's own model space.
|
||||
Vec3f sLeftRightFootLimbModelFootPos[] = {
|
||||
{ 200.0f, 300.0f, 0.0f },
|
||||
{ 200.0f, 200.0f, 0.0f },
|
||||
};
|
||||
|
||||
void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
|
||||
Player* this = (Player*)thisx;
|
||||
|
||||
|
@ -1507,6 +1475,8 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
if (this->actor.scale.y >= 0.0f) {
|
||||
if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) {
|
||||
if (this->stateFlags1 & PLAYER_STATE1_9) {
|
||||
static Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f };
|
||||
|
||||
Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos);
|
||||
Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp14C);
|
||||
|
@ -1536,6 +1506,10 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
Matrix_Get(&this->shieldMf);
|
||||
} else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) ||
|
||||
(this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2)) {
|
||||
static BowSlingshotStringData sBowSlingshotStringData[] = {
|
||||
{ gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // Bow
|
||||
{ gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // Slingshot
|
||||
};
|
||||
BowSlingshotStringData* stringData = &sBowSlingshotStringData[gSaveContext.save.linkAge];
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2783);
|
||||
|
@ -1577,15 +1551,26 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
|
||||
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2809);
|
||||
} else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) {
|
||||
// Coordinates of the shield quad collider vertices, in the right hand limb's own model space.
|
||||
static Vec3f sRightHandLimbModelShieldQuadVertices[] = {
|
||||
{ -4500.0f, -3000.0f, -600.0f },
|
||||
{ 1500.0f, -3000.0f, -600.0f },
|
||||
{ -4500.0f, 3000.0f, -600.0f },
|
||||
{ 1500.0f, 3000.0f, -600.0f },
|
||||
};
|
||||
|
||||
Matrix_Get(&this->shieldMf);
|
||||
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sRightHandLimbModelShieldQuadVertices);
|
||||
}
|
||||
|
||||
if (this->actor.scale.y >= 0.0f) {
|
||||
if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) {
|
||||
static Vec3f D_80126184 = { 100.0f, 1500.0f, 0.0f };
|
||||
|
||||
Matrix_MultVec3f(&D_80126184, &this->unk_3C8);
|
||||
|
||||
if (heldActor != NULL) {
|
||||
static Vec3f D_80126190 = { 100.0f, 1640.0f, 0.0f };
|
||||
MtxF sp44;
|
||||
s32 pad;
|
||||
|
||||
|
@ -1622,6 +1607,17 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
if (limbIndex == PLAYER_LIMB_SHEATH) {
|
||||
if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) &&
|
||||
(this->rightHandType != PLAYER_MODELTYPE_RH_FF)) {
|
||||
// Coordinates of the shield quad collider vertices, in the sheath limb's own model space.
|
||||
static Vec3f sSheathLimbModelShieldQuadVertices[] = {
|
||||
{ -3000.0f, -3000.0f, -900.0f },
|
||||
{ 3000.0f, -3000.0f, -900.0f },
|
||||
{ -3000.0f, 3000.0f, -900.0f },
|
||||
{ 3000.0f, 3000.0f, -900.0f },
|
||||
};
|
||||
// Position and rotation of the shield on Link's back, in the sheath limb's own model space.
|
||||
static Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f };
|
||||
static Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF };
|
||||
|
||||
if (Player_IsChildWithHylianShield(this)) {
|
||||
Player_UpdateShieldCollider(play, this, &this->shieldQuad, sSheathLimbModelShieldQuadVertices);
|
||||
}
|
||||
|
@ -1632,6 +1628,11 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve
|
|||
} else if (limbIndex == PLAYER_LIMB_HEAD) {
|
||||
Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &this->actor.focus.pos);
|
||||
} else {
|
||||
// Position of Link's foot, in the foot limb's own model space.
|
||||
static Vec3f sLeftRightFootLimbModelFootPos[] = {
|
||||
{ 200.0f, 300.0f, 0.0f },
|
||||
{ 200.0f, 200.0f, 0.0f },
|
||||
};
|
||||
Vec3f* footPos = &sLeftRightFootLimbModelFootPos[((void)0, gSaveContext.save.linkAge)];
|
||||
|
||||
// The same model position is used for both feet,
|
||||
|
@ -1733,8 +1734,6 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,
|
|||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3129);
|
||||
|
||||
{ s32 pad[2]; }
|
||||
|
||||
opaRef = POLY_OPA_DISP;
|
||||
POLY_OPA_DISP++;
|
||||
|
||||
|
@ -1744,6 +1743,8 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject,
|
|||
gSPDisplayList(WORK_DISP++, POLY_OPA_DISP);
|
||||
gSPDisplayList(WORK_DISP++, POLY_XLU_DISP);
|
||||
|
||||
{ s32 pad[2]; }
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
|
|
@ -411,10 +411,6 @@ s16 Quake_Update(Camera* camera, ShakeInfo* camShake) {
|
|||
zeroVec.y = 0.0f;
|
||||
zeroVec.z = 0.0f;
|
||||
|
||||
camShake->upPitchOffset = 0;
|
||||
camShake->upYawOffset = 0;
|
||||
camShake->fovOffset = 0;
|
||||
|
||||
camShake->atOffset.x = 0.0f;
|
||||
camShake->atOffset.y = 0.0f;
|
||||
camShake->atOffset.z = 0.0f;
|
||||
|
@ -423,6 +419,10 @@ s16 Quake_Update(Camera* camera, ShakeInfo* camShake) {
|
|||
camShake->eyeOffset.y = 0.0f;
|
||||
camShake->eyeOffset.z = 0.0f;
|
||||
|
||||
camShake->upPitchOffset = 0;
|
||||
camShake->upYawOffset = 0;
|
||||
camShake->fovOffset = 0;
|
||||
|
||||
camShake->maxOffset = 0.0f;
|
||||
|
||||
if (sQuakeRequestCount == 0) {
|
||||
|
|
|
@ -1246,23 +1246,33 @@ Gfx* Gfx_SetupDL_69NoCD(Gfx* gfx) {
|
|||
return gfx;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
#define HREG_21 HREG(21)
|
||||
#define HREG_22 HREG(22)
|
||||
#else
|
||||
#define HREG_21 0
|
||||
#define HREG_22 0
|
||||
#endif
|
||||
|
||||
Gfx* func_800947AC(Gfx* gfx) {
|
||||
gSPDisplayList(gfx++, sSetupDL[SETUPDL_65]);
|
||||
gDPSetColorDither(gfx++, G_CD_DISABLE);
|
||||
|
||||
// clang-format off
|
||||
switch (HREG(21)) {
|
||||
switch (HREG_21) {
|
||||
case 1: gDPSetAlphaDither(gfx++, G_AD_DISABLE); break;
|
||||
case 2: gDPSetAlphaDither(gfx++, G_AD_PATTERN); break;
|
||||
case 3: gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN); break;
|
||||
case 4: gDPSetAlphaDither(gfx++, G_AD_NOISE); break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
switch (HREG(22)) {
|
||||
switch (HREG_22) {
|
||||
case 1: gDPSetColorDither(gfx++, G_CD_DISABLE); break;
|
||||
case 2: gDPSetColorDither(gfx++, G_CD_MAGICSQ); break;
|
||||
case 3: gDPSetColorDither(gfx++, G_CD_BAYER); break;
|
||||
case 4: gDPSetColorDither(gfx++, G_CD_NOISE); break;
|
||||
default: break;
|
||||
}
|
||||
// clang-format on
|
||||
|
||||
|
@ -1362,7 +1372,7 @@ void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) {
|
|||
}
|
||||
|
||||
Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) {
|
||||
Gfx* displayList = Graph_DlistAlloc(gfxP, 3 * sizeof(Gfx));
|
||||
Gfx* displayList = Gfx_Alloc(gfxP, 3 * sizeof(Gfx));
|
||||
|
||||
gDPTileSync(displayList);
|
||||
gDPSetTileSize(displayList + 1, G_TX_RENDERTILE, x, y, x + ((width - 1) << 2), y + ((height - 1) << 2));
|
||||
|
@ -1472,6 +1482,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
if ((R_PAUSE_BG_PRERENDER_STATE <= PAUSE_BG_PRERENDER_SETUP) && (gTransitionTileState <= TRANS_TILE_SETUP)) {
|
||||
s32 letterboxSize = Letterbox_GetSize();
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (R_HREG_MODE == HREG_MODE_SETUP_FRAME) {
|
||||
if (R_SETUP_FRAME_INIT != HREG_MODE_SETUP_FRAME) {
|
||||
R_SETUP_FRAME_GET = (SETUP_FRAME_LETTERBOX_SIZE_FLAG | SETUP_FRAME_BASE_COLOR_FLAG);
|
||||
|
@ -1514,6 +1525,7 @@ void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
b = R_SETUP_FRAME_BASE_COLOR_B;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set the whole z buffer to maximum depth
|
||||
// Don't bother with pixels that are being covered by the letterbox
|
||||
|
|
|
@ -385,18 +385,20 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) {
|
|||
if (drawBackground) {
|
||||
gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2d_fifo);
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
|
||||
{
|
||||
Vec3f quakeOffset;
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
quakeOffset = Camera_GetQuakeOffset(activeCam);
|
||||
Room_DrawBackground2D(&gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height,
|
||||
roomShape->fmt, roomShape->siz, roomShape->tlutMode, roomShape->tlutCount,
|
||||
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
|
||||
quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f);
|
||||
POLY_OPA_DISP = gfx;
|
||||
}
|
||||
|
||||
POLY_OPA_DISP = gfx;
|
||||
|
||||
gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
|
||||
}
|
||||
}
|
||||
|
@ -483,18 +485,20 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) {
|
|||
if (drawBackground) {
|
||||
gSPLoadUcodeL(POLY_OPA_DISP++, gspS2DEX2d_fifo);
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
|
||||
{
|
||||
Vec3f quakeOffset;
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
quakeOffset = Camera_GetQuakeOffset(activeCam);
|
||||
Room_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height,
|
||||
bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount,
|
||||
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
|
||||
quakeOffset.y * 2.4f + (quakeOffset.x + quakeOffset.z) * 0.3f);
|
||||
POLY_OPA_DISP = gfx;
|
||||
}
|
||||
|
||||
POLY_OPA_DISP = gfx;
|
||||
|
||||
gSPLoadUcode(POLY_OPA_DISP++, SysUcode_GetUCode(), SysUcode_GetUCodeData());
|
||||
}
|
||||
}
|
||||
|
@ -528,7 +532,6 @@ void func_80096FD4(PlayState* play, Room* room) {
|
|||
|
||||
u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
|
||||
u32 maxRoomSize = 0;
|
||||
RomFile* roomList = play->roomList;
|
||||
u32 roomSize;
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
@ -537,16 +540,21 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
|
|||
u32 frontRoomSize;
|
||||
u32 backRoomSize;
|
||||
u32 cumulRoomSize;
|
||||
s32 pad;
|
||||
|
||||
for (i = 0; i < play->numRooms; i++) {
|
||||
roomSize = roomList[i].vromEnd - roomList[i].vromStart;
|
||||
PRINTF("ROOM%d size=%d\n", i, roomSize);
|
||||
if (maxRoomSize < roomSize) {
|
||||
maxRoomSize = roomSize;
|
||||
{
|
||||
RomFile* roomList = play->roomList;
|
||||
|
||||
for (i = 0; i < play->numRooms; i++) {
|
||||
roomSize = roomList[i].vromEnd - roomList[i].vromStart;
|
||||
PRINTF("ROOM%d size=%d\n", i, roomSize);
|
||||
if (maxRoomSize < roomSize) {
|
||||
maxRoomSize = roomSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (play->transiActorCtx.numActors != 0) {
|
||||
if ((u32)play->transiActorCtx.numActors != 0) {
|
||||
RomFile* roomList = play->roomList;
|
||||
TransitionActorEntry* transitionActor = &play->transiActorCtx.list[0];
|
||||
|
||||
|
@ -589,9 +597,9 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) {
|
|||
}
|
||||
|
||||
s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) {
|
||||
u32 size;
|
||||
|
||||
if (roomCtx->status == 0) {
|
||||
u32 size;
|
||||
|
||||
roomCtx->prevRoom = roomCtx->curRoom;
|
||||
roomCtx->curRoom.num = roomNum;
|
||||
roomCtx->curRoom.segment = NULL;
|
||||
|
@ -624,11 +632,9 @@ s32 func_800973FC(PlayState* play, RoomContext* roomCtx) {
|
|||
Scene_ExecuteCommands(play, roomCtx->curRoom.segment);
|
||||
Player_SetBootData(play, GET_PLAYER(play));
|
||||
Actor_SpawnTransitionActors(play, &play->actorCtx);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -47,6 +47,7 @@ s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 objectId) {
|
|||
|
||||
void Object_InitContext(PlayState* play, ObjectContext* objectCtx) {
|
||||
PlayState* play2 = play;
|
||||
s32 pad;
|
||||
u32 spaceSize;
|
||||
s32 i;
|
||||
|
||||
|
@ -171,10 +172,9 @@ void* func_800982FC(ObjectContext* objectCtx, s32 slot, s16 objectId) {
|
|||
}
|
||||
|
||||
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
|
||||
u32 cmdCode;
|
||||
|
||||
while (true) {
|
||||
cmdCode = sceneCmd->base.code;
|
||||
u32 cmdCode = sceneCmd->base.code;
|
||||
|
||||
PRINTF("*** Scene_Word = { code=%d, data1=%02x, data2=%04x } ***\n", cmdCode, sceneCmd->base.data1,
|
||||
sceneCmd->base.data2);
|
||||
|
||||
|
@ -189,12 +189,14 @@ s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd) {
|
|||
PRINTF("code の値が異常です\n"); // "code variable is abnormal"
|
||||
PRINTF(VT_RST);
|
||||
}
|
||||
|
||||
sceneCmd++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
ActorEntry* playerEntry = play->playerEntry =
|
||||
(ActorEntry*)SEGMENTED_TO_VIRTUAL(cmd->playerEntryList.data) + play->spawnList[play->spawn].playerEntryIndex;
|
||||
s16 linkObjectId;
|
||||
|
@ -207,16 +209,16 @@ void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
|
|||
Object_SpawnPersistent(&play->objectCtx, linkObjectId);
|
||||
}
|
||||
|
||||
void Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
play->numActorEntries = cmd->actorEntryList.length;
|
||||
play->actorEntryList = SEGMENTED_TO_VIRTUAL(cmd->actorEntryList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandUnused2(PlayState* play, SceneCmd* cmd) {
|
||||
play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment);
|
||||
}
|
||||
|
||||
void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) {
|
||||
CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(cmd->colHeader.data);
|
||||
|
||||
colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList);
|
||||
|
@ -228,16 +230,16 @@ void Scene_CommandCollisionHeader(PlayState* play, SceneCmd* cmd) {
|
|||
BgCheck_Allocate(&play->colCtx, play, colHeader);
|
||||
}
|
||||
|
||||
void Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandRoomList(PlayState* play, SceneCmd* cmd) {
|
||||
play->numRooms = cmd->roomList.length;
|
||||
play->roomList = SEGMENTED_TO_VIRTUAL(cmd->roomList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
|
||||
play->spawnList = SEGMENTED_TO_VIRTUAL(cmd->spawnList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
|
||||
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
|
||||
play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId);
|
||||
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment);
|
||||
|
@ -248,18 +250,18 @@ void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandRoomBehavior(PlayState* play, SceneCmd* cmd) {
|
||||
play->roomCtx.curRoom.behaviorType1 = cmd->roomBehavior.gpFlag1;
|
||||
play->roomCtx.curRoom.behaviorType2 = cmd->roomBehavior.gpFlag2 & 0xFF;
|
||||
play->roomCtx.curRoom.lensMode = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
|
||||
play->msgCtx.disableWarpSongs = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
|
||||
}
|
||||
|
||||
void Scene_CommandRoomShape(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandRoomShape(PlayState* play, SceneCmd* cmd) {
|
||||
play->roomCtx.curRoom.roomShape = SEGMENTED_TO_VIRTUAL(cmd->mesh.data);
|
||||
}
|
||||
|
||||
void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
s32 k;
|
||||
|
@ -311,7 +313,7 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
|
|||
play->objectCtx.numEntries = i;
|
||||
}
|
||||
|
||||
void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
|
||||
s32 i;
|
||||
LightInfo* lightInfo = SEGMENTED_TO_VIRTUAL(cmd->lightList.data);
|
||||
|
||||
|
@ -321,11 +323,11 @@ void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Scene_CommandPathList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandPathList(PlayState* play, SceneCmd* cmd) {
|
||||
play->pathList = SEGMENTED_TO_VIRTUAL(cmd->pathList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandTransitionActorEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandTransitionActorEntryList(PlayState* play, SceneCmd* cmd) {
|
||||
play->transiActorCtx.numActors = cmd->transiActorList.length;
|
||||
play->transiActorCtx.list = SEGMENTED_TO_VIRTUAL(cmd->transiActorList.data);
|
||||
}
|
||||
|
@ -334,23 +336,23 @@ void TransitionActor_InitContext(GameState* state, TransitionActorContext* trans
|
|||
transiActorCtx->numActors = 0;
|
||||
}
|
||||
|
||||
void Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandLightSettingsList(PlayState* play, SceneCmd* cmd) {
|
||||
play->envCtx.numLightSettings = cmd->lightSettingList.length;
|
||||
play->envCtx.lightSettingsList = SEGMENTED_TO_VIRTUAL(cmd->lightSettingList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandSkyboxSettings(PlayState* play, SceneCmd* cmd) {
|
||||
play->skyboxId = cmd->skyboxSettings.skyboxId;
|
||||
play->envCtx.skyboxConfig = play->envCtx.changeSkyboxNextConfig = cmd->skyboxSettings.skyboxConfig;
|
||||
play->envCtx.lightMode = cmd->skyboxSettings.envLightMode;
|
||||
}
|
||||
|
||||
void Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandSkyboxDisables(PlayState* play, SceneCmd* cmd) {
|
||||
play->envCtx.skyboxDisabled = cmd->skyboxDisables.skyboxDisabled;
|
||||
play->envCtx.sunMoonDisabled = cmd->skyboxDisables.sunMoonDisabled;
|
||||
}
|
||||
|
||||
void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
|
||||
if ((cmd->timeSettings.hour != 0xFF) && (cmd->timeSettings.min != 0xFF)) {
|
||||
gSaveContext.skyboxTime = gSaveContext.save.dayTime =
|
||||
((cmd->timeSettings.hour + (cmd->timeSettings.min / 60.0f)) * 60.0f) / ((f32)(24 * 60) / 0x10000);
|
||||
|
@ -387,7 +389,7 @@ void Scene_CommandTimeSettings(PlayState* play, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) {
|
||||
s8 x = cmd->windSettings.x;
|
||||
s8 y = cmd->windSettings.y;
|
||||
s8 z = cmd->windSettings.z;
|
||||
|
@ -399,14 +401,14 @@ void Scene_CommandWindSettings(PlayState* play, SceneCmd* cmd) {
|
|||
play->envCtx.windSpeed = cmd->windSettings.unk_07;
|
||||
}
|
||||
|
||||
void Scene_CommandExitList(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandExitList(PlayState* play, SceneCmd* cmd) {
|
||||
play->exitList = SEGMENTED_TO_VIRTUAL(cmd->exitList.data);
|
||||
}
|
||||
|
||||
void Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandUndefined9(PlayState* play, SceneCmd* cmd) {
|
||||
}
|
||||
|
||||
void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
|
||||
play->sequenceCtx.seqId = cmd->soundSettings.seqId;
|
||||
play->sequenceCtx.natureAmbienceId = cmd->soundSettings.natureAmbienceId;
|
||||
|
||||
|
@ -415,22 +417,17 @@ void Scene_CommandSoundSettings(PlayState* play, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandEchoSettings(PlayState* play, SceneCmd* cmd) {
|
||||
play->roomCtx.curRoom.echo = cmd->echoSettings.echo;
|
||||
}
|
||||
|
||||
void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
|
||||
s32 pad;
|
||||
SceneCmd* altHeader;
|
||||
|
||||
BAD_RETURN(s32) Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
|
||||
PRINTF("\n[ZU]sceneset age =[%X]", ((void)0, gSaveContext.save.linkAge));
|
||||
PRINTF("\n[ZU]sceneset time =[%X]", ((void)0, gSaveContext.save.cutsceneIndex));
|
||||
PRINTF("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneLayer));
|
||||
|
||||
if (gSaveContext.sceneLayer != 0) {
|
||||
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneLayer - 1];
|
||||
|
||||
if (1) {}
|
||||
SceneCmd* altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(cmd->altHeaders.data))[gSaveContext.sceneLayer - 1];
|
||||
|
||||
if (altHeader != NULL) {
|
||||
Scene_ExecuteCommands(play, SEGMENTED_TO_VIRTUAL(altHeader));
|
||||
|
@ -441,7 +438,7 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
|
|||
|
||||
if (gSaveContext.sceneLayer == SCENE_LAYER_ADULT_NIGHT) {
|
||||
// Due to the condition above, this is equivalent to accessing altHeaders[SCENE_LAYER_ADULT_DAY - 1]
|
||||
altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(
|
||||
SceneCmd* altHeader = ((SceneCmd**)SEGMENTED_TO_VIRTUAL(
|
||||
cmd->altHeaders
|
||||
.data))[(gSaveContext.sceneLayer - SCENE_LAYER_ADULT_NIGHT) + SCENE_LAYER_ADULT_DAY - 1];
|
||||
|
||||
|
@ -457,13 +454,12 @@ void Scene_CommandAlternateHeaderList(PlayState* play, SceneCmd* cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
void Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandCutsceneData(PlayState* play, SceneCmd* cmd) {
|
||||
PRINTF("\ngame_play->demo_play.data=[%x]", play->csCtx.script);
|
||||
play->csCtx.script = SEGMENTED_TO_VIRTUAL(cmd->cutsceneData.data);
|
||||
}
|
||||
|
||||
// Camera & World Map Area
|
||||
void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {
|
||||
BAD_RETURN(s32) Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {
|
||||
R_SCENE_CAM_TYPE = cmd->miscSettings.sceneCamType;
|
||||
gSaveContext.worldMapArea = cmd->miscSettings.area;
|
||||
|
||||
|
@ -476,9 +472,9 @@ void Scene_CommandMiscSettings(PlayState* play, SceneCmd* cmd) {
|
|||
if (((play->sceneId >= SCENE_HYRULE_FIELD) && (play->sceneId <= SCENE_OUTSIDE_GANONS_CASTLE)) ||
|
||||
((play->sceneId >= SCENE_MARKET_ENTRANCE_DAY) && (play->sceneId <= SCENE_TEMPLE_OF_TIME_EXTERIOR_RUINS))) {
|
||||
if (gSaveContext.save.cutsceneIndex < 0xFFF0) {
|
||||
gSaveContext.save.info.worldMapAreaData |= gBitFlags[gSaveContext.worldMapArea];
|
||||
gSaveContext.save.info.worldMapAreaData |= gBitFlags[((void)0, gSaveContext.worldMapArea)];
|
||||
PRINTF("000 area_arrival=%x (%d)\n", gSaveContext.save.info.worldMapAreaData,
|
||||
gSaveContext.worldMapArea);
|
||||
((void)0, gSaveContext.worldMapArea));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -503,7 +499,7 @@ void Scene_SetTransitionForNextEntrance(PlayState* play) {
|
|||
play->transitionType = ENTRANCE_INFO_START_TRANS_TYPE(gEntranceTable[entranceIndex].field);
|
||||
}
|
||||
|
||||
void (*gSceneCmdHandlers[SCENE_CMD_ID_MAX])(PlayState*, SceneCmd*) = {
|
||||
SceneCmdHandlerFunc gSceneCmdHandlers[SCENE_CMD_ID_MAX] = {
|
||||
Scene_CommandPlayerEntryList, // SCENE_CMD_ID_SPAWN_LIST
|
||||
Scene_CommandActorEntryList, // SCENE_CMD_ID_ACTOR_LIST
|
||||
Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2
|
||||
|
|
|
@ -266,6 +266,8 @@ void Scene_DrawConfigGrottos(PlayState* play) {
|
|||
void Scene_DrawConfigChamberOfTheSages(PlayState* play) {
|
||||
u32 gameplayFrames;
|
||||
|
||||
if (1) {}
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 5226);
|
||||
|
||||
gameplayFrames = play->gameplayFrames;
|
||||
|
@ -700,6 +702,8 @@ void Scene_DrawConfigLakesideLaboratory(PlayState* play) {
|
|||
32, 32));
|
||||
gSPSegment(POLY_XLU_DISP++, 0x09, Gfx_TexScroll(play->state.gfxCtx, 0, 255 - (gameplayFrames * 10) % 256, 32, 64));
|
||||
|
||||
if (1) {}
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
|
||||
|
||||
|
@ -982,6 +986,9 @@ void Scene_DrawConfigHyruleField(PlayState* play) {
|
|||
}
|
||||
|
||||
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]);
|
||||
|
||||
if (1) {}
|
||||
|
||||
gSPDisplayList(displayListHead++, spot00_room_0DL_012B20);
|
||||
gSPEndDisplayList(displayListHead);
|
||||
}
|
||||
|
@ -1028,6 +1035,8 @@ void Scene_DrawConfigZorasRiver(PlayState* play) {
|
|||
(gameplayFrames * 1) % 128, 32, 32, 1, gameplayFrames % 128, (gameplayFrames * 1) % 128,
|
||||
32, 32));
|
||||
|
||||
if (1) {}
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
|
||||
|
||||
|
@ -1161,6 +1170,8 @@ void Scene_DrawConfigZorasFountain(PlayState* play) {
|
|||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, (gameplayFrames * 1) % 128, 32, 32, 1, 0,
|
||||
(gameplayFrames * 1) % 128, 32, 32));
|
||||
|
||||
if (1) {}
|
||||
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
gDPSetEnvColor(POLY_OPA_DISP++, 128, 128, 128, 128);
|
||||
|
||||
|
@ -1321,6 +1332,8 @@ void Scene_DrawConfigDeathMountainTrail(PlayState* play) {
|
|||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08, displayListHead);
|
||||
|
||||
if (1) {}
|
||||
|
||||
if ((gSaveContext.save.dayTime > CLOCK_TIME(7, 0)) && (gSaveContext.save.dayTime <= CLOCK_TIME(18, 0))) {
|
||||
gSPEndDisplayList(displayListHead);
|
||||
} else {
|
||||
|
@ -1335,6 +1348,9 @@ void Scene_DrawConfigDeathMountainTrail(PlayState* play) {
|
|||
}
|
||||
|
||||
gDPSetPrimColor(displayListHead++, 0, 0, 255, 255, 255, play->roomCtx.unk_74[0]);
|
||||
|
||||
if (0) {}
|
||||
|
||||
gSPDisplayList(displayListHead++, spot16_room_0DL_00AA48);
|
||||
gSPEndDisplayList(displayListHead);
|
||||
}
|
||||
|
@ -1528,6 +1544,9 @@ void Scene_DrawConfigInsideGanonsCastle(PlayState* play) {
|
|||
OPEN_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7825);
|
||||
|
||||
gameplayFrames = play->gameplayFrames;
|
||||
|
||||
if (1) {}
|
||||
|
||||
gSPSegment(POLY_XLU_DISP++, 0x08,
|
||||
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 127 - gameplayFrames % 128,
|
||||
(gameplayFrames * 1) % 512, 32, 128, 1, gameplayFrames % 128,
|
||||
|
@ -1633,7 +1652,7 @@ void (*sSceneDrawConfigs[SDC_MAX])(PlayState*) = {
|
|||
};
|
||||
|
||||
void Scene_Draw(PlayState* play) {
|
||||
if (R_HREG_MODE == HREG_MODE_SCENE_CONFIG) {
|
||||
if ((R_HREG_MODE == HREG_MODE_SCENE_CONFIG) && OOT_DEBUG) {
|
||||
if (R_SCENE_CONFIG_INIT != HREG_MODE_SCENE_CONFIG) {
|
||||
R_SCENE_CONFIG_INIT = HREG_MODE_SCENE_CONFIG;
|
||||
R_SCENE_CONFIG_DRAW_DEFAULT_DLIST = 1;
|
||||
|
|
|
@ -1374,9 +1374,8 @@ s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame) {
|
|||
/**
|
||||
* Initializes a normal skeleton to a looping animation, dynamically allocating the frame tables if not provided.
|
||||
*/
|
||||
BAD_RETURN(s32)
|
||||
SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg, AnimationHeader* animation,
|
||||
Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
|
||||
BAD_RETURN(s32) SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
|
||||
SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
|
||||
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
|
@ -1405,9 +1404,8 @@ SkelAnime_Init(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHe
|
|||
/**
|
||||
* Initializes a flex skeleton to a looping animation, dynamically allocating the frame tables if not given.
|
||||
*/
|
||||
BAD_RETURN(s32)
|
||||
SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
|
||||
BAD_RETURN(s32) SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animation, Vec3s* jointTable, Vec3s* morphTable, s32 limbCount) {
|
||||
FlexSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
|
||||
|
||||
skelAnime->limbCount = skeletonHeader->sh.limbCount + 1;
|
||||
|
@ -1440,9 +1438,8 @@ SkelAnime_InitFlex(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeader* sk
|
|||
/**
|
||||
* Initializes a skeleton with SkinLimbs to a looping animation, dynamically allocating the frame tables.
|
||||
*/
|
||||
BAD_RETURN(s32)
|
||||
SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animation) {
|
||||
BAD_RETURN(s32) SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* skeletonHeaderSeg,
|
||||
AnimationHeader* animation) {
|
||||
SkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg);
|
||||
|
||||
skelAnime->limbCount = skeletonHeader->limbCount + 1;
|
||||
|
|
|
@ -7,13 +7,14 @@ static s32 sUnused;
|
|||
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
|
||||
Vtx* vtx;
|
||||
SkinVertex* vertexEntry;
|
||||
f32 xwTemp;
|
||||
f32 ywTemp;
|
||||
f32 zwTemp;
|
||||
Vec3f normal;
|
||||
Vec3f sp64;
|
||||
|
||||
for (vertexEntry = skinVertices; vertexEntry < &skinVertices[modifEntry->vtxCount]; vertexEntry++) {
|
||||
f32 xwTemp;
|
||||
f32 ywTemp;
|
||||
f32 zwTemp;
|
||||
Vec3f normal;
|
||||
Vec3f sp64;
|
||||
|
||||
vtx = &vtxBuf[vertexEntry->index];
|
||||
|
||||
vtx->n.ob[0] = pos->x;
|
||||
|
@ -94,12 +95,13 @@ void Skin_ApplyLimbModifications(GraphicsContext* gfxCtx, Skin* skin, s32 limbIn
|
|||
SkinMatrix_Vec3fMtxFMultXYZ(&gSkinLimbMatrices[transformationEntry->limbIndex], &spA0, &vtxPoint);
|
||||
} else {
|
||||
Vec3f phi_f20;
|
||||
Vec3f sp88;
|
||||
|
||||
phi_f20.x = phi_f20.y = phi_f20.z = 0.0f;
|
||||
|
||||
for (transformationEntry = &limbTransformations[0];
|
||||
transformationEntry < &limbTransformations[transformCount]; transformationEntry++) {
|
||||
Vec3f sp88;
|
||||
|
||||
scale = transformationEntry->scale * 0.01f;
|
||||
|
||||
sp88.x = transformationEntry->x;
|
||||
|
@ -191,7 +193,7 @@ void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postD
|
|||
s32 segmentType;
|
||||
SkinLimb** skeleton;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
s32 pad;
|
||||
Mtx* mtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_skin.c", 471);
|
||||
|
||||
|
@ -202,8 +204,6 @@ void Skin_DrawImpl(Actor* actor, PlayState* play, Skin* skin, SkinPostDraw postD
|
|||
skeleton = SEGMENTED_TO_VIRTUAL(skin->skeletonHeader->segment);
|
||||
|
||||
if (!(drawFlags & SKIN_DRAW_FLAG_CUSTOM_MATRIX)) {
|
||||
Mtx* mtx;
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, &gMtxClear, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &skin->mtx);
|
||||
|
||||
|
|
|
@ -20,13 +20,14 @@ void Skin_InitAnimatedLimb(PlayState* play, Skin* skin, s32 limbIndex) {
|
|||
modifEntry++) {
|
||||
SkinVertex* skinVertices = SEGMENTED_TO_VIRTUAL(modifEntry->skinVertices);
|
||||
|
||||
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount]; skinVtxEntry++) {
|
||||
for (skinVtxEntry = skinVertices; skinVtxEntry < &skinVertices[modifEntry->vtxCount];) {
|
||||
Vtx* vtx = &vtxBuf[skinVtxEntry->index];
|
||||
|
||||
vtx->n.flag = 0;
|
||||
vtx->n.tc[0] = skinVtxEntry->s;
|
||||
vtx->n.tc[1] = skinVtxEntry->t;
|
||||
vtx->n.a = skinVtxEntry->alpha;
|
||||
skinVtxEntry++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -193,21 +193,21 @@ void SkinMatrix_GetClear(MtxF** mfp) {
|
|||
|
||||
void SkinMatrix_Clear(MtxF* mf) {
|
||||
mf->xx = 1.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->ww = 1.0f;
|
||||
mf->yx = 0.0f;
|
||||
mf->zx = 0.0f;
|
||||
mf->wx = 0.0f;
|
||||
mf->xy = 0.0f;
|
||||
mf->yy = 1.0f;
|
||||
mf->zy = 0.0f;
|
||||
mf->wy = 0.0f;
|
||||
mf->xz = 0.0f;
|
||||
mf->yz = 0.0f;
|
||||
mf->zz = 1.0f;
|
||||
mf->wz = 0.0f;
|
||||
mf->xw = 0.0f;
|
||||
mf->yw = 0.0f;
|
||||
mf->zw = 0.0f;
|
||||
mf->ww = 1.0f;
|
||||
}
|
||||
|
||||
void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) {
|
||||
|
@ -237,8 +237,6 @@ void SkinMatrix_MtxFCopy(MtxF* src, MtxF* dest) {
|
|||
s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
|
||||
MtxF mfCopy;
|
||||
s32 i;
|
||||
s32 pad;
|
||||
f32 temp2;
|
||||
f32 temp1;
|
||||
s32 thisCol;
|
||||
s32 thisRow;
|
||||
|
@ -264,13 +262,8 @@ s32 SkinMatrix_Invert(MtxF* src, MtxF* dest) {
|
|||
// Diagonal element mf[thisCol][thisCol] is zero.
|
||||
// Swap the rows thisCol and thisRow.
|
||||
for (i = 0; i < 4; i++) {
|
||||
temp1 = mfCopy.mf[i][thisRow];
|
||||
mfCopy.mf[i][thisRow] = mfCopy.mf[i][thisCol];
|
||||
mfCopy.mf[i][thisCol] = temp1;
|
||||
|
||||
temp2 = dest->mf[i][thisRow];
|
||||
dest->mf[i][thisRow] = dest->mf[i][thisCol];
|
||||
dest->mf[i][thisCol] = temp2;
|
||||
SWAP(f32, mfCopy.mf[i][thisRow], mfCopy.mf[i][thisCol]);
|
||||
SWAP(f32, dest->mf[i][thisRow], dest->mf[i][thisCol]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -37,25 +37,30 @@ void View_Free(View* view) {
|
|||
|
||||
void View_Init(View* view, GraphicsContext* gfxCtx) {
|
||||
view->gfxCtx = gfxCtx;
|
||||
|
||||
view->viewport.topY = 0;
|
||||
view->viewport.bottomY = SCREEN_HEIGHT;
|
||||
view->viewport.leftX = 0;
|
||||
view->viewport.rightX = SCREEN_WIDTH;
|
||||
|
||||
view->magic = 0x56494557; // "VIEW"
|
||||
view->eye.x = 0.0f;
|
||||
view->eye.y = 0.0f;
|
||||
|
||||
if (sLogOnNextViewInit == false) {}
|
||||
|
||||
view->scale = 1.0f;
|
||||
view->fovy = 60.0f;
|
||||
view->zNear = 10.0f;
|
||||
view->zFar = 12800.0f;
|
||||
|
||||
view->eye.x = 0.0f;
|
||||
view->eye.y = 0.0f;
|
||||
view->eye.z = -1.0f;
|
||||
view->at.x = 0.0f;
|
||||
view->up.x = 0.0f;
|
||||
view->up.y = 1.0f;
|
||||
view->up.z = 0.0f;
|
||||
view->eye.z = -1.0f;
|
||||
|
||||
if (sLogOnNextViewInit) {
|
||||
if (sLogOnNextViewInit == false) {}
|
||||
PRINTF("\nview: initialize ---\n");
|
||||
sLogOnNextViewInit = false;
|
||||
}
|
||||
|
@ -136,37 +141,38 @@ void View_GetViewport(View* view, Viewport* viewport) {
|
|||
}
|
||||
|
||||
void View_ApplyLetterbox(View* view) {
|
||||
s32 varY;
|
||||
s32 varX;
|
||||
s32 pad;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 letterboxSize;
|
||||
s32 pillarboxSize;
|
||||
s32 ulx;
|
||||
s32 uly;
|
||||
s32 lrx;
|
||||
s32 lry;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
varY = Letterbox_GetSize();
|
||||
letterboxSize = Letterbox_GetSize();
|
||||
|
||||
varX = -1; // The following is optimized to varX = 0 but affects codegen
|
||||
// The following is optimized to pillarboxSize = 0 but affects codegen
|
||||
pillarboxSize = -1;
|
||||
|
||||
if (varX < 0) {
|
||||
varX = 0;
|
||||
if (pillarboxSize < 0) {
|
||||
pillarboxSize = 0;
|
||||
}
|
||||
if (varX > SCREEN_WIDTH / 2) {
|
||||
varX = SCREEN_WIDTH / 2;
|
||||
if (pillarboxSize > SCREEN_WIDTH / 2) {
|
||||
pillarboxSize = SCREEN_WIDTH / 2;
|
||||
}
|
||||
|
||||
if (varY < 0) {
|
||||
varY = 0;
|
||||
if (letterboxSize < 0) {
|
||||
letterboxSize = 0;
|
||||
}
|
||||
if (varY > SCREEN_HEIGHT / 2) {
|
||||
varY = SCREEN_HEIGHT / 2;
|
||||
if (letterboxSize > SCREEN_HEIGHT / 2) {
|
||||
letterboxSize = SCREEN_HEIGHT / 2;
|
||||
}
|
||||
|
||||
ulx = view->viewport.leftX + varX;
|
||||
uly = view->viewport.topY + varY;
|
||||
lrx = view->viewport.rightX - varX;
|
||||
lry = view->viewport.bottomY - varY;
|
||||
ulx = view->viewport.leftX + pillarboxSize;
|
||||
uly = view->viewport.topY + letterboxSize;
|
||||
lrx = view->viewport.rightX - pillarboxSize;
|
||||
lry = view->viewport.bottomY - letterboxSize;
|
||||
|
||||
ASSERT(ulx >= 0, "ulx >= 0", "../z_view.c", 454);
|
||||
ASSERT(uly >= 0, "uly >= 0", "../z_view.c", 455);
|
||||
|
@ -269,24 +275,24 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) {
|
|||
/**
|
||||
* Apply view to POLY_OPA_DISP, POLY_XLU_DISP (and OVERLAY_DISP if ortho)
|
||||
*/
|
||||
void View_Apply(View* view, s32 mask) {
|
||||
s32 View_Apply(View* view, s32 mask) {
|
||||
mask = (view->flags & mask) | (mask >> 4);
|
||||
|
||||
if (mask & VIEW_PROJECTION_ORTHO) {
|
||||
View_ApplyOrtho(view);
|
||||
return View_ApplyOrtho(view);
|
||||
} else {
|
||||
View_ApplyPerspective(view);
|
||||
return View_ApplyPerspective(view);
|
||||
}
|
||||
}
|
||||
|
||||
s32 View_ApplyPerspective(View* view) {
|
||||
f32 aspect;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 width;
|
||||
s32 height;
|
||||
Vp* vp;
|
||||
Mtx* projection;
|
||||
Mtx* viewing;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
f32 aspect;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_view.c", 596);
|
||||
|
||||
|
@ -310,7 +316,7 @@ s32 View_ApplyPerspective(View* view) {
|
|||
height = view->viewport.bottomY - view->viewport.topY;
|
||||
aspect = (f32)width / (f32)height;
|
||||
|
||||
if (R_HREG_MODE == HREG_MODE_PERSPECTIVE) {
|
||||
if (OOT_DEBUG && R_HREG_MODE == HREG_MODE_PERSPECTIVE) {
|
||||
if (R_PERSPECTIVE_INIT != HREG_MODE_PERSPECTIVE) {
|
||||
R_PERSPECTIVE_INIT = HREG_MODE_PERSPECTIVE;
|
||||
R_PERSPECTIVE_FOVY = 60;
|
||||
|
@ -325,6 +331,7 @@ s32 View_ApplyPerspective(View* view) {
|
|||
guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale);
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
if (QREG(88) & 1) {
|
||||
s32 i;
|
||||
MtxF mf;
|
||||
|
@ -339,6 +346,7 @@ s32 View_ApplyPerspective(View* view) {
|
|||
}
|
||||
PRINTF("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
view->projection = *projection;
|
||||
|
||||
|
@ -360,24 +368,27 @@ s32 View_ApplyPerspective(View* view) {
|
|||
view->eye.z += 1.0f;
|
||||
}
|
||||
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
VIEW_ERROR_CHECK_EYE_POS(view->eye.x, view->eye.y, view->eye.z);
|
||||
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
|
||||
view->up.z);
|
||||
|
||||
view->viewing = *viewing;
|
||||
|
||||
#if OOT_DEBUG
|
||||
// Debug print view matrix
|
||||
if (QREG(88) & 2) {
|
||||
s32 i;
|
||||
MtxF mf;
|
||||
|
||||
Matrix_MtxToMtxF(view->viewingPtr, &mf);
|
||||
|
||||
PRINTF("viewing\n");
|
||||
for (i = 0; i < 4; i++) {
|
||||
PRINTF("\t%f\t%f\t%f\t%f\n", mf.mf[i][0], mf.mf[i][1], mf.mf[i][2], mf.mf[i][3]);
|
||||
}
|
||||
PRINTF("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
||||
gSPMatrix(POLY_XLU_DISP++, viewing, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
|
||||
|
@ -426,11 +437,9 @@ s32 View_ApplyOrtho(View* view) {
|
|||
* Apply scissor, viewport and projection (ortho) to OVERLAY_DISP.
|
||||
*/
|
||||
s32 View_ApplyOrthoToOverlay(View* view) {
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
Vp* vp;
|
||||
Mtx* projection;
|
||||
GraphicsContext* gfxCtx;
|
||||
|
||||
gfxCtx = view->gfxCtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_view.c", 777);
|
||||
|
||||
|
@ -464,14 +473,15 @@ s32 View_ApplyOrthoToOverlay(View* view) {
|
|||
* Apply scissor, viewport, view and projection (perspective) to OVERLAY_DISP.
|
||||
*/
|
||||
s32 View_ApplyPerspectiveToOverlay(View* view) {
|
||||
s32 pad[2];
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 pad;
|
||||
f32 aspect;
|
||||
s32 width;
|
||||
s32 height;
|
||||
Vp* vp;
|
||||
Mtx* projection;
|
||||
Mtx* viewing;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
s32 pad1;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_view.c", 816);
|
||||
|
||||
|
@ -511,7 +521,8 @@ s32 View_ApplyPerspectiveToOverlay(View* view) {
|
|||
view->eye.z += 1.0f;
|
||||
}
|
||||
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
VIEW_ERROR_CHECK_EYE_POS(view->eye.x, view->eye.y, view->eye.z);
|
||||
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y,
|
||||
view->up.z);
|
||||
|
||||
|
@ -530,7 +541,8 @@ s32 View_ApplyPerspectiveToOverlay(View* view) {
|
|||
s32 View_UpdateViewingMatrix(View* view) {
|
||||
OPEN_DISPS(view->gfxCtx, "../z_view.c", 878);
|
||||
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
VIEW_ERROR_CHECK_EYE_POS(view->eye.x, view->eye.y, view->eye.z);
|
||||
|
||||
guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
|
||||
view->up.y, view->up.z);
|
||||
|
||||
|
@ -596,7 +608,8 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) {
|
|||
LOG_UTILS_CHECK_NULL_POINTER("viewing", viewing, "../z_view.c", 948);
|
||||
view->viewingPtr = viewing;
|
||||
|
||||
View_ErrorCheckEyePosition(view->eye.x, view->eye.y, view->eye.z);
|
||||
VIEW_ERROR_CHECK_EYE_POS(view->eye.x, view->eye.y, view->eye.z);
|
||||
|
||||
guLookAt(viewing, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x,
|
||||
view->up.y, view->up.z);
|
||||
|
||||
|
@ -611,6 +624,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#if OOT_DEBUG
|
||||
/**
|
||||
* Logs an error and returns nonzero if camera is too far from the origin.
|
||||
*/
|
||||
|
@ -640,3 +654,4 @@ s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ) {
|
|||
|
||||
return error;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -146,14 +146,14 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) {
|
|||
if (this->tlut) {
|
||||
tlut = this->tlut;
|
||||
} else {
|
||||
tlut = Graph_DlistAlloc(&gfx, 256 * G_IM_SIZ_16b_BYTES);
|
||||
tlut = Gfx_Alloc(&gfx, 256 * G_IM_SIZ_16b_BYTES);
|
||||
VisMono_DesaturateTLUT(this, tlut);
|
||||
}
|
||||
|
||||
if (this->dList) {
|
||||
dList = this->dList;
|
||||
} else {
|
||||
dList = Graph_DlistAlloc(&gfx, VISMONO_DLSIZE * sizeof(Gfx));
|
||||
dList = Gfx_Alloc(&gfx, VISMONO_DLSIZE * sizeof(Gfx));
|
||||
dListEnd = VisMono_DesaturateDList(this, dList);
|
||||
|
||||
if (!(dListEnd <= dList + VISMONO_DLSIZE)) {
|
||||
|
|
|
@ -456,7 +456,7 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
|||
s16 i;
|
||||
u8 skybox1Index;
|
||||
u8 skybox2Index;
|
||||
uintptr_t start;
|
||||
s32 pad;
|
||||
s32 skyboxConfig;
|
||||
|
||||
switch (skyboxId) {
|
||||
|
@ -530,473 +530,497 @@ void Skybox_Setup(PlayState* play, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
|||
case SKYBOX_BAZAAR:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_SP1a_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_SP1a_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_SP1a_staticSegmentRomEnd - (uintptr_t)_vr_SP1a_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1127);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1128);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1129);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_SP1a_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1129);
|
||||
|
||||
start = (uintptr_t)_vr_SP1a_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_SP1a_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_SP1a_pal_staticSegmentRomEnd - (uintptr_t)_vr_SP1a_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1132);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1133);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1134);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_SP1a_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1134);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_OVERCAST_SUNSET:
|
||||
start = (uintptr_t)_vr_cloud2_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_cloud2_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_cloud2_staticSegmentRomEnd - (uintptr_t)_vr_cloud2_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1155);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1156);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1159);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_cloud2_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1159);
|
||||
|
||||
skyboxCtx->staticSegments[1] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1162);
|
||||
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
|
||||
1163);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[1], start, size, "../z_vr_box.c", 1166);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[1], (uintptr_t)_vr_cloud2_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1166);
|
||||
|
||||
start = (uintptr_t)_vr_cloud2_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_cloud2_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_cloud2_pal_staticSegmentRomEnd - (uintptr_t)_vr_cloud2_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size * 2, "../z_vr_box.c", 1170);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1171);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1173);
|
||||
DMA_REQUEST_SYNC((u8*)skyboxCtx->palettes + size, start, size, "../z_vr_box.c", 1175);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_cloud2_pal_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1173);
|
||||
DMA_REQUEST_SYNC((u8*)skyboxCtx->palettes + size, (uintptr_t)_vr_cloud2_pal_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1175);
|
||||
break;
|
||||
|
||||
case SKYBOX_MARKET_ADULT:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_RUVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_RUVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_RUVR_staticSegmentRomEnd - (uintptr_t)_vr_RUVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1182);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1183);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1184);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_RUVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1184);
|
||||
|
||||
start = (uintptr_t)_vr_RUVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_RUVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_RUVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_RUVR_pal_staticSegmentRomStart;
|
||||
PRINTF("SIZE = %d\n", size);
|
||||
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1188);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1189);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1190);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_RUVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1190);
|
||||
break;
|
||||
|
||||
case SKYBOX_CUTSCENE_MAP:
|
||||
start = (uintptr_t)_vr_holy0_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_holy0_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_holy0_staticSegmentRomEnd - (uintptr_t)_vr_holy0_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1196);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1197);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1200);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_holy0_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1200);
|
||||
|
||||
start = (uintptr_t)_vr_holy1_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_holy1_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_holy1_staticSegmentRomEnd - (uintptr_t)_vr_holy1_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[1] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1203);
|
||||
ASSERT(skyboxCtx->staticSegments[1] != NULL, "vr_box->vr_box_staticSegment[1] != NULL", "../z_vr_box.c",
|
||||
1204);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[1], start, size, "../z_vr_box.c", 1207);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[1], (uintptr_t)_vr_holy1_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1207);
|
||||
|
||||
start = (uintptr_t)_vr_holy0_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_holy0_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_holy0_pal_staticSegmentRomEnd - (uintptr_t)_vr_holy0_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size * 2, "../z_vr_box.c", 1211);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1212);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1214);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_holy0_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1214);
|
||||
DMA_REQUEST_SYNC((u8*)skyboxCtx->palettes + size, (uintptr_t)_vr_holy1_pal_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1216);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_LINK:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_LHVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_LHVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_LHVR_staticSegmentRomEnd - (uintptr_t)_vr_LHVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1226);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1227);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1228);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_LHVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1228);
|
||||
|
||||
start = (uintptr_t)_vr_LHVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_LHVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_LHVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_LHVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1231);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1232);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1233);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_LHVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1233);
|
||||
break;
|
||||
|
||||
case SKYBOX_MARKET_CHILD_DAY:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_MDVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MDVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MDVR_staticSegmentRomEnd - (uintptr_t)_vr_MDVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1257);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1258);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1259);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_MDVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1259);
|
||||
|
||||
start = (uintptr_t)_vr_MDVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MDVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MDVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_MDVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1262);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1263);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1264);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_MDVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1264);
|
||||
break;
|
||||
|
||||
case SKYBOX_MARKET_CHILD_NIGHT:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_MNVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MNVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MNVR_staticSegmentRomEnd - (uintptr_t)_vr_MNVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1271);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1272);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1273);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_MNVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1273);
|
||||
|
||||
start = (uintptr_t)_vr_MNVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MNVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MNVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_MNVR_pal_staticSegmentRomStart;
|
||||
PRINTF("SIZE = %d\n", size);
|
||||
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1277);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1278);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1279);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_MNVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1279);
|
||||
break;
|
||||
|
||||
case SKYBOX_HAPPY_MASK_SHOP:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_FCVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_FCVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_FCVR_staticSegmentRomEnd - (uintptr_t)_vr_FCVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1286);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1287);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1288);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_FCVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1288);
|
||||
|
||||
start = (uintptr_t)_vr_FCVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_FCVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_FCVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_FCVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1291);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1292);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1293);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_FCVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1293);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_KNOW_IT_ALL_BROTHERS:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_KHVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KHVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KHVR_staticSegmentRomEnd - (uintptr_t)_vr_KHVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1301);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1302);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1303);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_KHVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1303);
|
||||
|
||||
start = (uintptr_t)_vr_KHVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KHVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KHVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_KHVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1306);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1307);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1308);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_KHVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1308);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_OF_TWINS:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_3FACE;
|
||||
|
||||
start = (uintptr_t)_vr_K3VR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K3VR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K3VR_staticSegmentRomEnd - (uintptr_t)_vr_K3VR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1331);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1332);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1333);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_K3VR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1333);
|
||||
|
||||
start = (uintptr_t)_vr_K3VR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K3VR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K3VR_pal_staticSegmentRomEnd - (uintptr_t)_vr_K3VR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1336);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1337);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1338);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_K3VR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1338);
|
||||
break;
|
||||
|
||||
case SKYBOX_STABLES:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_MLVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MLVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MLVR_staticSegmentRomEnd - (uintptr_t)_vr_MLVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1345);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1346);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1347);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_MLVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1347);
|
||||
|
||||
start = (uintptr_t)_vr_MLVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_MLVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_MLVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_MLVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1350);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1351);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1352);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_MLVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1352);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_KAKARIKO:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_KKRVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KKRVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KKRVR_staticSegmentRomEnd - (uintptr_t)_vr_KKRVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1359);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1360);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1361);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_KKRVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1361);
|
||||
|
||||
start = (uintptr_t)_vr_KKRVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KKRVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KKRVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_KKRVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1364);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1365);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1366);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_KKRVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1366);
|
||||
break;
|
||||
|
||||
case SKYBOX_KOKIRI_SHOP:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_KSVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KSVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KSVR_staticSegmentRomEnd - (uintptr_t)_vr_KSVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1373);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1374);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1375);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_KSVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1375);
|
||||
|
||||
start = (uintptr_t)_vr_KSVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KSVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KSVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_KSVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1378);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1379);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1380);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_KSVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1380);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_GORON_SHOP:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_GLVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_GLVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_GLVR_staticSegmentRomEnd - (uintptr_t)_vr_GLVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1405);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1406);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1407);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_GLVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1407);
|
||||
|
||||
start = (uintptr_t)_vr_GLVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_GLVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_GLVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_GLVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1410);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1411);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1412);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_GLVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1412);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_ZORA_SHOP:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_ZRVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_ZRVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_ZRVR_staticSegmentRomEnd - (uintptr_t)_vr_ZRVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1420);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1421);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1422);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_ZRVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1422);
|
||||
|
||||
start = (uintptr_t)_vr_ZRVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_ZRVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_ZRVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_ZRVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1425);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1426);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1427);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_ZRVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1427);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_POTION_SHOP_KAKARIKO:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_DGVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_DGVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_DGVR_staticSegmentRomEnd - (uintptr_t)_vr_DGVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1451);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1452);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1453);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_DGVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1453);
|
||||
|
||||
start = (uintptr_t)_vr_DGVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_DGVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_DGVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_DGVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1456);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1457);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1458);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_DGVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1458);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_POTION_SHOP_MARKET:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_ALVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_ALVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_ALVR_staticSegmentRomEnd - (uintptr_t)_vr_ALVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1466);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1467);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1468);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_ALVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1468);
|
||||
|
||||
start = (uintptr_t)_vr_ALVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_ALVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_ALVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_ALVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1471);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1472);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1473);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_ALVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1473);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_BOMBCHU_SHOP:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_NSVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_NSVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_NSVR_staticSegmentRomEnd - (uintptr_t)_vr_NSVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1481);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1482);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1483);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_NSVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1483);
|
||||
|
||||
start = (uintptr_t)_vr_NSVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_NSVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_NSVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_NSVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1486);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1487);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1488);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_NSVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1488);
|
||||
skyboxCtx->rot.y = 0.8f;
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_RICHARD:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_IPVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_IPVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_IPVR_staticSegmentRomEnd - (uintptr_t)_vr_IPVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1512);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1513);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1514);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_IPVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1514);
|
||||
|
||||
start = (uintptr_t)_vr_IPVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_IPVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_IPVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_IPVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1517);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1518);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1519);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_IPVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1519);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_IMPA:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_4FACE;
|
||||
|
||||
start = (uintptr_t)_vr_LBVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_LBVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_LBVR_staticSegmentRomEnd - (uintptr_t)_vr_LBVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1526);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1527);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1528);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_LBVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1528);
|
||||
|
||||
start = (uintptr_t)_vr_LBVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_LBVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_LBVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_LBVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1531);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1532);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1533);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_LBVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1533);
|
||||
break;
|
||||
|
||||
case SKYBOX_TENT:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_3FACE;
|
||||
|
||||
start = (uintptr_t)_vr_TTVR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_TTVR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_TTVR_staticSegmentRomEnd - (uintptr_t)_vr_TTVR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1540);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1541);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1542);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_TTVR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1542);
|
||||
|
||||
start = (uintptr_t)_vr_TTVR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_TTVR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_TTVR_pal_staticSegmentRomEnd - (uintptr_t)_vr_TTVR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1545);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1546);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1547);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_TTVR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1547);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_MIDO:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_3FACE;
|
||||
|
||||
start = (uintptr_t)_vr_K4VR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K4VR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K4VR_staticSegmentRomEnd - (uintptr_t)_vr_K4VR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1560);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1561);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1562);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_K4VR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1562);
|
||||
|
||||
start = (uintptr_t)_vr_K4VR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K4VR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K4VR_pal_staticSegmentRomEnd - (uintptr_t)_vr_K4VR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1565);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1566);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1567);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_K4VR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1567);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_SARIA:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_3FACE;
|
||||
|
||||
start = (uintptr_t)_vr_K5VR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K5VR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K5VR_staticSegmentRomEnd - (uintptr_t)_vr_K5VR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1574);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1575);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1576);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_K5VR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1576);
|
||||
|
||||
start = (uintptr_t)_vr_K5VR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_K5VR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_K5VR_pal_staticSegmentRomEnd - (uintptr_t)_vr_K5VR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1579);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1580);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1581);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_K5VR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1581);
|
||||
break;
|
||||
|
||||
case SKYBOX_HOUSE_ALLEY:
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_256_3FACE;
|
||||
|
||||
start = (uintptr_t)_vr_KR3VR_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KR3VR_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KR3VR_staticSegmentRomEnd - (uintptr_t)_vr_KR3VR_staticSegmentRomStart;
|
||||
skyboxCtx->staticSegments[0] = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1588);
|
||||
ASSERT(skyboxCtx->staticSegments[0] != NULL, "vr_box->vr_box_staticSegment[0] != NULL", "../z_vr_box.c",
|
||||
1589);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], start, size, "../z_vr_box.c", 1590);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->staticSegments[0], (uintptr_t)_vr_KR3VR_staticSegmentRomStart, size,
|
||||
"../z_vr_box.c", 1590);
|
||||
|
||||
start = (uintptr_t)_vr_KR3VR_pal_staticSegmentRomStart;
|
||||
size = (uintptr_t)_vr_KR3VR_pal_staticSegmentRomEnd - start;
|
||||
size = (uintptr_t)_vr_KR3VR_pal_staticSegmentRomEnd - (uintptr_t)_vr_KR3VR_pal_staticSegmentRomStart;
|
||||
skyboxCtx->palettes = GAME_STATE_ALLOC(&play->state, size, "../z_vr_box.c", 1593);
|
||||
ASSERT(skyboxCtx->palettes != NULL, "vr_box->vr_box_staticSegment[2] != NULL", "../z_vr_box.c", 1594);
|
||||
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, start, size, "../z_vr_box.c", 1595);
|
||||
DMA_REQUEST_SYNC(skyboxCtx->palettes, (uintptr_t)_vr_KR3VR_pal_staticSegmentRomStart, size, "../z_vr_box.c",
|
||||
1595);
|
||||
break;
|
||||
|
||||
case SKYBOX_UNSET_27:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Skybox_Init(GameState* state, SkyboxContext* skyboxCtx, s16 skyboxId) {
|
||||
PlayState* play = (PlayState*)state;
|
||||
|
||||
skyboxCtx->drawType = SKYBOX_DRAW_128;
|
||||
skyboxCtx->rot.x = skyboxCtx->rot.y = skyboxCtx->rot.z = 0.0f;
|
||||
|
||||
// DMA required assets based on skybox id
|
||||
Skybox_Setup(play, skyboxCtx, skyboxId);
|
||||
Skybox_Setup((PlayState*)state, skyboxCtx, skyboxId);
|
||||
PRINTF("\n\n\n********************\n\n\n"
|
||||
"TYPE=%d"
|
||||
"\n\n\n********************\n\n\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue