From 664d7ee902ed5300ae019e58c1cf0c1359a319d7 Mon Sep 17 00:00:00 2001 From: Francesco Saltori Date: Fri, 16 Sep 2022 13:34:41 +0200 Subject: [PATCH] Clean up more Cemuhook leftovers (#253) --- src/Cafe/GraphicPack/GraphicPack2Patches.cpp | 8 ++------ src/Cafe/HW/Espresso/PPCState.h | 1 - src/Cafe/OS/RPL/rpl.cpp | 7 ------- src/Cafe/OS/RPL/rpl_structs.h | 16 ---------------- src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp | 7 ++----- src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h | 2 +- src/gui/MainWindow.cpp | 14 ++------------ 7 files changed, 7 insertions(+), 48 deletions(-) diff --git a/src/Cafe/GraphicPack/GraphicPack2Patches.cpp b/src/Cafe/GraphicPack/GraphicPack2Patches.cpp index 5a3c85b9..3910000a 100644 --- a/src/Cafe/GraphicPack/GraphicPack2Patches.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2Patches.cpp @@ -121,12 +121,8 @@ bool GraphicPack2::LoadCemuPatches() void GraphicPack2::LoadPatchFiles() { // order of loading patches: - // 1) If Cemuhook is loaded: - // 1.1) Check if patches.txt exists and if it does, stop here and do nothing (Cemuhook takes over patching) - // 1.2) Load Cemu-style patches (patch_.asm) - // 2) If Cemuhook is not loaded: - // 1.1) Load Cemu-style patches (patch_.asm), stop here if at least one patch file exists - // 1.2) Load Cemuhook patches.txt + // 1) Load Cemu-style patches (patch_.asm), stop here if at least one patch file exists + // 2) Load Cemuhook patches.txt // update: As of 1.20.2b Cemu always takes over patching since Cemuhook patching broke due to other internal changes (memory allocation changed and some reordering on when graphic packs get loaded) if (LoadCemuPatches()) diff --git a/src/Cafe/HW/Espresso/PPCState.h b/src/Cafe/HW/Espresso/PPCState.h index 540bbd4e..1e36c099 100644 --- a/src/Cafe/HW/Espresso/PPCState.h +++ b/src/Cafe/HW/Espresso/PPCState.h @@ -65,7 +65,6 @@ struct PPCInterpreter_t // LWARX and STWCX uint32 reservedMemAddr; uint32 reservedMemValue; - /* Note: Everything above is potentially hardcoded into Cemuhook. Do not touch anything or it will risk breaking compatibility */ // temporary storage for recompiler FPR_t temporaryFPR[8]; uint32 temporaryGPR[4]; diff --git a/src/Cafe/OS/RPL/rpl.cpp b/src/Cafe/OS/RPL/rpl.cpp index 90f9225b..b1af5535 100644 --- a/src/Cafe/OS/RPL/rpl.cpp +++ b/src/Cafe/OS/RPL/rpl.cpp @@ -217,7 +217,6 @@ bool RPLLoader_ProcessHeaders(std::string_view moduleName, uint8* rplData, uint3 // setup RPL info struct RPLModule* rplLoaderContext = new RPLModule(); rplLoaderContext->RPLRawData = std::span(rplData, rplSize); - rplLoaderContext->rplData_depr = rplData; rplLoaderContext->heapTrampolineArea.setBaseAllocator(&rplLoaderHeap_lowerAreaCodeMem2); // load section table if ((uint32)rplHeader->sectionTableEntrySize != sizeof(rplSectionEntryNew_t)) @@ -282,12 +281,6 @@ bool RPLLoader_ProcessHeaders(std::string_view moduleName, uint8* rplData, uint3 // convert modulename to lower-case for(auto& c : rplLoaderContext->moduleName2) c = _ansiToLower(c); - // cemuhook compatibility - rplLoaderContext->moduleNamePtr__depr = rplLoaderContext->moduleName2.data(); - rplLoaderContext->moduleNameLength__depr = rplLoaderContext->moduleName2.size(); - rplLoaderContext->moduleNameSize = 0; - rplLoaderContext->sectionAddressTable__depr = rplLoaderContext->sectionAddressTable2.data(); - rplLoaderContext->sectionAddressTableSize__depr = rplLoaderContext->sectionAddressTable2.size() * sizeof(rplSectionAddressEntry_t); // load CRC section uint32 crcTableExpectedSize = sectionCount * sizeof(uint32be); diff --git a/src/Cafe/OS/RPL/rpl_structs.h b/src/Cafe/OS/RPL/rpl_structs.h index 18413049..71be960c 100644 --- a/src/Cafe/OS/RPL/rpl_structs.h +++ b/src/Cafe/OS/RPL/rpl_structs.h @@ -144,25 +144,13 @@ struct RPLModule { uint32 ukn00; // pointer to shared memory region? (0xEFE01000) uint32 ukn04; // related to text region size? - char* moduleNamePtr__depr; // converted to lower case - uint32 moduleNameLength__depr; // length of module name - uint32 moduleNameSize; // aligned alloc size, not the same as actual length uint32 padding14; uint32 padding18; rplHeaderNew_t rplHeader; rplSectionEntryNew_t* sectionTablePtr; // copy of section table - RPLFileInfoData* fileInfoPtr__depr{}; // copy of fileinfo section - uint32 fileInfoSize__depr{}; // size of fileInfo section - uint32 fileInfoAllocSize__depr{}; // aligned alloc size - - uint32be* crcTablePtr_depr{}; // copy of CRC section - uint32 crcTableAllocSize_depr{}; - uint32 entrypoint; - uint8* rplData_depr; // Cemuhook might still read this - MPTR textRegionTemp; // temporary memory for text section? MEMPTR regionMappingBase_text; // base destination address for text region @@ -171,15 +159,11 @@ struct RPLModule uint8* tempRegionPtr; uint32 tempRegionAllocSize; - rplSectionAddressEntry_t* sectionAddressTable__depr; - uint32 sectionAddressTableSize__depr; - uint32 exportDCount; rplExportTableEntry_t* exportDDataPtr; uint32 exportFCount; rplExportTableEntry_t* exportFDataPtr; - /* above are hardcoded in Cemuhook */ std::string moduleName2; std::vector sectionAddressTable2; diff --git a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp index aae17dfe..f6559b65 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.cpp @@ -105,15 +105,12 @@ namespace coreinit return 0; } - uint32 OSDynLoad_Release(uint32 moduleHandle) + void OSDynLoad_Release(uint32 moduleHandle) { if (moduleHandle == RPL_INVALID_HANDLE) - return 0; + return; RPLLoader_RemoveDependency(moduleHandle); RPLLoader_UpdateDependencies(); - - // this function isn't supposed to return anything, but early versions of Cemu did and Cemuhook (up to 0.5.7.6) now relies on it. We still keep the return value around for compatibility - return 0; } uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype* addrOut) diff --git a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h index 061be002..0be8226c 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h +++ b/src/Cafe/OS/libs/coreinit/coreinit_DynLoad.h @@ -11,7 +11,7 @@ namespace coreinit void OSDynLoad_AllocatorFree(void* mem); uint32 OSDynLoad_Acquire(const char* libName, uint32be* moduleHandleOut); - uint32 OSDynLoad_Release(uint32 moduleHandle); + void OSDynLoad_Release(uint32 moduleHandle); uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype* addrOut); void InitializeDynLoad(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 5b65c7a1..7c1ce0e4 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -66,8 +66,6 @@ wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent); enum { - // note - Cemuhook mirrors these ids, be careful about changing them - // ui elements MAINFRAME_GAMELIST_ID = 20000, //wxID_HIGHEST + 1, // file @@ -79,7 +77,6 @@ enum MAINFRAME_MENU_ID_FILE_RECENT_LAST = MAINFRAME_MENU_ID_FILE_RECENT_0 + 15, // options MAINFRAME_MENU_ID_OPTIONS_FULLSCREEN = 20200, - MAINFRAME_MENU_ID_OPTIONS_VSYNC, MAINFRAME_MENU_ID_OPTIONS_SECOND_WINDOW_PADVIEW, MAINFRAME_MENU_ID_OPTIONS_GRAPHIC, MAINFRAME_MENU_ID_OPTIONS_GRAPHIC_PACKS2, @@ -87,10 +84,6 @@ enum MAINFRAME_MENU_ID_OPTIONS_GENERAL2, MAINFRAME_MENU_ID_OPTIONS_AUDIO, MAINFRAME_MENU_ID_OPTIONS_INPUT, - // options -> experimental - MAINFRAME_MENU_ID_EXPERIMENTAL_BOTW_WORKAROUND = 20300, - MAINFRAME_MENU_ID_EXPERIMENTAL_SYNC_TO_GX2DRAWDONE, - MAINFRAME_MENU_ID_EXPERIMENTAL_DISABLE_PRECOMPILED, // options -> account MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_1 = 20350, MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_12 = 20350 + 11, @@ -127,8 +120,7 @@ enum MAINFRAME_MENU_ID_NFC_RECENT_0, MAINFRAME_MENU_ID_NFC_RECENT_LAST = MAINFRAME_MENU_ID_NFC_RECENT_0 + 15, // debug - MAINFRAME_MENU_ID_DEBUG_RESERVED = 21100, - MAINFRAME_MENU_ID_DEBUG_RENDER_UPSIDE_DOWN, + MAINFRAME_MENU_ID_DEBUG_RENDER_UPSIDE_DOWN = 21100, MAINFRAME_MENU_ID_DEBUG_VIEW_LOGGING_WINDOW, MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_THREADS, MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER, @@ -139,9 +131,7 @@ enum MAINFRAME_MENU_ID_DEBUG_VK_ACCURATE_BARRIERS, // debug->logging - MAINFRAME_MENU_ID_DEBUG_LOGGING_DISABLE_ALL = 21500, - MAINFRAME_MENU_ID_DEBUG_LOGGING0, - MAINFRAME_MENU_ID_DEBUG_LOGGING20 = MAINFRAME_MENU_ID_DEBUG_LOGGING0 + 20, + MAINFRAME_MENU_ID_DEBUG_LOGGING0 = 21500, MAINFRAME_MENU_ID_DEBUG_ADVANCED_PPC_INFO, // debug->dump MAINFRAME_MENU_ID_DEBUG_DUMP_TEXTURES = 21600,