geode/loader/src/hooks/MessageBoxFix.cpp

39 lines
1 KiB
C++
Raw Normal View History

#include <Geode/DefaultInclude.hpp>
#ifdef GEODE_IS_WINDOWS
2023-02-08 16:42:34 +03:00
#include <Geode/loader/Mod.hpp>
#include <Geode/modify/Modify.hpp>
using namespace geode::prelude;
// 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
2022-10-30 21:56:36 +03:00
static void __cdecl fixedErrorHandler(int code, char const* description) {
log::error("GLFW Error {}: {}", code, description);
MessageBoxA(
nullptr,
fmt::format(
"GLFWError #{}: {}\nPlease contact the "
"Geode Development Team for more information.",
2023-02-08 16:42:34 +03:00
code,
description
)
.c_str(),
"OpenGL Error",
MB_ICONERROR
);
}
$execute {
2024-01-12 22:18:24 +03:00
// TODO: i'm pretty sure this patch only works on 2.113?
//(void)Mod::get()->patch(
// reinterpret_cast<void*>(geode::base::getCocos() + 0x19feec), toByteArray(&fixedErrorHandler)
//);
2022-10-08 17:05:53 +03:00
}
#endif