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
35 changed files with 38 additions and 792 deletions
+1 -6
View File
@@ -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)
-10
View File
@@ -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)
+1 -1
View File
@@ -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;
+4 -35
View File
@@ -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;
}
+2 -2
View File
@@ -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<GameProfile> g_current_game_profile;
__declspec(dllexport) void gameProfile_load();
void gameProfile_load();
-25
View File
@@ -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
*/
+1 -62
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)
{
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<std::pair<MPTR, MPTR>> 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;
}
}
+2 -2
View File
@@ -166,8 +166,8 @@ public:
static bool DeactivateGraphicPack(const std::shared_ptr<GraphicPack2>& graphic_pack);
static void ClearGraphicPacks();
private:
__declspec(dllexport) bool Activate();
__declspec(dllexport) bool Deactivate();
bool Activate();
bool Deactivate();
static std::vector<std::shared_ptr<GraphicPack2>> s_graphic_packs;
static std::vector<std::shared_ptr<GraphicPack2>> s_active_graphic_packs;
-5
View File
@@ -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();
@@ -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;
@@ -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
+1 -1
View File
@@ -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)
+1 -9
View File
@@ -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
}
}
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -1,6 +1,6 @@
#pragma once
DLLEXPORT void memory_init();
void memory_init();
void memory_mapForCurrentTitle();
void memory_logModifiedMemoryRanges();
+2 -2
View File
@@ -46,8 +46,8 @@ ChunkedFlatAllocator<64 * 1024> g_heapTrampolineArea;
std::vector<rplDependency_t*> rplDependencyList = std::vector<rplDependency_t*>();
__declspec(dllexport) RPLModule* rplModuleList[256];
__declspec(dllexport) sint32 rplModuleCount = 0;
RPLModule* rplModuleList[256];
sint32 rplModuleCount = 0;
uint32 _currentTLSModuleIndex = 1; // value 0 is reserved
+1 -1
View File
@@ -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();
+1 -1
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));
}
__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);
}
+1 -1
View File
@@ -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);
@@ -43,49 +43,4 @@ void ExpressionParser_test()
cemu_assert_debug(_testEvaluateToType<float>("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<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);
}
// 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;
}
}

Some files were not shown because too many files have changed in this diff Show More