Decompile init.c

This commit is contained in:
gamemasterplc 2023-11-24 16:52:24 -06:00
parent 0079229b08
commit c6a0351e2c
9 changed files with 417 additions and 127 deletions

View file

@ -47,6 +47,14 @@ game/decode.c:
game/font.c:
.data start:0x8011FE00 end:0x80121E00
game/init.c:
.text start:0x80009AFC end:0x8000A464
.data start:0x80121E00 end:0x80121F50
.bss start:0x80145A40 end:0x80145A80
.sdata start:0x801D3448 end:0x801D3460
.sbss start:0x801D3AF8 end:0x801D3B28
.sdata2 start:0x801D4968 end:0x801D4978
game/jmp.c:
.text start:0x8000A464 end:0x8000A558

View file

@ -91,14 +91,14 @@ HuDecodeSlide = .text:0x80009400; // type:function size:0x200 scope:local
HuDecodeFslide = .text:0x80009600; // type:function size:0x1D8 scope:local
HuDecodeData = .text:0x800097D8; // type:function size:0x324
HuSysInit = .text:0x80009AFC; // type:function size:0x138
fn_80009C34 = .text:0x80009C34; // type:function size:0xD0
fn_80009D04 = .text:0x80009D04; // type:function size:0x164
fn_80009E68 = .text:0x80009E68; // type:function size:0x13C
fn_80009FA4 = .text:0x80009FA4; // type:function size:0x54
fn_80009FF8 = .text:0x80009FF8; // type:function size:0xE4
fn_8000A0DC = .text:0x8000A0DC; // type:function size:0xC8
fn_8000A1A4 = .text:0x8000A1A4; // type:function size:0x6C
fn_8000A210 = .text:0x8000A210; // type:function size:0x254
InitRenderMode = .text:0x80009C34; // type:function size:0xD0 scope:local
InitGX = .text:0x80009D04; // type:function size:0x164 scope:local
InitMem = .text:0x80009E68; // type:function size:0x13C scope:local
InitVI = .text:0x80009FA4; // type:function size:0x54 scope:local
HuSysBeforeRender = .text:0x80009FF8; // type:function size:0xE4
HuSysDoneRender = .text:0x8000A0DC; // type:function size:0xC8
SwapBuffers = .text:0x8000A1A4; // type:function size:0x6C scope:local
LoadMemInfo = .text:0x8000A210; // type:function size:0x254 scope:local
gcsetjmp = .text:0x8000A464; // type:function size:0x74
gclongjmp = .text:0x8000A4D8; // type:function size:0x80
HuMemInitAll = .text:0x8000A558; // type:function size:0x12C
@ -535,8 +535,8 @@ fn_8002FE38 = .text:0x8002FE38; // type:function size:0xE0
fn_8002FF18 = .text:0x8002FF18; // type:function size:0x2C
fn_8002FF44 = .text:0x8002FF44; // type:function size:0x8
OSPanic = .text:0x8002FF4C; // type:function size:0x150
fn_8003009C = .text:0x8003009C; // type:function size:0x118
fn_800301B4 = .text:0x800301B4; // type:function size:0x34
HuFaultInitXfbDirectDraw = .text:0x8003009C; // type:function size:0x118
HuFaultSetXfbAddress = .text:0x800301B4; // type:function size:0x34
fn_800301E8 = .text:0x800301E8; // type:function size:0x98
fn_80030280 = .text:0x80030280; // type:function size:0x50
fn_800302D0 = .text:0x800302D0; // type:function size:0xF4
@ -589,10 +589,10 @@ fn_800322C8 = .text:0x800322C8; // type:function size:0xB4
fn_8003237C = .text:0x8003237C; // type:function size:0xC8
fn_80032444 = .text:0x80032444; // type:function size:0xD0
fn_80032514 = .text:0x80032514; // type:function size:0xE0
fn_800325F4 = .text:0x800325F4; // type:function size:0xAC
fn_800326A0 = .text:0x800326A0; // type:function size:0xD8
fn_80032778 = .text:0x80032778; // type:function size:0xB8
fn_80032830 = .text:0x80032830; // type:function size:0x170
frand = .text:0x800325F4; // type:function size:0xAC
frandf = .text:0x800326A0; // type:function size:0xD8
frandmod = .text:0x80032778; // type:function size:0xB8
HuAudInit = .text:0x80032830; // type:function size:0x170
fn_800329A0 = .text:0x800329A0; // type:function size:0x8
fn_800329A8 = .text:0x800329A8; // type:function size:0x3C
fn_800329E4 = .text:0x800329E4; // type:function size:0x24
@ -808,7 +808,7 @@ fn_80047D94 = .text:0x80047D94; // type:function size:0x304
fn_80048098 = .text:0x80048098; // type:function size:0xA4
fn_8004813C = .text:0x8004813C; // type:function size:0x264
fn_800483A0 = .text:0x800483A0; // type:function size:0xE8
fn_80048488 = .text:0x80048488; // type:function size:0x34
HuCardInit = .text:0x80048488; // type:function size:0x34
fn_800484BC = .text:0x800484BC; // type:function size:0xC4
fn_80048580 = .text:0x80048580; // type:function size:0x58
fn_800485D8 = .text:0x800485D8; // type:function size:0xEC
@ -823,7 +823,7 @@ fn_80048960 = .text:0x80048960; // type:function size:0x50
fn_800489B0 = .text:0x800489B0; // type:function size:0x40
fn_800489F0 = .text:0x800489F0; // type:function size:0x4C
fn_80048A3C = .text:0x80048A3C; // type:function size:0x48
fn_80048A84 = .text:0x80048A84; // type:function size:0x148
HuARInit = .text:0x80048A84; // type:function size:0x148
fn_80048BCC = .text:0x80048BCC; // type:function size:0x16C
fn_80048D38 = .text:0x80048D38; // type:function size:0x16C
fn_80048EA4 = .text:0x80048EA4; // type:function size:0xA8
@ -991,7 +991,7 @@ fn_80059D54 = .text:0x80059D54; // type:function size:0x5A8
fn_8005A2FC = .text:0x8005A2FC; // type:function size:0x3FC
fn_8005A6F8 = .text:0x8005A6F8; // type:function size:0x50
fn_8005A748 = .text:0x8005A748; // type:function size:0x28
fn_8005A770 = .text:0x8005A770; // type:function size:0x1F4
HuDvdErrDispInit = .text:0x8005A770; // type:function size:0x1F4
fn_8005A964 = .text:0x8005A964; // type:function size:0xD8
fn_8005AA3C = .text:0x8005AA3C; // type:function size:0x128
fn_8005AB64 = .text:0x8005AB64; // type:function size:0x2D0
@ -2054,13 +2054,13 @@ DecrementerExceptionCallback = .text:0x800B5124; // type:function size:0x230 sco
DecrementerExceptionHandler = .text:0x800B5354; // type:function size:0x50 scope:local
fn_800B53A4 = .text:0x800B53A4; // type:function size:0xAC
OSAllocFromHeap = .text:0x800B5450; // type:function size:0xFC
fn_800B554C = .text:0x800B554C; // type:function size:0x284
fn_800B57D0 = .text:0x800B57D0; // type:function size:0x7C
OSAllocFixed = .text:0x800B554C; // type:function size:0x284
OSFreeToHeap = .text:0x800B57D0; // type:function size:0x7C
OSSetCurrentHeap = .text:0x800B584C; // type:function size:0x10
OSInitAlloc = .text:0x800B585C; // type:function size:0x70
OSCreateHeap = .text:0x800B58CC; // type:function size:0x6C
OSCheckHeap = .text:0x800B5938; // type:function size:0x360
fn_800B5C98 = .text:0x800B5C98; // type:function size:0x104
OSDumpHeap = .text:0x800B5C98; // type:function size:0x104
OSGetArenaHi = .text:0x800B5D9C; // type:function size:0x8 scope:global
OSGetArenaLo = .text:0x800B5DA4; // type:function size:0x8 scope:global
OSSetArenaHi = .text:0x800B5DAC; // type:function size:0x8 scope:global
@ -2120,8 +2120,8 @@ fn_800B7F74 = .text:0x800B7F74; // type:function size:0x20C
fn_800B8180 = .text:0x800B8180; // type:function size:0x94
__OSModuleInit = .text:0x800B8214; // type:function size:0x18 scope:global
fn_800B822C = .text:0x800B822C; // type:function size:0x60
fn_800B828C = .text:0x800B828C; // type:function size:0xC
fn_800B8298 = .text:0x800B8298; // type:function size:0xC
OSGetPhysicalMemSize = .text:0x800B828C; // type:function size:0xC
OSGetConsoleSimulatedMemSize = .text:0x800B8298; // type:function size:0xC
fn_800B82A4 = .text:0x800B82A4; // type:function size:0x3C
MEMIntrruptHandler = .text:0x800B82E0; // type:function size:0x6C scope:local
Config24MB = .text:0x800B834C; // type:function size:0x80 scope:local
@ -2149,18 +2149,18 @@ fn_800B92D4 = .text:0x800B92D4; // type:function size:0x308
__OSUnlockSram = .text:0x800B95DC; // type:function size:0x24 scope:global
__OSUnlockSramEx = .text:0x800B9600; // type:function size:0x24 scope:global
__OSSyncSram = .text:0x800B9624; // type:function size:0x10 scope:global
fn_800B9634 = .text:0x800B9634; // type:function size:0x80
fn_800B96B4 = .text:0x800B96B4; // type:function size:0xA4
fn_800B9758 = .text:0x800B9758; // type:function size:0x70
fn_800B97C8 = .text:0x800B97C8; // type:function size:0xA4
fn_800B986C = .text:0x800B986C; // type:function size:0x84
fn_800B98F0 = .text:0x800B98F0; // type:function size:0xAC
fn_800B999C = .text:0x800B999C; // type:function size:0x2C
fn_800B99C8 = .text:0x800B99C8; // type:function size:0x3C
fn_800B9A04 = .text:0x800B9A04; // type:function size:0xCC
fn_800B9AD0 = .text:0x800B9AD0; // type:function size:0x70
fn_800B9B40 = .text:0x800B9B40; // type:function size:0x28
fn_800B9B68 = .text:0x800B9B68; // type:function size:0x1A4
OSGetSoundMode = .text:0x800B9634; // type:function size:0x80
OSSetSoundMode = .text:0x800B96B4; // type:function size:0xA4
OSGetProgressiveMode = .text:0x800B9758; // type:function size:0x70
OSSetProgressiveMode = .text:0x800B97C8; // type:function size:0xA4
OSGetWirelessID = .text:0x800B986C; // type:function size:0x84
OSSetWirelessID = .text:0x800B98F0; // type:function size:0xAC
OSInitStopwatch = .text:0x800B999C; // type:function size:0x2C
OSStartStopwatch = .text:0x800B99C8; // type:function size:0x3C
OSStopStopwatch = .text:0x800B9A04; // type:function size:0xCC
OSCheckStopwatch = .text:0x800B9AD0; // type:function size:0x70
OSResetStopwatch = .text:0x800B9B40; // type:function size:0x28
OSDumpStopwatch = .text:0x800B9B68; // type:function size:0x1A4
__OSSystemCallVectorStart = .text:0x800B9D0C; // type:label scope:global
fn_800B9D0C = .text:0x800B9D0C; // type:function size:0x20
__OSSystemCallVectorEnd = .text:0x800B9D28; // type:label scope:global
@ -2266,9 +2266,9 @@ DVDClose = .text:0x800BDCA4; // type:function size:0x24
fn_800BDCC8 = .text:0x800BDCC8; // type:function size:0x160
fn_800BDE28 = .text:0x800BDE28; // type:function size:0xC4
DVDReadAsyncPrio = .text:0x800BDEEC; // type:function size:0xC0
fn_800BDFAC = .text:0x800BDFAC; // type:function size:0x30
fn_800BDFDC = .text:0x800BDFDC; // type:function size:0x118
fn_800BE0F4 = .text:0x800BE0F4; // type:function size:0x24
cbForReadAsync = .text:0x800BDFAC; // type:function size:0x30 scope:local
DVDReadPrio = .text:0x800BDFDC; // type:function size:0x118
cbForReadSync = .text:0x800BE0F4; // type:function size:0x24 scope:local
DVDInit = .text:0x800BE118; // type:function size:0xFC scope:global
fn_800BE214 = .text:0x800BE214; // type:function size:0x54
fn_800BE268 = .text:0x800BE268; // type:function size:0x80
@ -2326,28 +2326,28 @@ getTiming = .text:0x800C0E1C; // type:function size:0x90
__VIInit = .text:0x800C0EAC; // type:function size:0x1F8
VIInit = .text:0x800C10A4; // type:function size:0x478
VIWaitForRetrace = .text:0x800C151C; // type:function size:0x54
setFbbRegs = .text:0x800C1570; // type:function size:0x2D4
setVerticalRegs = .text:0x800C1844; // type:function size:0x1A0
setFbbRegs = .text:0x800C1570; // type:function size:0x2D4 scope:local
setVerticalRegs = .text:0x800C1844; // type:function size:0x1A0 scope:local
VIConfigure = .text:0x800C19E4; // type:function size:0x79C
fn_800C2180 = .text:0x800C2180; // type:function size:0x394
fn_800C2514 = .text:0x800C2514; // type:function size:0x11C
fn_800C2630 = .text:0x800C2630; // type:function size:0x6C
fn_800C269C = .text:0x800C269C; // type:function size:0x7C
fn_800C2718 = .text:0x800C2718; // type:function size:0x8
fn_800C2720 = .text:0x800C2720; // type:function size:0x68
VIConfigurePan = .text:0x800C2180; // type:function size:0x394
VIFlush = .text:0x800C2514; // type:function size:0x11C
VISetNextFrameBuffer = .text:0x800C2630; // type:function size:0x6C
VISetBlack = .text:0x800C269C; // type:function size:0x7C
VIGetRetraceCount = .text:0x800C2718; // type:function size:0x8
getCurrentFieldEvenOdd = .text:0x800C2720; // type:function size:0x68 scope:local
VIGetNextField = .text:0x800C2788; // type:function size:0xA8
VIGetCurrentLine = .text:0x800C2830; // type:function size:0x98
VIGetTvFormat = .text:0x800C28C8; // type:function size:0x7C scope:global
VIGetDTVStatus = .text:0x800C2944; // type:function size:0x3C
fn_800C2980 = .text:0x800C2980; // type:function size:0x8
fn_800C2988 = .text:0x800C2988; // type:function size:0x228
fn_800C2BB0 = .text:0x800C2BB0; // type:function size:0x310
fn_800C2EC0 = .text:0x800C2EC0; // type:function size:0xC4
fn_800C2F84 = .text:0x800C2F84; // type:function size:0x394
fn_800C3318 = .text:0x800C3318; // type:function size:0x58
fn_800C3370 = .text:0x800C3370; // type:function size:0x96C
fn_800C3CDC = .text:0x800C3CDC; // type:function size:0x130
fn_800C3E0C = .text:0x800C3E0C; // type:function size:0x108
DEMOGetRenderModeObj = .text:0x800C2980; // type:function size:0x8
DEMOInitCaption = .text:0x800C2988; // type:function size:0x228
DEMOPuts = .text:0x800C2BB0; // type:function size:0x310
DEMOPrintf = .text:0x800C2EC0; // type:function size:0xC4
DEMOWriteStats = .text:0x800C2F84; // type:function size:0x394
DEMOUpdateStats = .text:0x800C3318; // type:function size:0x58
DEMOPrintStats = .text:0x800C3370; // type:function size:0x96C
ClampStick = .text:0x800C3CDC; // type:function size:0x130 scope:local
PADClamp = .text:0x800C3E0C; // type:function size:0x108
fn_800C3F14 = .text:0x800C3F14; // type:function size:0x1A4
fn_800C40B8 = .text:0x800C40B8; // type:function size:0xC4
fn_800C417C = .text:0x800C417C; // type:function size:0xC0
@ -2446,19 +2446,19 @@ fn_800C9BAC = .text:0x800C9BAC; // type:function size:0x54
fn_800C9C00 = .text:0x800C9C00; // type:function size:0x124
GXClearVtxDesc = .text:0x800C9D24; // type:function size:0x4C
GXSetVtxAttrFmt = .text:0x800C9D70; // type:function size:0x35C
fn_800CA0CC = .text:0x800CA0CC; // type:function size:0x9C
__GXSetVAT = .text:0x800CA0CC; // type:function size:0x9C
GXSetArray = .text:0x800CA168; // type:function size:0x8C
fn_800CA1F4 = .text:0x800CA1F4; // type:function size:0x10
GXInvalidateVtxCache = .text:0x800CA1F4; // type:function size:0x10
GXSetTexCoordGen2 = .text:0x800CA204; // type:function size:0x2D0
GXSetNumTexGens = .text:0x800CA4D4; // type:function size:0x48
GXSetMisc = .text:0x800CA51C; // type:function size:0x78 scope:global
fn_800CA594 = .text:0x800CA594; // type:function size:0x5C
fn_800CA5F0 = .text:0x800CA5F0; // type:function size:0x34
fn_800CA624 = .text:0x800CA624; // type:function size:0xCC
fn_800CA6F0 = .text:0x800CA6F0; // type:function size:0xB8
fn_800CA7A8 = .text:0x800CA7A8; // type:function size:0x98
fn_800CA840 = .text:0x800CA840; // type:function size:0x4C
fn_800CA88C = .text:0x800CA88C; // type:function size:0x80
GXFlush = .text:0x800CA594; // type:function size:0x5C
GXResetWriteGatherPipe = .text:0x800CA5F0; // type:function size:0x34
__GXAbortWaitPECopyDone = .text:0x800CA624; // type:function size:0xCC
GXSetDrawSync = .text:0x800CA6F0; // type:function size:0xB8
GXSetDrawDone = .text:0x800CA7A8; // type:function size:0x98
GXWaitDrawDone = .text:0x800CA840; // type:function size:0x4C
GXDrawDone = .text:0x800CA88C; // type:function size:0x80
fn_800CA90C = .text:0x800CA90C; // type:function size:0x24
fn_800CA930 = .text:0x800CA930; // type:function size:0x14
fn_800CA944 = .text:0x800CA944; // type:function size:0x14
@ -2481,20 +2481,20 @@ fn_800CAF04 = .text:0x800CAF04; // type:function size:0x64
fn_800CAF68 = .text:0x800CAF68; // type:function size:0x50
fn_800CAFB8 = .text:0x800CAFB8; // type:function size:0x44
fn_800CAFFC = .text:0x800CAFFC; // type:function size:0x24
fn_800CB020 = .text:0x800CB020; // type:function size:0x120
fn_800CB140 = .text:0x800CB140; // type:function size:0xC0
fn_800CB200 = .text:0x800CB200; // type:function size:0xC0
fn_800CB2C0 = .text:0x800CB2C0; // type:function size:0x44
fn_800CB304 = .text:0x800CB304; // type:function size:0x170
fn_800CB474 = .text:0x800CB474; // type:function size:0x2C
fn_800CB4A0 = .text:0x800CB4A0; // type:function size:0x7C
fn_800CB51C = .text:0x800CB51C; // type:function size:0xD4
fn_800CB5F0 = .text:0x800CB5F0; // type:function size:0x68
fn_800CB658 = .text:0x800CB658; // type:function size:0x228
fn_800CB880 = .text:0x800CB880; // type:function size:0x1C
fn_800CB89C = .text:0x800CB89C; // type:function size:0x170
fn_800CBA0C = .text:0x800CBA0C; // type:function size:0x190
fn_800CBB9C = .text:0x800CBB9C; // type:function size:0x38
GXAdjustForOverscan = .text:0x800CB020; // type:function size:0x120
GXSetDispCopySrc = .text:0x800CB140; // type:function size:0xC0
GXSetTexCopySrc = .text:0x800CB200; // type:function size:0xC0
GXSetDispCopyDst = .text:0x800CB2C0; // type:function size:0x44
GXSetTexCopyDst = .text:0x800CB304; // type:function size:0x170
GXSetDispCopyFrame2Field = .text:0x800CB474; // type:function size:0x2C
GXSetCopyClamp = .text:0x800CB4A0; // type:function size:0x7C
GXSetDispCopyYScale = .text:0x800CB51C; // type:function size:0xD4
GXSetCopyClear = .text:0x800CB5F0; // type:function size:0x68
GXSetCopyFilter = .text:0x800CB658; // type:function size:0x228
GXSetDispCopyGamma = .text:0x800CB880; // type:function size:0x1C
GXCopyDisp = .text:0x800CB89C; // type:function size:0x170
GXCopyTex = .text:0x800CBA0C; // type:function size:0x190
GXClearBoundingBox = .text:0x800CBB9C; // type:function size:0x38
fn_800CBBD4 = .text:0x800CBBD4; // type:function size:0x1C
fn_800CBBF0 = .text:0x800CBBF0; // type:function size:0x10
fn_800CBC00 = .text:0x800CBC00; // type:function size:0x180
@ -2560,11 +2560,11 @@ GXSetColorUpdate = .text:0x800CEC80; // type:function size:0x40
GXSetAlphaUpdate = .text:0x800CECC0; // type:function size:0x40
GXSetZMode = .text:0x800CED00; // type:function size:0x78
GXSetZCompLoc = .text:0x800CED78; // type:function size:0x40
fn_800CEDB8 = .text:0x800CEDB8; // type:function size:0x110
fn_800CEEC8 = .text:0x800CEEC8; // type:function size:0x40
fn_800CEF08 = .text:0x800CEF08; // type:function size:0x54
fn_800CEF5C = .text:0x800CEF5C; // type:function size:0x38
fn_800CEF94 = .text:0x800CEF94; // type:function size:0x80
GXSetPixelFmt = .text:0x800CEDB8; // type:function size:0x110
GXSetDither = .text:0x800CEEC8; // type:function size:0x40
GXSetDstAlpha = .text:0x800CEF08; // type:function size:0x54
GXSetFieldMask = .text:0x800CEF5C; // type:function size:0x38
GXSetFieldMode = .text:0x800CEF94; // type:function size:0x80
fn_800CF014 = .text:0x800CF014; // type:function size:0x4
fn_800CF018 = .text:0x800CF018; // type:function size:0xC8
fn_800CF0E0 = .text:0x800CF0E0; // type:function size:0xD4
@ -5284,11 +5284,11 @@ jumptable_8013D8C0 = .data:0x8013D8C0; // type:object size:0x68 scope:local
jumptable_8013D928 = .data:0x8013D928; // type:object size:0x44 scope:local
jumptable_8013D96C = .data:0x8013D96C; // type:object size:0x1C scope:local
jumptable_8013D988 = .data:0x8013D988; // type:object size:0x54 scope:local
lbl_8013D9E0 = .data:0x8013D9E0; // type:object size:0x3C
lbl_8013DA1C = .data:0x8013DA1C; // type:object size:0x3C
lbl_8013DA58 = .data:0x8013DA58; // type:object size:0x3C
lbl_8013DA94 = .data:0x8013DA94; // type:object size:0x3C
lbl_8013DAD0 = .data:0x8013DAD0; // type:object size:0x40
GXNtsc480IntDf = .data:0x8013D9E0; // type:object size:0x3C
GXNtsc480Prog = .data:0x8013DA1C; // type:object size:0x3C
GXMpal480IntDf = .data:0x8013DA58; // type:object size:0x3C
GXPal528IntDf = .data:0x8013DA94; // type:object size:0x3C
GXEurgb60Hz480IntDf = .data:0x8013DAD0; // type:object size:0x40
jumptable_8013DB10 = .data:0x8013DB10; // type:object size:0x1C scope:local
jumptable_8013DB30 = .data:0x8013DB30; // type:object size:0xF4 scope:local
jumptable_8013DC24 = .data:0x8013DC24; // type:object size:0xF4 scope:local
@ -5356,7 +5356,7 @@ padStatErrOld = .bss:0x80142800; // type:object size:0x10
rumbleData = .bss:0x80142810; // type:object size:0x30
ReadDataStat = .bss:0x80142840; // type:object size:0x2E00 scope:local align:32 data:4byte
TextBuffer = .bss:0x80145640; // type:object size:0x400
lbl_80145A40 = .bss:0x80145A40; // type:object size:0x40
rmodeobj = .bss:0x80145A40; // type:object size:0x40 scope:local
HeapTbl = .bss:0x80145A80; // type:object size:0x14 scope:local
strline = .bss:0x80145A98; // type:object size:0x6800 scope:local
pfStrBuf = .bss:0x8014C298; // type:object size:0x100 scope:local data:byte
@ -5620,7 +5620,7 @@ lbl_801D3430 = .sdata:0x801D3430; // type:object size:0x6 data:string
lbl_801D3436 = .sdata:0x801D3436; // type:object size:0x2 data:string
lbl_801D3438 = .sdata:0x801D3438; // type:object size:0x7 data:string
lbl_801D343F = .sdata:0x801D343F; // type:object size:0x9
lbl_801D3448 = .sdata:0x801D3448; // type:object size:0x4 data:4byte
FirstFrame = .sdata:0x801D3448; // type:object size:0x4 scope:local data:4byte
lbl_801D344C = .sdata:0x801D344C; // type:object size:0x7 data:string
lbl_801D3453 = .sdata:0x801D3453; // type:object size:0xD
lbl_801D3460 = .sdata:0x801D3460; // type:object size:0x2 data:string
@ -5944,15 +5944,15 @@ CallBackStatus = .sbss:0x801D3AE4; // type:object size:0x4 scope:local data:4byt
shortAccessSleep = .sbss:0x801D3AE8; // type:object size:0x4 scope:local data:4byte
DataDirMax = .sbss:0x801D3AEC; // type:object size:0x4 scope:local data:4byte
DirDataSize = .sbss:0x801D3AF0; // type:object size:0x8 data:4byte
lbl_801D3AF8 = .sbss:0x801D3AF8; // type:object size:0x4 data:4byte
lbl_801D3AFC = .sbss:0x801D3AFC; // type:object size:0x4 data:4byte
lbl_801D3B00 = .sbss:0x801D3B00; // type:object size:0x4 data:float
lbl_801D3B04 = .sbss:0x801D3B04; // type:object size:0x4 data:4byte
lbl_801D3B08 = .sbss:0x801D3B08; // type:object size:0x4 data:4byte
lbl_801D3B0C = .sbss:0x801D3B0C; // type:object size:0x4 data:4byte
lbl_801D3B10 = .sbss:0x801D3B10; // type:object size:0x4 data:4byte
lbl_801D3B14 = .sbss:0x801D3B14; // type:object size:0x4 data:4byte
lbl_801D3B18 = .sbss:0x801D3B18; // type:object size:0x4 data:4byte
DemoStatEnable = .sbss:0x801D3AF8; // type:object size:0x4 scope:local data:4byte
worstVcount = .sbss:0x801D3AFC; // type:object size:0x4 data:4byte
minimumVcountf = .sbss:0x801D3B00; // type:object size:0x4 data:float
minimumVcount = .sbss:0x801D3B04; // type:object size:0x4 data:4byte
DemoCurrentBuffer = .sbss:0x801D3B08; // type:object size:0x4 data:4byte
DemoFrameBuffer2 = .sbss:0x801D3B0C; // type:object size:0x4 data:4byte
DemoFrameBuffer1 = .sbss:0x801D3B10; // type:object size:0x4 data:4byte
DefaultFifoObj = .sbss:0x801D3B14; // type:object size:0x4 scope:local data:4byte
DefaultFifo = .sbss:0x801D3B18; // type:object size:0x4 scope:local data:4byte
currentHeapHandle = .sbss:0x801D3B1C; // type:object size:0x4 data:4byte
RenderMode = .sbss:0x801D3B20; // type:object size:0x8 data:4byte
saftyFrameF = .sbss:0x801D3B28; // type:object size:0x4 data:4byte

View file

@ -235,6 +235,7 @@ config.libs = [
Object(NonMatching, "game/data.c"),
Object(Matching, "game/decode.c"),
Object(NonMatching, "game/font.c"),
Object(Matching, "game/init.c"),
Object(NonMatching, "game/jmp.c"),
Object(Matching, "game/malloc.c"),
Object(Matching, "game/memory.c"),

View file

@ -121,6 +121,9 @@ BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
#define DVDReadAsync(fileInfo, addr, length, offset, callback) \
DVDReadAsyncPrio((fileInfo), (addr), (length), (offset), (callback), 2)
#define DVDRead(fileInfo, addr, length, offset) \
DVDReadPrio((fileInfo), (addr), (length), (offset), 2)
#define DVDSeekAsync(fileInfo, offset, callback) \
DVDSeekAsyncPrio((fileInfo), (offset), (callback), 2)

View file

@ -8,37 +8,36 @@
extern "C" {
#endif
// extern GXRenderModeObj GXNtsc240Ds;
// extern GXRenderModeObj GXNtsc240DsAa;
// extern GXRenderModeObj GXNtsc240Int;
// extern GXRenderModeObj GXNtsc240IntAa;
extern GXRenderModeObj GXNtsc240Ds;
extern GXRenderModeObj GXNtsc240DsAa;
extern GXRenderModeObj GXNtsc240Int;
extern GXRenderModeObj GXNtsc240IntAa;
extern GXRenderModeObj GXNtsc480IntDf;
// extern GXRenderModeObj GXNtsc480Int;
// extern GXRenderModeObj GXNtsc480IntAa;
// extern GXRenderModeObj GXNtsc480Prog;
// extern GXRenderModeObj GXNtsc480ProgSoft;
// extern GXRenderModeObj GXNtsc480ProgAa;
// extern GXRenderModeObj GXMpal240Ds;
// extern GXRenderModeObj GXMpal240DsAa;
// extern GXRenderModeObj GXMpal240Int;
// extern GXRenderModeObj GXMpal240IntAa;
extern GXRenderModeObj GXNtsc480Int;
extern GXRenderModeObj GXNtsc480IntAa;
extern GXRenderModeObj GXNtsc480Prog;
extern GXRenderModeObj GXNtsc480ProgAa;
extern GXRenderModeObj GXMpal240Ds;
extern GXRenderModeObj GXMpal240DsAa;
extern GXRenderModeObj GXMpal240Int;
extern GXRenderModeObj GXMpal240IntAa;
extern GXRenderModeObj GXMpal480IntDf;
// extern GXRenderModeObj GXMpal480Int;
// extern GXRenderModeObj GXMpal480IntAa;
// extern GXRenderModeObj GXPal264Ds;
// extern GXRenderModeObj GXPal264DsAa;
// extern GXRenderModeObj GXPal264Int;
// extern GXRenderModeObj GXPal264IntAa;
extern GXRenderModeObj GXMpal480Int;
extern GXRenderModeObj GXMpal480IntAa;
extern GXRenderModeObj GXPal264Ds;
extern GXRenderModeObj GXPal264DsAa;
extern GXRenderModeObj GXPal264Int;
extern GXRenderModeObj GXPal264IntAa;
extern GXRenderModeObj GXPal528IntDf;
// extern GXRenderModeObj GXPal528Int;
// extern GXRenderModeObj GXPal524IntAa;
// extern GXRenderModeObj GXEurgb60Hz240Ds;
// extern GXRenderModeObj GXEurgb60Hz240DsAa;
// extern GXRenderModeObj GXEurgb60Hz240Int;
// extern GXRenderModeObj GXEurgb60Hz240IntAa;
extern GXRenderModeObj GXPal528Int;
extern GXRenderModeObj GXPal524IntAa;
extern GXRenderModeObj GXEurgb60Hz240Ds;
extern GXRenderModeObj GXEurgb60Hz240DsAa;
extern GXRenderModeObj GXEurgb60Hz240Int;
extern GXRenderModeObj GXEurgb60Hz240IntAa;
extern GXRenderModeObj GXEurgb60Hz480IntDf;
// extern GXRenderModeObj GXEurgb60Hz480Int;
// extern GXRenderModeObj GXEurgb60Hz480IntAa;
extern GXRenderModeObj GXEurgb60Hz480Int;
extern GXRenderModeObj GXEurgb60Hz480IntAa;
#define GX_MAX_Z24 0x00FFFFFF

View file

@ -58,6 +58,7 @@ u32 OSUncachedToCached(void* ucaddr);
#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0))
#define OSRoundUp32B(v) (((u32)(v + 31) & ~31))
#define OSRoundDown32B(x) (((u32)(x)) & ~31)
void* OSGetArenaHi(void);
void* OSGetArenaLo(void);
@ -218,6 +219,9 @@ void OSReport(const char* msg, ...);
void OSPanic(const char* file, int line, const char* msg, ...);
void OSFatal(GXColor fg, GXColor bg, const char* msg);
u32 OSGetPhysicalMemSize(void);
u32 OSGetConsoleSimulatedMemSize(void);
#ifdef __cplusplus
}
#endif

View file

@ -18,6 +18,7 @@ void* OSAllocFixed(void** rstart, void** rend);
void OSFreeToHeap(OSHeapHandle heap, void* ptr);
long OSCheckHeap(OSHeapHandle heap);
void OSDumpHeap(OSHeapHandle heap);
void *OSAllocFixed(void **rstart, void **rend);
u32 OSReferentSize(void* ptr);
void OSVisitAllocated(OSAllocVisitor visitor);
extern volatile OSHeapHandle __OSCurrHeap;

274
src/game/init.c Normal file
View file

@ -0,0 +1,274 @@
#include "common.h"
#include "dolphin/os.h"
#include "dolphin/gx.h"
#include "dolphin/dvd.h"
#include "dolphin/vi.h"
#include "dolphin/pad.h"
struct memory_info {
void *start;
void *end;
};
extern void HuAudInit();
extern void HuCardInit();
extern void HuARInit();
extern u32 frand();
extern void HuFaultInitXfbDirectDraw(GXRenderModeObj *mode);
extern void HuFaultSetXfbAddress(int fb, void *addr);
static GXRenderModeObj rmodeobj;
static BOOL FirstFrame = TRUE;
GXRenderModeObj *RenderMode;
OSHeapHandle currentHeapHandle;
static void *DefaultFifo;
static GXFifoObj *DefaultFifoObj;
void *DemoFrameBuffer1;
void *DemoFrameBuffer2;
void *DemoCurrentBuffer;
u32 minimumVcount;
float minimumVcountf;
u32 worstVcount;
static BOOL DemoStatEnable;
static void InitRenderMode(GXRenderModeObj *mode);
static void InitMem();
static void InitGX();
static void InitVI();
static void SwapBuffers();
static void LoadMemInfo();
void HuSysInit(GXRenderModeObj *mode)
{
u32 rnd_temp;
OSInit();
DVDInit();
VIInit();
PADInit();
if(OSGetProgressiveMode() == 1 && VIGetDTVStatus() == 1) {
mode = &GXNtsc480Prog;
}
InitRenderMode(mode);
InitMem();
VIConfigure(RenderMode);
VIConfigurePan(0, 0, 640, 480);
DefaultFifo = OSAlloc(0x100000);
DefaultFifoObj = GXInit(DefaultFifo, 0x100000);
InitGX();
InitVI();
HuFaultInitXfbDirectDraw(RenderMode);
HuFaultSetXfbAddress(0, DemoFrameBuffer1);
HuFaultSetXfbAddress(1, DemoFrameBuffer2);
HuDvdErrDispInit(RenderMode, DemoFrameBuffer1, DemoFrameBuffer2);
rnd_temp = frand();
HuMemInitAll();
HuAudInit();
HuARInit();
minimumVcount = minimumVcountf = 1.0f;
worstVcount = 0;
OSInitFastCast();
HuCardInit();
}
static void InitRenderMode(GXRenderModeObj *mode)
{
if(mode != NULL) {
RenderMode = mode;
return;
}
switch(VIGetTvFormat()) {
case 0:
RenderMode = &GXNtsc480IntDf;
break;
case 1:
RenderMode = &GXPal528IntDf;
break;
case 2:
RenderMode = &GXMpal480IntDf;
break;
default:
OSPanic("init.c", 169, "DEMOInit: invalid TV format\n");
break;
}
GXAdjustForOverscan(RenderMode, &rmodeobj, 0, 16);
RenderMode = &rmodeobj;
}
static void InitGX()
{
GXSetViewport(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1);
GXSetScissor(0, 0, RenderMode->fbWidth, RenderMode->efbHeight);
GXSetDispCopySrc(0, 0, RenderMode->fbWidth, RenderMode->efbHeight);
GXSetDispCopyDst(RenderMode->fbWidth, RenderMode->xfbHeight);
GXSetDispCopyYScale((float)RenderMode->xfbHeight/(float)RenderMode->efbHeight);
GXSetCopyFilter(RenderMode->aa, RenderMode->sample_pattern, GX_TRUE, RenderMode->vfilter);
if(RenderMode->aa) {
GXSetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
} else {
GXSetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
}
GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
GXSetDispCopyGamma(GX_GM_1_0);
}
static void InitMem()
{
void *arena_lo = OSGetArenaLo();
void *arena_hi = OSGetArenaHi();
u32 fb_size = (u16)(((u16)RenderMode->fbWidth+15) & ~15)*RenderMode->xfbHeight*2;
DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo);
DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1+fb_size);
DemoCurrentBuffer = DemoFrameBuffer2;
arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2+fb_size);
OSSetArenaLo(arena_lo);
if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) {
LoadMemInfo();
} else {
arena_lo = OSGetArenaLo();
arena_hi = OSGetArenaHi();
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
OSSetArenaLo(arena_lo);
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi));
arena_lo = arena_hi;
OSSetArenaLo(arena_lo);
}
}
static void InitVI()
{
u32 interlace;
VISetNextFrameBuffer(DemoFrameBuffer1);
DemoCurrentBuffer = DemoFrameBuffer2;
VIFlush();
VIWaitForRetrace();
interlace = RenderMode->viTVmode & 0x1;
if(interlace) {
VIWaitForRetrace();
}
}
void HuSysBeforeRender()
{
if(RenderMode->field_rendering) {
GXSetViewportJitter(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1, VIGetNextField());
} else {
GXSetViewport(0, 0, RenderMode->fbWidth, RenderMode->xfbHeight, 0, 1);
}
GXInvalidateVtxCache();
GXInvalidateTexAll();
}
void HuSysDoneRender(s32 retrace_count)
{
int retrace_dist;
if(DemoStatEnable) {
GXDrawDone();
DEMOUpdateStats(1);
DEMOPrintStats();
GXDrawDone();
DEMOUpdateStats(0);
}
GXSetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
GXSetColorUpdate(GX_TRUE);
GXDrawDone();
GXCopyDisp(DemoCurrentBuffer, GX_TRUE);
if(minimumVcount != 0) {
retrace_dist = VIGetRetraceCount()-retrace_count;
if(worstVcount < retrace_dist) {
worstVcount = retrace_dist;
}
while(VIGetRetraceCount()-retrace_count < minimumVcount-1) {
VIWaitForRetrace();
}
}
SwapBuffers();
}
static void SwapBuffers()
{
VISetNextFrameBuffer(DemoCurrentBuffer);
if(FirstFrame) {
VISetBlack(GX_FALSE);
FirstFrame = FALSE;
}
VIFlush();
VIWaitForRetrace();
if(DemoCurrentBuffer == DemoFrameBuffer1) {
DemoCurrentBuffer = DemoFrameBuffer2;
} else {
DemoCurrentBuffer = DemoFrameBuffer1;
}
}
static void LoadMemInfo()
{
u32 size;
u32 copy_size;
u32 offset;
u32 entries;
u32 i;
void *arena_lo;
void *arena_hi;
void *alloc_max;
void *alloc_min;
struct memory_info *buf_ptr;
DVDFileInfo file;
char buf[240];
OSReport("\nNow, try to find memory info file...\n\n");
if(!DVDOpen("/meminfo.bin", &file)) {
OSReport("\nCan't find memory info file. Use /XXX toolname/ to maximize available\n");
OSReport("memory space. For now, we only use the first %dMB.\n", (OSGetConsoleSimulatedMemSize()/1024)/1024);
arena_lo = OSGetArenaLo();
arena_hi = OSGetArenaHi();
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
OSSetArenaLo(arena_lo);
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
arena_lo = arena_hi;
OSSetArenaLo(arena_lo);
} else {
buf_ptr = (struct memory_info *)OSRoundUp32B((u32)buf);
alloc_max = OSGetArenaHi();
alloc_min = (void *)(OSGetConsoleSimulatedMemSize()+0x80000000);
OSSetArenaHi((void *)(OSGetPhysicalMemSize()+0x80000000));
arena_lo = OSGetArenaLo();
arena_hi = OSGetArenaHi();
arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
OSSetArenaLo(arena_lo);
arena_lo = (void *)OSRoundUp32B((u32)arena_lo);
arena_hi = (void *)OSRoundDown32B((u32)arena_hi);
OSSetCurrentHeap(OSCreateHeap(arena_lo, arena_hi));
arena_lo = arena_hi;
OSSetArenaLo(arena_lo);
OSAllocFixed(&alloc_max, &alloc_min);
size = file.length;
offset = 0;
while(size) {
OSReport("loop\n");
copy_size = (size < 32) ? size : 32;
if(DVDRead(&file, buf_ptr, OSRoundUp32B(copy_size), offset) < 0) {
OSPanic("init.c", 576, "An error occurred when issuing read to /meminfo.bin\n");
}
entries = copy_size/sizeof(struct memory_info);
for(i=0; i<entries; i++) {
OSReport("start: 0x%08x, end: 0x%08x\n", buf_ptr[i].start, buf_ptr[i].end);
OSAllocFixed(&buf_ptr[i].start, &buf_ptr[i].end);
OSReport("Removed 0x%08x - 0x%08x from the current heap\n", buf_ptr[i].start, (u32)buf_ptr[i].end-1);
}
size -= copy_size;
offset += copy_size;
}
DVDClose(&file);
OSDumpHeap(__OSCurrHeap);
}
}

View file

@ -10,7 +10,7 @@ void HuMemInitAll(void)
void *ptr;
u32 free_size;
for(i=0; i<4; i++) {
ptr = OSAllocFromHeap(__OSCurrHeap, HeapSizeTbl[i]);
ptr = OSAlloc(HeapSizeTbl[i]);
if(ptr == NULL) {
OSReport("HuMem> Failed OSAlloc Size:%d\n", HeapSizeTbl[i]);
return;
@ -19,7 +19,7 @@ void HuMemInitAll(void)
}
free_size = OSCheckHeap(currentHeapHandle);
OSReport("HuMem> left memory space %dKB(%d)\n", free_size/1024, free_size);
ptr = OSAllocFromHeap(__OSCurrHeap, free_size);
ptr = OSAlloc(free_size);
if(ptr == NULL) {
OSReport("HuMem> Failed OSAlloc left space\n");
return;