diff --git a/CMakeLists.txt b/CMakeLists.txt index 2875116d..9666005d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,10 +41,6 @@ option(ENABLE_OPENGL "Enables the OpenGL backend" ON) option(ENABLE_VULKAN "Enables the Vulkan backend" ON) option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON) -if (WIN32) - option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON) -endif() - # input backends if (WIN32) option(ENABLE_XINPUT "Enables the usage of XInput" ON) @@ -116,5 +112,4 @@ endif() add_subdirectory(dependencies/ih264d) add_subdirectory(dependencies/ZArchive) -add_subdirectory(src) - +add_subdirectory(src) \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70db09a5..adebc32c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,11 +48,6 @@ add_subdirectory(imgui) add_subdirectory(resource) add_subdirectory(asm) -if(ENABLE_CEMUHOOK) - add_definitions(-DUSE_CEMUHOOK) - add_subdirectory(cemuhook) -endif() - if(PUBLIC_RELEASE) add_executable(CemuBin WIN32 main.cpp @@ -70,7 +65,6 @@ target_precompile_headers(CemuBin PRIVATE Common/precompiled.h) if(WIN32) target_sources(CemuBin PRIVATE resource/cemu.rc - exports.def # for Cemuhook ) endif() @@ -91,10 +85,6 @@ target_link_libraries(CemuBin PRIVATE CURL::libcurl) target_link_libraries(CemuBin PRIVATE imgui::imgui) target_link_libraries(CemuBin PRIVATE pugixml pugixml::static pugixml::pugixml) -if(ENABLE_CEMUHOOK) -target_link_libraries(CemuBin PRIVATE CemuCemuhook) -endif() - target_link_libraries(CemuBin PUBLIC CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl) diff --git a/src/Cafe/CafeSystem.cpp b/src/Cafe/CafeSystem.cpp index f8bce458..add9d1c6 100644 --- a/src/Cafe/CafeSystem.cpp +++ b/src/Cafe/CafeSystem.cpp @@ -282,7 +282,7 @@ struct static_assert(sizeof(SharedDataEntry) == 0x1C); -__declspec(dllexport) uint32 loadSharedData() +uint32 loadSharedData() { // check if font files are dumped bool hasAllShareddataFiles = true; diff --git a/src/Cafe/GameProfile/GameProfile.cpp b/src/Cafe/GameProfile/GameProfile.cpp index 8e1186c9..d3e930ee 100644 --- a/src/Cafe/GameProfile/GameProfile.cpp +++ b/src/Cafe/GameProfile/GameProfile.cpp @@ -22,7 +22,7 @@ struct gameProfileBooleanOption_t * If the option exists, true is returned. * The boolean is stored in *optionValue */ -__declspec(dllexport) bool gameProfile_loadBooleanOption(IniParser* iniParser, char* optionName, gameProfileBooleanOption_t* option) +bool gameProfile_loadBooleanOption(IniParser* iniParser, char* optionName, gameProfileBooleanOption_t* option) { auto option_value = iniParser->FindOption(optionName); option->isPresent = false; @@ -81,7 +81,7 @@ bool gameProfile_loadBooleanOption2(IniParser& iniParser, const char* optionName * Attempts to load a integer option * Allows to specify min and max value (error is logged if out of range and default value is picked) */ -__declspec(dllexport) bool gameProfile_loadIntegerOption(IniParser* iniParser, const char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, sint32 minVal, sint32 maxVal) +bool gameProfile_loadIntegerOption(IniParser* iniParser, const char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, sint32 minVal, sint32 maxVal) { auto option_value = iniParser->FindOption(optionName); option->isPresent = false; @@ -166,17 +166,10 @@ bool gameProfile_loadEnumOption(IniParser& iniParser, const char* optionName, st return result; } -#pragma optimize( "", off ) -__declspec(dllexport) __declspec(noinline) void gameProfile_categoryBegin(IniParser* iniParser) -{ - // do nothing -} -#pragma optimize( "", on ) - void gameProfile_load() { g_current_game_profile->ResetOptional(); // reset with global values as optional - g_current_game_profile->Load(CafeSystem::GetForegroundTitleId(), true); + g_current_game_profile->Load(CafeSystem::GetForegroundTitleId()); // apply some settings immediately ppcThreadQuantum = g_current_game_profile->GetThreadQuantum(); @@ -185,7 +178,7 @@ void gameProfile_load() cemuLog_force("Thread quantum set to {}", ppcThreadQuantum); } -bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook) +bool GameProfile::Load(uint64_t title_id) { auto gameProfilePath = ActiveSettings::GetPath("gameProfiles/{:016x}.ini", title_id); @@ -220,9 +213,6 @@ bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook) // parse ini while (iniParser.NextSection()) { - //if (notifyCemuhook) - // gameProfile_categoryBegin(gameProfile); // hookable export for Cemuhook - if (boost::iequals(iniParser.GetCurrentSectionName(), "General")) { gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries); @@ -378,25 +368,4 @@ void GameProfile::Reset() // controller settings for (auto& profile : m_controllerProfile) profile.reset(); -} - -// legacy code for Cemuhook -__declspec(dllexport) char* gameProfile_loadStringOption(IniParser* iniParser, char* optionName) -{ - return nullptr; -} -__declspec(dllexport) char* gameProfile_getCurrentCategoryName(IniParser* iniParser) -{ - return nullptr; -} - -struct gpNamedOptionEntry_t -{ - char* name; - sint32 value; -}; - -__declspec(dllexport) bool gameProfile_loadIntegerNamedOption(IniParser* iniParser, char* optionName, gameProfileIntegerOption_t* option, sint32 defaultValue, const gpNamedOptionEntry_t* nameValues, sint32 numNameValues) -{ - return false; } \ No newline at end of file diff --git a/src/Cafe/GameProfile/GameProfile.h b/src/Cafe/GameProfile/GameProfile.h index 00b4e0d1..6a1f2ebd 100644 --- a/src/Cafe/GameProfile/GameProfile.h +++ b/src/Cafe/GameProfile/GameProfile.h @@ -16,7 +16,7 @@ class GameProfile public: static const uint32 kThreadQuantumDefault = 45000; - bool Load(uint64_t title_id, bool notifyCemuhook); + bool Load(uint64_t title_id); void Save(uint64_t title_id); void ResetOptional(); void Reset(); @@ -65,4 +65,4 @@ private: }; extern std::unique_ptr g_current_game_profile; -__declspec(dllexport) void gameProfile_load(); +void gameProfile_load(); diff --git a/src/Cafe/GraphicPack/GraphicPack.cpp b/src/Cafe/GraphicPack/GraphicPack.cpp index b55ac82a..c41ca944 100644 --- a/src/Cafe/GraphicPack/GraphicPack.cpp +++ b/src/Cafe/GraphicPack/GraphicPack.cpp @@ -4,31 +4,6 @@ #include "config/ActiveSettings.h" #include "Cafe/GraphicPack/GraphicPack2.h" -typedef struct -{ - int placeholder; -}graphicPack_t; - -// scans the graphic pack directory for shaders -__declspec(dllexport) void graphicPack_loadGraphicPackShaders(graphicPack_t* gp, wchar_t* graphicPackPath) -{ - // this function is part of the deprecated/removed v1 graphic pack code - // as of Cemuhook 0.5.7.3 this function must exist with a minimum length for detour - // otherwise Cemuhook graphic pack stuff will error out, so we just create some pointless instructions which wont be optimized away - forceLog_printf("STUB1"); - forceLog_printf("STUB2"); - forceLog_printf("STUB3"); -} - -// for cemuhook compatibility only -__declspec(dllexport) bool config_isGraphicPackEnabled(uint64 id) -{ - forceLog_printf("STUB4"); - forceLog_printf("STUB5"); - forceLog_printf("STUB6"); - return false; -} - /* * Loads the graphic pack if the titleId is referenced in rules.ini */ diff --git a/src/Cafe/GraphicPack/GraphicPack2.cpp b/src/Cafe/GraphicPack/GraphicPack2.cpp index 62765f2c..0f734675 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.cpp +++ b/src/Cafe/GraphicPack/GraphicPack2.cpp @@ -599,23 +599,6 @@ void GraphicPack2::LoadShaders() } } -#pragma optimize( "", off ) - -DLLEXPORT __declspec(noinline) void GraphicPack2_notifyActivate(GraphicPack2* gp, ExpressionParser* ep) -{ - // for Cemuhook - int placeholder = 0xDEADDEAD; -} - -DLLEXPORT __declspec(noinline) void GraphicPack2_notifyDeactivate(GraphicPack2* gp) -{ - // for Cemuhook - int placeholder = 0xDEADDEAD; -} - -#pragma optimize( "", on ) - - bool GraphicPack2::SetActivePreset(std::string_view name) { return SetActivePreset("", name); @@ -862,7 +845,6 @@ bool GraphicPack2::Activate() m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor; } } - GraphicPack2_notifyActivate(this, &parser); } catch(const std::exception& ex) { @@ -932,7 +914,6 @@ bool GraphicPack2::Deactivate() LatteTiming_disableCustomVsyncFrequency(); } - GraphicPack2_notifyDeactivate(this); return true; } @@ -1148,46 +1129,4 @@ std::vector> GraphicPack2::GetActiveRAMMappings() return a.first < b.first; }); return v; -} - -// C-style exports for Cemuhook - -DLLEXPORT const wchar_t* GraphicPack2_GetFilename(GraphicPack2* gp) -{ - return gp->GetFilename().c_str(); -} - -DLLEXPORT const char* GraphicPack2_GetName(GraphicPack2* gp) -{ - if (!gp->HasName()) - return ""; - - return gp->GetName().c_str(); -} - -DLLEXPORT const char* GraphicPack2_GetPath(GraphicPack2* gp) -{ - return gp->GetPath().c_str(); -} - -DLLEXPORT const char* GraphicPack2_GetDescription(GraphicPack2* gp) -{ - return gp->GetDescription().c_str(); -} - -DLLEXPORT const sint32 GraphicPack2_GetTitleIdCount(GraphicPack2* gp) -{ - return gp->GetTitleIds().size(); -} - -DLLEXPORT const uint64* GraphicPack2_GetTitleIdList(GraphicPack2* gp) -{ - return &gp->GetTitleIds()[0]; -} - -DLLEXPORT ExpressionParser* GraphicPack2_CreateExpressionParser(GraphicPack2* gp) -{ - auto ep = new ExpressionParser(); - gp->AddConstantsForCurrentPreset((ExpressionParser&)*ep); - return ep; -} +} \ No newline at end of file diff --git a/src/Cafe/GraphicPack/GraphicPack2.h b/src/Cafe/GraphicPack/GraphicPack2.h index b02dbf84..65d25f3f 100644 --- a/src/Cafe/GraphicPack/GraphicPack2.h +++ b/src/Cafe/GraphicPack/GraphicPack2.h @@ -166,8 +166,8 @@ public: static bool DeactivateGraphicPack(const std::shared_ptr& graphic_pack); static void ClearGraphicPacks(); private: - __declspec(dllexport) bool Activate(); - __declspec(dllexport) bool Deactivate(); + bool Activate(); + bool Deactivate(); static std::vector> s_graphic_packs; static std::vector> s_active_graphic_packs; diff --git a/src/Cafe/HW/Espresso/PPCScheduler.cpp b/src/Cafe/HW/Espresso/PPCScheduler.cpp index ebe6a473..ab662150 100644 --- a/src/Cafe/HW/Espresso/PPCScheduler.cpp +++ b/src/Cafe/HW/Espresso/PPCScheduler.cpp @@ -100,11 +100,6 @@ PPCInterpreter_t* PPCCore_executeCallbackInternal(uint32 functionMPTR) return hCPU; } -__declspec(dllexport) void PPCCore_executeCallback(uint32 functionMPTR) -{ - PPCCore_executeCallbackInternal(functionMPTR); -} - void PPCCore_deleteAllThreads() { assert_dbg(); diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp index e98e410a..376172f2 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.cpp @@ -374,7 +374,7 @@ struct ppcRecompilerFuncRange_t size_t x86Size; }; -DLLEXPORT bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_t* rangesOut, size_t* countInOut) +bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_t* rangesOut, size_t* countInOut) { PPCRecompilerState.recompilerSpinlock.acquire(); size_t countIn = *countInOut; @@ -399,7 +399,7 @@ DLLEXPORT bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_ return true; } -DLLEXPORT uintptr_t* PPCRecompiler_getJumpTableBase() +extern "C" DLLEXPORT uintptr_t * PPCRecompiler_getJumpTableBase() { if (ppcRecompilerInstanceData == nullptr) return nullptr; @@ -431,7 +431,7 @@ void PPCRecompiler_deleteFunction(PPCRecFunction_t* func) // todo - free x86 code } -DLLEXPORT void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr) +void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr) { if (ppcRecompilerEnabled == false) return; diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h index f87778de..9663c2a4 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompiler.h @@ -369,14 +369,14 @@ typedef struct uint32 _x64XMM_mxCsr_ftzOff; }PPCRecompilerInstanceData_t; -extern __declspec(dllexport) PPCRecompilerInstanceData_t* ppcRecompilerInstanceData; +extern PPCRecompilerInstanceData_t* ppcRecompilerInstanceData; extern bool ppcRecompilerEnabled; -__declspec(dllexport) void PPCRecompiler_init(); +void PPCRecompiler_init(); void PPCRecompiler_allocateRange(uint32 startAddress, uint32 size); -DLLEXPORT void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr); +void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr); extern void ATTR_MS_ABI (*PPCRecompiler_enterRecompilerCode)(uint64 codeMem, uint64 ppcInterpreterInstance); extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_visited)(); @@ -385,10 +385,10 @@ extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_unvisited)(); #define PPC_REC_INVALID_FUNCTION ((PPCRecFunction_t*)-1) // CPUID -extern __declspec(dllexport) bool hasLZCNTSupport; -extern __declspec(dllexport) bool hasMOVBESupport; -extern __declspec(dllexport) bool hasBMI2Support; -extern __declspec(dllexport) bool hasAVXSupport; +extern bool hasLZCNTSupport; +extern bool hasMOVBESupport; +extern bool hasBMI2Support; +extern bool hasAVXSupport; // todo - move some of the stuff above into PPCRecompilerInternal.h diff --git a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp index 52a6f040..84183cbc 100644 --- a/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp +++ b/src/Cafe/HW/Latte/Core/LatteRenderTarget.cpp @@ -1003,7 +1003,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa g_renderer->ImguiEnd(); } -bool DLLEXPORT alwaysDisplayDRC = false; +bool alwaysDisplayDRC = false; bool ctrlTabHotkeyPressed = false; void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uint32 colorBufferWidth, uint32 colorBufferHeight, uint32 colorBufferSliceIndex, uint32 colorBufferFormat, uint32 colorBufferPitch, Latte::E_HWTILEMODE colorBufferTilemode, uint32 colorBufferSwizzle, uint32 renderTarget) diff --git a/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp b/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp index b2f6ec5a..151f0661 100644 --- a/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp +++ b/src/Cafe/HW/Latte/Core/LatteTextureCache.cpp @@ -425,12 +425,4 @@ void LatteTC_UnloadAllTextures() LatteTexture_Delete(itr); } LatteRenderTarget_unloadAll(); -} - -/* - * Asynchronous way to invalidate textures - */ -__declspec(dllexport) void gpu7Texture_forceInvalidateByImagePtr(MPTR imagePtr) -{ - // deprecated. Texture cache heuristics are now good enough to detect moving frames -} +} \ No newline at end of file diff --git a/src/Cafe/HW/MMU/MMU.cpp b/src/Cafe/HW/MMU/MMU.cpp index 3982d8d8..87bf5722 100644 --- a/src/Cafe/HW/MMU/MMU.cpp +++ b/src/Cafe/HW/MMU/MMU.cpp @@ -389,7 +389,7 @@ uint8 memory_readU8(uint32 address) return *(uint8*)(memory_getPointerFromVirtualOffset(address)); } -__declspec(dllexport) void* memory_getBase() +extern "C" DLLEXPORT void* memory_getBase() { return memory_base; } diff --git a/src/Cafe/HW/MMU/MMU.h b/src/Cafe/HW/MMU/MMU.h index 67c14ba3..0e27d81a 100644 --- a/src/Cafe/HW/MMU/MMU.h +++ b/src/Cafe/HW/MMU/MMU.h @@ -1,6 +1,6 @@ #pragma once -DLLEXPORT void memory_init(); +void memory_init(); void memory_mapForCurrentTitle(); void memory_logModifiedMemoryRanges(); diff --git a/src/Cafe/OS/RPL/rpl.cpp b/src/Cafe/OS/RPL/rpl.cpp index 07cf3d0d..82edbb85 100644 --- a/src/Cafe/OS/RPL/rpl.cpp +++ b/src/Cafe/OS/RPL/rpl.cpp @@ -46,8 +46,8 @@ ChunkedFlatAllocator<64 * 1024> g_heapTrampolineArea; std::vector rplDependencyList = std::vector(); -__declspec(dllexport) RPLModule* rplModuleList[256]; -__declspec(dllexport) sint32 rplModuleCount = 0; +RPLModule* rplModuleList[256]; +sint32 rplModuleCount = 0; uint32 _currentTLSModuleIndex = 1; // value 0 is reserved diff --git a/src/Cafe/OS/RPL/rpl.h b/src/Cafe/OS/RPL/rpl.h index d7eae552..ced7e83c 100644 --- a/src/Cafe/OS/RPL/rpl.h +++ b/src/Cafe/OS/RPL/rpl.h @@ -14,7 +14,7 @@ MPTR RPLLoader_AllocateCodeSpace(uint32 size, uint32 alignment); uint32 RPLLoader_GetMaxCodeOffset(); uint32 RPLLoader_GetDataAllocatorAddr(); -__declspec(dllexport) RPLModule* rpl_loadFromMem(uint8* rplData, sint32 size, char* name); +RPLModule* rpl_loadFromMem(uint8* rplData, sint32 size, char* name); uint32 rpl_mapHLEImport(RPLModule* rplLoaderContext, const char* rplName, const char* funcName, bool functionMustExist); void RPLLoader_Link(); diff --git a/src/Cafe/OS/common/OSCommon.cpp b/src/Cafe/OS/common/OSCommon.cpp index dbc9d16e..9dd05aac 100644 --- a/src/Cafe/OS/common/OSCommon.cpp +++ b/src/Cafe/OS/common/OSCommon.cpp @@ -99,7 +99,7 @@ void osLib_addFunctionInternal(const char* libraryName, const char* functionName s_osFunctionTable->emplace_back(libHashA, libHashB, funcHashA, funcHashB, fmt::format("{}.{}", libraryName, functionName), PPCInterpreter_registerHLECall(osFunction)); } -__declspec(dllexport) void osLib_registerHLEFunction(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t* hCPU)) +extern "C" DLLEXPORT void osLib_registerHLEFunction(const char* libraryName, const char* functionName, void(*osFunction)(PPCInterpreter_t * hCPU)) { osLib_addFunctionInternal(libraryName, functionName, osFunction); } diff --git a/src/Cafe/OS/libs/coreinit/coreinit_Time.cpp b/src/Cafe/OS/libs/coreinit/coreinit_Time.cpp index 823d4938..c22152f4 100644 --- a/src/Cafe/OS/libs/coreinit/coreinit_Time.cpp +++ b/src/Cafe/OS/libs/coreinit/coreinit_Time.cpp @@ -366,7 +366,7 @@ namespace coreinit void InitializeTimeAndCalendar() { osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime); - osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy); // register dummy HLE function to get Cemuhook to patch our dummy instead of the real function + osLib_addFunction("coreinit", "OSGetSystemTime", export_OSGetSystemTimeDummy); osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick); cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder); diff --git a/src/Cemu/ExpressionParser/ExpressionParser.cpp b/src/Cemu/ExpressionParser/ExpressionParser.cpp index 74729339..90e3f4cd 100644 --- a/src/Cemu/ExpressionParser/ExpressionParser.cpp +++ b/src/Cemu/ExpressionParser/ExpressionParser.cpp @@ -43,49 +43,4 @@ void ExpressionParser_test() cemu_assert_debug(_testEvaluateToType("5 > 4 > 3 > 2") == 0.0f); // this should evaluate the operations from left to right, (5 > 4) -> 0.0, (0.0 > 4) -> 0.0, (0.0 > 3) -> 0.0, (0.0 > 2) -> 0.0 cemu_assert_debug(_testEvaluateToType("5 > 4 > 3 > -2") == 1.0f); // this should evaluate the operations from left to right, (5 > 4) -> 0.0, (0.0 > 4) -> 0.0, (0.0 > 3) -> 0.0, (0.0 > -2) -> 1.0 cemu_assert_debug(_testEvaluateToType("(5 == 5) > (5 == 6)") == 1.0f); -} - -// Cemuhook exports - -DLLEXPORT ExpressionParser* ExpressionParser_Create() -{ - return new ExpressionParser(); -} - -DLLEXPORT ExpressionParser* ExpressionParser_CreateCopy(ExpressionParser* ep) -{ - return new ExpressionParser((ExpressionParser&)*ep); -} - -DLLEXPORT void ExpressionParser_Delete(ExpressionParser* ep) -{ - delete ep; -} - -DLLEXPORT void ExpressionParser_AddConstantDouble(ExpressionParser* ep, const char* name, double value) -{ - ep->AddConstant(name, value); -} - -DLLEXPORT void ExpressionParser_AddConstantString(ExpressionParser* ep, const char* name, const char* value) -{ - ep->AddConstant(name, value); -} - -DLLEXPORT bool ExpressionParser_EvaluateToDouble(ExpressionParser* ep, const char* expression, double* result) -{ - try - { - const double temp = ep->Evaluate(std::string(expression)); - if (result) - *result = temp; - - return true; - } - catch (const std::exception& ex) - { - if( result ) - forceLog_printf("Unable to evaluate expression: %s", ex.what()); - return false; - } } \ No newline at end of file diff --git a/src/Cemu/Logging/CemuLogging.cpp b/src/Cemu/Logging/CemuLogging.cpp index 6684ee9d..f58e7984 100644 --- a/src/Cemu/Logging/CemuLogging.cpp +++ b/src/Cemu/Logging/CemuLogging.cpp @@ -243,7 +243,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...) LoggingWindow::Log(it->second, logTempStr); } -__declspec(dllexport) void cemuLog_log() +void cemuLog_log() { typedef void(*VoidFunc)(); const VoidFunc func = (VoidFunc)cafeLog_log; diff --git a/src/Common/ExceptionHandler/ExceptionHandler.cpp b/src/Common/ExceptionHandler/ExceptionHandler.cpp index 4e9fc36e..20074fbf 100644 --- a/src/Common/ExceptionHandler/ExceptionHandler.cpp +++ b/src/Common/ExceptionHandler/ExceptionHandler.cpp @@ -41,7 +41,6 @@ void crashlog_writeHeader(const char* header) } bool crashLogCreated = false; -bool IsCemuhookLoaded(); #include BOOL CALLBACK MyMiniDumpCallback(PVOID pParam, const PMINIDUMP_CALLBACK_INPUT pInput, PMINIDUMP_CALLBACK_OUTPUT pOutput) { @@ -375,10 +374,7 @@ void createCrashlog(EXCEPTION_POINTERS* e, PCONTEXT context) fs::copy_file(ActiveSettings::GetPath("log.txt"), p, ec); } - if (IsCemuhookLoaded()) - TerminateProcess(GetCurrentProcess(), 0); // abort(); - else - exit(0); + exit(0); return; } diff --git a/src/cemuhook/CMakeLists.txt b/src/cemuhook/CMakeLists.txt deleted file mode 100644 index b7f6b5a1..00000000 --- a/src/cemuhook/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(CemuCemuhook) - -add_library(CemuCemuhook -wxEvtHook.inl -wxCemuhookExports.cpp -) - -set_property(TARGET CemuCemuhook PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") - -target_precompile_headers(CemuCemuhook PRIVATE ../Common/precompiled.h) - -target_include_directories(CemuCemuhook PRIVATE ../) \ No newline at end of file diff --git a/src/cemuhook/wxCemuhookExports.cpp b/src/cemuhook/wxCemuhookExports.cpp deleted file mode 100644 index d39e22dc..00000000 --- a/src/cemuhook/wxCemuhookExports.cpp +++ /dev/null @@ -1,196 +0,0 @@ - -#ifdef USE_CEMUHOOK - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define CHECK_FOR_WX_EVT_STRING(strVar, strConst) if (strcmp(strVar, #strConst) == 0){ return static_cast(strConst); } - - -__declspec(dllexport) wxEvtHandler* wxEvtHandler_Initialize(uint8_t* allocMemory) -{ - wxEvtHandler* handler = new (allocMemory) wxEvtHandler(); - return handler; -} - -__declspec(dllexport) void wxEvtHandler_Connect(wxEvtHandler* eventSource, int id, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink) -{ - eventSource->Connect(id, lastId, eventType, func, userData, eventSink); -} - -__declspec(dllexport) void wxEvtHandler_Disconnect(wxEvtHandler* eventSource, int id, int lastId, int eventType, wxObjectEventFunction func, wxObject* userData, wxEvtHandler* eventSink) -{ - eventSource->Disconnect(id, lastId, eventType, func, userData, eventSink); -} - -__declspec(dllexport) const wchar_t* GetTranslationWChar(const wchar_t* text) -{ - return wxGetTranslation(text).wc_str(); -} - -__declspec(dllexport) int wxGetEventByName(const char* eventName) -{ -#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) if (!strcmp(eventName,#EventVarName)){ return static_cast(EventVarName); } -#include "wxEvtHook.inl" -#undef PROCESS_OWN_WXEVT - - return -1; -} - -#pragma optimize( "", off ) - -static bool FixupWxEvtId(const wxEventType& outObj, const int newId) -{ - const int oldVal = static_cast(outObj); - if (oldVal == newId) - return false; - - wxEventType* dstObj = const_cast(&outObj); - memcpy(dstObj, &newId, sizeof(newId)); - - // check value again - if (static_cast(outObj) != newId) - assert_dbg(); - - return true; -} - -void FixupWxEvtIdsToMatchCemuHook() -{ - // instantiate all the events -#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) static_cast(EventVarName); -#include "cemuhook/wxEvtHook.inl" -#undef PROCESS_OWN_WXEVT - // fix them -#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) FixupWxEvtId(EventVarName,EventHookId) -#include "cemuhook/wxEvtHook.inl" -#undef PROCESS_OWN_WXEVT -} - -#pragma optimize( "", on ) - -// these I added on my own since they might be useful - -__declspec(dllexport) void coreinitAPI_OSYieldThread() -{ - PPCCore_switchToScheduler(); -} - -#define xstr(a) str(a) -#define str(a) #a - -#define PRINT_EVENT(__evtName) printf(xstr(__evtName) " = %d\n", (int)(wxEventType)__evtName); - -void PrintEvents() -{ - PRINT_EVENT(wxEVT_IDLE) - PRINT_EVENT(wxEVT_THREAD) - PRINT_EVENT(wxEVT_ASYNC_METHOD_CALL) - - PRINT_EVENT(wxEVT_BUTTON) - PRINT_EVENT(wxEVT_CHECKBOX) - PRINT_EVENT(wxEVT_CHOICE) - PRINT_EVENT(wxEVT_LISTBOX) - PRINT_EVENT(wxEVT_LISTBOX_DCLICK) - PRINT_EVENT(wxEVT_CHECKLISTBOX) - PRINT_EVENT(wxEVT_MENU) - PRINT_EVENT(wxEVT_SLIDER) - PRINT_EVENT(wxEVT_RADIOBOX) - PRINT_EVENT(wxEVT_RADIOBUTTON) - PRINT_EVENT(wxEVT_SCROLLBAR) - - PRINT_EVENT(wxEVT_LEFT_DOWN) - PRINT_EVENT(wxEVT_LEFT_UP) - PRINT_EVENT(wxEVT_MIDDLE_DOWN) - PRINT_EVENT(wxEVT_MIDDLE_UP) - PRINT_EVENT(wxEVT_RIGHT_DOWN) - PRINT_EVENT(wxEVT_RIGHT_UP) - PRINT_EVENT(wxEVT_MOTION) - PRINT_EVENT(wxEVT_ENTER_WINDOW) - PRINT_EVENT(wxEVT_LEAVE_WINDOW) - - PRINT_EVENT(wxEVT_CHAR) - PRINT_EVENT(wxEVT_SET_CURSOR) - PRINT_EVENT(wxEVT_SCROLL_TOP) - PRINT_EVENT(wxEVT_SCROLL_BOTTOM) - - PRINT_EVENT(wxEVT_SIZE) - PRINT_EVENT(wxEVT_MOVE) - PRINT_EVENT(wxEVT_CLOSE_WINDOW) - PRINT_EVENT(wxEVT_END_SESSION) - PRINT_EVENT(wxEVT_ACTIVATE_APP) - PRINT_EVENT(wxEVT_ACTIVATE) - PRINT_EVENT(wxEVT_CREATE) - PRINT_EVENT(wxEVT_DESTROY) - PRINT_EVENT(wxEVT_SHOW) - PRINT_EVENT(wxEVT_ICONIZE) - PRINT_EVENT(wxEVT_MAXIMIZE) - - PRINT_EVENT(wxEVT_PAINT) - PRINT_EVENT(wxEVT_MENU_OPEN) - PRINT_EVENT(wxEVT_MENU_CLOSE) - PRINT_EVENT(wxEVT_MENU_HIGHLIGHT) - PRINT_EVENT(wxEVT_CONTEXT_MENU) - - PRINT_EVENT(wxEVT_UPDATE_UI) - PRINT_EVENT(wxEVT_SIZING) - PRINT_EVENT(wxEVT_MOVING) - - PRINT_EVENT(wxEVT_TEXT_COPY) - PRINT_EVENT(wxEVT_TEXT_CUT) - PRINT_EVENT(wxEVT_TEXT_PASTE) - -} - -void wxMatchCemuhookEventIds() -{ - - FixupWxEvtIdsToMatchCemuHook(); - - //PrintEvents(); - // check if key eventIds match with Cemuhook - cemu_assert((wxEventType)wxEVT_SIZE == 10078); - cemu_assert((wxEventType)wxEVT_HYPERLINK == 10156); - cemu_assert((wxEventType)wxEVT_IDLE == 10001); - cemu_assert((wxEventType)wxEVT_UPDATE_UI == 10116); -} - -/* This code reserves the first 300 wxWidgets event ids early, so that they cant be grabbed by wxWidgets constructors for the regular events. We then assign fixed IDs that match Cemuhook's later */ -#pragma init_seg(lib) - -int wxNewEventType(); - -bool wxReserveEventIds() -{ - for (int i = 0; i < 300; i++) - wxNewEventType(); - return true; -} - -bool s_placeholderResult = wxReserveEventIds(); - -#endif \ No newline at end of file diff --git a/src/cemuhook/wxEvtHook.inl b/src/cemuhook/wxEvtHook.inl deleted file mode 100644 index a8ae33c0..00000000 --- a/src/cemuhook/wxEvtHook.inl +++ /dev/null @@ -1,171 +0,0 @@ -PROCESS_OWN_WXEVT(wxEVT_NULL,10000); -PROCESS_OWN_WXEVT(wxEVT_IDLE,10001); -PROCESS_OWN_WXEVT(wxEVT_THREAD,10002); -PROCESS_OWN_WXEVT(wxEVT_ASYNC_METHOD_CALL,10003); -PROCESS_OWN_WXEVT(wxEVT_END_PROCESS,10004); -PROCESS_OWN_WXEVT(wxEVT_TIMER,10005); -PROCESS_OWN_WXEVT(wxEVT_BUTTON,10006); -PROCESS_OWN_WXEVT(wxEVT_CHECKBOX,10007); -PROCESS_OWN_WXEVT(wxEVT_CHOICE,10008); -PROCESS_OWN_WXEVT(wxEVT_LISTBOX,10009); -PROCESS_OWN_WXEVT(wxEVT_LISTBOX_DCLICK,10010); -PROCESS_OWN_WXEVT(wxEVT_CHECKLISTBOX,10011); -PROCESS_OWN_WXEVT(wxEVT_MENU,10012); -PROCESS_OWN_WXEVT(wxEVT_SLIDER,10013); -PROCESS_OWN_WXEVT(wxEVT_RADIOBOX,10014); -PROCESS_OWN_WXEVT(wxEVT_RADIOBUTTON,10015); -PROCESS_OWN_WXEVT(wxEVT_SCROLLBAR,10016); -PROCESS_OWN_WXEVT(wxEVT_VLBOX,10017); -PROCESS_OWN_WXEVT(wxEVT_COMBOBOX,10018); -PROCESS_OWN_WXEVT(wxEVT_TOOL_RCLICKED,10019); -PROCESS_OWN_WXEVT(wxEVT_TOOL_ENTER,10020); -PROCESS_OWN_WXEVT(wxEVT_TOOL_DROPDOWN,10021); -PROCESS_OWN_WXEVT(wxEVT_COMBOBOX_DROPDOWN,10022); -PROCESS_OWN_WXEVT(wxEVT_COMBOBOX_CLOSEUP,10023); -PROCESS_OWN_WXEVT(wxEVT_LEFT_DOWN,10024); -PROCESS_OWN_WXEVT(wxEVT_LEFT_UP,10025); -PROCESS_OWN_WXEVT(wxEVT_MIDDLE_DOWN,10026); -PROCESS_OWN_WXEVT(wxEVT_MIDDLE_UP,10027); -PROCESS_OWN_WXEVT(wxEVT_RIGHT_DOWN,10028); -PROCESS_OWN_WXEVT(wxEVT_RIGHT_UP,10029); -PROCESS_OWN_WXEVT(wxEVT_MOTION,10030); -PROCESS_OWN_WXEVT(wxEVT_ENTER_WINDOW,10031); -PROCESS_OWN_WXEVT(wxEVT_LEAVE_WINDOW,10032); -PROCESS_OWN_WXEVT(wxEVT_LEFT_DCLICK,10033); -PROCESS_OWN_WXEVT(wxEVT_MIDDLE_DCLICK,10034); -PROCESS_OWN_WXEVT(wxEVT_RIGHT_DCLICK,10035); -PROCESS_OWN_WXEVT(wxEVT_SET_FOCUS,10036); -PROCESS_OWN_WXEVT(wxEVT_KILL_FOCUS,10037); -PROCESS_OWN_WXEVT(wxEVT_CHILD_FOCUS,10038); -PROCESS_OWN_WXEVT(wxEVT_MOUSEWHEEL,10039); -PROCESS_OWN_WXEVT(wxEVT_AUX1_DOWN,10040); -PROCESS_OWN_WXEVT(wxEVT_AUX1_UP,10041); -PROCESS_OWN_WXEVT(wxEVT_AUX1_DCLICK,10042); -PROCESS_OWN_WXEVT(wxEVT_AUX2_DOWN,10043); -PROCESS_OWN_WXEVT(wxEVT_AUX2_UP,10044); -PROCESS_OWN_WXEVT(wxEVT_AUX2_DCLICK,10045); -PROCESS_OWN_WXEVT(wxEVT_MAGNIFY,10046); -PROCESS_OWN_WXEVT(wxEVT_CHAR,10047); -PROCESS_OWN_WXEVT(wxEVT_AFTER_CHAR,10048); -PROCESS_OWN_WXEVT(wxEVT_CHAR_HOOK,10049); -PROCESS_OWN_WXEVT(wxEVT_NAVIGATION_KEY,10050); -PROCESS_OWN_WXEVT(wxEVT_KEY_DOWN,10051); -PROCESS_OWN_WXEVT(wxEVT_KEY_UP,10052); -PROCESS_OWN_WXEVT(wxEVT_HOTKEY,10053); -PROCESS_OWN_WXEVT(wxEVT_SET_CURSOR,10054); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_TOP,10055); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_BOTTOM,10056); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_LINEUP,10057); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_LINEDOWN,10058); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_PAGEUP,10059); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_PAGEDOWN,10060); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_THUMBTRACK,10061); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_THUMBRELEASE,10062); -PROCESS_OWN_WXEVT(wxEVT_SCROLL_CHANGED,10063); -PROCESS_OWN_WXEVT(wxEVT_SPIN_UP,10057); -PROCESS_OWN_WXEVT(wxEVT_SPIN_DOWN,10058); -PROCESS_OWN_WXEVT(wxEVT_SPIN,10061); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_TOP,10064); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_BOTTOM,10065); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_LINEUP,10066); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_LINEDOWN,10067); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_PAGEUP,10068); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_PAGEDOWN,10069); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_THUMBTRACK,10070); -PROCESS_OWN_WXEVT(wxEVT_SCROLLWIN_THUMBRELEASE,10071); -PROCESS_OWN_WXEVT(wxEVT_GESTURE_PAN,10072); -PROCESS_OWN_WXEVT(wxEVT_GESTURE_ZOOM,10073); -PROCESS_OWN_WXEVT(wxEVT_GESTURE_ROTATE,10074); -PROCESS_OWN_WXEVT(wxEVT_TWO_FINGER_TAP,10075); -PROCESS_OWN_WXEVT(wxEVT_LONG_PRESS,10076); -PROCESS_OWN_WXEVT(wxEVT_PRESS_AND_TAP,10077); -PROCESS_OWN_WXEVT(wxEVT_SIZE,10078); -PROCESS_OWN_WXEVT(wxEVT_SIZING,10079); -PROCESS_OWN_WXEVT(wxEVT_MOVE,10080); -PROCESS_OWN_WXEVT(wxEVT_MOVING,10081); -PROCESS_OWN_WXEVT(wxEVT_MOVE_START,10082); -PROCESS_OWN_WXEVT(wxEVT_MOVE_END,10083); -PROCESS_OWN_WXEVT(wxEVT_CLOSE_WINDOW,10084); -PROCESS_OWN_WXEVT(wxEVT_END_SESSION,10085); -PROCESS_OWN_WXEVT(wxEVT_QUERY_END_SESSION,10086); -PROCESS_OWN_WXEVT(wxEVT_HIBERNATE,10087); -PROCESS_OWN_WXEVT(wxEVT_ACTIVATE_APP,10088); -PROCESS_OWN_WXEVT(wxEVT_ACTIVATE,10089); -PROCESS_OWN_WXEVT(wxEVT_CREATE,10090); -PROCESS_OWN_WXEVT(wxEVT_DESTROY,10091); -PROCESS_OWN_WXEVT(wxEVT_SHOW,10092); -PROCESS_OWN_WXEVT(wxEVT_ICONIZE,10093); -PROCESS_OWN_WXEVT(wxEVT_MAXIMIZE,10094); -PROCESS_OWN_WXEVT(wxEVT_FULLSCREEN,10095); -PROCESS_OWN_WXEVT(wxEVT_MOUSE_CAPTURE_CHANGED,10096); -PROCESS_OWN_WXEVT(wxEVT_MOUSE_CAPTURE_LOST,10097); -PROCESS_OWN_WXEVT(wxEVT_PAINT,10098); -PROCESS_OWN_WXEVT(wxEVT_ERASE_BACKGROUND,10099); -PROCESS_OWN_WXEVT(wxEVT_NC_PAINT,10100); -PROCESS_OWN_WXEVT(wxEVT_MENU_OPEN,10101); -PROCESS_OWN_WXEVT(wxEVT_MENU_CLOSE,10102); -PROCESS_OWN_WXEVT(wxEVT_MENU_HIGHLIGHT,10103); -PROCESS_OWN_WXEVT(wxEVT_CONTEXT_MENU,10104); -PROCESS_OWN_WXEVT(wxEVT_SYS_COLOUR_CHANGED,10105); -PROCESS_OWN_WXEVT(wxEVT_DISPLAY_CHANGED,10106); -PROCESS_OWN_WXEVT(wxEVT_DPI_CHANGED,10107); -PROCESS_OWN_WXEVT(wxEVT_QUERY_NEW_PALETTE,10108); -PROCESS_OWN_WXEVT(wxEVT_PALETTE_CHANGED,10109); -PROCESS_OWN_WXEVT(wxEVT_JOY_BUTTON_DOWN,10110); -PROCESS_OWN_WXEVT(wxEVT_JOY_BUTTON_UP,10111); -PROCESS_OWN_WXEVT(wxEVT_JOY_MOVE,10112); -PROCESS_OWN_WXEVT(wxEVT_JOY_ZMOVE,10113); -PROCESS_OWN_WXEVT(wxEVT_DROP_FILES,10114); -PROCESS_OWN_WXEVT(wxEVT_INIT_DIALOG,10115); -PROCESS_OWN_WXEVT(wxEVT_UPDATE_UI,10116); -PROCESS_OWN_WXEVT(wxEVT_TEXT_COPY,10117); -PROCESS_OWN_WXEVT(wxEVT_TEXT_CUT,10118); -PROCESS_OWN_WXEVT(wxEVT_TEXT_PASTE,10119); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_LEFT_CLICK,10120); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_LEFT_DCLICK,10121); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_RIGHT_CLICK,10122); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_RIGHT_DCLICK,10123); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_SET_FOCUS,10124); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_KILL_FOCUS,10125); -PROCESS_OWN_WXEVT(wxEVT_COMMAND_ENTER,10126); -PROCESS_OWN_WXEVT(wxEVT_HELP,10127); -PROCESS_OWN_WXEVT(wxEVT_DETAILED_HELP,10128); -PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_DRAG,10129); -PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_RDRAG,10130); -PROCESS_OWN_WXEVT(wxEVT_LIST_BEGIN_LABEL_EDIT,10131); -PROCESS_OWN_WXEVT(wxEVT_LIST_END_LABEL_EDIT,10132); -PROCESS_OWN_WXEVT(wxEVT_LIST_DELETE_ITEM,10133); -PROCESS_OWN_WXEVT(wxEVT_LIST_DELETE_ALL_ITEMS,10134); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_SELECTED,10135); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_DESELECTED,10136); -PROCESS_OWN_WXEVT(wxEVT_LIST_KEY_DOWN,10137); -PROCESS_OWN_WXEVT(wxEVT_LIST_INSERT_ITEM,10138); -PROCESS_OWN_WXEVT(wxEVT_LIST_COL_CLICK,10139); -PROCESS_OWN_WXEVT(wxEVT_LIST_COL_RIGHT_CLICK,10140); -PROCESS_OWN_WXEVT(wxEVT_LIST_COL_BEGIN_DRAG,10141); -PROCESS_OWN_WXEVT(wxEVT_LIST_COL_DRAGGING,10142); -PROCESS_OWN_WXEVT(wxEVT_LIST_COL_END_DRAG,10143); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_RIGHT_CLICK,10144); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_MIDDLE_CLICK,10145); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_ACTIVATED,10146); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_FOCUSED,10147); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_CHECKED,10148); -PROCESS_OWN_WXEVT(wxEVT_LIST_ITEM_UNCHECKED,10149); -PROCESS_OWN_WXEVT(wxEVT_LIST_CACHE_HINT,10150); -PROCESS_OWN_WXEVT(wxEVT_TEXT,10151); -PROCESS_OWN_WXEVT(wxEVT_TEXT_ENTER,10152); -PROCESS_OWN_WXEVT(wxEVT_TEXT_URL,10153); -PROCESS_OWN_WXEVT(wxEVT_TEXT_MAXLEN,10154); -PROCESS_OWN_WXEVT(wxEVT_WINDOW_MODAL_DIALOG_CLOSED,10155); -PROCESS_OWN_WXEVT(wxEVT_HYPERLINK,10156); -PROCESS_OWN_WXEVT(wxEVT_CLIPBOARD_CHANGED,10157); -PROCESS_OWN_WXEVT(wxEVT_NOTEBOOK_PAGE_CHANGED,10158); -PROCESS_OWN_WXEVT(wxEVT_NOTEBOOK_PAGE_CHANGING,10159); -PROCESS_OWN_WXEVT(wxEVT_SPINCTRL,10160); -PROCESS_OWN_WXEVT(wxEVT_SPINCTRLDOUBLE,10161); -PROCESS_OWN_WXEVT(wxEVT_COLLAPSIBLEPANE_CHANGED,10162); -PROCESS_OWN_WXEVT(wxEVT_COLLAPSIBLEHEADER_CHANGED,10163); -PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPENDING,10164); -PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPENDED,10165); -PROCESS_OWN_WXEVT(wxEVT_POWER_SUSPEND_CANCEL,10166); -PROCESS_OWN_WXEVT(wxEVT_POWER_RESUME,10167); \ No newline at end of file diff --git a/src/config/ActiveSettings.cpp b/src/config/ActiveSettings.cpp index 9e8a429e..c7ff4fe6 100644 --- a/src/config/ActiveSettings.cpp +++ b/src/config/ActiveSettings.cpp @@ -10,7 +10,7 @@ #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/CafeSystem.h" -extern bool DLLEXPORT alwaysDisplayDRC; +extern bool alwaysDisplayDRC; void ActiveSettings::LoadOnce() { diff --git a/src/exports.def b/src/exports.def deleted file mode 100644 index fd824c4c..00000000 --- a/src/exports.def +++ /dev/null @@ -1,57 +0,0 @@ -EXPORTS - cemuLog_log=?cemuLog_log@@YAXXZ - PPCCore_executeCallback=?PPCCore_executeCallback@@YAXI@Z - osLib_registerHLEFunction=?osLib_registerHLEFunction@@YAXPEBD0P6AXPEAUPPCInterpreter_t@@@Z@Z - gameProfile_load=?gameProfile_load@@YAXXZ - gameProfile_categoryBegin=?gameProfile_categoryBegin@@YAXPEAVIniParser@@@Z - gameProfile_getCurrentCategoryName=?gameProfile_getCurrentCategoryName@@YAPEADPEAVIniParser@@@Z - gameProfile_loadStringOption=?gameProfile_loadStringOption@@YAPEADPEAVIniParser@@PEAD@Z - gameProfile_loadBooleanOption=?gameProfile_loadBooleanOption@@YA_NPEAVIniParser@@PEADPEAUgameProfileBooleanOption_t@@@Z - gameProfile_loadIntegerNamedOption=?gameProfile_loadIntegerNamedOption@@YA_NPEAVIniParser@@PEADPEAUgameProfileIntegerOption_t@@HPEBUgpNamedOptionEntry_t@@H@Z - gameProfile_loadIntegerOption=?gameProfile_loadIntegerOption@@YA_NPEAVIniParser@@PEBDPEAUgameProfileIntegerOption_t@@HHH@Z - memory_init=?memory_init@@YAXXZ - memory_getBase=?memory_getBase@@YAPEAXXZ - wxMainWindowCreated=?wxMainWindowCreated@@YAPEAVwxTopLevelWindow@@PEAV1@IPEAVCemuApp@@@Z - wxEvtHandler_Initialize=?wxEvtHandler_Initialize@@YAPEAVwxEvtHandler@@PEAE@Z - wxEvtHandler_Connect=?wxEvtHandler_Connect@@YAXPEAVwxEvtHandler@@HHHP81@EAAXAEAVwxEvent@@@ZPEAVwxObject@@0@Z - wxEvtHandler_Disconnect=?wxEvtHandler_Disconnect@@YAXPEAVwxEvtHandler@@HHHP81@EAAXAEAVwxEvent@@@ZPEAVwxObject@@0@Z - wxGetEventByName=?wxGetEventByName@@YAHPEBD@Z - gameMeta_loadForCurrent=?gameMeta_loadForCurrent@@YAXXZ - gameMeta_getTitleId=?gameMeta_getTitleId@@YA_KXZ - PPCRecompiler_init=?PPCRecompiler_init@@YAXXZ - hasMOVBESupport=?hasMOVBESupport@@3_NA - hasLZCNTSupport=?hasLZCNTSupport@@3_NA - hasAVXSupport=?hasAVXSupport@@3_NA - ppcRecompilerInstanceData=?ppcRecompilerInstanceData@@3PEAUPPCRecompilerInstanceData_t@@EA - currentTLSModuleIndex=?_currentTLSModuleIndex@@3IA - rplModuleCount=?rplModuleCount@@3HA - rplModuleList=?rplModuleList@@3PAPEAURPLModule@@A - rpl_loadFromMem=?rpl_loadFromMem@@YAPEAURPLModule@@PEAEHPEAD@Z - loadSharedData=?loadSharedData@@YAIXZ - graphicPack_loadGraphicPackShaders=?graphicPack_loadGraphicPackShaders@@YAXPEAUgraphicPack_t@@PEA_W@Z - config_isGraphicPackEnabled=?config_isGraphicPackEnabled@@YA_N_K@Z - alwaysDisplayDRC=?alwaysDisplayDRC@@3_NA - ppcCyclesSince2000=?ppcCyclesSince2000@@3_KA - ppcMainThreadCycleCounter=?ppcMainThreadCycleCounter@@3_KC - GetTranslationWChar=?GetTranslationWChar@@YAPEB_WPEB_W@Z - ActivateGraphicPack=?Activate@GraphicPack2@@AEAA_NXZ - DeactivateGraphicPack=?Deactivate@GraphicPack2@@AEAA_NXZ - coreinitAPI_OSYieldThread=?coreinitAPI_OSYieldThread@@YAXXZ - GraphicPack2_GetFilename=?GraphicPack2_GetFilename@@YAPEB_WPEAVGraphicPack2@@@Z - GraphicPack2_GetName=?GraphicPack2_GetName@@YAPEBDPEAVGraphicPack2@@@Z - GraphicPack2_GetPath=?GraphicPack2_GetPath@@YAPEBDPEAVGraphicPack2@@@Z - GraphicPack2_GetDescription=?GraphicPack2_GetDescription@@YAPEBDPEAVGraphicPack2@@@Z - GraphicPack2_GetTitleIdCount=?GraphicPack2_GetTitleIdCount@@YA?BHPEAVGraphicPack2@@@Z - GraphicPack2_GetTitleIdList=?GraphicPack2_GetTitleIdList@@YAPEB_KPEAVGraphicPack2@@@Z - GraphicPack2_notifyActivate=?GraphicPack2_notifyActivate@@YAXPEAVGraphicPack2@@PEAVExpressionParser@@@Z - GraphicPack2_notifyDeactivate=?GraphicPack2_notifyDeactivate@@YAXPEAVGraphicPack2@@@Z - GraphicPack2_CreateExpressionParser=?GraphicPack2_CreateExpressionParser@@YAPEAVExpressionParser@@PEAVGraphicPack2@@@Z - ExpressionParser_Create=?ExpressionParser_Create@@YAPEAVExpressionParser@@XZ - ExpressionParser_CreateCopy=?ExpressionParser_CreateCopy@@YAPEAVExpressionParser@@PEAV1@@Z - ExpressionParser_Delete=?ExpressionParser_Delete@@YAXPEAVExpressionParser@@@Z - ExpressionParser_AddConstantDouble=?ExpressionParser_AddConstantDouble@@YAXPEAVExpressionParser@@PEBDN@Z - ExpressionParser_AddConstantString=?ExpressionParser_AddConstantString@@YAXPEAVExpressionParser@@PEBD1@Z - ExpressionParser_EvaluateToDouble=?ExpressionParser_EvaluateToDouble@@YA_NPEAVExpressionParser@@PEBDPEAN@Z - PPCRecompiler_findFuncRanges=?PPCRecompiler_findFuncRanges@@YA_NIPEAUppcRecompilerFuncRange_t@@PEA_K@Z - PPCRecompiler_getJumpTableBase=?PPCRecompiler_getJumpTableBase@@YAPEA_KXZ - PPCRecompiler_invalidateRange=?PPCRecompiler_invalidateRange@@YAXII@Z \ No newline at end of file diff --git a/src/gui/CemuApp.cpp b/src/gui/CemuApp.cpp index 38decc2f..37a40bab 100644 --- a/src/gui/CemuApp.cpp +++ b/src/gui/CemuApp.cpp @@ -68,14 +68,6 @@ void unused_translation_dummy() void(_("PrincipalId missing")); } - -#pragma optimize( "", off ) -DLLEXPORT _declspec(noinline) wxTopLevelWindow* wxMainWindowCreated(wxTopLevelWindow* wndPtr, uint32 magicConstant, CemuApp* appPointer) -{ - return wndPtr; -} -#pragma optimize( "", on ) - bool CemuApp::OnInit() { wxInitAllImageHandlers(); @@ -140,9 +132,6 @@ bool CemuApp::OnInit() g_window_info.app_active = true; SetTopWindow(m_mainFrame); - - // Cemuhook callback - wxMainWindowCreated(m_mainFrame, 0xDABABE, this); m_mainFrame->Show(); return true; } diff --git a/src/gui/CemuUpdateWindow.cpp b/src/gui/CemuUpdateWindow.cpp index d8b144f5..6d79d13c 100644 --- a/src/gui/CemuUpdateWindow.cpp +++ b/src/gui/CemuUpdateWindow.cpp @@ -510,7 +510,6 @@ void CemuUpdateWindow::WorkerThread() } } -bool IsCemuhookLoaded(); void CemuUpdateWindow::OnClose(wxCloseEvent& event) { event.Skip(); @@ -529,11 +528,8 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event) HANDLE lock = CreateMutex(nullptr, TRUE, L"Global\\cemu_update_lock"); CreateProcess(nullptr, (wchar_t*)cmdline.c_str(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi); - - if (IsCemuhookLoaded()) - TerminateProcess(GetCurrentProcess(), 0); - else - exit(0); + + exit(0); } #else cemuLog_log(LogType::Force, "unimplemented - restart on update"); diff --git a/src/gui/GameProfileWindow.cpp b/src/gui/GameProfileWindow.cpp index 5fea17be..d3cd28d4 100644 --- a/src/gui/GameProfileWindow.cpp +++ b/src/gui/GameProfileWindow.cpp @@ -21,7 +21,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id) SetIcon(wxICON(X_GAME_PROFILE)); m_game_profile.Reset(); - m_game_profile.Load(title_id, false); + m_game_profile.Load(title_id); this->SetSizeHints(wxDefaultSize, wxDefaultSize); diff --git a/src/gui/GraphicPacksWindow2.cpp b/src/gui/GraphicPacksWindow2.cpp index 7281edd1..f46d8abe 100644 --- a/src/gui/GraphicPacksWindow2.cpp +++ b/src/gui/GraphicPacksWindow2.cpp @@ -15,8 +15,6 @@ #endif // main.cpp -bool IsCemuhookLoaded(); - class wxGraphicPackData : public wxTreeItemData { public: diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 877a95ee..89895502 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -65,8 +65,6 @@ extern WindowInfo g_window_info; extern std::shared_mutex g_mutex; -bool IsCemuhookLoaded(); - wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent); enum @@ -347,18 +345,6 @@ MainWindow::MainWindow() Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, this); Bind(wxEVT_LAUNCH_GAME, &MainWindow::OnLaunchFromFile, this); - if (fs::exists(ActiveSettings::GetPath("dbghelp.dll")) && !fs::exists(ActiveSettings::GetPath("cemuhook.dll"))) - { - m_statusBar = CreateStatusBar(1); - wxStaticText* statusBarText = new wxStaticText(m_statusBar, wxID_ANY, wxT("The installed version of Cemuhook is not compatible. To get the latest version visit: ")); - wxHyperlinkCtrl* cemuhookUrl = new wxHyperlinkCtrl(m_statusBar, wxID_ANY, "https://cemuhook.sshnuke.net/", "https://cemuhook.sshnuke.net/"); - // align elements - auto textSize = statusBarText->GetSize(); - statusBarText->SetPosition(wxPoint(6, (m_statusBar->GetSize().GetHeight() - textSize.GetHeight()) / 2)); - if(cemuhookUrl) - cemuhookUrl->SetPosition(wxPoint(textSize.GetWidth() + 12, (m_statusBar->GetSize().GetHeight() - textSize.GetHeight()) / 2)); - } - if (LaunchSettings::GetLoadFile().has_value()) { MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE); @@ -2086,12 +2072,6 @@ void MainWindow::RecreateMenu() #ifndef PUBLIC_RELEASE m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation")); #endif - // destroy Cemuhook update indicator status bar - if (m_statusBar) - { - delete m_statusBar; - m_statusBar = nullptr; - } } m_exitMenuItem = m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_EXIT, _("&Exit")); diff --git a/src/gui/MainWindow.h b/src/gui/MainWindow.h index 5b8458cb..bcf1212d 100644 --- a/src/gui/MainWindow.h +++ b/src/gui/MainWindow.h @@ -161,8 +161,6 @@ private: wxSize m_restored_size; wxPoint m_restored_position; - wxStatusBar* m_statusBar{}; - bool m_menu_visible = false; bool m_game_launched = false; diff --git a/src/gui/guiWrapper.cpp b/src/gui/guiWrapper.cpp index 12b7bb50..c53a3bef 100644 --- a/src/gui/guiWrapper.cpp +++ b/src/gui/guiWrapper.cpp @@ -17,21 +17,17 @@ std::shared_mutex g_mutex; MainWindow* g_mainFrame = nullptr; #if BOOST_OS_WINDOWS -void wxMatchCemuhookEventIds(); - void _wxLaunch() { SetThreadName("MainThread_UI"); wxEntry(); } - #endif void gui_create() { SetThreadName("MainThread"); #if BOOST_OS_WINDOWS - wxMatchCemuhookEventIds(); // on Windows wxWidgets there is a bug where wxDirDialog->ShowModal will deadlock in Windows internals somehow // moving the UI thread off the main thread fixes this std::thread t = std::thread(_wxLaunch); diff --git a/src/main.cpp b/src/main.cpp index b7944696..aa43aee5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -53,44 +53,6 @@ std::atomic_bool g_isGPUInitFinished = false; std::wstring executablePath; -bool g_cemuhook_loaded = false; -bool IsCemuhookLoaded() -{ - return g_cemuhook_loaded; -} - -void checkForCemuhook() -{ - #if BOOST_OS_WINDOWS - // check if there is a dbghelp.dll in the current working directory - if (!fs::exists(ActiveSettings::GetPath("cemuhook.dll"))) - return; - // check if Cemuhook can be detected - DWORD verHandle; - DWORD verLen = GetFileVersionInfoSizeW(L"cemuhook.dll", &verHandle); - if (verLen == 0) - return; - uint8* verData = (uint8*)malloc(verLen); - GetFileVersionInfoW(L"cemuhook.dll", 0, verLen, verData); - // get version - LPVOID lpBuffer; - UINT size; - if (VerQueryValueW(verData, L"\\", (LPVOID*)&lpBuffer, (PUINT)&size)) - { - if (size) - { - VS_FIXEDFILEINFO *verInfo = (VS_FIXEDFILEINFO *)lpBuffer; - if (verInfo->dwSignature == 0xfeef04bd) - { - forceLog_printf("Cemuhook version: %d.%d.%d.%d", (verInfo->dwFileVersionMS >> 16) & 0xFFFF, (verInfo->dwFileVersionMS >> 0) & 0xFFFF, (verInfo->dwFileVersionLS >> 16) & 0xFFFF, (verInfo->dwFileVersionLS >> 0) & 0xFFFF); - g_cemuhook_loaded = true; - } - } - } - free(verData); - #endif -} - void logCPUAndMemoryInfo() { #if BOOST_OS_WINDOWS @@ -150,8 +112,6 @@ void infoLog_cemuStartup() cemuLog_force("------- Init {} {}.{}{} -------", EMULATOR_NAME, EMULATOR_VERSION_LEAD, EMULATOR_VERSION_MAJOR, EMULATOR_VERSION_SUFFIX); cemuLog_force("Init Wii U memory space (base: 0x{:016x})", (size_t)memory_base); cemuLog_force(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string()); - // check if Cemuhook is installed - checkForCemuhook(); // check for wine version checkForWine(); // CPU and RAM info @@ -424,48 +384,7 @@ int main(int argc, char *argv[]) } #endif -/* Cemuhook legacy API */ - -#pragma optimize("",off) - -__declspec(dllexport) void gameMeta_loadForCurrent() -{ - int placeholderA = 0x11223344; - int placeholderB = 0x55667788; -} - -#pragma optimize("",on) - -__declspec(dllexport) uint64 gameMeta_getTitleId() +extern "C" DLLEXPORT uint64 gameMeta_getTitleId() { return CafeSystem::GetForegroundTitleId(); -} - -/* Cemuhook loading */ -#if BOOST_OS_WINDOWS -#pragma init_seg(".CRT$XCT") - -HANDLE dbgLib; - -int dbghelp_init(void) -{ - // load dbghelp.dll from the system folder instead of loading outdated cemuhook via dbghelp.dll - WCHAR dllPath[MAX_PATH]; - GetSystemDirectoryW(dllPath, MAX_PATH); - wcscat_s(dllPath, sizeof(dllPath) / sizeof(WCHAR), TEXT("\\dbghelp.dll")); - - dbgLib = LoadLibraryW(dllPath); - if (dbgLib == NULL) - return -1; - - return 0; -} - -HMODULE _earlyInitFunction() -{ - dbghelp_init(); - return LoadLibraryA("cemuhook2.dll"); -} - -HMODULE _cemuHookDllHandle = _earlyInitFunction(); -#endif +} \ No newline at end of file