HUD: centre the taskbar, move the portrait/health panel to the right edge
New mods/hud: while a HUD window renders, screen-space vertices passed to D3D7 DrawPrimitive/DrawIndexedPrimitive are shifted by dx; while it handles an event, the UI event point (category 5, +0x48) is shifted by -dx. Applied to cUI_Taskbar2 (centred) and cUI_Mercenary (portrait + health, right edge). 3D belt items line up without help (their projection is screen-centred). re::AttachRuntimeHook hooks functions only known at runtime (COM methods). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
f73c4154ad
commit
ed3163d312
8 files changed
+259
-1
No files matched your search
@@ -59,4 +59,22 @@ int InstallHooks() {
|
||||
return failed;
|
||||
}
|
||||
|
||||
bool AttachRuntimeHook(const char* name, void** original, void* replacement) {
|
||||
const void* target = *original;
|
||||
DetourTransactionBegin();
|
||||
DetourUpdateThread(GetCurrentThread());
|
||||
LONG error = DetourAttach(original, replacement);
|
||||
if (error == NO_ERROR) {
|
||||
error = DetourTransactionCommit();
|
||||
} else {
|
||||
DetourTransactionAbort();
|
||||
}
|
||||
if (error != NO_ERROR) {
|
||||
Log("hook %-24s %p FAILED (error %ld)", name, target, error);
|
||||
return false;
|
||||
}
|
||||
Log("hook %-24s %p attached at runtime", name, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace re
|
||||
@@ -31,6 +31,11 @@ public:
|
||||
// number of hooks that failed to attach.
|
||||
int InstallHooks();
|
||||
|
||||
// Hooks a function only known at runtime (e.g. a COM method read from a
|
||||
// vtable). `*original` must hold the function's address; it receives the
|
||||
// trampoline. Returns false (and logs) on failure.
|
||||
bool AttachRuntimeHook(const char* name, void** original, void* replacement);
|
||||
|
||||
} // namespace re
|
||||
|
||||
// Hooks a Windows API function for the whole process (game and DLLs alike).
|
||||
|
||||
Reference in new issue
Block a user