Remove cemuhook and fix exports (#73)

This commit is contained in:
Crementif 2022-08-26 19:41:42 +02:00 committed by GitHub
parent fb76d714f2
commit ca78b92718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 38 additions and 792 deletions

View File

@ -41,10 +41,6 @@ option(ENABLE_OPENGL "Enables the OpenGL backend" ON)
option(ENABLE_VULKAN "Enables the Vulkan backend" ON) option(ENABLE_VULKAN "Enables the Vulkan backend" ON)
option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON) option(ENABLE_DISCORD_RPC "Enables the Discord Rich Presence feature" ON)
if (WIN32)
option(ENABLE_CEMUHOOK "Enables Cemuhook compatibility" ON)
endif()
# input backends # input backends
if (WIN32) if (WIN32)
option(ENABLE_XINPUT "Enables the usage of XInput" ON) option(ENABLE_XINPUT "Enables the usage of XInput" ON)
@ -117,4 +113,3 @@ add_subdirectory(dependencies/ih264d)
add_subdirectory(dependencies/ZArchive) add_subdirectory(dependencies/ZArchive)
add_subdirectory(src) add_subdirectory(src)

View File

@ -48,11 +48,6 @@ add_subdirectory(imgui)
add_subdirectory(resource) add_subdirectory(resource)
add_subdirectory(asm) add_subdirectory(asm)
if(ENABLE_CEMUHOOK)
add_definitions(-DUSE_CEMUHOOK)
add_subdirectory(cemuhook)
endif()
if(PUBLIC_RELEASE) if(PUBLIC_RELEASE)
add_executable(CemuBin WIN32 add_executable(CemuBin WIN32
main.cpp main.cpp
@ -70,7 +65,6 @@ target_precompile_headers(CemuBin PRIVATE Common/precompiled.h)
if(WIN32) if(WIN32)
target_sources(CemuBin PRIVATE target_sources(CemuBin PRIVATE
resource/cemu.rc resource/cemu.rc
exports.def # for Cemuhook
) )
endif() endif()
@ -91,10 +85,6 @@ target_link_libraries(CemuBin PRIVATE CURL::libcurl)
target_link_libraries(CemuBin PRIVATE imgui::imgui) target_link_libraries(CemuBin PRIVATE imgui::imgui)
target_link_libraries(CemuBin PRIVATE pugixml pugixml::static pugixml::pugixml) 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 target_link_libraries(CemuBin PUBLIC
CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl) CemuCommon CemuAudio CemuInput CemuComponents CemuCafe CemuConfig CemuGui imguiImpl)

View File

@ -282,7 +282,7 @@ struct
static_assert(sizeof(SharedDataEntry) == 0x1C); static_assert(sizeof(SharedDataEntry) == 0x1C);
__declspec(dllexport) uint32 loadSharedData() uint32 loadSharedData()
{ {
// check if font files are dumped // check if font files are dumped
bool hasAllShareddataFiles = true; bool hasAllShareddataFiles = true;

View File

@ -22,7 +22,7 @@ struct gameProfileBooleanOption_t
* If the option exists, true is returned. * If the option exists, true is returned.
* The boolean is stored in *optionValue * 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); auto option_value = iniParser->FindOption(optionName);
option->isPresent = false; option->isPresent = false;
@ -81,7 +81,7 @@ bool gameProfile_loadBooleanOption2(IniParser& iniParser, const char* optionName
* Attempts to load a integer option * 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) * 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); auto option_value = iniParser->FindOption(optionName);
option->isPresent = false; option->isPresent = false;
@ -166,17 +166,10 @@ bool gameProfile_loadEnumOption(IniParser& iniParser, const char* optionName, st
return result; return result;
} }
#pragma optimize( "", off )
__declspec(dllexport) __declspec(noinline) void gameProfile_categoryBegin(IniParser* iniParser)
{
// do nothing
}
#pragma optimize( "", on )
void gameProfile_load() void gameProfile_load()
{ {
g_current_game_profile->ResetOptional(); // reset with global values as optional 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 // apply some settings immediately
ppcThreadQuantum = g_current_game_profile->GetThreadQuantum(); ppcThreadQuantum = g_current_game_profile->GetThreadQuantum();
@ -185,7 +178,7 @@ void gameProfile_load()
cemuLog_force("Thread quantum set to {}", ppcThreadQuantum); 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); auto gameProfilePath = ActiveSettings::GetPath("gameProfiles/{:016x}.ini", title_id);
@ -220,9 +213,6 @@ bool GameProfile::Load(uint64_t title_id, bool notifyCemuhook)
// parse ini // parse ini
while (iniParser.NextSection()) while (iniParser.NextSection())
{ {
//if (notifyCemuhook)
// gameProfile_categoryBegin(gameProfile); // hookable export for Cemuhook
if (boost::iequals(iniParser.GetCurrentSectionName(), "General")) if (boost::iequals(iniParser.GetCurrentSectionName(), "General"))
{ {
gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries); gameProfile_loadBooleanOption2(iniParser, "loadSharedLibraries", m_loadSharedLibraries);
@ -379,24 +369,3 @@ void GameProfile::Reset()
for (auto& profile : m_controllerProfile) for (auto& profile : m_controllerProfile)
profile.reset(); 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;
}

View File

@ -16,7 +16,7 @@ class GameProfile
public: public:
static const uint32 kThreadQuantumDefault = 45000; 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 Save(uint64_t title_id);
void ResetOptional(); void ResetOptional();
void Reset(); void Reset();
@ -65,4 +65,4 @@ private:
}; };
extern std::unique_ptr<GameProfile> g_current_game_profile; extern std::unique_ptr<GameProfile> g_current_game_profile;
__declspec(dllexport) void gameProfile_load(); void gameProfile_load();

View File

@ -4,31 +4,6 @@
#include "config/ActiveSettings.h" #include "config/ActiveSettings.h"
#include "Cafe/GraphicPack/GraphicPack2.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 * Loads the graphic pack if the titleId is referenced in rules.ini
*/ */

View File

@ -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) bool GraphicPack2::SetActivePreset(std::string_view name)
{ {
return SetActivePreset("", name); return SetActivePreset("", name);
@ -862,7 +845,6 @@ bool GraphicPack2::Activate()
m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor; m_output_settings.downscale_filter = LatteTextureView::MagFilter::kNearestNeighbor;
} }
} }
GraphicPack2_notifyActivate(this, &parser);
} }
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
@ -932,7 +914,6 @@ bool GraphicPack2::Deactivate()
LatteTiming_disableCustomVsyncFrequency(); LatteTiming_disableCustomVsyncFrequency();
} }
GraphicPack2_notifyDeactivate(this);
return true; return true;
} }
@ -1149,45 +1130,3 @@ std::vector<std::pair<MPTR, MPTR>> GraphicPack2::GetActiveRAMMappings()
}); });
return v; 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;
}

View File

@ -166,8 +166,8 @@ public:
static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack); static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack);
static void ClearGraphicPacks(); static void ClearGraphicPacks();
private: private:
__declspec(dllexport) bool Activate(); bool Activate();
__declspec(dllexport) bool Deactivate(); bool Deactivate();
static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs; static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs;
static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs; static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs;

View File

@ -100,11 +100,6 @@ PPCInterpreter_t* PPCCore_executeCallbackInternal(uint32 functionMPTR)
return hCPU; return hCPU;
} }
__declspec(dllexport) void PPCCore_executeCallback(uint32 functionMPTR)
{
PPCCore_executeCallbackInternal(functionMPTR);
}
void PPCCore_deleteAllThreads() void PPCCore_deleteAllThreads()
{ {
assert_dbg(); assert_dbg();

View File

@ -374,7 +374,7 @@ struct ppcRecompilerFuncRange_t
size_t x86Size; 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(); PPCRecompilerState.recompilerSpinlock.acquire();
size_t countIn = *countInOut; size_t countIn = *countInOut;
@ -399,7 +399,7 @@ DLLEXPORT bool PPCRecompiler_findFuncRanges(uint32 addr, ppcRecompilerFuncRange_
return true; return true;
} }
DLLEXPORT uintptr_t* PPCRecompiler_getJumpTableBase() extern "C" DLLEXPORT uintptr_t * PPCRecompiler_getJumpTableBase()
{ {
if (ppcRecompilerInstanceData == nullptr) if (ppcRecompilerInstanceData == nullptr)
return nullptr; return nullptr;
@ -431,7 +431,7 @@ void PPCRecompiler_deleteFunction(PPCRecFunction_t* func)
// todo - free x86 code // todo - free x86 code
} }
DLLEXPORT void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr) void PPCRecompiler_invalidateRange(uint32 startAddr, uint32 endAddr)
{ {
if (ppcRecompilerEnabled == false) if (ppcRecompilerEnabled == false)
return; return;

View File

@ -369,14 +369,14 @@ typedef struct
uint32 _x64XMM_mxCsr_ftzOff; uint32 _x64XMM_mxCsr_ftzOff;
}PPCRecompilerInstanceData_t; }PPCRecompilerInstanceData_t;
extern __declspec(dllexport) PPCRecompilerInstanceData_t* ppcRecompilerInstanceData; extern PPCRecompilerInstanceData_t* ppcRecompilerInstanceData;
extern bool ppcRecompilerEnabled; extern bool ppcRecompilerEnabled;
__declspec(dllexport) void PPCRecompiler_init(); void PPCRecompiler_init();
void PPCRecompiler_allocateRange(uint32 startAddress, uint32 size); 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_enterRecompilerCode)(uint64 codeMem, uint64 ppcInterpreterInstance);
extern void ATTR_MS_ABI (*PPCRecompiler_leaveRecompilerCode_visited)(); 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) #define PPC_REC_INVALID_FUNCTION ((PPCRecFunction_t*)-1)
// CPUID // CPUID
extern __declspec(dllexport) bool hasLZCNTSupport; extern bool hasLZCNTSupport;
extern __declspec(dllexport) bool hasMOVBESupport; extern bool hasMOVBESupport;
extern __declspec(dllexport) bool hasBMI2Support; extern bool hasBMI2Support;
extern __declspec(dllexport) bool hasAVXSupport; extern bool hasAVXSupport;
// todo - move some of the stuff above into PPCRecompilerInternal.h // todo - move some of the stuff above into PPCRecompilerInternal.h

View File

@ -1003,7 +1003,7 @@ void LatteRenderTarget_copyToBackbuffer(LatteTextureView* textureView, bool isPa
g_renderer->ImguiEnd(); g_renderer->ImguiEnd();
} }
bool DLLEXPORT alwaysDisplayDRC = false; bool alwaysDisplayDRC = false;
bool ctrlTabHotkeyPressed = 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) void LatteRenderTarget_itHLECopyColorBufferToScanBuffer(MPTR colorBufferPtr, uint32 colorBufferWidth, uint32 colorBufferHeight, uint32 colorBufferSliceIndex, uint32 colorBufferFormat, uint32 colorBufferPitch, Latte::E_HWTILEMODE colorBufferTilemode, uint32 colorBufferSwizzle, uint32 renderTarget)

View File

@ -426,11 +426,3 @@ void LatteTC_UnloadAllTextures()
} }
LatteRenderTarget_unloadAll(); 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
}

View File

@ -389,7 +389,7 @@ uint8 memory_readU8(uint32 address)
return *(uint8*)(memory_getPointerFromVirtualOffset(address)); return *(uint8*)(memory_getPointerFromVirtualOffset(address));
} }
__declspec(dllexport) void* memory_getBase() extern "C" DLLEXPORT void* memory_getBase()
{ {
return memory_base; return memory_base;
} }

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
DLLEXPORT void memory_init(); void memory_init();
void memory_mapForCurrentTitle(); void memory_mapForCurrentTitle();
void memory_logModifiedMemoryRanges(); void memory_logModifiedMemoryRanges();

View File

@ -46,8 +46,8 @@ ChunkedFlatAllocator<64 * 1024> g_heapTrampolineArea;
std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>(); std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>();
__declspec(dllexport) RPLModule* rplModuleList[256]; RPLModule* rplModuleList[256];
__declspec(dllexport) sint32 rplModuleCount = 0; sint32 rplModuleCount = 0;
uint32 _currentTLSModuleIndex = 1; // value 0 is reserved uint32 _currentTLSModuleIndex = 1; // value 0 is reserved

View File

@ -14,7 +14,7 @@ MPTR RPLLoader_AllocateCodeSpace(uint32 size, uint32 alignment);
uint32 RPLLoader_GetMaxCodeOffset(); uint32 RPLLoader_GetMaxCodeOffset();
uint32 RPLLoader_GetDataAllocatorAddr(); 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); uint32 rpl_mapHLEImport(RPLModule* rplLoaderContext, const char* rplName, const char* funcName, bool functionMustExist);
void RPLLoader_Link(); void RPLLoader_Link();

View File

@ -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)); 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); osLib_addFunctionInternal(libraryName, functionName, osFunction);
} }

View File

@ -366,7 +366,7 @@ namespace coreinit
void InitializeTimeAndCalendar() void InitializeTimeAndCalendar()
{ {
osLib_addFunction("coreinit", "OSGetTime", export_OSGetTime); 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); osLib_addFunction("coreinit", "OSGetTick", export_OSGetTick);
cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder); cafeExportRegister("coreinit", OSTicksToCalendarTime, LogType::Placeholder);

View File

@ -44,48 +44,3 @@ void ExpressionParser_test()
cemu_assert_debug(_testEvaluateToType<float>("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<float>("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<float>("(5 == 5) > (5 == 6)") == 1.0f); cemu_assert_debug(_testEvaluateToType<float>("(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;
}
}

View File

@ -243,7 +243,7 @@ void cafeLog_logW(uint32 type, const wchar_t* format, ...)
LoggingWindow::Log(it->second, logTempStr); LoggingWindow::Log(it->second, logTempStr);
} }
__declspec(dllexport) void cemuLog_log() void cemuLog_log()
{ {
typedef void(*VoidFunc)(); typedef void(*VoidFunc)();
const VoidFunc func = (VoidFunc)cafeLog_log; const VoidFunc func = (VoidFunc)cafeLog_log;

View File

@ -41,7 +41,6 @@ void crashlog_writeHeader(const char* header)
} }
bool crashLogCreated = false; bool crashLogCreated = false;
bool IsCemuhookLoaded();
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
BOOL CALLBACK MyMiniDumpCallback(PVOID pParam, const PMINIDUMP_CALLBACK_INPUT pInput, PMINIDUMP_CALLBACK_OUTPUT pOutput) 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); fs::copy_file(ActiveSettings::GetPath("log.txt"), p, ec);
} }
if (IsCemuhookLoaded()) exit(0);
TerminateProcess(GetCurrentProcess(), 0); // abort();
else
exit(0);
return; return;
} }

View File

@ -1,12 +0,0 @@
project(CemuCemuhook)
add_library(CemuCemuhook
wxEvtHook.inl
wxCemuhookExports.cpp
)
set_property(TARGET CemuCemuhook PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
target_precompile_headers(CemuCemuhook PRIVATE ../Common/precompiled.h)
target_include_directories(CemuCemuhook PRIVATE ../)

View File

@ -1,196 +0,0 @@
#ifdef USE_CEMUHOOK
#include <wx/app.h>
#include <wx/event.h>
#include <wx/process.h>
#include <wx/timer.h>
#include <wx/window.h>
#include <wx/dialog.h>
#include <wx/dcclient.h>
#include <wx/frame.h>
#include <wx/menu.h>
#include <wx/sizer.h>
#include <wx/checklst.h>
#include <wx/button.h>
#include <wx/combobox.h>
#include <wx/stattext.h>
#include <wx/listctrl.h>
#include <wx/dataview.h>
#include <wx/filedlg.h>
#include <wx/mstream.h>
#include <wx/hyperlink.h>
#include <wx/clipbrd.h>
#include <wx/notebook.h>
#include <wx/spinctrl.h>
#include <wx/collpane.h>
#include <wx/collheaderctrl.h>
#include <wx/power.h>
#include <wx/gauge.h>
#define CHECK_FOR_WX_EVT_STRING(strVar, strConst) if (strcmp(strVar, #strConst) == 0){ return static_cast<int>(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<int>(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<int>(outObj);
if (oldVal == newId)
return false;
wxEventType* dstObj = const_cast<wxEventType*>(&outObj);
memcpy(dstObj, &newId, sizeof(newId));
// check value again
if (static_cast<int>(outObj) != newId)
assert_dbg();
return true;
}
void FixupWxEvtIdsToMatchCemuHook()
{
// instantiate all the events
#define PROCESS_OWN_WXEVT(EventVarName,EventHookId) static_cast<int>(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

View File

@ -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);

View File

@ -10,7 +10,7 @@
#include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h" #include "Cafe/HW/Latte/Renderer/Vulkan/VulkanAPI.h"
#include "Cafe/CafeSystem.h" #include "Cafe/CafeSystem.h"
extern bool DLLEXPORT alwaysDisplayDRC; extern bool alwaysDisplayDRC;
void ActiveSettings::LoadOnce() void ActiveSettings::LoadOnce()
{ {

View File

@ -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

View File

@ -68,14 +68,6 @@ void unused_translation_dummy()
void(_("PrincipalId missing")); 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() bool CemuApp::OnInit()
{ {
wxInitAllImageHandlers(); wxInitAllImageHandlers();
@ -140,9 +132,6 @@ bool CemuApp::OnInit()
g_window_info.app_active = true; g_window_info.app_active = true;
SetTopWindow(m_mainFrame); SetTopWindow(m_mainFrame);
// Cemuhook callback
wxMainWindowCreated(m_mainFrame, 0xDABABE, this);
m_mainFrame->Show(); m_mainFrame->Show();
return true; return true;
} }

View File

@ -510,7 +510,6 @@ void CemuUpdateWindow::WorkerThread()
} }
} }
bool IsCemuhookLoaded();
void CemuUpdateWindow::OnClose(wxCloseEvent& event) void CemuUpdateWindow::OnClose(wxCloseEvent& event)
{ {
event.Skip(); event.Skip();
@ -530,10 +529,7 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
HANDLE lock = CreateMutex(nullptr, TRUE, L"Global\\cemu_update_lock"); 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); CreateProcess(nullptr, (wchar_t*)cmdline.c_str(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi);
if (IsCemuhookLoaded()) exit(0);
TerminateProcess(GetCurrentProcess(), 0);
else
exit(0);
} }
#else #else
cemuLog_log(LogType::Force, "unimplemented - restart on update"); cemuLog_log(LogType::Force, "unimplemented - restart on update");

View File

@ -21,7 +21,7 @@ GameProfileWindow::GameProfileWindow(wxWindow* parent, uint64_t title_id)
SetIcon(wxICON(X_GAME_PROFILE)); SetIcon(wxICON(X_GAME_PROFILE));
m_game_profile.Reset(); m_game_profile.Reset();
m_game_profile.Load(title_id, false); m_game_profile.Load(title_id);
this->SetSizeHints(wxDefaultSize, wxDefaultSize); this->SetSizeHints(wxDefaultSize, wxDefaultSize);

View File

@ -15,8 +15,6 @@
#endif #endif
// main.cpp // main.cpp
bool IsCemuhookLoaded();
class wxGraphicPackData : public wxTreeItemData class wxGraphicPackData : public wxTreeItemData
{ {
public: public:

View File

@ -65,8 +65,6 @@
extern WindowInfo g_window_info; extern WindowInfo g_window_info;
extern std::shared_mutex g_mutex; extern std::shared_mutex g_mutex;
bool IsCemuhookLoaded();
wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent); wxDEFINE_EVENT(wxEVT_SET_WINDOW_TITLE, wxCommandEvent);
enum enum
@ -347,18 +345,6 @@ MainWindow::MainWindow()
Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, this); Bind(wxEVT_OPEN_GRAPHIC_PACK, &MainWindow::OnGraphicWindowOpen, this);
Bind(wxEVT_LAUNCH_GAME, &MainWindow::OnLaunchFromFile, 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()) if (LaunchSettings::GetLoadFile().has_value())
{ {
MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE); MainWindow::RequestLaunchGame(LaunchSettings::GetLoadFile().value(), wxLaunchGameEvent::INITIATED_BY::COMMAND_LINE);
@ -2086,12 +2072,6 @@ void MainWindow::RecreateMenu()
#ifndef PUBLIC_RELEASE #ifndef PUBLIC_RELEASE
m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation")); m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_END_EMULATION, _("End emulation"));
#endif #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")); m_exitMenuItem = m_fileMenu->Append(MAINFRAME_MENU_ID_FILE_EXIT, _("&Exit"));

View File

@ -161,8 +161,6 @@ private:
wxSize m_restored_size; wxSize m_restored_size;
wxPoint m_restored_position; wxPoint m_restored_position;
wxStatusBar* m_statusBar{};
bool m_menu_visible = false; bool m_menu_visible = false;
bool m_game_launched = false; bool m_game_launched = false;

View File

@ -17,21 +17,17 @@ std::shared_mutex g_mutex;
MainWindow* g_mainFrame = nullptr; MainWindow* g_mainFrame = nullptr;
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
void wxMatchCemuhookEventIds();
void _wxLaunch() void _wxLaunch()
{ {
SetThreadName("MainThread_UI"); SetThreadName("MainThread_UI");
wxEntry(); wxEntry();
} }
#endif #endif
void gui_create() void gui_create()
{ {
SetThreadName("MainThread"); SetThreadName("MainThread");
#if BOOST_OS_WINDOWS #if BOOST_OS_WINDOWS
wxMatchCemuhookEventIds();
// on Windows wxWidgets there is a bug where wxDirDialog->ShowModal will deadlock in Windows internals somehow // 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 // moving the UI thread off the main thread fixes this
std::thread t = std::thread(_wxLaunch); std::thread t = std::thread(_wxLaunch);

View File

@ -53,44 +53,6 @@ std::atomic_bool g_isGPUInitFinished = false;
std::wstring executablePath; 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() void logCPUAndMemoryInfo()
{ {
#if BOOST_OS_WINDOWS #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 {} {}.{}{} -------", 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("Init Wii U memory space (base: 0x{:016x})", (size_t)memory_base);
cemuLog_force(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string()); cemuLog_force(u8"mlc01 path: {}", ActiveSettings::GetMlcPath().generic_u8string());
// check if Cemuhook is installed
checkForCemuhook();
// check for wine version // check for wine version
checkForWine(); checkForWine();
// CPU and RAM info // CPU and RAM info
@ -424,48 +384,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
/* Cemuhook legacy API */ extern "C" DLLEXPORT uint64 gameMeta_getTitleId()
#pragma optimize("",off)
__declspec(dllexport) void gameMeta_loadForCurrent()
{
int placeholderA = 0x11223344;
int placeholderB = 0x55667788;
}
#pragma optimize("",on)
__declspec(dllexport) uint64 gameMeta_getTitleId()
{ {
return CafeSystem::GetForegroundTitleId(); 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