diff --git a/config/RSBE01_02/splits.txt b/config/RSBE01_02/splits.txt index be2790d8d..ae7658cab 100644 --- a/config/RSBE01_02/splits.txt +++ b/config/RSBE01_02/splits.txt @@ -55,6 +55,12 @@ sora/gf/gf_callback.cpp: sora/gf/gf_decomp.cpp: .text start:0x8001A48C end:0x8001A5C0 +sora/gf/gf_error_manager.cpp: + .text start:0x8001AF08 end:0x8001B574 + .sdata start:0x8059C500 end:0x8059C508 + .sbss start:0x8059FFD0 end:0x8059FFD4 + .sdata2 start:0x805A1480 end:0x805A14B0 + sora/gf/gf_error_check.cpp: .text start:0x8001B574 end:0x8001B784 .ctors start:0x804064EC end:0x804064F0 diff --git a/config/RSBE01_02/symbols.txt b/config/RSBE01_02/symbols.txt index 5f17c9853..48785336e 100644 --- a/config/RSBE01_02/symbols.txt +++ b/config/RSBE01_02/symbols.txt @@ -2112,7 +2112,7 @@ __dla__FPv = .text:0x8000C8DC; // type:function size:0x4 srSystemGetRevisionNumber__Fv = .text:0x8000C8E0; // type:function size:0x8 main = .text:0x8000C8E8; // type:function size:0x78 scope:global fn_8000C960 = .text:0x8000C960; // type:function size:0x38 -fn_8000C998 = .text:0x8000C998; // type:function size:0x40 +__dt__Q34nw4r2ut5ColorFv = .text:0x8000C998; // type:function size:0x40 fn_8000C9D8 = .text:0x8000C9D8; // type:function size:0x504 fn_8000CEDC = .text:0x8000CEDC; // type:function size:0xC fn_8000CEE8 = .text:0x8000CEE8; // type:function size:0x40 @@ -2302,7 +2302,7 @@ draw__18gfCameraControllerFv = .text:0x8001A3A4; // type:function size:0x8 add__14gfCallBackListFP10gfCallBack = .text:0x8001A3AC; // type:function size:0x30 remove__14gfCallBackListFP10gfCallBack = .text:0x8001A3DC; // type:function size:0x64 process__14gfCallBackListFv = .text:0x8001A440; // type:function size:0x4C -decomp__8gfDecompFPC8CXStreamPv = .text:0x8001A48C; // type:function size:0x134 +decomp__8gfDecompFPC8CXStreamUl = .text:0x8001A48C; // type:function size:0x134 gfDrawSetVtxPosColorPrimEnvironment__Fv = .text:0x8001A5C0; // type:function size:0x1EC gfDrawSetVtxPosColorTexPrimEnvironment__Fv = .text:0x8001A7AC; // type:function size:0x1D4 gfDrawResetLight__Fv = .text:0x8001A980; // type:function size:0x108 @@ -2313,11 +2313,11 @@ fn_8001AC98 = .text:0x8001AC98; // type:function size:0x2C fn_8001ACC4 = .text:0x8001ACC4; // type:function size:0x158 fn_8001AE1C = .text:0x8001AE1C; // type:function size:0xEC getInstance__14gfErrorManagerFv = .text:0x8001AF08; // type:function size:0x48 -fn_8001AF50 = .text:0x8001AF50; // type:function size:0x38 -fn_8001AF88 = .text:0x8001AF88; // type:function size:0xF4 -fn_8001B07C = .text:0x8001B07C; // type:function size:0x64 -fn_8001B0E0 = .text:0x8001B0E0; // type:function size:0x164 -fn_8001B244 = .text:0x8001B244; // type:function size:0x12C +create__14gfErrorManagerFv = .text:0x8001AF50; // type:function size:0x38 +__ct__14gfErrorManagerFv = .text:0x8001AF88; // type:function size:0xF4 +update__14gfErrorManagerFv = .text:0x8001B07C; // type:function size:0x64 +renderPre__14gfErrorManagerFv = .text:0x8001B0E0; // type:function size:0x164 +render__14gfErrorManagerFv = .text:0x8001B244; // type:function size:0x12C notifyError__14gfErrorManagerFUlUl = .text:0x8001B370; // type:function size:0x13C notifyErrorRecovery__14gfErrorManagerFb = .text:0x8001B4AC; // type:function size:0xC8 init__12gfErrorCheckFv = .text:0x8001B574; // type:function size:0xC @@ -2783,8 +2783,8 @@ fn_800367C8 = .text:0x800367C8; // type:function size:0x64 fn_8003682C = .text:0x8003682C; // type:function size:0x5C fn_80036888 = .text:0x80036888; // type:function size:0x40 fn_800368C8 = .text:0x800368C8; // type:function size:0x254 -fn_80036B1C = .text:0x80036B1C; // type:function size:0x80 -fn_80036B9C = .text:0x80036B9C; // type:function size:0x58 +start__10gfHomeMenuFv = .text:0x80036B1C; // type:function size:0x80 +kill__10gfHomeMenuFv = .text:0x80036B9C; // type:function size:0x58 fn_80036BF4 = .text:0x80036BF4; // type:function size:0x2C fn_80036C20 = .text:0x80036C20; // type:function size:0x3C fn_80036C5C = .text:0x80036C5C; // type:function size:0x274 @@ -2796,7 +2796,7 @@ fn_800377D4 = .text:0x800377D4; // type:function size:0x2C fn_80037800 = .text:0x80037800; // type:function size:0x18C fn_8003798C = .text:0x8003798C; // type:function size:0x258 fn_80037BE4 = .text:0x80037BE4; // type:function size:0x160 -fn_80037D44 = .text:0x80037D44; // type:function size:0x68 +setBan__10gfHomeMenuFUlUl = .text:0x80037D44; // type:function size:0x68 fn_80037DAC = .text:0x80037DAC; // type:function size:0x1C fn_80037DC8 = .text:0x80037DC8; // type:function size:0x8 fn_80037DD0 = .text:0x80037DD0; // type:function size:0x94 @@ -3612,14 +3612,14 @@ __dt__7MessageFv = .text:0x80069860; // type:function size:0x110 setCursorX__7MessageFf = .text:0x80069970; // type:function size:0xC0 setCursorY__7MessageFf = .text:0x80069A30; // type:function size:0xC0 setWindow__7MessageFffff = .text:0x80069AF0; // type:function size:0x154 -fn_80069C44 = .text:0x80069C44; // type:function size:0x38 +setCallProjection__7MessageFUc = .text:0x80069C44; // type:function size:0x38 fn_80069C7C = .text:0x80069C7C; // type:function size:0x8C fn_80069D08 = .text:0x80069D08; // type:function size:0x38 printf__7MessageFPCce = .text:0x80069D40; // type:function size:0xFC fn_80069E3C = .text:0x80069E3C; // type:function size:0xA0 fn_80069EDC = .text:0x80069EDC; // type:function size:0x50 fn_80069F2C = .text:0x80069F2C; // type:function size:0x70 -fn_80069F9C = .text:0x80069F9C; // type:function size:0x7C +setScale__7MessageFf = .text:0x80069F9C; // type:function size:0x7C setScale__7MessageFff = .text:0x8006A018; // type:function size:0x9C fn_8006A0B4 = .text:0x8006A0B4; // type:function size:0x4C fn_8006A100 = .text:0x8006A100; // type:function size:0x70 @@ -3631,7 +3631,7 @@ fn_8006A3A8 = .text:0x8006A3A8; // type:function size:0xC8 fn_8006A470 = .text:0x8006A470; // type:function size:0x18 fn_8006A488 = .text:0x8006A488; // type:function size:0xC8 setFace__7MessageFUc = .text:0x8006A550; // type:function size:0x38 -fn_8006A588 = .text:0x8006A588; // type:function size:0x78 +setDrawFlag__7MessageFUlUl = .text:0x8006A588; // type:function size:0x78 setFixedWidth__7MessageFf = .text:0x8006A600; // type:function size:0x74 changeMsgBuf__7MessageFi = .text:0x8006A674; // type:function size:0x34 fn_8006A6A8 = .text:0x8006A6A8; // type:function size:0xA8 @@ -3640,10 +3640,10 @@ fn_8006A76C = .text:0x8006A76C; // type:function size:0x17C fn_8006A8E8 = .text:0x8006A8E8; // type:function size:0x7C fn_8006A964 = .text:0x8006A964; // type:function size:0x1BC SetEdge__Q22ms10CharWriterFfQ34nw4r2ut5Color = .text:0x8006AB20; // type:function size:0x28 -fn_8006AB48 = .text:0x8006AB48; // type:function size:0x580 +printMsgBuf__7MessageFQ28FontData13FONT_RESOURCE = .text:0x8006AB48; // type:function size:0x580 fn_8006B0C8 = .text:0x8006B0C8; // type:function size:0x6C getPrintIndexData__7MessageFPvUlPPcPUl = .text:0x8006B134; // type:function size:0x28 -fn_8006B15C = .text:0x8006B15C; // type:function size:0x204 +drawBoxLine__7MessageFlllfffff = .text:0x8006B15C; // type:function size:0x204 fn_8006B360 = .text:0x8006B360; // type:function size:0xA0 allocMsgBuf__7MessageFUlUlQ25Heaps8HeapType = .text:0x8006B400; // type:function size:0x118 attachMsgBuf__7MessageFUlPQ34nw4r3g3d12ScnMdlSimplePCcUcif = .text:0x8006B518; // type:function size:0x100 @@ -3664,7 +3664,7 @@ fn_8006C620 = .text:0x8006C620; // type:function size:0x3C fn_8006C65C = .text:0x8006C65C; // type:function size:0x44 fn_8006C6A0 = .text:0x8006C6A0; // type:function size:0x3C fn_8006C6DC = .text:0x8006C6DC; // type:function size:0x44 -fn_8006C720 = .text:0x8006C720; // type:function size:0x3C +loadAlertFont__8FontDataFPv = .text:0x8006C720; // type:function size:0x3C fn_8006C75C = .text:0x8006C75C; // type:function size:0x34 fn_8006C790 = .text:0x8006C790; // type:function size:0x44 fn_8006C7D4 = .text:0x8006C7D4; // type:function size:0x9C @@ -3701,7 +3701,7 @@ fn_8006EBC8 = .text:0x8006EBC8; // type:function size:0x4 __ct__Q22ms10CharWriterFv = .text:0x8006EBCC; // type:function size:0x250 __dt__Q22ms10CharWriterFv = .text:0x8006EE1C; // type:function size:0x40 fn_8006EE5C = .text:0x8006EE5C; // type:function size:0x78 -fn_8006EED4 = .text:0x8006EED4; // type:function size:0x10 +SetFont__Q22ms10CharWriterFRCQ34nw4r2ut7ResFont = .text:0x8006EED4; // type:function size:0x10 GetFont__Q22ms10CharWriterCFv = .text:0x8006EEE4; // type:function size:0x8 SetupGXWithColorMapping__Q22ms10CharWriterFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x8006EEEC; // type:function size:0xA58 SetColorMapping__Q22ms10CharWriterFQ34nw4r2ut5ColorQ34nw4r2ut5Color = .text:0x8006F944; // type:function size:0x44 @@ -3806,9 +3806,9 @@ fn_800765B0 = .text:0x800765B0; // type:function size:0xC4 fn_80076674 = .text:0x80076674; // type:function size:0xA0 fn_80076714 = .text:0x80076714; // type:function size:0x14C fn_80076860 = .text:0x80076860; // type:function size:0x198 -fn_800769F8 = .text:0x800769F8; // type:function size:0x74 +specialPause__9sndSystemFv = .text:0x800769F8; // type:function size:0x74 fn_80076A6C = .text:0x80076A6C; // type:function size:0x194 -fn_80076C00 = .text:0x80076C00; // type:function size:0x78 +specialResume__9sndSystemFv = .text:0x80076C00; // type:function size:0x78 fn_80076C78 = .text:0x80076C78; // type:function size:0x88 fn_80076D00 = .text:0x80076D00; // type:function size:0x130 fn_80076E30 = .text:0x80076E30; // type:function size:0x100 @@ -3977,13 +3977,13 @@ fn_8007EF68 = .text:0x8007EF68; // type:function size:0x8 fn_8007EF70 = .text:0x8007EF70; // type:function size:0x1D8 fn_8007F148 = .text:0x8007F148; // type:function size:0x14 fn_8007F15C = .text:0x8007F15C; // type:function size:0x78 -fn_8007F1D4 = .text:0x8007F1D4; // type:function size:0x64 -fn_8007F238 = .text:0x8007F238; // type:function size:0x40 -fn_8007F278 = .text:0x8007F278; // type:function size:0x8 +setPause__13mvMoviePlayerFv = .text:0x8007F1D4; // type:function size:0x64 +resetPause__13mvMoviePlayerFv = .text:0x8007F238; // type:function size:0x40 +isPause__13mvMoviePlayerCFv = .text:0x8007F278; // type:function size:0x8 fn_8007F280 = .text:0x8007F280; // type:function size:0x34 fn_8007F2B4 = .text:0x8007F2B4; // type:function size:0x14 fn_8007F2C8 = .text:0x8007F2C8; // type:function size:0xDC -fn_8007F3A4 = .text:0x8007F3A4; // type:function size:0x8 +getInstance__13mvMoviePlayerFv = .text:0x8007F3A4; // type:function size:0x8 fn_8007F3AC = .text:0x8007F3AC; // type:function size:0x58 fn_8007F404 = .text:0x8007F404; // type:function size:0x1EC fn_8007F5F0 = .text:0x8007F5F0; // type:function size:0x50 @@ -9144,8 +9144,8 @@ fn_801EFF28 = .text:0x801EFF28; // type:function size:0x26C fn_801F0194 = .text:0x801F0194; // type:function size:0x74 fn_801F0208 = .text:0x801F0208; // type:function size:0x40 fn_801F0248 = .text:0x801F0248; // type:function size:0x10 -fn_801F0258 = .text:0x801F0258; // type:function size:0x228 -fn_801F0480 = .text:0x801F0480; // type:function size:0x24 +GXSetTexCoordGen2 = .text:0x801F0258; // type:function size:0x228 +GXSetNumTexGens = .text:0x801F0480; // type:function size:0x24 GXSetMisc = .text:0x801F04A4; // type:function size:0x8C scope:global fn_801F0530 = .text:0x801F0530; // type:function size:0x5C fn_801F058C = .text:0x801F058C; // type:function size:0x34 @@ -9211,8 +9211,8 @@ fn_801F240C = .text:0x801F240C; // type:function size:0xC fn_801F2418 = .text:0x801F2418; // type:function size:0x7C fn_801F2494 = .text:0x801F2494; // type:function size:0xD8 fn_801F256C = .text:0x801F256C; // type:function size:0xD8 -fn_801F2644 = .text:0x801F2644; // type:function size:0x24 -fn_801F2668 = .text:0x801F2668; // type:function size:0xA4 +GXSetNumChans = .text:0x801F2644; // type:function size:0x24 +GXSetChanCtrl = .text:0x801F2668; // type:function size:0xA4 fn_801F270C = .text:0x801F270C; // type:function size:0x124 fn_801F2830 = .text:0x801F2830; // type:function size:0xC0 fn_801F28F0 = .text:0x801F28F0; // type:function size:0x20C @@ -9248,12 +9248,12 @@ fn_801F3750 = .text:0x801F3750; // type:function size:0x68 fn_801F37B8 = .text:0x801F37B8; // type:function size:0x154 fn_801F390C = .text:0x801F390C; // type:function size:0x104 fn_801F3A10 = .text:0x801F3A10; // type:function size:0xCC -fn_801F3ADC = .text:0x801F3ADC; // type:function size:0x20 +GXSetNumIndStages = .text:0x801F3ADC; // type:function size:0x20 fn_801F3AFC = .text:0x801F3AFC; // type:function size:0x48 fn_801F3B44 = .text:0x801F3B44; // type:function size:0x4 __GXSetIndirectMask = .text:0x801F3B48; // type:function size:0x30 scope:global __GXFlushTextureState = .text:0x801F3B78; // type:function size:0x24 scope:global -fn_801F3B9C = .text:0x801F3B9C; // type:function size:0x94 +GXSetTevOp = .text:0x801F3B9C; // type:function size:0x94 fn_801F3C30 = .text:0x801F3C30; // type:function size:0x40 fn_801F3C70 = .text:0x801F3C70; // type:function size:0x40 fn_801F3CB0 = .text:0x801F3CB0; // type:function size:0x58 @@ -9267,16 +9267,16 @@ fn_801F3F20 = .text:0x801F3F20; // type:function size:0x3C fn_801F3F5C = .text:0x801F3F5C; // type:function size:0x7C GXSetAlphaCompare = .text:0x801F3FD8; // type:function size:0x38 fn_801F4010 = .text:0x801F4010; // type:function size:0x8C -fn_801F409C = .text:0x801F409C; // type:function size:0x15C -fn_801F41F8 = .text:0x801F41F8; // type:function size:0x24 -fn_801F421C = .text:0x801F421C; // type:function size:0x22C +GXSetTevOrder = .text:0x801F409C; // type:function size:0x15C +GXSetNumTevStages = .text:0x801F41F8; // type:function size:0x24 +GXSetFog = .text:0x801F421C; // type:function size:0x22C fn_801F4448 = .text:0x801F4448; // type:function size:0x160 fn_801F45A8 = .text:0x801F45A8; // type:function size:0x124 -fn_801F46CC = .text:0x801F46CC; // type:function size:0x50 +GXSetBlendMode = .text:0x801F46CC; // type:function size:0x50 fn_801F471C = .text:0x801F471C; // type:function size:0x2C fn_801F4748 = .text:0x801F4748; // type:function size:0x2C GXSetZMode = .text:0x801F4774; // type:function size:0x34 -fn_801F47A8 = .text:0x801F47A8; // type:function size:0x30 +GXSetZCompLoc = .text:0x801F47A8; // type:function size:0x30 fn_801F47D8 = .text:0x801F47D8; // type:function size:0xA8 fn_801F4880 = .text:0x801F4880; // type:function size:0x2C fn_801F48AC = .text:0x801F48AC; // type:function size:0x30 @@ -17630,7 +17630,7 @@ lbl_80420E38 = .data:0x80420E38; // type:object size:0x64 data:string lbl_80420E9C = .data:0x80420E9C; // type:object size:0x3A data:string lbl_80420ED8 = .data:0x80420ED8; // type:object size:0x65 data:string lbl_80420F40 = .data:0x80420F40; // type:object size:0x4D data:string -lbl_80420F90 = .data:0x80420F90; // type:object size:0x30 +g_ErrorMsgTable = .data:0x80420F90; // type:object size:0x30 lbl_80420FC0 = .data:0x80420FC0; // type:object size:0x36 data:string lbl_80420FF8 = .data:0x80420FF8; // type:object size:0x30 lbl_80421028 = .data:0x80421028; // type:object size:0x40 @@ -17835,7 +17835,7 @@ lbl_80423928 = .data:0x80423928; // type:object size:0xC lbl_80423934 = .data:0x80423934; // type:object size:0xC data:string lbl_80423940 = .data:0x80423940; // type:object size:0x18 lbl_80423958 = .data:0x80423958; // type:object size:0x28 -lbl_80423980 = .data:0x80423980; // type:object size:0x7450 noreloc +g_LZEncodedAlertFont = .data:0x80423980; // type:object size:0x7450 noreloc __vt__15gfMonitorThread = .data:0x8042ADD0; // type:object size:0x10 lbl_8042ADE0 = .data:0x8042ADE0; // type:object size:0x10 data:string lbl_8042ADF0 = .data:0x8042ADF0; // type:object size:0x18 @@ -27878,7 +27878,7 @@ lbl_80497DCC = .bss:0x80497DCC; // type:object size:0x28 lbl_80497DF4 = .bss:0x80497DF4; // type:object size:0x28 lbl_80497E1C = .bss:0x80497E1C; // type:object size:0x28 lbl_80497E44 = .bss:0x80497E44; // type:object size:0x28 -lbl_80497E6C = .bss:0x80497E6C; // type:object size:0x4C +g_AlertFont = .bss:0x80497E6C; // type:object size:0x4C lbl_80497EB8 = .bss:0x80497EB8; // type:object size:0x10 lbl_80497EC8 = .bss:0x80497EC8; // type:object size:0x10 data:4byte lbl_80497ED8 = .bss:0x80497ED8; // type:object size:0x28 @@ -30622,7 +30622,7 @@ lbl_8059FFB8 = .sbss:0x8059FFB8; // type:object size:0x4 data:4byte lbl_8059FFBC = .sbss:0x8059FFBC; // type:object size:0x1 data:byte lbl_8059FFC0 = .sbss:0x8059FFC0; // type:object size:0x8 data:4byte lbl_8059FFC8 = .sbss:0x8059FFC8; // type:object size:0x8 data:4byte -lbl_8059FFD0 = .sbss:0x8059FFD0; // type:object size:0x8 data:4byte +g_gfErrorManager = .sbss:0x8059FFD0; // type:object size:0x4 data:4byte lbl_8059FFD8 = .sbss:0x8059FFD8; // type:object size:0x4 data:4byte lbl_8059FFDC = .sbss:0x8059FFDC; // type:object size:0x1 data:byte lbl_8059FFE0 = .sbss:0x8059FFE0; // type:object size:0x4 data:4byte @@ -30655,7 +30655,7 @@ lbl_805A0070 = .sbss:0x805A0070; // type:object size:0x8 align:8 data:4byte lbl_805A0078 = .sbss:0x805A0078; // type:object size:0x8 data:4byte s_needsUpdate = .sbss:0x805A0080; // type:object size:0x8 data:byte lbl_805A0088 = .sbss:0x805A0088; // type:object size:0x8 data:4byte -lbl_805A0090 = .sbss:0x805A0090; // type:object size:0x8 data:4byte +g_gfHomeMenu = .sbss:0x805A0090; // type:object size:0x8 data:4byte lbl_805A0098 = .sbss:0x805A0098; // type:object size:0x8 data:4byte g_unk805a00a0__32@unnamed@gf_system_callback_cpp@ = .sbss:0x805A00A0; // type:object size:0x8 scope:local data:4byte lbl_805A00A8 = .sbss:0x805A00A8; // type:object size:0x2 data:2byte diff --git a/configure.py b/configure.py index f3a84fbea..a2e5dba0a 100755 --- a/configure.py +++ b/configure.py @@ -299,6 +299,7 @@ def MatchingFor(*versions): Object(Matching, "sora/gf/gf_camera_controller.cpp"), Object(Matching, "sora/gf/gf_callback.cpp"), Object(Matching, "sora/gf/gf_decomp.cpp"), + Object(Matching, "sora/gf/gf_error_manager.cpp"), Object(Matching, "sora/gf/gf_error_check.cpp"), Object(Matching, "sora/gf/gf_file_io_handle.cpp"), Object(Matching, "sora/gf/gf_file_io_request.cpp"), diff --git a/include/lib/BrawlHeaders b/include/lib/BrawlHeaders index e2a1c10f4..a0118ed9c 160000 --- a/include/lib/BrawlHeaders +++ b/include/lib/BrawlHeaders @@ -1 +1 @@ -Subproject commit e2a1c10f40de4d3b5a2a375717da871f061080c7 +Subproject commit a0118ed9c02c21fe8acf1e1a85bb99271c761e35 diff --git a/src/sora/gf/gf_decomp.cpp b/src/sora/gf/gf_decomp.cpp index f057ad0cf..4273fb89b 100644 --- a/src/sora/gf/gf_decomp.cpp +++ b/src/sora/gf/gf_decomp.cpp @@ -3,20 +3,20 @@ #include #include -void gfDecomp::decomp(const CXStream* src, void* dest) { +void gfDecomp::decomp(const CXStream* src, u32 streamLen) { if (!m_ready) { m_algo = static_cast(src->m_type << 4); - m_uncompSize = CXGetUncompressedSize(src); - unk8 = gfMemoryPool::alloc(m_heapAddr, m_uncompSize, 0x20); + m_decompSize = CXGetUncompressedSize(src); + m_decompData = gfMemoryPool::alloc(m_heapAddr, m_decompSize, 0x20); switch (m_algo) { case CompressionAlgo::RL: - CXInitUncompContextRL(&m_ctx, unk8); + CXInitUncompContextRL(&m_ctx, m_decompData); break; case CompressionAlgo::LZ: - CXInitUncompContextLZ(&m_ctx, unk8); + CXInitUncompContextLZ(&m_ctx, m_decompData); break; case CompressionAlgo::Huffman: - CXInitUncompContextHuffman(&m_ctx, unk8); + CXInitUncompContextHuffman(&m_ctx, m_decompData); break; default: break; @@ -25,13 +25,13 @@ void gfDecomp::decomp(const CXStream* src, void* dest) { } switch (m_algo) { case CompressionAlgo::RL: - CXReadUncompRL(&m_ctx, src, dest); + CXReadUncompRL(&m_ctx, src, streamLen); break; case CompressionAlgo::LZ: - CXReadUncompLZ(&m_ctx, src, dest); + CXReadUncompLZ(&m_ctx, src, streamLen); break; case CompressionAlgo::Huffman: - CXReadUncompHuffman(&m_ctx, src, dest); + CXReadUncompHuffman(&m_ctx, src, streamLen); break; default: break; diff --git a/src/sora/gf/gf_error_check.cpp b/src/sora/gf/gf_error_check.cpp index 3f51f45a6..9132eff7b 100644 --- a/src/sora/gf/gf_error_check.cpp +++ b/src/sora/gf/gf_error_check.cpp @@ -14,31 +14,31 @@ void gfErrorCheck::init() { void gfErrorCheck::check() { s32 status = DVDGetDriveStatus(); - u32 r31; + u32 errCode; bool r30 = false; if (status == -1) { r30 = true; - r31 = 4; + errCode = 4; } else if (status == 4) { r30 = true; - r31 = 1; + errCode = 1; } else if (status == 11) { r30 = true; - r31 = 3; + errCode = 3; } else if (status == 6) { r30 = true; - r31 = 2; + errCode = 2; } else { const DVDDiskID* id1 = DVDGetCurrentDiskID(); const DVDDiskID* id2 = gfFileIO::getDVDDiskId(); if (true != DVDCompareDiskID(id1, id2)) { r30 = true; - r31 = 2; + errCode = 2; } } if (r30) { - gfErrorManager::getInstance()->notifyError(r31, 0); + gfErrorManager::getInstance()->notifyError(errCode, 0); } else { gfErrorManager::getInstance()->notifyErrorRecovery(false); } diff --git a/src/sora/gf/gf_error_manager.cpp b/src/sora/gf/gf_error_manager.cpp new file mode 100644 index 000000000..41e8a6a1b --- /dev/null +++ b/src/sora/gf/gf_error_manager.cpp @@ -0,0 +1,143 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// TODO: These belong to different files +// .data start:0x80423980 end:0x8042ADD0 +extern CXStream g_LZEncodedAlertFont; +extern nw4r::ut::ResFont g_AlertFont; +extern const char* g_ErrorMsgTable[12]; + +static gfErrorManager* g_gfErrorManager; + +gfErrorManager* gfErrorManager::getInstance() { + if (!g_gfErrorManager) + g_gfErrorManager = new (Heaps::SystemFW) gfErrorManager; + return g_gfErrorManager; +} + +gfErrorManager* gfErrorManager::create() { + g_gfErrorManager = new (Heaps::SystemFW) gfErrorManager; + return g_gfErrorManager; +} + +gfErrorManager::gfErrorManager() : + m_isFatal(false), + m_isSuspended(false), + m_unused(false), + m_isMoviePaused(false), + m_msgBgColor(nw4r::ut::Color::WHITE), + m_msgTextColor(nw4r::ut::Color::WHITE) +{ + m_errorCode = 0; + m_reasonCode = 0; + m_msgScreen = new (Heaps::SystemFW) Message(0x400, Heaps::SystemFW); + + m_msgBgColor.Set(0xDE, 0xF3, 0xD7, 0xFF); + m_msgTextColor.Set(0x8B, 0xB6, 0x7D, 0xFF); + + gfDecomp dec(gfHeapManager::getHeap(Heaps::GameGlobal)); + dec.decomp(&g_LZEncodedAlertFont, 0x741E); + m_fontData = dec.m_decompData; + FontData::loadAlertFont(m_fontData); +} + +void gfErrorManager::update() { + if (m_isSuspended) { + if (m_updateDone == 0) { + g_gfPadSystem->stopMotorAllForce(); + g_gfHomeMenu->setBan(1, 4); + } + m_updateDone++; + } +} + +void gfErrorManager::renderPre() { + Message* msg = m_msgScreen; + Message::drawBoxLine(m_msgBgColor, 0, 0, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f); + msg->SetFont(g_AlertFont); + msg->changeMsgBuf(-1); + msg->clearMsgBuf(); + msg->setFace(7); + msg->setFixedWidth(-1.0); + if (true == g_GameGlobal->getGlobalRecordMenuDatap()->m_isWidescreen) + msg->setScale(0.65f, 0.845f); + else + msg->setScale(0.65f); + msg->setCallProjection(0); + msg->setWindow(20.0f, 100.0f, 620.0f, 380.0f); + msg->setDrawFlag(0x101, 0x303); + msg->setColor(m_msgTextColor); + const char* msgText = g_ErrorMsgTable[m_errorCode]; + if (0 == m_reasonCode) + msg->printf(msgText); + else { + msg->printf(msgText); + msg->printf("\n\n%d", m_reasonCode); + } +} + +void gfErrorManager::render() { + Message* msg = m_msgScreen; + GXColor white; + white.b = 255; + white.a = 255; + white.g = 255; + white.r = 255; + GXSetFog(GX_FOG_NONE, white, 0.0f, 1000.0f, 1.0f, 1000.0f); + GXSetNumTevStages(1); + GXSetNumIndStages(0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE); + GXSetNumChans(1); + GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_NONE, GX_AF_NONE); + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, 60, false, 125); + GXSetZCompLoc(true); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR); + GXSetZMode(false, GX_ALWAYS, false); + GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_AND, GX_ALWAYS, 0); + msg->printMsgBuf(FontData::FONT_ALERT); +} + +void gfErrorManager::notifyError(u32 errorCode, u32 reasonCode) { + bool res; + notifyErrorHelper(res, errorCode); + if (res) { + m_reasonCode = reasonCode; + m_errorCode = errorCode; + } + if (!isRecoverable(m_errorCode)) { + m_isFatal = true; + g_gfShutdownManager.unkC = 0; + } +} + +void gfErrorManager::notifyErrorRecovery(bool skip) { + if (m_isSuspended && !m_isFatal && !skip && isRecoverable(m_errorCode)) { + m_isSuspended = false; + m_updateDone = 0; + g_gfHomeMenu->setBan(0, 4); + if (mvMoviePlayer::getInstance()) { + if (!m_isMoviePaused) + mvMoviePlayer::getInstance()->resetPause(); + m_isMoviePaused = false; + } + if (g_sndSystem) + g_sndSystem->specialResume(); + if (g_gfHomeMenu) + g_gfHomeMenu->start(); + } +} diff --git a/src/sora/gf/gf_shutdown_manager.cpp b/src/sora/gf/gf_shutdown_manager.cpp index 623fd3a00..1c84d31ad 100644 --- a/src/sora/gf/gf_shutdown_manager.cpp +++ b/src/sora/gf/gf_shutdown_manager.cpp @@ -36,9 +36,7 @@ void gfShutdownManager::enterReturnToWiiMenuProcess() { void gfShutdownManager::update() { if (m_reset || m_powerOff || m_returnToWiiMenu) { if (unkC && unkD) { - if (!unk0_b3 && - (gfErrorManager::getInstance()->unk0_b6 != true || - gfErrorManager::getInstance()->unk0_b7)) { + if (!unk0_b3 && (gfErrorManager::getInstance()->m_isSuspended != true || gfErrorManager::getInstance()->m_isFatal)) { unk8.add(gmSysSave::create(Heaps::GlobalMode)); unk0_b3 = true; }