mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-22 23:48:08 -05:00
fix tuliphook result and windows messageboxfix
This commit is contained in:
parent
1bdc8f408c
commit
ac40e4c8fb
2 changed files with 3 additions and 18 deletions
|
@ -136,7 +136,7 @@ CPMAddPackage("gh:google/re2#954656f")
|
|||
target_include_directories(${PROJECT_NAME} PRIVATE ${md4c_SOURCE_DIR}/src)
|
||||
|
||||
# Tulip hook (hooking)
|
||||
CPMAddPackage("gh:altalk23/TulipHook#2a97005")
|
||||
CPMAddPackage("gh:altalk23/TulipHook#2347311")
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} md4c z TulipHook geode-sdk re2)
|
||||
|
||||
|
|
|
@ -7,14 +7,11 @@
|
|||
#include <Geode/loader/Mod.hpp>
|
||||
|
||||
USE_GEODE_NAMESPACE();
|
||||
using geode::core::meta::x86::Thiscall;
|
||||
|
||||
// for some reason RobTop uses MessageBoxW in his GLFW error handler.
|
||||
// no one knows how this is possible (he passes char* to wchar_t*).
|
||||
// so anyway, here's a fix for it
|
||||
|
||||
static auto CCEGLVIEW_CON_ADDR = reinterpret_cast<void*>(base::getCocos() + 0xc2860);
|
||||
|
||||
static void __cdecl fixedErrorHandler(int code, char const* description) {
|
||||
log::error("GLFW Error {}: {}", code, description);
|
||||
MessageBoxA(
|
||||
|
@ -28,23 +25,11 @@ static void __cdecl fixedErrorHandler(int code, char const* description) {
|
|||
);
|
||||
}
|
||||
|
||||
static CCEGLView* CCEGLView_CCEGLView(CCEGLView* self) {
|
||||
// you will never have to make a manual hook with Geode again, they said
|
||||
// it will be fun, they said
|
||||
reinterpret_cast<CCEGLView*(__thiscall*)(CCEGLView*)>(CCEGLVIEW_CON_ADDR)(self);
|
||||
static auto p = Mod::get()->patch(
|
||||
$execute {
|
||||
(void)Mod::get()->patch(
|
||||
reinterpret_cast<void*>(geode::base::getCocos() + 0x19feec),
|
||||
toByteArray(&fixedErrorHandler)
|
||||
);
|
||||
return self;
|
||||
}
|
||||
|
||||
$execute {
|
||||
(void)Mod::get()->addHook<tulip::hook::ThiscallConvention>(
|
||||
CCEGLVIEW_CON_ADDR,
|
||||
&CCEGLView_CCEGLView,
|
||||
"CCEGLView::CCEGLView",
|
||||
);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue