diff --git a/config/SOUE01/config.yml b/config/SOUE01/config.yml index 3615db70..3acb2db1 100644 --- a/config/SOUE01/config.yml +++ b/config/SOUE01/config.yml @@ -12,6 +12,11 @@ force_active: [ "ProcessTab__Q34nw4r2ut19TagProcessorBaseFPQ34nw4r2ut15PrintContext", # "RemoveResourceBuffer__Q44nw4r2ut6detail11ResFontBaseFv", "RemoveResource__Q34nw4r2ut7ResFontFv", + "ModuleProlog", + "ModuleEpilog", + "ModuleUnresolved", + "ModuleConstructorsX", + "ModuleDestructorsX", ] # modules: # - object: orig/SOUE01/rels/d_a_asura_bulletNP.rel diff --git a/config/SOUE01/splits.txt b/config/SOUE01/splits.txt index b1f0165e..fdd52647 100644 --- a/config/SOUE01/splits.txt +++ b/config/SOUE01/splits.txt @@ -55,11 +55,19 @@ d/d_cc.cpp: .text start:0x80050A20 end:0x800520F0 d/d_dvd.cpp: - .text start:0x800520F0 end:0x80052E00 + .text start:0x800520F0 end:0x800522FC + .data start:0x805033F0 end:0x80503400 + .sdata start:0x80571C10 end:0x80571C20 + +d/d_dvd_unk.cpp: + .text start:0x80052300 end:0x80052E00 + .sbss start:0x805750D0 end:0x805750D8 d/d_dylink.cpp: .text start:0x80052E00 end:0x80053A30 .ctors start:0x804DB674 end:0x804DB678 + .data start:0x8050D2D8 end:0x8050D30C + .sbss start:0x805750E0 end:0x805750FC d/d_fader.cpp: .text start:0x80053A30 end:0x80053E70 @@ -183,6 +191,12 @@ toBeSorted/counters/extra_wallet_counter.cpp: .data start:0x805280B0 end:0x805280D0 .sbss start:0x80575640 end:0x80575648 +DynamicLink.cpp: + .text start:0x802DF100 end:0x802DFD74 + .data start:0x805419E8 end:0x80541A70 + .sdata start:0x80573F78 end:0x80573FB0 + .sbss start:0x80575B80 end:0x80575BA0 + c/c_list.cpp: .text start:0x802E08C0 end:0x802E0A10 @@ -213,6 +227,14 @@ m/m_angle.cpp: .ctors start:0x804DB8CC end:0x804DB8D0 .sbss start:0x80575C08 end:0x80575C10 +m/m_dvd.cpp: + .text start:0x802EEBA0 end:0x802F0494 + .ctors start:0x804DB8D0 end:0x804DB8D4 + .data start:0x80542870 end:0x80542968 + .sdata start:0x80573FD0 end:0x80573FF8 + .sbss start:0x80575C10 end:0x80575C38 + .bss start:0x805B85C0 end:0x805CB078 + m/m_heap.cpp: .text start:0x802F0F00 end:0x802F1660 .rodata start:0x804F0570 end:0x804F0580 diff --git a/config/SOUE01/symbols.txt b/config/SOUE01/symbols.txt index 48b7e544..5250ad05 100644 --- a/config/SOUE01/symbols.txt +++ b/config/SOUE01/symbols.txt @@ -2140,16 +2140,16 @@ fn_80052060 = .text:0x80052060; // type:function size:0x10 fn_80052070 = .text:0x80052070; // type:function size:0x10 fn_80052080 = .text:0x80052080; // type:function size:0x10 fn_80052090 = .text:0x80052090; // type:function size:0x60 -fn_800520F0 = .text:0x800520F0; // type:function size:0x4 -fn_80052100 = .text:0x80052100; // type:function size:0x28 -fn_80052130 = .text:0x80052130; // type:function size:0x40 -fn_80052170 = .text:0x80052170; // type:function size:0x128 -fn_800522A0 = .text:0x800522A0; // type:function size:0x5C -fn_80052300 = .text:0x80052300; // type:function size:0x34 -fn_80052340 = .text:0x80052340; // type:function size:0x8 -fn_80052350 = .text:0x80052350; // type:function size:0x35C +create__4dDvdFlPQ23EGG4HeapPQ23EGG4HeapPQ23EGG4Heap = .text:0x800520F0; // type:function size:0x4 +__ct__Q24dDvd8loader_cFv = .text:0x80052100; // type:function size:0x28 +__dt__Q24dDvd8loader_cFv = .text:0x80052130; // type:function size:0x40 +request__Q24dDvd8loader_cFPCcUcPQ23EGG4Heap = .text:0x80052170; // type:function size:0x128 +remove__Q24dDvd8loader_cFv = .text:0x800522A0; // type:function size:0x5C +create__Q24dDvd11unkstruct_cFPQ23EGG4Heap = .text:0x80052300; // type:function size:0x34 +getUnk__Q24dDvd11unkstruct_cFv = .text:0x80052340; // type:function size:0x8 +draw__Q27dDvdUnk11unkstruct_cFv = .text:0x80052350; // type:function size:0x35C fn_800526B0 = .text:0x800526B0; // type:function size:0x98 -fn_80052750 = .text:0x80052750; // type:function size:0x10 +init__Q24dDvd11unkstruct_cFv = .text:0x80052750; // type:function size:0x10 fn_80052760 = .text:0x80052760; // type:function size:0x88 fn_800527F0 = .text:0x800527F0; // type:function size:0x11C fn_80052910 = .text:0x80052910; // type:function size:0x48 @@ -2169,7 +2169,7 @@ fn_80052D50 = .text:0x80052D50; // type:function size:0x78 fn_80052DD0 = .text:0x80052DD0; // type:function size:0x2C fn_80052E00 = .text:0x80052E00; // type:function size:0x1A0 fn_80052FA0 = .text:0x80052FA0; // type:function size:0x30 -fn_80052FD0 = .text:0x80052FD0; // type:function size:0x20 +Unlink__4dDylFUs = .text:0x80052FD0; // type:function size:0x20 fn_80052FF0 = .text:0x80052FF0; // type:function size:0x84 fn_80053080 = .text:0x80053080; // type:function size:0x58 fn_800530E0 = .text:0x800530E0; // type:function size:0x7C @@ -2182,9 +2182,9 @@ fn_80053780 = .text:0x80053780; // type:function size:0x54 fn_800537E0 = .text:0x800537E0; // type:function size:0x30 fn_80053810 = .text:0x80053810; // type:function size:0x6C fn_80053880 = .text:0x80053880; // type:function size:0xC -fn_80053890 = .text:0x80053890; // type:function size:0xA0 +do_link__21dDynamicModuleControlFv = .text:0x80053890; // type:function size:0xA0 fn_80053930 = .text:0x80053930; // type:function size:0x9C -fn_800539D0 = .text:0x800539D0; // type:function size:0x54 +__sinit_\d_dylink_cpp = .text:0x800539D0; // type:function size:0x54 fn_80053A30 = .text:0x80053A30; // type:function size:0xE4 fn_80053B20 = .text:0x80053B20; // type:function size:0x128 fn_80053C50 = .text:0x80053C50; // type:function size:0x198 @@ -17229,42 +17229,42 @@ fn_802DEFE0 = .text:0x802DEFE0; // type:function size:0x80 OSReport = .text:0x802DF060; // type:function size:0x80 scope:weak OSVReport = .text:0x802DF0E0; // type:function size:0x4 scope:global fn_802DF0F0 = .text:0x802DF0F0; // type:function size:0x10 -fn_802DF100 = .text:0x802DF100; // type:function size:0xA0 -fn_802DF1A0 = .text:0x802DF1A0; // type:function size:0x48 -fn_802DF1F0 = .text:0x802DF1F0; // type:function size:0x94 -fn_802DF290 = .text:0x802DF290; // type:function size:0x74 -fn_802DF310 = .text:0x802DF310; // type:function size:0x24 -fn_802DF340 = .text:0x802DF340; // type:function size:0x8 -fn_802DF350 = .text:0x802DF350; // type:function size:0x8 -fn_802DF360 = .text:0x802DF360; // type:function size:0x8 -fn_802DF370 = .text:0x802DF370; // type:function size:0x4 -fn_802DF380 = .text:0x802DF380; // type:function size:0x8 -fn_802DF390 = .text:0x802DF390; // type:function size:0x8 -fn_802DF3A0 = .text:0x802DF3A0; // type:function size:0x8 -fn_802DF3B0 = .text:0x802DF3B0; // type:function size:0x8 -fn_802DF3C0 = .text:0x802DF3C0; // type:function size:0x8 -fn_802DF3D0 = .text:0x802DF3D0; // type:function size:0x80 -fn_802DF450 = .text:0x802DF450; // type:function size:0x68 -fn_802DF4C0 = .text:0x802DF4C0; // type:function size:0x8 -fn_802DF4D0 = .text:0x802DF4D0; // type:function size:0x5C -fn_802DF530 = .text:0x802DF530; // type:function size:0x10 -fn_802DF540 = .text:0x802DF540; // type:function size:0x84 -fn_802DF5D0 = .text:0x802DF5D0; // type:function size:0x138 -fn_802DF710 = .text:0x802DF710; // type:function size:0x8C -fn_802DF7A0 = .text:0x802DF7A0; // type:function size:0x54 -fn_802DF800 = .text:0x802DF800; // type:function size:0x4 -fn_802DF810 = .text:0x802DF810; // type:function size:0x250 -fn_802DFA60 = .text:0x802DFA60; // type:function size:0xA4 -fn_802DFB10 = .text:0x802DFB10; // type:function size:0x5C -fn_802DFB70 = .text:0x802DFB70; // type:function size:0x18 -fn_802DFB90 = .text:0x802DFB90; // type:function size:0x60 -fn_802DFBF0 = .text:0x802DFBF0; // type:function size:0x70 -fn_802DFC60 = .text:0x802DFC60; // type:function size:0x50 -fn_802DFCB0 = .text:0x802DFCB0; // type:function size:0x4 -fn_802DFCC0 = .text:0x802DFCC0; // type:function size:0x4 -fn_802DFCD0 = .text:0x802DFCD0; // type:function size:0x4 -fn_802DFCE0 = .text:0x802DFCE0; // type:function size:0x44 -fn_802DFD30 = .text:0x802DFD30; // type:function size:0x44 +__dt__24DynamicModuleControlBaseFv = .text:0x802DF100; // type:function size:0xA0 +__ct__24DynamicModuleControlBaseFv = .text:0x802DF1A0; // type:function size:0x48 +link__24DynamicModuleControlBaseFv = .text:0x802DF1F0; // type:function size:0x94 +unlink__24DynamicModuleControlBaseFv = .text:0x802DF290; // type:function size:0x74 +load_async__24DynamicModuleControlBaseFv = .text:0x802DF310; // type:function size:0x24 +getModuleName__24DynamicModuleControlBaseCFv = .text:0x802DF340; // type:function size:0x8 +getModuleSize__24DynamicModuleControlBaseCFv = .text:0x802DF350; // type:function size:0x8 +getModuleTypeString__24DynamicModuleControlBaseCFv = .text:0x802DF360; // type:function size:0x8 +dump__24DynamicModuleControlBaseFv = .text:0x802DF370; // type:function size:0x4 +do_load__24DynamicModuleControlBaseFv = .text:0x802DF380; // type:function size:0x8 +do_load_async__24DynamicModuleControlBaseFv = .text:0x802DF390; // type:function size:0x8 +do_unload__24DynamicModuleControlBaseFv = .text:0x802DF3A0; // type:function size:0x8 +do_link__24DynamicModuleControlBaseFv = .text:0x802DF3B0; // type:function size:0x8 +do_unlink__24DynamicModuleControlBaseFv = .text:0x802DF3C0; // type:function size:0x8 +__ct__20DynamicModuleControlFPCcPQ23EGG7ExpHeap = .text:0x802DF3D0; // type:function size:0x80 +__dt__20DynamicModuleControlFv = .text:0x802DF450; // type:function size:0x68 +getModuleName__20DynamicModuleControlCFv = .text:0x802DF4C0; // type:function size:0x8 +initialize__20DynamicModuleControlFPQ23EGG7ExpHeap = .text:0x802DF4D0; // type:function size:0x5C +callback__20DynamicModuleControlFPv = .text:0x802DF530; // type:function size:0x10 +checkHeapStatus__20DynamicModuleControlFv = .text:0x802DF540; // type:function size:0x84 +do_load__20DynamicModuleControlFv = .text:0x802DF5D0; // type:function size:0x138 +do_load_async__20DynamicModuleControlFv = .text:0x802DF710; // type:function size:0x8C +do_unload__20DynamicModuleControlFv = .text:0x802DF7A0; // type:function size:0x54 +dump__20DynamicModuleControlFv = .text:0x802DF800; // type:function size:0x4 +do_link__20DynamicModuleControlFv = .text:0x802DF810; // type:function size:0x250 +do_unlink__20DynamicModuleControlFv = .text:0x802DFA60; // type:function size:0xA4 +getModuleSize__20DynamicModuleControlCFv = .text:0x802DFB10; // type:function size:0x5C +getModuleTypeString__20DynamicModuleControlCFv = .text:0x802DFB70; // type:function size:0x18 +__dt__9DbMapFileFv = .text:0x802DFB90; // type:function size:0x60 +RegisterOnDvd__9DbMapFileFPCcPC12OSModuleInfo = .text:0x802DFBF0; // type:function size:0x70 +Unregister__9DbMapFileFv = .text:0x802DFC60; // type:function size:0x50 +ModuleProlog = .text:0x802DFCB0; // type:function size:0x4 +ModuleEpilog = .text:0x802DFCC0; // type:function size:0x4 +ModuleUnresolved = .text:0x802DFCD0; // type:function size:0x4 +ModuleConstructorsX = .text:0x802DFCE0; // type:function size:0x44 +ModuleDestructorsX = .text:0x802DFD30; // type:function size:0x44 fn_802DFD80 = .text:0x802DFD80; // type:function size:0x4 fn_802DFD90 = .text:0x802DFD90; // type:function size:0x234 fn_802DFFD0 = .text:0x802DFFD0; // type:function size:0x1B8 @@ -17718,86 +17718,86 @@ fn_802EE830 = .text:0x802EE830; // type:function size:0x58 fn_802EE890 = .text:0x802EE890; // type:function size:0x38 fn_802EE8D0 = .text:0x802EE8D0; // type:function size:0xB0 fn_802EE980 = .text:0x802EE980; // type:function size:0x214 -fn_802EEBA0 = .text:0x802EEBA0; // type:function size:0x40 -fn_802EEBE0 = .text:0x802EEBE0; // type:function size:0x40 -fn_802EEC20 = .text:0x802EEC20; // type:function size:0x40 -fn_802EEC60 = .text:0x802EEC60; // type:function size:0x40 -fn_802EECA0 = .text:0x802EECA0; // type:function size:0x40 -fn_802EECE0 = .text:0x802EECE0; // type:function size:0xC -fn_802EECF0 = .text:0x802EECF0; // type:function size:0x40 -fn_802EED30 = .text:0x802EED30; // type:function size:0x3C -fn_802EED70 = .text:0x802EED70; // type:function size:0x40 -fn_802EEDB0 = .text:0x802EEDB0; // type:function size:0x38 -fn_802EEDF0 = .text:0x802EEDF0; // type:function size:0x8 -fn_802EEE00 = .text:0x802EEE00; // type:function size:0x8 -fn_802EEE10 = .text:0x802EEE10; // type:function size:0x24 -fn_802EEE40 = .text:0x802EEE40; // type:function size:0x4C -fn_802EEE90 = .text:0x802EEE90; // type:function size:0x8 -fn_802EEEA0 = .text:0x802EEEA0; // type:function size:0x88 -fn_802EEF30 = .text:0x802EEF30; // type:function size:0x158 -fn_802EF090 = .text:0x802EF090; // type:function size:0x8 -fn_802EF0A0 = .text:0x802EF0A0; // type:function size:0x30 -fn_802EF0D0 = .text:0x802EF0D0; // type:function size:0x60 -fn_802EF130 = .text:0x802EF130; // type:function size:0xC -fn_802EF140 = .text:0x802EF140; // type:function size:0x8 -fn_802EF150 = .text:0x802EF150; // type:function size:0x10 -fn_802EF160 = .text:0x802EF160; // type:function size:0x4 -fn_802EF170 = .text:0x802EF170; // type:function size:0x14 -fn_802EF190 = .text:0x802EF190; // type:function size:0x44 -fn_802EF1E0 = .text:0x802EF1E0; // type:function size:0x50 -fn_802EF230 = .text:0x802EF230; // type:function size:0x8 -fn_802EF240 = .text:0x802EF240; // type:function size:0x8 -fn_802EF250 = .text:0x802EF250; // type:function size:0x8 -fn_802EF260 = .text:0x802EF260; // type:function size:0xA8 -fn_802EF310 = .text:0x802EF310; // type:function size:0xB8 -fn_802EF3D0 = .text:0x802EF3D0; // type:function size:0x34 -fn_802EF410 = .text:0x802EF410; // type:function size:0x4C -fn_802EF460 = .text:0x802EF460; // type:function size:0x1C -fn_802EF480 = .text:0x802EF480; // type:function size:0x20 -fn_802EF4A0 = .text:0x802EF4A0; // type:function size:0x54 -fn_802EF500 = .text:0x802EF500; // type:function size:0x58 -fn_802EF560 = .text:0x802EF560; // type:function size:0x64 -fn_802EF5D0 = .text:0x802EF5D0; // type:function size:0x78 +__dt__Q24mDvd42TUncompressInfo_cFv = .text:0x802EEBA0; // type:function size:0x40 +__dt__Q24mDvd41TUncompressInfo_cFv = .text:0x802EEBE0; // type:function size:0x40 +__dt__Q24mDvd41TUncompressInfo_cFv = .text:0x802EEC20; // type:function size:0x40 +__dt__Q24mDvd42TUncompressInfo_cFv = .text:0x802EEC60; // type:function size:0x40 +__dt__Q24mDvd41TUncompressInfo_cFv = .text:0x802EECA0; // type:function size:0x40 +unk_setDecompressorPtrs__4mDvdFPPQ24mDvd22TUncompressInfo_Base_cPPQ24mDvd22TUncompressInfo_Base_c = .text:0x802EECE0; // type:function size:0xC +unk_initDecompressors__4mDvdFv = .text:0x802EECF0; // type:function size:0x40 +findUncompressInfo__4mDvdFUc = .text:0x802EED30; // type:function size:0x3C +newUncompressObj__4mDvdFUc = .text:0x802EED70; // type:function size:0x40 +deleteUncompressObj__4mDvdFUc = .text:0x802EEDB0; // type:function size:0x38 +getOSThread__4mDvdFv = .text:0x802EEDF0; // type:function size:0x8 +getArchiveHeap__4mDvdFv = .text:0x802EEE00; // type:function size:0x8 +run__Q24mDvd10MyThread_cFP12mDvd_param_c = .text:0x802EEE10; // type:function size:0x24 +__ct__Q24mDvd10MyThread_cFiPQ23EGG4Heap = .text:0x802EEE40; // type:function size:0x4C +run__Q24mDvd10MyThread_cFv = .text:0x802EEE90; // type:function size:0x8 +create__4mDvdFiPQ23EGG4HeapPQ23EGG4HeapPQ23EGG4Heap = .text:0x802EEEA0; // type:function size:0x88 +loadToMainRAM__4mDvdFiPcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionlPUlPUlUl = .text:0x802EEF30; // type:function size:0x158 +ConvertPathToEntrynum__4mDvdFPCc = .text:0x802EF090; // type:function size:0x8 +IsExistPath__4mDvdFPCc = .text:0x802EF0A0; // type:function size:0x30 +__dt__14mDvd_command_cFv = .text:0x802EF0D0; // type:function size:0x60 +__nw__14mDvd_command_cFUl = .text:0x802EF130; // type:function size:0xC +__dl__14mDvd_command_cFPv = .text:0x802EF140; // type:function size:0x8 +done__14mDvd_command_cFv = .text:0x802EF150; // type:function size:0x10 +doClear__14mDvd_command_cFv = .text:0x802EF160; // type:function size:0x4 +waitDone__14mDvd_command_cFv = .text:0x802EF170; // type:function size:0x14 +waitUntilDone__14mDvd_command_cFv = .text:0x802EF190; // type:function size:0x44 +__ct__12mDvd_param_cFv = .text:0x802EF1E0; // type:function size:0x50 +kick__12mDvd_param_cFv = .text:0x802EF230; // type:function size:0x8 +waitForKick__12mDvd_param_cFv = .text:0x802EF240; // type:function size:0x8 +getFirstCommand__12mDvd_param_cFv = .text:0x802EF250; // type:function size:0x8 +addCommand__12mDvd_param_cFP14mDvd_command_c = .text:0x802EF260; // type:function size:0xA8 +removeCommand__12mDvd_param_cFP14mDvd_command_c = .text:0x802EF310; // type:function size:0xB8 +executeCB__12mDvd_param_cFPP14mDvd_command_c = .text:0x802EF3D0; // type:function size:0x34 +mainLoop__12mDvd_param_cFv = .text:0x802EF410; // type:function size:0x4C +__ct__14mDvd_command_cFv = .text:0x802EF460; // type:function size:0x1C +do_delete__14mDvd_command_cFv = .text:0x802EF480; // type:function size:0x20 +destroy__14mDvd_command_cFPP14mDvd_command_c = .text:0x802EF4A0; // type:function size:0x54 +__dt__15mDvd_callback_cFv = .text:0x802EF500; // type:function size:0x58 +__ct__15mDvd_callback_cFPFPv_bPv = .text:0x802EF560; // type:function size:0x64 +create__15mDvd_callback_cFPFPv_bPv = .text:0x802EF5D0; // type:function size:0x78 fn_802EF650 = .text:0x802EF650; // type:function size:0x30 -fn_802EF680 = .text:0x802EF680; // type:function size:0x54 -fn_802EF6E0 = .text:0x802EF6E0; // type:function size:0x58 -fn_802EF740 = .text:0x802EF740; // type:function size:0x74 -fn_802EF7C0 = .text:0x802EF7C0; // type:function size:0x16C -fn_802EF930 = .text:0x802EF930; // type:function size:0x8 -fn_802EF940 = .text:0x802EF940; // type:function size:0x8 -fn_802EF950 = .text:0x802EF950; // type:function size:0x80 -fn_802EF9D0 = .text:0x802EF9D0; // type:function size:0x4 -fn_802EF9E0 = .text:0x802EF9E0; // type:function size:0xA0 -fn_802EFA80 = .text:0x802EFA80; // type:function size:0xF8 -fn_802EFB80 = .text:0x802EFB80; // type:function size:0x18 -fn_802EFBA0 = .text:0x802EFBA0; // type:function size:0x64 -fn_802EFC10 = .text:0x802EFC10; // type:function size:0x6C -fn_802EFC80 = .text:0x802EFC80; // type:function size:0x58 -fn_802EFCE0 = .text:0x802EFCE0; // type:function size:0x58 -fn_802EFD40 = .text:0x802EFD40; // type:function size:0x60 -fn_802EFDA0 = .text:0x802EFDA0; // type:function size:0x80 -fn_802EFE20 = .text:0x802EFE20; // type:function size:0x64 -fn_802EFE90 = .text:0x802EFE90; // type:function size:0x30 -fn_802EFEC0 = .text:0x802EFEC0; // type:function size:0x78 -fn_802EFF40 = .text:0x802EFF40; // type:function size:0x4C -fn_802EFF90 = .text:0x802EFF90; // type:function size:0x9C -fn_802F0030 = .text:0x802F0030; // type:function size:0x30 -fn_802F0060 = .text:0x802F0060; // type:function size:0x48 -fn_802F00B0 = .text:0x802F00B0; // type:function size:0x58 -fn_802F0110 = .text:0x802F0110; // type:function size:0xA0 -fn_802F01B0 = .text:0x802F01B0; // type:function size:0x18 -fn_802F01D0 = .text:0x802F01D0; // type:function size:0x58 -fn_802F0230 = .text:0x802F0230; // type:function size:0xE0 -fn_802F0310 = .text:0x802F0310; // type:function size:0x3C -fn_802F0350 = .text:0x802F0350; // type:function size:0x4 -fn_802F0360 = .text:0x802F0360; // type:function size:0x40 -fn_802F03A0 = .text:0x802F03A0; // type:function size:0x4 -fn_802F03B0 = .text:0x802F03B0; // type:function size:0x3C -fn_802F03F0 = .text:0x802F03F0; // type:function size:0x4 -fn_802F0400 = .text:0x802F0400; // type:function size:0x3C -fn_802F0440 = .text:0x802F0440; // type:function size:0x4 -fn_802F0450 = .text:0x802F0450; // type:function size:0x3C -fn_802F0490 = .text:0x802F0490; // type:function size:0x4 +execute__15mDvd_callback_cFv = .text:0x802EF680; // type:function size:0x54 +__dt__22mDvd_mountMemArchive_cFv = .text:0x802EF6E0; // type:function size:0x58 +__ct__22mDvd_mountMemArchive_cFi = .text:0x802EF740; // type:function size:0x74 +findPathWithCompressedExtension__FPCcPUc = .text:0x802EF7C0; // type:function size:0x16C +setAutoStreamDecomp__Fb = .text:0x802EF930; // type:function size:0x8 +getAutoStreamDecomp__Fv = .text:0x802EF940; // type:function size:0x8 +ConvertPathToEntrynum__FPCcPUc = .text:0x802EF950; // type:function size:0x80 +ConvertPathToEntrynum_Thunk__FPCcPUc = .text:0x802EF9D0; // type:function size:0x4 +create__22mDvd_mountMemArchive_cFPCcUcPQ23EGG4Heap = .text:0x802EF9E0; // type:function size:0xA0 +execute__22mDvd_mountMemArchive_cFv = .text:0x802EFA80; // type:function size:0xF8 +getArcBinary__22mDvd_mountMemArchive_cFv = .text:0x802EFB80; // type:function size:0x18 +doClear__22mDvd_mountMemArchive_cFv = .text:0x802EFBA0; // type:function size:0x64 +__ct__21mDvd_toMainRam_base_cFi = .text:0x802EFC10; // type:function size:0x6C +__dt__21mDvd_toMainRam_base_cFv = .text:0x802EFC80; // type:function size:0x58 +__dt__20mDvd_toMainRam_arc_cFv = .text:0x802EFCE0; // type:function size:0x58 +__ct__20mDvd_toMainRam_arc_cFPQ23EGG7Archiveii = .text:0x802EFD40; // type:function size:0x60 +makeRequest__20mDvd_toMainRam_arc_cFPQ23EGG7ArchiveiiPQ23EGG4Heap = .text:0x802EFDA0; // type:function size:0x80 +create__20mDvd_toMainRam_arc_cFPQ23EGG7ArchivePCciPQ23EGG4Heap = .text:0x802EFE20; // type:function size:0x64 +createOrFail__20mDvd_toMainRam_arc_cFPQ23EGG7ArchivePCciPQ23EGG4Heap = .text:0x802EFE90; // type:function size:0x30 +execute__20mDvd_toMainRam_arc_cFv = .text:0x802EFEC0; // type:function size:0x78 +__ct__23mDvd_toMainRam_normal_cFi = .text:0x802EFF40; // type:function size:0x4C +create__23mDvd_toMainRam_normal_cFPCciPQ23EGG4Heap = .text:0x802EFF90; // type:function size:0x9C +createOrFail__23mDvd_toMainRam_normal_cFPCciPQ23EGG4Heap = .text:0x802F0030; // type:function size:0x30 +create2__23mDvd_toMainRam_normal_cFPP23mDvd_toMainRam_normal_cPCciPQ23EGG4Heap = .text:0x802F0060; // type:function size:0x48 +__dt__23mDvd_toMainRam_normal_cFv = .text:0x802F00B0; // type:function size:0x58 +execute__23mDvd_toMainRam_normal_cFv = .text:0x802F0110; // type:function size:0xA0 +doClear__23mDvd_toMainRam_normal_cFv = .text:0x802F01B0; // type:function size:0x18 +__dt__Q24mDvd10MyThread_cFv = .text:0x802F01D0; // type:function size:0x58 +__sinit_\m_dvd_cpp = .text:0x802F0230; // type:function size:0xE0 scope:local +Construct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F0310; // type:function size:0x3C +Destruct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F0350; // type:function size:0x4 +Construct__Q24mDvd42TUncompressInfo_cCFv = .text:0x802F0360; // type:function size:0x40 +Destruct__Q24mDvd42TUncompressInfo_cCFv = .text:0x802F03A0; // type:function size:0x4 +Construct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F03B0; // type:function size:0x3C +Destruct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F03F0; // type:function size:0x4 +Construct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F0400; // type:function size:0x3C +Destruct__Q24mDvd41TUncompressInfo_cCFv = .text:0x802F0440; // type:function size:0x4 +Construct__Q24mDvd42TUncompressInfo_cCFv = .text:0x802F0450; // type:function size:0x3C +Destruct__Q24mDvd42TUncompressInfo_cCFv = .text:0x802F0490; // type:function size:0x4 fn_802F04A0 = .text:0x802F04A0; // type:function size:0x48 fn_802F04F0 = .text:0x802F04F0; // type:function size:0x12C fn_802F0620 = .text:0x802F0620; // type:function size:0x9C @@ -21970,10 +21970,10 @@ fn_803A9500 = .text:0x803A9500; // type:function size:0x4 fn_803A9510 = .text:0x803A9510; // type:function size:0xC fn_803A9520 = .text:0x803A9520; // type:function size:0x2C4 fn_803A97F0 = .text:0x803A97F0; // type:function size:0x2E8 -fn_803A9AE0 = .text:0x803A9AE0; // type:function size:0x8 -fn_803A9AF0 = .text:0x803A9AF0; // type:function size:0x1C +OSLink = .text:0x803A9AE0; // type:function size:0x8 +OSLinkFixed = .text:0x803A9AF0; // type:function size:0x1C fn_803A9B10 = .text:0x803A9B10; // type:function size:0x240 -fn_803A9D50 = .text:0x803A9D50; // type:function size:0x1D4 +OSUnlink = .text:0x803A9D50; // type:function size:0x1D4 __OSModuleInit = .text:0x803A9F30; // type:function size:0x18 scope:global fn_803A9F50 = .text:0x803A9F50; // type:function size:0xA4 OSInitMessageQueue = .text:0x803AA000; // type:function size:0x60 @@ -22049,7 +22049,7 @@ fn_803ACF10 = .text:0x803ACF10; // type:function size:0xE4 OSCancelThread = .text:0x803AD000; // type:function size:0x1D4 scope:global fn_803AD1E0 = .text:0x803AD1E0; // type:function size:0x144 OSDetachThread = .text:0x803AD330; // type:function size:0xA0 -fn_803AD3D0 = .text:0x803AD3D0; // type:function size:0x29C +OSResumeThread = .text:0x803AD3D0; // type:function size:0x29C fn_803AD670 = .text:0x803AD670; // type:function size:0x18C OSSleepThread = .text:0x803AD800; // type:function size:0xF0 scope:global OSWakeupThread = .text:0x803AD8F0; // type:function size:0xF8 @@ -26137,7 +26137,7 @@ unmount__Q23EGG7ArchiveFv = .text:0x80493B80; // type:function size:0x94 getFile__Q23EGG7ArchiveFPCcPQ33EGG7Archive8FileInfo = .text:0x80493C20; // type:function size:0xC4 convertPathToEntryID__Q23EGG7ArchiveFPCc = .text:0x80493CF0; // type:function size:0x8 getFileFast__Q23EGG7ArchiveFlPQ33EGG7Archive8FileInfo = .text:0x80493D00; // type:function size:0xB8 -loadFromDiscFast__EGG__Archive = .text:0x80493DC0; // type:function size:0x148 +getFileFast__Q23EGG7ArchiveFlPQ23EGG4Heapl = .text:0x80493DC0; // type:function size:0x148 countFileCallbackFunc__3EGGFPvPvUlPC11ARCDirEntryPCc = .text:0x80493F10; // type:function size:0x18 countFile__Q23EGG7ArchiveFv = .text:0x80493F30; // type:function size:0x38 searchInsideWithPath__3EGGFPQ23EGG7ArchiveP9ARCHandlePFPvPvUlPC11ARCDirEntryPCc_vPvPcUl = .text:0x80493F70; // type:function size:0x144 @@ -30061,7 +30061,7 @@ lbl_80503314 = .data:0x80503314; // type:object size:0x6C __vt__7dBase_c = .data:0x80503380; // type:object size:0x4C lbl_805033D0 = .data:0x805033D0; // type:object size:0x10 lbl_805033E0 = .data:0x805033E0; // type:object size:0x10 -lbl_805033F0 = .data:0x805033F0; // type:object size:0x10 +__vt__Q24dDvd8loader_c = .data:0x805033F0; // type:object size:0x10 lbl_80503400 = .data:0x80503400; // type:object size:0x40 lbl_80503440 = .data:0x80503440; // type:object size:0x6DF8 lbl_8050A238 = .data:0x8050A238; // type:object size:0x14 @@ -30695,7 +30695,7 @@ lbl_8050D290 = .data:0x8050D290; // type:object size:0x14 lbl_8050D2A4 = .data:0x8050D2A4; // type:object size:0x14 lbl_8050D2B8 = .data:0x8050D2B8; // type:object size:0x14 lbl_8050D2CC = .data:0x8050D2CC; // type:object size:0xC -lbl_8050D2D8 = .data:0x8050D2D8; // type:object size:0x34 +lbl_8050D2D8 = .data:0x8050D2D8; // type:object size:0x32 data:string lbl_8050D30C = .data:0x8050D30C; // type:object size:0x14 lbl_8050D320 = .data:0x8050D320; // type:object size:0x10 lbl_8050D330 = .data:0x8050D330; // type:object size:0xC @@ -35665,8 +35665,8 @@ lbl_805419A8 = .data:0x805419A8; // type:object size:0x40 lbl_805419E8 = .data:0x805419E8; // type:object size:0xC data:string lbl_805419F4 = .data:0x805419F4; // type:object size:0xC data:string lbl_80541A00 = .data:0x80541A00; // type:object size:0x10 -lbl_80541A10 = .data:0x80541A10; // type:object size:0x30 -lbl_80541A40 = .data:0x80541A40; // type:object size:0x30 +__vt__20DynamicModuleControl = .data:0x80541A10; // type:object size:0x30 +__vt__24DynamicModuleControlBase = .data:0x80541A40; // type:object size:0x30 lbl_80541A70 = .data:0x80541A70; // type:object size:0x808 lbl_80542278 = .data:0x80542278; // type:object size:0xB4 data:4byte lbl_8054232C = .data:0x8054232C; // type:object size:0x30 @@ -35717,18 +35717,18 @@ lbl_805427F0 = .data:0x805427F0; // type:object size:0x30 lbl_80542820 = .data:0x80542820; // type:object size:0x14 lbl_80542834 = .data:0x80542834; // type:object size:0x14 lbl_80542848 = .data:0x80542848; // type:object size:0x28 -lbl_80542870 = .data:0x80542870; // type:object size:0x18 -lbl_80542888 = .data:0x80542888; // type:object size:0x14 -lbl_8054289C = .data:0x8054289C; // type:object size:0x14 -lbl_805428B0 = .data:0x805428B0; // type:object size:0x14 -lbl_805428C4 = .data:0x805428C4; // type:object size:0x14 -lbl_805428D8 = .data:0x805428D8; // type:object size:0x14 -lbl_805428EC = .data:0x805428EC; // type:object size:0x14 -lbl_80542900 = .data:0x80542900; // type:object size:0x14 -lbl_80542914 = .data:0x80542914; // type:object size:0x14 -lbl_80542928 = .data:0x80542928; // type:object size:0x14 -lbl_8054293C = .data:0x8054293C; // type:object size:0x14 -lbl_80542950 = .data:0x80542950; // type:object size:0x18 +__vt__Q24mDvd10MyThread_c = .data:0x80542870; // type:object size:0x18 +__vt__23mDvd_toMainRam_normal_c = .data:0x80542888; // type:object size:0x14 +__vt__20mDvd_toMainRam_arc_c = .data:0x8054289C; // type:object size:0x14 +__vt__21mDvd_toMainRam_base_c = .data:0x805428B0; // type:object size:0x14 +__vt__22mDvd_mountMemArchive_c = .data:0x805428C4; // type:object size:0x14 +__vt__15mDvd_callback_c = .data:0x805428D8; // type:object size:0x14 +__vt__14mDvd_command_c = .data:0x805428EC; // type:object size:0x14 +__vt__Q24mDvd41TUncompressInfo_c = .data:0x80542900; // type:object size:0x14 +__vt__Q24mDvd42TUncompressInfo_c = .data:0x80542914; // type:object size:0x14 +__vt__Q24mDvd41TUncompressInfo_c = .data:0x80542928; // type:object size:0x14 +__vt__Q24mDvd41TUncompressInfo_c = .data:0x8054293C; // type:object size:0x14 +__vt__Q24mDvd42TUncompressInfo_c = .data:0x80542950; // type:object size:0x14 lbl_80542968 = .data:0x80542968; // type:object size:0x28 lbl_80542990 = .data:0x80542990; // type:object size:0x29 lbl_805429BC = .data:0x805429BC; // type:object size:0x29 @@ -37092,11 +37092,11 @@ lbl_8056E7F8 = .data:0x8056E7F8; // type:object size:0x14 lbl_8056E80C = .data:0x8056E80C; // type:object size:0x14 lbl_8056E820 = .data:0x8056E820; // type:object size:0x10 lbl_8056E830 = .data:0x8056E830; // type:object size:0x28 -lbl_8056E858 = .data:0x8056E858; // type:object size:0x18 -lbl_8056E870 = .data:0x8056E870; // type:object size:0x18 -lbl_8056E888 = .data:0x8056E888; // type:object size:0x18 -lbl_8056E8A0 = .data:0x8056E8A0; // type:object size:0x18 -lbl_8056E8B8 = .data:0x8056E8B8; // type:object size:0x18 +__vt__Q23EGG15StreamDecompSZS = .data:0x8056E858; // type:object size:0x18 +__vt__Q23EGG15StreamDecompLRC = .data:0x8056E870; // type:object size:0x18 +__vt__Q23EGG14StreamDecompLH = .data:0x8056E888; // type:object size:0x18 +__vt__Q23EGG14StreamDecompRL = .data:0x8056E8A0; // type:object size:0x18 +__vt__Q23EGG14StreamDecompLZ = .data:0x8056E8B8; // type:object size:0x18 __vt__Q23EGG9Allocator = .data:0x8056E8D0; // type:object size:0x14 lbl_8056E8E8 = .data:0x8056E8E8; // type:object size:0x68 __vt__Q23EGG4Heap = .data:0x8056E950; // type:object size:0x30 @@ -37570,8 +37570,8 @@ lbl_80571BF8 = .sdata:0x80571BF8; // type:object size:0x8 lbl_80571C00 = .sdata:0x80571C00; // type:object size:0x4 data:4byte lbl_80571C04 = .sdata:0x80571C04; // type:object size:0x4 data:4byte lbl_80571C08 = .sdata:0x80571C08; // type:object size:0x8 data:4byte -lbl_80571C10 = .sdata:0x80571C10; // type:object size:0x8 -lbl_80571C18 = .sdata:0x80571C18; // type:object size:0x8 +lbl_80571C10 = .sdata:0x80571C10; // type:object size:0x5 data:string +lbl_80571C18 = .sdata:0x80571C18; // type:object size:0x3 data:string lbl_80571C20 = .sdata:0x80571C20; // type:object size:0x8 data:string lbl_80571C28 = .sdata:0x80571C28; // type:object size:0x8 lbl_80571C30 = .sdata:0x80571C30; // type:object size:0x8 data:string @@ -39012,14 +39012,14 @@ lbl_80573F58 = .sdata:0x80573F58; // type:object size:0x8 lbl_80573F60 = .sdata:0x80573F60; // type:object size:0x8 lbl_80573F68 = .sdata:0x80573F68; // type:object size:0x8 data:4byte lbl_80573F70 = .sdata:0x80573F70; // type:object size:0x8 data:4byte -lbl_80573F78 = .sdata:0x80573F78; // type:object size:0x8 -lbl_80573F80 = .sdata:0x80573F80; // type:object size:0x8 -lbl_80573F88 = .sdata:0x80573F88; // type:object size:0x4 data:4byte -lbl_80573F8C = .sdata:0x80573F8C; // type:object size:0x8 -lbl_80573F94 = .sdata:0x80573F94; // type:object size:0x8 +lbl_80573F78 = .sdata:0x80573F78; // type:object size:0x5 data:string +lbl_80573F80 = .sdata:0x80573F80; // type:object size:0x6 data:string +sRelsDir__20DynamicModuleControl = .sdata:0x80573F88; // type:object size:0x4 data:4byte +lbl_80573F8C = .sdata:0x80573F8C; // type:object size:0x6 data:string +lbl_80573F94 = .sdata:0x80573F94; // type:object size:0x5 data:string lbl_80573F9C = .sdata:0x80573F9C; // type:object size:0x4 data:string -lbl_80573FA0 = .sdata:0x80573FA0; // type:object size:0x8 -lbl_80573FA8 = .sdata:0x80573FA8; // type:object size:0x8 +lbl_80573FA0 = .sdata:0x80573FA0; // type:object size:0x5 data:string +lbl_80573FA8 = .sdata:0x80573FA8; // type:object size:0x4 data:string lbl_80573FB0 = .sdata:0x80573FB0; // type:object size:0x4 data:4byte lbl_80573FB4 = .sdata:0x80573FB4; // type:object size:0x4 data:4byte m_rootUniqueID__7fBase_c = .sdata:0x80573FB8; // type:object size:0x4 data:4byte @@ -39028,10 +39028,10 @@ lbl_80573FC8 = .sdata:0x80573FC8; // type:object size:0x8 data:4byte lbl_80573FD0 = .sdata:0x80573FD0; // type:object size:0x4 lbl_80573FD4 = .sdata:0x80573FD4; // type:object size:0x1 data:byte lbl_80573FD8 = .sdata:0x80573FD8; // type:object size:0x4 data:4byte -lbl_80573FDC = .sdata:0x80573FDC; // type:object size:0x8 +lbl_80573FDC = .sdata:0x80573FDC; // type:object size:0x5 data:string lbl_80573FE4 = .sdata:0x80573FE4; // type:object size:0x4 data:string lbl_80573FE8 = .sdata:0x80573FE8; // type:object size:0x4 data:string -lbl_80573FEC = .sdata:0x80573FEC; // type:object size:0x8 +lbl_80573FEC = .sdata:0x80573FEC; // type:object size:0x5 data:string lbl_80573FF4 = .sdata:0x80573FF4; // type:object size:0x4 data:string g_DefaultGameHeapId__5mHeap = .sdata:0x80573FF8; // type:object size:0x1 data:byte lbl_80574000 = .sdata:0x80574000; // type:object size:0x8 data:4byte @@ -39689,13 +39689,13 @@ s_DrawControlFlags__7dBase_c = .sbss:0x805750C4; // type:object size:0x4 data:4b s_NextExecuteControlFlags__7dBase_c = .sbss:0x805750C8; // type:object size:0x4 data:4byte lbl_805750D0 = .sbss:0x805750D0; // type:object size:0x8 data:4byte lbl_805750D8 = .sbss:0x805750D8; // type:object size:0x8 data:4byte -lbl_805750E0 = .sbss:0x805750E0; // type:object size:0x4 data:4byte -lbl_805750E4 = .sbss:0x805750E4; // type:object size:0x4 data:4byte -lbl_805750E8 = .sbss:0x805750E8; // type:object size:0x4 data:4byte -lbl_805750EC = .sbss:0x805750EC; // type:object size:0x4 data:4byte -lbl_805750F0 = .sbss:0x805750F0; // type:object size:0x4 data:4byte -lbl_805750F4 = .sbss:0x805750F4; // type:object size:0x4 data:4byte -lbl_805750F8 = .sbss:0x805750F8; // type:object size:0x8 data:4byte +pDynamicNameTable = .sbss:0x805750E0; // type:object size:0x4 data:4byte +nDynamicNameTable = .sbss:0x805750E4; // type:object size:0x4 data:4byte +pDMC__4dDyl = .sbss:0x805750E8; // type:object size:0x4 data:4byte +nDMC__4dDyl = .sbss:0x805750EC; // type:object size:0x4 data:4byte +cCc_frmHeap__4dDyl = .sbss:0x805750F0; // type:object size:0x4 data:4byte +Initialized__4dDyl = .sbss:0x805750F4; // type:object size:0x1 data:byte +DVD__4dDyl = .sbss:0x805750F8; // type:object size:0x4 data:4byte lbl_80575100 = .sbss:0x80575100; // type:object size:0x8 data:byte lbl_80575108 = .sbss:0x80575108; // type:object size:0x8 data:byte lbl_80575110 = .sbss:0x80575110; // type:object size:0x8 data:4byte @@ -40231,14 +40231,14 @@ lbl_80575B68 = .sbss:0x80575B68; // type:object size:0x8 data:4byte lbl_80575B70 = .sbss:0x80575B70; // type:object size:0x8 data:4byte lbl_80575B78 = .sbss:0x80575B78; // type:object size:0x4 data:4byte lbl_80575B7C = .sbss:0x80575B7C; // type:object size:0x4 data:4byte -lbl_80575B80 = .sbss:0x80575B80; // type:object size:0x4 data:4byte -lbl_80575B84 = .sbss:0x80575B84; // type:object size:0x4 data:4byte -lbl_80575B88 = .sbss:0x80575B88; // type:object size:0x4 data:4byte -lbl_80575B8C = .sbss:0x80575B8C; // type:object size:0x4 data:4byte -lbl_80575B90 = .sbss:0x80575B90; // type:object size:0x4 data:4byte -lbl_80575B94 = .sbss:0x80575B94; // type:object size:0x4 data:4byte -lbl_80575B98 = .sbss:0x80575B98; // type:object size:0x4 data:4byte -lbl_80575B9C = .sbss:0x80575B9C; // type:object size:0x4 data:4byte +mFirst__24DynamicModuleControlBase = .sbss:0x80575B80; // type:object size:0x4 data:4byte +mLast__24DynamicModuleControlBase = .sbss:0x80575B84; // type:object size:0x4 data:4byte +sAllocBytes__20DynamicModuleControl = .sbss:0x80575B88; // type:object size:0x4 data:4byte +sDvdFile__20DynamicModuleControl = .sbss:0x80575B8C; // type:object size:0x4 data:4byte +sDylinkHeap__20DynamicModuleControl = .sbss:0x80575B90; // type:object size:0x4 data:4byte +sCurrentAllocatableSize__20DynamicModuleControl = .sbss:0x80575B94; // type:object size:0x4 data:4byte +sTotalFreeSize__20DynamicModuleControl = .sbss:0x80575B98; // type:object size:0x4 data:4byte +sArchive__20DynamicModuleControl = .sbss:0x80575B9C; // type:object size:0x4 data:4byte lbl_80575BA0 = .sbss:0x80575BA0; // type:object size:0x8 data:4byte m_forceExecuteList__7fBase_c = .sbss:0x80575BA8; // type:object size:0x8 data:4byte sLoadAsyncCallback__7fBase_c = .sbss:0x80575BB0; // type:object size:0x4 data:4byte @@ -40260,17 +40260,17 @@ lbl_80575BF8 = .sbss:0x80575BF8; // type:object size:0x4 data:4byte lbl_80575BFC = .sbss:0x80575BFC; // type:object size:0x1 data:byte lbl_80575C00 = .sbss:0x80575C00; // type:object size:0x8 data:4byte Zero__7mAng3_c = .sbss:0x80575C08; // type:object size:0x6 data:2byte -lbl_80575C10 = .sbss:0x80575C10; // type:object size:0x4 data:4byte -lbl_80575C14 = .sbss:0x80575C14; // type:object size:0x4 data:4byte -lbl_80575C18 = .sbss:0x80575C18; // type:object size:0x4 data:4byte -lbl_80575C1C = .sbss:0x80575C1C; // type:object size:0x4 data:4byte -lbl_80575C20 = .sbss:0x80575C20; // type:object size:0x4 data:4byte -lbl_80575C24 = .sbss:0x80575C24; // type:object size:0x4 data:4byte -lbl_80575C28 = .sbss:0x80575C28; // type:object size:0x4 data:4byte -lbl_80575C2C = .sbss:0x80575C2C; // type:object size:0x4 data:4byte -lbl_80575C30 = .sbss:0x80575C30; // type:object size:0x1 data:byte -lbl_80575C31 = .sbss:0x80575C31; // type:object size:0x1 data:byte -lbl_80575C34 = .sbss:0x80575C34; // type:object size:0x4 data:4byte +somePtr__4mDvd = .sbss:0x80575C10; // type:object size:0x4 data:4byte +someNumber__4mDvd = .sbss:0x80575C14; // type:object size:0x4 data:4byte +compressors_ptr__4mDvd = .sbss:0x80575C18; // type:object size:0x4 data:4byte +compressors_last__4mDvd = .sbss:0x80575C1C; // type:object size:0x4 data:4byte +l_OSThread__4mDvd = .sbss:0x80575C20; // type:object size:0x4 data:4byte +l_MyThread__4mDvd = .sbss:0x80575C24; // type:object size:0x4 data:4byte +l_CommandHeap__4mDvd = .sbss:0x80575C28; // type:object size:0x4 data:4byte +l_ArchiveHeap__4mDvd = .sbss:0x80575C2C; // type:object size:0x4 data:4byte +l_IsAutoStreamDecomp__4mDvd = .sbss:0x80575C30; // type:object size:0x1 data:byte +@GUARD@loadToMainRAM__4mDvdFiPcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionlPUlPUlUl@DvdFile = .sbss:0x80575C31; // type:object size:0x1 data:byte +mInstance__12mDvd_param_c = .sbss:0x80575C34; // type:object size:0x4 data:4byte s_SavedCurrentHeap__5mHeap = .sbss:0x80575C38; // type:object size:0x4 data:4byte g_archiveHeap__5mHeap = .sbss:0x80575C3C; // type:object size:0x4 data:4byte g_commandHeap__5mHeap = .sbss:0x80575C40; // type:object size:0x4 data:4byte @@ -49068,13 +49068,17 @@ m_searchManage__10fManager_c = .bss:0x805B8548; // type:object size:0x40 lbl_805B8588 = .bss:0x805B8588; // type:object size:0xC lbl_805B8594 = .bss:0x805B8594; // type:object size:0xC lbl_805B85A0 = .bss:0x805B85A0; // type:object size:0x20 data:4byte -lbl_805B85C0 = .bss:0x805B85C0; // type:object size:0xC data:4byte -lbl_805B85CC = .bss:0x805B85CC; // type:object size:0x6772 -lbl_805BED3E = .bss:0x805BED3E; // type:object size:0x28FA -lbl_805C1638 = .bss:0x805C1638; // type:object size:0x9930 -lbl_805CAF68 = .bss:0x805CAF68; // type:object size:0x30 -lbl_805CAF98 = .bss:0x805CAF98; // type:object size:0x10 -lbl_805CAFA8 = .bss:0x805CAFA8; // type:object size:0xD0 +s_UncompressInfoSZS__4mDvd = .bss:0x805B85C0; // type:object size:0xC data:4byte +s_UncompressInfoLZ__4mDvd = .bss:0x805B85CC; // type:object size:0xC data:4byte +s_UncompressInfoLH__4mDvd = .bss:0x805B85D8; // type:object size:0xC data:4byte +s_UncompressInfoLRC__4mDvd = .bss:0x805B85E4; // type:object size:0xC data:4byte +s_UncompressInfoRL__4mDvd = .bss:0x805B85F0; // type:object size:0xC data:4byte +likely_align__4mDvd = .bss:0x805B85FC; // type:object size:0x7A04 +more_empty_space__4mDvd = .bss:0x805C0000; // type:object size:0x1638 +decompressor_alloc_space__4mDvd = .bss:0x805C1638; // type:object size:0x9930 +l_param__4mDvd = .bss:0x805CAF68; // type:object size:0x30 +lbl_805CAF98 = .bss:0x805CAF98; // type:object size:0xC +@LOCAL@loadToMainRAM__4mDvdFiPcPQ23EGG4HeapQ33EGG9DvdRipper15EAllocDirectionlPUlPUlUl@DvdFile = .bss:0x805CAFA8; // type:object size:0xD0 g_gameHeaps__5mHeap = .bss:0x805CB078; // type:object size:0x10 data:4byte lbl_805CB088 = .bss:0x805CB088; // type:object size:0x30 data:4byte lbl_805CB0B8 = .bss:0x805CB0B8; // type:object size:0x10 data:4byte diff --git a/configure.py b/configure.py index 8b572602..38b302df 100644 --- a/configure.py +++ b/configure.py @@ -281,6 +281,9 @@ config.libs = [ Object(Matching, "c/c_list.cpp"), Object(Matching, "c/c_tree.cpp"), Object(Matching, "d/d_base.cpp"), + Object(Matching, "d/d_dvd.cpp"), + Object(NonMatching, "d/d_dvd_unk.cpp"), + Object(NonMatching, "d/d_dylink.cpp"), Object(NonMatching, "d/d_heap.cpp"), Object(NonMatching, "d/d_stage.cpp"), Object(NonMatching, "d/d_sys.cpp"), @@ -301,8 +304,10 @@ config.libs = [ Object(Matching, "f/f_list.cpp"), Object(Matching, "f/f_manager.cpp"), Object(Matching, "m/m_angle.cpp"), + Object(Matching, "m/m_dvd.cpp"), Object(Matching, "m/m_heap.cpp"), Object(NonMatching, "m/m_mtx.cpp"), + Object(Matching, "DynamicLink.cpp"), # framework (f_name) # d stuff (d_name) ], diff --git a/include/DynamicLink.h b/include/DynamicLink.h new file mode 100644 index 00000000..1e9e3319 --- /dev/null +++ b/include/DynamicLink.h @@ -0,0 +1,94 @@ +#ifndef DYNAMICLINK_H +#define DYNAMICLINK_H + +#include +#include +#include + +class DbMapFile { +public: + DbMapFile(): unk_0(0) {} + ~DbMapFile(); + + void RegisterOnDvd(const char *, const OSModuleInfo *); + void Unregister(); +private: + UNKWORD unk_0; +}; + +// https://github.com/zeldaret/tp/blob/main/include/DynamicLink.h + +struct DynamicModuleControlBase { + /* 0x00 */ u16 mLinkCount; + /* 0x02 */ u16 mDoLinkCount; + /* 0x04 */ DynamicModuleControlBase* mPrev; + /* 0x08 */ DynamicModuleControlBase* mNext; + + /* 0x0C */ /*vtable*/ + /* 802df100 */ virtual ~DynamicModuleControlBase(); + /* 802df340 */ virtual const char* getModuleName() const; + /* 802df350 */ virtual int getModuleSize() const; + /* 802df360 */ virtual const char* getModuleTypeString() const; + /* 802df370 */ virtual void dump(); + /* 802df380 */ virtual bool do_load(); + /* 802df390 */ virtual BOOL do_load_async(); + /* 802df3a0 */ virtual bool do_unload(); + /* 802df3b0 */ virtual BOOL do_link(); + /* 802df3c0 */ virtual bool do_unlink(); + /* 802df1a0 */ DynamicModuleControlBase(); + /* 802df1f0 */ BOOL link(); + /* 802df290 */ BOOL unlink(); + /* 802df310 */ BOOL load_async(); + + static inline DynamicModuleControlBase* getFirstClass() { return mFirst; } + inline DynamicModuleControlBase* getNextClass() { return mNext; } + bool isLinked() const { return mLinkCount != 0; } + + static DynamicModuleControlBase* mFirst; + static DynamicModuleControlBase* mLast; +}; + +struct DynamicModuleControl : DynamicModuleControlBase { + /* 802df4c0 */ virtual const char* getModuleName() const; + /* 802df450 */ virtual ~DynamicModuleControl(); + /* 802dfb10 */ virtual int getModuleSize() const; + /* 802dfb70 */ virtual const char* getModuleTypeString() const; + /* 802df800 */ virtual void dump(); + /* 802df5d0 */ virtual bool do_load(); + /* 802df710 */ virtual BOOL do_load_async(); + /* 802df7a0 */ virtual bool do_unload(); + /* 802df810 */ virtual BOOL do_link(); + /* 802dfa60 */ virtual bool do_unlink(); + /* 802df3d0 */ DynamicModuleControl(char const*, EGG::ExpHeap *); + /* 802df4d0 */ static void initialize(EGG::ExpHeap *heap); + /* 802df530 */ static bool callback(void*); + void checkHeapStatus(); + + /* 0x10 */ UNKWORD unk_16; + /* 0x14 */ OSModuleHeader *mModule; + /* 0x18 */ void *mBss; + /* 0x1C */ UNKWORD unk_24; + /* 0x20 */ const char *mName; + /* 0x24 */ u8 mResourceType; + /* 0x25 */ u8 unk_33; + /* 0x28 */ UNKWORD unk_40; + /* 0x2C */ mDvd_callback_c *mDvdCallbackRequest; + /* 0x30 */ EGG::ExpHeap *mHeap; + /* 0x34 */ DbMapFile mpRelMapFile; + // Some of these might be members of DbMapFile + UNKWORD unk1; + UNKWORD unk2; + UNKWORD unk3; + UNKWORD unk4; + + static u32 sAllocBytes; + static mDvd_toMainRam_base_c *sDvdFile; + static EGG::ExpHeap *sDylinkHeap; + static u32 sCurrentAllocatableSize; + static u32 sTotalFreeSize; + static EGG::Archive *sArchive; + + static const char *sRelsDir; +}; + +#endif diff --git a/include/d/d_dvd.h b/include/d/d_dvd.h new file mode 100644 index 00000000..a7addacb --- /dev/null +++ b/include/d/d_dvd.h @@ -0,0 +1,30 @@ +#ifndef D_DVD_H +#define D_DVD_H + +#include +#include +#include + +namespace dDvd { + +// difference to NSMBW: additional heap arg +void create(s32 priority, EGG::Heap*, EGG::Heap*, EGG::Heap*); + +class loader_c { +public: + loader_c(); + /** vtable at 0x805033F0 */ + virtual ~loader_c(); + void *request(const char *path, u8 mountDirection, EGG::Heap *heap); + virtual void remove(); + +private: + u32 mSize; + mDvd_toMainRam_normal_c *mpCommand; + EGG::Heap* mpHeap; + void* mpBuffer; +}; + +} // dDvd + +#endif diff --git a/include/d/d_dvd_unk.h b/include/d/d_dvd_unk.h new file mode 100644 index 00000000..080a6eb6 --- /dev/null +++ b/include/d/d_dvd_unk.h @@ -0,0 +1,26 @@ +#ifndef D_DVD_UNK_H +#define D_DVD_UNK_H + +#include +#include + +namespace dDvdUnk { + +class unkstruct_c { +public: + static unkstruct_c *create(EGG::Heap *heap); + void draw(); + void execute(); + void init(); + char getUnk(); + + static void createFont(EGG::Heap *heap); + +private: + UNKWORD field_0x0; + char field_0x4; +}; + +} // dDvdUnk + +#endif diff --git a/include/d/d_dylink.h b/include/d/d_dylink.h new file mode 100644 index 00000000..c7a0a6a2 --- /dev/null +++ b/include/d/d_dylink.h @@ -0,0 +1,12 @@ +#ifndef D_DYLINK_H +#define D_DYLINK_H + +#include + +namespace dDyl { + +bool Unlink(u16 relId); + +} // dDyl + +#endif diff --git a/include/egg/core/eggArchive.h b/include/egg/core/eggArchive.h index 4600a3f8..72f2ec97 100644 --- a/include/egg/core/eggArchive.h +++ b/include/egg/core/eggArchive.h @@ -40,7 +40,7 @@ public: /* 80493760 */ static Archive *findArchive(NANDFileInfo *file); /* 804937f0 */ static void appendList(Archive *); // prob private /* 80493850 */ static void removeList(Archive *); - /* 80493860 */ static Archive *mount(void *data, Heap *heap, s32 align); + /* 80493860 */ static Archive *mount(void *data, Heap *heap, int align); /* 80493950 */ static Archive *mountFST(void *data, Heap *heap, s32 align); /* 80493a40 */ static Archive *mountNandFile(NANDFileInfo *, Heap *heap, s32 align); /* 80493ac0 */ static Archive *loadFST(const char *fileName, Heap *heap, s32 align); diff --git a/include/egg/core/eggDecomp.h b/include/egg/core/eggDecomp.h index 46b8f11f..83248930 100644 --- a/include/egg/core/eggDecomp.h +++ b/include/egg/core/eggDecomp.h @@ -70,7 +70,7 @@ public: private: // NON-OFFICIAL struct SZSCompContext { - u8 _[0x18]; + u8 _[0x14]; /* 80494e00 */ static u32 getUncompressedSize(const void *src); /* 80494e30 */ void init(u32 maxCompSize); /* 80494e60 */ static int readSzsHeader(/* unk params*/); diff --git a/include/egg/core/eggDvdFile.h b/include/egg/core/eggDvdFile.h index 8d7c13da..a9e9ef2b 100644 --- a/include/egg/core/eggDvdFile.h +++ b/include/egg/core/eggDvdFile.h @@ -32,8 +32,8 @@ public: /* vt 0x0C | 80494450 */ virtual bool open(const char *path); /* vt 0x10 | 804944b0 */ virtual void close(); /* vt 0x14 | 80494510 */ virtual s32 readData(void *buffer, s32 length, s32 offset); - /* vt 0x18 | 804945e0 */ virtual s32 writeData(void *buffer, s32 length, s32 offset); - /* vt 0x1C | 80494670 */ virtual u32 getFileSize(); + /* vt 0x18 | 804945e0 */ virtual s32 writeData(const void *buffer, s32 length, s32 offset); + /* vt 0x1C | 80494670 */ virtual u32 getFileSize() const; /* vt 0x20 | 804943d0 */ virtual bool open(s32 entryNum); /* vt 0x24 | 804944a0 */ virtual bool open(const char *path, void *); diff --git a/include/egg/core/eggDvdRipper.h b/include/egg/core/eggDvdRipper.h index 873508d6..fc2cc374 100644 --- a/include/egg/core/eggDvdRipper.h +++ b/include/egg/core/eggDvdRipper.h @@ -20,7 +20,7 @@ public: /* 804947e0 */ static u8 *loadToMainRAM(DvdFile *file, u8 *dst, Heap *heap, EAllocDirection allocDir, u32 offset, u32 *amountRead, u32 *fileSize); /* 804949b0 */ static void *loadToMainRAMDecomp(DvdFile *file, StreamDecomp *decompressor, u8 *dst, Heap *heap, - EAllocDirection allocDir, u32 offset, s32 size, u32 maxChunkSize, u32 *amountRead, u32 *fileSize); + EAllocDirection allocDir, s32 offset, u32 size, u32 maxChunkSize, u32 *amountRead, u32 *fileSize); public: /* 80574ed0 */ static bool sErrorRetry; diff --git a/include/m/m_dvd.h b/include/m/m_dvd.h new file mode 100644 index 00000000..11890653 --- /dev/null +++ b/include/m/m_dvd.h @@ -0,0 +1,186 @@ +#ifndef M_DVD_H +#define M_DVD_H + +#include +#include +#include +#include +#include + +// Note: names are taken from NSMBW where available but a lot are made up + +void unk_initDecompressors(); + +namespace mDvd { + +extern void *somePtr; + +class TUncompressInfo_Base_c { +public: + TUncompressInfo_Base_c(u8 type, const char *extension) : mType(type), mExtension(extension) {} + virtual ~TUncompressInfo_Base_c() {} + virtual EGG::StreamDecomp *Construct() const { + return nullptr; + } + virtual void Destruct() const {} + + u8 mType; + const char *mExtension; +}; + +template +class TUncompressInfo_c : public TUncompressInfo_Base_c { +public: + TUncompressInfo_c(u8 type, const char *extension) : TUncompressInfo_Base_c(type, extension) {} + virtual T *Construct() const { + return new (somePtr) T(); + } + virtual void Destruct() const {} +}; + +void create(int priority, EGG::Heap *commandHeap, EGG::Heap *archiveHeap, EGG::Heap *threadHeap); +int ConvertPathToEntrynum(const char *path); +u32 IsExistPath(const char *path); + +OSThread *getOSThread(); +EGG::Heap *getArchiveHeap(); +} // namespace mDvd + +class mDvd_command_c { +public: + mDvd_command_c(); + virtual ~mDvd_command_c(); + + virtual u32 execute() = 0; + virtual void doClear(); + + void done(); + void waitDone(); + void waitUntilDone(); + static void destroy(mDvd_command_c **cmd); + void do_delete(); + + void *operator new(size_t size); + void operator delete(void *ptr); + + mDvd_command_c *mNext; + u8 mStatus; + u8 mMountDirection; + u8 mCompressionType; +}; + +typedef bool (*dvdReadCallback)(void *); + +class mDvd_callback_c : public mDvd_command_c { +public: + mDvd_callback_c(dvdReadCallback cb, void *cbData); + virtual ~mDvd_callback_c(); + virtual u32 execute() override; + + static mDvd_callback_c *create(dvdReadCallback cb, void *cbData); + + dvdReadCallback mCallback; + void *mCallbackData; + BOOL mSuccess; +}; + +class mDvd_mountMemArchive_c : public mDvd_command_c { +public: + mDvd_mountMemArchive_c(int mountDirection); + virtual ~mDvd_mountMemArchive_c(); + virtual u32 execute(); + virtual void doClear(); + + static mDvd_mountMemArchive_c *create(const char *path, u8 mountDirection, EGG::Heap *heap); + void *getArcBinary(); + + int mEntryNum; + EGG::Archive *mDataPtr; + EGG::Heap *mHeap; + u32 mAmountRead; +}; + +class mDvd_toMainRam_base_c : public mDvd_command_c { +public: + mDvd_toMainRam_base_c(int mountDirection); + virtual ~mDvd_toMainRam_base_c(); + virtual u32 execute() = 0; + + void *mDataPtr; + int mAmountRead; + u32 mFileSize; + EGG::Heap *mHeap; +}; + +class mDvd_toMainRam_arc_c : public mDvd_toMainRam_base_c { +public: + mDvd_toMainRam_arc_c(EGG::Archive *arc, int entryNum, int mountDirection); + virtual ~mDvd_toMainRam_arc_c(); + virtual u32 execute(); + + static mDvd_toMainRam_arc_c *makeRequest(EGG::Archive *arc, int entryNum, int mountDirection, EGG::Heap *heap); + static mDvd_toMainRam_arc_c *create(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap); + static mDvd_toMainRam_arc_c *createOrFail(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap); + + EGG::Archive *mArcPtr; + int mEntryNum; +}; + +class mDvd_toMainRam_normal_c : public mDvd_toMainRam_base_c { +public: + mDvd_toMainRam_normal_c(int mountDirection); + ~mDvd_toMainRam_normal_c(); + virtual u32 execute(); + virtual void doClear(); + + static mDvd_toMainRam_normal_c *create(const char *path, int mountDirection, EGG::Heap *heap); + static mDvd_toMainRam_normal_c *createOrFail(const char *path, int mountDirection, EGG::Heap *heap); + static void create2(mDvd_toMainRam_normal_c **cmd, const char *path, int mountDirection, EGG::Heap *heap); + + u8 mCompressionType2; + int mEntryNum; +}; + +class mDvd_param_c { +public: + mDvd_param_c(); + + OSMutex mMutex; + mDvd_command_c *mFirstRequest; + mDvd_command_c *mLastRequest; + OSThreadQueue mThreadQueue1; + OSThreadQueue mThreadQueue2; + + void kick(); + void waitForKick(); + + mDvd_command_c *getFirstCommand(); + void addCommand(mDvd_command_c *cmd); + void removeCommand(mDvd_command_c *cmd); + static u32 executeCB(mDvd_command_c **cmd); + void mainLoop(); + + static mDvd_param_c *mInstance; +}; + +namespace mDvd { + +class MyThread_c : EGG::Thread { +public: + MyThread_c(int priority, EGG::Heap *heap); + + virtual void *run() override; + + OSThread *getMyOsThread() { + return mOSThread; + } + + void setThreadHeap(EGG::Heap *heap) { + setThreadCurrentHeap(heap); + } + + static void *run(mDvd_param_c *dvd); +}; +} // namespace mDvd + +#endif diff --git a/include/rvl/OS/OSLink.h b/include/rvl/OS/OSLink.h index 0736a590..8f6df8b0 100644 --- a/include/rvl/OS/OSLink.h +++ b/include/rvl/OS/OSLink.h @@ -1,13 +1,113 @@ -#ifndef RVL_SDK_OS_LINK_H -#define RVL_SDK_OS_LINK_H +#ifndef OSLINK_H +#define OSLINK_H + #include + #ifdef __cplusplus extern "C" { #endif +#define OS_MODULE_VERSION 3 + +typedef struct OSModuleHeader OSModuleHeader; + +typedef u32 OSModuleID; +typedef struct OSModuleQueue OSModuleQueue; +typedef struct OSModuleLink OSModuleLink; +typedef struct OSModuleInfo OSModuleInfo; +typedef struct OSSectionInfo OSSectionInfo; +typedef struct OSImportInfo OSImportInfo; +typedef struct OSRel OSRel; + +// OSModuleQueue __OSModuleList : 0x800030C8; +// void* __OSStringTable : 0x800030D0; +extern OSModuleQueue __OSModuleList; +extern void * __OSStringTable; + +struct OSModuleQueue { + OSModuleInfo* head; + OSModuleInfo* tail; +}; + +struct OSModuleLink { + OSModuleInfo* next; + OSModuleInfo* prev; +}; + +struct OSSectionInfo { + u32 offset; + u32 size; +}; + +struct OSModuleInfo { + OSModuleID id; // unique identifier for the module + OSModuleLink link; // doubly linked list of modules + u32 numSections; // # of sections + u32 sectionInfoOffset; // offset to section info table + u32 nameOffset; // offset to module name + u32 nameSize; // size of module name + u32 version; // version number +}; + +struct OSModuleHeader { + // CAUTION: info must be the 1st member + OSModuleInfo info; + + // OS_MODULE_VERSION == 1 + u32 bssSize; // total size of bss sections in bytes + u32 relOffset; + u32 impOffset; + u32 impSize; // size in bytes + u8 prologSection; // section # for prolog function + u8 epilogSection; // section # for epilog function + u8 unresolvedSection; // section # for unresolved function + u8 bssSection; // section # for bss section (set at run-time) + u32 prolog; // prolog function offset + u32 epilog; // epilog function offset + u32 unresolved; // unresolved function offset + + // OS_MODULE_VERSION == 2 +#if (2 <= OS_MODULE_VERSION) + u32 align; // module alignment constraint + u32 bssAlign; // bss alignment constraint +#endif + + // OS_MODULE_VERSION == 3 +#if (3 <= OS_MODULE_VERSION) + u32 fixSize; +#endif +}; + +#define OSGetSectionInfo(module) ((OSSectionInfo*)(((OSModuleInfo*)(module))->sectionInfoOffset)) + +#define OS_SECTIONINFO_EXEC 0x1 +#define OS_SECTIONINFO_OFFSET(offset) ((offset) & ~0x1) + +struct OSImportInfo { + OSModuleID id; // external module id + u32 offset; // offset to OSRel instructions +}; + +struct OSRel { + u16 offset; // byte offset from the previous entry + u8 type; + u8 section; + u32 addend; +}; + +#define R_DOLPHIN_NOP 201 // C9h current offset += OSRel.offset +#define R_DOLPHIN_SECTION 202 // CAh current section = OSRel.section +#define R_DOLPHIN_END 203 // CBh +#define R_DOLPHIN_MRKREF 204 // CCh + +BOOL OSLink(OSModuleInfo* newModule, void* bss); +BOOL OSLinkFixed(OSModuleInfo* newModule, void* bss); +BOOL OSUnlink(OSModuleInfo* module); +void OSSetStringTable(void* string_table); void __OSModuleInit(void); #ifdef __cplusplus -} -#endif +}; #endif + +#endif /* OSLINK_H */ diff --git a/src/DynamicLink.cpp b/src/DynamicLink.cpp new file mode 100644 index 00000000..2c7947c0 --- /dev/null +++ b/src/DynamicLink.cpp @@ -0,0 +1,374 @@ +#include + +DynamicModuleControlBase *DynamicModuleControlBase::mFirst; +DynamicModuleControlBase *DynamicModuleControlBase::mLast; + +DynamicModuleControlBase::~DynamicModuleControlBase() { + if (mPrev != nullptr) { + mPrev->mNext = mNext; + } + if (mNext != nullptr) { + mNext->mPrev = mPrev; + } + if (mFirst == this) { + mFirst = mNext; + } + if (mLast == this) { + mLast = mPrev; + } + mNext = nullptr; + mPrev = nullptr; +} + +DynamicModuleControlBase::DynamicModuleControlBase() { + mLinkCount = 0; + mDoLinkCount = 0; + mNext = nullptr; + if (mFirst == nullptr) { + mFirst = this; + } + DynamicModuleControlBase *last = mLast; + mPrev = last; + if (last != nullptr) { + last->mNext = this; + } + mLast = this; +} + +BOOL DynamicModuleControlBase::link() { + if (mLinkCount == 0) { + do_load(); + if (!do_link()) { + return false; + } + + if (mDoLinkCount < 0xFFFF) { + mDoLinkCount++; + } + } + + if (mLinkCount < 0xFFFF) { + mLinkCount++; + } + + return true; +} + +BOOL DynamicModuleControlBase::unlink() { + if (mLinkCount != 0) { + if (mLinkCount < 0xFFFF && --mLinkCount == 0) { + do_unlink(); + do_unload(); + } + } + + return true; +} + +BOOL DynamicModuleControlBase::load_async() { + if (mLinkCount == 0) { + return do_load_async(); + } + return true; +} + +const char *DynamicModuleControlBase::getModuleName() const { + return nullptr; +} + +int DynamicModuleControlBase::getModuleSize() const { + return 0; +} + +const char *DynamicModuleControlBase::getModuleTypeString() const { + return "Base"; +} + +void DynamicModuleControlBase::dump() {} + +bool DynamicModuleControlBase::do_load() { + return true; +} + +BOOL DynamicModuleControlBase::do_load_async() { + return true; +} + +bool DynamicModuleControlBase::do_unload() { + return true; +} + +BOOL DynamicModuleControlBase::do_link() { + return true; +} + +bool DynamicModuleControlBase::do_unlink() { + return true; +} + +u32 DynamicModuleControl::sAllocBytes; +mDvd_toMainRam_base_c *DynamicModuleControl::sDvdFile; +EGG::ExpHeap *DynamicModuleControl::sDylinkHeap; +u32 DynamicModuleControl::sCurrentAllocatableSize; +u32 DynamicModuleControl::sTotalFreeSize; +EGG::Archive *DynamicModuleControl::sArchive; + +DynamicModuleControl::DynamicModuleControl(const char *name, EGG::ExpHeap *heap) + : mModule(nullptr), mBss(nullptr), unk_24(0), mName(name), mResourceType(0), unk_33(0), unk_40(0), + mDvdCallbackRequest(0), mHeap(heap), mpRelMapFile() {} + +DynamicModuleControl::~DynamicModuleControl() {} + +const char *DynamicModuleControl::getModuleName() const { + return mName; +} + +void DynamicModuleControl::initialize(EGG::ExpHeap *heap) { + sDylinkHeap = heap; + sCurrentAllocatableSize = heap->getAllocatableSize(4); + sTotalFreeSize = heap->getTotalFreeSize(); +} + +bool DynamicModuleControl::callback(void *arg) { + return static_cast(arg)->do_load(); +} + +void DynamicModuleControl::checkHeapStatus() { + if (mHeap == sDylinkHeap) { + int size = mHeap->getAllocatableSize(4); + if (sCurrentAllocatableSize > size) { + sCurrentAllocatableSize = size; + } + size = mHeap->getTotalFreeSize(); + if (sTotalFreeSize > size) { + sTotalFreeSize = size; + } + } +} + +const char *DynamicModuleControl::sRelsDir = "/rels"; + +bool DynamicModuleControl::do_load() { + char buf[64]; + if (mModule != nullptr) { + return true; + } + if (mHeap == nullptr) { + mHeap = sDylinkHeap; + } + snprintf(buf, sizeof(buf), "%s/%sNP.rel", sRelsDir, mName); + if (mModule == nullptr) { + if (sArchive != nullptr) { + sDvdFile = mDvd_toMainRam_arc_c::createOrFail(sArchive, buf, 1, mHeap); + } else { + sDvdFile = mDvd_toMainRam_normal_c::createOrFail(buf, 1, mHeap); + } + + if (sDvdFile != nullptr) { + sDvdFile->waitUntilDone(); + checkHeapStatus(); + void *ptr = sDvdFile->mDataPtr; + sDvdFile->mDataPtr = nullptr; + mModule = static_cast(ptr); + sDvdFile->do_delete(); + sDvdFile = nullptr; + if (mModule != nullptr) { + unk_40 = 0; + mResourceType = 3; + } + } + } + + if (mModule == nullptr) { + return false; + } + if (unk_33 < 0xFF) { + unk_33++; + } + checkHeapStatus(); + return true; +} + +BOOL DynamicModuleControl::do_load_async() { + if (mDvdCallbackRequest == nullptr) { + if (mModule != nullptr) { + return true; + } + mDvdCallbackRequest = mDvd_callback_c::create(callback, this); + } + + if (mDvdCallbackRequest != nullptr && mDvdCallbackRequest->mStatus != 0) { + mDvdCallbackRequest->do_delete(); + mDvdCallbackRequest = nullptr; + return true; + } else { + return false; + } +} + +bool DynamicModuleControl::do_unload() { + if (mModule != nullptr) { + mHeap->free(mModule); + mModule = nullptr; + } + + return true; +} + +void DynamicModuleControl::dump() {} + +BOOL DynamicModuleControl::do_link() { + char mapPath[64]; + + if (mModule != nullptr) { + int alignedFixSize = ROUND_UP(mModule->fixSize, 0x20); + int alignedFixPtr = (int)mModule + alignedFixSize; + int totalSize = EGG::ExpHeap::getSizeForMBlock(mModule); + BOOL result; + if (totalSize == 0) { + void *bss = mHeap->alloc(mModule->bssSize, 0x20); + if (bss == nullptr) { + goto error; + } + mBss = bss; + result = OSLink(&mModule->info, bss); + if (!result) { + goto error; + } + } else { + if (alignedFixSize + mModule->bssSize < totalSize) { + result = OSLinkFixed(&mModule->info, (void *)alignedFixPtr); + if (!result) { + goto error; + } + mHeap->resizeForMBlock(mModule, alignedFixSize + mModule->bssSize); + } else if ((int)mHeap->resizeForMBlock(mModule, alignedFixSize + mModule->bssSize) > 0) { + // TODO resizeForMBlock should maybe return int? + result = OSLinkFixed(&mModule->info, (void *)alignedFixPtr); + if (!result) { + goto error; + } + } else { + void *bss = mHeap->alloc(mModule->bssSize, 0x20); + if (!bss) { + goto error; + } + mBss = bss; + result = OSLinkFixed(&mModule->info, bss); + if (!result) { + goto error; + } + mHeap->resizeForMBlock(mModule, alignedFixSize); + } + } + + sAllocBytes = sAllocBytes + getModuleSize(); + snprintf(mapPath, sizeof(mapPath), "%s/%sNP.map", "/maps", mName); + mpRelMapFile.RegisterOnDvd(mapPath, &mModule->info); + unk_24 = ((UNKWORD(*)())mModule->prolog)(); + checkHeapStatus(); + return true; + } + +error: + unk_33 = 0; + if (mBss != nullptr) { + mHeap->free(mBss); + mBss = nullptr; + } + if (mModule != nullptr) { + mHeap->free(mModule); + mModule = nullptr; + } + return false; +} + +bool DynamicModuleControl::do_unlink() { + ((void (*)())mModule->epilog)(); + mpRelMapFile.Unregister(); + if (!OSUnlink(&mModule->info)) { + return false; + } + sAllocBytes -= getModuleSize(); + if (mBss != nullptr) { + mHeap->free(mBss); + mBss = nullptr; + } + return true; +} + +int DynamicModuleControl::getModuleSize() const { + if (mModule != nullptr) { + int size = EGG::ExpHeap::getSizeForMBlock(mModule); + if (mBss != nullptr) { + size += mModule->bssSize; + } + + return size; + } + return 0; +} + +const char *DynamicModuleControl::getModuleTypeString() const { + static const char *REL_LOAD_TYPES[4] = { + "????", + "MEM", + "ARAM", + "DVD", + }; + return REL_LOAD_TYPES[mResourceType & 3]; +} + +DbMapFile::~DbMapFile() { + if (unk_0) { + Unregister(); + } +} + +namespace nw4r { +namespace db { +// TODO +typedef struct MapFile { +} MapFile; +extern MapFile *MapFile_RegistOnDvd(void *arg, const char *buf, const OSModuleInfo *info); +extern void *MapFile_Unregist(MapFile *); +} // namespace db +} // namespace nw4r + +void DbMapFile::RegisterOnDvd(const char *path, const OSModuleInfo *info) { + if (mDvd::IsExistPath(path)) { + unk_0 = (UNKWORD)nw4r::db::MapFile_RegistOnDvd(((int *)this) + 1, path, info); + } else { + unk_0 = 0xffffffff; + } +} + +void DbMapFile::Unregister() { + if (unk_0 != 0) { + if (unk_0 != 0xffffffff) { + nw4r::db::MapFile_Unregist((nw4r::db::MapFile *)unk_0); + } + unk_0 = 0; + } +} + +extern "C" { + +void ModuleProlog() {} + +void ModuleEpilog() {} + +void ModuleUnresolved() {} + +void ModuleConstructorsX(void (**ptrs)()) { + for (; *ptrs != nullptr; ptrs++) { + (*ptrs)(); + } +} + +void ModuleDestructorsX(void (**ptrs)()) { + for (; *ptrs != nullptr; ptrs++) { + (*ptrs)(); + } +} +} diff --git a/src/d/d_dvd.cpp b/src/d/d_dvd.cpp new file mode 100644 index 00000000..2f7b9cfa --- /dev/null +++ b/src/d/d_dvd.cpp @@ -0,0 +1,62 @@ +#include +#include + +namespace dDvd { + +/** 800520f0 */ +void create(s32 priority, EGG::Heap *archiveHeap, EGG::Heap *commandHeap, EGG::Heap *threadHeap) { + mDvd::create(priority, archiveHeap, commandHeap, threadHeap); +} + +/** 80052100 */ +loader_c::loader_c() { + mpCommand = nullptr; + mSize = -1; + mpHeap = nullptr; + mpBuffer = nullptr; +} + +/** 80052130 */ +loader_c::~loader_c() {} + +// sprintf2 +extern "C" void fn_8003D650(char *out, const char *fmt, ...); + +/** 80052170 */ +void *loader_c::request(const char *path, u8 mountDirection, EGG::Heap *heap) { + char buf[128]; + + if (mpBuffer != nullptr) { + return mpBuffer; + } + if (mpCommand == 0) { + mSize = -1; + mpHeap = heap != nullptr ? heap : mDvd::getArchiveHeap(); + buf[0] = '\0'; + fn_8003D650(buf, "US%s", path); + if (!mDvd::IsExistPath(buf)) { + fn_8003D650(buf, "%s", path); + } + mpCommand = mDvd_toMainRam_normal_c::create(buf, mountDirection, heap); + } + if (mpCommand != nullptr && mpCommand->mStatus != 0) { + mpBuffer = mpCommand->mDataPtr; + mSize = mpCommand->mAmountRead; + mpCommand->mDataPtr = nullptr; + mpCommand->do_delete(); + mpCommand = nullptr; + return mpBuffer; + } else { + return nullptr; + } +} + +/** 800522a0 */ +void loader_c::remove() { + if (mpHeap != nullptr && mpBuffer != nullptr) { + mpHeap->free(mpBuffer); + mpBuffer = nullptr; + } +} + +} // namespace dDvd diff --git a/src/d/d_dvd_unk.cpp b/src/d/d_dvd_unk.cpp new file mode 100644 index 00000000..b4ab12d4 --- /dev/null +++ b/src/d/d_dvd_unk.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +namespace dDvdUnk { + +/** 805750d0 */ +static unkstruct_c *singleton; + +static nw4r::ut::ResFont *fontPtr; + +/** 80052300 */ +unkstruct_c *unkstruct_c::create(EGG::Heap *heap) { + singleton = new (heap, 0x04) unkstruct_c(); + singleton->init(); +} + +/** 80052340 */ +char unkstruct_c::getUnk() { + return field_0x4; +} + +/** 80052350 */ +void unkstruct_c::draw() { + // EGG:: +} + +/** 800526b0 */ +void unkstruct_c::execute() { + +} + +/** 80052750 */ +void unkstruct_c::init() { + field_0x0 = 0; + field_0x4 = 0; +} + + +void unkstruct_c::createFont(EGG::Heap *heap) { + fontPtr = new (heap, 0x04) nw4r::ut::ResFont(); +} + +} // namespace dDvdUnk diff --git a/src/d/d_dylink.cpp b/src/d/d_dylink.cpp new file mode 100644 index 00000000..3bec3f39 --- /dev/null +++ b/src/d/d_dylink.cpp @@ -0,0 +1,94 @@ +#include +#include +#include +#include +#include +// clang-format off +#include +// clang-format on + +struct RelNamePtr { + u16 relId; + const char *name; +}; + +static RelNamePtr *pDynamicNameTable; +static int nDynamicNameTable; + +namespace dDyl { + +DynamicModuleControl **pDMC; +int nDMC; +EGG::Heap *cCc_frmHeap; +u32 Initialized; +mDvd_callback_c *DVD; + +// initDylinkHeap +extern "C" int fn_80052E00(int maxRelId, RelNamePtr *dynNameTable, int dynNameTableNum, EGG::Heap *parentHeap) { + cCc_frmHeap = mHeap::createFrmHeap(maxRelId * 0x10 + dynNameTableNum * 0x48, parentHeap, + "ダイナミックリンク制御用ヒープ(dDyl::cCc_frmHeap)", 0x20, 0); + + mHeap _guard(cCc_frmHeap); + + nDMC = maxRelId; + pDMC = new DynamicModuleControl *[maxRelId](); + memset(pDMC, 0, sizeof(void *) * nDMC); + + pDynamicNameTable = dynNameTable; + nDynamicNameTable = dynNameTableNum; + + for (int i = 0; i < nDynamicNameTable; i++) { + RelNamePtr *rel = &pDynamicNameTable[i]; + if (rel->name != nullptr) { + for (int j = 0; j < nDMC; j++) { + DynamicModuleControl **dmc = &pDMC[j]; + if (*dmc != nullptr) { + const char *nm = (*dmc)->getModuleName(); + if (!strcmp(rel->name, nm)) { + pDMC[rel->relId] = pDMC[j]; + break; + } + } + } + if (pDMC[rel->relId] == nullptr) { + pDMC[rel->relId] = new DynamicModuleControl(rel->name, nullptr); + } + } + } + cCc_frmHeap->adjust(); + return 1; +} + +// isLoaded? +extern "C" bool fn_80052FA0(u16 relId) { + return pDMC[relId] != nullptr ? pDMC[relId]->isLinked() : true; +} + +bool dDyl::Unlink(u16 relId) { + DynamicModuleControl *dmc = pDMC[relId]; + if (dmc != nullptr) { + return dmc->unlink(); + } + + return false; +} + +extern "C" int fn_80052FF0(u16 relId) { + if (!Initialized) { + return 0; + } + + DynamicModuleControl *dmc = pDMC[relId]; + if (dmc != nullptr) { + if (dmc->load_async()) { + // what is going on here? + return (bool)dmc->link() + 2; + } else { + return 0; + } + } else { + return 1; + } +} + +} // namespace dDyl diff --git a/src/d/d_heap.cpp b/src/d/d_heap.cpp index a29ba328..16ad0f70 100644 --- a/src/d/d_heap.cpp +++ b/src/d/d_heap.cpp @@ -18,7 +18,7 @@ extern "C" void fn_802DE710(); // TODO TU splits? void dHeapAllocator::onAlloc(EGG::HeapAllocArg *arg) { - if (arg->heap != nullptr) { + if (arg->ptr != nullptr) { return; } if (lbl_80571C58 == 0) { diff --git a/src/m/m_dvd.cpp b/src/m/m_dvd.cpp new file mode 100644 index 00000000..82fce847 --- /dev/null +++ b/src/m/m_dvd.cpp @@ -0,0 +1,650 @@ +#include +#include +#include +#include +#include +#include +#include +#include +// clang-format off +// TODO a define in here stomps another header +#include +// clang-format on + +static int ConvertPathToEntrynum(const char *path, u8 *outType); + +namespace mDvd { + +TUncompressInfo_c s_UncompressInfoSZS(3, ".szs"); +TUncompressInfo_c s_UncompressInfoLZ(5, ".LZ"); +TUncompressInfo_c s_UncompressInfoLH(7, ".LH"); +TUncompressInfo_c s_UncompressInfoLRC(8, ".LRC"); +TUncompressInfo_c s_UncompressInfoRL(4, ".RL"); + +// TODO This the space within which the actual decompressors +// are allocated. +char likely_align[0x7A04]; +char more_empty_space[0x1638]; +char decompressor_alloc_space[0x9930]; + +mDvd_param_c l_param; + +// unofficial +TUncompressInfo_Base_c *decompressorPtrs[1] = { + &s_UncompressInfoLZ, +}; + +u8 g_mountDirection = 1; +int maxChunkSize = 0x10000; + +void *somePtr; +u32 someNumber; +TUncompressInfo_Base_c **compressors_ptr; +TUncompressInfo_Base_c **compressors_last; +// official +OSThread *l_OSThread; +mDvd::MyThread_c *l_MyThread; +EGG::Heap *l_CommandHeap; +EGG::Heap *l_ArchiveHeap; +bool l_IsAutoStreamDecomp; + +/** 802eece0 */ +static void unk_setDecompressorPtrs(TUncompressInfo_Base_c **ptr, TUncompressInfo_Base_c **last) { + compressors_ptr = ptr; + compressors_last = last; +} + +/** 802eecf0 */ +void unk_initDecompressors() { + unk_setDecompressorPtrs(decompressorPtrs, &decompressorPtrs[1]); + somePtr = decompressor_alloc_space; + someNumber = 0x24; +} + +/** 802eed30 */ +static TUncompressInfo_Base_c *findUncompressInfo(u8 type) { + TUncompressInfo_Base_c **ptr = compressors_ptr; + while (ptr != compressors_last) { + if ((*ptr)->mType == type) { + return *ptr; + } + ptr++; + } + return nullptr; +} + +/** 802eed70 */ +static EGG::StreamDecomp *newUncompressObj(u8 type) { + TUncompressInfo_Base_c *factory = findUncompressInfo(type); + if (factory != nullptr) { + return factory->Construct(); + } else { + return nullptr; + } +} + +/** 802eedb0 */ +static void deleteUncompressObj(u8 type) { + TUncompressInfo_Base_c *factory = findUncompressInfo(type); + if (factory != nullptr) { + factory->Destruct(); + } +} + +OSThread *getOSThread() { + return l_OSThread; +} + +EGG::Heap *getArchiveHeap() { + return l_ArchiveHeap; +} + +/** 802eee10 */ +void *MyThread_c::run(mDvd_param_c *dvd) { + dvd->mainLoop(); + return nullptr; +} + +/** 802eee40 */ +MyThread_c::MyThread_c(int priority, EGG::Heap *heap) : EGG::Thread(0x4000, 0, priority, heap) {} + +/** 802eee90 */ +void *MyThread_c::run() { + return run(mDvd_param_c::mInstance); +} + +/** 802eeea0 */ +void create(int priority, EGG::Heap *commandHeap, EGG::Heap *archiveHeap, EGG::Heap *threadHeap) { + l_CommandHeap = commandHeap; + l_ArchiveHeap = archiveHeap; + mDvd::MyThread_c *thread = new (threadHeap, 0x04) mDvd::MyThread_c(priority, threadHeap); + l_MyThread = thread; + l_OSThread = thread->getMyOsThread(); + if (mHeap::g_assertHeap != nullptr) { + thread->setThreadHeap((EGG::Heap *)mHeap::g_assertHeap); + } + OSResumeThread(l_MyThread->getMyOsThread()); +} + +/** 802eef30 */ +static void *loadToMainRAM(int entryNum, char *dst, EGG::Heap *heap, EGG::DvdRipper::EAllocDirection allocDir, s32 offset, + u32 *outAmountRead, u32 *outFileSize, u32 decompressorType) { + void *result; + u32 amountRead = 0; + u32 fileSize = 0; + + if (decompressorType != 0) { + EGG::StreamDecomp *decomp = newUncompressObj(decompressorType); + static EGG::DvdFile DvdFile; + DvdFile.open(entryNum); + + result = EGG::DvdRipper::loadToMainRAMDecomp(&DvdFile, decomp, (u8 *)dst, heap, allocDir, offset, 0, + maxChunkSize, nullptr, nullptr); + + deleteUncompressObj(decompressorType); + u32 size = DvdFile.mFileInfo.size; + DvdFile.close(); + if (result != nullptr) { + u32 b = EGG::ExpHeap::getSizeForMBlock(result); + DCStoreRangeNoSync(result, b); + fileSize = size; + amountRead = size; + } + } else { + result = EGG::DvdRipper::loadToMainRAM(entryNum, (u8 *)dst, heap, allocDir, offset, &amountRead, &fileSize); + } + + if (outAmountRead != nullptr) { + *outAmountRead = amountRead; + } + if (outFileSize != nullptr) { + *outFileSize = fileSize; + } + return result; +} + +int ConvertPathToEntrynum(const char *path) { + return ::ConvertPathToEntrynum(path, nullptr); +} + +u32 IsExistPath(const char *path) { + u32 entry = ConvertPathToEntrynum(path); + return entry != -1; +} + +} // namespace mDvd + +mDvd_param_c *mDvd_param_c::mInstance; + +/** 802ef0d0 */ +mDvd_command_c::~mDvd_command_c() { + waitUntilDone(); +} + +/** 802ef130 */ +void *mDvd_command_c::operator new(size_t size) { + return EGG::Heap::alloc(size, -4, mDvd::l_CommandHeap); +} + +void mDvd_command_c::operator delete(void *ptr) { + EGG::Heap::free(ptr, mDvd::l_CommandHeap); +} + +/** 802ef150 */ +void mDvd_command_c::done() { + doClear(); +} + +/** 802ef170 */ +void mDvd_command_c::doClear() {} + +void mDvd_command_c::waitDone() { + mStatus = 1; + OSWakeupThread(&mDvd_param_c::mInstance->mThreadQueue2); +} + +/** 802ef190 */ +void mDvd_command_c::waitUntilDone() { + while (mStatus == 0) { + OSSleepThread(&mDvd_param_c::mInstance->mThreadQueue2); + } +} + +/** 802ef1e0 */ +mDvd_param_c::mDvd_param_c() { + mFirstRequest = nullptr; + mLastRequest = nullptr; + OSInitMutex(&mMutex); + OSInitThreadQueue(&mThreadQueue1); + OSInitThreadQueue(&mThreadQueue2); + mDvd_param_c::mInstance = this; +} + +/** 802ef230 */ +void mDvd_param_c::kick() { + OSWakeupThread(&mThreadQueue1); +} + +/** 802ef240 */ +void mDvd_param_c::waitForKick() { + OSSleepThread(&mThreadQueue1); +} + +/** 802ef250 */ +mDvd_command_c *mDvd_param_c::getFirstCommand() { + return mFirstRequest; +} + +/** 802ef260 */ +void mDvd_param_c::addCommand(mDvd_command_c *cmd) { + OSThread *dvdThread = mDvd::getOSThread(); + OSThread *currThread = OSGetCurrentThread(); + if (currThread == dvdThread) { + cmd->execute(); + } else { + OSLockMutex(&mMutex); + cmd->mNext = nullptr; + if (mLastRequest == nullptr) { + mLastRequest = cmd; + mFirstRequest = cmd; + } else { + mLastRequest->mNext = cmd; + mLastRequest = cmd; + } + OSUnlockMutex(&mMutex); + kick(); + } +} + +/** 802ef310 */ +void mDvd_param_c::removeCommand(mDvd_command_c *toRemove) { + OSLockMutex(&mMutex); + mDvd_command_c *prev = nullptr; + + for (mDvd_command_c *cmd = mFirstRequest; cmd != nullptr; cmd = cmd->mNext) { + if (cmd == toRemove) { + if (prev != nullptr) { + prev->mNext = cmd->mNext; + if (mLastRequest == cmd) { + mLastRequest = prev; + } + } else { + if (mFirstRequest == mLastRequest) { + mFirstRequest = nullptr; + mLastRequest = nullptr; + } else { + mFirstRequest = cmd->mNext; + } + } + } + + prev = cmd; + } + + OSUnlockMutex(&mMutex); + kick(); +} + +u32 mDvd_param_c::executeCB(mDvd_command_c **cmd) { + (*cmd)->execute(); + return 0; +} + +/** 802ef410 */ +void mDvd_param_c::mainLoop() { + mDvd_command_c *cmd; + while (true) { + waitForKick(); + while ((cmd = getFirstCommand()) != nullptr) { + removeCommand(cmd); + executeCB(&cmd); + } + } +} + +/** 802ef460 */ +mDvd_command_c::mDvd_command_c() { + mNext = nullptr; + mStatus = 0; +} + +/** 802ef480 */ +void mDvd_command_c::do_delete() { + delete this; +} + +/** 802ef4a0 */ +void mDvd_command_c::destroy(mDvd_command_c **cmd) { + // TODO fake match, this looks like an inlined dtor + if (cmd != nullptr && cmd != nullptr && *cmd != nullptr) { + (*cmd)->done(); + (*cmd)->do_delete(); + *cmd = nullptr; + } +} + +/** 802ef500 */ +mDvd_callback_c::~mDvd_callback_c() {} + +/** 802ef560 */ +mDvd_callback_c::mDvd_callback_c(dvdReadCallback cb, void *cbData) { + mCallback = cb; + mCallbackData = cbData; + mSuccess = false; +} + +/* 802ef5d0 */ +mDvd_callback_c *mDvd_callback_c::create(dvdReadCallback cb, void *cbData) { + mDvd_callback_c *cmd = new mDvd_callback_c(cb, cbData); + if (cmd != nullptr) { + mDvd_param_c::mInstance->addCommand(cmd); + } + return cmd; +} + +/** 802ef650 */ +extern "C" mDvd_callback_c *fn_802EF650(dvdReadCallback cb, void *cbData) { + mDvd_callback_c *cmd = mDvd_callback_c::create(cb, cbData); + while (!cmd) {} + return cmd; +} + +/** 802ef680 */ +u32 mDvd_callback_c::execute() { + mSuccess = (mCallback)(mCallbackData); + waitDone(); + return (bool)mSuccess; +} + +/** 802ef6e0 */ +mDvd_mountMemArchive_c::~mDvd_mountMemArchive_c() {} + +/** 802ef740 */ +mDvd_mountMemArchive_c::mDvd_mountMemArchive_c(int mountDirection) { + if (mountDirection == 0) { + mountDirection = mDvd::g_mountDirection; + } + mMountDirection = mountDirection; + mCompressionType = 0; + mEntryNum = -1; + mDataPtr = nullptr; + mHeap = nullptr; + mAmountRead = 0; +} + +/** 802ef7c0 */ +int findPathWithCompressedExtension(const char *name, u8 *outType) { + u8 type; + char buf[256]; + int num; + char *end; + int size; + + type = 0; + buf[255] = '\0'; + num = -1; + + strncpy(buf, name, sizeof(buf)); + if (buf[255] == '\0') { + end = buf + strlen(buf); + size = sizeof(buf) - (end - buf); + // Append the compressor extension and try to find a compressed version + for (mDvd::TUncompressInfo_Base_c **ptr = mDvd::compressors_ptr; ptr != mDvd::compressors_last; ptr++) { + strncpy(end, (*ptr)->mExtension, size); + num = DVDConvertPathToEntrynum(buf); + if (num != -1) { + type = (*ptr)->mType; + goto out; + } + } + *end = '\0'; + // No compressed version found + end = strrchr(buf, '/'); + if (end == nullptr) { + end = buf; + } + end = strrchr(end, '.'); + if (end != nullptr) { + size = sizeof(buf) - (end - buf); + // Append the compressor extension and try to find a compressed version + for (mDvd::TUncompressInfo_Base_c **ptr = mDvd::compressors_ptr; ptr != mDvd::compressors_last; ptr++) { + strncpy(end, (*ptr)->mExtension, size); + num = DVDConvertPathToEntrynum(buf); + if (num != -1) { + type = (*ptr)->mType; + goto out; + } + } + *end = '\0'; + } + } + +out: + if (num != -1 && outType != nullptr) { + *outType = type; + } + return num; +} + +/** 802ef930 */ +void setAutoStreamDecomp(bool arg) { + mDvd::l_IsAutoStreamDecomp = arg; +} + +/** 802ef940 */ +bool getAutoStreamDecomp() { + return mDvd::l_IsAutoStreamDecomp; +} + +/** 802ef950 */ +static int ConvertPathToEntrynum(const char *path, u8 *outType) { + int num = DVDConvertPathToEntrynum(path); + if (num != -1) { + if (outType != nullptr) { + *outType = 0; + } + } else if (getAutoStreamDecomp()) { + num = findPathWithCompressedExtension(path, outType); + } + return num; +} + +/** 802ef9d0 */ +static int ConvertPathToEntrynum_Thunk(const char *path, u8 *outType) { + return ConvertPathToEntrynum(path, outType); +} + +/** 802ef9e0 */ +mDvd_mountMemArchive_c *mDvd_mountMemArchive_c::create(const char *path, u8 mountDirection, EGG::Heap *heap) { + u8 type; + mDvd_mountMemArchive_c *cmd = nullptr; + int entryNum = ConvertPathToEntrynum_Thunk(path, &type); + if (entryNum != -1) { + cmd = new mDvd_mountMemArchive_c(mountDirection); + if (cmd != nullptr) { + cmd->mEntryNum = entryNum; + cmd->mHeap = heap; + cmd->mCompressionType = type; + mDvd_param_c::mInstance->addCommand(cmd); + } + } + + return cmd; +} + +/** 802efa80 */ +u32 mDvd_mountMemArchive_c::execute() { + EGG::DvdRipper::EAllocDirection allocDirection; + EGG::Archive *archive; + void *data; + EGG::Heap *heap; + + heap = mHeap != nullptr ? mHeap : mDvd::l_ArchiveHeap; + archive = nullptr; + + allocDirection = mMountDirection == 1 ? EGG::DvdRipper::ALLOC_DIR_TOP : EGG::DvdRipper::ALLOC_DIR_BOTTOM; + data = mDvd::loadToMainRAM(mEntryNum, nullptr, heap, allocDirection, 0, &mAmountRead, 0, mCompressionType); + if (data != nullptr) { + archive = EGG::Archive::mount(data, heap, mMountDirection == 1 ? 4 : -4); + } + + if (archive != nullptr) { + mDataPtr = archive; + } else { + if (data != nullptr) { + delete data; + } + mAmountRead = 0; + } + waitDone(); + return (bool)mDataPtr; +} + +/** 802efb80 */ +void *mDvd_mountMemArchive_c::getArcBinary() { + void *result = nullptr; + if (mDataPtr != nullptr) { + result = mDataPtr->mHandle.header; + } + return result; +} + +/** 802efba0 */ +void mDvd_mountMemArchive_c::doClear() { + if (mDataPtr != nullptr) { + void *data = mDataPtr->mHandle.header; + mDataPtr->unmount(); + mDataPtr = nullptr; + if (data != nullptr) { + EGG::Heap::free(data, nullptr); + } + } +} + +/** 802efc10 */ +mDvd_toMainRam_base_c::mDvd_toMainRam_base_c(int mountDirection) { + if (mountDirection == 0) { + mountDirection = mDvd::g_mountDirection; + } + mMountDirection = mountDirection; + mDataPtr = nullptr; + mAmountRead = 0; + mFileSize = 0; + mHeap = nullptr; +} + +/** 802efc80 */ +mDvd_toMainRam_base_c::~mDvd_toMainRam_base_c() {} + +/** 802efce0 */ +mDvd_toMainRam_arc_c::~mDvd_toMainRam_arc_c() {} + +/** 802efd40 */ +mDvd_toMainRam_arc_c::mDvd_toMainRam_arc_c(EGG::Archive *arc, int entryNum, int mountDirection) + : mDvd_toMainRam_base_c(mountDirection), mArcPtr(arc) { + mEntryNum = entryNum; +} + +/** 802efda0 */ +mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::makeRequest(EGG::Archive *arc, int entryNum, int mountDirection, + EGG::Heap *heap) { + mDvd_toMainRam_arc_c *cmd = new mDvd_toMainRam_arc_c(arc, entryNum, mountDirection); + if (cmd != nullptr) { + cmd->mHeap = heap; + mDvd_param_c::mInstance->addCommand(cmd); + } + return cmd; +} + +/** 802efe20 */ +mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::create(EGG::Archive *arc, const char *path, int mountDirection, + EGG::Heap *heap) { + int entryNum = arc->convertPathToEntryID(path); + mDvd_toMainRam_arc_c *cmd = nullptr; + if (entryNum != -1) { + cmd = mDvd_toMainRam_arc_c::makeRequest(arc, entryNum, mountDirection, heap); + } + return cmd; +} + +/** 802efe90 */ +mDvd_toMainRam_arc_c *mDvd_toMainRam_arc_c::createOrFail(EGG::Archive *arc, const char *path, int mountDirection, EGG::Heap *heap) { + mDvd_toMainRam_arc_c *cmd = mDvd_toMainRam_arc_c::create(arc, path, mountDirection, heap); + while (!cmd) {} + return cmd; +} + +/** 802efec0 */ +u32 mDvd_toMainRam_arc_c::execute() { + EGG::Heap *heap = mHeap != nullptr ? mHeap : mDvd::l_ArchiveHeap; + mDataPtr = mArcPtr->getFileFast(mEntryNum, heap, mMountDirection == 1 ? 0x20 : -0x20); + waitDone(); + return (bool)mDataPtr; +} + +/** 802eff40 */ +mDvd_toMainRam_normal_c::mDvd_toMainRam_normal_c(int mountDirection) : mDvd_toMainRam_base_c(mountDirection) { + mCompressionType2 = 0; + mEntryNum = -1; +} + +/** 802eff90 */ +mDvd_toMainRam_normal_c *mDvd_toMainRam_normal_c::create(const char *path, int mountDirection, EGG::Heap *heap) { + u8 type; + int entryNum = ConvertPathToEntrynum_Thunk(path, &type); + mDvd_toMainRam_normal_c *cmd; + if (entryNum == -1) { + cmd = nullptr; + } else { + cmd = new mDvd_toMainRam_normal_c(mountDirection); + if (cmd != nullptr) { + cmd->mEntryNum = entryNum; + cmd->mHeap = heap; + cmd->mCompressionType2 = type; + mDvd_param_c::mInstance->addCommand(cmd); + } + } + return cmd; +} + +/** 802f0030 */ +mDvd_toMainRam_normal_c *mDvd_toMainRam_normal_c::createOrFail(const char *path, int mountDirection, EGG::Heap *heap) { + mDvd_toMainRam_normal_c *cmd = mDvd_toMainRam_normal_c::create(path, mountDirection, heap); + while (!cmd) {} + return cmd; +} + +/** 802f0060 */ +void mDvd_toMainRam_normal_c::create2(mDvd_toMainRam_normal_c **cmd, const char *path, int mountDirection, + EGG::Heap *heap) { + if (*cmd == nullptr) { + *cmd = mDvd_toMainRam_normal_c::create(path, mountDirection, heap); + } +} + +/** 802f00b0 */ +mDvd_toMainRam_normal_c::~mDvd_toMainRam_normal_c() {} + +/** 802f0110 */ +u32 mDvd_toMainRam_normal_c::execute() { + u32 amountRead; + u32 fileSize; + EGG::Heap *heap = mHeap != nullptr ? mHeap : mDvd::l_ArchiveHeap; + EGG::DvdRipper::EAllocDirection allocDirection = + mMountDirection == 1 ? EGG::DvdRipper::ALLOC_DIR_TOP : EGG::DvdRipper::ALLOC_DIR_BOTTOM; + mDataPtr = mDvd::loadToMainRAM(mEntryNum, 0, heap, allocDirection, 0, &amountRead, &fileSize, mCompressionType2); + if (mDataPtr != nullptr) { + mAmountRead = amountRead; + mFileSize = fileSize; + } + waitDone(); + return (bool)mDataPtr; +} + +/** 802f01b0 */ +void mDvd_toMainRam_normal_c::doClear() { + if (mDataPtr == nullptr) { + return; + } + EGG::Heap::free(mDataPtr, nullptr); +}