mirror of
https://github.com/zeldaret/mm.git
synced 2026-07-28 15:17:23 -04:00
Some OOT transfers, some renaming, etc (#75)
* Progress on various files * gfxprint stuff * split some rodata, add iconv for rodata string parsing * z_std_dma rodata * 2 nonmatchings in gfxprint * mtxuty-cvt ok * more * match a function in idle.c * progress * Cleanup * Rename BgPolygon to CollisionPoly * progress * some effect stuff * more effect progress * updates * made suggested changes * z_effect_soft_sprite_old_init mostly ok Co-authored-by: Lucas Shaw <lucas.shaw1123@gmail.com> Co-authored-by: Rozelette <Rozelette@users.noreply.github.com>
This commit is contained in:
@@ -2,5 +2,5 @@
|
||||
#include <global.h>
|
||||
|
||||
void func_80087E00(u32 a0) {
|
||||
D_8009817C = a0;
|
||||
__additional_scanline = a0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
#include "os_internal.h"
|
||||
|
||||
void __osGetHWIntrRoutine(s32 idx, OSMesgQueue** outQueue, OSMesg* outMsg) {
|
||||
*outQueue = __osHwIntTable[idx].queue;
|
||||
*outMsg = __osHwIntTable[idx].msg;
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.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)
|
||||
|
||||
extern OSMesg sArenaLockMsg[1];
|
||||
|
||||
void ArenaImpl_LockInit(Arena* arena) {
|
||||
osCreateMesgQueue(&arena->lock, sArenaLockMsg, ARRAY_COUNT(sArenaLockMsg));
|
||||
}
|
||||
|
||||
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* heap_get_tail(Arena* arena) {
|
||||
ArenaNode* last;
|
||||
ArenaNode* iter;
|
||||
|
||||
last = arena->head;
|
||||
|
||||
if (last != NULL) {
|
||||
iter = last->next;
|
||||
while (iter != NULL) {
|
||||
last = iter;
|
||||
iter = iter->next;
|
||||
}
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
||||
void __osMallocInit(Arena* arena, void* start, u32 size) {
|
||||
bzero(arena, sizeof(*arena));
|
||||
ArenaImpl_LockInit(arena);
|
||||
__osMallocAddBlock(arena, start, size);
|
||||
arena->isInit = 1;
|
||||
}
|
||||
|
||||
void __osMallocAddBlock(Arena* arena, void* start, s32 size) {
|
||||
s32 diff;
|
||||
s32 size2;
|
||||
ArenaNode* firstNode;
|
||||
ArenaNode* lastNode;
|
||||
|
||||
if (start != NULL) {
|
||||
firstNode = (ArenaNode*)ALIGN16((u32)start);
|
||||
diff = (s32)firstNode - (s32)start;
|
||||
size2 = (size - diff) & ~0xF;
|
||||
|
||||
if (size2 > (s32)sizeof(ArenaNode)) {
|
||||
firstNode->next = NULL;
|
||||
firstNode->prev = NULL;
|
||||
firstNode->size = size2 - sizeof(ArenaNode);
|
||||
firstNode->isFree = 1;
|
||||
firstNode->magic = NODE_MAGIC;
|
||||
ArenaImpl_Lock(arena);
|
||||
lastNode = heap_get_tail(arena);
|
||||
if (lastNode == NULL) {
|
||||
arena->head = firstNode;
|
||||
arena->start = start;
|
||||
} else {
|
||||
firstNode->prev = lastNode;
|
||||
lastNode->next = firstNode;
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void __osMallocCleanup(Arena* arena) {
|
||||
bzero(arena, sizeof(*arena));
|
||||
}
|
||||
|
||||
u8 __osMallocIsInitalized(Arena* arena) {
|
||||
return arena->isInit;
|
||||
}
|
||||
|
||||
void* __osMalloc(Arena* arena, u32 size) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* newNode;
|
||||
void* alloc;
|
||||
u32 blockSize;
|
||||
alloc = NULL;
|
||||
|
||||
size = ALIGN16(size);
|
||||
ArenaImpl_Lock(arena);
|
||||
iter = arena->head;
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
ArenaNode* next;
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + blockSize);
|
||||
newNode->next = iter->next;
|
||||
newNode->prev = iter;
|
||||
newNode->size = iter->size - blockSize;
|
||||
newNode->isFree = 1;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size = size;
|
||||
next = newNode->next;
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
}
|
||||
|
||||
iter->isFree = 0;
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
break;
|
||||
}
|
||||
|
||||
iter = iter->next;
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
|
||||
void* __osMallocR(Arena* arena, u32 size) {
|
||||
ArenaNode* iter;
|
||||
ArenaNode* newNode;
|
||||
u32 blockSize;
|
||||
void* alloc = NULL;
|
||||
|
||||
size = ALIGN16(size);
|
||||
ArenaImpl_Lock(arena);
|
||||
iter = heap_get_tail(arena);
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree && iter->size >= size) {
|
||||
ArenaNode* next;
|
||||
blockSize = ALIGN16(size) + sizeof(ArenaNode);
|
||||
if (blockSize < iter->size) {
|
||||
newNode = (ArenaNode*)((u32)iter + (iter->size - size));
|
||||
newNode->next = iter->next;
|
||||
newNode->prev = iter;
|
||||
newNode->size = size;
|
||||
newNode->magic = NODE_MAGIC;
|
||||
|
||||
iter->next = newNode;
|
||||
iter->size -= blockSize;
|
||||
next = newNode->next;
|
||||
if (next) {
|
||||
next->prev = newNode;
|
||||
}
|
||||
iter = newNode;
|
||||
}
|
||||
|
||||
iter->isFree = 0;
|
||||
alloc = (void*)((u32)iter + sizeof(ArenaNode));
|
||||
break;
|
||||
}
|
||||
iter = iter->prev;
|
||||
}
|
||||
ArenaImpl_Unlock(arena);
|
||||
|
||||
return alloc;
|
||||
}
|
||||
|
||||
void __osFree(Arena* arena, void* ptr) {
|
||||
ArenaNode* node;
|
||||
ArenaNode* next;
|
||||
ArenaNode* prev;
|
||||
ArenaNode* newNext;
|
||||
|
||||
ArenaImpl_Lock(arena);
|
||||
node = (ArenaNode*)((u32)ptr - sizeof(ArenaNode));
|
||||
|
||||
if (ptr == NULL || (node->magic != NODE_MAGIC) || node->isFree) {
|
||||
goto end;
|
||||
}
|
||||
|
||||
next = node->next;
|
||||
prev = node->prev;
|
||||
node->isFree = 1;
|
||||
|
||||
newNext = next;
|
||||
if ((u32)next == (u32)node + sizeof(ArenaNode) + node->size && next->isFree) {
|
||||
newNext = next->next;
|
||||
if (newNext != NULL) {
|
||||
newNext->prev = node;
|
||||
}
|
||||
|
||||
node->size += next->size + sizeof(ArenaNode);
|
||||
|
||||
node->next = newNext;
|
||||
next = newNext;
|
||||
}
|
||||
|
||||
if (prev != NULL && prev->isFree && (u32)node == (u32)prev + sizeof(ArenaNode) + prev->size) {
|
||||
if (next) {
|
||||
next->prev = prev;
|
||||
}
|
||||
prev->next = next;
|
||||
prev->size += node->size + sizeof(ArenaNode);
|
||||
}
|
||||
|
||||
end:
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/__osMalloc/__osRealloc.asm")
|
||||
|
||||
void __osAnalyzeArena(Arena* arena, u32* outMaxFree, u32* outFree, u32* outAlloc) {
|
||||
ArenaNode* iter;
|
||||
|
||||
ArenaImpl_Lock(arena);
|
||||
|
||||
*outMaxFree = 0;
|
||||
*outFree = 0;
|
||||
*outAlloc = 0;
|
||||
|
||||
iter = arena->head;
|
||||
while (iter != NULL) {
|
||||
if (iter->isFree) {
|
||||
*outFree += iter->size;
|
||||
if (*outMaxFree < iter->size) {
|
||||
*outMaxFree = iter->size;
|
||||
}
|
||||
} else {
|
||||
*outAlloc += iter->size;
|
||||
}
|
||||
|
||||
iter = iter->next;
|
||||
}
|
||||
|
||||
ArenaImpl_Unlock(arena);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/__osMalloc/__osCheckArena.asm")
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void assert_fail(const char* file, u32 lineNum) {
|
||||
osGetThreadId(NULL);
|
||||
Fault_AddHungupAndCrash(file, lineNum);
|
||||
}
|
||||
|
||||
void func_800862B4(void) {
|
||||
Fault_AddHungupAndCrash("Reset", 0);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_AllocMin1.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_FreeNull.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_8008633C.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_800863AC.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_8008641C.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_800864EC.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_80086588.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/StartHeap_Init.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/boot_0x800862E0/func_80086620.asm")
|
||||
@@ -0,0 +1,78 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#define RAND_MULTIPLIER 1664525
|
||||
#define RAND_INCREMENT 1013904223
|
||||
|
||||
/**
|
||||
* Gets the next integer in the sequence of pseudo-random numbers.
|
||||
*/
|
||||
s32 Rand_Next(void) {
|
||||
return sRandInt = (sRandInt * 1664525) + 1013904223;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds the pseudo-random number generator by providing a starting value.
|
||||
*/
|
||||
void Rand_Seed(u32 seed) {
|
||||
sRandInt = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between 0.0f and 1.0f, by generating
|
||||
* the next integer and masking it to an IEEE-754 compliant floating-point number
|
||||
* between 1.0f and 2.0f, returning the result subtract 1.0f.
|
||||
*/
|
||||
f32 Rand_ZeroOne(void) {
|
||||
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same
|
||||
* manner in which Rand_ZeroOne generates its result.
|
||||
*/
|
||||
f32 Rand_Centered(void) {
|
||||
sRandInt = (sRandInt * RAND_MULTIPLIER) + RAND_INCREMENT;
|
||||
sRandFloat = ((sRandInt >> 9) | 0x3F800000);
|
||||
return *((f32*)&sRandFloat) - 1.5f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seeds a pseudo-random number at rndNum with a provided seed.
|
||||
*/
|
||||
void Rand_Seed_Variable(u32* rndNum, u32 seed) {
|
||||
*rndNum = seed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random integer from the provided rndNum.
|
||||
*/
|
||||
u32 Rand_Next_Variable(u32* rndNum) {
|
||||
return *rndNum = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between 0.0f and
|
||||
* 1.0f from the provided rndNum.
|
||||
*/
|
||||
f32 Rand_ZeroOne_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
|
||||
// clang-format off
|
||||
*rndNum = next; sRandFloat = (next >> 9) | 0x3F800000;
|
||||
// clang-format on
|
||||
return *((f32*)&sRandFloat) - 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the next pseudo-random floating-point number between -0.5f and
|
||||
* 0.5f from the provided rndNum.
|
||||
*/
|
||||
f32 Rand_Centered_Variable(u32* rndNum) {
|
||||
u32 next = (*rndNum * RAND_MULTIPLIER) + RAND_INCREMENT;
|
||||
// clang-format off
|
||||
*rndNum = next; sRandFloat = (next >> 9) | 0x3F800000;
|
||||
// clang-format on
|
||||
return *((f32*)&sRandFloat) - 1.5f;
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
extern u16 sGfxPrintFontTLUT[64];
|
||||
extern u16 sGfxPrintUnkTLUT[16];
|
||||
extern u8 sGfxPrintUnkData[8];
|
||||
extern u8 sGfxPrintFontData[2048];
|
||||
|
||||
#define gDPSetPrimColorMod(pkt, m, l, rgba) \
|
||||
{ \
|
||||
Gfx* _g = (Gfx*)(pkt); \
|
||||
\
|
||||
_g->words.w0 = (_SHIFTL(G_SETPRIMCOLOR, 24, 8) | _SHIFTL(m, 8, 8) | _SHIFTL(l, 0, 8)); \
|
||||
_g->words.w1 = (rgba); \
|
||||
}
|
||||
|
||||
void GfxPrint_InitDlist(GfxPrint* this) {
|
||||
s32 width = 16;
|
||||
s32 height = 256;
|
||||
s32 i;
|
||||
|
||||
gDPPipeSync(this->dlist++);
|
||||
gDPSetOtherMode(this->dlist++,
|
||||
G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_IA16 | G_TL_TILE |
|
||||
G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE,
|
||||
G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_DECALRGBA, G_CC_DECALRGBA);
|
||||
gDPLoadTextureBlock_4b(this->dlist++, sGfxPrintFontData, G_IM_FMT_CI, width, height, 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);
|
||||
gDPLoadTLUT(this->dlist++, 64, 256, sGfxPrintFontTLUT);
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2, i, 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(this->dlist++, i * 2, 0, 0, 60, 1020);
|
||||
}
|
||||
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
|
||||
gDPLoadMultiTile_4b(this->dlist++, sGfxPrintUnkData, 0, 1, G_IM_FMT_CI, 2, 8, 0, 0, 1, 7, 4,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, 1, 3, G_TX_NOLOD, G_TX_NOLOD);
|
||||
|
||||
gDPLoadTLUT(this->dlist++, 16, 320, sGfxPrintUnkTLUT);
|
||||
|
||||
for (i = 1; i < 4; i++) {
|
||||
gDPSetTile(this->dlist++, G_IM_FMT_CI, G_IM_SIZ_4b, 1, 0, i * 2 + 1, 4, G_TX_NOMIRROR | G_TX_WRAP, 3,
|
||||
G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, 1, G_TX_NOLOD);
|
||||
gDPSetTileSize(this->dlist++, i * 2 + 1, 0, 0, 4, 28);
|
||||
}
|
||||
}
|
||||
|
||||
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, this->color.rgba);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* regalloc in the final gSPTextureRectangle */
|
||||
#ifdef NON_MATCHING
|
||||
void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) {
|
||||
u32 tile = (c & 0xFF) * 2;
|
||||
|
||||
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);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_INTERFERENCE, G_CC_PASS2);
|
||||
} else {
|
||||
gDPSetTextureLUT(this->dlist++, G_TT_IA16);
|
||||
gDPSetCycleType(this->dlist++, G_CYC_1CYCLE);
|
||||
gDPSetRenderMode(this->dlist++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetCombineMode(this->dlist++, G_CC_MODULATEIDECALA_PRIM, G_CC_MODULATEIDECALA_PRIM);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->flag & GFXPRINT_FLAG4) {
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, 0);
|
||||
|
||||
gSPTextureRectangle(this->dlist++, this->posX + 4, this->posY + 4, this->posX + 4 + 32, this->posY + 4 + 32,
|
||||
(c & 3) << 1, (u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
|
||||
|
||||
gDPSetPrimColorMod(this->dlist++, 0, 0, this->color.rgba);
|
||||
}
|
||||
|
||||
|
||||
gSPTextureRectangle(this->dlist++, this->posX, this->posY, this->posX + 32, this->posY + 32, (u16)(tile & 7),
|
||||
(u16)(c & 4) * 64, (u16)(c >> 3) * 256, 1024, 1024);
|
||||
|
||||
|
||||
this->posX += 32;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/gfxprint/GfxPrint_PrintCharImpl.asm")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/gfxprint/GfxPrint_PrintChar.asm")
|
||||
|
||||
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_Init(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;
|
||||
this->color.rgba = 0;
|
||||
this->flag &= ~GFXPRINT_FLAG1;
|
||||
this->flag &= ~GFXPRINT_USE_RGBA16;
|
||||
this->flag |= GFXPRINT_FLAG4;
|
||||
this->flag |= GFXPRINT_UPDATE_MODE;
|
||||
}
|
||||
|
||||
void GfxPrint_Destroy(GfxPrint* this) {
|
||||
|
||||
}
|
||||
|
||||
void GfxPrint_Open(GfxPrint* this, Gfx* dlist) {
|
||||
if (!(this->flag & GFXPRINT_OPEN)) {
|
||||
this->flag |= GFXPRINT_OPEN;
|
||||
this->dlist = dlist;
|
||||
GfxPrint_InitDlist(this);
|
||||
}
|
||||
}
|
||||
|
||||
Gfx* GfxPrint_Close(GfxPrint* this) {
|
||||
Gfx* ret;
|
||||
|
||||
this->flag &= ~GFXPRINT_OPEN;
|
||||
ret = this->dlist;
|
||||
this->dlist = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) {
|
||||
func_80087900(&this->callback, fmt, args);
|
||||
}
|
||||
|
||||
void GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
GfxPrint_VPrintf(this, fmt, args);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
|
||||
s32 i;
|
||||
s32 j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
s32 value = (m2->mf[i][j] * 0x10000);
|
||||
m1->intPart[i][j] = value >> 16;
|
||||
m1->fracPart[i][j] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MtxConv_L2F(MtxF* m1, MatrixInternal* m2) {
|
||||
guMtxL2F(m1, (Mtx *)m2);
|
||||
}
|
||||
@@ -69,13 +69,11 @@ void StackCheck_Cleanup(StackEntry* entry) {
|
||||
if (inconsistency) {}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// Missing useless move
|
||||
s32 StackCheck_GetState(StackEntry* entry) {
|
||||
StackStatus StackCheck_GetState(StackEntry* entry) {
|
||||
u32* last;
|
||||
u32 used;
|
||||
u32 free;
|
||||
s32 ret;
|
||||
s32 status;
|
||||
|
||||
for (last = (u32*)entry->head; (u32)last < entry->tail; last++) {
|
||||
if (entry->initValue != *last) {
|
||||
@@ -87,23 +85,20 @@ s32 StackCheck_GetState(StackEntry* entry) {
|
||||
free = (u32)last - entry->head;
|
||||
|
||||
if (free == 0) {
|
||||
return 2;
|
||||
status = STACK_STATUS_OVERFLOW;
|
||||
} else if (free < (u32)entry->minSpace && entry->minSpace != -1) {
|
||||
status = STACK_STATUS_WARNING;
|
||||
} else {
|
||||
status = STACK_STATUS_OK;
|
||||
}
|
||||
|
||||
if (free < entry->minSpace && entry->minSpace != -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return status;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/stackcheck/StackCheck_GetState.asm")
|
||||
#endif
|
||||
|
||||
u32 StackCheck_CheckAll() {
|
||||
u32 ret = 0;
|
||||
|
||||
StackEntry* iter = sStackInfoListStart;
|
||||
|
||||
while(iter) {
|
||||
u32 state = StackCheck_GetState(iter);
|
||||
if (state) {
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#include <global.h>
|
||||
|
||||
void bootproc(void) {
|
||||
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, &sBootThreadStack[1024], 0, -1, "boot");
|
||||
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot");
|
||||
osMemSize = osGetMemSize();
|
||||
func_800818F4();
|
||||
osInitialize();
|
||||
osUnmapTLBAll();
|
||||
gCartHandle = osCartRomInit();
|
||||
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, &sIdleThreadStack[1024], 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, (osCreateThread_func)Idle_ThreadEntry, 0, &sIdleThreadStack[1024], 12);
|
||||
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), 12);
|
||||
osStartThread(&sIdleThread);
|
||||
}
|
||||
|
||||
+18
-21
@@ -8,23 +8,20 @@ u32 gViConfigFeatures = 0x42;
|
||||
f32 gViConfigXScale = 1.0f;
|
||||
f32 gViConfigYScale = 1.0f;
|
||||
|
||||
void Idle_ClearMemory(void* begin, void* end){
|
||||
void Idle_ClearMemory(const void* begin, const void* end) {
|
||||
if (begin < end) {
|
||||
bzero(begin, (s32)(int)end - (int)begin);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This loop shouldn't unroll
|
||||
void Idle_InitFramebuffer(u32* ptr, u32 numBytes, u32 value) {
|
||||
s32 temp = sizeof(u32);
|
||||
|
||||
while (numBytes) {
|
||||
*ptr++ = value;
|
||||
numBytes -= sizeof(u32);
|
||||
numBytes -= temp;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/idle/Idle_InitFramebuffer.asm")
|
||||
#endif
|
||||
|
||||
void Idle_InitScreen(void) {
|
||||
Idle_InitFramebuffer((u32*)&gFramebuffer1, 0x25800, 0x00010001);
|
||||
@@ -58,7 +55,7 @@ void Idle_InitCodeAndMemory(void) {
|
||||
DmaMgr_SendRequestImpl(&dmaReq, (u32)&code_text_start, (u32)_codeSegmentRomStart, (u32)_codeSegmentRomEnd - (u32)_codeSegmentRomStart, 0, &queue, 0);
|
||||
Idle_InitScreen();
|
||||
Idle_InitMemory();
|
||||
osRecvMesg(&queue, 0, 1);
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
|
||||
sDmaMgrDmaBuffSize = oldSize;
|
||||
|
||||
@@ -69,15 +66,15 @@ void Idle_InitCodeAndMemory(void) {
|
||||
#endif
|
||||
|
||||
void Main_ThreadEntry(void* arg) {
|
||||
StackCheck_Init(&irqmgrStackEntry, &irqmgrStack, &irqmgrStack[1280], 0, 256, "irqmgr");
|
||||
IrqMgr_Create(&irqmgrContext, &irqmgrStackEntry, 18, 1);
|
||||
Dmamgr_Start();
|
||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 256, "irqmgr");
|
||||
IrqMgr_Init(&gIrqMgr, &sIrqMgrStackInfo, 18, 1);
|
||||
DmaMgr_Start();
|
||||
Idle_InitCodeAndMemory();
|
||||
main(arg);
|
||||
Dmamgr_Stop();
|
||||
DmaMgr_Stop();
|
||||
}
|
||||
|
||||
void func_8008038C(void) {
|
||||
void Idle_InitVideo(void) {
|
||||
osCreateViManager(254);
|
||||
|
||||
gViConfigFeatures = 66;
|
||||
@@ -87,15 +84,15 @@ void func_8008038C(void) {
|
||||
switch (osTvType) {
|
||||
case 1:
|
||||
D_8009B290 = 2;
|
||||
D_8009B240 = osViModeNtscLan1;
|
||||
gViConfigMode = osViModeNtscLan1;
|
||||
break;
|
||||
case 2:
|
||||
D_8009B290 = 30;
|
||||
D_8009B240 = osViModeMpalLan1;
|
||||
gViConfigMode = osViModeMpalLan1;
|
||||
break;
|
||||
case 0:
|
||||
D_8009B290 = 44;
|
||||
D_8009B240 = D_800980E0;
|
||||
gViConfigMode = osViModeFpalLan1;
|
||||
gViConfigYScale = 0.833f;
|
||||
break;
|
||||
}
|
||||
@@ -104,11 +101,11 @@ void func_8008038C(void) {
|
||||
}
|
||||
|
||||
void Idle_ThreadEntry(void* arg) {
|
||||
func_8008038C();
|
||||
osCreatePiManager(150, &D_8009B228, D_8009B160, 50);
|
||||
StackCheck_Init(&mainStackEntry, &mainStack, &mainStack[2304], 0, 1024, "main");
|
||||
osCreateThread(&mainOSThread, 3, (osCreateThread_func)Main_ThreadEntry, arg, &mainStack[2304], 12);
|
||||
osStartThread(&mainOSThread);
|
||||
Idle_InitVideo();
|
||||
osCreatePiManager(150, &gPiMgrCmdQ, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
|
||||
StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 1024, "main");
|
||||
osCreateThread(&gMainThread, 3, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), 12);
|
||||
osStartThread(&gMainThread);
|
||||
osSetThreadPri(NULL, 0);
|
||||
|
||||
for(;;);
|
||||
|
||||
@@ -155,7 +155,7 @@ void IrqMgr_ThreadEntry(IrqMgr* irqmgr) {
|
||||
}
|
||||
}
|
||||
|
||||
void IrqMgr_Create(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
|
||||
void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
|
||||
irqmgr->callbacks = NULL;
|
||||
irqmgr->verticalRetraceMesg.type = 1;
|
||||
irqmgr->prenmiMsg.type = 4;
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void ViConfig_UpdateVi(u32 arg0) {
|
||||
if (arg0 != 0) {
|
||||
void ViConfig_UpdateVi(u32 mode) {
|
||||
if (mode != 0) {
|
||||
switch (osTvType) {
|
||||
case 2:
|
||||
osViSetMode(&osViModeMpalLan1);
|
||||
@@ -17,7 +16,6 @@ void ViConfig_UpdateVi(u32 arg0) {
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (gViConfigFeatures != 0) {
|
||||
osViSetSpecialFeatures(gViConfigFeatures);
|
||||
}
|
||||
@@ -26,13 +24,12 @@ void ViConfig_UpdateVi(u32 arg0) {
|
||||
osViSetYScale(1);
|
||||
}
|
||||
} else {
|
||||
osViSetMode(&D_8009B240);
|
||||
osViSetMode(&gViConfigMode);
|
||||
|
||||
if (gViConfigAdditionalScanLines != 0) {
|
||||
func_80087E00(gViConfigAdditionalScanLines);
|
||||
}
|
||||
|
||||
// TODO v0 is used here instead of a0. Is this a 7.1 optimization?
|
||||
if (gViConfigFeatures != 0) {
|
||||
osViSetSpecialFeatures(gViConfigFeatures);
|
||||
}
|
||||
@@ -46,11 +43,9 @@ void ViConfig_UpdateVi(u32 arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
gViConfigUseDefault = arg0;
|
||||
gViConfigUseDefault = mode;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/viconfig/ViConfig_UpdateVi.asm")
|
||||
#endif
|
||||
|
||||
|
||||
void ViConfig_UpdateBlack(void) {
|
||||
if (gViConfigUseDefault != 0) {
|
||||
|
||||
+117
-117
@@ -1,45 +1,45 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
UNK_TYPE4 sDmaMgrDmaBuffSize = 0x2000;
|
||||
u32 sDmaMgrDmaBuffSize = 0x2000;
|
||||
|
||||
s32 DmaMgr_DMARomToRam(u32 a0, void* a1, u32 a2) {
|
||||
OSIoMesg sp60;
|
||||
OSMesgQueue sp48;
|
||||
OSMesg sp44;
|
||||
s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) {
|
||||
OSIoMesg ioMsg;
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg[1];
|
||||
s32 ret;
|
||||
u32 s0 = sDmaMgrDmaBuffSize;
|
||||
u32 buffSize = sDmaMgrDmaBuffSize;
|
||||
|
||||
osInvalDCache(a1, a2);
|
||||
osCreateMesgQueue(&sp48, &sp44, 1);
|
||||
osInvalDCache(ram, size);
|
||||
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
|
||||
|
||||
if (s0 != 0) {
|
||||
while (s0 < a2) {
|
||||
sp60.hdr.pri = 0;
|
||||
sp60.hdr.retQueue = &sp48;
|
||||
sp60.devAddr = (u32)a0;
|
||||
sp60.dramAddr = a1;
|
||||
sp60.size = s0;
|
||||
ret = osEPiStartDma(gCartHandle, &sp60, 0);
|
||||
if (buffSize != 0) {
|
||||
while (buffSize < size) {
|
||||
ioMsg.hdr.pri = 0;
|
||||
ioMsg.hdr.retQueue = &queue;
|
||||
ioMsg.devAddr = (u32)rom;
|
||||
ioMsg.dramAddr = ram;
|
||||
ioMsg.size = buffSize;
|
||||
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp48, NULL, 1);
|
||||
a2 -= s0;
|
||||
a0 = a0 + s0;
|
||||
a1 = (u8*)a1 + s0;
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
size -= buffSize;
|
||||
rom = rom + buffSize;
|
||||
ram = (u8*)ram + buffSize;
|
||||
}
|
||||
}
|
||||
sp60.hdr.pri = 0;
|
||||
sp60.hdr.retQueue = &sp48;
|
||||
sp60.devAddr = (u32)a0;
|
||||
sp60.dramAddr = a1;
|
||||
sp60.size = (u32)a2;
|
||||
ret = osEPiStartDma(gCartHandle, &sp60, 0);
|
||||
ioMsg.hdr.pri = 0;
|
||||
ioMsg.hdr.retQueue = &queue;
|
||||
ioMsg.devAddr = (u32)rom;
|
||||
ioMsg.dramAddr = ram;
|
||||
ioMsg.size = (u32)size;
|
||||
ret = osEPiStartDma(gCartHandle, &ioMsg, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp48, NULL, 1);
|
||||
osRecvMesg(&queue, NULL, 1);
|
||||
|
||||
osInvalDCache(a1, a2);
|
||||
osInvalDCache(ram, size);
|
||||
|
||||
END:
|
||||
return ret;
|
||||
@@ -49,12 +49,12 @@ void DmaMgr_DmaCallback0(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
osEPiStartDma(pihandle, mb, direction);
|
||||
}
|
||||
|
||||
DmaEntry* Dmamgr_FindDmaEntry(u32 a0) {
|
||||
DmaEntry* DmaMgr_FindDmaEntry(u32 vrom) {
|
||||
DmaEntry* curr;
|
||||
|
||||
for (curr = dmadata; curr->vromEnd != 0; curr++) {
|
||||
if (a0 < curr->vromStart) continue;
|
||||
if (a0 >= curr->vromEnd) continue;
|
||||
if (vrom < curr->vromStart) continue;
|
||||
if (vrom >= curr->vromEnd) continue;
|
||||
|
||||
return curr;
|
||||
}
|
||||
@@ -62,16 +62,16 @@ DmaEntry* Dmamgr_FindDmaEntry(u32 a0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
u32 Dmamgr_TranslateVromToRom(u32 a0) {
|
||||
DmaEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
u32 DmaMgr_TranslateVromToRom(u32 vrom) {
|
||||
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
||||
|
||||
if (v0 != NULL) {
|
||||
if (v0->romEnd == 0) {
|
||||
return a0 + v0->romStart - v0->vromStart;
|
||||
if (entry != NULL) {
|
||||
if (entry->romEnd == 0) {
|
||||
return vrom + entry->romStart - entry->vromStart;
|
||||
}
|
||||
|
||||
if (a0 == v0->vromStart) {
|
||||
return v0->romStart;
|
||||
if (vrom == entry->vromStart) {
|
||||
return entry->romStart;
|
||||
}
|
||||
|
||||
return -1;
|
||||
@@ -80,86 +80,86 @@ u32 Dmamgr_TranslateVromToRom(u32 a0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 Dmamgr_FindDmaIndex(u32 a0) {
|
||||
DmaEntry* v0 = Dmamgr_FindDmaEntry(a0);
|
||||
s32 DmaMgr_FindDmaIndex(u32 vrom) {
|
||||
DmaEntry* entry = DmaMgr_FindDmaEntry(vrom);
|
||||
|
||||
if (v0 != NULL) {
|
||||
return v0 - dmadata;
|
||||
if (entry != NULL) {
|
||||
return entry - dmadata;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO this should be a string
|
||||
char* func_800809F4(u32 a0) {
|
||||
return &D_800981C0[0];
|
||||
const char* func_800809F4(u32 a0) {
|
||||
return "??";
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void DmaMgr_ProcessMsg(DmaRequest* a0) {
|
||||
u32 sp34;
|
||||
u32 sp30;
|
||||
UNK_TYPE sp2C;
|
||||
UNK_TYPE sp28;
|
||||
UNK_TYPE sp24;
|
||||
UNK_TYPE sp20;
|
||||
s32 sp1C;
|
||||
UNK_TYPE sp18;
|
||||
void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||
u32 vrom;
|
||||
void* ram;
|
||||
u32 size;
|
||||
u32 romStart;
|
||||
u32 romSize;
|
||||
DmaEntry* dmaEntry;
|
||||
s32 index;
|
||||
|
||||
sp34 = a0->vromStart;
|
||||
sp30 = a0->dramAddr;
|
||||
sp2C = a0->size;
|
||||
vrom = req->vromAddr;
|
||||
ram = req->dramAddr;
|
||||
size = req->size;
|
||||
|
||||
sp1C = Dmamgr_FindDmaIndex(sp34);
|
||||
|
||||
if ((sp1C >= 0) && (sp1C < numDmaEntries)) {
|
||||
if (dmadata[sp1C].romEnd == 0) {
|
||||
if (dmadata[sp1C].vromEnd < (sp2C + sp34)) {
|
||||
Fault_AddHungupAndCrash(dmamgrString800981C4, 499);
|
||||
index = DmaMgr_FindDmaIndex(vrom);
|
||||
|
||||
if ((index >= 0) && (index < numDmaEntries)) {
|
||||
dmaEntry = &dmadata[index];
|
||||
if (dmaEntry->romEnd == 0) {
|
||||
if (dmaEntry->vromEnd < (vrom + size)) {
|
||||
Fault_AddHungupAndCrash("../z_std_dma.c", 499);
|
||||
}
|
||||
DmaMgr_DMARomToRam((dmadata[sp1C].romStart + sp34) - dmadata[sp1C].vromStart, (u8*)sp30, sp2C);
|
||||
DmaMgr_DMARomToRam((dmaEntry->romStart + vrom) - dmaEntry->vromStart, (u8*)ram, size);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO this part is arranged slightly different is ASM
|
||||
sp24 = dmadata[sp1C].romEnd - dmadata[sp1C].romStart;
|
||||
sp28 = dmadata[sp1C].romStart;
|
||||
romSize = dmaEntry->romEnd - dmaEntry->romStart;
|
||||
romStart = dmaEntry->romStart;
|
||||
|
||||
if (sp34 != dmadata[sp1C].vromStart) {
|
||||
Fault_AddHungupAndCrash(dmamgrString800981D4, 518);
|
||||
if (vrom != dmaEntry->vromStart) {
|
||||
Fault_AddHungupAndCrash("../z_std_dma.c", 518);
|
||||
}
|
||||
|
||||
if (sp2C != (dmadata[sp1C].vromEnd - dmadata[sp1C].vromStart)) {
|
||||
Fault_AddHungupAndCrash(dmamgrString800981E4, 525);
|
||||
if (size != (dmaEntry->vromEnd - dmaEntry->vromStart)) {
|
||||
Fault_AddHungupAndCrash("../z_std_dma.c", 525);
|
||||
}
|
||||
|
||||
osSetThreadPri(NULL, 10);
|
||||
Yaz0_Decompress(sp28, sp30, sp24);
|
||||
Yaz0_Decompress(romStart, ram, romSize);
|
||||
osSetThreadPri(NULL, 17);
|
||||
} else {
|
||||
Fault_AddHungupAndCrash(dmamgrString800981F4, 558);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/z_std_dma/DmaMgr_ProcessMsg.asm")
|
||||
#endif
|
||||
|
||||
void Dmamgr_ThreadEntry(void* a0) {
|
||||
OSMesg sp34;
|
||||
u32 pad;
|
||||
DmaRequest* s0;
|
||||
|
||||
for (;;) {
|
||||
osRecvMesg(&dmamgrMsq, &sp34, 1);
|
||||
if (sp34 == NULL) return;
|
||||
s0 = (DmaRequest*)sp34;
|
||||
DmaMgr_ProcessMsg(s0);
|
||||
if (s0->notifyQueue == NULL) continue;
|
||||
osSendMesg(s0->notifyQueue, s0->notifyMsg, 0);
|
||||
Fault_AddHungupAndCrash("../z_std_dma.c", 558);
|
||||
}
|
||||
}
|
||||
|
||||
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* callback, void* callbackMesg) {
|
||||
void DmaMgr_ThreadEntry(void* a0) {
|
||||
OSMesg msg;
|
||||
DmaRequest* req;
|
||||
|
||||
while (1) {
|
||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
req = (DmaRequest *)msg;
|
||||
|
||||
DmaMgr_ProcessMsg(req);
|
||||
if (req->notifyQueue) {
|
||||
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart, u32 size, UNK_TYPE4 unused, OSMesgQueue* queue, OSMesg msg) {
|
||||
if (gIrqMgrResetStatus >= 2) {
|
||||
return -2;
|
||||
}
|
||||
@@ -168,56 +168,56 @@ s32 DmaMgr_SendRequestImpl(DmaRequest* request, void* vramStart, u32 vromStart,
|
||||
request->dramAddr = vramStart;
|
||||
request->size = size;
|
||||
request->unk14 = 0;
|
||||
request->notifyQueue = callback;
|
||||
request->notifyMsg = callbackMesg;
|
||||
request->notifyQueue = queue;
|
||||
request->notifyMsg = msg;
|
||||
|
||||
osSendMesg(&dmamgrMsq, request, 1);
|
||||
osSendMesg(&sDmaMgrMsgQueue, request, OS_MESG_BLOCK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) {
|
||||
DmaRequest sp48;
|
||||
OSMesgQueue sp30;
|
||||
OSMesg sp2C;
|
||||
DmaRequest req;
|
||||
OSMesgQueue queue;
|
||||
OSMesg msg[1];
|
||||
s32 ret;
|
||||
|
||||
osCreateMesgQueue(&sp30, &sp2C, 1);
|
||||
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
|
||||
|
||||
ret = DmaMgr_SendRequestImpl(&sp48, vramStart, vromStart, size, 0, &sp30, 0);
|
||||
ret = DmaMgr_SendRequestImpl(&req, vramStart, vromStart, size, 0, &queue, NULL);
|
||||
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
} else {
|
||||
osRecvMesg(&sp30, NULL, 1);
|
||||
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char dmamgrThreadName[] = "dmamgr";
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// TODO missing a useless move initializing v0, and some reorderings
|
||||
void Dmamgr_Start() {
|
||||
DmaEntry* v0;
|
||||
u32 v1;
|
||||
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, dmadata, (u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart);
|
||||
void DmaMgr_Start() {
|
||||
DmaEntry* iter;
|
||||
u32 idx;
|
||||
|
||||
for (v0 = dmadata, v1 = 0; v0->vromEnd != 0; v0++, v1++);
|
||||
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, dmadata, (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
|
||||
|
||||
numDmaEntries = v1;
|
||||
for (iter = dmadata, idx = 0; iter->vromEnd != 0; iter++, idx++);
|
||||
|
||||
osCreateMesgQueue(&dmamgrMsq, dmamgrMsqMessages, 32);
|
||||
numDmaEntries = idx;
|
||||
|
||||
StackCheck_Init(&dmamgrStackEntry, &dmamgrStack, &dmamgrStack[1280], 0, 256, dmamgrThreadName);
|
||||
|
||||
osCreateThread(&dmamgrOSThread, 18, Dmamgr_ThreadEntry, NULL, &dmamgrStack[1280], 17);
|
||||
|
||||
osStartThread(&dmamgrOSThread);
|
||||
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
|
||||
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 256, dmamgrThreadName);
|
||||
osCreateThread(&sDmaMgrThread, 18, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack), 17);
|
||||
osStartThread(&sDmaMgrThread);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/z_std_dma/Dmamgr_Start.asm")
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/z_std_dma/DmaMgr_Start.asm")
|
||||
#endif
|
||||
|
||||
void Dmamgr_Stop() {
|
||||
osSendMesg(&dmamgrMsq, NULL, 1);
|
||||
void DmaMgr_Stop() {
|
||||
osSendMesg(&sDmaMgrMsgQueue, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
+148
-178
@@ -2,51 +2,45 @@
|
||||
#include <global.h>
|
||||
|
||||
// TODO move out
|
||||
#define OS_CLOCK_RATE 62500000LL
|
||||
#define OS_CPU_COUNTER (OS_CLOCK_RATE*3/4)
|
||||
#define OS_USEC_TO_CYCLES(n) (((u64)(n)*(OS_CPU_COUNTER/15625LL))/(1000000LL/15625LL))
|
||||
#define OS_CLOCK_RATE 62500000LL
|
||||
|
||||
void Fault_SleepImpl(u32 duration) {
|
||||
u64 value = (duration * OS_CPU_COUNTER) / 1000ull;
|
||||
wait_cycles(value);
|
||||
Sleep_Cycles(value);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// minor reordering around the start of the loop, same as Fault_AddAddrConvClient
|
||||
void Fault_AddClient(FaultClient* client, fault_client_func callback, void* param0, void* param1) {
|
||||
OSIntMask mask;
|
||||
u32 alreadyExist;
|
||||
FaultClient* iter;
|
||||
|
||||
alreadyExist = 0;
|
||||
u32 alreadyExists = 0;
|
||||
|
||||
mask = osSetIntMask(1);
|
||||
|
||||
iter = faultCtxt->clients;
|
||||
while (iter) {
|
||||
if (iter == client) {
|
||||
alreadyExist = 1;
|
||||
goto end;
|
||||
{
|
||||
|
||||
FaultClient* iter = sFaultContext->clients;
|
||||
|
||||
while (iter) {
|
||||
if (iter == client) {
|
||||
alreadyExists = 1;
|
||||
goto end;
|
||||
}
|
||||
iter = iter->next;
|
||||
}
|
||||
iter = iter->next;
|
||||
}
|
||||
|
||||
client->callback = callback;
|
||||
client->param0 = param0;
|
||||
client->param1 = param1;
|
||||
client->next = faultCtxt->clients;
|
||||
faultCtxt->clients = client;
|
||||
client->next = sFaultContext->clients;
|
||||
sFaultContext->clients = client;
|
||||
|
||||
end:
|
||||
osSetIntMask(mask);
|
||||
|
||||
if (alreadyExist) {
|
||||
if (alreadyExists) {
|
||||
Fault_Log(D_800984B4, client);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_AddClient.asm")
|
||||
#endif
|
||||
|
||||
void Fault_RemoveClient(FaultClient* client) {
|
||||
FaultClient* iter;
|
||||
@@ -54,7 +48,7 @@ void Fault_RemoveClient(FaultClient* client) {
|
||||
OSIntMask mask;
|
||||
u32 listIsEmpty;
|
||||
|
||||
iter = faultCtxt->clients;
|
||||
iter = sFaultContext->clients;
|
||||
listIsEmpty = 0;
|
||||
lastIter = NULL;
|
||||
|
||||
@@ -65,9 +59,9 @@ void Fault_RemoveClient(FaultClient* client) {
|
||||
if (lastIter) {
|
||||
lastIter->next = client->next;
|
||||
} else {
|
||||
faultCtxt->clients = client;
|
||||
if (faultCtxt->clients) {
|
||||
faultCtxt->clients = client->next;
|
||||
sFaultContext->clients = client;
|
||||
if (sFaultContext->clients) {
|
||||
sFaultContext->clients = client->next;
|
||||
} else {
|
||||
listIsEmpty = 1;
|
||||
}
|
||||
@@ -86,41 +80,35 @@ void Fault_RemoveClient(FaultClient* client) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// minor reordering around the start of the loop, same as Fault_AddClient
|
||||
void Fault_AddAddrConvClient(FaultAddrConvClient* client, fault_address_converter_func callback, void* param) {
|
||||
OSIntMask mask;
|
||||
u32 alreadyExist;
|
||||
FaultAddrConvClient* iter;
|
||||
|
||||
alreadyExist = 0;
|
||||
u32 alreadyExists = 0;
|
||||
|
||||
mask = osSetIntMask(1);
|
||||
|
||||
iter = faultCtxt->addrConvClients;
|
||||
while (iter) {
|
||||
if (iter == client) {
|
||||
alreadyExist = 1;
|
||||
goto end;
|
||||
}
|
||||
iter = iter->next;
|
||||
}
|
||||
{
|
||||
|
||||
FaultAddrConvClient* iter = sFaultContext->addrConvClients;
|
||||
while (iter) {
|
||||
if (iter == client) {
|
||||
alreadyExists = 1;
|
||||
goto end;
|
||||
}
|
||||
iter = iter->next;
|
||||
}
|
||||
}
|
||||
client->callback = callback;
|
||||
client->param = param;
|
||||
client->next = faultCtxt->addrConvClients;
|
||||
faultCtxt->addrConvClients = client;
|
||||
client->next = sFaultContext->addrConvClients;
|
||||
sFaultContext->addrConvClients = client;
|
||||
|
||||
end:
|
||||
osSetIntMask(mask);
|
||||
|
||||
if (alreadyExist) {
|
||||
if (alreadyExists) {
|
||||
Fault_Log(D_80098524, client);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_AddAddrConvClient.asm")
|
||||
#endif
|
||||
|
||||
void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
|
||||
FaultAddrConvClient* iter;
|
||||
@@ -128,7 +116,7 @@ void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
|
||||
OSIntMask mask;
|
||||
u32 listIsEmpty;
|
||||
|
||||
iter = faultCtxt->addrConvClients;
|
||||
iter = sFaultContext->addrConvClients;
|
||||
listIsEmpty = 0;
|
||||
lastIter = NULL;
|
||||
|
||||
@@ -139,9 +127,9 @@ void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
|
||||
if (lastIter) {
|
||||
lastIter->next = client->next;
|
||||
} else {
|
||||
faultCtxt->addrConvClients = client;
|
||||
if (faultCtxt->addrConvClients) {
|
||||
faultCtxt->addrConvClients = client->next;
|
||||
sFaultContext->addrConvClients = client;
|
||||
if (sFaultContext->addrConvClients) {
|
||||
sFaultContext->addrConvClients = client->next;
|
||||
} else {
|
||||
listIsEmpty = 1;
|
||||
}
|
||||
@@ -162,9 +150,9 @@ void Fault_RemoveAddrConvClient(FaultAddrConvClient* client) {
|
||||
|
||||
void* Fault_ConvertAddress(void* addr) {
|
||||
void* ret;
|
||||
FaultAddrConvClient* iter = faultCtxt->addrConvClients;
|
||||
FaultAddrConvClient* iter = sFaultContext->addrConvClients;
|
||||
|
||||
while(iter) {
|
||||
while (iter) {
|
||||
if (iter->callback) {
|
||||
ret = iter->callback(addr, iter->param);
|
||||
if (ret != NULL) {
|
||||
@@ -186,55 +174,47 @@ void Fault_PadCallback(Input* input) {
|
||||
}
|
||||
|
||||
void Fault_UpdatePadImpl() {
|
||||
faultCtxt->padCallback(faultCtxt->padInput);
|
||||
sFaultContext->padCallback(sFaultContext->padInput);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// curInput is being put in s3 instead of temp registers
|
||||
// Stack is too small
|
||||
s32 Fault_WaitForInputImpl() {
|
||||
Input* curInput;
|
||||
u32 Fault_WaitForInputImpl() {
|
||||
Input* curInput = &sFaultContext->padInput[0];
|
||||
s32 count = 600;
|
||||
u32 kDown;
|
||||
s32 count;
|
||||
|
||||
count = 600;
|
||||
curInput = faultCtxt->padInput;
|
||||
while (1) {
|
||||
while (1) {
|
||||
Fault_Sleep(0x10);
|
||||
Fault_UpdatePadImpl();
|
||||
kDown = curInput->press.button;
|
||||
if (kDown == BTN_L) {
|
||||
faultCtxt->faultActive = !faultCtxt->faultActive;
|
||||
}
|
||||
Fault_Sleep(0x10);
|
||||
Fault_UpdatePadImpl();
|
||||
|
||||
if (!faultCtxt->faultActive) {
|
||||
break;
|
||||
}
|
||||
kDown = curInput->press.button;
|
||||
|
||||
if (kDown == BTN_L) {
|
||||
sFaultContext->faultActive = !sFaultContext->faultActive;
|
||||
}
|
||||
|
||||
if (sFaultContext->faultActive) {
|
||||
if (count-- < 1) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (kDown == BTN_A || kDown == BTN_DRIGHT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (kDown == BTN_A || kDown == BTN_DRIGHT) {
|
||||
return 0;
|
||||
}
|
||||
if (kDown == BTN_DLEFT) {
|
||||
return 1;
|
||||
}
|
||||
if (kDown == BTN_DUP) {
|
||||
FaultDrawer_SetOsSyncPrintfEnabled(1);
|
||||
}
|
||||
if (kDown == BTN_DDOWN) {
|
||||
FaultDrawer_SetOsSyncPrintfEnabled(0);
|
||||
if (kDown == BTN_DLEFT) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (kDown == BTN_DUP) {
|
||||
FaultDrawer_SetOsSyncPrintfEnabled(1);
|
||||
}
|
||||
|
||||
if (kDown == BTN_DDOWN) {
|
||||
FaultDrawer_SetOsSyncPrintfEnabled(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_WaitForInputImpl.asm")
|
||||
#endif
|
||||
|
||||
void Fault_WaitForInput() {
|
||||
Fault_WaitForInputImpl();
|
||||
@@ -273,32 +253,25 @@ void Fault_PrintFReg(s32 idx, f32* value) {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc
|
||||
void Fault_LogFReg(s32 idx, f32* value) {
|
||||
s32 v0;
|
||||
u32 raw;
|
||||
u32 raw = *(u32*)value;
|
||||
s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
|
||||
|
||||
raw = *(u32*)value;
|
||||
v0 = ((*(u32*)value & 0x7f800000) >> 0x17) - 0x7f;
|
||||
|
||||
if ((v0 >= -0x7e && v0 < 0x80) || *(u32*)value == 0) {
|
||||
if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
|
||||
Fault_Log(D_800985DC, idx, *value);
|
||||
} else {
|
||||
Fault_Log(D_800985EC, idx, raw);
|
||||
Fault_Log(D_800985EC, idx, *(u32*)value);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_LogFReg.asm")
|
||||
#endif
|
||||
|
||||
void Fault_PrintFPCR(u32 value) {
|
||||
s32 i;
|
||||
u32 flag = 0x20000;
|
||||
|
||||
FaultDrawer_Printf(D_80098600, value);
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
|
||||
if (value & flag) {
|
||||
FaultDrawer_Printf(D_80098610, D_80096BC8[i]);
|
||||
FaultDrawer_Printf(D_80098610, sExceptionNames[i]);
|
||||
break;
|
||||
}
|
||||
flag >>= 1;
|
||||
@@ -309,23 +282,26 @@ void Fault_PrintFPCR(u32 value) {
|
||||
void Fault_LogFPCR(u32 value) {
|
||||
s32 i;
|
||||
u32 flag = 0x20000;
|
||||
|
||||
Fault_Log(D_8009861C, value);
|
||||
for (i = 0; i < 6; i++) {
|
||||
for (i = 0; i < ARRAY_COUNT(sExceptionNames); i++) {
|
||||
if (value & flag) {
|
||||
Fault_Log(D_8009862C, D_80096BC8[i]);
|
||||
Fault_Log(D_8009862C, sExceptionNames[i]);
|
||||
break;
|
||||
}
|
||||
flag >>= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Fault_PrintThreadContext(OSThread* t){
|
||||
void Fault_PrintThreadContext(OSThread* t) {
|
||||
__OSThreadContext* ctx;
|
||||
s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
|
||||
if (causeStrIdx == 0x17)
|
||||
s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
|
||||
if (causeStrIdx == 0x17) {
|
||||
causeStrIdx = 0x10;
|
||||
if (causeStrIdx == 0x1F)
|
||||
}
|
||||
if (causeStrIdx == 0x1F) {
|
||||
causeStrIdx = 0x11;
|
||||
}
|
||||
|
||||
FaultDrawer_FillScreen();
|
||||
FaultDrawer_SetCharPad(-2, 4);
|
||||
@@ -380,13 +356,15 @@ void Fault_PrintThreadContext(OSThread* t){
|
||||
}
|
||||
}
|
||||
|
||||
void Fault_LogThreadContext(OSThread* t){
|
||||
__OSThreadContext *ctx;
|
||||
s32 causeStrIdx = (s32) ((((u32) t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
|
||||
if (causeStrIdx == 0x17)
|
||||
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)
|
||||
}
|
||||
if (causeStrIdx == 0x1f) {
|
||||
causeStrIdx = 0x11;
|
||||
}
|
||||
|
||||
ctx = &t->context;
|
||||
Fault_Log(D_800987B0);
|
||||
@@ -434,8 +412,7 @@ void Fault_LogThreadContext(OSThread* t){
|
||||
|
||||
OSThread* Fault_FindFaultedThread() {
|
||||
OSThread* iter = __osGetActiveQueue();
|
||||
while (iter->priority != -1)
|
||||
{
|
||||
while (iter->priority != -1) {
|
||||
if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) {
|
||||
return iter;
|
||||
}
|
||||
@@ -451,11 +428,11 @@ void Fault_Wait5Seconds(void) {
|
||||
Fault_Sleep(0x10);
|
||||
} while ((osGetTime() - start) <= OS_USEC_TO_CYCLES(5000000));
|
||||
|
||||
faultCtxt->faultActive = 1;
|
||||
sFaultContext->faultActive = 1;
|
||||
}
|
||||
|
||||
void Fault_WaitForButtonCombo(void) {
|
||||
Input* input = &faultCtxt->padInput[0];
|
||||
Input* input = &sFaultContext->padInput[0];
|
||||
|
||||
FaultDrawer_SetForeColor(0xffff);
|
||||
FaultDrawer_SetBackColor(1);
|
||||
@@ -487,7 +464,7 @@ void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) {
|
||||
Fault_FillScreenBlack();
|
||||
FaultDrawer_SetCharPad(-2, 0);
|
||||
|
||||
FaultDrawer_DrawText(0x24, 0x12, D_80098954, title? title : D_8009895C, alignedAddr);
|
||||
FaultDrawer_DrawText(0x24, 0x12, D_80098954, title ? title : D_8009895C, alignedAddr);
|
||||
if (alignedAddr >= (u32*)0x80000000 && alignedAddr < (u32*)0xC0000000) {
|
||||
for (y = 0x1C; y != 0xE2; y += 9) {
|
||||
FaultDrawer_DrawText(0x18, y, D_80098968, writeAddr);
|
||||
@@ -500,15 +477,14 @@ void Fault_DrawMemDumpPage(char* title, u32* addr, u32 param_3) {
|
||||
FaultDrawer_SetCharPad(0, 0);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// The count = 600 load happens a bit too early
|
||||
void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
|
||||
s32 count;
|
||||
s32 off;
|
||||
Input* input = &faultCtxt->padInput[0];
|
||||
Input* input = &sFaultContext->padInput[0];
|
||||
u32 addr = pc;
|
||||
|
||||
do {
|
||||
count = 0;
|
||||
if (addr < 0x80000000) {
|
||||
addr = 0x80000000;
|
||||
}
|
||||
@@ -520,7 +496,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
|
||||
Fault_DrawMemDumpPage(D_80098978, (u32*)addr, 0);
|
||||
|
||||
count = 600;
|
||||
while (faultCtxt->faultActive) {
|
||||
while (sFaultContext->faultActive) {
|
||||
if (count == 0) {
|
||||
return;
|
||||
}
|
||||
@@ -531,7 +507,7 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
|
||||
Fault_UpdatePadImpl();
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_L)) {
|
||||
faultCtxt->faultActive = 0;
|
||||
sFaultContext->faultActive = 0;
|
||||
}
|
||||
}
|
||||
do {
|
||||
@@ -539,15 +515,15 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
|
||||
Fault_UpdatePadImpl();
|
||||
} while (input->press.button == 0);
|
||||
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START)) == 0) {
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_START)) {
|
||||
return;
|
||||
}
|
||||
|
||||
off = 0x10;
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_A)) {
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_A)) {
|
||||
off = 0x100;
|
||||
}
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_B)) {
|
||||
if (CHECK_BTN_ALL(input->cur.button, BTN_B)) {
|
||||
off <<= 8;
|
||||
}
|
||||
if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) {
|
||||
@@ -571,11 +547,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
|
||||
|
||||
} while (!CHECK_BTN_ALL(input->press.button, BTN_L));
|
||||
|
||||
faultCtxt->faultActive = 1;
|
||||
sFaultContext->faultActive = 1;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_DrawMemDump.asm")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// This function still needs a bit of work
|
||||
@@ -655,7 +628,7 @@ void Fault_DrawStackTrace(OSThread* t, u32 flags) {
|
||||
FaultDrawer_DrawText(0x24, 0x18, D_8009898C);
|
||||
|
||||
for (y = 1; (y < 22) && (((ra != 0) || (sp != 0)) && (pc != (u32)__osCleanupThread)); y++) {
|
||||
FaultDrawer_DrawText(0x24, y*8+24, D_800989A4, sp, pc);
|
||||
FaultDrawer_DrawText(0x24, y * 8 + 24, D_800989A4, sp, pc);
|
||||
|
||||
if (flags & 1) {
|
||||
convertedPc = (u32)Fault_ConvertAddress((void*)pc);
|
||||
@@ -711,17 +684,15 @@ void Fault_ResumeThread(OSThread* t) {
|
||||
osStartThread(t);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc
|
||||
void Fault_CommitFB() {
|
||||
u16* fb;
|
||||
osViSetYScale(1.0f);
|
||||
osViSetMode(&osViModeNtscLan1);
|
||||
osViSetSpecialFeatures(0x42); //gama_disable|dither_fliter_enable_aa_mode3_disable
|
||||
osViSetSpecialFeatures(0x42); // gama_disable|dither_fliter_enable_aa_mode3_disable
|
||||
osViBlack(0);
|
||||
|
||||
if (faultCtxt->fb) {
|
||||
fb = faultCtxt->fb;
|
||||
if (sFaultContext->fb) {
|
||||
fb = sFaultContext->fb;
|
||||
} else {
|
||||
fb = (u16*)osViGetNextFramebuffer();
|
||||
if ((u32)fb == 0x80000000) {
|
||||
@@ -730,16 +701,14 @@ void Fault_CommitFB() {
|
||||
}
|
||||
|
||||
osViSwapBuffer(fb);
|
||||
FaultDrawer_SetDrawerFB(fb, 0x140, 0xF0);
|
||||
FaultDrawer_SetDrawerFB(fb, SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault/Fault_CommitFB.asm")
|
||||
#endif
|
||||
|
||||
void Fault_ProcessClients(void) {
|
||||
FaultClient* iter = faultCtxt->clients;
|
||||
FaultClient* iter = sFaultContext->clients;
|
||||
s32 idx = 0;
|
||||
while(iter) {
|
||||
|
||||
while (iter != NULL) {
|
||||
if (iter->callback) {
|
||||
Fault_FillScreenBlack();
|
||||
FaultDrawer_SetCharPad(-2, 0);
|
||||
@@ -762,7 +731,7 @@ void Fault_SetOptionsFromController3(void) {
|
||||
u32 graphRA;
|
||||
u32 graphSP;
|
||||
|
||||
input3 = &faultCtxt->padInput[3];
|
||||
input3 = &sFaultContext->padInput[3];
|
||||
|
||||
if (CHECK_BTN_ALL(input3->press.button, 0x80)) {
|
||||
faultCustomOptions = faultCustomOptions == 0;
|
||||
@@ -801,52 +770,51 @@ void Fault_ThreadEntry(void* arg) {
|
||||
u32 pad;
|
||||
OSThread* faultedThread;
|
||||
|
||||
osSetEventMesg(10, &faultCtxt->queue, (OSMesg)1);
|
||||
osSetEventMesg(12, &faultCtxt->queue, (OSMesg)2);
|
||||
osSetEventMesg(10, &sFaultContext->queue, (OSMesg)1);
|
||||
osSetEventMesg(12, &sFaultContext->queue, (OSMesg)2);
|
||||
while (1) {
|
||||
do {
|
||||
osRecvMesg(&faultCtxt->queue, &msg, 1);
|
||||
osRecvMesg(&sFaultContext->queue, &msg, 1);
|
||||
|
||||
if (msg == (OSMesg)1) {
|
||||
faultCtxt->msgId = 1;
|
||||
sFaultContext->msgId = 1;
|
||||
Fault_Log(D_80098A88);
|
||||
} else if (msg == (OSMesg)2) {
|
||||
faultCtxt->msgId = 2;
|
||||
sFaultContext->msgId = 2;
|
||||
Fault_Log(D_80098AC0);
|
||||
} else if (msg == (OSMesg)3) {
|
||||
Fault_SetOptions();
|
||||
faultedThread = NULL;
|
||||
continue;
|
||||
} else {
|
||||
faultCtxt->msgId = 3;
|
||||
sFaultContext->msgId = 3;
|
||||
Fault_Log(D_80098AF4);
|
||||
}
|
||||
|
||||
faultedThread = __osGetCurrFaultedThread();
|
||||
Fault_Log(D_80098B28, faultedThread);
|
||||
if (!faultedThread)
|
||||
{
|
||||
if (!faultedThread) {
|
||||
faultedThread = Fault_FindFaultedThread();
|
||||
Fault_Log(D_80098B4C, faultedThread);
|
||||
}
|
||||
} while (faultedThread == NULL);
|
||||
|
||||
__osSetFpcCsr(__osGetFpcCsr() & 0xFFFFF07F);
|
||||
faultCtxt->faultedThread = faultedThread;
|
||||
while (!faultCtxt->faultHandlerEnabled) {
|
||||
sFaultContext->faultedThread = faultedThread;
|
||||
while (!sFaultContext->faultHandlerEnabled) {
|
||||
Fault_Sleep(1000);
|
||||
}
|
||||
Fault_Sleep(500);
|
||||
Fault_CommitFB();
|
||||
|
||||
if (faultCtxt->faultActive) {
|
||||
if (sFaultContext->faultActive) {
|
||||
Fault_Wait5Seconds();
|
||||
} else {
|
||||
Fault_DrawCornerRec(0xF801);
|
||||
Fault_WaitForButtonCombo();
|
||||
}
|
||||
|
||||
faultCtxt->faultActive = 1;
|
||||
sFaultContext->faultActive = 1;
|
||||
FaultDrawer_SetForeColor(0xFFFF);
|
||||
FaultDrawer_SetBackColor(0);
|
||||
|
||||
@@ -869,55 +837,57 @@ void Fault_ThreadEntry(void* arg) {
|
||||
FaultDrawer_DrawText(0x40, 0x6E, D_80098BBC);
|
||||
Fault_WaitForInput();
|
||||
|
||||
} while (!faultCtxt->exitDebugger);
|
||||
} while (!sFaultContext->exitDebugger);
|
||||
|
||||
while(!faultCtxt->exitDebugger);
|
||||
while (!sFaultContext->exitDebugger) {
|
||||
;
|
||||
}
|
||||
|
||||
Fault_ResumeThread(faultedThread);
|
||||
}
|
||||
}
|
||||
|
||||
void Fault_SetFB(void* fb, u16 w, u16 h) {
|
||||
faultCtxt->fb = fb;
|
||||
sFaultContext->fb = fb;
|
||||
FaultDrawer_SetDrawerFB(fb, w, h);
|
||||
}
|
||||
|
||||
void Fault_Start(void){
|
||||
faultCtxt = &faultContextStruct;
|
||||
bzero(faultCtxt, sizeof(FaultThreadStruct));
|
||||
void Fault_Start(void) {
|
||||
sFaultContext = &gFaultStruct;
|
||||
bzero(sFaultContext, sizeof(FaultThreadStruct));
|
||||
FaultDrawer_Init();
|
||||
FaultDrawer_SetInputCallback(Fault_WaitForInput);
|
||||
faultCtxt->exitDebugger = 0;
|
||||
faultCtxt->msgId = 0;
|
||||
faultCtxt->faultHandlerEnabled = 0;
|
||||
faultCtxt->faultedThread = NULL;
|
||||
faultCtxt->padCallback = &Fault_PadCallback;
|
||||
faultCtxt->clients = NULL;
|
||||
faultCtxt->faultActive = 0;
|
||||
faultContextStruct.faultHandlerEnabled = 1;
|
||||
osCreateMesgQueue(&faultCtxt->queue, faultCtxt->msg, 1);
|
||||
StackCheck_Init(&faultStackEntry, faultStack, &faultStack[1536], 0, 0x100, faultThreadName);
|
||||
osCreateThread(&faultCtxt->thread, 2, (osCreateThread_func)Fault_ThreadEntry, 0, &faultStack[1536], 0x7f);
|
||||
osStartThread(&faultCtxt->thread);
|
||||
sFaultContext->exitDebugger = 0;
|
||||
sFaultContext->msgId = 0;
|
||||
sFaultContext->faultHandlerEnabled = 0;
|
||||
sFaultContext->faultedThread = NULL;
|
||||
sFaultContext->padCallback = &Fault_PadCallback;
|
||||
sFaultContext->clients = NULL;
|
||||
sFaultContext->faultActive = 0;
|
||||
gFaultStruct.faultHandlerEnabled = 1;
|
||||
osCreateMesgQueue(&sFaultContext->queue, sFaultContext->msg, 1);
|
||||
StackCheck_Init(&sFaultThreadInfo, sFaultStack, sFaultStack + sizeof(sFaultStack), 0, 0x100, faultThreadName);
|
||||
osCreateThread(&sFaultContext->thread, 2, Fault_ThreadEntry, NULL, sFaultStack + sizeof(sFaultStack), 0x7F);
|
||||
osStartThread(&sFaultContext->thread);
|
||||
}
|
||||
|
||||
void Fault_HangupFaultClient(char* arg0, char* arg1) {
|
||||
Fault_Log(D_80098BE0, osGetThreadId(0));
|
||||
void Fault_HangupFaultClient(const char* arg0, char* arg1) {
|
||||
Fault_Log(D_80098BE0, osGetThreadId(NULL));
|
||||
Fault_Log(D_80098BF8, arg0 ? arg0 : D_80098BFC);
|
||||
Fault_Log(D_80098C04, arg1 ? arg1 : D_80098C08);
|
||||
FaultDrawer_Printf(D_80098C10, osGetThreadId(0));
|
||||
FaultDrawer_Printf(D_80098C10, osGetThreadId(NULL));
|
||||
FaultDrawer_Printf(D_80098C28, arg0 ? arg0 : D_80098C2C);
|
||||
FaultDrawer_Printf(D_80098C34, arg1 ? arg1 : D_80098C38);
|
||||
}
|
||||
|
||||
void Fault_AddHungupAndCrashImpl(char* arg0, char* arg1) {
|
||||
void Fault_AddHungupAndCrashImpl(const char* arg0, char* arg1) {
|
||||
FaultClient client;
|
||||
char padd[4];
|
||||
Fault_AddClient(&client, (fault_client_func)Fault_HangupFaultClient, arg0, arg1);
|
||||
*(u32*)0x11111111 = 0; //trigger an exception
|
||||
*(u32*)0x11111111 = 0; // trigger an exception
|
||||
}
|
||||
|
||||
void Fault_AddHungupAndCrash(char* filename, u32 line) {
|
||||
void Fault_AddHungupAndCrash(const char* filename, u32 line) {
|
||||
char msg[256];
|
||||
sprintf(msg, D_80098C40, filename, line);
|
||||
Fault_AddHungupAndCrashImpl(msg, NULL);
|
||||
|
||||
@@ -3,21 +3,36 @@
|
||||
|
||||
FaultDrawer* sFaultDrawContext = &sFaultDrawerStruct;
|
||||
FaultDrawer sFaultDrawerDefault = {
|
||||
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
|
||||
320, 240, // w, h
|
||||
16, 223, // yStart, yEnd
|
||||
22, 297,// xStart, xEnd
|
||||
0xFFFF, 0x0000, // foreColor, backColor
|
||||
22, 16, // cursorX, cursorY
|
||||
(u32*)&faultDrawFont, // font
|
||||
8, 8, 0, 0, // charW, charH, charWPad, charHPad
|
||||
{ // printColors
|
||||
0x0001, 0xF801, 0x07C1, 0xFFC1,
|
||||
0x003F, 0xF83F, 0x07FF, 0xFFFF,
|
||||
0x7BDF, 0xB5AD
|
||||
(u16*)0x803DA800, // fb - TODO map out buffers in this region and avoid hard-coded pointer
|
||||
SCREEN_WIDTH, // w
|
||||
SCREEN_HEIGHT, // h
|
||||
16, // yStart
|
||||
223, // yEnd
|
||||
22, // xStart
|
||||
297, // xEnd
|
||||
GPACK_RGBA5551(255, 255, 255, 255), // foreColor
|
||||
GPACK_RGBA5551(0, 0, 0, 0), // backColor
|
||||
22, // cursorX
|
||||
16, // cursorY
|
||||
(u32*)&sFaultDrawerFont, // font
|
||||
8, // charW
|
||||
8, // charH
|
||||
0, // charWPad
|
||||
0, // charHPad
|
||||
{ // printColors
|
||||
GPACK_RGBA5551(0, 0, 0, 1),
|
||||
GPACK_RGBA5551(255, 0, 0, 1),
|
||||
GPACK_RGBA5551(0, 255, 0, 1),
|
||||
GPACK_RGBA5551(255, 255, 0, 1),
|
||||
GPACK_RGBA5551(0, 0, 255, 1),
|
||||
GPACK_RGBA5551(255, 0, 255, 1),
|
||||
GPACK_RGBA5551(0, 255, 255, 1),
|
||||
GPACK_RGBA5551(255, 255, 255, 1),
|
||||
GPACK_RGBA5551(120, 120, 120, 1),
|
||||
GPACK_RGBA5551(176, 176, 176, 1),
|
||||
},
|
||||
0, // escCode
|
||||
0, // osSyncPrintfEnabled
|
||||
0, // escCode
|
||||
0, // osSyncPrintfEnabled
|
||||
NULL, // inputCallback
|
||||
};
|
||||
|
||||
@@ -26,31 +41,40 @@ void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled) {
|
||||
}
|
||||
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
//This function needs a lot of work
|
||||
void FaultDrawer_DrawRecImpl(s32 xstart, s32 ystart, s32 xend, s32 yend, u16 color) {
|
||||
s32 x;
|
||||
s32 y;
|
||||
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color) {
|
||||
u16* fb;
|
||||
if (sFaultDrawContext->w - xstart > 0 && sFaultDrawContext->h - ystart > 0) {
|
||||
for (y = 0; y < yend - ystart + 1; y++) {
|
||||
fb = &sFaultDrawContext->fb[sFaultDrawContext->w * y];
|
||||
for (x = 0; x < xend - xstart + 1; x++) {
|
||||
s32 x, y;
|
||||
s32 xDiff = sFaultDrawContext->w - xStart;
|
||||
s32 yDiff = sFaultDrawContext->h - yStart;
|
||||
s32 xSize = xEnd - xStart + 1;
|
||||
s32 ySize = yEnd - yStart + 1;
|
||||
|
||||
if (xDiff > 0 && yDiff > 0) {
|
||||
if (xDiff < xSize) {
|
||||
xSize = xDiff;
|
||||
}
|
||||
|
||||
if (yDiff < ySize) {
|
||||
ySize = yDiff;
|
||||
}
|
||||
|
||||
fb = sFaultDrawContext->fb + sFaultDrawContext->w * yStart + xStart;
|
||||
for (y = 0; y < ySize; y++) {
|
||||
for (x = 0; x < xSize; x++) {
|
||||
*fb++ = color;
|
||||
}
|
||||
fb += sFaultDrawContext->w - xSize;
|
||||
}
|
||||
|
||||
osWritebackDCacheAll();
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_DrawRecImpl.asm")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_DrawChar.asm")
|
||||
|
||||
s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
if (color == sFaultDrawContext->printColors[i]) {
|
||||
return i;
|
||||
@@ -61,6 +85,7 @@ s32 FaultDrawer_ColorToPrintColor(u16 color) {
|
||||
|
||||
void FaultDrawer_UpdatePrintColor() {
|
||||
s32 idx;
|
||||
|
||||
if (sFaultDrawContext->osSyncPrintfEnabled) {
|
||||
Fault_Log(D_80099050);
|
||||
idx = FaultDrawer_ColorToPrintColor(sFaultDrawContext->foreColor);
|
||||
@@ -85,7 +110,7 @@ void FaultDrawer_SetBackColor(u16 color) {
|
||||
}
|
||||
|
||||
void FaultDrawer_SetFontColor(u16 color) {
|
||||
FaultDrawer_SetForeColor((u16)(color | 1)); //force alpha to be set
|
||||
FaultDrawer_SetForeColor(color | 1); //force alpha to be set
|
||||
}
|
||||
|
||||
void FaultDrawer_SetCharPad(s8 padW, s8 padH) {
|
||||
@@ -116,9 +141,20 @@ void FaultDrawer_VPrintf(char* str, char* args) { //va_list
|
||||
_Printf((printf_func)FaultDrawer_FormatStringFunc, sFaultDrawContext, str, args);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_Printf.asm")
|
||||
void FaultDrawer_Printf(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/fault_drawer/FaultDrawer_DrawText.asm")
|
||||
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) {
|
||||
sFaultDrawContext->fb = (u16*)fb;
|
||||
|
||||
@@ -8,11 +8,9 @@ void EnAObj_Init(ActorEnAObj* this, GlobalContext* ctxt) {
|
||||
s0->base.textId = ((s0->base.params >> 8) & 0xFF) | 0x300;
|
||||
s0->base.params = (s0->base.params & 0xFF) - 9;
|
||||
Actor_ProcessInitChain((Actor*)s0, &enAObjInitVar);
|
||||
|
||||
Actor_SetDrawParams(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
|
||||
ActorShape_Init(&s0->base.shape, 0, (ActorShadowFunc)func_800B3FC0, 12);
|
||||
Collider_InitAndSetCylinder(ctxt, &s0->collision, (Actor*)s0, &enAObjCylinderInit);
|
||||
Collider_UpdateCylinder((Actor*)s0, &s0->collision);
|
||||
|
||||
s0->base.colChkInfo.mass = 255;
|
||||
s0->update = (ActorFunc)EnAObj_Update1;
|
||||
}
|
||||
|
||||
@@ -10,14 +10,14 @@ EffInfo sEffInfoTable[] = {
|
||||
(eff_draw_func)EffectSpark_Draw,
|
||||
},
|
||||
{
|
||||
sizeof(EffBlureParams),
|
||||
sizeof(EffectBlure),
|
||||
(eff_init_func)EffectBlure_Init1,
|
||||
(eff_destroy_func)EffectBlure_Destroy,
|
||||
(eff_update_func)EffectBlure_Update,
|
||||
(eff_draw_func)EffectBlure_Draw,
|
||||
},
|
||||
{
|
||||
sizeof(EffBlureParams),
|
||||
sizeof(EffectBlure),
|
||||
(eff_init_func)EffectBlure_Init2,
|
||||
(eff_destroy_func)EffectBlure_Destroy,
|
||||
(eff_update_func)EffectBlure_Update,
|
||||
|
||||
@@ -38,8 +38,8 @@ void BgCheck2_UpdateActorPosition(CollisionContext* bgCtxt, s32 index, Actor* ac
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.pos.y,
|
||||
bgCtxt->dyna.actorMeshArr[index].currParams.pos.z);
|
||||
|
||||
Matrix_MultiplyByVectorXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
|
||||
Matrix_MultiplyByVectorXYZ(&currMatrix, &posWithInv, &newPos);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&prevMatrixInv, &actor->world.pos, &posWithInv);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&currMatrix, &posWithInv, &newPos);
|
||||
|
||||
actor->world.pos = newPos;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans_first_8th.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atans.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/Math_FAtan2F.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/code_0x8017FEB0/atan_flip.asm")
|
||||
@@ -0,0 +1,99 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void Matrix_Init(GameState* state) {
|
||||
sMatrixStack = (MtxF *)THA_AllocEndAlign16(&state->heap, 0x500);
|
||||
sCurrentMatrix = sMatrixStack;
|
||||
}
|
||||
|
||||
void Matrix_Push(void) {
|
||||
MtxF* prev = sCurrentMatrix;
|
||||
|
||||
sCurrentMatrix++;
|
||||
Matrix_MtxFCopy(sCurrentMatrix, prev);
|
||||
|
||||
}
|
||||
|
||||
void Matrix_Pop(void) {
|
||||
sCurrentMatrix--;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_CopyCurrentState.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Put.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetCurrentState.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertMatrix.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertTranslation.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_Scale.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_s.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertXRotation_f.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateStateAroundXAxis.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateXRotation.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_RotateY.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertYRotation_f.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_s.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertZRotation_f.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotation.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_RotateAndTranslateState.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_SetStateRotationAndTranslation.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_ToRSPMatrix.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateAsRSPMatrix.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_NewMtx.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_AppendToPolyOpaDisp.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByState.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslation.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledX.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledY.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_GetStateTranslationAndScaledZ.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fXZByCurrentState.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/Matrix_MtxFCopy.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_FromRSPMatrix.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_MultiplyVector3fByMatrix.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_TransposeXYZ.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_NormalizeXYZ.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_8018219C.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_801822C4.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_f.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/SysMatrix_InsertRotationAroundUnitVector_s.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182C90.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CA0.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CBC.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/sys_matrix/func_80182CCC.asm")
|
||||
+138
-25
@@ -5,26 +5,139 @@
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PrintLists.asm")
|
||||
void Actor_PrintLists(ActorContext *actorCtx) {
|
||||
ActorListEntry* actorList = &actorCtx->actorList[0];
|
||||
Actor* actor;
|
||||
s32 i;
|
||||
|
||||
void Actor_SetDrawParams(ActorShape* actorShape, f32 yOffset, ActorShadowFunc func, f32 scale) {
|
||||
FaultDrawer_SetCharPad(-2, 0);
|
||||
FaultDrawer_Printf(D_801DC9D0, gMaxActorId);
|
||||
FaultDrawer_Printf(D_801DC9D8);
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(actorCtx->actorList); i++) {
|
||||
actor = actorList[i].first;
|
||||
|
||||
while (actor != NULL) {
|
||||
FaultDrawer_Printf(D_801DC9F8, i, actor, actor->id, actor->category, D_801DCA10);
|
||||
actor = actor->next;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ActorShape_Init(ActorShape* actorShape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) {
|
||||
actorShape->yOffset = yOffset;
|
||||
actorShape->shadowDraw = func;
|
||||
actorShape->shadowScale = scale;
|
||||
actorShape->shadowDraw = shadowDraw;
|
||||
actorShape->shadowScale = shadowScale;
|
||||
actorShape->shadowAlpha = 255;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_PostDraw.asm")
|
||||
#ifdef NON_MATCHING
|
||||
void ActorShadow_Draw(Actor* actor, Lights* lights, GlobalContext* globalCtx, Gfx* dlist, Color_RGBA8* color) {
|
||||
if (actor->floorPoly != NULL) {
|
||||
f32 dy = actor->world.pos.y - actor->floorHeight;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B3FC0.asm")
|
||||
if (dy >= -50.0f && dy < 500.0f) {
|
||||
f32 shadowScale;
|
||||
MtxF mtx;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4024.asm")
|
||||
|
||||
POLY_OPA_DISP = Gfx_CallSetupDL(POLY_OPA_DISP, 0x2C);
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B4088.asm")
|
||||
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, COMBINED, 0, 0, 0,
|
||||
COMBINED);
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40B8.asm")
|
||||
dy = CLAMP(dy, 0.0f, 150.0f);
|
||||
shadowScale = 1.0f - (dy * D_801DCA14);
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B40E0.asm")
|
||||
if (color != NULL) {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color->red, color->green, color->blue,
|
||||
(u8)(actor->shape.shadowAlpha * shadowScale));
|
||||
} else {
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0, (u8)(actor->shape.shadowAlpha * shadowScale));
|
||||
}
|
||||
|
||||
func_800C0094(actor->floorPoly, actor->world.pos.x, actor->floorHeight, actor->world.pos.z, &mtx);
|
||||
Matrix_Put(&mtx);
|
||||
|
||||
if (dlist != D_04076BC0) {
|
||||
Matrix_RotateY((f32)actor->shape.rot.y * (M_PI / 32768), MTXMODE_APPLY);
|
||||
}
|
||||
|
||||
shadowScale = 1.0f - (dy * D_801DCA14);
|
||||
shadowScale *= actor->shape.shadowScale;
|
||||
Matrix_Scale(shadowScale * actor->scale.x, 1.0f, shadowScale * actor->scale.z, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, dlist);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//ActorShadow_Draw.asm")
|
||||
#endif
|
||||
|
||||
/* ActorShadow_DrawCircle */
|
||||
void func_800B3FC0(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
|
||||
if (actor->bgCheckFlags & 0x400) {
|
||||
func_800B4AEC(globalCtx, actor, 50.0f);
|
||||
}
|
||||
|
||||
ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, NULL);
|
||||
}
|
||||
|
||||
/* ActorShadow_DrawSquare */
|
||||
void func_800B4024(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
|
||||
if (actor->bgCheckFlags & 0x400) {
|
||||
func_800B4AEC(globalCtx, actor, 50.0f);
|
||||
}
|
||||
|
||||
ActorShadow_Draw(actor, lights, globalCtx, D_04075A40, NULL);
|
||||
}
|
||||
|
||||
/* ActorShadow_DrawWhiteCircle */
|
||||
void func_800B4088(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
|
||||
ActorShadow_Draw(actor, lights, globalCtx, D_04076BC0, &D_801AEC80);
|
||||
}
|
||||
|
||||
/* ActorShadow_DrawHorse */
|
||||
void func_800B40B8(Actor* actor, Lights* lights, GlobalContext* globalCtx) {
|
||||
ActorShadow_Draw(actor, lights, globalCtx, D_04077480, NULL);
|
||||
}
|
||||
|
||||
/* ActorShadow_DrawFoot */
|
||||
#ifdef NON_MATCHING
|
||||
void func_800B40E0(GlobalContext* globalCtx, Light* light, MtxF* arg2, s32 arg3, f32 arg4, f32 arg5, f32 arg6) {
|
||||
s32 pad1;
|
||||
s16 sp58;
|
||||
s32 pad2[2];
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
|
||||
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 0, 0, 0,
|
||||
(u32)(((arg3 * D_801DCA18) > 1.0f ? 1.0f : (arg3 * D_801DCA18)) * arg4) & 0xFF);
|
||||
|
||||
sp58 = Math_FAtan2F(light->l.dir[0], light->l.dir[2]);
|
||||
arg6 *= (4.5f - (light->l.dir[1] * D_801DCA1C));
|
||||
arg6 = (arg6 < 1.0f) ? 1.0f : arg6;
|
||||
Matrix_Put(arg2);
|
||||
Matrix_RotateY(sp58, MTXMODE_APPLY);
|
||||
Matrix_Scale(arg5, 1.0f, arg5 * arg6, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_04075B30);
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_actor/func_800B40E0.asm")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//func_800B42F8.asm")
|
||||
|
||||
@@ -214,10 +327,10 @@ void Actor_SetScale(Actor* actor, f32 scale) {
|
||||
|
||||
void Actor_SetObjectSegment(GlobalContext* ctxt, Actor* actor) {
|
||||
// TODO: Segment number enum
|
||||
gRspSegmentPhysAddrs[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].vramAddr);
|
||||
gSegments[6] = PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[actor->objBankIndex].segment);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
#if 0
|
||||
void Actor_InitToDefaultValues(Actor* actor, GlobalContext* ctxt) {
|
||||
Actor_InitCurrPosition(actor);
|
||||
Actor_InitDrawRotation(actor);
|
||||
@@ -271,11 +384,11 @@ void Actor_ApplyMovement(Actor* actor) {
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_actor//Actor_ApplyMovement.asm")
|
||||
#endif
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
#if 0
|
||||
void Actor_SetVelocityYRotationAndGravity(Actor* actor) {
|
||||
actor->velocity.x = actor->speedXZ * Math_Sins(actor->world.rot.x);
|
||||
actor->velocity.x = actor->speedXZ * Math_SinS(actor->world.rot.x);
|
||||
actor->velocity.y = actor->velocity.y + actor->gravity;
|
||||
actor->velocity.z = actor->speedXZ * Math_Coss(actor->world.rot.x);
|
||||
actor->velocity.z = actor->speedXZ * Math_CosS(actor->world.rot.x);
|
||||
|
||||
if (actor->velocity.y < actor->minYVelocity) {
|
||||
actor->velocity.y = actor->minYVelocity;
|
||||
@@ -291,10 +404,10 @@ void Actor_SetVelocityAndMoveYRotationAndGravity(Actor* actor) {
|
||||
}
|
||||
|
||||
void Actor_SetVelocityXYRotation(Actor* actor) {
|
||||
f32 velX = Math_Coss(actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
|
||||
actor->velocity.y = Math_Sins(actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
|
||||
f32 velX = Math_CosS(actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
|
||||
actor->velocity.y = Math_SinS(actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
|
||||
}
|
||||
|
||||
void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
|
||||
@@ -303,10 +416,10 @@ void Actor_SetVelocityAndMoveXYRotation(Actor* actor) {
|
||||
}
|
||||
|
||||
void Actor_SetVelocityXYRotationReverse(Actor* actor) {
|
||||
f32 velX = Math_Coss(-actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_Sins(actor->world.rot.y) * velX;
|
||||
actor->velocity.y = Math_Sins(-actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_Coss(actor->world.rot.y) * velX;
|
||||
f32 velX = Math_CosS(-actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.x = Math_SinS(actor->world.rot.y) * velX;
|
||||
actor->velocity.y = Math_SinS(-actor->world.rot.x) * actor->speedXZ;
|
||||
actor->velocity.z = Math_CosS(actor->world.rot.y) * velX;
|
||||
}
|
||||
|
||||
void Actor_SetVelocityAndMoveXYRotationReverse(Actor* actor) {
|
||||
@@ -364,8 +477,8 @@ void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f*
|
||||
f32 imm_x;
|
||||
f32 imm_z;
|
||||
|
||||
cos_rot_y = Math_Coss(actor->shape.rot.y);
|
||||
sin_rot_y = Math_Sins(actor->shape.rot.y);
|
||||
cos_rot_y = Math_CosS(actor->shape.rot.y);
|
||||
sin_rot_y = Math_SinS(actor->shape.rot.y);
|
||||
imm_x = point->x - actor->world.pos.x;
|
||||
imm_z = point->z - actor->world.pos.z;
|
||||
offset->x = ((imm_x * cos_rot_y) - (imm_z * sin_rot_y));
|
||||
|
||||
@@ -162,7 +162,7 @@ void BgCheck_CreateVertexFromVec3f(BgVertex* vertex, Vec3f* vector) {
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_bgcheck/func_800C40B4.asm")
|
||||
|
||||
f32 func_800C411C(CollisionContext* bgCtxt, BgPolygon* arg1, s32* arg2, Actor* actor, Vec3f* pos) {
|
||||
f32 func_800C411C(CollisionContext* bgCtxt, CollisionPoly* arg1, s32* arg2, Actor* actor, Vec3f* pos) {
|
||||
return func_800C3D50(0, bgCtxt, 2, arg1, arg2, pos, actor, 28, 1.0f, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1455,7 +1455,7 @@ void CollisionCheck_GreenBlood(GlobalContext* ctxt, Collider* collider, Vec3f* v
|
||||
* Used by collider type HIT4.
|
||||
*/
|
||||
void CollisionCheck_WaterBurst(GlobalContext* ctxt, Collider* collider, Vec3f* v) {
|
||||
func_800B249C(ctxt, v);
|
||||
EffectSsSibuki_SpawnBurst(ctxt, v);
|
||||
CollisionCheck_SpawnWaterDroplets(ctxt, v);
|
||||
}
|
||||
|
||||
@@ -1481,28 +1481,28 @@ void CollisionCheck_HitSolid(GlobalContext* ctxt, ColliderInfo* info, Collider*
|
||||
s32 flags = info->toucherFlags & TOUCH_SFX_NONE;
|
||||
|
||||
if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) {
|
||||
func_800B2684(ctxt, 0, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
|
||||
if (collider->actor == NULL) {
|
||||
play_sound(0x1806);
|
||||
} else {
|
||||
func_8019F1C0(&collider->actor->projectedPos, 0x1806);
|
||||
}
|
||||
} else if (flags == TOUCH_SFX_NORMAL) {
|
||||
func_800B2684(ctxt, 3, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, 3, hitPos);
|
||||
if (collider->actor == NULL) {
|
||||
CollisionCheck_SpawnShieldParticlesMetal(ctxt, hitPos);
|
||||
} else {
|
||||
CollisionCheck_SpawnShieldParticlesMetalSound(ctxt, hitPos, &collider->actor->projectedPos);
|
||||
}
|
||||
} else if (flags == TOUCH_SFX_HARD) {
|
||||
func_800B2684(ctxt, 0, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
|
||||
if (collider->actor == NULL) {
|
||||
play_sound(0x1806);
|
||||
} else {
|
||||
func_8019F1C0(&collider->actor->projectedPos, 0x1806);
|
||||
}
|
||||
} else if (flags == TOUCH_SFX_WOOD) {
|
||||
func_800B2684(ctxt, 1, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, 1, hitPos);
|
||||
if (collider->actor == NULL) {
|
||||
play_sound(0x1837);
|
||||
} else {
|
||||
@@ -1568,13 +1568,13 @@ void CollisionCheck_HitEffects(GlobalContext* ctxt, Collider* at, ColliderInfo*
|
||||
CollisionCheck_SpawnShieldParticlesWood(ctxt, hitPos, &at->actor->projectedPos);
|
||||
}
|
||||
} else if (sHitInfo[ac->colType].effect != HIT_NONE) {
|
||||
func_800B2684(ctxt, sHitInfo[ac->colType].effect, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, sHitInfo[ac->colType].effect, hitPos);
|
||||
if (!(acInfo->bumperFlags & BUMP_NO_SWORD_SFX)) {
|
||||
CollisionCheck_SwordHitAudio(at, acInfo);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
func_800B2684(ctxt, 0, hitPos);
|
||||
EffectSsHitMark_SpawnFixedScale(ctxt, 0, hitPos);
|
||||
if (ac->actor == NULL) {
|
||||
play_sound(0x1806);
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
#ifdef NON_MATCHING
|
||||
void func_800A81F0(EffectBlure* this, Vec3f* p1, Vec3f* p2) {
|
||||
EffectBlureElement* elem;
|
||||
s32 numElements;
|
||||
Vec3f sp16C;
|
||||
Vec3f sp160;
|
||||
Vec3f sp154;
|
||||
f32 scale;
|
||||
MtxF sp110;
|
||||
MtxF spD0;
|
||||
MtxF sp90;
|
||||
MtxF sp50;
|
||||
Vec3f sp44;
|
||||
Vec3f sp38;
|
||||
|
||||
if (this != NULL) {
|
||||
numElements = this->numElements;
|
||||
if (numElements >= 16) {
|
||||
return;
|
||||
}
|
||||
|
||||
elem = &this->elements[numElements];
|
||||
elem->state = 1;
|
||||
|
||||
if (!(this->flags & 2)) {
|
||||
elem->p1.x = p1->x;
|
||||
elem->p1.y = p1->y;
|
||||
elem->p1.z = p1->z;
|
||||
elem->p2.x = p2->x;
|
||||
elem->p2.y = p2->y;
|
||||
elem->p2.z = p2->z;
|
||||
} else {
|
||||
sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) * 0.5f;
|
||||
sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) * 0.5f;
|
||||
sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) * 0.5f;
|
||||
sp160.x = (p1->x + p2->x) * 0.5f;
|
||||
sp160.y = (p1->y + p2->y) * 0.5f;
|
||||
sp160.z = (p1->z + p2->z) * 0.5f;
|
||||
|
||||
Math_Vec3f_Diff(&sp160, &sp16C, &sp154);
|
||||
scale = Math3D_Vec3fMagnitude(&sp154);
|
||||
if (!(fabsf(scale) < D_801DC080)) {
|
||||
scale = 1.0f / scale;
|
||||
Math_Vec3f_Scale(&sp154, scale);
|
||||
|
||||
SkinMatrix_SetTranslate(&sp110, sp160.x, sp160.y, sp160.z);
|
||||
Matrix_MakeRotationAroundUnitVector(&spD0, this->addAngle, sp154.x, sp154.y, sp154.z);
|
||||
SkinMatrix_MtxFMtxFMult(&sp110, &spD0, &sp90);
|
||||
SkinMatrix_SetTranslate(&sp110, -sp160.x, -sp160.y, -sp160.z);
|
||||
SkinMatrix_MtxFMtxFMult(&sp90, &sp110, &sp50);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p1, &sp38);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&sp50, p2, &sp44);
|
||||
|
||||
elem->p1.x = sp38.x;
|
||||
elem->p1.y = sp38.y;
|
||||
elem->p1.z = sp38.z;
|
||||
elem->p2.x = sp44.x;
|
||||
elem->p2.y = sp44.y;
|
||||
elem->p2.z = sp44.z;
|
||||
}
|
||||
}
|
||||
|
||||
elem->timer = 1;
|
||||
this->numElements++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A81F0.asm")
|
||||
#endif
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8514.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Initcommon.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init1.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Init2.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Destroy.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Update.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8C78.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A8DE8.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A92FC.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9330.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800A9804.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA190.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA460.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA498.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AA700.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/func_800AABE0.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_eff_blure/EffectBlure_Draw.asm")
|
||||
@@ -52,7 +52,7 @@ void EffFootmark_Add(GlobalContext* ctxt, z_Matrix* displayMatrix, Actor* actor,
|
||||
if (destination == NULL) {
|
||||
destination = oldest;
|
||||
}
|
||||
SysMatrix_Copy(&destination->displayMatrix,displayMatrix);
|
||||
Matrix_MtxFCopy(&destination->displayMatrix,displayMatrix);
|
||||
destination->actor = actor;
|
||||
destination->location.x = location->x;
|
||||
destination->location.y = location->y;
|
||||
@@ -106,10 +106,10 @@ void EffFootmark_Draw(GlobalContext* ctxt) {
|
||||
|
||||
for (footmark = ctxt->footmarks, i = 0; i < 100; i++, footmark++) {
|
||||
if (footmark->actor != NULL) {
|
||||
SysMatrix_SetCurrentState(&footmark->displayMatrix);
|
||||
SysMatrix_InsertScale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
|
||||
Matrix_Put(&footmark->displayMatrix);
|
||||
Matrix_Scale(footmark->size * 0.00390625f * 0.7f, 1, footmark->size * 0.00390625f, 1);
|
||||
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, SysMatrix_AppendStateToPolyOpaDisp(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(ctxt->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD);
|
||||
|
||||
gDPSetPrimColor(gfxCtx->polyXlu.p++, 0, 0, footmark->red, footmark->green, footmark->blue, footmark->alpha >> 8);
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
|
||||
u32 i;
|
||||
LoadedParticleEntry* iter;
|
||||
EffectSs* iter;
|
||||
ParticleOverlay* iter2;
|
||||
|
||||
EffectSS2Info.data_table = (LoadedParticleEntry*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(LoadedParticleEntry));
|
||||
EffectSS2Info.data_table = (EffectSs*)THA_AllocEndAlign16(&ctxt->state.heap, numEntries * sizeof(EffectSs));
|
||||
EffectSS2Info.searchIndex = 0;
|
||||
EffectSS2Info.size = numEntries;
|
||||
|
||||
@@ -21,7 +21,7 @@ void EffectSS_Init(GlobalContext* ctxt, s32 numEntries) {
|
||||
|
||||
void EffectSS_Clear(GlobalContext* ctxt) {
|
||||
u32 i;
|
||||
LoadedParticleEntry* iter;
|
||||
EffectSs* iter;
|
||||
ParticleOverlay* iter2;
|
||||
void* addr;
|
||||
|
||||
@@ -44,47 +44,47 @@ void EffectSS_Clear(GlobalContext* ctxt) {
|
||||
}
|
||||
}
|
||||
|
||||
LoadedParticleEntry* EffectSS_GetTable() {
|
||||
EffectSs* EffectSS_GetTable() {
|
||||
return EffectSS2Info.data_table;
|
||||
}
|
||||
|
||||
void EffectSS_Delete(LoadedParticleEntry* a0) {
|
||||
void EffectSS_Delete(EffectSs* a0) {
|
||||
if (a0->flags & 0x2) {
|
||||
func_801A72CC((UNK_PTR)&a0->position);
|
||||
func_801A72CC((UNK_PTR)&a0->pos);
|
||||
}
|
||||
|
||||
if (a0->flags & 0x4) {
|
||||
func_801A72CC((UNK_PTR)&a0->unk2C);
|
||||
func_801A72CC((UNK_PTR)&a0->vec);
|
||||
}
|
||||
|
||||
EffectSS_ResetEntry(a0);
|
||||
}
|
||||
|
||||
void EffectSS_ResetEntry(LoadedParticleEntry* particle) {
|
||||
void EffectSS_ResetEntry(EffectSs* particle) {
|
||||
u32 i;
|
||||
|
||||
particle->type = EFFECT_SS2_TYPE_LAST_LABEL;
|
||||
particle->acceleration.z = 0;
|
||||
particle->acceleration.y = 0;
|
||||
particle->acceleration.x = 0;
|
||||
particle->accel.z = 0;
|
||||
particle->accel.y = 0;
|
||||
particle->accel.x = 0;
|
||||
particle->velocity.z = 0;
|
||||
particle->velocity.y = 0;
|
||||
particle->velocity.x = 0;
|
||||
particle->unk2C.z = 0;
|
||||
particle->unk2C.y = 0;
|
||||
particle->unk2C.x = 0;
|
||||
particle->position.z = 0;
|
||||
particle->position.y = 0;
|
||||
particle->position.x = 0;
|
||||
particle->vec.z = 0;
|
||||
particle->vec.y = 0;
|
||||
particle->vec.x = 0;
|
||||
particle->pos.z = 0;
|
||||
particle->pos.y = 0;
|
||||
particle->pos.x = 0;
|
||||
particle->life = -1;
|
||||
particle->flags = 0;
|
||||
particle->priority = 128;
|
||||
particle->draw = NULL;
|
||||
particle->update = NULL;
|
||||
particle->displayList = 0;
|
||||
particle->unk3C = 0;
|
||||
particle->gfx = NULL;
|
||||
particle->actor = NULL;
|
||||
|
||||
for (i = 0; i != 13; i++) {
|
||||
for (i = 0; i != ARRAY_COUNT(particle->regs); i++) {
|
||||
particle->regs[i] = 0;
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ s32 EffectSS_FindFreeSpace(u32 priority, u32* tableEntry) {
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_FindFreeSpace.asm")
|
||||
#endif
|
||||
|
||||
void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) {
|
||||
void EffectSS_Copy(GlobalContext* ctxt, EffectSs* a1) {
|
||||
u32 index;
|
||||
if (func_8016A01C(ctxt) != 1) {
|
||||
if (EffectSS_FindFreeSpace(a1->priority, &index) == 0) {
|
||||
@@ -159,7 +159,7 @@ void EffectSS_Copy(GlobalContext* ctxt, LoadedParticleEntry* a1) {
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* initData) {
|
||||
void EffectSs_Spawn(GlobalContext* ctxt, s32 type, s32 priority, void* initData) {
|
||||
u32 index;
|
||||
u32 initRet;
|
||||
u32 overlaySize;
|
||||
@@ -208,20 +208,20 @@ void EffectSS_LoadParticle(GlobalContext* ctxt, u32 type, u32 priority, void* in
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSS_LoadParticle.asm")
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_effect_soft_sprite/EffectSs_Spawn.asm")
|
||||
#endif
|
||||
|
||||
void EffectSS_UpdateParticle(GlobalContext* ctxt, s32 index) {
|
||||
LoadedParticleEntry* particle = &EffectSS2Info.data_table[index];
|
||||
EffectSs* 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->velocity.x += particle->accel.x;
|
||||
particle->velocity.y += particle->accel.y;
|
||||
particle->velocity.z += particle->accel.z;
|
||||
|
||||
particle->position.x += particle->velocity.x;
|
||||
particle->position.y += particle->velocity.y;
|
||||
particle->position.z += particle->velocity.z;
|
||||
particle->pos.x += particle->velocity.x;
|
||||
particle->pos.y += particle->velocity.y;
|
||||
particle->pos.z += particle->velocity.z;
|
||||
|
||||
(*particle->update)(ctxt, index, particle);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void EffectSS_UpdateAllParticles(GlobalContext* ctxt) {
|
||||
}
|
||||
|
||||
void EffectSS_DrawParticle(GlobalContext* ctxt, s32 index) {
|
||||
LoadedParticleEntry* entry = &EffectSS2Info.data_table[index];
|
||||
EffectSs* entry = &EffectSS2Info.data_table[index];
|
||||
if (entry->draw != 0) {
|
||||
(*entry->draw)(ctxt, index, entry);
|
||||
}
|
||||
@@ -262,12 +262,12 @@ void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
|
||||
|
||||
for (i = 0; i < EffectSS2Info.size; i++) {
|
||||
if (EffectSS2Info.data_table[i].life > -1) {
|
||||
if (EffectSS2Info.data_table[i].position.x > 32000 ||
|
||||
EffectSS2Info.data_table[i].position.x < -32000 ||
|
||||
EffectSS2Info.data_table[i].position.y > 32000 ||
|
||||
EffectSS2Info.data_table[i].position.y < -32000 ||
|
||||
EffectSS2Info.data_table[i].position.z > 32000 ||
|
||||
EffectSS2Info.data_table[i].position.z < -32000
|
||||
if (EffectSS2Info.data_table[i].pos.x > 32000 ||
|
||||
EffectSS2Info.data_table[i].pos.x < -32000 ||
|
||||
EffectSS2Info.data_table[i].pos.y > 32000 ||
|
||||
EffectSS2Info.data_table[i].pos.y < -32000 ||
|
||||
EffectSS2Info.data_table[i].pos.z > 32000 ||
|
||||
EffectSS2Info.data_table[i].pos.z < -32000
|
||||
) {
|
||||
EffectSS_Delete(&EffectSS2Info.data_table[i]);
|
||||
} else {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -28,11 +28,11 @@ void* Lib_MemSet(u8* a0, u32 a1, u32 a2) {
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/Lib_MemSet.asm")
|
||||
#endif
|
||||
|
||||
f32 Math_Coss(s16 angle) {
|
||||
f32 Math_CosS(s16 angle) {
|
||||
return coss(angle) * D_801DDA80;
|
||||
}
|
||||
|
||||
f32 Math_Sins(s16 angle) {
|
||||
f32 Math_SinS(s16 angle) {
|
||||
return sins(angle) * D_801DDA84;
|
||||
}
|
||||
|
||||
@@ -212,12 +212,12 @@ void func_800FF3A0(void) {
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lib/func_800FF3A0.asm")
|
||||
#endif
|
||||
|
||||
s16 Math_Rand_S16Offset(s16 base, s16 range) {
|
||||
return (s16)(randZeroOne() * range) + base;
|
||||
s16 Rand_S16Offset(s16 base, s16 range) {
|
||||
return (s16)(Rand_ZeroOne() * range) + base;
|
||||
}
|
||||
|
||||
s16 Math_Rand_S16OffsetStride(s16 base, s16 stride, s16 range) {
|
||||
return (s16)(randZeroOne() * range) * stride + base;
|
||||
return (s16)(Rand_ZeroOne() * range) * stride + base;
|
||||
}
|
||||
|
||||
void Math_Vec3f_Copy(Vec3f* dest, Vec3f* src) {
|
||||
@@ -373,11 +373,11 @@ f32 Math_Vec3f_DiffY(Vec3f* a, Vec3f* b) {
|
||||
s16 Math_Vec3f_Yaw(Vec3f* from, Vec3f* to) {
|
||||
f32 f14 = to->x - from->x;
|
||||
f32 f12 = to->z - from->z;
|
||||
return atans_flip(f12, f14);
|
||||
return Math_FAtan2F(f12, f14);
|
||||
}
|
||||
|
||||
s16 Math_Vec3f_Pitch(Vec3f* from, Vec3f* to) {
|
||||
return atans_flip(Math_Vec3f_DistXZ(from, to), from->y - to->y);
|
||||
return Math_FAtan2F(Math_Vec3f_DistXZ(from, to), from->y - to->y);
|
||||
}
|
||||
|
||||
void Actor_ProcessInitChain(Actor* actor, InitChainEntry* init) {
|
||||
@@ -561,8 +561,8 @@ void Lib_TranslateAndRotateYVec3f(Vec3f* translation, s16 rotation, Vec3f* src,
|
||||
f32 sp1C;
|
||||
f32 f0;
|
||||
|
||||
sp1C = Math_Coss(rotation);
|
||||
f0 = Math_Sins(rotation);
|
||||
sp1C = Math_CosS(rotation);
|
||||
f0 = Math_SinS(rotation);
|
||||
dst->x = translation->x + (src->x * sp1C + src->z * f0);
|
||||
dst->y = translation->y + src->y;
|
||||
dst->z = translation->z + (src->z * sp1C - src->x * f0);
|
||||
@@ -585,7 +585,7 @@ f32 Lib_PushAwayVec3f(Vec3f* start, Vec3f* pusher, f32 distanceToApproach) {
|
||||
f32 f0;
|
||||
|
||||
Math_Vec3f_Diff(pusher, start, &sp24);
|
||||
f0 = Math3D_Length(&sp24);
|
||||
f0 = Math3D_Vec3fMagnitude(&sp24);
|
||||
if (distanceToApproach < f0) {
|
||||
f2 = distanceToApproach / f0;
|
||||
f0 = f0 - distanceToApproach;
|
||||
|
||||
+7
-3
@@ -132,7 +132,7 @@ void Lights_BindPoint(Lights* lights, LightParams* params, GlobalContext* global
|
||||
posF.x = params->point.x;
|
||||
posF.y = params->point.y;
|
||||
posF.z = params->point.z;
|
||||
Matrix_MultiplyByVectorXYZ(&globalCtx->unk187B0,&posF,&adjustedPos);
|
||||
SkinMatrix_Vec3fMtxFMultXYZ(&globalCtx->unk187B0,&posF,&adjustedPos);
|
||||
if ((adjustedPos.z > -radiusF) &&
|
||||
(600 + radiusF > adjustedPos.z) &&
|
||||
(400 > fabsf(adjustedPos.x) - radiusF) &&
|
||||
@@ -398,6 +398,7 @@ void Lights_GlowCheck(GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
void Lights_DrawGlow(GlobalContext* globalCtx) {
|
||||
Gfx* dl;
|
||||
LightPoint* params;
|
||||
@@ -424,9 +425,9 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
|
||||
gDPSetPrimColor(dl++, 0, 0, params->color[0], params->color[1], params->color[2], 50);
|
||||
|
||||
SysMatrix_InsertTranslation(params->x, params->y, params->z, 0);
|
||||
SysMatrix_InsertScale(scale,scale,scale,1);
|
||||
Matrix_Scale(scale,scale,scale, MTXMODE_APPLY);
|
||||
|
||||
gSPMatrix(dl++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(dl++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
gSPDisplayList(dl++, &D_04029CF0);
|
||||
}
|
||||
@@ -440,3 +441,6 @@ void Lights_DrawGlow(GlobalContext* globalCtx) {
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/code/z_lights/Lights_DrawGlow.asm")
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -1229,9 +1229,9 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
|
||||
s32 i;
|
||||
Gfx* gfx;
|
||||
|
||||
gRspSegmentPhysAddrs[0] = 0;
|
||||
gRspSegmentPhysAddrs[14] = (u32)graphDlEntry;
|
||||
gRspSegmentPhysAddrs[15] = (u32)gCtxt->framebuffer;
|
||||
gSegments[0] = 0;
|
||||
gSegments[14] = (u32)graphDlEntry;
|
||||
gSegments[15] = (u32)gCtxt->framebuffer;
|
||||
|
||||
gfx = graphDlEntry + 0x16;
|
||||
gSPDisplayList(gfx + 0, &D_0E000140);
|
||||
@@ -1285,7 +1285,7 @@ void func_8012CF0C(GraphicsContext* gCtxt, s32 iParm2, s32 iParm3, u8 r, u8 g, u
|
||||
if (i == 0xE) {
|
||||
gSPNoOp(gfx + i);
|
||||
} else {
|
||||
gSPSegment(gfx + i, i, gRspSegmentPhysAddrs[i]);
|
||||
gSPSegment(gfx + i, i, gSegments[i]);
|
||||
}
|
||||
}
|
||||
gSPEndDisplayList(gfx + i);
|
||||
|
||||
+2
-2
@@ -110,7 +110,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
|
||||
roomCtxt->unk31 = 0;
|
||||
roomCtxt->currRoom.segment = roomCtxt->activeRoomVram;
|
||||
// TODO: Segment number enum
|
||||
gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram);
|
||||
gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtxt->activeRoomVram);
|
||||
|
||||
Scene_ProcessHeader(ctxt, (SceneCmd*)roomCtxt->currRoom.segment);
|
||||
func_80123140(ctxt, (ActorPlayer*)ctxt->actorCtx.actorList[2].first);
|
||||
@@ -135,7 +135,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* ctxt, RoomContext* roomCtxt) {
|
||||
void Room_Draw(GlobalContext* ctxt, Room* room, u32 flags) {
|
||||
if (room->segment != NULL) {
|
||||
// TODO: Segment number enum
|
||||
gRspSegmentPhysAddrs[3] = PHYSICAL_TO_VIRTUAL(room->segment);
|
||||
gSegments[3] = PHYSICAL_TO_VIRTUAL(room->segment);
|
||||
roomDrawFuncs[room->mesh->type0.type](ctxt, room, flags);
|
||||
}
|
||||
return;
|
||||
|
||||
+22
-22
@@ -19,14 +19,14 @@ s32 Scene_LoadObject(SceneContext* sceneCtxt, s16 id) {
|
||||
if (sceneCtxt) {}
|
||||
|
||||
if (size) {
|
||||
DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].vramAddr, objectFileTable[id].vromStart, size);
|
||||
DmaMgr_SendRequest0(sceneCtxt->objects[sceneCtxt->objectCount].segment, objectFileTable[id].vromStart, size);
|
||||
}
|
||||
|
||||
// TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT
|
||||
if (sceneCtxt->objectCount < 0x22) {
|
||||
sceneCtxt->objects[sceneCtxt->objectCount + 1].vramAddr =
|
||||
sceneCtxt->objects[sceneCtxt->objectCount + 1].segment =
|
||||
// UB to cast pointer to u32
|
||||
(void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].vramAddr + size);
|
||||
(void*)ALIGN16((u32)sceneCtxt->objects[sceneCtxt->objectCount].segment + size);
|
||||
}
|
||||
|
||||
sceneCtxt->objectCount++;
|
||||
@@ -59,18 +59,18 @@ void Scene_Init(GlobalContext* ctxt, SceneContext* sceneCtxt) {
|
||||
// TODO: 0x23 is OBJECT_EXCHANGE_BANK_MAX in OOT
|
||||
for (i = 0; i < 0x23; i++) sceneCtxt->objects[i].id = 0;
|
||||
|
||||
sceneCtxt->objectVramStart = sceneCtxt->objects[0].vramAddr = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize);
|
||||
sceneCtxt->objectVramStart = sceneCtxt->objects[0].segment = THA_AllocEndAlign16(&ctxt->state.heap, spaceSize);
|
||||
// UB to cast sceneCtxt->objectVramStart to s32
|
||||
sceneCtxt->objectVramEnd = (void*)((u32)sceneCtxt->objectVramStart + spaceSize);
|
||||
// TODO: Second argument here is an object enum
|
||||
sceneCtxt->mainKeepIndex = Scene_LoadObject(sceneCtxt, 1);
|
||||
// TODO: Segment number enum?
|
||||
gRspSegmentPhysAddrs[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].vramAddr);
|
||||
gSegments[4] = PHYSICAL_TO_VIRTUAL(sceneCtxt->objects[sceneCtxt->mainKeepIndex].segment);
|
||||
}
|
||||
|
||||
void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) {
|
||||
s32 i;
|
||||
SceneObject* status;
|
||||
ObjectStatus* status;
|
||||
ObjectFileTableEntry* objectFile;
|
||||
u32 size;
|
||||
|
||||
@@ -86,7 +86,7 @@ void Scene_ReloadUnloadedObjects(SceneContext* sceneCtxt) {
|
||||
status->id = 0;
|
||||
} else {
|
||||
osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1);
|
||||
DmaMgr_SendRequestImpl(&status->dmaReq, status->vramAddr, objectFile->vromStart,
|
||||
DmaMgr_SendRequestImpl(&status->dmaReq, status->segment, objectFile->vromStart,
|
||||
size, 0, &status->loadQueue, NULL);
|
||||
}
|
||||
} else if (!osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK)) {
|
||||
@@ -128,7 +128,7 @@ void Scene_DmaAllObjects(SceneContext* sceneCtxt) {
|
||||
continue;
|
||||
}
|
||||
|
||||
DmaMgr_SendRequest0(sceneCtxt->objects[i].vramAddr, objectFileTable[id].vromStart, vromSize);
|
||||
DmaMgr_SendRequest0(sceneCtxt->objects[i].segment, objectFileTable[id].vromStart, vromSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ void* func_8012F73C(SceneContext* sceneCtxt, s32 iParm2, s16 id) {
|
||||
fileTableEntry = &objectFileTable[id];
|
||||
vromSize = fileTableEntry->vromEnd - fileTableEntry->vromStart;
|
||||
// TODO: UB to cast void to u32
|
||||
addr = ((u32)sceneCtxt->objects[iParm2].vramAddr) + vromSize;
|
||||
addr = ((u32)sceneCtxt->objects[iParm2].segment) + vromSize;
|
||||
addr = ALIGN16(addr);
|
||||
// UB to cast u32 to pointer
|
||||
return (void*)addr;
|
||||
@@ -167,7 +167,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
}
|
||||
|
||||
loadedCount = Scene_LoadObject(&ctxt->sceneContext, OBJECT_LINK_CHILD);
|
||||
objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].vramAddr;
|
||||
objectVramAddr = global->sceneContext.objects[global->sceneContext.objectCount].segment;
|
||||
ctxt->sceneContext.objectCount = loadedCount;
|
||||
ctxt->sceneContext.spawnedObjectCount = loadedCount;
|
||||
unk20 = gSaveContext.perm.unk20;
|
||||
@@ -175,7 +175,7 @@ void Scene_HeaderCommand00(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
gActorOverlayTable[0].initInfo->objectId = temp16;
|
||||
Scene_LoadObject(&ctxt->sceneContext, temp16);
|
||||
|
||||
ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].vramAddr = objectVramAddr;
|
||||
ctxt->sceneContext.objects[ctxt->sceneContext.objectCount].segment = objectVramAddr;
|
||||
}
|
||||
|
||||
// Scene Command 0x01: Actor List
|
||||
@@ -198,7 +198,7 @@ void Scene_HeaderCommand03(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
temp_ret = (BgMeshHeader*)Lib_PtrSegToVirt(entry->colHeader.segment);
|
||||
temp_s0 = temp_ret;
|
||||
temp_s0->vertices = (BgVertex*)Lib_PtrSegToVirt(temp_ret->vertices);
|
||||
temp_s0->polygons = (BgPolygon*)Lib_PtrSegToVirt(temp_s0->polygons);
|
||||
temp_s0->polygons = (CollisionPoly*)Lib_PtrSegToVirt(temp_s0->polygons);
|
||||
if (temp_s0->attributes != 0) {
|
||||
temp_s0->attributes = (BgPolygonAttributes*)Lib_PtrSegToVirt(temp_s0->attributes);
|
||||
}
|
||||
@@ -229,8 +229,8 @@ void Scene_HeaderCommand07(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
ctxt->sceneContext.keepObjectId = Scene_LoadObject(&ctxt->sceneContext,
|
||||
entry->specialFiles.keepObjectId);
|
||||
// TODO: Segment number enum?
|
||||
gRspSegmentPhysAddrs[5] =
|
||||
PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].vramAddr);
|
||||
gSegments[5] =
|
||||
PHYSICAL_TO_VIRTUAL(ctxt->sceneContext.objects[ctxt->sceneContext.keepObjectId].segment);
|
||||
}
|
||||
|
||||
if (entry->specialFiles.cUpElfMsgNum != 0) {
|
||||
@@ -256,9 +256,9 @@ void Scene_HeaderCommand0A(GlobalContext* ctxt, SceneCmd* entry) {
|
||||
// Scene Command 0x0B: Object List
|
||||
void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
|
||||
s32 i, j, k;
|
||||
SceneObject* firstObject;
|
||||
SceneObject* status;
|
||||
SceneObject* status2;
|
||||
ObjectStatus* firstObject;
|
||||
ObjectStatus* status;
|
||||
ObjectStatus* status2;
|
||||
s16* objectEntry;
|
||||
void* nextPtr;
|
||||
|
||||
@@ -292,7 +292,7 @@ void Scene_HeaderCommand0B(GlobalContext *ctxt, SceneCmd *entry) {
|
||||
|
||||
// TODO: This 0x22 is OBJECT_EXCHANGE_BANK_MAX - 1 in OOT
|
||||
if (i < 0x22) {
|
||||
firstObject[i + 1].vramAddr = nextPtr;
|
||||
firstObject[i + 1].segment = nextPtr;
|
||||
}
|
||||
i++;
|
||||
k++;
|
||||
@@ -386,15 +386,15 @@ void Scene_HeaderCommand10(GlobalContext *ctxt, SceneCmd *entry) {
|
||||
|
||||
if (gSaveContext.extra.unk2b8 == 0) {
|
||||
// TODO: Needs REG macro
|
||||
gStaticContext->data[0x0F] = ctxt->kankyoContext.unk2;
|
||||
gGameInfo->data[0x0F] = ctxt->kankyoContext.unk2;
|
||||
}
|
||||
|
||||
dayTime = gSaveContext.perm.time;
|
||||
ctxt->kankyoContext.unk4 = -(Math_Sins(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
ctxt->kankyoContext.unk4 = -(Math_SinS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.perm.time;
|
||||
ctxt->kankyoContext.unk8 = (Math_Coss(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
ctxt->kankyoContext.unk8 = (Math_CosS(dayTime - 0x8000) * 120.0f) * 25.0f;
|
||||
dayTime = gSaveContext.perm.time;
|
||||
ctxt->kankyoContext.unkC = (Math_Coss(dayTime - 0x8000) * 20.0f) * 25.0f;
|
||||
ctxt->kankyoContext.unkC = (Math_CosS(dayTime - 0x8000) * 20.0f) * 25.0f;
|
||||
|
||||
if (ctxt->kankyoContext.unk2 == 0 && gSaveContext.perm.cutscene < 0xFFF0) {
|
||||
gSaveContext.extra.environmentTime = gSaveContext.perm.time;
|
||||
|
||||
+44
-44
@@ -38,7 +38,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
rot = limbDrawTable[limbIndex];
|
||||
@@ -53,7 +53,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
|
||||
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(polyTemp + 1, dList);
|
||||
gfxCtx->polyOpa.p = polyTemp + 2;
|
||||
@@ -69,7 +69,7 @@ void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
postLimbDraw, actor, dListIndex);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
SkelAnime_LodDrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
|
||||
@@ -96,7 +96,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
pos.x = limbDrawTable[0].x;
|
||||
@@ -111,7 +111,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
|
||||
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(polyTemp + 1, dList);
|
||||
|
||||
@@ -128,7 +128,7 @@ void SkelAnime_LodDraw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
postLimbDraw, actor, dListIndex);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -145,7 +145,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -181,7 +181,7 @@ void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton*
|
||||
postLimbDraw, actor, dListIndex, mtx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
SkelAnime_LodDrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
|
||||
@@ -215,7 +215,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
pos.x = limbDrawTable[0].x;
|
||||
@@ -251,7 +251,7 @@ void SkelAnime_LodDrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* li
|
||||
postLimbDraw, actor, dListIndex, &mtx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -266,7 +266,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -281,7 +281,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
|
||||
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(polyTemp + 1, dList);
|
||||
gfxCtx->polyOpa.p = polyTemp + 2;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ void SkelAnime_DrawLimb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skele
|
||||
postLimbDraw, actor);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
SkelAnime_DrawLimb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
|
||||
@@ -320,7 +320,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
|
||||
|
||||
gfxCtx = globalCtx->state.gfxCtx;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
rootLimb = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
|
||||
pos.x = limbDrawTable[0].x;
|
||||
@@ -335,7 +335,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
|
||||
if (dList != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
|
||||
gSPMatrix(polyTemp, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(polyTemp, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(polyTemp + 1, dList);
|
||||
gfxCtx->polyOpa.p = polyTemp + 2;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ void SkelAnime_Draw(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDra
|
||||
postLimbDraw, actor);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable,
|
||||
@@ -363,7 +363,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -398,7 +398,7 @@ void SkelAnime_DrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, Skeleton* ske
|
||||
postLimbDraw, actor, limbMatricies);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
SkelAnime_DrawLimbSV(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
|
||||
@@ -427,7 +427,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
|
||||
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
|
||||
@@ -465,7 +465,7 @@ void SkelAnime_DrawSV(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbD
|
||||
postLimbDraw, actor, &mtx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton, Vec3s* limbDrawTable,
|
||||
@@ -478,7 +478,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
|
||||
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
|
||||
s32 pad2;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -493,7 +493,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
|
||||
|
||||
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList[1], &pos, &rot, actor) == 0)) {
|
||||
SysMatrix_RotateAndTranslateState(&pos, &rot);
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
unkDraw(globalCtx, limbIndex, actor);
|
||||
if (dList[1] != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
@@ -508,7 +508,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
|
||||
(*mtx)++;
|
||||
}
|
||||
}
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
if (postLimbDraw != NULL) {
|
||||
@@ -520,7 +520,7 @@ void func_80134148(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skeleton,
|
||||
unkDraw, actor, mtx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
func_80134148(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw, postLimbDraw,
|
||||
@@ -549,7 +549,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
|
||||
gSPSegment(gfxCtx->polyOpa.p++, 0xD, mtx);
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
|
||||
@@ -563,7 +563,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
|
||||
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList[1], &pos, &rot, actor) == 0)) {
|
||||
SysMatrix_RotateAndTranslateState(&pos, &rot);
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
unkDraw(globalCtx, 1, actor);
|
||||
if (dList[1] != NULL) {
|
||||
Gfx* polyTemp = gfxCtx->polyOpa.p;
|
||||
@@ -577,7 +577,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
SysMatrix_GetStateAsRSPMatrix(mtx++);
|
||||
}
|
||||
}
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
if (postLimbDraw != NULL) {
|
||||
@@ -589,7 +589,7 @@ void func_801343C0(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDraw
|
||||
unkDraw, actor, &mtx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -639,7 +639,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -654,7 +654,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
|
||||
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, limbIndex, &dList, &pos, &rot, actor, &gfx) == 0)) {
|
||||
SysMatrix_RotateAndTranslateState(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(gfx + 1, dList);
|
||||
gfx = gfx + 2;
|
||||
}
|
||||
@@ -669,7 +669,7 @@ Gfx* SkelAnime_Draw2Limb(GlobalContext* globalCtx, s32 limbIndex, Skeleton* skel
|
||||
postLimbDraw, actor, gfx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
gfx = SkelAnime_Draw2Limb(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
|
||||
@@ -695,7 +695,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
|
||||
@@ -709,7 +709,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
|
||||
if ((overrideLimbDraw == NULL) || (overrideLimbDraw(globalCtx, 1, &dList, &pos, &rot, actor, &gfx) == 0)) {
|
||||
SysMatrix_RotateAndTranslateState(&pos, &rot);
|
||||
if (dList != NULL) {
|
||||
gSPMatrix(gfx, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPMatrix(gfx, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_LOAD);
|
||||
gSPDisplayList(gfx + 1, dList);
|
||||
gfx = gfx + 2;
|
||||
}
|
||||
@@ -724,7 +724,7 @@ Gfx* SkelAnime_Draw2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limbDr
|
||||
postLimbDraw, actor, gfx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
return gfx;
|
||||
}
|
||||
@@ -742,7 +742,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
Vec3f pos;
|
||||
Vec3s rot;
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[limbIndex]);
|
||||
limbIndex++;
|
||||
@@ -778,7 +778,7 @@ Gfx* SkelAnime_DrawLimbSV2(GlobalContext* globalCtx, s32 limbIndex, Skeleton* sk
|
||||
postLimbDraw, actor, mtx, gfx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
if (limbEntry->nextLimbIndex != LIMB_DONE) {
|
||||
gfx = SkelAnime_DrawLimbSV2(globalCtx, limbEntry->nextLimbIndex, skeleton, limbDrawTable, overrideLimbDraw,
|
||||
@@ -806,7 +806,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
|
||||
gSPSegment(gfx++, 0xD, mtx);
|
||||
|
||||
SysMatrix_StatePush();
|
||||
Matrix_Push();
|
||||
|
||||
limbEntry = Lib_PtrSegToVirt(skeleton->limbs[0]);
|
||||
|
||||
@@ -842,7 +842,7 @@ Gfx* SkelAnime_DrawSV2(GlobalContext* globalCtx, Skeleton* skeleton, Vec3s* limb
|
||||
postLimbDraw, actor, &mtx, gfx);
|
||||
}
|
||||
|
||||
SysMatrix_StatePop();
|
||||
Matrix_Pop();
|
||||
|
||||
return gfx;
|
||||
}
|
||||
@@ -1462,11 +1462,11 @@ s32 func_80136D98(SkelAnime* skelAnime) {
|
||||
}
|
||||
temp_a1 = (s16)(skelAnime->transCurrentFrame * 16384.0f);
|
||||
if (skelAnime->unk03 < 0) {
|
||||
sp28 = 1.0f - Math_Coss(temp_a2);
|
||||
phi_f2 = 1.0f - Math_Coss(temp_a1);
|
||||
sp28 = 1.0f - Math_CosS(temp_a2);
|
||||
phi_f2 = 1.0f - Math_CosS(temp_a1);
|
||||
} else {
|
||||
sp28 = Math_Sins(temp_a2);
|
||||
phi_f2 = Math_Sins(temp_a1);
|
||||
sp28 = Math_SinS(temp_a2);
|
||||
phi_f2 = Math_SinS(temp_a1);
|
||||
}
|
||||
if (phi_f2 != 0.0f) {
|
||||
phi_f2 /= sp28;
|
||||
@@ -1691,8 +1691,8 @@ void func_80137748(SkelAnime* skelAnime, Vec3f* pos, s16 angle) {
|
||||
// `angle` rotation around y axis.
|
||||
x = skelAnime->limbDrawTbl->x - skelAnime->prevFramePos.x;
|
||||
z = skelAnime->limbDrawTbl->z - skelAnime->prevFramePos.z;
|
||||
sin = Math_Sins(angle);
|
||||
cos = Math_Coss(angle);
|
||||
sin = Math_SinS(angle);
|
||||
cos = Math_CosS(angle);
|
||||
pos->x = x * cos + z * sin;
|
||||
pos->z = z * cos - x * sin;
|
||||
}
|
||||
|
||||
+2
-2
@@ -256,11 +256,11 @@ s32 View_StepQuake(View* view, RSPMatrix* matrix) {
|
||||
}
|
||||
|
||||
SysMatrix_FromRSPMatrix(matrix, &mf);
|
||||
SysMatrix_SetCurrentState(&mf);
|
||||
Matrix_Put(&mf);
|
||||
SysMatrix_RotateStateAroundXAxis(view->currQuakeRot.x);
|
||||
SysMatrix_InsertYRotation_f(view->currQuakeRot.y, 1);
|
||||
SysMatrix_InsertZRotation_f(view->currQuakeRot.z, 1);
|
||||
SysMatrix_InsertScale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1);
|
||||
Matrix_Scale(view->currQuakeScale.x, view->currQuakeScale.y, view->currQuakeScale.z, 1);
|
||||
SysMatrix_InsertZRotation_f(-view->currQuakeRot.z, 1);
|
||||
SysMatrix_InsertYRotation_f(-view->currQuakeRot.y, 1);
|
||||
SysMatrix_RotateStateAroundXAxis(-view->currQuakeRot.x);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
void guLookAtF(f32 mf[4][4], f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp) {
|
||||
f32 length;
|
||||
f32 xLook;
|
||||
f32 yLook;
|
||||
f32 zLook;
|
||||
f32 xRight;
|
||||
f32 yRight;
|
||||
f32 zRight;
|
||||
|
||||
guMtxIdentF(mf);
|
||||
|
||||
xLook = xAt - xEye;
|
||||
yLook = yAt - yEye;
|
||||
zLook = zAt - zEye;
|
||||
length = -1.0 / sqrtf(SQ(xLook) + SQ(yLook) + SQ(zLook));
|
||||
xLook *= length;
|
||||
yLook *= length;
|
||||
zLook *= length;
|
||||
|
||||
xRight = yUp * zLook - zUp * yLook;
|
||||
yRight = zUp * xLook - xUp * zLook;
|
||||
zRight = xUp * yLook - yUp * xLook;
|
||||
length = 1.0 / sqrtf(SQ(xRight) + SQ(yRight) + SQ(zRight));
|
||||
xRight *= length;
|
||||
yRight *= length;
|
||||
zRight *= length;
|
||||
|
||||
xUp = yLook * zRight - zLook * yRight;
|
||||
yUp = zLook * xRight - xLook * zRight;
|
||||
zUp = xLook * yRight - yLook * xRight;
|
||||
length = 1.0 / sqrtf(SQ(xUp) + SQ(yUp) + SQ(zUp));
|
||||
xUp *= length;
|
||||
yUp *= length;
|
||||
zUp *= length;
|
||||
|
||||
mf[0][0] = xRight;
|
||||
mf[1][0] = yRight;
|
||||
mf[2][0] = zRight;
|
||||
mf[3][0] = -(xEye * xRight + yEye * yRight + zEye * zRight);
|
||||
|
||||
mf[0][1] = xUp;
|
||||
mf[1][1] = yUp;
|
||||
mf[2][1] = zUp;
|
||||
mf[3][1] = -(xEye * xUp + yEye * yUp + zEye * zUp);
|
||||
|
||||
mf[0][2] = xLook;
|
||||
mf[1][2] = yLook;
|
||||
mf[2][2] = zLook;
|
||||
mf[3][2] = -(xEye * xLook + yEye * yLook + zEye * zLook);
|
||||
|
||||
mf[0][3] = 0;
|
||||
mf[1][3] = 0;
|
||||
mf[2][3] = 0;
|
||||
mf[3][3] = 1;
|
||||
}
|
||||
|
||||
void guLookAt(Mtx* m, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp, f32 yUp, f32 zUp) {
|
||||
f32 mf[4][4];
|
||||
|
||||
guLookAtF(mf, xEye, yEye, zEye, xAt, yAt, zAt, xUp, yUp, zUp);
|
||||
|
||||
guMtxF2L((MtxF*)mf, m);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xff)
|
||||
|
||||
void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt,
|
||||
f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */
|
||||
f32 xl2, f32 yl2, f32 zl2, /* light 2 direction */
|
||||
s32 hiliteWidth, s32 hiliteHeight) /* size of hilite texture */
|
||||
{
|
||||
f32 length;
|
||||
f32 xLook;
|
||||
f32 yLook;
|
||||
f32 zLook;
|
||||
f32 xRight;
|
||||
f32 yRight;
|
||||
f32 zRight;
|
||||
f32 xHilite;
|
||||
f32 yHilite;
|
||||
f32 zHilite;
|
||||
|
||||
guMtxIdentF(mf);
|
||||
|
||||
xLook = xAt - xEye;
|
||||
yLook = yAt - yEye;
|
||||
zLook = zAt - zEye;
|
||||
length = -1.0 / sqrtf(SQ(xLook) + SQ(yLook) + SQ(zLook));
|
||||
xLook *= length;
|
||||
yLook *= length;
|
||||
zLook *= length;
|
||||
|
||||
xRight = yUp * zLook - zUp * yLook;
|
||||
yRight = zUp * xLook - xUp * zLook;
|
||||
zRight = xUp * yLook - yUp * xLook;
|
||||
length = 1.0 / sqrtf(SQ(xRight) + SQ(yRight) + SQ(zRight));
|
||||
xRight *= length;
|
||||
yRight *= length;
|
||||
zRight *= length;
|
||||
|
||||
xUp = yLook * zRight - zLook * yRight;
|
||||
yUp = zLook * xRight - xLook * zRight;
|
||||
zUp = xLook * yRight - yLook * xRight;
|
||||
length = 1.0 / sqrtf(SQ(xUp) + SQ(yUp) + SQ(zUp));
|
||||
xUp *= length;
|
||||
yUp *= length;
|
||||
zUp *= length;
|
||||
|
||||
/* hilite vectors */
|
||||
|
||||
length = 1.0 / sqrtf(SQ(xl1) + SQ(yl1) + SQ(zl1));
|
||||
xl1 *= length;
|
||||
yl1 *= length;
|
||||
zl1 *= length;
|
||||
|
||||
xHilite = xl1 + xLook;
|
||||
yHilite = yl1 + yLook;
|
||||
zHilite = zl1 + zLook;
|
||||
|
||||
length = sqrtf(SQ(xHilite) + SQ(yHilite) + SQ(zHilite));
|
||||
|
||||
if (length > D_800992F0) {
|
||||
length = 1.0 / length;
|
||||
xHilite *= length;
|
||||
yHilite *= length;
|
||||
zHilite *= length;
|
||||
|
||||
h->h.x1 = hiliteWidth * 4 + (xHilite * xRight + yHilite * yRight + zHilite * zRight) * hiliteWidth * 2;
|
||||
|
||||
h->h.y1 = hiliteHeight * 4 + (xHilite * xUp + yHilite * yUp + zHilite * zUp) * hiliteHeight * 2;
|
||||
} else {
|
||||
h->h.x1 = hiliteWidth * 2;
|
||||
h->h.y1 = hiliteHeight * 2;
|
||||
}
|
||||
|
||||
length = 1.0 / sqrtf(SQ(xl2) + SQ(yl2) + SQ(zl2));
|
||||
xl2 *= length;
|
||||
yl2 *= length;
|
||||
zl2 *= length;
|
||||
|
||||
xHilite = xl2 + xLook;
|
||||
yHilite = yl2 + yLook;
|
||||
zHilite = zl2 + zLook;
|
||||
length = sqrtf(SQ(xHilite) + SQ(yHilite) + SQ(zHilite));
|
||||
if (length > D_800992F8) {
|
||||
length = 1.0 / length;
|
||||
xHilite *= length;
|
||||
yHilite *= length;
|
||||
zHilite *= length;
|
||||
|
||||
h->h.x2 = hiliteWidth * 4 + (xHilite * xRight + yHilite * yRight + zHilite * zRight) * hiliteWidth * 2;
|
||||
|
||||
h->h.y2 = hiliteHeight * 4 + (xHilite * xUp + yHilite * yUp + zHilite * zUp) * hiliteHeight * 2;
|
||||
} else {
|
||||
h->h.x2 = hiliteWidth * 2;
|
||||
h->h.y2 = hiliteHeight * 2;
|
||||
}
|
||||
|
||||
/* reflectance vectors = Up and Right */
|
||||
|
||||
l->l[0].l.dir[0] = FTOFRAC8(xRight);
|
||||
l->l[0].l.dir[1] = FTOFRAC8(yRight);
|
||||
l->l[0].l.dir[2] = FTOFRAC8(zRight);
|
||||
l->l[1].l.dir[0] = FTOFRAC8(xUp);
|
||||
l->l[1].l.dir[1] = FTOFRAC8(yUp);
|
||||
l->l[1].l.dir[2] = FTOFRAC8(zUp);
|
||||
l->l[0].l.col[0] = 0x00;
|
||||
l->l[0].l.col[1] = 0x00;
|
||||
l->l[0].l.col[2] = 0x00;
|
||||
l->l[0].l.pad1 = 0x00;
|
||||
l->l[0].l.colc[0] = 0x00;
|
||||
l->l[0].l.colc[1] = 0x00;
|
||||
l->l[0].l.colc[2] = 0x00;
|
||||
l->l[0].l.pad2 = 0x00;
|
||||
l->l[1].l.col[0] = 0x00;
|
||||
l->l[1].l.col[1] = 0x80;
|
||||
l->l[1].l.col[2] = 0x00;
|
||||
l->l[1].l.pad1 = 0x00;
|
||||
l->l[1].l.colc[0] = 0x00;
|
||||
l->l[1].l.colc[1] = 0x80;
|
||||
l->l[1].l.colc[2] = 0x00;
|
||||
l->l[1].l.pad2 = 0x00;
|
||||
|
||||
mf[0][0] = xRight;
|
||||
mf[1][0] = yRight;
|
||||
mf[2][0] = zRight;
|
||||
mf[3][0] = -(xEye * xRight + yEye * yRight + zEye * zRight);
|
||||
|
||||
mf[0][1] = xUp;
|
||||
mf[1][1] = yUp;
|
||||
mf[2][1] = zUp;
|
||||
mf[3][1] = -(xEye * xUp + yEye * yUp + zEye * zUp);
|
||||
|
||||
mf[0][2] = xLook;
|
||||
mf[1][2] = yLook;
|
||||
mf[2][2] = zLook;
|
||||
mf[3][2] = -(xEye * xLook + yEye * yLook + zEye * zLook);
|
||||
|
||||
mf[0][3] = 0;
|
||||
mf[1][3] = 0;
|
||||
mf[2][3] = 0;
|
||||
mf[3][3] = 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* guLookAtHilite
|
||||
* This function creates the viewing matrix (fixed point) and sets the LookAt/Hilite structures
|
||||
* Same args as previous function
|
||||
**/
|
||||
void guLookAtHilite(Mtx* m, LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt, f32 xUp,
|
||||
f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, f32 xl2, f32 yl2, f32 zl2, s32 hiliteWidth,
|
||||
s32 hiliteHeight) {
|
||||
f32 mf[4][4];
|
||||
|
||||
guLookAtHiliteF(mf, l, h, xEye, yEye, zEye, xAt, yAt, zAt, xUp, yUp, zUp, xl1, yl1, zl1, xl2, yl2, zl2, hiliteWidth,
|
||||
hiliteHeight);
|
||||
|
||||
guMtxF2L((MtxF*)mf, m);
|
||||
}
|
||||
@@ -12,7 +12,7 @@ s32 osContStartQuery(OSMesgQueue* mq)
|
||||
if (__osContLastCmd != 0) {
|
||||
__osPackRequestData(0);
|
||||
__osSiRawStartDma(1, &__osContPifRam);
|
||||
osRecvMesg(mq, NULL, 1);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
|
||||
ret = __osSiRawStartDma(0, &__osContPifRam);
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
#include "PR/hardware.h"
|
||||
|
||||
s32 __osEPiRawWriteIo(OSPiHandle* handle, u32 devAddr, u32 data) {
|
||||
s32 status;
|
||||
OSPiHandle* curHandle;
|
||||
|
||||
while (status = HW_REG(PI_STATUS_REG, u32), status & (PI_STATUS_BUSY | PI_STATUS_IOBUSY | PI_STATUS_ERROR)) {
|
||||
;
|
||||
}
|
||||
|
||||
if (__osCurrentHandle[handle->domain]->type != handle->type) {
|
||||
curHandle = __osCurrentHandle[handle->domain];
|
||||
|
||||
if (handle->domain == 0) {
|
||||
if (curHandle->latency != handle->latency) {
|
||||
HW_REG(PI_BSD_DOM1_LAT_REG, u32) = handle->latency;
|
||||
}
|
||||
|
||||
if (curHandle->pageSize != handle->pageSize) {
|
||||
HW_REG(PI_BSD_DOM1_PGS_REG, u32) = handle->pageSize;
|
||||
}
|
||||
|
||||
if (curHandle->relDuration != handle->relDuration) {
|
||||
HW_REG(PI_BSD_DOM1_RLS_REG, u32) = handle->relDuration;
|
||||
}
|
||||
|
||||
if (curHandle->pulse != handle->pulse) {
|
||||
HW_REG(PI_BSD_DOM1_PWD_REG, u32) = handle->pulse;
|
||||
}
|
||||
} else {
|
||||
if (curHandle->latency != handle->latency) {
|
||||
HW_REG(PI_BSD_DOM2_LAT_REG, u32) = handle->latency;
|
||||
}
|
||||
|
||||
if (curHandle->pageSize != handle->pageSize) {
|
||||
HW_REG(PI_BSD_DOM2_PGS_REG, u32) = handle->pageSize;
|
||||
}
|
||||
|
||||
if (curHandle->relDuration != handle->relDuration) {
|
||||
HW_REG(PI_BSD_DOM2_RLS_REG, u32) = handle->relDuration;
|
||||
}
|
||||
|
||||
if (curHandle->pulse != handle->pulse) {
|
||||
HW_REG(PI_BSD_DOM2_PWD_REG, u32) = handle->pulse;
|
||||
}
|
||||
}
|
||||
|
||||
curHandle->type = handle->type;
|
||||
curHandle->latency = handle->latency;
|
||||
curHandle->pageSize = handle->pageSize;
|
||||
curHandle->relDuration = handle->relDuration;
|
||||
curHandle->pulse = handle->pulse;
|
||||
}
|
||||
|
||||
HW_REG(handle->baseAddress | devAddr, u32) = data;
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/vimgr/osCreateViManager.asm")
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/vimgr/viMgrMain.asm")
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <PR/ultratypes.h>
|
||||
#include <osint.h>
|
||||
|
||||
void osCreateThread(OSThread* t, OSId id, osCreateThread_func entry, void* arg, void* sp, OSPri p) {
|
||||
void osCreateThread(OSThread* t, OSId id, void* entry, void* arg, void* sp, OSPri p) {
|
||||
register u32 saveMask;
|
||||
OSIntMask mask;
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/voicecheckresult/__osVoiceCheckResult.asm")
|
||||
@@ -0,0 +1,59 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
#include "io/controller.h"
|
||||
|
||||
s32 __osVoiceGetStatus(OSMesgQueue* mq, s32 port, u8* status) {
|
||||
__OSContRequestHeaderAligned header;
|
||||
s32 ret = 0;
|
||||
s32 i;
|
||||
u8* ptr = (u8 *)&__osContPifRam;
|
||||
s32 var = 2;
|
||||
|
||||
__osSiGetAccess();
|
||||
|
||||
do {
|
||||
if (ret != CONT_ERR_CONTRFAIL) {
|
||||
__osContPifRam.pifstatus = CONT_CMD_READ_BUTTON;
|
||||
|
||||
for (i = 0; i < port; i++, *ptr++ = 0) {
|
||||
;
|
||||
}
|
||||
|
||||
*ptr++ = 1;
|
||||
*ptr++ = 3;
|
||||
*ptr = CONT_CMD_REQUEST_STATUS;
|
||||
ptr += 4;
|
||||
*ptr = CONT_CMD_END;
|
||||
|
||||
__osContLastCmd = CONT_CMD_END;
|
||||
ret = __osSiRawStartDma(OS_WRITE, &__osContPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
}
|
||||
ret = __osSiRawStartDma(OS_READ, &__osContPifRam);
|
||||
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
|
||||
|
||||
ptr = (u8 *)&__osContPifRam + port;
|
||||
|
||||
header = *((__OSContRequestHeaderAligned*)ptr);
|
||||
|
||||
ret = (u8)((header.rxsize & 0xC0) >> 4);
|
||||
*status = header.status;
|
||||
|
||||
if (ret == 0) {
|
||||
if (header.typeh == 0 && header.typel == 1) {
|
||||
if (header.status & 4) {
|
||||
ret = CONT_ERR_CONTRFAIL;
|
||||
}
|
||||
} else {
|
||||
ret = CONT_ERR_DEVICE;
|
||||
}
|
||||
} else if (ret & CONT_NO_RESPONSE_ERROR) {
|
||||
ret = CONT_ERR_NO_CONTROLLER;
|
||||
} else {
|
||||
ret = CONT_ERR_CONTRFAIL;
|
||||
}
|
||||
} while ((ret == CONT_ERR_CONTRFAIL) && (var-- >= 0));
|
||||
|
||||
__osSiRelAccess();
|
||||
return (ret);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/boot/voicesetword/osVoiceSetWord.asm")
|
||||
@@ -219,7 +219,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
} else {
|
||||
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->base.velocity);
|
||||
player->base.world.rot.x =
|
||||
atans_flip(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
|
||||
Math_FAtan2F(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
|
||||
}
|
||||
if (phi_f16 < 50.0f) {
|
||||
ArmsHook_DetachHookFromActor(this);
|
||||
@@ -232,7 +232,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
BgPolygon* poly;
|
||||
CollisionPoly* poly;
|
||||
u32 bgId;
|
||||
Vec3f sp78;
|
||||
Vec3f prevFrameDiff;
|
||||
@@ -241,7 +241,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) {
|
||||
Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor);
|
||||
Math_Vec3f_Diff(&this->actor.world.pos, &this->actor.prevPos, &prevFrameDiff);
|
||||
Math_Vec3f_Sum(&this->unk1E0, &prevFrameDiff, &this->unk1E0);
|
||||
this->actor.shape.rot.x = atans_flip(this->actor.speedXZ, -this->actor.velocity.y);
|
||||
this->actor.shape.rot.x = Math_FAtan2F(this->actor.speedXZ, -this->actor.velocity.y);
|
||||
sp60.x = this->unk1EC.x - (this->unk1E0.x - this->unk1EC.x);
|
||||
sp60.y = this->unk1EC.y - (this->unk1E0.y - this->unk1EC.y);
|
||||
sp60.z = this->unk1EC.z - (this->unk1E0.z - this->unk1EC.z);
|
||||
@@ -315,7 +315,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
func_80122868(globalCtx, player);
|
||||
|
||||
gSPMatrix(sp44->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
gSPMatrix(sp44->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(sp44->polyOpa.p++, D_0601D960);
|
||||
SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z,
|
||||
@@ -323,11 +323,11 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Math_Vec3f_Diff(&player->unk368, &this->actor.world.pos, &sp68);
|
||||
sp48 = SQ(sp68.x) + SQ(sp68.z);
|
||||
sp4C = sqrtf(sp48);
|
||||
SysMatrix_InsertYRotation_s(atans(sp68.x, sp68.z), MTXMODE_APPLY);
|
||||
Matrix_RotateY(atans(sp68.x, sp68.z), MTXMODE_APPLY);
|
||||
SysMatrix_InsertXRotation_s(atans(-sp68.y, sp4C), MTXMODE_APPLY);
|
||||
f0 = sqrtf(SQ(sp68.y) + sp48);
|
||||
SysMatrix_InsertScale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
|
||||
gSPMatrix(sp44->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
Matrix_Scale(0.015f, 0.015f, f0 * 0.01f, MTXMODE_APPLY);
|
||||
gSPMatrix(sp44->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(sp44->polyOpa.p++, D_040008D0);
|
||||
func_801229A0(globalCtx, player);
|
||||
|
||||
@@ -55,7 +55,7 @@ void BgFuKaiten_UpdateHeight(BgFuKaiten* this) {
|
||||
this->bounce += this->bounceSpeed;
|
||||
this->bg.actor.world.pos.y = this->bg.actor.home.pos.y + this->elevation + this->bouceHeight;
|
||||
|
||||
this->bg.actor.world.pos.y -= this->bouceHeight * Math_Coss(this->bounce);
|
||||
this->bg.actor.world.pos.y -= this->bouceHeight * Math_CosS(this->bounce);
|
||||
}
|
||||
|
||||
void BgFuKaiten_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
@@ -69,6 +69,6 @@ void BgFuKaiten_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
func_8012C28C(gfxCtx);
|
||||
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, object_fu_kaiten_0005D0);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ void BgLotus_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->dyna.actor.floorHeight =
|
||||
func_800C411C(&globalCtx->colCtx, &thisx->floorPoly, &sp2C, &this->dyna.actor, &this->dyna.actor.world.pos);
|
||||
this->timer2 = 96;
|
||||
this->dyna.actor.world.rot.y = (s16)(rand() >> 0x10);
|
||||
this->dyna.actor.world.rot.y = Rand_Next() >> 0x10;
|
||||
this->actionFunc = BgLotus_Wait;
|
||||
}
|
||||
|
||||
@@ -78,13 +78,13 @@ void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (this->dyna.actor.params == 0) {
|
||||
this->dyna.actor.world.pos.x =
|
||||
(Math_Sins(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.x;
|
||||
(Math_SinS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.x;
|
||||
this->dyna.actor.world.pos.z =
|
||||
(Math_Coss(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.z;
|
||||
(Math_CosS(this->dyna.actor.world.rot.y) * moveDist) + this->dyna.actor.home.pos.z;
|
||||
|
||||
if (this->timer2 == 0) {
|
||||
this->timer2 = 96;
|
||||
this->dyna.actor.world.rot.y += (s16)(rand() >> 0x12);
|
||||
this->dyna.actor.world.rot.y += (s16)(Rand_Next() >> 0x12);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ void BgLotus_Wait(BgLotus* this, GlobalContext* globalCtx) {
|
||||
|
||||
if (func_800CAF70(&this->dyna)) {
|
||||
if (this->hasSpawnedRipples == 0) {
|
||||
EffectSS_SpawnGRipple(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 0);
|
||||
EffectSS_SpawnGRipple(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 8);
|
||||
EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 0);
|
||||
EffectSsGRipple_Spawn(globalCtx, &this->dyna.actor.world.pos, 1000, 1400, 8);
|
||||
this->timer = 40;
|
||||
}
|
||||
if (gSaveContext.perm.unk20 != 3) {
|
||||
|
||||
@@ -331,7 +331,7 @@ void DoorSpiral_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(POLY_OPA_DISP++, spiralInfo->spiralDL[this->orientation]);
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ void EnDyExtra_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, globalCtx->state.frames * 2, 0, 0x20, 0x40, 1,
|
||||
globalCtx->state.frames, globalCtx->state.frames * -8, 0x10, 0x10));
|
||||
gDPPipeSync(POLY_XLU_DISP++);
|
||||
gSPMatrix(POLY_XLU_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, D_80A61740[this->type].r, D_80A61740[this->type].g,
|
||||
D_80A61740[this->type].b, 255);
|
||||
|
||||
@@ -44,7 +44,7 @@ void EnEndingHero_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600B0CC, &D_06000BE0, this->limbDrawTable,
|
||||
this->transitionDrawTable, 15);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
func_80C1E748(this);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ void EnEndingHero_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->unk242 += 1;
|
||||
if (this->unk242 > 2) {
|
||||
this->unk242 = 0;
|
||||
this->unk240 = (s16)randZeroOneScaled(60.0f) + 0x14;
|
||||
this->unk240 = (s16)Rand_ZeroFloat(60.0f) + 0x14;
|
||||
}
|
||||
}
|
||||
this->actionFunc(this, globalCtx);
|
||||
|
||||
@@ -36,7 +36,7 @@ void EnEndingHero2_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007908, &D_060011C0, this->limbDrawTable,
|
||||
this->transitionDrawTable, 20);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
func_80C232E8(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void EnEndingHero3_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06007150, &D_06000E50, this->limbDrawTable,
|
||||
this->transitionDrawTable, 17);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
func_80C23518(&this->actor);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void EnEndingHero4_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600D640, &D_06002A84, this->limbDrawTable,
|
||||
this->transitionDrawTable, 17);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
func_80C23748(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ void EnEndingHero5_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
this->actor.gravity = -3.0f;
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600A850, &D_06002FA0, this->limbDrawTable,
|
||||
this->transitionDrawTable, 17);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
this->unk25C = this->actor.params;
|
||||
func_80C23980(this);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void EnNnh_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
func_8012C28C(gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, D_06001510);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ void EnPoFusen_Init(Actor *thisx, GlobalContext *globalCtx) {
|
||||
if (0){}
|
||||
this->collider.dim.worldSphere.radius = 40;
|
||||
SkelAnime_InitSV(globalCtx, &this->anime, &D_060024F0, &D_06000040, &this->limbDrawTbl, &this->transitionDrawTbl, 10);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 25.0f);
|
||||
func_800B78B8(globalCtx, this, 0.0f, 0.0f, 0.0f, 4);
|
||||
|
||||
if (EnPoFusen_CheckParent(this, globalCtx) == 0) {
|
||||
@@ -70,8 +70,8 @@ void EnPoFusen_Init(Actor *thisx, GlobalContext *globalCtx) {
|
||||
this->actor.home.pos.y = heightTemp;
|
||||
}
|
||||
|
||||
this->randScaleChange = ((rand() % 0xFFFEU) - 0x7FFF);
|
||||
this->randYRotChange = ((rand() % 0x4B0U) - 0x258);
|
||||
this->randScaleChange = ((Rand_Next() % 0xFFFEU) - 0x7FFF);
|
||||
this->randYRotChange = ((Rand_Next() % 0x4B0U) - 0x258);
|
||||
this->avgBaseRotation = 0x1555;
|
||||
this->limb3Rot = 0;
|
||||
this->limb46Rot = 0;
|
||||
@@ -150,11 +150,11 @@ void EnPoFusen_Idle(EnPoFusen *this, GlobalContext *gCtx) {
|
||||
this->randScaleChange += 0x190;
|
||||
this->randXZRotChange += 0x5DC;
|
||||
this->randBaseRotChange += 0x9C4;
|
||||
heightOffset = Math_Sins(this->randScaleChange);
|
||||
heightOffset = Math_SinS(this->randScaleChange);
|
||||
heightOffset = 50.0f * heightOffset;
|
||||
this->actor.shape.rot.y += this->randYRotChange;
|
||||
this->actor.world.pos.y += heightOffset;
|
||||
this->actor.shape.rot.z = (Math_Sins(this->randBaseRotChange) * 910.0f);
|
||||
this->actor.shape.rot.z = (Math_SinS(this->randBaseRotChange) * 910.0f);
|
||||
|
||||
if ((this->randScaleChange < 0x4000) && (this->randScaleChange >= -0x3FFF)) {
|
||||
Math_SmoothScaleMaxMinS( &this->limb9Rot, 0x38E, 0x14, 0xBB8, 0x64);
|
||||
@@ -163,13 +163,13 @@ void EnPoFusen_Idle(EnPoFusen *this, GlobalContext *gCtx) {
|
||||
}
|
||||
|
||||
this->avgBaseRotation = this->limb9Rot * 3;
|
||||
this->limb3Rot = (Math_Sins(this->randBaseRotChange + 0x38E3) * this->avgBaseRotation);
|
||||
this->limb46Rot = (Math_Sins(this->randBaseRotChange) * this->avgBaseRotation);
|
||||
this->limb57Rot = (Math_Sins(this->randBaseRotChange - 0x38E3) * this->avgBaseRotation);
|
||||
this->limb8Rot = (Math_Sins(this->randBaseRotChange - 0x71C6) * this->avgBaseRotation);
|
||||
this->limb3Rot = (Math_SinS(this->randBaseRotChange + 0x38E3) * this->avgBaseRotation);
|
||||
this->limb46Rot = (Math_SinS(this->randBaseRotChange) * this->avgBaseRotation);
|
||||
this->limb57Rot = (Math_SinS(this->randBaseRotChange - 0x38E3) * this->avgBaseRotation);
|
||||
this->limb8Rot = (Math_SinS(this->randBaseRotChange - 0x71C6) * this->avgBaseRotation);
|
||||
|
||||
shadowScaleTmp = ((1.0f - Math_Sins(this->randScaleChange)) * 10.0f) + 50.0f;
|
||||
shadowAlphaTmp = ((1.0f - Math_Sins(this->randScaleChange)) * 75.0f) + 100.0f;
|
||||
shadowScaleTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 10.0f) + 50.0f;
|
||||
shadowAlphaTmp = ((1.0f - Math_SinS(this->randScaleChange)) * 75.0f) + 100.0f;
|
||||
this->actor.shape.shadowScale = shadowScaleTmp;
|
||||
this->actor.shape.shadowAlpha = (shadowAlphaTmp > f255) ? (u8) f255 : (u8) shadowAlphaTmp;
|
||||
}
|
||||
@@ -229,15 +229,15 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext *gCtx, s32 limbIndex, Gfx **dList,
|
||||
s16 xRot;
|
||||
|
||||
if (limbIndex == 2) {
|
||||
zScale = (Math_Coss(this->randScaleChange) * 0.0799999982119f) + 1.0f;
|
||||
zScale = (Math_CosS(this->randScaleChange) * 0.0799999982119f) + 1.0f;
|
||||
xScale = zScale;
|
||||
if (!zScale) { }
|
||||
yScale = (Math_Sins(this->randScaleChange) * 0.0799999982119f) + 1.0f;
|
||||
yScale = (Math_SinS(this->randScaleChange) * 0.0799999982119f) + 1.0f;
|
||||
yScale = yScale * yScale;
|
||||
xRot = ((Math_Sins(this->randXZRotChange) * 2730.0f));
|
||||
zRot = ((Math_Coss(this->randXZRotChange) * 2730.0f));
|
||||
xRot = ((Math_SinS(this->randXZRotChange) * 2730.0f));
|
||||
zRot = ((Math_CosS(this->randXZRotChange) * 2730.0f));
|
||||
SysMatrix_InsertRotation(xRot, 0, zRot , 1);
|
||||
SysMatrix_InsertScale(xScale, yScale , zScale, 1);
|
||||
Matrix_Scale(xScale, yScale, zScale, 1);
|
||||
SysMatrix_InsertZRotation_s( -zRot, 1);
|
||||
SysMatrix_InsertXRotation_s( -xRot, 1);
|
||||
} else if (limbIndex == 3) {
|
||||
@@ -251,8 +251,8 @@ s32 EnPoFusen_OverrideLimbDraw(GlobalContext *gCtx, s32 limbIndex, Gfx **dList,
|
||||
} else if (limbIndex == 8) {
|
||||
rot->z += this->limb8Rot;
|
||||
} else if (limbIndex == 9) {
|
||||
rot->y += (s16) (this->limb9Rot * Math_Sins(this->randBaseRotChange));
|
||||
rot->z += (s16) (this->limb9Rot * Math_Coss(this->randBaseRotChange));
|
||||
rot->y += (s16) (this->limb9Rot * Math_SinS(this->randBaseRotChange));
|
||||
rot->z += (s16) (this->limb9Rot * Math_CosS(this->randBaseRotChange));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void func_80C25D84(EnRsn* this, GlobalContext* globalCtx) {
|
||||
void EnRsn_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnRsn* this = THIS;
|
||||
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 20.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 20.0f);
|
||||
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06009220, &D_06009120, NULL, NULL, 0);
|
||||
this->actor.flags &= ~1;
|
||||
func_80C25D40(this);
|
||||
|
||||
@@ -39,7 +39,7 @@ void EnScopecoin_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnScopecoin* this = THIS;
|
||||
|
||||
Actor_SetScale(&this->actor, 0.01f);
|
||||
Actor_SetDrawParams(&this->actor.shape, 0, func_800B3FC0, 10.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 10.0f);
|
||||
this->unk148 = (this->actor.params & 0xF);
|
||||
if (this->unk148 < 0 || this->unk148 >= 8) {
|
||||
this->unk148 = 0;
|
||||
@@ -87,7 +87,7 @@ void EnScopecoin_Draw(Actor *thisx, GlobalContext *globalCtx) {
|
||||
func_800B8050(&this->actor, globalCtx, 0);
|
||||
OPEN_DISPS(gfxCtx);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x08, Lib_PtrSegToVirt(D_80BFD280[this->unk148]));
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_040622C0);
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ void EnTanron6_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
EnTanron6* this = THIS;
|
||||
|
||||
this->actor.colChkInfo.mass = 10;
|
||||
Actor_SetDrawParams(&this->actor.shape, 0, func_800B3FC0, 19.0f);
|
||||
ActorShape_Init(&this->actor.shape, 0, func_800B3FC0, 19.0f);
|
||||
this->actor.colChkInfo.health = 1;
|
||||
this->actor.colChkInfo.damageTable = &D_80BE6170;
|
||||
this->actor.targetMode = 6;
|
||||
|
||||
@@ -49,7 +49,7 @@ void EnTuboTrap_Init(Actor *thisx, GlobalContext *globalCtx) {
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
this->actor.shape.rot.z = 0;
|
||||
this->actor.world.rot.z = 0;
|
||||
Actor_SetDrawParams(&this->actor.shape, 0.0f, func_800B3FC0, 1.8f);
|
||||
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 1.8f);
|
||||
Collider_InitCylinder(globalCtx, &this->collider);
|
||||
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
|
||||
this->actionFunc = func_80931004; // idle
|
||||
@@ -90,21 +90,21 @@ void func_809308F4(EnTuboTrap *this, GlobalContext *globalCtx) {
|
||||
Vec3f *actorPos = &this->actor.world.pos;
|
||||
|
||||
for (i = 0, var = 0; i < 15; i++, var += 20000){
|
||||
sin = Math_Sins(var);
|
||||
cos = Math_Coss(var);
|
||||
sin = Math_SinS(var);
|
||||
cos = Math_CosS(var);
|
||||
pos.x = sin * 8.0f;
|
||||
pos.y = (randZeroOne() * 5.0f) + 2.0f;
|
||||
pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f;
|
||||
pos.z = cos * 8.0f;
|
||||
|
||||
vel.x = pos.x * 0.23f;
|
||||
vel.y = (randZeroOne() * 5.0f) + 2.0f;
|
||||
vel.y = (Rand_ZeroOne() * 5.0f) + 2.0f;
|
||||
vel.z = pos.z * 0.23f;
|
||||
|
||||
pos.x += actorPos->x;
|
||||
pos.y += actorPos->y;
|
||||
pos.z += actorPos->z;
|
||||
|
||||
rand = randZeroOne();
|
||||
rand = Rand_ZeroOne();
|
||||
if (rand < 0.2f) {
|
||||
arg5 = 0x60;
|
||||
}else if (rand < 0.6f){
|
||||
@@ -112,7 +112,7 @@ void func_809308F4(EnTuboTrap *this, GlobalContext *globalCtx) {
|
||||
}else {
|
||||
arg5 = 0x20;
|
||||
}
|
||||
EffectSS_SpawnShard(globalCtx,
|
||||
EffectSsKakera_Spawn(globalCtx,
|
||||
&pos,
|
||||
&vel,
|
||||
actorPos,
|
||||
@@ -121,7 +121,7 @@ void func_809308F4(EnTuboTrap *this, GlobalContext *globalCtx) {
|
||||
0x14,
|
||||
0,
|
||||
0,
|
||||
((randZeroOne() * 85.0f) + 15.0f),
|
||||
((Rand_ZeroOne() * 85.0f) + 15.0f),
|
||||
0,
|
||||
0,
|
||||
0x3C,
|
||||
@@ -151,38 +151,38 @@ void func_80930B60(EnTuboTrap *this, GlobalContext *globalCtx) {
|
||||
pos = *actorPos;
|
||||
pos.y += this->actor.yDistToWater;
|
||||
|
||||
EffectSS_SpawnGSplash(globalCtx, &pos, NULL, NULL, 0, 0x190);
|
||||
EffectSsGSplash_Spawn(globalCtx, &pos, NULL, NULL, 0, 0x190);
|
||||
|
||||
for (i = 0, var = 0; i < 15; i++, var += 20000) {
|
||||
sin = Math_Sins(var);
|
||||
cos = Math_Coss(var);
|
||||
sin = Math_SinS(var);
|
||||
cos = Math_CosS(var);
|
||||
pos.x = sin * 8.0f;
|
||||
pos.y = (randZeroOne() * 5.0f) + 2.0f;
|
||||
pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f;
|
||||
pos.z = cos * 8.0f;
|
||||
|
||||
vel.x = pos.x * 0.20f;
|
||||
vel.y = (randZeroOne() * 4.0f) + 2.0f;
|
||||
vel.y = (Rand_ZeroOne() * 4.0f) + 2.0f;
|
||||
vel.z = pos.z * 0.20f;
|
||||
|
||||
pos.x += actorPos->x;
|
||||
pos.y += actorPos->y;
|
||||
pos.z += actorPos->z;
|
||||
|
||||
rand = randZeroOne();
|
||||
rand = Rand_ZeroOne();
|
||||
if (rand < 0.2f) {
|
||||
arg5 = 64;
|
||||
} else {
|
||||
arg5 = 32;
|
||||
}
|
||||
|
||||
EffectSS_SpawnShard(globalCtx,
|
||||
EffectSsKakera_Spawn(globalCtx,
|
||||
&pos,
|
||||
&vel,
|
||||
actorPos,
|
||||
-0xAA,
|
||||
arg5,
|
||||
0x32, 5, 0,
|
||||
((randZeroOne() * 85.0f) + 15.0f),
|
||||
((Rand_ZeroOne() * 85.0f) + 15.0f),
|
||||
0, 0, 0x46,
|
||||
-1,
|
||||
GAMEPLAY_DANGEON_KEEP,
|
||||
|
||||
@@ -44,7 +44,7 @@ void ObjDinner_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
func_8012C28C(gfxCtx);
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, SysMatrix_AppendStateToPolyOpaDisp(globalCtx->state.gfxCtx),
|
||||
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
gSPDisplayList(gfxCtx->polyOpa.p++, D_060011E0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user