Proposed names for library stuff (#29)

* get this started

* linker scripts fixed

* oh god what now

* names

* the blue pill

* names, perhaps

* save

* clean out structs

* save for later again

* more names

* save, again
This commit is contained in:
petrie911 2023-11-24 13:11:20 -06:00 committed by GitHub
parent e0cc3dbc0e
commit d32854ced1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 1455 additions and 1350 deletions

View File

@ -42,6 +42,8 @@
"symbol_addrs_overlays": "cpp", "symbol_addrs_overlays": "cpp",
"fox_option.h": "c", "fox_option.h": "c",
"cstdlib": "c", "cstdlib": "c",
"typeinfo": "c" "typeinfo": "c",
"sym_addrs_funcs": "c",
"*.txt": "c"
}, },
} }

View File

@ -267,7 +267,7 @@ clean:
@git clean -fdx assets/ @git clean -fdx assets/
@git clean -fdx bin/ @git clean -fdx bin/
@git clean -fdx build/ @git clean -fdx build/
@git clean -fdx linker_scripts/ @git clean -fdx linker_scripts/*.ld
format: format:
@$(TOOLS)/format.py -j $(N_THREADS) @$(TOOLS)/format.py -j $(N_THREADS)

View File

@ -4,19 +4,19 @@
#include "structs.h" #include "structs.h"
#include "fox_option.h" #include "fox_option.h"
void func_8000291C(void); void Controller_Init(void);
void func_800029A8(void); void Controller_UpdateInput(void);
void func_80002AF4(void); void Controller_ReadData(void);
void func_80002BE8(void); void Save_ReadData(void);
void func_80002C50(void); void Save_WriteData(void);
void func_80002CB8(void); void Controller_Rumble(void);
void func_8000316C(Gfx** dList); void Lib_Perspective(Gfx** dList);
void func_800032B4(Gfx** dList); void Lib_Ortho(Gfx** dList);
void func_800033E0(void* var_s2, void* var_s1, s32 var_s0); void Lib_DmaRead(void* src, void* dst, s32 size);
void func_800034E8(u8 arg0); void Lib_FillScreen(u8 setFill);
void func_8000372C(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG, s32 ambB); void Lights_SetOneLight(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG, s32 ambB);
void func_800038AC(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r, s32 col1g, void Lights_SetTwoLights(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r, s32 col1g,
s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB); s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB);
f32 Math_ModF(f32 value, f32 mod); f32 Math_ModF(f32 value, f32 mod);
void Rand_Init(void); void Rand_Init(void);
@ -48,18 +48,18 @@ void Matrix_GetXYZAngles(Matrix*, Vec3f*);
void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8); void Matrix_LookAt(Matrix*, f32, f32, f32, f32, f32, f32, f32, f32, f32, u8);
void Matrix_SetGfxMtx(Gfx**); void Matrix_SetGfxMtx(Gfx**);
s32 func_80006FD8(u64 arg0, void* arg2, s32* arg3, s32 arg4); s32 Timer_CreateTask(u64, TimerAction, s32*, s32);
void func_80006F20(void); void Memory_FreeAll(void);
void* func_80006F38(s32); void* Memory_Allocate(s32);
void func_80007068(s32* arg0, s32 arg1); void Timer_Increment(s32* address, s32 value);
void func_8000707C(s32* arg0, s32 arg1); void Timer_SetValue(s32* address, s32 value);
void func_80007088(UnkStruct_func_80007088*); void Timer_CompleteTask(TimerTask*);
void func_800070C8(u64); void Timer_Wait(u64);
s32 func_800071FC(SaveFile*); s32 Save_WriteEeprom(SaveFile*);
s32 func_800072E0(SaveFile*); s32 Save_ReadEeprom(SaveFile*);
void Fault_ThreadEntry(void*); void Fault_ThreadEntry(void*);
void func_80007FE4(FrameBuffer*, u16, u16); void func_80007FE4(FrameBuffer*, u16, u16);
@ -136,6 +136,7 @@ s64 __ll_rshift(s64, s64);
void func_8002E3E0(Object_2F4 *arg0); void func_8002E3E0(Object_2F4 *arg0);
void func_8002E548(void); void func_8002E548(void);
void func_8002F5F4(void);
void func_8003DAF0(void); void func_8003DAF0(void);
void func_8003DE68(s32, s32); void func_8003DE68(s32, s32);
void func_80040CDC(void); void func_80040CDC(void);
@ -305,8 +306,8 @@ void func_800C20B0(void);
void func_800C2190(void); void func_800C2190(void);
u16 func_800C2890(u16*); u16 func_800C2890(u16*);
s32 func_800C2F30(u16*, s32); s32 func_800C2F30(u16*, s32);
s32 func_800C3084(void); s32 Save_Write(void);
s32 func_800C3194(void); s32 Save_Read(void);
void func_EFFA40_80187520(s32, void*); void func_EFFA40_80187520(s32, void*);

View File

@ -19,13 +19,13 @@
#include "gfx.h" #include "gfx.h"
typedef enum { typedef enum {
SI_MESG_10 = 10, SI_READ_CONTROLLER = 10,
SI_MESG_11, SI_READ_SAVE,
SI_MESG_12, SI_WRITE_SAVE,
SI_MESG_13, SI_RUMBLE,
SI_MESG_14, SI_SAVE_FAILED,
SI_MESG_15, SI_SAVE_SUCCESS,
SI_MESG_16, SI_CONT_READ_DONE,
} SerialMesg; } SerialMesg;
#define MSG_QUEUE_EMPTY -1 #define MSG_QUEUE_EMPTY -1

View File

@ -33,15 +33,15 @@ typedef struct {
/* 0xC */ s32 compFlag; /* 0xC */ s32 compFlag;
} DmaEntry; // size = 0x10; } DmaEntry; // size = 0x10;
typedef void (*unkFunc_80007088)(s32*, s32); typedef void (*TimerAction)(s32*, s32);
typedef struct { typedef struct {
/* 0x00 */ u8 unk0; /* 0x00 */ u8 active;
/* 0x08 */ OSTimer unk8; /* 0x08 */ OSTimer timer;
/* 0x28 */ unkFunc_80007088 unk28; /* 0x28 */ TimerAction action;
/* 0x2C */ s32* unk2C; /* 0x2C */ s32* address;
/* 0x30 */ s32 unk30; /* 0x30 */ s32 value;
} UnkStruct_func_80007088; // size = 0x38, 0x8 aligned } TimerTask; // size = 0x38, 0x8 aligned
typedef struct { typedef struct {
u16 data[240 * 320]; u16 data[240 * 320];
@ -54,7 +54,7 @@ typedef struct {
/* bit 5 */ u8 unk_5 : 1; /* bit 5 */ u8 unk_5 : 1;
/* bit 6 */ u8 unk_6 : 1; /* bit 6 */ u8 unk_6 : 1;
/* bit 7 */ u8 unk_7 : 1; /* bit 7 */ u8 unk_7 : 1;
} Save_00_SubStruct_00; // size = 0x1 } Save_SubStruct_00; // size = 0x1
typedef struct { typedef struct {
/* bit 0 */ u16 unk_0 : 8; /* bit 0 */ u16 unk_0 : 8;
@ -63,10 +63,10 @@ typedef struct {
/* bit D */ u16 unk_D : 1; /* bit D */ u16 unk_D : 1;
/* bit E */ u16 unk_E : 1; /* bit E */ u16 unk_E : 1;
/* bit F */ u16 unk_F : 1; /* bit F */ u16 unk_F : 1;
} Save_00_SubStruct_5E; // size = 0x10 } Save_SubStruct_5E; // size = 0x10
typedef struct Save_00 { typedef struct{
/* 0x00 */ Save_00_SubStruct_00 unk_00[16]; /* 0x00 */ Save_SubStruct_00 unk_00[16];
/* 0x10 */ char pad10[0x4]; /* 0x10 */ char pad10[0x4];
/* 0x14 */ u8 unk_14; /* 0x14 */ u8 unk_14;
/* 0x15 */ u8 unk_15; /* 0x15 */ u8 unk_15;
@ -76,24 +76,23 @@ typedef struct Save_00 {
/* 0x36 */ u8 unk_36[10]; /* 0x36 */ u8 unk_36[10];
/* 0x40 */ s8 unk_40[10]; /* 0x40 */ s8 unk_40[10];
/* 0x4A */ char pad4A[0x14]; /* 0x4A */ char pad4A[0x14];
/* 0x5E */ Save_00_SubStruct_5E unk_5E[10][7]; /* 0x5E */ Save_SubStruct_5E unk_5E[10][7];
/* 0xEA */ u8 unk_EA; /* 0xEA */ u8 unk_EA;
/* 0xEB */ char padEB[0x3]; /* 0xEB */ char padEB[0x3];
} Save_00; /* 0xEE */ char padEE[0x10];
} SaveData; // size = 0xFE
typedef struct { typedef struct {
/* 0x00 */ u8 unk_00[0xFE]; /* 0x00 */ union {
/* 0xFE */ u16 unk_FE; SaveData data;
} Checksum; u8 raw[sizeof(SaveData)];
};
/* 0xFE */ u16 checksum;
} Save;
typedef union { typedef struct {
/* 0x00 */ Save_00 save_00; /* 0x000 */ Save save;
/* 0x00 */ Checksum checksum; /* 0x100 */ Save backup;
} Save; // size = 0x100
typedef union {
Save save[2];
u8 raw[EEPROM_BLOCK_SIZE*EEPROM_MAXBLOCKS];
} SaveFile; // size = 0x200 } SaveFile; // size = 0x200
typedef struct { typedef struct {

View File

@ -10,7 +10,7 @@ extern u8 gF3dexData;
extern u8 D_8003B50[]; extern u8 D_8003B50[];
extern u8 D_80046B0[]; extern u8 D_80046B0[];
extern s32 D_800C45D0; extern s32 sGammaMode;
extern f32 D_800C45E0[]; extern f32 D_800C45E0[];
extern Mtx gIdentityMtx; // 800C4620 extern Mtx gIdentityMtx; // 800C4620
@ -18,8 +18,8 @@ extern Matrix gIdentityMatrix; //800C4660
extern u8 sFaultCharIndex[]; extern u8 sFaultCharIndex[];
extern s32 sFaultCharPixelFlags[]; extern s32 sFaultCharPixelFlags[];
extern const char* D_800C4870[]; extern const char* sFaultCauses[];
extern const char* D_800C48B8[]; extern const char* sFloatExceptions[];
extern Vec3f D_800C5D28; extern Vec3f D_800C5D28;
extern f32 D_800C5D34; extern f32 D_800C5D34;
@ -33,62 +33,61 @@ extern OSMesgQueue* D_800C7C64;
extern char D_800C7C80[]; extern char D_800C7C80[];
extern OSContPad D_800DD880[4]; extern OSContPad gCurrentInput[4];
extern OSContPad D_800DD898[4]; extern OSContPad gChangedInput[4];
extern u8 D_800DD8B0[4]; extern u8 gControllerStatus[4];
extern s32 D_800DD8B4; extern s32 gStopInputTimer;
extern u8 D_800DD8B8[4]; extern u8 gRumbleStatus[4];
extern u8 D_800DD8BC[4]; // Fake symbol. Only exists as loop terminator for D_800DD8B8 extern u8 D_800DD8BC[4]; // Fake symbol. Only exists as loop terminator for gRumbleStatus
// extern OSContPad D_800DD8C0[4]; // extern OSContPad sNextInput[4];
// extern OSContPad D_800DD8D8[4]; // extern OSContPad sPrevInput[4];
// extern OSContStatus D_800DD8F0[4]; // extern OSContStatus D_800DD8F0[4];
// extern OSPfs D_800DD900[4]; // extern OSPfs D_800DD900[4];
extern u8 gAudioThreadStack[0x1000]; // 800DDAA0 extern u8 gAudioThreadStack[0x1000]; // 800DDAA0
extern OSThread gGraphicsThread; // 800DEAA0 extern OSThread gGraphicsThread; // 800DEAA0
extern u8 gGraphicsThreadStack[0x1000]; // 800DEC50 extern u8 gGraphicsThreadStack[0x1000]; // 800DEC50
extern OSThread gUnkThread3; // 800DFC50 extern OSThread gTimerThread; // 800DFC50
extern u8 gUnkThread3Stack[0x1000]; // 800DFE00 extern u8 gTimerThreadStack[0x1000]; // 800DFE00
extern OSThread gSerialThread; // 800E0E00 extern OSThread gSerialThread; // 800E0E00
extern u8 gSerialThreadStack[0x1000]; // 800E0FB0 extern u8 gSerialThreadStack[0x1000]; // 800E0FB0
extern u8 gUnusedStack[0x1000];
extern SPTask* gCurrentTask; extern SPTask* gCurrentTask;
extern SPTask* D_800E1FB4[1]; extern SPTask* sAudioTasks[1];
extern SPTask* D_800E1FB8[2]; extern SPTask* sGfxTasks[2];
extern SPTask* D_800E1FC0[2]; extern SPTask* sNewAudioTasks[1];
extern SPTask* D_800E1FC8[2]; extern SPTask* sNewGfxTasks[2];
extern u32 gSegments[16]; // 800E1FD0 extern u32 gSegments[16]; // 800E1FD0
extern OSMesgQueue gPiMgrCmdQueue; // 800E2010 extern OSMesgQueue gPiMgrCmdQueue; // 800E2010
extern OSMesg sPiMgrCmdBuff[50]; // 800E2028 extern OSMesg sPiMgrCmdBuff[50]; // 800E2028
extern OSMesgQueue D_800E20F0; extern OSMesgQueue gDmaMsgQueue;
extern void *D_800E2108[1]; extern void *sDmaMsgBuff[1];
extern OSIoMesg D_800E2110; extern OSIoMesg gDmaIOMsg;
extern OSMesgQueue gSerialEventQueue; extern OSMesgQueue gSerialEventQueue;
extern void *D_800E2140[1]; extern void *sSerialEventBuff[1];
extern OSMesgQueue gMainThreadMsgQueue; extern OSMesgQueue gMainThreadMsgQueue;
extern void *D_800E2160[32]; extern void *sMainThreadMsgBuff[32];
extern OSMesgQueue gTaskMsgQueue; extern OSMesgQueue gTaskMsgQueue;
extern void *D_800E21F8[16]; extern void *sTaskMsgBuff[16];
extern OSMesgQueue D_800E2238; extern OSMesgQueue gAudioVImsgQueue;
extern void *D_800E2250[1]; extern void *sAudioVImsgBuff[1];
extern OSMesgQueue D_800E2258; extern OSMesgQueue gAudioTaskMsgQueue;
extern void *D_800E2270[1]; extern void *sAudioTaskMsgBuff[1];
extern OSMesgQueue D_800E2278; extern OSMesgQueue gGfxVImsgQueue;
extern void *D_800E2290[4]; extern void *sGfxVImsgBuff[4];
extern OSMesgQueue D_800E22A0; extern OSMesgQueue gGfxTaskMsgQueue;
extern void *D_800E22B8[2]; extern void *sGfxTaskMsgBuff[2];
extern OSMesgQueue gSerialThreadMsgQueue; extern OSMesgQueue gSerialThreadMsgQueue;
extern void *D_800E22D8[8]; extern void *sSerialThreadMsgBuff[8];
extern OSMesgQueue D_800E22F8; extern OSMesgQueue gControllerMsgQueue;
extern void *D_800E2310[1]; extern void *sControllerMsgBuff[1];
extern OSMesgQueue D_800E2318; extern OSMesgQueue gSaveMsgQueue;
extern void *D_800E2330[1]; extern void *sSaveMsgBuff[1];
extern OSMesgQueue gThread7msgQueue; extern OSMesgQueue gTimerTaskMsgQueue;
extern void *D_800E2350[16]; extern void *sTimerTaskMsgBuff[16];
extern OSMesgQueue D_800E2390; extern OSMesgQueue gTimerWaitMsgQueue;
extern void *D_800E23A8[1]; extern void *sTimerWaitMsgBuff[1];
extern GfxPool gGfxPools[2]; // 800E23B0 extern GfxPool gGfxPools[2]; // 800E23B0
@ -105,26 +104,26 @@ extern s32* D_80137E74;
// some sort of struct? // some sort of struct?
extern u8 D_80137E78; extern u8 D_80137E78;
extern u32 D_80137E7C; extern u32 gFrameCounter;
extern u8 D_80137E80; extern u8 gStartNMI;
extern u8 D_80137E81; extern u8 gStopTasks;
extern u8 D_80137E84[4]; extern u8 D_80137E84[4];
extern u16 D_80137E88; extern u16 gFillScreenColor;
extern u16 D_80137E8A; extern u16 gFillScreen;
extern OSThread sIdleThread; // 80138E90 // extern OSThread sIdleThread; // 80138E90
extern u8 sIdleThreadStack[0x1000]; // 801390A0 // extern u8 sIdleThreadStack[0x1000]; // 801390A0
extern OSThread gMainThread; // 8013A040 // extern OSThread gMainThread; // 8013A040
extern u8 sMainThreadStack[0x1000]; // 8013A1F0 // extern u8 sMainThreadStack[0x1000]; // 8013A1F0
extern OSThread gAudioThread; //8013B1F0 // extern OSThread gAudioThread; //8013B1F0
extern Matrix* D_8013B3C0; extern Matrix* gGfxMatrix;
extern Matrix D_8013B3C8[0x20]; extern Matrix sGfxMatrixStack[0x20];
extern Matrix* D_8013BBC8; extern Matrix* gCalcMatrix;
extern Matrix D_8013BBD0[0x20]; extern Matrix sCalcMatrixStack[0x20];
extern SaveFile D_80144F60; extern SaveFile gSaveIOBuffer;
extern SaveFile D_80145160; extern SaveFile sPrevSaveData;
extern FaultMgr gFaultMgr; extern FaultMgr gFaultMgr;
extern OSMesg D_80156600[1]; extern OSMesg D_80156600[1];
@ -464,7 +463,7 @@ extern f32 D_80178740;
extern s32 D_80178754; extern s32 D_80178754;
extern s32 D_80178758; extern s32 D_80178758;
extern s32 D_80178768[]; extern s32 D_80178768[];
extern SaveFile D_80178870; extern SaveFile gSaveFile;
extern u16 D_Tex_800D99F8[]; extern u16 D_Tex_800D99F8[];
extern u16 D_Tex_800DBA20[]; extern u16 D_Tex_800DBA20[];
@ -550,7 +549,7 @@ extern s32 D_EBFEB0_801ADA94;
extern u8 D_80281000[0x400]; extern u8 D_80281000[0x400];
extern u8 D_80281400[0xC00]; extern u8 D_80281400[0xC00];
extern FrameBuffer D_80282000; // z buffer extern FrameBuffer gZBuffer; // z buffer
extern u8 D_802A7800; extern u8 D_802A7800;
extern u8 D_802D7800; extern u8 D_802D7800;
extern s32 D_80387800; extern s32 D_80387800;

View File

@ -1,40 +1,7 @@
bootproc = 0x80004DA8;
D_800C90F0 = 0x800C90F0; D_800C90F0 = 0x800C90F0;
__libm_qnan_f = 0x800C9570; __libm_qnan_f = 0x800C9570;
D_1 = 0x1; //ignore:true D_1 = 0x1; //ignore:true
Math_ModF = 0x80004E20;
Rand_Init = 0x80004E4C;
Rand_ZeroOne = 0x80004EB0;
Rand_SetSeed = 0x80004FC8;
Rand_ZeroOneSeeded = 0x80004FE8;
Math_Atan2F = 0x80005100;
Math_Atan2F_XY = 0x800051F8;
Math_Atan2F_XYAlt = 0x80005320;
Math_FactorialF = 0x800053C8;
Math_Factorial = 0x800054C8;
Math_PowF = 0x800055DC;
Math_MinMax = 0x80005604;
Matrix_Copy = 0x80005680;
Matrix_Push = 0x80005708;
Matrix_Pop = 0x80005740;
Matrix_Mult = 0x80005754;
Matrix_Translate = 0x80005B00;
Matrix_Scale = 0x80005C34;
Matrix_RotateX = 0x80005D44;
Matrix_RotateY = 0x80005E90;
Matrix_RotateZ = 0x80005FE0;
Matrix_RotateAxis = 0x8000612C;
Matrix_ToMtx = 0x80006500;
Matrix_FromMtx = 0x8000671C;
Matrix_MultVec3f = 0x80006970;
Matrix_MultVec3fNoTranslate = 0x80006A20;
Matrix_GetYRPAngles = 0x80006AB8;
Matrix_GetXYZAngles = 0x80006C7C;
Matrix_LookAt = 0x80006E3C;
Matrix_SetGfxMtx = 0x80006EB8;
D_800C45E0 = 0x800C45E0; D_800C45E0 = 0x800C45E0;
D_800C57EC = 0x800C57EC; D_800C57EC = 0x800C57EC;
@ -43,112 +10,31 @@ D_800C5FF4 = 0x800C5FF4; //type:u16 size:5000
D_80163FE0 = 0x80163FE0; //size:0xB130 D_80163FE0 = 0x80163FE0; //size:0xB130
gZBuffer = 0x80282000;
gFrameBuffers = 0x8038F800;
gDmaTable = 0x80178A70; gDmaTable = 0x80178A70;
D_800D3180 = 0x800D3180; // size:0x1E D_800D3180 = 0x800D3180; // size:0x1E
gSetupDLs = 0x800D31B0; // size:0x18C0 gSetupDLs = 0x800D31B0; // size:0x18C0
D_800DD880 = 0x800DD880; // size:0x18
D_800DD898 = 0x800DD898; // size:0x18
D_800DD8B0 = 0x800DD8B0; // size:0x4
D_800DD8B4 = 0x800DD8B4; // size:0x4
D_800DD8B8 = 0x800DD8B8; // size:0x4
D_800DD8BC = 0x800DD8BC; // ignore:true
D_800DD8C0 = 0x800DD8C0; // size:0x18
D_800DD8D8 = 0x800DD8D8; // size:0x18
D_800DD8F0 = 0x800DD8F0; // size:0x10
D_800DD900 = 0x800DD900; // size:0x1A0 D_800DD900 = 0x800DD900; // size:0x1A0
D_800CBDD4 = 0x800CBDD4; //size:0x98 D_800CBDD4 = 0x800CBDD4; //size:0x98
D_80178870 = 0x80178870; //size:0x200 Save_Checksum = 0x800C2FB0;
Save_Write = 0x800C3084;
D_800E20F0 = 0x800E20F0; Save_Read = 0x800C3194;
gTaskMsgQueue = 0x800E21E0; gSaveFile = 0x80178870; //size:0x200
D_800E2238 = 0x800E2238;
D_800E2258 = 0x800E2258;
D_800E2278 = 0x800E2278;
D_800E22A0 = 0x800E22A0;
gSerialEventQueue = 0x800E2128;
gMainThreadMsgQueue = 0x800E2148;
gThread7msgQueue = 0x800E2338;
D_800E2390 = 0x800E2390;
gSerialThreadMsgQueue = 0x800E22C0;
D_800E22F8 = 0x800E22F8;
D_800E2318 = 0x800E2318;
Thread7_ThreadEntry = 0x800040D4;
SerialInterface_ThreadEntry = 0x80003FEC;
gIdentityMtx = 0x800C4620;
gIdentityMatrix = 0x800C4660;
sFaultCharPixelFlags = 0x800C4770;
sFaultCharIndex = 0x800C46F0;
Math_FAtanF = 0x8001FBE8;
Math_FAtan2F = 0x8001FD0C;
Math_FAsinF = 0x8001FE00;
Math_FAcosF = 0x8001FE30;
Fault_Init = 0x80008018;
func_80003C50 = 0x80003C50;
Idle_ThreadEntry = 0x80004D00;
Main_ThreadEntry = 0x80004ABC;
Audio_ThreadEntry = 0x80003B48;
Graphics_ThreadEntry = 0x80004144;
__rspboot_start = 0x80000450; __rspboot_start = 0x80000450;
__rspboot_end = 0x80000520; __rspboot_end = 0x80000520;
__f3dex_start = 0x80001410; __f3dex_start = 0x80001410;
gF3dexData = 0x800C3DD0; gF3dexData = 0x800C3DD0;
gAudioThreadStack = 0x800DDAA0;
gGraphicsThread = 0x800DEAA0;
gGraphicsThreadStack = 0x800DEC50;
gUnkThread3 = 0x800DFC50;
gUnkThread3Stack = 0x800DFE00;
gSerialThread = 0x800E0E00;
gSerialThreadStack = 0x800E0FB0;
gCurrentTask = 0x800E1FB0;
D_800E1FB4 = 0x800E1FB4;
D_800E1FB8 = 0x800E1FB8;
D_800E1FC0 = 0x800E1FC0;
D_800E1FC8 = 0x800E1FC8;
D_800CBD3C = 0x800CBD3C; D_800CBD3C = 0x800CBD3C;
gPiMgrCmdQueue = 0x800E2010;
sPiMgrCmdBuff = 0x800E2028;
sIdleThread = 0x80138E90;
sIdleThreadStack = 0x80139040;
gMainThread = 0x8013A040;
sMainThreadStack = 0x8013A1F0;
gAudioThread = 0x8013B1F0;
gSegments = 0x800E1FD0;
gGfxPools = 0x800E23B0; // size:0x55AA0
gGfxPool = 0x80137E50;
gGfxTask = 0x80137E54;
gViewport = 0x80137E58;
gGfxMtx = 0x80137E5C;
gUnkDisp1 = 0x80137E60;
gMasterDisp = 0x80137E64;
gUnkDisp2 = 0x80137E68;
gLight = 0x80137E6C;
gFrameBuffer = 0x80137E70;
D_80137E74 = 0x80137E74;
gFrameBuffers = 0x8038F800;
D_8013C3D0 = 0x8013C3D0; // size:0x8800
gFaultMgr = 0x80145360; // size:0x9D8
D_80177E88 = 0x80177E88; // size:0xC D_80177E88 = 0x80177E88; // size:0xC
Mio0_Decompress = 0x8001EE70;
RdRam_CheckIPL3 = 0x8001EF10;
D_800CFA54 = 0x800CFA54; D_800CFA54 = 0x800CFA54;
D_800D934C = 0x800D934C; // force_migration:True D_800D934C = 0x800D934C; // force_migration:True

View File

@ -0,0 +1,124 @@
// joybus
Controller_AddDeadZone = 0x80002840;
Controller_Init = 0x8000291C;
Controller_UpdateInput = 0x800029A8;
Controller_ReadData = 0x80002AF4;
Save_ReadData = 0x80002BE8;
Save_WriteData = 0x80002C50;
Controller_Rumble = 0x80002CB8;
// lib
Lib_vsPrintf = 0x80002E80;
Lib_vTable = 0x80002EA0;
Lib_SwapBuffers = 0x80002EE4;
Lib_QuickSort = 0x80002F88;
Lib_Perspective = 0x8000316C;
Lib_Ortho = 0x800032B4;
Lib_DmaRead = 0x800033E0;
Lib_FillScreen = 0x800034E8;
// lights
Lights_AddLight = 0x800035D0;
Lights_SetOneLight = 0x8000372C;
Lights_SetTwoLights = 0x800038AC;
// main
Main_Initialize = 0x80003A50;
Audio_ThreadEntry = 0x80003B48;
Graphics_SetTask = 0x80003C50;
Graphics_InitializeTask = 0x80003DC0;
Main_SetVIMode = 0x80003EE0;
SerialInterface_ThreadEntry = 0x80003FEC;
Timer_ThreadEntry = 0x800040D4;
Graphics_ThreadEntry = 0x80004144;
Main_HandleRDP = 0x80004714;
Main_StartNextTask = 0x800049D4;
Main_ThreadEntry = 0x80004ABC;
Idle_ThreadEntry = 0x80004D00;
bootproc = 0x80004DA8;
// math
Math_ModF = 0x80004E20;
Rand_Init = 0x80004E4C;
Rand_ZeroOne = 0x80004EB0;
Rand_SetSeed = 0x80004FC8;
Rand_ZeroOneSeeded = 0x80004FE8;
Math_Atan2F = 0x80005100;
Math_Atan2F_XY = 0x800051F8;
Math_Atan2F_XYAlt = 0x80005320;
Math_FactorialF = 0x800053C8;
Math_Factorial = 0x800054C8;
Math_PowF = 0x800055DC;
Math_MinMax = 0x80005604;
// matrix
Matrix_Copy = 0x80005680;
Matrix_Push = 0x80005708;
Matrix_Pop = 0x80005740;
Matrix_Mult = 0x80005754;
Matrix_Translate = 0x80005B00;
Matrix_Scale = 0x80005C34;
Matrix_RotateX = 0x80005D44;
Matrix_RotateY = 0x80005E90;
Matrix_RotateZ = 0x80005FE0;
Matrix_RotateAxis = 0x8000612C;
Matrix_ToMtx = 0x80006500;
Matrix_FromMtx = 0x8000671C;
Matrix_MultVec3f = 0x80006970;
Matrix_MultVec3fNoTranslate = 0x80006A20;
Matrix_GetYRPAngles = 0x80006AB8;
Matrix_GetXYZAngles = 0x80006C7C;
Matrix_LookAt = 0x80006E3C;
Matrix_SetGfxMtx = 0x80006EB8;
// memory
Memory_FreeAll = 0x80006F20;
Memory_Allocate = 0x80006F38;
// thread 7
Timer_AllocateTask = 0x80006F60;
Timer_Increment = 0x80007068;
Timer_SetValue = 0x8000707C;
Timer_CompleteTask = 0x80007088;
Timer_Wait = 0x800070C8;
// save
Save_ReadBlock = 0x80007130;
Save_WriteBlock = 0x8000716C;
Save_WriteEeprom = 0x800071FC;
Save_ReadEeprom = 0x800072E0;
// fault
func_800073C0 = 0x800073C0;
func_800074AC = 0x800074AC;
func_80007604 = 0x80007604;
func_8000762C = 0x8000762C;
func_8000770C = 0x8000770C;
func_800077F8 = 0x800077F8;
func_80007880 = 0x80007880;
func_80007910 = 0x80007910;
func_80007CEC = 0x80007CEC;
func_80007FE4 = 0x80007FE4;
Fault_Init = 0x80008018;
// audio
// hasm
Mio0_Decompress = 0x8001EE70;
RdRam_CheckIPL3 = 0x8001EF10;
// math64
Math_FAtanF = 0x8001FBE8;
Math_FAtan2F = 0x8001FD0C;
Math_FAsinF = 0x8001FE00;
Math_FAcosF = 0x8001FE30;

View File

@ -0,0 +1,121 @@
// joybus
gCurrentInput = 0x800DD880; // size:0x18
gChangedInput = 0x800DD898; // size:0x18
gControllerStatus = 0x800DD8B0; // size:0x4
gStopInputTimer = 0x800DD8B4; // size:0x4
gRumbleStatus = 0x800DD8B8; // size:0x4
D_800DD8BC = 0x800DD8BC; // ignore:true
sNextInput = 0x800DD8C0; // size:0x18
sPrevInput = 0x800DD8D8; // size:0x18
D_800DD8F0 = 0x800DD8F0; // size:0x10
// main
gAudioThreadStack = 0x800DDAA0;
gGraphicsThread = 0x800DEAA0;
gGraphicsThreadStack = 0x800DEC50;
gTimerThread = 0x800DFC50;
gTimerThreadStack = 0x800DFE00;
gSerialThread = 0x800E0E00;
gSerialThreadStack = 0x800E0FB0;
gCurrentTask = 0x800E1FB0;
sAudioTasks = 0x800E1FB4;
sGfxTasks = 0x800E1FB8;
sNewAudioTasks = 0x800E1FC0;
sNewGfxTasks = 0x800E1FC8;
gSegments = 0x800E1FD0;
gPiMgrCmdQueue = 0x800E2010;
sPiMgrCmdBuff = 0x800E2028;
gDmaMsgQueue = 0x800E20F0;
sDmaMsgBuff = 0x800E2108;
gDmaIOMsg = 0x800E2110;
gSerialEventQueue = 0x800E2128;
sSerialEventBuff = 0x800E2140;
gMainThreadMsgQueue = 0x800E2148;
sMainThreadMsgBuff = 0x800E2160;
gTaskMsgQueue = 0x800E21E0;
sTaskMsgBuff = 0x800E21F8;
gAudioVImsgQueue = 0x800E2238;
gAudioTaskMsgQueue = 0x800E2258;
gGfxVImsgQueue = 0x800E2278;
gGfxTaskMsgQueue = 0x800E22A0;
sAudioVImsgBuff = 0x800E2250;
sAudioTaskMsgBuff = 0x800E2270;
sGfxVImsgBuff = 0x800E2290;
sGfxTaskMsgBuff = 0x800E22B8;
gSerialThreadMsgQueue = 0x800E22C0;
sSerialThreadMsgBuff = 0x800E22D8;
gControllerMsgQueue = 0x800E22F8;
sControllerMsgBuff = 0x800E2310;
gSaveMsgQueue = 0x800E2318;
sSaveMsgBuff = 0x800E2330;
gTimerTaskMsgQueue = 0x800E2338;
sTimerTaskMsgBuff = 0x800E2350;
gTimerWaitMsgQueue = 0x800E2390;
sTimerWaitMsgBuff = 0x800E23A8;
gGfxPools = 0x800E23B0; // size:0x55AA0
gGfxPool = 0x80137E50;
gGfxTask = 0x80137E54;
gViewport = 0x80137E58;
gGfxMtx = 0x80137E5C;
gUnkDisp1 = 0x80137E60;
gMasterDisp = 0x80137E64;
gUnkDisp2 = 0x80137E68;
gLight = 0x80137E6C;
gFrameBuffer = 0x80137E70;
D_80137E74 = 0x80137E74;
D_80137E78 = 0x80137E78;
gFrameCounter = 0x80137E7C;
gStartNMI = 0x80137E80;
gStopTasks = 0x80137E81;
D_80137E84 = 0x80137E84; // size:0x4
gFillScreenColor = 0x80137E88;
gFillScreen = 0x80137E8A;
gUnusedStack = 0x80137E90;
sIdleThread = 0x80138E90;
sIdleThreadStack = 0x80139040;
gMainThread = 0x8013A040;
sMainThreadStack = 0x8013A1F0;
gAudioThread = 0x8013B1F0;
// math
sSeededRandSeed3 = 0x8013B3A0;
sRandSeed1 = 0x8013B3A4;
sRandSeed2 = 0x8013B3A8;
sRandSeed3 = 0x8013B3AC;
sSeededRandSeed1 = 0x8013B3B0;
sSeededRandSeed2 = 0x8013B3B4;
// matrix
gIdentityMtx = 0x800C4620;
gIdentityMatrix = 0x800C4660;
gGfxMatrix = 0x8013B3C0;
sGfxMatrixStack = 0x8013B3C8;
gCalcMatrix = 0x8013BBC8;
sCalcMatrixStack = 0x8013BBD0;
// memory
sMemoryBuffer = 0x8013C3D0; // size:0x8800
sMemoryPtr = 0x80144BD0;
// thread 7
sTimerTasks = 0x80144BE0;
// save
gSaveIOBuffer = 0x80144F60;
sPrevSaveData = 0x80145160;
// fault
gFaultMgr = 0x80145360; // size:0x9D8
sFaultCharIndex = 0x800C46F0;
sFaultCharPixelFlags = 0x800C4770;
sFaultCauses = 0x800C4870;
sFloatExceptions = 0x800C48B8;
// audio

View File

@ -27,3 +27,5 @@
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonbrk/__rmonHitCpuFault.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonbrk/__rmonHitCpuFault.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonbrk/rmonFindFaultedThreads.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonbrk/rmonFindFaultedThreads.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonbrk/D_800C9880.s")

View File

@ -18,3 +18,5 @@ int __rmonSetComm(KKHeader* req) {
return TV_ERROR_NO_ERROR; return TV_ERROR_NO_ERROR;
} }
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonmisc/D_800C97D0.s")

View File

@ -44,3 +44,5 @@ s32 rmonGetRcpRegister(s32 arg0) {
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonregs/__rmonSetVRegs.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonregs/__rmonSetVRegs.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonregs/__rmonGetRegisterContents.s") #pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonregs/__rmonGetRegisterContents.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/rmon/rmonregs/D_800C9800.s")

View File

@ -1,157 +0,0 @@
#include "global.h"
#ifdef DATA_IMPORT_PENDING
OSContPad D_800DD880[4];
OSContPad D_800DD898[4];
u8 D_800DD8B0[4];
s32 D_800DD8B4;
u8 D_800DD8B8[4];
OSContPad D_800DD8C0[4]; //
OSContPad D_800DD8D8[4]; //
OSContStatus D_800DD8F0[4]; //
OSPfs D_800DD900[4]; //
#else
extern OSContPad D_800DD8C0[4]; //
extern OSContPad D_800DD8D8[4]; //
extern OSContStatus D_800DD8F0[4]; //
extern OSPfs D_800DD900[4]; //
#endif
void func_80002840(s32 contrNum) {
s32 temp_v0 = D_800DD880[contrNum].stick_x;
s32 temp_a2 = D_800DD880[contrNum].stick_y;
s32 var_a0;
s32 var_v0;
if ((temp_v0 >= -16) && (temp_v0 <= 16)) {
var_a0 = 0;
} else if (temp_v0 > 16) {
var_a0 = temp_v0 - 16;
} else {
var_a0 = temp_v0 + 16;
}
if ((temp_a2 >= -16) && (temp_a2 <= 16)) {
var_v0 = 0;
} else if (temp_a2 > 16) {
var_v0 = temp_a2 - 16;
} else {
var_v0 = temp_a2 + 16;
}
if (var_a0 > 60) {
var_a0 = 60;
}
if (var_a0 < -60) {
var_a0 = -60;
}
if (var_v0 > 60) {
var_v0 = 60;
}
if (var_v0 < -60) {
var_v0 = -60;
}
D_800DD898[contrNum].stick_x = var_a0;
D_800DD898[contrNum].stick_y = var_v0;
}
void func_8000291C(void) {
u8 sp1F;
s32 i;
osContInit(&gSerialEventQueue, &sp1F, D_800DD8F0);
for (i = 0; i < 4; i++) {
D_800DD8B0[i] = (sp1F >> i) & 1;
D_800DD8B8[i] = 0;
}
}
void func_800029A8(void) {
s32 i;
for (i = 0; i < 4; i++) {
if (D_800DD8B0[i] == 1 && D_800DD8C0[i].errno == 0) {
D_800DD8D8[i] = D_800DD880[i];
D_800DD880[i] = D_800DD8C0[i];
D_800DD898[i].button = (D_800DD880[i].button ^ D_800DD8D8[i].button) & D_800DD880[i].button;
func_80002840(i);
} else {
D_800DD880[i].button = D_800DD880[i].stick_x = D_800DD880[i].stick_y = D_800DD880[i].errno =
D_800DD898[i].button = D_800DD898[i].stick_x = D_800DD898[i].stick_y = D_800DD898[i].errno = 0;
}
}
}
#ifdef DATA_IMPORT_PENDING // requires data import on D_800DD8C0
void func_80002AF4(void) {
s32 i;
if (D_800DD8B4 != 0) {
D_800DD8B4--;
for (i = 0; i < 4; i++) {
D_800DD8C0[i].button = D_800DD8C0[i].stick_x = D_800DD8C0[i].stick_y = D_800DD8C0[i].errno = 0;
}
} else {
osContStartReadData(&gSerialEventQueue);
osRecvMesg(&gSerialEventQueue, NULL, OS_MESG_BLOCK);
osContGetReadData(D_800DD8C0);
}
osSendMesg(&D_800E22F8, (OSMesg) SI_MESG_16, OS_MESG_PRI_NORMAL);
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/3440/func_80002AF4.s")
#endif
void func_80002BE8(void) {
if ((D_80137E80 == 0) && (func_800072E0(&D_80144F60) == 0)) {
osSendMesg(&D_800E2318, (OSMesg) SI_MESG_15, OS_MESG_PRI_NORMAL);
return;
}
osSendMesg(&D_800E2318, (OSMesg) SI_MESG_14, OS_MESG_PRI_NORMAL);
}
void func_80002C50(void) {
if ((D_80137E80 == 0) && (func_800071FC(&D_80144F60) == 0)) {
osSendMesg(&D_800E2318, (OSMesg) SI_MESG_15, OS_MESG_PRI_NORMAL);
return;
}
osSendMesg(&D_800E2318, (OSMesg) SI_MESG_14, OS_MESG_PRI_NORMAL);
}
void func_80002CB8(void) {
s32 i;
osContStartQuery(&gSerialEventQueue);
osRecvMesg(&gSerialEventQueue, NULL, OS_MESG_BLOCK);
osContGetQuery(D_800DD8F0);
for (i = 0; i < 4; i++) {
if ((D_800DD8B0[i] != 0) && (D_800DD8F0[i].errno == 0)) {
if (D_800DD8F0[i].status & 1) {
if (D_800DD8B8[i] == 0) {
if (osMotorInit(&gSerialEventQueue, &D_800DD900[i], i)) {
D_800DD8B8[i] = 0;
} else {
D_800DD8B8[i] = 1;
}
}
if (D_800DD8B8[i] == 1) {
if (D_80137E84[i] != 0) {
if (osMotorStart(&D_800DD900[i])) {
D_800DD8B8[i] = 0;
}
} else {
if (osMotorStop(&D_800DD900[i])) {
D_800DD8B8[i] = 0;
}
}
}
} else {
D_800DD8B8[i] = 0;
}
}
}
for (i = 0; i < 4; i++) {
D_80137E84[i] = 0;
}
}

View File

@ -1,42 +0,0 @@
#include "global.h"
void func_800033E0(void* var_s2, void* var_s1, ptrdiff_t var_s0) {
osInvalICache(var_s1, var_s0);
osInvalDCache(var_s1, var_s0);
while (var_s0 > 0x100) {
osPiStartDma(&D_800E2110, 0, 0, (uintptr_t) var_s2, var_s1, 0x100, &D_800E20F0);
var_s0 -= 0x100;
var_s2 = (void*) ((uintptr_t) var_s2 + 0x100);
var_s1 = (void*) ((uintptr_t) var_s1 + 0x100);
osRecvMesg(&D_800E20F0, NULL, OS_MESG_BLOCK);
}
if (var_s0 != 0) {
osPiStartDma(&D_800E2110, 0, 0, (uintptr_t) var_s2, var_s1, var_s0, &D_800E20F0);
osRecvMesg(&D_800E20F0, NULL, OS_MESG_BLOCK);
}
}
void func_800034E8(u8 arg0) {
s32 i;
D_80137E88 |= 1;
if (arg0 == 1) {
if (D_80137E8A == 0) {
if (D_80137E88 == 1) {
osViBlack(1);
} else {
for (i = 0; i < 0x3C0; i++) {
D_8038F080[i] = D_80137E88;
}
osWritebackDCacheAll();
osViSwapBuffer(&D_8038F300);
osViRepeatLine(1);
}
D_80137E8A = 1;
}
} else if (D_80137E8A == 1) {
osViRepeatLine(0);
osViBlack(0);
D_80137E8A = 0;
}
}

View File

@ -1,15 +0,0 @@
#include "global.h"
extern s32 D_8013C3D0[0x2200];
extern s32* D_80144BD0;
void func_80006F20(void) {
D_80144BD0 = D_8013C3D0;
}
void* func_80006F38(s32 arg0) {
void* tmp = D_80144BD0;
D_80144BD0 = (void*) (((arg0 + 0xF) & ~0xF) + (uintptr_t) D_80144BD0);
return tmp;
}

View File

@ -1,51 +0,0 @@
#include "global.h"
extern UnkStruct_func_80007088 D_80144BE0[0x10];
UnkStruct_func_80007088* func_80006F60(void) {
s32 i;
for (i = 0; i < 0x10; i++) {
if (D_80144BE0[i].unk0 == 0) {
return &D_80144BE0[i];
}
}
return NULL;
}
s32 func_80006FD8(u64 arg0, void* arg2, s32* arg3, s32 arg4) {
UnkStruct_func_80007088* temp_v0;
temp_v0 = func_80006F60();
if (temp_v0 == NULL) {
return -1;
}
temp_v0->unk0 = 1;
temp_v0->unk28 = arg2;
temp_v0->unk2C = arg3;
temp_v0->unk30 = arg4;
return osSetTimer(&temp_v0->unk8, arg0, 0, &gThread7msgQueue, temp_v0);
}
void func_80007068(s32* arg0, s32 arg1) {
*arg0 += arg1;
}
void func_8000707C(s32* arg0, s32 arg1) {
*arg0 = arg1;
}
void func_80007088(UnkStruct_func_80007088* arg0) {
if (arg0->unk28 != NULL) {
arg0->unk28(arg0->unk2C, arg0->unk30);
}
arg0->unk0 = 0;
}
void func_800070C8(u64 arg0) {
OSTimer sp30;
OSMesg sp2C;
osSetTimer(&sp30, arg0, 0, &D_800E2390, NULL);
osRecvMesg(&D_800E2390, &sp2C, OS_MESG_BLOCK);
}

View File

@ -1,12 +1,52 @@
#include "global.h" #include "global.h"
#ifdef DATA_IMPORT_PENDING
FaultMgr gFaultMgr; FaultMgr gFaultMgr;
s32 sFaultCharPixelFlags[0x40];
u8 sFaultCharIndex[0x80]; u8 sFaultCharIndex[0x80] = {
const char* D_800C4870[18]; 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
const char* D_800C48B8[6]; 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x29, 0xFF, 0xFF, 0xFF, 0x2B,
#endif 0xFF, 0xFF, 0x25, 0x26, 0xFF, 0x2A, 0xFF, 0x27, 0x2C, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
0x09, 0x24, 0xFF, 0xFF, 0xFF, 0xFF, 0x28, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14,
0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
};
s32 sFaultCharPixelFlags[0x40] = {
0x70871C30, 0x8988A250, 0x88808290, 0x88831C90, 0x888402F8, 0x88882210, 0x71CF9C10, 0xF9CF9C70,
0x8228A288, 0xF200A288, 0x0BC11C78, 0x0A222208, 0x8A222288, 0x71C21C70, 0x23C738F8, 0x5228A480,
0x8A282280, 0x8BC822F0, 0xFA282280, 0x8A28A480, 0x8BC738F8, 0xF9C89C08, 0x82288808, 0x82088808,
0xF2EF8808, 0x82288888, 0x82288888, 0x81C89C70, 0x8A08A270, 0x920DA288, 0xA20AB288, 0xC20AAA88,
0xA208A688, 0x9208A288, 0x8BE8A270, 0xF1CF1CF8, 0x8A28A220, 0x8A28A020, 0xF22F1C20, 0x82AA0220,
0x82492220, 0x81A89C20, 0x8A28A288, 0x8A28A288, 0x8A289488, 0x8A2A8850, 0x894A9420, 0x894AA220,
0x70852220, 0xF8011000, 0x08020800, 0x10840400, 0x20040470, 0x40840400, 0x80020800, 0xF8011000,
0x70800000, 0x88822200, 0x08820400, 0x108F8800, 0x20821000, 0x00022200, 0x20800020, 0x00000000,
};
const char* sFaultCauses[18] = {
"Interrupt",
"TLB modification",
"TLB exception on load",
"TLB exception on store",
"Address error on load",
"Address error on store",
"Bus error on inst.",
"Bus error on data",
"System call exception",
"Breakpoint exception",
"Reserved instruction",
"Coprocessor unusable",
"Arithmetic overflow",
"Trap exception",
"Virtual coherency on inst.",
"Floating point exception",
"Watchpoint exception",
"Virtual coherency on data",
};
const char* sFloatExceptions[6] = {
"Unimplemented operation", "Invalid operation", "Division by zero", "Overflow", "Underflow", "Inexact operation",
};
void func_800073C0(s32 arg0, s32 arg1, s32 arg2, s32 arg3) { void func_800073C0(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {
u16* var_v0; u16* var_v0;
@ -79,63 +119,15 @@ void func_8000762C(s32 arg0, s32 arg1, const char* fmt, ...) {
va_end(args); va_end(args);
} }
void func_8000770C(s32 arg0) { void func_8000770C(s32 time) {
u64 temp_ret_4 = MSEC_TO_CYCLES(arg0); u64 time64 = MSEC_TO_CYCLES(time);
osSetTime(0); osSetTime(0);
while (osGetTime() < temp_ret_4) { while (osGetTime() < time64) {
; ;
} }
} }
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8240.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C824C.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8260.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8278.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8290.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C82A8.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C82C0.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C82D4.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C82E8.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8300.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8318.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8330.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8348.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C835C.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C836C.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8388.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C83A4.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C83BC.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C83D8.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C83F0.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8404.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8418.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8424.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/7FC0/D_800C8430.s")
void func_800077F8(s32 arg0, s32 arg1, s32 arg2, f32* arg3) { void func_800077F8(s32 arg0, s32 arg1, s32 arg2, f32* arg3) {
u32 temp_v0 = *(u32*) arg3; u32 temp_v0 = *(u32*) arg3;
s32 temp_v1 = ((temp_v0 & 0x7F800000) >> 0x17) - 0x7F; s32 temp_v1 = ((temp_v0 & 0x7F800000) >> 0x17) - 0x7F;
@ -154,7 +146,7 @@ void func_80007880(u32 arg0) {
func_8000762C(0x1E, 0xA0, "FPCSR:%08XH", arg0); func_8000762C(0x1E, 0xA0, "FPCSR:%08XH", arg0);
for (var_v0 = 0; var_v0 < 6; var_v0++, var_v1 >>= 1) { for (var_v0 = 0; var_v0 < 6; var_v0++, var_v1 >>= 1) {
if (arg0 & var_v1) { if (arg0 & var_v1) {
func_8000762C(0x84, 0xA0, "(%s)", D_800C48B8[var_v0]); func_8000762C(0x84, 0xA0, "(%s)", sFloatExceptions[var_v0]);
return; return;
} }
} }
@ -174,7 +166,7 @@ void func_80007910(OSThread* thread) {
} }
func_8000770C(3000); func_8000770C(3000);
func_800073C0(15, 15, 290, 210); func_800073C0(15, 15, 290, 210);
func_8000762C(30, 40, "THREAD:%d (%s)", thread->id, D_800C4870[var_s0]); func_8000762C(30, 40, "THREAD:%d (%s)", thread->id, sFaultCauses[var_s0]);
func_8000762C(30, 50, "PC:%08XH SR:%08XH\tVA:%08XH", context->pc, context->sr, context->badvaddr); func_8000762C(30, 50, "PC:%08XH SR:%08XH\tVA:%08XH", context->pc, context->sr, context->badvaddr);
osWritebackDCacheAll(); osWritebackDCacheAll();
func_8000762C(30, 60, "AT:%08XH V0:%08XH\tV1:%08XH", (s32) context->at, (s32) context->v0, (s32) context->v1); func_8000762C(30, 60, "AT:%08XH V0:%08XH\tV1:%08XH", (s32) context->at, (s32) context->v0, (s32) context->v1);
@ -247,14 +239,14 @@ void Fault_ThreadEntry(void* arg0) {
} }
func_8000762C(300, 10, "-"); func_8000762C(300, 10, "-");
D_800DD8B0[0] = 1; gControllerStatus[0] = 1;
while (var_s5 == 0) { while (var_s5 == 0) {
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_10, OS_MESG_PRI_NORMAL); osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_READ_CONTROLLER, OS_MESG_PRI_NORMAL);
osRecvMesg(&D_800E22F8, NULL, OS_MESG_BLOCK); osRecvMesg(&gControllerMsgQueue, NULL, OS_MESG_BLOCK);
func_800029A8(); Controller_UpdateInput();
switch (var_s0) { switch (var_s0) {
case 0: case 0:
if (D_800DD880[0].button == 0x16) { if (gCurrentInput[0].button == (R_TRIG | D_CBUTTONS | L_CBUTTONS)) {
var_s0++; var_s0++;
var_s2 = 4000; var_s2 = 4000;
} }
@ -262,11 +254,11 @@ void Fault_ThreadEntry(void* arg0) {
case 1: case 1:
case 2: case 2:
case 7: case 7:
if (D_800DD880[0].button & 0x10) { if (gCurrentInput[0].button & R_TRIG) {
if (D_800DD898[0].button == 0x8000) { if (gChangedInput[0].button == A_BUTTON) {
var_s0++; var_s0++;
var_s2 = 3000; var_s2 = 3000;
} else if (D_800DD898[0].button != 0) { } else if (gChangedInput[0].button != 0) {
var_s0 = 0; var_s0 = 0;
} }
} }
@ -274,11 +266,11 @@ void Fault_ThreadEntry(void* arg0) {
case 3: case 3:
case 4: case 4:
case 8: case 8:
if (D_800DD880[0].button & 0x10) { if (gCurrentInput[0].button & R_TRIG) {
if (D_800DD898[0].button == 0x4000) { if (gChangedInput[0].button == B_BUTTON) {
var_s0++; var_s0++;
var_s2 = 3000; var_s2 = 3000;
} else if (D_800DD898[0].button != 0) { } else if (gChangedInput[0].button != 0) {
var_s0 = 0; var_s0 = 0;
} }
} }
@ -290,21 +282,21 @@ void Fault_ThreadEntry(void* arg0) {
case 11: case 11:
case 12: case 12:
case 13: case 13:
if (D_800DD880[0].button & 0x10) { if (gCurrentInput[0].button & R_TRIG) {
if (D_800DD898[0].button == 2) { if (gChangedInput[0].button == L_CBUTTONS) {
var_s0++; var_s0++;
var_s2 = 3000; var_s2 = 3000;
} else if (D_800DD898[0].button != 0) { } else if (gChangedInput[0].button != 0) {
var_s0 = 0; var_s0 = 0;
} }
} }
break; break;
case 14: case 14:
if (D_800DD880[0].button & 0x10) { if (gCurrentInput[0].button & R_TRIG) {
if (D_800DD898[0].button == 0x1000) { if (gChangedInput[0].button == START_BUTTON) {
var_s0++; var_s0++;
var_s2 = 3000; var_s2 = 3000;
} else if (D_800DD898[0].button != 0) { } else if (gChangedInput[0].button != 0) {
var_s0 = 0; var_s0 = 0;
} }
} }
@ -337,6 +329,6 @@ void Fault_Init(void) {
gFaultMgr.height = SCREEN_HEIGHT; gFaultMgr.height = SCREEN_HEIGHT;
osCreateMesgQueue(&gFaultMgr.msgQueue, &gFaultMgr.msg, 1); osCreateMesgQueue(&gFaultMgr.msgQueue, &gFaultMgr.msg, 1);
osCreateThread(&gFaultMgr.thread, THREAD_ID_FAULT, Fault_ThreadEntry, 0, gFaultMgr.stack + sizeof(gFaultMgr.stack), osCreateThread(&gFaultMgr.thread, THREAD_ID_FAULT, Fault_ThreadEntry, 0, gFaultMgr.stack + sizeof(gFaultMgr.stack),
0x7F); 127);
osStartThread(&gFaultMgr.thread); osStartThread(&gFaultMgr.thread);
} }

61
src/main/fox_save.c Normal file
View File

@ -0,0 +1,61 @@
#include "global.h"
SaveFile gSaveFile;
u16 Save_Checksum(Save* arg0) {
u16 var_v1;
s32 i;
for (i = 0, var_v1 = 0; i < sizeof(SaveData); i++) {
var_v1 ^= arg0->raw[i];
var_v1 <<= 1;
var_v1 = (var_v1 & 0xFE) | ((var_v1 >> 8) & 1);
}
var_v1 = (var_v1 & 0xFF) | 0x9500;
return var_v1;
}
s32 Save_Write(void) {
void* sp1C;
gSaveFile.save.checksum = Save_Checksum(&gSaveFile.save);
gSaveFile.backup = gSaveFile.save;
gSaveIOBuffer = gSaveFile;
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_WRITE_SAVE, OS_MESG_PRI_NORMAL);
osRecvMesg(&gSaveMsgQueue, &sp1C, OS_MESG_BLOCK);
if (sp1C != (OSMesg) SI_SAVE_SUCCESS) {
return -1;
}
return 0;
}
s32 Save_Read(void) {
void* sp24;
s32 i;
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_READ_SAVE, OS_MESG_PRI_NORMAL);
osRecvMesg(&gSaveMsgQueue, &sp24, OS_MESG_BLOCK);
if ((s32) sp24 != SI_SAVE_SUCCESS) {
return -1;
}
gSaveFile = gSaveIOBuffer;
if (gSaveFile.save.checksum == Save_Checksum(&gSaveFile.save)) {
(void) " 正常\n";
return 0;
}
for (i = 0; i <= sizeof(SaveData); i++) { // should be <, but gets overwritten immediately.
gSaveFile.save.raw[i] = gSaveFile.backup.raw[i];
}
gSaveFile.save.checksum = gSaveFile.backup.checksum;
if (gSaveFile.save.checksum == Save_Checksum(&gSaveFile.save)) {
(void) " 1 正常\n";
return 0;
}
(void) " 1 異常\n";
return -1;
}

147
src/main/joybus.c Normal file
View File

@ -0,0 +1,147 @@
#include "global.h"
OSContPad gCurrentInput[4];
OSContPad gChangedInput[4];
u8 gControllerStatus[4];
s32 gStopInputTimer;
u8 gRumbleStatus[4];
OSContPad sNextInput[4]; //
OSContPad sPrevInput[4]; //
OSContStatus D_800DD8F0[4]; //
OSPfs D_800DD900[4]; //
void Controller_AddDeadZone(s32 contrNum) {
s32 temp_v0 = gCurrentInput[contrNum].stick_x;
s32 temp_a2 = gCurrentInput[contrNum].stick_y;
s32 var_a0;
s32 var_v0;
if ((temp_v0 >= -16) && (temp_v0 <= 16)) {
var_a0 = 0;
} else if (temp_v0 > 16) {
var_a0 = temp_v0 - 16;
} else {
var_a0 = temp_v0 + 16;
}
if ((temp_a2 >= -16) && (temp_a2 <= 16)) {
var_v0 = 0;
} else if (temp_a2 > 16) {
var_v0 = temp_a2 - 16;
} else {
var_v0 = temp_a2 + 16;
}
if (var_a0 > 60) {
var_a0 = 60;
}
if (var_a0 < -60) {
var_a0 = -60;
}
if (var_v0 > 60) {
var_v0 = 60;
}
if (var_v0 < -60) {
var_v0 = -60;
}
gChangedInput[contrNum].stick_x = var_a0;
gChangedInput[contrNum].stick_y = var_v0;
}
void Controller_Init(void) {
u8 sp1F;
s32 i;
osContInit(&gSerialEventQueue, &sp1F, D_800DD8F0);
for (i = 0; i < 4; i++) {
gControllerStatus[i] = (sp1F >> i) & 1;
gRumbleStatus[i] = 0;
}
}
void Controller_UpdateInput(void) {
s32 i;
for (i = 0; i < 4; i++) {
if (gControllerStatus[i] == 1 && sNextInput[i].errno == 0) {
sPrevInput[i] = gCurrentInput[i];
gCurrentInput[i] = sNextInput[i];
gChangedInput[i].button = (gCurrentInput[i].button ^ sPrevInput[i].button) & gCurrentInput[i].button;
Controller_AddDeadZone(i);
} else {
gCurrentInput[i].button = gCurrentInput[i].stick_x = gCurrentInput[i].stick_y = gCurrentInput[i].errno =
gChangedInput[i].button = gChangedInput[i].stick_x = gChangedInput[i].stick_y = gChangedInput[i].errno =
0;
}
}
}
void Controller_ReadData(void) {
s32 i;
if (gStopInputTimer != 0) {
gStopInputTimer--;
for (i = 0; i < 4; i++) {
sNextInput[i].button = sNextInput[i].stick_x = sNextInput[i].stick_y = sNextInput[i].errno = 0;
}
} else {
osContStartReadData(&gSerialEventQueue);
osRecvMesg(&gSerialEventQueue, NULL, OS_MESG_BLOCK);
osContGetReadData(sNextInput);
}
osSendMesg(&gControllerMsgQueue, (OSMesg) SI_CONT_READ_DONE, OS_MESG_PRI_NORMAL);
}
void Save_ReadData(void) {
if ((gStartNMI == 0) && (Save_ReadEeprom(&gSaveIOBuffer) == 0)) {
osSendMesg(&gSaveMsgQueue, (OSMesg) SI_SAVE_SUCCESS, OS_MESG_PRI_NORMAL);
return;
}
osSendMesg(&gSaveMsgQueue, (OSMesg) SI_SAVE_FAILED, OS_MESG_PRI_NORMAL);
}
void Save_WriteData(void) {
if ((gStartNMI == 0) && (Save_WriteEeprom(&gSaveIOBuffer) == 0)) {
osSendMesg(&gSaveMsgQueue, (OSMesg) SI_SAVE_SUCCESS, OS_MESG_PRI_NORMAL);
return;
}
osSendMesg(&gSaveMsgQueue, (OSMesg) SI_SAVE_FAILED, OS_MESG_PRI_NORMAL);
}
void Controller_Rumble(void) {
s32 i;
osContStartQuery(&gSerialEventQueue);
osRecvMesg(&gSerialEventQueue, NULL, OS_MESG_BLOCK);
osContGetQuery(D_800DD8F0);
for (i = 0; i < 4; i++) {
if ((gControllerStatus[i] != 0) && (D_800DD8F0[i].errno == 0)) {
if (D_800DD8F0[i].status & 1) {
if (gRumbleStatus[i] == 0) {
if (osMotorInit(&gSerialEventQueue, &D_800DD900[i], i)) {
gRumbleStatus[i] = 0;
} else {
gRumbleStatus[i] = 1;
}
}
if (gRumbleStatus[i] == 1) {
if (D_80137E84[i] != 0) {
if (osMotorStart(&D_800DD900[i])) {
gRumbleStatus[i] = 0;
}
} else {
if (osMotorStop(&D_800DD900[i])) {
gRumbleStatus[i] = 0;
}
}
}
} else {
gRumbleStatus[i] = 0;
}
}
}
for (i = 0; i < 4; i++) {
D_80137E84[i] = 0;
}
}

View File

@ -1,16 +1,16 @@
#include "global.h" #include "global.h"
s32 func_80002E80(char* dst, char* fmt, va_list args) { s32 Lib_vsPrintf(char* dst, char* fmt, va_list args) {
return vsprintf(dst, fmt, args); return vsprintf(dst, fmt, args);
} }
void func_80002EA0(s32 arg0, void (**arg1)(s32, s32), s32 arg2, s32 arg3) { void Lib_vTable(s32 arg0, void (**arg1)(s32, s32), s32 arg2, s32 arg3) {
void (*temp)(s32, s32) = arg1[arg0]; void (*temp)(s32, s32) = arg1[arg0];
temp(arg2, arg3); temp(arg2, arg3);
} }
void func_80002EE4(u8* buf1, u8* buf2, s32 len) { void Lib_SwapBuffers(u8* buf1, u8* buf2, s32 len) {
s32 i; s32 i;
u8 temp; u8 temp;
@ -23,7 +23,7 @@ void func_80002EE4(u8* buf1, u8* buf2, s32 len) {
typedef s32 (*CompareFunc)(void*, void*); typedef s32 (*CompareFunc)(void*, void*);
void func_80002F88(u8* first, u32 curLen, u32 size, CompareFunc cFunc) { void Lib_QuickSort(u8* first, u32 curLen, u32 size, CompareFunc cFunc) {
u32 splitIdx; u32 splitIdx;
u8* last; u8* last;
u8* right; u8* right;
@ -34,7 +34,7 @@ void func_80002F88(u8* first, u32 curLen, u32 size, CompareFunc cFunc) {
if (curLen == 2) { if (curLen == 2) {
if (cFunc(first, last) > 0) { if (cFunc(first, last) > 0) {
func_80002EE4(first, last, size); Lib_SwapBuffers(first, last, size);
} }
return; return;
} }
@ -52,15 +52,15 @@ void func_80002F88(u8* first, u32 curLen, u32 size, CompareFunc cFunc) {
if (left >= right) { if (left >= right) {
break; break;
} }
func_80002EE4(left, right, size); Lib_SwapBuffers(left, right, size);
left += size; left += size;
right -= size; right -= size;
} }
func_80002EE4(last, left, size); Lib_SwapBuffers(last, left, size);
splitIdx = (left - first) / size; splitIdx = (left - first) / size;
if (curLen / 2 < splitIdx) { if (curLen / 2 < splitIdx) {
if ((curLen - splitIdx) > 2) { if ((curLen - splitIdx) > 2) {
func_80002F88(left + size, curLen - splitIdx - 1, size, cFunc); Lib_QuickSort(left + size, curLen - splitIdx - 1, size, cFunc);
} }
if (splitIdx < 2) { if (splitIdx < 2) {
@ -70,7 +70,7 @@ void func_80002F88(u8* first, u32 curLen, u32 size, CompareFunc cFunc) {
curLen = splitIdx; curLen = splitIdx;
} else { } else {
if (splitIdx >= 2) { if (splitIdx >= 2) {
func_80002F88(first, splitIdx, size, cFunc); Lib_QuickSort(first, splitIdx, size, cFunc);
} }
if ((curLen - splitIdx) <= 2) { if ((curLen - splitIdx) <= 2) {
@ -83,7 +83,7 @@ void func_80002F88(u8* first, u32 curLen, u32 size, CompareFunc cFunc) {
} }
} }
void func_8000316C(Gfx** dList) { void Lib_Perspective(Gfx** dList) {
u16 norm; u16 norm;
guPerspective(gGfxMtx, &norm, D_80161A3C, 1.3333334f, D_80161A40, D_80161A44, 1.0f); guPerspective(gGfxMtx, &norm, D_80161A3C, 1.3333334f, D_80161A40, D_80161A44, 1.0f);
@ -91,13 +91,54 @@ void func_8000316C(Gfx** dList) {
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(gGfxMtx, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -12800.0f, 0.0f, 1.0f, 0.0f); guLookAt(gGfxMtx, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -12800.0f, 0.0f, 1.0f, 0.0f);
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
Matrix_Copy(D_8013B3C0, &gIdentityMatrix); Matrix_Copy(gGfxMatrix, &gIdentityMatrix);
} }
void func_800032B4(Gfx** dList) { void Lib_Ortho(Gfx** dList) {
guOrtho(gGfxMtx, -160.0f, 160.0f, -120.0f, 120.0f, D_80161A40, D_80161A44, 1.0f); guOrtho(gGfxMtx, -160.0f, 160.0f, -120.0f, 120.0f, D_80161A40, D_80161A44, 1.0f);
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guLookAt(gGfxMtx, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -12800.0f, 0.0f, 1.0f, 0.0f); guLookAt(gGfxMtx, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -12800.0f, 0.0f, 1.0f, 0.0f);
gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); gSPMatrix((*dList)++, gGfxMtx++, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
Matrix_Copy(D_8013B3C0, &gIdentityMatrix); Matrix_Copy(gGfxMatrix, &gIdentityMatrix);
}
void Lib_DmaRead(void* src, void* dst, ptrdiff_t size) {
osInvalICache(dst, size);
osInvalDCache(dst, size);
while (size > 0x100) {
osPiStartDma(&gDmaIOMsg, 0, 0, (uintptr_t) src, dst, 0x100, &gDmaMsgQueue);
size -= 0x100;
src = (void*) ((uintptr_t) src + 0x100);
dst = (void*) ((uintptr_t) dst + 0x100);
osRecvMesg(&gDmaMsgQueue, NULL, OS_MESG_BLOCK);
}
if (size != 0) {
osPiStartDma(&gDmaIOMsg, 0, 0, (uintptr_t) src, dst, size, &gDmaMsgQueue);
osRecvMesg(&gDmaMsgQueue, NULL, OS_MESG_BLOCK);
}
}
void Lib_FillScreen(u8 setFill) {
s32 i;
gFillScreenColor |= 1;
if (setFill == true) {
if (gFillScreen == false) {
if (gFillScreenColor == 1) {
osViBlack(1);
} else {
for (i = 0; i < 3 * SCREEN_WIDTH; i++) {
D_8038F080[i] = gFillScreenColor;
}
osWritebackDCacheAll();
osViSwapBuffer(&D_8038F300);
osViRepeatLine(1);
}
gFillScreen = true;
}
} else if (gFillScreen == true) {
osViRepeatLine(0);
osViBlack(0);
gFillScreen = false;
}
} }

View File

@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
void func_800035D0(Gfx** dList) { void Lights_AddLight(Gfx** dList) {
gSPNumLights((*dList)++, 7); gSPNumLights((*dList)++, 7);
gSPLight((*dList)++, &gLight->l[0], 1); gSPLight((*dList)++, &gLight->l[0], 1);
gSPLight((*dList)++, &gLight->l[1], 2); gSPLight((*dList)++, &gLight->l[1], 2);
@ -13,8 +13,8 @@ void func_800035D0(Gfx** dList) {
gLight++; gLight++;
} }
void func_8000372C(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG, void Lights_SetOneLight(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG, s32 colB, s32 ambR, s32 ambG,
s32 ambB) { s32 ambB) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
@ -45,11 +45,11 @@ void func_8000372C(Gfx** dList, s32 dirX, s32 dirY, s32 dirZ, s32 colR, s32 colG
gLight->a.l.colc[0] = ambR; gLight->a.l.colc[0] = ambR;
gLight->a.l.colc[1] = ambG; gLight->a.l.colc[1] = ambG;
gLight->a.l.colc[2] = ambB; gLight->a.l.colc[2] = ambB;
func_800035D0(dList); Lights_AddLight(dList);
} }
void func_800038AC(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r, s32 col1g, void Lights_SetTwoLights(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32 dir2y, s32 dir2z, s32 col1r,
s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB) { s32 col1g, s32 col1b, s32 col2r, s32 col2g, s32 col2b, s32 ambR, s32 ambG, s32 ambB) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
@ -80,5 +80,5 @@ void func_800038AC(Gfx** dList, s32 dir1x, s32 dir1y, s32 dir1z, s32 dir2x, s32
gLight->a.l.colc[0] = ambR; gLight->a.l.colc[0] = ambR;
gLight->a.l.colc[1] = ambG; gLight->a.l.colc[1] = ambG;
gLight->a.l.colc[2] = ambB; gLight->a.l.colc[2] = ambB;
func_800035D0(dList); Lights_AddLight(dList);
} }

View File

@ -1,52 +1,52 @@
#include "global.h" #include "global.h"
s32 D_800C45D0 = 1; s32 sGammaMode = 1;
#ifdef IMPORT_DATA_PENDING
u8 gAudioThreadStack[0x1000]; // 800DDAA0 u8 gAudioThreadStack[0x1000]; // 800DDAA0
OSThread gGraphicsThread; // 800DEAA0 OSThread gGraphicsThread; // 800DEAA0
u8 gGraphicsThreadStack[0x1000]; // 800DEC50 u8 gGraphicsThreadStack[0x1000]; // 800DEC50
OSThread gUnkThread3; // 800DFC50 OSThread gTimerThread; // 800DFC50
u8 gUnkThread3Stack[0x1000]; // 800DFE00 u8 gTimerThreadStack[0x1000]; // 800DFE00
OSThread gSerialThread; // 800E0E00 OSThread gSerialThread; // 800E0E00
u8 gSerialThreadStack[0x1000]; // 800E0FB0 u8 gSerialThreadStack[0x1000]; // 800E0FB0
SPTask* gCurrentTask; SPTask* gCurrentTask;
SPTask* D_800E1FB4[1]; SPTask* sAudioTasks[1];
SPTask* D_800E1FB8[2]; SPTask* sGfxTasks[2];
SPTask* D_800E1FC0[2]; SPTask* sNewAudioTasks[1];
SPTask* D_800E1FC8[2]; // 0x4 gap here
SPTask* sNewGfxTasks[2];
u32 gSegments[16]; // 800E1FD0 u32 gSegments[16]; // 800E1FD0
OSMesgQueue gPiMgrCmdQueue; // 800E2010 OSMesgQueue gPiMgrCmdQueue; // 800E2010
OSMesg sPiMgrCmdBuff[50]; // 800E2028 OSMesg sPiMgrCmdBuff[50]; // 800E2028
OSMesgQueue D_800E20F0; OSMesgQueue gDmaMsgQueue;
void* D_800E2108[1]; void* sDmaMsgBuff[1];
OSIoMesg D_800E2110; OSIoMesg gDmaIOMsg;
OSMesgQueue gSerialEventQueue; OSMesgQueue gSerialEventQueue;
void* D_800E2140[1]; void* sSerialEventBuff[1];
OSMesgQueue gMainThreadMsgQueue; OSMesgQueue gMainThreadMsgQueue;
void* D_800E2160[32]; void* sMainThreadMsgBuff[32];
OSMesgQueue gTaskMsgQueue; OSMesgQueue gTaskMsgQueue;
void* D_800E21F8[16]; void* sTaskMsgBuff[16];
OSMesgQueue D_800E2238; OSMesgQueue gAudioVImsgQueue;
void* D_800E2250[1]; void* sAudioVImsgBuff[1];
OSMesgQueue D_800E2258; OSMesgQueue gAudioTaskMsgQueue;
void* D_800E2270[1]; void* sAudioTaskMsgBuff[1];
OSMesgQueue D_800E2278; OSMesgQueue gGfxVImsgQueue;
void* D_800E2290[4]; void* sGfxVImsgBuff[4];
OSMesgQueue D_800E22A0; OSMesgQueue gGfxTaskMsgQueue;
void* D_800E22B8[2]; void* sGfxTaskMsgBuff[2];
OSMesgQueue gSerialThreadMsgQueue; OSMesgQueue gSerialThreadMsgQueue;
void* D_800E22D8[8]; void* sSerialThreadMsgBuff[8];
OSMesgQueue D_800E22F8; OSMesgQueue gControllerMsgQueue;
void* D_800E2310[1]; void* sControllerMsgBuff[1];
OSMesgQueue D_800E2318; OSMesgQueue gSaveMsgQueue;
void* D_800E2330[1]; void* sSaveMsgBuff[1];
OSMesgQueue gThread7msgQueue; OSMesgQueue gTimerTaskMsgQueue;
void* D_800E2350[16]; void* sTimerTaskMsgBuff[16];
OSMesgQueue D_800E2390; OSMesgQueue gTimerWaitMsgQueue;
void* D_800E23A8[1]; void* sTimerWaitMsgBuff[1];
GfxPool gGfxPools[2]; GfxPool gGfxPools[2];
@ -62,12 +62,12 @@ FrameBuffer* gFrameBuffer;
s32* D_80137E74; s32* D_80137E74;
u8 D_80137E78; u8 D_80137E78;
u32 D_80137E7C; u32 gFrameCounter;
u8 D_80137E80; u8 gStartNMI;
u8 D_80137E81; u8 gStopTasks;
u8 D_80137E84[4]; u8 D_80137E84[4];
u16 D_80137E88; u16 gFillScreenColor;
u16 D_80137E8A; u16 gFillScreen;
u8 gUnusedStack[0x1000]; u8 gUnusedStack[0x1000];
OSThread sIdleThread; // 80138E90 OSThread sIdleThread; // 80138E90
@ -75,30 +75,29 @@ u8 sIdleThreadStack[0x1000]; // 801390A0
OSThread gMainThread; // 8013A040 OSThread gMainThread; // 8013A040
u8 sMainThreadStack[0x1000]; // 8013A1F0 u8 sMainThreadStack[0x1000]; // 8013A1F0
OSThread gAudioThread; // 8013B1F0 OSThread gAudioThread; // 8013B1F0
#endif
void func_80003A50(void) { void Main_Initialize(void) {
u8 i; u8 i;
D_80137E78 = 0; D_80137E78 = 0;
D_80137E7C = 0; gFrameCounter = 0;
D_80137E80 = 0; gStartNMI = false;
D_80137E81 = 0; gStopTasks = false;
D_80137E88 = 0; gFillScreenColor = 0;
D_80137E8A = 0; gFillScreen = false;
gCurrentTask = NULL; gCurrentTask = NULL;
for (i = 0; i < ARRAY_COUNT(D_800E1FB4); i += 1) { for (i = 0; i < ARRAY_COUNT(sAudioTasks); i += 1) {
D_800E1FB4[i] = NULL; sAudioTasks[i] = NULL;
} }
for (i = 0; i < ARRAY_COUNT(D_800E1FB8); i += 1) { for (i = 0; i < ARRAY_COUNT(sGfxTasks); i += 1) {
D_800E1FB8[i] = NULL; sGfxTasks[i] = NULL;
} }
for (i = 0; i < 1; i += 1) { for (i = 0; i < ARRAY_COUNT(sNewAudioTasks); i += 1) {
D_800E1FC0[i] = NULL; sNewAudioTasks[i] = NULL;
} }
for (i = 0; i < ARRAY_COUNT(D_800E1FC8); i += 1) { for (i = 0; i < ARRAY_COUNT(sNewGfxTasks); i += 1) {
D_800E1FC8[i] = NULL; sNewGfxTasks[i] = NULL;
} }
} }
@ -109,7 +108,7 @@ void Audio_ThreadEntry(void* arg0) {
func_8001DCE0(); func_8001DCE0();
task = func_8001DF50(); task = func_8001DF50();
if (task != NULL) { if (task != NULL) {
task->msgQueue = &D_800E2258; task->msgQueue = &gAudioTaskMsgQueue;
task->msg = (OSMesg) TASK_MESG_1; task->msg = (OSMesg) TASK_MESG_1;
osWritebackDCacheAll(); osWritebackDCacheAll();
osSendMesg(&gTaskMsgQueue, task, OS_MESG_PRI_NORMAL); osSendMesg(&gTaskMsgQueue, task, OS_MESG_PRI_NORMAL);
@ -117,20 +116,20 @@ void Audio_ThreadEntry(void* arg0) {
while (1) { while (1) {
task = func_8001DF50(); task = func_8001DF50();
if (task != NULL) { if (task != NULL) {
task->msgQueue = &D_800E2258; task->msgQueue = &gAudioTaskMsgQueue;
task->msg = (OSMesg) TASK_MESG_1; task->msg = (OSMesg) TASK_MESG_1;
osWritebackDCacheAll(); osWritebackDCacheAll();
} }
osRecvMesg(&D_800E2258, NULL, OS_MESG_NOBLOCK); osRecvMesg(&gAudioTaskMsgQueue, NULL, OS_MESG_NOBLOCK);
if (task != NULL) { if (task != NULL) {
osSendMesg(&gTaskMsgQueue, task, OS_MESG_PRI_NORMAL); osSendMesg(&gTaskMsgQueue, task, OS_MESG_PRI_NORMAL);
} }
osRecvMesg(&D_800E2238, NULL, OS_MESG_BLOCK); osRecvMesg(&gAudioVImsgQueue, NULL, OS_MESG_BLOCK);
} }
} }
void func_80003C50(void) { void Graphics_SetTask(void) {
gGfxTask->msgQueue = &D_800E22A0; gGfxTask->msgQueue = &gGfxTaskMsgQueue;
gGfxTask->msg = (OSMesg) TASK_MESG_2; gGfxTask->msg = (OSMesg) TASK_MESG_2;
gGfxTask->task.t.type = M_GFXTASK; gGfxTask->task.t.type = M_GFXTASK;
gGfxTask->task.t.flags = 0; gGfxTask->task.t.flags = 0;
@ -152,8 +151,8 @@ void func_80003C50(void) {
osSendMesg(&gTaskMsgQueue, gGfxTask, OS_MESG_PRI_NORMAL); osSendMesg(&gTaskMsgQueue, gGfxTask, OS_MESG_PRI_NORMAL);
} }
void func_80003DC0(u32 arg0) { void Graphics_InitializeTask(u32 frameCount) {
gGfxPool = &gGfxPools[arg0 % 2]; gGfxPool = &gGfxPools[frameCount % 2];
gGfxTask = &gGfxPool->task; gGfxTask = &gGfxPool->task;
gViewport = gGfxPool->viewports; gViewport = gGfxPool->viewports;
@ -163,33 +162,34 @@ void func_80003DC0(u32 arg0) {
gUnkDisp2 = gGfxPool->unkDL2; gUnkDisp2 = gGfxPool->unkDL2;
gLight = gGfxPool->lights; gLight = gGfxPool->lights;
gFrameBuffer = &gFrameBuffers[arg0 % 3]; gFrameBuffer = &gFrameBuffers[frameCount % 3];
D_80137E74 = &D_80387800; D_80137E74 = &D_80387800;
D_8013B3C0 = D_8013B3C8; gGfxMatrix = &sGfxMatrixStack[0];
D_8013BBC8 = D_8013BBD0; gCalcMatrix = &sCalcMatrixStack[0];
D_80178710 = &D_80178580; D_80178710 = &D_80178580;
} }
void func_80003EE0(void) { void Main_SetVIMode(void) {
if ((D_800DD880[0].button & D_JPAD) && (D_800DD880[1].button & D_JPAD) && (D_800DD880[2].button & D_JPAD) && if ((gCurrentInput[0].button & D_JPAD) && (gCurrentInput[1].button & D_JPAD) &&
(D_800DD880[3].button & L_TRIG) && (D_800DD880[3].button & R_TRIG) && (D_800DD880[3].button & Z_TRIG)) { (gCurrentInput[2].button & D_JPAD) && (gCurrentInput[3].button & L_TRIG) &&
D_800C45D0 = 1 - D_800C45D0; (gCurrentInput[3].button & R_TRIG) && (gCurrentInput[3].button & Z_TRIG)) {
sGammaMode = 1 - sGammaMode;
} }
switch (osTvType) { switch (osTvType) {
case 0: case OS_TV_PAL:
osViSetMode(&osViModePalLan1); osViSetMode(&osViModePalLan1);
break; break;
case 2: case OS_TV_MPAL:
osViSetMode(&osViModeMpalLan1); osViSetMode(&osViModeMpalLan1);
break; break;
default: default:
case 1: case OS_TV_NTSC:
osViSetMode(&osViModeNtscLan1); osViSetMode(&osViModeNtscLan1);
break; break;
} }
if (D_800C45D0 != 0) { if (sGammaMode != 0) {
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_DIVOT_OFF | OS_VI_GAMMA_ON | OS_VI_GAMMA_DITHER_ON); osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_DIVOT_OFF | OS_VI_GAMMA_ON | OS_VI_GAMMA_DITHER_ON);
} else { } else {
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_DIVOT_OFF | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF); osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON | OS_VI_DIVOT_OFF | OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF);
@ -199,33 +199,33 @@ void func_80003EE0(void) {
void SerialInterface_ThreadEntry(void* arg0) { void SerialInterface_ThreadEntry(void* arg0) {
OSMesg sp34; OSMesg sp34;
func_8000291C(); Controller_Init();
while (1) { while (1) {
osRecvMesg(&gSerialThreadMsgQueue, &sp34, OS_MESG_BLOCK); osRecvMesg(&gSerialThreadMsgQueue, &sp34, OS_MESG_BLOCK);
switch ((s32) sp34) { switch ((s32) sp34) {
case SI_MESG_10: case SI_READ_CONTROLLER:
func_80002AF4(); Controller_ReadData();
break; break;
case SI_MESG_11: case SI_READ_SAVE:
func_80002BE8(); Save_ReadData();
break; break;
case SI_MESG_12: case SI_WRITE_SAVE:
func_80002C50(); Save_WriteData();
break; break;
case SI_MESG_13: case SI_RUMBLE:
func_80002CB8(); Controller_Rumble();
break; break;
} }
} }
} }
void Thread7_ThreadEntry(void* arg0) { void Timer_ThreadEntry(void* arg0) {
void* sp24; void* sp24;
while (1) { while (1) {
osRecvMesg(&gThread7msgQueue, &sp24, OS_MESG_BLOCK); osRecvMesg(&gTimerTaskMsgQueue, &sp24, OS_MESG_BLOCK);
func_80007088(sp24); Timer_CompleteTask(sp24);
} }
} }
@ -235,8 +235,8 @@ void Graphics_ThreadEntry(void* arg0) {
u8 var_v2; u8 var_v2;
func_800A18B0(); func_800A18B0();
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_10, OS_MESG_PRI_NORMAL); osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_READ_CONTROLLER, OS_MESG_PRI_NORMAL);
func_80003DC0(D_80137E7C); Graphics_InitializeTask(gFrameCounter);
{ {
gSPSegment(gUnkDisp1++, 0, 0); gSPSegment(gUnkDisp1++, 0, 0);
gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1); gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1);
@ -247,22 +247,22 @@ void Graphics_ThreadEntry(void* arg0) {
gDPFullSync(gMasterDisp++); gDPFullSync(gMasterDisp++);
gSPEndDisplayList(gMasterDisp++); gSPEndDisplayList(gMasterDisp++);
} }
func_80003C50(); Graphics_SetTask();
while (1) { while (1) {
D_80137E7C++; gFrameCounter++;
func_80003DC0(D_80137E7C); Graphics_InitializeTask(gFrameCounter);
osRecvMesg(&D_800E22F8, NULL, OS_MESG_BLOCK); osRecvMesg(&gControllerMsgQueue, NULL, OS_MESG_BLOCK);
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_13, OS_MESG_PRI_NORMAL); osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_RUMBLE, OS_MESG_PRI_NORMAL);
func_800029A8(); Controller_UpdateInput();
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_10, OS_MESG_PRI_NORMAL); osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_READ_CONTROLLER, OS_MESG_PRI_NORMAL);
if (D_800DD898[3].button & 0x800) { if (gChangedInput[3].button & U_JPAD) {
func_80003EE0(); Main_SetVIMode();
} }
{ {
gSPSegment(gUnkDisp1++, 0, 0); gSPSegment(gUnkDisp1++, 0, 0);
gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1); gSPDisplayList(gMasterDisp++, gGfxPool->unkDL1);
func_800A26C0(); func_800A26C0();
if (D_80137E80 == 1) { if (gStartNMI == 1) {
func_800BC4B0(); func_800BC4B0();
} }
gSPEndDisplayList(gUnkDisp1++); gSPEndDisplayList(gUnkDisp1++);
@ -271,17 +271,17 @@ void Graphics_ThreadEntry(void* arg0) {
gDPFullSync(gMasterDisp++); gDPFullSync(gMasterDisp++);
gSPEndDisplayList(gMasterDisp++); gSPEndDisplayList(gMasterDisp++);
} }
osRecvMesg(&D_800E22A0, NULL, OS_MESG_BLOCK); osRecvMesg(&gGfxTaskMsgQueue, NULL, OS_MESG_BLOCK);
func_80003C50(); Graphics_SetTask();
if (D_80137E8A == 0) { if (gFillScreen == 0) {
osViSwapBuffer(&gFrameBuffers[(D_80137E7C - 1) % 3]); osViSwapBuffer(&gFrameBuffers[(gFrameCounter - 1) % 3]);
} }
func_80007FE4(&gFrameBuffers[(D_80137E7C - 1) % 3], 320, 16); func_80007FE4(&gFrameBuffers[(gFrameCounter - 1) % 3], 320, 16);
var_v1 = MIN(D_80137E78, 4); var_v1 = MIN(D_80137E78, 4);
var_v2 = MAX(var_v1, D_800E2278.validCount + 1); var_v2 = MAX(var_v1, gGfxVImsgQueue.validCount + 1);
for (i = 0; i < var_v2; i += 1) { // Can't be ++ for (i = 0; i < var_v2; i += 1) { // Can't be ++
osRecvMesg(&D_800E2278, NULL, OS_MESG_BLOCK); osRecvMesg(&gGfxVImsgQueue, NULL, OS_MESG_BLOCK);
} }
func_8001DECC(); func_8001DECC();
@ -289,41 +289,41 @@ void Graphics_ThreadEntry(void* arg0) {
} }
void Main_InitMesgQueues(void) { void Main_InitMesgQueues(void) {
osCreateMesgQueue(&D_800E20F0, D_800E2108, ARRAY_COUNT(D_800E2108)); osCreateMesgQueue(&gDmaMsgQueue, sDmaMsgBuff, ARRAY_COUNT(sDmaMsgBuff));
osCreateMesgQueue(&gTaskMsgQueue, D_800E21F8, ARRAY_COUNT(D_800E21F8)); osCreateMesgQueue(&gTaskMsgQueue, sTaskMsgBuff, ARRAY_COUNT(sTaskMsgBuff));
osCreateMesgQueue(&D_800E2238, D_800E2250, ARRAY_COUNT(D_800E2250)); osCreateMesgQueue(&gAudioVImsgQueue, sAudioVImsgBuff, ARRAY_COUNT(sAudioVImsgBuff));
osCreateMesgQueue(&D_800E2258, D_800E2270, ARRAY_COUNT(D_800E2270)); osCreateMesgQueue(&gAudioTaskMsgQueue, sAudioTaskMsgBuff, ARRAY_COUNT(sAudioTaskMsgBuff));
osCreateMesgQueue(&D_800E2278, D_800E2290, ARRAY_COUNT(D_800E2290)); osCreateMesgQueue(&gGfxVImsgQueue, sGfxVImsgBuff, ARRAY_COUNT(sGfxVImsgBuff));
osCreateMesgQueue(&D_800E22A0, D_800E22B8, ARRAY_COUNT(D_800E22B8)); osCreateMesgQueue(&gGfxTaskMsgQueue, sGfxTaskMsgBuff, ARRAY_COUNT(sGfxTaskMsgBuff));
osCreateMesgQueue(&gSerialEventQueue, D_800E2140, ARRAY_COUNT(D_800E2140)); osCreateMesgQueue(&gSerialEventQueue, sSerialEventBuff, ARRAY_COUNT(sSerialEventBuff));
osSetEventMesg(OS_EVENT_SI, &gSerialEventQueue, NULL); osSetEventMesg(OS_EVENT_SI, &gSerialEventQueue, NULL);
osCreateMesgQueue(&gMainThreadMsgQueue, D_800E2160, ARRAY_COUNT(D_800E2160)); osCreateMesgQueue(&gMainThreadMsgQueue, sMainThreadMsgBuff, ARRAY_COUNT(sMainThreadMsgBuff));
osViSetEvent(&gMainThreadMsgQueue, (OSMesg) EVENT_MESG_VI, 1); osViSetEvent(&gMainThreadMsgQueue, (OSMesg) EVENT_MESG_VI, 1);
osSetEventMesg(OS_EVENT_SP, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_SP); osSetEventMesg(OS_EVENT_SP, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_SP);
osSetEventMesg(OS_EVENT_DP, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_DP); osSetEventMesg(OS_EVENT_DP, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_DP);
osSetEventMesg(OS_EVENT_PRENMI, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_PRENMI); osSetEventMesg(OS_EVENT_PRENMI, &gMainThreadMsgQueue, (OSMesg) EVENT_MESG_PRENMI);
osCreateMesgQueue(&gThread7msgQueue, D_800E2350, ARRAY_COUNT(D_800E2350)); osCreateMesgQueue(&gTimerTaskMsgQueue, sTimerTaskMsgBuff, ARRAY_COUNT(sTimerTaskMsgBuff));
osCreateMesgQueue(&D_800E2390, D_800E23A8, ARRAY_COUNT(D_800E23A8)); osCreateMesgQueue(&gTimerWaitMsgQueue, sTimerWaitMsgBuff, ARRAY_COUNT(sTimerWaitMsgBuff));
osCreateMesgQueue(&gSerialThreadMsgQueue, D_800E22D8, ARRAY_COUNT(D_800E22D8)); osCreateMesgQueue(&gSerialThreadMsgQueue, sSerialThreadMsgBuff, ARRAY_COUNT(sSerialThreadMsgBuff));
osCreateMesgQueue(&D_800E22F8, D_800E2310, ARRAY_COUNT(D_800E2310)); osCreateMesgQueue(&gControllerMsgQueue, sControllerMsgBuff, ARRAY_COUNT(sControllerMsgBuff));
osCreateMesgQueue(&D_800E2318, D_800E2330, ARRAY_COUNT(D_800E2330)); osCreateMesgQueue(&gSaveMsgQueue, sSaveMsgBuff, ARRAY_COUNT(sSaveMsgBuff));
} }
void func_80004714(void) { void Main_HandleRDP(void) {
SPTask** var_v1 = D_800E1FB8; SPTask** var_v1 = sGfxTasks;
u8 i; u8 i;
if ((*var_v1)->msgQueue != NULL) { if ((*var_v1)->msgQueue != NULL) {
osSendMesg((*var_v1)->msgQueue, (*var_v1)->msg, OS_MESG_PRI_NORMAL); osSendMesg((*var_v1)->msgQueue, (*var_v1)->msg, OS_MESG_PRI_NORMAL);
} }
(*var_v1)->state = SPTASK_STATE_FINISHED_DP; (*var_v1)->state = SPTASK_STATE_FINISHED_DP;
for (i = 0; i < 1; i += 1, var_v1++) { for (i = 0; i < ARRAY_COUNT(sGfxTasks) - 1; i += 1, var_v1++) {
*var_v1 = *(var_v1 + 1); *var_v1 = *(var_v1 + 1);
} }
*var_v1 = NULL; *var_v1 = NULL;
} }
void func_80004798(void) { void Main_HandleRSP(void) {
SPTask* task = gCurrentTask; SPTask* task = gCurrentTask;
gCurrentTask = NULL; gCurrentTask = NULL;
@ -337,12 +337,12 @@ void func_80004798(void) {
if (task->msgQueue != NULL) { if (task->msgQueue != NULL) {
osSendMesg(task->msgQueue, task->msg, OS_MESG_PRI_NORMAL); osSendMesg(task->msgQueue, task->msg, OS_MESG_PRI_NORMAL);
} }
D_800E1FB4[0] = NULL; sAudioTasks[0] = NULL;
} }
} }
} }
void func_80004824(void) { void Main_GetNewTasks(void) {
u8 i; u8 i;
SPTask** var_a0; SPTask** var_a0;
SPTask** var_a1; SPTask** var_a1;
@ -351,17 +351,17 @@ void func_80004824(void) {
OSMesg sp40; OSMesg sp40;
SPTask* sp3C; SPTask* sp3C;
var_s0_2 = D_800E1FC0; var_s0_2 = sNewAudioTasks;
var_s1_2 = D_800E1FC8; var_s1_2 = sNewGfxTasks;
for (i = 0; i < 1; i += 1) { for (i = 0; i < ARRAY_COUNT(sNewAudioTasks); i += 1) {
*(var_s0_2++) = NULL; *(var_s0_2++) = NULL;
} }
for (i = 0; i < ARRAY_COUNT(D_800E1FC8); i += 1) { for (i = 0; i < ARRAY_COUNT(sNewGfxTasks); i += 1) {
*(var_s1_2++) = NULL; *(var_s1_2++) = NULL;
} }
var_s0_2 = D_800E1FC0; var_s0_2 = sNewAudioTasks;
var_s1_2 = D_800E1FC8; var_s1_2 = sNewGfxTasks;
while (osRecvMesg(&gTaskMsgQueue, &sp40, OS_MESG_NOBLOCK) != MSG_QUEUE_EMPTY) { while (osRecvMesg(&gTaskMsgQueue, &sp40, OS_MESG_NOBLOCK) != MSG_QUEUE_EMPTY) {
sp3C = (SPTask*) sp40; sp3C = (SPTask*) sp40;
sp3C->state = SPTASK_STATE_NOT_STARTED; sp3C->state = SPTASK_STATE_NOT_STARTED;
@ -375,44 +375,45 @@ void func_80004824(void) {
break; break;
} }
} }
var_s0_2 = D_800E1FC0; var_s0_2 = sNewAudioTasks;
var_s1_2 = D_800E1FC8; var_s1_2 = sNewGfxTasks;
var_a0 = D_800E1FB4; var_a0 = sAudioTasks;
var_a1 = D_800E1FB8; var_a1 = sGfxTasks;
for (i = 0; i < 1; i += 1, var_a0++) { for (i = 0; i < ARRAY_COUNT(sAudioTasks); i += 1, var_a0++) {
if (*var_a0 == NULL) { if (*var_a0 == NULL) {
break; break;
} }
} }
for (i; i < 1; i += 1) { for (i; i < ARRAY_COUNT(sAudioTasks); i += 1) {
*(var_a0++) = *(var_s0_2++); *(var_a0++) = *(var_s0_2++);
} }
for (i = 0; i < 2; i += 1, var_a1++) {
for (i = 0; i < ARRAY_COUNT(sGfxTasks); i += 1, var_a1++) {
if (*var_a1 == NULL) { if (*var_a1 == NULL) {
break; break;
} }
} }
for (i; i < 2; i += 1) { for (i; i < ARRAY_COUNT(sGfxTasks); i += 1) {
*(var_a1++) = *(var_s1_2++); *(var_a1++) = *(var_s1_2++);
} }
} }
void func_800049D4(void) { void Main_StartNextTask(void) {
if (D_800E1FB4[0] != NULL) { if (sAudioTasks[0] != NULL) {
if (gCurrentTask != NULL) { if (gCurrentTask != NULL) {
if (gCurrentTask->task.t.type == M_GFXTASK) { if (gCurrentTask->task.t.type == M_GFXTASK) {
gCurrentTask->state = SPTASK_STATE_INTERRUPTED; gCurrentTask->state = SPTASK_STATE_INTERRUPTED;
osSpTaskYield(); osSpTaskYield();
} }
} else { } else {
gCurrentTask = D_800E1FB4[0]; gCurrentTask = sAudioTasks[0];
osSpTaskLoad(&gCurrentTask->task); osSpTaskLoad(&gCurrentTask->task);
osSpTaskStartGo(&gCurrentTask->task); osSpTaskStartGo(&gCurrentTask->task);
gCurrentTask->state = SPTASK_STATE_RUNNING; gCurrentTask->state = SPTASK_STATE_RUNNING;
} }
} else if ((gCurrentTask == NULL) && (D_800E1FB8[0] != NULL) && (D_800E1FB8[0]->state != SPTASK_STATE_FINISHED)) { } else if ((gCurrentTask == NULL) && (sGfxTasks[0] != NULL) && (sGfxTasks[0]->state != SPTASK_STATE_FINISHED)) {
gCurrentTask = D_800E1FB8[0]; gCurrentTask = sGfxTasks[0];
osDpSetStatus(DPC_CLR_TMEM_CTR | DPC_CLR_PIPE_CTR | DPC_CLR_CMD_CTR | DPC_CLR_CLOCK_CTR); osDpSetStatus(DPC_CLR_TMEM_CTR | DPC_CLR_PIPE_CTR | DPC_CLR_CMD_CTR | DPC_CLR_CLOCK_CTR);
osSpTaskLoad(&gCurrentTask->task); osSpTaskLoad(&gCurrentTask->task);
osSpTaskStartGo(&gCurrentTask->task); osSpTaskStartGo(&gCurrentTask->task);
@ -421,7 +422,7 @@ void func_800049D4(void) {
} }
void Main_ThreadEntry(void* arg0) { void Main_ThreadEntry(void* arg0) {
OSMesg sp54; OSMesg osMsg;
u8 mesg; u8 mesg;
osCreateThread(&gAudioThread, THREAD_ID_AUDIO, Audio_ThreadEntry, arg0, osCreateThread(&gAudioThread, THREAD_ID_AUDIO, Audio_ThreadEntry, arg0,
@ -430,9 +431,9 @@ void Main_ThreadEntry(void* arg0) {
osCreateThread(&gGraphicsThread, THREAD_ID_GRAPHICS, Graphics_ThreadEntry, arg0, osCreateThread(&gGraphicsThread, THREAD_ID_GRAPHICS, Graphics_ThreadEntry, arg0,
gGraphicsThreadStack + sizeof(gGraphicsThreadStack), 40); gGraphicsThreadStack + sizeof(gGraphicsThreadStack), 40);
osStartThread(&gGraphicsThread); osStartThread(&gGraphicsThread);
osCreateThread(&gUnkThread3, THREAD_ID_7, Thread7_ThreadEntry, arg0, gUnkThread3Stack + sizeof(gUnkThread3Stack), osCreateThread(&gTimerThread, THREAD_ID_7, Timer_ThreadEntry, arg0, gTimerThreadStack + sizeof(gTimerThreadStack),
60); 60);
osStartThread(&gUnkThread3); osStartThread(&gTimerThread);
osCreateThread(&gSerialThread, THREAD_ID_SERIAL, SerialInterface_ThreadEntry, arg0, osCreateThread(&gSerialThread, THREAD_ID_SERIAL, SerialInterface_ThreadEntry, arg0,
gSerialThreadStack + sizeof(gSerialThreadStack), 20); gSerialThreadStack + sizeof(gSerialThreadStack), 20);
osStartThread(&gSerialThread); osStartThread(&gSerialThread);
@ -440,35 +441,35 @@ void Main_ThreadEntry(void* arg0) {
Main_InitMesgQueues(); Main_InitMesgQueues();
while (true) { while (true) {
osRecvMesg(&gMainThreadMsgQueue, &sp54, OS_MESG_BLOCK); osRecvMesg(&gMainThreadMsgQueue, &osMsg, OS_MESG_BLOCK);
mesg = (u32) sp54; mesg = (u32) osMsg;
switch (mesg) { switch (mesg) {
case EVENT_MESG_VI: case EVENT_MESG_VI:
osSendMesg(&D_800E2238, (OSMesg) EVENT_MESG_VI, OS_MESG_PRI_NORMAL); osSendMesg(&gAudioVImsgQueue, (OSMesg) EVENT_MESG_VI, OS_MESG_PRI_NORMAL);
osSendMesg(&D_800E2278, (OSMesg) EVENT_MESG_VI, OS_MESG_PRI_NORMAL); osSendMesg(&gGfxVImsgQueue, (OSMesg) EVENT_MESG_VI, OS_MESG_PRI_NORMAL);
func_80004824(); Main_GetNewTasks();
break; break;
case EVENT_MESG_SP: case EVENT_MESG_SP:
func_80004798(); Main_HandleRSP();
break; break;
case EVENT_MESG_DP: case EVENT_MESG_DP:
func_80004714(); Main_HandleRDP();
break; break;
case EVENT_MESG_PRENMI: case EVENT_MESG_PRENMI:
D_80137E80 = 1; gStartNMI = 1;
break; break;
} }
if (D_80137E81 == 0) { if (gStopTasks == 0) {
func_800049D4(); Main_StartNextTask();
} }
} }
} }
void Idle_ThreadEntry(void* arg0) { void Idle_ThreadEntry(void* arg0) {
osCreateViManager(OS_PRIORITY_VIMGR); osCreateViManager(OS_PRIORITY_VIMGR);
func_80003EE0(); Main_SetVIMode();
func_800034E8(1); Lib_FillScreen(1);
osCreatePiMgr(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff)); osCreatePiMgr(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
osCreateThread(&gMainThread, THREAD_ID_MAIN, &Main_ThreadEntry, arg0, sMainThreadStack + sizeof(sMainThreadStack), osCreateThread(&gMainThread, THREAD_ID_MAIN, &Main_ThreadEntry, arg0, sMainThreadStack + sizeof(sMainThreadStack),
100); 100);
@ -482,7 +483,7 @@ loop_1:
void bootproc(void) { void bootproc(void) {
RdRam_CheckIPL3(); RdRam_CheckIPL3();
osInitialize(); osInitialize();
func_80003A50(); Main_Initialize();
osCreateThread(&sIdleThread, THREAD_ID_IDLE, &Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), osCreateThread(&sIdleThread, THREAD_ID_IDLE, &Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack),
255); 255);
osStartThread(&sIdleThread); osStartThread(&sIdleThread);

View File

@ -1,42 +1,43 @@
#include "global.h" #include "global.h"
extern s32 D_8013B3A0; s32 sSeededRandSeed3;
extern s32 D_8013B3A4; s32 sRandSeed1;
extern s32 D_8013B3A8; s32 sRandSeed2;
extern s32 D_8013B3AC; s32 sRandSeed3;
extern s32 D_8013B3B0; s32 sSeededRandSeed1;
extern s32 D_8013B3B4; s32 sSeededRandSeed2;
f32 Math_ModF(f32 value, f32 mod) { f32 Math_ModF(f32 value, f32 mod) {
return value - ((s32) (value / mod) * mod); return value - ((s32) (value / mod) * mod);
} }
void Rand_Init(void) { void Rand_Init(void) {
D_8013B3A4 = (s32) osGetTime() % 30000; sRandSeed1 = (s32) osGetTime() % 30000;
D_8013B3A8 = (s32) osGetTime() % 30000; sRandSeed2 = (s32) osGetTime() % 30000;
D_8013B3AC = (s32) osGetTime() % 30000; sRandSeed3 = (s32) osGetTime() % 30000;
} }
f32 Rand_ZeroOne(void) { f32 Rand_ZeroOne(void) {
D_8013B3A4 = (D_8013B3A4 * 171) % 30269; sRandSeed1 = (sRandSeed1 * 171) % 30269;
D_8013B3A8 = (D_8013B3A8 * 172) % 30307; sRandSeed2 = (sRandSeed2 * 172) % 30307;
D_8013B3AC = (D_8013B3AC * 170) % 30323; sRandSeed3 = (sRandSeed3 * 170) % 30323;
return fabsf(Math_ModF((D_8013B3A4 / 30269.0f) + (D_8013B3A8 / 30307.0f) + (D_8013B3AC / 30323.0f), 1.0f)); return fabsf(Math_ModF((sRandSeed1 / 30269.0f) + (sRandSeed2 / 30307.0f) + (sRandSeed3 / 30323.0f), 1.0f));
} }
void Rand_SetSeed(s32 seed1, s32 seed2, s32 seed3) { void Rand_SetSeed(s32 seed1, s32 seed2, s32 seed3) {
D_8013B3B0 = seed1; sSeededRandSeed1 = seed1;
D_8013B3B4 = seed2; sSeededRandSeed2 = seed2;
D_8013B3A0 = seed3; sSeededRandSeed3 = seed3;
} }
f32 Rand_ZeroOneSeeded(void) { f32 Rand_ZeroOneSeeded(void) {
D_8013B3B0 = (D_8013B3B0 * 171) % 30269; sSeededRandSeed1 = (sSeededRandSeed1 * 171) % 30269;
D_8013B3B4 = (D_8013B3B4 * 172) % 30307; sSeededRandSeed2 = (sSeededRandSeed2 * 172) % 30307;
D_8013B3A0 = (D_8013B3A0 * 170) % 30323; sSeededRandSeed3 = (sSeededRandSeed3 * 170) % 30323;
return fabsf(Math_ModF((D_8013B3B0 / 30269.0f) + (D_8013B3B4 / 30307.0f) + (D_8013B3A0 / 30323.0f), 1.0f)); return fabsf(
Math_ModF((sSeededRandSeed1 / 30269.0f) + (sSeededRandSeed2 / 30307.0f) + (sSeededRandSeed3 / 30323.0f), 1.0f));
} }
f32 Math_Atan2F(f32 y, f32 x) { f32 Math_Atan2F(f32 y, f32 x) {

View File

@ -14,12 +14,10 @@ Matrix gIdentityMatrix = { {
{ 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f },
} }; } };
#ifdef DATA_IMPORT_PENDING Matrix* gGfxMatrix;
Matrix* D_8013B3C0; Matrix sGfxMatrixStack[0x20];
Matrix D_8013B3C8[0x20]; Matrix* gCalcMatrix;
Matrix* D_8013BBC8; Matrix sCalcMatrixStack[0x20];
Matrix D_8013BBD0[0x20];
#endif
void Matrix_Copy(Matrix* dst, Matrix* src) { void Matrix_Copy(Matrix* dst, Matrix* src) {
dst->m[0][0] = src->m[0][0]; dst->m[0][0] = src->m[0][0];
@ -387,12 +385,11 @@ void Matrix_RotateAxis(Matrix* mtx, f32 angle, f32 axisX, f32 axisY, f32 axisZ,
} }
} }
// Matrix_ToMtx
void Matrix_ToMtx(Mtx* dest) { void Matrix_ToMtx(Mtx* dest) {
s32 temp; s32 temp;
u16* m1 = (u16*) &dest->m[0][0]; u16* m1 = (u16*) &dest->m[0][0];
u16* m2 = (u16*) &dest->m[2][0]; u16* m2 = (u16*) &dest->m[2][0];
Matrix* src = D_8013B3C0; Matrix* src = gGfxMatrix;
temp = src->xx * 0x10000; temp = src->xx * 0x10000;
m1[0] = (temp >> 0x10); m1[0] = (temp >> 0x10);
@ -459,7 +456,6 @@ void Matrix_ToMtx(Mtx* dest) {
m2[15] = temp & 0xFFFF; m2[15] = temp & 0xFFFF;
} }
// Matrix_FromMtx
void Matrix_FromMtx(Mtx* src, Matrix* dest) { void Matrix_FromMtx(Mtx* src, Matrix* dest) {
u16* m1 = (u16*) &src->m[0][0]; u16* m1 = (u16*) &src->m[0][0];
u16* m2 = (u16*) &src->m[2][0]; u16* m2 = (u16*) &src->m[2][0];
@ -482,14 +478,12 @@ void Matrix_FromMtx(Mtx* src, Matrix* dest) {
dest->ww = ((m1[15] << 0x10) | m2[15]) * (1 / 65536.0f); dest->ww = ((m1[15] << 0x10) | m2[15]) * (1 / 65536.0f);
} }
// Matrix_MultVec3f
void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest) { void Matrix_MultVec3f(Matrix* mtx, Vec3f* src, Vec3f* dest) {
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z) + mtx->m[3][0]; dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z) + mtx->m[3][0];
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z) + mtx->m[3][1]; dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z) + mtx->m[3][1];
dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z) + mtx->m[3][2]; dest->z = (mtx->m[0][2] * src->x) + (mtx->m[1][2] * src->y) + (mtx->m[2][2] * src->z) + mtx->m[3][2];
} }
// Matrix_MultVec3fLinear ?
void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest) { void Matrix_MultVec3fNoTranslate(Matrix* mtx, Vec3f* src, Vec3f* dest) {
dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z); dest->x = (mtx->m[0][0] * src->x) + (mtx->m[1][0] * src->y) + (mtx->m[2][0] * src->z);
dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z); dest->y = (mtx->m[0][1] * src->x) + (mtx->m[1][1] * src->y) + (mtx->m[2][1] * src->z);

15
src/main/memory.c Normal file
View File

@ -0,0 +1,15 @@
#include "global.h"
s32 sMemoryBuffer[0x2200];
s32* sMemoryPtr;
void Memory_FreeAll(void) {
sMemoryPtr = sMemoryBuffer;
}
void* Memory_Allocate(s32 size) {
void* addr = sMemoryPtr;
sMemoryPtr = (void*) (((size + 0xF) & ~0xF) + (uintptr_t) sMemoryPtr);
return addr;
}

View File

@ -2,12 +2,10 @@
#include "global.h" #include "global.h"
#ifdef DATA_IMPORT_PENDING SaveFile gSaveIOBuffer;
SaveFile D_80144F60; SaveFile sPrevSaveData;
SaveFile D_80145160;
#endif
s32 func_80007130(s32 arg0, u8* arg1) { s32 Save_ReadBlock(s32 arg0, u8* arg1) {
if (osEepromRead(&gSerialEventQueue, arg0, arg1)) { if (osEepromRead(&gSerialEventQueue, arg0, arg1)) {
(void) " インターフェース回路反応なし ()\n"; (void) " インターフェース回路反応なし ()\n";
return -1; return -1;
@ -16,17 +14,17 @@ s32 func_80007130(s32 arg0, u8* arg1) {
return 0; return 0;
} }
s32 func_8000716C(s32 arg0, u8* arg1) { s32 Save_WriteBlock(s32 arg0, u8* arg1) {
if (osEepromWrite(&gSerialEventQueue, arg0, arg1)) { if (osEepromWrite(&gSerialEventQueue, arg0, arg1)) {
(void) " インターフェース回路反応なし ()\n"; (void) " インターフェース回路反応なし ()\n";
return -1; return -1;
} }
func_800070C8(MSEC_TO_CYCLES(15)); Timer_Wait(MSEC_TO_CYCLES(15));
(void) "EEPROM WRITE %02X: %02X %02X %02X %02X %02X %02X %02X %02X\n"; (void) "EEPROM WRITE %02X: %02X %02X %02X %02X %02X %02X %02X %02X\n";
return 0; return 0;
} }
s32 func_800071FC(SaveFile* arg0) { s32 Save_WriteEeprom(SaveFile* arg0) {
s32 var_a2; s32 var_a2;
s32 i; s32 i;
s32 j; s32 j;
@ -38,19 +36,19 @@ s32 func_800071FC(SaveFile* arg0) {
for (i = 0; i < EEPROM_MAXBLOCKS; i++) { for (i = 0; i < EEPROM_MAXBLOCKS; i++) {
var_a2 = 0; var_a2 = 0;
for (j = 0; j < EEPROM_BLOCK_SIZE; j++) { for (j = 0; j < EEPROM_BLOCK_SIZE; j++) {
if (D_80145160.raw[EEPROM_BLOCK_SIZE * i + j] != arg0->raw[EEPROM_BLOCK_SIZE * i + j]) { if (((char*) &sPrevSaveData)[EEPROM_BLOCK_SIZE * i + j] != ((char*) arg0)[EEPROM_BLOCK_SIZE * i + j]) {
D_80145160.raw[EEPROM_BLOCK_SIZE * i + j] = arg0->raw[EEPROM_BLOCK_SIZE * i + j]; ((char*) &sPrevSaveData)[EEPROM_BLOCK_SIZE * i + j] = ((char*) arg0)[EEPROM_BLOCK_SIZE * i + j];
var_a2 = 1; var_a2 = 1;
} }
} }
if ((var_a2 == 1) && func_8000716C(i, &arg0->raw[EEPROM_BLOCK_SIZE * i])) { if ((var_a2 == 1) && Save_WriteBlock(i, &((char*) arg0)[EEPROM_BLOCK_SIZE * i])) {
return -1; return -1;
} }
} }
return 0; return 0;
} }
s32 func_800072E0(SaveFile* arg0) { s32 Save_ReadEeprom(SaveFile* arg0) {
s32 i; s32 i;
if (osEepromProbe(&gSerialEventQueue) != 1) { if (osEepromProbe(&gSerialEventQueue) != 1) {
@ -58,10 +56,10 @@ s32 func_800072E0(SaveFile* arg0) {
return -1; return -1;
} }
for (i = 0; i < EEPROM_MAXBLOCKS; i++) { for (i = 0; i < EEPROM_MAXBLOCKS; i++) {
if (func_80007130(i, &arg0->raw[EEPROM_BLOCK_SIZE * i]) != 0) { if (Save_ReadBlock(i, &((char*) arg0)[EEPROM_BLOCK_SIZE * i]) != 0) {
return -1; return -1;
} }
} }
D_80145160 = *arg0; sPrevSaveData = *arg0;
return 0; return 0;
} }

View File

@ -11,12 +11,12 @@ void func_80058B80(void* arg0, void* arg1, ptrdiff_t arg2) {
for (i = 0; gDmaTable[i].pRom.end != NULL; i++) { for (i = 0; gDmaTable[i].pRom.end != NULL; i++) {
if (gDmaTable[i].vRomAddress == arg0) { if (gDmaTable[i].vRomAddress == arg0) {
if (gDmaTable[i].compFlag == 0) { if (gDmaTable[i].compFlag == 0) {
func_800033E0(gDmaTable[i].pRom.start, arg1, arg2); Lib_DmaRead(gDmaTable[i].pRom.start, arg1, arg2);
} else { } else {
func_800034E8(1); Lib_FillScreen(1);
D_800CA3B0 = 3; D_800CA3B0 = 3;
D_80161A39 = 1; D_80161A39 = 1;
func_800033E0(gDmaTable[i].pRom.start, gFrameBuffers, SEGMENT_SIZE(gDmaTable[i].pRom)); Lib_DmaRead(gDmaTable[i].pRom.start, gFrameBuffers, SEGMENT_SIZE(gDmaTable[i].pRom));
Mio0_Decompress(gFrameBuffers, arg1); Mio0_Decompress(gFrameBuffers, arg1);
} }
break; break;
@ -65,8 +65,8 @@ u8 func_80058C48(OverlayInit* ovlInit) {
if (D_800CA3B0 != 0) { if (D_800CA3B0 != 0) {
D_800CA3B0--; D_800CA3B0--;
} else if (D_80137E80 == 0) { } else if (gStartNMI == 0) {
func_800034E8(0); Lib_FillScreen(0);
} }
return startLoad; return startLoad;
} }
@ -179,6 +179,6 @@ extern u8 D_DEA20[];
extern u8 D_DF4260[]; extern u8 D_DF4260[];
void func_80059498(void) { void func_80059498(void) {
func_800033E0(D_DE480, gDmaTable, D_DEA20 - D_DE480); Lib_DmaRead(D_DE480, gDmaTable, D_DEA20 - D_DE480);
func_80058B80(D_DE5D50, D_80179010, D_DF4260 - D_DE5D50); func_80058B80(D_DE5D50, D_80179010, D_DF4260 - D_DE5D50);
} }

View File

@ -2,7 +2,7 @@
void func_800594F0(Object_80* arg0) { void func_800594F0(Object_80* arg0) {
func_800B9EB0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC); func_800B9EB0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC);
Matrix_RotateY(D_8013B3C0, M_PI, 1); Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_6007D90); gSPDisplayList(gMasterDisp++, D_6007D90);
func_800BA1D0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC); func_800BA1D0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC);
@ -10,7 +10,7 @@ void func_800594F0(Object_80* arg0) {
void func_800595D0(Object_80* arg0) { void func_800595D0(Object_80* arg0) {
func_800B9EB0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC); func_800B9EB0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC);
Matrix_RotateY(D_8013B3C0, M_PI, 1); Matrix_RotateY(gGfxMatrix, M_PI, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_6007CF0); gSPDisplayList(gMasterDisp++, D_6007CF0);
func_800BA1D0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC); func_800BA1D0(D_80178320, D_80178328, D_80178330, D_80178338, D_801783D8, D_801783DC);

File diff suppressed because it is too large Load Diff

View File

@ -20,11 +20,11 @@ s32 func_80060FE4(Vec3f* arg0, f32 arg1) {
if ((D_80177880 != 1) && (D_80178280[0].unk_1C8 != 2)) { if ((D_80177880 != 1) && (D_80178280[0].unk_1C8 != 2)) {
return 1; return 1;
} }
Matrix_RotateY(D_8013BBC8, D_80178280[D_801778A0].unk_058, 0); Matrix_RotateY(gCalcMatrix, D_80178280[D_801778A0].unk_058, 0);
sp2C.x = arg0->x - D_80178280[D_801778A0].unk_040.x; sp2C.x = arg0->x - D_80178280[D_801778A0].unk_040.x;
sp2C.y = 0.0f; sp2C.y = 0.0f;
sp2C.z = arg0->z - D_80178280[D_801778A0].unk_040.z; sp2C.z = arg0->z - D_80178280[D_801778A0].unk_040.z;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp2C, &sp20); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp2C, &sp20);
if ((sp20.z < 1000.0f) && (arg1 < sp20.z) && (fabsf(sp20.x) < (fabsf(sp20.z * 0.5f) + 2000.0f))) { if ((sp20.z < 1000.0f) && (arg1 < sp20.z) && (fabsf(sp20.x) < (fabsf(sp20.z * 0.5f) + 2000.0f))) {
return 1; return 1;
@ -42,11 +42,11 @@ s32 func_80061148(Vec3f* arg0, f32 arg1) {
if (D_80178280[0].unk_1C8 == 7) { if (D_80178280[0].unk_1C8 == 7) {
return func_80060FE4(arg0, arg1); return func_80060FE4(arg0, arg1);
} }
Matrix_RotateY(D_8013BBC8, D_80178280[D_801778A0].unk_058, 0); Matrix_RotateY(gCalcMatrix, D_80178280[D_801778A0].unk_058, 0);
sp2C.x = arg0->x - D_80178280[D_801778A0].unk_040.x; sp2C.x = arg0->x - D_80178280[D_801778A0].unk_040.x;
sp2C.y = 0.0f; sp2C.y = 0.0f;
sp2C.z = arg0->z - D_80178280[D_801778A0].unk_040.z; sp2C.z = arg0->z - D_80178280[D_801778A0].unk_040.z;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp2C, &sp20); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp2C, &sp20);
if ((sp20.z < 0.0f) && (arg1 < sp20.z) && (fabsf(sp20.x) < (fabsf(sp20.z * 0.5f) + 500.0f))) { if ((sp20.z < 0.0f) && (arg1 < sp20.z) && (fabsf(sp20.x) < (fabsf(sp20.z * 0.5f) + 500.0f))) {
return 1; return 1;
@ -325,13 +325,13 @@ void func_80061F0C(Object_2F4* arg0, ObjectInit* arg1, s32 arg2) {
arg0->unk_054 = D_80177E70; arg0->unk_054 = D_80177E70;
arg0->unk_078 = D_80163FE0[D_80177E70].unk_0E4; arg0->unk_078 = D_80163FE0[D_80177E70].unk_0E4;
arg0->unk_16C = D_80161A54; arg0->unk_16C = D_80161A54;
Matrix_RotateZ(D_8013BBC8, -D_80177E88.z * M_DTOR, 0); Matrix_RotateZ(gCalcMatrix, -D_80177E88.z * M_DTOR, 0);
Matrix_RotateX(D_8013BBC8, -D_80177E88.x * M_DTOR, 1); Matrix_RotateX(gCalcMatrix, -D_80177E88.x * M_DTOR, 1);
Matrix_RotateY(D_8013BBC8, -D_80177E88.y * M_DTOR, 1); Matrix_RotateY(gCalcMatrix, -D_80177E88.y * M_DTOR, 1);
sp24.x = arg0->obj.pos.x - D_80177F10.x; sp24.x = arg0->obj.pos.x - D_80177F10.x;
sp24.y = arg0->obj.pos.y - D_80177F10.y; sp24.y = arg0->obj.pos.y - D_80177F10.y;
sp24.z = arg0->obj.pos.z - D_80177F10.z; sp24.z = arg0->obj.pos.z - D_80177F10.z;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp24, &arg0->unk_2DC); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp24, &arg0->unk_2DC);
arg0->unk_074 = D_80177E78; arg0->unk_074 = D_80177E78;
D_80177E70 = arg2; D_80177E70 = arg2;
func_80069AAC(arg0); func_80069AAC(arg0);
@ -619,21 +619,21 @@ s32 func_80062DBC(Vec3f* arg0, f32* var_s0, Object* arg2, f32 arg3, f32 arg4, f3
var_ft4 = arg0->y; var_ft4 = arg0->y;
var_ft5 = arg0->z; var_ft5 = arg0->z;
} else { } else {
Matrix_RotateZ(D_8013BBC8, -var_fa0 * M_DTOR, 0); Matrix_RotateZ(gCalcMatrix, -var_fa0 * M_DTOR, 0);
Matrix_RotateX(D_8013BBC8, -var_fs1 * M_DTOR, 1); Matrix_RotateX(gCalcMatrix, -var_fs1 * M_DTOR, 1);
Matrix_RotateY(D_8013BBC8, -var_fs2 * M_DTOR, 1); Matrix_RotateY(gCalcMatrix, -var_fs2 * M_DTOR, 1);
Matrix_RotateZ(D_8013BBC8, -arg2->rot.z * M_DTOR, 1); Matrix_RotateZ(gCalcMatrix, -arg2->rot.z * M_DTOR, 1);
Matrix_RotateX(D_8013BBC8, -arg2->rot.x * M_DTOR, 1); Matrix_RotateX(gCalcMatrix, -arg2->rot.x * M_DTOR, 1);
Matrix_RotateY(D_8013BBC8, -arg2->rot.y * M_DTOR, 1); Matrix_RotateY(gCalcMatrix, -arg2->rot.y * M_DTOR, 1);
if ((arg3 != 0.0f) || (arg4 != 0.0f) || (arg5 != 0.0f)) { if ((arg3 != 0.0f) || (arg4 != 0.0f) || (arg5 != 0.0f)) {
Matrix_RotateZ(D_8013BBC8, -arg5 * M_DTOR, 1); Matrix_RotateZ(gCalcMatrix, -arg5 * M_DTOR, 1);
Matrix_RotateX(D_8013BBC8, -arg3 * M_DTOR, 1); Matrix_RotateX(gCalcMatrix, -arg3 * M_DTOR, 1);
Matrix_RotateY(D_8013BBC8, -arg4 * M_DTOR, 1); Matrix_RotateY(gCalcMatrix, -arg4 * M_DTOR, 1);
} }
sp80.x = arg0->x - arg2->pos.x; sp80.x = arg0->x - arg2->pos.x;
sp80.y = arg0->y - arg2->pos.y; sp80.y = arg0->y - arg2->pos.y;
sp80.z = arg0->z - arg2->pos.z; sp80.z = arg0->z - arg2->pos.z;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp80, &sp74); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp80, &sp74);
var_fa1 = arg2->pos.x + sp74.x; var_fa1 = arg2->pos.x + sp74.x;
var_ft4 = arg2->pos.y + sp74.y; var_ft4 = arg2->pos.y + sp74.y;
var_ft5 = arg2->pos.z + sp74.z; var_ft5 = arg2->pos.z + sp74.z;
@ -673,8 +673,8 @@ s32 func_8006326C(Vec3f* arg0, s32 arg1, s32 arg2, Object* arg3) {
sp74.z = arg0->z - arg3->pos.z; sp74.z = arg0->z - arg3->pos.z;
if (((fabsf(sp74.x) < 1100.0f) && (fabsf(sp74.z) < 1100.0f)) || (arg2 == 0xB4)) { if (((fabsf(sp74.x) < 1100.0f) && (fabsf(sp74.z) < 1100.0f)) || (arg2 == 0xB4)) {
sp74.y = arg0->y - arg3->pos.y; sp74.y = arg0->y - arg3->pos.y;
Matrix_RotateY(D_8013BBC8, -arg3->rot.y * M_DTOR, 0U); Matrix_RotateY(gCalcMatrix, -arg3->rot.y * M_DTOR, 0U);
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp74, &sp68); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp74, &sp68);
sp5C.x = arg3->pos.x + sp68.x; sp5C.x = arg3->pos.x + sp68.x;
sp5C.y = arg3->pos.y + sp68.y; sp5C.y = arg3->pos.y + sp68.y;
sp5C.z = arg3->pos.z + sp68.z; sp5C.z = arg3->pos.z + sp68.z;
@ -1742,10 +1742,10 @@ void func_80066A8C(Object_80* arg0) {
sp64.x = 120.0f; sp64.x = 120.0f;
} }
for (yf = 0.0f; yf < 680.0f; yf += 100.0f) { for (yf = 0.0f; yf < 680.0f; yf += 100.0f) {
Matrix_RotateY(D_8013BBC8, arg0->obj.rot.y * M_DTOR, 0); Matrix_RotateY(gCalcMatrix, arg0->obj.rot.y * M_DTOR, 0);
Matrix_RotateX(D_8013BBC8, arg0->obj.rot.x * M_DTOR, 1); Matrix_RotateX(gCalcMatrix, arg0->obj.rot.x * M_DTOR, 1);
sp64.y = yf; sp64.y = yf;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp64, &sp58); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp64, &sp58);
func_8007D0E0(arg0->obj.pos.x + sp58.x, arg0->obj.pos.y + sp58.y, arg0->obj.pos.z + sp58.z, 4.0f); func_8007D0E0(arg0->obj.pos.x + sp58.x, arg0->obj.pos.y + sp58.y, arg0->obj.pos.z + sp58.z, 4.0f);
} }
} }
@ -1760,11 +1760,11 @@ void func_80066C00(Object_80* arg0) {
if (arg0->obj.rot.y > 90.0f) { if (arg0->obj.rot.y > 90.0f) {
sp64.x = 100.0f; sp64.x = 100.0f;
} }
Matrix_RotateY(D_8013BBC8, arg0->obj.rot.y * M_DTOR, 0); Matrix_RotateY(gCalcMatrix, arg0->obj.rot.y * M_DTOR, 0);
for (zf = -180.0f; zf <= 0.0f; zf += 30.0f) { for (zf = -180.0f; zf <= 0.0f; zf += 30.0f) {
sp64.z = zf; sp64.z = zf;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp64, &sp58); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp64, &sp58);
func_8007D0E0(arg0->obj.pos.x + sp58.x, arg0->obj.pos.y + sp58.y, arg0->obj.pos.z + sp58.z, func_8007D0E0(arg0->obj.pos.x + sp58.x, arg0->obj.pos.y + sp58.y, arg0->obj.pos.z + sp58.z,
Rand_ZeroOne() + 2.0f); Rand_ZeroOne() + 2.0f);
} }
@ -1868,11 +1868,11 @@ void func_800671D0(Object_6C* arg0) {
var_v0 = 7; var_v0 = 7;
} }
if (!(var_v0 & D_80177DB0)) { if (!(var_v0 & D_80177DB0)) {
Matrix_RotateY(D_8013BBC8, D_80177DB0 * 23.0f * M_DTOR, 0); Matrix_RotateY(gCalcMatrix, D_80177DB0 * 23.0f * M_DTOR, 0);
sp40.x = 50.0f; sp40.x = 50.0f;
sp40.y = (Rand_ZeroOne() - 0.5f) * 120.0f; sp40.y = (Rand_ZeroOne() - 0.5f) * 120.0f;
sp40.z = 0.0f; sp40.z = 0.0f;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp40, &sp34); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp40, &sp34);
func_80078E50(arg0->obj.pos.x + sp34.x, arg0->obj.pos.y + sp34.y, arg0->obj.pos.z + sp34.z, 3.0f); func_80078E50(arg0->obj.pos.x + sp34.x, arg0->obj.pos.y + sp34.y, arg0->obj.pos.z + sp34.z, 3.0f);
} }
arg0->obj.rot.y += arg0->unk_50; arg0->obj.rot.y += arg0->unk_50;
@ -1959,18 +1959,18 @@ void func_8006753C(Object_2F4* arg0) {
void func_80067874(Object_2F4* arg0) { void func_80067874(Object_2F4* arg0) {
s32 i; s32 i;
func_8000372C(&gMasterDisp, -60, -60, 60, 150, 150, 150, 20, 20, 20); Lights_SetOneLight(&gMasterDisp, -60, -60, 60, 150, 150, 150, 20, 20, 20);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, D_800CFEC4[i].x, D_800CFEC4[i].y, D_800CFEC4[i].z, 1); Matrix_Translate(gGfxMatrix, D_800CFEC4[i].x, D_800CFEC4[i].y, D_800CFEC4[i].z, 1);
Matrix_RotateY(D_8013B3C0, D_800CFF0C[i].y * M_DTOR, 1); Matrix_RotateY(gGfxMatrix, D_800CFF0C[i].y * M_DTOR, 1);
Matrix_RotateX(D_8013B3C0, D_800CFF0C[i].x * M_DTOR, 1); Matrix_RotateX(gGfxMatrix, D_800CFF0C[i].x * M_DTOR, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_10177C0); gSPDisplayList(gMasterDisp++, D_10177C0);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
func_8000372C(&gMasterDisp, D_801784DC, D_801784E0, D_801784E4, D_80178548, D_8017854C, D_80178550, D_80178554, Lights_SetOneLight(&gMasterDisp, D_801784DC, D_801784E0, D_801784E4, D_80178548, D_8017854C, D_80178550, D_80178554,
D_80178558, D_8017855C); D_80178558, D_8017855C);
} }
void func_80067A40(void) { void func_80067A40(void) {
@ -2133,12 +2133,12 @@ void func_80068020(Object_6C* arg0) {
func_80060FBC(&arg0->obj, &arg0->unk_5C); func_80060FBC(&arg0->obj, &arg0->unk_5C);
} }
if (arg0->unk_68 > 0.3f) { if (arg0->unk_68 > 0.3f) {
Matrix_RotateY(D_8013BBC8, arg0->obj.rot.y * M_DTOR, 0); Matrix_RotateY(gCalcMatrix, arg0->obj.rot.y * M_DTOR, 0);
Matrix_RotateZ(D_8013BBC8, D_80177DB0 * 37.0f * M_DTOR, 1); Matrix_RotateZ(gCalcMatrix, D_80177DB0 * 37.0f * M_DTOR, 1);
sp4C.x = 0.0f; sp4C.x = 0.0f;
sp4C.y = arg0->unk_68 * 100.0f; sp4C.y = arg0->unk_68 * 100.0f;
sp4C.z = 0.0f; sp4C.z = 0.0f;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp4C, &sp40); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp4C, &sp40);
func_80078E50(arg0->obj.pos.x + sp40.x, arg0->obj.pos.y + sp40.y, arg0->obj.pos.z + sp40.z, 3.5f); func_80078E50(arg0->obj.pos.x + sp40.x, arg0->obj.pos.y + sp40.y, arg0->obj.pos.z + sp40.z, 3.5f);
} }
break; break;
@ -2545,14 +2545,14 @@ void func_80069AAC(Object_2F4* arg0) {
if (D_801778E8 != 0) { if (D_801778E8 != 0) {
for (i = 0; i < D_801778A8; i++) { for (i = 0; i < D_801778A8; i++) {
if (arg0->unk_0CA[i] != 0) { if (arg0->unk_0CA[i] != 0) {
if (!(D_800DD880[i].button & 0x8000)) { if (!(gCurrentInput[i].button & 0x8000)) {
arg0->unk_0CA[i]--; arg0->unk_0CA[i]--;
} }
D_801779C8[i] = 0; D_801779C8[i] = 0;
} }
} }
} else if (arg0->unk_0CA[0] != 0) { } else if (arg0->unk_0CA[0] != 0) {
if (!(D_800DD880[D_80177AF8].button & 0x8000)) { if (!(gCurrentInput[D_80177AF8].button & 0x8000)) {
arg0->unk_0CA[0]--; arg0->unk_0CA[0]--;
} }
D_801779C8[0] = 0; D_801779C8[0] = 0;
@ -2726,12 +2726,12 @@ void func_8006A06C(UnkStruct_D_80174750* arg0) {
if (D_80177834 == 7) { if (D_80177834 == 7) {
if (((arg0->unk_00 == 1) || (arg0->unk_00 == 0x65) || (arg0->unk_00 == 0x32)) && (D_80178280[0].unk_1C8 == 3) && if (((arg0->unk_00 == 1) || (arg0->unk_00 == 0x65) || (arg0->unk_00 == 0x32)) && (D_80178280[0].unk_1C8 == 3) &&
(D_80178280[0].unk_1F4 == 0)) { (D_80178280[0].unk_1F4 == 0)) {
Matrix_RotateX(D_8013BBC8, -arg0->unk_1C, 0); Matrix_RotateX(gCalcMatrix, -arg0->unk_1C, 0);
Matrix_RotateY(D_8013BBC8, -arg0->unk_20, 1); Matrix_RotateY(gCalcMatrix, -arg0->unk_20, 1);
sp44.x = D_80178280[D_801778A0].unk_074 - arg0->unk_04; sp44.x = D_80178280[D_801778A0].unk_074 - arg0->unk_04;
sp44.y = D_80178280[D_801778A0].unk_078 - arg0->unk_08; sp44.y = D_80178280[D_801778A0].unk_078 - arg0->unk_08;
sp44.z = D_80178280[D_801778A0].unk_138 - arg0->unk_0C; sp44.z = D_80178280[D_801778A0].unk_138 - arg0->unk_0C;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp44, &sp38); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
sp38.x += arg0->unk_04; sp38.x += arg0->unk_04;
sp38.y += arg0->unk_08; sp38.y += arg0->unk_08;
sp38.z += arg0->unk_0C; sp38.z += arg0->unk_0C;

View File

@ -6,7 +6,7 @@ extern void func_80187520(s32, void*);
#define RGBA16_BLUE(color16) ((((color16) >> 1) & 0x1F) * 8) #define RGBA16_BLUE(color16) ((((color16) >> 1) & 0x1F) * 8)
void func_800A18B0(void) { void func_800A18B0(void) {
func_80006F20(); Memory_FreeAll();
Rand_Init(); Rand_Init();
Rand_SetSeed(1, 29000, 9876); Rand_SetSeed(1, 29000, 9876);
D_80177834 = 100; D_80177834 = 100;
@ -48,17 +48,17 @@ void func_800A1980(void) {
case 0: case 0:
return; return;
} }
func_80006F20(); Memory_FreeAll();
func_800A6148(); func_800A6148();
D_80177834 = D_80161A32; D_80177834 = D_80161A32;
D_8017783C = 3; D_8017783C = 3;
D_8015F924 = 0; D_8015F924 = 0;
D_80161A32 = 0; D_80161A32 = 0;
D_80177820 = 0; D_80177820 = 0;
D_80137E88 = D_80161A36 = 0; gFillScreenColor = D_80161A36 = 0;
D_80177D20 = 0.0f; D_80177D20 = 0.0f;
if ((D_80178234 == 0x13) && (D_8017827C == 2)) { if ((D_80178234 == 0x13) && (D_8017827C == 2)) {
D_80137E88 = D_80161A36 = 0xFFFF; gFillScreenColor = D_80161A36 = 0xFFFF;
D_80178348 = D_80178350 = D_80178354 = 0xFF; D_80178348 = D_80178350 = D_80178354 = 0xFF;
} else { } else {
D_80178348 = D_80178350 = D_80178354 = 0; D_80178348 = D_80178350 = D_80178354 = 0;
@ -105,8 +105,8 @@ s32 func_800A1B6C(void) {
void func_800A1C14(Gfx** arg0) { void func_800A1C14(Gfx** arg0) {
gSPDisplayList((*arg0)++, D_Gfx_800DBAA0); gSPDisplayList((*arg0)++, D_Gfx_800DBAA0);
gDPSetScissor((*arg0)++, G_SC_NON_INTERLACE, 8, 8, 312, 232); gDPSetScissor((*arg0)++, G_SC_NON_INTERLACE, 8, 8, 312, 232);
gDPSetDepthImage((*arg0)++, &D_80282000); gDPSetDepthImage((*arg0)++, &gZBuffer);
gDPSetColorImage((*arg0)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, &D_80282000); gDPSetColorImage((*arg0)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, &gZBuffer);
gDPSetFillColor((*arg0)++, 0xFFFCFFFC); gDPSetFillColor((*arg0)++, 0xFFFCFFFC);
gDPFillRectangle((*arg0)++, 8, 8, 311, 231); gDPFillRectangle((*arg0)++, 8, 8, 311, 231);
gDPSetColorImage((*arg0)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, gFrameBuffer); gDPSetColorImage((*arg0)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, gFrameBuffer);
@ -288,7 +288,7 @@ void func_800A26C0(void) {
func_800A1C14(&gUnkDisp1); func_800A1C14(&gUnkDisp1);
func_800A25DC(); func_800A25DC();
if (func_800A1B6C() != 1) { if (func_800A1B6C() != 1) {
func_8000316C(&gUnkDisp1); Lib_Perspective(&gUnkDisp1);
func_800A1FB0(&gUnkDisp1, D_801778A8, 0); func_800A1FB0(&gUnkDisp1, D_801778A8, 0);
if (D_8017783C != 0) { if (D_8017783C != 0) {
D_8017783C--; D_8017783C--;
@ -314,12 +314,12 @@ void func_800A26C0(void) {
D_80177834++; D_80177834++;
break; break;
case 0x67: case 0x67:
if (func_800C3194() != 0) { if (Save_Read() != 0) {
D_80178870 = *((SaveFile*) &D_800D4D10); gSaveFile = *((SaveFile*) &D_800D4D10);
func_800C3084(); Save_Write();
} }
D_80177834++; D_80177834++;
func_80006FD8(MSEC_TO_CYCLES(1000), func_80007068, &D_80177834, 1); Timer_CreateTask(MSEC_TO_CYCLES(1000), Timer_Increment, &D_80177834, 1);
case 0x68: case 0x68:
func_800B8DD0(&gMasterDisp, 0x4C); func_800B8DD0(&gMasterDisp, 0x4C);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
@ -338,7 +338,7 @@ void func_800A26C0(void) {
D_80177834 = 2; D_80177834 = 2;
D_80177AE0 = 1; D_80177AE0 = 1;
D_80177824 = 1; D_80177824 = 1;
func_80006F20(); Memory_FreeAll();
func_800A6148(); func_800A6148();
D_801778A8 = 1; D_801778A8 = 1;
D_80161AA0[0] = 2; D_80161AA0[0] = 2;
@ -368,7 +368,7 @@ void func_800A26C0(void) {
D_800D3180[i] = 0; D_800D3180[i] = 0;
} }
D_801779F8 = 0; D_801779F8 = 0;
D_80177C74 = D_80178870.raw[0x14]; D_80177C74 = gSaveFile.save.data.unk_14;
switch (D_80177C74) { switch (D_80177C74) {
case 0: case 0:
var_v0_3 = 0; var_v0_3 = 0;
@ -385,9 +385,9 @@ void func_800A26C0(void) {
break; break;
} }
func_800182F4(var_v0_3 | 0xE0000000); func_800182F4(var_v0_3 | 0xE0000000);
D_80177C80[0] = D_80178870.raw[0x15]; D_80177C80[0] = gSaveFile.save.data.unk_15;
D_80177C80[1] = D_80178870.raw[0x16]; D_80177C80[1] = gSaveFile.save.data.unk_16;
D_80177C80[2] = D_80178870.raw[0x17]; D_80177C80[2] = gSaveFile.save.data.unk_17;
if (D_80177C80[0] > 99) { if (D_80177C80[0] > 99) {
D_80177C80[0] = 99; D_80177C80[0] = 99;
} }

View File

@ -1,72 +0,0 @@
#include "global.h"
#ifdef DATA_IMPORT_PENDING
SaveFile D_80178870;
#else
extern SaveFile D_80178870;
#endif
u16 func_800C2FB0(Save* arg0) {
u16 var_v1;
s32 i;
for (i = 0, var_v1 = 0; i < 0xFE; i++) {
var_v1 ^= arg0->checksum.unk_00[i];
var_v1 <<= 1;
var_v1 = (var_v1 & 0xFE) | ((var_v1 >> 8) & 1);
}
var_v1 = (var_v1 & 0xFF) | 0x9500;
return var_v1;
}
s32 func_800C3084(void) {
void* sp1C;
D_80178870.save[0].checksum.unk_FE = func_800C2FB0(&D_80178870.save[0]);
D_80178870.save[1] = D_80178870.save[0];
D_80144F60 = D_80178870;
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_12, OS_MESG_PRI_NORMAL);
osRecvMesg(&D_800E2318, &sp1C, OS_MESG_BLOCK);
if (sp1C != (OSMesg) SI_MESG_15) {
return -1;
}
return 0;
}
#ifdef DATA_IMPORT_PENDING
s32 func_800C3194(void) {
void* sp24;
s32 i;
osSendMesg(&gSerialThreadMsgQueue, (OSMesg) SI_MESG_11, OS_MESG_PRI_NORMAL);
osRecvMesg(&D_800E2318, &sp24, OS_MESG_BLOCK);
if ((s32) sp24 != SI_MESG_15) {
return -1;
}
D_80178870 = D_80144F60;
if (D_80178870.save[0].unk_FE == func_800C2FB0(&D_80178870.save[0])) {
(void) " 正常\n";
return 0;
}
for (i = 0; i < 0xFF; i++) {
D_80178870.save[0].unk_0[i] = D_80178870.save[1].unk_0[i];
}
D_80178870.save[0].unk_FE = D_80178870.save[1].unk_FE;
if (D_80178870.save[0].unk_FE == func_800C2FB0(&D_80178870.save[0])) {
(void) " 1 正常\n";
return 0;
}
(void) " 1 異常\n";
return -1;
}
#else
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_C3BB0/func_800C3194.s")
#pragma GLOBAL_ASM("asm/us/nonmatchings/main/sf_C3BB0/D_800D9430.s")
#endif

View File

@ -80,29 +80,29 @@ void func_80084B94(s32 arg0) {
if (arg0 == 0) { if (arg0 == 0) {
for (i = 1; i < 4; i++) { for (i = 1; i < 4; i++) {
if (((D_801778B0[i] != 0) || (D_80178280->unk_1C8 != 7)) && (D_801778B0[i] <= 0) && (D_801778B0[i] != -2)) { if (((D_801778B0[i] != 0) || (D_80178280->unk_1C8 != 7)) && (D_801778B0[i] <= 0) && (D_801778B0[i] != -2)) {
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, D_800D1A70[i - 1].x, D_800D1A70[i - 1].y, D_800D1A70[i - 1].z, 1); Matrix_Translate(gGfxMatrix, D_800D1A70[i - 1].x, D_800D1A70[i - 1].y, D_800D1A70[i - 1].z, 1);
Matrix_Scale(D_8013B3C0, 0.68f, 0.68f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 0.68f, 0.68f, 1.0f, 1);
Matrix_RotateZ(D_8013B3C0, M_PI / 4.0f, 1); Matrix_RotateZ(gGfxMatrix, M_PI / 4.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_500B600); gSPDisplayList(gMasterDisp++, D_500B600);
Matrix_RotateZ(D_8013B3C0, 3.0f * M_PI / 2.0f, 1); Matrix_RotateZ(gGfxMatrix, 3.0f * M_PI / 2.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_500B600); gSPDisplayList(gMasterDisp++, D_500B600);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
} else { } else {
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, -234.0f, -167.0f, -600.0f, 1); Matrix_Translate(gGfxMatrix, -234.0f, -167.0f, -600.0f, 1);
Matrix_RotateZ(D_8013B3C0, M_PI / 4.0f, 1); Matrix_RotateZ(gGfxMatrix, M_PI / 4.0f, 1);
Matrix_Scale(D_8013B3C0, 0.68f, 0.68f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 0.68f, 0.68f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_500B600); gSPDisplayList(gMasterDisp++, D_500B600);
Matrix_RotateZ(D_8013B3C0, 3.0f * M_PI / 2.0f, 1); Matrix_RotateZ(gGfxMatrix, 3.0f * M_PI / 2.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_500B600); gSPDisplayList(gMasterDisp++, D_500B600);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
#else #else
@ -472,9 +472,9 @@ void func_80088784(s32 arg0) {
arg0--; arg0--;
func_800B8DD0(&gMasterDisp, 0x24); func_800B8DD0(&gMasterDisp, 0x24);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_800D1DC8[arg0]); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, D_800D1DC8[arg0]);
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, 3.9f, -3.3f, -100.0f, 0); Matrix_Translate(gGfxMatrix, 3.9f, -3.3f, -100.0f, 0);
Matrix_Scale(D_8013B3C0, 0.37f, 0.37f, 0.37f, 1); Matrix_Scale(gGfxMatrix, 0.37f, 0.37f, 0.37f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
if (D_80177C98 == 0) { if (D_80177C98 == 0) {
@ -483,7 +483,7 @@ void func_80088784(s32 arg0) {
gSPDisplayList(gMasterDisp++, D_800D1D94[arg0]); gSPDisplayList(gMasterDisp++, D_800D1D94[arg0]);
} }
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
#else #else
@ -495,7 +495,7 @@ void func_80088784(s32 arg0) {
void func_80089670(void) { void func_80089670(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Matrix_Scale(D_8013B3C0, 18.64f, 21.04f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 18.64f, 21.04f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0); gSPDisplayList(gMasterDisp++, D_1024AC0);
} }
@ -503,7 +503,7 @@ void func_80089670(void) {
void func_80089710(void) { void func_80089710(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Matrix_Scale(D_8013B3C0, 11.0f, 11.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 11.0f, 11.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024AC0); gSPDisplayList(gMasterDisp++, D_1024AC0);
} }
@ -511,7 +511,7 @@ void func_80089710(void) {
void func_800897B0(void) { void func_800897B0(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
Matrix_Scale(D_8013B3C0, 130.0f, 130.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 130.0f, 130.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024830); gSPDisplayList(gMasterDisp++, D_1024830);
} }
@ -519,7 +519,7 @@ void func_800897B0(void) {
void func_80089850(void) { void func_80089850(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255);
Matrix_Scale(D_8013B3C0, 125.0f, 125.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 125.0f, 125.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_102A8A0); gSPDisplayList(gMasterDisp++, D_102A8A0);
} }
@ -527,7 +527,7 @@ void func_80089850(void) {
void func_800898F0(void) { void func_800898F0(void) {
func_800B8DD0(&gMasterDisp, 1); func_800B8DD0(&gMasterDisp, 1);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 208, 80, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 208, 80, 255);
Matrix_Scale(D_8013B3C0, 30.0f, 30.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 30.0f, 30.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_6004570); gSPDisplayList(gMasterDisp++, D_6004570);
} }
@ -552,7 +552,7 @@ void func_80089994(s32 arg0) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, D_800D1E14[arg0][0], D_800D1E14[arg0][1], D_800D1E14[arg0][2], gDPSetPrimColor(gMasterDisp++, 0, 0, D_800D1E14[arg0][0], D_800D1E14[arg0][1], D_800D1E14[arg0][2],
D_800D1E14[arg0][3]); D_800D1E14[arg0][3]);
Matrix_Scale(D_8013B3C0, var_fv1, var_fv2, 1.0f, 1); Matrix_Scale(gGfxMatrix, var_fv1, var_fv2, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1015510); gSPDisplayList(gMasterDisp++, D_1015510);
} }
@ -563,7 +563,7 @@ void func_80089994(s32 arg0) {
void func_80089AF4(void) { void func_80089AF4(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255);
Matrix_Scale(D_8013B3C0, 54.0f, 54.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_F014180); gSPDisplayList(gMasterDisp++, D_F014180);
} }
@ -571,7 +571,7 @@ void func_80089AF4(void) {
void func_80089B94(void) { void func_80089B94(void) {
func_800B8DD0(&gMasterDisp, 0x3E); func_800B8DD0(&gMasterDisp, 0x3E);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 92, 92, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 92, 92, 255);
Matrix_Scale(D_8013B3C0, 54.0f, 54.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_D0098B0); gSPDisplayList(gMasterDisp++, D_D0098B0);
} }
@ -589,7 +589,7 @@ void func_80089C38(void) {
alpha *= 255.0f / 10.0f; alpha *= 255.0f / 10.0f;
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, alpha); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, alpha);
Matrix_Scale(D_8013B3C0, 15.0f, 15.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 15.0f, 15.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024230); gSPDisplayList(gMasterDisp++, D_1024230);
} }
@ -615,8 +615,8 @@ void func_80089D28(void) {
} }
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, gb, gb, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, gb, gb, 255);
Matrix_Translate(D_8013B3C0, 0.0f, -185.92001f, 0, 1); Matrix_Translate(gGfxMatrix, 0.0f, -185.92001f, 0, 1);
Matrix_Scale(D_8013B3C0, 3.55f, 0.13f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 3.55f, 0.13f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_1024230); gSPDisplayList(gMasterDisp++, D_1024230);
} }
@ -983,12 +983,12 @@ void func_8008BAE4(void) {
if ((D_80161788 != 0) || (D_8016178C != 0)) { if ((D_80161788 != 0) || (D_8016178C != 0)) {
func_800B8DD0(&gMasterDisp, 0xC); func_800B8DD0(&gMasterDisp, 0xC);
gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, alpha); gDPSetPrimColor(gMasterDisp++, 0, 0, r, g, b, alpha);
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, -53.9f, -38.5f, -139.4f, 1); Matrix_Translate(gGfxMatrix, -53.9f, -38.5f, -139.4f, 1);
Matrix_Scale(D_8013B3C0, 1.0f, 1.0f, 1.0f, 1); Matrix_Scale(gGfxMatrix, 1.0f, 1.0f, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_800D1A40); gSPDisplayList(gMasterDisp++, D_800D1A40);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
@ -2053,7 +2053,7 @@ s32 func_80091DF4(Object_2F4* arg0) {
sp44.x = 0.0f; sp44.x = 0.0f;
sp44.y = 0.0f; sp44.y = 0.0f;
sp44.z = 100.0f; sp44.z = 100.0f;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp44, &sp38); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp44, &sp38);
func_8006EEFC(arg0->unk_0E4, arg0->obj.pos.x + (sp38.x * 1.5), arg0->obj.pos.y + (sp38.y * 1.5), func_8006EEFC(arg0->unk_0E4, arg0->obj.pos.x + (sp38.x * 1.5), arg0->obj.pos.y + (sp38.y * 1.5),
arg0->obj.pos.z + (sp38.z * 1.5), sp38.x, sp38.y, sp38.z, arg0->obj.rot.x, arg0->obj.rot.y, arg0->obj.pos.z + (sp38.z * 1.5), sp38.x, sp38.y, sp38.z, arg0->obj.rot.x, arg0->obj.rot.y,
arg0->obj.rot.z); arg0->obj.rot.z);
@ -2080,7 +2080,7 @@ s32 func_80091F00(Object_2F4* arg0) {
func_80019218(0x2903300E, &arg0->unk_100, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x2903300E, &arg0->unk_100, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
func_8007D10C(arg0->obj.pos.x, arg0->obj.pos.y, arg0->obj.pos.z, 1.5f); func_8007D10C(arg0->obj.pos.x, arg0->obj.pos.y, arg0->obj.pos.z, 1.5f);
Matrix_RotateY(D_8013BBC8, arg0->unk_0F8 * M_DTOR, 0); Matrix_RotateY(gCalcMatrix, arg0->unk_0F8 * M_DTOR, 0);
if (Rand_ZeroOne() < 0.5f) { if (Rand_ZeroOne() < 0.5f) {
sp40.x = -20.0f; sp40.x = -20.0f;
@ -2091,7 +2091,7 @@ s32 func_80091F00(Object_2F4* arg0) {
sp40.y = (Rand_ZeroOne() - 0.5f) * 20.0f; sp40.y = (Rand_ZeroOne() - 0.5f) * 20.0f;
sp40.z = 0.0f; sp40.z = 0.0f;
Matrix_MultVec3fNoTranslate(D_8013BBC8, &sp40, &sp34); Matrix_MultVec3fNoTranslate(gCalcMatrix, &sp40, &sp34);
arg0->unk_148 = sp34.x; arg0->unk_148 = sp34.x;
arg0->unk_14C = sp34.y; arg0->unk_14C = sp34.y;

50
src/main/timer.c Normal file
View File

@ -0,0 +1,50 @@
#include "global.h"
TimerTask sTimerTasks[0x10];
TimerTask* Timer_AllocateTask(void) {
s32 i;
for (i = 0; i < 0x10; i++) {
if (!sTimerTasks[i].active) {
return &sTimerTasks[i];
}
}
return NULL;
}
s32 Timer_CreateTask(u64 time, TimerAction action, s32* address, s32 value) {
TimerTask* task = Timer_AllocateTask();
if (task == NULL) {
return -1;
}
task->active = true;
task->action = action;
task->address = address;
task->value = value;
return osSetTimer(&task->timer, time, 0, &gTimerTaskMsgQueue, task);
}
void Timer_Increment(s32* address, s32 value) {
*address += value;
}
void Timer_SetValue(s32* address, s32 value) {
*address = value;
}
void Timer_CompleteTask(TimerTask* task) {
if (task->action != NULL) {
task->action(task->address, task->value);
}
task->active = false;
}
void Timer_Wait(u64 time) {
OSTimer timer;
OSMesg dummy;
osSetTimer(&timer, time, 0, &gTimerWaitMsgQueue, NULL);
osRecvMesg(&gTimerWaitMsgQueue, &dummy, OS_MESG_BLOCK);
}

View File

@ -35,7 +35,7 @@ void func_EBFBE0_801875E0(void) {
D_EBFBE0_801B7BCC = 255.0f; D_EBFBE0_801B7BCC = 255.0f;
D_EBFBE0_801B7BC8 = 255.0f; D_EBFBE0_801B7BC8 = 255.0f;
func_80006F20(); Memory_FreeAll();
func_800A5D6C(); func_800A5D6C();
D_80178420 = 320.0f; D_80178420 = 320.0f;
@ -51,7 +51,7 @@ void func_EBFBE0_801875E0(void) {
func_8001DC6C(0, 0x16); func_8001DC6C(0, 0x16);
D_EBFBE0_801B82C4 = 1; D_EBFBE0_801B82C4 = 1;
} }
D_800DD8B4 = 0x1E; gStopInputTimer = 0x1E;
} }
void func_EBFBE0_80187754(void) { void func_EBFBE0_80187754(void) {
@ -121,21 +121,21 @@ void func_EBFBE0_801878D8(void) {
case 0: case 0:
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_80189208(); func_EBFBE0_80189208();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
func_EBFBE0_8018F680(); func_EBFBE0_8018F680();
func_EBFBE0_8018F85C(); func_EBFBE0_8018F85C();
func_EBFBE0_8018FC14(); func_EBFBE0_8018FC14();
func_EBFBE0_8018F8E4(); func_EBFBE0_8018F8E4();
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018F77C(); func_EBFBE0_8018F77C();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
break; break;
case 1: case 1:
if (D_EBFBE0_801B8348 != 0) { if (D_EBFBE0_801B8348 != 0) {
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018A2F8(); func_EBFBE0_8018A2F8();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
func_800BB5D0(); func_800BB5D0();
func_EBFBE0_80190C9C(); func_EBFBE0_80190C9C();
} }
@ -146,7 +146,7 @@ void func_EBFBE0_801878D8(void) {
case 2: case 2:
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018A990(); func_EBFBE0_8018A990();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
if (D_EBFBE0_801B8344 != 0) { if (D_EBFBE0_801B8344 != 0) {
func_EBFBE0_8018FD08(); func_EBFBE0_8018FD08();
} }
@ -155,20 +155,20 @@ void func_EBFBE0_801878D8(void) {
case 3: case 3:
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018B038(); func_EBFBE0_8018B038();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
break; break;
case 4: case 4:
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018C114(); func_EBFBE0_8018C114();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
func_EBFBE0_80190C9C(); func_EBFBE0_80190C9C();
break; break;
case 5: case 5:
func_EBFBE0_801918FC(); func_EBFBE0_801918FC();
func_EBFBE0_8018CB90(); func_EBFBE0_8018CB90();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
break; break;
} }
@ -186,7 +186,7 @@ s32 func_EBFBE0_80187ABC(void) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (D_800DD8B0[i] == 1) { if (gControllerStatus[i] == 1) {
ret = i; ret = i;
break; break;
} }

View File

@ -82,7 +82,7 @@ void func_EBFBE0_80191B20(void) {
if (i == 14) { if (i == 14) {
continue; continue;
} }
if (!(D_80178870.save[0].save_00.unk_00[i].unk_6 & 1)) { if (!(gSaveFile.save.data.unk_00[i].unk_6 & 1)) {
var_a1_2 = 0; var_a1_2 = 0;
break; break;
} }
@ -121,24 +121,24 @@ void func_EBFBE0_80191B20(void) {
if (D_80161A34 == 8) { if (D_80161A34 == 8) {
D_80177B8C[D_80177B48 + 1] = 13; D_80177B8C[D_80177B48 + 1] = 13;
if (D_800D3180[9] == 1) { if (D_800D3180[9] == 1) {
D_80178870.save[0].save_00.unk_00[14].unk_5 = 1; gSaveFile.save.data.unk_00[14].unk_5 = 1;
if (var_v0_2 != 0) { if (var_v0_2 != 0) {
D_80178870.save[0].save_00.unk_00[14].unk_4 = 1; gSaveFile.save.data.unk_00[14].unk_4 = 1;
} else { } else {
D_80178870.save[0].save_00.unk_00[14].unk_7 = 1; gSaveFile.save.data.unk_00[14].unk_7 = 1;
} }
func_800C3084(); Save_Write();
} else if (D_800D3180[9] == 2) { } else if (D_800D3180[9] == 2) {
D_80177BB0[D_80177B48] = 1; D_80177BB0[D_80177B48] = 1;
D_80178870.save[0].save_00.unk_00[15].unk_5 = 1; gSaveFile.save.data.unk_00[15].unk_5 = 1;
if (var_v0_2 != 0) { if (var_v0_2 != 0) {
D_80178870.save[0].save_00.unk_00[15].unk_4 = 1; gSaveFile.save.data.unk_00[15].unk_4 = 1;
D_80178870.save[0].save_00.unk_00[15].unk_3 = 1; gSaveFile.save.data.unk_00[15].unk_3 = 1;
} else { } else {
D_80178870.save[0].save_00.unk_00[15].unk_7 = 1; gSaveFile.save.data.unk_00[15].unk_7 = 1;
D_80178870.save[0].save_00.unk_00[15].unk_6 = 1; gSaveFile.save.data.unk_00[15].unk_6 = 1;
} }
func_800C3084(); Save_Write();
} }
} }
@ -195,7 +195,7 @@ void func_EBFBE0_80191B20(void) {
D_8017784C = 2; D_8017784C = 2;
func_80006F20(); Memory_FreeAll();
D_80178420 = 320.0f; D_80178420 = 320.0f;
D_80178424 = 240.0f; D_80178424 = 240.0f;
@ -376,7 +376,7 @@ void func_EBFBE0_80192340(void) {
if (D_EBFBE0_801B8280 != 0) { if (D_EBFBE0_801B8280 != 0) {
func_EBFBE0_8019BDF0(); func_EBFBE0_8019BDF0();
func_80084688(2, D_EBFBE0_801B8284); func_80084688(2, D_EBFBE0_801B8284);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
@ -472,7 +472,7 @@ void func_EBFBE0_801928BC(void) {
D_8017783C = 2; D_8017783C = 2;
D_80177B40 = 0; D_80177B40 = 0;
D_80177898 = 0; D_80177898 = 0;
D_800DD8B4 = 3; gStopInputTimer = 3;
} else { } else {
D_80178340 += 0x20; D_80178340 += 0x20;
if (D_80178340 > 0xFF) { if (D_80178340 > 0xFF) {
@ -492,7 +492,7 @@ void func_EBFBE0_80192938(void) {
D_80177CA0 = 0; D_80177CA0 = 0;
D_80177CB0 = 0.0f; D_80177CB0 = 0.0f;
D_8017782C = 1; D_8017782C = 1;
D_800DD8B4 = 3; gStopInputTimer = 3;
func_8001DC6C(0, 28); func_8001DC6C(0, 28);
} else { } else {
D_80178340 += 0x20; D_80178340 += 0x20;
@ -510,7 +510,7 @@ void func_EBFBE0_801929F0(void) {
D_800D2870 = 0; D_800D2870 = 0;
D_80161A38 = 0xFF; D_80161A38 = 0xFF;
D_800DD8B4 = 0; gStopInputTimer = 0;
D_80178410 = 800; D_80178410 = 800;
D_EBFBE0_801B9248 = 0; D_EBFBE0_801B9248 = 0;
@ -568,7 +568,7 @@ void func_EBFBE0_80193864(void) {
} }
func_EBFBE0_8019BBA4(D_EBFBE0_801AE638[D_EBFBE0_801B91A4].unk_4C); func_EBFBE0_8019BBA4(D_EBFBE0_801AE638[D_EBFBE0_801B91A4].unk_4C);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (!(D_EBFBE0_801AE638[i].unk_58) || (D_EBFBE0_801AE638[i].unk_00.unk_20) <= 0.0f) { if (!(D_EBFBE0_801AE638[i].unk_58) || (D_EBFBE0_801AE638[i].unk_00.unk_20) <= 0.0f) {
@ -590,7 +590,7 @@ void func_EBFBE0_80193B04(void) {
s32 i; s32 i;
D_80161A38 = 0xFF; D_80161A38 = 0xFF;
D_800DD8B4 = 0; gStopInputTimer = 0;
D_80178410 = 800; D_80178410 = 800;
if (D_EBFBE0_801B9248 == 0) { if (D_EBFBE0_801B9248 == 0) {
@ -641,7 +641,7 @@ void func_EBFBE0_801944F0(void) {
} }
func_EBFBE0_8019BBA4(D_EBFBE0_801AE878[D_EBFBE0_801B91A8].unk_4C); func_EBFBE0_8019BBA4(D_EBFBE0_801AE878[D_EBFBE0_801B91A8].unk_4C);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
if ((D_EBFBE0_801AE878[i].unk_58 != 0) && !(D_EBFBE0_801AE878[i].unk_00.unk_20 <= 0.0f)) { if ((D_EBFBE0_801AE878[i].unk_58 != 0) && !(D_EBFBE0_801AE878[i].unk_00.unk_20 <= 0.0f)) {
@ -662,12 +662,12 @@ void func_EBFBE0_80194678(void) {
D_EBFBE0_801B91BC = 1; D_EBFBE0_801B91BC = 1;
D_EBFBE0_801B91A0 = 0; D_EBFBE0_801B91A0 = 0;
D_80177C74 = D_80178870.save[0].save_00.unk_14; D_80177C74 = gSaveFile.save.data.unk_14;
func_800182F4(D_EBFBE0_801AE998[D_80177C74] | 0xE0000000); func_800182F4(D_EBFBE0_801AE998[D_80177C74] | 0xE0000000);
D_80177C80[0] = D_80178870.save[0].save_00.unk_15; D_80177C80[0] = gSaveFile.save.data.unk_15;
D_80177C80[1] = D_80178870.save[0].save_00.unk_16; D_80177C80[1] = gSaveFile.save.data.unk_16;
D_80177C80[2] = D_80178870.save[0].save_00.unk_17; D_80177C80[2] = gSaveFile.save.data.unk_17;
if (D_80177C80[0] > 99) { if (D_80177C80[0] > 99) {
D_80177C80[0] = 99; D_80177C80[0] = 99;
@ -734,23 +734,23 @@ void func_EBFBE0_801948A8(void) {
} }
// Test sound // Test sound
if (D_800DD898[D_80177AF8].button & R_TRIG) { if (gChangedInput[D_80177AF8].button & R_TRIG) {
D_EBFBE0_801B9284 ^= 1; D_EBFBE0_801B9284 ^= 1;
func_8001D8F4(D_EBFBE0_801B9284); func_8001D8F4(D_EBFBE0_801B9284);
} }
if (D_800DD898[D_80177AF8].button & A_BUTTON) { if (gChangedInput[D_80177AF8].button & A_BUTTON) {
func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_EBFBE0_801B9288 = (D_EBFBE0_801B9288 + 1) & 3; D_EBFBE0_801B9288 = (D_EBFBE0_801B9288 + 1) & 3;
} }
if (D_800DD898[D_80177AF8].button & B_BUTTON) { if (gChangedInput[D_80177AF8].button & B_BUTTON) {
func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
if (D_EBFBE0_801B9284 == 1) { if (D_EBFBE0_801B9284 == 1) {
D_EBFBE0_801B9284 = 0; D_EBFBE0_801B9284 = 0;
func_8001D8F4(D_EBFBE0_801B9284); func_8001D8F4(D_EBFBE0_801B9284);
} }
func_800C3084(); Save_Write();
D_80177898 = 0; D_80177898 = 0;
D_EBFBE0_801B9124 = 1000; D_EBFBE0_801B9124 = 1000;
D_EBFBE0_801B912C = 0; D_EBFBE0_801B912C = 0;
@ -768,7 +768,7 @@ void func_EBFBE0_80194AEC(void) {
if (D_80177C74 >= 3) { if (D_80177C74 >= 3) {
D_80177C74 = 0; D_80177C74 = 0;
} }
D_80178870.save[0].save_00.unk_14 = D_80177C74; gSaveFile.save.data.unk_14 = D_80177C74;
func_800182F4(D_EBFBE0_801AE998[D_80177C74] | 0xE0000000); func_800182F4(D_EBFBE0_801AE998[D_80177C74] | 0xE0000000);
} }
} }
@ -789,15 +789,15 @@ void func_EBFBE0_80194BD0(void) {
switch (D_EBFBE0_801B9288 - 1) { switch (D_EBFBE0_801B9288 - 1) {
case 0: case 0:
D_80178870.save[0].save_00.unk_15 = var_v1; gSaveFile.save.data.unk_15 = var_v1;
break; break;
case 1: case 1:
D_80178870.save[0].save_00.unk_16 = var_v1; gSaveFile.save.data.unk_16 = var_v1;
break; break;
case 2: case 2:
D_80178870.save[0].save_00.unk_17 = var_v1; gSaveFile.save.data.unk_17 = var_v1;
break; break;
} }
func_8001D8A8(D_EBFBE0_801B924C, var_v1); func_8001D8A8(D_EBFBE0_801B924C, var_v1);
@ -835,12 +835,12 @@ void func_EBFBE0_80195944(void) {
D_EBFBE0_801B931C = sp28; D_EBFBE0_801B931C = sp28;
} }
if (D_800DD898[D_80177AF8].button & A_BUTTON) { if (gChangedInput[D_80177AF8].button & A_BUTTON) {
func_8001DA90(D_EBFBE0_801B931F); func_8001DA90(D_EBFBE0_801B931F);
D_EBFBE0_801B9320 = true; D_EBFBE0_801B9320 = true;
} }
if (D_800DD898[D_80177AF8].button & B_BUTTON) { if (gChangedInput[D_80177AF8].button & B_BUTTON) {
if (!D_EBFBE0_801B9320) { if (!D_EBFBE0_801B9320) {
func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
func_8001D444(0, 0x24, 0, 0xFF); func_8001D444(0, 0x24, 0, 0xFF);
@ -857,7 +857,7 @@ void func_EBFBE0_80195944(void) {
} }
// Spectrum Analizer mode selector // Spectrum Analizer mode selector
if (D_800DD898[D_80177AF8].button & R_CBUTTONS) { if (gChangedInput[D_80177AF8].button & R_CBUTTONS) {
spectrumAnalizerMode++; spectrumAnalizerMode++;
if (spectrumAnalizerMode > 2) { if (spectrumAnalizerMode > 2) {
spectrumAnalizerMode = 0; spectrumAnalizerMode = 0;
@ -935,9 +935,9 @@ void func_EBFBE0_801962A4(void) {
if (temp_fv0 == 0.0f) { if (temp_fv0 == 0.0f) {
D_EBFBE0_801B91CC = 3; D_EBFBE0_801B91CC = 3;
D_80178870 = *(SaveFile*) &D_800D4D10; gSaveFile = *(SaveFile*) &D_800D4D10;
func_800C3084(); Save_Write();
D_EBFBE0_801B91AC = 0; D_EBFBE0_801B91AC = 0;
D_EBFBE0_801B91B0 = 0; D_EBFBE0_801B91B0 = 0;
@ -976,7 +976,7 @@ void func_EBFBE0_8019669C(void) {
if (1) {} if (1) {}
} }
if (D_800DD898[D_80177AF8].button & 0x8000) { if (gChangedInput[D_80177AF8].button & 0x8000) {
if (D_EBFBE0_801B91CC == 3) { if (D_EBFBE0_801B91CC == 3) {
func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_EBFBE0_801B912C = 3; D_EBFBE0_801B912C = 3;
@ -995,7 +995,7 @@ void func_EBFBE0_8019669C(void) {
D_EBFBE0_801B912C = 4; D_EBFBE0_801B912C = 4;
} }
} }
} else if (D_800DD898[D_80177AF8].button & 0x4000) { } else if (gChangedInput[D_80177AF8].button & 0x4000) {
if (D_EBFBE0_801B91CC == 1) { if (D_EBFBE0_801B91CC == 1) {
func_80019218(0x4900101D, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x4900101D, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_EBFBE0_801B912C = 2; D_EBFBE0_801B912C = 2;
@ -1036,7 +1036,7 @@ void func_EBFBE0_80196E54(void) {
void func_EBFBE0_80196EFC(void) { void func_EBFBE0_80196EFC(void) {
func_EBFBE0_80196FC4(); func_EBFBE0_80196FC4();
if (D_800DD898[D_80177AF8].button & B_BUTTON) { if (gChangedInput[D_80177AF8].button & B_BUTTON) {
func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000021, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_80177898 = 0; D_80177898 = 0;
D_EBFBE0_801B9124 = 1000; D_EBFBE0_801B9124 = 1000;
@ -1051,7 +1051,7 @@ void func_EBFBE0_80196F9C(void) {
} }
void func_EBFBE0_80196FC4(void) { void func_EBFBE0_80196FC4(void) {
if (D_800DD898[D_80177AF8].button & A_BUTTON) { if (gChangedInput[D_80177AF8].button & A_BUTTON) {
func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_EBFBE0_801B93E0 ^= 1; D_EBFBE0_801B93E0 ^= 1;
} }
@ -1189,7 +1189,7 @@ void func_EBFBE0_8019752C(void) {
func_EBFBE0_80197A3C(i, 41, var_fs0); func_EBFBE0_80197A3C(i, 41, var_fs0);
func_EBFBE0_80197D30(i, 75, var_fs0 - 25.0f); func_EBFBE0_80197D30(i, 75, var_fs0 - 25.0f);
func_EBFBE0_80197DE4(i, 130, (var_fs0 - 26.0f)); func_EBFBE0_80197DE4(i, 130, (var_fs0 - 26.0f));
func_EBFBE0_801AD7EC(210, (var_fs0 - 24.0f), D_80178870.save[0].save_00.unk_40[i]); func_EBFBE0_801AD7EC(210, (var_fs0 - 24.0f), gSaveFile.save.data.unk_40[i]);
func_EBFBE0_80197F74(i, 258, var_fs0 - 25.0f); func_EBFBE0_80197F74(i, 258, var_fs0 - 25.0f);
} }
func_EBFBE0_80198164(i, var_fs0, var_fs1); func_EBFBE0_80198164(i, var_fs0, var_fs1);
@ -1200,7 +1200,7 @@ void func_EBFBE0_8019752C(void) {
func_EBFBE0_8019BDF0(); func_EBFBE0_8019BDF0();
func_EBFBE0_80197914(); func_EBFBE0_80197914();
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
func_800B8DD0(&gMasterDisp, 0x4C); func_800B8DD0(&gMasterDisp, 0x4C);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 255, 255);
@ -1244,12 +1244,12 @@ void func_EBFBE0_80197914(void) {
func_800B8DD0(&gMasterDisp, 0); func_800B8DD0(&gMasterDisp, 0);
for (i = 0, vec1 = &D_EBFBE0_801AF100, vec2 = &D_EBFBE0_801AF118; i < 2; i++, vec1++, vec2++) { for (i = 0, vec1 = &D_EBFBE0_801AF100, vec2 = &D_EBFBE0_801AF118; i < 2; i++, vec1++, vec2++) {
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, vec1->x, vec1->y, -500.0f, 1); Matrix_Translate(gGfxMatrix, vec1->x, vec1->y, -500.0f, 1);
Matrix_Scale(D_8013B3C0, vec2->x, vec2->y, 1.0f, 1); Matrix_Scale(gGfxMatrix, vec2->x, vec2->y, 1.0f, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_EBFBE0_801AEF30); gSPDisplayList(gMasterDisp++, D_EBFBE0_801AEF30);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
} }
@ -1295,9 +1295,9 @@ void func_EBFBE0_80197D30(s32 arg0, s32 arg1, s32 arg2) {
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
temp[0] = D_80178870.save[0].save_00.unk_18[arg0][0] & 0xFF; temp[0] = gSaveFile.save.data.unk_18[arg0][0] & 0xFF;
temp[1] = D_80178870.save[0].save_00.unk_18[arg0][1] & 0xFF; temp[1] = gSaveFile.save.data.unk_18[arg0][1] & 0xFF;
temp[2] = D_80178870.save[0].save_00.unk_18[arg0][2] & 0xFF; temp[2] = gSaveFile.save.data.unk_18[arg0][2] & 0xFF;
temp[3] = 0; temp[3] = 0;
func_800A0094(arg1, arg2, 1.0f, 1.0f, temp); func_800A0094(arg1, arg2, 1.0f, 1.0f, temp);
@ -1331,7 +1331,7 @@ void func_EBFBE0_80197F74(s32 arg0, s32 arg1, s32 arg2) {
void func_EBFBE0_80198164(s32 arg0, f32 arg1, f32 arg2) { void func_EBFBE0_80198164(s32 arg0, f32 arg1, f32 arg2) {
f32 temp = 16.0f; f32 temp = 16.0f;
s32 temp_s2 = D_80178870.save[0].save_00.unk_36[arg0]; s32 temp_s2 = gSaveFile.save.data.unk_36[arg0];
f32 var_fs2; f32 var_fs2;
s32 i; s32 i;
@ -1364,8 +1364,8 @@ void func_EBFBE0_801982B0(s32 arg0, s32 arg1, f32 arg2, f32 arg3, s32 arg4) {
g = 255; g = 255;
r = 255; r = 255;
if (arg1 < (arg4 - 1)) { if (arg1 < (arg4 - 1)) {
temp1 = D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_8 & 15; temp1 = gSaveFile.save.data.unk_5E[arg0][arg1].unk_8 & 15;
temp2 = D_80178870.save[0].save_00.unk_5E[arg0][arg1 + 1].unk_8 & 15; temp2 = gSaveFile.save.data.unk_5E[arg0][arg1 + 1].unk_8 & 15;
temp_v0 = func_EBFBE0_80199284(temp1, temp2); temp_v0 = func_EBFBE0_80199284(temp1, temp2);
@ -1406,8 +1406,8 @@ void func_EBFBE0_801984D0(s32 arg0, s32 arg1, f32 arg2, f32 arg3) {
if ((arg3 > 22.0f) && (arg3 < 162.0f)) { if ((arg3 > 22.0f) && (arg3 < 162.0f)) {
func_800B8DD0(&gMasterDisp, 0x53); func_800B8DD0(&gMasterDisp, 0x53);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
sp1C = (D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_C & 1) << 8; sp1C = (gSaveFile.save.data.unk_5E[arg0][arg1].unk_C & 1) << 8;
sp1C |= D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_0; sp1C |= gSaveFile.save.data.unk_5E[arg0][arg1].unk_0;
func_8009FEA0(arg2 + 15.0f - (func_8008BCBC(sp1C) - 1) * 8, arg3 + 24.0f + 1.0f, sp1C); func_8009FEA0(arg2 + 15.0f - (func_8008BCBC(sp1C) - 1) * 8, arg3 + 24.0f + 1.0f, sp1C);
} }
} }
@ -1420,9 +1420,9 @@ void func_EBFBE0_80198608(s32 arg0, s32 arg1, f32 arg2, f32 arg3) {
if ((arg3 > 12.0f) && (arg3 < 154.0f)) { if ((arg3 > 12.0f) && (arg3 < 154.0f)) {
func_800B8DD0(&gMasterDisp, 0x53); func_800B8DD0(&gMasterDisp, 0x53);
sp90[0] = D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_D & 1; sp90[0] = gSaveFile.save.data.unk_5E[arg0][arg1].unk_D & 1;
sp90[1] = D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_F & 1; sp90[1] = gSaveFile.save.data.unk_5E[arg0][arg1].unk_F & 1;
sp90[2] = D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_E & 1; sp90[2] = gSaveFile.save.data.unk_5E[arg0][arg1].unk_E & 1;
for (var_fs1 = 0.0f, i = 0; i < 3; i++, var_fs1 += 9.0f) { for (var_fs1 = 0.0f, i = 0; i < 3; i++, var_fs1 += 9.0f) {
if (sp90[i] == 0) { if (sp90[i] == 0) {
@ -1440,7 +1440,7 @@ void func_EBFBE0_8019882C(s32 arg0, s32 arg1, f32 arg2, f32 arg3) {
f32 temp2; f32 temp2;
if (arg3 > 58.0f && arg3 < 197.0f) { if (arg3 > 58.0f && arg3 < 197.0f) {
temp = D_80178870.save[0].save_00.unk_5E[arg0][arg1].unk_8 & 0x0f; temp = gSaveFile.save.data.unk_5E[arg0][arg1].unk_8 & 0x0f;
sp20 = D_EBFBE0_801AEEAC[temp]; sp20 = D_EBFBE0_801AEEAC[temp];
func_800B8DD0(&gMasterDisp, 0x53); func_800B8DD0(&gMasterDisp, 0x53);
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255); gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
@ -1453,12 +1453,12 @@ void func_EBFBE0_8019882C(s32 arg0, s32 arg1, f32 arg2, f32 arg3) {
void func_EBFBE0_80199198(f32 arg0, f32 arg1, f32 arg2) { void func_EBFBE0_80199198(f32 arg0, f32 arg1, f32 arg2) {
func_800B8DD0(&gMasterDisp, 0x35); func_800B8DD0(&gMasterDisp, 0x35);
Matrix_Push(&D_8013B3C0); Matrix_Push(&gGfxMatrix);
Matrix_Translate(D_8013B3C0, arg0 - D_EBFBE0_801AF140, arg1 + D_EBFBE0_801AF144, arg2, 1); Matrix_Translate(gGfxMatrix, arg0 - D_EBFBE0_801AF140, arg1 + D_EBFBE0_801AF144, arg2, 1);
Matrix_Scale(D_8013B3C0, D_EBFBE0_801AF13C, D_EBFBE0_801AF13C, D_EBFBE0_801AF13C, 1); Matrix_Scale(gGfxMatrix, D_EBFBE0_801AF13C, D_EBFBE0_801AF13C, D_EBFBE0_801AF13C, 1);
Matrix_SetGfxMtx(&gMasterDisp); Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, D_601D1F0); gSPDisplayList(gMasterDisp++, D_601D1F0);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
} }
s32 func_EBFBE0_80199284(s32 arg0, s32 arg1) { s32 func_EBFBE0_80199284(s32 arg0, s32 arg1) {
@ -1499,7 +1499,7 @@ void func_EBFBE0_8019978C(void) {
func_EBFBE0_80199EA8(); func_EBFBE0_80199EA8();
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (D_800DD8B0[i] == 1) { if (gControllerStatus[i] == 1) {
func_EBFBE0_80199820(i); func_EBFBE0_80199820(i);
} }
} }
@ -1675,15 +1675,15 @@ void func_EBFBE0_8019CBC0(void) {
D_EBFBE0_801B911C = 0.0f; D_EBFBE0_801B911C = 0.0f;
D_EBFBE0_801B9120 = 70.0f; D_EBFBE0_801B9120 = 70.0f;
temp = D_80178870.save[0].save_00.unk_EA & 0xFF; temp = gSaveFile.save.data.unk_EA & 0xFF;
if (temp < 10) { if (temp < 10) {
D_EBFBE0_801B9098 = 3; D_EBFBE0_801B9098 = 3;
D_EBFBE0_801B9138 = 1; D_EBFBE0_801B9138 = 1;
D_EBFBE0_801B9150[0][0] = D_80178870.save[0].save_00.unk_18[temp][0] & 0xFF; D_EBFBE0_801B9150[0][0] = gSaveFile.save.data.unk_18[temp][0] & 0xFF;
D_EBFBE0_801B9150[1][0] = D_80178870.save[0].save_00.unk_18[temp][1] & 0xFF; D_EBFBE0_801B9150[1][0] = gSaveFile.save.data.unk_18[temp][1] & 0xFF;
D_EBFBE0_801B9150[2][0] = D_80178870.save[0].save_00.unk_18[temp][2] & 0xFF; D_EBFBE0_801B9150[2][0] = gSaveFile.save.data.unk_18[temp][2] & 0xFF;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
D_EBFBE0_801B90A0[i] = func_EBFBE0_8019DCE8(D_EBFBE0_801B9150[i][0]); D_EBFBE0_801B90A0[i] = func_EBFBE0_8019DCE8(D_EBFBE0_801B9150[i][0]);
@ -1764,7 +1764,7 @@ void func_EBFBE0_8019DD44(void) {
void func_EBFBE0_8019DE74(void) { void func_EBFBE0_8019DE74(void) {
func_EBFBE0_8019715C(); func_EBFBE0_8019715C();
if (D_800DD898[D_80177AF8].button & 0xD00E) { // START, A, B, C-UP, C-LEFT, C-DOWN if (gChangedInput[D_80177AF8].button & 0xD00E) { // START, A, B, C-UP, C-LEFT, C-DOWN
func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x49000003, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_80177898 = 0; D_80177898 = 0;
@ -1787,7 +1787,7 @@ void func_EBFBE0_8019DF64(void) {
func_EBFBE0_8019752C(); func_EBFBE0_8019752C();
func_EBFBE0_8019BDF0(); func_EBFBE0_8019BDF0();
func_EBFBE0_8019BAB8(D_EBFBE0_801AE638[3].unk_38); func_EBFBE0_8019BAB8(D_EBFBE0_801AE638[3].unk_38);
Matrix_Pop(&D_8013B3C0); Matrix_Pop(&gGfxMatrix);
func_EBFBE0_8019C120(D_EBFBE0_801AE638[3].unk_00); func_EBFBE0_8019C120(D_EBFBE0_801AE638[3].unk_00);
} }
@ -1819,7 +1819,7 @@ void func_EBFBE0_8019E030(void) {
break; break;
case 2: case 2:
if ((D_EBFBE0_801B9178 == 0) && (D_800DD898[D_80177AF8].button & 0xD00E)) { if ((D_EBFBE0_801B9178 == 0) && (gChangedInput[D_80177AF8].button & 0xD00E)) {
func_80019218(0x19031083, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C); func_80019218(0x19031083, &D_800C5D28, 4, &D_800C5D34, &D_800C5D34, &D_800C5D3C);
D_EBFBE0_801B9090 = 1; D_EBFBE0_801B9090 = 1;
D_EBFBE0_801B9178 = 60; D_EBFBE0_801B9178 = 60;

View File

@ -19,6 +19,8 @@ options:
symbol_addrs_path: symbol_addrs_path:
- linker_scripts/us/symbol_addrs.txt - linker_scripts/us/symbol_addrs.txt
- linker_scripts/us/symbol_addrs_libultra.txt - linker_scripts/us/symbol_addrs_libultra.txt
- linker_scripts/us/symbol_addrs_nlib_funcs.txt
- linker_scripts/us/symbol_addrs_nlib_vars.txt
- linker_scripts/us/symbol_addrs_assets.txt - linker_scripts/us/symbol_addrs_assets.txt
- linker_scripts/us/symbol_addrs_overlays.txt - linker_scripts/us/symbol_addrs_overlays.txt
- linker_scripts/us/symbol_addrs_EBFBE0.txt - linker_scripts/us/symbol_addrs_EBFBE0.txt

View File

@ -11,17 +11,16 @@
- [0x02010, textbin, f3dex] - [0x02010, textbin, f3dex]
# Nintendo libraries # Nintendo libraries
- [0x03440, c, 3440] - [0x03440, c, joybus]
- [0x03A80, c, 3A80] - [0x03A80, c, lib]
- [0x03FE0, c, 3FE0] - [0x041D0, c, lights]
- [0x041D0, c, 41D0] - [0x04650, c, main]
- [0x04650, c, 4650]
- [0x05A20, c, math] - [0x05A20, c, math]
- [0x06280, c, matrix] - [0x06280, c, matrix]
- [0x07B20, c, 7B20] - [0x07B20, c, memory]
- [0x07B60, c, 7B60] - [0x07B60, c, timer]
- [0x07D30, c, 7D30] - [0x07D30, c, save]
- [0x07FC0, c, 7FC0] - [0x07FC0, c, fault]
# Audio block # Audio block
- [0x08CC0, c, 8CC0] - [0x08CC0, c, 8CC0]
- [0x0C870, c, C870] - [0x0C870, c, C870]
@ -188,7 +187,7 @@
- [0xBB360, c, sf_BB360] - [0xBB360, c, sf_BB360]
- [0xBD360, c, sf_versus] - [0xBD360, c, sf_versus]
- [0xC3430, c, sf_C3430] - [0xC3430, c, sf_C3430]
- [0xC3BB0, c, sf_C3BB0] - [0xC3BB0, c, fox_save]
# DATA - Microcode # DATA - Microcode
- [0xC3EE0, data, aspmain] - [0xC3EE0, data, aspmain]
@ -196,10 +195,10 @@
- [0xC49D0, data, f3dex] - [0xC49D0, data, f3dex]
# DATA - Nintendo Libraries # DATA - Nintendo Libraries
- [0xC51D0, .data, 4650] - [0xC51D0, .data, main]
- [0xC51E0, .data, math] - [0xC51E0, .data, math]
- [0xC5220, .data, matrix] - [0xC5220, .data, matrix]
- [0xC52F0, data, 7FC0] - [0xC52F0, .data, fault]
- [0xC54D0, data, audio] - [0xC54D0, data, audio]
- [0xC8880, data, sprintf] - [0xC8880, data, sprintf]
@ -226,8 +225,8 @@
# RODATA - Nintendo Libraries # RODATA - Nintendo Libraries
- [0xC8CC0, .rodata, math] - [0xC8CC0, .rodata, math]
- [0xC8D10, .rodata, matrix] - [0xC8D10, .rodata, matrix]
- [0xC8D20, .rodata, 7D30] - [0xC8D20, .rodata, save]
- [0xC8E40, .rodata, 7FC0] - [0xC8E40, .rodata, fault]
- [0xC9220, .rodata, 8CC0] - [0xC9220, .rodata, 8CC0]
- [0xC9260, .rodata, C870] - [0xC9260, .rodata, C870]
- [0xC9280, .rodata, F0A0] - [0xC9280, .rodata, F0A0]
@ -248,7 +247,9 @@
- [0xCA180, .rodata, ../libultra/libc/xldtob] - [0xCA180, .rodata, ../libultra/libc/xldtob]
- [0xCA1E0, rodata, ../libultra/os/setintmask] - [0xCA1E0, rodata, ../libultra/os/setintmask]
- [0xCA260, .rodata, ../libultra/rmon/rmonmem] - [0xCA260, .rodata, ../libultra/rmon/rmonmem]
- [0xCA5A0, .rodata, ../libultra/rmon/rmonbrk] - [0xCA3D0, .rodata, ../libultra/rmon/rmonmisc]
- [0xCA400, .rodata, ../libultra/rmon/rmonregs]
- [0xCA480, .rodata, ../libultra/rmon/rmonbrk]
- [0xCA650, rodata, ../libultra/rmon/rmonrcp] - [0xCA650, rodata, ../libultra/rmon/rmonrcp]
# DATA - game engine # DATA - game engine
@ -301,21 +302,21 @@
- [0xD97F0, .rodata, sf_BB360] - [0xD97F0, .rodata, sf_BB360]
- [0xD9E50, .rodata, sf_versus] - [0xD9E50, .rodata, sf_versus]
- [0xD9F60, .rodata, sf_C3430] - [0xD9F60, .rodata, sf_C3430]
- [0xDA030, .rodata, sf_C3BB0] - [0xDA030, .rodata, fox_save]
# Common assets # Common assets
- [0xDA0A0, data, displists] - [0xDA0A0, data, displists]
- [0xDC710, data, audiodata] - [0xDC710, data, audiodata]
# Nintendo Library bss # Nintendo Library bss
- { start: 0xDE480, type: bss, vram: 0x800DD880, name: 3440 } - { start: 0xDE480, type: .bss, vram: 0x800DD880, name: joybus }
- { start: 0xDE480, type: bss, vram: 0x800DDAA0, name: 4650 } - { start: 0xDE480, type: .bss, vram: 0x800DDAA0, name: main }
- { start: 0xDE480, type: bss, vram: 0x8013B3A0, name: math } - { start: 0xDE480, type: .bss, vram: 0x8013B3A0, name: math }
- { start: 0xDE480, type: bss, vram: 0x8013B3C0, name: matrix } - { start: 0xDE480, type: .bss, vram: 0x8013B3C0, name: matrix }
- { start: 0xDE480, type: bss, vram: 0x8013C3D0, name: 7B20 } - { start: 0xDE480, type: .bss, vram: 0x8013C3D0, name: memory }
- { start: 0xDE480, type: bss, vram: 0x80144BE0, name: 7B60 } - { start: 0xDE480, type: .bss, vram: 0x80144BE0, name: timer }
- { start: 0xDE480, type: bss, vram: 0x80144F60, name: 7D30 } - { start: 0xDE480, type: .bss, vram: 0x80144F60, name: save }
- { start: 0xDE480, type: bss, vram: 0x80145360, name: 7FC0 } - { start: 0xDE480, type: .bss, vram: 0x80145360, name: fault }
- { start: 0xDE480, type: bss, vram: 0x80145D40, name: audio } - { start: 0xDE480, type: bss, vram: 0x80145D40, name: audio }
@ -347,3 +348,4 @@
# Game engine bss # Game engine bss
- { start: 0xDE480, type: bss, vram: 0x8015F900, name: engine } - { start: 0xDE480, type: bss, vram: 0x8015F900, name: engine }
- { start: 0xDE480, type: .bss, vram: 0x80178870, name: fox_save }