mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-26 01:18:01 -05:00
Fix delayload xmm0
This commit is contained in:
parent
2824c17e89
commit
ec1d846a69
3 changed files with 66 additions and 20 deletions
|
@ -1,7 +1,9 @@
|
|||
# Geode Changelog
|
||||
|
||||
## v3.0.0-beta.2
|
||||
## v3.0.0-beta.3
|
||||
*
|
||||
|
||||
## v3.0.0-beta.2
|
||||
* (WebRequest) Don't change the method from POST to GET on redirect follow (6ae11dd)
|
||||
* Make `file::openFolder` actually work on selecting paths on Windows (0309e01)
|
||||
* Hide platform console option on Android (df3d147)
|
||||
|
@ -22,7 +24,6 @@
|
|||
* Hopefully finally fix Windows crashlogs (70fe096)
|
||||
|
||||
## v3.0.0-beta.1
|
||||
|
||||
* Add a special error for 1114 - vcredist update (d0821f5)
|
||||
* Properly fix Windows exceptions (84a2c6b)
|
||||
* Add keyboard support to ModsLayer (2b53e8a)
|
||||
|
@ -45,7 +46,6 @@
|
|||
* `file::pick` and `file::pickMany` are the new file APIs, which use Tasks (#899)
|
||||
|
||||
## v3.0.0-alpha.2
|
||||
|
||||
* Add `WebResponse::into()` for writing responses to files (f909a73)
|
||||
* Add `geodeImplicitEntry` and `geodeCustomEntry` (6b2ac24, 5969c90)
|
||||
* Fix padding and add a custom color for borders (#868)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
3.0.0-beta.2
|
||||
3.0.0-beta.3
|
|
@ -69,22 +69,68 @@ void patchDelayLoad() {
|
|||
// TODO:
|
||||
// FIXME: xmm0 is still wrong, dont have enough space to fix it,
|
||||
// gotta allocate space somewhere else
|
||||
static constexpr uint8_t patch1[] = {
|
||||
0x48, 0x83, 0xEC, 0x68, // sub rsp, 68h
|
||||
0x66, 0x0F, 0x7F, 0x04, 0x24, // movdqa xmmword ptr [rsp], xmm0
|
||||
0x66, 0x0F, 0x7F, 0x4C, 0x24, 0x30, // movdqa xmmword ptr [rsp+30h], xmm1
|
||||
0x66, 0x0F, 0x7F, 0x54, 0x24, 0x40, // movdqa xmmword ptr [rsp+40h], xmm2
|
||||
0x66, 0x0F, 0x7F, 0x5C, 0x24, 0x50, // movdqa xmmword ptr [rsp+50h], xmm3
|
||||
};
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 6), patch1, sizeof(patch1));
|
||||
static constexpr uint8_t patch2[] = {
|
||||
0x66, 0x0F, 0x6F, 0x04, 0x24, // movdqa xmm0, xmmword ptr [rsp]
|
||||
0x66, 0x0F, 0x6F, 0x4C, 0x24, 0x30, // movdqa xmm1, xmmword ptr [rsp+30h]
|
||||
0x66, 0x0F, 0x6F, 0x54, 0x24, 0x40, // movdqa xmm2, xmmword ptr [rsp+40h]
|
||||
0x66, 0x0F, 0x6F, 0x5C, 0x24, 0x50, // movdqa xmm3, xmmword ptr [rsp+50h]
|
||||
0x48, 0x83, 0xC4, 0x68, // add rsp, 68h
|
||||
};
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 48), patch2, sizeof(patch2));
|
||||
auto allocated = reinterpret_cast<uintptr_t>(VirtualAlloc(nullptr, 0x100, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READ));
|
||||
if (!allocated) {
|
||||
log::warn("Failed to allocate memory for xmm0 fix");
|
||||
static constexpr uint8_t patch1[] = {
|
||||
0x48, 0x83, 0xEC, 0x68, // sub rsp, 68h
|
||||
0x66, 0x0F, 0x7F, 0x04, 0x24, // movdqa xmmword ptr [rsp], xmm0
|
||||
0x66, 0x0F, 0x7F, 0x4C, 0x24, 0x30, // movdqa xmmword ptr [rsp+30h], xmm1
|
||||
0x66, 0x0F, 0x7F, 0x54, 0x24, 0x40, // movdqa xmmword ptr [rsp+40h], xmm2
|
||||
0x66, 0x0F, 0x7F, 0x5C, 0x24, 0x50, // movdqa xmmword ptr [rsp+50h], xmm3
|
||||
};
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 6), patch1, sizeof(patch1));
|
||||
static constexpr uint8_t patch2[] = {
|
||||
0x66, 0x0F, 0x6F, 0x04, 0x24, // movdqa xmm0, xmmword ptr [rsp]
|
||||
0x66, 0x0F, 0x6F, 0x4C, 0x24, 0x30, // movdqa xmm1, xmmword ptr [rsp+30h]
|
||||
0x66, 0x0F, 0x6F, 0x54, 0x24, 0x40, // movdqa xmm2, xmmword ptr [rsp+40h]
|
||||
0x66, 0x0F, 0x6F, 0x5C, 0x24, 0x50, // movdqa xmm3, xmmword ptr [rsp+50h]
|
||||
0x48, 0x83, 0xC4, 0x68, // add rsp, 68h
|
||||
};
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 48), patch2, sizeof(patch2));
|
||||
}
|
||||
else {
|
||||
std::array<uint8_t, 27> patch1 = {
|
||||
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip + ...]
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
uintptr_t jmpAddr = allocated;
|
||||
std::memcpy(patch1.data() + 6, &jmpAddr, sizeof(jmpAddr));
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 6), patch1.data(), sizeof(patch1));
|
||||
|
||||
std::array<uint8_t, 48> patch2 = {
|
||||
0x48, 0x83, 0xEC, 0x68, // sub rsp, 68h
|
||||
0x66, 0x0F, 0x7F, 0x44, 0x24, 0x20, // movdqa xmmword ptr [rsp+20h], xmm0
|
||||
0x66, 0x0F, 0x7F, 0x4C, 0x24, 0x30, // movdqa xmmword ptr [rsp+30h], xmm1
|
||||
0x66, 0x0F, 0x7F, 0x54, 0x24, 0x40, // movdqa xmmword ptr [rsp+40h], xmm2
|
||||
0x66, 0x0F, 0x7F, 0x5C, 0x24, 0x50, // movdqa xmmword ptr [rsp+50h], xmm3
|
||||
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip + ...]
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
jmpAddr = tailMergeAddr + 6 + 27;
|
||||
std::memcpy(patch2.data() + 34, &jmpAddr, sizeof(jmpAddr));
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(allocated), patch2.data(), sizeof(patch2));
|
||||
|
||||
jmpAddr = allocated + 42;
|
||||
std::memcpy(patch1.data() + 6, &jmpAddr, sizeof(jmpAddr));
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(tailMergeAddr + 48), patch1.data(), sizeof(patch1));
|
||||
|
||||
std::array<uint8_t, 48> patch3 = {
|
||||
0x66, 0x0F, 0x6F, 0x44, 0x24, 0x20, // movdqa xmm0, xmmword ptr [rsp+20h]
|
||||
0x66, 0x0F, 0x6F, 0x4C, 0x24, 0x30, // movdqa xmm1, xmmword ptr [rsp+30h]
|
||||
0x66, 0x0F, 0x6F, 0x54, 0x24, 0x40, // movdqa xmm2, xmmword ptr [rsp+40h]
|
||||
0x66, 0x0F, 0x6F, 0x5C, 0x24, 0x50, // movdqa xmm3, xmmword ptr [rsp+50h]
|
||||
0x48, 0x83, 0xC4, 0x68, // add rsp, 68h
|
||||
0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, // jmp qword ptr [rip + ...]
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90, 0x90, 0x90, 0x90, 0x90, 0x90
|
||||
};
|
||||
jmpAddr = tailMergeAddr + 48 + 27;
|
||||
std::memcpy(patch3.data() + 34, &jmpAddr, sizeof(jmpAddr));
|
||||
(void) tulip::hook::writeMemory(reinterpret_cast<void*>(allocated + 42), patch3.data(), sizeof(patch3));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue