Generate all major headers from ghidra project

This commit is contained in:
rozlette 2019-12-07 18:21:34 -06:00
parent 86ab9c2067
commit 60eaf159b4
19 changed files with 17066 additions and 19482 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
#ifndef _PRE_BOOT_VARIABLES_H_
#define _PRE_BOOT_VARIABLES_H_
#include <PR/ultratypes.h>
extern UNK_TYPE osTvType; // D_80000300
extern UNK_TYPE osRomType; // D_80000304
extern UNK_TYPE osRomBase; // D_80000308
extern UNK_TYPE osResetType; // D_8000030C
extern UNK_TYPE osCicId; // D_80000310
extern UNK_TYPE osVersion; // D_80000314
extern UNK_TYPE osMemSize; // D_80000318
extern UNK_TYPE D_8000031C; // D_8000031C
extern UNK_TYPE D_80000500; // D_80000500
extern UNK_TYPE D_80025D00; // D_80025D00
#endif

View File

@ -113,7 +113,7 @@ typedef struct {
/* 0xC */ u32 romEnd;
} DmadataEntry;
enum EffectSSType {
typedef enum EffectSSType {
EFFECT_SS2_TYPE_DUST = 0x0,
EFFECT_SS2_TYPE_SPARKLE = 0x1,
EFFECT_SS2_TYPE_DELETED_2 = 0x2,
@ -154,7 +154,7 @@ enum EffectSSType {
EFFECT_SS2_TYPE_ICE_BLOCK = 0x25,
EFFECT_SS2_TYPE_SBN = 0x26,
EFFECT_SS2_TYPE_LAST_LABEL = 0x27
};
} EffectSSType;
typedef struct {
/* 0x0 */ s16 x;
@ -266,13 +266,13 @@ typedef struct {
/* 0x2EC */ UNK_TYPE1 pad2EC[4];
} GraphicsContext;
enum IRQ_MSG_TYPE {
typedef enum IRQ_MSG_TYPE {
IRQ_VERTICAL_RETRACE_MSG = 0x1,
IRQ_PRENMI_2_MSG = 0x3,
IRQ_PRENMI_1_MSG = 0x4
};
} IRQ_MSG_TYPE;
enum IRQ_TYPE {
typedef enum IRQ_TYPE {
IRQ_VERTICAL_RETRACE = 0x29A,
IRQ_SP = 0x29B,
IRQ_DP = 0x29C,
@ -280,7 +280,7 @@ enum IRQ_TYPE {
IRQ_PRENMI_2 = 0x29F,
IRQ_PRENMI_3 = 0x2A0,
IRQ_PRENMI_4 = 0x2A1
};
} IRQ_TYPE;
typedef struct {
/* 0x0 */ u16 buttons;
@ -426,11 +426,11 @@ typedef struct {
/* 0x0A7E */ UNK_TYPE1 padA7E[2902];
} StaticContext;
enum THREAD_STACK_STATUS {
typedef enum ThreadStackStatus {
THREAD_STACK_STATUS_GOOD = 0x0,
THREAD_STACK_STATUS_WARNING = 0x1,
THREAD_STACK_STATUS_FULL = 0x2
};
} ThreadStackStatus;
typedef struct {
/* 0x0 */ s8 unk0;
@ -500,6 +500,8 @@ typedef struct {
/* 0xC */ unsigned int inst4;
} __osExceptionVector;
typedef void(*actor_init_var_func)(u8*, ActorInitVar*);
typedef unsigned long(*func)(void);
typedef void(*func_ptr)(void);
@ -1229,8 +1231,8 @@ typedef struct ThreadInfo ThreadInfo;
struct ThreadInfo {
/* 0x00 */ ThreadInfo* next;
/* 0x04 */ ThreadInfo* prev;
/* 0x08 */ s32* stackBegin;
/* 0x0C */ s32* stackEnd;
/* 0x08 */ u8* stackBegin;
/* 0x0C */ u8* stackEnd;
/* 0x10 */ s32 initStackValue;
/* 0x14 */ s32 stackWarningThreshold;
/* 0x18 */ s8* name;
@ -1316,11 +1318,9 @@ struct ColTriGroup {
typedef void(*actor_func)(Actor* this, GlobalContext* ctxt);
typedef void(*actor_init_var_func)(u8*, ActorInitVar*);
struct Actor {
/* 0x000 */ s16 id;
/* 0x002 */ UNK_TYPE1 type;
/* 0x002 */ u8 type;
/* 0x003 */ s8 room;
/* 0x004 */ UNK_TYPE4 flags; // bit 22: disable positional lights if bit 28 is not set; bit 28: enable positional lights on actor
/* 0x008 */ Vector3f initPos;

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#include <ultra64.h>
#include <global.h>
UNK_TYPE func_8008D350(void) {
u32 func_8008D350(void) {
u32* spC;
u32 sp8;
u32 sp4;

View File

@ -12,7 +12,7 @@ void func_80081830(void) {
}
void func_8008189C(void) {
func_800819F0(&D_8009BE38, (void(*)(UNK_TYPE, UNK_TYPE))func_80081830, 0, 0);
func_800819F0(&D_8009BE38, (u32)(void(*)(UNK_TYPE, UNK_TYPE))func_80081830, 0, 0);
}
void func_800818D0(void) {

View File

@ -2,13 +2,13 @@
#include <global.h>
UNK_RET start(void) {
thread_info_init(&bootThreadInfo, &bootStack, &irqmgrContext, 0, -1, &bootThreadName);
thread_info_init(&bootThreadInfo, bootStack, &bootStack[1024], 0, -1, bootThreadName);
osMemSize = func_8008D350();
func_800818F4();
osInitialize();
osUnmapTLBAll();
D_80096B40 = func_80092920();
thread_info_init(&idleTreadInfo, &idleStack, &idleStack[1024], 0, 256, &idleThreadName);
osCreateThread(&idleOSThread, 1, (void(*)(void*))Idle_ThreadEntry, 0, &idleTreadInfo, 12);
thread_info_init(&idleTreadInfo, idleStack, &idleStack[1024], 0, 256, idleThreadName);
osCreateThread(&idleOSThread, 1, (osCreateThread_func*)Idle_ThreadEntry, 0, &idleTreadInfo, 12);
osStartThread(&idleOSThread);
}

View File

@ -1,7 +1,7 @@
#include <ultra64.h>
#include <global.h>
s32 Dmamgr_DoDmaTransfer(void* a0, void* a1, s32 a2) {
s32 Dmamgr_DoDmaTransfer(u32 a0, void* a1, u32 a2) {
u32 spPad;
OSIoMesg sp60;
OSMesgQueue sp48;
@ -24,7 +24,7 @@ s32 Dmamgr_DoDmaTransfer(void* a0, void* a1, s32 a2) {
osRecvMesg(&sp48, NULL, 1);
a2 -= s0;
a0 = (u8*)a0 + s0;
a0 = a0 + s0;
a1 = (u8*)a1 + s0;
}
}
@ -61,7 +61,7 @@ DmadataEntry* Dmamgr_FindDmaEntry(u32 a0) {
return NULL;
}
s32 Dmamgr_TranslateVromToRom(u32 a0) {
u32 Dmamgr_TranslateVromToRom(u32 a0) {
DmadataEntry* v0 = Dmamgr_FindDmaEntry(a0);
if (v0 != NULL) {
@ -199,7 +199,7 @@ GLOBAL_ASM("./asm/nonmatching/z_std_dma/Dmamgr_SendRequest.asm")
#endif
s32 Dmamgr_SendRequestAndWait(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) {
s32 Dmamgr_SendRequestAndWait(u32 a0, u32 a1, u32 a2) {
DmaRequest sp48;
OSMesgQueue sp30;
OSMesg sp2C;
@ -207,7 +207,7 @@ s32 Dmamgr_SendRequestAndWait(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) {
osCreateMesgQueue(&sp30, &sp2C, 1);
ret = Dmamgr_SendRequest(&sp48, (UNK_FUN_ARG)a0, a1, a2, 0, &sp30, 0);
ret = Dmamgr_SendRequest(&sp48, a0, a1, a2, 0, &sp30, 0);
if (ret == -1) {
return ret;

View File

@ -5,7 +5,7 @@
// This file is most likely En_A_Obj
UNK_RET EnAObj_Init(void* a0, UNK_TYPE a1) {
UNK_RET EnAObj_Init(ActorEnAObj* a0, GlobalContext* a1) {
ActorEnAObj* s0 = (ActorEnAObj*)a0;
s0->base.textId = ((s0->base.variable >> 8) & 0xFF) | 0x300;
s0->base.variable = (s0->base.variable & 0xFF) - 9;
@ -22,32 +22,32 @@ UNK_RET EnAObj_Fini(ActorEnAObj* a0, GlobalContext* a1) {
Collision_FiniCylinder(a1, a2);
}
UNK_RET EnAObj_Update1(ActorEnAObj* a0, UNK_TYPE a1) {
UNK_RET EnAObj_Update1(ActorEnAObj* a0, GlobalContext* a1) {
s16 v0;
s32 v1;
if (func_800B84D0(a0, a1) != 0) {
if (func_800B84D0((Actor*)a0, a1) != 0) {
a0->update = (actor_func)EnAObj_Update2;
} else {
v0 = a0->base.unk92 - a0->base.unkBC.rotation.y;
v1 = (v0 < 0)? -v0 : v0;
if ((v1 < 10240) || ((a0->base.variable == 1) && (v1 > 22528))) {
func_800B863C(a0, a1);
func_800B863C((Actor*)a0, a1);
}
}
}
UNK_RET EnAObj_Update2(ActorEnAObj* a0) {
if (func_800B867C(a0) != 0) {
UNK_RET EnAObj_Update2(ActorEnAObj* a0, GlobalContext* a1) {
if (func_800B867C((Actor*)a0, a1) != 0) {
a0->update = (actor_func)EnAObj_Update1;
}
}
UNK_RET EnAObj_Main(ActorEnAObj* a0, UNK_TYPE a1) {
UNK_RET EnAObj_Main(ActorEnAObj* a0, GlobalContext* a1) {
(a0->update)((Actor*)a0, (GlobalContext*)a1);
func_800B675C(a0, 0x42340000);
Collision_AddOT(a1, a1 + 0x18884, &a0->collision);
func_800B675C((Actor*)a0, 45.0f);
Collision_AddOT(a1, &a1->collisionContext, (ColCommon*)&a0->collision);
}
UNK_RET EnAObj_Draw(ActorEnAObj* a0, UNK_TYPE a1) {
func_800BDFC0(a1, D_801ADEB0[a0->base.variable], a1, a0);
UNK_RET EnAObj_Draw(ActorEnAObj* a0, GlobalContext* a1) {
func_800BDFC0(a1, D_801ADEB0[a0->base.variable]);
}

View File

@ -7,13 +7,13 @@ UNK_RET func_800BF9A0(UNK_TYPE a0, UNK_TYPE a1) {
UNK_TYPE v1;
func_8008439C(-2, 0);
func_800847CC(&D_801DCBB0, D_801B4610);
func_800847CC(&D_801DCBC4);
func_800847CC(D_801DCBB0, D_801B4610);
func_800847CC(D_801DCBC4);
for (i = 0, s0 = &actorOverlayTable[0]; i < D_801B4610; i++, s0++) {
v1 = s0->vramEnd - s0->vramStart;
if (s0->ramAddr == 0) continue;
func_800847CC(&D_801DCBE4, i, s0->ramAddr, s0->ramAddr + v1, s0->clients, &D_801DCBFC);
func_800847CC(D_801DCBE4, i, s0->ramAddr, s0->ramAddr + v1, s0->clients, &D_801DCBFC);
}
}
@ -41,8 +41,8 @@ UNK_TYPE func_800BFA78(UNK_TYPE a0, UNK_TYPE a1) {
UNK_RET func_800BFAE8(UNK_ARGS) {
D_801B4610 = 690;
func_800819F0(&D_801ED930, func_800BF9A0, 0, 0);
func_80081BCC(&D_801ED940, func_800BFA78, 0);
func_800819F0(&D_801ED930, (u32)func_800BF9A0, 0, 0);
func_80081BCC(&D_801ED940, (u32)func_800BFA78, 0);
}
UNK_RET func_800BFB40(UNK_ARGS) {

View File

@ -259,7 +259,7 @@ GLOBAL_ASM("./asm/nonmatching/z_actor/func_800B8898.asm")
GLOBAL_ASM("./asm/nonmatching/z_actor/func_800B8934.asm")
UNK_TYPE Actor_HasParent(Actor* actor, GlobalContext* ctxt) {
u32 Actor_HasParent(Actor* actor, GlobalContext* ctxt) {
if (actor->parent != NULL) {
return 1;
} else {

View File

@ -279,7 +279,7 @@ GLOBAL_ASM("./asm/nonmatching/z_effect_soft_sprite/EffectSS_DrawParticle.asm")
#endif
void EffectSS_DrawAllParticles(GlobalContext* ctxt) {
UNK_TYPE s0;
LightMapper* s0;
s32 i;
s0 = Lights_CreateMapper(&ctxt->lightsContext, ctxt->commonVars.graphicsContext);

View File

@ -61,11 +61,11 @@ s32 Lib_StepTowardsGet_i(s32 a0, s32 a1, s32 a2) {
return a1;
}
UNK_RET Lib_StepTowards_i(u32* a0, u32 a1, u32 a2) {
void Lib_StepTowards_i(s32* a0, s32 a1, s32 a2) {
*a0 = Lib_StepTowardsGet_i(*a0, a1, a2);
}
UNK_TYPE Lib_StepTowardsCheck_i(u32* a0, u32 a1, u32 a2) {
UNK_TYPE Lib_StepTowardsCheck_i(s32* a0, s32 a1, s32 a2) {
Lib_StepTowards_i(a0, a1, a2);
return a1 == *a0;
@ -524,7 +524,7 @@ f32 func_800FFCD8(f32* a0, f32 a1, f32 a2, f32 a3, f32 a4) {
return fabsf(a1 - *a0);
}
UNK_RET Lib_ScaleMax_f(f32* a0, f32 a1, f32 a2, f32 a3) {
void Lib_ScaleMax_f(f32* a0, f32 a1, f32 a2, f32 a3) {
f32 f2;
if (*a0 != a1) {
@ -581,11 +581,11 @@ void Lib_ScaleMax_s(s16* a0, s16 a1, s16 a2, s16 a3) {
*a0 += v0;
}
UNK_RET Lib_CopyColor(u8* a0, u8* a1) {
a0[0] = a1[0];
a0[1] = a1[1];
a0[2] = a1[2];
a0[3] = a1[3];
UNK_RET Lib_CopyColor(Color* a0, Color* a1) {
a0->red = a1->red;
a0->green = a1->green;
a0->blue = a1->blue;
a0->alpha = a1->alpha;
}
UNK_RET func_801000A4(u16 a0) {
@ -613,11 +613,11 @@ void Lib_TranslateAndRotateYVec3f(Vector3f* a0, s16 a1, Vector3f* a2, Vector3f*
#ifdef NONMATCHING
void Lib_LerpRGB(u8* a0, u8* a1, f32 a2, u8* a3) {
void Lib_LerpRGB(RGB* a0, RGB* a1, f32 a2, RGB* a3) {
// XXX regalloc is slightly off
a3[0] = (f32)a0[0] + ((f32)a1[0] - (f32)a0[0]) * a2;
a3[1] = (f32)a0[1] + ((f32)a1[1] - (f32)a0[1]) * a2;
a3[2] = (f32)a0[2] + ((f32)a1[2] - (f32)a0[2]) * a2;
a3->red = (f32)a0->red + ((f32)a1->red - (f32)a0->red) * a2;
a3->green = (f32)a0->green + ((f32)a1->green - (f32)a0->green) * a2;
a3->blue = (f32)a0->blue + ((f32)a1->blue - (f32)a0->blue) * a2;
}
#else
@ -649,11 +649,11 @@ f32 Lib_PushAwayVec3f(Vector3f* a0, Vector3f* a1, f32 a2) {
void Lib_Nop801004FC(void) {}
UNK_TYPE Lib_PtrSegToPhys(u32 a0) {
u32 Lib_PtrSegToPhys(u32 a0) {
return(rspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
}
UNK_TYPE Lib_PtrSegToPhysNull(u32 a0) {
u32 Lib_PtrSegToPhysNull(u32 a0) {
if ((a0 >> 28) == 0) {
return a0;
}
@ -661,7 +661,7 @@ UNK_TYPE Lib_PtrSegToPhysNull(u32 a0) {
return(rspSegmentPhysAddrs[(a0 << 4) >> 28] + (a0 & 0xFFFFFF)) + 0x80000000;
}
UNK_TYPE Lib_PtrSegToK0(UNK_TYPE a0) {
u32 Lib_PtrSegToK0(u32 a0) {
if (a0 == 0) {
return 0;
} else {
@ -669,7 +669,7 @@ UNK_TYPE Lib_PtrSegToK0(UNK_TYPE a0) {
}
}
UNK_TYPE Lib_PtrSegToK0Null(UNK_TYPE a0) {
u32 Lib_PtrSegToK0Null(u32 a0) {
if (a0 == 0) {
return 0;
} else {

View File

@ -1,10 +1,10 @@
#include <PR/ultratypes.h>
#include <osint.h>
void osCreateThread(OSThread* t, OSId id, void(*entry)(void*), void* arg, void* sp, OSPri p) {
void osCreateThread(OSThread* t, OSId id, osCreateThread_func* entry, void* arg, void* sp, OSPri p) {
register u32 saveMask;
OSIntMask mask;
t->id = id;
t->priority = p;
t->next = NULL;
@ -13,7 +13,7 @@ void osCreateThread(OSThread* t, OSId id, void(*entry)(void*), void* arg, void*
t->context.a0 = (u64)arg;
t->context.sp = (u64)sp - 16;
t->context.ra = (u64)__osCleanupThread;
mask = 0x3FFF01;
t->context.sr = 0xFF03;
t->context.rcp = (mask & 0x3F0000) >> 16;
@ -21,7 +21,7 @@ void osCreateThread(OSThread* t, OSId id, void(*entry)(void*), void* arg, void*
t->fp = 0;
t->state = 1;
t->flags = 0;
saveMask = __osDisableInt();
t->tlnext = __osActiveQueue;
__osActiveQueue = t;

View File

@ -25,7 +25,7 @@ void osInitialize(void) {
__osSetSR(__osGetSR() | 0x20000000);
__osSetFpcCsr(0x01000800);
func_80096820(0x04900000);
__osSetWatchLo(0x04900000);
while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0);
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0);

View File

@ -3,33 +3,33 @@
#include <osint.h>
#include <viint.h>
int osStopTimer(OSTimer* t)
s32 osStopTimer(OSTimer* t)
{
register u32 savedMask;
OSTimer* timep;
if (t->next == NULL) {
return -1;
}
savedMask = __osDisableInt();
timep = t->next;
if (timep != __osTimerList) {
timep->value += t->value;
}
t->prev->next = t->next;
t->next->prev = t->prev;
t->next = NULL;
t->prev = NULL;
if (__osTimerList->next == __osTimerList) {
__osSetCompare(0);
}
__osRestoreInt(savedMask);
return 0;
}

View File

@ -480,7 +480,7 @@
0x80096510:("__osSpSetPc","s32","u32 data"),
0x80096540:("func_80096540","UNK_RET","UNK_ARGS"),
0x800967A0:("func_800967A0","UNK_RET","UNK_ARGS"),
0x80096820:("func_80096820","UNK_RET","UNK_TYPE"),
0x80096820:("__osSetWatchLo","UNK_RET","UNK_TYPE"),
0x80096880:("func_80096880","UNK_RET","UNK_ARGS"),
0x800968B0:("func_800968B0","u32","const u8*, const u8*"),
0x80096930:("func_80096930","UNK_RET","UNK_ARGS"),

View File

@ -729,6 +729,7 @@ class Disassembler:
"#include <xstdio.h>\n"
"#include <dmadata.h>\n"
"#include <segment.h>\n"
"#include <pre_boot_variables.h>\n"
"\n"
)