Clean up more Cemuhook leftovers (#253)

This commit is contained in:
Francesco Saltori 2022-09-16 13:34:41 +02:00 committed by GitHub
parent cebdccfdf5
commit 664d7ee902
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 7 additions and 48 deletions

View File

@ -121,12 +121,8 @@ bool GraphicPack2::LoadCemuPatches()
void GraphicPack2::LoadPatchFiles() void GraphicPack2::LoadPatchFiles()
{ {
// order of loading patches: // order of loading patches:
// 1) If Cemuhook is loaded: // 1) Load Cemu-style patches (patch_<name>.asm), stop here if at least one patch file exists
// 1.1) Check if patches.txt exists and if it does, stop here and do nothing (Cemuhook takes over patching) // 2) Load Cemuhook patches.txt
// 1.2) Load Cemu-style patches (patch_<name>.asm)
// 2) If Cemuhook is not loaded:
// 1.1) Load Cemu-style patches (patch_<name>.asm), stop here if at least one patch file exists
// 1.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) // 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()) if (LoadCemuPatches())

View File

@ -65,7 +65,6 @@ struct PPCInterpreter_t
// LWARX and STWCX // LWARX and STWCX
uint32 reservedMemAddr; uint32 reservedMemAddr;
uint32 reservedMemValue; uint32 reservedMemValue;
/* Note: Everything above is potentially hardcoded into Cemuhook. Do not touch anything or it will risk breaking compatibility */
// temporary storage for recompiler // temporary storage for recompiler
FPR_t temporaryFPR[8]; FPR_t temporaryFPR[8];
uint32 temporaryGPR[4]; uint32 temporaryGPR[4];

View File

@ -217,7 +217,6 @@ bool RPLLoader_ProcessHeaders(std::string_view moduleName, uint8* rplData, uint3
// setup RPL info struct // setup RPL info struct
RPLModule* rplLoaderContext = new RPLModule(); RPLModule* rplLoaderContext = new RPLModule();
rplLoaderContext->RPLRawData = std::span<uint8>(rplData, rplSize); rplLoaderContext->RPLRawData = std::span<uint8>(rplData, rplSize);
rplLoaderContext->rplData_depr = rplData;
rplLoaderContext->heapTrampolineArea.setBaseAllocator(&rplLoaderHeap_lowerAreaCodeMem2); rplLoaderContext->heapTrampolineArea.setBaseAllocator(&rplLoaderHeap_lowerAreaCodeMem2);
// load section table // load section table
if ((uint32)rplHeader->sectionTableEntrySize != sizeof(rplSectionEntryNew_t)) 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 // convert modulename to lower-case
for(auto& c : rplLoaderContext->moduleName2) for(auto& c : rplLoaderContext->moduleName2)
c = _ansiToLower(c); 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 // load CRC section
uint32 crcTableExpectedSize = sectionCount * sizeof(uint32be); uint32 crcTableExpectedSize = sectionCount * sizeof(uint32be);

View File

@ -144,25 +144,13 @@ struct RPLModule
{ {
uint32 ukn00; // pointer to shared memory region? (0xEFE01000) uint32 ukn00; // pointer to shared memory region? (0xEFE01000)
uint32 ukn04; // related to text region size? 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 padding14;
uint32 padding18; uint32 padding18;
rplHeaderNew_t rplHeader; rplHeaderNew_t rplHeader;
rplSectionEntryNew_t* sectionTablePtr; // copy of section table 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; uint32 entrypoint;
uint8* rplData_depr; // Cemuhook might still read this
MPTR textRegionTemp; // temporary memory for text section? MPTR textRegionTemp; // temporary memory for text section?
MEMPTR<void> regionMappingBase_text; // base destination address for text region MEMPTR<void> regionMappingBase_text; // base destination address for text region
@ -171,15 +159,11 @@ struct RPLModule
uint8* tempRegionPtr; uint8* tempRegionPtr;
uint32 tempRegionAllocSize; uint32 tempRegionAllocSize;
rplSectionAddressEntry_t* sectionAddressTable__depr;
uint32 sectionAddressTableSize__depr;
uint32 exportDCount; uint32 exportDCount;
rplExportTableEntry_t* exportDDataPtr; rplExportTableEntry_t* exportDDataPtr;
uint32 exportFCount; uint32 exportFCount;
rplExportTableEntry_t* exportFDataPtr; rplExportTableEntry_t* exportFDataPtr;
/* above are hardcoded in Cemuhook */
std::string moduleName2; std::string moduleName2;
std::vector<rplSectionAddressEntry_t> sectionAddressTable2; std::vector<rplSectionAddressEntry_t> sectionAddressTable2;

View File

@ -105,15 +105,12 @@ namespace coreinit
return 0; return 0;
} }
uint32 OSDynLoad_Release(uint32 moduleHandle) void OSDynLoad_Release(uint32 moduleHandle)
{ {
if (moduleHandle == RPL_INVALID_HANDLE) if (moduleHandle == RPL_INVALID_HANDLE)
return 0; return;
RPLLoader_RemoveDependency(moduleHandle); RPLLoader_RemoveDependency(moduleHandle);
RPLLoader_UpdateDependencies(); 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<MPTR>* addrOut) uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype<MPTR>* addrOut)

View File

@ -11,7 +11,7 @@ namespace coreinit
void OSDynLoad_AllocatorFree(void* mem); void OSDynLoad_AllocatorFree(void* mem);
uint32 OSDynLoad_Acquire(const char* libName, uint32be* moduleHandleOut); 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<MPTR>* addrOut); uint32 OSDynLoad_FindExport(uint32 moduleHandle, uint32 isData, const char* exportName, betype<MPTR>* addrOut);
void InitializeDynLoad(); void InitializeDynLoad();

View File

@ -66,8 +66,6 @@ wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent);
enum enum
{ {
// note - Cemuhook mirrors these ids, be careful about changing them
// ui elements // ui elements
MAINFRAME_GAMELIST_ID = 20000, //wxID_HIGHEST + 1, MAINFRAME_GAMELIST_ID = 20000, //wxID_HIGHEST + 1,
// file // file
@ -79,7 +77,6 @@ enum
MAINFRAME_MENU_ID_FILE_RECENT_LAST = MAINFRAME_MENU_ID_FILE_RECENT_0 + 15, MAINFRAME_MENU_ID_FILE_RECENT_LAST = MAINFRAME_MENU_ID_FILE_RECENT_0 + 15,
// options // options
MAINFRAME_MENU_ID_OPTIONS_FULLSCREEN = 20200, MAINFRAME_MENU_ID_OPTIONS_FULLSCREEN = 20200,
MAINFRAME_MENU_ID_OPTIONS_VSYNC,
MAINFRAME_MENU_ID_OPTIONS_SECOND_WINDOW_PADVIEW, MAINFRAME_MENU_ID_OPTIONS_SECOND_WINDOW_PADVIEW,
MAINFRAME_MENU_ID_OPTIONS_GRAPHIC, MAINFRAME_MENU_ID_OPTIONS_GRAPHIC,
MAINFRAME_MENU_ID_OPTIONS_GRAPHIC_PACKS2, MAINFRAME_MENU_ID_OPTIONS_GRAPHIC_PACKS2,
@ -87,10 +84,6 @@ enum
MAINFRAME_MENU_ID_OPTIONS_GENERAL2, MAINFRAME_MENU_ID_OPTIONS_GENERAL2,
MAINFRAME_MENU_ID_OPTIONS_AUDIO, MAINFRAME_MENU_ID_OPTIONS_AUDIO,
MAINFRAME_MENU_ID_OPTIONS_INPUT, 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 // options -> account
MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_1 = 20350, MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_1 = 20350,
MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_12 = 20350 + 11, MAINFRAME_MENU_ID_OPTIONS_ACCOUNT_12 = 20350 + 11,
@ -127,8 +120,7 @@ enum
MAINFRAME_MENU_ID_NFC_RECENT_0, MAINFRAME_MENU_ID_NFC_RECENT_0,
MAINFRAME_MENU_ID_NFC_RECENT_LAST = MAINFRAME_MENU_ID_NFC_RECENT_0 + 15, MAINFRAME_MENU_ID_NFC_RECENT_LAST = MAINFRAME_MENU_ID_NFC_RECENT_0 + 15,
// debug // debug
MAINFRAME_MENU_ID_DEBUG_RESERVED = 21100, MAINFRAME_MENU_ID_DEBUG_RENDER_UPSIDE_DOWN = 21100,
MAINFRAME_MENU_ID_DEBUG_RENDER_UPSIDE_DOWN,
MAINFRAME_MENU_ID_DEBUG_VIEW_LOGGING_WINDOW, MAINFRAME_MENU_ID_DEBUG_VIEW_LOGGING_WINDOW,
MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_THREADS, MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_THREADS,
MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER, MAINFRAME_MENU_ID_DEBUG_VIEW_PPC_DEBUGGER,
@ -139,9 +131,7 @@ enum
MAINFRAME_MENU_ID_DEBUG_VK_ACCURATE_BARRIERS, MAINFRAME_MENU_ID_DEBUG_VK_ACCURATE_BARRIERS,
// debug->logging // debug->logging
MAINFRAME_MENU_ID_DEBUG_LOGGING_DISABLE_ALL = 21500, MAINFRAME_MENU_ID_DEBUG_LOGGING0 = 21500,
MAINFRAME_MENU_ID_DEBUG_LOGGING0,
MAINFRAME_MENU_ID_DEBUG_LOGGING20 = MAINFRAME_MENU_ID_DEBUG_LOGGING0 + 20,
MAINFRAME_MENU_ID_DEBUG_ADVANCED_PPC_INFO, MAINFRAME_MENU_ID_DEBUG_ADVANCED_PPC_INFO,
// debug->dump // debug->dump
MAINFRAME_MENU_ID_DEBUG_DUMP_TEXTURES = 21600, MAINFRAME_MENU_ID_DEBUG_DUMP_TEXTURES = 21600,