Merge branch 'master' into banjo-kazooie-var_renames

This commit is contained in:
Banjo Kazooie
2024-09-01 15:31:34 -05:00
402 changed files with 8000 additions and 7857 deletions

View File

@@ -51,7 +51,7 @@ void __n_seqpReleaseVoice(ALSeqPlayer *seqp, ALVoice *voice, ALMicroTime deltaT
* 1 Fine Tuning
* 2 Coarse Tuning
*/
void func_8025D7C0(ALCSPlayer *seqp);
void __n_CSPPostNextSeqEvent(ALCSPlayer *seqp);
static ALMicroTime __n_CSPVoiceHandler(void *node);
static void __CSPHandleNextSeqEvent(ALCSPlayer *seqp);
@@ -232,7 +232,7 @@ static ALMicroTime __n_CSPVoiceHandler(void *node)
{
seqp->state = AL_PLAYING;
func_80250650();
func_8025D7C0(seqp); /* seqp must be AL_PLAYING before we call this routine. */
__n_CSPPostNextSeqEvent(seqp); /* seqp must be AL_PLAYING before we call this routine. */
}
break;
@@ -344,7 +344,7 @@ static ALMicroTime __n_CSPVoiceHandler(void *node)
is no target sequence.
sct 11/7/95
*/
void func_8025D7C0(ALCSPlayer *seqp)
void __n_CSPPostNextSeqEvent(ALCSPlayer *seqp)
{
ALEvent evt;
s32 deltaTicks;
@@ -383,12 +383,12 @@ __CSPHandleNextSeqEvent(ALCSPlayer *seqp)
{
case AL_SEQ_MIDI_EVT:
__n_CSPHandleMIDIMsg(seqp, &evt);
func_8025D7C0(seqp);
__n_CSPPostNextSeqEvent(seqp);
break;
case AL_TEMPO_EVT:
__CSPHandleMetaMsg(seqp, &evt);
func_8025D7C0(seqp);
__n_CSPPostNextSeqEvent(seqp);
break;
case AL_SEQ_END_EVT:
@@ -400,7 +400,7 @@ __CSPHandleNextSeqEvent(ALCSPlayer *seqp)
case AL_TRACK_END:
case AL_CSP_LOOPSTART:
case AL_CSP_LOOPEND:
func_8025D7C0(seqp);
__n_CSPPostNextSeqEvent(seqp);
break;
default:

View File

@@ -129,18 +129,12 @@ void func_8023DCF4(void){
D_80275618--;
}
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_0/mainLoop.s")
#else
void mainLoop(void){
s32 x;
s32 y;
s32 r;
s32 g;
s32 b;
s32 x, y;
s32 r, g, b, a;
u16 tmp;
u16 rgba;
s32 offset;
if((func_8023DB5C() & 0x7f) == 0x11)
sns_write_payload_over_heap();
@@ -150,7 +144,7 @@ void mainLoop(void){
func_8023DCDC();
if(!D_8027BEEC)
func_8024E7C8();
pfsManager_update();
D_8027BEEC = 0;
rumbleManager_80250C08();
@@ -182,23 +176,24 @@ void mainLoop(void){
){
s32 offset;
//render weird CRC failure image
for(x= 0x1e; x< framebuffer_height - 0x1e; x++){//L8023DEB4
g = x >> 3;
for(y = 0x14; y < 0xeb; y++){
b = ((func_8023DB5C() << 3) + y*y + x*x) >> 3;
r = y >> 3;
rgba = _SHIFTL(b, 1, 5);
rgba |= _SHIFTL(r, 11, 5 );
rgba |= _SHIFTL(g, 6, 5);
rgba |= _SHIFTL(1, 0, 1 );
offset = ((framebuffer_width - 0xff)/2 + y + x*framebuffer_width);
D_803A5D00[0][offset] = rgba;
D_803A5D00[1][offset] = rgba;
for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4
for(x = 0x14; x < 0xeb; x++){
tmp = ((8 * func_8023DB5C()) + ((x*x) + (y*y)));
r = _SHIFTL(x>>3, 11, 5);
g = _SHIFTL(y>>3, 6, 5);
b = _SHIFTL(tmp>>3, 1, 5);
a = 1;
rgba = b | r | g | a;
offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width);
D_803A5D00[0][offset] = (s32) rgba;
D_803A5D00[1][offset] = (s32) rgba;
}
}
}//L8023DF70
}
#endif
void __mainMethod(void *arg0){
core1_init();

View File

@@ -2,12 +2,7 @@
#include "functions.h"
#include "variables.h"
#ifndef CORE2_DATA_CRC2
#define CORE2_DATA_CRC2 0
#endif
extern s32 core2_D_803727F4;
extern s32 D_803727F4;
extern struct {
u8 pad0[4];
@@ -26,14 +21,13 @@ typedef struct {
typedef struct {
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6;
f32 unk8;
f32 unkC;
u16 unk4;
u16 unk6;
f32 unk8[2];
f32 joystick[2];
}Struct_core1_10A00_1;
extern s32 D_80276574; // = CORE2_DATA_CRC2
extern s32 D_80276574;
/* .data */
s32 D_80275D30 = 0xC3A68832; //WHAT IS THIS?
@@ -74,7 +68,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) {
f32 phi_f2;
phi_f2 = 0.0125f;
if ((D_80379B90.unk4 != core2_D_803727F4) || (D_80379B90.unkC != D_80276574)) {
if ((D_80379B90.unk4 != D_803727F4) || (D_80379B90.unkC != D_80276574)) {
phi_f2 = 0.00625f;
}
if (arg0 > 0) {
@@ -157,145 +151,130 @@ void func_8024E71C(s32 controller_index, f32 dst[2]){
}
}
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_10A00/func_8024E7C8.s")
#else
void func_8024E7C8(void){
s32 i, j;
s32 sp5C;
void pfsManager_update(void) {
int j;
int i;
u32 sp5C;
u32 s0;
s32 temp_t6;
u16 temp_v0_3;
if(func_8023E000() == 3)
u32 temp_t6;
u32 temp_v0_3;
u32 var_a2;
if (func_8023E000() == 3) {
func_802E4384();
osSetThreadPri(NULL, 0x29);
}
osSetThreadPri(0, 0x29);
D_802812D0.stick_x = pfsManagerContPadData[0].stick_x;
D_802812D0.stick_y = pfsManagerContPadData[0].stick_y;
D_802812D0.button = pfsManagerContPadData[0].button;
if( getGameMode() == GAME_MODE_6_FILE_PLAYBACK
|| getGameMode() == GAME_MODE_7_ATTRACT_DEMO
|| getGameMode() == GAME_MODE_8_BOTTLES_BONUS
|| getGameMode() == GAME_MODE_A_SNS_PICTURE
|| getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE
){
s0 = START_BUTTON;
if(gctransition_8030BD98()){
if ((getGameMode() == GAME_MODE_6_FILE_PLAYBACK)
|| (getGameMode() == GAME_MODE_7_ATTRACT_DEMO)
|| (getGameMode() == GAME_MODE_8_BOTTLES_BONUS)
|| (getGameMode() == GAME_MODE_A_SNS_PICTURE)
|| (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE)
) {
s0 = 0x1000;
if (gctransition_done()) {
D_802816E0 += time_getDelta();
}
if(D_802816E0 < 1.0 || getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){
if ((D_802816E0 < 1.0) || (getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE)) {
s0 = 0;
}
temp_t6 = demo_readInput(&pfsManagerContPadData, &sp5C) == 0;
if(D_802812D0.button & s0 || temp_t6){
if(D_802812D0.button & s0){
if ((D_802812D0.button & s0) || temp_t6) {
if (D_802812D0.button & s0) {
func_803204E4(0x64, 1);
}
else{
} else {
func_803204E4(0x63, 1);
}
}//L8024E944
}
func_8033DD04(sp5C);
}//L8024E94C
}
sp5C = func_8033DD90();
randf();
// var_s0_2 = &D_80281250;
// var_s1 = &pfsManagerContPadData
for(i = 0; i < 4; i++){
// temp_t5 = var_s1->unk0;
// temp_t1 = temp_t5 & 0x20;
for (i = 0; i < 4; i++) {
if ((pfsManagerContPadData[i].button & 0x20) && (pfsManagerContPadData[i].button & 0x10)) {
D_802810E0[i][0] = (pfsManagerContPadData[i].button & 0x0004) ? D_802810E0[i][0] + 1 : 0;
D_802810E0[i][1] = (pfsManagerContPadData[i].button & 0x2000) ? D_802810E0[i][1] + 1 : 0;
D_802810E0[i][2] = (pfsManagerContPadData[i].button & 0x8000) ? D_802810E0[i][2] + 1 : 0;
D_802810E0[i][3] = (pfsManagerContPadData[i].button & 0x4000) ? D_802810E0[i][3] + 1 : 0;
D_802810E0[i][4] = (D_802812D0.button & 0x4000) ? D_802810E0[i][4] + 1 : 0;
for(j = 0; j < 0xE; j++){
((s32*)&D_80281138[i])[j] = 0;
D_802810E0[i][0] = (pfsManagerContPadData[i].button & 0x0004) ? (D_802810E0[i][0] + 1) : (0);
D_802810E0[i][1] = (pfsManagerContPadData[i].button & 0x2000) ? (D_802810E0[i][1] + 1) : (0);
D_802810E0[i][2] = (pfsManagerContPadData[i].button & 0x8000) ? (D_802810E0[i][2] + 1) : (0);
D_802810E0[i][3] = (pfsManagerContPadData[i].button & 0x4000) ? (D_802810E0[i][3] + 1) : (0);
D_802810E0[i][4] = (D_802812D0.button & 0x4000) ? (D_802810E0[i][4] + 1) : (0);
for (j = 0; j < 0xE; j++)
{
((s32 *) (&D_80281138[i]))[j] = 0;
}
for(j = 0; (j < 0xE) && (i == 0); j++){
((s32*)&D_80281218)[j] = 0;
for (j = 0; (j < 0xE) && (i == 0); j++)
{
((s32 *) (&D_80281218))[j] = 0;
}
D_80281250[i].unk0 = 0;
D_80281250[i].unk2 = 0;
D_80281250[i].unk4 = 0;
D_80281250[i].unk6 = 0;
D_80281250[i].joystick[0] = 0.0f;
D_80281250[i].joystick[1] = 0.0f;
D_80281250[i].unk8 = 0.0f;
D_80281250[i].unkC = 0.0f;
} else {
// temp_a0 = (i * 0x14) + &D_802810E0;
// temp_a1 = (i * 0x38) + &D_80281138;
// temp_t4 = (i * 4) + &D_80281308;
for(j = 0; j < 5; j++){
D_802810E0[i][j] = 0;
}
D_80281138[i].face_button[0] = (pfsManagerContPadData[i].button & 0x8000) ? D_80281138[i].face_button[0] + 1 : 0;
D_80281138[i].face_button[1] = (pfsManagerContPadData[i].button & 0x4000) ? D_80281138[i].face_button[1] + 1 : 0;
D_80281138[i].face_button[2] = (pfsManagerContPadData[i].button & 0x0002) ? D_80281138[i].face_button[2] + 1 : 0;
D_80281138[i].face_button[3] = (pfsManagerContPadData[i].button & 0x0004) ? D_80281138[i].face_button[3] + 1 : 0;
D_80281138[i].face_button[4] = (pfsManagerContPadData[i].button & 0x0008) ? D_80281138[i].face_button[4] + 1 : 0;
D_80281138[i].face_button[5] = (pfsManagerContPadData[i].button & 0x0001) ? D_80281138[i].face_button[5] + 1 : 0;
D_80281138[i].side_button[0] = (pfsManagerContPadData[i].button & 0x2000) ? D_80281138[i].side_button[0] + 1 : 0;
D_80281138[i].side_button[1] = (pfsManagerContPadData[i].button & 0x0020) ? D_80281138[i].side_button[1] + 1 : 0;
D_80281138[i].side_button[2] = (pfsManagerContPadData[i].button & 0x0010) ? D_80281138[i].side_button[2] + 1 : 0;
D_80281138[i].unk24[0] = (pfsManagerContPadData[i].button & 0x0800) ? D_80281138[i].unk24[0] + 1 : 0;
D_80281138[i].unk24[1] = (pfsManagerContPadData[i].button & 0x0400) ? D_80281138[i].unk24[1] + 1 : 0;
D_80281138[i].unk24[2] = (pfsManagerContPadData[i].button & 0x0200) ? D_80281138[i].unk24[2] + 1 : 0;
D_80281138[i].unk24[3] = (pfsManagerContPadData[i].button & 0x0100) ? D_80281138[i].unk24[3] + 1 : 0;
D_80281138[i].start_button = (pfsManagerContPadData[i].button & 0x1000) ? D_80281138[i].start_button + 1 : 0;
if(i == 0){
D_80281218.face_button[0] = (D_802812D0.button & 0x8000) ? D_80281218.face_button[0] + 1 : 0;
D_80281218.face_button[1] = (D_802812D0.button & 0x4000) ? D_80281218.face_button[1] + 1 : 0;
D_80281218.face_button[2] = (D_802812D0.button & 0x0002) ? D_80281218.face_button[2] + 1 : 0;
D_80281218.face_button[3] = (D_802812D0.button & 0x0004) ? D_80281218.face_button[3] + 1 : 0;
D_80281218.face_button[4] = (D_802812D0.button & 0x0008) ? D_80281218.face_button[4] + 1 : 0;
D_80281218.face_button[5] = (D_802812D0.button & 0x0001) ? D_80281218.face_button[5] + 1 : 0;
D_80281218.side_button[0] = (D_802812D0.button & 0x2000) ? D_80281218.side_button[0] + 1 : 0;
D_80281218.side_button[1] = (D_802812D0.button & 0x0020) ? D_80281218.side_button[1] + 1 : 0;
D_80281218.side_button[2] = (D_802812D0.button & 0x0010) ? D_80281218.side_button[2] + 1 : 0;
D_80281218.unk24[0] = (D_802812D0.button & 0x0800) ? D_80281218.unk24[0] + 1 : 0;
D_80281218.unk24[1] = (D_802812D0.button & 0x0400) ? D_80281218.unk24[1] + 1 : 0;
D_80281218.unk24[2] = (D_802812D0.button & 0x0200) ? D_80281218.unk24[2] + 1 : 0;
D_80281218.unk24[3] = (D_802812D0.button & 0x0100) ? D_80281218.unk24[3] + 1 : 0;
D_80281218.start_button = (D_802812D0.button & 0x1000) ? D_80281218.start_button + 1 : 0;
}
temp_v0_3 = D_80281250[i].unk0;
D_80281250[i].unk0 = D_802812D0.button;
D_80281250[i].unk4 = ~temp_v0_3 & D_802812D0.button; //pressed buttons
D_80281250[i].unk6 = ~D_802812D0.button & temp_v0_3; //unpressed buttons
D_80281250[i].unk2 = temp_v0_3; //previous buttons
D_80281250[i].unk8 = D_80281250[i].joystick[0];
D_80281250[i].unkC = D_80281250[i].joystick[1];
D_80281250[i].joystick[0] = func_8024E420(pfsManagerContPadData[i].stick_x, 7, 0x3B);
D_80281250[i].joystick[1] = func_8024E420(pfsManagerContPadData[i].stick_y, 7, 0x3D);
D_80281308[i] = ((D_80281250[i].unk4 != 0)
|| (D_80281250[i].unk8 != D_80281250[i].joystick[0])
|| (D_80281250[i].unkC != D_80281250[i].joystick[1])
) ? 0.0f : D_80281308[i] + time_getDelta();
D_80281250[i].unk8[0] = 0.0f;
D_80281250[i].unk8[1] = 0.0f;
continue;
}
for (j = 0; j < 5; j++) {
D_802810E0[i][j] = 0;
}
D_80281138[i].face_button[0] = (pfsManagerContPadData[i].button & 0x8000) ? (D_80281138[i].face_button[0] + 1) : (0);
D_80281138[i].face_button[1] = (pfsManagerContPadData[i].button & 0x4000) ? (D_80281138[i].face_button[1] + 1) : (0);
D_80281138[i].face_button[2] = (pfsManagerContPadData[i].button & 0x0002) ? (D_80281138[i].face_button[2] + 1) : (0);
D_80281138[i].face_button[3] = (pfsManagerContPadData[i].button & 0x0004) ? (D_80281138[i].face_button[3] + 1) : (0);
D_80281138[i].face_button[4] = (pfsManagerContPadData[i].button & 0x0008) ? (D_80281138[i].face_button[4] + 1) : (0);
D_80281138[i].face_button[5] = (pfsManagerContPadData[i].button & 0x0001) ? (D_80281138[i].face_button[5] + 1) : (0);
D_80281138[i].side_button[0] = (pfsManagerContPadData[i].button & 0x2000) ? (D_80281138[i].side_button[0] + 1) : (0);
D_80281138[i].side_button[1] = (pfsManagerContPadData[i].button & 0x0020) ? (D_80281138[i].side_button[1] + 1) : (0);
D_80281138[i].side_button[2] = (pfsManagerContPadData[i].button & 0x0010) ? (D_80281138[i].side_button[2] + 1) : (0);
D_80281138[i].unk24[0] = (pfsManagerContPadData[i].button & 0x0800) ? (D_80281138[i].unk24[0] + 1) : (0);
D_80281138[i].unk24[1] = (pfsManagerContPadData[i].button & 0x0400) ? (D_80281138[i].unk24[1] + 1) : (0);
D_80281138[i].unk24[2] = (pfsManagerContPadData[i].button & 0x0200) ? (D_80281138[i].unk24[2] + 1) : (0);
D_80281138[i].unk24[3] = (pfsManagerContPadData[i].button & 0x0100) ? (D_80281138[i].unk24[3] + 1) : (0);
D_80281138[i].start_button = (pfsManagerContPadData[i].button & 0x1000) ? (D_80281138[i].start_button + 1) : (0);
if (i == 0) {
D_80281218.face_button[0] = (D_802812D0.button & 0x8000) ? (D_80281218.face_button[0] + 1) : (0);
D_80281218.face_button[1] = (D_802812D0.button & 0x4000) ? (D_80281218.face_button[1] + 1) : (0);
D_80281218.face_button[2] = (D_802812D0.button & 0x0002) ? (D_80281218.face_button[2] + 1) : (0);
D_80281218.face_button[3] = (D_802812D0.button & 0x0004) ? (D_80281218.face_button[3] + 1) : (0);
D_80281218.face_button[4] = (D_802812D0.button & 0x0008) ? (D_80281218.face_button[4] + 1) : (0);
D_80281218.face_button[5] = (D_802812D0.button & 0x0001) ? (D_80281218.face_button[5] + 1) : (0);
D_80281218.side_button[0] = (D_802812D0.button & 0x2000) ? (D_80281218.side_button[0] + 1) : (0);
D_80281218.side_button[1] = (D_802812D0.button & 0x0020) ? (D_80281218.side_button[1] + 1) : (0);
D_80281218.side_button[2] = (D_802812D0.button & 0x0010) ? (D_80281218.side_button[2] + 1) : (0);
D_80281218.unk24[0] = (D_802812D0.button & 0x0800) ? (D_80281218.unk24[0] + 1) : (0);
D_80281218.unk24[1] = (D_802812D0.button & 0x0400) ? (D_80281218.unk24[1] + 1) : (0);
D_80281218.unk24[2] = (D_802812D0.button & 0x0200) ? (D_80281218.unk24[2] + 1) : (0);
D_80281218.unk24[3] = (D_802812D0.button & 0x0100) ? (D_80281218.unk24[3] + 1) : (0);
D_80281218.start_button = (D_802812D0.button & 0x1000) ? ((u64)D_80281218.start_button + 1) : (0);
}
temp_v0_3 = (u16)D_80281250[i].unk0;
var_a2 = (u16)pfsManagerContPadData[i].button;
D_80281250[i].unk0 = var_a2;
D_80281250[i].unk2 = temp_v0_3;
D_80281250[i].unk4 = (~temp_v0_3) & var_a2;
D_80281250[i].unk6 = temp_v0_3 & (~var_a2);
D_80281250[i].unk8[0] = D_80281250[i].joystick[0];
D_80281250[i].unk8[1] = D_80281250[i].joystick[1];
D_80281250[i].joystick[0] = func_8024E420(pfsManagerContPadData[i].stick_x, 7, 0x3B);
D_80281250[i].joystick[1] = func_8024E420(pfsManagerContPadData[i].stick_y, 7, 0x3D);
if ((D_80281250[i].unk4 != 0)
|| (D_80281250[i].unk8[0] != D_80281250[i].joystick[0])
|| (D_80281250[i].unk8[1] != D_80281250[i].joystick[1])
) {
D_80281308[i] = 0.0f;
} else {
D_80281308[i] += time_getDelta();
}
}
osSetThreadPri(NULL, 0x14);
osSetThreadPri(0, 0x14);
}
#endif
void pfsManager_readData(){
func_8024F35C(0);
@@ -351,12 +330,16 @@ void pfsManager_getStartReadData(void){
void func_8024F1F0(void){
osRecvMesg(&pfsManagerContPollingMsqQ, NULL, 1);
func_8024E7C8();
pfsManager_update();
}
void func_8024F224(void){
s32 iCont, j;
// for(iCont = 0; iCont < 4; iCont++){
// D_80281250[iCont].unk0 = 0;
// }
for(iCont = 0; iCont < 4; iCont++){
D_80281250[iCont].unk0 = 0;
D_80281250[iCont].unk2 = 0;
@@ -364,8 +347,8 @@ void func_8024F224(void){
D_80281250[iCont].unk6 = 0;
D_80281250[iCont].joystick[0] = 0.0f;
D_80281250[iCont].joystick[1] = 0.0f;
D_80281250[iCont].unk8 = 0.0f;
D_80281250[iCont].unkC = 0.0f;
D_80281250[iCont].unk8[0] = 0.0f;
D_80281250[iCont].unk8[1] = 0.0f;
for(j = 0; j < 5; j++){
D_802810E0[iCont][j] = 0;
}

View File

@@ -9,8 +9,9 @@ extern void func_8025F570(ALCSPlayer *, u8);
extern void func_8025F510(ALCSPlayer *, u8, u8);
extern void func_8025F5C0(ALCSPlayer *, u8);
extern ALBankFile D_EA3EB0;
extern ALWaveTable D_EADE60;
extern u8 soundfont2ctl_ROM_START[];
extern u8 soundfont2ctl_ROM_END[];
extern u8 soundfont2tbl_ROM_START[];
/* dependent functions */
void func_8024FA98(u8, enum comusic_e);
@@ -220,10 +221,10 @@ void musicInstruments_init(void){
s32 i;
f32 tmpf1;
size = (u8*)&D_EADE60 - (u8*)&D_EA3EB0;
size = soundfont2ctl_ROM_END - soundfont2ctl_ROM_START;
bnk_f = malloc(size);
osWriteBackDCacheAll();
osPiStartDma(func_802405D0(), 0, 0, &D_EA3EB0, bnk_f, size, func_802405C4());
osPiStartDma(func_802405D0(), 0, 0, (u32)soundfont2ctl_ROM_START, bnk_f, size, func_802405C4());
osRecvMesg(func_802405C4(), 0, 1); //osRecvMesg
D_80282104 = 0xAD;
D_802820E0 = (MusicTrack **) malloc(D_80282104 * sizeof(MusicTrack *));
@@ -242,7 +243,7 @@ void musicInstruments_init(void){
n_alCSPNew(&D_80281720[i].cseqp, &D_802820E8);
}
alBnkfNew(bnk_f, (u8 *)&D_EADE60);
alBnkfNew(bnk_f, soundfont2tbl_ROM_START);
D_80282108 = bnk_f->bankArray[0];
for(i = 0; i < 6; i++){
alCSPSetBank(&D_80281720[i].cseqp, D_80282108);
@@ -258,7 +259,7 @@ void musicInstruments_init(void){
func_8024FB8C();
}
ALBank *func_8024F758(void){
ALBank *music_get_sound_bank(void){
return D_80282108;
}

View File

@@ -4,13 +4,12 @@
#include "ml/mtx.h"
void func_8024632C(Mtx*, f32, f32, f32, f32);
void _guRotateF(Mtx*, f32, f32, f32, f32);
f32 func_80263FF0(f32);
f32 cosf(f32);
#ifndef CORE2_DATA_CRC2
#define CORE2_DATA_CRC2 0
#define CORE2_DATA_CRC2 0x84D7B4F8
#endif
s32 D_80276570 = 0xFF62C2B8; //WHAT IS THIS?
@@ -21,53 +20,50 @@ f32 D_8027657C = BAD_DTOR;
/*.bss*/
Mtx_t D_80282810;
u8 pad_D_80282850[0x780];
Mtx * D_80282FD0;
Mtx * s_mtx_stack;
/*.code*/
void mlMtxGet(f32 *arg0) {
s32 var_v0, j;
/**
* @brief copies the top of the matrix stack to the destination address
*
* @param dst
*/
void mlMtxGet(f32 *dst) {
s32 row, col;
for(var_v0 = 0; var_v0 < 4; var_v0++){
for(j = 0; j < 4; j++){
*(arg0++) = reinterpret_cast(f32, D_80282FD0->m[var_v0][j]);
for(row = 0; row < 4; row++){
for(col = 0; col < 4; col++){
*(dst++) = reinterpret_cast(f32, s_mtx_stack->m[row][col]);
}
}
}
Mtx *func_80251488(void){
return D_80282FD0;
Mtx *mlMtx_get_stack_pointer(void){
return s_mtx_stack;
}
void mlMtxApply(Mtx *mPtr){
func_80245A7C(D_80282FD0, mPtr);
_guMtxF2L(s_mtx_stack, mPtr);
}
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802514BC.s")
#else
void func_802514BC(Mtx *arg0) {
s32 i, j, k;
f32 tmp;
f32 sp38[4][4];
f32 (*sp34)[4];
f32 (*var_s0)[4];
void func_802514BC(Mtx* arg0) {
s32 row;
s32 col;
s32 i;
f32 sum;
f32 prod[4][4];
sp34 = reinterpret_cast(f32 *, *D_80282FD0);
var_s0 = reinterpret_cast(f32 *, arg0);
for(i = 0; i < 4; i++){
for(j = 0; j < 4; j++){
tmp = 0.0f;
for(k = 0; k < 4; k++){
tmp += var_s0[i][k] * sp34[k][j];
for(row = 0; row < 4; row++, arg0 = &arg0->m[1][0]) {
for(col = 0; col < 4; col++) {
sum = 0.0;
for(i = 0; i < 4; i++) {
sum += reinterpret_cast(f32, arg0->m[0][i]) * reinterpret_cast(f32, s_mtx_stack->m[i][col]);
}
sp38[i][j] = tmp;
prod[row][col] = sum;
}
}
func_80253010(sp34, &sp38, sizeof(Mtx));
func_80253010(s_mtx_stack, prod, sizeof(Mtx));
}
#endif
void func_802515D4(f32 arg0[3][3]) {
f32 var_f0;
@@ -80,7 +76,7 @@ void func_802515D4(f32 arg0[3][3]) {
for(var_v1 = 0; var_v1 < 3; var_v1++){
var_f0 = 0.0f;
for(var_v0 = 0; var_v0 < 3; var_v0++){
var_f0 += arg0[i][var_v0] * reinterpret_cast(f32, D_80282FD0->m[var_v0][var_v1]);
var_f0 += arg0[i][var_v0] * reinterpret_cast(f32, s_mtx_stack->m[var_v0][var_v1]);
}
sp1C[i][var_v1] = var_f0;
}
@@ -89,7 +85,7 @@ void func_802515D4(f32 arg0[3][3]) {
for( i = 0; i < 3; i++){
for(var_v1 = 0; var_v1 < 3; var_v1++){
reinterpret_cast(f32, D_80282FD0->m[i][var_v1]) = sp1C[i][var_v1];
reinterpret_cast(f32, s_mtx_stack->m[i][var_v1]) = sp1C[i][var_v1];
}
}
@@ -97,25 +93,34 @@ void func_802515D4(f32 arg0[3][3]) {
void mlMtxPop(void){
D_80282FD0--;
s_mtx_stack--;
}
void func_802516E0(void) {
/**
* @brief pushes a copy of the current matrix on the top matrix stack to the top of
* the matrix stack.
*
*/
void mlMtx_push_duplicate(void) {
s32 i, j;
f32 *var_a3;
f32 *var_a2;
var_a2 = D_80282FD0 + 1;
var_a3 = D_80282FD0;
var_a2 = s_mtx_stack + 1;
var_a3 = s_mtx_stack;
for(i = 0; i < 16; i++) {
var_a2[i] = var_a3[i];
}
D_80282FD0++;
s_mtx_stack++;
}
void func_80251738(void){
/**
* @brief pushes the identity matrix to the top of the matrix stack.
*
*/
void mlMtx_push_identity(void){
s32 i;
f32 *v0 = ++D_80282FD0;
f32 *v0 = ++s_mtx_stack;
for(i = 0; i<3; i++){
v0[0] = 1.0f;
v0[1] = 0.0f;
@@ -127,48 +132,93 @@ void func_80251738(void){
v0[0] = 1.0f;
}
f32 *func_80251788(f32 arg0, f32 arg1, f32 arg2){
f32 * var_v0 = ++D_80282FD0;
/**
* @brief Pushes a translation matrix to the top of the matrix stack.
*
* @param x
* @param y
* @param z
* @return f32*
*/
f32 *mlMtx_push_translation(f32 x, f32 y, f32 z){
f32 * var_v0 = ++s_mtx_stack;
*(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f;
*(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f;
*(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f;
*(var_v0++) = arg0; *(var_v0++) = arg1; *(var_v0++) = arg2; *(var_v0++) = 1.0f;
*(var_v0++) = x; *(var_v0++) = y; *(var_v0++) = z; *(var_v0++) = 1.0f;
}
void func_802517F8(f32* arg0) {
/**
* @brief Pushes a copy of a matrix to the top of the matrix stack.
*
* @param mtx
*/
void mlMtx_push_mtx(f32* mtx) {
s32 var_v0, j;
D_80282FD0++;
s_mtx_stack++;
for(var_v0 = 0; var_v0 < 4; var_v0++){
for(j = 0; j < 4; j++){
reinterpret_cast(f32, D_80282FD0->m[var_v0][j]) = *arg0++;
reinterpret_cast(f32, s_mtx_stack->m[var_v0][j]) = *mtx++;
}
}
}
void func_80251878(f32* arg0) {
/**
* @brief Pushes a copy of the a matrix multiplied with the matrix at the top
* of the matrix stack onto the top of the matrix stack.
*
* @param l_mtx
*/
void mlMtx_push_multiplied(f32* l_mtx) {
s32 i;
s32 j;
Mtx* var_a2;
var_a2 = D_80282FD0 + 1;
for(i = 0; i < 4; i++, arg0 += 4){
var_a2 = s_mtx_stack + 1;
for(i = 0; i < 4; i++, l_mtx += 4){
for(j = 0; j < 4; j++){
reinterpret_cast(f32, var_a2->m[i][j]) = arg0[0] * reinterpret_cast(f32, D_80282FD0->m[0][j])
+ arg0[1] * reinterpret_cast(f32, D_80282FD0->m[1][j])
+ arg0[2] * reinterpret_cast(f32, D_80282FD0->m[2][j])
+ arg0[3] * reinterpret_cast(f32, D_80282FD0->m[3][j]);
reinterpret_cast(f32, var_a2->m[i][j]) = l_mtx[0] * reinterpret_cast(f32, s_mtx_stack->m[0][j])
+ l_mtx[1] * reinterpret_cast(f32, s_mtx_stack->m[1][j])
+ l_mtx[2] * reinterpret_cast(f32, s_mtx_stack->m[2][j])
+ l_mtx[3] * reinterpret_cast(f32, s_mtx_stack->m[3][j]);
}
}
D_80282FD0 = var_a2;
s_mtx_stack = var_a2;
}
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_13990/func_802519C8.s")
/**
* @brief Pushes a copy of the a matrix multiplied with another matrix onto the
* top of the matrix stack.
*
* @param l_mtx
* @param r_mtx
*/
void mlMtx_push_multiplied_2(Mtx * l_mtx, Mtx * r_mtx) {
s32 row;
s32 col;
Mtx * dst = (s_mtx_stack + 1);
for (row = 0; row < 4; row++, r_mtx = &r_mtx->m[1][0])
{
for (col = 0; col < 4; col++)
{
reinterpret_cast(f32, dst->m[row][col]) =
(
reinterpret_cast(f32, r_mtx->m[0][0]) * reinterpret_cast(f32, l_mtx->m[0][col]) +
reinterpret_cast(f32, r_mtx->m[0][1]) * reinterpret_cast(f32, l_mtx->m[1][col]) +
reinterpret_cast(f32, r_mtx->m[0][2]) * reinterpret_cast(f32, l_mtx->m[2][col]) +
reinterpret_cast(f32, r_mtx->m[0][3]) * reinterpret_cast(f32, l_mtx->m[3][col])
);
}
}
s_mtx_stack = (dst + 0);
}
//mlMtx
void mlMtxIdent(void){
s32 i;
f32 *v0 = D_80282FD0 = &D_80282810;
f32 *v0 = s_mtx_stack = &D_80282810;
for(i = 0; i<3; i++){
v0[0] = 1.0f;
v0[1] = 0.0f;
@@ -180,19 +230,19 @@ void mlMtxIdent(void){
v0[0] = 1.0f;
}
void func_80251B5C(f32 arg0, f32 arg1, f32 arg2){
f32 * var_v0 = D_80282FD0 = &D_80282810;
void func_80251B5C(f32 x, f32 y, f32 z){
f32 * var_v0 = s_mtx_stack = &D_80282810;
*(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f;
*(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f; *(var_v0++) = 0.0f;
*(var_v0++) = 0.0f; *(var_v0++) = 0.0f; *(var_v0++) = 1.0f; *(var_v0++) = 0.0f;
*(var_v0++) = arg0; *(var_v0++) = arg1; *(var_v0++) = arg2; *(var_v0++) = 1.0f;
*(var_v0++) = x; *(var_v0++) = y; *(var_v0++) = z; *(var_v0++) = 1.0f;
}
void mlMtxSet(Mtx* arg0) {
s32 i, j;
f32 *v0;
v0 = D_80282FD0 = &D_80282810;
v0 = s_mtx_stack = &D_80282810;
for(i = 0; i < 4*4; i+=4){
for(j = 0; j < 4; j++){
*(v0++) = *(((f32*)arg0)++);
@@ -200,9 +250,9 @@ void mlMtxSet(Mtx* arg0) {
}
}
void func_80251C20(f32 arg0, f32 arg1, f32 arg2, f32 arg3) {
func_8024632C(D_80282FD0 + 1, arg0, arg1, arg2, arg3);
func_80245DCC(D_80282FD0 + 1, D_80282FD0, D_80282FD0);
void mlMtxRotate(f32 a, f32 x, f32 y, f32 z) {
_guRotateF(s_mtx_stack + 1, a, x, y, z);
guMtxCatF(s_mtx_stack + 1, s_mtx_stack, s_mtx_stack);
}
void mlMtxRotPitch(f32 arg0) {
@@ -215,20 +265,20 @@ void mlMtxRotPitch(f32 arg0) {
arg0 *= D_80276578;
sin = sinf(arg0);
cos = cosf(arg0);
var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][0]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][0]);
reinterpret_cast(f32, D_80282FD0->m[1][0]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][0]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][0]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][0]);
reinterpret_cast(f32, s_mtx_stack->m[1][0]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][0]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][1]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][1]);
reinterpret_cast(f32, D_80282FD0->m[1][1]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][1]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][1]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][1]);
reinterpret_cast(f32, s_mtx_stack->m[1][1]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][1]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][2]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][2]);
reinterpret_cast(f32, D_80282FD0->m[1][2]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][2]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][2]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][2]);
reinterpret_cast(f32, s_mtx_stack->m[1][2]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][2]) = var_f18*-sin + var_f10*cos;
}
}
@@ -244,10 +294,10 @@ void mlMtxRotYaw(f32 arg0) {
sin = sinf(arg0);
cos = cosf(arg0);
for(i = 0; i < 3; i++){
var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][i]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]);
reinterpret_cast(f32, D_80282FD0->m[0][i]) = var_f18*cos - var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][i]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]);
reinterpret_cast(f32, s_mtx_stack->m[0][i]) = var_f18*cos - var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*sin + var_f10*cos;
}
}
}
@@ -262,25 +312,25 @@ void mlMtxRotRoll(f32 arg0) {
arg0 *= D_8027657C;
sin = sinf(arg0);
cos = cosf(arg0);
var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][0]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][0]);
reinterpret_cast(f32, D_80282FD0->m[0][0]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[1][0]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][0]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][0]);
reinterpret_cast(f32, s_mtx_stack->m[0][0]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[1][0]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][1]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][1]);
reinterpret_cast(f32, D_80282FD0->m[0][1]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[1][1]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][1]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][1]);
reinterpret_cast(f32, s_mtx_stack->m[0][1]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[1][1]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][2]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[1][2]);
reinterpret_cast(f32, D_80282FD0->m[0][2]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[1][2]) = var_f18*-sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][2]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[1][2]);
reinterpret_cast(f32, s_mtx_stack->m[0][2]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[1][2]) = var_f18*-sin + var_f10*cos;
}
}
void func_80251F8C(f32 arg0) {
void mlMtx_rotate_pitch_deg(f32 arg0) {
f32 cos;
f32 sin;
f32 var_f10;
@@ -292,15 +342,15 @@ void func_80251F8C(f32 arg0) {
sin = sinf(arg0);
cos = cosf(arg0);
for(i = 0; i < 3; i++){
var_f18 = reinterpret_cast(f32, D_80282FD0->m[1][i]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]);
reinterpret_cast(f32, D_80282FD0->m[1][i]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*-sin +var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[1][i]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]);
reinterpret_cast(f32, s_mtx_stack->m[1][i]) = var_f18*cos + var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*-sin +var_f10*cos;
}
}
}
void func_8025208C(f32 arg0) {
void mlMtx_rotate_yaw_deg(f32 arg0) {
f32 cos;
f32 sin;
f32 var_f10;
@@ -312,16 +362,16 @@ void func_8025208C(f32 arg0) {
sin = sinf(arg0);
cos = cosf(arg0);
for(i = 0; i < 3; i++){
var_f18 = reinterpret_cast(f32, D_80282FD0->m[0][i]);
var_f10 = reinterpret_cast(f32, D_80282FD0->m[2][i]);
reinterpret_cast(f32, D_80282FD0->m[0][i]) = var_f18*cos - var_f10*sin;
reinterpret_cast(f32, D_80282FD0->m[2][i]) = var_f18*sin + var_f10*cos;
var_f18 = reinterpret_cast(f32, s_mtx_stack->m[0][i]);
var_f10 = reinterpret_cast(f32, s_mtx_stack->m[2][i]);
reinterpret_cast(f32, s_mtx_stack->m[0][i]) = var_f18*cos - var_f10*sin;
reinterpret_cast(f32, s_mtx_stack->m[2][i]) = var_f18*sin + var_f10*cos;
}
}
}
void mlMtxRotate(f32 pitch, f32 yaw, f32 roll){
void mlMtxRotatePYR(f32 pitch, f32 yaw, f32 roll){
mlMtxRotYaw(yaw);
mlMtxRotPitch(pitch);
mlMtxRotRoll(roll);
@@ -330,25 +380,25 @@ void mlMtxRotate(f32 pitch, f32 yaw, f32 roll){
void mlMtxScale_xyz(f32 x, f32 y, f32 z){
int i;
for(i = 0; i < 3; i++){
reinterpret_cast(f32, D_80282FD0->m[0][i]) *= x;
reinterpret_cast(f32, D_80282FD0->m[1][i]) *= y;
reinterpret_cast(f32, D_80282FD0->m[2][i]) *= z;
reinterpret_cast(f32, s_mtx_stack->m[0][i]) *= x;
reinterpret_cast(f32, s_mtx_stack->m[1][i]) *= y;
reinterpret_cast(f32, s_mtx_stack->m[2][i]) *= z;
}
}
void mlMtxScale(f32 scale){
int i;
for(i = 0; i < 3; i++){
reinterpret_cast(f32, D_80282FD0->m[0][i]) *= scale;
reinterpret_cast(f32, D_80282FD0->m[1][i]) *= scale;
reinterpret_cast(f32, D_80282FD0->m[2][i]) *= scale;
reinterpret_cast(f32, s_mtx_stack->m[0][i]) *= scale;
reinterpret_cast(f32, s_mtx_stack->m[1][i]) *= scale;
reinterpret_cast(f32, s_mtx_stack->m[2][i]) *= scale;
}
}
void func_80252330(f32 x, f32 y, f32 z){
reinterpret_cast(f32, D_80282FD0->m[3][0]) = x;
reinterpret_cast(f32, D_80282FD0->m[3][1]) = y;
reinterpret_cast(f32, D_80282FD0->m[3][2]) = z;
reinterpret_cast(f32, s_mtx_stack->m[3][0]) = x;
reinterpret_cast(f32, s_mtx_stack->m[3][1]) = y;
reinterpret_cast(f32, s_mtx_stack->m[3][2]) = z;
}
void func_8025235C(f32 arg0[3], f32 arg1[3]) {
@@ -360,10 +410,10 @@ void func_8025235C(f32 arg0[3], f32 arg1[3]) {
sp0[2] = arg1[2];
for(i = 0; i < 3; i++){
arg0[i] = sp0[0]*reinterpret_cast(f32, D_80282FD0->m[0][i])
+ sp0[1]*reinterpret_cast(f32, D_80282FD0->m[1][i])
+ sp0[2]*reinterpret_cast(f32, D_80282FD0->m[2][i])
+ reinterpret_cast(f32, D_80282FD0->m[3][i]);
arg0[i] = sp0[0]*reinterpret_cast(f32, s_mtx_stack->m[0][i])
+ sp0[1]*reinterpret_cast(f32, s_mtx_stack->m[1][i])
+ sp0[2]*reinterpret_cast(f32, s_mtx_stack->m[2][i])
+ reinterpret_cast(f32, s_mtx_stack->m[3][i]);
}
}
@@ -371,17 +421,17 @@ void func_80252434(f32 arg0[3], f32 arg1[3]) {
s32 i;
for(i = 0; i < 3; i++){
arg0[i] = arg1[0]*reinterpret_cast(f32, D_80282FD0->m[0][i])
+ arg1[1]*reinterpret_cast(f32, D_80282FD0->m[1][i])
+ arg1[2]*reinterpret_cast(f32, D_80282FD0->m[2][i])
+ reinterpret_cast(f32, D_80282FD0->m[3][i]);
arg0[i] = arg1[0]*reinterpret_cast(f32, s_mtx_stack->m[0][i])
+ arg1[1]*reinterpret_cast(f32, s_mtx_stack->m[1][i])
+ arg1[2]*reinterpret_cast(f32, s_mtx_stack->m[2][i])
+ reinterpret_cast(f32, s_mtx_stack->m[3][i]);
}
}
void func_802524F0(f32 dst[3], f32 x, f32 y, f32 z) {
dst[0] = x*((f32 (*)[4])D_80282FD0)[0][0] + y*((f32 (*)[4])D_80282FD0)[1][0] + z*((f32 (*)[4])D_80282FD0)[2][0] + ((f32 (*)[4])D_80282FD0)[3][0];
dst[1] = x*((f32 (*)[4])D_80282FD0)[0][1] + y*((f32 (*)[4])D_80282FD0)[1][1] + z*((f32 (*)[4])D_80282FD0)[2][1] + ((f32 (*)[4])D_80282FD0)[3][1];
dst[2] = x*((f32 (*)[4])D_80282FD0)[0][2] + y*((f32 (*)[4])D_80282FD0)[1][2] + z*((f32 (*)[4])D_80282FD0)[2][2] + ((f32 (*)[4])D_80282FD0)[3][2];
void mlMtx_apply_f3(f32 dst[3], f32 x, f32 y, f32 z) {
dst[0] = x*((f32 (*)[4])s_mtx_stack)[0][0] + y*((f32 (*)[4])s_mtx_stack)[1][0] + z*((f32 (*)[4])s_mtx_stack)[2][0] + ((f32 (*)[4])s_mtx_stack)[3][0];
dst[1] = x*((f32 (*)[4])s_mtx_stack)[0][1] + y*((f32 (*)[4])s_mtx_stack)[1][1] + z*((f32 (*)[4])s_mtx_stack)[2][1] + ((f32 (*)[4])s_mtx_stack)[3][1];
dst[2] = x*((f32 (*)[4])s_mtx_stack)[0][2] + y*((f32 (*)[4])s_mtx_stack)[1][2] + z*((f32 (*)[4])s_mtx_stack)[2][2] + ((f32 (*)[4])s_mtx_stack)[3][2];
}
void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]) {
@@ -389,7 +439,7 @@ void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]) {
f32 sp0[3];
f32 (*temp_v0)[4];
temp_v0 = D_80282FD0;
temp_v0 = s_mtx_stack;
sp0[0] = (f32) src[0];
sp0[1] = (f32) src[1];
sp0[2] = (f32) src[2];
@@ -443,9 +493,9 @@ void mlMtxTranslate(f32 x, f32 y, f32 z) {
f32 phi_f10;
s32 phi_v1;
phi_v0 = D_80282FD0;
phi_v0 = s_mtx_stack;
for(phi_v1 = 0; phi_v1 < 0xC; phi_v1 +=4){
phi_v0 = (u32)D_80282FD0 + phi_v1;
phi_v0 = (u32)s_mtx_stack + phi_v1;
phi_f18 = phi_v0[0] * x;
phi_f16 = phi_v0[4] * y;
phi_v0[0xC] += phi_f18 + phi_f16 + (phi_v0[8] * z);
@@ -456,7 +506,7 @@ void func_80252A38(f32 x, f32 y, f32 z) {
s32 var_v1;
for(var_v1 = 0; var_v1 != 3; var_v1++){
reinterpret_cast(f32, D_80282FD0->m[3][var_v1]) += reinterpret_cast(f32, D_80282FD0->m[0][var_v1])*x + reinterpret_cast(f32, D_80282FD0->m[1][var_v1])*y + reinterpret_cast(f32, D_80282FD0->m[2][var_v1])*z;
reinterpret_cast(f32, s_mtx_stack->m[3][var_v1]) += reinterpret_cast(f32, s_mtx_stack->m[0][var_v1])*x + reinterpret_cast(f32, s_mtx_stack->m[1][var_v1])*y + reinterpret_cast(f32, s_mtx_stack->m[2][var_v1])*z;
}
}
@@ -506,7 +556,7 @@ void func_80252C08(f32 arg0[3], f32 rotation[3], f32 scale, f32 arg3[3]){
}
void func_80252CC4(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]){
void func_80252CC4(f32 position[3], f32 rotation[3], f32 scale, f32 arg3[3]){
if(arg3 != NULL)
mlMtxTranslate(arg3[0], arg3[1], arg3[2]);
@@ -514,62 +564,62 @@ void func_80252CC4(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]){
mlMtxScale_xyz(1.0f/scale, 1.0f/scale, 1.0f/scale);
}
if(arg1 != NULL){
mlMtxRotRoll(-arg1[2]);
mlMtxRotPitch(-arg1[0]);
mlMtxRotYaw(-arg1[1]);
if(rotation != NULL){
mlMtxRotRoll(-rotation[2]);
mlMtxRotPitch(-rotation[0]);
mlMtxRotYaw(-rotation[1]);
}
if(arg0 != NULL)
mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]);
if(position != NULL)
mlMtxTranslate(-position[0], -position[1], -position[2]);
}
void func_80252D8C(f32 arg0[3], f32 arg1[3]){
mlMtxTranslate(arg0[0], arg0[1], arg0[2]);
mlMtxRotRoll(arg1[2]);
mlMtxRotPitch(arg1[0]);
mlMtxRotYaw(arg1[1]);
void func_80252D8C(f32 position[3], f32 rotation[3]){
mlMtxTranslate(position[0], position[1], position[2]);
mlMtxRotRoll(rotation[2]);
mlMtxRotPitch(rotation[0]);
mlMtxRotYaw(rotation[1]);
}
void func_80252DDC(f32 arg0[3], f32 arg1[3]){
mlMtxRotYaw(-arg1[1]);
mlMtxRotPitch(-arg1[0]);
mlMtxRotRoll(-arg1[2]);
mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]);
void func_80252DDC(f32 position[3], f32 rotation[3]){
mlMtxRotYaw(-rotation[1]);
mlMtxRotPitch(-rotation[0]);
mlMtxRotRoll(-rotation[2]);
mlMtxTranslate(-position[0], -position[1], -position[2]);
}
void func_80252E4C(f32 arg0[3], f32 arg1[3]){
mlMtxTranslate(arg0[0], arg0[1], arg0[2]);
mlMtxRotRoll(arg1[2]);
mlMtxRotPitch(arg1[0]);
mlMtxRotYaw(arg1[1]);
mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]);
void func_80252E4C(f32 position[3], f32 rotation[3]){
mlMtxTranslate(position[0], position[1], position[2]);
mlMtxRotRoll(rotation[2]);
mlMtxRotPitch(rotation[0]);
mlMtxRotYaw(rotation[1]);
mlMtxTranslate(-position[0], -position[1], -position[2]);
}
void func_80252EC8(f32 arg0[3], f32 arg1[3]){
mlMtxTranslate(arg0[0], arg0[1], arg0[2]);
mlMtxRotYaw(-arg1[1]);
mlMtxRotPitch(-arg1[0]);
mlMtxRotRoll(-arg1[2]);
mlMtxTranslate(-arg0[0], -arg0[1], -arg0[2]);
void func_80252EC8(f32 position[3], f32 rotation[3]){
mlMtxTranslate(position[0], position[1], position[2]);
mlMtxRotYaw(-rotation[1]);
mlMtxRotPitch(-rotation[0]);
mlMtxRotRoll(-rotation[2]);
mlMtxTranslate(-position[0], -position[1], -position[2]);
}
void func_80252F50(f32 arg0[3]){
mlMtxRotYaw(arg0[1]);
mlMtxRotPitch(arg0[0]);
mlMtxRotRoll(arg0[2]);
void func_80252F50(f32 rotation[3]){
mlMtxRotYaw(rotation[1]);
mlMtxRotPitch(rotation[0]);
mlMtxRotRoll(rotation[2]);
}
void func_80252F8C(f32 arg0[3]){
mlMtxRotRoll(arg0[2]);
mlMtxRotPitch(arg0[0]);
mlMtxRotYaw(arg0[1]);
void func_80252F8C(f32 rotation[3]){
mlMtxRotRoll(rotation[2]);
mlMtxRotPitch(rotation[0]);
mlMtxRotYaw(rotation[1]);
}
void func_80252FC8(f32 arg0[3]){
mlMtxRotYaw(-arg0[1]);
mlMtxRotPitch(-arg0[0]);
mlMtxRotRoll(-arg0[2]);
void func_80252FC8(f32 rotation[3]){
mlMtxRotYaw(-rotation[1]);
mlMtxRotPitch(-rotation[0]);
mlMtxRotRoll(-rotation[2]);
}

View File

@@ -2,8 +2,6 @@
#include "functions.h"
#include "variables.h"
#define BAD_DTOR (BAD_PI/180.0)
/* .data*/
u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS?
u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS?
@@ -30,7 +28,7 @@ f32 ml_acosValTbl[90] = { //D_80276CBC
0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997
};
f32 viewport_getYaw(void);
f32 viewport_get_yaw(void);
// .h
void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]);
@@ -1481,7 +1479,7 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3])
s32 func_8025975C(f32 a0)
{
f32 val = (s32)(viewport_getYaw() - a0);
f32 val = (s32)(viewport_get_yaw() - a0);
while (val < 0)
val += 360;

View File

@@ -24,17 +24,24 @@ CoMusic *D_80276E30 = NULL; //active track ptr
int D_80276E34 = 0;
/* .code */
CoMusic *func_802598B0(enum comusic_e track_id) {
/**
* @brief returns a pointer to the CoMusic struct with the corresponding track_id
* if it exists OR the first free CoMusic struct.
*
* @param track_id
* @return CoMusic*
*/
CoMusic *__find_track(enum comusic_e track_id) {
CoMusic *iMusPtr;
CoMusic *freeSlotPtr;
freeSlotPtr = NULL;
for(iMusPtr = D_80276E30 + 1; iMusPtr < D_80276E30 + 5; iMusPtr++) {
if (track_id == iMusPtr->unk10) {
if (track_id == iMusPtr->track_id) {
return iMusPtr;
}
if (freeSlotPtr == 0) {
if ((s32) iMusPtr->unk10 < 0) {
if ((s32) iMusPtr->track_id < 0) {
freeSlotPtr = iMusPtr;
}
}
@@ -61,8 +68,8 @@ void func_80259994(CoMusic *this, s32 arg1){
}
void func_802599B4(CoMusic *this){
func_80259994(this, func_80250034(this->unk10));
this->unk10 = -1;
func_80259994(this, func_80250034(this->track_id));
this->track_id = -1;
this->unk14 = 0;
this->unk15 = 0;
func_8024FC1C(this - D_80276E30, -1);
@@ -77,7 +84,7 @@ void comusicPlayer_init(void){
D_80276E30 = (CoMusic *) malloc(6*sizeof(CoMusic));
for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){
iPtr->unk10 = -1;
iPtr->track_id = -1;
iPtr->unk8 = 0;
iPtr->unk12 = 0;
iPtr->unkC = 0;
@@ -105,12 +112,11 @@ void comusicPlayer_free(void){
D_80276E30 = NULL;
}
//comusic_count
s32 func_80259B8C(void){
s32 comusic_active_track_count(void){
CoMusic * iPtr;
s32 cnt = 0;
for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){
if(iPtr->unk10 >= 0)
if(iPtr->track_id >= 0)
cnt++;
}
return cnt;
@@ -124,11 +130,11 @@ void comusicPlayer_update(void) {
dt = time_getDelta();
for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){
if (var_s0->unk10 >= 0) {
if (var_s0->track_id >= 0) {
temp_lo = var_s0 - D_80276E30;
var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f);
if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) {
func_8025A7DC(var_s0->unk10);
func_8025A7DC(var_s0->track_id);
}
}
}
@@ -138,7 +144,7 @@ void comusicPlayer_update(void) {
D_80276E34 = FALSE;
for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){
if (var_s0->unk10 >= 0) {
if (var_s0->track_id >= 0) {
if (var_s0->unk12 != 0) {
temp_lo = var_s0 - D_80276E30;
if (var_s0->unk0 > 0.0f) {
@@ -212,8 +218,8 @@ void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) {
if (var_s2 < 0) {
temp_v0 = (struct12s *)freelist_at(self->unk18, 1);
if (temp_v0->unk0 < func_80250034(self->unk10)) {
var_s2 = func_80250034(self->unk10);
if (temp_v0->unk0 < func_80250034(self->track_id)) {
var_s2 = func_80250034(self->track_id);
}
else{
var_s2 = temp_v0->unk0;
@@ -245,11 +251,11 @@ void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) {
}
void func_8025A104(enum comusic_e arg0, s32 arg1){
if (arg0 != D_80276E30[0].unk10){
if (arg0 != D_80276E30[0].track_id){
func_8024FC1C(0, arg0);
}
func_8024FD28(0, (s16)arg1);
D_80276E30[0].unk10 = (s16) arg0;
D_80276E30[0].track_id = (s16) arg0;
D_80276E30[0].unk8 = arg1;
D_80276E30[0].unk0 = 0.0f;
D_80276E30[0].unk12 = 0;
@@ -260,9 +266,9 @@ void func_8025A104(enum comusic_e arg0, s32 arg1){
void func_8025A1A8(enum comusic_e arg0){
if (arg0 != D_80276E30[0].unk10){
if (arg0 != D_80276E30[0].track_id){
func_8024FC1C(0, arg0);
D_80276E30[0].unk10 = (s16) arg0;
D_80276E30[0].track_id = (s16) arg0;
D_80276E30[0].unk8 = func_80250034(arg0);
D_80276E30[0].unk0 = 0.0f;
D_80276E30[0].unk12 = 0;
@@ -276,9 +282,9 @@ void func_8025A23C(s32 arg0){
CoMusic *music = &D_80276E30[5];
s32 temp_v0;
if (arg0 != music->unk10){
if (arg0 != music->track_id){
func_8024FC1C(5, arg0);
music->unk10 = (s16) arg0;
music->track_id = (s16) arg0;
temp_v0 = func_80250034(arg0);
music->unk8 = temp_v0;
music->unk12 = 0;
@@ -302,7 +308,7 @@ void func_8025A2FC(s32 arg0, s32 arg1){
func_8025A55C(arg0, arg1, 1);
for (i = 1; i < 5; i++){
s16 val = (i + D_80276E30)->unk10; // Doesn't match with D_80276E30[i]
s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i]
if (val >= 0){
func_8025ABB8(val, arg0, arg1, 1);
}
@@ -317,8 +323,8 @@ void func_8025A388(s32 arg0, s32 arg1) {
}
for (i = 1; i < 5; i++){
CoMusic *current = (i + D_80276E30); // Doesn't match with D_80276E30[i]
if (current->unk10 >= 0 && current->unk14 == 0){
func_8025ABB8(current->unk10, arg0, arg1, 1);
if (current->track_id >= 0 && current->unk14 == 0){
func_8025ABB8(current->track_id, arg0, arg1, 1);
}
}
}
@@ -328,7 +334,7 @@ void func_8025A430(s32 arg0, s32 arg1, s32 arg2){
func_8025A55C(arg0, arg1, arg2);
for (i = 1; i < 5; i++){
s16 val = (i + D_80276E30)->unk10; // Doesn't match with D_80276E30[i]
s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i]
if (val >= 0){
func_8025ABB8(val, arg0, arg1, arg2);
}
@@ -336,7 +342,7 @@ void func_8025A430(s32 arg0, s32 arg1, s32 arg2){
}
void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2){
if(D_80276E30[0].unk10 >= 0){
if(D_80276E30[0].track_id >= 0){
func_80259F7C(&D_80276E30[0], &arg0, &arg1, arg2);
if(arg0 != D_80276E30[0].unk8){
if(D_80276E30[0].unk8 < arg0){
@@ -368,21 +374,22 @@ void func_8025A5AC(enum comusic_e comusic_id, s32 arg1, s32 arg2){
arg1 = func_80250034(comusic_id);
}
tmp_a2 = func_802598B0(comusic_id);
tmp_a2 = __find_track(comusic_id);
if(tmp_a2 == NULL)
return;
sp20 = (tmp_a2 - D_80276E30);
if(tmp_a2->unk10 < 0 || arg2){
if(tmp_a2->track_id < 0 || arg2){
switch(comusic_id){
case COMUSIC_15_EXTRA_LIFE_COLLECTED:
if(map_get() != MAP_10_BGS_MR_VILE){
if(map_get() == MAP_10_BGS_MR_VILE){
break;
}
case COMUSIC_3B_MINIGAME_VICTORY:
case COMUSIC_3C_MINIGAME_LOSS:
func_8025AE50(4000, 2.0f);
}//L8025A668
func_8025AE50(4000, 2.0f);
}
tmp_a2->unk10 = comusic_id;
tmp_a2->track_id = comusic_id;
tmp_a2->unk12 = 0;
tmp_a2->unk15 = 0;
tmp_a2->unk4 = 0.0f;
@@ -407,13 +414,13 @@ void func_8025A70C(enum comusic_e track_id){
CoMusic *trackPtr;
s32 indx;
trackPtr = func_802598B0(track_id);
trackPtr = __find_track(track_id);
if(trackPtr == NULL)
return;
indx = trackPtr - D_80276E30;
if(trackPtr->unk10 < 0){
trackPtr->unk10 = track_id;
if(trackPtr->track_id < 0){
trackPtr->track_id = track_id;
trackPtr->unk12 = 0;
trackPtr->unk4 = 0.0f;
func_8024FC1C( indx, track_id);
@@ -430,8 +437,8 @@ void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2){
void func_8025A7DC(enum comusic_e track_id){
CoMusic *trackPtr;
trackPtr = func_802598B0(track_id);
if (trackPtr != NULL && trackPtr->unk10 >= 0){
trackPtr = __find_track(track_id);
if (trackPtr != NULL && trackPtr->track_id >= 0){
func_802599B4(trackPtr);
}
}
@@ -447,7 +454,7 @@ s32 func_8025A818(void){
s32 func_8025A864(enum comusic_e track_id){
CoMusic *trackPtr;
trackPtr = func_802598B0(track_id);
trackPtr = __find_track(track_id);
if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->unk8 <= 0){
func_802599B4(trackPtr);
return 1;
@@ -458,14 +465,14 @@ s32 func_8025A864(enum comusic_e track_id){
void func_8025A8B8(enum comusic_e track_id, s32 arg1){
CoMusic *trackPtr;
trackPtr = func_802598B0(track_id);
trackPtr = __find_track(track_id);
if (trackPtr != NULL){
trackPtr->unk14 = arg1;
}
}
void func_8025A8E4(s32 arg0) {
if (D_80276E30[0].unk10 >= 0) {
if (D_80276E30[0].track_id >= 0) {
D_80276E30[0].unk14 = arg0;
}
}
@@ -474,7 +481,7 @@ void func_8025A904(void){
CoMusic *trackPtr = &D_80276E30[0];
while (trackPtr < &D_80276E30[6]){
if (trackPtr->unk10 >= 0){
if (trackPtr->track_id >= 0){
func_802599B4(trackPtr);
}
trackPtr++;
@@ -486,7 +493,7 @@ void func_8025A96C(void){
CoMusic *iPtr;
for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){
if(iPtr->unk10 >= 0){
if(iPtr->track_id >= 0){
func_802599B4(iPtr);
}
}
@@ -497,7 +504,7 @@ void func_8025A9D4(void){
CoMusic *iPtr;
for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){
if(iPtr->unk10 >= 0 && !iPtr->unk14){
if(iPtr->track_id >= 0 && !iPtr->unk14){
func_802599B4(iPtr);
}
}
@@ -508,7 +515,7 @@ void func_8025AA48(void){
CoMusic *iPtr;
for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){
if(iPtr->unk10 >= 0 && !iPtr->unk14){
if(iPtr->track_id >= 0 && !iPtr->unk14){
func_802599B4(iPtr);
}
}
@@ -518,7 +525,7 @@ void func_8025AA48(void){
void func_8025AABC(enum comusic_e track_id){
CoMusic *trackPtr;
if(trackPtr = func_802598B0(track_id)){
if(trackPtr = __find_track(track_id)){
trackPtr->unk15 = 1;
if(!trackPtr->unk8)
func_802599B4(trackPtr);
@@ -541,32 +548,34 @@ void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
}
void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(func_802598B0(comusic_id)->unk1C[arg3]), "comusic.c", 0x3aa);
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(__find_track(comusic_id)->unk1C[arg3]), "comusic.c", 0x3aa);
}
void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) func_802598B0(comusic_id)->unk1C, "comusic.c", 0x3b1);
func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) __find_track(comusic_id)->unk1C, "comusic.c", 0x3b1);
}
void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 arg4, char* arg5, s32 arg6){
CoMusic *trackPtr;
u32 sp24;
u32 slot_index;
trackPtr = func_802598B0(comusic_id);
//get track location
trackPtr = __find_track(comusic_id);
if(trackPtr == NULL)
return;
if(trackPtr->unk10 < 0){ //Track not ready
//check if track is loaded in slot
if(trackPtr->track_id < 0){ //Track not loaded
if(arg1 == 0)
return;
sp24 = (trackPtr - D_80276E30);
func_8024FC1C(sp24, comusic_id);
trackPtr->unk10 = comusic_id;
slot_index = (trackPtr - D_80276E30);
func_8024FC1C(slot_index, comusic_id);
trackPtr->track_id = comusic_id;
trackPtr->unk8 = 0;
trackPtr->unk15 = 0;
trackPtr->unk4 = 0.0f;
func_80259994(trackPtr, 0);
func_8024FD28(sp24, 0);
func_8024FD28(slot_index, 0);
}
func_80259F7C(trackPtr,&arg1, &arg2, arg4);
trackPtr->unk0 = arg3;
@@ -578,17 +587,17 @@ void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32
//comusic_trackQueued
int func_8025AD7C(enum comusic_e arg0){
CoMusic * trackPtr = func_802598B0(arg0);
return (trackPtr == NULL || trackPtr->unk10 == -1)? 0 : 1;
CoMusic * trackPtr = __find_track(arg0);
return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1;
}
//comusic_isPrimaryTrack
int func_8025ADBC(enum comusic_e arg0){
return D_80276E30[0].unk10 == arg0;
return D_80276E30[0].track_id == arg0;
}
s32 func_8025ADD4(enum comusic_e id){
CoMusic * ptr = func_802598B0(id);
CoMusic * ptr = __find_track(id);
return ptr - D_80276E30;
}
@@ -603,7 +612,7 @@ void func_8025AE50(s32 arg0, f32 arg1){
}
void func_8025AEA0(enum comusic_e track_id, s32 arg1){
CoMusic *ptr = func_802598B0(track_id);
CoMusic *ptr = __find_track(track_id);
if(!ptr) return;
func_8024FDDC(ptr - D_80276E30, arg1);
@@ -616,7 +625,7 @@ int func_8025AEEC(void){
return out;
}
void func_8025AF38(void){
void comusic_defrag(void){
CoMusic *iPtr;
if(!D_80276E30) return;

View File

@@ -147,9 +147,9 @@ ALHeap D_8027CFF0;
u8 * D_8027D000;
s32 D_8027D004;
OSMesgQueue D_8027D008;
OSMesg D_8027D020;
OSMesg D_8027D020[50];
OSIoMesg D_8027D0E8;
Struct_core1_1D00_4 D_8027D100[58];
Struct_core1_1D00_4 D_8027D100[50];
struct {
u8 unk0;
Struct_1D00_3 *unk4;
@@ -297,7 +297,7 @@ void audioManager_create(void) {
int i;
f32 var_f0;
osCreateMesgQueue(&D_8027D008, &D_8027D020, 0x32);
osCreateMesgQueue(&D_8027D008, D_8027D020, 50);
osCreateMesgQueue(&audioManager.audioReplyMsgQ, audioManager.audioReplyMsgBuf, 8); //audioReplyMesgQueue
osCreateMesgQueue(&audioManager.audioFrameMsgQ, audioManager.audioFrameMsgBuf, 8);
var_f0 = 733.333313f;

View File

@@ -216,9 +216,8 @@ void sns_write_payload_over_heap(void)
sns_generate_payload(snsBasePayloadPtr2);
// memcpy
func_80254630(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
func_80254630(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
wmemcpy(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
wmemcpy(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
for (i = 1; i < 5; i++)
{
@@ -231,8 +230,7 @@ void sns_write_payload_over_heap(void)
val1 -= val1 & 0x1FFF;
for (val1 += 0x2C00; val1 < val3; val1 += 0x2000)
// memcpy
func_80254630((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
wmemcpy((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2));
}
}
}

View File

@@ -3,40 +3,38 @@
#include "variables.h"
OSIoMesg D_8027E090;
OSMesg D_8027E0A8;
OSMesgQueue D_8027E0AC;
struct {
OSMesg mesg;
OSMesgQueue queue;
} D_8027E0A8;
OSMesg D_8027E0C8[16]; //g_PimgrMesgBuffer
OSMesgQueue D_8027E108; //g_PimgrMesgQueue
#ifndef NONMATCHING
#pragma GLOBAL_ASM("asm/nonmatchings/core1/code_2BD0/func_802405F0.s")
#else
void func_802405F0(u32 arg0, u32 arg1, s32 size){
int i;
void func_802405F0(u32 * arg0, s32 arg1, s32 size){
s32 block_cnt;
s32 block_remainder;
s32 block_size = 0x20000;
int i;
osWritebackDCache(arg0, size);
block_cnt = size/block_size;
block_cnt = size / block_size;
block_remainder = size % block_size;
for(i = 0; i < block_cnt; i++){
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_size, &D_8027E0AC);
osRecvMesg(&D_8027E0AC, NULL, 1);
arg0 += 0x20000;
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, 0x20000, &D_8027E0A8.queue);
osRecvMesg(&D_8027E0A8.queue, NULL, 1);
arg1 += 0x20000;
arg0 += 0x8000;
}
block_remainder = size%0x20000;
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0AC);
osRecvMesg(&D_8027E0AC, NULL, 1);
osPiStartDma(&D_8027E090, OS_MESG_PRI_NORMAL, OS_READ, arg1, arg0, block_remainder, &D_8027E0A8.queue);
osRecvMesg(&D_8027E0A8.queue, NULL, 1);
osInvalDCache(arg0, size);
}
#endif
void piMgr_create(void){
osCreateMesgQueue(&D_8027E0AC, &D_8027E0A8, 1);
osCreateMesgQueue(&D_8027E0A8.queue, &D_8027E0A8.mesg, 1);
osCreateMesgQueue(&D_8027E108, &D_8027E0C8[0], 16);
osCreatePiManager(OS_PRIORITY_PIMGR, &D_8027E108, &D_8027E0C8[0], 16);
}

View File

@@ -17,7 +17,7 @@ void func_802409C0(f32 arg0[3], f32 arg1){
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * sp24);
viewport_getRotation(&sp3C);
viewport_get_rotation_vec3f(&sp3C);
ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]);
arg0[0] = arg0[0] + sp30[0];
@@ -59,7 +59,7 @@ void func_80240AC8(f32 arg0[3], f32 arg1){
sp30[1] = 0.0f;
sp30[2] = -(sp28[1] * sp24);
viewport_getRotation(&sp3C);
viewport_get_rotation_vec3f(&sp3C);
ml_vec3f_yaw_rotate_copy(sp30, sp30, sp3C[1]);
arg0[0] = arg0[0] + sp30[0];

View File

@@ -1,7 +1,7 @@
#include <ultra64.h>
extern f32 gu_sqrtf(f32);
static void _guMtxF2L(float mf[4][4], Mtx *m)
static void __guMtxF2L(float mf[4][4], Mtx *m)
{
int i, j;
int e1,e2;
@@ -142,7 +142,7 @@ void guScale(Mtx *m, float x, float y, float z)
float mf[4][4];
guScaleF(mf, x, y, z);
_guMtxF2L(mf, m);
__guMtxF2L(mf, m);
}
void guRotateRPYF(f32 mf[4][4], f32 r, f32 p, f32 h) {

View File

@@ -4,7 +4,7 @@
extern f32 ml_cos_deg(f32);
extern f32 ml_sin_deg(f32);
extern void func_8024C5F0(s32[3]);
extern void veiwport_get_position_vec3w(s32[3]);
Gfx D_80275880[] = {
gsSPClearGeometryMode(G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0060CD00),
@@ -18,7 +18,7 @@ Gfx D_80275880[] = {
};
/* .code */
void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) {
void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) {
s32 spB4[3];
s32 var_a0;
s32 var_v0;
@@ -26,7 +26,7 @@ void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3],
s32 sp78[3][4];
s32 i;
func_8024C5F0(spB4);
veiwport_get_position_vec3w(spB4);
gSPDisplayList((*gfx)++, D_80275880);
if (arg6 != 0) {
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_BACK);
@@ -95,7 +95,7 @@ void func_80241928(Gfx** gfx, Vtx** vtx, s32 arg2[3], s32 arg3, s32 arg4[3]) {
s32 var_fp;
s32 var_s0;
func_8024C5F0(spB4);
veiwport_get_position_vec3w(spB4);
for(var_fp = 0; var_fp < 4; var_fp++){
gSPDisplayList((*gfx)++, D_80275880);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
@@ -162,7 +162,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3
sp68[1] *= arg5;
sp68[2] *= arg5;
viewport_getPosition(sp5C);
viewport_get_position_vec3f(sp5C);
gSPDisplayList((*gfx)++, D_80275880);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER);
gSPVertex((*gfx)++, *vtx, 8, 0);
@@ -209,7 +209,7 @@ void func_80242BE8(Gfx **gfx, Vtx **arg1, f32 arg2[2][2][2][3], s32 arg3[3], s32
s32 i;
s32 j;
s32 k;
viewport_getPosition(sp84);
viewport_get_position_vec3f(sp84);
gSPDisplayList((*gfx)++, D_80275880);
if (arg5){
gSPSetGeometryMode((*gfx)++, G_CULL_BACK);

View File

@@ -21,7 +21,7 @@ void func_80244978(s32 arg0, s16 type, s32 arg2);
N_ALSndPlayer D_8027EEC0;
s16 *D_8027EF14;
extern struct {
struct {
s32 volume[4];
}D_8027EF18;
@@ -329,10 +329,10 @@ void func_802432F8(N_ALSndPlayer *sndp, N_ALEvent *event) {
case 0x200:
if (temp_s0->unk3F & 0x10) {
sp68 = func_80244608(var_s5->msg.midi.duration, (s16)var_s5->msg.generic.data[1].i, temp_s0->unk30);
func_80244978(sp68, 8, temp_s0->unk34);
func_80244978(sp68, 4, temp_s0->unk3D);
func_80244978(sp68, AL_SEQP_PROG_EVT, temp_s0->unk34);
func_80244978(sp68, AL_SEQ_END_EVT, temp_s0->unk3D);
func_80244978(sp68, 0x100, temp_s0->unk3E);
func_80244978(sp68, 0x10, reinterpret_cast(s32, temp_s0->unk2C));
func_80244978(sp68, AL_SEQP_STOP_EVT, reinterpret_cast(s32, temp_s0->unk2C));
}
break;

View File

@@ -53,7 +53,7 @@ s32 D_80275768 = 6; //dbits
/* .data */
extern struct huft D_803FBE00;
struct huft *D_8027BF00;
u8 pad_8027BF00[0xC];
u8 pad_8027BF08[0x8];
u8 *D_8027BF10; //inbuf
u8 *D_8027BF14; //slide
u32 D_8027BF18; //inptr
@@ -65,6 +65,7 @@ u32 D_8027BF2C; //crc1
u32 D_8027BF30; //crc2
u32 D_8027BF34; //hufts
static int _rarezip_inflate(u8 * src, u8 * dst, struct huft * arg2);
/* .code */
s32 rarezip_get_uncompressed_size(u8 *arg0) {

View File

@@ -12,7 +12,6 @@ extern f32 func_8031C5D4(struct0*);
extern void func_8031C5AC(struct0 *, f32 *);
/* .bss */
u8 pad_D_8027EF20[0x10];
f32 D_8027EF30;
/* .code */

View File

@@ -2,14 +2,16 @@
#include "functions.h"
#include "variables.h"
static void _guMtxIdentF(float mf[4][4]);
u8 D_80275900[] = {0xCF, 0xAD, 0xA2, 0x90, 0x93, 0x4A, 0x83, 0xF1};
f32 D_80275908 = BAD_DTOR;
s32 func_80245980(f32 arg0){
static s32 guFToFix32(f32 arg0){
return arg0*65536.0f;
}
void func_802459A0(float mf[4][4], Mtx *m)
static void __guMtxF2L(float mf[4][4], Mtx *m)
{
int i, j;
int e1,e2;
@@ -21,14 +23,14 @@ void func_802459A0(float mf[4][4], Mtx *m)
for (i=0; i<4; i++)
for (j=0; j<2; j++) {
e1=func_80245980(mf[i][j*2]);
e2=func_80245980(mf[i][j*2+1]);
e1=guFToFix32(mf[i][j*2]);
e2=guFToFix32(mf[i][j*2+1]);
*(ai++) = ( e1 & 0xffff0000 ) | ((e2 >> 16)&0xffff);
*(af++) = ((e1 << 16) & 0xffff0000) | (e2 & 0xffff);
}
}
void func_80245A7C(float mf[4][4], Mtx *m) //should be mf[4][4]
void _guMtxF2L(float mf[4][4], Mtx *m) //should be mf[4][4]
{
int i;
int j;
@@ -50,10 +52,10 @@ void func_80245A7C(float mf[4][4], Mtx *m) //should be mf[4][4]
}
}
void func_80245BE4(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) {
void _guFustrumF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6, f32 arg7) {
s32 i, j;
_guMtxIdentF_80245D44(mf);
_guMtxIdentF(mf);
mf[0][0] = (2 * arg5) / (arg2 - arg1);
mf[1][1] = (2 * arg5) / (arg4 - arg3);
mf[2][0] = (arg2 + arg1) / (arg2 - arg1);
@@ -69,7 +71,7 @@ void func_80245BE4(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg
}
}
void _guMtxIdentF_80245D44(float mf[4][4]) //static
static void _guMtxIdentF(float mf[4][4]) //static
{
int i, j;
@@ -79,7 +81,7 @@ void _guMtxIdentF_80245D44(float mf[4][4]) //static
else mf[i][j] = 0.0;
}
void func_80245DCC(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) {
void guMtxCatF(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) {
s32 i, j, k;
f32 sp1C[4][4];
@@ -98,7 +100,7 @@ void func_80245DCC(f32 lmf[4][4], f32 rmf[4][4], f32 dst[4][4]) {
}
}
void func_80245F34(f32 *arg0, f32 *arg1, f32 *arg2) {
static void _guNormalize(f32 *arg0, f32 *arg1, f32 *arg2) {
f32 inv_len;
inv_len = 1.0f / gu_sqrtf((*arg0 * *arg0) + (*arg1 * *arg1) + (*arg2 * *arg2));
@@ -107,7 +109,7 @@ void func_80245F34(f32 *arg0, f32 *arg1, f32 *arg2) {
*arg2 *= inv_len;
}
void func_80245FB8(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale)
void guPerspectiveF(float mf[4][4], u16 *perspNorm, float fovy, float aspect, float near, float far, float scale)
{
float cot;
float tmp;
@@ -163,25 +165,25 @@ void func_80245FB8(float mf[4][4], u16 *perspNorm, float fovy, float aspect, flo
void guPerspective(Mtx *m, u16 *perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) {
f32 sp28[4][4];
func_80245FB8(sp28, perspNorm, fovy, aspect, near, far, scale);
func_802459A0(sp28, m);
guPerspectiveF(sp28, perspNorm, fovy, aspect, near, far, scale);
__guMtxF2L(sp28, m);
}
void func_8024632C(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
void _guRotateF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
f32 sp34;
f32 sp30;
f32 sp2C;
f32 sp28;
volatile f32 sp24;
func_80245F34(&arg2, &arg3, &arg4);
_guNormalize(&arg2, &arg3, &arg4);
arg1 *= D_80275908;
sp34 = sinf(arg1);
sp30 = cosf(arg1);
sp2C = arg2 * arg3 * (1.0f - sp30);
sp28 = arg3 * arg4 * (1.0f - sp30);
sp24 = (arg4 * arg2 * (1.0f - sp30));
_guMtxIdentF_80245D44(mf);
_guMtxIdentF(mf);
mf[0][0] = ((1.0f - (arg2 * arg2)) * sp30) + (arg2 * arg2);
mf[2][1] = (sp28 - (arg2 * sp34));
mf[1][2] = ((arg2 * sp34) + sp28);
@@ -195,10 +197,10 @@ void func_8024632C(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3, f32 arg4) {
mf[0][1] = (arg4 * sp34) + sp2C;
}
void func_802464B0(f32 mf[4][4], f32 arg1){
void guRotateRollF(f32 mf[4][4], f32 arg1){
f32 c, s;
arg1 *= D_80275908;
_guMtxIdentF_80245D44(mf);
_guMtxIdentF(mf);
c = cosf(arg1);
mf[1][1] = c;
mf[2][2] = c;
@@ -207,10 +209,10 @@ void func_802464B0(f32 mf[4][4], f32 arg1){
mf[2][1] = -s;
}
void func_80246510(f32 mf[4][4], f32 arg1){
void guRotatePitchF(f32 mf[4][4], f32 arg1){
f32 c, s;
arg1 *= D_80275908;
_guMtxIdentF_80245D44(mf);
_guMtxIdentF(mf);
c = cosf(arg1);
mf[0][0] = c;
mf[2][2] = c;
@@ -219,10 +221,10 @@ void func_80246510(f32 mf[4][4], f32 arg1){
mf[0][2] = -s;
}
void func_80246570(f32 mf[4][4], f32 arg1){
void guRotateYawF(f32 mf[4][4], f32 arg1){
f32 c, s;
arg1 *= D_80275908;
_guMtxIdentF_80245D44(mf);
_guMtxIdentF(mf);
c = cosf(arg1);
mf[0][0] = c;
mf[1][1] = c;
@@ -231,16 +233,16 @@ void func_80246570(f32 mf[4][4], f32 arg1){
mf[1][0] = -s;
}
void func_802465D0(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){
_guMtxIdentF_80245D44(mf);
void _guScaleF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){
_guMtxIdentF(mf);
mf[0][0] = arg1;
mf[1][1] = arg2;
mf[2][2] = arg3;
mf[3][3] = 1.0f;
}
void func_80246624(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){
_guMtxIdentF_80245D44(mf);
void _guTranslateF(f32 mf[4][4], f32 arg1, f32 arg2, f32 arg3){
_guMtxIdentF(mf);
mf[3][0] = arg1;
mf[3][1] = arg2;
mf[3][2] = arg3;

View File

@@ -61,7 +61,7 @@ s32 D_8027599C = 0;
/* .bss */
u64 D_8027EF40[OS_YIELD_DATA_SIZE / sizeof(u64)];
static u8 pad[0x28]; // 8027FB40
static u8 pad[0x20]; // 8027FB40
OSMesgQueue D_8027FB60;
OSMesg D_8027FB78[20];
OSMesgQueue D_8027FBC8;
@@ -74,7 +74,7 @@ s32 D_8027FC18;
s32 D_8027FC1C;
s32 D_8027FC20;
s32 D_8027FC24;
u8 D_8027FC28[2040]; //stack for thread D_80280428;
u8 D_8027FC28[2048]; //stack for thread D_80280428;
OSThread D_80280428;
Struct_Core1_8C50_s * D_802805D8[20];
volatile s32 D_80280628;
@@ -458,7 +458,7 @@ void func_80247560(void){
tmp_v0 = D_8027EF40;
while((u32)tmp_v0 % 0x10){((u32)tmp_v0)++;}
D_80275950.t.yield_data_ptr = tmp_v0;
osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2040], 60);
osCreateThread(&D_80280428, 5, func_802473B4, NULL, &D_8027FC28[2048], 60);
osStartThread(&D_80280428);
}

View File

@@ -318,28 +318,38 @@ void func_80248098(f32 arg0) {
func_80248520();
}
//letter to font index???
s32 func_8024824C(s32 arg0) {
//lowercase_letter
if ((arg0 >= (s32) D_80275BE8[0]) && ((s32) D_80275BE8[1] >= arg0)) {
return (arg0 - D_80275BE8[0]) + 0xA;
}
//uppercase_letter
if ((arg0 >= (s32) D_80275BE8[2]) && ((s32) D_80275BE8[3] >= arg0)) {
return (arg0 - D_80275BE8[2]) + 0xA;
}
//number
if ((arg0 >= (s32) D_80275BE8[4]) && ((s32) D_80275BE8[5] >= arg0)) {
return (arg0 - D_80275BE8[4]);
}
//.
if (arg0 == D_80275BE8[6]) {
return 0x24;
}
//:
if (arg0 == D_80275BE8[7]) {
return 0x25;
}
//-
if (arg0 == D_80275BE8[8]) {
return 0x26;
}
//
if (arg0 == D_80275BE8[9]) {
return 0x27;
}

View File

@@ -535,7 +535,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled
}
}
void func_80249CEC(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
void draw_sprite(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) {
s16 temp_v0;
temp_v0 = sprite->type;

View File

@@ -61,12 +61,16 @@ u32 D_80280724;
u32 D_80280728;
struct1 D_80280730[8];
OSMesgQueue D_80280770;
OSMesg D_80280788[10];
OSMesgQueue D_802807B0;
OSMesg D_802807C8[1];
OSMesgQueue D_802807D0;
OSMesg D_802807E8[60];
volatile s32 D_802808D8;
s32 D_802808DC;
OSThread D_802808E0;
u8 pad_80280970[0x520];
#define THREAD0_STACK_SIZE 0x400
u8 thread0_stack[THREAD0_STACK_SIZE];
extern u8 D_803A5D00[2][0x1ECC0]; //framebuffer
@@ -100,7 +104,6 @@ void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){
}
void func_8024BE30(void){
extern s32 D_80280E90;
s32 i;
func_8024C428();
@@ -113,9 +116,9 @@ void func_8024BE30(void){
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON);
osViSetSpecialFeatures(OS_VI_GAMMA_OFF);
osViSwapBuffer(&D_803A5D00);
osCreateMesgQueue(&D_80280770, (&D_80280770 + 1), 10);
osCreateMesgQueue(&D_802807B0, (&D_802807B0 + 1), 1);
osCreateMesgQueue(&D_802807D0, (&D_802807D0 + 1), 0x3C);
osCreateMesgQueue(&D_80280770, D_80280788, 10);
osCreateMesgQueue(&D_802807B0, D_802807C8, 1);
osCreateMesgQueue(&D_802807D0, D_802807E8, 60);
osViSetEvent(&D_80280770,NULL,1);
D_80280720 = 0;
D_80280724 = 1;
@@ -125,7 +128,7 @@ void func_8024BE30(void){
}
D_802808D8 = 0;
func_8024BF94(2);
osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&D_80280E90,0x50);
osCreateThread(&D_802808E0,0,func_8024C2F8,NULL,&thread0_stack[THREAD0_STACK_SIZE],80);
osStartThread(&D_802808E0);
}

View File

@@ -5,11 +5,13 @@
extern void guPerspective(Mtx *, u16*, f32, f32, f32, f32, f32);
extern f32 ml_dotProduct_vec3f(f32[3], f32[3]);
#define VIEWPORT_FOVY_DEFAULT (40.0f)
/* .data */
f32 D_80275D20 = 40.0f; //fovy
f32 D_80275D24 = 1.35185182f; //aspect
f32 D_80275D28 = 30.0f; //near
f32 D_80275D2C = 4000.0f; //far
f32 s_viewport_fovy = VIEWPORT_FOVY_DEFAULT; //fovy
f32 s_viewport_aspect = 1.35185182f; //aspect
f32 s_viewport_near = 30.0f; //near
f32 s_viewport_far = 4000.0f; //far
/* .data */
f32 D_80280EA0[3];
@@ -17,11 +19,11 @@ f32 viewportPosition[3];
f32 viewportRotation[3];
f32 D_80280ECC;
f32 D_80280ED0[4][4];
Vp D_80280F10[8];
Vp s_viewport_stack[8];
int D_80280F90;
f32 D_80280F98[4][4];
Mtx D_80280FD8;
s32 D_80281018; //viewport indx
s32 s_viewport_stack_index; //viewport indx
@@ -30,11 +32,11 @@ void func_8024F450(void);
void func_8024F4AC(void);
void func_8024C964(Gfx **, Mtx **, f32, f32);
void func_8024CD7C(int);
void func_8024CDF8(f32, f32, f32);
void func_8024CE40(f32, f32, f32);
void func_8024CE60(f32, f32);
void viewport_set_position_f3(f32, f32, f32);
void viewport_set_rotation_f3(f32, f32, f32);
void viewport_set_near_far(f32, f32);
void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void func_8024DDB4(f32);
void viewport_set_field_of_view(f32);
void func_80256E24(f32 [3], f32, f32, f32, f32, f32);
@@ -55,38 +57,38 @@ void func_8024C5A8(f32 arg0[3]){
ml_vec3f_copy(arg0, D_80280EA0);
}
void viewport_getPosition(f32 arg0[3]){
void viewport_get_position_vec3f(f32 arg0[3]){
ml_vec3f_copy(arg0, viewportPosition);
}
void func_8024C5F0(s32 dst[3]){
void veiwport_get_position_vec3w(s32 dst[3]){
dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0;
}
void func_8024C6A0(s16 dst[3]){
void veiwport_get_position_vec3s(s16 dst[3]){
dst[0] = ((f32)(s32)(viewportPosition[0]*500.0))/500.0;
dst[1] = ((f32)(s32)(viewportPosition[1]*500.0))/500.0;
dst[2] = ((f32)(s32)(viewportPosition[2]*500.0))/500.0;
}
void viewport_getRotation(f32 arg0[3]){
void viewport_get_rotation_vec3f(f32 arg0[3]){
ml_vec3f_copy(arg0, viewportRotation);
}
f32 viewport_getYaw(void){
f32 viewport_get_yaw(void){
return viewportRotation[1];
}
void func_8024C794(f32 *arg0, f32 *arg1, f32 *arg2){
*arg0 = viewportRotation[0];
*arg1 = viewportRotation[1];
*arg2 = viewportRotation[2];
void viewport_get_rotation_f3(f32 *pitch, f32 *yaw, f32 *roll){
*pitch = viewportRotation[0];
*yaw = viewportRotation[1];
*roll = viewportRotation[2];
}
void func_8024C7B8(Gfx **gfx, Mtx **mtx){
gSPViewport((*gfx)++, &D_80280F10[D_80281018]);
gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]);
guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f);
gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
@@ -96,22 +98,22 @@ void func_8024C7B8(Gfx **gfx, Mtx **mtx){
}
void func_8024C904(Gfx **gfx, Mtx **mtx){
gSPViewport((*gfx)++, &D_80280F10[D_80281018]);
func_8024C964(gfx, mtx, D_80275D28, D_80275D2C);
gSPViewport((*gfx)++, &s_viewport_stack[s_viewport_stack_index]);
func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far);
}
void func_8024C964(Gfx **gfx, Mtx **mtx, f32 near, f32 far){
u16 sp5e;
near = MAX(D_80275D28, near);
far = MIN(D_80275D2C, far);
near = MAX(s_viewport_near, near);
far = MIN(s_viewport_far, far);
if(*(u32*)OS_PHYSICAL_TO_K1(0x1D8) + 0x53D4FFF0){
near = 750.0f;
far = 1250.0f;
}
guPerspective(*mtx, &sp5e, D_80275D20, D_80275D24, near, far, 0.5f);
guPerspective(*mtx, &sp5e, s_viewport_fovy, s_viewport_aspect, near, far, 0.5f);
gSPPerspNormalize((*gfx)++, sp5e);
gSPMatrix((*gfx)++, OS_PHYSICAL_TO_K0((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
@@ -129,10 +131,10 @@ void func_8024C964(Gfx **gfx, Mtx **mtx, f32 near, f32 far){
}
void func_8024CBD4(Gfx **gfx, Mtx **mtx){
func_8024C964(gfx, mtx, D_80275D28, D_80275D2C);
func_8024C964(gfx, mtx, s_viewport_near, s_viewport_far);
}
void func_8024CC00(void){}
void viewport_debug(void){}
void func_8024CC08(f32 arg0){
if(90.0f < arg0) arg0 = 90.0f;
@@ -148,14 +150,14 @@ void func_8024CC5C(void){
func_8024CE74((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2));
}
void func_8024CCC4(void){
void viewport_reset(void){
func_8024CD7C(1);
func_8024CDF8(0.0f, 0.0f, 0.0f);
func_8024CE40(0.0f, 0.0f, 0.0f);
viewport_set_position_f3(0.0f, 0.0f, 0.0f);
viewport_set_rotation_f3(0.0f, 0.0f, 0.0f);
func_8024CC08(40.0f);
func_8024CE60(1.0f, 10000.0f);
viewport_set_near_far(1.0f, 10000.0f);
func_8024CC5C();
func_8024DDB4(40.0f);
viewport_set_field_of_view(VIEWPORT_FOVY_DEFAULT);
mlMtxIdent();
mlMtxRotYaw(-60.0f);
mlMtxRotPitch(-90.0f);
@@ -166,61 +168,61 @@ void func_8024CD7C(int arg0){
D_80280F90 = arg0;
}
void viewport_setPosition(f32 src[3]){
void viewport_set_position_vec3f(f32 src[3]){
ml_vec3f_copy(viewportPosition, src);
}
void func_8024CDB0(s32 src[3]){
void viewport_set_position_vec3w(s32 src[3]){
viewportPosition[0] = (f32)src[0];
viewportPosition[1] = (f32)src[1];
viewportPosition[2] = (f32)src[2];
}
void func_8024CDF8(f32 arg0, f32 arg1, f32 arg2){
viewportPosition[0] = arg0;
viewportPosition[1] = arg1;
viewportPosition[2] = arg2;
void viewport_set_position_f3(f32 x, f32 y, f32 z){
viewportPosition[0] = x;
viewportPosition[1] = y;
viewportPosition[2] = z;
}
void viewport_setRotation(f32 src[3]){
void viewport_set_rotation_vec3f(f32 src[3]){
ml_vec3f_copy(viewportRotation, src);
}
void func_8024CE40(f32 arg0, f32 arg1, f32 arg2){
viewportRotation[0] = arg0;
viewportRotation[1] = arg1;
viewportRotation[2] = arg2;
void viewport_set_rotation_f3(f32 pitch, f32 yaw, f32 roll){
viewportRotation[0] = pitch;
viewportRotation[1] = yaw;
viewportRotation[2] = roll;
}
void func_8024CE60(f32 near, f32 far){
D_80275D28 = near;
D_80275D2C = far;
void viewport_set_near_far(f32 near, f32 far){
s_viewport_near = near;
s_viewport_far = far;
}
void func_8024CE74(s32 arg0, s32 arg1, s32 arg2, s32 arg3){
D_80281018 = (D_80281018 + 1) % 8;
D_80280F10[D_80281018].vp.vscale[0] = arg0 << 2;
D_80280F10[D_80281018].vp.vscale[1] = arg1 << 2;
D_80280F10[D_80281018].vp.vscale[2] = 0x1ff;
D_80280F10[D_80281018].vp.vscale[3] = 0;
D_80280F10[D_80281018].vp.vtrans[0] = arg2 << 2;
D_80280F10[D_80281018].vp.vtrans[1] = arg3 << 2;
D_80280F10[D_80281018].vp.vtrans[2] = 0x1ff;
D_80280F10[D_80281018].vp.vtrans[3] = 0;
osWritebackDCache(&D_80280F10[D_80281018], sizeof(Vp)*8);
s_viewport_stack_index = (s_viewport_stack_index + 1) % 8;
s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3 << 2;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0;
osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8);
}
void func_8024CF10(f32 arg0, f32 arg1, f32 arg2, f32 arg3){
D_80281018 = (D_80281018 + 1) % 8;
D_80280F10[D_80281018].vp.vscale[0] = arg0*4;
D_80280F10[D_80281018].vp.vscale[1] = arg1*4;
D_80280F10[D_80281018].vp.vscale[2] = 0x1ff;
D_80280F10[D_80281018].vp.vscale[3] = 0;
D_80280F10[D_80281018].vp.vtrans[0] = arg2*4;
D_80280F10[D_80281018].vp.vtrans[1] = arg3*4;
D_80280F10[D_80281018].vp.vtrans[2] = 0x1ff;
D_80280F10[D_80281018].vp.vtrans[3] = 0;
osWritebackDCache(&D_80280F10[D_80281018], sizeof(Vp)*8);
s_viewport_stack_index = (s_viewport_stack_index + 1) % 8;
s_viewport_stack[s_viewport_stack_index].vp.vscale[0] = arg0*4;
s_viewport_stack[s_viewport_stack_index].vp.vscale[1] = arg1*4;
s_viewport_stack[s_viewport_stack_index].vp.vscale[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vscale[3] = 0;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[0] = arg2*4;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[1] = arg3*4;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[2] = 0x1ff;
s_viewport_stack[s_viewport_stack_index].vp.vtrans[3] = 0;
osWritebackDCache(&s_viewport_stack[s_viewport_stack_index], sizeof(Vp)*8);
}
void viewport_update(void){
@@ -348,14 +350,14 @@ bool func_8024D9B0(Cube *cube) {
}
bool func_8024DB50(f32 arg0[3], f32 arg1) {
f32 sp3C[3];
f32 delta[3];
s32 i;
sp3C[0] = arg0[0] - viewportPosition[0];
sp3C[1] = arg0[1] - viewportPosition[1];
sp3C[2] = arg0[2] - viewportPosition[2];
delta[0] = arg0[0] - viewportPosition[0];
delta[1] = arg0[1] - viewportPosition[1];
delta[2] = arg0[2] - viewportPosition[2];
for(i = 0; i < 4; i++){
if(arg1 <= ml_dotProduct_vec3f(sp3C, D_80280ED0[i])){
if(arg1 <= ml_dotProduct_vec3f(delta, D_80280ED0[i])){
return FALSE;
}
}
@@ -392,20 +394,20 @@ Mtx *func_8024DD9C(void){
return &D_80280FD8;
}
f32 func_8024DDA8(void){
return D_80275D20;
f32 viewport_get_field_of_view(void){
return s_viewport_fovy;
}
void func_8024DDB4(f32 arg0){
D_80275D20 = arg0;
void viewport_set_field_of_view(f32 fovy){
s_viewport_fovy = fovy;
}
f32 func_8024DDC0(void){
return D_80275D24;
f32 viewport_get_aspect_ratio(void){
return s_viewport_aspect;
}
f32 func_8024DDCC(void){
return D_80275D28;
f32 viewport_get_near(void){
return s_viewport_near;
}
f32 func_8024DDD8(s32 arg0, f32 arg1){
@@ -413,16 +415,16 @@ f32 func_8024DDD8(s32 arg0, f32 arg1){
}
f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) {
f32 sp24;
f32 fovy_rad;
static f32 D_8028101C;
static f32 D_80281020;
static f32 D_80281024;
if ((D_80275D20 != D_8028101C) || (D_80275D28 != D_80281020)) {
sp24 = (D_80275D20 * M_PI) / 360.0;
D_80281024 = (500.0 + D_80275D28) / (((framebuffer_height / (f32)2) / sinf(sp24)) * cosf(sp24));
D_8028101C = D_80275D20;
D_80281020 = D_80275D28;
if ((s_viewport_fovy != D_8028101C) || (s_viewport_near != D_80281020)) {
fovy_rad = (s_viewport_fovy * M_PI) / 360.0;
D_80281024 = (500.0 + s_viewport_near) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad));
D_8028101C = s_viewport_fovy;
D_80281020 = s_viewport_near;
}
arg0 = arg0 - (framebuffer_width / (f32)2);
arg1 = (framebuffer_height / (f32)2) - arg1;
@@ -431,7 +433,7 @@ f32 func_8024DE1C(f32 arg0, f32 arg1, f32 arg2[3], f32 arg3[3]) {
arg3[2] = viewportRotation[2];
arg2[0] = arg0 * D_80281024;
arg2[1] = arg1 * D_80281024;
arg2[2] = (-500.0 - D_80275D28);
arg2[2] = (-500.0 - s_viewport_near);
ml_vec3f_pitch_rotate_copy(arg2, arg2, arg3[0]);
ml_vec3f_yaw_rotate_copy(arg2, arg2, arg3[1]);
@@ -456,13 +458,13 @@ bool func_8024E030(f32 arg0[3], f32 *arg1)
f32 temp_f2_2;
f32 temp_f2;
f32 sp28;
sp28 = (D_80275D20 * 3.14159265358979323846) / 360.0;
sp28 = (s_viewport_fovy * M_PI) / 360.0;
sp34[0] = arg0[0] - viewportPosition[0];
sp34[1] = arg0[1] - viewportPosition[1];
sp34[2] = arg0[2] - viewportPosition[2];
ml_vec3f_yaw_rotate_copy(sp34, sp34, -viewportRotation[1]);
ml_vec3f_pitch_rotate_copy(sp34, sp34, -viewportRotation[0]);
if ((-D_80275D28) <= sp34[2]) {
if ((-s_viewport_near) <= sp34[2]) {
return 0;
}
temp_f2 = gu_sqrtf((sp34[1] * sp34[1]) + (sp34[2] * sp34[2])) * sinf(sp28);
@@ -480,8 +482,8 @@ bool func_8024E030(f32 arg0[3], f32 *arg1)
void func_8024E258(void){
s32 i, j;
viewport_getPosition(D_80281028);
viewport_getRotation(D_80281038);
viewport_get_position_vec3f(D_80281028);
viewport_get_rotation_vec3f(D_80281038);
func_8024D1EC(D_80281048, D_80281058, D_80281068, D_80281078);
func_8024C5A8(D_80281088);
for(i = 0; i < 4; i++){
@@ -493,8 +495,8 @@ void func_8024E258(void){
void func_8024E2FC(void){
s32 i, j;
viewport_setPosition(D_80281028);
viewport_setRotation(D_80281038);
viewport_set_position_vec3f(D_80281028);
viewport_set_rotation_vec3f(D_80281038);
func_8024D2B0(D_80281048, D_80281058, D_80281068, D_80281078);
ml_vec3f_copy(D_80280EA0, D_80281088);
for(i = 0; i < 4; i++){
@@ -505,10 +507,10 @@ void func_8024E2FC(void){
}
//moves the point(arg0) some distance (arg1) further away from the camera
void func_8024E3A8(f32 arg0[3], f32 arg1){
void func_8024E3A8(f32 arg0[3], f32 distance){
f32 sp1C[3];
ml_vec3f_diff_copy(sp1C, viewportPosition, arg0);
ml_vec3f_set_length_copy(sp1C, sp1C, arg1);
ml_vec3f_set_length_copy(sp1C, sp1C, distance);
arg0[0] += sp1C[0];
arg0[1] += sp1C[1];
arg0[2] += sp1C[2];

View File

@@ -1 +1 @@
unsigned long long D_80276E70 = 0xAB8D9F7781280783;
unsigned long long D_80276E70 = 0xAB8D9F7781280783;

View File

@@ -141,7 +141,7 @@ void memcpy(void * dst, void *src, int size){
}
}
void func_80254630(void * dst, void *src, int size){
void wmemcpy(void * dst, void *src, int size){
while(size > 0){
*(u32*)dst = *(u32*)src;
size -= 4;
@@ -150,22 +150,16 @@ void func_80254630(void * dst, void *src, int size){
}
}
void func_80254658(u8* arg0, u8* arg1, s32 arg2) {
if(arg0 < arg1){
if(arg2--){
do{
*(arg0++) = *(arg1++);
}while(arg2--);
void memmove(u8* dst, u8* src, s32 n) {
if(dst < src){ //copy
while(n--){
*(dst++) = *(src++);
}
}else{
arg0 += arg2 -1;
arg1 += arg2 -1;
if(arg2--){
do{
*(arg0--) = *(arg1--);
}while(arg2--);
}else{ //copy backwards to avoid data lose
dst += n -1;
src += n -1;
while(n--){
*(dst--) = *(src--);
}
}
}
@@ -244,11 +238,11 @@ void func_80254908(void){
}
}
u32 _heap_get_occupied_size(void){
static u32 _heap_get_occupied_size(void){
return heap_occupiedBytes;
}
u32 func_8025496C(void){
u32 heap_get_occupied_size(void){
return _heap_get_occupied_size();
}
@@ -356,7 +350,7 @@ void *malloc(s32 size){
animCache_flushStale();
if(!func_80254B84(0))
func_8028873C(0);
animBinCache_flushStale(0); //nonpersistent anim
if(!func_80254B84(0))
func_8032AD7C(2);
@@ -377,7 +371,7 @@ void *malloc(s32 size){
func_802F1294(); //particleEmitters
if(!func_80254B84(0))
func_8028873C(1); //AnimationFileCache
animBinCache_flushStale(1); //persistent anim
if(v1 = func_80254B84(0)){}
else
@@ -591,8 +585,8 @@ void *realloc(void *ptr, s32 size){
return ptr;
}
u32 func_80255498(void){
return HEAP_SIZE - func_8025496C();
u32 heap_get_free_size(void){
return HEAP_SIZE - heap_get_occupied_size();
}
s32 heap_findLargestEmptyBlock(s32 *size_ptr){
@@ -806,7 +800,7 @@ void func_80255A3C(void){
func_802E6820(1);
if(!func_802559A0())
func_802F542C();
printbuffer_defrag();
if(!func_802559A0()){
ml_defrag();

View File

@@ -1,4 +1,4 @@
#include <os_internal.h>
//not included in final rom, but __osThreadSave is here for some reason
OSThread __osThreadSave;
OSThread __osThreadSave;