mirror of https://github.com/zeldaret/mm.git
Get boot_0x80080790 somewhat close to matching
This commit is contained in:
parent
5fcbe0a483
commit
00e3a8fcb7
2
Makefile
2
Makefile
|
@ -69,7 +69,7 @@ code.elf: $(S_O_FILES) $(C_O_FILES) codescript.txt undef.txt
|
|||
$(LD) -T codescript.txt -T undef.txt --no-check-sections --accept-unknown-input-arch -o $@
|
||||
|
||||
test.txt: build/src/test.o
|
||||
$(MIPS_BINUTILS)objdump -d -z --adjust-vma=0x80080180 $< > test.txt
|
||||
$(MIPS_BINUTILS)objdump -d -z --adjust-vma=0x80080790 $< > test.txt
|
||||
|
||||
clean:
|
||||
rm $(ROM) $(ELF) code.elf code.bin boot.bin -r build
|
||||
|
|
19
functions.py
19
functions.py
|
@ -9,9 +9,19 @@ known_funcs = {
|
|||
0x8008038C:("func_8008038C","UNK_RET","void"),
|
||||
0x80080514:("func_80080514","void","UNK_TYPE"),
|
||||
0x800805E0:("func_800805E0","UNK_RET","UNK_TYPE"),
|
||||
0x80080C04:("func_80080C04","UNK_RET","UNK_PTR, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR, UNK_TYPE"),
|
||||
0x80080D0C:("func_80080D0C","UNK_RET","void"),
|
||||
0x80080E00:("func_80080E00","UNK_RET","void"),
|
||||
0x80080748:("func_80080748","UNK_RET","void"),
|
||||
0x80080790:("func_80080790","s32","void*, void*, s32"),
|
||||
0x800808D4:("func_800808D4","void","OSPiHandle* pihandle, OSIoMesg* mb, s32 direction"),
|
||||
0x800808F4:("func_800808F4","DmadataEntry*","u32"),
|
||||
0x80080950:("func_80080950","s32","u32"),
|
||||
0x800809BC:("func_800809BC","s32","u32"),
|
||||
0x800809F4:("func_800809F4","UNK_TYPE*","u32"),
|
||||
0x80080A08:("func_80080A08","void","s80080A08*"),
|
||||
0x80080B84:("func_80080B84","void","void*"),
|
||||
0x80080C04:("func_80080C04","s32","s80080A08*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE"),
|
||||
0x80080C90:("func_80080C90","s32","UNK_TYPE, UNK_PTR, UNK_TYPE"),
|
||||
0x80080D0C:("func_80080D0C","void","void"),
|
||||
0x80080E00:("func_80080E00","void","void"),
|
||||
0x80081754:("func_80081754","UNK_RET","UNK_PTR, struct s80085320*, UNK_TYPE, UNK_TYPE"),
|
||||
0x80081820:("func_80081820","void","void"),
|
||||
0x80081828:("func_80081828","void","void"),
|
||||
|
@ -23,6 +33,7 @@ known_funcs = {
|
|||
0x80081AD4:("func_80081AD4","UNK_RET","UNK_PTR"),
|
||||
0x80081BCC:("func_80081BCC","UNK_RET","UNK_PTR, UNK_TYPE(*)(UNK_TYPE, UNK_TYPE), UNK_TYPE"),
|
||||
0x80081CA4:("func_80081CA4","UNK_RET","UNK_PTR"),
|
||||
0x80083E4C:("func_80083E4C","UNK_RET","UNK_TYPE*, UNK_TYPE"),
|
||||
0x8008439C:("func_8008439C","UNK_RET","UNK_TYPE, UNK_TYPE"),
|
||||
0x800847CC:("func_800847CC","UNK_RET","UNK_PTR, ..."), # printf?
|
||||
0x8008481C:("func_8008481C","UNK_RET","UNK_TYPE, UNK_TYPE, UNK_PTR, UNK_PTR"),
|
||||
|
@ -149,7 +160,7 @@ known_funcs = {
|
|||
0x80092100:("func_80092100","UNK_RET","UNK_TYPE"),
|
||||
0x80092260:("coss","short","unsigned short x"),
|
||||
0x80092290:("osSetTime","void","OSTime ticks"),
|
||||
0x80092920:("func_80092920","struct s80092920*","void"),
|
||||
0x80092920:("func_80092920","OSPiHandle*","void"),
|
||||
0x80092C80:("osContSetCh","s32","u8 ch"),
|
||||
0x80092CE0:("__osSetFpcCsr","void","u32 value"),
|
||||
0x80092CF0:("__osGetFpcCsr","u32","void"),
|
||||
|
|
|
@ -17,19 +17,19 @@ UNK_RET func_80080300(UNK_TYPE); // func_80080300
|
|||
UNK_RET func_8008038C(void); // func_8008038C
|
||||
void func_80080514(UNK_TYPE); // func_80080514
|
||||
UNK_RET func_800805E0(UNK_TYPE); // func_800805E0
|
||||
// UNK_RET func_80080748(UNK_ARGS);
|
||||
// UNK_RET func_80080790(UNK_ARGS);
|
||||
// UNK_RET func_800808D4(UNK_ARGS);
|
||||
// UNK_RET func_800808F4(UNK_ARGS);
|
||||
// UNK_RET func_80080950(UNK_ARGS);
|
||||
// UNK_RET func_800809BC(UNK_ARGS);
|
||||
// UNK_RET func_800809F4(UNK_ARGS);
|
||||
// UNK_RET func_80080A08(UNK_ARGS);
|
||||
// UNK_RET func_80080B84(UNK_ARGS);
|
||||
UNK_RET func_80080C04(UNK_PTR, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, UNK_PTR, UNK_TYPE); // func_80080C04
|
||||
// UNK_RET func_80080C90(UNK_ARGS);
|
||||
UNK_RET func_80080D0C(void); // func_80080D0C
|
||||
UNK_RET func_80080E00(void); // func_80080E00
|
||||
UNK_RET func_80080748(void); // func_80080748
|
||||
s32 func_80080790(void*, void*, s32); // func_80080790
|
||||
void func_800808D4(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction); // func_800808D4
|
||||
DmadataEntry* func_800808F4(u32); // func_800808F4
|
||||
s32 func_80080950(u32); // func_80080950
|
||||
s32 func_800809BC(u32); // func_800809BC
|
||||
UNK_TYPE* func_800809F4(u32); // func_800809F4
|
||||
void func_80080A08(s80080A08*); // func_80080A08
|
||||
void func_80080B84(void*); // func_80080B84
|
||||
s32 func_80080C04(s80080A08*, UNK_FUN_ARG, UNK_PTR, UNK_TYPE, UNK_TYPE, OSMesgQueue*, UNK_TYPE); // func_80080C04
|
||||
s32 func_80080C90(UNK_TYPE, UNK_PTR, UNK_TYPE); // func_80080C90
|
||||
void func_80080D0C(void); // func_80080D0C
|
||||
void func_80080E00(void); // func_80080E00
|
||||
// UNK_RET func_80080E30(UNK_ARGS);
|
||||
// UNK_RET func_80080ED0(UNK_ARGS);
|
||||
// UNK_RET func_80080FF0(UNK_ARGS);
|
||||
|
@ -98,7 +98,7 @@ UNK_RET func_80081CA4(UNK_PTR); // func_80081CA4
|
|||
// UNK_RET func_80083BC4(UNK_ARGS);
|
||||
// UNK_RET func_80083CF8(UNK_ARGS);
|
||||
// UNK_RET func_80083DF4(UNK_ARGS);
|
||||
// UNK_RET func_80083E4C(UNK_ARGS);
|
||||
UNK_RET func_80083E4C(UNK_TYPE*, UNK_TYPE); // func_80083E4C
|
||||
// UNK_RET func_80083EB0(UNK_ARGS);
|
||||
// UNK_RET func_80083EC4(UNK_ARGS);
|
||||
// UNK_RET func_80083FE4(UNK_ARGS);
|
||||
|
@ -395,7 +395,7 @@ void osSetTime(OSTime ticks); // func_80092290
|
|||
// UNK_RET func_800925CC(UNK_ARGS);
|
||||
// UNK_RET func_80092680(UNK_ARGS);
|
||||
// UNK_RET func_80092730(UNK_ARGS);
|
||||
struct s80092920* func_80092920(void); // func_80092920
|
||||
OSPiHandle* func_80092920(void); // func_80092920
|
||||
// UNK_RET func_80092A80(UNK_ARGS);
|
||||
// UNK_RET func_80092C00(UNK_ARGS);
|
||||
s32 osContSetCh(u8 ch); // func_80092C80
|
||||
|
|
42
include/os.h
42
include/os.h
|
@ -103,6 +103,48 @@ typedef struct {
|
|||
} OSMesgQueue;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0 */ u32 errStatus;
|
||||
/* 4 */ void* dramAddr;
|
||||
/* 8 */ void* C2Addr;
|
||||
/* 12 */ u32 sectorSize;
|
||||
/* 16 */ u32 C1ErrNum;
|
||||
/* 20 */ u32 C1ErrSector[4];
|
||||
} __OSBlockInfo;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0 */ u32 cmdType;
|
||||
/* 4 */ u16 transferMode;
|
||||
/* 6 */ u16 blockNum;
|
||||
/* 8 */ s32 sectorNum;
|
||||
/* 12 */ u32 devAddr;
|
||||
/* 16 */ u32 bmCtlShadow;
|
||||
/* 20 */ u32 seqCtlShadow;
|
||||
/* 24 */ __OSBlockInfo block[2];
|
||||
} __OSTranxInfo;
|
||||
|
||||
|
||||
typedef struct OSPiHandle_s {
|
||||
/* 0 */ struct OSPiHandle_s* next;
|
||||
/* 4 */ u8 type;
|
||||
/* 5 */ u8 latency;
|
||||
/* 6 */ u8 pageSize;
|
||||
/* 7 */ u8 relDuration;
|
||||
/* 8 */ u8 pulse;
|
||||
/* 9 */ u8 domain;
|
||||
/* 12 */ u32 baseAddress;
|
||||
/* 16 */ u32 speed;
|
||||
/* 20 */ __OSTranxInfo transferInfo;
|
||||
} OSPiHandle;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0 */ u8 type;
|
||||
/* 4 */ u32 address;
|
||||
} OSPiInfo;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* 0 */ u16 type;
|
||||
/* 2 */ u8 pri;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <PR/ultratypes.h>
|
||||
#include <unk.h>
|
||||
#include <os.h>
|
||||
|
||||
struct s80085320 {
|
||||
/* 00 */ struct s80085320* next;
|
||||
|
@ -21,20 +22,6 @@ struct s8008A6FC {
|
|||
/* 12 */ UNK_TYPE unk12;
|
||||
};
|
||||
|
||||
struct s80092920 {
|
||||
/* 00 */ struct s80092920* unk0;
|
||||
/* 04 */ u8 unk4;
|
||||
/* 05 */ u8 unk5;
|
||||
/* 06 */ u8 unk6;
|
||||
/* 07 */ u8 unk7;
|
||||
/* 08 */ u8 unk8;
|
||||
/* 09 */ u8 unk9;
|
||||
/* 10 */ u8 unk10; // pad?
|
||||
/* 11 */ u8 unk11; // pad?
|
||||
/* 12 */ UNK_TYPE unk12;
|
||||
/* 16 */ UNK_TYPE unk16;
|
||||
};
|
||||
|
||||
struct s800A5AC0 {
|
||||
/* 000 */ u8 pad0[28];
|
||||
/* 028 */ s16 unk28;
|
||||
|
@ -93,6 +80,24 @@ typedef struct s800E03A0_s {
|
|||
/* 000 */ u8 pad[32];
|
||||
} s800E03A0;
|
||||
|
||||
// Entries in dmadata
|
||||
typedef struct {
|
||||
/* 000 */ u32 vromStart;
|
||||
/* 004 */ u32 vromEnd;
|
||||
/* 008 */ u32 romStart;
|
||||
/* 012 */ u32 romEnd;
|
||||
} DmadataEntry;
|
||||
|
||||
typedef struct s80080A08_s {
|
||||
/* 000 */ UNK_PTR unk0;
|
||||
/* 004 */ UNK_FUN_PTR(unk4);
|
||||
/* 008 */ UNK_TYPE unk8;
|
||||
/* 012 */ u8 pad1[8];
|
||||
/* 020 */ UNK_TYPE unk20;
|
||||
/* 024 */ OSMesgQueue* unk24;
|
||||
/* 028 */ UNK_TYPE unk28;
|
||||
} s80080A08;
|
||||
|
||||
// This struct is huge! Global context?
|
||||
typedef struct s800F4F54_s {
|
||||
/* 00000 */ u8 pad[92152];
|
||||
|
|
|
@ -323,9 +323,9 @@
|
|||
//extern UNK_TYPE D_00018E60;
|
||||
//extern UNK_TYPE D_00018E64;
|
||||
//extern UNK_TYPE D_00018E68;
|
||||
//extern UNK_TYPE D_0001A500;
|
||||
extern u32 dmadataRomStart; // D_0001A500
|
||||
//extern UNK_TYPE D_00020308;
|
||||
//extern UNK_TYPE D_00020700;
|
||||
extern u32 dmadataRomEnd; // D_00020700
|
||||
//extern UNK_TYPE D_0002446A;
|
||||
//extern UNK_TYPE D_00046AF0;
|
||||
//extern UNK_TYPE D_00080028;
|
||||
|
@ -1876,9 +1876,9 @@ extern u32 D_80096B28; // D_80096B28
|
|||
extern u32 D_80096B2C; // D_80096B2C
|
||||
extern f32 D_80096B30; // D_80096B30
|
||||
extern f32 D_80096B34; // D_80096B34
|
||||
extern struct s80092920* D_80096B40; // D_80096B40
|
||||
extern OSPiHandle* D_80096B40; // D_80096B40
|
||||
extern UNK_TYPE D_80096B50; // D_80096B50
|
||||
//extern UNK_TYPE D_80096B60;
|
||||
extern UNK_TYPE* D_80096B60; // D_80096B60
|
||||
//extern UNK_TYPE D_80096B68;
|
||||
//extern UNK_TYPE D_80096B70;
|
||||
//extern UNK_TYPE D_80096B78;
|
||||
|
@ -1917,7 +1917,7 @@ extern UNK_TYPE D_80097E58; // D_80097E58
|
|||
extern UNK_TYPE __osShutdown; // D_80097E5C
|
||||
extern UNK_TYPE __OSGlobalIntMask; // D_80097E60
|
||||
extern UNK_TYPE __osPiDevMgr; // D_80097E70
|
||||
extern struct s80092920* D_80097E8C; // D_80097E8C
|
||||
extern OSPiHandle* D_80097E8C; // D_80097E8C
|
||||
//extern UNK_TYPE D_80097E90;
|
||||
extern UNK_TYPE __osPiAccessQueueEnabled; // D_80097EA0
|
||||
//extern UNK_TYPE D_80097F00;
|
||||
|
@ -1947,12 +1947,12 @@ extern UNK_TYPE D_80098198; // D_80098198
|
|||
extern UNK_TYPE D_800981A0; // D_800981A0
|
||||
extern UNK_TYPE D_800981A8; // D_800981A8
|
||||
extern float D_800981B0; // D_800981B0
|
||||
//extern UNK_TYPE D_800981C0;
|
||||
//extern UNK_TYPE D_800981C4;
|
||||
//extern UNK_TYPE D_800981D4;
|
||||
//extern UNK_TYPE D_800981E4;
|
||||
//extern UNK_TYPE D_800981F4;
|
||||
//extern UNK_TYPE D_80098204;
|
||||
extern UNK_TYPE D_800981C0; // D_800981C0
|
||||
extern UNK_TYPE D_800981C4; // D_800981C4
|
||||
extern UNK_TYPE D_800981D4; // D_800981D4
|
||||
extern UNK_TYPE D_800981E4; // D_800981E4
|
||||
extern UNK_TYPE D_800981F4; // D_800981F4
|
||||
extern UNK_TYPE D_80098204; // D_80098204
|
||||
//extern UNK_TYPE D_80098210;
|
||||
//extern UNK_TYPE D_80098220;
|
||||
//extern UNK_TYPE D_8009823C;
|
||||
|
@ -2109,12 +2109,13 @@ extern UNK_TYPE D_8009B160; // D_8009B160
|
|||
extern UNK_TYPE D_8009B228; // D_8009B228
|
||||
extern u32* D_8009B240; // D_8009B240
|
||||
extern u8 D_8009B290; // D_8009B290
|
||||
//extern UNK_TYPE D_8009B2BC;
|
||||
//extern UNK_TYPE D_8009B2C0;
|
||||
//extern UNK_TYPE D_8009B2D8;
|
||||
//extern UNK_TYPE D_8009B358;
|
||||
//extern UNK_TYPE D_8009B508;
|
||||
//extern UNK_TYPE D_8009BA08;
|
||||
extern struct s80085320 D_8009B2A0; // D_8009B2A0
|
||||
extern u16 D_8009B2BC; // D_8009B2BC
|
||||
extern OSMesgQueue D_8009B2C0; // D_8009B2C0
|
||||
extern UNK_TYPE D_8009B2D8; // D_8009B2D8
|
||||
extern OSThread D_8009B358; // D_8009B358
|
||||
extern UNK_TYPE D_8009B508; // D_8009B508
|
||||
extern UNK_TYPE D_8009BA08; // D_8009BA08
|
||||
//extern UNK_TYPE D_8009BA10;
|
||||
//extern UNK_TYPE D_8009BE10;
|
||||
//extern UNK_TYPE D_8009BE14;
|
||||
|
@ -2178,7 +2179,7 @@ extern UNK_TYPE __osBaseCounter; // D_8009E5B8
|
|||
extern UNK_TYPE __osViIntrCount; // D_8009E5BC
|
||||
extern UNK_TYPE __osTimerCounter; // D_8009E5C0
|
||||
//extern UNK_TYPE D_8009E5D0;
|
||||
extern struct s80092920 D_8009E610; // D_8009E610
|
||||
extern OSPiHandle D_8009E610; // D_8009E610
|
||||
extern UNK_TYPE D_8009E624; // D_8009E624
|
||||
//extern UNK_TYPE D_8009E690;
|
||||
//extern UNK_TYPE D_8009F840;
|
||||
|
@ -2186,7 +2187,7 @@ extern UNK_TYPE D_8009E624; // D_8009E624
|
|||
//extern UNK_TYPE D_8009F870;
|
||||
//extern UNK_TYPE D_8009F888;
|
||||
//extern UNK_TYPE D_8009F8A0;
|
||||
//extern UNK_TYPE D_8009F8B0;
|
||||
extern DmadataEntry dmadata[]; // D_8009F8B0
|
||||
//extern UNK_TYPE D_800A0004;
|
||||
//extern UNK_TYPE D_80186028;
|
||||
//extern UNK_TYPE D_801AAAB0;
|
||||
|
|
|
@ -43,7 +43,7 @@ UNK_RET func_80080250(void) {
|
|||
sp40 = *v0;
|
||||
*v0 = 0;
|
||||
|
||||
func_80080C04(&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, (UNK_TYPE*)&sp48, 0);
|
||||
func_80080C04(&sp72, (UNK_FUN_ARG)func_800A5AC0, v1, (u32)t7 - (u32)v1, 0, &sp48, 0);
|
||||
func_8008019C();
|
||||
func_800801EC();
|
||||
osRecvMesg(&sp48, 0, 1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
struct s80092920* func_80092920(void) {
|
||||
OSPiHandle* func_80092920(void) {
|
||||
u32 v0;
|
||||
u32 temp;
|
||||
u32 temp2;
|
||||
|
@ -18,10 +18,10 @@ struct s80092920* func_80092920(void) {
|
|||
|
||||
D_800980D0_ = 0;
|
||||
|
||||
D_8009E610.unk4 = 0;
|
||||
D_8009E610.unk12 = 0xB0000000;
|
||||
D_8009E610.unk9 = 0;
|
||||
D_8009E610.unk16 = 0;
|
||||
D_8009E610.type = 0;
|
||||
D_8009E610.baseAddress = 0xB0000000;
|
||||
D_8009E610.domain = 0;
|
||||
D_8009E610.speed = 0;
|
||||
|
||||
func_80089630(&D_8009E624, 96);
|
||||
|
||||
|
@ -37,11 +37,11 @@ struct s80092920* func_80092920(void) {
|
|||
*(vu32*)0xA4600020 = 3;
|
||||
*(vu32*)0xA4600018 = 255;
|
||||
|
||||
v0 = *(u32*)(D_8009E610.unk12 | 0xA0000000);
|
||||
D_8009E610.unk6 = (v0 >> 16) & 0xF;
|
||||
D_8009E610.unk7 = (v0 >> 20) & 0xF;
|
||||
D_8009E610.unk8 = v0 >> 8;
|
||||
D_8009E610.unk5 = v0;
|
||||
v0 = *(u32*)(D_8009E610.baseAddress | 0xA0000000);
|
||||
D_8009E610.pageSize = (v0 >> 16) & 0xF;
|
||||
D_8009E610.relDuration = (v0 >> 20) & 0xF;
|
||||
D_8009E610.pulse = v0 >> 8;
|
||||
D_8009E610.latency = v0;
|
||||
|
||||
*(vu32*)0xA4600014 = temp;
|
||||
*(vu32*)0xA460001C = temp2;
|
||||
|
@ -50,7 +50,7 @@ struct s80092920* func_80092920(void) {
|
|||
|
||||
func_ret = func_80091A60();
|
||||
|
||||
D_8009E610.unk0 = D_80097E8C;
|
||||
D_8009E610.next = D_80097E8C;
|
||||
D_80097E8C = &D_8009E610;
|
||||
|
||||
func_80091AD0(func_ret);
|
||||
|
|
|
@ -0,0 +1,218 @@
|
|||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
s32 func_80080790(void* a0, void* a1, s32 a2) {
|
||||
u32 spPad;
|
||||
OSIoMesg sp96;
|
||||
OSMesgQueue sp72;
|
||||
OSMesg sp68;
|
||||
s32 ret;
|
||||
u32 s0 = D_80096B50;
|
||||
|
||||
osInvalDCache(a1, a2);
|
||||
osCreateMesgQueue(&sp72, &sp68, 1);
|
||||
|
||||
if (s0 != 0) {
|
||||
while (s0 < a2) {
|
||||
sp96.hdr.pri = 0;
|
||||
sp96.hdr.retQueue = &sp72;
|
||||
sp96.devAddr = (u32)a0;
|
||||
sp96.dramAddr = a1;
|
||||
sp96.size = s0;
|
||||
ret = osEPiStartDma(D_80096B40, &sp96, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp72, NULL, 1);
|
||||
a2 -= s0;
|
||||
a0 = (u8*)a0 + s0;
|
||||
a1 = (u8*)a1 + s0;
|
||||
}
|
||||
}
|
||||
sp96.hdr.pri = 0;
|
||||
sp96.hdr.retQueue = &sp72;
|
||||
sp96.devAddr = (u32)a0;
|
||||
sp96.dramAddr = a1;
|
||||
sp96.size = (u32)a2;
|
||||
ret = osEPiStartDma(D_80096B40, &sp96, 0);
|
||||
if (ret) goto END;
|
||||
|
||||
osRecvMesg(&sp72, NULL, 1);
|
||||
|
||||
osInvalDCache(a1, a2);
|
||||
|
||||
END:
|
||||
return ret;
|
||||
}
|
||||
|
||||
void func_800808D4(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) {
|
||||
osPiStartDma(pihandle, mb, direction);
|
||||
}
|
||||
|
||||
DmadataEntry* func_800808F4(u32 a0) {
|
||||
DmadataEntry* curr;
|
||||
|
||||
for (curr = dmadata; curr->vromEnd != 0; curr++) {
|
||||
if (a0 < curr->vromStart) continue;
|
||||
if (a0 >= curr->vromEnd) continue;
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s32 func_80080950(u32 a0) {
|
||||
DmadataEntry* v0 = func_800808F4(a0);
|
||||
|
||||
if (v0 != NULL) {
|
||||
if (v0->romEnd == 0) {
|
||||
return a0 + v0->romStart - v0->vromStart;
|
||||
}
|
||||
|
||||
if (a0 == v0->vromStart) {
|
||||
return v0->romStart;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
s32 func_800809BC(u32 a0) {
|
||||
DmadataEntry* v0 = func_800808F4(a0);
|
||||
|
||||
if (v0 != NULL) {
|
||||
// TODO this uses t7 to shift instead of reusing v0
|
||||
return v0 - dmadata;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
UNK_TYPE* func_800809F4(u32 a0) {
|
||||
return &D_800981C0;
|
||||
}
|
||||
|
||||
void func_80080A08(s80080A08* a0) {
|
||||
UNK_TYPE sp52;
|
||||
UNK_TYPE sp48;
|
||||
UNK_TYPE sp44;
|
||||
UNK_TYPE sp40;
|
||||
UNK_TYPE sp36;
|
||||
UNK_TYPE sp32;
|
||||
s32 sp28;
|
||||
UNK_TYPE sp24;
|
||||
|
||||
sp52 = (UNK_TYPE)a0->unk0;
|
||||
sp48 = (UNK_TYPE)a0->unk4;
|
||||
sp44 = a0->unk8;
|
||||
|
||||
sp28 = func_800809BC(sp52);
|
||||
|
||||
if ((sp28 >= 0) && (sp28 < D_8009B2BC)) {
|
||||
if (dmadata[sp28].romEnd == 0) {
|
||||
if (dmadata[sp28].vromEnd < (sp44 + sp52)) {
|
||||
func_80083E4C(&D_800981C4, 499);
|
||||
}
|
||||
func_80080790((u8*)((dmadata[sp28].romStart + sp52) - dmadata[sp28].vromStart), (u8*)sp48, sp44);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO this part is arranged slightly different is ASM
|
||||
sp36 = dmadata[sp28].romEnd - dmadata[sp28].romStart;
|
||||
sp40 = dmadata[sp28].romStart;
|
||||
|
||||
if (sp52 != dmadata[sp28].vromStart) {
|
||||
func_80083E4C(&D_800981D4, 518);
|
||||
}
|
||||
|
||||
if (sp44 != (dmadata[sp28].vromEnd - dmadata[sp28].vromStart)) {
|
||||
func_80083E4C(&D_800981E4, 525);
|
||||
}
|
||||
|
||||
osSetThreadPri(NULL, 10);
|
||||
func_80081178(sp40, sp48, sp36);
|
||||
osSetThreadPri(NULL, 17);
|
||||
} else {
|
||||
func_80083E4C(&D_800981F4, 558);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80080B84(void* a0) {
|
||||
s80080A08* sp52;
|
||||
UNK_TYPE pad;
|
||||
s80080A08* s0;
|
||||
|
||||
for (;;) {
|
||||
osRecvMesg(&D_8009B2C0, (OSMesg)&sp52, 1);
|
||||
if (sp52 == NULL) return;
|
||||
s0 = sp52;
|
||||
func_80080A08(s0);
|
||||
// TODO a0 isn't being used for this comparison
|
||||
if (s0->unk24 == 0) continue;
|
||||
osSendMesg(&D_8009B2C0, (OSMesg)s0->unk28, 0);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80080C04(s80080A08* a0, UNK_FUN_PTR(a1), UNK_PTR a2, UNK_TYPE a3, UNK_TYPE sp48, OSMesgQueue* sp52, UNK_TYPE sp56) {
|
||||
// TODO this isn't correct, it uses a lui, addiu to get the address of D_80096B60, then loads it,
|
||||
// meaning that this is likely just "if (*D_80096B60 >= 2)". However, I can not get it to not
|
||||
// produce the usual lui, lw combo to load from an address :/
|
||||
if (*D_80096B60 >= 2) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
a0->unk0 = a2;
|
||||
a0->unk4 = a1;
|
||||
a0->unk8 = a3;
|
||||
a0->unk20 = 0;
|
||||
a0->unk24 = sp52;
|
||||
a0->unk28 = sp56;
|
||||
|
||||
osSendMesg(&D_8009B2C0, (OSMesg)a0, 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 func_80080C90(UNK_TYPE a0, UNK_PTR a1, UNK_TYPE a2) {
|
||||
s80080A08 sp72;
|
||||
OSMesgQueue sp48;
|
||||
OSMesg sp44;
|
||||
s32 ret;
|
||||
|
||||
osCreateMesgQueue(&sp48, &sp44, 1);
|
||||
|
||||
ret = func_80080C04(&sp72, (UNK_FUN_ARG)a0, a1, a2, 0, &sp48, 0);
|
||||
|
||||
if (ret == -1) {
|
||||
return ret;
|
||||
} else {
|
||||
osRecvMesg(&sp48, NULL, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void func_80080D0C() {
|
||||
DmadataEntry* v0;
|
||||
u32 v1;
|
||||
// TODO register load ordering is wrong
|
||||
func_80080790(&dmadataRomStart, dmadata, (u8*)&dmadataRomEnd - (u8*)&dmadataRomStart);
|
||||
|
||||
for (v0 = dmadata, v1 = 0; v0->vromEnd != 0; v0++, v1++);
|
||||
|
||||
D_8009B2BC = (u16)v1;
|
||||
|
||||
osCreateMesgQueue(&D_8009B2C0, (OSMesg)&D_8009B2D8, 32);
|
||||
|
||||
func_80085320(&D_8009B2A0, &D_8009B508, &D_8009BA08, 0, 256, &D_80098204);
|
||||
|
||||
osCreateThread(&D_8009B358, 18, func_80080B84, NULL, &D_8009BA08, 17);
|
||||
|
||||
osStartThread(&D_8009B358);
|
||||
}
|
||||
|
||||
void func_80080E00() {
|
||||
osSendMesg(&D_8009B2C0, NULL, 1);
|
||||
}
|
|
@ -314,9 +314,9 @@ D_00018E5C = 0x00018E5C;
|
|||
D_00018E60 = 0x00018E60;
|
||||
D_00018E64 = 0x00018E64;
|
||||
D_00018E68 = 0x00018E68;
|
||||
D_0001A500 = 0x0001A500;
|
||||
dmadataRomStart = 0x0001A500;
|
||||
D_00020308 = 0x00020308;
|
||||
D_00020700 = 0x00020700;
|
||||
dmadataRomEnd = 0x00020700;
|
||||
D_0002446A = 0x0002446A;
|
||||
D_00046AF0 = 0x00046AF0;
|
||||
D_00080028 = 0x00080028;
|
||||
|
@ -2100,6 +2100,7 @@ D_8009B160 = 0x8009B160;
|
|||
D_8009B228 = 0x8009B228;
|
||||
D_8009B240 = 0x8009B240;
|
||||
D_8009B290 = 0x8009B290;
|
||||
D_8009B2A0 = 0x8009B2A0;
|
||||
D_8009B2BC = 0x8009B2BC;
|
||||
D_8009B2C0 = 0x8009B2C0;
|
||||
D_8009B2D8 = 0x8009B2D8;
|
||||
|
@ -2177,7 +2178,7 @@ D_8009F858 = 0x8009F858;
|
|||
D_8009F870 = 0x8009F870;
|
||||
D_8009F888 = 0x8009F888;
|
||||
D_8009F8A0 = 0x8009F8A0;
|
||||
D_8009F8B0 = 0x8009F8B0;
|
||||
dmadata = 0x8009F8B0;
|
||||
D_800A0004 = 0x800A0004;
|
||||
D_80186028 = 0x80186028;
|
||||
D_801AAAB0 = 0x801AAAB0;
|
||||
|
|
23
variables.py
23
variables.py
|
@ -1,4 +1,6 @@
|
|||
known_vars = {
|
||||
0x0001A500:("dmadataRomStart","u32",False), # Start of dmadata
|
||||
0x00020700:("dmadataRomEnd","u32",False), # Byte immediately after end of dmadata
|
||||
0x00AC4000:("","UNK_TYPE",False), # this seems low
|
||||
0x00ACC000:("","UNK_TYPE",False), # this seems low
|
||||
0x00B3C000:("","UNK_TYPE",False), # this seems low
|
||||
|
@ -19,8 +21,9 @@ known_vars = {
|
|||
0x80096B2C:("","u32",False),
|
||||
0x80096B30:("","f32",False),
|
||||
0x80096B34:("","f32",False),
|
||||
0x80096B40:("","struct s80092920*",False),
|
||||
0x80096B40:("","OSPiHandle*",False),
|
||||
0x80096B50:("","UNK_TYPE",False),
|
||||
0x80096B60:("","UNK_TYPE*",False),
|
||||
0x80096C40:("g_s80085320_ListHead","struct s80085320*",False), # TODO rename?
|
||||
0x80096C44:("g_s80085320_ListTail","struct s80085320*",False), # TODO rename?
|
||||
0x80097590:("","UNK_TYPE",False),
|
||||
|
@ -36,7 +39,7 @@ known_vars = {
|
|||
0x80097E5C:("__osShutdown","UNK_TYPE",False),
|
||||
0x80097E60:("__OSGlobalIntMask","UNK_TYPE",False),
|
||||
0x80097E70:("__osPiDevMgr","UNK_TYPE",False),
|
||||
0x80097E8C:("","struct s80092920*",False),
|
||||
0x80097E8C:("","OSPiHandle*",False),
|
||||
0x80097EA0:("__osPiAccessQueueEnabled","UNK_TYPE",False),
|
||||
0x80097F10:("","UNK_TYPE",False),
|
||||
0x80097F70:("__osTimerList","OSTimer*",False),
|
||||
|
@ -55,6 +58,12 @@ known_vars = {
|
|||
0x800981A0:("","UNK_TYPE",False),
|
||||
0x800981A8:("","UNK_TYPE",False),
|
||||
0x800981B0:("","float",False),
|
||||
0x800981C0:("","UNK_TYPE",False),
|
||||
0x800981C4:("","UNK_TYPE",False),
|
||||
0x800981D4:("","UNK_TYPE",False),
|
||||
0x800981E4:("","UNK_TYPE",False),
|
||||
0x800981F4:("","UNK_TYPE",False),
|
||||
0x80098204:("","UNK_TYPE",False),
|
||||
0x80098280:("","UNK_TYPE",False),
|
||||
0x80098290:("","UNK_TYPE",False),
|
||||
0x800982A4:("","UNK_TYPE",False),
|
||||
|
@ -77,6 +86,13 @@ known_vars = {
|
|||
0x8009B228:("","UNK_TYPE",False),
|
||||
0x8009B240:("","u32*",False),
|
||||
0x8009B290:("","u8",False),
|
||||
0x8009B2A0:("","struct s80085320",False),
|
||||
0x8009B2BC:("","u16",False), # Count of entries in dmadata
|
||||
0x8009B2C0:("","OSMesgQueue",False),
|
||||
0x8009B2D8:("","UNK_TYPE",False),
|
||||
0x8009B358:("","OSThread",False),
|
||||
0x8009B508:("","UNK_TYPE",False),
|
||||
0x8009BA08:("","UNK_TYPE",False),
|
||||
0x8009BE30:("","UNK_TYPE",False),
|
||||
0x8009BE34:("","UNK_TYPE",False),
|
||||
0x8009BE38:("","UNK_TYPE",False),
|
||||
|
@ -104,8 +120,9 @@ known_vars = {
|
|||
0x8009E5B8:("__osBaseCounter","UNK_TYPE",False),
|
||||
0x8009E5BC:("__osViIntrCount","UNK_TYPE",False), # actually an array of structs?
|
||||
0x8009E5C0:("__osTimerCounter","UNK_TYPE",False),
|
||||
0x8009E610:("","struct s80092920",False),
|
||||
0x8009E610:("","OSPiHandle",False),
|
||||
0x8009E624:("","UNK_TYPE",False),
|
||||
0x8009F8B0:("dmadata","DmadataEntry",True), # RAM copy of dmadata
|
||||
0x801ADE80:("","UNK_TYPE",False),
|
||||
0x801ADEAC:("","UNK_TYPE",False),
|
||||
0x801ADEB0:("D_801ADEB0","int",True), # TODO better array representation
|
||||
|
|
Loading…
Reference in New Issue