First proper commit.

This commit is contained in:
Jack Walker
2020-03-17 00:31:30 -04:00
parent be78236d36
commit 087f561f77
14086 changed files with 1200489 additions and 1 deletions
+172
View File
@@ -0,0 +1,172 @@
#include <global.h>
void THGA_Ct(TwoHeadGfxArena* thga, Gfx* start, u32 size)
{
THA_Ct((TwoHeadArena*)thga, start, size);
}
void THGA_Dt(TwoHeadGfxArena* thga)
{
THA_Dt((TwoHeadArena*)thga);
}
u32 THGA_IsCrash(TwoHeadGfxArena* thga)
{
return THA_IsCrash((TwoHeadArena*)thga);
}
void THGA_Init(TwoHeadGfxArena* thga)
{
THA_Init((TwoHeadArena*)thga);
}
s32 THGA_GetSize(TwoHeadGfxArena* thga)
{
return THA_GetSize((TwoHeadArena*)thga);
}
Gfx* THGA_GetHead(TwoHeadGfxArena* thga)
{
return THA_GetHead((TwoHeadArena*)thga);
}
void THGA_SetHead(TwoHeadGfxArena* thga, Gfx* start)
{
THA_SetHead((TwoHeadArena*)thga, start);
}
Gfx* THGA_GetTail(TwoHeadGfxArena* thga)
{
return THA_GetTail((TwoHeadArena*)thga);
}
Gfx* THGA_AllocStartArray8(TwoHeadGfxArena* thga, u32 count)
{
return THA_AllocStart((TwoHeadArena*)thga, count * 8);
}
Gfx* THGA_AllocStart8(TwoHeadGfxArena* thga)
{
return THGA_AllocStartArray8(thga, 1);
}
Gfx* THGA_AllocStart8Wrapper(TwoHeadGfxArena* thga)
{
return THGA_AllocStart8(thga);
}
Gfx* THGA_AllocEnd(TwoHeadGfxArena* thga, u32 size)
{
return THA_AllocEnd((TwoHeadArena*)thga, size);
}
Gfx* THGA_AllocEndArray64(TwoHeadGfxArena* thga, u32 count)
{
return THGA_AllocEnd(thga, count * 0x40);
}
Gfx* THGA_AllocEnd64(TwoHeadGfxArena* thga)
{
return THGA_AllocEnd(thga, 0x40);
}
Gfx* THGA_AllocEndArray16(TwoHeadGfxArena* thga, u32 count)
{
return THGA_AllocEnd(thga, count * 0x10);
}
Gfx* THGA_AllocEnd16(TwoHeadGfxArena* thga)
{
return THGA_AllocEnd(thga, 0x10);
}
void* THA_GetHead(TwoHeadArena* tha)
{
return tha->head;
}
void THA_SetHead(TwoHeadArena* tha, void* start)
{
tha->head = start;
}
void* THA_GetTail(TwoHeadArena* tha)
{
return tha->tail;
}
void* THA_AllocStart(TwoHeadArena* tha, u32 size)
{
void* start = tha->head;
tha->head += size;
return start;
}
void* THA_AllocStart1(TwoHeadArena* tha)
{
return THA_AllocStart(tha, 1);
}
void* THA_AllocEnd(TwoHeadArena* tha, u32 size)
{
u32 mask;
u32* temp;
if (size == 8)
mask = ~7;
else if (size == 4 || size == 12)
mask = ~3;
else if (size == 2 || size == 6 || size == 10 || size == 12 || size == 14)
mask = ~1;
else
mask = (size >= 0x10) ? ~0xF : 0;
temp = (u32*)&tha->tail; // required to match
return tha->tail = (void*)(((*temp & mask) - size) & mask);
}
void* THA_AllocEndAlign16(TwoHeadArena *tha, u32 size)
{
void* ret = (void*)(u32)((((u32)tha->tail & ~0xF) - size) & ((~(0xF & 0xFFFFFFFFFFFFFFFF)) & 0xFFFFFFFFu)); // required to match
tha->tail = ret;
return ret;
}
void* THA_AllocEndAlign(TwoHeadArena* tha, u32 size, u32 mask)
{
void* ret = (void*)((((u32)tha->tail & mask) - size) & mask);
tha->tail = ret;
return ret;
}
s32 THA_GetSize(TwoHeadArena* tha)
{
return tha->tail - tha->head;
}
u32 THA_IsCrash(TwoHeadArena* tha)
{
return THA_GetSize(tha) < 0;
}
void THA_Init(TwoHeadArena* tha)
{
tha->head = tha->bufp;
tha->tail = tha->bufp + tha->size;
}
void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size)
{
tha->bufp = ptr;
tha->size = size;
THA_Init(tha);
}
void THA_Dt(TwoHeadArena* tha)
{
bzero(tha, sizeof(TwoHeadArena));
}
+950
View File
@@ -0,0 +1,950 @@
#include <global.h>
#include <vt.h>
#define FILL_ALLOCBLOCK (1 << 0)
#define FILL_FREEBLOCK (1 << 1)
#define CHECK_FREE_BLOCK (1 << 2)
#define NODE_MAGIC (0x7373)
#define BLOCK_UNINIT_MAGIC (0xAB)
#define BLOCK_UNINIT_MAGIC_32 (0xABABABAB)
#define BLOCK_ALLOC_MAGIC (0xCD)
#define BLOCK_ALLOC_MAGIC_32 (0xCDCDCDCD)
#define BLOCK_FREE_MAGIC (0xEF)
#define BLOCK_FREE_MAGIC_32 (0xEFEFEFEF)
OSMesg sArenaLockMsg;
u32 __osMalloc_FreeBlockTest_Enable;
bool ArenaImpl_GetFillAllocBlock(Arena* arena)
{
return (arena->flag & FILL_ALLOCBLOCK) != 0;
}
bool ArenaImpl_GetFillFreeBlock(Arena* arena)
{
return (arena->flag & FILL_FREEBLOCK) != 0;
}
bool ArenaImpl_GetCheckFreeBlock(Arena* arena)
{
return (arena->flag & CHECK_FREE_BLOCK) != 0;
}
void ArenaImpl_SetFillAllocBlock(Arena* arena)
{
arena->flag |= FILL_ALLOCBLOCK;
}
void ArenaImpl_SetFillFreeBlock(Arena* arena)
{
arena->flag |= FILL_FREEBLOCK;
}
void ArenaImpl_SetCheckFreeBlock(Arena* arena)
{
arena->flag |= CHECK_FREE_BLOCK;
}
void ArenaImpl_UnsetFillAllocBlock(Arena* arena)
{
arena->flag &= ~FILL_ALLOCBLOCK;
}
void ArenaImpl_UnsetFillFreeBlock(Arena* arena)
{
arena->flag &= ~FILL_FREEBLOCK;
}
void ArenaImpl_UnsetCheckFreeBlock(Arena* arena)
{
arena->flag &= ~CHECK_FREE_BLOCK;
}
void ArenaImpl_SetDebugInfo(ArenaNode* node, const char* file, s32 line, Arena* arena)
{
node->filename = file;
node->line = line;
node->threadId = osGetThreadId(NULL);
node->arena = arena;
node->time = osGetTime();
}
void ArenaImpl_LockInit(Arena* arena)
{
osCreateMesgQueue(&arena->lock, &sArenaLockMsg, 1);
}
void ArenaImpl_Lock(Arena* arena)
{
osSendMesg(&arena->lock, NULL, OS_MESG_BLOCK);
}
void ArenaImpl_Unlock(Arena* arena)
{
osRecvMesg(&arena->lock, NULL, OS_MESG_BLOCK);
}
ArenaNode* ArenaImpl_GetNextBlock(ArenaNode* node)
{
ArenaNode* ret;
ret = node->next;
if (ret && (!ret || (ret->magic != NODE_MAGIC)))
{
osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク発見! (block=%08x)\n" VT_RST, ret);
ret = NULL;
node->next = NULL;
}
return ret;
}
ArenaNode* ArenaImpl_GetPrevBlock(ArenaNode* node)
{
ArenaNode* ret;
ret = node->prev;
if (ret && (!ret || (ret->magic != NODE_MAGIC)))
{
osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク発見! (block=%08x)\n" VT_RST, ret);
ret = NULL;
node->prev = NULL;
}
return ret;
}
ArenaNode* ArenaImpl_GetLastBlock(Arena* arena)
{
ArenaNode* ret = NULL;
ArenaNode* iter;
if (arena && arena->head && arena->head->magic == NODE_MAGIC)
{
iter = arena->head;
while (iter)
{
ret = iter;
iter = ArenaImpl_GetNextBlock(iter);
}
}
return ret;
}
void __osMallocInit(Arena* arena, void* start, u32 size)
{
bzero(arena, sizeof(Arena));
ArenaImpl_LockInit(arena);
__osMallocAddBlock(arena, start, size);
arena->isInit = true;
}
void __osMallocAddBlock(Arena* arena, void* start, s32 size)
{
s32 diff;
s32 size2;
ArenaNode* firstNode;
ArenaNode* lastNode;
if (start)
{
firstNode = (ArenaNode*)ALIGN16((u32)start);
diff = (s32)firstNode - (s32)start;
size2 = (size - diff) & ~0xF;
if (size2 > (s32)sizeof(ArenaNode))
{
func_80106860(firstNode, BLOCK_UNINIT_MAGIC, size2); //memset
firstNode->next = NULL;
firstNode->prev = NULL;
firstNode->size = size2 - sizeof(ArenaNode);
firstNode->isFree = true;
firstNode->magic = NODE_MAGIC;
ArenaImpl_Lock(arena);
lastNode = ArenaImpl_GetLastBlock(arena);
if (!lastNode)
{
arena->head = firstNode;
arena->start = start;
}
else
{
firstNode->prev = lastNode;
lastNode->next = firstNode;
}
ArenaImpl_Unlock(arena);
}
}
}
void ArenaImpl_RemoveAllBlocks(Arena* arena)
{
ArenaNode* iter;
ArenaNode* next;
ArenaImpl_Lock(arena);
iter = arena->head;
while (iter)
{
next = ArenaImpl_GetNextBlock(iter);
func_80106860(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); //memset
iter = next;
}
ArenaImpl_Unlock(arena);
}
void __osMallocCleanup(Arena* arena)
{
ArenaImpl_RemoveAllBlocks(arena);
bzero(arena, sizeof(*arena));
}
u8 __osMallocIsInitalized(Arena* arena)
{
return arena->isInit;
}
void __osMalloc_FreeBlockTest(Arena *arena, ArenaNode *node)
{
ArenaNode *node2;
u32* start;
u32* end;
u32* iter;
node2 = node;
if (__osMalloc_FreeBlockTest_Enable)
{
start = (u32*)((u32)node + sizeof(ArenaNode));
end = (u32*)((u32) start + node2->size);
iter = start;
while (iter < end)
{
if (*iter != BLOCK_UNINIT_MAGIC_32 && *iter != BLOCK_FREE_MAGIC_32)
{
osSyncPrintf(VT_COL(RED, WHITE) "緊急事態!メモリリーク検出! (block=%08x s=%08x e=%08x p=%08x)\n" VT_RST, node, start, end, iter);
__osDisplayArena(arena);
return;
}
iter++;
}
}
}
//single instruction not matching, stack problem
#ifdef NON_MATCHING
void* __osMalloc_NoLockDebug(Arena *arena, u32 size, const char *file, s32 line)
{
ArenaNode *iter;
u32 blockSize;
ArenaNode *newNode;
void *ret;
ArenaNode *next;
u32 pad;
ret = NULL;
iter = arena->head;
size = ALIGN16(size);
while (iter)
{
if (iter->isFree && iter->size >= size)
{
if ((arena->flag & CHECK_FREE_BLOCK) != 0)
__osMalloc_FreeBlockTest(arena, iter);
blockSize = ALIGN16(size) + sizeof(ArenaNode);
if (blockSize < iter->size)
{
newNode = (ArenaNode *)((u32)iter + blockSize);
newNode->next = ArenaImpl_GetNextBlock(iter);
newNode->prev = iter;
newNode->size = iter->size - blockSize;
newNode->isFree = true;
newNode->magic = NODE_MAGIC;
iter->next = newNode;
iter->size = size;
next = ArenaImpl_GetNextBlock(newNode);
if (next)
next->prev = newNode;
}
iter->isFree = false;
ArenaImpl_SetDebugInfo(iter, file, line, arena);
ret = (void *)((u32)iter + sizeof(ArenaNode));
if ((arena->flag & FILL_ALLOCBLOCK) != 0)
func_80106860(ret, BLOCK_ALLOC_MAGIC, size);
break;
}
iter = ArenaImpl_GetNextBlock(iter);
}
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osMalloc_NoLockDebug.s")
#endif
void* __osMallocDebug(Arena* arena, u32 size, const char* file, s32 line)
{
void* ret;
ArenaImpl_Lock(arena);
ret = __osMalloc_NoLockDebug(arena, size, file, line);
ArenaImpl_Unlock(arena);
return ret;
}
//stack + missing a move
#ifdef NON_MATCHING
void* __osMallocRDebug(Arena *arena, u32 size, const char *file, s32 line)
{
ArenaNode *iter;
u32 blockSize;
ArenaNode *newNode;
ArenaNode *next;
void *ret;
ret = NULL;
size = ALIGN16(size);
ArenaImpl_Lock(arena);
iter = ArenaImpl_GetLastBlock(arena);;
while (iter)
{
if (iter->isFree && iter->size >= size)
{
if ((arena->flag & CHECK_FREE_BLOCK) != 0)
__osMalloc_FreeBlockTest(arena, iter);
blockSize = ALIGN16(size) + sizeof(ArenaNode);
if (blockSize < iter->size)
{
newNode = (ArenaNode *)((u32)iter + (iter->size - size));
newNode->next = ArenaImpl_GetNextBlock(iter);
newNode->prev = iter;
newNode->size = size;
newNode->magic = NODE_MAGIC;
iter->next = newNode;
iter->size -= blockSize;
next = ArenaImpl_GetNextBlock(newNode);
if (next)
next->prev = newNode;
}
iter->isFree = false;
ArenaImpl_SetDebugInfo(iter, file, line, arena);
ret = (void *)((u32)iter + sizeof(ArenaNode));
if ((arena->flag & FILL_ALLOCBLOCK) != 0)
func_80106860(ret, BLOCK_ALLOC_MAGIC, size);
break;
}
iter = ArenaImpl_GetPrevBlock(iter);
}
ArenaImpl_Unlock(arena);
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osMallocRDebug.s")
#endif
//same diff as __osMalloc_NoLockDebug
#ifdef NON_MATCHING
void* __osMalloc_NoLock(Arena *arena, u32 size)
{
ArenaNode *iter;
u32 blockSize;
ArenaNode *newNode;
void *ret;
ArenaNode *next;
u32 pad;
ret = NULL;
iter = arena->head;
size = ALIGN16(size);
while (iter)
{
if (iter->isFree && iter->size >= size)
{
if ((arena->flag & CHECK_FREE_BLOCK) != 0)
__osMalloc_FreeBlockTest(arena, iter);
blockSize = ALIGN16(size) + sizeof(ArenaNode);
if (blockSize < iter->size)
{
newNode = (ArenaNode *)((u32)iter + blockSize);
newNode->next = ArenaImpl_GetNextBlock(iter);
newNode->prev = iter;
newNode->size = iter->size - blockSize;
newNode->isFree = true;
newNode->magic = NODE_MAGIC;
iter->next = newNode;
iter->size = size;
next = ArenaImpl_GetNextBlock(newNode);
if (next)
next->prev = newNode;
}
iter->isFree = false;
ArenaImpl_SetDebugInfo(iter, NULL, 0, arena);
ret = (void *)((u32)iter + sizeof(ArenaNode));
if ((arena->flag & FILL_ALLOCBLOCK) != 0)
func_80106860(ret, BLOCK_ALLOC_MAGIC, size);
break;
}
iter = ArenaImpl_GetNextBlock(iter);
}
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osMalloc_NoLock.s")
#endif
void* __osMalloc(Arena* arena, u32 size)
{
void* ret;
ArenaImpl_Lock(arena);
ret = __osMalloc_NoLock(arena, size);
ArenaImpl_Unlock(arena);
return ret;
}
//same diff as __osMallocRDebug
#ifdef NON_MATCHING
void* __osMallocR(Arena *arena, u32 size)
{
ArenaNode *iter;
u32 blockSize;
ArenaNode *newNode;
ArenaNode *next;
void *ret;
ret = NULL;
size = ALIGN16(size);
ArenaImpl_Lock(arena);
iter = ArenaImpl_GetLastBlock(arena);;
while (iter)
{
if (iter->isFree && iter->size >= size)
{
if ((arena->flag & CHECK_FREE_BLOCK) != 0)
__osMalloc_FreeBlockTest(arena, iter);
blockSize = ALIGN16(size) + sizeof(ArenaNode);
if (blockSize < iter->size)
{
newNode = (ArenaNode *)((u32)iter + (iter->size - size));
newNode->next = ArenaImpl_GetNextBlock(iter);
newNode->prev = iter;
newNode->size = size;
newNode->magic = NODE_MAGIC;
iter->next = newNode;
iter->size -= blockSize;
next = ArenaImpl_GetNextBlock(newNode);
if (next)
next->prev = newNode;
}
iter->isFree = false;
ArenaImpl_SetDebugInfo(iter, NULL, 0, arena);
ret = (void *)((u32)iter + sizeof(ArenaNode));
if ((arena->flag & FILL_ALLOCBLOCK) != 0)
func_80106860(ret, BLOCK_ALLOC_MAGIC, size);
break;
}
iter = ArenaImpl_GetPrevBlock(iter);
}
ArenaImpl_Unlock(arena);
return ret;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osMallocR.s")
#endif
//small reordering
#ifdef NON_MATCHING
void __osFree_NoLock(Arena* arena, void* ptr)
{
ArenaNode* node;
ArenaNode* next;
ArenaNode* prev;
ArenaNode* newNext;
if (ptr)
{
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
if (node == NULL || node->magic != NODE_MAGIC)
{
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x)\n" VT_RST, arena); //__osFree: Unauthorized release (%08x)
return;
}
if (node->isFree)
{
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, arena); //__osFree: Double release (%08x)
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);
return;
}
next = ArenaImpl_GetNextBlock(node);
prev = ArenaImpl_GetPrevBlock(node);
node->isFree = true;
ArenaImpl_SetDebugInfo(node, NULL, 0, arena);
if ((arena->flag & FILL_FREEBLOCK) != 0)
{
func_80106860((u32)node + sizeof(ArenaNode), BLOCK_FREE_MAGIC, node->size);
}
newNext = node->next;
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree)
{
newNext = ArenaImpl_GetNextBlock(next);
if (newNext)
newNext->prev = node;
node->size += next->size + sizeof(ArenaNode);
if ((arena->flag & FILL_FREEBLOCK) != 0)
func_80106860(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
node->next = newNext;
}
if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size)
{
if (newNext)
newNext->prev = prev;
prev->next = newNext;
prev->size += node->size + sizeof(ArenaNode);
if ((arena->flag & FILL_FREEBLOCK) != 0)
func_80106860(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osFree_NoLock.s")
#endif
void __osFree(Arena* arena, void* ptr)
{
ArenaImpl_Lock(arena);
__osFree_NoLock(arena, ptr);
ArenaImpl_Unlock(arena);
}
//small reordering
#ifdef NON_MATCHING
void __osFree_NoLockDebug(Arena* arena, void* ptr, const char* file, s32 line)
{
ArenaNode* node;
ArenaNode* next;
ArenaNode* prev;
ArenaNode* newNext;
if (ptr)
{
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
if (node == NULL || node->magic != NODE_MAGIC)
{
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:不正解放(%08x) [%s:%d ]\n" VT_RST, arena, file, line); //__osFree: Unauthorized release (%08x)
return;
}
if (node->isFree)
{
osSyncPrintf(VT_COL(RED, WHITE) "__osFree:二重解放(%08x)\n" VT_RST, arena); //__osFree: Double release (%08x)
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);
return;
}
next = ArenaImpl_GetNextBlock(node);
prev = ArenaImpl_GetPrevBlock(node);
node->isFree = true;
ArenaImpl_SetDebugInfo(node, file, line, arena);
if ((arena->flag & FILL_FREEBLOCK) != 0)
{
func_80106860((u32)node + sizeof(ArenaNode), BLOCK_FREE_MAGIC, node->size);
}
newNext = node->next;
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree)
{
newNext = ArenaImpl_GetNextBlock(next);
if (newNext)
newNext->prev = node;
node->size += next->size + sizeof(ArenaNode);
if ((arena->flag & FILL_FREEBLOCK) != 0)
func_80106860(next, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
node->next = newNext;
}
if (prev && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size)
{
if (newNext)
newNext->prev = prev;
prev->next = newNext;
prev->size += node->size + sizeof(ArenaNode);
if ((arena->flag & FILL_FREEBLOCK) != 0)
func_80106860(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode));
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osFree_NoLockDebug.s")
#endif
void __osFreeDebug(Arena* arena, void* ptr, const char* file, s32 line)
{
ArenaImpl_Lock(arena);
__osFree_NoLockDebug(arena, ptr, file, line);
ArenaImpl_Unlock(arena);
}
//small reordering, stack usage
#ifdef NON_MATCHING
void* __osRealloc(Arena* arena, void* ptr, u32 newSize)
{
ArenaNode* node;
ArenaNode* next;
u32 sizeDiff;
ArenaNode* overNext;
ArenaNode* newNext;
void* newAlloc;
//-----------
ArenaNode* next2;
ArenaNode unk;
ArenaNode* newNext2;
ArenaNode* overNext2;
//----------
u32 newSize2;
ArenaNode* newNext3;
ArenaNode* overNext3;
newSize = ALIGN16(newSize);
osSyncPrintf("__osRealloc(%08x, %d)\n", ptr, newSize);
ArenaImpl_Lock(arena);
if (!ptr)
{
ptr = __osMalloc(arena, newSize);
}
else if (!newSize)
{
__osFree_NoLock(arena, ptr);
ptr = NULL;
}
else
{
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
if (newSize == node->size)
{
//Does nothing because the memory block size does not change
osSyncPrintf("メモリブロックサイズが変わらないためなにもしません\n");
}
else if (node->size < newSize)
{
next = ArenaImpl_GetNextBlock(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);
newNext = (ArenaNode*)((u32)next + sizeDiff);
if (overNext)
overNext->prev = newNext;
node->next = newNext;
node->size = newSize;
func_801068B0(newNext, next, sizeof(ArenaNode)); //memcpy
}
else
{
//Allocate a new memory block and move the contents
osSyncPrintf("新たにメモリブロックを確保して内容を移動します\n");
newAlloc = __osMalloc_NoLock(arena, newSize);
if (newAlloc)
{
bcopy(ptr, newAlloc, node->size);
__osFree_NoLock(arena, ptr);
}
ptr = newAlloc;
}
}
else if (newSize < node->size)
{
next2 = ArenaImpl_GetNextBlock(node);
if (next && next->isFree)
{
//Increased free block behind current memory block
osSyncPrintf("現メモリブロックの後ろのフリーブロックを大きくしました\n");
unk = *next2;
newNext2 = (u32)node + ALIGN16(newSize) + sizeof(ArenaNode);
*newNext2 = unk;
newNext2->size += node->size - newSize;
node->next = newNext2;
node->size = newSize;
overNext2 = ArenaImpl_GetNextBlock(newNext2);
if (overNext2)
overNext2->prev = newNext2;
}
else if (newSize + sizeof(ArenaNode) < node->size)
{
//Generated because there is no free block after the current memory block
osSyncPrintf("現メモリブロックの後ろにフリーブロックがないので生成します\n");
newSize2 = ALIGN16(newSize) + sizeof(ArenaNode);
newNext3 = (ArenaNode*)((u32)node + newSize2);
newNext3->next = ArenaImpl_GetNextBlock(node);
newNext3->prev = node;
newNext3->size = node->size - newSize2;
newNext3->isFree = true;
newNext3->magic = NODE_MAGIC;
node->next = newNext3;
node->size = newSize;
overNext3 = ArenaImpl_GetNextBlock(newNext3);
if (overNext3)
overNext3->prev = newNext3;
}
else
{
//There is no room to generate free blocks
osSyncPrintf("フリーブロック生成するだけの空きがありません\n");
ptr = NULL;
}
}
}
ArenaImpl_Unlock(arena);
return ptr;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osRealloc.s")
#endif
void* __osReallocDebug(Arena* arena, void* ptr, u32 newSize, const char* file, s32 line)
{
return __osRealloc(arena, ptr, newSize);
}
void ArenaImpl_GetSizes(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc)
{
ArenaNode* iter;
ArenaImpl_Lock(arena);
*outMaxFree = 0;
*outFree = 0;
*outAlloc = 0;
iter = arena->head;
while(iter)
{
if (iter->isFree)
{
*outFree += iter->size;
if (*outMaxFree < iter->size)
*outMaxFree = iter->size;
}
else
*outAlloc += iter->size;
iter = ArenaImpl_GetNextBlock(iter);
}
ArenaImpl_Unlock(arena);
}
//small reordering at the end
#ifdef NON_MATCHING
void __osDisplayArena(Arena* arena)
{
u32 freeSize;
u32 allocatedSize;
u32 maxFree;
ArenaNode* iter;
ArenaNode* next;
if (!__osMallocIsInitalized(arena))
{
//Arena is not initalized
osSyncPrintf("アリーナは初期化されていません\n");
return;
}
ArenaImpl_Lock(arena);
maxFree = 0;
freeSize = 0;
allocatedSize = 0;
//Arena contents (0x%08x)
osSyncPrintf("アリーナの内容 (0x%08x)\n", arena);
//Memory node range status size [time s ms us ns: TID: src: line]
osSyncPrintf("メモリブロック範囲 status サイズ [時刻 s ms us ns: TID:src:行]\n");
iter = arena->head;
while(iter)
{
if (iter && iter->magic == NODE_MAGIC)
{
next = iter->next;
osSyncPrintf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size),
(!next) ? '$' : (iter != next->prev ? '!' : ' '),
iter->isFree ? "空き" : "確保", //? "Free" : "Secure"
iter->size);
if (!iter->isFree)
osSyncPrintf(" [%016llu:%2d:%s:%d]", (iter->time*64ll)/3ull, iter->threadId, iter->filename ? iter->filename : "**NULL**", iter->line);
osSyncPrintf("\n");
if (iter->isFree)
{
freeSize += iter->size;
if (maxFree < iter->size)
maxFree = iter->size;
}
else
{
allocatedSize += iter->size;
}
iter = next;
}
else
{
osSyncPrintf("%08x Block Invalid\n", iter);
iter = NULL;
}
}
osSyncPrintf("確保ブロックサイズの合計 0x%08x バイト\n", allocatedSize); //Total reserved node size 0x%08x bytes
osSyncPrintf("空きブロックサイズの合計 0x%08x バイト\n", freeSize); //Total free node size 0x%08x bytes
osSyncPrintf("最大空きブロックサイズ 0x%08x バイト\n", maxFree); //Maximum free node size 0x%08x bytes
ArenaImpl_Unlock(arena);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/__osDisplayArena.s")
#endif
//small reordering
#ifdef NON_MATCHING
void ArenaImpl_FaultClient(Arena* arena)
{
u32 freeSize;
u32 allocatedSize;
u32 maxFree;
ArenaNode* iter;
ArenaNode* next;
FaultDrawer_Printf("ARENA INFO (0x%08x)\n", arena);
if (!__osMallocIsInitalized(arena))
{
FaultDrawer_Printf("Arena is uninitalized\n", arena);
return;
}
maxFree = 0;
freeSize = 0;
allocatedSize = 0;
FaultDrawer_Printf("Memory Block Region status size\n");
iter = arena->head;
while(iter)
{
if (iter && iter->magic == NODE_MAGIC)
{
next = iter->next;
FaultDrawer_Printf("%08x-%08x%c %s %08x", iter, ((u32)iter + sizeof(ArenaNode) + iter->size),
(!next) ? '$' : (iter != next->prev ? '!' : ' '),
iter->isFree ? "F" : "A",
iter->size);
FaultDrawer_Printf("\n");
if (iter->isFree)
{
freeSize += iter->size;
if (maxFree < iter->size)
maxFree = iter->size;
}
else
{
allocatedSize += iter->size;
}
iter = next;
}
else
{
FaultDrawer_SetFontColor(0xF801);
FaultDrawer_Printf("%08x Block Invalid\n", iter);
iter = NULL;
}
}
FaultDrawer_SetFontColor(0x7F1);
FaultDrawer_Printf("Total Alloc Block Size %08x\n", allocatedSize);
FaultDrawer_Printf("Total Free Block Size %08x\n", freeSize);
FaultDrawer_Printf("Largest Free Block Size %08x\n", maxFree);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/__osMalloc/ArenaImpl_FaultClient.s")
#endif
u32 __osCheckArena(Arena* arena)
{
ArenaNode *iter;
u32 error;
error = 0;
ArenaImpl_Lock(arena);
//Checking the contents of the arena. . (%08x)
osSyncPrintf("アリーナの内容をチェックしています... (%08x)\n", arena);
iter = arena->head;
while(iter)
{
if (iter && iter->magic == NODE_MAGIC)
{
//Oops!! (%08x %08x)
osSyncPrintf(VT_COL(RED, WHITE) "おおっと!! (%08x %08x)\n" VT_RST, iter, iter->magic);
error = 1;
break;
}
iter = ArenaImpl_GetNextBlock(iter);
}
if (!error)
{
//The arena is still going well
osSyncPrintf("アリーナはまだ、いけそうです\n");
}
ArenaImpl_Unlock(arena);
return error;
}
u8 func_800FF334(Arena* arena)
{
return arena->unk_20;
}
+17
View File
@@ -0,0 +1,17 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/pad_800C3C70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3C80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3CB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3E40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3E70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3FC4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/audioMgr/func_800C3FEC.s")
+28
View File
@@ -0,0 +1,28 @@
#include <ultra64.h>
#include <global.h>
GlobalContext* func_80026B00(void)
{
return D_80157DA0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_80026B0C.s")
void func_80026C1C(u8* arg0)
{
arg0[0] = 0;
arg0[1] = 0;
arg0[2] = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_80026C2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/Effect_Add.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_80026E74.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_80026F70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_8002709C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80026B00/func_800271A8.s")
+64
View File
@@ -0,0 +1,64 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800430A0/func_800430A0.s")
void func_800432A0(CollisionContext* colCtx, u32 floorPolySource, Actor* actor)
{
if (func_8003E934(floorPolySource) != 0)
{
s16 v1 = colCtx->dyna.actorMeshArr[floorPolySource].rot2.y - colCtx->dyna.actorMeshArr[floorPolySource].rot1.y;
if (actor->id == 0)
((Player*)actor)->unk_83C += v1;
actor->shape.rot.y += v1;
actor->posRot.rot.y += v1;
}
}
void func_80043334(CollisionContext* colCtx, Actor* actor, u32 floorPolySource)
{
if (func_8003E934(floorPolySource) != 0)
{
DynaPolyActor* dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
if (dynaActor != NULL)
{
func_800434A8(dynaActor);
if ((actor->flags & 0x4000000) == 0x4000000)
func_80043538(dynaActor);
}
}
}
s32 func_800433A4(CollisionContext* colCtx, u32 floorPolySource, Actor* actor)
{
s32 sp24 = 0;
DynaPolyActor* dynaActor;
if (func_8003E934(floorPolySource) == 0)
return 0;
if ((colCtx->dyna.flags[floorPolySource] & 2) || !(colCtx->dyna.flags[floorPolySource] & 1))
return 0;
dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
if (dynaActor == NULL)
return 0;
if (dynaActor->unk_15C & 1)
{
func_800430A0(colCtx, floorPolySource, actor);
sp24 = 1;
}
if (dynaActor->unk_15C & 2)
{
func_800432A0(colCtx, floorPolySource, actor);
sp24 = 1;
}
return sp24;
}
+86
View File
@@ -0,0 +1,86 @@
#include <ultra64.h>
#include <global.h>
void DynaPolyInfo_SetActorMove(DynaPolyActor* dynaActor, DynaPolyMoveFlag flags)
{
dynaActor->dynaPolyId = -1;
dynaActor->unk_15C = flags;
dynaActor->unk_160 = 0;
dynaActor->unk_150 = 0.0f;
dynaActor->unk_154 = 0.0f;
}
void func_800434A0(DynaPolyActor *dynaActor)
{
dynaActor->unk_160 = 0;
}
void func_800434A8(DynaPolyActor *dynaActor)
{
dynaActor->unk_160 |= 1;
}
void func_800434B8(DynaPolyActor *dynaActor)
{
dynaActor->unk_160 |= 2;
}
void func_800434C8(CollisionContext* colCtx, u32 floorPolySource)
{
DynaPolyActor *dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
if (dynaActor != NULL)
func_800434B8(dynaActor);
}
void func_800434F8(DynaPolyActor* dynaActor)
{
dynaActor->unk_160 |= 4;
}
void func_80043508(CollisionContext* colCtx, u32 floorPolySource)
{
DynaPolyActor *dynaActor = DynaPolyInfo_GetActor(colCtx, floorPolySource);
if (dynaActor != NULL)
func_800434F8(dynaActor);
}
void func_80043538(DynaPolyActor* dynaActor)
{
dynaActor->unk_160 |= 8;
}
s32 func_80043548(DynaPolyActor* dynaActor)
{
if (dynaActor->unk_160 & 1)
return 1;
else
return 0;
}
s32 func_8004356C(DynaPolyActor* dynaActor)
{
if (dynaActor->unk_160 & 2)
return 1;
else
return 0;
}
s32 func_80043590(DynaPolyActor* dynaActor)
{
if (dynaActor->unk_160 & 4)
return 1;
else
return 0;
}
s32 func_800435B4(DynaPolyActor* dynaActor)
{
if (dynaActor->unk_160 & 8)
return 1;
else
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_80043480/func_800435D8.s")
+30
View File
@@ -0,0 +1,30 @@
#include <ultra64.h>
#include <global.h>
void* MemCopy(void* dest, void* src, s32 size)
{
u8* destu = (u8*)dest;
u8* srcu = (u8*)src;
while (size > 0)
{
*destu++ = *srcu++;
size--;
}
return dest;
}
void* MemSet(void* dest, s32 val, s32 size)
{
u8* destu = (u8*)dest;
s32 s = size;
while (s > 0)
{
*destu++ = val;
s--;
}
return dest;
}
+5
View File
@@ -0,0 +1,5 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C360/func_8006C360.s")
+11
View File
@@ -0,0 +1,11 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C3A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C3D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C438.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C3A0/func_8006C4A4.s")
+7
View File
@@ -0,0 +1,7 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C510.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006C510/func_8006C5A8.s")
+14
View File
@@ -0,0 +1,14 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006EA30.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006ECF4.s")
void func_8006EE48(UNK_TYPE arg0)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8006EA30/func_8006EE50.s")
+50
View File
@@ -0,0 +1,50 @@
#include <ultra64.h>
#include <global.h>
extern u32 osResetType;
/*
void func_8007BE60(u32* a0)
{
u32 var1;
//*a0 = 0;
if (osResetType == 0)
{
a0[1] = 0;
a0[2] = 0;
a0[3] = 0;
}
else
{
var1 = a0[3] + a0[5];
a0[1]++;
a0[2] = (var1 < a0[5]) + a0[2] + a0[4];
a0[3] = var1;
}
a0[5] = 0;
a0[4] = 0;
}
*/
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BE60/func_8007BE60.s")
typedef struct
{
/* 0x00 */ u32 unk_00;
/* 0x04 */ char unk_04[0x0C];
/* 0x10 */ OSTime unk_10;
} struct_8007BED4;
void func_8007BED4(struct_8007BED4* arg0)
{
arg0->unk_00 = 1;
arg0->unk_10 = osGetTime();
}
u32 func_8007BF08(struct_8007BED4* arg0)
{
return arg0->unk_00;
}
+5
View File
@@ -0,0 +1,5 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF10/func_8007BF10.s")
+137
View File
@@ -0,0 +1,137 @@
#include <ultra64.h>
#include <global.h>
void func_8007C1AC(Vec3f* dest, struct_80045714* arg1);
f32 func_8007BF90(Vec3f* a, Vec3f* b)
{
f32 dx = a->x - b->x;
f32 dy = a->y - b->y;
f32 dz = a->z - b->z;
return sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
}
f32 func_8007BFD0(Vec3f* a, Vec3f* b, Vec3f* dest)
{
dest->x = a->x - b->x;
dest->y = a->y - b->y;
dest->z = a->z - b->z;
return sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z));
}
f32 func_8007C028(Vec3f* a, Vec3f* b)
{
return sqrtf(SQ(a->x - b->x) + SQ(a->z - b->z));
}
f32 func_8007C058(f32 arg0, f32 arg1)
{
return (arg1 <= fabsf(arg0)) ? arg0 : ((arg0 >= 0) ? arg1 : -arg1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C0A8.s")
#ifdef NON_MATCHING
void func_8007C0F8(Vec3f* dest, Vec3f* a, Vec3f* b)
{
f32 fVar1;
Vec3f v;
v.x = b->x - a->x;
v.y = b->y - a->y;
v.z = b->z - a->z;
fVar1 = func_8007C058(sqrtf(v.x * v.x + v.y * v.y + v.z * v.z), D_8013CB80);
dest->x = v.x / fVar1;
dest->y = v.y / fVar1;
dest->z = v.z / fVar1;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C0F8.s")
#endif
#ifdef NON_MATCHING
void func_8007C1AC(Vec3f* dest, struct_80045714* arg1)
{
f32 fVar1;
f32 fVar2;
f32 fVar3;
f32 fVar4;
f32 fVar5;
f32 fVar6;
fVar1 = Math_Coss(arg1->unk_04);
fVar2 = Math_Coss(arg1->unk_06);
fVar3 = Math_Coss(arg1->unk_04);
fVar4 = Math_Coss(arg1->unk_06);
fVar6 = arg1->unk_00;
fVar5 = arg1->unk_00;
dest->x = arg1->unk_00 * fVar3 * fVar4;
dest->y = fVar6 * fVar1;
dest->z = fVar5 * fVar3 * fVar2;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C1AC.s")
#endif
void func_8007C3F4(struct_80045714* arg0, Vec3f* arg1);
void func_8007C25C(Vec3f* dest, struct_80045714* arg1)
{
struct_80045714 var;
var.unk_00 = arg1->unk_00;
var.unk_04 = 0x3FFF - arg1->unk_04;
var.unk_06 = arg1->unk_06;
func_8007C1AC(dest, &var);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C29C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C3F4.s")
void func_8007C29C(struct_80045714* arg0, Vec3f* arg1);
void func_8007C440(struct_80045714* arg0, Vec3f* a, Vec3f* b)
{
Vec3f var;
var.x = b->x - a->x;
var.y = b->y - a->y;
var.z = b->z - a->z;
func_8007C29C(arg0, &var);
}
void func_8007C490(struct_80045714* arg0, Vec3f* a, Vec3f* b)
{
Vec3f var;
var.x = b->x - a->x;
var.y = b->y - a->y;
var.z = b->z - a->z;
func_8007C3F4(arg0, &var);
}
Vec3f* func_8007C4E0(Vec3f* dest, Vec3f* a, Vec3f* b)
{
Vec3f var;
var.x = func_800FD250(b->z - a->z, b->y - a->y);
var.y = func_800FD250(b->x - a->x, b->z - a->z);
var.z = 0;
*dest = var;
return dest;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C574.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/code_8007BF90/func_8007C5E0.s")
+279
View File
@@ -0,0 +1,279 @@
#include <ultra64.h>
#include <global.h>
// Bit Flag array in which gBitFlags[n] is literally (1 << n)
u32 gBitFlags[] =
{
(1 << 0), (1 << 1), (1 << 2), (1 << 3),
(1 << 4), (1 << 5), (1 << 6), (1 << 7),
(1 << 8), (1 << 9), (1 << 10), (1 << 11),
(1 << 12), (1 << 13), (1 << 14), (1 << 15),
(1 << 16), (1 << 17), (1 << 18), (1 << 19),
(1 << 20), (1 << 21), (1 << 22), (1 << 23),
(1 << 24), (1 << 25), (1 << 26), (1 << 27),
(1 << 28), (1 << 29), (1 << 30), (1 << 31),
};
u16 gEquipMasks[] = { 0x000F, 0x00F0, 0x0F00, 0xF000 };
u16 gEquipNegMasks[] = { 0xFFF0, 0xFF0F, 0xF0FF, 0x0FFF };
u32 gUpgradeMasks[] = { 0x00000007, 0x00000038, 0x000001C0, 0x00000E00, 0x00003000, 0x0001C000, 0x000E0000, 0x00700000 };
u32 gUpgradeNegMasks[] = { 0xFFFFFFF8, 0xFFFFFFC7, 0xFFFFFE3F, 0xFFFFF1FF, 0xFFFFCFFF, 0xFFFE3FFF, 0xFFF1FFFF, 0xFF8FFFFF };
u8 gEquipShifts[] = { 0, 4, 8, 12 };
u8 gUpgradeShifts[] = { 0, 3, 6, 9, 12, 14, 17, 20 };
u16 gUpgradeCapacities[][4] =
{
{ 0, 30, 40, 50 }, // Quivers
{ 0, 20, 30, 40 }, // Bomb Bags
{ 0, 0, 0, 0 }, // Unused (Scale)
{ 0, 0, 0, 0 }, // Unused (Strength)
{ 99, 200, 500, 500 }, // Wallets
{ 0, 30, 40, 50 }, // Deku Seed Bullet Bags
{ 0, 10, 20, 30 }, // Deku Stick Upgrades
{ 0, 20, 30, 40 }, // Deku Nut Upgrades
};
u32 D_8012723C[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 }; // Unused
u32 D_8012724C[] = { 0, 8, 16, 24 }; // Unused
// TODO: use symbols for these icon textures once textures are properly in C
u32 gItemIcons[] =
{
0x08000000,
0x08001000,
0x08002000,
0x08003000,
0x08004000,
0x08005000,
0x08006000,
0x08007000,
0x08008000,
0x08009000,
0x0800A000,
0x0800B000,
0x0800C000,
0x0800D000,
0x0800E000,
0x0800F000,
0x08010000,
0x08011000,
0x08012000,
0x08013000,
0x08014000,
0x08015000,
0x08016000,
0x08017000,
0x08018000,
0x08019000,
0x0801A000,
0x0801B000,
0x0801C000,
0x0801D000,
0x0801E000,
0x0801F000,
0x08020000,
0x08021000,
0x08022000,
0x08023000,
0x08024000,
0x08025000,
0x08026000,
0x08027000,
0x08028000,
0x08029000,
0x0802A000,
0x0802B000,
0x0802C000,
0x0802D000,
0x0802E000,
0x0802F000,
0x08030000,
0x08031000,
0x08032000,
0x08033000,
0x08034000,
0x08035000,
0x08036000,
0x08037000,
0x08038000,
0x08039000,
0x0803A000,
0x0803B000,
0x0803C000,
0x0803D000,
0x0803E000,
0x0803F000,
0x08040000,
0x08041000,
0x08042000,
0x08043000,
0x08044000,
0x08045000,
0x08046000,
0x08047000,
0x08048000,
0x08049000,
0x0804A000,
0x0804B000,
0x0804C000,
0x0804D000,
0x0804E000,
0x0804F000,
0x08050000,
0x08051000,
0x08052000,
0x08053000,
0x08054000,
0x08055000,
0x08056000,
0x08057000,
0x08058000,
0x08059000,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x08089440,
0x09000000,
0x09000900,
0x09001200,
0x09001B00,
0x09002400,
0x09002D00,
0x09003600,
0x09003F00,
0x09004800,
0x09005100,
0x09005A00,
0x09006300,
0x09006C00,
0x09007500,
0x09007E00,
0x09009000,
0x09008700,
0x09007E00,
0x0900A200,
0x0900AB00,
0x0805A000,
0x0805A900,
0x0805B200,
0x02002D40,
0x02002A40,
0x02002C40,
0x02002B40,
0x02002940,
};
// Used to map item IDs to inventory slots
u8 gItemSlots[] =
{
SLOT_STICK,
SLOT_NUT,
SLOT_BOMB,
SLOT_BOW,
SLOT_ARROW_FIRE,
SLOT_DINS_FIRE,
SLOT_SLINGSHOT,
SLOT_OCARINA,
SLOT_OCARINA,
SLOT_BOMBCHU,
SLOT_HOOKSHOT,
SLOT_HOOKSHOT,
SLOT_ARROW_ICE,
SLOT_FARORES_WIND,
SLOT_BOOMERANG,
SLOT_LENS,
SLOT_BEAN,
SLOT_HAMMER,
SLOT_ARROW_LIGHT,
SLOT_NAYRUS_LOVE,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_BOTTLE_1,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_CHILD,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT,
SLOT_TRADE_ADULT
};
void Inventory_ChangeEquipment(s16 equipment, u16 value)
{
gSaveContext.equips.equipment &= gEquipNegMasks[equipment];
gSaveContext.equips.equipment |= value << gEquipShifts[equipment];
}
u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment)
{
Player* player = PLAYER;
s32 pad;
u16 sp26;
sp26 = gSaveContext.equips.equipment & gEquipMasks[equipment];
// Translates to: "Erasing equipment item = %d zzz=%d"
osSyncPrintf("装備アイテム抹消 = %d zzz=%d\n", equipment, sp26);
if (sp26)
{
sp26 >>= gEquipShifts[equipment];
gSaveContext.equips.equipment &= gEquipNegMasks[equipment];
gSaveContext.equipment ^= gBitFlags[sp26 - 1] << gEquipShifts[equipment];
if (equipment == EQUIP_TUNIC)
gSaveContext.equips.equipment |= 0x0100;
if (equipment == EQUIP_SWORD)
{
gSaveContext.equips.button_items[0] = ITEM_NONE;
gSaveContext.inf_table[29] = 1;
}
func_8008ECAC(globalCtx, player);
globalCtx->pauseCtx.unk_238 = 10;
}
return sp26;
}
void Inventory_ChangeUpgrade(s16 upgrade, s16 value)
{
gSaveContext.upgrades &= gUpgradeNegMasks[upgrade];
gSaveContext.upgrades |= value << gUpgradeShifts[upgrade];
}
+58
View File
@@ -0,0 +1,58 @@
#include <ultra64.h>
#include <global.h>
typedef struct
{
/* 0x00 */ OSPiHandle piHandle;
/* 0x74 */ OSIoMesg ioMesg;
/* 0x8C */ OSMesgQueue mesgQ;
} struct_800A9D40;
struct_800A9D40 D_8012A690 = {0};
void func_800A9D40(u32 addr, u8 handleType, u8 handleDomain, u8 handleLatency, u8 handlePageSize, u8 handleRelDuration,
u8 handlePulse, u32 handleSpeed)
{
u32 int_disabled;
OSPiHandle *handle = &D_8012A690.piHandle;
if ((u32) OS_PHYSICAL_TO_K1(addr) != (*handle).baseAddress)
{
D_8012A690.piHandle.type = handleType;
(*handle).baseAddress = OS_PHYSICAL_TO_K1(addr);
D_8012A690.piHandle.latency = handleLatency;
D_8012A690.piHandle.pulse = handlePulse;
D_8012A690.piHandle.pageSize = handlePageSize;
D_8012A690.piHandle.relDuration = handleRelDuration;
D_8012A690.piHandle.domain = handleDomain;
D_8012A690.piHandle.speed = handleSpeed;
bzero(&D_8012A690.piHandle.transferInfo, sizeof(__OSTranxInfo));
int_disabled = __osDisableInt();
D_8012A690.piHandle.next = __osPiTable;
__osPiTable = &D_8012A690;
__osRestoreInt(int_disabled);
D_8012A690.ioMesg.hdr.pri = 0;
D_8012A690.ioMesg.hdr.retQueue = &D_8012A690.mesgQ;
D_8012A690.ioMesg.devAddr = addr;
}
}
void func_800A9E14(UNK_PTR dramAddr, size_t size, UNK_TYPE arg2)
{
OSMesg mesg;
osCreateMesgQueue(&D_8012A690.mesgQ, &mesg, 1);
D_8012A690.ioMesg.dramAddr = dramAddr;
D_8012A690.ioMesg.size = size;
osWritebackDCache(dramAddr, size);
osEPiStartDma(&D_8012A690, &D_8012A690.ioMesg, arg2);
osRecvMesg(&D_8012A690.mesgQ, &mesg, 1);
osInvalDCache(dramAddr, size);
}
void Sram_ReadWrite(UNK_TYPE arg0, UNK_PTR dramAddr, size_t size, UNK_TYPE arg3)
{
osSyncPrintf("ssSRAMReadWrite:%08x %08x %08x %d\n", arg0, dramAddr, size, arg3);
func_800A9D40(arg0, 3, 1, 5, 0xd, 2, 0xc, 0);
func_800A9E14(dramAddr, size, arg3);
}
+83
View File
@@ -0,0 +1,83 @@
#include <ultra64.h>
#include <global.h>
#include <padmgr.h>
extern u8 D_80160FD0[];
extern PadMgr gPadMgr;
void func_800A9F30(s32 a, s32 b)
{
func_800D2E30(&D_80160FD0);
func_800C7948(a, &D_80160FD0);
}
void func_800A9F6C(f32 a, u8 b, u8 c, u8 d)
{
s32 temp1, temp2;
if (1000000.0f < a)
temp1 = 1000;
else
temp1 = sqrtf(a);
if ((temp1 < 1000) && (b != 0) && (d != 0))
{
temp2 = b - (temp1 * 255) / 1000;
if (temp2 > 0)
{
D_801610DA = temp2;
D_80160FD0[0x10B] = c;
D_80160FD0[0x10C] = d;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800A9F30/func_800AA000.s")
// this function is very similar to the one above but has a loop in it I can't figure out
void func_800AA0B4(void)
{
func_800D3140(&D_80160FD0);
gPadMgr.unk_460 = func_800A9F30;
gPadMgr.unk_464 = 0;
if (0) ; // Necessary to match
}
#ifdef NON_MATCHING
void func_800AA0F0(void)
{
if ((gPadMgr.unk_460 == func_800A9F30) && (gPadMgr.unk_464 == 0))
{
// asm loads/writes directly to 0x80166D20 and 0x80166D24
// but the compiler wants to reuse offsets from 0x801668C0
gPadMgr.unk_460 = NULL;
gPadMgr.unk_464 = 0;
}
func_800D3178(&D_80160FD0);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/code_800A9F30/func_800AA0F0.s")
#endif
u32 func_800AA148(void)
{
return ((gPadMgr.unk_2AE[0] ^ 1) == 0);
}
void func_800AA15C(void)
{
D_801610D4 = 2;
}
void func_800AA16C(void)
{
D_801610D4 = 0;
}
void func_800AA178(u32 a)
{
D_801610D5 = !!a;
}
+50
View File
@@ -0,0 +1,50 @@
#include <z64.h>
#define printSpStatus(x, name) if (x & SP_STATUS_##name) osSyncPrintf(#name " ")
#define printDpStatus(x, name) if (x & DPC_STATUS_##name) osSyncPrintf(#name " ")
void func_800FBCE0()
{
u32 spStatus = __osSpGetStatus();
u32 dpStatus = osDpGetStatus();
osSyncPrintf("osSpGetStatus=%08x: ", spStatus);
printSpStatus(spStatus, HALT);
printSpStatus(spStatus, BROKE);
printSpStatus(spStatus, DMA_BUSY);
printSpStatus(spStatus, DMA_FULL);
printSpStatus(spStatus, IO_FULL);
printSpStatus(spStatus, SSTEP);
printSpStatus(spStatus, INTR_BREAK);
printSpStatus(spStatus, YIELD);
printSpStatus(spStatus, YIELDED);
printSpStatus(spStatus, TASKDONE);
printSpStatus(spStatus, SIG3);
printSpStatus(spStatus, SIG4);
printSpStatus(spStatus, SIG5);
printSpStatus(spStatus, SIG6);
printSpStatus(spStatus, SIG7);
osSyncPrintf("\n");
osSyncPrintf("osDpGetStatus=%08x:", dpStatus);
printDpStatus(dpStatus, XBUS_DMEM_DMA);
printDpStatus(dpStatus, FREEZE);
printDpStatus(dpStatus, FLUSH);
printDpStatus(dpStatus, START_GCLK);
printDpStatus(dpStatus, TMEM_BUSY);
printDpStatus(dpStatus, PIPE_BUSY);
printDpStatus(dpStatus, CMD_BUSY);
printDpStatus(dpStatus, CBUF_READY);
printDpStatus(dpStatus, DMA_BUSY);
printDpStatus(dpStatus, END_VALID);
printDpStatus(dpStatus, START_VALID);
osSyncPrintf("\n");
}
void func_800FBFD8()
{
func_800FBCE0();
osDpSetStatus(DPC_SET_FREEZE | DPC_SET_FLUSH);
__osSpSetStatus(SP_SET_HALT | SP_SET_SIG2 | SP_CLR_INTR_BREAK);
func_800FBCE0();
}
+235
View File
@@ -0,0 +1,235 @@
#include <global.h>
typedef void (*arg3_800FC868)(void*);
typedef void (*arg3_800FC8D8)(void*,u32);
typedef void (*arg3_800FC948)(void*,u32,u32,u32,u32,u32,u32,u32,u32);
typedef void (*arg3_800FCA18)(void*,u32);
typedef struct InitFunc
{
s32 nextOffset;
void (*func)(void);
} InitFunc;
//.data
void *sInitFuncs = NULL;
char sNew[4] =
{
'n', 'e', 'w',
};
char D_80134488[0x18] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x7F, 0x80, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
};
s32 Overlay_Load(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd, void *allocatedVRamAddr)
{
u32 pad;
u32 end;
u32 bssSize;
OverlayRelocationSection *ovl;
u32 relocCnt;
u32 ovlOffset;
u32 size;
if(gOverlayLogSeverity >= 3)
{
// Start loading dynamic link function
osSyncPrintf("\nダイナミックリンクファンクションのロードを開始します\n");
}
if(gOverlayLogSeverity >= 3)
{
size = vRomEnd - vRomStart;
//DMA transfer of TEXT, DATA, RODATA + rel (%08x-%08x)
osSyncPrintf("TEXT,DATA,RODATA+relをDMA転送します(%08x-%08x)\n", allocatedVRamAddr, (u32)allocatedVRamAddr + size);
}
size = vRomEnd - vRomStart;
end = (u32)allocatedVRamAddr + size;
DmaMgr_SendRequest0((u32)allocatedVRamAddr, vRomStart, size);
ovlOffset = ((s32*)end)[-1];
ovl = (OverlayRelocationSection*)((u32)end - ovlOffset);
if(gOverlayLogSeverity >= 3)
{
osSyncPrintf("TEXT(%08x), DATA(%08x), RODATA(%08x), BSS(%08x)\n", ovl->textSize, ovl->dataSize, ovl->rodataSize, ovl->bssSize);
}
if(gOverlayLogSeverity >= 3)
{
// Relocate
osSyncPrintf("リロケーションします\n");
}
Overlay_DoRelocation(allocatedVRamAddr, ovl, vRamStart);
bssSize = ovl->bssSize;
if(bssSize != 0)
{
if(gOverlayLogSeverity >= 3)
{
// Clear BSS area (% 08x-% 08x)
osSyncPrintf("BSS領域をクリアします(%08x-%08x)\n", end, end + ovl->bssSize);
}
size = ovl->bssSize;
bssSize = size;
bzero((void*)end, bssSize);
relocCnt = ovl->nRelocations;
}
size = (u32)&ovl->relocations[ovl->nRelocations] - (u32)ovl;
if(gOverlayLogSeverity >= 3)
{
// Clear REL area (%08x-%08x)
osSyncPrintf("REL領域をクリアします(%08x-%08x)\n", ovl, (u32)ovl + size);
}
bzero(ovl, size);
size = (u32)vRamEnd - (u32)vRamStart;
osWritebackDCache(allocatedVRamAddr, size);
osInvalICache(allocatedVRamAddr, size);
if(gOverlayLogSeverity >= 3)
{
// Finish loading dynamic link function
osSyncPrintf("ダイナミックリンクファンクションのロードを終了します\n\n");
}
return size;
}
// possibly some kind of new() function
void *func_800FC800(u32 size)
{
if (size == 0)
{
size = 1;
}
return __osMallocDebug(&gSystemArena, size, sNew, 0);
}
// possible some kind of delete() function
void func_800FC83C(void *ptr)
{
if (ptr != NULL)
{
__osFree(&gSystemArena, ptr);
}
}
void func_800FC868(void *blk, u32 nBlk, u32 blkSize, arg3_800FC868 arg3)
{
u32 pos;
for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0))
{
arg3((void*)pos);
}
}
void func_800FC8D8(void *blk, u32 nBlk, s32 blkSize, arg3_800FC8D8 arg3)
{
u32 pos;
for (pos = (u32)blk; pos < (u32)blk + (nBlk * blkSize); pos = (u32)pos + (blkSize & ~0))
{
arg3((void*)pos, 2);
}
}
void *func_800FC948(void *blk, u32 nBlk, u32 blkSize, arg3_800FC948 arg3)
{
u32 pos;
if (blk == NULL)
{
blk = func_800FC800(nBlk * blkSize);
}
if (blk != NULL && arg3 != NULL)
{
pos = (u32)blk;
while(pos < (u32)blk + (nBlk * blkSize))
{
arg3((void*)pos, 0, 0, 0, 0, 0, 0, 0, 0);
pos = (u32)pos + (blkSize & ~0);
}
}
return blk;
}
void func_800FCA18(void *blk, u32 nBlk, u32 blkSize, arg3_800FCA18 arg3, s32 arg4)
{
u32 pos;
u32 end ;
s32 masked_arg2;
if (blk == 0)
{
return;
}
if (arg3 != 0)
{
end = (u32)blk;
masked_arg2 = (s32)(blkSize & ~0);
pos = (u32)end + (nBlk * blkSize);
if (masked_arg2) { }
while (pos > end)
{
do {
pos -= masked_arg2;
arg3((void*)pos, 2);
} while (0);
}
if (!masked_arg2){ }
}
if (arg4 != 0)
{
func_800FC83C(blk);
}
}
void func_800FCB34(void)
{
InitFunc *initFunc;
u32 nextOffset;
InitFunc *prev;
initFunc = (InitFunc*)&sInitFuncs;
nextOffset = initFunc->nextOffset;
prev = NULL;
while(nextOffset != 0)
{
initFunc = (InitFunc*)((s32)initFunc + nextOffset);
if(initFunc->func != NULL)
{
(*initFunc->func)();
}
nextOffset = initFunc->nextOffset;
initFunc->nextOffset = (s32)prev;
prev = initFunc;
}
sInitFuncs = prev;
}
void SystemHeap_Init(void *start, u32 size)
{
SystemArena_Init(start, size);
func_800FCB34();
}
+83
View File
@@ -0,0 +1,83 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3840.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3898.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B38A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B38FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3908.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3968.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B39B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3B50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3BD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3DF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3EBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3EFC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F38.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F54.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3F94.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B3FF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B404C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4088.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B41DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B42C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4370.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B44E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4920.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4A68.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4AA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4AE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4B20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4D58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4DE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B4E7C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8730.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B87D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8978.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8A0C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8BA4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B8F58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B9060.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B91B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B958C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/db_camera/func_800B9638.s")
+131
View File
@@ -0,0 +1,131 @@
#include <global.h>
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
#define LOG_SEVERITY_VERBOSE 3
s32 gDebugArenaLogSeverity = LOG_SEVERITY_ERROR;
Arena sDebugArena;
void DebugArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action)
{
if (!ptr)
{
if (gDebugArenaLogSeverity >= LOG_SEVERITY_ERROR)
{
//"%s: %u bytes %s failed\n"
osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action);
__osDisplayArena(&sDebugArena);
return;
}
}
else if (gDebugArenaLogSeverity >= LOG_SEVERITY_VERBOSE)
{
//"%s: %u bytes %s succeeded\n"
osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action);
}
}
void* DebugArena_Malloc(u32 size)
{
void* ptr;
ptr = __osMalloc(&sDebugArena, size);
DebugArena_CheckPointer(ptr, size, "debug_malloc", "確保"); //Secure
return ptr;
}
void* DebugArena_MallocDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocDebug(&sDebugArena, size, file, line);
DebugArena_CheckPointer(ptr, size, "debug_malloc_DEBUG", "確保"); //Secure
return ptr;
}
void* DebugArena_MallocR(u32 size)
{
void* ptr;
ptr = __osMallocR(&sDebugArena, size);
DebugArena_CheckPointer(ptr, size, "debug_malloc_r", "確保"); //Secure
return ptr;
}
void* DebugArena_MallocRDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocRDebug(&sDebugArena, size, file, line);
DebugArena_CheckPointer(ptr, size, "debug_malloc_r_DEBUG", "確保"); //Secure
return ptr;
}
void* DebugArena_Realloc(void* ptr, u32 newSize)
{
ptr = __osRealloc(&sDebugArena, ptr, newSize);
DebugArena_CheckPointer(ptr, newSize, "debug_realloc", "再確保"); // Re-securing
return ptr;
}
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
return ptr;
}
void DebugArena_Free(void* ptr)
{
__osFree(&sDebugArena, ptr);
}
void DebugArena_FreeDebug(void* ptr, const char* file, s32 line)
{
__osFreeDebug(&sDebugArena, ptr, file, line);
}
void* DebugArena_Calloc(u32 num, u32 size)
{
void* ret;
u32 n;
n = num*size;
ret = __osMalloc(&sDebugArena, n);
if (ret)
bzero(ret, n);
DebugArena_CheckPointer(ret, n, "debug_calloc", "確保");
return ret;
}
void DebugArena_Display()
{
//Zelda heap display (devs forgot to change "Zelda" to "Debug" apparently)
osSyncPrintf("ゼルダヒープ表示\n");
__osDisplayArena(&sDebugArena);
}
void DebugArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc)
{
ArenaImpl_GetSizes(&sDebugArena, outMaxFree, outFree, outAlloc);
}
void DebugArena_Check()
{
__osCheckArena(&sDebugArena);
}
void DebugArena_Init(void* start, u32 size)
{
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocInit(&sDebugArena, start, size);
}
void DebugArena_Cleanup()
{
gDebugArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocCleanup(&sDebugArena);
}
u8 DebugArena_IsInitalized()
{
return __osMallocIsInitalized(&sDebugArena);
}
+845
View File
@@ -0,0 +1,845 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
//data
const char* sExceptionNames[] =
{
"Interrupt",
"TLB modification",
"TLB exception on load",
"TLB exception on store",
"Address error on load",
"Address error on store",
"Bus error on inst.",
"Bus error on data",
"System call exception",
"Breakpoint exception",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap exception",
"Virtual coherency on inst.",
"Floating point exception",
"Watchpoint exception",
"Virtual coherency on data",
"Unimplemented operation",
"Invalid operation",
"Division by zero",
"Overflow",
"Underflow",
"Inexact operation",
};
//bss
FaultThreadStruct* sFaultStructPtr;
u8 sFaultIsWaitingForInput;
char sFaultStack[0x600];
char sFaultThreadInfo[0x20];
FaultThreadStruct gFaultStruct;
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/pad_800D3F10.s")
void Fault_SleepImpl(u32 duration)
{
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
func_800FF3A0(value);
}
void Fault_ClientProcessThread(FaultClientContext* ctx)
{
if (ctx->callback)
ctx->ret = ctx->callback(ctx->param0, ctx->param1);
if (ctx->queue)
osSendMesg(ctx->queue, ctx->msg, 1);
}
#ifdef NON_MATCHING
void Fault_ProcessClientContext(FaultClientContext* ctx)
{
OSMesgQueue queue;
OSMesg msg;
OSThread* t;
OSTimer timer;
OSMesg recMsg;
osCreateMesgQueue(&queue, &msg, 1);
ctx->queue = &queue;
ctx->msg = NULL;
if (sFaultStructPtr->currClientThreadSp)
{
Fault_ClientProcessThread(ctx);
t = NULL;
}
else
{
OSThread thread;
osCreateThread(&thread, 2, &Fault_ClientProcessThread, ctx, sFaultStructPtr->currClientThreadSp, 0x7E);
osStartThread(&thread);
t = &thread;
}
while(true)
{
osSetTimer(&timer, OS_USEC_TO_CYCLES(1000000), 0, &queue, (OSMesg)0x29A);
osRecvMesg(&queue, &recMsg, 1);
if (recMsg == (OSMesg)0x29A)
break;
if (sFaultIsWaitingForInput)
{
ctx->ret = -1;
break;
}
}
osStopTimer(&timer);
if (t)
{
osStopThread(t);
//osDestroyThread(t);
osDestroyThread(t);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_ProcessClientContext.s")
#endif
u32 Fault_ProcessClient(u32 callback, u32 param0, u32 param1)
{
FaultClientContext a;
a.callback = callback;
a.param0 = param0;
a.param1 = param1;
a.ret = 0;
Fault_ProcessClientContext(&a);
return a.ret;
}
#ifdef NON_MATCHING
void Fault_AddClient(FaultClient *client, void* callback, void* param0, void* param1)
{
bool alreadyExist = false;
OSIntMask mask = osSetIntMask(1);
FaultClient* iter = sFaultStructPtr->clients;
while (iter)
{
if (iter == client)
{
alreadyExist = true;
goto end;
}
iter = iter->next;
}
client->callback = callback;
client->param1 = param0;
client->param2 = param1;
client->next = sFaultStructPtr->clients;
sFaultStructPtr->clients = client;
end:
osSetIntMask(mask);
if (alreadyExist)
osSyncPrintf(VT_COL(RED, WHITE) "fault_AddClient: %08x は既にリスト中にある\n" VT_RST, client);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_AddClient.s")
#endif
void Fault_RemoveClient(FaultClient* client) {
FaultClient* iter;
FaultClient* lastIter;
OSIntMask mask;
u32 listIsEmpty;
iter = sFaultStructPtr->clients;
listIsEmpty = 0;
lastIter = NULL;
mask = osSetIntMask(1);
while (iter) {
if (iter == client) {
if (lastIter) {
lastIter->next = client->next;
} else {
sFaultStructPtr->clients = client;
if (sFaultStructPtr->clients) {
sFaultStructPtr->clients = client->next;
} else {
listIsEmpty = 1;
}
}
break;
}
lastIter = iter;
iter = iter->next;
}
osSetIntMask(mask);
if (listIsEmpty)
osSyncPrintf(VT_COL(RED, WHITE) "fault_RemoveClient: %08x リスト不整合です\n" VT_RST, client);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_AddAddrConvClient.s")
void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
FaultAddrConvClient* iter;
FaultAddrConvClient* lastIter;
OSIntMask mask;
u32 listIsEmpty;
iter = sFaultStructPtr->addrConvClients;
listIsEmpty = 0;
lastIter = NULL;
mask = osSetIntMask(1);
while (iter) {
if (iter == client) {
if (lastIter) {
lastIter->next = client->next;
} else {
sFaultStructPtr->addrConvClients = client;
if (sFaultStructPtr->addrConvClients) {
sFaultStructPtr->addrConvClients = client->next;
} else {
listIsEmpty = 1;
}
}
break;
}
lastIter = iter;
iter = iter->next;
}
osSetIntMask(mask);
if (listIsEmpty) {
osSyncPrintf(VT_COL(RED, WHITE) "fault_AddressConverterRemoveClient: %08x は既にリスト中にある\n" VT_RST, client);
}
}
u32 Fault_ConvertAddress(FaultAddrConvClient* client)
{
u32 ret;
FaultAddrConvClient* iter = sFaultStructPtr->addrConvClients;
while(iter)
{
if (iter->callback)
{
ret = Fault_ProcessClient(iter->callback, client, iter->param);
if (ret == -1)
Fault_RemoveAddrConvClient(iter);
else if (ret)
return ret;
}
iter = iter->next;
}
return 0;
}
void Fault_Sleep(u32 duration)
{
Fault_SleepImpl(duration);
}
void Fault_PadCallback(Input* input)
{
//BUG: this function is not called correctly and thus will crash from reading a bad pointer at 0x800C7E4C
func_800C7E08(input, 0);
}
void Fault_UpdatePadImpl()
{
sFaultStructPtr->padCallback(&sFaultStructPtr->padInput);
}
#ifdef NON_MATCHING
bool Fault_WaitForInputImpl()
{
u16 kDown;
bool exitDebugger;
s32 count = 600;
Input* curInput = &sFaultStructPtr->padInput;
while (true)
{
while (true)
{
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
kDown = curInput->padPressed;
if (kDown == 0x20)
sFaultStructPtr->faultActive = !sFaultStructPtr->faultActive;
if (!sFaultStructPtr->faultActive)
break;
if (count-- < 1)
return false;
}
if (kDown == 0x8000 || kDown == 0x100)
break;
if (kDown == 0x200)
return true;
if (kDown == 0x800)
FaultDrawer_SetOsSyncPrintfEnabled(true);
if (kDown == 0x400)
FaultDrawer_SetOsSyncPrintfEnabled(false);
}
return false;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_WaitForInputImpl.s")
#endif
void Fault_WaitForInput()
{
sFaultIsWaitingForInput = 1;
Fault_WaitForInputImpl();
sFaultIsWaitingForInput = 0;
}
void Fault_DrawRec(s32 x, s32 y, s32 w, s32 h, u16 color)
{
FaultDrawer_DrawRecImpl(x, y, x + w - 1, y + h - 1, color);
}
void Fault_FillScreenBlack()
{
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(1);
FaultDrawer_FillScreen();
FaultDrawer_SetBackColor(0);
}
void Fault_FillScreenRed()
{
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(0xF001);
FaultDrawer_FillScreen();
FaultDrawer_SetBackColor(0);
}
void Fault_DrawCornerRec(u16 color)
{
Fault_DrawRec(0x16, 0x10, 8, 1, color);
}
void Fault_PrintFReg(s32 idx, f32 *value)
{
u32 raw = *(u32*)value;
int v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0)
FaultDrawer_Printf("F%02d:%14.7e ", idx, *value);
else
FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw);
}
#ifdef NON_MATCHING
void Fault_LogFReg(s32 idx, f32 *value)
{
u32 raw = *(u32*)value;
s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
if ((v0 >= -0x7e && v0 < 0x80) || raw == 0)
osSyncPrintf("F%02d:%14.7e ", idx, *value);
else
osSyncPrintf("F%02d: %08x(16) ", idx, raw);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_LogFReg.s")
#endif
void Fault_PrintFPCR(u32 value)
{
s32 i;
u32 flag = 0x20000;
FaultDrawer_Printf("FPCSR:%08xH ", value);
for (i = 0; i < 6; i++)
{
if (value & flag)
{
FaultDrawer_Printf("(%s)", sExceptionNames[i+18]);
break;
}
flag >>= 1;
}
FaultDrawer_Printf("\n");
}
void Fault_LogFPCR(u32 value)
{
s32 i;
u32 flag = 0x20000;
osSyncPrintf("FPCSR:%08xH ", value);
for (i = 0; i < 6; i++)
{
if (value & flag)
{
osSyncPrintf("(%s)\n", sExceptionNames[i+18]);
break;
}
flag >>= 1;
}
}
void Fault_PrintThreadContext(OSThread* t)
{
__OSThreadContext *ctx;
s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
if (causeStrIdx == 0x17)
causeStrIdx = 0x10;
if (causeStrIdx == 0x1f)
causeStrIdx = 0x11;
FaultDrawer_FillScreen();
FaultDrawer_SetCharPad(-2, 4);
FaultDrawer_SetCursor(0x16, 0x14);
ctx = &t->context;
FaultDrawer_Printf("THREAD:%d (%d:%s)\n", t->id, causeStrIdx, sExceptionNames[causeStrIdx]);
FaultDrawer_SetCharPad(-1, 0);
FaultDrawer_Printf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
FaultDrawer_Printf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
FaultDrawer_Printf("A0:%08xH A1:%08xH A2:%08xH\n", (u32)ctx->a0, (u32)ctx->a1, (u32)ctx->a2);
FaultDrawer_Printf("A3:%08xH T0:%08xH T1:%08xH\n", (u32)ctx->a3, (u32)ctx->t0, (u32)ctx->t1);
FaultDrawer_Printf("T2:%08xH T3:%08xH T4:%08xH\n", (u32)ctx->t2, (u32)ctx->t3, (u32)ctx->t4);
FaultDrawer_Printf("T5:%08xH T6:%08xH T7:%08xH\n", (u32)ctx->t5, (u32)ctx->t6, (u32)ctx->t7);
FaultDrawer_Printf("S0:%08xH S1:%08xH S2:%08xH\n", (u32)ctx->s0, (u32)ctx->s1, (u32)ctx->s2);
FaultDrawer_Printf("S3:%08xH S4:%08xH S5:%08xH\n", (u32)ctx->s3, (u32)ctx->s4, (u32)ctx->s5);
FaultDrawer_Printf("S6:%08xH S7:%08xH T8:%08xH\n", (u32)ctx->s6, (u32)ctx->s7, (u32)ctx->t8);
FaultDrawer_Printf("T9:%08xH GP:%08xH SP:%08xH\n", (u32)ctx->t9, (u32)ctx->gp, (u32)ctx->sp);
FaultDrawer_Printf("S8:%08xH RA:%08xH LO:%08xH\n\n", (u32)ctx->s8, (u32)ctx->ra, (u32)ctx->lo);
Fault_PrintFPCR(ctx->fpcsr);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0, &ctx->fp0.f.f_even);
Fault_PrintFReg(2, &ctx->fp2.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(4, &ctx->fp4.f.f_even);
Fault_PrintFReg(6, &ctx->fp6.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(8, &ctx->fp8.f.f_even);
Fault_PrintFReg(0xa, &ctx->fp10.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0xc, &ctx->fp12.f.f_even);
Fault_PrintFReg(0xe, &ctx->fp14.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x10, &ctx->fp16.f.f_even);
Fault_PrintFReg(0x12, &ctx->fp18.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x14, &ctx->fp20.f.f_even);
Fault_PrintFReg(0x16, &ctx->fp22.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x18, &ctx->fp24.f.f_even);
Fault_PrintFReg(0x1a, &ctx->fp26.f.f_even);
FaultDrawer_Printf("\n");
Fault_PrintFReg(0x1c, &ctx->fp28.f.f_even);
Fault_PrintFReg(0x1e, &ctx->fp30.f.f_even);
FaultDrawer_Printf("\n");
FaultDrawer_SetCharPad(0, 0);
}
void Fault_LogThreadContext(OSThread* t)
{
__OSThreadContext *ctx;
s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
if (causeStrIdx == 0x17)
causeStrIdx = 0x10;
if (causeStrIdx == 0x1f)
causeStrIdx = 0x11;
ctx = &t->context;
osSyncPrintf("\n");
osSyncPrintf("THREAD ID:%d (%d:%s)\n", t->id, causeStrIdx, sExceptionNames[causeStrIdx]);
osSyncPrintf("PC:%08xH SR:%08xH VA:%08xH\n", (u32)ctx->pc, (u32)ctx->sr, (u32)ctx->badvaddr);
osSyncPrintf("AT:%08xH V0:%08xH V1:%08xH\n", (u32)ctx->at, (u32)ctx->v0, (u32)ctx->v1);
osSyncPrintf("A0:%08xH A1:%08xH A2:%08xH\n", (u32)ctx->a0, (u32)ctx->a1, (u32)ctx->a2);
osSyncPrintf("A3:%08xH T0:%08xH T1:%08xH\n", (u32)ctx->a3, (u32)ctx->t0, (u32)ctx->t1);
osSyncPrintf("T2:%08xH T3:%08xH T4:%08xH\n", (u32)ctx->t2, (u32)ctx->t3, (u32)ctx->t4);
osSyncPrintf("T5:%08xH T6:%08xH T7:%08xH\n", (u32)ctx->t5, (u32)ctx->t6, (u32)ctx->t7);
osSyncPrintf("S0:%08xH S1:%08xH S2:%08xH\n", (u32)ctx->s0, (u32)ctx->s1, (u32)ctx->s2);
osSyncPrintf("S3:%08xH S4:%08xH S5:%08xH\n", (u32)ctx->s3, (u32)ctx->s4, (u32)ctx->s5);
osSyncPrintf("S6:%08xH S7:%08xH T8:%08xH\n", (u32)ctx->s6, (u32)ctx->s7, (u32)ctx->t8);
osSyncPrintf("T9:%08xH GP:%08xH SP:%08xH\n", (u32)ctx->t9, (u32)ctx->gp, (u32)ctx->sp);
osSyncPrintf("S8:%08xH RA:%08xH LO:%08xH\n", (u32)ctx->s8, (u32)ctx->ra, (u32)ctx->lo);
osSyncPrintf("\n");
Fault_LogFPCR(ctx->fpcsr);
osSyncPrintf("\n");
Fault_LogFReg(0, &ctx->fp0.f.f_even);
Fault_LogFReg(2, &ctx->fp2.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(4, &ctx->fp4.f.f_even);
Fault_LogFReg(6, &ctx->fp6.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(8, &ctx->fp8.f.f_even);
Fault_LogFReg(0xa, &ctx->fp10.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0xc, &ctx->fp12.f.f_even);
Fault_LogFReg(0xe, &ctx->fp14.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x10, &ctx->fp16.f.f_even);
Fault_LogFReg(0x12, &ctx->fp18.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x14, &ctx->fp20.f.f_even);
Fault_LogFReg(0x16, &ctx->fp22.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x18, &ctx->fp24.f.f_even);
Fault_LogFReg(0x1a, &ctx->fp26.f.f_even);
osSyncPrintf("\n");
Fault_LogFReg(0x1c, &ctx->fp28.f.f_even);
Fault_LogFReg(0x1e, &ctx->fp30.f.f_even);
osSyncPrintf("\n");
}
OSThread* Fault_FindFaultedThread()
{
OSThread* iter = func_80104140();
while (iter->priority != -1)
{
if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3))
return iter;
iter = iter->tlnext;
}
return NULL;
}
void Fault_Wait5Seconds(void)
{
OSTime start[2]; //to make the function allocate 0x28 bytes of stack instead of 0x20
start[0] = osGetTime();
do
{
Fault_Sleep(0x10);
} while ((osGetTime() - start[0]) < OS_USEC_TO_CYCLES(5000000)+1); //0xdf84759
sFaultStructPtr->faultActive = true;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_WaitForButtonCombo.s")
void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
u32* alignedAddr;
u32* writeAddr;
s32 y;
s32 x;
alignedAddr = addr;
if (alignedAddr < (u32*)0x80000000) {
alignedAddr = (u32*)0x80000000;
}
if (alignedAddr > (u32*)0x807fff00) {
alignedAddr = (u32*)0x807fff00;
}
alignedAddr = (u32*)((u32)alignedAddr & ~3);
writeAddr = alignedAddr;
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_DrawText(0x24, 0x12, "%s %08x", title? title : "PrintDump", alignedAddr);
if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) {
for (y = 0x1C; y != 0xE2; y += 9) {
FaultDrawer_DrawText(0x18, y, "%06x", writeAddr);
for (x = 0x52; x != 0x122; x += 0x34) {
FaultDrawer_DrawText(x, y, "%08x", *writeAddr++);
}
}
}
FaultDrawer_SetCharPad(0, 0);
}
#ifdef NON_MATCHING
void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1)
{
s32 count;
u16 held;
s32 off;
u32 addr = pc;
while (true)
{
if (addr < 0x80000000)
addr = 0x80000000;
if (addr > 0x807fff00)
addr = 0x807fff00;
addr &= ~0xF;
Fault_DrawMemDumpPage("Dump", (u32*)addr);
count = 600;
while (sFaultStructPtr->faultActive)
{
if (count-- == 0)
return;
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
if ((sFaultStructPtr->padInput.padPressed | ~0x20) == ~0x20)
sFaultStructPtr->faultActive = false;
}
do
{
Fault_Sleep(0x10);
Fault_UpdatePadImpl();
} while (sFaultStructPtr->padInput.padPressed == 0);
if ((sFaultStructPtr->padInput.padPressed | ~0x1000) == ~0)
return;
held = sFaultStructPtr->padInput.status;
if ((held | ~0x8000) == ~0)
return;
off = 0x10;
if ((held | ~0x2000) == ~0)
off = 0x100;
if ((held | ~0x4000) == ~0)
off <<= 8;
if ((held | ~0x800) == ~0)
addr -= off;
if ((held | ~0x400) == ~0)
addr -= off;
if ((held | ~0x8) == ~0)
addr = pc;
if ((held | ~0x4) == ~0)
addr = sp;
if ((held | ~0x2) == ~0)
addr = unk0;
if ((held | ~0x1) == ~0)
addr = unk1;
if ((held | ~0x20) == ~0)
break;
}
sFaultStructPtr->faultActive = true;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_DrawMemDump.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/func_800D59F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_DrawStackTrace.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_LogStackTrace.s")
void Fault_ResumeThread(OSThread* t)
{
t->context.cause = 0;
t->context.fpcsr = 0;
t->context.pc += 4;
*(u32*)t->context.pc = 0xd;
osWritebackDCache(t->context.pc, 4);
osInvalICache(t->context.pc, 4);
osStartThread(t);
}
void Fault_CommitFB()
{
u16* fb;
osViSetYScale(1.0f);
osViSetMode(&osViModeNtscLan1);
osViSetSpecialFeatures(0x42); //gama_disable|dither_fliter_enable_aa_mode3_disable
osViBlack(false);
if (sFaultStructPtr->fb)
fb = sFaultStructPtr->fb;
else
{
fb = (u16*)osViGetNextFramebuffer();
if ((u32)fb == 0x80000000)
fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
}
osViSwapBuffer(fb);
FaultDrawer_SetDrawerFB(fb, 0x140, 0xf0);
}
void Fault_ProcessClients(void)
{
FaultClient* iter = sFaultStructPtr->clients;
s32 idx = 0;
while(iter)
{
if (iter->callback)
{
Fault_FillScreenBlack();
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf("\x1a""8CallBack (%d) %08x %08x %08x\n""\x1a""7", idx++, iter, iter->param1, iter->param2);
FaultDrawer_SetCharPad(0, 0);
Fault_ProcessClient(iter->callback, iter->param1, iter->param2);
Fault_WaitForInput();
Fault_CommitFB();
}
iter = iter->next;
}
}
void Fault_UpdatePad()
{
Fault_UpdatePadImpl();
}
#ifdef NON_MATCHING
void Fault_ThreadEntry(u32 unused)
{
OSThread *faultedThread;
OSMesg msg;
//osSetEventMesg
osSetEventMesg(OS_EVENT_CPU_BREAK, &sFaultStructPtr->queue, 1);
osSetEventMesg(OS_EVENT_FAULT, &sFaultStructPtr->queue, 2);
while (true)
{
osRecvMesg(&sFaultStructPtr->queue, &msg, 1);
if (msg == (OSMesg)1)
{
sFaultStructPtr->msgId = 1;
osSyncPrintf("フォルトマネージャ:OS_EVENT_CPU_BREAKを受信しました\n");
}
else if (msg == (OSMesg)2)
{
sFaultStructPtr->msgId = 2;
osSyncPrintf("フォルトマネージャ:OS_EVENT_FAULTを受信しました\n");
}
else if (msg != (OSMesg)3)
{
sFaultStructPtr->msgId = (u8)3;
osSyncPrintf("フォルトマネージャ:不明なメッセージを受信しました\n");
}
if (msg == (OSMesg)3)
{
Fault_UpdatePad();
faultedThread = NULL;
}
else
{
faultedThread = __osGetCurrFaultedThread();
osSyncPrintf("__osGetCurrFaultedThread()=%08x\n", faultedThread);
if (!faultedThread)
{
faultedThread = Fault_FindFaultedThread();
osSyncPrintf("FindFaultedThread()=%08x\n", faultedThread);
}
}
if (!faultedThread)
continue;
__osSetFpcCsr(__osGetFpcCsr() & -0xf81);
sFaultStructPtr->faultedThread = faultedThread;
while (!sFaultStructPtr->faultHandlerEnabled)
Fault_Sleep(1000);
Fault_Sleep(500);
Fault_CommitFB();
if (sFaultStructPtr->faultActive)
Fault_Wait5Seconds();
else
{
Fault_DrawCornerRec(0xF801);
Fault_WaitForButtonCombo();
}
sFaultStructPtr->faultActive = true;
FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(0);
do
{
Fault_PrintThreadContext(faultedThread);
Fault_LogThreadContext(faultedThread);
Fault_WaitForInput();
Fault_FillScreenBlack();
FaultDrawer_DrawText(0x78, 0x10, "STACK TRACE");
Fault_DrawStackTrace(faultedThread, 0x24, 0x18, 0x16);
Fault_LogStackTrace(faultedThread, 0x32);
Fault_WaitForInput();
Fault_ProcessClients();
Fault_DrawMemDump(faultedThread->context.pc - 0x100, (u32*)faultedThread->context.sp, 0, 0);
Fault_FillScreenRed();
FaultDrawer_DrawText(0x40, 0x50, " CONGRATURATIONS! ");
FaultDrawer_DrawText(0x40, 0x5A, "All Pages are displayed.");
FaultDrawer_DrawText(0x40, 0x64, " THANK YOU! ");
FaultDrawer_DrawText(0x40, 0x6E, " You are great debugger!");
Fault_WaitForInput();
} while (!sFaultStructPtr->exitDebugger);
while(!sFaultStructPtr->exitDebugger){}
Fault_ResumeThread(faultedThread);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault/Fault_ThreadEntry.s")
#endif
void Fault_SetFB(void* fb, u16 w, u16 h)
{
sFaultStructPtr->fb = fb;
FaultDrawer_SetDrawerFB(fb, w, h);
}
void Fault_Start(void)
{
sFaultStructPtr = &gFaultStruct;
bzero(sFaultStructPtr, sizeof(FaultThreadStruct));
FaultDrawer_SetDefault();
FaultDrawer_SetInputCallback(&Fault_WaitForInput);
sFaultStructPtr->exitDebugger = false;
sFaultStructPtr->msgId = 0;
sFaultStructPtr->faultHandlerEnabled = false;
sFaultStructPtr->faultedThread = NULL;
sFaultStructPtr->padCallback = &Fault_PadCallback;
sFaultStructPtr->clients = NULL;
sFaultStructPtr->faultActive = false;
gFaultStruct.faultHandlerEnabled = true;
osCreateMesgQueue(&sFaultStructPtr->queue, &sFaultStructPtr->msg, 1);
StackCheck_Init(sFaultThreadInfo, &sFaultStack, sFaultStack+sizeof(sFaultStack), 0, 0x100, "fault");
osCreateThread(&sFaultStructPtr->thread, 2, &Fault_ThreadEntry, 0, sFaultThreadInfo, 0x7f);
osStartThread(&sFaultStructPtr->thread);
}
void Fault_HangupFaultClient(const char* arg0, const char* arg1)
{
osSyncPrintf("HungUp on Thread %d\n", osGetThreadId(0));
osSyncPrintf("%s\n", arg0 ? arg0 : "(NULL)");
osSyncPrintf("%s\n", arg1 ? arg1 : "(NULL)");
FaultDrawer_Printf("HungUp on Thread %d\n", osGetThreadId(0));
FaultDrawer_Printf("%s\n", arg0 ? arg0 : "(NULL)");
FaultDrawer_Printf("%s\n", arg1 ? arg1 : "(NULL)");
}
void Fault_AddHungupAndCrashImpl(const char* arg0, const char* arg1)
{
FaultClient client;
char padd[4];
Fault_AddClient(&client, &Fault_HangupFaultClient, arg0, arg1);
*(u32*)0x11111111 = 0; //trigger an exception
}
void Fault_AddHungupAndCrash(const char* filename, u32 line)
{
char msg[256];
sprintf(msg, "HungUp %s:%d", filename, line);
Fault_AddHungupAndCrashImpl(msg, NULL);
}
+304
View File
@@ -0,0 +1,304 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
//rodata
const u32 sFaultDrawerFont[] = {
0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700,
0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000,
0x08BFFB00, 0x0EFFFFC0, 0x0BF00FB0, 0x0FF00330, 0x0FF00FF0, 0x0FF00220, 0x0CFBBF60, 0x0FFCCE20,
0x0DD44FF0, 0x0FF00220, 0x0FF00FF0, 0x0FF00330, 0x0CFBBF40, 0x0EF77740, 0x00000000, 0x00000000,
0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700,
0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000,
0x08BFFB00, 0x000DE000, 0x0BF00FB0, 0x005DE600, 0x0FF00FF0, 0x055CC660, 0x0CFBBF60, 0x773FF377,
0x0DD44FF0, 0xBB3FF3BB, 0x0FF00FF0, 0x099CCAA0, 0x0CFBBF40, 0x009DEA00, 0x00000000, 0x000DE000,
0x04C22C40, 0x028D5020, 0x0CCAACC0, 0x21F91710, 0x04C22C40, 0x12493400, 0x00820800, 0x01975110,
0x088A8880, 0x04615241, 0x00800800, 0x43117530, 0x00A20800, 0x60055600, 0x00000000, 0x04400040,
0x00221100, 0x00000080, 0x000FB000, 0x00000880, 0x040DA400, 0x00008800, 0x08CDE880, 0x022AA220,
0x08CDE880, 0x02AA2220, 0x040DA400, 0x0CD10000, 0x000FB000, 0x8C510000, 0x00221100, 0x81100000,
0x00DFFD00, 0x0AEEFFA0, 0x0DF22DD0, 0x06611DC0, 0x01122DD0, 0x06719900, 0x011EED10, 0x077EF700,
0x01562990, 0x05589760, 0x0DD22990, 0x05599770, 0x04DFFD40, 0x026EF700, 0x00000000, 0x00000000,
0x00333300, 0x04489980, 0x033CC330, 0x00CD1088, 0x033CC330, 0x02BF62A8, 0x00333320, 0x01104C80,
0x01100330, 0x0015C800, 0x033CC330, 0x02673220, 0x003FF300, 0x04409900, 0x00880000, 0x00000000,
0x05DFFD10, 0x07FFFF60, 0x1CE00EC1, 0x0FF00990, 0x1EE11661, 0x0FF00110, 0x1EF45621, 0x0FF66710,
0x1EF23661, 0x0FF08990, 0x1EF10FE1, 0x0FF00990, 0x16ECCE21, 0x07FBBB20, 0x01111110, 0x00000000,
0x09B66FD0, 0x27D88E60, 0x0992ED10, 0x2FF02EE0, 0x099AE510, 0x2FF62EE0, 0x099B7510, 0x2FD64EE0,
0x0DDAE510, 0x2FD04EE0, 0x0DD2ED10, 0x2FD00EE0, 0x09F66F90, 0x27D99F70, 0x00000000, 0x00000000,
0x07FFFF00, 0x8F711FF0, 0x2FD00FF0, 0x8F711FF0, 0x2FD00770, 0x8E611EE0, 0x27DDDF60, 0x8E691EE0,
0x27764AA0, 0x8EE99EE0, 0x2FD06E80, 0x8AE7FEA0, 0x07FA8E60, 0x88277A80, 0x00000000, 0x00000000,
0x077CCFF0, 0x13266011, 0x077CCFF0, 0x03766510, 0x0239D720, 0x04533540, 0x002FF200, 0x01133110,
0x005FB100, 0x00033000, 0x055EE550, 0x01133110, 0x055EEDD0, 0x02233000, 0x00088880, 0x8AABB888,
0x00001100, 0x00044510, 0x04623320, 0x00440110, 0x04C89AA0, 0x00EEAB10, 0x0CE66720, 0x0EF55FB0,
0x0EE00660, 0x0BF62B90, 0x0EE00660, 0x03FC8990, 0x04EEEEA0, 0x00773BB0, 0x00000000, 0x08888800,
0x09900000, 0x00111000, 0x09922440, 0x00011000, 0x09908800, 0x26EFDE20, 0x099BB540, 0x2EC33CE2,
0x0D9A2550, 0x2EC33CE2, 0x0DDAA550, 0x2EC33CE2, 0x09D6ED10, 0x26CBBC62, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00011000, 0x05FBFFE0, 0x8E6116E8, 0x0FF40330, 0x8F7117F8,
0x07FC8B30, 0x8E6996E8, 0x05733BA0, 0x8A6DD6A8, 0x0DD88A20, 0x08A779B2, 0x01100220, 0x00000000,
0x00000080, 0x8A011000, 0x00000800, 0x80A11000, 0x07744F70, 0x80A99000, 0x0231DF20, 0x84E60004,
0x0027DA20, 0xC8AA4C40, 0x00573B20, 0x00A11800, 0x05546F50, 0x00A99800, 0x02222080, 0x02001888,
};
//data
FaultDrawer sFaultDrawerDefault =
{
(u16*)0x803DA800, //fb
320, 240, //w, h
16, 223, //yStart, yEnd
22, 297,//xStart, xEnd
0xFFFF, 0x0000, //foreColor, backColor
22, 16, //cursorX, cursorY
&sFaultDrawerFont, //font
8, 8, 0, 0,
{ //printColors
0x0001, 0xF801, 0x07C1, 0xFFC1,
0x003F, 0xF83F, 0x07FF, 0xFFFF,
0x7BDF, 0xB5AD
},
0, //escCode
0, //osSyncPrintfEnabled
NULL, //inputCallback
};
//bss
FaultDrawer sFaultDrawerStruct;
char D_8016B6C0[0x20]; //? unused
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled)
{
sFaultDrawerStruct.osSyncPrintfEnabled = enabled;
}
#ifdef NON_MATCHING
void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color)
{
if (sFaultDrawerStruct.w - xstart > 0 && sFaultDrawerStruct.h - ystart > 0)
{
s32 x, y;
for (y = 0; y < yend-ystart+1; y++)
for (x = 0; x < xend-xstart+1; x++)
sFaultDrawerStruct.fb[sFaultDrawerStruct.w*y+x] = color;
osWritebackDCacheAll();
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawRecImpl.s")
#endif
#ifdef NON_MATCHING
void FaultDrawer_DrawChar(char c)
{
s32 x, y;
u32* dataStart = &sFaultDrawerStruct.fontData[(c >> 3) * 0x10 + (c & 4) >> 2];
u16* fb = &sFaultDrawerStruct.fb[sFaultDrawerStruct.w * sFaultDrawerStruct.cursorY + sFaultDrawerStruct.cursorX];
if (sFaultDrawerStruct.xStart <= sFaultDrawerStruct.cursorX &&
sFaultDrawerStruct.charW + sFaultDrawerStruct.cursorX -1 <= sFaultDrawerStruct.xEnd &&
sFaultDrawerStruct.yStart <= sFaultDrawerStruct.cursorY &&
sFaultDrawerStruct.charH + sFaultDrawerStruct.cursorY -1 <= sFaultDrawerStruct.yEnd &&
sFaultDrawerStruct.charH != 0
)
{
for (y = 0; y < sFaultDrawerStruct.charH; y++)
{
u32 mask = 0x10000000 << (c & 3);
for (x = 0; x < sFaultDrawerStruct.charW; x++)
{
if ((mask & *dataStart))
fb[x] = sFaultDrawerStruct.foreColor;
else
if (sFaultDrawerStruct.backColor & 1)
fb[x] = sFaultDrawerStruct.backColor;
mask >>= 4;
}
fb += sFaultDrawerStruct.w;
dataStart += 2;
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_DrawChar.s")
#endif
s32 FaultDrawer_ColorToPrintColor(u16 color)
{
s32 i;
for (i = 0; i < 10; i++)
if (color == sFaultDrawerStruct.printColors[i])
return i;
return -1;
}
void FaultDrawer_UpdatePrintColor()
{
s32 idx;
if (sFaultDrawerStruct.osSyncPrintfEnabled)
{
osSyncPrintf(VT_RST);
idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.foreColor);
if (idx >= 0 && idx < 8)
osSyncPrintf(VT_SGR("3%d"), idx);
idx = FaultDrawer_ColorToPrintColor(sFaultDrawerStruct.backColor);
if (idx >= 0 && idx < 8)
osSyncPrintf(VT_SGR("4%d"), idx);
}
}
void FaultDrawer_SetForeColor(u16 color)
{
sFaultDrawerStruct.foreColor = color;
FaultDrawer_UpdatePrintColor();
}
void FaultDrawer_SetBackColor(u16 color)
{
sFaultDrawerStruct.backColor = color;
FaultDrawer_UpdatePrintColor();
}
void FaultDrawer_SetFontColor(u16 color)
{
FaultDrawer_SetForeColor((u16)(color | 1)); //force alpha to be set
}
void FaultDrawer_SetCharPad(s8 padW, s8 padH)
{
sFaultDrawerStruct.charWPad = padW;
sFaultDrawerStruct.charHPad = padH;
}
void FaultDrawer_SetCursor(s32 x, s32 y)
{
if (sFaultDrawerStruct.osSyncPrintfEnabled)
osSyncPrintf(VT_CUP(%d, %d), (y - sFaultDrawerStruct.yStart) / (sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad), (x - sFaultDrawerStruct.xStart) / (sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad));
sFaultDrawerStruct.cursorX = x;
sFaultDrawerStruct.cursorY = y;
}
void FaultDrawer_FillScreen()
{
if (sFaultDrawerStruct.osSyncPrintfEnabled)
osSyncPrintf(VT_CLS);
FaultDrawer_DrawRecImpl(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart, sFaultDrawerStruct.xEnd, sFaultDrawerStruct.yEnd, sFaultDrawerStruct.backColor | 1);
FaultDrawer_SetCursor(sFaultDrawerStruct.xStart, sFaultDrawerStruct.yStart);
}
#ifdef NON_MATCHING
u32 FaultDrawer_FormatStringFunc(u32 arg0, const char* str, s32 count)
{
while (count)
{
s32 curXStart; //s32?
s32 curXEnd;
if (sFaultDrawerStruct.escCode)
{
sFaultDrawerStruct.escCode = false;
if (*str > 0x30 && *str < 0x3A)
FaultDrawer_SetForeColor(gFaultStruct.colors[*str + 12]);
curXStart = sFaultDrawerStruct.cursorX;
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
}
else
{
if (*str == '\n')
{
if (sFaultDrawerStruct.osSyncPrintfEnabled)
osSyncPrintf("\n");
sFaultDrawerStruct.cursorX = sFaultDrawerStruct.w;
curXStart = sFaultDrawerStruct.w;
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
}
else if (*str == '\x1a')
{
sFaultDrawerStruct.escCode = true;
curXStart = sFaultDrawerStruct.cursorX;
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
}
else
{
if (sFaultDrawerStruct.osSyncPrintfEnabled)
osSyncPrintf("%c", *str);
FaultDrawer_DrawChar(*str);
sFaultDrawerStruct.cursorX += sFaultDrawerStruct.charW + sFaultDrawerStruct.charWPad;
curXStart = sFaultDrawerStruct.cursorX;
curXEnd = sFaultDrawerStruct.xEnd - sFaultDrawerStruct.charW;
}
}
if (curXEnd <= curXStart)
{
sFaultDrawerStruct.cursorY += sFaultDrawerStruct.charH + sFaultDrawerStruct.charHPad;
sFaultDrawerStruct.cursorX = sFaultDrawerStruct.xStart;
if (sFaultDrawerStruct.yEnd - sFaultDrawerStruct.charH <= (u16)sFaultDrawerStruct.cursorY) //cast?
{
if (sFaultDrawerStruct.inputCallback)
{
sFaultDrawerStruct.inputCallback();
FaultDrawer_FillScreen();
}
sFaultDrawerStruct.cursorY = sFaultDrawerStruct.yStart;
}
}
count--;
str++;
}
osWritebackDCacheAll();
return arg0;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/fault_drawer/FaultDrawer_FormatStringFunc.s")
#endif
void FaultDrawer_VPrintf(const char* str, char* args) //va_list
{
_Printf(&FaultDrawer_FormatStringFunc, &sFaultDrawerStruct, str, args);
}
void FaultDrawer_Printf(const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
FaultDrawer_VPrintf(fmt, args);
}
void FaultDrawer_DrawText(s32 x, s32 y, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
FaultDrawer_SetCursor(x, y);
FaultDrawer_VPrintf(fmt, args);
}
void FaultDrawer_SetDrawerFB(void* fb, u16 w, u16 h)
{
sFaultDrawerStruct.fb = (u16*)fb;
sFaultDrawerStruct.w = w;
sFaultDrawerStruct.h = h;
}
void FaultDrawer_SetInputCallback(void(*callback)())
{
sFaultDrawerStruct.inputCallback = callback;
}
void FaultDrawer_WritebackFBDCache()
{
osWritebackDCache(sFaultDrawerStruct.fb, sFaultDrawerStruct.w*sFaultDrawerStruct.h*2);
}
void FaultDrawer_SetDefault()
{
bcopy(&sFaultDrawerDefault, &sFaultDrawerStruct, sizeof(FaultDrawer));
sFaultDrawerStruct.fb = (u16*)((osMemSize | 0x80000000) - 0x25800);
}
+4
View File
@@ -0,0 +1,4 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/flg_set/func_8002AAB0.s")
+95
View File
@@ -0,0 +1,95 @@
#include <global.h>
void GameAlloc_Log(GameAlloc* this)
{
GameAllocEntry* iter;
osSyncPrintf("this = %08x\n", this);
iter = this->base.next;
while (iter != &this->base)
{
osSyncPrintf("ptr = %08x size = %d\n", iter, iter->size);
iter = iter->next;
}
}
void* GameAlloc_MallocDebug(GameAlloc* this, u32 size, const char* file, s32 line)
{
GameAllocEntry* ptr;
ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), file, line);
if (ptr)
{
ptr->size = size;
ptr->prev = this->head;
this->head->next = ptr;
this->head = ptr;
ptr->next = &this->base;
this->base.prev = this->head;
return ptr + 1;
}
else
return NULL;
}
void* GameAlloc_Malloc(GameAlloc* this, u32 size)
{
GameAllocEntry* ptr;
ptr = SystemArena_MallocDebug(size+sizeof(GameAllocEntry), "../gamealloc.c", 93);
if (ptr)
{
ptr->size = size;
ptr->prev = this->head;
this->head->next = ptr;
this->head = ptr;
ptr->next = &this->base;
this->base.prev = this->head;
return ptr + 1;
}
else
return NULL;
}
void GameAlloc_Free(GameAlloc* this, void* data)
{
GameAllocEntry* ptr;
if (data)
{
ptr = &((GameAllocEntry*)data)[-1];
LogUtils_CheckNullPointer("ptr->prev", ptr->prev, "../gamealloc.c", 120);
LogUtils_CheckNullPointer("ptr->next", ptr->next, "../gamealloc.c", 121);
ptr->prev->next = ptr->next;
ptr->next->prev = ptr->prev;
this->head = this->base.prev;
SystemArena_FreeDebug(ptr, "../gamealloc.c", 125);
}
}
void GameAlloc_Cleanup(GameAlloc* this)
{
GameAllocEntry* next;
GameAllocEntry* cur;
next = this->base.next;
while (&this->base != next)
{
cur = next;
next = next->next;
SystemArena_FreeDebug(cur, "../gamealloc.c", 145);
}
this->head = &this->base;
this->base.next = &this->base;
this->base.prev = &this->base;
}
void GameAlloc_Init(GameAlloc* this)
{
this->head = &this->base;
this->base.next = &this->base;
this->base.prev = &this->base;
}
+412
View File
@@ -0,0 +1,412 @@
#include <ultra64.h>
#include <global.h>
//.bss
u8 D_801755F0;
//.data
u16 sGfxPrintFontTLUT[64] =
{
0x0000, 0xFFFF, 0x0000, 0xFFFF,
0x0000, 0xFFFF, 0x0000, 0xFFFF,
0x0000, 0xFFFF, 0x0000, 0xFFFF,
0x0000, 0xFFFF, 0x0000, 0xFFFF,
0x0000, 0x0000, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0x0000, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0x0000, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF,
};
u16 sGfxPrintUnkTLUT[16] =
{
0xF801, 0xFBC1, 0xFFC1, 0x07C1,
0x0421, 0x003F, 0x803F, 0xF83F,
0xF801, 0xFBC1, 0xFFC1, 0x07C1,
0x0421, 0x003F, 0x803F, 0xF83F,
};
u8 sGfxPrintUnkData[8] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
u8 sGfxPrintFontData[(16*256)/2] =
{
0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00,
0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0xBF, 0xFB, 0x00, 0x0E, 0xFF, 0xFF, 0xC0, 0x0B, 0xF0, 0x0F, 0xB0, 0x0F, 0xF0, 0x03, 0x30, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0C, 0xFB, 0xBF, 0x60, 0x0F, 0xFC, 0xCE, 0x20,
0x0D, 0xD4, 0x4F, 0xF0, 0x0F, 0xF0, 0x02, 0x20, 0x0F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF0, 0x03, 0x30, 0x0C, 0xFB, 0xBF, 0x40, 0x0E, 0xF7, 0x77, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00,
0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0xBF, 0xFB, 0x00, 0x00, 0x0D, 0xE0, 0x00, 0x0B, 0xF0, 0x0F, 0xB0, 0x00, 0x5D, 0xE6, 0x00, 0x0F, 0xF0, 0x0F, 0xF0, 0x05, 0x5C, 0xC6, 0x60, 0x0C, 0xFB, 0xBF, 0x60, 0x77, 0x3F, 0xF3, 0x77,
0x0D, 0xD4, 0x4F, 0xF0, 0xBB, 0x3F, 0xF3, 0xBB, 0x0F, 0xF0, 0x0F, 0xF0, 0x09, 0x9C, 0xCA, 0xA0, 0x0C, 0xFB, 0xBF, 0x40, 0x00, 0x9D, 0xEA, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0xE0, 0x00,
0x04, 0xC2, 0x2C, 0x40, 0x02, 0x8D, 0x50, 0x20, 0x0C, 0xCA, 0xAC, 0xC0, 0x21, 0xF9, 0x17, 0x10, 0x04, 0xC2, 0x2C, 0x40, 0x12, 0x49, 0x34, 0x00, 0x00, 0x82, 0x08, 0x00, 0x01, 0x97, 0x51, 0x10,
0x08, 0x8A, 0x88, 0x80, 0x04, 0x61, 0x52, 0x41, 0x00, 0x80, 0x08, 0x00, 0x43, 0x11, 0x75, 0x30, 0x00, 0xA2, 0x08, 0x00, 0x60, 0x05, 0x56, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x40,
0x00, 0x22, 0x11, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x0F, 0xB0, 0x00, 0x00, 0x00, 0x08, 0x80, 0x04, 0x0D, 0xA4, 0x00, 0x00, 0x00, 0x88, 0x00, 0x08, 0xCD, 0xE8, 0x80, 0x02, 0x2A, 0xA2, 0x20,
0x08, 0xCD, 0xE8, 0x80, 0x02, 0xAA, 0x22, 0x20, 0x04, 0x0D, 0xA4, 0x00, 0x0C, 0xD1, 0x00, 0x00, 0x00, 0x0F, 0xB0, 0x00, 0x8C, 0x51, 0x00, 0x00, 0x00, 0x22, 0x11, 0x00, 0x81, 0x10, 0x00, 0x00,
0x00, 0xDF, 0xFD, 0x00, 0x0A, 0xEE, 0xFF, 0xA0, 0x0D, 0xF2, 0x2D, 0xD0, 0x06, 0x61, 0x1D, 0xC0, 0x01, 0x12, 0x2D, 0xD0, 0x06, 0x71, 0x99, 0x00, 0x01, 0x1E, 0xED, 0x10, 0x07, 0x7E, 0xF7, 0x00,
0x01, 0x56, 0x29, 0x90, 0x05, 0x58, 0x97, 0x60, 0x0D, 0xD2, 0x29, 0x90, 0x05, 0x59, 0x97, 0x70, 0x04, 0xDF, 0xFD, 0x40, 0x02, 0x6E, 0xF7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x33, 0x33, 0x00, 0x04, 0x48, 0x99, 0x80, 0x03, 0x3C, 0xC3, 0x30, 0x00, 0xCD, 0x10, 0x88, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0xBF, 0x62, 0xA8, 0x00, 0x33, 0x33, 0x20, 0x01, 0x10, 0x4C, 0x80,
0x01, 0x10, 0x03, 0x30, 0x00, 0x15, 0xC8, 0x00, 0x03, 0x3C, 0xC3, 0x30, 0x02, 0x67, 0x32, 0x20, 0x00, 0x3F, 0xF3, 0x00, 0x04, 0x40, 0x99, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0xDF, 0xFD, 0x10, 0x07, 0xFF, 0xFF, 0x60, 0x1C, 0xE0, 0x0E, 0xC1, 0x0F, 0xF0, 0x09, 0x90, 0x1E, 0xE1, 0x16, 0x61, 0x0F, 0xF0, 0x01, 0x10, 0x1E, 0xF4, 0x56, 0x21, 0x0F, 0xF6, 0x67, 0x10,
0x1E, 0xF2, 0x36, 0x61, 0x0F, 0xF0, 0x89, 0x90, 0x1E, 0xF1, 0x0F, 0xE1, 0x0F, 0xF0, 0x09, 0x90, 0x16, 0xEC, 0xCE, 0x21, 0x07, 0xFB, 0xBB, 0x20, 0x01, 0x11, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00,
0x09, 0xB6, 0x6F, 0xD0, 0x27, 0xD8, 0x8E, 0x60, 0x09, 0x92, 0xED, 0x10, 0x2F, 0xF0, 0x2E, 0xE0, 0x09, 0x9A, 0xE5, 0x10, 0x2F, 0xF6, 0x2E, 0xE0, 0x09, 0x9B, 0x75, 0x10, 0x2F, 0xD6, 0x4E, 0xE0,
0x0D, 0xDA, 0xE5, 0x10, 0x2F, 0xD0, 0x4E, 0xE0, 0x0D, 0xD2, 0xED, 0x10, 0x2F, 0xD0, 0x0E, 0xE0, 0x09, 0xF6, 0x6F, 0x90, 0x27, 0xD9, 0x9F, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0xFF, 0xFF, 0x00, 0x8F, 0x71, 0x1F, 0xF0, 0x2F, 0xD0, 0x0F, 0xF0, 0x8F, 0x71, 0x1F, 0xF0, 0x2F, 0xD0, 0x07, 0x70, 0x8E, 0x61, 0x1E, 0xE0, 0x27, 0xDD, 0xDF, 0x60, 0x8E, 0x69, 0x1E, 0xE0,
0x27, 0x76, 0x4A, 0xA0, 0x8E, 0xE9, 0x9E, 0xE0, 0x2F, 0xD0, 0x6E, 0x80, 0x8A, 0xE7, 0xFE, 0xA0, 0x07, 0xFA, 0x8E, 0x60, 0x88, 0x27, 0x7A, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x7C, 0xCF, 0xF0, 0x13, 0x26, 0x60, 0x11, 0x07, 0x7C, 0xCF, 0xF0, 0x03, 0x76, 0x65, 0x10, 0x02, 0x39, 0xD7, 0x20, 0x04, 0x53, 0x35, 0x40, 0x00, 0x2F, 0xF2, 0x00, 0x01, 0x13, 0x31, 0x10,
0x00, 0x5F, 0xB1, 0x00, 0x00, 0x03, 0x30, 0x00, 0x05, 0x5E, 0xE5, 0x50, 0x01, 0x13, 0x31, 0x10, 0x05, 0x5E, 0xED, 0xD0, 0x02, 0x23, 0x30, 0x00, 0x00, 0x08, 0x88, 0x80, 0x8A, 0xAB, 0xB8, 0x88,
0x00, 0x00, 0x11, 0x00, 0x00, 0x04, 0x45, 0x10, 0x04, 0x62, 0x33, 0x20, 0x00, 0x44, 0x01, 0x10, 0x04, 0xC8, 0x9A, 0xA0, 0x00, 0xEE, 0xAB, 0x10, 0x0C, 0xE6, 0x67, 0x20, 0x0E, 0xF5, 0x5F, 0xB0,
0x0E, 0xE0, 0x06, 0x60, 0x0B, 0xF6, 0x2B, 0x90, 0x0E, 0xE0, 0x06, 0x60, 0x03, 0xFC, 0x89, 0x90, 0x04, 0xEE, 0xEE, 0xA0, 0x00, 0x77, 0x3B, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x88, 0x00,
0x09, 0x90, 0x00, 0x00, 0x00, 0x11, 0x10, 0x00, 0x09, 0x92, 0x24, 0x40, 0x00, 0x01, 0x10, 0x00, 0x09, 0x90, 0x88, 0x00, 0x26, 0xEF, 0xDE, 0x20, 0x09, 0x9B, 0xB5, 0x40, 0x2E, 0xC3, 0x3C, 0xE2,
0x0D, 0x9A, 0x25, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x0D, 0xDA, 0xA5, 0x50, 0x2E, 0xC3, 0x3C, 0xE2, 0x09, 0xD6, 0xED, 0x10, 0x26, 0xCB, 0xBC, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x05, 0xFB, 0xFF, 0xE0, 0x8E, 0x61, 0x16, 0xE8, 0x0F, 0xF4, 0x03, 0x30, 0x8F, 0x71, 0x17, 0xF8,
0x07, 0xFC, 0x8B, 0x30, 0x8E, 0x69, 0x96, 0xE8, 0x05, 0x73, 0x3B, 0xA0, 0x8A, 0x6D, 0xD6, 0xA8, 0x0D, 0xD8, 0x8A, 0x20, 0x08, 0xA7, 0x79, 0xB2, 0x01, 0x10, 0x02, 0x20, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x80, 0x8A, 0x01, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x80, 0xA1, 0x10, 0x00, 0x07, 0x74, 0x4F, 0x70, 0x80, 0xA9, 0x90, 0x00, 0x02, 0x31, 0xDF, 0x20, 0x84, 0xE6, 0x00, 0x04,
0x00, 0x27, 0xDA, 0x20, 0xC8, 0xAA, 0x4C, 0x40, 0x00, 0x57, 0x3B, 0x20, 0x00, 0xA1, 0x18, 0x00, 0x05, 0x54, 0x6F, 0x50, 0x00, 0xA9, 0x98, 0x00, 0x02, 0x22, 0x20, 0x80, 0x02, 0x00, 0x18, 0x88,
0x00, 0x04, 0x44, 0x40, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x0C, 0x44, 0x44, 0x00, 0x00, 0x04, 0x40, 0x00, 0x88, 0xC0, 0x00, 0x00, 0x00, 0x0C, 0xC0, 0x00, 0x0C, 0x46, 0xA4, 0x40,
0x00, 0x0C, 0xC0, 0x00, 0x08, 0x8E, 0xE0, 0x00, 0x02, 0x08, 0x80, 0x00, 0x80, 0xD0, 0x88, 0x00, 0x28, 0xA8, 0x80, 0x00, 0x88, 0xCD, 0x4C, 0x40, 0x0A, 0x88, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0xE0, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x88, 0x00, 0x80, 0x01, 0x06, 0x10, 0x00, 0x56, 0xE7, 0x50, 0x80, 0x02, 0x1F, 0xF1, 0x00,
0x38, 0x8C, 0xB8, 0x00, 0x0B, 0xF6, 0x0B, 0x00, 0x94, 0xC0, 0x28, 0x00, 0x06, 0x07, 0x6A, 0x00, 0xCB, 0xA6, 0xC8, 0x00, 0x00, 0x47, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x0A, 0x80, 0x00, 0x00, 0x39, 0x14, 0x20, 0x02, 0x22, 0x24, 0x00, 0x08, 0xAE, 0xA8, 0x60, 0x04, 0x28, 0x99, 0x70, 0x07, 0x75, 0xD1, 0x04, 0x0F, 0xB3, 0x33, 0xD0, 0x00, 0xAE, 0xBE, 0xA4,
0x25, 0x15, 0x20, 0xA0, 0x02, 0x61, 0x0C, 0x02, 0x20, 0x42, 0x08, 0x20, 0x2C, 0x30, 0x14, 0x02, 0x02, 0x28, 0x82, 0x00, 0x03, 0xAC, 0xC1, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x08, 0x12, 0x00, 0x08, 0x00, 0x28, 0x00, 0x0A, 0xCF, 0xEE, 0x20, 0x0B, 0x62, 0x2E, 0x20, 0x02, 0x10, 0x82, 0x40, 0x01, 0x44, 0xE4, 0x40, 0x03, 0x00, 0x0E, 0x00, 0x8D, 0xEA, 0xAC, 0x00,
0x02, 0x10, 0x0A, 0x00, 0x01, 0xE0, 0x24, 0x00, 0x0C, 0x21, 0x02, 0x00, 0x09, 0x42, 0x21, 0x00, 0x00, 0xCC, 0xF4, 0x40, 0x02, 0xBF, 0xD4, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x40, 0x00, 0x0C, 0xCC, 0xC4, 0x40, 0x00, 0x0C, 0xC0, 0x00, 0x00, 0x02, 0xA0, 0x40,
0x00, 0x0C, 0xC0, 0x00, 0x04, 0xCE, 0x64, 0x40, 0x02, 0x08, 0x80, 0x00, 0x00, 0x90, 0x00, 0x40, 0x28, 0xA8, 0x80, 0x00, 0x08, 0x01, 0x04, 0x00, 0x0A, 0x88, 0x80, 0x00, 0x04, 0x44, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x54, 0x44, 0x00, 0xEE, 0xFE, 0xE0, 0x00, 0x09, 0x3B, 0x3F, 0x00,
0x21, 0xD8, 0x20, 0x00, 0x00, 0x54, 0x4F, 0x00, 0x18, 0x58, 0x20, 0x00, 0x00, 0x01, 0x86, 0x00, 0xC6, 0x7E, 0x40, 0x00, 0x00, 0xEF, 0x66, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x04, 0x00, 0x00, 0xC0, 0x20, 0x00, 0xAA, 0xAA, 0xEA, 0x20, 0xEF, 0xFF, 0xFF, 0x00, 0x80, 0x44, 0x19, 0x30, 0x00, 0x49, 0x24, 0x00, 0xC5, 0x35, 0x1B, 0x10, 0x00, 0x4B, 0x24, 0x00,
0x01, 0x35, 0xA0, 0x00, 0x8C, 0xA9, 0xAC, 0x80, 0x00, 0x2C, 0x00, 0x00, 0x04, 0x21, 0xA4, 0x00, 0x2A, 0x84, 0x00, 0x00, 0x73, 0x11, 0xF1, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0B, 0x11, 0x19, 0x00, 0x00, 0x40, 0x00, 0x00, 0x8F, 0xEE, 0xEF, 0xE0, 0x0B, 0x76, 0x66, 0xD0, 0x1A, 0x00, 0x0B, 0x40, 0x4C, 0x40, 0x02, 0xD0, 0x28, 0x00, 0x1A, 0x40, 0x01, 0xD0, 0x2C, 0x10,
0x00, 0x00, 0x38, 0x40, 0x00, 0x40, 0x28, 0x10, 0x00, 0x01, 0xA0, 0x40, 0x00, 0x42, 0x83, 0x00, 0x05, 0xFE, 0x44, 0x40, 0x03, 0xFD, 0x54, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x09, 0x99, 0x9B, 0x00, 0x00, 0x10, 0x20, 0x00, 0x07, 0x26, 0x21, 0x40, 0x2A, 0xFE, 0xEE, 0xA0, 0x8D, 0x8C, 0xA9, 0xC0, 0x00, 0x10, 0x20, 0x80, 0x32, 0x33, 0xB3, 0x60, 0x00, 0x19, 0x28, 0x00,
0x00, 0x00, 0xA1, 0x40, 0x00, 0x10, 0xB1, 0x00, 0x00, 0x08, 0x34, 0x00, 0x00, 0x1A, 0x08, 0x00, 0x05, 0xF7, 0x40, 0x00, 0x8E, 0xF4, 0x44, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x08, 0x14, 0x02, 0x80, 0x00, 0x04, 0x00, 0x00, 0x1D, 0x11, 0xDB, 0x00, 0xDD, 0xFD, 0xDD, 0xD0, 0x0C, 0x88, 0x07, 0x00, 0x02, 0x06, 0x00, 0x90, 0x48, 0x00, 0x34, 0x00, 0x2C, 0x04, 0x2C, 0x10,
0x48, 0x11, 0x21, 0x40, 0x04, 0x84, 0x83, 0x40, 0x59, 0x03, 0x00, 0x50, 0x40, 0x0C, 0x10, 0x60, 0x42, 0xA9, 0x88, 0xC0, 0x40, 0x15, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x11, 0x02, 0x00, 0x40, 0x08, 0x98, 0x88, 0x80, 0x08, 0xF9, 0x98, 0xC0, 0x06, 0x77, 0x75, 0x50, 0x02, 0x0C, 0x05, 0x00, 0x19, 0x98, 0xA8, 0xD0, 0x0B, 0x99, 0xCA, 0x80, 0x04, 0x54, 0x65, 0xC0,
0x20, 0x08, 0x50, 0x20, 0x00, 0x10, 0x20, 0xC0, 0x31, 0x1C, 0x04, 0x20, 0x00, 0x01, 0x28, 0x40, 0x26, 0x63, 0xBB, 0xE0, 0x26, 0xEF, 0xE6, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x02, 0x01, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0F, 0x8A, 0x89, 0x80, 0xC3, 0xF3, 0x11, 0x30, 0x0F, 0x02, 0x01, 0x80, 0xC9, 0xC0, 0x00, 0x30, 0x0F, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, 0x30,
0x0E, 0x02, 0x05, 0xA0, 0x00, 0x00, 0x00, 0x30, 0x0E, 0x02, 0x52, 0x80, 0x00, 0x00, 0x03, 0x00, 0x2C, 0xDF, 0xA8, 0x80, 0x02, 0x33, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x03, 0x88, 0x00, 0x01, 0x02, 0x80, 0x00, 0x03, 0xFF, 0xF7, 0x00, 0x0F, 0x26, 0xE4, 0x72, 0xCC, 0x38, 0x00, 0x40, 0x0C, 0x38, 0x99, 0x00, 0x03, 0x0A, 0x31, 0x50, 0x0C, 0xB1, 0x82, 0x80,
0x03, 0x28, 0x06, 0x00, 0x87, 0x88, 0x2A, 0xA0, 0x01, 0x05, 0xC2, 0x00, 0x85, 0x82, 0xC2, 0x80, 0x10, 0x00, 0x39, 0x10, 0x08, 0x51, 0xBF, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x04, 0x00, 0x48, 0x9D, 0xCC, 0x40, 0xC9, 0xE6, 0x7F, 0x40, 0x40, 0x00, 0x94, 0x00, 0x5B, 0x21, 0x0C, 0xB0, 0x48, 0xAE, 0xCC, 0x40, 0xE1, 0x30, 0x0C, 0x30, 0x43, 0x01, 0xA4, 0x00,
0xE1, 0x24, 0x5D, 0x30, 0x78, 0x8C, 0xD6, 0x10, 0xF1, 0x60, 0x94, 0x70, 0xD0, 0x40, 0x9C, 0x70, 0x0B, 0x8C, 0x53, 0x00, 0x0C, 0x9D, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x39, 0x50, 0x00, 0x00, 0x88, 0xF0, 0x00, 0x2E, 0xAF, 0xC6, 0x00, 0x03, 0x01, 0x77, 0x60, 0x04, 0xF0, 0x41, 0x60, 0x03, 0x92, 0xF8, 0x12, 0x0F, 0xBD, 0x91, 0x40, 0x1B, 0x28, 0x60, 0x92,
0x70, 0xF4, 0x01, 0xF0, 0x0A, 0xD4, 0x65, 0x82, 0x53, 0xE0, 0x01, 0xE0, 0x04, 0x10, 0x68, 0x60, 0x04, 0x2A, 0xBE, 0x00, 0x00, 0x4F, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x3A, 0xEE, 0x00, 0xC8, 0xC0, 0x00, 0x00, 0x0D, 0x84, 0xA5, 0x00, 0xC1, 0xC2, 0x11, 0x00, 0x45, 0x0E, 0x27, 0x00, 0xD9, 0xC3, 0x00, 0x10, 0x07, 0xF8, 0x8D, 0x20, 0x01, 0x30, 0x00, 0x10,
0xAC, 0x02, 0x25, 0xA0, 0x01, 0x22, 0x00, 0x10, 0x44, 0x20, 0x16, 0xA0, 0x13, 0x02, 0x00, 0x30, 0x04, 0x1B, 0xAA, 0x40, 0x21, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
#define gDPSetPrimColorMod(pkt, m, l, rgba) \
_DW({ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | \
_SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
_g->words.w1 = (rgba); \
})
#ifdef NON_MATCHING
void GfxPrint_InitDlist(GfxPrint* this)
{
u32 palette;
u32 tile;
gDPPipeSync(this->dlist++);
gDPSetOtherMode(this->dlist++, 0xECF0, 0x504244);
gDPSetCombineLERP(this->dlist++, K5, K5, 0, TEXEL0, 0, 0, 0, TEXEL0, K5, K5, 0, TEXEL0, 0, 0, 0, TEXEL0);
gDPLoadTextureBlock(this->dlist++, sGfxPrintFontData, G_IM_FMT_CI, G_IM_SIZ_4b, 16, 256, 0, 0, 0, 0, 0, 0, 0); //? missmatch here
gDPLoadTLUT(this->dlist++, 64, 0x100, sGfxPrintFontTLUT);
tile = 2;
palette = 1;
do
{
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0x0, tile, palette++, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0);
gDPSetTileSize(this->dlist++, tile, 0, 0, 15, 255);
tile+=2;
} while (palette < 4);
gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color);
gDPLoadTextureTile(this->dlist++, sGfxPrintUnkData, G_IM_FMT_CI, G_IM_SIZ_8b, 1, 0, 0, 0, 0, 7, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 1, 3, 0, 0);
gDPLoadTLUT(this->dlist++, 16, 0x140, sGfxPrintUnkTLUT);
tile = 3;
do
{
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, tile, 0x0, G_TX_RENDERTILE, 4, G_TX_NOMIRROR | G_TX_WRAP, 3, 0, G_TX_NOMIRROR | G_TX_WRAP, 1, 0);
gDPSetTileSize(this->dlist++, tile, 0, 0, 1, 7);
tile += 2;
} while (tile != 9);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_InitDlist.s")
#endif
void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a)
{
this->color.r = r;
this->color.g = g;
this->color.b = b;
this->color.a = a;
gDPPipeSync(this->dlist++);
gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color);
}
void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y)
{
this->posX = this->baseX + (x << 2);
this->posY = this->baseY + (y << 2);
}
void GfxPrint_SetPos(GfxPrint* this, s32 x, s32 y)
{
GfxPrint_SetPosPx(this, x << 3, y << 3);
}
void GfxPrint_SetBasePosPx(GfxPrint* this, s32 x, s32 y)
{
this->baseX = x << 2;
this->baseY = y << 2;
}
//close from matching
#ifdef NON_MATCHING
void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c)
{
u32 test;
u32 test2;
if (this->flag & GFXPRINT_UPDATE_MODE)
{
this->flag &= ~GFXPRINT_UPDATE_MODE;
gDPPipeSync(this->dlist++);
if (this->flag & GFXPRINT_USE_RGBA16)
{
gDPSetTextureLUT(this->dlist++, G_TT_RGBA16);
gDPSetCycleType(this->dlist++, G_CYC_2CYCLE);
gDPSetRenderMode(this->dlist++, G_RM_OPA_CI, G_RM_XLU_SURF2);
gDPSetCombineLERP(this->dlist++, TEXEL0, K5, TEXEL1, COMBINED_ALPHA, TEXEL0, 0, TEXEL1, 0, K5, K5, 0, COMBINED, 0, 0, 0, COMBINED);
}
else
{
gDPSetTextureLUT(this->dlist++, G_TT_IA16);
gDPSetCycleType(this->dlist++, G_CYC_1CYCLE);
gDPSetRenderMode(this->dlist++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
gDPSetCombineLERP(this->dlist++, TEXEL0, K5, PRIMITIVE, COMBINED_ALPHA, 0, 0, 0, TEXEL0, TEXEL0, K5, PRIMITIVE, COMBINED_ALPHA, 0, 0, 0, TEXEL0);
}
}
test = (c & 4) << 6;
test2 = (c >> 3) << 8;
if (this->flag & GFXPRINT_FLAG4)
{
gDPSetPrimColorMod(this->dlist++, 0, 0, 0);
if (this->flag & GFXPRINT_FLAG64)
gSPTextureRectangle(this->dlist++, (this->posX+4)<<1, (this->posY+4)<<1, (this->posX+0x24)<<1, (this->posY+0x24)<<1, c<<1, test, test2, 512, 512); //c*2 ?
else
gSPTextureRectangle(this->dlist++, this->posX+4, this->posY+4, this->posX+0x24, this->posY+0x24, c<<1, test, test2, 1024, 1024);
gDPSetPrimColorMod(this->dlist++, 0, 0, *(u32*)&this->color);
}
if (this->flag & GFXPRINT_FLAG64)
gSPTextureRectangle(this->dlist++, (this->posX)<<1, (this->posY)<<1, (this->posX + 0x20)<<1, (this->posY + 0x20)<<1, c << 1, test, test2, 512, 512);
else
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 0x20, this->posY + 0x20, c << 1, test, test2, 1024, 1024);
this->posX += 0x20;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_PrintCharImpl.s")
#endif
#ifdef NON_MATCHING
void GfxPrint_PrintChar(GfxPrint *this, char c)
{
if (c == ' ')
this->posX += 0x20;
else if (c > 0x20 && c < 0x7f)
GfxPrint_PrintCharImpl(this, c);
else if (c >= 0xa0 && c < 0xe0)
{
u8 charParam = c;
if ((this->flag & GFXPRINT_FLAG1) != 0)
{
if (c < 0xc0)
charParam = c - 0x20;
else
charParam = c + 0x20;
}
GfxPrint_PrintCharImpl(this, charParam);
}
else
{
switch(c)
{
case 0:
return;
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
return;
//tab
case 9:
{
u32 uVar1;
do {
GfxPrint_PrintCharImpl(this, 0x20);
uVar1 = this->posX - this->baseX;
if (uVar1 < 0 && uVar1 != 0)
uVar1 -= 0x100;
} while (uVar1 != 0);
return;
}
//line feed
case 0xa:
{
this->posY += 0x20;
this->posX = this->baseX;
return;
}
/*
case 0xb:
case 0xc:
return;
*/
//carriage return
case 0xd:
{
this->posX = this->baseX;
return;
}
case 0x8a:
this->flag &= ~GFXPRINT_USE_RGBA16;
this->flag |= GFXPRINT_UPDATE_MODE;
return;
case 0x8b:
this->flag |= GFXPRINT_USE_RGBA16;
this->flag |= GFXPRINT_UPDATE_MODE;
return;
case 0x8c:
this->flag &= ~GFXPRINT_FLAG1;
return;
case 0x8d:
this->flag |= GFXPRINT_FLAG1;
return;
case 0x8e:
default:
return;
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/gfxprint/GfxPrint_PrintChar.s")
#endif
void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, size_t charSize, size_t charCount)
{
const char* str = (const char*)buffer;
size_t count = charSize * charCount;
while (count)
{
GfxPrint_PrintChar(this, *str++);
count--;
}
}
void GfxPrint_PrintString(GfxPrint* this, const char* str)
{
while (*str)
GfxPrint_PrintChar(this, *(str++));
}
GfxPrint* GfxPrint_Callback(GfxPrint* this, const char* str, size_t size)
{
GfxPrint_PrintStringWithSize(this, str, sizeof(char), size);
return this;
}
void GfxPrint_Ctor(GfxPrint* this)
{
this->flag &= ~GFXPRINT_OPEN;
this->callback = &GfxPrint_Callback;
this->dlist = NULL;
this->posX = 0;
this->posY = 0;
this->baseX = 0;
this->baseY = 0;
*(u32*)&this->color = 0;
this->flag &= ~GFXPRINT_FLAG1;
this->flag &= ~GFXPRINT_USE_RGBA16;
this->flag |= GFXPRINT_FLAG4;
this->flag |= GFXPRINT_UPDATE_MODE;
if ((D_801755F0 & GFXPRINT_FLAG64))
this->flag |= GFXPRINT_FLAG64; //? dsdx/dtdy
else
this->flag &= ~GFXPRINT_FLAG64;
}
void GfxPrint_Dtor(GfxPrint* this)
{
}
void GfxPrint_Open(GfxPrint* this, Gfx* dlist)
{
if (!(this->flag & GFXPRINT_OPEN))
{
this->flag |= GFXPRINT_OPEN;
this->dlist = dlist;
GfxPrint_InitDlist(this);
}
else
osSyncPrintf("gfxprint_open:2重オープンです\n");
}
Gfx* GfxPrint_Close(GfxPrint* this)
{
Gfx* ret;
this->flag &= ~GFXPRINT_OPEN;
gDPPipeSync(this->dlist++);
ret = this->dlist;
this->dlist = NULL;
return ret;
}
void GfxPrint_VPrintf(GfxPrint *this, const char *fmt, va_list args)
{
func_800FF340(&this->callback, fmt, args);
}
void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
GfxPrint_VPrintf(this, fmt, args);
}
+240
View File
@@ -0,0 +1,240 @@
#include <global.h>
#include <vt.h>
volatile u32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0;
volatile OSTime sIrqMgrRetraceTime = 0;
u32 sIrqMgrRetraceCount = 0;
#define RETRACE_MSG 666
#define PRE_NMI_MSG 669
#define PRENMI450_MSG 671
#define PRENMI480_MSG 672
#define PRENMI500_MSG 673
#define STATUS_IDLE 0
#define STATUS_PRENMI 1
#define STATUS_NMI 2
void IrqMgr_AddClient(IrqMgr* this, IrqMgrClient* c, OSMesgQueue* msgQ)
{
u32 prevMask;
LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 96);
LogUtils_CheckNullPointer("c", c, "../irqmgr.c", 97);
LogUtils_CheckNullPointer("msgQ", msgQ, "../irqmgr.c", 98);
prevMask = osSetIntMask(1);
c->queue = msgQ;
c->prev = this->clients;
this->clients = c;
osSetIntMask(prevMask);
if (this->resetStatus > STATUS_IDLE)
osSendMesg(c->queue, (OSMesg)&this->prenmiMsg, OS_MESG_NOBLOCK);
if (this->resetStatus >= STATUS_NMI)
osSendMesg(c->queue, (OSMesg)&this->nmiMsg, OS_MESG_NOBLOCK);
}
void IrqMgr_RemoveClient(IrqMgr* this, IrqMgrClient* c)
{
IrqMgrClient* iter;
IrqMgrClient* lastIter;
u32 prevMask;
iter = this->clients;
lastIter = NULL;
LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 129);
LogUtils_CheckNullPointer("c", c, "../irqmgr.c", 130);
prevMask = osSetIntMask(1);
while (iter)
{
if (iter == c)
{
if (lastIter)
lastIter->prev = c->prev;
else
this->clients = c->prev;
break;
}
lastIter = iter;
iter = iter->prev;
}
osSetIntMask(prevMask);
}
void IrqMgr_SendMesgForClient(IrqMgr* this, OSMesg msg)
{
IrqMgrClient* iter;
iter = this->clients;
while(iter)
{
if (iter->queue->validCount >= iter->queue->msgCount)
//irqmgr_SendMesgForClient: Message queue is overflowing mq=%08x cnt=%d
osSyncPrintf(VT_COL(RED, WHITE) "irqmgr_SendMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, iter->queue, iter->queue->validCount);
else
osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK);
iter = iter->prev;
}
}
void IrqMgr_JamMesgForClient(IrqMgr* this, OSMesg msg)
{
IrqMgrClient* iter;
iter = this->clients;
while(iter)
{
if (iter->queue->validCount >= iter->queue->msgCount)
//irqmgr_JamMesgForClient: Message queue is overflowing mq=%08x cnt=%d
osSyncPrintf(VT_COL(RED, WHITE) "irqmgr_JamMesgForClient:メッセージキューがあふれています mq=%08x cnt=%d\n" VT_RST, iter->queue, iter->queue->validCount);
else
//mistake? the function's name suggests it would use osJamMesg
osSendMesg(iter->queue, msg, OS_MESG_NOBLOCK);
iter = iter->prev;
}
}
void IrqMgr_HandlePreNMI(IrqMgr *this)
{
u64 temp = STATUS_PRENMI; //required to match
gIrqMgrResetStatus = temp;
this->resetStatus = STATUS_PRENMI;
sIrqMgrResetTime = this->resetTime = osGetTime();
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(450000), 0ull, &this->queue, (OSMesg)PRENMI450_MSG);
IrqMgr_JamMesgForClient(this, (OSMesg)&this->prenmiMsg);
}
void IrqMgr_CheckStack()
{
osSyncPrintf("irqmgr.c: PRENMIから0.5秒経過\n"); //0.5 seconds after PRENMI
if (StackCheck_Check(NULL) == 0)
{
osSyncPrintf("スタックは大丈夫みたいです\n"); //The stack looks ok
}
else
{
osSyncPrintf("%c", 7);
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("スタックがオーバーフローしたか危険な状態です\n"); //Stack overflow or dangerous
osSyncPrintf("早々にスタックサイズを増やすか、スタックを消費しないようにしてください\n"); //Increase stack size early or don't consume stack
osSyncPrintf(VT_RST);
}
}
void IrqMgr_HandlePRENMI450(IrqMgr* this)
{
u64 temp = STATUS_NMI; //required to match
gIrqMgrResetStatus = temp;
this->resetStatus = STATUS_NMI;
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(30000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG);
IrqMgr_SendMesgForClient(this, (OSMesg)&this->nmiMsg);
}
void IrqMgr_HandlePRENMI480(IrqMgr* this)
{
u32 ret;
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(20000), 0ull, &this->queue, (OSMesg)PRENMI500_MSG);
ret = func_801031F0(); //osAfterPreNMI
if (ret)
{
osSyncPrintf("osAfterPreNMIが %d を返しました!?\n", ret); //osAfterPreNMI returned %d !?
osSetTimer(&this->timer, OS_USEC_TO_CYCLES(1000), 0ull, &this->queue, (OSMesg)PRENMI480_MSG);
}
}
void IrqMgr_HandlePRENMI500(IrqMgr* this)
{
IrqMgr_CheckStack();
}
void IrqMgr_HandleRetrace(IrqMgr* this)
{
if (sIrqMgrRetraceTime == 0ull)
{
if (this->retraceTime == 0)
this->retraceTime = osGetTime();
else
sIrqMgrRetraceTime = osGetTime() - this->retraceTime;
}
sIrqMgrRetraceCount++;
IrqMgr_SendMesgForClient(this, (OSMesg)&this->retraceMsg);
}
void IrqMgr_ThreadEntry(void* arg0)
{
OSMesg msg;
IrqMgr* this;
u8 exit;
this = (IrqMgr*)arg0;
msg = 0;
osSyncPrintf("IRQマネージャスレッド実行開始\n"); //Start IRQ manager thread execution
exit = false;
while (!exit)
{
osRecvMesg(&this->queue, &msg, OS_MESG_BLOCK);
switch ((u32)msg)
{
case RETRACE_MSG:
IrqMgr_HandleRetrace(this);
break;
case PRE_NMI_MSG:
osSyncPrintf("PRE_NMI_MSG\n");
osSyncPrintf("スケジューラ:PRE_NMIメッセージを受信\n"); //Scheduler: Receives PRE_NMI message
IrqMgr_HandlePreNMI(this);
break;
case PRENMI450_MSG:
osSyncPrintf("PRENMI450_MSG\n");
osSyncPrintf("スケジューラ:PRENMI450メッセージを受信\n"); //Scheduler: Receives PRENMI450 message
IrqMgr_HandlePRENMI450(this);
break;
case PRENMI480_MSG:
osSyncPrintf("PRENMI480_MSG\n");
osSyncPrintf("スケジューラ:PRENMI480メッセージを受信\n"); //Scheduler: Receives PRENMI480 message
IrqMgr_HandlePRENMI480(this);
break;
case PRENMI500_MSG:
osSyncPrintf("PRENMI500_MSG\n");
osSyncPrintf("スケジューラ:PRENMI500メッセージを受信\n"); //Scheduler: Receives PRENMI500 message
exit = true;
IrqMgr_HandlePRENMI500(this);
break;
default:
osSyncPrintf("irqmgr.c:予期しないメッセージを受け取りました(%08x)\n", msg); //Unexpected message received
break;
}
}
osSyncPrintf("IRQマネージャスレッド実行終了\n"); //End of IRQ manager thread execution
}
void IrqMgr_Create(IrqMgr* this, void* stack, OSPri pri, u8 retraceCount)
{
LogUtils_CheckNullPointer("this", this, "../irqmgr.c", 346);
LogUtils_CheckNullPointer("stack", stack, "../irqmgr.c", 347);
this->clients = NULL;
this->retraceMsg.type = OS_SC_RETRACE_MSG;
this->prenmiMsg.type = OS_SC_PRE_NMI_MSG;
this->nmiMsg.type = OS_SC_NMI_MSG;
this->resetStatus = STATUS_IDLE;
this->resetTime = 0;
osCreateMesgQueue(&this->queue, this->msgBuf, ARRAY_COUNT(this->msgBuf));
osSetEventMesg(OS_EVENT_PRENMI, &this->queue, (OSMesg)PRE_NMI_MSG);
osViSetEvent(&this->queue, (OSMesg)RETRACE_MSG, retraceCount);
osCreateThread(&this->thread, 0x13, IrqMgr_ThreadEntry, this, stack, pri);
osStartThread(&this->thread);
}
+65
View File
@@ -0,0 +1,65 @@
#include <global.h>
ListAlloc* ListAlloc_Init(ListAlloc* this)
{
this->prev = NULL;
this->next = NULL;
return this;
}
void* ListAlloc_Alloc(ListAlloc* this, u32 size)
{
ListAlloc* ptr;
ListAlloc* next;
ptr = SystemArena_MallocDebug(size + sizeof(ListAlloc), "../listalloc.c", 40);
if (!ptr)
return NULL;
next = this->next;
if (next)
next->next = ptr;
ptr->prev = next;
ptr->next = NULL;
this->next = ptr;
if (!this->prev)
this->prev = ptr;
return (u8*)ptr + sizeof(ListAlloc);
}
void ListAlloc_Free(ListAlloc* this, void* data)
{
ListAlloc* ptr;
ptr = &((ListAlloc*)data)[-1];
if (ptr->prev)
ptr->prev->next = ptr->next;
if (ptr->next)
ptr->next->prev = ptr->prev;
if (this->prev == ptr)
this->prev = ptr->next;
if (this->next == ptr)
this->next = ptr->prev;
SystemArena_FreeDebug(ptr, "../listalloc.c", 72);
}
void ListAlloc_FreeAll(ListAlloc* this)
{
ListAlloc* iter;
iter = this->prev;
while (iter)
{
ListAlloc_Free(this, (u8*)iter + sizeof(ListAlloc));
iter = this->prev;
}
}
+20
View File
@@ -0,0 +1,20 @@
#include <global.h>
void *Overlay_AllocateAndLoad(u32 vRomStart, u32 vRomEnd, void *vRamStart, void *vRamEnd)
{
void *allocatedVRamAddr;
allocatedVRamAddr = SystemArena_MallocRDebug((s32)vRamEnd - (s32)vRamStart, "../loadfragment2.c", 31);
if(gOverlayLogSeverity >= 3)
{
osSyncPrintf("OVL:SPEC(%08x-%08x) REAL(%08x-%08x) OFFSET(%08x)\n", vRamStart, vRamEnd, allocatedVRamAddr, ((u32)vRamEnd - (u32)vRamStart) + (u32)allocatedVRamAddr, (u32)vRamStart - (u32)allocatedVRamAddr);
}
if(allocatedVRamAddr != NULL)
{
Overlay_Load(vRomStart, vRomEnd, vRamStart, vRamEnd, allocatedVRamAddr);
}
return allocatedVRamAddr;
}
+3
View File
@@ -0,0 +1,3 @@
#include <global.h>
s32 gOverlayLogSeverity = 2;
+123
View File
@@ -0,0 +1,123 @@
#include <global.h>
#include <vt.h>
#include <padmgr.h>
#include <sched.h>
u32 gScreenWidth = SCREEN_WIDTH;
u32 gScreenHeight = SCREEN_HEIGHT;
u32 gSystemHeapSize = 0;
u8* gAppNmiBufferPtr;
SchedContext gSchedContext;
PadMgr gPadMgr;
IrqMgr gIrqMgr;
u32 gSegments[NUM_SEGMENTS];
OSThread sGraphThread;
u8 sGraphStack[0x1800];
u8 sSchedStack[0x600];
u8 sAudioStack[0x800];
u8 sPadMgrStack[0x500];
u8 sIrqMgrStack[0x500];
StackEntry sGraphStackInfo;
StackEntry sSchedStackInfo;
StackEntry sAudioStackInfo;
StackEntry sPadMgrStackInfo;
StackEntry sIrqMgrStackInfo;
u8 gAudioMgr[0x298]; //type should be AudioMgr
OSMesgQueue sSiIntMsgQ;
OSMesg sSiIntMsgBuf[1];
void Main_LogSystemHeap()
{
osSyncPrintf(VT_FGCOL(GREEN));
//System heap size% 08x (% dKB) Start address% 08x
osSyncPrintf("システムヒープサイズ %08x(%dKB) 開始アドレス %08x\n", gSystemHeapSize, gSystemHeapSize / 1024, gSystemHeap);
osSyncPrintf(VT_RST);
}
void Main(void* arg0)
{
IrqMgrClient irqClient;
OSMesgQueue irqMgrMsgQ;
OSMesg irqMgrMsgBuf[60];
u32 sysHeap;
u32 fb;
s32 debugHeap;
s32 debugHeapSize;
s16 *msg;
osSyncPrintf("mainproc 実行開始\n"); //Start running
gScreenWidth = SCREEN_WIDTH;
gScreenHeight = SCREEN_HEIGHT;
gAppNmiBufferPtr = osAppNmiBuffer;
func_8007BE60(gAppNmiBufferPtr);
Fault_Start();
SysCfb_Init(0);
sysHeap = (u32)gSystemHeap;
fb = SysCfb_GetFbPtr(0);
gSystemHeapSize = (fb - sysHeap);
osSyncPrintf("システムヒープ初期化 %08x-%08x %08x\n", sysHeap, fb, gSystemHeapSize); //System heap initalization
SystemHeap_Init(sysHeap, gSystemHeapSize); //initializes the system heap
if (osMemSize >= 0x800000U)
{
debugHeap = SysCfb_GetFbEnd();
debugHeapSize = (s32) (0x80600000 - debugHeap);
}
else
{
debugHeapSize = 0x400;
debugHeap = SystemArena_MallocDebug(debugHeapSize, "../main.c", 0x235);
}
osSyncPrintf("debug_InitArena(%08x, %08x)\n", debugHeap, debugHeapSize);
DebugArena_Init(debugHeap, debugHeapSize);
func_800636C0();
SREG(0) = 0;
osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, 1);
osSetEventMesg(5, &sSiIntMsgQ, 0);
Main_LogSystemHeap();
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, 0x3c);
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack+sizeof(sIrqMgrStack), 0, 0x100, "irqmgr");
IrqMgr_Create(&gIrqMgr, &sGraphStackInfo, 0x11, 1);
osSyncPrintf("タスクスケジューラの初期化\n"); //Initialize the task scheduler
StackCheck_Init(&sSchedStackInfo, sSchedStack, sSchedStack+sizeof(sSchedStack), 0, 0x100, "sched");
func_800C9874(&gSchedContext, &sAudioStack, 0xf, D_80013960, 1, &gIrqMgr);
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
StackCheck_Init(&sAudioStackInfo, sAudioStack, sAudioStack+sizeof(sAudioStack), 0, 0x100, "audio");
func_800C3FEC(&gAudioMgr, sAudioStack+sizeof(sAudioStack), 0xc, 0xa, &gSchedContext, &gIrqMgr);
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, sPadMgrStack+sizeof(sPadMgrStack), 0, 0x100, "padmgr");
PadMgr_Init(&gPadMgr, &sSiIntMsgQ, &gIrqMgr, 7, 0xe, &sIrqMgrStack);
func_800C3FC4(&gAudioMgr);
StackCheck_Init(&sGraphStackInfo, sGraphStack, sGraphStack+sizeof(sGraphStack), 0, 0x100, "graph");
osCreateThread(&sGraphThread, 4, Graph_ThreadEntry, arg0, sGraphStack+sizeof(sGraphStack), 0xb);
osStartThread(&sGraphThread);
osSetThreadPri(0, 0xf);
while (true)
{
msg = NULL;
osRecvMesg(&irqMgrMsgQ, &msg, OS_MESG_BLOCK);
if (msg == NULL)
break;
if (*msg == OS_SC_PRE_NMI_MSG)
{
osSyncPrintf("main.c: リセットされたみたいだよ\n"); //Looks like it's been reset
func_8007BED4(gAppNmiBufferPtr);
}
}
osSyncPrintf("mainproc 後始末\n"); //Cleanup
osDestroyThread(&sGraphThread);
func_800FBFD8();
osSyncPrintf("mainproc 実行終了\n"); //End of execution
}
+309
View File
@@ -0,0 +1,309 @@
#include <ultra64.h>
#include <global.h>
#include <PR/os_cont.h>
#include <ultra64/controller.h>
#include <padmgr.h>
OSMesgQueue* PadMgr_LockGetControllerQueue(PadMgr* padmgr)
{
OSMesgQueue* ctrlrqueue = NULL;
if (D_8012D280 > 2)
//EUC-JP: ロック待ち | Waiting for lock
osSyncPrintf("%2d %d serialMsgQロック待ち %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, &ctrlrqueue);
osRecvMesg(&padmgr->queue1, &ctrlrqueue, OS_MESG_BLOCK);
if (D_8012D280 > 2)
//EUC-JP: をロックしました | Locked
osSyncPrintf("%2d %d serialMsgQをロックしました %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, ctrlrqueue);
return ctrlrqueue;
}
void PadMgr_UnlockReleaseControllerQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue)
{
if (D_8012D280 > 2)
//EUC-JP: ロック解除します | Unlock
osSyncPrintf("%2d %d serialMsgQロック解除します %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue);
osSendMesg(&padmgr->queue1, ctrlrqueue, OS_MESG_BLOCK);
if (D_8012D280 > 2)
//EUC-JP: ロック解除しました | Unlocked
osSyncPrintf("%2d %d serialMsgQロック解除しました %08x %08x %08x\n", osGetThreadId(NULL), padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue);
}
void PadMgr_Lock2(PadMgr* padmgr)
{
osRecvMesg(&padmgr->queue2, 0, OS_MESG_BLOCK);
}
void PadMgr_Unlock2(PadMgr* padmgr)
{
osSendMesg(&padmgr->queue2, 0, OS_MESG_BLOCK);
}
#ifdef NON_MATCHING
void func_800C740C(PadMgr* padmgr)
{
s32 var1;
OSMesgQueue* ctrlrqueue;
s32 var3;
s32 var4;
s32 i;
ctrlrqueue = PadMgr_LockGetControllerQueue(padmgr);
var1 = 0;
for (i = 0; i < 4; i++)
{
if (padmgr->unk_2AA[i] != 0)
{
if (padmgr->pad_status[i].status & 1)
{
if (padmgr->unk_2AE[i] == 1)
{
if (padmgr->unk_2B2[i] != 0)
{
if (padmgr->unk_2B6[i] < 3)
{
osSyncPrintf(D_80145894); //"\x1b[33m" (probably formatting/debugger interface)
osSyncPrintf(D_8014589C, i + 1, D_801458B0); //"padmgr: %d[JPN]Con: ", "[JPN]Vibration pack jumble jumble"
osSyncPrintf(D_801458CC); //"\x1b[m" (probably formatting/debugger interface)
if (osSetVibration(&padmgr->unk_controller[i], 1) != 0)
{
padmgr->unk_2AE[i] = 0;
osSyncPrintf(D_801458D0);
osSyncPrintf(D_801458D8, i + 1, D_801458EC); //"A communication error has occurred with the vibraton pack"
osSyncPrintf(D_80145914);
}
else
{
padmgr->unk_2B6[i] = 3;
}
var1 = 1;
}
}
else
{
if (padmgr->unk_2B6[i] != 0)
{
osSyncPrintf(D_80145918);
osSyncPrintf(D_80145920, i + 1, D_80145934); //"Stop vibration pack"
osSyncPrintf(D_80145944);
if (osSetVibration(&padmgr->unk_controller[i], 0) != 0)
{
padmgr->unk_2AE[i] = 0;
osSyncPrintf(D_80145948);
osSyncPrintf(D_80145950, i + 1, D_80145964); //"A communication error has occurred with the vibration pack"
osSyncPrintf(D_8014598C);
}
else
{
padmgr->unk_2B6[i]--;
}
var1 = 1;
}
}
}
}
else
{
if (padmgr->unk_2AE[i] != 0)
{
if (padmgr->unk_2AE[i] == 1)
{
osSyncPrintf(D_80145990);
osSyncPrintf(D_80145998, i + 1, D_801459AC); //"Vibration pack seems to be pulled out"
osSyncPrintf(D_801459CC);
padmgr->unk_2AE[i] = 0;
}
else
{
osSyncPrintf(D_801459D0);
osSyncPrintf(D_80145A24);
osSyncPrintf(D_801459D8, i + 1, D_801459EC); //"It seems that a controller pack that is not a vibration pack was pulled out"
padmgr->unk_2AE[i] = 0;
}
}
}
}
}
if (!var1)
{
var3 = D_8016A4F0 % 4;
if ((padmgr->unk_2AA[var3] != 0) && (padmgr->pad_status[var3].status & 1) && (padmgr->unk_2AE[var3] != 1))
{
var4 = osProbeVibrationPack(ctrlrqueue, &padmgr->unk_controller[var3], var3);
if (var4 == 0)
{
padmgr->unk_2AE[var3] = 1;
osSetVibration(&padmgr->unk_controller[var3], 1);
osSetVibration(&padmgr->unk_controller[var3], 0);
osSyncPrintf(D_80145A28);
osSyncPrintf(D_80145A30, var3 + 1, D_80145A44); //"Recognized vibration pack"
osSyncPrintf(D_80145A60);
}
else if (var4 == 11)
{
padmgr->unk_2AE[var3] = 2;
}
else if (var4 == 4)
{
LogUtils_LogThreadId(D_80145A64, 282);
++D_8012D284;
osSyncPrintf(D_80145A70, D_8012D284); //"++errcnt = %d"
osSyncPrintf(D_80145A80);
osSyncPrintf(D_80145A88, var3 + 1, D_80145A9C); //"Controller pack communication error"
osSyncPrintf(D_80145ABC);
}
}
}
D_8016A4F0++;
PadMgr_UnlockReleaseControllerQueue(padmgr, ctrlrqueue);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C740C.s")
#endif
//func_800A2300 in 1.0
void func_800C7818(PadMgr* padmgr)
{
s32 i;
OSMesgQueue* ctrlrqueue;
ctrlrqueue = PadMgr_LockGetControllerQueue(padmgr);
for (i = 0; i < 4; i++)
{
if (osProbeVibrationPack(ctrlrqueue, &padmgr->unk_controller[i], i) == 0)
{
if ((gFaultStruct.msgId == 0) && (padmgr->unk_45D != 0))
{
osSyncPrintf("\x1b[33m");
//EUC-JP: コン | 'Con'? , EUC-JP: 振動パック 停止 | Stop vibration pack
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
osSyncPrintf("\x1b[m");
}
osSetVibration(&padmgr->unk_controller[i], 0);
}
}
PadMgr_UnlockReleaseControllerQueue(padmgr, ctrlrqueue);
}
void func_800C7928(PadMgr* padmgr)
{
padmgr->unk_45C = 3;
}
void func_800C7934(PadMgr* padmgr, u32 a1, u32 a2)
{
padmgr->unk_2B2[a1] = a2;
padmgr->unk_45D = 0xF0;
}
#ifdef NON_MATCHING
//func_800A23CC in 1.0
void func_800C7948(PadMgr* padmgr, u8* a1)
{
padmgr->unk_2B2[0] = a1[0];
padmgr->unk_2B2[1] = a1[1];
padmgr->unk_2B2[2] = a1[2];
padmgr->unk_2B2[3] = a1[3];
padmgr->unk_45D = 0xF0; // NON MATCHING - T0 and T9 are reordered for some reason
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7948.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7974.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7C14.s")
void func_800C7DD0(PadMgr* padmgr)
{
osSyncPrintf("padmgr_HandlePreNMI()\n");
padmgr->unk_45E = 1;
func_800C7928(padmgr);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/func_800C7E08.s")
//void func_800C7E08(Input*, u32);
//800A2918 in 1.0
void PadMgr_Run(PadMgr* padmgr)
{
s16* mesg;
s32 bVar2;
mesg = NULL;
//EUC-JP: コントローラスレッド実行開始 | Start of controller thread execution
osSyncPrintf("コントローラスレッド実行開始\n");
bVar2 = 0;
while (bVar2 == 0)
{
if ((D_8012D280 > 2) && (padmgr->queue3.validCount == 0))
//EUC-JP: コントローラスレッドイベント待ち | Waiting for controller thread event
osSyncPrintf("コントローラスレッドイベント待ち %lld\n" , (osGetTime() * 64) / 3000);
osRecvMesg(&padmgr->queue3, &mesg, OS_MESG_BLOCK);
LogUtils_CheckNullPointer("msg", mesg, "../padmgr.c", 563);
switch (*mesg)
{
case OS_SC_RETRACE_MSG:
if (D_8012D280 > 2)
osSyncPrintf("padmgr_HandleRetraceMsg START %lld\n", (osGetTime() * 64) / 3000);
func_800C7C14(padmgr);
if (D_8012D280 > 2)
osSyncPrintf("padmgr_HandleRetraceMsg END %lld\n", (osGetTime() * 64) / 3000);
break;
case OS_SC_PRE_NMI_MSG:
func_800C7DD0(padmgr);
break;
case OS_SC_NMI_MSG:
bVar2 = 1;
break;
}
}
IrqMgr_RemoveClient(padmgr->unk_78, &padmgr->unk_70);
//EUC-JP: コントローラスレッド実行終了 | Controller thread execution end
osSyncPrintf("コントローラスレッド実行終了\n");
}
//func_800A2A14 in 1.0
void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* ctrlrqueue, UNK_TYPE arg2, OSId id, OSPri priority, void* stack)
{
//EUC-JP: パッドマネージャ作成 | Create pad manager
osSyncPrintf("パッドマネージャ作成 padmgr_Create()\n");
bzero(padmgr, sizeof(PadMgr));
padmgr->unk_78 = arg2;
osCreateMesgQueue(&padmgr->queue3, padmgr->msgbuf3, 4);
IrqMgr_AddClient(padmgr->unk_78, &padmgr->unk_70, &padmgr->queue3);
osCreateMesgQueue(&padmgr->queue1, padmgr->msgbuf1, 1);
PadMgr_UnlockReleaseControllerQueue(padmgr, ctrlrqueue);
osCreateMesgQueue(&padmgr->queue2, padmgr->msgbuf2, 1);
PadMgr_Unlock2(padmgr);
func_800FCD40(ctrlrqueue, &padmgr->unk_2A8, padmgr);
padmgr->unk_2A9 = 4;
func_80104D00(padmgr->unk_2A9);
osCreateThread(&padmgr->thread, id, PadMgr_Run, padmgr, stack, priority);
osStartThread(&padmgr->thread);
}
+3
View File
@@ -0,0 +1,3 @@
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/relocation/Overlay_DoRelocation.s")
+120
View File
@@ -0,0 +1,120 @@
#include <ultra64.h>
#include <global.h>
#include <sched.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C82A0.s")
void func_800C84E4(SchedContext* sc, UNK_TYPE arg1)
{
if (sc->unk_24C != 0)
{
sc->unk_24C = 0;
if (gIrqMgrResetStatus == 0)
ViConfig_UpdateVi(0);
}
func_800C82A0(arg1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8534.s")
void func_800C87CC(SchedContext* sc)
{
ViConfig_UpdateVi(1);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C87F0.s")
void func_800C8910(SchedContext* sc)
{
if (!(sc->curRSPTask->state & 0x10))
{
if (sc->curRSPTask->list.t.type == M_AUDTASK)
__assert("sc->curRSPTask->list.t.type != M_AUDTASK", "../sched.c", 496);
sc->curRSPTask->state |= 0x10;
osSpTaskYield();
if (D_8012D290 != 0)
osSyncPrintf("%08d:osSpTaskYield\n", (u32)((osGetTime() * 64) / 3000));
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C89D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8A94.s")
typedef struct
{
/* 0x00 */ char unk_00[0x04];
/* 0x00 */ u32 unk_04;
/* 0x00 */ u32 unk_08;
/* 0x0C */ UNK_TYPE unk_0C;
/* 0x10 */ char unk_10[0x40];
/* 0x50 */ OSMesgQueue* msgQ;
/* 0x54 */ OSMesg msg;
} struct_800C8C40;
void func_800C8BC4(SchedContext* sc, struct_800C8C40* arg1)
{
if (sc->pendingSwapBuf1 == 0)
{
sc->pendingSwapBuf1 = arg1->unk_0C;
LogUtils_CheckValidPointer("sc->pending_swapbuffer1", sc->pendingSwapBuf1, "../sched.c", 618);
if ((sc->unk_240 == NULL) || (sc->unk_240->unk_12 < 1))
func_800C84E4(sc, arg1->unk_0C);
}
}
u32 func_800C8C40(SchedContext* sc, struct_800C8C40* arg1)
{
if (!(arg1->unk_04 & 3))
{
if (arg1->msgQ != NULL)
osSendMesg(arg1->msgQ, arg1->msg, OS_MESG_BLOCK);
if (arg1->unk_08 & 0x40)
func_800C8BC4(sc, arg1);
return 1;
}
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8CB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C8EDC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C9018.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C91BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C94B4.s")
void func_800C95F8(OSMesgQueue* mq)
{
if (D_8012D290 != 0)
osSyncPrintf("osScKickEntryMsg\n");
osSendMesg(mq, 670, OS_MESG_BLOCK);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/sched/func_800C9644.s")
void func_800C9874(SchedContext* sc, void* stack, OSPri priority, UNK_TYPE arg3, UNK_TYPE arg4, UNK_TYPE arg5)
{
bzero(sc, sizeof(SchedContext));
sc->unk_24C = 1;
osCreateMesgQueue(&sc->interruptQ, sc->intBuf, 8);
osCreateMesgQueue(&sc->cmdQ, sc->cmdMsgBuf, 8);
osSetEventMesg(4, &sc->interruptQ, 667);
osSetEventMesg(9, &sc->interruptQ, 668);
IrqMgr_AddClient(arg5, &sc->unk_250, sc);
osCreateThread(&sc->thread, 5, func_800C9644, sc, stack, priority);
osStartThread(&sc->thread);
}
+58
View File
@@ -0,0 +1,58 @@
#include <ultra64.h>
#include <global.h>
typedef struct
{
/* 0x00 */ char unk_00[0x18];
/* 0x18 */ s32 unk_18;
/* 0x1C */ s32 unk_1C;
} struct_801664D0; // size = 0x20
extern struct_801664D0 D_801664D0;
void func_800C9940(struct_801664D0* arg0, u32 arg1, u32 arg2)
{
LogUtils_CheckNullPointer("this", arg0, "../speed_meter.c", 181);
arg0->unk_18 = arg1;
arg0->unk_1C = arg2;
}
void func_800C9998(struct_801664D0* arg0)
{
func_800C9940(arg0, 0x20, 0x16);
}
void func_800C99BC(struct_801664D0* arg0)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_800C99C4.s")
typedef struct
{
/* 0x00 */ u32 unk_00;
/* 0x04 */ u32 unk_04;
/* 0x08 */ u16 unk_08;
/* 0x0A */ u16 unk_0A;
/* 0x0C */ u32 unk_0C;
/* 0x10 */ u32 unk_10;
/* 0x14 */ u32 unk_14;
/* 0x18 */ u32 unk_18;
} struct_800C9E08;
void func_800C9E08(struct_800C9E08* arg0, u32 arg1, u32 arg2, u16 arg3, u16 arg4, u32 arg5, u32 arg6, u32 arg7, u32 arg8)
{
arg0->unk_00 = arg1;
arg0->unk_04 = arg2;
arg0->unk_08 = arg3;
arg0->unk_0A = arg4;
arg0->unk_0C = arg5;
arg0->unk_10 = arg6;
arg0->unk_14 = arg7;
arg0->unk_18 = arg8;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_800C9E44.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_800CA104.s")
+66
View File
@@ -0,0 +1,66 @@
#include <global.h>
volatile u32 sSysCfbFbPtr[2]; //may not be volatile but it currently gets SysCfb_Init closer from matching
u32 sSysCfbEnd;
//small reaordering
#ifdef NON_MATCHING
void SysCfb_Init(s32 n64dd)
{
if (osMemSize >= 0x800000U)
{
//8MB or more memory is installed
osSyncPrintf("8Mバイト以上のメモリが搭載されています\n");
if (n64dd == 1)
{
//RAM 8M mode (N64DD compatible)
osSyncPrintf("RAM 8M mode (N64DD対応)\n");
sSysCfbEnd = 0x805FB000;
}
else
{
//The margin for this version is% dK bytes
osSyncPrintf("このバージョンのマージンは %dK バイトです\n", (0x4BC00 / 1024));
sSysCfbEnd = 0x8044BE80;
}
}
else if (osMemSize >= 0x400000U)
{
sSysCfbEnd = 0x80400000;
osSyncPrintf("RAM4M mode\n");
}
else
{
LogUtils_HungupThread("../sys_cfb.c", 0x162);
}
sSysCfbEnd &= ~0x3f;
//The final address used by the system is% 08x
osSyncPrintf("システムが使用する最終アドレスは %08x です\n", sSysCfbEnd);
sSysCfbFbPtr[0] = sSysCfbEnd - (SCREEN_WIDTH*SCREEN_HEIGHT*4);
sSysCfbFbPtr[1] = sSysCfbEnd - (SCREEN_WIDTH*SCREEN_HEIGHT*2);
//Frame buffer addresses are% 08x and% 08x
osSyncPrintf("フレームバッファのアドレスは %08x と %08x です\n", sSysCfbFbPtr[0], sSysCfbFbPtr[1]);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/sys_cfb/SysCfb_Init.s")
#endif
void SysCfb_Reset()
{
sSysCfbFbPtr[0] = 0;
sSysCfbFbPtr[1] = 0;
sSysCfbEnd = 0;
}
u32 SysCfb_GetFbPtr(s32 idx)
{
if (idx < 2)
return sSysCfbFbPtr[idx];
return 0;
}
u32 SysCfb_GetFbEnd()
{
return sSysCfbEnd;
}
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
#include <global.h>
u32 func_800D2DF0()
{
return &D_80009320;
}
u32 func_800D2DFC()
{
return (u32)&D_800093F0 - (u32)&D_80009320;
}
u32 func_800D2E14()
{
return D_8012DBA0;
}
u32 func_800D2E20()
{
return D_8012DBA4;
}
+131
View File
@@ -0,0 +1,131 @@
#include <global.h>
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
#define LOG_SEVERITY_VERBOSE 3
s32 gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
Arena gSystemArena;
void SystemArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action)
{
if (!ptr)
{
if (gSystemArenaLogSeverity >= LOG_SEVERITY_ERROR)
{
//"%s: %u bytes %s failed\n"
osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action);
__osDisplayArena(&gSystemArena);
return;
}
}
else if (gSystemArenaLogSeverity >= LOG_SEVERITY_VERBOSE)
{
//"%s: %u bytes %s succeeded\n"
osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action);
}
}
void* SystemArena_Malloc(u32 size)
{
void* ptr;
ptr = __osMalloc(&gSystemArena, size);
SystemArena_CheckPointer(ptr, size, "malloc", "確保"); //Secure
return ptr;
}
void* SystemArena_MallocDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocDebug(&gSystemArena, size, file, line);
SystemArena_CheckPointer(ptr, size, "malloc_DEBUG", "確保"); //Secure
return ptr;
}
void* SystemArena_MallocR(u32 size)
{
void* ptr;
ptr = __osMallocR(&gSystemArena, size);
SystemArena_CheckPointer(ptr, size, "malloc_r", "確保"); //Secure
return ptr;
}
void* SystemArena_MallocRDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocRDebug(&gSystemArena, size, file, line);
SystemArena_CheckPointer(ptr, size, "malloc_r_DEBUG", "確保"); //Secure
return ptr;
}
void* SystemArena_Realloc(void* ptr, u32 newSize)
{
ptr = __osRealloc(&gSystemArena, ptr, newSize);
SystemArena_CheckPointer(ptr, newSize, "realloc", "再確保"); // Re-securing
return ptr;
}
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
return ptr;
}
void SystemArena_Free(void* ptr)
{
__osFree(&gSystemArena, ptr);
}
void SystemArena_FreeDebug(void* ptr, const char* file, s32 line)
{
__osFreeDebug(&gSystemArena, ptr, file, line);
}
void* SystemArena_Calloc(u32 num, u32 size)
{
void* ret;
u32 n;
n = num*size;
ret = __osMalloc(&gSystemArena, n);
if (ret)
bzero(ret, n);
SystemArena_CheckPointer(ret, n, "calloc", "確保");
return ret;
}
void SystemArena_Display()
{
//System heap display
osSyncPrintf("システムヒープ表示\n");
__osDisplayArena(&gSystemArena);
}
void SystemArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc)
{
ArenaImpl_GetSizes(&gSystemArena, outMaxFree, outFree, outAlloc);
}
void SystemArena_Check()
{
__osCheckArena(&gSystemArena);
}
void SystemArena_Init(void* start, u32 size)
{
gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocInit(&gSystemArena, start, size);
}
void SystemArena_Cleanup()
{
gSystemArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocCleanup(&gSystemArena);
}
u8 SystemArena_IsInitalized()
{
return __osMallocIsInitalized(&gSystemArena);
}
+21
View File
@@ -0,0 +1,21 @@
#include <global.h>
void TitleSetup_InitImpl(GameState* gameState)
{
//Zelda common data initalization
osSyncPrintf("ゼルダ共通データ初期化\n");
SaveContext_Init();
gameState->running = false;
gameState->init = func_80800878; gameState->size = sizeof(TitleContext);
}
void TitleSetup_Destroy(GameState* gameState)
{
}
void TitleSetup_Init(GameState* gameState)
{
gameState->destroy = TitleSetup_Destroy;
TitleSetup_InitImpl(gameState);
}
+113
View File
@@ -0,0 +1,113 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
void Overlay_LoadGameState(GameStateOverlay* overlayEntry)
{
if (overlayEntry->loadedRamAddr != NULL)
{
// Translates to: "ALREADY LINKED"
osSyncPrintf("既にリンクされています\n");
return;
}
if (overlayEntry->vramStart == 0)
overlayEntry->unk_28 = 0;
else
{
overlayEntry->loadedRamAddr = Overlay_AllocateAndLoad(overlayEntry->vromStart, overlayEntry->vromEnd,
overlayEntry->vramStart, overlayEntry->vramEnd);
if (overlayEntry->loadedRamAddr == NULL)
{
// Translates to: "LOADING FAILED"
osSyncPrintf("ロードに失敗しました\n");
return;
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("OVL(d):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n",
overlayEntry->vramStart, overlayEntry->vramEnd,
overlayEntry->loadedRamAddr,
(u32)overlayEntry->loadedRamAddr + (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart,
(u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr,
"");
osSyncPrintf(VT_RST);
if (overlayEntry->unk_14 != NULL)
overlayEntry->unk_14 = (void*)((u32)overlayEntry->unk_14 -
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_14 = NULL;
if (overlayEntry->init != NULL)
overlayEntry->init = (void*)((u32)overlayEntry->init -
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->init = NULL;
if (overlayEntry->destroy != NULL)
overlayEntry->destroy = (void*)((u32)overlayEntry->destroy -
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->destroy = NULL;
if (overlayEntry->unk_20 != NULL)
overlayEntry->unk_20 = (void*)((u32)overlayEntry->unk_20 -
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_20 = NULL;
if (overlayEntry->unk_24 != NULL)
overlayEntry->unk_24 = (void*)((u32)overlayEntry->unk_24 -
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_24 = NULL;
overlayEntry->unk_28 = 0;
}
}
void Overlay_FreeGameState(GameStateOverlay* overlayEntry)
{
if (overlayEntry->loadedRamAddr != NULL)
{
s32 temp = overlayEntry->unk_28 != 0 ? -1 : 0;
if (temp == 0)
{
if (overlayEntry->unk_14 != NULL)
overlayEntry->unk_14 = (void*)((u32)overlayEntry->unk_14 +
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_14 = NULL;
if (overlayEntry->init != NULL)
overlayEntry->init = (void*)((u32)overlayEntry->init +
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->init = NULL;
if (overlayEntry->destroy != NULL)
overlayEntry->destroy = (void*)((u32)overlayEntry->destroy +
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->destroy = NULL;
if (overlayEntry->unk_20 != NULL)
overlayEntry->unk_20 = (void*)((u32)overlayEntry->unk_20 +
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_20 = NULL;
if (overlayEntry->unk_24 != NULL)
overlayEntry->unk_24 = (void*)((u32)overlayEntry->unk_24 +
(s32)((u32)overlayEntry->vramStart - (u32)overlayEntry->loadedRamAddr));
else
overlayEntry->unk_24 = NULL;
SystemArena_FreeDebug(overlayEntry->loadedRamAddr, "../z_DLF.c", 149);
overlayEntry->loadedRamAddr = NULL;
}
}
}
+6143
View File
File diff suppressed because it is too large Load Diff
+551
View File
@@ -0,0 +1,551 @@
#include <ultra64.h>
#include <global.h>
#include <initvars.h>
#define ACTOR_OVERLAY(name, allocType) \
{ \
(u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, \
_ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, \
NULL, &name##_InitVars, #name, allocType, 0 \
}
#define ACTOR_OVERLAY_INTERNAL(name, allocType) \
{ \
0, 0, \
NULL, NULL, \
NULL, &name##_InitVars, #name, allocType, 0 \
}
#define ACTOR_OVERLAY_UNSET { 0 }
ActorOverlay gActorOverlayTable[] =
{
ACTOR_OVERLAY_INTERNAL(Player, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Test, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_GirlA, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Part, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Light, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Door, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_Box, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Dy_Yoseizo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Firewall, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Poh, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Okuta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ydan_Sp, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bom, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_Wallmas, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dodongo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Firefly, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_INTERNAL(En_Item00, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Arrow, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Elf, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Niw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Tite, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Reeba, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Peehat, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Butte, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Insect, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fish, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Holl, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_Scene_Change, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zf, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Hata, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Dodongo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Goma, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zl1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Viewer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Goma, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Pushbox, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bubble, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Shutter, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_Dodojr, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bdfire, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Boom, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_Torch2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bili, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tp, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_St, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_INTERNAL(En_A_Obj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Eiyer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_River_Sound, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse_Normal, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ossan, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Treemouth, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Dodoago, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Dalm, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Hrock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse_Ganon, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Rock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Rsekizou, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Sekizou, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Sima, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Syoku, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Xc, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Curtain, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot00_Hanebasi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Mb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bombf, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zl2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Fslift, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_OE2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ydan_Hasi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ydan_Maruta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Ganondrof, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Am, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dekubaba, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_M_Fire1, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_M_Thunder, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(Bg_Ddan_Jd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Breakwall, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Jj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse_Zelda, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ddan_Kd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Warp1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Syokudai, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Item_B_Heart, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dekunuts, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Menkuri_Kaiten, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Menkuri_Eye, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Vali, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mizu_Movebg, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mizu_Water, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Arms_Hook, ALLOCTYPE_PERMANENT),
ACTOR_OVERLAY(En_fHG, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Hineri, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Toki_Hikari, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Yukabyun, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Toki_Swd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fhg_Fire, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mjin, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Kousi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Toki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Hamstep, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bird, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Wood02, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Lightbox, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Pu_box, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Trap, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Arow_Trap, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Vase, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Ta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tk, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Bigst, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Elevator, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Kaitenkabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Rakkatenjo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Vm, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Effect, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Kankyo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Hidan_Fwbig, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Floormas, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Heishi1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Rd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Po_Sisters, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Heavy_Block, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Po_Event, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Mure, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Sw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Fd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Object_Kankyo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Du, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse_Link_Child, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Ana, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot02_Objects, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Magic_Wind, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Magic_Fire, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Ru1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Fd2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fd_Fire, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dh, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dha, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Rl, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Encount1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Du, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Im, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Tre_Lgt, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Vb_Sima, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Vb_Ball, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Megane, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_MeganeBG, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Ship, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Sgami, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Heishi2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Encount2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fire_Rock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Brob, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Mir_Ray, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot09_Obj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot18_Obj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Va, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Tubo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Trap, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Huta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Zou, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot17_Funen, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Syateki_Itm, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Syateki_Man, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tana, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Nb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Mo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Sb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bigokuta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Karebaba, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Bdan_Objects, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Sa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Go, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_In, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tr, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot16_Bombstone, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Bg_Hidan_Kowarerukabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Bombwall, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot08_Iceblock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ru2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Dekujr, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mizu_Uzu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot06_Objects, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ice_Objects, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Water, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Ma2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bom_Chu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Horse_Game_Check, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Tw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Rr, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ba, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bx, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Anubice, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Anubice_Fire, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Hashigo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Hashira4, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mori_Idomizu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot16_Doughnut, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Bdan_Switch, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ma1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Ganon, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Sst, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Ny, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fr, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Item_Shield, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ice_Shelter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ice_Hono, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Item_Ocarina, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Magic_Dark, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Demo_6K, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Anubice_Tag, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Haka_Gate, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot15_Saku, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Goroiwa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Zurerukabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Bg_Jya_Cobra, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Kanaami, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Fishing, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Oshihiki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gate_Shutter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Eff_Dust, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot01_Fusya, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot01_Idohashira, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot01_Idomizu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Po_Syokudai, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ganon_Otyuka, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot15_Rrbox, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Umajump, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Arrow_Fire, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Arrow_Ice, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Arrow_Light, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Item_Etcetera, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Kibako, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Tsubo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Wonder_Item, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ik, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Ik, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Skj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Skjneedle, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_G_Switch, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Ext, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Shd, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dns, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Elf_Msg, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Honotrap, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tubo_Trap, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Ice_Poly, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot03_Taki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot07_Taki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fz, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Po_Relay, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Relay_Objects, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Diving_Game, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kusa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Bean, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Bombiwa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Obj_Switch, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Elevator, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Lift, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Hsblock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Okarina_Tag, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Yabusame_Mark, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Goroiwa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ex_Ruppy, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Toryo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Daiku, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Nwc, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Blkobj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Item_Inbox, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ge1, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Blockstop, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Sda, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Clear_Tag, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Niw_Lady, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Gm, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ms, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Hs, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ingate, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kanban, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Heishi3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Syateki_Niw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Attack_Niw, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot01_Idosoko, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Sa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Wonder_Talk, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gjyo_Bridge, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ds, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Mk, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bom_Bowl_Man, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Bom_Bowl_Pit, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Owl, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ishi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Hana, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Lightswitch, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Mure2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Go, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Fu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Changer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Megami, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Lift, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Bigmirror, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Bombchuiwa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Amishutter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Bombiwa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot18_Basket, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Ganon_Organ, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Siofuki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Stream, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Mm, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ko, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kz, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Weather_Tag, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Sst_Floor, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ani, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ex_Item, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Ironobj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Js, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Jsjutan, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Cs, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Md, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Hy, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ganon_Mant, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Okarina_Effect, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Mag, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Gerudo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Elf_Msg2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Gt, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Po_Field, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Efc_Erupc, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Zg, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Heishi4, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zl3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Boss_Ganon2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kakasi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Takara_Man, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Makeoshihiki, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Oceff_Spot, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(End_Title, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(En_Torch, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Ec, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Shot_Sun, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dy_Extra, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Wonder_Talk2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ge2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Roomtimer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ssh, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Sth, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Oceff_Wipe, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Oceff_Storm, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(En_Weiyer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot05_Soko, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_1flift, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Haheniron, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot12_Gate, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot12_Saku, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Hintnuts, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Nutsball, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot00_Break, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Shopnuts, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_It, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_GeldB, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Oceff_Wipe2, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(Oceff_Wipe3, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(En_Niw_Girl, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dog, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Si, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot01_Objects2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Comb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot11_Bakudankabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Kibako2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dnt_Demo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dnt_Jiji, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Dnt_Nomal, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Guest, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Bom_Guard, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Hs2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Kekkai, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot08_Bakudankabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot17_Bakudankabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY_UNSET,
ACTOR_OVERLAY(Obj_Mure3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Tg, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Mu, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Go2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Wf, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Skb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Gj, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Demo_Geff, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gnd_Firemeiro, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gnd_Darkmeiro, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gnd_Soulmeiro, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gnd_Nisekabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Gnd_Iceblock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Gb, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Gs, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mizu_Bwall, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Mizu_Shutter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Daiku_Kakariko, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Bowl_Wall, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Wall_Tubo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Po_Desert, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Crow, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Door_Killer, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot11_Oasis, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot18_Futa, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Spot18_Shutter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ma3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Cow, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ice_Turara, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Ice_Shutter, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kakasi2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Kakasi3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Oceff_Wipe4, ALLOCTYPE_ABSOLUTE),
ACTOR_OVERLAY(En_Eg, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Menkuri_Nisekabe, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zo, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Makekinsuta, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Ge3, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Timeblock, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Hamishi, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Zl4, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(En_Mm2, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Bg_Jya_Block, ALLOCTYPE_NORMAL),
ACTOR_OVERLAY(Obj_Warp2block, ALLOCTYPE_NORMAL),
};
s32 gMaxProfile = 0;
static FaultClient sFaultClient;
void ActorOverlayTable_LogPrint(void)
{
ActorOverlay* overlayEntry;
u32 i;
osSyncPrintf("actor_dlftbls %u\n", gMaxProfile);
osSyncPrintf("RomStart RomEnd SegStart SegEnd allocp profile segname\n");
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++)
{
osSyncPrintf("%08x %08x %08x %08x %08x %08x %s\n",
overlayEntry->vromStart, overlayEntry->vromEnd,
overlayEntry->vramStart, overlayEntry->vramEnd,
overlayEntry->loadedRamAddr, &overlayEntry->initInfo->id,
overlayEntry->name != NULL ? overlayEntry->name : "?");
}
}
void ActorOverlayTable_FaultPrint(void* arg0, void* arg1)
{
ActorOverlay* overlayEntry;
u32 overlaySize;
s32 i;
FaultDrawer_SetCharPad(-2, 0);
FaultDrawer_Printf("actor_dlftbls %u\n", gMaxProfile);
FaultDrawer_Printf("No. RamStart- RamEnd cn Name\n");
for (i = 0, overlayEntry = &gActorOverlayTable[0]; i < gMaxProfile; i++, overlayEntry++)
{
overlaySize = (u32)overlayEntry->vramEnd - (u32)overlayEntry->vramStart;
if (overlayEntry->loadedRamAddr != NULL)
{
FaultDrawer_Printf("%3d %08x-%08x %3d %s\n",
i, overlayEntry->loadedRamAddr, (u32)overlayEntry->loadedRamAddr + overlaySize,
overlayEntry->nbLoaded, overlayEntry->name != NULL ? overlayEntry->name : "");
}
}
}
void ActorOverlayTable_Init(void)
{
gMaxProfile = ACTOR_DLF_MAX;
Fault_AddClient(&sFaultClient, ActorOverlayTable_FaultPrint, NULL, NULL);
}
void ActorOverlayTable_Cleanup(void)
{
Fault_RemoveClient(&sFaultClient);
gMaxProfile = 0;
}
+454
View File
@@ -0,0 +1,454 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038600.s")
void func_80038708(s16* puParm1, s16* puParm2, u16 uParm3)
{
*puParm1 = *puParm2;
puParm1[1] = uParm3;
}
void func_8003871C(u16* puParm1)
{
*puParm1 = 0xFFFF;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038728.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038780.s")
void func_800387FC(u32 uParm1, u32* puParm2)
{
*puParm2 = 0;
puParm2[1] = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003880C.s")
void func_80038870(int iParm1)
{
*(u32*)(iParm1 + 4) = 0;
}
u32 func_80038878(s32 iParm1)
{
u32 uVar1;
uVar1 = *(u32*)(iParm1 + 4) & 0xffff;
*(int *)(iParm1 + 4) = *(u32*)(iParm1 + 4) + 1;
if (*(int *)(iParm1 + 8) <= (int)uVar1)
{
return 0xffff;
}
return uVar1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800388A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800388E8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038924.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800389D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038A28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038B7C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038BE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038C78.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038D48.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038E78.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038F20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80038F60.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80039000.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800390A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003937C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80039448.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003965C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800396F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003992C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80039A3C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80039AEC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003A3E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003A5B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003A7D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003A95C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003AB28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003AC54.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003AD00.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003ADC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003AEA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003B04C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003B218.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003B3C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003BB18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003BF18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003BF5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003BFF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C078.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/T_BGCheck_getBGDataInfo.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C55C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C614.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C890.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C8EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C940.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003C9A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003CA0C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003CA64.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003CB30.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003CCA4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003CDD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D464.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D52C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D594.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D600.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D7A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003D7F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003DD28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003DD6C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003DFA0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E02C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E0B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E0FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E188.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E214.s")
void func_8003E398(u16* puParm1)
{
*puParm1 = 0;
puParm1[1] = 0;
*(u32*)(puParm1 + 2) = 0;
*(u32*)(puParm1 + 4) = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E3AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E4DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E530.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E568.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E5B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E688.s")
void func_8003E6C4(u16* puParm1)
{
*puParm1 = 0;
func_8003E688();
}
void func_8003E6E4(u16* a0)
{
*a0 = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E6EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E750.s")
void func_8003E804(int iParm1)
{
func_8003E5B4(iParm1 + 0x14, iParm1 + 0x34);
}
void func_8003E82C(u32* a0)
{
*a0 = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E834.s")
void func_8003E888(u32* a0)
{
*a0 = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E890.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E8EC.s")
/*
NON-MATCHING
void func_8003E8EC(u32 uParm1, u32* iParm2)
{
iParm2[0x06] = iParm2[0x0E];
iParm2[0x05] = iParm2[0x0D];
iParm2[0x07] = iParm2[0x0F];
iParm2[0x08] = iParm2[0x10];
iParm2[0x0A] = iParm2[0x12];
iParm2[0x09] = iParm2[0x11];
iParm2[0x0B] = iParm2[0x13];
iParm2[0x0C] = iParm2[0x14];
//int i;
//for (i = 0; i < 4; i++)
//{
//iParm2[0x06 + (i * 2)] = iParm2[0x0E + (i * 2)];
//iParm2[0x07 + (i * 2)] = iParm2[0x0D + (i * 2)];
//}
}
*/
u32 func_8003E934(int iParm1)
{
if (!((-1 < iParm1) && (iParm1 < 0x32)))
return 0;
return 1;
}
void func_8003E954(u32 uParm1, u8* puParm2)
{
*puParm2 = 1;
func_8003E82C(puParm2 + 0x13f0);
func_8003E888(puParm2 + 0x13f4);
func_800387FC(uParm1, puParm2 + 0x13f8);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003E9A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003EA74.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003EB84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003ECA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003ED58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003EE6C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003EE80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003F8EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003F984.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003FB64.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003FBF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8003FDDC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80040284.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800409A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80040BE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80040E40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80040FA4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041128.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041240.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800413F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041510.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041648.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800417A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041880.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800418D0.s")
#ifdef NON_MATCHING
void func_80041978(int iParm1, int iParm2)
{
u8* puVar1;
puVar1 = *(u8 **)(iParm1 + 8);
if (puVar1 < puVar1 + iParm2)
{
*puVar1 = 0;
while (puVar1++ < (u8*)(*(int *)(iParm1 + 8) + iParm2))
{
*puVar1 = 0;
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041978.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800419B0.s")
u32 func_80041A28(CollisionContext *a0, u32 a1, u32 a2)
{
u32 uVar1;
uVar1 = func_800419B0(a0, a1, a2, 0);
return uVar1 & 0xff;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041A4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041B24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041B80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041C10.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041C98.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041D28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041D4C.s")
u32 func_80041D94(u32 a0, u32 a1, u32 a2)
{
u32 uVar1;
uVar1 = func_800419B0(a0, a1, a2, 0);
return uVar1 >> 0x15 & 0x1f;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041DB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041DE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041E18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041E4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041EC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041EEC.s")
u32 func_80041F10(u32 a0, u32 a1, u32 a2)
{
u32 uVar1;
uVar1 = func_800419B0(a0, a1, a2, 1);
return uVar1 & 0xf;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041F34.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041F7C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041FA0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80041FC4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8004200C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042048.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042084.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800420E4.s")
u32 func_80042108(u32 a0, u32 a1, u32 a2)
{
u32 result;
s32 var1;
var1 = func_800419B0(a0, a1, a2, 1);
if (var1 << 4 < 0)
result = 1;
else
result = 0;
return result;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8004213C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042244.s")
u8 func_80042538(CollisionContext *colCtx, s32 iParm2)
{
u32 var1 = *(u32*)(iParm2 + 0xc);
return var1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042548.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_8004259C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_800427B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042868.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042B2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042C3C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042CB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042EF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_bgcheck/func_80042FC4.s")
+1252
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_btltbls/CollisionBtlTbl_Get.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_btltbls/func_8005B248.s")
+427
View File
@@ -0,0 +1,427 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B280.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B2AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B65C.s")
s32 func_8005B6A0(GlobalContext* globalCtx, Collider* collision)
{
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B6B0.s")
s32 func_8005B6EC(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src)
{
collision->actor = actor;
collision->unk_14 = src->unk_00;
collision->colliderFlags = src->colliderFlags;
collision->collideFlags = src->collideFlags;
collision->maskA = src->maskA;
collision->maskB = 0x10;
collision->type = src->maskB;
return 1;
}
s32 func_8005B72C(GlobalContext* globalCtx, Collider* collision, Actor* actor, ColliderBodyInfo* src)
{
collision->actor = actor;
collision->unk_14 = src->unk_00;
collision->colliderFlags = src->colliderFlags;
collision->collideFlags = src->collideFlags;
collision->maskA = src->maskA;
collision->maskB = src->maskB;
collision->type = src->type;
return 1;
}
void func_8005B76C(GlobalContext* globalCtx, Collider* collision)
{
collision->at = NULL;
collision->colliderFlags &= ~0x6;
}
void func_8005B784(GlobalContext* globalCtx, Collider* collision)
{
collision->ac = NULL;
collision->collideFlags &= ~0x82;
}
void func_8005B79C(GlobalContext* globalCtx, Collider* collision)
{
collision->ot = NULL;
collision->maskA &= ~0x2;
collision->maskB &= ~0x1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7C0.s")
s32 func_8005B7E4(GlobalContext* globalCtx, ColliderTouch* touch)
{
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B7F4.s")
void func_8005B818(GlobalContext* globalCtx, ColliderBody* body)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B824.s")
s32 func_8005B850(GlobalContext* globalCtx, ColliderBump* bump)
{
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B860.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005B884.s")
s32 func_8005B904(GlobalContext* globalCtx, ColliderBody* body)
{
func_8005B7E4(globalCtx, &body->toucher);
func_8005B850(globalCtx, &body->bumper);
return 1;
}
s32 func_8005B93C(GlobalContext* globalCtx, ColliderBody* body, ColliderBodyInfoInner* bodyInfoInner)
{
body->flags = bodyInfoInner->bodyFlags;
func_8005B7F4(globalCtx, &body->toucher, &bodyInfoInner->toucherMask);
func_8005B860(globalCtx, &body->bumper, &bodyInfoInner->bumperMask);
body->toucherFlags = bodyInfoInner->toucherFlags;
body->bumperFlags = bodyInfoInner->bumperFlags;
body->flags2 = bodyInfoInner->bodyFlags2;
return 1;
}
void func_8005B9B0(GlobalContext* globalCtx, ColliderBody* body)
{
body->unk_18 = 0;
body->unk_20 = 0;
body->toucherFlags &= ~0x2;
body->toucherFlags &= ~0x40;
func_8005B818(globalCtx, body);
}
void func_8005B9E8(GlobalContext* globalCtx, ColliderBody* body)
{
body->bumper.unk_0A = 0;
body->bumperFlags &= ~0x2;
body->bumperFlags &= ~0x80;
body->colBuf = NULL;
body->colliding = NULL;
body->bumper.unk_08 = body->bumper.unk_0A;
body->bumper.unk_06 = body->bumper.unk_0A;
}
void func_8005BA1C(GlobalContext* globalCtx, ColliderBody* body)
{
body->flags2 &= ~0x2;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BA30.s")
s32 func_8005BA74(UNK_TYPE arg0, UNK_TYPE arg1)
{
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BA84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BAD8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB10.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB48.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BB8C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBB0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BBF8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BC28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BCC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005BE50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C050.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C2BC.s")
s32 func_8005C318(GlobalContext* globalCtx, ColliderDimensions* dim)
{
return 1;
}
s32 func_8005C328(GlobalContext* globalCtx, ColliderDimensions* dest, ColliderDimensions* src)
{
*dest = *src;
return 1;
}
s32 ActorCollider_AllocCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B65C(globalCtx, &collision->base);
func_8005B884(globalCtx, &collision->body);
func_8005C2BC(globalCtx, &collision->dim);
return 1;
}
s32 ActorCollider_FreeCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B6A0(globalCtx, &collision->base);
func_8005B904(globalCtx, &collision->body);
func_8005C318(globalCtx, &collision->dim);
return 1;
}
s32 func_8005C3F4(GlobalContext* globalCtx, ColliderCylinderMain* collision, ColliderCylinderInit* src)
{
func_8005B6B0(globalCtx, &collision->base, &src->body);
func_8005B93C(globalCtx, &collision->body, &src->inner);
func_8005C328(globalCtx, &collision->dim, &src->dim);
return 1;
}
s32 func_8005C450(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src)
{
func_8005B6EC(globalCtx, &collision->base, actor, &src->body);
func_8005B93C(globalCtx, &collision->body, &src->inner);
func_8005C328(globalCtx, &collision->dim, &src->dim);
return 1;
}
s32 ActorCollider_InitCylinder(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src)
{
func_8005B72C(globalCtx, &collision->base, actor, &src->body);
func_8005B93C(globalCtx, &collision->body, &src->inner);
func_8005C328(globalCtx, &collision->dim, &src->dim);
return 1;
}
s32 func_8005C508(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B76C(globalCtx, &collision->base);
func_8005B9B0(globalCtx, &collision->body);
return 1;
}
s32 func_8005C540(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B784(globalCtx, &collision->base);
func_8005B9E8(globalCtx, &collision->body);
return 1;
}
s32 func_8005C578(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B79C(globalCtx, &collision->base);
func_8005BA1C(globalCtx, &collision->body);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C5B0.s")
s32 func_8005C5F8(UNK_TYPE arg0, UNK_TYPE arg1)
{
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C608.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C6C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C6F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C730.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C774.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C798.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C7BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C7E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005C8C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CBAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CE6C.s")
s32 func_8005CEB4(GlobalContext* globalCtx, ColliderDimensions* dim) {
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CEC4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CEDC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005CF90.s")
s32 func_8005D018(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B65C(globalCtx, &collision->base);
func_8005B884(globalCtx, &collision->body);
func_8005CE6C(globalCtx, &collision->dim);
return 1;
}
s32 func_8005D060(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B6A0(globalCtx, &collision->base);
func_8005B904(globalCtx, &collision->body);
func_8005CEB4(globalCtx, &collision->dim);
return 1;
}
s32 func_8005D0A8(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src)
{
func_8005B6EC(globalCtx, &collision->base, actor, &src->body);
func_8005B93C(globalCtx, &collision->body, &src->inner);
func_8005CF90(globalCtx, &collision->dim, &src->dim);
return 1;
}
s32 func_8005D104(GlobalContext* globalCtx, ColliderCylinderMain* collision, Actor* actor, ColliderCylinderInit* src)
{
func_8005B72C(globalCtx, &collision->base, actor, &src->body);
func_8005B93C(globalCtx, &collision->body, &src->inner);
func_8005CF90(globalCtx, &collision->dim, &src->dim);
return 1;
}
s32 func_8005D160(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B76C(globalCtx, &collision->base);
func_8005B9B0(globalCtx, &collision->body);
func_8005CEC4(globalCtx, &collision->dim);
return 1;
}
s32 func_8005D1A8(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B784(globalCtx, &collision->base);
func_8005B9E8(globalCtx, &collision->body);
return 1;
}
s32 func_8005D1E0(GlobalContext* globalCtx, ColliderCylinderMain* collision)
{
func_8005B79C(globalCtx, &collision->base);
func_8005BA1C(globalCtx, &collision->body);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D218.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D334.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D3A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D3BC.s")
void func_8005D400(UNK_TYPE arg0, UNK_TYPE arg1)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D40C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D4DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D62C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D79C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005D9F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DC4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DF74.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005DFAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E2EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E4F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E604.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E800.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8005E81C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800611A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061274.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006139C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006146C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800614A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_8006199C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061BF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061C18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061C98.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061E48.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061E8C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061ED4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061EFC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80061F64.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800622E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062530.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800626B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800626DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062734.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800627A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800628A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062A28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062B80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062CD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062D60.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062DAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062DF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062E14.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062ECC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_800635D0.s")
+21
View File
@@ -0,0 +1,21 @@
#include <ultra64.h>
#include <global.h>
void SaveContext_Init(void)
{
bzero(&gSaveContext, sizeof(gSaveContext));
D_8015FA88 = 0;
D_8015FA8C = 0;
gSaveContext.seq_index = 0xFF;
gSaveContext.night_sfx = 0xFF;
gSaveContext.unk_140E = 0;
gSaveContext.next_cutscene_index = 0xFFEF;
gSaveContext.cutscene_trigger = 0;
gSaveContext.chamber_cutscene_num = 0;
gSaveContext.next_day_time = 0xFFFF;
gSaveContext.environment_time = 0;
gSaveContext.unk_141C = 1;
gSaveContext.transition_type = 0xFF;
gSaveContext.unk_13EE = 50;
}
+624
View File
@@ -0,0 +1,624 @@
#include <ultra64.h>
#include <global.h>
void func_80110990(GlobalContext* globalCtx)
{
func_80080F44(globalCtx);
}
#ifdef NON_MATCHING
// regalloc, stack usage and minor ordering differences
void func_801109B0(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s32 parameterStart;
s32 parameterSize;
s32 do_actionStart;
s32 do_actionOffset;
s32 temp;
gSaveContext.unk_1422 = 0;
gSaveContext.unk_13EA = 0;
gSaveContext.unk_13E8 = 0;
func_800AA278(&interfaceCtx->view, globalCtx->state.gfxCtx);
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = 0;
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
interfaceCtx->unk_1F0 = 0;
interfaceCtx->unk_22E = 0;
interfaceCtx->unk_230 = 16;
interfaceCtx->unk_1F4 = 0.0f;
interfaceCtx->unk_228 = XREG(95);
interfaceCtx->minimapAlpha = 0;
interfaceCtx->unk_260 = 0;
interfaceCtx->unk_244 = interfaceCtx->aAlpha = interfaceCtx->bAlpha =
interfaceCtx->cLeftAlpha = interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha =
interfaceCtx->healthAlpha = interfaceCtx->startAlpha = interfaceCtx->magicAlpha = 0;
parameterStart = _parameter_staticSegmentRomStart;
parameterSize = _parameter_staticSegmentRomEnd - parameterStart;
// Translates to: "Permanent PARAMETER Segment = %x"
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
interfaceCtx->parameterSegment = Game_Alloc(&globalCtx->state, parameterSize, "../z_construct.c", 159);
osSyncPrintf("parameter->parameterSegment=%x", interfaceCtx->parameterSegment);
if (interfaceCtx->parameterSegment == NULL)
__assert("parameter->parameterSegment != NULL", "../z_construct.c", 161);
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, parameterStart, parameterSize, "../z_construct.c", 162);
interfaceCtx->do_actionSegment = Game_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
// Translates to: "DO Action Texture Initialization"
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480);
osSyncPrintf("parameter->do_actionSegment=%x", interfaceCtx->do_actionSegment);
if (interfaceCtx->do_actionSegment == NULL)
__assert("parameter->do_actionSegment != NULL", "../z_construct.c", 169);
do_actionStart = _do_action_staticSegmentRomStart;
if (gSaveContext.language == 0)
do_actionOffset = 0;
else if (gSaveContext.language == 1)
do_actionOffset = 0x2B80;
else
do_actionOffset = 0x5700;
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, do_actionStart + do_actionOffset, 0x300, "../z_construct.c", 174);
if (gSaveContext.language == 0)
do_actionOffset = 0x480;
else if (gSaveContext.language == 1)
do_actionOffset = 0x3000;
else
do_actionOffset = 0x5B80;
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300), do_actionStart + do_actionOffset, 0x180, "../z_construct.c", 178);
interfaceCtx->icon_itemSegment = Game_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
// Translates to: "Icon Item Texture Initialization = %x"
osSyncPrintf("アイコンアイテム テクスチャ初期=%x\n", 0x4000);
osSyncPrintf("parameter->icon_itemSegment=%x\n", interfaceCtx->icon_itemSegment);
if (interfaceCtx->icon_itemSegment == NULL)
__assert("parameter->icon_itemSegment != NULL", "../z_construct.c", 193);
osSyncPrintf("Register_Item[%x, %x, %x, %x]\n",
gSaveContext.equips.button_items[0], gSaveContext.equips.button_items[1],
gSaveContext.equips.button_items[2], gSaveContext.equips.button_items[3]);
if (gSaveContext.equips.button_items[0] < 0xF0)
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80,
0x1000, "../z_construct.c", 198);
else if (gSaveContext.equips.button_items[0] != 0xFF)
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[0] * 0x80,
0x1000, "../z_construct.c", 203);
if (gSaveContext.equips.button_items[1] < 0xF0)
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x1000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[1] * 0x80,
0x1000, "../z_construct.c", 209);
if (gSaveContext.equips.button_items[2] < 0xF0)
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x2000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[2] * 0x80,
0x1000, "../z_construct.c", 214);
if (gSaveContext.equips.button_items[3] < 0xF0)
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x3000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.button_items[3] * 0x80,
0x1000, "../z_construct.c", 219);
osSyncPrintf("EVENT=%d\n", gSaveContext.timer_1_state);
if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8) ||
(gSaveContext.timer_2_state == 4) || (gSaveContext.timer_2_state == 10))
{
osSyncPrintf("restart_flag=%d\n", gSaveContext.respawn_flag);
if ((gSaveContext.respawn_flag == -1) || (gSaveContext.respawn_flag == 1))
{
if (gSaveContext.timer_1_state == 4)
{
gSaveContext.timer_1_state = 1;
gSaveContext.timer_x[0] = 140;
gSaveContext.timer_y[0] = 80;
}
}
if ((gSaveContext.timer_1_state == 4) || (gSaveContext.timer_1_state == 8))
temp = 0;
else
temp = 1;
gSaveContext.timer_x[temp] = 26;
if (gSaveContext.health_capacity > 0xA0)
gSaveContext.timer_y[temp] = 54;
else
gSaveContext.timer_y[temp] = 46;
}
if ((gSaveContext.timer_1_state >= 11) && (gSaveContext.timer_1_state < 16))
{
gSaveContext.timer_1_state = 0;
// Translates to: "Timer Stop!!!!!!!!!!!!!!!!!!!!!!"
osSyncPrintf("タイマー停止!!!!!!!!!!!!!!!!!!!!! = %d\n", gSaveContext.timer_1_state);
}
// Translates to: "Parameter Area = %x"
osSyncPrintf("PARAMETER領域=%x\n", parameterSize + 0x5300);
Health_InitData(globalCtx);
func_80080F68(globalCtx);
interfaceCtx->unk_242 = 0;
interfaceCtx->unk_23C = 0;
R_ITEM_BTN_X(0) = 160;
R_B_BTN_COLOR(0) = 0xFF;
R_B_BTN_COLOR(1) = 0x1E;
R_B_BTN_COLOR(2) = 0x1E;
R_ITEM_ICON_X(0) = 160;
R_ITEM_AMMO_X(0) = 162;
R_A_BTN_X = 186;
R_A_ICON_X = 186;
R_A_BTN_COLOR(0) = 0x00;
R_A_BTN_COLOR(1) = 0xC8;
R_A_BTN_COLOR(2) = 0x32;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_construct/func_801109B0.s")
#endif
void func_80110F68(GlobalContext* globalCtx)
{
MessageContext* msgCtx = &globalCtx->msgCtx;
s32 pad;
func_8011040C();
globalCtx->msgCtx.unk_E3EE = 0;
msgCtx->msgMode = 0;
msgCtx->unk_E300 = 0;
msgCtx->unk_E2F8 = msgCtx->unk_E3E4 = msgCtx->choiceIndex = msgCtx->unk_E3F0 = msgCtx->unk_E3D6 = 0;
msgCtx->unk_E3E2 = 0xFF;
func_800AA278(&msgCtx->view, globalCtx->state.gfxCtx);
msgCtx->textboxSegment = Game_Alloc(&globalCtx->state, 0x2200, "../z_construct.c", 349);
osSyncPrintf("message->fukidashiSegment=%x\n", msgCtx->textboxSegment);
// Translates to: "Textbox game_alloc=%x"
osSyncPrintf("吹き出しgame_alloc=%x\n", 0x2200);
if (msgCtx->textboxSegment == NULL)
__assert("message->fukidashiSegment != NULL", "../z_construct.c", 352);
func_8006EF10(&globalCtx->msgCtx.unk_128);
YREG(31) = 0;
}
void func_80111070(void)
{
YREG(8) = 0xA;
YREG(14) = 0;
YREG(15) = 0;
YREG(16) = 0;
YREG(17) = 0;
YREG(22) = 0x32;
YREG(23) = 0;
YREG(24) = -0x3C;
YREG(25) = 0xD;
YREG(26) = 0xF;
YREG(27) = 0x29;
YREG(28) = 0xF;
YREG(32) = 0x109;
YREG(33) = 0x37;
YREG(34) = 0;
YREG(35) = 0x14;
YREG(36) = 0;
YREG(37) = 0;
YREG(38) = 0;
YREG(40) = 2;
YREG(41) = 1;
YREG(42) = 2;
YREG(43) = 1;
YREG(44) = 0;
YREG(45) = 0xEC;
YREG(46) = 0x24;
YREG(47) = 0;
YREG(48) = -0x2D;
YREG(49) = -0x30;
YREG(50) = 0x10;
YREG(51) = 0x16;
YREG(52) = -0x37;
YREG(53) = -0x35;
YREG(54) = 0x2B;
YREG(55) = 0x2F;
YREG(56) = -0x21;
YREG(57) = -0x2A;
YREG(58) = -0x21;
YREG(59) = -0x25;
YREG(60) = 0xE;
YREG(61) = -2;
YREG(62) = -2;
YREG(63) = -0x12;
YREG(64) = -0x12;
YREG(67) = 0;
YREG(68) = 0;
YREG(69) = 0;
YREG(70) = 0;
YREG(71) = -6;
YREG(72) = 0xA;
YREG(73) = -8;
YREG(74) = 8;
YREG(75) = 0x18;
YREG(76) = 0x20;
YREG(77) = 0;
YREG(78) = 0;
YREG(79) = 0x30;
YREG(80) = 0x1C2;
YREG(81) = 0;
YREG(82) = -0xF;
YREG(83) = 0x1F4;
YREG(84) = 0x258;
YREG(85) = 0;
YREG(86) = -0x15;
YREG(87) = 0x1FE;
R_C_UP_ICON_X = 0xF7;
R_C_UP_ICON_Y = 0x14;
YREG(92) = 8;
YREG(93) = 6;
YREG(94) = 3;
YREG(95) = 1;
R_MAGIC_FILL_COLOR(0) = 0;
R_MAGIC_FILL_COLOR(1) = 0xC8;
R_MAGIC_FILL_COLOR(2) = 0;
ZREG(9) = 0x8C;
ZREG(10) = 0xC8;
ZREG(11) = 0;
ZREG(12) = 0xC8;
ZREG(13) = 0;
ZREG(14) = 0x6E;
ZREG(15) = 0x38;
ZREG(16) = 1;
ZREG(17) = -0x32;
ZREG(18) = -0xC8;
ZREG(19) = 0;
ZREG(20) = 0;
ZREG(21) = 0x32;
ZREG(22) = -0x32;
ZREG(23) = 0x14;
ZREG(24) = 0x14;
ZREG(25) = 4;
ZREG(26) = 0x14;
ZREG(27) = 0xA;
ZREG(28) = 0x14;
ZREG(29) = 4;
ZREG(30) = 0x14;
ZREG(31) = 0xA;
ZREG(32) = 0;
ZREG(33) = 0;
ZREG(34) = 0;
ZREG(36) = 0;
ZREG(37) = 0;
ZREG(38) = 0;
R_C_BTN_COLOR(0) = 0xFF;
R_C_BTN_COLOR(1) = 0xA0;
R_C_BTN_COLOR(2) = 0;
ZREG(46) = 1;
ZREG(47) = 1;
R_START_LABEL_DD(0) = 0x64;
R_START_LABEL_DD(1) = 0x59;
R_START_LABEL_DD(2) = 0x5C;
R_START_LABEL_Y(0) = 0x14;
R_START_LABEL_Y(1) = 0x14;
R_START_LABEL_Y(2) = 0x14;
R_START_LABEL_X(0) = 0x78;
R_START_LABEL_X(1) = 0x77;
R_START_LABEL_X(2) = 0x77;
ZREG(61) = 1;
R_C_UP_BTN_X = 0xFE;
R_C_UP_BTN_Y = 0x10;
ZREG(64) = 0x14;
ZREG(65) = 0x15;
ZREG(66) = 0x7A;
R_ITEM_BTN_X(1) = 0xE3;
R_ITEM_BTN_X(2) = 0xF9;
R_ITEM_BTN_X(3) = 0x10F;
R_ITEM_BTN_Y(0) = 0x11;
R_ITEM_BTN_Y(1) = 0x12;
R_ITEM_BTN_Y(2) = 0x22;
R_ITEM_BTN_Y(3) = 0x12;
R_ITEM_BTN_DD(0) = 0x23F;
R_ITEM_BTN_DD(1) = 0x26C;
R_ITEM_BTN_DD(2) = 0x26C;
R_ITEM_BTN_DD(3) = 0x26C;
R_ITEM_ICON_X(1) = 0xE3;
R_ITEM_ICON_X(2) = 0xF9;
R_ITEM_ICON_X(3) = 0x10F;
R_ITEM_ICON_Y(0) = 0x11;
R_ITEM_ICON_Y(1) = 0x12;
R_ITEM_ICON_Y(2) = 0x22;
R_ITEM_ICON_Y(3) = 0x12;
R_ITEM_ICON_DD(0) = 0x226;
R_ITEM_ICON_DD(1) = 0x2A8;
R_ITEM_ICON_DD(2) = 0x2A8;
R_ITEM_ICON_DD(3) = 0x2A8;
ZREG(94) = 1;
ZREG(95) = 0;
XREG(0) = 0x1A;
XREG(1) = 0x16;
XREG(2) = -0xB;
XREG(3) = -4;
XREG(4) = 3;
XREG(5) = 0;
XREG(6) = 2;
XREG(7) = 0x1E;
XREG(8) = 0xA;
XREG(9) = 0;
XREG(10) = -0x254E;
XREG(11) = 0x26DE;
XREG(12) = 0x44;
XREG(13) = 0x24;
XREG(14) = 4;
XREG(15) = 1;
R_A_BTN_Y = 9;
XREG(18) = -0x17C;
R_A_ICON_Y = 9;
XREG(21) = 0x30;
XREG(25) = 0;
XREG(26) = 0;
XREG(27) = 0;
XREG(28) = 0x10;
XREG(29) = 0x32;
XREG(30) = 0xF;
XREG(31) = 8;
XREG(32) = 4;
XREG(33) = 2;
XREG(34) = 0x64;
XREG(35) = 7;
XREG(36) = 0x14;
XREG(37) = 0xA;
XREG(38) = 2;
XREG(39) = 0x8C;
XREG(40) = 0x14;
XREG(41) = 0x12C;
XREG(42) = 0x64;
XREG(43) = 0x46;
XREG(44) = 0x32;
XREG(45) = 0x24;
XREG(46) = 0x10;
XREG(47) = 8;
R_MAGIC_BAR_SMALL_Y = 0x22;
R_MAGIC_BAR_X = 0x12;
R_MAGIC_BAR_LARGE_Y = 0x2A;
R_MAGIC_FILL_X = 0x1A;
XREG(52) = 0;
XREG(53) = 1;
XREG(54) = 0x41;
XREG(55) = 0x3C;
XREG(56) = 0x10;
XREG(57) = 0x50;
XREG(58) = 0x50;
XREG(59) = 0xC;
XREG(60) = 1;
XREG(61) = 3;
XREG(62) = 0;
XREG(63) = 0x64;
XREG(64) = 0x9E;
XREG(65) = 0x66;
XREG(66) = 0x30;
XREG(67) = 0x36;
XREG(68) = 0x46;
XREG(69) = 0x56;
XREG(70) = -0x12C;
XREG(71) = 0;
XREG(72) = 0x36;
XREG(73) = 0x30;
XREG(74) = 0x80;
XREG(75) = 0x40;
XREG(76) = 0x800;
XREG(77) = 0x200;
XREG(78) = 0x60;
XREG(79) = 0x62;
XREG(80) = 0;
XREG(81) = 0x32;
XREG(82) = 0x19;
XREG(83) = 0x64;
XREG(84) = 0x64;
XREG(85) = 0;
XREG(86) = 0;
XREG(87) = 0;
XREG(88) = -0x32;
XREG(89) = -0x64;
XREG(90) = -0x1F4;
XREG(91) = 0;
XREG(92) = 0x64;
XREG(93) = 0x64;
XREG(94) = 0xA0;
XREG(95) = 0xC8;
WREG(2) = -0x17C0;
WREG(3) = 0x248B;
WREG(4) = 8;
WREG(5) = 3;
WREG(6) = 8;
WREG(7) = 0;
WREG(8) = 0x64;
WREG(9) = 0x6D;
WREG(10) = 0x97;
WREG(11) = 0x94;
WREG(12) = 0x17;
WREG(13) = 0x16;
WREG(14) = -0x17C;
WREG(15) = -0x15E;
WREG(16) = -0xAF;
WREG(17) = 0x9B;
WREG(18) = 0xA;
WREG(19) = 0xA;
WREG(20) = -0x32;
WREG(21) = -0x36;
WREG(22) = -0x20;
WREG(23) = -0x26;
WREG(24) = -0x24;
WREG(25) = 0x28;
WREG(26) = -0x28;
WREG(27) = 0;
WREG(28) = 0;
WREG(29) = 0xEE;
WREG(30) = 0xA4;
WREG(31) = 0;
WREG(32) = 0x7A;
WREG(33) = 0x3C;
WREG(35) = 0;
WREG(36) = 0;
WREG(37) = 0x64;
WREG(38) = 0x63;
WREG(39) = 0x6D;
R_B_LABEL_X(0) = 0x97;
R_B_LABEL_X(1) = 0x95;
R_B_LABEL_X(2) = 0x94;
R_B_LABEL_Y(0) = 0x17;
R_B_LABEL_Y(1) = 0x16;
R_B_LABEL_Y(2) = 0x16;
WREG(46) = -0x17C;
WREG(47) = -0x168;
WREG(48) = -0x15E;
WREG(49) = -0x30;
WREG(50) = 0x10;
WREG(51) = -0x3E;
WREG(52) = 0x16;
WREG(53) = -0x54;
WREG(54) = 0x14;
WREG(55) = -0x35;
WREG(56) = 0x28;
WREG(57) = -0x40;
WREG(58) = 0x2F;
WREG(59) = -0x54;
WREG(60) = 0x2C;
WREG(61) = -0x2A;
WREG(62) = 0x20;
WREG(63) = -0x2D;
WREG(64) = -0x25;
WREG(65) = 0x1E;
WREG(66) = -0x32;
WREG(68) = 0xCC;
WREG(69) = 0x8C;
WREG(87) = 0x50;
WREG(88) = 0x46;
WREG(89) = 0x28;
WREG(90) = 0x140;
WREG(91) = 0x28;
WREG(92) = 3;
WREG(93) = 6;
WREG(94) = 3;
WREG(95) = 6;
if (gSaveContext.game_mode == 0)
{
VREG(0) = 0x34;
VREG(1) = 0x24;
VREG(2) = 0xD6;
VREG(3) = 0x4C;
VREG(4) = 0x130;
VREG(5) = 0x1AE;
VREG(6) = 1;
VREG(7) = 0x4E;
VREG(8) = 0xA6;
VREG(9) = 0x28;
VREG(14) = 0x20;
VREG(15) = 0x20;
VREG(16) = 0x6E;
VREG(17) = -0x2E4;
VREG(18) = 0;
VREG(19) = 0xFF;
VREG(20) = 0xFF;
}
VREG(21) = 0;
VREG(22) = 0;
VREG(23) = 0;
VREG(24) = 0;
VREG(25) = 0;
VREG(26) = 0;
VREG(27) = 0;
VREG(28) = 0x62;
VREG(29) = 0x12;
VREG(30) = 0;
VREG(31) = 0;
VREG(32) = 0;
VREG(33) = 0x46;
VREG(34) = 0xFF;
VREG(35) = 0x50;
VREG(36) = 0x46;
VREG(37) = 0xFF;
VREG(38) = 0x50;
VREG(40) = 9;
VREG(42) = 0xFA;
VREG(43) = 0x1B8;
VREG(44) = 0xA;
VREG(45) = 0xBE;
VREG(46) = 0xB8;
VREG(47) = 0xB0;
VREG(48) = 0xAC;
VREG(49) = 0xAA;
VREG(50) = 0x1E;
VREG(51) = 0;
VREG(52) = -0x10;
VREG(53) = 0xE6;
VREG(54) = 0xE6;
VREG(55) = 0x78;
VREG(56) = -0x2D0;
VREG(57) = 0xFF;
VREG(58) = 0xFF;
VREG(59) = 0xFF;
VREG(60) = 0x14;
VREG(61) = 0x64;
VREG(62) = 0;
VREG(63) = 0xA;
R_ITEM_AMMO_X(1) = 0xE4;
R_ITEM_AMMO_X(2) = 0xFA;
R_ITEM_AMMO_X(3) = 0x110;
R_ITEM_AMMO_Y(0) = 0x23;
R_ITEM_AMMO_Y(1) = 0x23;
R_ITEM_AMMO_Y(2) = 0x33;
R_ITEM_AMMO_Y(3) = 0x23;
VREG(72) = 0;
VREG(73) = 0;
VREG(74) = 0;
VREG(75) = 0;
R_ITEM_ICON_WIDTH(0) = 0x1E;
R_ITEM_ICON_WIDTH(1) = 0x18;
R_ITEM_ICON_WIDTH(2) = 0x18;
R_ITEM_ICON_WIDTH(3) = 0x18;
R_ITEM_BTN_WIDTH(0) = 0x1D;
R_ITEM_BTN_WIDTH(1) = 0x1B;
R_ITEM_BTN_WIDTH(2) = 0x1B;
R_ITEM_BTN_WIDTH(3) = 0x1B;
VREG(84) = 0;
VREG(85) = 0x32;
VREG(86) = 0;
VREG(87) = 0x40;
VREG(88) = 0x42;
VREG(89) = 0;
VREG(90) = 0x7E;
VREG(91) = 0x7C;
VREG(92) = -0x3F;
}
void func_80112098(GlobalContext* globalCtx)
{
func_80111070();
}
+20
View File
@@ -0,0 +1,20 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_800636C0.s")
void func_8006375C(UNK_TYPE arg0, UNK_TYPE arg1, UNK_TYPE arg2)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006376C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063828.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_8006390C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063C04.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_debug/func_80063D7C.s")
+131
View File
@@ -0,0 +1,131 @@
#include <ultra64.h>
#include <global.h>
typedef struct
{
/* 0x00 */ s16 drawType; // indicates which draw function to use when displaying the object
/* 0x04 */ u32 drawArg; // segment address (display list or texture) passed to the draw funciton when called
} DebugDispObjectInfo; // size = 0x8
typedef void (*DebugDispObject_DrawFunc)(DebugDispObject*, u32, GlobalContext*);
static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx);
static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx);
static DebugDispObject_DrawFunc sDebugObjectDrawFuncTable[] =
{
DebugDisplay_DrawSpriteI8,
DebugDisplay_DrawPolygon,
};
static DebugDispObjectInfo sDebugObjectInfoTable[] =
{
{ 0, 0x040035F0 }, // Circle
{ 0, 0x040038F0 }, // Cross
{ 0, 0x040036F0 }, // Ball
{ 0, 0x040037F0 }, // Cursor
{ 1, 0x040039F0 }, // Arrow
{ 1, 0x04003C90 }, // Camera
};
static Lights1 sDebugObjectLights = gdSPDefLights1(0x80, 0x80, 0x80, 0xFF, 0xFF, 0xFF, 0x49, 0x49, 0x49);
static DebugDispObject* sDebugObjectListHead;
void DebugDisplay_Init(void)
{
sDebugObjectListHead = NULL;
}
DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ,
f32 scaleX, f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha,
s16 type, GraphicsContext* gfxCtx)
{
DebugDispObject* prevHead = sDebugObjectListHead;
sDebugObjectListHead = Graph_Alloc(gfxCtx, sizeof(DebugDispObject));
sDebugObjectListHead->pos.x = posX;
sDebugObjectListHead->pos.y = posY;
sDebugObjectListHead->pos.z = posZ;
sDebugObjectListHead->rot.x = rotX;
sDebugObjectListHead->rot.y = rotY;
sDebugObjectListHead->rot.z = rotZ;
sDebugObjectListHead->scale.x = scaleX;
sDebugObjectListHead->scale.y = scaleY;
sDebugObjectListHead->scale.z = scaleZ;
sDebugObjectListHead->color.r = red;
sDebugObjectListHead->color.g = green;
sDebugObjectListHead->color.b = blue;
sDebugObjectListHead->color.a = alpha;
sDebugObjectListHead->type = type;
sDebugObjectListHead->next = prevHead;
return sDebugObjectListHead;
}
void DebugDisplay_DrawObjects(GlobalContext* globalCtx)
{
DebugDispObject* dispObj = sDebugObjectListHead;
DebugDispObjectInfo* objInfo;
while (dispObj != NULL)
{
objInfo = &sDebugObjectInfoTable[dispObj->type];
sDebugObjectDrawFuncTable[objInfo->drawType](dispObj, objInfo->drawArg, globalCtx);
dispObj = dispObj->next;
}
}
static void DebugDisplay_DrawSpriteI8(DebugDispObject* dispObj, u32 texture, GlobalContext* globalCtx)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 169);
func_80094678(globalCtx->state.gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
Matrix_Translate(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, MTXMODE_NEW);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
Matrix_Mult(&globalCtx->mf_11DA0, MTXMODE_APPLY);
Matrix_RotateXYZ(dispObj->rot.x, dispObj->rot.y, dispObj->rot.z, MTXMODE_APPLY);
gDPLoadTextureBlock(gfxCtx->polyXlu.p++,
texture,
G_IM_FMT_I,
G_IM_SIZ_8b,
16, 16,
0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 189), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, &D_04004298);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 192);
}
static void DebugDisplay_DrawPolygon(DebugDispObject* dispObj, u32 dlist, GlobalContext* globalCtx)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 211);
func_8009435C(globalCtx->state.gfxCtx);
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, dispObj->color.r, dispObj->color.g, dispObj->color.b, dispObj->color.a);
gSPSetLights1(gfxCtx->polyXlu.p++, sDebugObjectLights);
func_800D1694(dispObj->pos.x, dispObj->pos.y, dispObj->pos.z, &dispObj->rot);
Matrix_Scale(dispObj->scale.x, dispObj->scale.y, dispObj->scale.z, MTXMODE_APPLY);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_debug_display.c", 228), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, dlist);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_debug_display.c", 231);
}
+2211
View File
File diff suppressed because it is too large Load Diff
+680
View File
@@ -0,0 +1,680 @@
#include <ultra64.h>
#include <global.h>
// "Get Item" Model Draw Functions
static void func_800694E4(GlobalContext* globalCtx, s16 drawId);
static void func_800695C0(GlobalContext* globalCtx, s16 drawId);
static void func_8006969C(GlobalContext* globalCtx, s16 drawId);
static void func_80069880(GlobalContext* globalCtx, s16 drawId);
static void func_80069AC8(GlobalContext* globalCtx, s16 drawId);
static void func_80069CF0(GlobalContext* globalCtx, s16 drawId);
static void func_80069EB0(GlobalContext* globalCtx, s16 drawId);
static void func_8006A060(GlobalContext* globalCtx, s16 drawId);
static void func_8006A158(GlobalContext* globalCtx, s16 drawId);
static void func_8006A2A0(GlobalContext* globalCtx, s16 drawId);
static void func_8006A4B0(GlobalContext* globalCtx, s16 drawId);
static void func_8006A5F0(GlobalContext* globalCtx, s16 drawId);
static void func_8006A73C(GlobalContext* globalCtx, s16 drawId);
static void func_8006A88C(GlobalContext* globalCtx, s16 drawId);
static void func_8006A9CC(GlobalContext* globalCtx, s16 drawId);
static void func_8006AAA8(GlobalContext* globalCtx, s16 drawId);
static void func_8006ABEC(GlobalContext* globalCtx, s16 drawId);
static void func_8006ACE4(GlobalContext* globalCtx, s16 drawId);
static void func_8006AE40(GlobalContext* globalCtx, s16 drawId);
static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId);
static void func_8006B124(GlobalContext* globalCtx, s16 drawId);
static void func_8006B24C(GlobalContext* globalCtx, s16 drawId);
static void func_8006B3C0(GlobalContext* globalCtx, s16 drawId);
static void func_8006B54C(GlobalContext* globalCtx, s16 drawId);
static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId);
static void func_8006B870(GlobalContext* globalCtx, s16 drawId);
typedef struct
{
/* 0x00 */ void (*drawFunc)(GlobalContext*, s16);
/* 0x04 */ u32 dlists[8];
} DrawItemTableEntry; // size = 0x24
// TODO: use symbols for these dlists once objects are in C
static DrawItemTableEntry sDrawItemTable[] =
{
{ func_8006AAA8, { 0x06000670, 0x06000750 } },
{ func_8006A9CC, { 0x06000800 } },
{ func_8006ABEC, { 0x06000A80, 0x06000AE0 } },
{ func_8006ABEC, { 0x06000A90, 0x06000AE0 } },
{ func_8006ABEC, { 0x06000AA0, 0x06000AE0 } },
{ func_8006ABEC, { 0x06000AB0, 0x06000AE0 } },
{ func_8006ABEC, { 0x06000AC0, 0x06000AE0 } },
{ func_8006ABEC, { 0x06000AD0, 0x06000AE0 } },
{ func_8006A73C, { 0x060000E0 } },
{ func_8006AAA8, { 0x06000CA0, 0x06000F08 } },
{ func_8006A158, { 0x06000960, 0x06000C50 } },
{ func_8006A060, { 0x06000CB0, 0x06000E18 } },
{ func_8006A060, { 0x06001AF0, 0x06000E18 } },
{ func_8006A060, { 0x06002830, 0x06000E18 } },
{ func_8006A060, { 0x06003610, 0x06000E18 } },
{ func_8006A060, { 0x06004330, 0x06000E18 } },
{ func_8006A060, { 0x06005220, 0x06000E18 } },
{ func_8006A5F0, { 0x06000E90 } },
{ func_8006ABEC, { 0x06001290, 0x06001470 } },
{ func_8006ABEC, { 0x06001290, 0x06001590 } },
{ func_8006B124, { 0x06000990, 0x060008D0, 0x06000930, 0x06000A80 } },
{ func_8006B124, { 0x06000990, 0x060008F0, 0x06000950, 0x06000A80 } },
{ func_8006B124, { 0x06000990, 0x06000910, 0x06000970, 0x06000A80 } },
{ func_8006B124, { 0x06000B90, 0x06000AD0, 0x06000B30, 0x06000D98 } },
{ func_8006B124, { 0x06000B90, 0x06000AF0, 0x06000B50, 0x06000D98 } },
{ func_8006B124, { 0x06000B90, 0x06000B10, 0x06000B70, 0x06000D98 } },
{ func_8006A9CC, { 0x060004D0 } },
{ func_8006A9CC, { 0x060003C0 } },
{ func_8006A9CC, { 0x06000A50 } },
{ func_8006A9CC, { 0x06000580 } },
{ func_8006A9CC, { 0x06000EE0 } },
{ func_8006A9CC, { 0x060009A0 } },
{ func_8006A9CC, { 0x06000B70 } },
{ func_8006B870, { 0x06001850, 0x06001750, 0x06001790, 0x060019A0, 0x060017B0, 0x06001A28, 0x060017D0, 0x06001AD8 } },
{ func_8006B870, { 0x06001850, 0x06001770, 0x060017F0, 0x060019A0, 0x06001810, 0x06001A28, 0x06001830, 0x06001AD8 } },
{ func_8006A9CC, { 0x06000F60 } },
{ func_8006A9CC, { 0x06000340 } },
{ func_8006A9CC, { 0x06000B90 } },
{ func_8006A9CC, { 0x06001830 } },
{ func_800694E4, { 0x060004B0 } },
{ func_8006A060, { 0x06000FD0, 0x06001008 } },
{ func_8006B54C, { 0x06000AA0, 0x06000A20, 0x06000A60, 0x06000CC8 } },
{ func_8006B54C, { 0x06000AA0, 0x06000A40, 0x06000A80, 0x06000CC8 } },
{ func_8006A9CC, { 0x06000C70 } },
{ func_8006A9CC, { 0x06000750 } },
{ func_8006A9CC, { 0x06001240 } },
{ func_8006AAA8, { 0x060008C0, 0x06000AF8 } },
{ func_8006AAA8, { 0x06001060, 0x06001288 } },
{ func_8006AAA8, { 0x06000AC0, 0x06000D50 } },
{ func_8006A9CC, { 0x060007E0 } },
{ func_8006A9CC, { 0x06000940 } },
{ func_8006A9CC, { 0x06000A30 } },
{ func_8006A9CC, { 0x06000990 } },
{ func_8006AAA8, { 0x06000D80, 0x06001010 } },
{ func_8006A2A0, { 0x06001438, 0x06001270, 0x060012D0, 0x06001790, 0x06001330, 0x06001848 } },
{ func_8006A2A0, { 0x06001438, 0x06001290, 0x060012F0, 0x06001790, 0x06001388, 0x06001848 } },
{ func_8006A2A0, { 0x06001438, 0x060012B0, 0x06001310, 0x06001790, 0x060013E0, 0x06001848 } },
{ func_80069CF0, { 0x06000FB0, 0x060011C8 } },
{ func_8006AAA8, { 0x06000CC0, 0x06000D60 } },
{ func_8006B124, { 0x06001560, 0x060014E0, 0x06001520, 0x06001608 } },
{ func_8006B124, { 0x06001560, 0x06001500, 0x06001540, 0x06001608 } },
{ func_8006A9CC, { 0x06000580 } },
{ func_8006A88C, { 0x06000600 } },
{ func_8006A9CC, { 0x060007E0 } },
{ func_8006A9CC, { 0x060009D0 } },
{ func_8006A9CC, { 0x060008E0 } },
{ func_8006A4B0, { 0x06000600 } },
{ func_8006ACE4, { 0x06001630, 0x060015F0, 0x06001948 } },
{ func_8006AAA8, { 0x060008E0, 0x06000AE0 } },
{ func_8006AAA8, { 0x060008E0, 0x06000B58 } },
{ func_8006AAA8, { 0x06001630, 0x06001A98 } },
{ func_8006A9CC, { 0x06000810 } },
{ func_8006B24C, { 0x06001540, 0x060014C0, 0x06001860, 0x06001500 } },
{ func_8006B24C, { 0x06001540, 0x060014E0, 0x06001860, 0x06001520 } },
{ func_8006ACE4, { 0x060005E0, 0x06000560, 0x06000768 } },
{ func_8006ACE4, { 0x060005E0, 0x06000580, 0x06000768 } },
{ func_8006ACE4, { 0x060005E0, 0x060005A0, 0x06000768 } },
{ func_8006ACE4, { 0x060005E0, 0x060005C0, 0x06000768 } },
{ func_8006A9CC, { 0x060009D0 } },
{ func_8006AAA8, { 0x06000BC0, 0x06000E58 } },
{ func_8006AAA8, { 0x060013D0, 0x060016B0 } },
{ func_8006AAA8, { 0x06000680, 0x06000768 } },
{ func_8006A9CC, { 0x060008B0 } },
{ func_8006A9CC, { 0x060009D0 } },
{ func_8006AAA8, { 0x06000F00, 0x06001188 } },
{ func_8006A4B0, { 0x060006E0 } },
{ func_8006AAA8, { 0x060009C0, 0x06000AF0 } },
{ func_8006A9CC, { 0x06000960 } },
{ func_800695C0, { 0x06000440 } },
{ func_8006AAA8, { 0x06000D60, 0x06001060 } },
{ func_800694E4, { 0x060014F8 } },
{ func_800694E4, { 0x06001398 } },
{ func_800694E4, { 0x060010E8 } },
{ func_8006ACE4, { 0x06001630, 0x06001610, 0x06001948 } },
{ func_8006A9CC, { 0x06001850 } },
{ func_8006AE40, { 0x06000AE0, 0x06000CA0, 0x06000D00 } },
{ func_8006AE40, { 0x06000AE0, 0x06000CC0, 0x06000D00 } },
{ func_8006AE40, { 0x06000AE0, 0x06000CE0, 0x06000D00 } },
{ func_80069EB0, { 0x06000330, 0x06000438 } },
{ func_8006AF9C, { 0x06000920, 0x060009E0, 0x06000A40 } },
{ func_8006AF9C, { 0x06000920, 0x06000A00, 0x06000A40 } },
{ func_8006AF9C, { 0x06000920, 0x06000A20, 0x06000A40 } },
{ func_8006969C, { 0x06000C60, 0x06000F08 } },
{ func_8006AAA8, { 0x06000830, 0x06000B20 } },
{ func_8006AAA8, { 0x06000830, 0x06000A70 } },
{ func_80069880, { 0x06000990, 0x06000BE0, 0x06000CF0, 0x06000950 } },
{ func_80069AC8, { 0x06000BD0, 0x06000DB8, 0x06000EF0 } },
{ func_8006B6E4, { 0x06000B70, 0x06000AF0, 0x06000F48, 0x06000B30, 0x06000FF0 } },
{ func_8006B3C0, { 0x060005E0, 0x060004A0, 0x060006F0, 0x06000540 } },
{ func_8006B3C0, { 0x060005E0, 0x060004C0, 0x060006F0, 0x06000560 } },
{ func_8006B3C0, { 0x060005E0, 0x060004E0, 0x060006F0, 0x06000580 } },
{ func_80069880, { 0x06000990, 0x06000BE0, 0x06000CF0, 0x06000970 } },
{ func_8006B24C, { 0x060005E0, 0x06000500, 0x060006F0, 0x060005A0 } },
{ func_8006B24C, { 0x060005E0, 0x06000520, 0x060006F0, 0x060005C0 } },
{ func_8006B6E4, { 0x06000B70, 0x06000B10, 0x06000F48, 0x06000B50, 0x06000FF0 } },
{ func_8006A9CC, { 0x06000960 } },
{ func_80069EB0, { 0x06004DB0, 0x06004EB8 } },
};
/**
* Draw "Get Item" Model
* Calls the corresponding draw function for the given draw ID
*/
void func_800694A0(GlobalContext* globalCtx, s16 drawId)
{
sDrawItemTable[drawId].drawFunc(globalCtx, drawId);
}
// All remaining functions in this file are draw functions referenced in the table and called by the function above
static void func_800694E4(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 556);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 560), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 565);
}
static void func_800695C0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 572);
gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 5);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 576), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 581);
}
static void func_8006969C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 588);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 592), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32,
1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 8), 16, 32));
Matrix_Push();
Matrix_Translate(-8.0f, -2.0f, 0.0f, MTXMODE_APPLY);
func_800D1FD4(&globalCtx->mf_11DA0);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 615), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
Matrix_Pull();
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 621);
}
static void func_80069880(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 628);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 632), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 641), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 16, 32,
1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 16, 32));
Matrix_Push();
func_800D1FD4(&globalCtx->mf_11DA0);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 656), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pull();
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 663);
}
static void func_80069AC8(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 670);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 674), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 683), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 32,
1, 1 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 6), 32, 32));
Matrix_Push();
func_800D1FD4(&globalCtx->mf_11DA0);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 698), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
Matrix_Pull();
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 704);
}
static void func_80069CF0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 712);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0) % 256, 1 * (globalCtx->state.frames * 2) % 256, 64, 64,
1, 0 * (globalCtx->state.frames * 0) % 128, 1 * (globalCtx->state.frames * 1) % 128, 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 723), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 730), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 735);
}
static void func_80069EB0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 742);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 746), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0), 1 * -(globalCtx->state.frames * 5), 32, 32,
1, 0 * (globalCtx->state.frames * 0), 0 * (globalCtx->state.frames * 0), 32, 64));
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 760), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 765);
}
static void func_8006A060(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 772);
func_80093BA8(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 776), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 783);
}
static void func_8006A158(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 811);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 815), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 5);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 822), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 827);
}
static void func_8006A2A0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 834);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32,
1, -1 * (globalCtx->state.frames * 1), 1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 845), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 855), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[5]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 861);
}
static void func_8006A4B0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 868);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 1 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32,
1, 0 * (globalCtx->state.frames * 1), 0 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 878), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 883);
}
static void func_8006A5F0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 890);
func_80093D18(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32,
1, 1 * (globalCtx->state.frames * 6), 1 * (globalCtx->state.frames * 6), 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 901), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 906);
}
static void func_8006A73C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 913);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 3), 32, 32,
1, 0 * (globalCtx->state.frames * 1), 1 * -(globalCtx->state.frames * 2), 32, 32));
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 924), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 929);
}
static void func_8006A88C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 936);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32,
1, 0 * (globalCtx->state.frames * 0), 1 * (globalCtx->state.frames * 1), 32, 32));
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 947), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 952);
}
static void func_8006A9CC(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 959);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 963), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 968);
}
static void func_8006AAA8(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 975);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 979), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 986), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 991);
}
static void func_8006ABEC(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 998);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1002), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1008);
}
static void func_8006ACE4(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1015);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1019), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1027), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1032);
}
static void func_8006AE40(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1039);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1043), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1050), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1056);
}
static void func_8006AF9C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1063);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 1 * (globalCtx->state.frames * 2), 1 * -(globalCtx->state.frames * 6), 32, 32,
1, 1 * (globalCtx->state.frames * 1), -1 * (globalCtx->state.frames * 2), 32, 32));
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1074), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1081);
}
static void func_8006B124(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1088);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1092), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1100);
}
static void func_8006B24C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1108);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1112), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1120), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1126);
}
static void func_8006B3C0(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1133);
Matrix_Scale(0.7f, 0.7f, 0.7f, MTXMODE_APPLY);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1140), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1148), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1154);
}
static void func_8006B54C(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1162);
func_80093D84(globalCtx->state.gfxCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Draw_TwoTexScroll(globalCtx->state.gfxCtx,
0, 1 * (globalCtx->state.frames * 2), -1 * (globalCtx->state.frames * 2), 64, 64,
1, 1 * (globalCtx->state.frames * 4), 1 * -(globalCtx->state.frames * 4), 32, 32));
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1173), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[0]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1181);
}
static void func_8006B6E4(GlobalContext* globalCtx, s16 drawId)
{
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1188);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1192), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1200), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyXlu.p++, sDrawItemTable[drawId].dlists[4]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1207);
}
static void func_8006B870(GlobalContext* globalCtx, s16 drawId)
{
u32 pad;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1214);
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_draw.c", 1218), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[1]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[0]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[2]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[3]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[4]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[5]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[6]);
gSPDisplayList(gfxCtx->polyOpa.p++, sDrawItemTable[drawId].dlists[7]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_draw.c", 1230);
}
+32
View File
@@ -0,0 +1,32 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_8001FDF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80020184.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800208E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80020A50.s")
void func_80020F60(u32 unused, GraphicsContext* gfxCtx)
{
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, gfxCtx, D_80135180, 809);
gfxCtx->polyXlu.p = func_80093774(gfxCtx->polyXlu.p, 0x26);
func_800C6B54(gfxArr, gfxCtx, D_80135194, 813);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80020FC0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800214D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80021F00.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_800224F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_blure/func_80022A10.s")
+11
View File
@@ -0,0 +1,11 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_80023450.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_800236B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_8002389C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_shield_particle/func_800245BC.s")
+14
View File
@@ -0,0 +1,14 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80024B00.s")
void func_80024F0C(UNK_TYPE arg0)
{
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80024F14.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/func_80025000.s")
+15
View File
@@ -0,0 +1,15 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026230.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026400.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026608.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026690.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026860.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_ss_dead/func_80026A6C.s")
+144
View File
@@ -0,0 +1,144 @@
#include <ultra64.h>
#include <global.h>
extern ParticleOverlay sParticleOverlayTable[37];
void Effect_SS_Delete(LoadedParticleEntry* particle);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_800272B0.s")
void Effect_SS_Clear(GlobalContext* globalCtx)
{
u32 i;
LoadedParticleEntry* iter;
ParticleOverlay* iter2;
void* addr;
EffectSS2Info.data_table = NULL;
EffectSS2Info.searchIndex = 0;
EffectSS2Info.size = 0;
for (iter = EffectSS2Info.data_table; iter < EffectSS2Info.data_table + EffectSS2Info.size; iter++)
Effect_SS_Delete(iter);
// Free memory from loaded particle overlays
iter2 = &sParticleOverlayTable[0];
for (i = 0; i < ARRAY_COUNT(sParticleOverlayTable); i++)
{
addr = iter2->loadedRamAddr;
if (addr != NULL)
ZeldaArena_FreeDebug(addr, D_801357DC, 337);
(iter2++)->loadedRamAddr = NULL;
}
}
void Effect_SS_Delete(LoadedParticleEntry* particle)
{
if (particle->flags & 2)
func_800F89E8(particle);
if (particle->flags & 4)
func_800F89E8(&particle->unk_2C);
Effect_SS_ResetEntry(particle);
}
void Effect_SS_ResetEntry(LoadedParticleEntry* particle)
{
u32 i;
particle->type = 0x25;
particle->acceleration.z = 0;
particle->acceleration.y = 0;
particle->acceleration.x = 0;
particle->velocity.z = 0;
particle->velocity.y = 0;
particle->velocity.x = 0;
particle->unk_34 = 0;
particle->unk_30 = 0;
particle->unk_2C = 0;
particle->position.z = 0;
particle->position.y = 0;
particle->position.x = 0;
particle->life = -1;
particle->flags = 0;
particle->priority = 128;
particle->draw = NULL;
particle->update = NULL;
particle->unk_38 = 0;
particle->unk_3C = 0;
for (i = 0; i != 13; i++)
particle->unk_40[i] = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_800275D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_80027704.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_80027798.s")
void Effect_SS_UpdateParticle(GlobalContext* globalCtx, s32 index)
{
LoadedParticleEntry* particle = &EffectSS2Info.data_table[index];
if (particle->update != NULL)
{
particle->velocity.x += particle->acceleration.x;
particle->velocity.y += particle->acceleration.y;
particle->velocity.z += particle->acceleration.z;
particle->position.x += particle->velocity.x;
particle->position.y += particle->velocity.y;
particle->position.z += particle->velocity.z;
particle->update(globalCtx, index, particle);
}
}
void Effect_SS_UpdateAllParticles(GlobalContext* globalCtx)
{
s32 i;
for (i = 0; i < EffectSS2Info.size; i++)
{
if (EffectSS2Info.data_table[i].life > -1)
{
EffectSS2Info.data_table[i].life--;
if (EffectSS2Info.data_table[i].life < 0)
Effect_SS_Delete(&EffectSS2Info.data_table[i]);
}
if (EffectSS2Info.data_table[i].life > -1)
Effect_SS_UpdateParticle(globalCtx, i);
}
}
void Effect_SS_DrawParticle(GlobalContext* globalCtx, s32 index)
{
LoadedParticleEntry* particle = &EffectSS2Info.data_table[index];
if (particle->draw != NULL)
particle->draw(globalCtx, index, particle);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite/func_80027BDC.s")
s16 func_80027DD4(s16 arg0, s16 arg1, s32 arg2)
{
s16 ret = !arg2 ? arg1 : (arg0 + (s32) ((f32) (arg1 - arg0) / arg2));
return ret;
}
s16 func_80027E34(s16 a0, s16 a1, f32 a2)
{
return (a1 - a0) * a2 + a0;
}
u8 func_80027E84(u8 a0, u8 a1, f32 a2)
{
return a2 * ((f32)a1 - (f32)a0) + a0;
}
+167
View File
@@ -0,0 +1,167 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80027F80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800281E8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002829C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028304.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002836C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800283D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002843C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800284A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028510.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002857C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800285EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002865C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800286CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002873C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800287AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002881C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028858.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028894.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028990.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028A54.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028B18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028B74.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028BB0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028CEC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028DC4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028E1C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028E84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028EF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028F84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80028FD8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029024.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029060.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800290F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029184.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800291D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800292DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029320.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800293A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800293E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029444.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002949C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029530.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029568.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800295A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029618.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029694.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029724.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800297A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800298EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002993C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_800299AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029B30.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029B90.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029C00.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029C50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029CA4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029CC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029CF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029D5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029DBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029E24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/Effect_SpawnFragment.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029F44.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_80029FAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A140.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A1DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A2A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A32C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A3C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A484.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A4D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A54C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A5F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A65C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A6B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A770.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A824.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A894.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A90C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A95C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002A9F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_effect_soft_sprite_old_init/func_8002AA44.s")
+14
View File
@@ -0,0 +1,14 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006BBC0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006BE88.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006BF1C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006C0FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006C2B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/func_8006C318.s")
+378
View File
@@ -0,0 +1,378 @@
#include <ultra64.h>
#include <global.h>
typedef enum
{
/* 0x00 */ A_OBJ_BLOCK_SMALL,
/* 0x01 */ A_OBJ_BLOCK_LARGE,
/* 0x02 */ A_OBJ_BLOCK_HUGE,
/* 0x03 */ A_OBJ_BLOCK_SMALL_ROT,
/* 0x04 */ A_OBJ_BLOCK_LARGE_ROT,
/* 0x05 */ A_OBJ_CUBE_SMALL,
/* 0x06 */ A_OBJ_UNKNOWN_6,
/* 0x07 */ A_OBJ_GRASS_CLUMP,
/* 0x08 */ A_OBJ_TREE_STUMP,
/* 0x09 */ A_OBJ_SIGNPOST_OBLONG,
/* 0x0A */ A_OBJ_SIGNPOST_ARROW,
/* 0x0B */ A_OBJ_KNOB
} AObjType;
typedef struct
{
/* 0x000 */ Actor actor;
/* 0x14C */ u32 dynaPolyId;
/* 0x150 */ f32 unk_150;
/* 0x154 */ f32 unk_154;
/* 0x158 */ s16 unk_158;
/* 0x15C */ u32 unk_15C;
/* 0x160 */ u8 unk_160;
/* 0x164 */ ActorFunc updateFunc;
/* 0x168 */ s32 unk_168;
/* 0x16C */ s16 textId;
/* 0x16E */ s16 unk_16E;
/* 0x170 */ s16 unk_170;
/* 0x172 */ s16 unk_172;
/* 0x174 */ s16 unk_174;
/* 0x178 */ f32 unk_178;
/* 0x17C */ ColliderCylinderMain cylinderCollider;
} ActorEnAObj; // size = 0x1C8
void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx);
void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx);
void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx);
void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx);
void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx);
void func_8001D234(ActorEnAObj* this, s16 params);
void func_8001D310(ActorEnAObj* this, s16 params);
void func_8001D480(ActorEnAObj* this, s16 params);
void func_8001D5C8(ActorEnAObj* this, s16 params);
// TODO: Define this part of code .data here and rename the symbols
extern ActorInit En_A_Obj_InitVars;
extern ColliderCylinderInit D_80115440;
extern u32 D_8011546C[];
extern u32 D_80115484[];
void En_A_Obj_SetNewUpdate(ActorEnAObj* this, ActorFunc newUpdateFunc)
{
this->updateFunc = newUpdateFunc;
}
#ifdef NON_MATCHING
// minor ordering and regalloc differences
void En_A_Obj_Init(ActorEnAObj* this, GlobalContext* globalCtx)
{
u32 sp34;
s16 type;
s16 initialParams;
s32 params;
f32 sp28;
sp34 = 0;
sp28 = 6.0f;
initialParams = this->actor.params;
type = initialParams & 0xFF;
this->textId = (initialParams >> 8) & 0xFF;
this->actor.params = type;
switch (type & 0xFFFF)
{
case A_OBJ_BLOCK_SMALL:
Actor_SetScale(&this->actor, 0.025f);
break;
case A_OBJ_BLOCK_LARGE:
Actor_SetScale(&this->actor, 0.05f);
break;
case A_OBJ_BLOCK_HUGE:
case A_OBJ_CUBE_SMALL:
case A_OBJ_UNKNOWN_6:
Actor_SetScale(&this->actor, 0.1f);
break;
case A_OBJ_BLOCK_SMALL_ROT:
Actor_SetScale(&this->actor, 0.005f);
break;
case A_OBJ_BLOCK_LARGE_ROT:
default:
Actor_SetScale(&this->actor, 0.01f);
break;
}
if (this->actor.params >= 9)
sp28 = 12.0f;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, sp28);
this->dynaPolyId = -1;
this->unk_160 = 0;
this->unk_15C = 0;
this->actor.unk_FC = 1200.0f;
this->actor.unk_F8 = 200.0f;
params = this->actor.params;
this->actor.posRot2.pos = this->actor.posRot.pos;
switch (params)
{
case A_OBJ_BLOCK_LARGE:
case A_OBJ_BLOCK_HUGE:
this->dynaPolyId = 1;
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_BG);
func_8001D5C8(this, this->actor.params);
break;
case A_OBJ_BLOCK_SMALL_ROT:
case A_OBJ_BLOCK_LARGE_ROT:
this->dynaPolyId = 3;
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_BG);
func_8001D310(this, this->actor.params);
break;
case A_OBJ_UNKNOWN_6:
this->actor.flags |= 0x1;
this->dynaPolyId = 5;
this->unk_178 = 10.0f;
this->actor.gravity = -2.0f;
func_8001D234(this, this->actor.params);
break;
case A_OBJ_GRASS_CLUMP:
case A_OBJ_TREE_STUMP:
this->dynaPolyId = 0;
func_8001D234(this, this->actor.params);
break;
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
this->actor.textId = (this->textId & 0xFF) | 0x300;
this->actor.flags |= 0x8 | 0x1;
this->actor.unk_4C = 500.0f;
this->unk_178 = 45.0f;
func_8001D234(this, this->actor.params);
ActorCollider_AllocCylinder(globalCtx, &this->cylinderCollider);
ActorCollider_InitCylinder(globalCtx, &this->cylinderCollider, &this->actor, &D_80115440);
this->actor.sub_98.mass = 0xFF;
this->actor.unk_1F = 0;
break;
case A_OBJ_KNOB:
this->actor.gravity = -1.5f;
func_8001D480(this, params);
break;
default:
this->actor.gravity = -2.0f;
func_8001D234(this, params);
break;
}
if (this->actor.params < 5)
this->actor.sub_98.mass = 0xFF;
if (this->dynaPolyId != -1)
{
DynaPolyInfo_Alloc(D_8011546C[this->dynaPolyId], &sp34);
this->dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, &this->actor, sp34);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_en_a_keep/En_A_Obj_Init.s")
#endif
void En_A_Obj_Destroy(ActorEnAObj* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* cylinderCollider = &this->cylinderCollider;
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dynaPolyId);
switch (this->actor.params)
{
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
ActorCollider_FreeCylinder(globalCtx, cylinderCollider);
}
}
void func_8001D204(ActorEnAObj* this, GlobalContext* globalCtx)
{
if (func_8002F334(&this->actor, globalCtx))
func_8001D234(this, this->actor.params);
}
void func_8001D234(ActorEnAObj* this, s16 params)
{
En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D25C);
}
void func_8001D25C(ActorEnAObj* this, GlobalContext* globalCtx)
{
s16 var;
if (this->actor.textId != 0)
{
var = this->actor.rotTowardsLinkY - this->actor.shape.rot.y;
if ((ABS(var) < 0x2800) ||
((this->actor.params == 0xA) && (ABS(var) > 0x5800)))
{
if (func_8002F194(&this->actor, globalCtx))
En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D204);
else
func_8002F2F4(&this->actor, globalCtx);
}
}
}
void func_8001D310(ActorEnAObj* this, s16 params)
{
this->unk_16E = 0;
this->unk_168 = 10;
this->actor.posRot.rot.y = 0;
this->actor.shape.rot = this->actor.posRot.rot;
En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D360);
}
void func_8001D360(ActorEnAObj* this, GlobalContext* globalCtx)
{
if (this->unk_16E == 0)
{
if (this->unk_160 != 0)
{
this->unk_16E++;
this->unk_170 = 20;
if ((s16)(this->actor.rotTowardsLinkY + 0x4000) < 0)
this->unk_174 = -1000;
else
this->unk_174 = 1000;
if (this->actor.rotTowardsLinkY < 0)
this->unk_172 = -this->unk_174;
else
this->unk_172 = this->unk_174;
}
}
else
{
if (this->unk_168 != 0)
{
this->unk_168--;
}
else
{
this->actor.shape.rot.y += this->unk_172;
this->actor.shape.rot.x += this->unk_174;
this->unk_170--;
this->actor.gravity = -1.0f;
if (this->unk_170 == 0)
{
this->actor.posRot.pos = this->actor.initPosRot.pos;
this->unk_16E = 0;
this->unk_168 = 10;
this->actor.velocity.y = 0.0f;
this->actor.gravity = 0.0f;
this->actor.shape.rot = this->actor.posRot.rot;
}
}
}
}
void func_8001D480(ActorEnAObj* this, s16 params)
{
En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D4A8);
}
void func_8001D4A8(ActorEnAObj* this, GlobalContext* globalCtx)
{
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 1.0f, 1.0f, 0.5f, 0.0f);
this->actor.shape.rot.x = this->actor.shape.rot.x + (this->actor.posRot.rot.x >> 1);
this->actor.shape.rot.z = this->actor.shape.rot.z + (this->actor.posRot.rot.z >> 1);
if ((this->actor.speedXZ != 0.0f) && (this->actor.bgCheckFlags & 0x8))
{
if (1) // Necessary to match
this->actor.posRot.rot.y = ((this->actor.unk_7E - this->actor.posRot.rot.y) + this->actor.unk_7E) - 0x8000;
this->actor.bgCheckFlags &= ~0x8;
}
if (this->actor.bgCheckFlags & 0x2)
{
if (this->actor.velocity.y < -8.0f)
{
this->actor.velocity.y *= -0.6f;
this->actor.speedXZ *= 0.6f;
this->actor.bgCheckFlags &= ~0x3;
}
else
Actor_Kill(&this->actor);
}
}
void func_8001D5C8(ActorEnAObj* this, s16 params)
{
this->actor.unk_FC = 1200.0f;
this->actor.unk_F8 = 720.0f;
En_A_Obj_SetNewUpdate(this, (ActorFunc)func_8001D608);
}
void func_8001D608(ActorEnAObj* this, GlobalContext* globalCtx)
{
this->actor.speedXZ += this->unk_150;
this->actor.posRot.rot.y = this->unk_158;
this->actor.speedXZ = (this->actor.speedXZ < -2.5f) ? -2.5f :
((this->actor.speedXZ > 2.5f) ? 2.5f :
this->actor.speedXZ);
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f);
if (this->actor.speedXZ != 0.0f)
Audio_PlayActorSound2(&this->actor, 0x200A);
this->unk_154 = 0.0f;
this->unk_150 = 0.0f;
}
void En_A_Obj_Update(ActorEnAObj* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* cylinderCollider;
this->updateFunc(this, globalCtx);
Actor_MoveForward(&this->actor);
if (this->actor.gravity != 0.0f)
{
if (this->actor.params != A_OBJ_KNOB)
func_8002E4B4(globalCtx, &this->actor, 5.0f, 40.0f, 0.0f, 0x1D);
else
func_8002E4B4(globalCtx, &this->actor, 5.0f, 20.0f, 0.0f, 0x1D);
}
this->actor.posRot2.pos = this->actor.posRot.pos;
this->actor.posRot2.pos.y += this->unk_178;
switch (this->actor.params)
{
case A_OBJ_SIGNPOST_OBLONG:
case A_OBJ_SIGNPOST_ARROW:
cylinderCollider = &this->cylinderCollider;
ActorCollider_Cylinder_Update(&this->actor, cylinderCollider);
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, cylinderCollider);
}
}
void En_A_Obj_Draw(ActorEnAObj* this, GlobalContext* globalCtx)
{
s32 type = this->actor.params;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[4];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_en_a_keep.c", 701);
func_80093D18(globalCtx->state.gfxCtx);
if (type > A_OBJ_KNOB)
type = A_OBJ_KNOB;
if (this->actor.params == A_OBJ_KNOB)
gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 1, 0x3C, 0x3C, 0x3C, 0x32);
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_a_keep.c", 712), G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, D_80115484[type]);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_a_keep.c", 715);
}
File diff suppressed because it is too large Load Diff
+21
View File
@@ -0,0 +1,21 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B18B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B1CFC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B1DBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B1E84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B2074.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B2188.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B22B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B23E8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fbdemo/func_800B23F0.s")
+17
View File
@@ -0,0 +1,17 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006C750.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006C778.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006C85C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006C894.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006C8C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006CBAC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_fcurve_data_skelanime/func_8006CF6C.s")
+366
View File
@@ -0,0 +1,366 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
s32 func_8006CFC0(s32 scene)
{
s32 validScenes[] = { SCENE_SPOT00, SCENE_SPOT06, SCENE_SPOT09, SCENE_SPOT12, SCENE_SPOT20 };
s32 i;
for (i = 0; i < ARRAY_COUNT(validScenes); i++)
{
if (scene == validScenes[i])
return 1;
}
return 0;
}
void func_8006D074(GlobalContext* globalCtx)
{
gSaveContext.horse_data.scene = SCENE_SPOT00;
gSaveContext.horse_data.pos.x = -1840;
gSaveContext.horse_data.pos.y = 72;
gSaveContext.horse_data.pos.z = 5497;
gSaveContext.horse_data.angle = -27353;
}
void func_8006D0AC(GlobalContext* globalCtx)
{
if (gSaveContext.horse_data.scene == SCENE_SPOT06)
{
gSaveContext.horse_data.scene = SCENE_SPOT06;
gSaveContext.horse_data.pos.x = -2065;
gSaveContext.horse_data.pos.y = -863;
gSaveContext.horse_data.pos.z = 1839;
gSaveContext.horse_data.angle = 0;
}
}
typedef struct
{
/* 0x00 */ s16 scene;
/* 0x02 */ Vec3s pos;
/* 0x08 */ s16 angle;
/* 0x0A */ s16 type;
} HorseSpawn;
void func_8006D0EC(GlobalContext* globalCtx, Player* player)
{
s32 i;
HorseSpawn horseSpawns[] =
{
{ 81, 0xFE34, 0x0064, 0x19F0, 0, 2 },
{ 87, 0xF877, 0xFBFF, 0x0300, 0, 2 },
{ 90, 0x0A06, 0xFEFD, 0x02FF, 0, 2 },
{ 93, 0xFEB8, 0x000A, 0x03B9, 0, 2 },
{ 99, 0x03A0, 0x0000, 0xF718, 0, 2 },
};
if ((AREG(6) != 0) && (Flags_GetEventChkInf(0x18) || (DREG(1) != 0)))
{
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
player->actor.posRot.pos.x, player->actor.posRot.pos.y, player->actor.posRot.pos.z,
player->actor.shape.rot.x, player->actor.shape.rot.y, player->actor.shape.rot.z, 9);
if (player->rideActor == NULL)
__assert("player->ride.actor != NULL", "../z_horse.c", 343);
func_8002DECC(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horse_data.scene = globalCtx->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12)
player->rideActor->room = -1;
}
else if ((globalCtx->sceneNum == SCENE_SPOT12) && (gSaveContext.minigame_state == 3))
{
Actor* horseActor;
gSaveContext.minigame_state = 0;
horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
3586.0f, 1413.0f, -402.0f,
0, 0x4000, 0, 1);
horseActor->room = -1;
}
else if ((gSaveContext.entrance_index == 1230) && (gSaveContext.event_chk_inf[1] & 0x100))
{
Actor* horseActor;
horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
-25.0f, 0.0f, -1600.0f,
0, -0x4000, 0, 1);
if (horseActor == NULL)
__assert("horse_actor != NULL", "../z_horse.c", 389);
}
else if ((globalCtx->sceneNum == gSaveContext.horse_data.scene) && (Flags_GetEventChkInf(0x18) != 0 || DREG(1) != 0))
{
// Translates to: "SET BY EXISTENCE OF HORSE %d %d %d"
osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horse_data.scene, Flags_GetEventChkInf(0x18), DREG(1));
if (func_8006CFC0(gSaveContext.horse_data.scene))
{
Actor* horseActor;
horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
gSaveContext.horse_data.pos.x, gSaveContext.horse_data.pos.y, gSaveContext.horse_data.pos.z,
0, gSaveContext.horse_data.angle, 0, 1);
if (horseActor == NULL)
__assert("horse_actor != NULL", "../z_horse.c", 414);
if (globalCtx->sceneNum == SCENE_SPOT12)
horseActor->room = -1;
}
else
{
osSyncPrintf(VT_COL(RED, WHITE));
// Translates to: "Horse_SetNormal():%d SET SPOT IS NO GOOD."
osSyncPrintf("Horse_SetNormal():%d セットスポットまずいです。\n", gSaveContext.horse_data.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
}
}
else if ((globalCtx->sceneNum == SCENE_SPOT20) && !Flags_GetEventChkInf(0x18) && (DREG(1) == 0))
{
Actor* horseActor;
horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
0.0f, 0.0f, -500.0f,
0, 0, 0, 1);
if (horseActor == 0)
__assert("horse_actor != NULL", "../z_horse.c", 443);
}
else if (Flags_GetEventChkInf(0x18) || (DREG(1) != 0))
{
for (i = 0; i < ARRAY_COUNT(horseSpawns); i++)
{
HorseSpawn* horseSpawn = &horseSpawns[i];
if (horseSpawn->scene == globalCtx->sceneNum)
{
Actor* horseActor;
horseActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
horseSpawn->pos.x, horseSpawn->pos.y, horseSpawn->pos.z,
0, horseSpawn->angle, 0, horseSpawn->type);
if (horseActor == NULL)
__assert("horse_actor != NULL", "../z_horse.c", 466);
if (globalCtx->sceneNum == SCENE_SPOT12)
horseActor->room = -1;
break;
}
}
}
else if (!Flags_GetEventChkInf(0x18))
{
if ((DREG(1) == 0) && (globalCtx->sceneNum == SCENE_SOUKO) &&(gSaveContext.night_flag != 0))
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
0.0f, 0.0f, -60.0f,
0, 0x7360, 0, 1);
}
}
typedef struct
{
/* 0x00 */ s16 scene;
/* 0x04 */ s32 cutsceneIndex;
/* 0x08 */ Vec3s pos;
/* 0x0E */ s16 angle;
/* 0x10 */ s16 type;
} struct_8011F9B8;
#ifdef NON_MATCHING
// regalloc differences
void func_8006D684(GlobalContext* globalCtx, Player* player)
{
s32 pad;
s32 i;
Vec3s spawnPos;
if ((gSaveContext.entrance_index == 0x028A || gSaveContext.entrance_index == 0x028E ||
gSaveContext.entrance_index == 0x0292 || gSaveContext.entrance_index == 0x0476) &&
(gSaveContext.respawn_flag == 0))
{
Vec3s spawnPositions[] =
{
{ 0xF46F, 0x0139, 0x1E14 },
{ 0xF894, 0x0139, 0x1B67 },
{ 0xF035, 0x0139, 0x1B15 },
{ 0xF6F7, 0x0139, 0x1766 },
};
if (gSaveContext.entrance_index == 0x028A)
spawnPos = spawnPositions[0];
else if (gSaveContext.entrance_index == 0x028E)
spawnPos = spawnPositions[1];
else if (gSaveContext.entrance_index == 0x0292)
spawnPos = spawnPositions[2];
else
spawnPos = spawnPositions[3];
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
spawnPos.x, spawnPos.y, spawnPos.z,
0, player->actor.posRot.rot.y, 0, 7);
if (player->rideActor == NULL)
__assert("player->ride.actor != NULL", "../z_horse.c", 561);
func_8002DECC(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horse_data.scene = globalCtx->sceneNum;
}
else if ((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.event_inf[0] & 0xF) == 6) &&
(Flags_GetEventChkInf(0x18) == 0) && (DREG(1) == 0))
{
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
894.0f, 0.0f, -2084.0f,
0, -0x7FFF, 0, 5);
if (player->rideActor == NULL)
__assert("player->ride.actor != NULL", "../z_horse.c", 582);
func_8002DECC(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
gSaveContext.horse_data.scene = globalCtx->sceneNum;
if (globalCtx->sceneNum == SCENE_SPOT12)
player->rideActor->room = -1;
}
else
{
static struct_8011F9B8 D_8011F9B8[] =
{
{ 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 },
{ 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 },
{ 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 },
{ 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 },
{ 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 },
{ 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 },
{ 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
{ 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
};
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++)
{
if ((globalCtx->sceneNum == D_8011F9B8[i].scene) && (gSaveContext.cutscene_index == D_8011F9B8[i].cutsceneIndex))
{
if (D_8011F9B8[i].type == 7)
{
if ((globalCtx->sceneNum == 99) && (gSaveContext.cutscene_index == 0xFFF1))
{
D_8011F9B8[i].pos.x = player->actor.posRot.pos.x;
D_8011F9B8[i].pos.y = player->actor.posRot.pos.y;
D_8011F9B8[i].pos.z = player->actor.posRot.pos.z;
}
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z,
0, player->actor.posRot.rot.y, 0, D_8011F9B8[i].type);
if (player->rideActor == NULL)
__assert("player->ride.actor != NULL", "../z_horse.c", 628);
func_8002DECC(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
}
else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8))
{
Vec3f sp54;
s32 temp;
s32 pad2;
temp = 0;
if (((gSaveContext.event_inf[0] & 0x10) >> 4) && D_8011F9B8[i].type == 6)
temp = 0x8000;
player->rideActor = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z,
0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type | temp);
if (player->rideActor == NULL)
__assert("player->ride.actor != NULL", "../z_horse.c", 667);
player->actor.posRot.pos.x = D_8011F9B8[i].pos.x;
player->actor.posRot.pos.y = D_8011F9B8[i].pos.y;
player->actor.posRot.pos.z = D_8011F9B8[i].pos.z;
player->actor.shape.rot.x = player->actor.shape.rot.z = 0;
player->actor.shape.rot.y = D_8011F9B8[i].angle;
func_8002DECC(globalCtx, player, player->rideActor);
func_8002DE74(globalCtx, player);
sp54.x = player->actor.posRot.pos.x - 200.0f;
sp54.y = player->actor.posRot.pos.y + 100.0f;
sp54.z = player->actor.posRot.pos.z;
func_800C04D8(globalCtx, globalCtx->cameraCtx.unk_5C0, &player->actor.posRot, &sp54);
}
else
{
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE,
D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z,
0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type);
}
break;
}
}
}
}
#else
Vec3s D_8011F9A0[] =
{
{ 0xF46F, 0x0139, 0x1E14 },
{ 0xF894, 0x0139, 0x1B67 },
{ 0xF035, 0x0139, 0x1B15 },
{ 0xF6F7, 0x0139, 0x1766 },
};
struct_8011F9B8 D_8011F9B8[] =
{
{ 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 },
{ 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 },
{ 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 },
{ 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 },
{ 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 },
{ 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 },
{ 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
{ 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
};
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_8006D684.s")
#endif
void func_8006DC68(GlobalContext* globalCtx, Player* player)
{
if (LINK_IS_ADULT)
{
if (!func_8006CFC0(gSaveContext.horse_data.scene))
{
osSyncPrintf(VT_COL(RED, WHITE));
// Translates to: "Horse_Set_Check():%d SET SPOT IS NO GOOD."
osSyncPrintf("Horse_Set_Check():%d セットスポットまずいです。\n", gSaveContext.horse_data.scene);
osSyncPrintf(VT_RST);
func_8006D074(globalCtx);
}
if (func_8006CFC0(globalCtx->sceneNum))
{
if ((gSaveContext.scene_setup_index > 3) ||
((gSaveContext.entrance_index == 0x028A || gSaveContext.entrance_index == 0x028E ||
gSaveContext.entrance_index == 0x0292 || gSaveContext.entrance_index == 0x0476) &&
(gSaveContext.respawn_flag == 0)) ||
((globalCtx->sceneNum == SCENE_SPOT20) && ((gSaveContext.event_inf[0] & 0xF) == 6) &&
!Flags_GetEventChkInf(0x18) && (DREG(1) == 0)))
{
func_8006D684(globalCtx, player);
}
else
{
func_8006D0EC(globalCtx, player);
}
}
}
}
void func_8006DD9C(Actor* actor, Vec3f* arg1, s16 arg2)
{
s16 x = Math_Vec3f_Yaw(&actor->posRot.pos, arg1) - actor->posRot.rot.y;
if (x > arg2)
actor->posRot.rot.y += arg2;
else if (x < -arg2)
actor->posRot.rot.y -= arg2;
else
actor->posRot.rot.y += x;
actor->shape.rot.y = actor->posRot.rot.y;
}
+13
View File
@@ -0,0 +1,13 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006DE30.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006DF68.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E0A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E0EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_jpeg/func_8006E418.s")
+109
View File
@@ -0,0 +1,109 @@
#include <global.h>
#include <vt.h>
#define KALEIDO_OVERLAY(name) \
{ \
NULL, (u32)_ovl_##name##SegmentRomStart, (u32)_ovl_##name##SegmentRomEnd, \
_ovl_##name##SegmentStart, _ovl_##name##SegmentEnd, \
0, #name, \
}
KaleidoManagerOvl gKaleidoMgrOverlayTable[] =
{
KALEIDO_OVERLAY(kaleido_scope),
KALEIDO_OVERLAY(player_actor),
};
void* sKaleidoAreaPtr = NULL;
KaleidoManagerOvl* gKaleidoMgrCurOvl = NULL;
u32 D_8012D1E0 = 0;
void KaleidoManager_LoadOvl(KaleidoManagerOvl* ovl)
{
LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 99);
ovl->loadedRamAddr = sKaleidoAreaPtr;
Overlay_Load(ovl->vromStart, ovl->vromEnd, ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("OVL(k):Seg:%08x-%08x Ram:%08x-%08x Off:%08x %s\n", ovl->vramStart, ovl->vramEnd, ovl->loadedRamAddr, ((u32)ovl->loadedRamAddr + ovl->vramEnd) - (u32)ovl->vramStart, (u32)ovl->vramStart - (u32)ovl->loadedRamAddr, ovl->name);
osSyncPrintf(VT_RST);
ovl->off = (u32)ovl->loadedRamAddr - (u32)ovl->vramStart;
gKaleidoMgrCurOvl = ovl;
}
void KaleidoManager_ClearOvl(KaleidoManagerOvl* ovl)
{
if (ovl->loadedRamAddr)
{
ovl->off = 0;
bzero(ovl->loadedRamAddr, ovl->vramEnd - (u32)ovl->vramStart);
ovl->loadedRamAddr = NULL;
gKaleidoMgrCurOvl = NULL;
}
}
void KaleidoManager_Init(GlobalContext* globalCtx)
{
s32 largestOvl;
s32 vramSize;
u32 idx;
largestOvl = 0;
for (idx = 0; idx < ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++)
{
vramSize = gKaleidoMgrOverlayTable[idx].vramEnd - (u32)gKaleidoMgrOverlayTable[idx].vramStart;
if (largestOvl < vramSize)
largestOvl = vramSize;
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("KaleidoArea の最大サイズは %d バイトを確保します\n", largestOvl);
osSyncPrintf(VT_RST);
sKaleidoAreaPtr = Game_Alloc(&globalCtx->state, largestOvl, "../z_kaleido_manager.c", 150);
LogUtils_CheckNullPointer("KaleidoArea_allocp", sKaleidoAreaPtr, "../z_kaleido_manager.c", 151);
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("KaleidoArea %08x - %08x\n", sKaleidoAreaPtr, (u32)sKaleidoAreaPtr + largestOvl);
osSyncPrintf(VT_RST);
gKaleidoMgrCurOvl = 0;
}
void KaleidoManager_Destroy()
{
if (gKaleidoMgrCurOvl)
{
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
gKaleidoMgrCurOvl = NULL;
}
sKaleidoAreaPtr = NULL;
}
//NOTE: this function looks messed up and probably doesn't work like how the devs wanted it to work
void* KaleidoManager_GetRamAddr(void* vram)
{
KaleidoManagerOvl* iter;
KaleidoManagerOvl* ovl;
u32 idx;
iter = gKaleidoMgrCurOvl;
ovl = iter;
if (!ovl)
{
iter = &gKaleidoMgrOverlayTable[0];
for (idx = 0; idx != ARRAY_COUNT(gKaleidoMgrOverlayTable); idx++)
{
if ((u32)vram >= (u32)iter->vramStart && (u32)iter->vramEnd >= (u32)vram)
{
KaleidoManager_LoadOvl(iter);
ovl = iter;
goto KaleidoManager_GetRamAddr_end;
}
//BUG: devs probably forgot iter++ here
}
osSyncPrintf("異常\n"); //Abnormal
return NULL;
}
KaleidoManager_GetRamAddr_end:
if (!ovl || (u32)vram < (u32)ovl->vramStart || (u32)vram >= (u32)ovl->vramEnd)
return NULL;
return (void*)((u32)vram + ovl->off);
}
+143
View File
@@ -0,0 +1,143 @@
#include <global.h>
#include <vt.h>
void (*sKaleidoScopeUpdateFunc)(GlobalContext*);
void (*sKaleidoScopeDrawFunc)(GlobalContext*);
float D_80161398;
u32 D_8016139C;
void* D_801613A0;
extern void func_80826CB4(GlobalContext*); //KaleidoScope_Update
extern void func_808262B8(GlobalContext*); //KaleidoScope_Draw
void KaleidoScopeCall_LoadPlayer()
{
if ((u32)gKaleidoMgrCurOvl != (u32)&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR])
{
if (gKaleidoMgrCurOvl)
{
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 強制排除\n"); //Kaleido area forced exclusion
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("プレイヤーアクター搬入\n"); //Player actor import
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_PLAYER_ACTOR]);
}
}
void KaleidoScopeCall_Init(GlobalContext* globalCtx)
{
//Kaleidoscope replacement construct
osSyncPrintf("カレイド・スコープ入れ替え コンストラクト \n");
sKaleidoScopeUpdateFunc = KaleidoManager_GetRamAddr(func_80826CB4);
sKaleidoScopeDrawFunc = KaleidoManager_GetRamAddr(func_808262B8);
//Note : the line numbers suggests there was a macro (see logutils.c)
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 98);
osSyncPrintf("kaleido_scope_move = %08x\n", func_80826CB4);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 99);
osSyncPrintf("kaleido_scope_move_func = %08x\n", sKaleidoScopeUpdateFunc);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 100);
osSyncPrintf("kaleido_scope_draw = %08x\n", func_808262B8);
LogUtils_LogThreadId("../z_kaleido_scope_call.c", 101);
osSyncPrintf("kaleido_scope_draw_func = %08x\n", sKaleidoScopeDrawFunc);
func_8006ECF4(globalCtx);
}
void KaleidoScopeCall_Destroy(GlobalContext* globalCtx)
{
//Kaleidoscope replacement
osSyncPrintf("カレイド・スコープ入れ替え デストラクト \n");
func_8006EE48(globalCtx);
}
//regalloc
#ifdef NON_MATCHING
void KaleidoScopeCall_Update(GlobalContext* globalCtx)
{
u32 pad;
PauseContext* pauseCtx;
pauseCtx = &globalCtx->pauseCtx;
if (pauseCtx->state != 0 || pauseCtx->flag != 0)
{
if (pauseCtx->state == 1)
{
if (func_800B38FC() == 0)
{
HREG(80) = 7;
HREG(82) = 3;
R_PAUSE_MENU_MODE = 1;
pauseCtx->unk_1E4 = 0;
pauseCtx->unk_1EC = 0;
pauseCtx->state++;
}
}
else if (pauseCtx->state == 8)
{
HREG(80) = 7;
HREG(82) = 3;
R_PAUSE_MENU_MODE = 1;
pauseCtx->unk_1E4 = 0;
pauseCtx->unk_1EC = 0;
pauseCtx->state++;
}
else if (pauseCtx->state == 2 || pauseCtx->state == 9)
{
osSyncPrintf("R_PAUSE_MENU_MODE=%d\n", R_PAUSE_MENU_MODE);
if (R_PAUSE_MENU_MODE >= 3)
pauseCtx->state++;
}
else if (pauseCtx->state != 0)
{
if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] != gKaleidoMgrCurOvl)
{
if (gKaleidoMgrCurOvl)
{
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 プレイヤー 強制排除\n"); //Kaleid Zone Player Forced Elimination
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(gKaleidoMgrCurOvl);
}
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 カレイドスコープ搬入\n"); //Kaleid area Kaleidoscope loading
osSyncPrintf(VT_RST);
KaleidoManager_LoadOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]);
}
if (&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE] == gKaleidoMgrCurOvl)
{
sKaleidoScopeUpdateFunc(globalCtx);
if (globalCtx->pauseCtx.state == 0 && globalCtx->pauseCtx.flag == 0)
{
osSyncPrintf(VT_FGCOL(GREEN));
osSyncPrintf("カレイド領域 カレイドスコープ排出\n"); //Kaleid area Kaleidoscope emission
osSyncPrintf(VT_RST);
KaleidoManager_ClearOvl(&gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]);
KaleidoScopeCall_LoadPlayer();
}
}
}
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kaleido_scope_call/KaleidoScopeCall_Update.s")
#endif
void KaleidoScopeCall_Draw(GlobalContext* globalCtx)
{
KaleidoManagerOvl *kaleidoScopeOvl;
if (R_PAUSE_MENU_MODE >= 3)
{
if ((globalCtx->pauseCtx.state >= 4 && globalCtx->pauseCtx.state < 8) || (globalCtx->pauseCtx.state >= 11 && globalCtx->pauseCtx.state < 19))
{
kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE];
if (gKaleidoMgrCurOvl == kaleidoScopeOvl)
sKaleidoScopeDrawFunc(globalCtx);
}
}
}
+9
View File
@@ -0,0 +1,9 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EE60.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EEBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kanfont/func_8006EF10.s")
+100
View File
@@ -0,0 +1,100 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F0A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F0D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F0FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F140.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F93C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006F9BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006FB94.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8006FC88.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80070600.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800706A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80070718.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80070C24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800730DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80073988.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80073A5C.s")
f32 func_800746DC()
{
return Math_Rand_ZeroOne() - 0.5f;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80074704.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80074CE8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80074D6C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80074FF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800750C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800753C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8007542C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800758AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80075B44.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80075E68.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80075F14.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800760F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800763A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800766C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_8007672C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80076934.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800773A8.s")
s32 func_800775CC()
{
return gSaveContext.unk_18;
}
void func_800775D8()
{
gSaveContext.unk_18 = 0;
}
s32 func_800775E4()
{
return gSaveContext.unk_14;
}
void func_800775F0(u16 arg0)
{
gSaveContext.unk_140E = arg0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80077600.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80077624.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_80077684.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_kankyo/func_800776E4.s")
+646
View File
@@ -0,0 +1,646 @@
#include <ultra64.h>
#include <global.h>
#ifdef NON_MATCHING
void Lib_MemSet(void* dest, size_t size, u8 val)
{
u8* destu = dest;
u32 i;
for (i = 0; i < size; i++)
{
*destu++ = val;
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lib/Lib_MemSet.s")
#endif
f32 Math_Coss(s16 angle)
{
return coss(angle) * (1.0f / 32767);
}
f32 Math_Sins(s16 angle)
{
return sins(angle) * (1.0f / 32767);
}
s32 Math_ApproxUpdateScaledS(s16* pValue, s16 target, s16 step)
{
f32 updateScale;
if (step != 0)
{
updateScale = R_UPDATE_RATE * 0.5f;
if ((s16)(*pValue - target) > 0)
step = -step;
*pValue += (s16)(step * updateScale);
if (((s16)(*pValue - target) * step) >= 0)
{
*pValue = target;
return 1;
}
}
else if (target == *pValue)
{
return 1;
}
return 0;
}
s32 Math_ApproxS(s16* pValue, s16 target, s16 step)
{
if (step != 0)
{
if (target < *pValue)
step = -step;
*pValue += step;
if (((*pValue - target) * step) >= 0)
{
*pValue = target;
return 1;
}
}
else if (target == *pValue)
{
return 1;
}
return 0;
}
s32 Math_ApproxF(f32* pValue, f32 target, f32 step)
{
if (step != 0.0f)
{
if (target < *pValue)
step = -step;
*pValue += step;
if (((*pValue - target) * step) >= 0)
{
*pValue = target;
return 1;
}
}
else if (target == *pValue)
{
return 1;
}
return 0;
}
s32 func_80077A90(s16* pValue, s16 target, s16 step)
{
s16 orig = *pValue;
*pValue += step;
if (((s16)(*pValue - target) * (s16)(orig - target)) <= 0)
{
*pValue = target;
return 1;
}
return 0;
}
s32 func_80077AF8(s16* pValue, s16 target, s16 step)
{
s16 orig = *pValue;
*pValue += step;
if (((*pValue - target) * ((s16)orig - target)) <= 0)
{
*pValue = target;
return 1;
}
return 0;
}
s32 func_80077B58(s16* pValue, s16 target, s16 step)
{
s32 phi_v0 = target - *pValue;
if (phi_v0 < 0)
step = -step;
if (phi_v0 >= 0x8000)
{
step = -step;
phi_v0 = 0xFFFF0001 - -phi_v0;
}
else if (phi_v0 <= -0x8000)
{
phi_v0 += 0xFFFF;
step = -step;
}
if (step != 0)
{
*pValue += step;
if ((phi_v0 * step) <= 0)
{
*pValue = target;
return 1;
}
}
else if (target == *pValue)
{
return 1;
}
return 0;
}
s32 func_80077C1C(f32* pValue, f32 target, f32 step)
{
f32 orig = *pValue;
*pValue += step;
if (((*pValue - target) * (orig - target)) <= 0)
{
*pValue = target;
return 1;
}
return 0;
}
s32 func_80077C6C(f32* pValue, f32 target, f32 incrStep, f32 decrStep)
{
f32 step = (target >= *pValue) ? incrStep : decrStep;
if (step != 0.0f)
{
if (target < *pValue)
step = -step;
*pValue += step;
if (((*pValue - target) * step) >= 0)
{
*pValue = target;
return 1;
}
}
else if (target == *pValue)
{
return 1;
}
return 0;
}
typedef struct
{
/* 0x00 */ char unk_00[0x14];
/* 0x14 */ s8 unk_14;
/* 0x14 */ s8 unk_15;
} struct_80077D10;
void func_80077D10(f32* arg0, s16* arg1, struct_80077D10* arg2)
{
f32 var1 = arg2->unk_14;
f32 var2 = arg2->unk_15;
*arg0 = sqrtf(SQ(var1) + SQ(var2));
*arg0 = (60.0f < *arg0) ? 60.0f : *arg0;
*arg1 = atan2s(var2, -var1);
}
s16 Math_Rand_S16Offset(s16 base, s16 range)
{
return (s16)(Math_Rand_ZeroOne() * range) + base;
}
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range)
{
return (s16)(Math_Rand_ZeroOne() * range) * stride + base;
}
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src)
{
dest->x = src->x;
dest->y = src->y;
dest->z = src->z;
}
void Math_Vec3s_ToVec3f(Vec3f* dest, Vec3s* src)
{
dest->x = src->x;
dest->y = src->y;
dest->z = src->z;
}
void Math_Vec3f_Sum(Vec3f* a, Vec3f* b, Vec3f* dest)
{
dest->x = a->x + b->x;
dest->y = a->y + b->y;
dest->z = a->z + b->z;
}
void Math_Vec3f_Diff(Vec3f* a, Vec3f* b, Vec3f* dest)
{
dest->x = a->x - b->x;
dest->y = a->y - b->y;
dest->z = a->z - b->z;
}
void Math_Vec3s_DiffToVec3f(Vec3f* dest, Vec3s* a, Vec3s* b)
{
dest->x = a->x - b->x;
dest->y = a->y - b->y;
dest->z = a->z - b->z;
}
void Math_Vec3f_Scale(Vec3f* vec, f32 scaleF)
{
vec->x *= scaleF;
vec->y *= scaleF;
vec->z *= scaleF;
}
f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b)
{
f32 dx = b->x - a->x;
f32 dy = b->y - a->y;
f32 dz = b->z - a->z;
return sqrtf(SQ(dx) + SQ(dy) + SQ(dz));
}
f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest)
{
dest->x = b->x - a->x;
dest->y = b->y - a->y;
dest->z = b->z - a->z;
return sqrtf(SQ(dest->x) + SQ(dest->y) + SQ(dest->z));
}
f32 Math_Vec3f_DistXZ(Vec3f* a, Vec3f* b)
{
f32 dx = b->x - a->x;
f32 dz = b->z - a->z;
return sqrtf(SQ(dx) + SQ(dz));
}
f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b)
{
return b->y - a->y;
}
s16 Math_Vec3f_Yaw(Vec3f* a, Vec3f* b)
{
f32 dx = b->x - a->x;
f32 dz = b->z - a->z;
return atan2s(dz, dx);
}
s16 Math_Vec3f_Pitch(Vec3f* a, Vec3f* b)
{
return atan2s(Math_Vec3f_DistXZ(a, b), a->y - b->y);
}
void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_s8(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_u16(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_s16(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_u32(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_s32(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_f32(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_f32div1000(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain);
void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain);
void (*sInitChainHandlers[])(u8* ptr, InitChainEntry* ichain) =
{
IChain_Apply_u8,
IChain_Apply_s8,
IChain_Apply_u16,
IChain_Apply_s16,
IChain_Apply_u32,
IChain_Apply_s32,
IChain_Apply_f32,
IChain_Apply_f32div1000,
IChain_Apply_Vec3f,
IChain_Apply_Vec3fdiv1000,
IChain_Apply_Vec3s,
};
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* ichain)
{
do sInitChainHandlers[ichain->type]((u8*)actor, ichain);
while ((ichain++)->cont);
}
void IChain_Apply_u8(u8* ptr, InitChainEntry* ichain)
{
*(u8*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_s8(u8* ptr, InitChainEntry* ichain)
{
*(s8*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_u16(u8* ptr, InitChainEntry* ichain)
{
*(u16*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_s16(u8* ptr, InitChainEntry* ichain)
{
*(s16*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_u32(u8* ptr, InitChainEntry* ichain)
{
*(u32*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_s32(u8* ptr, InitChainEntry* ichain)
{
*(s32*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_f32(u8* ptr, InitChainEntry* ichain)
{
*(f32*)(ptr + ichain->offset) = ichain->value;
}
void IChain_Apply_f32div1000(u8* ptr, InitChainEntry* ichain)
{
*(f32*)(ptr + ichain->offset) = ichain->value / 1000.0f;
}
void IChain_Apply_Vec3f(u8* ptr, InitChainEntry* ichain)
{
Vec3f* vec;
f32 val;
vec = (Vec3f*)(ptr + ichain->offset);
val = ichain->value;
vec->z = val;
vec->y = val;
vec->x = val;
}
void IChain_Apply_Vec3fdiv1000(u8* ptr, InitChainEntry* ichain)
{
Vec3f* vec;
f32 val;
vec = (Vec3f*)(ptr + ichain->offset);
osSyncPrintf("pp=%x data=%f\n", vec, (f64)(ichain->value / 1000.0f));
val = ichain->value / 1000.0f;
vec->z = val;
vec->y = val;
vec->x = val;
}
void IChain_Apply_Vec3s(u8* ptr, InitChainEntry* ichain)
{
Vec3s* vec;
s16 val;
vec = (Vec3s*)(ptr + ichain->offset);
val = ichain->value;
vec->z = val;
vec->y = val;
vec->x = val;
}
f32 Math_SmoothScaleMaxMinF(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep)
{
f32 var;
if (*pValue != target)
{
var = (target - *pValue) * scale;
if ((var >= minStep) || (var <= -minStep))
{
if (var > maxStep)
var = maxStep;
if (var < -maxStep)
var = -maxStep;
*pValue += var;
}
else
{
if (var < minStep)
{
*pValue += minStep;
var = minStep;
if (target < *pValue)
*pValue = target;
}
if (var > -minStep)
{
*pValue += -minStep;
if (*pValue < target)
*pValue = target;
}
}
}
return fabsf(target - *pValue);
}
void Math_SmoothScaleMaxF(f32* pValue, f32 target, f32 scale, f32 maxStep)
{
f32 step;
if (*pValue != target)
{
step = (target - *pValue) * scale;
if (step > maxStep)
step = maxStep;
else if (step < -maxStep)
step = -maxStep;
*pValue += step;
}
}
void Math_SmoothDownscaleMaxF(f32* pValue, f32 scale, f32 maxStep)
{
f32 step;
step = *pValue * scale;
if (step > maxStep)
step = maxStep;
else if (step < -maxStep)
step = -maxStep;
*pValue -= step;
}
f32 func_800784D8(f32* pValue, f32 target, f32 scale, f32 maxStep, f32 minStep)
{
f32 step;
f32 baseStep;
step = 0.0f;
baseStep = target - *pValue;
if (*pValue != target)
{
if (baseStep > 180.0f)
baseStep = -(360.0f - baseStep);
else if (baseStep < -180.0f)
baseStep = 360.0f + baseStep;
step = baseStep * scale;
if ((step >= minStep) || (step <= -minStep))
{
if (step > maxStep)
step = maxStep;
if (step < -maxStep)
step = -maxStep;
*pValue += step;
}
else
{
if (step < minStep)
{
step = minStep;
*pValue += step;
if (*pValue > target)
*pValue = target;
}
if (step > -minStep)
{
step = -minStep;
*pValue += step;
if (*pValue < target)
*pValue = target;
}
}
}
if (*pValue >= 360.0f)
*pValue -= 360.0f;
if (*pValue < 0.0f)
*pValue += 360.0f;
return step;
}
#ifdef NON_MATCHING
// regalloc differences
s16 Math_SmoothScaleMaxMinS(s16* pValue, s16 target, s16 invScale, s16 maxStep, s16 minStep)
{
s16 diff = (target - *pValue);
s32 baseStep;
s16 step;
baseStep = diff / invScale;
if (*pValue != target)
{
step = baseStep;
if ((step > minStep) || (step < -minStep))
{
if (step > maxStep)
step = maxStep;
if (step < -maxStep)
step = -maxStep;
*pValue += step;
}
else
{
if (diff >= 0)
{
*pValue += minStep;
if ((s16)(target - *pValue) <= 0)
*pValue = target;
}
else
{
*pValue -= minStep;
if ((s16)(target - *pValue) >= 0)
*pValue = target;
}
}
}
return diff;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lib/Math_SmoothScaleMaxMinS.s")
#endif
void Math_SmoothScaleMaxS(s16* pValue, s16 target, s16 invScale, s16 maxStep)
{
s16 step = target - *pValue;
step /= invScale;
if (step > maxStep)
*pValue += maxStep;
else if (step < -maxStep)
*pValue -= maxStep;
else
*pValue += step;
}
void Color_RGBA8_Copy(Color_RGBA8* dst, Color_RGBA8* src)
{
dst->r = src->r;
dst->g = src->g;
dst->b = src->b;
dst->a = src->a;
}
void func_80078884(u16 sfxId)
{
Audio_PlaySoundGeneral(sfxId, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
void func_800788CC(u16 sfxId)
{
Audio_PlaySoundGeneral(sfxId, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
void func_80078914(Vec3f* arg0, u16 sfxId)
{
Audio_PlaySoundGeneral(sfxId, arg0, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
+519
View File
@@ -0,0 +1,519 @@
#include <ultra64.h>
#include <global.h>
extern s16 D_8011FF10[3];
extern s16 D_8011FF24[3];
extern s16 D_8011FF38[3];
extern s16 D_8011FF4C[3];
extern s16 D_8011FF60[3];
extern s16 D_8011FF74[3];
extern s16 D_8011FF88[3];
extern s16 D_8011FF9C[3];
extern u8* D_8011FFB0[];
extern u8* D_8011FFF0[];
s16 D_8015FDC0[3];
s16 D_8015FDC8[3];
s16 D_8015FDD0[6];
s16 D_8015FDE0[6];
void Health_InitData(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 = gSaveContext.health;
interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0;
interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0;
interfaceCtx->unk_20E[0] = 0xFF;
interfaceCtx->unk_20E[2] = 0x46;
interfaceCtx->unk_20E[4] = 0x32;
interfaceCtx->unk_21A[0] = 0x32;
interfaceCtx->unk_21A[2] = 0x28;
interfaceCtx->unk_21A[4] = 0x3C;
interfaceCtx->unk_20E[1] = 0xFF;
interfaceCtx->unk_20E[3] = 0x46;
interfaceCtx->unk_20E[5] = 0x32;
interfaceCtx->unk_21A[1] = 0x32;
interfaceCtx->unk_21A[3] = 0x28;
interfaceCtx->unk_21A[5] = 0x3C;
D_8015FDD0[0] = D_8015FDD0[3] = 0xFF;
D_8015FDD0[1] = D_8015FDD0[4] = 0xFF;
D_8015FDD0[2] = D_8015FDD0[5] = 0xFF;
D_8015FDE0[0] = D_8015FDE0[3] = 0xC8;
D_8015FDE0[1] = D_8015FDE0[4] = 0x00;
D_8015FDE0[2] = D_8015FDE0[5] = 0x00;
}
#ifdef NON_MATCHING
// this function still needs some work
void Health_UpdateData(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
f32 temp_f0 = interfaceCtx->unk_1FE * 0.1f;
s16 temp1, temp2, temp3;
if (0) ;
if (interfaceCtx->unk_200 != 0)
{
interfaceCtx->unk_1FE--;
if (interfaceCtx->unk_1FE <= 0)
{
interfaceCtx->unk_1FE = 0;
interfaceCtx->unk_200 = 0;
}
}
else
{
interfaceCtx->unk_1FE++;
if (interfaceCtx->unk_1FE >= 10)
{
interfaceCtx->unk_1FE = 10;
interfaceCtx->unk_200 = 1;
}
}
interfaceCtx->unk_20E[0] = 0xFF;
interfaceCtx->unk_20E[2] = 0x46;
interfaceCtx->unk_20E[4] = 0x32;
interfaceCtx->unk_21A[0] = 0x32;
interfaceCtx->unk_21A[2] = 0x28;
interfaceCtx->unk_21A[4] = 0x3C;
interfaceCtx->unk_20E[1] = D_8011FF10[0];
interfaceCtx->unk_20E[3] = D_8011FF10[1];
interfaceCtx->unk_20E[5] = D_8011FF10[2];
interfaceCtx->unk_21A[1] = D_8011FF24[0];
interfaceCtx->unk_21A[3] = D_8011FF24[1];
interfaceCtx->unk_21A[5] = D_8011FF24[2];
temp1 = D_8011FF38[0];
temp2 = D_8011FF38[1];
temp3 = D_8011FF38[2];
temp1 *= temp_f0;
interfaceCtx->unk_202[0] = (u8)(temp1 + 0xFF);
temp2 *= temp_f0;
interfaceCtx->unk_202[1] = (u8)(temp2 + 0x46);
temp3 *= temp_f0;
interfaceCtx->unk_202[2] = (u8)(temp3 + 0x32);
temp1 = D_8011FF4C[0];
temp2 = D_8011FF4C[1];
temp3 = D_8011FF4C[2];
temp1 *= temp_f0;
interfaceCtx->unk_208[0] = (u8)(temp1 + 0x32);
temp2 *= temp_f0;
interfaceCtx->unk_208[1] = (u8)(temp2 + 0x28);
temp3 *= temp_f0;
interfaceCtx->unk_208[2] = (u8)(temp2 + 0x3C);
D_8015FDD0[0] = 0xFF;
D_8015FDD0[1] = 0xFF;
D_8015FDD0[2] = 0xFF;
D_8015FDE0[0] = 0xC8;
D_8015FDE0[1] = 0x00;
D_8015FDE0[2] = 0x00;
D_8015FDD0[3] = D_8011FF60[0];
D_8015FDD0[4] = D_8011FF60[1];
D_8015FDD0[5] = D_8011FF60[2];
D_8015FDE0[3] = D_8011FF74[0];
D_8015FDE0[4] = D_8011FF74[1];
D_8015FDE0[5] = D_8011FF74[2];
temp1 = D_8011FF88[0];
temp2 = D_8011FF88[1];
temp3 = D_8011FF88[2];
temp1 *= temp_f0;
D_8015FDC0[0] = (u8)(temp1 + 0xFF);
temp2 *= temp_f0;
D_8015FDC0[1] = (u8)(temp2 + 0xFF);
temp3 *= temp_f0;
D_8015FDC0[2] = (u8)(temp3 + 0xFF);
temp1 = D_8011FF9C[0];
temp2 = D_8011FF9C[1];
temp3 = D_8011FF9C[2];
temp1 *= temp_f0;
D_8015FDC8[0] = (u8)(temp1 + 0xC8);
temp2 *= temp_f0;
D_8015FDC8[1] = (u8)(temp2 + 0x00);
temp3 *= temp_f0;
D_8015FDC8[2] = (u8)(temp3 + 0x00);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lifemeter/Health_UpdateData.s")
#endif
s32 func_80078E18(GlobalContext* globalCtx)
{
gSaveContext.health = globalCtx->interfaceCtx.unk_226;
return 1;
}
s32 func_80078E34(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 += 0x10;
if (interfaceCtx->unk_226 >= gSaveContext.health)
{
interfaceCtx->unk_226 = gSaveContext.health;
return 1;
}
return 0;
}
s32 func_80078E84(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
if (interfaceCtx->unk_228 != 0)
{
interfaceCtx->unk_228--;
}
else
{
interfaceCtx->unk_228 = 0x140;
interfaceCtx->unk_226 -= 0x10;
if (interfaceCtx->unk_226 <= 0)
{
interfaceCtx->unk_226 = 0;
globalCtx->unk_11D58(globalCtx, -(gSaveContext.health + 1));
return 1;
}
}
return 0;
}
void Interface_DrawHealth(GlobalContext* globalCtx)
{
s32 pad[5];
u8* heartBgImg;
u32 curColorSet;
f32 offsetX;
f32 offsetY;
s32 i;
f32 temp1;
f32 temp2;
f32 temp3;
f32 temp4;
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Vtx* sp154 = interfaceCtx->vtx_12C;
s32 curHeartFraction = gSaveContext.health % 0x10;
s16 totalHeartCount = gSaveContext.health_capacity / 0x10;
s16 fullHeartCount = gSaveContext.health / 0x10;
s32 pad2;
f32 sp144 = interfaceCtx->unk_22A * 0.1f;
s32 curCombineModeSet = 0;
u8* curBgImgLoaded = NULL;
s32 ddHeartCountMinusOne = gSaveContext.defense_hearts - 1;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, gfxCtx, "../z_lifemeter.c", 353);
if (!(gSaveContext.health % 0x10))
fullHeartCount--;
curColorSet = -1;
offsetY = 0.0f;
offsetX = 0.0f;
for (i = 0; i < totalHeartCount; i++)
{
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne))
{
if (i < fullHeartCount)
{
if (curColorSet != 0)
{
curColorSet = 0;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2],
interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2],
interfaceCtx->unk_21A[4], 0xFF);
}
}
else if (i == fullHeartCount)
{
if (curColorSet != 1)
{
curColorSet = 1;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
interfaceCtx->unk_202[0], interfaceCtx->unk_202[1],
interfaceCtx->unk_202[2], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
interfaceCtx->unk_208[0], interfaceCtx->unk_208[1],
interfaceCtx->unk_208[2], 0xFF);
}
}
else if (i > fullHeartCount)
{
if (curColorSet != 2)
{
curColorSet = 2;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
interfaceCtx->unk_20E[0], interfaceCtx->unk_20E[2],
interfaceCtx->unk_20E[4], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
interfaceCtx->unk_21A[0], interfaceCtx->unk_21A[2],
interfaceCtx->unk_21A[4], 0xFF);
}
}
else
{
if (curColorSet != 3)
{
curColorSet = 3;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
interfaceCtx->unk_20E[1], interfaceCtx->unk_20E[3],
interfaceCtx->unk_20E[5], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
interfaceCtx->unk_21A[1], interfaceCtx->unk_21A[3],
interfaceCtx->unk_21A[5], 0xFF);
}
}
if (i < fullHeartCount)
heartBgImg = D_02000400;
else if (i == fullHeartCount)
heartBgImg = D_8011FFB0[curHeartFraction];
else
heartBgImg = D_02000000;
}
else
{
if (i < fullHeartCount)
{
if (curColorSet != 4)
{
curColorSet = 4;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
D_8015FDD0[0], D_8015FDD0[1],
D_8015FDD0[2], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
D_8015FDE0[0], D_8015FDE0[1],
D_8015FDE0[2], 0xFF);
}
}
else if (i == fullHeartCount)
{
if (curColorSet != 5)
{
curColorSet = 5;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
D_8015FDC0[0], D_8015FDC0[1],
D_8015FDC0[2], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
D_8015FDC8[0], D_8015FDC8[1],
D_8015FDC8[2], 0xFF);
}
}
else if (i > fullHeartCount)
{
if (curColorSet != 6)
{
curColorSet = 6;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
D_8015FDD0[0], D_8015FDD0[1],
D_8015FDD0[2], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
D_8015FDE0[0], D_8015FDE0[1],
D_8015FDE0[2], 0xFF);
}
}
else
{
if (curColorSet != 7)
{
curColorSet = 7;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0,
D_8015FDD0[3], D_8015FDD0[4],
D_8015FDD0[5], interfaceCtx->healthAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++,
D_8015FDE0[3], D_8015FDE0[4],
D_8015FDE0[5], 0xFF);
}
}
if (i < fullHeartCount)
heartBgImg = D_02000900;
else if (i == fullHeartCount)
heartBgImg = D_8011FFF0[curHeartFraction];
else
heartBgImg = D_02000500;
}
if (curBgImgLoaded != heartBgImg)
{
curBgImgLoaded = heartBgImg;
gDPLoadTextureBlock(gfxCtx->overlay.p++,
heartBgImg,
G_IM_FMT_IA,
G_IM_SIZ_8b,
16, 16,
0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
}
if (i != fullHeartCount)
{
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne))
{
if (curCombineModeSet != 1)
{
curCombineModeSet = 1;
func_80094520(gfxCtx);
gDPSetCombineLERP(gfxCtx->overlay.p++,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
}
}
else
{
if (curCombineModeSet != 3)
{
curCombineModeSet = 3;
func_80094520(gfxCtx);
gDPSetCombineLERP(gfxCtx->overlay.p++,
ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0,
ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
}
}
temp3 = 26.0f + offsetY;
temp2 = 30.0f + offsetX;
temp4 = 1.0f;
temp4 /= 0.68f;
temp4 *= 1024.0f;
temp1 = 8.0f;
temp1 *= 0.68f;
gSPTextureRectangle(gfxCtx->overlay.p++,
(s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4),
(s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4),
G_TX_RENDERTILE,
0, 0,
(s32)temp4, (s32)temp4);
}
else
{
if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne))
{
if (curCombineModeSet != 2)
{
curCombineModeSet = 2;
func_80094A14(gfxCtx);
gDPSetCombineLERP(gfxCtx->overlay.p++,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
}
}
else
{
if (curCombineModeSet != 4)
{
curCombineModeSet = 4;
func_80094A14(gfxCtx);
gDPSetCombineLERP(gfxCtx->overlay.p++,
ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0,
ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
}
}
if (1)
{
Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx));
func_800D2CEC(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144),
-130.0f + offsetX, 94.5f - offsetY, 0.0f);
gSPMatrix(gfxCtx->overlay.p++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(gfxCtx->overlay.p++, sp154, 4, 0);
gSP1Quadrangle(gfxCtx->overlay.p++, 0, 2, 3, 1, 0);
}
}
offsetX += 10.0f;
if (i == 9)
{
offsetY += 10.0f;
offsetX = 0.0f;
}
}
func_800C6B54(gfxArr, gfxCtx, "../z_lifemeter.c", 606);
}
u32 Health_IsCritical(void);
void Health_HandleCriticalAlarm(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
if (interfaceCtx->unk_22C != 0)
{
interfaceCtx->unk_22A--;
if (interfaceCtx->unk_22A <= 0)
{
interfaceCtx->unk_22A = 0;
interfaceCtx->unk_22C = 0;
if (!func_8008E988(globalCtx) && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.flag == 0) && Health_IsCritical() && !func_800BFC84(globalCtx))
{
func_80078884(NA_SE_SY_HITPOINT_ALARM);
}
}
}
else
{
interfaceCtx->unk_22A++;
if (interfaceCtx->unk_22A >= 10)
{
interfaceCtx->unk_22A = 10;
interfaceCtx->unk_22C = 1;
}
}
}
u32 Health_IsCritical(void)
{
s32 var;
if (gSaveContext.health_capacity <= 0x50)
var = 0x10;
else if (gSaveContext.health_capacity <= 0xA0)
var = 0x18;
else if (gSaveContext.health_capacity <= 0xF0)
var = 0x20;
else
var = 0x2C;
if ((var >= gSaveContext.health) && (gSaveContext.health > 0))
return 1;
else
return 0;
}
+214
View File
@@ -0,0 +1,214 @@
#include <ultra64.h>
#include <global.h>
extern LightsList sLightsList;
void Lights_InitPositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius, u32 type)
{
info->type = type;
info->params.posX = posX;
info->params.posY = posY;
info->params.posZ = posZ;
Lights_SetPositionalLightColorAndRadius(info, red, green, blue, radius);
}
void Lights_InitType0PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius)
{
Lights_InitPositionalLight(info, posX, posY, posZ, red, green, blue, radius, 0);
}
void Lights_InitType2PositionalLight(LightInfoPositional* info, s16 posX, s16 posY, s16 posZ, u8 red, u8 green, u8 blue, s16 radius)
{
Lights_InitPositionalLight(info, posX, posY, posZ, red, green, blue, radius, 2);
}
void Lights_SetPositionalLightColorAndRadius(LightInfoPositional* info, u8 red, u8 green, u8 blue, s16 radius)
{
info->params.red = red;
info->params.green = green;
info->params.blue = blue;
info->params.radius = radius;
}
void Lights_InitDirectional(LightInfoDirectional* info, s8 dirX, s8 dirY, s8 dirZ, u8 red, u8 green, u8 blue)
{
info->type = 1;
info->params.dirX = dirX;
info->params.dirY = dirY;
info->params.dirZ = dirZ;
info->params.red = red;
info->params.green = green;
info->params.blue = blue;
}
void Lights_MapperInit(LightMapper* mapper, u8 red, u8 green, u8 blue)
{
mapper->ambient.l.col[0] = red;
mapper->ambient.l.colc[0] = red;
mapper->ambient.l.col[1] = green;
mapper->ambient.l.colc[1] = green;
mapper->ambient.l.col[2] = blue;
mapper->ambient.l.colc[2] = blue;
mapper->numLights = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_80079EFC.s")
Light* Lights_MapperGetNextFreeSlot(LightMapper* mapper)
{
if (6 < mapper->numLights)
return NULL;
return &mapper->lights[mapper->numLights++];
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A084.s")
void func_8007A40C(LightMapper* mapper, LightInfoDirectionalParams* params, GlobalContext* globalCtx)
{
Light* light = Lights_MapperGetNextFreeSlot(mapper);
if (light != NULL)
{
light->l.col[0] = light->l.colc[0] = params->red;
light->l.col[1] = light->l.colc[1] = params->green;
light->l.col[2] = light->l.colc[2] = params->blue;
light->l.dir[0] = params->dirX;
light->l.dir[1] = params->dirY;
light->l.dir[2] = params->dirZ;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A474.s")
z_Light* Lights_FindFreeSlot()
{
z_Light* ret;
if (0x1F < sLightsList.numOccupied)
return NULL;
ret = &sLightsList.lights[sLightsList.nextFree];
while (ret->info != NULL)
{
sLightsList.nextFree++;
if (sLightsList.nextFree < 0x20)
{
ret++;
}
else
{
sLightsList.nextFree = 0;
ret = &sLightsList.lights[0];
}
}
sLightsList.numOccupied++;
return ret;
}
#ifdef NON_MATCHING
// single ordering difference
void Lights_Free(z_Light* light)
{
if (light != NULL)
{
sLightsList.numOccupied--;
light->info = NULL;
sLightsList.nextFree = (light - sLightsList.lights) / sizeof(z_Light); //! @bug Due to pointer arithmetic, the division is unnecessary
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/Lights_Free.s")
#endif
void func_8007A614(GlobalContext* globalCtx, LightingContext* lightCtx)
{
Lights_ClearHead(globalCtx, lightCtx);
Lights_SetAmbientColor(lightCtx, 0x50, 0x50, 0x50);
func_8007A698(lightCtx, 0, 0, 0, 0x3e4, 0x3200);
bzero(&sLightsList, sizeof(sLightsList));
}
void Lights_SetAmbientColor(LightingContext* lightCtx, u8 red, u8 green, u8 blue)
{
lightCtx->ambientRed = red;
lightCtx->ambientGreen = green;
lightCtx->ambientBlue = blue;
}
void func_8007A698(LightingContext* lightCtx, u8 arg1, u8 arg2, u8 arg3, s16 arg4, s16 arg5)
{
lightCtx->unk_07 = arg1;
lightCtx->unk_08 = arg2;
lightCtx->unk_09 = arg3;
lightCtx->unk_0A = arg4;
lightCtx->unk_0C = arg5;
}
LightMapper* Lights_CreateMapper(LightingContext* lightCtx, GraphicsContext* gfxCtx)
{
return func_8007A960(gfxCtx, lightCtx->ambientRed, lightCtx->ambientGreen, lightCtx->ambientBlue);
}
void Lights_ClearHead(GlobalContext* globalCtx, LightingContext* lightCtx)
{
lightCtx->lightsHead = NULL;
}
void Lights_RemoveAll(GlobalContext* globalCtx, LightingContext* lightCtx)
{
while (lightCtx->lightsHead != NULL)
{
Lights_Remove(globalCtx, lightCtx, lightCtx->lightsHead);
lightCtx->lightsHead = lightCtx->lightsHead->next;
}
}
z_Light* Lights_Insert(GlobalContext* globalCtx, LightingContext* lightCtx, LightInfo* info)
{
z_Light* light;
light = Lights_FindFreeSlot();
if (light != NULL)
{
light->info = info;
light->prev = NULL;
light->next = lightCtx->lightsHead;
if (lightCtx->lightsHead != NULL)
lightCtx->lightsHead->prev = light;
lightCtx->lightsHead = light;
}
return light;
}
void Lights_Remove(GlobalContext* globalCtx, LightingContext* lightCtx, z_Light* light)
{
if (light != NULL)
{
if (light->prev != NULL)
light->prev->next = light->next;
else
lightCtx->lightsHead = light->next;
if (light->next != NULL)
light->next->prev = light->prev;
Lights_Free(light);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A824.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A960.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007A9B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_lights/func_8007ABBC.s")
+131
View File
@@ -0,0 +1,131 @@
#include <global.h>
#define LOG_SEVERITY_NOLOG 0
#define LOG_SEVERITY_ERROR 2
#define LOG_SEVERITY_VERBOSE 3
s32 gZeldaArenaLogSeverity = LOG_SEVERITY_ERROR;
Arena sZeldaArena;
void ZeldaArena_CheckPointer(void* ptr, u32 size, const char* name, const char* action)
{
if (!ptr)
{
if (gZeldaArenaLogSeverity >= LOG_SEVERITY_ERROR)
{
//"%s: %u bytes %s failed\n"
osSyncPrintf("%s: %u バイトの%sに失敗しました\n", name, size, action);
__osDisplayArena(&sZeldaArena);
return;
}
}
else if (gZeldaArenaLogSeverity >= LOG_SEVERITY_VERBOSE)
{
//"%s: %u bytes %s succeeded\n"
osSyncPrintf("%s: %u バイトの%sに成功しました\n", name, size, action);
}
}
void* ZeldaArena_Malloc(u32 size)
{
void* ptr;
ptr = __osMalloc(&sZeldaArena, size);
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc", "確保"); //Secure
return ptr;
}
void* ZeldaArena_MallocDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocDebug(&sZeldaArena, size, file, line);
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_DEBUG", "確保"); //Secure
return ptr;
}
void* ZeldaArena_MallocR(u32 size)
{
void* ptr;
ptr = __osMallocR(&sZeldaArena, size);
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r", "確保"); //Secure
return ptr;
}
void* ZeldaArena_MallocRDebug(u32 size, const char* file, s32 line)
{
void* ptr;
ptr = __osMallocRDebug(&sZeldaArena, size, file, line);
ZeldaArena_CheckPointer(ptr, size, "zelda_malloc_r_DEBUG", "確保"); //Secure
return ptr;
}
void* ZeldaArena_Realloc(void* ptr, u32 newSize)
{
ptr = __osRealloc(&sZeldaArena, ptr, newSize);
ZeldaArena_CheckPointer(ptr, newSize, "zelda_realloc", "再確保"); // Re-securing
return ptr;
}
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
return ptr;
}
void ZeldaArena_Free(void* ptr)
{
__osFree(&sZeldaArena, ptr);
}
void ZeldaArena_FreeDebug(void* ptr, const char* file, s32 line)
{
__osFreeDebug(&sZeldaArena, ptr, file, line);
}
void* ZeldaArena_Calloc(u32 num, u32 size)
{
void* ret;
u32 n;
n = num*size;
ret = __osMalloc(&sZeldaArena, n);
if (ret)
bzero(ret, n);
ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保");
return ret;
}
void ZeldaArena_Display()
{
//Zelda heap display
osSyncPrintf("ゼルダヒープ表示\n");
__osDisplayArena(&sZeldaArena);
}
void ZeldaArena_GetSizes(u32* outMaxFree, u32* outFree, u32* outAlloc)
{
ArenaImpl_GetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc);
}
void ZeldaArena_Check()
{
__osCheckArena(&sZeldaArena);
}
void ZeldaArena_Init(void* start, u32 size)
{
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocInit(&sZeldaArena, start, size);
}
void ZeldaArena_Cleanup()
{
gZeldaArenaLogSeverity = LOG_SEVERITY_NOLOG;
__osMallocCleanup(&sZeldaArena);
}
u8 ZeldaArena_IsInitalized()
{
return __osMallocIsInitalized(&sZeldaArena);
}
+25
View File
@@ -0,0 +1,25 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_800807A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_800807FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_800808FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80080AB4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80080E04.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80080F44.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80080F68.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80081240.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/Interface_DrawMinimap.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_80082248.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/func_8008226C.s")
+181
View File
@@ -0,0 +1,181 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
typedef struct
{
/* 0x00 */ void* texture;
/* 0x04 */ u32 imageFormat;
/* 0x08 */ u32 imageSize;
/* 0x0C */ u32 textureWidth;
/* 0x10 */ u32 textureHeight;
/* 0x14 */ u32 rectWidth;
/* 0x18 */ u32 rectHeight;
/* 0x1C */ u32 dsdx;
/* 0x20 */ u32 dtdy;
} MapMarkInfo; // size = 0x24
typedef struct
{
/* 0x00 */ void* loadedRamAddr; // original name: "allocp"
/* 0x04 */ u32 vromStart;
/* 0x08 */ u32 vromEnd;
/* 0x0C */ u32 vramStart;
/* 0x10 */ u32 vramEnd;
/* 0x14 */ u32 vramTable;
} MapMarkDataOverlay; // size = 0x18
static u32 sBaseImageSizes[] = { 0, 1, 2, 3 };
static u32 sLoadBlockImageSizes[] = { 2, 2, 2, 3 };
static u32 sIncrImageSizes[] = { 3, 1, 0, 0 };
static u32 sShiftImageSizes[] = { 2, 1, 0, 0 };
static u32 sBytesImageSizes[] = { 0, 1, 2, 4 };
static u32 sLineBytesImageSizes[] = { 0, 1, 2, 2 };
#define G_IM_SIZ_MARK sBaseImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_LOAD_BLOCK sLoadBlockImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_INCR sIncrImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_SHIFT sShiftImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_BYTES sBytesImageSizes[markInfo->imageSize]
#define G_IM_SIZ_MARK_LINE_BYTES sLineBytesImageSizes[markInfo->imageSize]
static MapMarkInfo sMapMarkInfoTable[] =
{
{ D_02002580, G_IM_FMT_RGBA, G_IM_SIZ_16b, 8, 8, 32, 32, 1024, 1024 }, // Chest Icon
{ D_02002900, G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 32, 32, 1024, 1024 }, // Boss Skull Icon
};
static MapMarkDataOverlay sMapMarkDataOvl =
{
NULL,
(u32)_ovl_map_mark_dataSegmentRomStart,
(u32)_ovl_map_mark_dataSegmentRomEnd,
(u32)_ovl_map_mark_dataSegmentStart,
(u32)_ovl_map_mark_dataSegmentEnd,
(u32)gMapMarkDataTable
};
static MapMarksData** sLoadedMarkDataTable;
extern u8** D_8015FFD0;
void MapMark_Init(GlobalContext* globalCtx)
{
MapMarkDataOverlay* overlay = &sMapMarkDataOvl;
u32 overlaySize = overlay->vramEnd - overlay->vramStart;
overlay->loadedRamAddr = Game_Alloc(&globalCtx->state, overlaySize, "../z_map_mark.c", 235);
LogUtils_CheckNullPointer("dlftbl->allocp", overlay->loadedRamAddr, "../z_map_mark.c", 236);
Overlay_Load(overlay->vromStart, overlay->vromEnd,
overlay->vramStart, overlay->vramEnd,
overlay->loadedRamAddr);
sLoadedMarkDataTable = gMapMarkDataTable;
sLoadedMarkDataTable = (void*)(s32)((overlay->vramTable != 0) ?
(void*)(overlay->vramTable - (s32)(overlay->vramStart - (s32)overlay->loadedRamAddr)) :
NULL);
}
void MapMark_ClearPointers(GlobalContext* globalCtx)
{
sMapMarkDataOvl.loadedRamAddr = NULL;
sLoadedMarkDataTable = NULL;
}
void MapMark_Draw(GlobalContext* globalCtx)
{
InterfaceContext* interfaceCtx;
MapMarkData* mapMarkData;
MapMarkPoint* markPoint;
MapMarkInfo* markInfo;
u16 dungeonId;
s32 i;
s32 rectLeft;
s32 rectTop;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
dungeonId = gSaveContext.dungeon_index;
interfaceCtx = &globalCtx->interfaceCtx;
if ((D_8015FFD0 != NULL) && (globalCtx->interfaceCtx.roomNum >= D_8015FFD0[7][dungeonId]))
{
// Translates to: "ROOM NUMBER EXCEEDED, YIKES %d/%d MapMarkDraw PROCESSING INTERRUPTED"
osSyncPrintf(VT_COL(RED, WHITE) "部屋番号がオーバーしてるで,ヤバイで %d/%d \nMapMarkDraw の処理を中断します\n", VT_RST,
globalCtx->interfaceCtx.roomNum, D_8015FFD0[7][dungeonId]);
return;
}
mapMarkData = &sLoadedMarkDataTable[dungeonId][interfaceCtx->roomNum][0];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_map_mark.c", 303);
while (1)
{
if (mapMarkData->markType == -1)
break;
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetTextureLUT(gfxCtx->overlay.p++, G_TT_NONE);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->minimapAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, interfaceCtx->minimapAlpha);
markPoint = &mapMarkData->points[0];
for (i = 0; i < mapMarkData->count; i++)
{
if ((mapMarkData->markType != 0) || !Flags_GetTreasure(globalCtx, markPoint->chestFlag))
{
markInfo = &sMapMarkInfoTable[mapMarkData->markType];
gDPPipeSync(gfxCtx->overlay.p++);
gDPLoadTextureBlock(gfxCtx->overlay.p++,
markInfo->texture,
markInfo->imageFormat,
G_IM_SIZ_MARK,
markInfo->textureWidth, markInfo->textureHeight,
0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK,
G_TX_NOLOD, G_TX_NOLOD);
rectLeft = (GREG(94) + markPoint->x + 204) << 2;
rectTop = (GREG(95) + markPoint->y + 140) << 2;
gSPTextureRectangle(gfxCtx->overlay.p++,
rectLeft, rectTop,
markInfo->rectWidth + rectLeft, rectTop + markInfo->rectHeight,
G_TX_RENDERTILE,
0, 0,
markInfo->dsdx, markInfo->dtdy);
}
markPoint++;
}
mapMarkData++;
}
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_map_mark.c", 339);
}
void MapMark_DrawConditionally(GlobalContext* globalCtx)
{
switch (globalCtx->sceneNum)
{
case SCENE_YDAN:
case SCENE_DDAN:
case SCENE_BDAN:
case SCENE_BMORI1:
case SCENE_HIDAN:
case SCENE_MIZUSIN:
case SCENE_JYASINZOU:
case SCENE_HAKADAN:
case SCENE_HAKADANCH:
case SCENE_ICE_DOUKUTO:
case SCENE_YDAN_BOSS:
case SCENE_DDAN_BOSS:
case SCENE_BDAN_BOSS:
case SCENE_MORIBOSSROOM:
case SCENE_FIRE_BS:
MapMark_Draw(globalCtx);
}
}
+85
View File
@@ -0,0 +1,85 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801069B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106AA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106BC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106C88.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106CCC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106D40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80106F1C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107244.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107448.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107628.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801076CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010773C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801077B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107804.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010787C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801078CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107918.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80107980.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801080B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801083F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801086B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80109968.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80109B3C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010B0C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010B680.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010B720.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010B820.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010BD58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010BD88.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010BDBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010BED8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010C358.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010C39C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010F2CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010F494.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010F58C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8010F6F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_8011040C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80110450.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_80110460.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_message_PAL/func_801104C8.s")
+123
View File
@@ -0,0 +1,123 @@
#include <ultra64.h>
#include <global.h>
u32 sFontColorRed = 0xFF;
u32 sFontColorGreen = 0xFF;
u32 sFontColorBlue = 0xFF;
u32 sFontColorAlpha = 0xFF;
s32 D_80120120 = 0;
s32 D_80120124 = 0;
UNK_TYPE D_8015FFC0;
UNK_TYPE D_8015FFC4;
void func_8007B910(u32 red, u32 green, u32 blue, u32 alpha)
{
sFontColorRed = red;
sFontColorGreen = green;
sFontColorBlue = blue;
sFontColorAlpha = alpha;
}
void func_8007B934(s32 arg0, s32 arg1)
{
if (arg0 > 39)
D_80120120 = 39 * 8;
else if (arg0 < 0)
D_80120120 = 0;
else
D_80120120 = arg0 * 8;
if (arg1 > 29)
D_80120124 = 29 * 8;
else if (arg1 < 0)
D_80120124 = 0;
else
D_80120124 = arg1 * 8;
}
void func_8007B9A4(GraphicsContext* gfxCtx, u8 arg1)
{
Gfx* gfxArr[7];
func_800C6AC4(gfxArr, gfxCtx, "../z_moji.c", 86);
if ((u32)gLetterTLUT & 0xF)
osSyncPrintf("moji_tlut --> %X\n", gLetterTLUT);
if (D_8015FFC0 != (arg1 & 3))
{
gDPLoadTLUT(gfxCtx->polyOpa.p++, 16, 256, &gLetterTLUT[arg1 & 3]);
D_8015FFC0 = arg1 & 3;
}
gSPTextureRectangle(gfxCtx->polyOpa.p++,
D_80120120 << 2, D_80120124 << 2,
(D_80120120 + 8) << 2, (D_80120124 + 8) << 2,
G_TX_RENDERTILE,
(u16)(arg1 & 4) * 64, (u16)(arg1 >> 3) * 256,
1024, 1024);
func_800C6B54(gfxArr, gfxCtx, "../z_moji.c", 123);
}
void func_8007BBA8(GraphicsContext* gfxCtx, u8* arg1)
{
s32 i;
Gfx* gfxArr[5];
func_800C6AC4(gfxArr, gfxCtx, "../z_moji.c", 137);
if ((u32)gFontFF & 0xF)
osSyncPrintf("font_ff --> %X\n", gFontFF);
gDPPipeSync(gfxCtx->polyOpa.p++);
gDPSetPrimColor(gfxCtx->polyOpa.p++, 0, 0,
sFontColorRed, sFontColorGreen,
sFontColorBlue, sFontColorAlpha);
gDPSetTextureImage(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b, 1, (s32)gFontFF);
gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_16b,
0, 0, G_TX_LOADTILE, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadSync(gfxCtx->polyOpa.p++);
gDPLoadBlock(gfxCtx->polyOpa.p++, G_TX_LOADTILE, 0, 0, 511, 2048);
gDPPipeSync(gfxCtx->polyOpa.p++);
gDPSetTile(gfxCtx->polyOpa.p++, G_IM_FMT_CI, G_IM_SIZ_4b,
1, 0, G_TX_RENDERTILE, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD);
gDPSetTileSize(gfxCtx->polyOpa.p++, G_TX_RENDERTILE, 0, 0, 60, 508);
D_8015FFC0 = -1;
for (i = 0; arg1[i] != 0; i++)
{
switch (arg1[i])
{
case 9:
D_80120120 = (((D_80120120 / 8) / 8) + 1) * 8 * 8;
if (D_80120120 >= 320)
{
D_80120120 = 0;
D_80120124 += 8;
if (D_80120124 >= 240)
D_80120124 = 0;
}
break;
case 10:
case 13:
D_80120120 = 0;
D_80120124 += 8;
if (D_80120124 >= 240)
D_80120124 = 0;
break;
default:
func_8007B9A4(gfxCtx, arg1[i]);
D_80120120 += 8;
}
}
func_800C6B54(gfxArr, gfxCtx, "../z_moji.c", 181);
}
+69
View File
@@ -0,0 +1,69 @@
#include <ultra64.h>
#include <global.h>
typedef struct
{
/* 0x00 */ u32 unk_00;
/* 0x04 */ u32 unk_04;
/* 0x08 */ s16 unk_08;
/* 0x0A */ s16 unk_0A;
} struct_8007C820;
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C680.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C704.s")
void func_8007C76C(f32* pfParm1, s16 *puParm2)
{
puParm2[0] = pfParm1[0];
puParm2[1] = pfParm1[1];
puParm2[2] = pfParm1[2];
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C7A8.s")
void func_8007C7F8(u32 uParm1, u32 uParm2)
{
u8 auStack4[4];
u8 auStack8[4];
func_8003C940(uParm1, auStack4, auStack8, uParm2);
}
void func_8007C820(struct_8007C820* puParm1, s16 uParm2, s16 uParm3, u32 uParm4, u32 param_5)
{
puParm1->unk_00 = uParm4;
puParm1->unk_04 = param_5;
puParm1->unk_08 = uParm2;
puParm1->unk_0A = uParm3;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007C850.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_8007FFE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_80080024.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_800800F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_800803F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_80080480.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_800806BC.s")
void func_8008070C()
{
D_80120130 = 0;
}
void func_80080718()
{
D_80120130 = 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_onepointdemo/func_80080728.s")
void func_80080788(UNK_TYPE arg0, UNK_TYPE arg1)
{
}
File diff suppressed because it is too large Load Diff
+177
View File
@@ -0,0 +1,177 @@
#include <ultra64.h>
#include <global.h>
void func_800BC450(GlobalContext* globalCtx)
{
func_8005A7A8(globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0],
globalCtx->unk_1242B - 1, globalCtx);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC490.s")
s32 func_800BC56C(GlobalContext* globalCtx, s16 arg1)
{
return arg1 == globalCtx->unk_1242B;
}
void func_800BC590(GlobalContext* globalCtx)
{
osSyncPrintf("Game_play_shop_pr_vr_switch_set()\n");
if (YREG(15) == 0x10)
{
globalCtx->unk_1242B = 2;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC5E0.s")
void func_800BC88C(GlobalContext* globalCtx)
{
globalCtx->unk_123F0 = -1;
}
Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* a1)
{
func_80093708(a1, globalCtx->lightCtx.unk_07, globalCtx->lightCtx.unk_08,
globalCtx->lightCtx.unk_09, 0, globalCtx->lightCtx.unk_0A, 1000);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BC8EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BCA64.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BD314.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BED40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BEDD8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFAE4.s")
s32 func_800BFC84(GlobalContext* globalCtx)
{
return globalCtx->csCtx.state != 0 || func_8008E988(globalCtx) != 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFCB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFE5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800BFEC4.s")
void func_800BFF0C(GlobalContext* globalCtx, s32 a1)
{
globalCtx->curSpawn = a1;
globalCtx->linkActorEntry = NULL;
globalCtx->unk_11DFC = NULL;
globalCtx->setupEntranceList = NULL;
globalCtx->setupExitList = NULL;
globalCtx->naviMsgSegment = NULL;
globalCtx->setupPathList = NULL;
globalCtx->nbSetupActors = 0;
Object_InitBank(globalCtx, &globalCtx->objectCtx);
func_8007A614(globalCtx, &globalCtx->lightCtx);
func_80098CBC(globalCtx, &globalCtx->nbTransitionActors);
func_80096FD4(globalCtx, &globalCtx->roomCtx);
YREG(15) = 0;
gSaveContext.world_map_area = 0;
Scene_ExecuteCommands(globalCtx, globalCtx->unk_B0);
func_800BFEC4(globalCtx, globalCtx->skyboxId);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Area_Spawn.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C016C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0230.s")
s16 func_800C030C(GlobalContext* globalCtx)
{
return globalCtx->cameraCtx.unk_5C0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0314.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0384.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0438.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C04A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C04D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C05E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0704.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0744.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C078C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0808.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0874.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C08AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0A44.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0A88.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0AF4.s")
void func_800C0B60(GlobalContext* globalCtx)
{
gSaveContext.respawn[RESPAWN_MODE_DOWN].temp_swch_flags = globalCtx->actorCtx.flags.tempSwch;
gSaveContext.respawn[RESPAWN_MODE_DOWN].temp_collect_flags = globalCtx->actorCtx.flags.tempCollect;
gSaveContext.respawn_flag = 1;
globalCtx->sceneLoadFlag = 0x14;
globalCtx->nextEntranceIndex = gSaveContext.respawn[0].entrance_index;
globalCtx->fadeOutTransition = 2;
}
void func_800C0BB4(GlobalContext* globalCtx)
{
gSaveContext.respawn_flag = -1;
globalCtx->sceneLoadFlag = 0x14;
if (globalCtx->sceneNum == SCENE_GANON_SONOGO ||
globalCtx->sceneNum == SCENE_GANON_FINAL ||
globalCtx->sceneNum == SCENE_GANONTIKA_SONOGO ||
globalCtx->sceneNum == SCENE_GANON_DEMO)
{
globalCtx->nextEntranceIndex = 0x043F;
Item_Give(globalCtx, ITEM_SWORD_MASTER);
}
else if (gSaveContext.entrance_index == 0x028A ||
gSaveContext.entrance_index == 0x028E ||
gSaveContext.entrance_index == 0x0292 ||
gSaveContext.entrance_index == 0x0476)
{
globalCtx->nextEntranceIndex = 0x01F9;
}
else
{
globalCtx->nextEntranceIndex = gSaveContext.entrance_index;
}
globalCtx->fadeOutTransition = 2;
}
void func_800C0C88(GlobalContext* globalCtx)
{
func_800C0AF4(globalCtx, 0, 0xDFF);
func_800C0BB4(globalCtx);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0CB8.s")
s32 func_800C0D28(GlobalContext* globalCtx)
{
return globalCtx->unk_7B8 != 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0D34.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_800C0DB4.s")
+63
View File
@@ -0,0 +1,63 @@
#include <global.h>
void (*sPlayerCallInitFunc)(void*, GlobalContext*);
void (*sPlayerCallDestroyFunc)(void*, GlobalContext*);
void (*sPlayerCallUpdateFunc)(void*, GlobalContext*);
void (*sPlayerCallDrawFunc)(void*, GlobalContext*);
void func_80846CD8(Player*, GlobalContext*);
void func_8084AB54(Player*, GlobalContext*);
void func_80849EA8(Player*, GlobalContext*);
void func_8084A5C4(Player*, GlobalContext*);
void PlayerCall_Init(Player* player, GlobalContext* globalCtx);
void PlayerCall_Destroy(Player* player, GlobalContext* globalCtx);
void PlayerCall_Update(Player* player, GlobalContext* globalCtx);
void PlayerCall_Draw(Player* player, GlobalContext* globalCtx);
const ActorInit Player_InitVars =
{
ACTOR_PLAYER,
ACTORTYPE_PLAYER,
0,
0x6000035,
OBJECT_GAMEPLAY_KEEP,
sizeof(Player),
(ActorFunc)PlayerCall_Init,
(ActorFunc)PlayerCall_Destroy,
(ActorFunc)PlayerCall_Update,
(ActorFunc)PlayerCall_Draw,
};
void PlayerCall_InitFuncPtrs()
{
sPlayerCallInitFunc = KaleidoManager_GetRamAddr(func_80846CD8);
sPlayerCallDestroyFunc = KaleidoManager_GetRamAddr(func_8084AB54);
sPlayerCallUpdateFunc = KaleidoManager_GetRamAddr(func_80849EA8);
sPlayerCallDrawFunc = KaleidoManager_GetRamAddr(func_8084A5C4);
}
void PlayerCall_Init(Player* player, GlobalContext* globalCtx)
{
KaleidoScopeCall_LoadPlayer();
PlayerCall_InitFuncPtrs();
sPlayerCallInitFunc(player, globalCtx);
}
void PlayerCall_Destroy(Player* player, GlobalContext* globalCtx)
{
KaleidoScopeCall_LoadPlayer();
sPlayerCallDestroyFunc(player, globalCtx);
}
void PlayerCall_Update(Player* player, GlobalContext* globalCtx)
{
KaleidoScopeCall_LoadPlayer();
sPlayerCallUpdateFunc(player, globalCtx);
}
void PlayerCall_Draw(Player* player, GlobalContext* globalCtx)
{
KaleidoScopeCall_LoadPlayer();
sPlayerCallDrawFunc(player, globalCtx);
}
+220
View File
@@ -0,0 +1,220 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008E750.s")
UNK_TYPE func_8008E8DC(GlobalContext* globalCtx, Player* player)
{
return (
player->stateFlags1 & 0x20000080 ||
player->action ||
globalCtx->sceneLoadFlag == 0x14 ||
player->stateFlags1 & 1 ||
player->unk_692 & 0x80 ||
gSaveContext.unk_13F0 &&
func_8008F0D8(player, player->unk_154) >= 0
);
}
UNK_TYPE func_8008E988(GlobalContext* globalCtx)
{
Player* player = PLAYER;
return func_8008E8DC(globalCtx, player) || player->unk_6AD == 4;
}
UNK_TYPE func_8008E9C4(Player* player)
{
return player->stateFlags1 & 0x10;
}
UNK_TYPE func_8008E9D0(Player* player)
{
return LINK_IS_CHILD && player->currentShield == 2;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008E9F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EA40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EB2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EC04.s")
void func_8008EC70(Player* player)
{
player->unk_154 = player->unk_151;
func_8008EC04(player, func_8008E9F8(player, player->unk_151));
player->unk_6AD = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008ECAC.s")
void func_8008ED9C(GlobalContext* globalCtx, Player* player, UNK_TYPE item, UNK_TYPE arg2)
{
Inventory_UpdateBottleItem(globalCtx, item, player->unk_150);
if (item != ITEM_BOTTLE)
{
player->unk_152 = item;
player->unk_151 = arg2;
}
player->unk_154 = arg2;
}
void func_8008EDF0(Player* player)
{
player->unk_664 = NULL;
player->stateFlags2 &= ~0x2000;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EE08.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EEAC.s")
UNK_TYPE func_8008EF44(GlobalContext* globalCtx, UNK_TYPE arg1)
{
globalCtx->unk_11E5C = (arg1 + 1);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008EF5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F034.s")
u8 func_8008F080(GlobalContext* globalCtx)
{
Player* player = PLAYER;
return player->currentMask;
}
void func_8008F08C(GlobalContext* globalCtx)
{
Player* player = PLAYER;
player->currentMask = 0;
}
UNK_TYPE func_8008F098(GlobalContext* globalCtx)
{
Player* player = PLAYER;
return player->currentShield == 3;
}
UNK_TYPE func_8008F0AC(GlobalContext* globalCtx)
{
Player* player = PLAYER;
return player->unk_15D == 0xa && player->currentShield == 3;
}
s32 func_8008F0D8(Player* player, UNK_TYPE arg1)
{
s32 temp_v0 = arg1 - 0x15;
if (temp_v0 >= 0 && temp_v0 < 6)
{
return temp_v0;
}
return -1;
}
UNK_TYPE func_8008F104(Player* player)
{
return player->unk_151 == 0x10 || player->unk_151 == 0x11;
}
UNK_TYPE func_8008F128(Player* player)
{
return func_8008F104(player) && player->heldActor == NULL;
}
s32 func_8008F158(UNK_TYPE arg0)
{
s32 temp_v0 = arg0 - 2;
if (temp_v0 > 0 && temp_v0 < 6)
{
return temp_v0;
}
return 0;
}
void func_8008F180(Player* player)
{
func_8008F158(player->unk_151);
}
UNK_TYPE func_8008F1A0(Player* player)
{
if (player->unk_151 >= 5 && player->unk_151 < 8)
{
return 1;
}
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F1CC.s")
s32 func_8008F224(Player* player, UNK_TYPE arg1)
{
s32 temp_v0 = arg1 - 0x1E;
if (temp_v0 >= 0 && temp_v0 < 0xD)
{
return temp_v0;
}
return -1;
}
void func_8008F250(Player* player)
{
func_8008F224(player, player->unk_151);
}
s32 func_8008F270(Player* player, UNK_TYPE arg1)
{
s32 temp_v0 = arg1 - 0x12;
if (temp_v0 >= 0 && temp_v0 < 2)
{
return temp_v0;
}
return -1;
}
s32 func_8008F29C(Player* player)
{
return func_8008F270(player, player->unk_151);
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F2BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F2F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F470.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008F87C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008FCC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800902F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090440.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090480.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090604.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800906D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800907E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800909B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090A28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090AFC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80090D20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091738.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091880.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_80091A24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8009214C.s")
+69
View File
@@ -0,0 +1,69 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
void func_80092320(PreNMIContext* prenmiCtx)
{
prenmiCtx->state.running = false;
prenmiCtx->state.init = NULL;
prenmiCtx->state.size = 0;
}
void PreNMI_Update(PreNMIContext* prenmiCtx)
{
osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_move\n" VT_RST);
// Strings existing only in rodata
("../z_prenmi.c");
("(int)volume = %d\n");
if (prenmiCtx->timer == 0)
{
ViConfig_UpdateVi(1);
func_80092320(prenmiCtx);
return;
}
prenmiCtx->timer--;
}
void PreNMI_Draw(PreNMIContext* prenmiCtx)
{
GraphicsContext* gfxCtx = prenmiCtx->state.gfxCtx;
Gfx* gfxArr[5];
osSyncPrintf(VT_COL(YELLOW, BLACK) "prenmi_draw\n" VT_RST);
func_800C6AC4(gfxArr, gfxCtx, "../z_prenmi.c", 96);
gSPSegment(gfxCtx->polyOpa.p++, 0x00, NULL);
func_80095248(gfxCtx, 0, 0, 0);
func_800940B0(gfxCtx);
gDPSetFillColor(gfxCtx->polyOpa.p++, -1);
gDPFillRectangle(gfxCtx->polyOpa.p++, 0, prenmiCtx->timer + 100, 319, prenmiCtx->timer + 100);
func_800C6B54(gfxArr, gfxCtx, "../z_prenmi.c", 112);
}
void PreNMI_Main(PreNMIContext* prenmiCtx)
{
PreNMI_Update(prenmiCtx);
PreNMI_Draw(prenmiCtx);
prenmiCtx->state.unk_A0 = 1;
}
void PreNMI_Destroy(PreNMIContext* prenmiCtx)
{
}
void PreNMI_Init(PreNMIContext* prenmiCtx)
{
prenmiCtx->state.main = PreNMI_Main;
prenmiCtx->state.destroy = PreNMI_Destroy;
prenmiCtx->timer = 30;
prenmiCtx->unk_A8 = 10;
R_UPDATE_RATE = 1;
}
+205
View File
@@ -0,0 +1,205 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093370.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009352C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093708.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009373C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093774.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093794.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800937C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800937E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093808.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093848.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800938B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093920.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009398C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800939F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093A64.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093AD0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093B3C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093BA8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093C14.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093C80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093D18.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093D84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093DF0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093E5C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093EC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093F34.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093F58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093F7C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80093FD8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094044.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800940B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009411C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094140.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800941AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094218.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094284.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800942F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009435C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800943C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094434.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800944A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800944C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094520.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009457C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800945A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009460C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094678.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800946E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094708.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009472C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_8009476C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800947AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094944.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094968.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800949A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094A14.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094A80.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094AEC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094B58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094BC4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094C50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094CBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094D28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094D4C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094DB8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80094E54.s")
Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y)
{
return Draw_TexScroll(gfxCtx, x, y, 0, 0);
}
Gfx* Draw_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height)
{
Gfx* displayList = Graph_Alloc(gfxCtx, 3 * sizeof(Gfx));
x %= 2048;
y %= 2048;
gDPTileSync(displayList);
gDPSetTileSize(displayList+1, 0, x, y,
(x+((width-1)<<2)), (y+((height-1)<<2)));
gSPEndDisplayList(displayList+2);
return displayList;
}
Gfx* Draw_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1,
s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2)
{
Gfx* displayList = Graph_Alloc(gfxCtx, 5 * sizeof(Gfx));
x1 %= 2048;
y1 %= 2048;
x2 %= 2048;
y2 %= 2048;
gDPTileSync(displayList);
gDPSetTileSize(displayList+1, tile1, x1, y1,
(x1+((width1-1)<<2)), (y1+((height1-1)<<2)));
gDPTileSync(displayList+2);
gDPSetTileSize(displayList+3, tile2, x2, y2,
(x2+((width2-1)<<2)), (y2+((height2-1)<<2)));
gSPEndDisplayList(displayList+4);
return displayList;
}
Gfx* Draw_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1,
s32 tile2, u32 x2, u32 y2, s32 width2, s32 height2,
s32 red, s32 green, s32 blue, s32 alpha)
{
Gfx* displayList = Graph_Alloc(gfxCtx, 6 * sizeof(Gfx));
x1 %= 2048;
y1 %= 2048;
x2 %= 2048;
y2 %= 2048;
gDPTileSync(displayList);
gDPSetTileSize(displayList+1, tile1, x1, y1,
(x1+((width1-1)<<2)), (y1+((height1-1)<<2)));
gDPTileSync(displayList+2);
gDPSetTileSize(displayList+3, tile2, x2, y2,
(x2+((width2-1)<<2)), (y2+((height2-1)<<2)));
gDPSetEnvColor(displayList+4, red, green, blue, alpha);
gSPEndDisplayList(displayList+5);
return displayList;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_800951D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80095248.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_rcp/func_80095974.s")
+732
View File
@@ -0,0 +1,732 @@
#include <ultra64.h>
#include <global.h>
#include <vt.h>
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags);
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags);
Vec3f D_801270A0 = { 0.0f, 0.0f, 0.0f };
// unused
Gfx D_801270B0[] =
{
gsDPPipeSync(),
gsSPClearGeometryMode(G_ZBUFFER | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
gsDPSetCombineLERP(0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE, 0, 0, 0, SHADE),
gsDPSetOtherMode(G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP |
G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_PERSP | G_CYC_FILL | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2),
gsSPLoadGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BACK | G_LIGHTING | G_SHADING_SMOOTH),
gsDPSetScissor(G_SC_NON_INTERLACE, 0, 0, 320, 240),
gsSPClipRatio(FRUSTRATIO_1),
gsSPEndDisplayList(),
};
void (*sRoomDrawHandlers[])(GlobalContext* globalCtx, Room* room, u32 flags) =
{
func_80095AB4,
func_80096F6C,
func_80095D04,
};
void func_80095AA0(GlobalContext* globalCtx, Room* room, UNK_TYPE arg2, UNK_TYPE arg3)
{
}
// Room Draw Polygon Type 0
void func_80095AB4(GlobalContext* globalCtx, Room* room, u32 flags)
{
s32 i;
PolygonType0* polygon0;
PolygonDlist* polygonDlist;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 193);
if (flags & 1)
{
func_800342EC(&D_801270A0, globalCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
func_80093C80(globalCtx);
gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2)
{
func_8003435C(&D_801270A0, globalCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
polygon0 = &room->mesh->polygon0;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon0->start);
for (i = 0; i < polygon0->num; i++)
{
if ((flags & 1) && (polygonDlist->opa != NULL))
gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa);
if ((flags & 2) && (polygonDlist->xlu != NULL))
gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu);
polygonDlist++;
}
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 239);
}
#define SHAPE_SORT_MAX 64
typedef struct struct_80095D04
{
/* 0x00 */ PolygonDlist2* unk_00;
/* 0x04 */ f32 unk_04;
/* 0x08 */ struct struct_80095D04* unk_08;
/* 0x0C */ struct struct_80095D04* unk_0C;
} struct_80095D04; // size = 0x10
// Room Draw Polygon Type 2
#ifdef NON_MATCHING
// this function still needs some work
void func_80095D04(GlobalContext* globalCtx, Room* room, u32 flags)
{
PolygonType2* polygon2;
PolygonDlist2* polygonDlist;
struct_80095D04 spB8[SHAPE_SORT_MAX];
struct_80095D04* spB4;
struct_80095D04* spB0;
struct_80095D04* phi_v0;
struct_80095D04* phi_a0;
struct_80095D04* spA4;
s32 phi_v1;
s32 sp9C;
Vec3f sp90;
Vec3f sp84;
f32 sp80;
PolygonDlist2* phi_s0;
PolygonDlist2* sp78;
f32 temp_f0;
f32 temp_f2;
GraphicsContext* gfxCtx;
Gfx* sp5C[4];
spB0 = NULL;
spB4 = NULL;
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(sp5C, globalCtx->state.gfxCtx, "../z_room.c", 287);
if (flags & 1)
{
func_800342EC(&D_801270A0, globalCtx);
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
func_80093C80(globalCtx);
gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
if (flags & 2)
{
func_8003435C(&D_801270A0, globalCtx);
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
}
spA4 = &spB8[0];
polygonDlist = SEGMENTED_TO_VIRTUAL(room->mesh->polygon2.start);
polygon2 = &room->mesh->polygon2;
if (polygon2->num > SHAPE_SORT_MAX)
__assert("polygon2->num <= SHAPE_SORT_MAX", "../z_room.c", 317);
sp78 = polygonDlist;
for (sp9C = 0; sp9C < polygon2->num; sp9C++)
{
sp90.x = polygonDlist->pos.x;
sp90.y = polygonDlist->pos.y;
sp90.z = polygonDlist->pos.z;
func_800A6E10(&globalCtx->mf_11D60, &sp90, &sp84, &sp80);
temp_f0 = polygonDlist->unk_06;
if (-temp_f0 < sp84.z)
{
temp_f2 = sp84.z - temp_f0;
if (temp_f2 < globalCtx->lightCtx.unk_0C)
{
spA4->unk_00 = polygonDlist;
spA4->unk_04 = temp_f2;
phi_v0 = spB4;
if (spB4 == 0)
{
spB0 = spA4;
spB4 = spA4;
spA4->unk_0C = NULL;
spA4->unk_08 = NULL;
}
else
{
do
{
if (spA4->unk_04 < phi_v0->unk_04)
break;
phi_v0 = phi_v0->unk_0C;
} while (phi_v0 != NULL);
if (phi_v0 == NULL)
{
spA4->unk_08 = spB0;
spA4->unk_0C = NULL;
spB0->unk_0C = spA4;
spB0 = spA4;
}
else
{
phi_a0 = phi_v0->unk_08;
spA4->unk_08 = phi_a0;
if (phi_a0 == NULL)
spB4 = spA4;
else
phi_a0->unk_0C = spA4;
phi_v0->unk_08 = spA4;
spA4->unk_0C = (void *) phi_v0;
}
}
spA4 = spA4++;
}
}
polygonDlist++;
}
iREG(87) = polygon2->num;
sp9C = 1;
while (spB4 != NULL)
{
phi_s0 = spB4->unk_00;
if (iREG(86) != 0)
{
phi_v1 = 0;
while (phi_v1 < polygon2->num)
{
if (phi_s0 == sp78)
break;
phi_v1++;
sp78++;
}
if (((iREG(86) == 1) && (iREG(89) > sp9C)) ||
((iREG(86) == 2) && (iREG(89) == sp9C)))
{
if ((flags & 1) && (phi_s0->opa != NULL))
gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa);
if ((flags & 2) && (phi_s0->xlu != NULL))
gSPDisplayList(gfxCtx->polyXlu.p++, phi_s0->xlu);
}
}
else
{
if ((flags & 1) && (phi_s0->opa != NULL))
gSPDisplayList(gfxCtx->polyOpa.p++, phi_s0->opa);
if ((flags & 2) && (phi_s0->xlu != NULL))
gSPDisplayList(gfxCtx->polyXlu.p++, phi_s0->xlu);
}
spB4 = spB4->unk_0C;
sp9C++;
}
iREG(88) = sp9C - 1;
func_800C6B54(sp5C, globalCtx->state.gfxCtx, "../z_room.c", 430);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80095D04.s")
#endif
#define JPEG_MARKER 0xFFD8FFE0
#ifdef NON_MATCHING
// long multiplication by 64 doesn't quite match
s32 func_80096238(void* data)
{
OSTime timeBefore;
OSTime timeAfter;
OSTime time;
if (*(u32*)data == JPEG_MARKER)
{
// Translates to: "EXPANDING JPEG DATA"
osSyncPrintf("JPEGデータを展開します\n");
// Translates to: "JPEG DATA ADDRESS %08x"
osSyncPrintf("JPEGデータアドレス %08x\n", data);
// Translates to: "WORK BUFFER ADDRESS (Z BUFFER) %08x"
osSyncPrintf("ワークバッファアドレス(Zバッファ)%08x\n", gZBuffer);
timeBefore = osGetTime();
if (!func_8006E418(data, gZBuffer, gGfxSPTaskOutputBuffer, sizeof(gGfxSPTaskOutputBuffer)))
{
timeAfter = osGetTime();
time = ((timeAfter - timeBefore) * 64) / 3000;
// Translates to: "SUCCESS... I THINK. time = %6.3f ms"
osSyncPrintf("成功…だと思う。 time = %6.3f ms \n", (f64)(time / 1000.0f));
// Translates to: "WRITING BACK TO ORIGINAL ADDRESS FROM WORK BUFFER."
osSyncPrintf("ワークバッファから元のアドレスに書き戻します。\n");
// Translates to: "IF THE ORIGINAL BUFFER SIZE ISN'T AT LEAST 150KB, IT WILL BE OUT OF CONTROL."
osSyncPrintf("元のバッファのサイズが150キロバイト無いと暴走するでしょう。\n");
bcopy(gZBuffer, data, sizeof(gZBuffer));
}
else
{
// Translates to: "FAILURE! WHY IS IT 〜"
osSyncPrintf("失敗!なんで〜\n");
}
}
return 0;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80096238.s")
#endif
#ifdef NON_MATCHING
// pointer arithmetic doesn't quite match
void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY)
{
Gfx* displayListHead;
uObjBg* bg;
displayListHead = *displayList;
func_80096238(SEGMENTED_TO_VIRTUAL(source));
displayListHead++;
gSPBranchList(displayListHead, displayListHead+5);
bg = (void*)displayListHead;
bg->b.imageX = 0;
bg->b.imageW = width * 4;
bg->b.frameX = frameX * 4;
bg->b.imageY = 0;
bg->b.imageH = height * 4;
bg->b.frameY = frameY * 4;
bg->b.imagePtr = (void*)source;
bg->b.imageLoad = G_BGLT_LOADTILE;
bg->b.imageFmt = fmt;
bg->b.imageSiz = siz;
bg->b.imagePal = 0;
bg->b.imageFlip = 0;
if (fmt == G_IM_FMT_CI)
{
displayListHead = (void*)(bg+1);
gDPLoadTLUT(displayListHead++, tlutCount, 256, tlut);
}
else
{
displayListHead = (void*)(bg+1);
gDPPipeSync(displayListHead++);
}
if ((fmt == G_IM_FMT_RGBA) && (SREG(26) == 0))
{
bg->b.frameW = width * 4;
bg->b.frameH = height * 4;
func_80104B00(bg);
gDPSetOtherMode(displayListHead++,
mode0 | G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT |
G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_COPY | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
gSPBgRectCopy(displayListHead++, bg);
}
else
{
bg->s.frameW = width * 4;
bg->s.frameH = height * 4;
bg->s.scaleW = 1024;
bg->s.scaleH = 1024;
bg->s.imageYorig = bg->b.imageY;
gDPSetOtherMode(displayListHead++,
mode0 | G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT |
G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
G_AC_THRESHOLD | G_ZS_PIXEL | AA_EN |
CVG_DST_CLAMP | ZMODE_OPA | CVG_X_ALPHA | ALPHA_CVG_SEL |
GBL_c1(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA) |
GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_BL, G_BL_1MA));
gDPSetCombineLERP(displayListHead++,
0, 0, 0, TEXEL0, 0, 0, 0, 1,
0, 0, 0, TEXEL0, 0, 0, 0, 1);
gSPObjRenderMode(displayListHead++, 0x0C); // unknown object render mode?
gSPBgRect1Cyc(displayListHead++, bg);
}
gDPPipeSync(displayListHead++);
*displayList = displayListHead;
}
#else
void func_8009638C(Gfx** displayList, u32 source, u32 tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0, u16 tlutCount, f32 frameX, f32 frameY);
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_8009638C.s")
#endif
// Room Draw Polygon Type 1 - Single Format
void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags)
{
Camera* camera;
Gfx* spA8;
PolygonType1* polygon1;
PolygonDlist* polygonDlist;
u32 sp9C;
u32 sp98;
u32 sp94;
u32 sp90;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 628);
camera = globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0];
polygon1 = &room->mesh->polygon1;
sp9C = (camera->unk_142 ^ 25) == 0;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
sp98 = (flags & 1) && sp9C && polygon1->single.source && !(SREG(25) & 1);
sp94 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2);
sp90 = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4);
if (sp94 || sp98)
{
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
if (sp94)
{
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa);
}
if (sp98)
{
// gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, D_00113070, D_001579A0, 0x800);
if (1)
{
Vec3f sp60;
spA8 = gfxCtx->polyOpa.p;
func_8005AFB4(&sp60, camera);
func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut,
polygon1->single.width, polygon1->single.height,
polygon1->single.fmt, polygon1->single.siz,
polygon1->single.mode0, polygon1->single.tlutCount,
(sp60.x + sp60.z) * 1.2f + sp60.y * 0.6f,
sp60.y * 2.4f + (sp60.x + sp60.z) * 0.3f);
gfxCtx->polyOpa.p = spA8;
}
// gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800);
}
}
if (sp90)
{
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu);
}
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 691);
}
typedef struct
{
char unk_00[0x0E];
s16 unk_0E;
} struct_80041C10_ret;
extern struct_80041C10_ret* func_80041C10(CollisionContext*, s32, s32);
BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx)
{
Camera* camera;
s32 camId;
s16 camId2;
Player* player;
BgImage* bgImage;
s32 i;
camera = globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0];
camId = camera->unk_148;
camId2 = func_80041C10(&globalCtx->colCtx, camId, 50)->unk_0E;
if (camId2 >= 0)
camId = camId2;
player = PLAYER;
player->actor.params = (player->actor.params & 0xFF00) | camId;
bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list);
for (i = 0; i < polygon1->multi.count; i++)
{
if (bgImage->id == camId)
return bgImage;
bgImage++;
}
// Translates to: "z_room.c: DATA CONSISTENT WITH CAMERA ID DOES NOT EXIST camid=%d"
osSyncPrintf(VT_COL(RED, WHITE) "z_room.c:カメラIDに一致するデータが存在しません camid=%d\n" VT_RST, camId);
LogUtils_HungupThread("../z_room.c", 726);
return NULL;
}
// Room Draw Polygon Type 1 - Multi Format
#ifdef NON_MATCHING
// regalloc differences
void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags)
{
Camera* camera;
Gfx* spA8;
BgImage* bgImage;
PolygonType1* polygon1;
PolygonDlist* polygonDlist;
u32 sp98;
u32 sp94;
u32 sp90;
u32 sp8C;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 752);
camera = globalCtx->cameraCtx.activeCameraPtrs[globalCtx->cameraCtx.unk_5C0];
sp98 = (camera->unk_142 ^ 25) == 0;
polygon1 = &room->mesh->polygon1;
polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist);
bgImage = func_80096A74(polygon1, globalCtx);
sp94 = (flags & 1) && sp98 && bgImage->source && !(SREG(25) & 1);
sp90 = (flags & 1) && polygonDlist->opa && !(SREG(25) & 2);
sp8C = (flags & 2) && polygonDlist->xlu && !(SREG(25) & 4);
if (sp90 || sp94)
{
gSPSegment(gfxCtx->polyOpa.p++, 0x03, room->segment);
if (sp90)
{
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyOpa.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyOpa.p++, polygonDlist->opa);
}
if (sp94)
{
// gSPLoadUcodeL(gfxCtx->polyOpa.p++, rspS2DEX)?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, D_00113070, D_001579A0, 0x800);
if (1)
{
Vec3f sp5C;
spA8 = gfxCtx->polyOpa.p;
func_8005AFB4(&sp5C, camera);
func_8009638C(&spA8, bgImage->source, bgImage->tlut,
bgImage->width, bgImage->height,
bgImage->fmt, bgImage->siz,
bgImage->mode0, bgImage->tlutCount,
(sp5C.x + sp5C.z) * 1.2f + sp5C.y * 0.6f,
sp5C.y * 2.4f + (sp5C.x + sp5C.z) * 0.3f);
gfxCtx->polyOpa.p = spA8;
}
// gSPLoadUcode(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20())?
gSPLoadUcodeEx(gfxCtx->polyOpa.p++, func_800D2E14(), func_800D2E20(), 0x800);
}
}
if (sp8C)
{
gSPSegment(gfxCtx->polyXlu.p++, 0x03, room->segment);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, &gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD);
gSPDisplayList(gfxCtx->polyXlu.p++, polygonDlist->xlu);
}
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_room.c", 819);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80096B6C.s")
#endif
// Room Draw Polygon Type 1
void func_80096F6C(GlobalContext* globalCtx, Room* room, u32 flags)
{
PolygonType1* polygon1 = &room->mesh->polygon1;
if (polygon1->format == 1)
func_80096680(globalCtx, room, flags);
else if (polygon1->format == 2)
func_80096B6C(globalCtx, room, flags);
else
LogUtils_HungupThread("../z_room.c", 841);
}
void func_80096FD4(GlobalContext* globalCtx, Room* room)
{
room->num = -1;
room->segment = NULL;
}
#ifdef NON_MATCHING
// regalloc differences
u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx)
{
RomFile* roomList;
TransitionActorEntry* transitionActor;
s32 i, j;
s8 frontRoom;
s8 backRoom;
u32 roomSize;
u32 maxRoomSize;
u32 frontRoomSize;
u32 backRoomSize;
u32 cumulRoomSize;
u8 nextRoomNum;
maxRoomSize = 0;
roomList = globalCtx->roomList;
for (i = 0; i < globalCtx->nbRooms; i++)
{
roomSize = roomList[i].vromEnd - roomList[i].vromStart;
osSyncPrintf("ROOM%d size=%d\n", i, roomSize);
if (maxRoomSize < roomSize)
maxRoomSize = roomSize;
}
if (globalCtx->nbTransitionActors != 0)
{
j = 0;
roomList = globalCtx->roomList;
transitionActor = &globalCtx->transitionActorList[0];
LogUtils_LogThreadId("../z_room.c", 912);
osSyncPrintf("game_play->room_rom_address.num = %d\n", globalCtx->nbRooms);
for (j = 0; j < globalCtx->nbTransitionActors; j++)
{
frontRoom = transitionActor->frontRoom;
backRoom = transitionActor->backRoom;
frontRoomSize = (frontRoom < 0) ? 0 : roomList[frontRoom].vromEnd - roomList[frontRoom].vromStart;
backRoomSize = (backRoom < 0) ? 0 : roomList[backRoom].vromEnd - roomList[backRoom].vromStart;
cumulRoomSize = (frontRoom != backRoom) ? frontRoomSize + backRoomSize : frontRoomSize;
osSyncPrintf("DOOR%d=<%d> ROOM1=<%d, %d> ROOM2=<%d, %d>\n",
j, cumulRoomSize, frontRoom, frontRoomSize, backRoom, backRoomSize);
if (maxRoomSize < cumulRoomSize)
maxRoomSize = cumulRoomSize;
transitionActor++;
}
}
osSyncPrintf(VT_FGCOL(YELLOW));
// Translates to: "ROOM BUFFER SIZE=%08x(%5.1fK)"
osSyncPrintf("部屋バッファサイズ=%08x(%5.1fK)\n", maxRoomSize, (f64)(maxRoomSize * 0.0009765625f));
roomCtx->bufPtrs[0] = Game_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946);
// Translates to: "ROOM BUFFER INITIAL POINTER=%08x"
osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]);
roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize);
// Translates to: "ROOM BUFFER END POINTER=%08x"
osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]);
osSyncPrintf(VT_RST);
roomCtx->unk_30 = 0;
roomCtx->status = 0;
if (gSaveContext.respawn_flag > 0)
nextRoomNum = gSaveContext.respawn[gSaveContext.respawn_flag-1].room_index;
else
nextRoomNum = globalCtx->setupEntranceList[globalCtx->curSpawn].room;
func_8009728C(globalCtx, roomCtx, nextRoomNum);
return maxRoomSize;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_room/func_80096FE8.s")
#endif
s32 func_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, s32 roomNum)
{
u32 size;
if (0) ; // Necessary to match
if (roomCtx->status == 0)
{
roomCtx->prevRoom = roomCtx->curRoom;
roomCtx->curRoom.num = roomNum;
roomCtx->curRoom.segment = NULL;
roomCtx->status = 1;
if (roomNum >= globalCtx->nbRooms)
__assert("read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009);
size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart;
roomCtx->unk_34 = (void*)ALIGN16((s32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7));
if (0) ; // Also necessary to match
osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1);
DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size,
0, &roomCtx->loadQueue, NULL, "../z_room.c", 1036);
roomCtx->unk_30 ^= 1;
return 1;
}
return 0;
}
s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx)
{
if (roomCtx->status == 1)
{
if (!osRecvMesg(&roomCtx->loadQueue, NULL, OS_MESG_NOBLOCK))
{
roomCtx->status = 0;
roomCtx->curRoom.segment = roomCtx->unk_34;
gSegments[3] = PHYSICAL_TO_VIRTUAL2(roomCtx->unk_34);
Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment);
func_8008E750(globalCtx, PLAYER);
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
return 1;
}
return 0;
}
return 1;
}
void Room_Draw(GlobalContext* globalCtx, Room* room, u32 flags)
{
if (room->segment != NULL)
{
gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment);
if (room->mesh->polygon.type >= ARRAY_COUNTU(sRoomDrawHandlers))
__assert("this->ground_shape->polygon.type < number(Room_Draw_Proc)", "../z_room.c", 1125);
sRoomDrawHandlers[room->mesh->polygon.type](globalCtx, room, flags);
}
}
void func_80097534(GlobalContext* globalCtx, RoomContext* roomCtx)
{
roomCtx->prevRoom.num = -1;
roomCtx->prevRoom.segment = NULL;
func_80031B14(globalCtx, &globalCtx->actorCtx);
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
func_80080E04(globalCtx, roomCtx->curRoom.num);
if (!((globalCtx->sceneNum >= SCENE_SPOT00) && (globalCtx->sceneNum <= SCENE_SPOT20)))
func_800807A0(globalCtx);
func_800F66C0(globalCtx->roomCtx.curRoom.echo);
}
+17
View File
@@ -0,0 +1,17 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_800975D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097604.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097820.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097848.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097850.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097904.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sample/func_80097974.s")
+1023
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+177
View File
@@ -0,0 +1,177 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A08A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A0B40.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A0D94.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A106C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A1344.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_Draw.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A180C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A1AC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A1D8C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A1FC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_GetFrameCount.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2044.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2288.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A24A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A273C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A29BC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2DBC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2DF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2E2C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A2E70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A32EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A32F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3310.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3334.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A336C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3478.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A34DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3548.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A35B4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3620.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3678.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A36A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3714.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3770.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A37F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3874.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A390C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A39AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3B8C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3BC0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3BE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3C9C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3D70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3E0C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3EE8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A3F08.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A407C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A40DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4140.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A419C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A41FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A422C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A425C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A42A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A42E4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A431C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A43B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4454.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4478.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4530.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A46F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A487C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A49B0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_FrameUpdateMatrix.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4A20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4AD8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4C58.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4D9C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4E38.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4EE0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A4FE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/SkelAnime_ChangeAnimation.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A51E8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5240.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A529C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A52F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A534C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5384.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A53DC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5408.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5428.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5490.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A54FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A56F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skelanime/func_800A5774.s")
+23
View File
@@ -0,0 +1,23 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A57C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A598C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A5E28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A5F60.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A60D8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A6330.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A6360.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A6394.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A63CC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin/func_800A6408.s")
+13
View File
@@ -0,0 +1,13 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A6460.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A663C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A6888.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A698C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_awb/func_800A6AC4.s")
+43
View File
@@ -0,0 +1,43 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A6E10.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A6EF4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A6FA0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A72FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A730C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A735C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A73E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A76A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7704.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7894.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7A24.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7A84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7B04.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7B84.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7BE4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7C20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7C60.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7E70.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A7EC0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_skin_matrix/func_800A8030.s")
+27
View File
@@ -0,0 +1,27 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A81A0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A82C8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A8484.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A88D4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A8A20.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9258.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A96D0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A97F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9A9C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9AD0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9CD4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_sram/func_800A9D28.s")
+63
View File
@@ -0,0 +1,63 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA190.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA1F8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA250.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA278.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA358.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA3F0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA43C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA454.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA460.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA48C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA4A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA4E0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA4FC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA52C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA550.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA76C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA78C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA7AC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA7B8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA814.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA840.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AA890.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AAA50.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AAA9C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB0A8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB2C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB560.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB944.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800AB9EC.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_view/func_800ABE74.s")
+19
View File
@@ -0,0 +1,19 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800AC030.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800AC2F4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800AC89C.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800AC9A4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACA28.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACA90.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACA98.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vimode/func_800ACAF8.s")
+15
View File
@@ -0,0 +1,15 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD000.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD054.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD080.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD394.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD5C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vismono/func_800AD870.s")
+15
View File
@@ -0,0 +1,15 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800ADBB0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AE2C0.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AEFC8.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AF178.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800AF218.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box/func_800B0E50.s")
+9
View File
@@ -0,0 +1,9 @@
#include <ultra64.h>
#include <global.h>
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_800B1030.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_800B10C4.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_vr_box_draw/func_800B1744.s")