diff --git a/config/DZDE01/splits.txt b/config/DZDE01/splits.txt index 0b8742abc4..998705545d 100644 --- a/config/DZDE01/splits.txt +++ b/config/DZDE01/splits.txt @@ -3313,7 +3313,7 @@ revolution/sc/scsystem.c: .data start:0x80401E40 end:0x80401FC0 .bss start:0x804B1DE0 end:0x804B9F80 .sdata start:0x804FA640 end:0x804FA718 - .sbss start:0x804FB91C end:0x804FB934 + .sbss start:0x804FB91C end:0x804FB930 revolution/sc/scapi.c: .text start:0x8033D99C end:0x8033DD18 @@ -3330,7 +3330,7 @@ revolution/wenc/wenc.c: revolution/ipc/ipcMain.c: .text start:0x8033E1E0 end:0x8033E264 - .sbss start:0x804FB934 end:0x804FB948 + .sbss start:0x804FB930 end:0x804FB948 revolution/ipc/ipcclt.c: .text start:0x8033E264 end:0x8033F964 diff --git a/config/DZDE01/symbols.txt b/config/DZDE01/symbols.txt index 65740d5d35..1e1d37818a 100644 --- a/config/DZDE01/symbols.txt +++ b/config/DZDE01/symbols.txt @@ -27821,7 +27821,7 @@ ItemIDOffsetTblOffset = .sbss:0x804FB928; // type:object size:0x4 scope:global a IsDevKit = .sbss:0x804FB92C; // type:object size:0x1 scope:local data:byte lbl_804FB92D = .sbss:0x804FB92D; // type:object size:0x1 data:byte Initialized = .sbss:0x804FB92E; // type:object size:0x1 scope:local data:byte -lbl_804FB930 = .sbss:0x804FB930; // type:object size:0x1 data:byte +Initialized = .sbss:0x804FB930; // type:object size:0x1 scope:local data:byte IPCCurrentBufferLo = .sbss:0x804FB934; // type:object size:0x4 scope:global align:4 data:4byte IPCCurrentBufferHi = .sbss:0x804FB938; // type:object size:0x4 scope:global align:4 data:4byte IPCBufferLo = .sbss:0x804FB93C; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDE01_00/splits.txt b/config/RZDE01_00/splits.txt index c0cdb64a1b..b7e09572c2 100644 --- a/config/RZDE01_00/splits.txt +++ b/config/RZDE01_00/splits.txt @@ -3444,16 +3444,16 @@ revolution/ax/AXCL.c: .text start:0x80369114 end:0x80369144 .sbss start:0x8053B7B0 end:0x8053B7B8 -revolution/ax/AXFXReverbHi.c: +revolution/axfx/AXFXReverbHi.c: .text start:0x80369144 end:0x803691D0 .sdata2 start:0x80540560 end:0x80540568 -revolution/ax/AXFXReverbHiExp.c: +revolution/axfx/AXFXReverbHiExp.c: .text start:0x803691D0 end:0x80369FA8 .data start:0x8043FD60 end:0x8043FF00 .sdata2 start:0x80540568 end:0x805405A8 -revolution/ax/AXFXHooks.c: +revolution/axfx/AXFXHooks.c: .text start:0x80369FA8 end:0x80369FE0 .sdata start:0x8053A418 end:0x8053A420 @@ -3564,7 +3564,7 @@ revolution/sc/scsystem.c: .data start:0x804404C0 end:0x80440640 .bss start:0x804F1B40 end:0x804F9CE0 .sdata start:0x8053A480 end:0x8053A558 - .sbss start:0x8053B7F4 end:0x8053B80C + .sbss start:0x8053B7F4 end:0x8053B808 revolution/sc/scapi.c: .text start:0x80375134 end:0x80375514 @@ -3586,7 +3586,7 @@ revolution/arc/arc.c: revolution/ipc/ipcMain.c: .text start:0x80375EE8 end:0x80375F6C - .sbss start:0x8053B80C end:0x8053B820 + .sbss start:0x8053B808 end:0x8053B820 revolution/ipc/ipcclt.c: .text start:0x80375F6C end:0x8037766C diff --git a/config/RZDE01_00/symbols.txt b/config/RZDE01_00/symbols.txt index 69888bcfa4..dedd6b1d15 100644 --- a/config/RZDE01_00/symbols.txt +++ b/config/RZDE01_00/symbols.txt @@ -13324,8 +13324,8 @@ CalcLineRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut GetCharStrmReader__Q36nw4hbm2ut4FontCFv = .text:0x802CA230; // type:function size:0x148 scope:global align:4 AllocStringBuffer__Q36nw4hbm3lyt7TextBoxFUs = .text:0x802CA378; // type:function size:0x78 scope:global align:4 FreeStringBuffer__Q36nw4hbm3lyt7TextBoxFv = .text:0x802CA3F0; // type:function size:0x48 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUs = .text:0x802CA438; // type:function size:0x68 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUsUs = .text:0x802CA4A0; // type:function size:0x140 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUs = .text:0x802CA438; // type:function size:0x68 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUsUs = .text:0x802CA4A0; // type:function size:0x140 scope:global align:4 __dt__Q36nw4hbm2ut4FontFv = .text:0x802CA5E0; // type:function size:0x40 scope:global align:4 GetTextDrawRect__Q36nw4hbm3lyt7TextBoxCFPQ36nw4hbm2ut17TextWriterBase = .text:0x802CA620; // type:function size:0x614 scope:global align:4 CalcStringRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut17TextWriterBasePCwif_v = .text:0x802CAC34; // type:function size:0x438 scope:global align:4 @@ -13454,12 +13454,12 @@ GetCharSpace__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802DD8BC; // type:fun GetTabWidth__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802DD9D4; // type:function size:0x118 scope:global align:4 SetTagProcessor__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut19TagProcessorBase = .text:0x802DDAEC; // type:function size:0x210 scope:global align:4 GetTagProcessor__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802DDCFC; // type:function size:0x118 scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802DDE14; // type:function size:0x438 scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_t = .text:0x802DE24C; // type:function size:0x540 scope:global align:4 -CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802DE78C; // type:function size:0x1068 scope:global align:4 -CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802DF7F4; // type:function size:0x3F0 scope:global align:4 -PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802DFBE4; // type:function size:0x1550 scope:global align:4 -AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPC7wchar_ti = .text:0x802E1134; // type:function size:0xDFC scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802DDE14; // type:function size:0x438 scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCw = .text:0x802DE24C; // type:function size:0x540 scope:global align:4 +CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802DE78C; // type:function size:0x1068 scope:global align:4 +CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802DF7F4; // type:function size:0x3F0 scope:global align:4 +PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802DFBE4; // type:function size:0x1550 scope:global align:4 +AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPCwi = .text:0x802E1134; // type:function size:0xDFC scope:global align:4 __sinit_\ut_TextWriterBase_cpp = .text:0x802E1F30; // type:function size:0x84 scope:local align:4 __ct__7JKRHeapFPvUlP7JKRHeapb = .text:0x802E1FB4; // type:function size:0x118 scope:global align:4 __dt__17JSULink<7JKRHeap>Fv = .text:0x802E20CC; // type:function size:0x5C scope:global align:4 @@ -23436,14 +23436,14 @@ __vt__Q36nw4hbm3lyt16ResourceAccessor = .data:0x804280E0; // type:object size:0x @10603 = .data:0x80428450; // type:object size:0x19 scope:local align:4 data:string __vt__Q36nw4hbm3lyt7TextBox = .data:0x8042846C; // type:object size:0x74 scope:global align:4 @STRING@GetCharStrmReader__Q36nw4hbm2ut4FontCFv@0 = .data:0x804284E0; // type:object size:0x35 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@6 = .data:0x80428518; // type:object size:0x37 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@5 = .data:0x80428550; // type:object size:0x11 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@4 = .data:0x80428564; // type:object size:0x37 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@3 = .data:0x8042859C; // type:object size:0x11 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@2 = .data:0x804285B0; // type:object size:0x49 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@1 = .data:0x804285FC; // type:object size:0x11 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t@0 = .data:0x80428610; // type:object size:0x35 scope:global align:4 data:string -@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPC7wchar_t = .data:0x80428648; // type:object size:0x11 scope:local align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@6 = .data:0x80428518; // type:object size:0x37 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@5 = .data:0x80428550; // type:object size:0x11 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@4 = .data:0x80428564; // type:object size:0x37 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@3 = .data:0x8042859C; // type:object size:0x11 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@2 = .data:0x804285B0; // type:object size:0x49 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@1 = .data:0x804285FC; // type:object size:0x11 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw@0 = .data:0x80428610; // type:object size:0x35 scope:global align:4 data:string +@STRING@Set__Q36nw4hbm2ut14CharStrmReaderFPCw = .data:0x80428648; // type:object size:0x11 scope:local align:4 data:string @STRING@GetCurrentPos__Q36nw4hbm2ut14CharStrmReaderCFv@0 = .data:0x8042865C; // type:object size:0x35 scope:global align:4 data:string @STRING@GetCurrentPos__Q36nw4hbm2ut14CharStrmReaderCFv = .data:0x80428694; // type:object size:0x11 scope:local align:4 data:string @STRING@Next__Q36nw4hbm2ut14CharStrmReaderFv@0 = .data:0x804286A8; // type:object size:0x35 scope:global align:4 data:string @@ -25945,7 +25945,7 @@ Type = .bss:0x804F9EE0; // type:object size:0x10 scope:local align:4 CmdProbeDevice = .bss:0x804F9EF0; // type:object size:0x10 scope:global align:4 data:4byte pre_status$889 = .bss:0x804F9F00; // type:object size:0x30 scope:local align:4 ...bss.0 = .bss:0x804F9F40; // type:label scope:local align:4 -_managerAlarm = .bss:0x804F9F40; // type:object size:0x30 scope:global align:4 +_managerAlarm = .bss:0x804F9F40; // type:object size:0x30 scope:global align:32 _wpdcb = .bss:0x804F9F70; // type:object size:0x10 scope:global align:4 data:4byte __WPADiManageHandlerStack = .bss:0x804F9F80; // type:object size:0x1000 scope:global align:4 _dev_handle_index = .bss:0x804FAF80; // type:object size:0x10 scope:global align:4 data:byte @@ -29004,7 +29004,7 @@ ItemIDOffsetTblOffset = .sbss:0x8053B800; // type:object size:0x4 scope:global a IsDevKit = .sbss:0x8053B804; // type:object size:0x1 scope:local data:byte lbl_8053B805 = .sbss:0x8053B805; // type:object size:0x1 data:byte Initialized = .sbss:0x8053B806; // type:object size:0x1 scope:local data:byte -lbl_8053B808 = .sbss:0x8053B808; // type:object size:0x1 data:byte +Initialized = .sbss:0x8053B808; // type:object size:0x1 scope:local data:byte IPCCurrentBufferLo = .sbss:0x8053B80C; // type:object size:0x4 scope:global align:4 data:4byte IPCCurrentBufferHi = .sbss:0x8053B810; // type:object size:0x4 scope:global align:4 data:4byte IPCBufferLo = .sbss:0x8053B814; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDE01_02/splits.txt b/config/RZDE01_02/splits.txt index f1bd931354..2b9ad69111 100644 --- a/config/RZDE01_02/splits.txt +++ b/config/RZDE01_02/splits.txt @@ -3406,16 +3406,16 @@ revolution/ax/AXCL.c: .text start:0x80353B4C end:0x80353B7C .sbss start:0x805217A8 end:0x805217B0 -revolution/ax/AXFXReverbHi.c: +revolution/axfx/AXFXReverbHi.c: .text start:0x80353B7C end:0x80353C08 .sdata2 start:0x805265E0 end:0x805265E8 -revolution/ax/AXFXReverbHiExp.c: +revolution/axfx/AXFXReverbHiExp.c: .text start:0x80353C08 end:0x803549E0 .data start:0x80427240 end:0x804273E0 .sdata2 start:0x805265E8 end:0x80526628 -revolution/ax/AXFXHooks.c: +revolution/axfx/AXFXHooks.c: .text start:0x803549E0 end:0x80354A18 .sdata start:0x80520428 end:0x80520430 @@ -3526,7 +3526,7 @@ revolution/sc/scsystem.c: .data start:0x804279A0 end:0x80427B20 .bss start:0x804D7BC0 end:0x804DFD60 .sdata start:0x80520490 end:0x80520568 - .sbss start:0x805217EC end:0x80521804 + .sbss start:0x805217EC end:0x80521800 revolution/sc/scapi.c: .text start:0x8035FB6C end:0x8035FF4C @@ -3548,7 +3548,7 @@ revolution/arc/arc.c: revolution/ipc/ipcMain.c: .text start:0x80360920 end:0x803609A4 - .sbss start:0x80521804 end:0x80521818 + .sbss start:0x80521800 end:0x80521818 revolution/ipc/ipcclt.c: .text start:0x803609A4 end:0x803620A4 diff --git a/config/RZDE01_02/symbols.txt b/config/RZDE01_02/symbols.txt index d75f75161d..b12bf52937 100644 --- a/config/RZDE01_02/symbols.txt +++ b/config/RZDE01_02/symbols.txt @@ -13256,8 +13256,8 @@ CalcLineRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut GetCharStrmReader__Q36nw4hbm2ut4FontCFv = .text:0x802C5090; // type:function size:0x38 scope:global align:4 AllocStringBuffer__Q36nw4hbm3lyt7TextBoxFUs = .text:0x802C50C8; // type:function size:0x78 scope:global align:4 FreeStringBuffer__Q36nw4hbm3lyt7TextBoxFv = .text:0x802C5140; // type:function size:0x48 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUs = .text:0x802C5188; // type:function size:0x68 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUsUs = .text:0x802C51F0; // type:function size:0xC8 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUs = .text:0x802C5188; // type:function size:0x68 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUsUs = .text:0x802C51F0; // type:function size:0xC8 scope:global align:4 __dt__Q36nw4hbm2ut4FontFv = .text:0x802C52B8; // type:function size:0x40 scope:global align:4 GetTextDrawRect__Q36nw4hbm3lyt7TextBoxCFPQ36nw4hbm2ut17TextWriterBase = .text:0x802C52F8; // type:function size:0x328 scope:global align:4 CalcStringRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut17TextWriterBasePCwif_v = .text:0x802C5620; // type:function size:0x160 scope:global align:4 @@ -13380,12 +13380,12 @@ GetCharSpace__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB12C; // type:fun GetTabWidth__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB134; // type:function size:0x8 scope:global align:4 SetTagProcessor__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut19TagProcessorBase = .text:0x802CB13C; // type:function size:0x8 scope:global align:4 GetTagProcessor__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB144; // type:function size:0x8 scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CB14C; // type:function size:0x21C scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_t = .text:0x802CB368; // type:function size:0x238 scope:global align:4 -CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CB5A0; // type:function size:0x3C0 scope:global align:4 -CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CB960; // type:function size:0x124 scope:global align:4 -PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CBA84; // type:function size:0x744 scope:global align:4 -AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPC7wchar_ti = .text:0x802CC1C8; // type:function size:0x738 scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CB14C; // type:function size:0x21C scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCw = .text:0x802CB368; // type:function size:0x238 scope:global align:4 +CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CB5A0; // type:function size:0x3C0 scope:global align:4 +CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CB960; // type:function size:0x124 scope:global align:4 +PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CBA84; // type:function size:0x744 scope:global align:4 +AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPCwi = .text:0x802CC1C8; // type:function size:0x738 scope:global align:4 __sinit_\ut_TextWriterBase_cpp = .text:0x802CC900; // type:function size:0x84 scope:global align:4 __ct__7JKRHeapFPvUlP7JKRHeapb = .text:0x802CC984; // type:function size:0x118 scope:global align:4 __dt__17JSULink<7JKRHeap>Fv = .text:0x802CCA9C; // type:function size:0x5C scope:global align:4 @@ -25491,7 +25491,7 @@ Type = .bss:0x804DFF60; // type:object size:0x10 scope:local align:4 CmdProbeDevice = .bss:0x804DFF70; // type:object size:0x10 scope:global align:4 data:4byte pre_status$889 = .bss:0x804DFF80; // type:object size:0x30 scope:global align:4 ...bss.0 = .bss:0x804DFFC0; // type:label scope:local align:4 -_managerAlarm = .bss:0x804DFFC0; // type:object size:0x30 scope:global align:4 +_managerAlarm = .bss:0x804DFFC0; // type:object size:0x30 scope:global align:32 _wpdcb = .bss:0x804DFFF0; // type:object size:0x10 scope:global align:4 data:4byte __WPADiManageHandlerStack = .bss:0x804E0000; // type:object size:0x1000 scope:global align:4 _dev_handle_index = .bss:0x804E1000; // type:object size:0x10 scope:global align:4 data:byte @@ -28524,7 +28524,7 @@ ItemIDOffsetTblOffset = .sbss:0x805217F8; // type:object size:0x4 scope:global a IsDevKit = .sbss:0x805217FC; // type:object size:0x1 scope:local data:byte lbl_805217FD = .sbss:0x805217FD; // type:object size:0x1 data:byte Initialized = .sbss:0x805217FE; // type:object size:0x1 scope:local data:byte -lbl_80521800 = .sbss:0x80521800; // type:object size:0x1 data:byte +Initialized = .sbss:0x80521800; // type:object size:0x1 scope:local data:byte IPCCurrentBufferLo = .sbss:0x80521804; // type:object size:0x4 scope:global align:4 data:4byte IPCCurrentBufferHi = .sbss:0x80521808; // type:object size:0x4 scope:global align:4 data:4byte IPCBufferLo = .sbss:0x8052180C; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDJ01/splits.txt b/config/RZDJ01/splits.txt index d60dba5171..a8fefcda66 100644 --- a/config/RZDJ01/splits.txt +++ b/config/RZDJ01/splits.txt @@ -3402,16 +3402,16 @@ revolution/ax/AXCL.c: .text start:0x80355604 end:0x80355634 .sbss start:0x8051F618 end:0x8051F620 -revolution/ax/AXFXReverbHi.c: +revolution/axfx/AXFXReverbHi.c: .text start:0x80355634 end:0x803556C0 .sdata2 start:0x80524438 end:0x80524440 -revolution/ax/AXFXReverbHiExp.c: +revolution/axfx/AXFXReverbHiExp.c: .text start:0x803556C0 end:0x80356498 .data start:0x804250C0 end:0x80425260 .sdata2 start:0x80524440 end:0x80524480 -revolution/ax/AXFXHooks.c: +revolution/axfx/AXFXHooks.c: .text start:0x80356498 end:0x803564D0 .sdata start:0x8051E298 end:0x8051E2A0 @@ -3522,7 +3522,7 @@ revolution/sc/scsystem.c: .data start:0x80425820 end:0x804259A0 .bss start:0x804D5A40 end:0x804DDBE0 .sdata start:0x8051E300 end:0x8051E3D8 - .sbss start:0x8051F65C end:0x8051F674 + .sbss start:0x8051F65C end:0x8051F670 revolution/sc/scapi.c: .text start:0x80361624 end:0x80361A04 @@ -3544,7 +3544,7 @@ revolution/arc/arc.c: revolution/ipc/ipcMain.c: .text start:0x803623D8 end:0x8036245C - .sbss start:0x8051F674 end:0x8051F688 + .sbss start:0x8051F670 end:0x8051F688 revolution/ipc/ipcclt.c: .text start:0x8036245C end:0x80363B5C diff --git a/config/RZDJ01/symbols.txt b/config/RZDJ01/symbols.txt index 77fb7850ca..0a05fcbb32 100644 --- a/config/RZDJ01/symbols.txt +++ b/config/RZDJ01/symbols.txt @@ -13261,8 +13261,8 @@ CalcLineRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut GetCharStrmReader__Q36nw4hbm2ut4FontCFv = .text:0x802C6BB0; // type:function size:0x38 scope:global align:4 AllocStringBuffer__Q36nw4hbm3lyt7TextBoxFUs = .text:0x802C6BE8; // type:function size:0x78 scope:global align:4 FreeStringBuffer__Q36nw4hbm3lyt7TextBoxFv = .text:0x802C6C60; // type:function size:0x48 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUs = .text:0x802C6CA8; // type:function size:0x68 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUsUs = .text:0x802C6D10; // type:function size:0xC8 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUs = .text:0x802C6CA8; // type:function size:0x68 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUsUs = .text:0x802C6D10; // type:function size:0xC8 scope:global align:4 __dt__Q36nw4hbm2ut4FontFv = .text:0x802C6DD8; // type:function size:0x40 scope:global align:4 GetTextDrawRect__Q36nw4hbm3lyt7TextBoxCFPQ36nw4hbm2ut17TextWriterBase = .text:0x802C6E18; // type:function size:0x328 scope:global align:4 CalcStringRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut17TextWriterBasePCwif_v = .text:0x802C7140; // type:function size:0x160 scope:global align:4 @@ -13385,12 +13385,12 @@ GetCharSpace__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CCC4C; // type:fun GetTabWidth__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CCC54; // type:function size:0x8 scope:global align:4 SetTagProcessor__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut19TagProcessorBase = .text:0x802CCC5C; // type:function size:0x8 scope:global align:4 GetTagProcessor__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CCC64; // type:function size:0x8 scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CCC6C; // type:function size:0x21C scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_t = .text:0x802CCE88; // type:function size:0x238 scope:global align:4 -CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CD0C0; // type:function size:0x3C0 scope:global align:4 -CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CD480; // type:function size:0x124 scope:global align:4 -PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CD5A4; // type:function size:0x744 scope:global align:4 -AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPC7wchar_ti = .text:0x802CDCE8; // type:function size:0x738 scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CCC6C; // type:function size:0x21C scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCw = .text:0x802CCE88; // type:function size:0x238 scope:global align:4 +CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CD0C0; // type:function size:0x3C0 scope:global align:4 +CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CD480; // type:function size:0x124 scope:global align:4 +PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CD5A4; // type:function size:0x744 scope:global align:4 +AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPCwi = .text:0x802CDCE8; // type:function size:0x738 scope:global align:4 __sinit_\ut_TextWriterBase_cpp = .text:0x802CE420; // type:function size:0x84 scope:global align:4 __ct__7JKRHeapFPvUlP7JKRHeapb = .text:0x802CE4A4; // type:function size:0x118 scope:global align:4 __dt__17JSULink<7JKRHeap>Fv = .text:0x802CE5BC; // type:function size:0x5C scope:global align:4 @@ -25493,7 +25493,7 @@ Type = .bss:0x804DDDE0; // type:object size:0x10 scope:local align:4 CmdProbeDevice = .bss:0x804DDDF0; // type:object size:0x10 scope:global align:4 data:4byte pre_status$889 = .bss:0x804DDE00; // type:object size:0x30 scope:local align:4 ...bss.0 = .bss:0x804DDE40; // type:label scope:local align:4 -_managerAlarm = .bss:0x804DDE40; // type:object size:0x30 scope:global align:4 +_managerAlarm = .bss:0x804DDE40; // type:object size:0x30 scope:global align:32 _wpdcb = .bss:0x804DDE70; // type:object size:0x10 scope:global align:4 data:4byte __WPADiManageHandlerStack = .bss:0x804DDE80; // type:object size:0x1000 scope:global align:4 _dev_handle_index = .bss:0x804DEE80; // type:object size:0x10 scope:global align:4 data:byte @@ -28528,7 +28528,7 @@ ItemIDOffsetTblOffset = .sbss:0x8051F668; // type:object size:0x4 scope:global a IsDevKit = .sbss:0x8051F66C; // type:object size:0x1 scope:local data:byte lbl_8051F66D = .sbss:0x8051F66D; // type:object size:0x1 data:byte Initialized = .sbss:0x8051F66E; // type:object size:0x1 scope:local data:byte -lbl_8051F670 = .sbss:0x8051F670; // type:object size:0x1 data:byte +Initialized = .sbss:0x8051F670; // type:object size:0x1 scope:local data:byte IPCCurrentBufferLo = .sbss:0x8051F674; // type:object size:0x4 scope:global align:4 data:4byte IPCCurrentBufferHi = .sbss:0x8051F678; // type:object size:0x4 scope:global align:4 data:4byte IPCBufferLo = .sbss:0x8051F67C; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/RZDP01/splits.txt b/config/RZDP01/splits.txt index 9f7823a2b4..9af9f07411 100644 --- a/config/RZDP01/splits.txt +++ b/config/RZDP01/splits.txt @@ -3402,16 +3402,16 @@ revolution/ax/AXCL.c: .text start:0x80353F7C end:0x80353FAC .sbss start:0x80521F68 end:0x80521F70 -revolution/ax/AXFXReverbHi.c: +revolution/axfx/AXFXReverbHi.c: .text start:0x80353FAC end:0x80354038 .sdata2 start:0x80526DB0 end:0x80526DB8 -revolution/ax/AXFXReverbHiExp.c: +revolution/axfx/AXFXReverbHiExp.c: .text start:0x80354038 end:0x80354E10 .data start:0x80427B40 end:0x80427CE0 .sdata2 start:0x80526DB8 end:0x80526DF8 -revolution/ax/AXFXHooks.c: +revolution/axfx/AXFXHooks.c: .text start:0x80354E10 end:0x80354E48 .sdata start:0x80520BD0 end:0x80520BD8 @@ -3522,7 +3522,7 @@ revolution/sc/scsystem.c: .data start:0x804282A0 end:0x80428420 .bss start:0x804D84C0 end:0x804E0660 .sdata start:0x80520C38 end:0x80520D10 - .sbss start:0x80521FAC end:0x80521FC4 + .sbss start:0x80521FAC end:0x80521FC0 revolution/sc/scapi.c: .text start:0x8035FF9C end:0x803603D0 @@ -3544,7 +3544,7 @@ revolution/arc/arc.c: revolution/ipc/ipcMain.c: .text start:0x80360DA4 end:0x80360E28 - .sbss start:0x80521FC4 end:0x80521FD8 + .sbss start:0x80521FC0 end:0x80521FD8 revolution/ipc/ipcclt.c: .text start:0x80360E28 end:0x80362528 diff --git a/config/RZDP01/symbols.txt b/config/RZDP01/symbols.txt index 086364676b..8b3bd7f9b4 100644 --- a/config/RZDP01/symbols.txt +++ b/config/RZDP01/symbols.txt @@ -13256,8 +13256,8 @@ CalcLineRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut GetCharStrmReader__Q36nw4hbm2ut4FontCFv = .text:0x802C54C0; // type:function size:0x38 scope:global align:4 AllocStringBuffer__Q36nw4hbm3lyt7TextBoxFUs = .text:0x802C54F8; // type:function size:0x78 scope:global align:4 FreeStringBuffer__Q36nw4hbm3lyt7TextBoxFv = .text:0x802C5570; // type:function size:0x48 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUs = .text:0x802C55B8; // type:function size:0x68 scope:global align:4 -SetString__Q36nw4hbm3lyt7TextBoxFPC7wchar_tUsUs = .text:0x802C5620; // type:function size:0xC8 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUs = .text:0x802C55B8; // type:function size:0x68 scope:global align:4 +SetString__Q36nw4hbm3lyt7TextBoxFPCwUsUs = .text:0x802C5620; // type:function size:0xC8 scope:global align:4 __dt__Q36nw4hbm2ut4FontFv = .text:0x802C56E8; // type:function size:0x40 scope:global align:4 GetTextDrawRect__Q36nw4hbm3lyt7TextBoxCFPQ36nw4hbm2ut17TextWriterBase = .text:0x802C5728; // type:function size:0x328 scope:global align:4 CalcStringRectImpl__25@unnamed@lyt_textBox_cpp@FPQ36nw4hbm2ut4RectPQ36nw4hbm2ut17TextWriterBasePCwif_v = .text:0x802C5A50; // type:function size:0x160 scope:global align:4 @@ -13380,12 +13380,12 @@ GetCharSpace__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB55C; // type:fun GetTabWidth__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB564; // type:function size:0x8 scope:global align:4 SetTagProcessor__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut19TagProcessorBase = .text:0x802CB56C; // type:function size:0x8 scope:global align:4 GetTagProcessor__Q36nw4hbm2ut17TextWriterBaseCFv = .text:0x802CB574; // type:function size:0x8 scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CB57C; // type:function size:0x21C scope:global align:4 -Print__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_t = .text:0x802CB798; // type:function size:0x238 scope:global align:4 -CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CB9D0; // type:function size:0x3C0 scope:global align:4 -CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPC7wchar_ti = .text:0x802CBD90; // type:function size:0x124 scope:global align:4 -PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPC7wchar_ti = .text:0x802CBEB4; // type:function size:0x744 scope:global align:4 -AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPC7wchar_ti = .text:0x802CC5F8; // type:function size:0x738 scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CB57C; // type:function size:0x21C scope:global align:4 +Print__Q36nw4hbm2ut17TextWriterBaseFPCw = .text:0x802CB798; // type:function size:0x238 scope:global align:4 +CalcLineRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CB9D0; // type:function size:0x3C0 scope:global align:4 +CalcStringRectImpl__Q36nw4hbm2ut17TextWriterBaseFPQ36nw4hbm2ut4RectPCwi = .text:0x802CBD90; // type:function size:0x124 scope:global align:4 +PrintImpl__Q36nw4hbm2ut17TextWriterBaseFPCwi = .text:0x802CBEB4; // type:function size:0x744 scope:global align:4 +AdjustCursor__Q36nw4hbm2ut17TextWriterBaseFPfPfPCwi = .text:0x802CC5F8; // type:function size:0x738 scope:global align:4 __sinit_\ut_TextWriterBase_cpp = .text:0x802CCD30; // type:function size:0x84 scope:global align:4 __ct__7JKRHeapFPvUlP7JKRHeapb = .text:0x802CCDB4; // type:function size:0x118 scope:global align:4 __dt__17JSULink<7JKRHeap>Fv = .text:0x802CCECC; // type:function size:0x5C scope:global align:4 @@ -25487,7 +25487,7 @@ Type = .bss:0x804E0860; // type:object size:0x10 scope:local align:4 CmdProbeDevice = .bss:0x804E0870; // type:object size:0x10 scope:global align:4 data:4byte pre_status$889 = .bss:0x804E0880; // type:object size:0x30 scope:local align:4 ...bss.0 = .bss:0x804E08C0; // type:label scope:local align:4 -_managerAlarm = .bss:0x804E08C0; // type:object size:0x30 scope:global align:4 +_managerAlarm = .bss:0x804E08C0; // type:object size:0x30 scope:global align:32 _wpdcb = .bss:0x804E08F0; // type:object size:0x10 scope:global align:4 data:4byte __WPADiManageHandlerStack = .bss:0x804E0900; // type:object size:0x1000 scope:global align:4 _dev_handle_index = .bss:0x804E1900; // type:object size:0x10 scope:global align:4 data:byte @@ -28415,7 +28415,7 @@ ItemIDOffsetTblOffset = .sbss:0x80521FB8; // type:object size:0x4 scope:global a IsDevKit = .sbss:0x80521FBC; // type:object size:0x1 scope:local data:byte lbl_80521FBD = .sbss:0x80521FBD; // type:object size:0x1 data:byte Initialized = .sbss:0x80521FBE; // type:object size:0x1 scope:local data:byte -lbl_80521FC0 = .sbss:0x80521FC0; // type:object size:0x1 data:byte +Initialized = .sbss:0x80521FC0; // type:object size:0x1 scope:local data:byte IPCCurrentBufferLo = .sbss:0x80521FC4; // type:object size:0x4 scope:global align:4 data:4byte IPCCurrentBufferHi = .sbss:0x80521FC8; // type:object size:0x4 scope:global align:4 data:4byte IPCBufferLo = .sbss:0x80521FCC; // type:object size:0x4 scope:global align:4 data:4byte diff --git a/config/Shield/splits.txt b/config/Shield/splits.txt index 394ecc2449..4021d5ea41 100644 --- a/config/Shield/splits.txt +++ b/config/Shield/splits.txt @@ -2412,7 +2412,7 @@ revolution/gf/GFPixel.cpp: revolution/gf/GFTev.cpp: .text start:0x803611A0 end:0x80361200 -revolution/hbm/HBMBase.cpp: +revolution/homebuttonLib/nw4hbm/HBMBase.cpp: .text start:0x80361200 end:0x803699C0 .rodata start:0x804A93A0 end:0x804A9650 .data start:0x804E11B0 end:0x804E1D58 @@ -2421,95 +2421,95 @@ revolution/hbm/HBMBase.cpp: .sdata2 start:0x8050DF50 end:0x8050DFB0 .bss start:0x8057EEA8 end:0x8057EEB8 -revolution/hbm/HBMAnmController.cpp: +revolution/homebuttonLib/nw4hbm/HBMAnmController.cpp: .text start:0x803699C0 end:0x80369AD0 .data start:0x804E1D58 end:0x804E1D68 -revolution/hbm/HBMFrameController.cpp: +revolution/homebuttonLib/nw4hbm/HBMFrameController.cpp: .text start:0x80369AD0 end:0x80369C80 .sdata2 start:0x8050DFB0 end:0x8050DFB8 -revolution/hbm/HBMGUIManager.cpp: +revolution/homebuttonLib/nw4hbm/HBMGUIManager.cpp: .text start:0x80369C80 end:0x8036B120 .data start:0x804E1D68 end:0x804E1EC0 .sbss start:0x805091C0 end:0x805091C8 .sdata2 start:0x8050DFB8 end:0x8050DFC8 -revolution/hbm/HBMController.cpp: +revolution/homebuttonLib/nw4hbm/HBMController.cpp: .text start:0x8036B120 end:0x8036B9F0 .sbss start:0x805091C8 end:0x805091D0 .sdata2 start:0x8050DFC8 end:0x8050DFD8 .bss start:0x8057EEB8 end:0x8057F048 -revolution/hbm/HBMRemoteSpk.cpp: +revolution/homebuttonLib/nw4hbm/HBMRemoteSpk.cpp: .text start:0x8036B9F0 end:0x8036C170 .data start:0x804E1EC0 end:0x804E1ED0 .sbss start:0x805091D0 end:0x805091D8 -revolution/hbm/db_DbgPrintBase.cpp: +revolution/homebuttonLib/nw4hbm/db_DbgPrintBase.cpp: .text start:0x8036C170 end:0x8036C1B0 -revolution/hbm/lyt_animation.cpp: +revolution/homebuttonLib/nw4hbm/lyt_animation.cpp: .text start:0x8036C1B0 end:0x8036CD40 .data start:0x804E1ED0 end:0x804E1EF0 .sdata2 start:0x8050DFD8 end:0x8050DFF8 -revolution/hbm/lyt_arcResourceAccessor.cpp: +revolution/homebuttonLib/nw4hbm/lyt_arcResourceAccessor.cpp: .text start:0x8036CD40 end:0x8036D0C0 .data start:0x804E1EF0 end:0x804E1F08 .sdata start:0x80507DA8 end:0x80507DB0 -revolution/hbm/lyt_bounding.cpp: +revolution/homebuttonLib/nw4hbm/lyt_bounding.cpp: .text start:0x8036D0C0 end:0x8036D1F0 .ctors start:0x8048E688 end:0x8048E68C .data start:0x804E1F08 end:0x804E1F70 .sbss start:0x805091D8 end:0x805091E8 -revolution/hbm/lyt_common.cpp: +revolution/homebuttonLib/nw4hbm/lyt_common.cpp: .text start:0x8036D1F0 end:0x8036E050 .sdata2 start:0x8050DFF8 end:0x8050E008 .bss start:0x8057F048 end:0x8057F068 -revolution/hbm/lyt_drawInfo.cpp: +revolution/homebuttonLib/nw4hbm/lyt_drawInfo.cpp: .text start:0x8036E050 end:0x8036E110 .data start:0x804E1F70 end:0x804E1F80 .sdata2 start:0x8050E008 end:0x8050E010 -revolution/hbm/lyt_group.cpp: +revolution/homebuttonLib/nw4hbm/lyt_group.cpp: .text start:0x8036E110 end:0x8036E450 .data start:0x804E1F80 end:0x804E1F90 -revolution/hbm/lyt_layout.cpp: +revolution/homebuttonLib/nw4hbm/lyt_layout.cpp: .text start:0x8036E450 end:0x8036EFD0 .data start:0x804E1F90 end:0x804E1FC8 .sbss start:0x805091E8 end:0x805091F0 .sdata2 start:0x8050E010 end:0x8050E018 -revolution/hbm/lyt_material.cpp: +revolution/homebuttonLib/nw4hbm/lyt_material.cpp: .text start:0x8036EFD0 end:0x803721E0 .data start:0x804E1FC8 end:0x804E2030 .sdata2 start:0x8050E018 end:0x8050E038 .sbss2 start:0x8050EFD0 end:0x8050EFD8 -revolution/hbm/lyt_pane.cpp: +revolution/homebuttonLib/nw4hbm/lyt_pane.cpp: .text start:0x803721E0 end:0x803732E0 .ctors start:0x8048E68C end:0x8048E690 .data start:0x804E2030 end:0x804E2098 .sbss start:0x805091F0 end:0x805091F8 .sdata2 start:0x8050E038 end:0x8050E058 -revolution/hbm/lyt_picture.cpp: +revolution/homebuttonLib/nw4hbm/lyt_picture.cpp: .text start:0x803732E0 end:0x80373830 .ctors start:0x8048E690 end:0x8048E694 .data start:0x804E2098 end:0x804E2108 .sbss start:0x805091F8 end:0x80509200 .sdata2 start:0x8050E058 end:0x8050E060 -revolution/hbm/lyt_resourceAccessor.cpp: +revolution/homebuttonLib/nw4hbm/lyt_resourceAccessor.cpp: .text start:0x80373830 end:0x80373890 .data start:0x804E2108 end:0x804E2120 -revolution/hbm/lyt_textBox.cpp: +revolution/homebuttonLib/nw4hbm/lyt_textBox.cpp: .text start:0x80373890 end:0x80374C90 .ctors start:0x8048E694 end:0x8048E698 .data start:0x804E2120 end:0x804E2198 @@ -2517,66 +2517,66 @@ revolution/hbm/lyt_textBox.cpp: .sbss start:0x80509200 end:0x80509208 .sdata2 start:0x8050E060 end:0x8050E078 -revolution/hbm/lyt_window.cpp: +revolution/homebuttonLib/nw4hbm/lyt_window.cpp: .text start:0x80374C90 end:0x80377210 .ctors start:0x8048E698 end:0x8048E69C .data start:0x804E2198 end:0x804E2250 .sbss start:0x80509208 end:0x80509214 .sdata2 start:0x8050E078 end:0x8050E090 -revolution/hbm/math_triangular.cpp: +revolution/homebuttonLib/nw4hbm/math_triangular.cpp: .text start:0x80377210 end:0x803774C0 .data start:0x804E2250 end:0x804E3368 .sdata2 start:0x8050E090 end:0x8050E0B0 -revolution/hbm/snd_SoundArchivePlayer.cpp: +revolution/homebuttonLib/nw4hbm/snd_SoundArchivePlayer.cpp: .text start:0x803774C0 end:0x803774D0 -revolution/hbm/snd_SoundHandle.cpp: +revolution/homebuttonLib/nw4hbm/snd_SoundHandle.cpp: .text start:0x803774D0 end:0x80377520 -revolution/hbm/snd_SoundPlayer.cpp: +revolution/homebuttonLib/nw4hbm/snd_SoundPlayer.cpp: .text start:0x80377520 end:0x803775A0 -revolution/hbm/snd_SoundStartable.cpp: +revolution/homebuttonLib/nw4hbm/snd_SoundStartable.cpp: .text start:0x803775A0 end:0x80377610 -revolution/hbm/ut_binaryFileFormat.cpp: +revolution/homebuttonLib/nw4hbm/ut_binaryFileFormat.cpp: .text start:0x80377610 end:0x80377690 -revolution/hbm/ut_CharStrmReader.cpp: +revolution/homebuttonLib/nw4hbm/ut_CharStrmReader.cpp: .text start:0x80377690 end:0x803777B0 -revolution/hbm/ut_CharWriter.cpp: +revolution/homebuttonLib/nw4hbm/ut_CharWriter.cpp: .text start:0x803777B0 end:0x80379120 .sbss start:0x80509214 end:0x80509218 .sdata2 start:0x8050E0B0 end:0x8050E0D0 .bss start:0x8057F068 end:0x8057F078 -revolution/hbm/ut_Font.cpp: +revolution/homebuttonLib/nw4hbm/ut_Font.cpp: .text start:0x80379120 end:0x803791D0 .data start:0x804E3368 end:0x804E3398 -revolution/hbm/ut_LinkList.cpp: +revolution/homebuttonLib/nw4hbm/ut_LinkList.cpp: .text start:0x803791D0 end:0x803792E0 -revolution/hbm/ut_list.cpp: +revolution/homebuttonLib/nw4hbm/ut_list.cpp: .text start:0x803792E0 end:0x80379450 -revolution/hbm/ut_ResFont.cpp: +revolution/homebuttonLib/nw4hbm/ut_ResFont.cpp: .text start:0x80379450 end:0x80379750 .data start:0x804E3398 end:0x804E33F0 -revolution/hbm/ut_ResFontBase.cpp: +revolution/homebuttonLib/nw4hbm/ut_ResFontBase.cpp: .text start:0x80379750 end:0x80379DA0 .data start:0x804E33F0 end:0x804E34B0 -revolution/hbm/ut_TagProcessorBase.cpp: +revolution/homebuttonLib/nw4hbm/ut_TagProcessorBase.cpp: .text start:0x80379DA0 end:0x8037A560 .data start:0x804E34B0 end:0x804E34D8 .sdata2 start:0x8050E0D0 end:0x8050E0D8 -revolution/hbm/ut_TextWriterBase.cpp: +revolution/homebuttonLib/nw4hbm/ut_TextWriterBase.cpp: .text start:0x8037A560 end:0x8037BAF0 .ctors start:0x8048E69C end:0x8048E6A0 .sbss start:0x80509218 end:0x80509228 @@ -3636,7 +3636,7 @@ revolution/sc/scsystem.c: .rodata start:0x804AE070 end:0x804AE0C8 .data start:0x804FC0D8 end:0x804FC2D0 .sdata start:0x80508608 end:0x80508718 - .sbss start:0x8050995C end:0x80509974 + .sbss start:0x8050995C end:0x80509970 .bss start:0x8059DB80 end:0x805A5D20 revolution/sc/scapi.c: @@ -3663,7 +3663,7 @@ revolution/esp/esp.c: revolution/ipc/ipcMain.c: .text start:0x804264A0 end:0x80426590 - .sbss start:0x80509974 end:0x80509988 + .sbss start:0x80509970 end:0x80509988 revolution/ipc/ipcclt.c: .text start:0x80426590 end:0x80427FF0 diff --git a/config/Shield/symbols.txt b/config/Shield/symbols.txt index d395c723a3..bce77f0328 100644 --- a/config/Shield/symbols.txt +++ b/config/Shield/symbols.txt @@ -22112,7 +22112,7 @@ __FilterSizeTable = .data:0x804F9F80; // type:object size:0xE0 scope:global hash @3935 = .data:0x804FA238; // type:object size:0x17 scope:local data:string hash:0x0C9F56A9 @2807 = .data:0x804FA260; // type:object size:0x47 scope:local data:string hash:0x0CA0F7A8 ...data.0 = .data:0x804FA260; // type:label scope:local -s_currentDir = .data:0x804FA2C0; // type:object size:0x40 scope:global hash:0xAD8D041F +s_currentDir = .data:0x804FA2C0; // type:object size:0x40 scope:global align:32 hash:0xAD8D041F s_shutdownFuncInfo = .data:0x804FA300; // type:object size:0x10 scope:global hash:0x31593411 @3814 = .data:0x804FA310; // type:object size:0x9 scope:local data:string hash:0x0C9F5B2B @3818 = .data:0x804FA31C; // type:object size:0xA scope:local data:string hash:0x0C9F5B27 @@ -26048,7 +26048,7 @@ ItemIDOffsetTblOffset = .sbss:0x80509968; // type:object size:0x4 scope:global d IsDevKit = .sbss:0x8050996C; // type:object size:0x1 scope:local data:byte hash:0x4316083E lbl_8050996D = .sbss:0x8050996D; // type:object size:0x1 data:byte hash:0x6C951F5B Initialized = .sbss:0x8050996E; // type:object size:0x1 scope:local data:byte hash:0x99FD6509 -lbl_80509970 = .sbss:0x80509970; // type:object size:0x1 data:byte hash:0x99FD6509 +Initialized = .sbss:0x80509970; // type:object size:0x1 scope:local data:byte hash:0x99FD6509 IPCCurrentBufferLo = .sbss:0x80509974; // type:object size:0x4 scope:global data:4byte hash:0xF2DFCBD5 IPCCurrentBufferHi = .sbss:0x80509978; // type:object size:0x4 scope:global data:4byte hash:0xF2DFCC57 IPCBufferLo = .sbss:0x8050997C; // type:object size:0x4 scope:global data:4byte hash:0xC4DB7D9C @@ -31196,7 +31196,7 @@ statusRegister = .bss:0x8059D7A0; // type:object size:0x20 scope:global data:4by controlRegister = .bss:0x8059D7C0; // type:object size:0x20 scope:global data:4byte hash:0xDB2D0FCB sRootList = .bss:0x8059D7E0; // type:object size:0xC scope:global hash:0xF7269392 sRootMutex = .bss:0x8059D7F0; // type:object size:0x18 scope:global hash:0xDBE30C41 -s_homeDir = .bss:0x8059D820; // type:object size:0x40 scope:global hash:0x784C1999 +s_homeDir = .bss:0x8059D820; // type:object size:0x40 scope:global align:32 hash:0x784C1999 s_message = .bss:0x8059D880; // type:object size:0x100 scope:global hash:0xD144DA22 ...bss.0 = .bss:0x8059D880; // type:label scope:local @LOCAL@asyncRoutine__FlPv@s_rBuf = .bss:0x8059D980; // type:object size:0x100 scope:local hash:0x4463FC93 dhash:0x98BE39E5 @@ -31219,9 +31219,9 @@ Origin = .bss:0x805A9960; // type:object size:0x30 scope:global hash:0xABFD7E11 ...bss.0 = .bss:0x805A9960; // type:label scope:local Type = .bss:0x805A9990; // type:object size:0x10 scope:local data:4byte hash:0x7C88247D CmdProbeDevice = .bss:0x805A99A0; // type:object size:0x10 scope:global data:4byte hash:0x37D18A3D -@LOCAL@SPEC2_MakeStatus__FlP9PADStatusPUl@pre_status@0 = .bss:0x805A99B0; // type:object size:0x30 scope:local hash:0xE44225C1 dhash:0x3BE688B3 -@LOCAL@PADRead__FP9PADStatus@pre_status@1 = .bss:0x805A99E0; // type:object size:0x30 scope:local data:2byte hash:0x44A5529C dhash:0x557AE609 -_wpadManageAlarm = .bss:0x805A9A20; // type:object size:0x30 scope:global hash:0x1F60ECAA +@LOCAL@SPEC2_MakeStatus__FlP9PADStatusPUl@pre_status = .bss:0x805A99B0; // type:object size:0x30 scope:local hash:0xE44225C1 dhash:0x3BE688B3 +@LOCAL@PADRead__FP9PADStatus@pre_status = .bss:0x805A99E0; // type:object size:0x30 scope:local data:2byte hash:0x44A5529C dhash:0x557AE609 +_wpadManageAlarm = .bss:0x805A9A20; // type:object size:0x30 scope:global align:32 hash:0x1F60ECAA ...bss.0 = .bss:0x805A9A20; // type:label scope:local __rvl_p_wpadcb = .bss:0x805A9A50; // type:object size:0x10 scope:global data:4byte hash:0xA5CEDF5E __wpadManageHandlerStack = .bss:0x805A9A60; // type:object size:0x1000 scope:global hash:0x7340F270 diff --git a/config/ShieldD/symbols.txt b/config/ShieldD/symbols.txt index a8099be5d3..53a109d7c5 100644 --- a/config/ShieldD/symbols.txt +++ b/config/ShieldD/symbols.txt @@ -63884,7 +63884,7 @@ __RTTI__9JORServer = .sdata:0x8074BC78; // type:object size:0x8 scope:global has @STRING@Element_toNode__Q27JGadget40TLinkList<24JOREventCallbackListNode,-4>FP24JOREventCallbackListNode@0 = .sdata:0x8074BC98; // type:object size:0x5 scope:local data:string hash:0xA2419FA3 dhash:0x580336D2 @STRING@removeEventCallbackListNode__9JORServerFP24JOREventCallbackListNode@2 = .sdata:0x8074BCA0; // type:object size:0x5 scope:local data:string hash:0xA51686A8 dhash:0x89BBD614 @STRING@removeEventCallbackListNode__9JORServerFP24JOREventCallbackListNode@0 = .sdata:0x8074BCA8; // type:object size:0x5 scope:local data:string hash:0xA51686AA dhash:0x89BBD614 -@10568 = .sdata:0x8074BCB0; // type:object size:0x2 scope:local hash:0xA0621CFF +@10568 = .sdata:0x8074BCB0; // type:object size:0x1 scope:local data:string hash:0xA0621CFF @10885 = .sdata:0x8074BCB8; // type:object size:0x8 scope:local data:string hash:0xA06241B1 __RTTI__7JORFile = .sdata:0x8074BCC0; // type:object size:0x8 scope:global hash:0x956E1AD8 dhash:0x64FE5F8F __RTTI__24JORHostInfo_CalendarTime = .sdata:0x8074BCC8; // type:object size:0x8 scope:global hash:0x2BC918B9 dhash:0xFAACAA1F @@ -65241,7 +65241,7 @@ ItemIDOffsetTblOffset = .sbss:0x8074D5F8; // type:object size:0x4 scope:global d IsDevKit = .sbss:0x8074D5FC; // type:object size:0x1 scope:local data:byte hash:0x4316083E lbl_8074D5FD = .sbss:0x8074D5FD; // type:object size:0x1 data:byte hash:0x6C951F5B Initialized = .sbss:0x8074D5FE; // type:object size:0x1 scope:local data:byte hash:0x99FD6509 -lbl_8074D600 = .sbss:0x8074D600; // type:object size:0x1 data:byte hash:0x99FD6509 +Initialized = .sbss:0x8074D600; // type:object size:0x1 scope:local data:byte hash:0x99FD6509 IPCCurrentBufferLo = .sbss:0x8074D604; // type:object size:0x4 scope:global data:4byte hash:0xF2DFCBD5 IPCCurrentBufferHi = .sbss:0x8074D608; // type:object size:0x4 scope:global data:4byte hash:0xF2DFCC57 IPCBufferLo = .sbss:0x8074D60C; // type:object size:0x4 scope:global data:4byte hash:0xC4DB7D9C diff --git a/configure.py b/configure.py index dc1aea8388..d5f189d804 100755 --- a/configure.py +++ b/configure.py @@ -1764,6 +1764,30 @@ config.libs = [ Object(NonMatching, "revolution/ai/ai.c"), ], ), + RevolutionLib( + "ax", + [ + Object(Matching, "revolution/ax/AXAux.c"), + Object(Matching, "revolution/ax/AXCL.c"), + ], + ), + RevolutionLib( + "axfx", + [ + Object(Matching, "revolution/axfx/AXFXHooks.c"), + Object(Matching, "revolution/axfx/AXFXReverbHi.c"), + Object(Matching, "revolution/axfx/AXFXReverbHiExp.c"), + ], + ), + RevolutionLib( + "axfx", + [ + Object(Matching, "revolution/mem/mem_heapCommon.c"), + Object(Matching, "revolution/mem/mem_expHeap.c"), + Object(Matching, "revolution/mem/mem_allocator.c"), + Object(Matching, "revolution/mem/mem_list.c"), + ], + ), RevolutionLib( "dsp", [ @@ -1822,6 +1846,12 @@ config.libs = [ Object(NonMatching, "revolution/wenc/wenc.c"), ], ), + RevolutionLib( + "arc", + [ + Object(Matching, "revolution/arc/arc.c"), + ], + ), RevolutionLib( "esp", [ @@ -1831,10 +1861,10 @@ config.libs = [ RevolutionLib( "ipc", [ - Object(NonMatching, "revolution/ipc/ipcMain.c"), - Object(NonMatching, "revolution/ipc/ipcclt.c"), - Object(NonMatching, "revolution/ipc/memory.c"), - Object(NonMatching, "revolution/ipc/ipcProfile.c"), + Object(Matching, "revolution/ipc/ipcMain.c"), + Object(MatchingFor(ALL_WII, ALL_DEMO, "Shield"), "revolution/ipc/ipcclt.c"), # strnlen issue in ShieldD + Object(Matching, "revolution/ipc/memory.c"), + Object(Matching, "revolution/ipc/ipcProfile.c"), ], ), RevolutionLib( @@ -1846,8 +1876,8 @@ config.libs = [ RevolutionLib( "pad", [ - Object(NonMatching, "revolution/pad/Padclamp.c"), - Object(NonMatching, "revolution/pad/Pad.c"), + Object(MatchingFor("ShieldD"), "revolution/pad/Padclamp.c"), # sqrtf issue on retail versions + Object(Matching, "revolution/pad/Pad.c"), ], ), RevolutionLib( @@ -1886,6 +1916,12 @@ config.libs = [ Object(Matching, "revolution/usb/usb.c"), ], ), + RevolutionLib( + "tpl", + [ + Object(Matching, "revolution/tpl/TPL.c"), + ], + ), RevolutionLib( "gd", [ @@ -1928,7 +1964,7 @@ config.libs = [ Object(NonMatching, "revolution/homebuttonLib/nw4hbm/ut/ut_ResFont.cpp"), Object(NonMatching, "revolution/homebuttonLib/nw4hbm/ut/ut_ResFontBase.cpp"), Object(NonMatching, "revolution/homebuttonLib/nw4hbm/ut/ut_TagProcessorBase.cpp"), - Object(NonMatching, "revolution/homebuttonLib/nw4hbm/ut/ut_TextWriterBase.cpp"), + Object(MatchingFor("RZDE01_02", "RZDP01", "RZDJ01"), "revolution/homebuttonLib/nw4hbm/ut/ut_TextWriterBase.cpp"), # RZDE01_00 func order Object(NonMatching, "revolution/homebuttonLib/HBMBase.cpp"), Object(NonMatching, "revolution/homebuttonLib/HBMAnmController.cpp"), diff --git a/include/revolution/arc.h b/include/revolution/arc.h index 8e8b23b732..c751aafc1f 100644 --- a/include/revolution/arc.h +++ b/include/revolution/arc.h @@ -1,5 +1,5 @@ -#ifndef _REVOLUTION_ARC_H_ -#define _REVOLUTION_ARC_H_ +#ifndef ARC_H +#define ARC_H #include @@ -7,61 +7,59 @@ extern "C" { #endif -#define ARC_ENTRY_NUM_INVALID (-1) + typedef struct { + unsigned int magic; + int fstStart; + int fstSize; + int fileStart; + int pad[4]; + } ARCHeader; -typedef struct { - unsigned int magic; - int fstStart; - int fstSize; - int fileStart; - int pad[4]; -} ARCHeader; + typedef struct { + void* archiveStartAddr; // 0x0 + void* FSTStart; // 0x4 + void* fileStart; // 0x8 + u32 entryNum; // 0xC + char* FSTStringStart; // 0x10 + u32 FSTLength; // 0x14 + u32 currDir; // 0x18 + } ARCHandle; -typedef struct { - void* archiveStartAddr; // 0x0 - void* FSTStart; // 0x4 - void* fileStart; // 0x8 - u32 entryNum; // 0xC - char* FSTStringStart; // 0x10 - u32 FSTLength; // 0x14 - u32 currDir; // 0x18 -} ARCHandle; + typedef struct { + ARCHandle* handle; + u32 startOffset; + u32 length; + } ARCFileInfo; -typedef struct { - ARCHandle* handle; - u32 startOffset; - u32 length; -} ARCFileInfo; + typedef struct { + ARCHandle* handle; + u32 entryNum; + u32 location; + u32 next; + } ARCDir; -typedef struct { - ARCHandle* handle; - u32 entryNum; - u32 location; - u32 next; -} ARCDir; + typedef struct { + ARCHandle* handle; + u32 entryNum; + BOOL isDir; + char* name; + } ARCDirEntry; -typedef struct { - ARCHandle* handle; - u32 entryNum; - BOOL isDir; - char* name; -} ARCDirEntry; + BOOL ARCInitHandle(void *, ARCHandle *); + BOOL ARCFastOpen(ARCHandle *, s32, ARCFileInfo *); + s32 ARCConvertPathToEntrynum(ARCHandle *, const char *); + void* ARCGetStartAddrInMem(ARCFileInfo *); + u32 ARCGetLength(ARCFileInfo *); + BOOL ARCClose(ARCFileInfo *); + BOOL ARCChangeDir(ARCHandle *, const char *); + BOOL ARCGetCurrentDir(ARCHandle *, char *, u32); -BOOL ARCInitHandle(void*, ARCHandle*); -BOOL ARCFastOpen(ARCHandle*, s32, ARCFileInfo*); -s32 ARCConvertPathToEntrynum(ARCHandle*, const char*); -void* ARCGetStartAddrInMem(ARCFileInfo*); -u32 ARCGetLength(ARCFileInfo*); -BOOL ARCClose(ARCFileInfo*); -BOOL ARCChangeDir(ARCHandle*, const char*); -BOOL ARCGetCurrentDir(ARCHandle*, char*, u32); - -BOOL ARCOpenDir(ARCHandle*, const char*, ARCDir*); -BOOL ARCReadDir(ARCDir*, ARCDirEntry*); -BOOL ARCCloseDir(ARCDir*); + BOOL ARCOpenDir(ARCHandle *, const char *, ARCDir *); + BOOL ARCReadDir(ARCDir *, ARCDirEntry *); + BOOL ARCCloseDir(ARCDir *); #ifdef __cplusplus } #endif -#endif // _REVOLUTION_ARC_H_ +#endif // ARC_H diff --git a/include/revolution/ax.h b/include/revolution/ax.h index 37693da034..428823874e 100644 --- a/include/revolution/ax.h +++ b/include/revolution/ax.h @@ -362,6 +362,16 @@ void AXSetVoiceLpf(AXVPB* p, AXPBLPF* lpf); void AXSetVoiceLpfCoefs(AXVPB* p, u16 a0, u16 b0); void AXGetLpfCoefs(u16 freq, u16* a0, u16* b0); +void AXGetAuxACallback(AXAuxCallback* cbOut, void** contextOut); +u16 AXGetAuxAReturnVolume(void); +u16 AXGetAuxBReturnVolume(void); +u16 AXGetAuxCReturnVolume(void); +void AXSetAuxAReturnVolume(u16 volume); +void AXSetAuxBReturnVolume(u16 volume); +void AXSetAuxCReturnVolume(u16 volume); +void AXSetMasterVolume(u16 volume); +u16 AXGetMasterVolume(void); + // DSPCode extern u16 axDspSlaveLength; extern u16 axDspSlave[AX_DSP_SLAVE_LENGTH]; diff --git a/include/revolution/axfx.h b/include/revolution/axfx.h index 3c8b2a2d7e..deca72fb56 100644 --- a/include/revolution/axfx.h +++ b/include/revolution/axfx.h @@ -1,214 +1,109 @@ -#ifndef _REVOLUTION_AXFX_H_ -#define _REVOLUTION_AXFX_H_ +#ifndef AXFX_H +#define AXFX_H -#include -#include +#include +#include #ifdef __cplusplus extern "C" { #endif -typedef struct AXFX_REVSTD_DELAYLINE { - /* 0x00 */ s32 inPoint; - /* 0x04 */ s32 outPoint; - /* 0x08 */ s32 length; - /* 0x0C */ f32* inputs; - /* 0x10 */ f32 lastOutput; -} AXFX_REVSTD_DELAYLINE; +typedef struct AXFX_BUS { + s32* left; + s32* right; + s32* surround; -typedef struct AXFX_REVSTD_WORK { - /* 0x000 */ AXFX_REVSTD_DELAYLINE AP[6]; - /* 0x078 */ AXFX_REVSTD_DELAYLINE C[6]; - /* 0x0F0 */ f32 allPassCoeff; - /* 0x0F4 */ f32 combCoef[6]; - /* 0x10C */ f32 lpLastout[3]; - /* 0x118 */ f32 level; - /* 0x11C */ f32 damping; - /* 0x120 */ s32 preDelayTime; - /* 0x124 */ f32* preDelayLine[3]; - /* 0x130 */ f32* preDelayPtr[3]; -} AXFX_REVSTD_WORK; - -typedef struct AXFX_REVERBSTD { - /* 0x000 */ AXFX_REVSTD_WORK rv; - /* 0x13C */ u8 tempDisableFX; - /* 0x140 */ f32 coloration; - /* 0x144 */ f32 mix; - /* 0x148 */ f32 time; - /* 0x14C */ f32 damping; - /* 0x150 */ f32 preDelay; -} AXFX_REVERBSTD; +} AXFX_BUS; typedef struct AXFX_BUFFERUPDATE { - /* 0x00 */ s32* left; - /* 0x04 */ s32* right; - /* 0x08 */ s32* surround; + s32* left; + s32* right; + s32* surround; + } AXFX_BUFFERUPDATE; -typedef struct AXFX_BUFFERUPDATE_DPL2 { - /* 0x00 */ s32* L; - /* 0x04 */ s32* R; - /* 0x08 */ s32* Ls; - /* 0x0C */ s32* Rs; -} AXFX_BUFFERUPDATE_DPL2; +typedef struct AXFX_REVERBHI_EXP { + f32* earlyLine[3]; // at 0x0 + u32 earlyPos[3]; // at 0xC + u32 earlyLength; // at 0x18 + u32 earlyMaxLength; // at 0x1C + f32 earlyCoef[3]; // at 0x20 -// REVHI Structs + f32* preDelayLine[3]; // at 0x2C + u32 preDelayPos; // at 0x38 + u32 preDelayLength; // at 0x3C + u32 preDelayMaxLength; // at 0x40 -typedef struct AXFX_REVHI_DELAYLINE { - /* 0x00 */ s32 inPoint; - /* 0x04 */ s32 outPoint; - /* 0x08 */ s32 length; - /* 0x0C */ f32* inputs; - /* 0x10 */ f32 lastOutput; -} AXFX_REVHI_DELAYLINE; + f32* combLine[3][3]; // at 0x44 + u32 combPos[3]; // at 0x68 + u32 combLength[3]; // at 0x74 + u32 combMaxLength[3]; // at 0x80 + f32 combCoef[3]; // at 0x8C -typedef struct AXFX_REVHI_WORK { - /* 0x000 */ AXFX_REVHI_DELAYLINE AP[9]; - /* 0x0B4 */ AXFX_REVHI_DELAYLINE C[9]; - /* 0x168 */ f32 allPassCoeff; - /* 0x16C */ f32 combCoef[9]; - /* 0x190 */ f32 lpLastout[3]; - /* 0x19C */ f32 level; - /* 0x1A0 */ f32 damping; - /* 0x1A4 */ s32 preDelayTime; - /* 0x1A8 */ f32 crosstalk; - /* 0x1AC */ f32* preDelayLine[3]; - /* 0x1B8 */ f32* preDelayPtr[3]; -} AXFX_REVHI_WORK; + f32* allpassLine[3][2]; // at 0x98 + u32 allpassPos[2]; // at 0xB0 + u32 allpassLength[2]; // at 0xB8 + u32 allpassMaxLength[2]; // at 0xC0 -typedef struct AXFX_REVHI_WORK_DPL2 { - /* 0x000 */ AXFX_REVHI_DELAYLINE AP[12]; - /* 0x0F0 */ AXFX_REVHI_DELAYLINE C[12]; - /* 0x1E0 */ f32 allPassCoeff; - /* 0x1E4 */ f32 combCoef[12]; - /* 0x214 */ f32 lpLastout[4]; - /* 0x224 */ f32 level; - /* 0x228 */ f32 damping; - /* 0x22C */ s32 preDelayTime; - /* 0x230 */ f32 crosstalk; - /* 0x234 */ f32* preDelayLine[4]; - /* 0x244 */ f32* preDelayPtr[4]; -} AXFX_REVHI_WORK_DPL2; + f32* lastAllpassLine[3]; // at 0xC8 + u32 lastAllpassPos[3]; // at 0xD4 + u32 lastAllpassLength[3]; // at 0xE0 + u32 lastAllpassMaxLength[3]; // at 0xEC + + f32 allpassCoef; // at 0xF8 + f32 lastLpfOut[3]; // at 0xFC + f32 lpfCoef; // at 0x108 + u32 active; // at 0x10C + u32 earlyMode; // at 0x110 + f32 preDelayTimeMax; // at 0x114 + f32 preDelayTime; // at 0x118 + u32 fusedMode; // at 0x11C + f32 fusedTime; // at 0x120 + f32 coloration; // at 0x124 + f32 damping; // at 0x128 + f32 crosstalk; // at 0x12C + f32 earlyGain; // at 0x130 + f32 fusedGain; // at 0x134 + AXFX_BUS* busIn; // at 0x138 + AXFX_BUS* busOut; // at 0x13C + f32 outGain; // at 0x140 + f32 sendGain; // at 0x144 +} AXFX_REVERBHI_EXP; typedef struct AXFX_REVERBHI { - /* 0x000 */ AXFX_REVHI_WORK rv; - /* 0x1C4 */ u8 tempDisableFX; - /* 0x1C8 */ f32 coloration; - /* 0x1CC */ f32 mix; - /* 0x1D0 */ f32 time; - /* 0x1D4 */ f32 damping; - /* 0x1D8 */ f32 preDelay; - /* 0x1DC */ f32 crosstalk; + AXFX_REVERBHI_EXP exp; // at 0x0 + f32 coloration; // at 0x148 + f32 mix; // at 0x14C + f32 time; // at 0x150 + f32 damping; // at 0x154 + f32 preDelay; // at 0x158 + f32 crosstalk; // at 0x15C } AXFX_REVERBHI; -typedef struct AXFX_REVERBHI_DPL2 { - /* 0x000 */ AXFX_REVHI_WORK_DPL2 rv; - /* 0x254 */ u8 tempDisableFX; - /* 0x258 */ f32 coloration; - /* 0x25C */ f32 mix; - /* 0x260 */ f32 time; - /* 0x264 */ f32 damping; - /* 0x268 */ f32 preDelay; -} AXFX_REVERBHI_DPL2; +typedef void* (*AXFXAllocHook)(size_t size); +typedef void (*AXFXFreeHook)(void* block); -typedef struct AXFX_DELAY { - /* 0x00 */ u32 currentSize[3]; - /* 0x0C */ u32 currentPos[3]; - /* 0x18 */ u32 currentFeedback[3]; - /* 0x24 */ u32 currentOutput[3]; - /* 0x30 */ s32* left; - /* 0x34 */ s32* right; - /* 0x38 */ s32* sur; - /* 0x3C */ u32 delay[3]; - /* 0x48 */ u32 feedback[3]; - /* 0x54 */ u32 output[3]; -} AXFX_DELAY; +extern AXFXAllocHook __AXFXAlloc; +extern AXFXFreeHook __AXFXFree; -typedef struct AXFX_CHORUS_SRCINFO { - /* 0x00 */ s32* dest; - /* 0x04 */ s32* smpBase; - /* 0x08 */ s32* old; - /* 0x0C */ u32 posLo; - /* 0x10 */ u32 posHi; - /* 0x14 */ u32 pitchLo; - /* 0x18 */ u32 pitchHi; - /* 0x1C */ u32 trigger; - /* 0x20 */ u32 target; -} AXFX_CHORUS_SRCINFO; +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free); +void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free); -typedef struct AXFX_CHORUS_WORK { - /* 0x00 */ s32* lastLeft[3]; - /* 0x0C */ s32* lastRight[3]; - /* 0x18 */ s32* lastSur[3]; - /* 0x24 */ u8 currentLast; - /* 0x28 */ s32 oldLeft[4]; - /* 0x38 */ s32 oldRight[4]; - /* 0x48 */ s32 oldSur[4]; - /* 0x58 */ u32 currentPosLo; - /* 0x5C */ u32 currentPosHi; - /* 0x60 */ s32 pitchOffset; - /* 0x64 */ u32 pitchOffsetPeriodCount; - /* 0x68 */ u32 pitchOffsetPeriod; - /* 0x6C */ AXFX_CHORUS_SRCINFO src; -} AXFX_CHORUS_WORK; +BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx); +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx); +void AXFXReverbHiCallback(void* update, void* fx); -typedef struct AXFX_CHORUS { - /* 0x00 */ AXFX_CHORUS_WORK work; - /* 0x90 */ u32 baseDelay; - /* 0x94 */ u32 variation; - /* 0x98 */ u32 period; -} AXFX_CHORUS; +BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* fx); +void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* update, AXFX_REVERBHI_EXP* fx); -typedef void* (*AXFXAllocFunc)(u32); -typedef void (*AXFXFreeFunc)(void*); - -// chorus -int AXFXChorusInit(AXFX_CHORUS* c); -int AXFXChorusShutdown(AXFX_CHORUS* c); -int AXFXChorusSettings(AXFX_CHORUS* c); -void AXFXChorusCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_CHORUS* chorus); - -// delay -void AXFXDelayCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_DELAY* delay); -int AXFXDelaySettings(AXFX_DELAY* delay); -int AXFXDelayInit(AXFX_DELAY* delay); -int AXFXDelayShutdown(AXFX_DELAY* delay); - -// reverb_hi -void DoCrossTalk(s32* l, s32* r, f32 cross, f32 invcross); -int AXFXReverbHiInit(AXFX_REVERBHI* rev); -int AXFXReverbHiShutdown(AXFX_REVERBHI* rev); -int AXFXReverbHiSettings(AXFX_REVERBHI* rev); - -// reverb_hi_4ch -int AXFXReverbHiInitDpl2(AXFX_REVERBHI_DPL2* reverb); -int AXFXReverbHiShutdownDpl2(AXFX_REVERBHI_DPL2* reverb); -int AXFXReverbHiSettingsDpl2(AXFX_REVERBHI_DPL2* rev); -void AXFXReverbHiCallbackDpl2(AXFX_BUFFERUPDATE_DPL2* bufferUpdate, AXFX_REVERBHI_DPL2* reverb); - -// reverb_std -int AXFXReverbStdInit(AXFX_REVERBSTD* rev); -int AXFXReverbStdShutdown(AXFX_REVERBSTD* rev); -int AXFXReverbStdSettings(AXFX_REVERBSTD* rev); -void AXFXReverbStdCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_REVERBSTD* reverb); - -void AXFXReverbHiCallback(void *data, void *context); -void AXGetAuxACallback(AXAuxCallback* cbOut, void** contextOut); -void AXFXSetHooks(AXFXAllocFunc alloc, AXFXFreeFunc free); -void AXFXGetHooks(AXFXAllocFunc* allocOut, AXFXFreeFunc* freeOut); +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free); +void AXFXGetHooks(AXFXAllocHook* allocOut, AXFXFreeHook* freeOut); BOOL AXFXReverbHiInit(AXFX_REVERBHI* reverbHi); BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* reverbHi); -u16 AXGetAuxAReturnVolume(void); -u16 AXGetAuxBReturnVolume(void); -u16 AXGetAuxCReturnVolume(void); -void AXSetAuxAReturnVolume(u16 volume); -void AXSetAuxBReturnVolume(u16 volume); -void AXSetAuxCReturnVolume(u16 volume); -void AXSetMasterVolume(u16 volume); -u16 AXGetMasterVolume(void); #ifdef __cplusplus } #endif -#endif // _REVOLUTION_AXFX_H_ +#endif // AXFX_H diff --git a/include/revolution/ipc.h b/include/revolution/ipc.h index 6c2ddf798d..8bb40d49d0 100644 --- a/include/revolution/ipc.h +++ b/include/revolution/ipc.h @@ -10,7 +10,9 @@ extern "C" { #endif void IPCInit(void); +#if SDK_AUG2010 void IPCReInit(void); +#endif u32 IPCReadReg(u32 regIdx); void IPCWriteReg(u32 regIdx, u32 data); void* IPCGetBufferHi(void); diff --git a/include/revolution/ipc/ipcclt.h b/include/revolution/ipc/ipcclt.h index 673cfcd688..d23b3625c2 100644 --- a/include/revolution/ipc/ipcclt.h +++ b/include/revolution/ipc/ipcclt.h @@ -12,7 +12,9 @@ extern "C" { typedef IOSError (*IOSIpcCb)(IOSError, void*); IOSError IPCCltInit(void); +#if SDK_AUG2010 IOSError IPCCltReInit(void); +#endif IOSError IOS_OpenAsync(const char* pPath, u32 flags, IOSIpcCb cb, void* callback_arg); IOSError IOS_Open(const char* path, u32 flags); diff --git a/include/revolution/mem/expHeap.h b/include/revolution/mem/expHeap.h index 2d811ad2fa..efa8afd123 100644 --- a/include/revolution/mem/expHeap.h +++ b/include/revolution/mem/expHeap.h @@ -9,7 +9,7 @@ extern "C" { typedef struct MEMiExpHeapMBlockHead MEMiExpHeapMBlockHead; -struct MEMiExPheapMBlockHead { +struct MEMiExpHeapMBlockHead { u16 signature; union { @@ -27,6 +27,31 @@ struct MEMiExPheapMBlockHead { MEMiExpHeapMBlockHead* next; }; +typedef struct MEMiExpMBlockList MEMiExpMBlockList; + +struct MEMiExpMBlockList { + MEMiExpHeapMBlockHead* head; + MEMiExpHeapMBlockHead* tail; +}; + +typedef struct MEMiExpHeapHead MEMiExpHeapHead; + +struct MEMiExpHeapHead { + MEMiExpMBlockList mbFreeList; + MEMiExpMBlockList mbUsedList; + + u16 groupID; + + union { + u16 val; + struct { + u16 _reserved : 14; + u16 useMarginOfAlign : 1; + u16 allocMode : 1; + } fields; + } feature; +}; + MEMHeapHandle MEMCreateExpHeapEx(void*, u32, u16); void* MEMDestroyExpHeap(MEMHeapHandle); void* MEMAllocFromExpHeapEx(MEMHeapHandle, u32, int); diff --git a/include/revolution/mem/heapCommon.h b/include/revolution/mem/heapCommon.h index 5c156348a6..7f32ce4b43 100644 --- a/include/revolution/mem/heapCommon.h +++ b/include/revolution/mem/heapCommon.h @@ -7,6 +7,7 @@ extern "C" { #include #include +#include typedef struct MEMiHeapHead MEMiHeapHead; @@ -36,6 +37,58 @@ static inline UIntPtr GetUIntPtr(const void* ptr) { return (UIntPtr)(ptr); } +static inline u32 GetOffsetFromPtr(const void* start, const void* end) { + return GetUIntPtr(end) - GetUIntPtr(start); +} + +static inline void* SubU32ToPtr(void* ptr, u32 val) { + return (void*)(GetUIntPtr(ptr) - val); +} + +static inline void* AddU32ToPtr(void* ptr, u32 val) { + return (void*)(GetUIntPtr(ptr) + val); +} + +static inline void SetOptForHeap(MEMiHeapHead* pHeapHd, u16 optFlag) { + pHeapHd->attribute.fields.optFlag = (u8)optFlag; +} + +static inline u16 GetOptForHeap(const MEMiHeapHead* pHeapHd) { + return (u16)pHeapHd->attribute.fields.optFlag; +} + +static inline void FillAllocMemory(MEMiHeapHead* pHeapHd, void* address, u32 size) { + if (GetOptForHeap(pHeapHd) & 1) { + (void)memset(address, 0, size); + } +} + +static inline int ComparePtr(const void* a, const void* b) { + const u8* wa = (const u8*)a; + const u8* wb = (const u8*)b; + + return wa - wb; +} + + +static inline void LockHeap(MEMiHeapHead* pHeapHd) { + if (GetOptForHeap(pHeapHd) & 4) { + OSLockMutex(&pHeapHd->mutex); + } +} + +static inline void UnlockHeap(MEMiHeapHead* pHeapHd) { + if (GetOptForHeap(pHeapHd) & 4) { + OSUnlockMutex(&pHeapHd->mutex); + } +} + +void MEMiInitHeapHead(MEMiHeapHead* pHeapHd, u32 signature, void* heapStart, void* heapEnd, u16 optFlag); + +void MEMiFinalizeHeap(MEMiHeapHead* pHeapHd); + +void MEMiDumpHeapHead(MEMiHeapHead* pHeapHd); + #ifdef __cplusplus } #endif diff --git a/include/revolution/mem/list.h b/include/revolution/mem/list.h index 9a713a6814..1d782a0a1a 100644 --- a/include/revolution/mem/list.h +++ b/include/revolution/mem/list.h @@ -21,9 +21,10 @@ typedef struct { void MEMInitList(MEMList*, u16); void MEMAppendListObject(MEMList*, void*); -void MEMRemoveListObject(MEMList*, void*); void* MEMGetNextListObject(MEMList*, void*); +#define MEM_INIT_LIST(list, structName, linkName) MEMInitList(list, offsetof(structName, linkName)) + #ifdef __cplusplus } #endif diff --git a/src/revolution/arc/arc.c b/src/revolution/arc/arc.c new file mode 100644 index 0000000000..7d52c0226d --- /dev/null +++ b/src/revolution/arc/arc.c @@ -0,0 +1,297 @@ +#include +#include +#include + +/* this is here because it won't be inlined otherwise */ +inline int tolower(int c) { + return ((c < 0) || (c >= 0x100)) ? c : (int) (_current_locale.ctype_cmpt_ptr->lower_map_ptr[c]); +} + +typedef struct FSTEntry FSTEntry; + +struct FSTEntry { + unsigned int isDirAndStringOff; + unsigned int parentOrPosition; + unsigned int nextEntryOrLength; +}; + +#define entryIsDir(fstStart, i) \ + ( ( ( fstStart[i].isDirAndStringOff & 0xFF000000 ) == 0 )? FALSE : TRUE ) +#define stringOff(fstStart, i) \ + ( fstStart[i].isDirAndStringOff & 0x00FFFFFF ) +#define parentDir(fstStart, i) \ + ( fstStart[i].parentOrPosition ) +#define nextDir(fstStart, i) \ + ( fstStart[i].nextEntryOrLength ) +#define filePosition(fstStart, i) \ + ( fstStart[i].parentOrPosition ) +#define fileLength(fstStart, i) \ + ( fstStart[i].nextEntryOrLength ) + +BOOL ARCInitHandle(void* arcStart, ARCHandle* handle) { + FSTEntry* FSTEntries; + ARCHeader* arcHeader = (ARCHeader*)arcStart; + + if (arcHeader->magic != 0x55AA382D) { +#if SDK_AUG2010 + OSPanic(__FILE__, 0x4A, "ARCInitHandle: bad archive format"); +#else + OSPanic(__FILE__, 0x47, "ARCInitHandle: bad archive format"); +#endif + } + + handle->archiveStartAddr = arcStart; + handle->FSTStart = FSTEntries = (void*)((u32)arcStart + arcHeader->fstStart); + handle->fileStart = (void*)((u32)arcStart + arcHeader->fileStart); + handle->entryNum = nextDir(FSTEntries, 0); + handle->FSTStringStart = (char*)&(FSTEntries[handle->entryNum]); + handle->FSTLength = (u32)arcHeader->fstSize; + handle->currDir = 0; + return TRUE; +} + +BOOL ARCFastOpen(ARCHandle* handle, s32 entrynum, ARCFileInfo* af) { + FSTEntry* FSTEntries = (FSTEntry*)handle->FSTStart; + + if ((entrynum < 0) || (entrynum >= handle->entryNum) || entryIsDir(FSTEntries, entrynum)) { + return FALSE; + } + + af->handle = handle; + af->startOffset = filePosition(FSTEntries, entrynum); + af->length = fileLength(FSTEntries, entrynum); + return TRUE; +} + +static BOOL isSame(const char* path, const char* string) { + while(*string != '\0') { + if (tolower(*path++) != tolower(*string++)) { + return FALSE; + } + } + + if ((*path == '/') || (*path == '\0')) { + return TRUE; + } + + return FALSE; +} + +s32 ARCConvertPathToEntrynum(ARCHandle* handle, const char* pathPtr) +{ + const char* ptr; + char* stringPtr; + BOOL isDir; + s32 length; + u32 dirLookAt; + u32 i; + const char* origPathPtr = pathPtr; + FSTEntry* FSTEntries; + + dirLookAt = handle->currDir; + FSTEntries = (FSTEntry*)handle->FSTStart; + + while (1) { + if (*pathPtr == '\0') { + return (s32)dirLookAt; + } + else if (*pathPtr == '/') { + dirLookAt = 0; + pathPtr++; + continue; + } + else if (*pathPtr == '.') { + if (*(pathPtr + 1) == '.') { + if (*(pathPtr + 2) == '/') { + dirLookAt = parentDir(FSTEntries, dirLookAt); + pathPtr += 3; + continue; + } + else if (*(pathPtr + 2) == '\0') { + return (s32)parentDir(FSTEntries, dirLookAt); + } + } + else if (*(pathPtr + 1) == '/') { + pathPtr += 2; + continue; + } + else if (*(pathPtr + 1) == '\0') { + return (s32)dirLookAt; + } + } + + for(ptr = pathPtr; (*ptr != '\0') && (*ptr != '/'); ptr++); + isDir = (*ptr == '\0')? FALSE : TRUE; + length = (s32)(ptr - pathPtr); + ptr = pathPtr; + + for(i = dirLookAt + 1; i < nextDir(FSTEntries, dirLookAt); + i = entryIsDir(FSTEntries, i)? nextDir(FSTEntries, i): (i+1) ) + { +dot: + if ((entryIsDir(FSTEntries, i) == FALSE) && (isDir == TRUE)) { + continue; + } + + stringPtr = handle->FSTStringStart + stringOff(FSTEntries, i); + + if (*stringPtr == '.' && *(stringPtr + 1) == '\0') { + i++; + goto dot; + } + + if (isSame(ptr, stringPtr) == TRUE) { + goto next_hier; + } + } + + return -1; + + next_hier: + if (!isDir) { + return (s32)i; + } + + dirLookAt = i; + pathPtr += length + 1; + } + + // the world ends if this is reached +} + +static u32 myStrncpy(char* dest, char* src, u32 maxlen) { + u32 i = maxlen; + + while ((i > 0) && (*src != 0)) { + *dest++ = *src++; + i--; + } + + return (maxlen - i); +} + +static u32 entryToPath(ARCHandle* handle, u32 entry, char* path, u32 maxlen) { + char* name; + u32 loc; + FSTEntry* FSTEntries = (FSTEntry*)handle->FSTStart; + + if (entry == 0) { + return 0; + } + + name = handle->FSTStringStart + stringOff(FSTEntries, entry); + loc = entryToPath(handle, parentDir(FSTEntries, entry), path, maxlen); + + if (loc == maxlen) { + return loc; + } + + *(path + loc++) = '/'; + loc += myStrncpy(path + loc, name, maxlen - loc); + return loc; +} + +static BOOL ARCConvertEntrynumToPath(ARCHandle* handle, s32 entrynum, char* path, u32 maxlen) { + u32 loc; + FSTEntry* FSTEntries = (FSTEntry*)handle->FSTStart; + + loc = entryToPath(handle, (u32)entrynum, path, maxlen); + + if (loc == maxlen) { + path[maxlen - 1] = '\0'; + return FALSE; + } + + if (entryIsDir(FSTEntries, entrynum)) { + if (loc == maxlen - 1) { + path[loc] = '\0'; + return FALSE; + } + + path[loc++] = '/'; + } + + path[loc] = '\0'; + return TRUE; +} + +static BOOL ARCGetCurrentDir(ARCHandle* handle, char* path, u32 maxlen) { + return ARCConvertEntrynumToPath(handle, (s32)handle->currDir, path, maxlen); +} + +void* ARCGetStartAddrInMem(ARCFileInfo* af) { + ARCHandle* handle = af->handle; + return (void*)((u32)handle->archiveStartAddr + af->startOffset); +} + +u32 ARCGetLength(ARCFileInfo* af) { + return af->length; +} + +BOOL ARCClose(ARCFileInfo* af) { + return TRUE; +} + +BOOL ARCChangeDir(ARCHandle* handle, const char* dirName) { + s32 entry; + FSTEntry* FSTEntries; + + entry = ARCConvertPathToEntrynum(handle, dirName); + FSTEntries = (FSTEntry*)handle->FSTStart; + + if ((entry < 0) || (entryIsDir(FSTEntries, entry) == FALSE)) { + return FALSE; + } + + handle->currDir = (u32)entry; + return TRUE; +} + +BOOL ARCOpenDir(ARCHandle* handle, const char* dirName, ARCDir* dir) { + s32 entry; + FSTEntry* FSTEntries; + + entry = ARCConvertPathToEntrynum(handle, dirName); + FSTEntries = (FSTEntry*)handle->FSTStart; + + if ((entry < 0) || (entryIsDir(FSTEntries, entry) == FALSE)) { + return FALSE; + } + + dir->handle = handle; + dir->entryNum = (u32)entry; + dir->location = (u32)entry + 1; + dir->next = nextDir(FSTEntries, entry); + return TRUE; +} + +BOOL ARCReadDir(ARCDir* dir, ARCDirEntry* dirent) { + u32 loc; + FSTEntry* FSTEntries; + ARCHandle* handle; + + handle = dir->handle; + FSTEntries = (FSTEntry*)handle->FSTStart; + loc = dir->location; +retry: + if ((loc <= dir->entryNum) || (dir->next <= loc)) { + return FALSE; + } + + dirent->handle = handle; + dirent->entryNum = loc; + dirent->isDir = entryIsDir(FSTEntries, loc); + dirent->name = handle->FSTStringStart + stringOff(FSTEntries, loc); + + if (dirent->name[0] == '.' && dirent->name[1] == '\0') { + loc++; + goto retry; + } + + dir->location = entryIsDir(FSTEntries, loc)? nextDir(FSTEntries, loc) : (loc+1); + return TRUE; +} + +BOOL ARCCloseDir(ARCDir* dir) { + return TRUE; +} diff --git a/src/revolution/ax/AXAux.c b/src/revolution/ax/AXAux.c new file mode 100644 index 0000000000..15396eac47 --- /dev/null +++ b/src/revolution/ax/AXAux.c @@ -0,0 +1,30 @@ +#include +#include +#include + +static u8 __clearAuxA[3]; + +static AXAuxCallback __AXCallbackAuxA; +static void* __AXContextAuxA; + +void AXRegisterAuxACallback(AXAuxCallback callback, void* context) { +#if SDK_AUG2010 + BOOL enabled = OSDisableInterrupts(); +#endif + + __AXCallbackAuxA = callback; + __AXContextAuxA = context; + +#if SDK_AUG2010 + if (callback == NULL) { + memset(&__clearAuxA, TRUE, 3); + } + + OSRestoreInterrupts(enabled); +#endif +} + +void AXGetAuxACallback(AXAuxCallback* callback, void** context) { + *callback = __AXCallbackAuxA; + *context = __AXContextAuxA; +} diff --git a/src/revolution/ax/AXCL.c b/src/revolution/ax/AXCL.c new file mode 100644 index 0000000000..69d53724f0 --- /dev/null +++ b/src/revolution/ax/AXCL.c @@ -0,0 +1,30 @@ +#include +#include + +static u16 __AXAuxAVolume; +static u16 __AXAuxBVolume; +static u16 __AXAuxCVolume; + +u16 AXGetAuxAReturnVolume(void) { + return __AXAuxAVolume; +} + +u16 AXGetAuxBReturnVolume(void) { + return __AXAuxBVolume; +} + +u16 AXGetAuxCReturnVolume(void) { + return __AXAuxCVolume; +} + +void AXSetAuxAReturnVolume(u16 volume) { + __AXAuxAVolume = volume; +} + +void AXSetAuxBReturnVolume(u16 volume) { + __AXAuxBVolume = volume; +} + +void AXSetAuxCReturnVolume(u16 volume) { + __AXAuxCVolume = volume; +} diff --git a/src/revolution/axfx/AXFXHooks.c b/src/revolution/axfx/AXFXHooks.c new file mode 100644 index 0000000000..bb24859c5a --- /dev/null +++ b/src/revolution/axfx/AXFXHooks.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +static void* __AXFXAllocFunction(size_t size); +static void __AXFXFreeFunction(void* block); + +AXFXAllocHook __AXFXAlloc = __AXFXAllocFunction; +AXFXFreeHook __AXFXFree = __AXFXFreeFunction; + +static void* __AXFXAllocFunction(size_t size) { + return OSAllocFromHeap(__OSCurrHeap, size); +} + +static void __AXFXFreeFunction(void* block) { + OSFreeToHeap(__OSCurrHeap, block); +} + +void AXFXSetHooks(AXFXAllocHook alloc, AXFXFreeHook free) { + __AXFXAlloc = alloc; + __AXFXFree = free; +} + +void AXFXGetHooks(AXFXAllocHook* alloc, AXFXFreeHook* free) { + *alloc = __AXFXAlloc; + *free = __AXFXFree; +} diff --git a/src/revolution/axfx/AXFXReverbHi.c b/src/revolution/axfx/AXFXReverbHi.c new file mode 100644 index 0000000000..a2390bddb7 --- /dev/null +++ b/src/revolution/axfx/AXFXReverbHi.c @@ -0,0 +1,33 @@ +#include +#include + +static void __ParamConvert(AXFX_REVERBHI* fx) { + fx->exp.earlyMode = 5; + fx->exp.preDelayTimeMax = fx->preDelay; + fx->exp.preDelayTime = fx->preDelay; + fx->exp.fusedMode = 0; + fx->exp.fusedTime = fx->time; + fx->exp.coloration = fx->coloration; + fx->exp.damping = fx->damping; + fx->exp.crosstalk = fx->crosstalk; + fx->exp.earlyGain = 0.0f; + fx->exp.fusedGain = 1.0f; + fx->exp.busIn = NULL; + fx->exp.busOut = NULL; + fx->exp.outGain = fx->mix; + fx->exp.sendGain = 0.0f; +} + +BOOL AXFXReverbHiInit(AXFX_REVERBHI* fx) { + __ParamConvert(fx); + return AXFXReverbHiExpInit(&fx->exp); +} + +BOOL AXFXReverbHiShutdown(AXFX_REVERBHI* fx) { + AXFXReverbHiExpShutdown(&fx->exp); + return TRUE; +} + +void AXFXReverbHiCallback(void* chans, void* context) { + AXFXReverbHiExpCallback((AXFX_BUFFERUPDATE*)chans, &((AXFX_REVERBHI*)context)->exp); +} diff --git a/src/revolution/axfx/AXFXReverbHiExp.c b/src/revolution/axfx/AXFXReverbHiExp.c new file mode 100644 index 0000000000..521e1464f3 --- /dev/null +++ b/src/revolution/axfx/AXFXReverbHiExp.c @@ -0,0 +1,418 @@ +#include +#include +#include + +static u32 __EarlySizeTable[8][3] = { + {157, 479, 829}, {317, 809, 1117}, {479, 941, 1487}, {641, 1259, 1949}, + {797, 1667, 2579}, {967, 1901, 2903}, {1123, 2179, 3413}, {1279, 2477, 3889} +}; + +static f32 __EarlyCoefTable[8][3] = { + {0.4f, -1.0f, 0.3f}, {0.5f, -0.95f, 0.3f}, {0.6f, -0.9f, 0.3f}, {0.75f, -0.85f, 0.3f}, + {-0.9f, 0.8f, 0.3f}, {-1.0f, 0.7f, 0.3f}, {-1.0f, 0.7f, 0.3f}, {-1.0f, 0.7f, 0.3f} +}; + +static u32 __FilterSizeTable[7][8] = { + {1789, 1999, 2333, 433, 149, 47, 73, 67}, {149, 293, 449, 251, 103, 47, 73, 67}, + {947, 1361, 1531, 433, 137, 47, 73, 67}, {1279, 1531, 1973, 509, 149, 47, 73, 67}, + {1531, 1847, 2297, 563, 179, 47, 73, 67}, {1823, 2357, 2693, 571, 137, 47, 73, 67}, + {1823, 2357, 2693, 571, 179, 47, 73, 67} +}; + +static BOOL __AllocDelayLine(AXFX_REVERBHI_EXP* reverb); +static void __FreeDelayLine(AXFX_REVERBHI_EXP* reverb); +static void __BzeroDelayLines(AXFX_REVERBHI_EXP* reverb); +static BOOL __InitParams(AXFX_REVERBHI_EXP* reverb); + +f32 dummy_0() { + return 32000.0f; +} + +BOOL AXFXReverbHiExpInit(AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + BOOL result = TRUE; + BOOL mask = OSDisableInterrupts(); + + reverb->active = 1; + + if (reverb->preDelayTimeMax < 0.0f) { + AXFXReverbHiExpShutdown(reverb); + OSRestoreInterrupts(mask); + return FALSE; + } + + reverb->earlyMaxLength = __EarlySizeTable[8 - 1][2]; + reverb->preDelayMaxLength = (u32)(reverb->preDelayTimeMax * 32000); + + for (i = 0; i < 3; i++) { + reverb->combMaxLength[i] = __FilterSizeTable[6][i]; + } + + for (i = 0; i < 2; i++) { + reverb->allpassMaxLength[i] = __FilterSizeTable[6][3 + i]; + } + + for (ch = 0; ch < 3; ch++) { + reverb->lastAllpassMaxLength[ch] = __FilterSizeTable[6][5 + ch]; + } + + result = __AllocDelayLine(reverb); + if (result == FALSE) { + AXFXReverbHiExpShutdown(reverb); + OSRestoreInterrupts(mask); + return FALSE; + } + + __BzeroDelayLines(reverb); + result = __InitParams(reverb); + if (result == FALSE) { + AXFXReverbHiExpShutdown(reverb); + OSRestoreInterrupts(mask); + return FALSE; + } + + reverb->active &= ~1; + OSRestoreInterrupts(mask); + return TRUE; +} + +void AXFXReverbHiExpShutdown(AXFX_REVERBHI_EXP* reverb) { + BOOL mask = OSDisableInterrupts(); + reverb->active |= 1; + __FreeDelayLine(reverb); + OSRestoreInterrupts(mask); +} + +void AXFXReverbHiExpCallback(AXFX_BUFFERUPDATE* bufferUpdate, AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + u32 samp; + s32* input[3]; + f32 data; + f32 output[3]; + f32* earlyLine; + f32 earlyOut; + f32* preDelayLine; + f32 preDelayOut; + f32 filterOut; + f32* combLine; + f32 combOutOne; + f32* allpass; + f32 outTmp; + f32 allpassIn; + f32 allpassCoef; + f32 lpfOut; + f32 lpfCoef1; + f32 lpfCoef2; + f32 fusedOut[3]; + f32 fusedGain; + f32 crosstalkGain; + f32 crosstalkL; + f32 crosstalkR; + f32 crosstalkS; + s32* inBusData[3]; + s32* outBusData[3]; + + if (reverb->active != 0) { + reverb->active &= ~2; + return; + } + + input[0] = bufferUpdate->left; + input[1] = bufferUpdate->right; + input[2] = bufferUpdate->surround; + + if (reverb->busIn != NULL) { + inBusData[0] = reverb->busIn->left; + inBusData[1] = reverb->busIn->right; + inBusData[2] = reverb->busIn->surround; + } + + if (reverb->busOut != NULL) { + outBusData[0] = reverb->busOut->left; + outBusData[1] = reverb->busOut->right; + outBusData[2] = reverb->busOut->surround; + } + + lpfCoef1 = 1.0f - reverb->lpfCoef; + lpfCoef2 = reverb->lpfCoef; + allpassCoef = reverb->allpassCoef; + fusedGain = reverb->fusedGain * 0.6f; + crosstalkGain = reverb->crosstalk * 0.5f; + + for (samp = 0; samp < 96; samp++) { + for (ch = 0; ch < 3; ch++) { + if (reverb->busIn != NULL) { + data = (f32)(*(input[ch]) + *(inBusData[ch]++)); + } else { + data = (f32)(*input[ch]); + } + + earlyLine = reverb->earlyLine[ch]; + earlyOut = earlyLine[reverb->earlyPos[0]] * reverb->earlyCoef[0] + + earlyLine[reverb->earlyPos[1]] * reverb->earlyCoef[1] + + earlyLine[reverb->earlyPos[2]] * reverb->earlyCoef[2]; + +#if SDK_AUG2010 + earlyLine[reverb->earlyPos[2]] = data; +#endif + + if (reverb->preDelayLength != 0) { + preDelayLine = reverb->preDelayLine[ch]; + preDelayOut = preDelayLine[reverb->preDelayPos]; + preDelayLine[reverb->preDelayPos] = data; + } else { + preDelayOut = data; + } + + filterOut = 0.0f; + for (i = 0; i < 3; i++) { + combLine = reverb->combLine[ch][i]; + combOutOne = combLine[reverb->combPos[i]]; + combLine[reverb->combPos[i]] = preDelayOut + (combOutOne * reverb->combCoef[i]); + filterOut += combOutOne; + } + + for (i = 0; i < 2; i++) { + allpass = reverb->allpassLine[ch][i]; + outTmp = allpass[reverb->allpassPos[i]]; + allpassIn = filterOut + outTmp * allpassCoef; + allpass[reverb->allpassPos[i]] = allpassIn; + filterOut = outTmp - allpassIn * allpassCoef; + } + + lpfOut = lpfCoef1 * filterOut + lpfCoef2 * reverb->lastLpfOut[ch]; + reverb->lastLpfOut[ch] = lpfOut; + allpass = reverb->lastAllpassLine[ch]; + outTmp = allpass[reverb->lastAllpassPos[ch]]; + allpassIn = lpfOut + outTmp * allpassCoef; + allpass[reverb->lastAllpassPos[ch]] = allpassIn; + fusedOut[ch] = outTmp - allpassIn * allpassCoef; + if (++reverb->lastAllpassPos[ch] >= reverb->lastAllpassLength[ch]) { + reverb->lastAllpassPos[ch] = 0; + } + + fusedOut[ch] *= fusedGain; + fusedOut[ch] += earlyOut; + } + + crosstalkL = fusedOut[1] + fusedOut[2]; + crosstalkR = fusedOut[0] + fusedOut[2]; + crosstalkS = fusedOut[0] + fusedOut[1]; + + output[0] = fusedOut[0] + crosstalkL * crosstalkGain; + output[1] = fusedOut[1] + crosstalkR * crosstalkGain; + output[2] = fusedOut[2] + crosstalkS * crosstalkGain; + + *(input[0]++) = (s32)(output[0] * reverb->outGain); + *(input[1]++) = (s32)(output[1] * reverb->outGain); + *(input[2]++) = (s32)(output[2] * reverb->outGain); + + if (reverb->busOut != NULL) { + *(outBusData[0]++) = (s32)(output[0] * reverb->sendGain); + *(outBusData[1]++) = (s32)(output[1] * reverb->sendGain); + *(outBusData[2]++) = (s32)(output[2] * reverb->sendGain); + } + + for (i = 0; i < 3; i++) { + if (++reverb->earlyPos[i] >= reverb->earlyLength) { + reverb->earlyPos[i] = 0; + } + } + + if (reverb->preDelayLength != 0) { + if (++reverb->preDelayPos >= reverb->preDelayLength) { + reverb->preDelayPos = 0; + } + } + + for (i = 0; i < 3; i++) { + if (++reverb->combPos[i] >= reverb->combLength[i]) { + reverb->combPos[i] = 0; + } + } + + for (i = 0; i < 2; i++) { + if (++reverb->allpassPos[i] >= reverb->allpassLength[i]) { + reverb->allpassPos[i] = 0; + } + } + } +} + +static BOOL __AllocDelayLine(AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + + for (ch = 0; ch < 3; ch++) { + reverb->earlyLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * reverb->earlyMaxLength); + if (reverb->earlyLine[ch] == NULL) + return FALSE; + + if (reverb->preDelayMaxLength != 0) { + reverb->preDelayLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * reverb->preDelayMaxLength); + if (reverb->preDelayLine[ch] == NULL) + return FALSE; + } else { + reverb->preDelayLine[ch] = NULL; + } + + for (i = 0; i < 3; i++) { + reverb->combLine[ch][i] = (f32*)__AXFXAlloc(sizeof(f32) * reverb->combMaxLength[i]); + if (reverb->combLine[ch][i] == NULL) + return FALSE; + } + + for (i = 0; i < 2; i++) { + reverb->allpassLine[ch][i] = (f32*)__AXFXAlloc(sizeof(f32) * reverb->allpassMaxLength[i]); + if (reverb->allpassLine[ch][i] == NULL) + return FALSE; + } + + reverb->lastAllpassLine[ch] = (f32*)__AXFXAlloc(sizeof(f32) * reverb->lastAllpassMaxLength[ch]); + if (reverb->lastAllpassLine[ch] == NULL) + return FALSE; + } + + return TRUE; +} + +static void __BzeroDelayLines(AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + + for (ch = 0; ch < 3; ch++) { + if (reverb->earlyLine[ch] != NULL) { + memset(reverb->earlyLine[ch], 0, sizeof(f32) * reverb->earlyMaxLength); + } + + if (reverb->preDelayLine[ch] != NULL) { + memset(reverb->preDelayLine[ch], 0, sizeof(f32) * reverb->preDelayMaxLength); + } + + for (i = 0; i < 3; i++) { + if (reverb->combLine[ch][i] != NULL) { + memset(reverb->combLine[ch][i], 0, sizeof(f32) * reverb->combMaxLength[i]); + } + } + + for (i = 0; i < 2; i++) { + if (reverb->allpassLine[ch][i] != NULL) { + memset(reverb->allpassLine[ch][i], 0, sizeof(f32) * reverb->allpassMaxLength[i]); + } + } + + if (reverb->lastAllpassLine[ch] != NULL) { + memset(reverb->lastAllpassLine[ch], 0, sizeof(f32) * reverb->lastAllpassMaxLength[ch]); + } + } +} + +static void __FreeDelayLine(AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + + for (ch = 0; ch < 3; ch++) { + if (reverb->earlyLine[ch] != NULL) { + __AXFXFree(reverb->earlyLine[ch]); + reverb->earlyLine[ch] = NULL; + } + + if (reverb->preDelayLine[ch] != NULL) { + __AXFXFree(reverb->preDelayLine[ch]); + reverb->preDelayLine[ch] = NULL; + } + + for (i = 0; i < 3; i++) { + if (reverb->combLine[ch][i] != NULL) { + __AXFXFree(reverb->combLine[ch][i]); + reverb->combLine[ch][i] = NULL; + } + } + + for (i = 0; i < 2; i++) { + if (reverb->allpassLine[ch][i] != NULL) { + __AXFXFree(reverb->allpassLine[ch][i]); + reverb->allpassLine[ch][i] = NULL; + } + } + + if (reverb->lastAllpassLine[ch] != NULL) { + __AXFXFree(reverb->lastAllpassLine[ch]); + reverb->lastAllpassLine[ch] = NULL; + } + } +} + +f32 dummy_1() { + return -3.0f; +} + +static BOOL __InitParams(AXFX_REVERBHI_EXP* reverb) { + u32 ch, i; + + if (reverb->earlyMode >= 8) + return FALSE; + + if (reverb->preDelayTime < 0.0f || reverb->preDelayTime > reverb->preDelayTimeMax) + return FALSE; + + if (reverb->fusedMode >= 6) + return FALSE; + + if (reverb->fusedTime < 0.0f) + return FALSE; + + if (reverb->coloration < 0.0f || reverb->coloration > 1.0f) + return FALSE; + + if (reverb->damping < 0.0f || reverb->damping > 1.0f) + return FALSE; + + if (reverb->crosstalk < 0.0f || reverb->crosstalk > 1.0f) + return FALSE; + + if (reverb->earlyGain < 0.0f || reverb->earlyGain > 1.0f) + return FALSE; + + if (reverb->fusedGain < 0.0f || reverb->fusedGain > 1.0f) + return FALSE; + + if (reverb->outGain < 0.0f || reverb->outGain > 1.0f) + return FALSE; + + if (reverb->sendGain < 0.0f || reverb->sendGain > 1.0f) + return FALSE; + + reverb->earlyLength = __EarlySizeTable[reverb->earlyMode][2]; + for (i = 0; i < 3; i++) { + reverb->earlyPos[i] = reverb->earlyLength - __EarlySizeTable[reverb->earlyMode][i]; + reverb->earlyCoef[i] = __EarlyCoefTable[reverb->earlyMode][i] * reverb->earlyGain * 0.6f; + } + + reverb->preDelayPos = 0; + reverb->preDelayLength = (u32)(reverb->preDelayTime * (f32)32000); + + for (i = 0; i < 3; i++) { + reverb->combPos[i] = 0; + reverb->combLength[i] = __FilterSizeTable[reverb->fusedMode][i]; + reverb->combCoef[i] = pow(10.0f, (-3.0f * (f32)(reverb->combLength[i]) / (f32)(reverb->fusedTime * 32000))); + } + + for (i = 0; i < 2; i++) { + reverb->allpassPos[i] = 0; + reverb->allpassLength[i] = __FilterSizeTable[reverb->fusedMode][3 + i]; + } + + for (ch = 0; ch < 3; ch++) { + reverb->lastAllpassPos[ch] = 0; + reverb->lastAllpassLength[ch] = __FilterSizeTable[reverb->fusedMode][5 + ch]; + } + + reverb->allpassCoef = reverb->coloration; + reverb->lpfCoef = 1.0f - reverb->damping; + if (reverb->lpfCoef > 0.95f) + reverb->lpfCoef = 0.95f; + + for (ch = 0; ch < 3; ch++) { + reverb->lastLpfOut[ch] = 0.0f; + } + + return TRUE; +} diff --git a/src/revolution/homebuttonLib/HBMBase.h b/src/revolution/homebuttonLib/HBMBase.h index 55156b28c6..8598974db1 100644 --- a/src/revolution/homebuttonLib/HBMBase.h +++ b/src/revolution/homebuttonLib/HBMBase.h @@ -260,8 +260,8 @@ namespace homebutton { /* 0x5D0 */ nw4hbm::snd::SoundHeap* mpSoundHeap; /* 0x5D4 */ nw4hbm::snd::SoundHandle* mpSoundHandle; /* 0x5D8 */ u16 mAppVolume[3]; - /* 0x5E0 */ AXFXAllocFunc mAxFxAlloc; - /* 0x5E4 */ AXFXFreeFunc mAxFxFree; + /* 0x5E0 */ AXFXAllocHook mAxFxAlloc; + /* 0x5E4 */ AXFXFreeHook mAxFxFree; /* 0x5E8 */ AXFX_REVERBHI mAxFxReverb; /* 0x748 */ AXAuxCallback mAuxCallback; /* 0x74C */ void* mpAuxContext; diff --git a/src/revolution/ipc/ipcMain.c b/src/revolution/ipc/ipcMain.c index f126cb5b1f..5c3e296d5f 100644 --- a/src/revolution/ipc/ipcMain.c +++ b/src/revolution/ipc/ipcMain.c @@ -23,10 +23,12 @@ void IPCInit(void) { Initialized = TRUE; } +#if SDK_AUG2010 void IPCReInit(void) { Initialized = FALSE; IPCInit(); } +#endif u32 IPCReadReg(u32 regIdx) { u32 reg = __IPCRegs[regIdx]; diff --git a/src/revolution/ipc/ipcProfile.c b/src/revolution/ipc/ipcProfile.c index 95ffec8bb9..735f053757 100644 --- a/src/revolution/ipc/ipcProfile.c +++ b/src/revolution/ipc/ipcProfile.c @@ -1,17 +1,40 @@ #include #include -static u32 IpcReqPtrArray[96] = {0}; -static u32 IpcReqArray[0x300] = {0}; -static OSTime IpcStartTimeArray[96]; -static u8 IpcHandlePathBuf[0x1800]; -static u8 IpcOpenPathBuf[0x1200]; +#if SDK_AUG2010 +#define IPC_REQ_MAX 0x60 +#define IPC_PATH_MAX 0x30 +#else +#define IPC_REQ_MAX 0x20 +#endif + +#if SDK_AUG2010 +// either release or debug config does something weird to swap the order of these in .bss +#if VERSION == VERSION_SHIELD_DEBUG +static IOSResourceRequest* IpcReqPtrArray[IPC_REQ_MAX] = {0}; +static IOSResourceRequest IpcReqArray[IPC_REQ_MAX] = {0}; +#else +static IOSResourceRequest IpcReqArray[IPC_REQ_MAX] = {0}; +static IOSResourceRequest* IpcReqPtrArray[IPC_REQ_MAX] = {0}; +#endif +static OSTime IpcStartTimeArray[IPC_REQ_MAX]; +static char IpcHandlePathBuf[0x80][0x30]; +static char IpcOpenPathBuf[IPC_REQ_MAX][0x30]; +#else +static s32 IpcFdArray[IPC_REQ_MAX] = {0}; +static u32 IpcReqPtrArray[IPC_REQ_MAX] = {0}; +#endif static u32 IpcNumPendingReqs = 0; static u32 IpcNumUnIssuedReqs = 0; -static void AddReqInfo(void* req); -static void DelReqInfo(void* req); +#if SDK_AUG2010 +static void AddReqInfo(IOSResourceRequest* req); +static void DelReqInfo(IOSResourceRequest* req); +#else +static void AddReqInfo(IOSResourceRequest* req, s32 fd); +static void DelReqInfo(IOSResourceRequest* req, s32 fd); +#endif void IPCiProfInit(void) { u32 i; @@ -19,20 +42,31 @@ void IPCiProfInit(void) { IpcNumPendingReqs = 0; IpcNumUnIssuedReqs = 0; - for (i = 0; i < 96; ++i) { + for (i = 0; i < IPC_REQ_MAX; ++i) { +#if SDK_AUG2010 IpcReqPtrArray[i] = 0; IpcStartTimeArray[i] = 0; +#else + IpcReqPtrArray[i] = 0; + IpcFdArray[i] = -1; +#endif } +#if SDK_AUG2010 memset(IpcHandlePathBuf, 0, sizeof(IpcHandlePathBuf)); memset(IpcOpenPathBuf, 0, sizeof(IpcOpenPathBuf)); memset(IpcReqArray, 0, sizeof(IpcReqArray)); +#endif } void IPCiProfQueueReq(void* req, s32 handle) { ++IpcNumPendingReqs; ++IpcNumUnIssuedReqs; - AddReqInfo(req); +#if SDK_AUG2010 + AddReqInfo((IOSResourceRequest*)req); +#else + AddReqInfo((IOSResourceRequest*)req, handle); +#endif } void IPCiProfAck(void) { @@ -41,13 +75,89 @@ void IPCiProfAck(void) { void IPCiProfReply(void* req, s32 handle) { --IpcNumPendingReqs; - DelReqInfo(req); +#if SDK_AUG2010 + DelReqInfo((IOSResourceRequest*)req); +#else + DelReqInfo((IOSResourceRequest*)req, handle); +#endif } -static void AddReqInfo(void* ptr) { - // NONMATCHING +#if SDK_AUG2010 +static void AddReqInfo(IOSResourceRequest* req) { + u32 i; + + for (i = 0; i < IPC_REQ_MAX; i++) { + if (!IpcReqPtrArray[i]) { + BOOL irqEnabled = OSDisableInterrupts(); + + IpcReqPtrArray[i] = req; + IpcReqArray[i] = *req; + IpcStartTimeArray[i] = OSGetTime(); + if (IpcReqArray[i].cmd == 1) { + const char* path_p_virt = (const char*)OSPhysicalToCached((u32)IpcReqArray[i].args.open.path); + strncpy(IpcOpenPathBuf[i], path_p_virt, + IPC_PATH_MAX - 1); + IpcOpenPathBuf[i][IPC_PATH_MAX - 1] = '\0'; + IpcReqArray[i].args.open.path = (u8*)IpcOpenPathBuf[i]; + } + + OSRestoreInterrupts(irqEnabled); + break; + } + } } -static void DelReqInfo(void* ptr) { - // NONMATCHING +static void DelReqInfo(IOSResourceRequest* req) { + u32 i; + + for (i = 0; i < IPC_REQ_MAX; i++) { + if (req == IpcReqPtrArray[i] && req->handle == IpcReqArray[i].cmd) { + BOOL irqEnabled = OSDisableInterrupts(); + + if (IpcReqArray[i].cmd == 1) { + if (req->status >= 0) { + strncpy(IpcHandlePathBuf[req->status], + (const char*)IpcReqArray[i].args.open.path, IPC_PATH_MAX - 1); + IpcHandlePathBuf[req->status][IPC_PATH_MAX - 1] = '\0'; + memset(&IpcOpenPathBuf[i], 0, IPC_PATH_MAX); + } + } + + if (IpcReqArray[i].cmd == 2) { + memset(&IpcHandlePathBuf[IpcReqArray[i].handle], 0, IPC_PATH_MAX); + } + + IpcReqPtrArray[i] = NULL; + memset(&IpcReqArray[i], 0, sizeof(IOSResourceRequest)); + IpcStartTimeArray[i] = 0; + + OSRestoreInterrupts(irqEnabled); + break; + } + } } +#else +static void AddReqInfo(IOSResourceRequest* ptr, s32 fd) { + u32 i; + + for (i = 0; i < 32; ++i) { + if (IpcReqPtrArray[i] == 0 && IpcFdArray[i] == -1) { + IpcReqPtrArray[i] = (u32)ptr; + IpcFdArray[i] = fd; + break; + } + } +} + +static void DelReqInfo(IOSResourceRequest* ptr, s32 fd) { + u32 i; + + for (i = 0; i < 32; ++i) { + if (IpcReqPtrArray[i] == (u32)ptr && IpcFdArray[i] == fd) { + IpcReqPtrArray[i] = 0; + IpcFdArray[i] = -1; + break; + } + } +} +#endif diff --git a/src/revolution/ipc/ipcclt.c b/src/revolution/ipc/ipcclt.c index 7484547cd2..6976775218 100644 --- a/src/revolution/ipc/ipcclt.c +++ b/src/revolution/ipc/ipcclt.c @@ -4,6 +4,14 @@ #include #include +#if SDK_AUG2010 +#define RESPONSE_REQ_BUF_LEN 0x30 +#define IPC_BUF_CNT 0x40 +#else +#define RESPONSE_REQ_BUF_LEN 0x10 +#define IPC_BUF_CNT 0x10 +#endif + /* macro for matching __ipcQueueRequest */ #define diff(a, b) \ ((a) < (b)) ? ((u32)0xffffffff - (b) + (a) + 1) : ((a) - (b)) @@ -23,9 +31,11 @@ typedef struct IOSRpcRequest { } IOSRpcRequest; static IOSRpcRequest* __relnchRpc = 0; +#if SDK_AUG2010 static IOSRpcRequest* __relnchRpcSave = 0; +#endif -#define ROUNDUP(sz) (((u32)(sz) + 31) & ~(u32)(31)) +#define ROUNDUP(sz) (((u32)(sz) + (IPC_BUF_CNT / 2 - 1)) & ~(u32)(IPC_BUF_CNT / 2 - 1)) static u8 __rpcBuf[ROUNDUP(sizeof(IOSRpcRequest))] ATTRIBUTE_ALIGN(32); @@ -34,7 +44,7 @@ static struct { u32 wcount; u32 rptr; u32 wptr; - IOSResourceRequest* buf[48]; + IOSResourceRequest* buf[RESPONSE_REQ_BUF_LEN]; } __responses; static OSAlarm __timeout_alarm; @@ -93,6 +103,10 @@ static void __ipcSendRequest(void) { } if (rpc->relaunch_flag) { +#if !SDK_AUG2010 + __relnchFl = 1; + __relnchRpc = rpc; +#endif __mailboxAck--; } @@ -149,7 +163,12 @@ void IpcReplyHandler(__OSInterrupt interrupt, OSContext* context) { DCInvalidateRange(v->vector[i].base, v->vector[i].length); } - if (__relnchFl && __relnchRpcSave == rep) { +#if SDK_AUG2010 + if (__relnchFl && __relnchRpcSave == rep) +#else + if (__relnchFl && __relnchRpc == rep) +#endif + { __relnchFl = 0; if (__mailboxAck < 1) { @@ -229,7 +248,7 @@ IOSError IPCCltInit(void) { IPCInit(); - i = ROUNDUP(64 * (ROUNDUP(sizeof(IOSRpcRequest)) + 64)); + i = ROUNDUP(IPC_BUF_CNT * (ROUNDUP(sizeof(IOSRpcRequest)) + 64)); bufferLo = IPCGetBufferLo(); if ((void*)((u8*)bufferLo + i) > IPCGetBufferHi()) { @@ -245,18 +264,21 @@ IOSError IPCCltInit(void) { IPCWriteReg(1, (1 << 5 | 1<< 4 | 1 << 3)); IPCiProfInit(); +#if SDK_AUG2010 OSCreateAlarm(&__timeout_alarm); +#endif out: return ret; } +#if SDK_AUG2010 IOSError IPCCltReInit(void) { u32 i; IOSError ret = 0; void* bufferLo; - i = ROUNDUP(64 * ROUNDUP(sizeof(IOSRpcRequest))); + i = ROUNDUP(IPC_BUF_CNT * ROUNDUP(sizeof(IOSRpcRequest))); bufferLo = IPCGetBufferLo(); if ((void*)((u8*)bufferLo + i) > IPCGetBufferHi()) { @@ -270,6 +292,7 @@ IOSError IPCCltReInit(void) { out: return ret; } +#endif static IOSError __ios_Ipc1(IOSFd fd, u32 cmd, IOSIpcCb cb, void* cbArg, IOSRpcRequest** rpc) { IOSError ret = 0; @@ -773,6 +796,7 @@ IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSI u32 inten; IOSResourceRequest* req; +#if SDK_AUG2010 inten = OSDisableInterrupts(); if (__relnchFl) { @@ -783,6 +807,7 @@ IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSI __relnchFl = 1; OSRestoreInterrupts(inten); +#endif ret = __ios_Ipc1(fd, 7, 0, 0, &rpc); @@ -790,15 +815,18 @@ IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSI goto err; } +#if SDK_AUG2010 __relnchRpcSave = rpc; +#endif rpc->relaunch_flag = 1; ret = __ios_Ioctlv(rpc, cmd, readCount, writeCount, vect); - + if (ret != 0) { goto err; } +#if SDK_AUG2010 memcpy(&__rpcBuf, rpc, sizeof(IOSRpcRequest)); __relnchRpc = (IOSRpcRequest*)&__rpcBuf; req = &rpc->request; @@ -821,14 +849,19 @@ IOSError IOS_IoctlvReboot(IOSFd fd, s32 cmd, u32 readCount, u32 writeCount, IOSI OSSleepThread(&__relnchRpc->thread_queue); OSRestoreInterrupts(inten); ret = (&__relnchRpc->request)->status; +#else + ret = __ios_Ipc2(rpc, NULL); +#endif err: +#if SDK_AUG2010 __relnchFl = 0; __relnchRpcSave = NULL; if (rpc && (ret != 0)) { ipcFree(rpc); } +#endif finish: return ret; diff --git a/src/revolution/mem/mem_allocator.c b/src/revolution/mem/mem_allocator.c new file mode 100644 index 0000000000..63b2391ebb --- /dev/null +++ b/src/revolution/mem/mem_allocator.c @@ -0,0 +1,31 @@ +#include +#include + +static void* AllocatorAllocForExpHeap_(MEMAllocator *pAllocator, u32 size) { + return MEMAllocFromExpHeapEx(pAllocator->pHeap, size, pAllocator->heapParam1); +} + +static void AllocatorFreeForExpHeap_(MEMAllocator *pAllocator, void *pBlock) { + MEMFreeToExpHeap(pAllocator->pHeap, pBlock); +} + +void* MEMAllocFromAllocator(MEMAllocator *pAllocator, u32 size) { + return (*pAllocator->pFunc->pfAlloc)(pAllocator, size); +} + +void MEMFreeToAllocator(MEMAllocator *pAllocator, void *pBlock) { + (*pAllocator->pFunc->pfFree)(pAllocator, pBlock); +} + +void MEMInitAllocatorForExpHeap(MEMAllocator *pAllocator, MEMHeapHandle handle, int align) { + static const MEMAllocatorFunc sAllocatorFunc = + { + AllocatorAllocForExpHeap_, + AllocatorFreeForExpHeap_, + }; + + pAllocator->pFunc = &sAllocatorFunc; + pAllocator->pHeap = handle; + pAllocator->heapParam1 = align; + pAllocator->heapParam2 = 0; +} diff --git a/src/revolution/mem/mem_expHeap.c b/src/revolution/mem/mem_expHeap.c new file mode 100644 index 0000000000..c476dba96e --- /dev/null +++ b/src/revolution/mem/mem_expHeap.c @@ -0,0 +1,380 @@ +#include +#include + +#define FillFreeMemory(pHeapHd, address, size) ((void)0) +#define FillNoUseMemory(pHeapHd, address, size) ((void)0) + +#define RoundUp(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment) - 1)) +#define RoundUpPtr(ptr, alignment) ((void*)RoundUp(GetUIntPtr(ptr), (alignment))) +#define RoundDown(value, alignment) ((value) & ~((alignment) - 1)) +#define RoundDownPtr(ptr, alignment) ((void*)RoundDown(GetUIntPtr(ptr), (alignment))) + +typedef struct MemRegion MemRegion; + +struct MemRegion { + void* start; + void* end; +}; + +static inline void* GetMemPtrForMBlock_(MEMiExpHeapMBlockHead* pMBlkHd) { + return AddU32ToPtr(pMBlkHd, sizeof(MEMiExpHeapMBlockHead)); +} + +static inline void* GetMBlockEndAddr_(MEMiExpHeapMBlockHead* pMBHead) { + return AddU32ToPtr(GetMemPtrForMBlock_(pMBHead), pMBHead->blockSize); +} + +static inline u16 GetAllocMode_(MEMiExpHeapHead* pEHHead) { + return pEHHead->feature.fields.allocMode; +} + +static MEMiExpHeapMBlockHead* InitMBlock_(MemRegion* pRegion, u16 signature) { + MEMiExpHeapMBlockHead* block = (MEMiExpHeapMBlockHead*)pRegion->start; + + block->signature = signature; + block->attribute.val = 0; + block->blockSize = GetOffsetFromPtr(GetMemPtrForMBlock_(block), pRegion->end); + + block->prev = NULL; + block->next = NULL; + + return block; +} + +static inline void SetAllocDirForMBlock_(MEMiExpHeapMBlockHead* pMBHead, u16 mode) { + pMBHead->attribute.fields.allocDir = mode; +} + +static inline u16 GetAlignmentForMBlock_(const MEMiExpHeapMBlockHead* pMBlkHd) { + return pMBlkHd->attribute.fields.alignment; +} + +static inline void SetAlignmentForMBlock_(MEMiExpHeapMBlockHead* pMBlkHd, u16 alignment) { + pMBlkHd->attribute.fields.alignment = alignment; +} + +static inline void SetGroupIDForMBlock_(MEMiExpHeapMBlockHead* pMBHead, u16 id) { + pMBHead->attribute.fields.groupID = (u8)id; +} + +static void GetRegionOfMBlock_(MemRegion* region, MEMiExpHeapMBlockHead* block) { + region->start = SubU32ToPtr(block, GetAlignmentForMBlock_(block)); + region->end = GetMBlockEndAddr_(block); +} + +static inline MEMiHeapHead* GetHeapHeadPtrFromExpHeapHead_(MEMiExpHeapHead* pEHHead) { + return (MEMiHeapHead*)SubU32ToPtr(pEHHead, sizeof(MEMiHeapHead)); +} + +static MEMiExpHeapMBlockHead* InsertMBlock_(MEMiExpMBlockList* list, MEMiExpHeapMBlockHead* target, MEMiExpHeapMBlockHead* prev) { + MEMiExpHeapMBlockHead* next; + + target->prev = prev; + if (prev) { + next = prev->next; + prev->next = target; + } else { + next = list->head; + list->head = target; + } + + target->next = next; + if (next) { + next->prev = target; + } else { + list->tail = target; + } + + return target; +} + +static inline void AppendMBlock_(MEMiExpMBlockList* list, MEMiExpHeapMBlockHead* block) { + (void)InsertMBlock_(list, block, list->tail); +} + +static inline MEMiExpHeapHead* GetExpHeapHeadPtrFromHeapHead_(MEMiHeapHead* pHHead) { + return (MEMiExpHeapHead*)AddU32ToPtr(pHHead, sizeof(MEMiHeapHead)); +} + +static MEMiExpHeapMBlockHead* RemoveMBlock_(MEMiExpMBlockList* list, MEMiExpHeapMBlockHead* block) { + MEMiExpHeapMBlockHead* const prev = block->prev; + MEMiExpHeapMBlockHead* const next = block->next; + + if (prev) { + prev->next = next; + } else { + list->head = next; + } + + if (next) { + next->prev = prev; + } else { + list->tail = prev; + } + + return prev; +} + +static inline MEMiExpHeapMBlockHead* InitFreeMBlock_(MemRegion* pRegion) { + return InitMBlock_(pRegion, 'FR'); +} + +static inline void SetAllocMode_(MEMiExpHeapHead* pEHHead, u16 mode) { + pEHHead->feature.fields.allocMode = mode; +} + +static MEMiHeapHead* InitExpHeap_(void* startAddress, void* endAddress, u16 optFlag) { + MEMiHeapHead* pHeapHd = (MEMiHeapHead*)startAddress; + MEMiExpHeapHead* pExpHeapHd = GetExpHeapHeadPtrFromHeapHead_(pHeapHd); + + MEMiInitHeapHead(pHeapHd, 'EXPH', AddU32ToPtr(pExpHeapHd, sizeof(MEMiExpHeapHead)), endAddress, optFlag); + + pExpHeapHd->groupID = 0; + pExpHeapHd->feature.val = 0; + SetAllocMode_(pExpHeapHd, 0); + + { + MEMiExpHeapMBlockHead* pMBHead; + MemRegion region; + + region.start = pHeapHd->heapStart; + region.end = pHeapHd->heapEnd; + pMBHead = InitFreeMBlock_(®ion); + pExpHeapHd->mbFreeList.head = pMBHead; + pExpHeapHd->mbFreeList.tail = pMBHead; + pExpHeapHd->mbUsedList.head = NULL; + pExpHeapHd->mbUsedList.tail = NULL; + + return pHeapHd; + } +} + +static void* AllocUsedBlockFromFreeBlock_(MEMiExpHeapHead* pEHHead, MEMiExpHeapMBlockHead* pMBHeadFree, void* mblock, u32 size, u16 direction) { + MemRegion freeRgnT; + MemRegion freeRgnB; + MEMiExpHeapMBlockHead* pMBHeadFreePrev; + + GetRegionOfMBlock_(&freeRgnT, pMBHeadFree); + freeRgnB.end = freeRgnT.end; + freeRgnB.start = AddU32ToPtr(mblock, size); + freeRgnT.end = SubU32ToPtr(mblock, sizeof(MEMiExpHeapMBlockHead)); + + pMBHeadFreePrev = RemoveMBlock_(&pEHHead->mbFreeList, pMBHeadFree); + + if ((GetOffsetFromPtr(freeRgnT.start, freeRgnT.end) < sizeof(MEMiExpHeapMBlockHead) + 4) +#if SDK_AUG2010 + || (direction == 0 && !pEHHead->feature.fields.useMarginOfAlign) +#endif + ) { + freeRgnT.end = freeRgnT.start; + } else { + pMBHeadFreePrev = InsertMBlock_(&pEHHead->mbFreeList, InitFreeMBlock_(&freeRgnT), pMBHeadFreePrev); + } + + if ((GetOffsetFromPtr(freeRgnB.start, freeRgnB.end) < sizeof(MEMiExpHeapMBlockHead) + 4) +#if SDK_AUG2010 + || (direction == 1 && !pEHHead->feature.fields.useMarginOfAlign) +#endif + ) { + freeRgnB.start = freeRgnB.end; + } else { + (void)InsertMBlock_(&pEHHead->mbFreeList, InitFreeMBlock_(&freeRgnB), pMBHeadFreePrev); + } + + FillAllocMemory(GetHeapHeadPtrFromExpHeapHead_(pEHHead), freeRgnT.end, GetOffsetFromPtr(freeRgnT.end, freeRgnB.start)); + + { + MEMiExpHeapMBlockHead* pMBHeadNewUsed; + MemRegion region; + + region.start = SubU32ToPtr(mblock, sizeof(MEMiExpHeapMBlockHead)); + region.end = freeRgnB.start; + + pMBHeadNewUsed = InitMBlock_(®ion, 'UD'); + SetAllocDirForMBlock_(pMBHeadNewUsed, direction); + SetAlignmentForMBlock_(pMBHeadNewUsed, (u16)GetOffsetFromPtr(freeRgnT.end, pMBHeadNewUsed)); + SetGroupIDForMBlock_(pMBHeadNewUsed, pEHHead->groupID); + AppendMBlock_(&pEHHead->mbUsedList, pMBHeadNewUsed); + } + + return mblock; +} + +static void* AllocFromHead_(MEMiHeapHead* pHeapHd, u32 size, int alignment) { + MEMiExpHeapHead* pExpHeapHd = GetExpHeapHeadPtrFromHeapHead_(pHeapHd); + + const BOOL bAllocFirst = GetAllocMode_(pExpHeapHd) == 0; + + MEMiExpHeapMBlockHead* pMBlkHd = NULL; + MEMiExpHeapMBlockHead* pMBlkHdFound = NULL; + u32 foundSize = 0xffffffff; + void* foundMBlock = NULL; + + for (pMBlkHd = pExpHeapHd->mbFreeList.head; pMBlkHd; pMBlkHd = pMBlkHd->next) { + void* const mblock = GetMemPtrForMBlock_(pMBlkHd); + void* const reqMBlock = RoundUpPtr(mblock, alignment); + const u32 offset = GetOffsetFromPtr(mblock, reqMBlock); + + if (pMBlkHd->blockSize >= size + offset && foundSize > pMBlkHd->blockSize) { + pMBlkHdFound = pMBlkHd; + foundSize = pMBlkHd->blockSize; + foundMBlock = reqMBlock; + + if (bAllocFirst || foundSize == size) { + break; + } + } + } + + if (!pMBlkHdFound) { + return NULL; + } + + return AllocUsedBlockFromFreeBlock_(pExpHeapHd, pMBlkHdFound, foundMBlock, size, 0); +} + +static void* AllocFromTail_(MEMiHeapHead* pHeapHd, u32 size, int alignment) { + MEMiExpHeapHead* pExpHeapHd = GetExpHeapHeadPtrFromHeapHead_(pHeapHd); + const BOOL bAllocFirst = GetAllocMode_(pExpHeapHd) == 0; + MEMiExpHeapMBlockHead* pMBlkHd = NULL; + MEMiExpHeapMBlockHead* pMBlkHdFound = NULL; + u32 foundSize = 0xffffffff; + void* foundMBlock = NULL; + + for (pMBlkHd = pExpHeapHd->mbFreeList.tail; pMBlkHd; pMBlkHd = pMBlkHd->prev) { + void* const mblock = GetMemPtrForMBlock_(pMBlkHd); + void* const mblockEnd = AddU32ToPtr(mblock, pMBlkHd->blockSize); + void* const reqMBlock = RoundDownPtr(SubU32ToPtr(mblockEnd, size), alignment); + + if (ComparePtr(reqMBlock, mblock) >= 0 && foundSize > pMBlkHd->blockSize) { + pMBlkHdFound = pMBlkHd; + foundSize = pMBlkHd->blockSize; + foundMBlock = reqMBlock; + + if (bAllocFirst || foundSize == size) { + break; + } + } + } + + if (!pMBlkHdFound) { + return NULL; + } + + return AllocUsedBlockFromFreeBlock_(pExpHeapHd, pMBlkHdFound, foundMBlock, size, 1); +} + +static BOOL RecycleRegion_(MEMiExpHeapHead* pEHHead, const MemRegion* pRegion) { + MEMiExpHeapMBlockHead* pBlkPrFree = NULL; + MemRegion freeRgn = *pRegion; + + { + MEMiExpHeapMBlockHead* pBlk; + + for (pBlk = pEHHead->mbFreeList.head; pBlk; pBlk = pBlk->next) { + if (pBlk < pRegion->start) { + pBlkPrFree = pBlk; + continue; + } + + if (pBlk == pRegion->end) { + freeRgn.end = GetMBlockEndAddr_(pBlk); + (void)RemoveMBlock_(&pEHHead->mbFreeList, pBlk); + FillNoUseMemory(GetHeapHeadPtrFromExpHeapHead_(pEHHead), pBlk, sizeof(MEMiExpHeapMBlockHead)); + } + break; + } + } + + if (pBlkPrFree && GetMBlockEndAddr_(pBlkPrFree) == pRegion->start) { + freeRgn.start = pBlkPrFree; + pBlkPrFree = RemoveMBlock_(&pEHHead->mbFreeList, pBlkPrFree); + } + + if (GetOffsetFromPtr(freeRgn.start, freeRgn.end) < sizeof(MEMiExpHeapMBlockHead)) { + return FALSE; + } + + FillFreeMemory(GetHeapHeadPtrFromExpHeapHead_(pEHHead), pRegion->start, GetOffsetFromPtr(pRegion->start, pRegion->end)); + + (void)InsertMBlock_(&pEHHead->mbFreeList, InitFreeMBlock_(&freeRgn), pBlkPrFree); + + return TRUE; +} + +MEMHeapHandle MEMCreateExpHeapEx(void* startAddress, u32 size, u16 optFlag) { + void* endAddress; + + endAddress = RoundDownPtr(AddU32ToPtr(startAddress, size), 4); + startAddress = RoundUpPtr(startAddress, 4); + + if (GetUIntPtr(startAddress) > GetUIntPtr(endAddress) || + GetOffsetFromPtr(startAddress, endAddress) < sizeof(MEMiHeapHead) + sizeof(MEMiExpHeapHead) + sizeof(MEMiExpHeapMBlockHead) + 4) { + return 0; + } + + { + MEMiHeapHead* pHeapHd = InitExpHeap_(startAddress, endAddress, optFlag); + return pHeapHd; + } +} + +void* MEMAllocFromExpHeapEx(MEMHeapHandle heap, u32 size, int alignment) { + void* memory = NULL; + + if (size == 0) { + size = 1; + } + + size = RoundUp(size, 4); + + LockHeap(heap); + + if (alignment >= 0) { + memory = AllocFromHead_(heap, size, alignment); + } else { + memory = AllocFromTail_(heap, size, -alignment); + } + + UnlockHeap(heap); + + return memory; +} + +static inline MEMiExpHeapMBlockHead* GetMBlockHeadPtr_(void* memBlock) { + return (MEMiExpHeapMBlockHead*)SubU32ToPtr(memBlock, sizeof(MEMiExpHeapMBlockHead)); +} + +static inline MEMiExpHeapHead* GetExpHeapHeadPtrFromHandle_(MEMHeapHandle heap) { + return (MEMiExpHeapHead*)GetExpHeapHeadPtrFromHeapHead_(heap); +} + +void MEMFreeToExpHeap(MEMHeapHandle heap, void* memBlock) { + MEMiHeapHead* pHeapHd; + MEMiExpHeapHead* pExpHeapHd; + MEMiExpHeapMBlockHead* pMBHead; + MemRegion region; + + if (memBlock == NULL) { + return; + } + +#if SDK_AUG2010 + LockHeap(heap); +#endif + + pHeapHd = heap; + pExpHeapHd = GetExpHeapHeadPtrFromHandle_(pHeapHd); + pMBHead = GetMBlockHeadPtr_(memBlock); + + +#if !SDK_AUG2010 + LockHeap(heap); +#endif + + GetRegionOfMBlock_(®ion, pMBHead); + (void)RemoveMBlock_(&pExpHeapHd->mbUsedList, pMBHead); + (void)RecycleRegion_(pExpHeapHd, ®ion); + + UnlockHeap(heap); +} diff --git a/src/revolution/mem/mem_heapCommon.c b/src/revolution/mem/mem_heapCommon.c new file mode 100644 index 0000000000..b29968078c --- /dev/null +++ b/src/revolution/mem/mem_heapCommon.c @@ -0,0 +1,57 @@ +#include +#include + +static MEMList sRootList; +static BOOL sRootListInitialized = FALSE; +static OSMutex sRootMutex; + +static MEMiHeapHead* FindContainHeap_(MEMList* pList, const void* memBlock) { + MEMiHeapHead* pHeapHd = NULL; + while (NULL != (pHeapHd = (MEMiHeapHead*)MEMGetNextListObject(pList, pHeapHd))) { + if (GetUIntPtr(pHeapHd->heapStart) <= GetUIntPtr(memBlock) && GetUIntPtr(memBlock) < GetUIntPtr(pHeapHd->heapEnd)) { + MEMiHeapHead* pChildHeapHd = FindContainHeap_(&pHeapHd->childList, memBlock); + if (pChildHeapHd) { + return pChildHeapHd; + } + return pHeapHd; + } + } + return NULL; +} + +static MEMList* FindListContainHeap_(const MEMiHeapHead* pHeapHd) { + MEMList* pList = &sRootList; + + MEMiHeapHead* pContainHeap = FindContainHeap_(&sRootList, pHeapHd); + + if (pContainHeap) { + pList = &pContainHeap->childList; + } + + return pList; +} + +#define FillNoUseMemory(pHeapHd, address, size) ((void)0) + +void MEMiInitHeapHead(MEMiHeapHead* pHeapHd, u32 signature, void* heapStart, void* heapEnd, u16 optFlag) { + pHeapHd->signature = signature; + pHeapHd->heapStart = heapStart; + pHeapHd->heapEnd = heapEnd; + pHeapHd->attribute.val = 0; + + SetOptForHeap(pHeapHd, optFlag); + + FillNoUseMemory(pHeapHd, heapStart, GetOffsetFromPtr(heapStart, heapEnd)); + MEM_INIT_LIST(&pHeapHd->childList, MEMiHeapHead, link); + + if (!sRootListInitialized) { + MEM_INIT_LIST(&sRootList, MEMiHeapHead, link); + OSInitMutex(&sRootMutex); + sRootListInitialized = TRUE; + } + + OSInitMutex(&pHeapHd->mutex); + OSLockMutex(&sRootMutex); + MEMAppendListObject(FindListContainHeap_(pHeapHd), pHeapHd); + OSUnlockMutex(&sRootMutex); +} diff --git a/src/revolution/mem/mem_list.c b/src/revolution/mem/mem_list.c new file mode 100644 index 0000000000..54f8ca9bdc --- /dev/null +++ b/src/revolution/mem/mem_list.c @@ -0,0 +1,41 @@ +#include + +// I've tried inlines but only a macro seems to work +#define GetLink(parent_list, obj) ((MEMLink*)(((u32)(obj))+(parent_list)->offs)) + +void MEMInitList(MEMList *pList, u16 offs) { + pList->head = NULL; + pList->tail = NULL; + pList->num = 0; + pList->offs = offs; +} + +void MEMAppendListObject(MEMList *pList, void *pObj) { + MEMLink* link; + + if (pList->head == NULL) { + link = GetLink(pList, pObj); + link->next = NULL; + link->prev = NULL; + pList->head = pObj; + pList->tail = pObj; + pList->num++; + } + else { + link = GetLink(pList, pObj); + link->prev = pList->tail; + link->next = NULL; + + GetLink(pList, pList->tail)->next = pObj; + pList->tail = pObj; + pList->num++; + } +} + +void* MEMGetNextListObject(MEMList *pList, void *pObj) { + if (pObj == NULL) { + return pList->head; + } + + return GetLink(pList, pObj)->next; +} diff --git a/src/revolution/os/OSExec.c b/src/revolution/os/OSExec.c index 39e2edc4ef..834482a7c0 100644 --- a/src/revolution/os/OSExec.c +++ b/src/revolution/os/OSExec.c @@ -515,8 +515,10 @@ void __OSLaunchNextFirmware(void) { } __OSInitIPCBuffer(); +#if SDK_AUG2010 IPCReInit(); IPCCltReInit(); +#endif DVDLowInit(); DVDLowIntType = 0; diff --git a/src/revolution/os/OSPlayTime.c b/src/revolution/os/OSPlayTime.c index a374d68409..653afad7db 100644 --- a/src/revolution/os/OSPlayTime.c +++ b/src/revolution/os/OSPlayTime.c @@ -7,7 +7,7 @@ #include "__os.h" -OSAlarm __OSExpireAlarm; +OSAlarm __OSExpireAlarm ATTRIBUTE_ALIGN(32); OSTime __OSExpireTime; OSPlayTimeCallbackFunc __OSExpireCallback; BOOL __OSExpireSetExpiredFlag; diff --git a/src/revolution/pad/Pad.c b/src/revolution/pad/Pad.c index 4c68a1aee4..1dcc38c52b 100644 --- a/src/revolution/pad/Pad.c +++ b/src/revolution/pad/Pad.c @@ -5,6 +5,7 @@ #include #include "__si.h" +#include "revolution/vi/__vi.h" #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -14,11 +15,11 @@ #if DEBUG #define BUILD_TIME "17:27:55" #else -#define BUILD_TIME "17:33:06" +#define BUILD_TIME "17:33:17" #endif #elif SDK_SEP2006 -#define BUILD_DATE "Sep 21 2006" -#define BUILD_TIME "14:32:13" +#define BUILD_DATE "Sep 7 2006" +#define BUILD_TIME "07:20:50" #endif #ifdef SDK_AUG2010 @@ -143,7 +144,7 @@ static void DoReset() { ASSERTLINE(589, 0 <= ResettingChan && ResettingChan < SI_MAX_CHAN); chanBit = (PAD_CHAN0_BIT >> ResettingChan); ResettingBits &= ~chanBit; - + memset(&Origin[ResettingChan], 0, sizeof(PADStatus)); SIGetTypeAsync(ResettingChan, PADTypeAndStatusCallback); } @@ -221,7 +222,7 @@ static void PADProbeCallback(s32 chan, u32 error, OSContext* context) { ASSERTLINE(740, 0 <= ResettingChan && ResettingChan < SI_MAX_CHAN); ASSERTLINE(741, chan == ResettingChan); ASSERTLINE(743, (Type[chan] & SI_WIRELESS_CONT_MASK) == SI_WIRELESS_CONT && !(Type[chan] & SI_WIRELESS_LITE)); - + if (!(error & (SI_ERROR_UNDER_RUN | SI_ERROR_OVER_RUN | SI_ERROR_NO_RESPONSE | SI_ERROR_COLLISION))) { PADEnable(ResettingChan); @@ -381,7 +382,7 @@ BOOL PADInit() { if (Initialized) { return 1; } - + OSRegisterVersion(__PADVersion); if (__PADSpec) @@ -394,7 +395,7 @@ BOOL PADInit() { __OSWirelessPadFixMode = (u16)((((time)&0xffff) + ((time >> 16) & 0xffff) + ((time >> 32) & 0xffff) + ((time >> 48) & 0xffff)) & 0x3fffu); - + RecalibrateBits = PAD_CHAN0_BIT | PAD_CHAN1_BIT | PAD_CHAN2_BIT | PAD_CHAN3_BIT; } @@ -416,7 +417,9 @@ u32 PADRead(PADStatus* status) { u32 sr; int chanShift; u32 motor; +#if SDK_AUG2010 static PADStatus pre_status[4]; +#endif int threshold; threshold = 3; @@ -462,7 +465,7 @@ u32 PADRead(PADStatus* status) { if (!(SIGetType(chan) & SI_GC_NOMOTOR)) { motor |= chanBit; } - + if (!SIGetResponse(chan, &data)) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); @@ -470,7 +473,7 @@ u32 PADRead(PADStatus* status) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); } else { - + MakeStatus(chan, status, data); @@ -480,6 +483,7 @@ u32 PADRead(PADStatus* status) { threshold = 3; } +#if SDK_AUG2010 #ifdef __MWERKS__ #define abs(x) __abs(x) #else @@ -500,19 +504,20 @@ u32 PADRead(PADStatus* status) { #undef abs memcpy(&pre_status[chan], status, sizeof(PADStatus)); - +#endif + // Check and clear PAD_ORIGIN bit if (status->button & 0x2000) { status->err = PAD_ERR_TRANSFER; memset(status, 0, offsetof(PADStatus, err)); - + // Get origin. It is okay if the following transfer fails // since the PAD_ORIGIN bit remains until the read origin // command complete. SITransfer(chan, &CmdReadOrigin, 1, &Origin[chan], 10, PADOriginUpdateCallback, 0); } else { status->err = PAD_ERR_NONE; - + // Clear PAD_INTERFERE bit status->button &= ~0x0080; } @@ -690,6 +695,10 @@ static u8 ClampU8(u8 var, u8 org) { } static void SPEC2_MakeStatus(s32 chan, PADStatus* status, u32 data[2]) { +#if !SDK_AUG2010 || VERSION == VERSION_SHIELD + static PADStatus pre_status[4]; +#endif + s32 threshold; PADStatus* origin; status->button = (u16)((data[0] >> 16) & PAD_ALL); @@ -765,6 +774,29 @@ static void SPEC2_MakeStatus(s32 chan, PADStatus* status, u32 data[2]) { status->substickY = ClampS8(status->substickY, origin->substickY); status->triggerLeft = ClampU8(status->triggerLeft, origin->triggerLeft); status->triggerRight = ClampU8(status->triggerRight, origin->triggerRight); + +#if !SDK_AUG2010 + #ifdef __MWERKS__ + #define abs(x) __abs(x) + #else + #define abs(x) __builtin_abs(x) + #endif + + threshold = 9; + if (abs(status->stickX * status->stickX - pre_status[chan].stickX * pre_status[chan].stickX) >= threshold || + abs(status->stickY * status->stickY - pre_status[chan].stickY * pre_status[chan].stickY) >= threshold || + abs(status->substickX * status->substickX - pre_status[chan].substickX * pre_status[chan].substickX) >= threshold || + abs(status->substickY * status->substickY - pre_status[chan].substickY * pre_status[chan].substickY) >= threshold || + abs(status->triggerLeft * status->triggerLeft - pre_status[chan].triggerLeft * pre_status[chan].triggerLeft) >= threshold || + abs(status->triggerRight * status->triggerRight - pre_status[chan].triggerRight * pre_status[chan].triggerRight) >= threshold || + pre_status[chan].button != status->button) { + __VIResetSIIdle(); + } + + memcpy(&pre_status[chan], status, sizeof(PADStatus)); +#endif + + #undef abs } int PADGetType(s32 chan, u32* type) { @@ -889,6 +921,6 @@ BOOL PADIsBarrel(s32 chan) { if (BarrelBits & (PAD_CHAN0_BIT >> chan)) { return TRUE; } - + return FALSE; } diff --git a/src/revolution/tpl/TPL.c b/src/revolution/tpl/TPL.c new file mode 100644 index 0000000000..466f390f83 --- /dev/null +++ b/src/revolution/tpl/TPL.c @@ -0,0 +1,37 @@ +#include +#include + +void TPLBind(TPLPalettePtr ptr) { + u16 i; + + if (ptr->versionNumber != 2142000) { + OSPanic(__FILE__, 0x19, "invalid version number for texture palette"); + } + + ptr->descriptorArray = (TPLDescriptorPtr)(((u32)(ptr->descriptorArray)) + ((u32)ptr)); + + for (i = 0; i < ptr->numDescriptors; i++) { + if (ptr->descriptorArray[i].textureHeader) { + ptr->descriptorArray[i].textureHeader = (TPLHeaderPtr)(((u32)(ptr->descriptorArray[i].textureHeader)) + ((u32)ptr)); + + if (!ptr->descriptorArray[i].textureHeader->unpacked) { + ptr->descriptorArray[i].textureHeader->data = (char*)((u32)(ptr->descriptorArray[i].textureHeader->data) + (u32)ptr); + ptr->descriptorArray[i].textureHeader->unpacked = 1; + } + } + + if (ptr->descriptorArray[i].CLUTHeader) { + ptr->descriptorArray[i].CLUTHeader = (TPLClutHeaderPtr)((u32)(ptr->descriptorArray[i].CLUTHeader) + (u32)ptr); + + if (!ptr->descriptorArray[i].CLUTHeader->unpacked) { + ptr->descriptorArray[i].CLUTHeader->data = (char*)((u32)(ptr->descriptorArray[i].CLUTHeader->data) + (u32)ptr); + ptr->descriptorArray[i].CLUTHeader->unpacked = 1; + } + } + } +} + +TPLDescriptorPtr TPLGet(TPLPalettePtr ptr, u32 id) { + id %= ptr->numDescriptors; + return &ptr->descriptorArray[id]; +}