mirror of
https://github.com/geode-sdk/geode.git
synced 2025-04-16 06:55:04 -04:00
fix macos tulip-hook, it works
This commit is contained in:
parent
cef0f3f3bb
commit
d7b1d9ba70
3 changed files with 24 additions and 9 deletions
loader
|
@ -121,6 +121,7 @@ target_include_directories(${PROJECT_NAME} PRIVATE
|
|||
if (APPLE)
|
||||
# For profiling
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC "-ftime-trace")
|
||||
# target_link_options(${PROJECT_NAME} PRIVATE "-Wl,-e,_dynamicInit")
|
||||
#set_property(TARGET ${PROJECT_NAME} PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
|
||||
endif()
|
||||
|
||||
|
@ -132,7 +133,7 @@ CPMAddPackage("gh:mity/md4c#e9ff661")
|
|||
target_include_directories(${PROJECT_NAME} PRIVATE ${md4c_SOURCE_DIR}/src)
|
||||
|
||||
# Tulip hook (hooking)
|
||||
CPMAddPackage("gh:altalk23/TulipHook#5ba99a8")
|
||||
CPMAddPackage("gh:altalk23/TulipHook#fc1b943")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} md4c z TulipHook geode-sdk)
|
||||
|
||||
|
|
|
@ -14,11 +14,17 @@ void displayError(std::string alertMessage) {
|
|||
}
|
||||
|
||||
void loadGeode() {
|
||||
auto dylib = dlopen("Geode.dylib", RTLD_LAZY);
|
||||
if (dylib) return;
|
||||
|
||||
displayError(std::string("Couldn't open Geode: ") + dlerror());
|
||||
|
||||
auto dylib = dlopen("Geode.dylib", RTLD_NOW);
|
||||
if (!dylib) {
|
||||
displayError(std::string("Couldn't load Geode: ") + dlerror());
|
||||
return;
|
||||
}
|
||||
auto trigger = dlsym(dylib, "dynamicTrigger");
|
||||
if (!trigger) {
|
||||
displayError(std::string("Couldn't start Geode: ") + dlerror());
|
||||
return;
|
||||
}
|
||||
reinterpret_cast<void(*)()>(trigger)();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ std::length_error::~length_error() _NOEXCEPT {} // do not ask...
|
|||
// from dynamic to static thats why she needs to define it
|
||||
// this is what old versions does to a silly girl
|
||||
|
||||
__attribute__((constructor)) void _entry() {
|
||||
void dynamicEntry() {
|
||||
auto dylib = dlopen("GeodeBootstrapper.dylib", RTLD_NOLOAD);
|
||||
dlclose(dylib);
|
||||
|
||||
|
@ -54,6 +54,13 @@ __attribute__((constructor)) void _entry() {
|
|||
geodeEntry(nullptr);
|
||||
}
|
||||
|
||||
extern "C" __attribute__((visibility("default"))) void dynamicTrigger() {
|
||||
std::thread(&dynamicEntry).detach();
|
||||
}
|
||||
|
||||
// remove when we can figure out how to not remove it
|
||||
auto dynamicTriggerRef = &dynamicTrigger;
|
||||
|
||||
#elif defined(GEODE_IS_WINDOWS)
|
||||
#include <Windows.h>
|
||||
|
||||
|
@ -160,11 +167,12 @@ int geodeEntry(void* platformData) {
|
|||
}
|
||||
|
||||
// set up loader, load mods, etc.
|
||||
if (!LoaderImpl::get()->setup()) {
|
||||
auto setupRes = LoaderImpl::get()->setup();
|
||||
if (!setupRes) {
|
||||
LoaderImpl::get()->platformMessageBox(
|
||||
"Unable to Load Geode!",
|
||||
"There was an unknown fatal error setting up "
|
||||
"the loader and Geode can not be loaded."
|
||||
"the loader and Geode can not be loaded." + setupRes.unwrapErr()
|
||||
);
|
||||
LoaderImpl::get()->reset();
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue