fix the messagebox fix

This commit is contained in:
Fleeym 2024-01-28 21:17:29 +02:00
parent d834ec1221
commit d2befe1873

View file

@ -29,25 +29,25 @@ static void __cdecl fixedErrorHandler(int code, char const* description) {
);
}
$execute {
// updated for 2.204
// check xrefs to "GLFWError #%d Happen, %s\n", now there's two functions with the same exact
// behaviour, one is a member function though... call ds:MessageBoxW
// patch MessageBoxW to MessageBoxA
// geode::base::getCocos() + 0x122600 = MessageBoxA in .idata
// geode::base::getCocos() + 0x1225DC = MessageBoxW in .idata
if (LoaderImpl::get()->isForwardCompatMode()) return;
const uint32_t importedMessageBoxA = geode::base::getCocos() + 0x122600;
ByteVector p = {
(importedMessageBoxA) & 0xff,
(importedMessageBoxA >> 8) & 0xff,
(importedMessageBoxA >> 16) & 0xff,
(importedMessageBoxA >> 24) & 0xff};
(void)Mod::get()->patch(reinterpret_cast<void*>(geode::base::getCocos() + 0xC75F9), p);
(void)Mod::get()->patch(reinterpret_cast<void*>(geode::base::getCocos() + 0xc7651), p);
$execute {
// updated for 2.204
// check xrefs to "GLFWError #%d Happen, %s\n", now there's two functions with the same exact
// behaviour, one is a member function though... call ds:MessageBoxW
// patch MessageBoxW to MessageBoxA
// geode::base::getCocos() + 0x122600 = MessageBoxA in .idata
// geode::base::getCocos() + 0x1225DC = MessageBoxW in .idata
if (LoaderImpl::get()->isForwardCompatMode()) return;
const uint32_t importedMessageBoxA = geode::base::getCocos() + 0x122600;
ByteVector p = {
static_cast<unsigned char>((importedMessageBoxA) & 0xff),
static_cast<unsigned char>((importedMessageBoxA >> 8) & 0xff),
static_cast<unsigned char>((importedMessageBoxA >> 16) & 0xff),
static_cast<unsigned char>((importedMessageBoxA >> 24) & 0xff)};
(void)Mod::get()->patch(reinterpret_cast<void*>(geode::base::getCocos() + 0xC75F9), p);
(void)Mod::get()->patch(reinterpret_cast<void*>(geode::base::getCocos() + 0xc7651), p);
}
#endif