mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-25 22:15:57 +00:00
Check the camera's player-state pointers against the guest layout instead of asking the OS
player_state follows about fifteen pointers from the player root to its action verbs, and each was checked with plat_mem_readable, a VirtualQuery. That query costs tens of microseconds in this process, so the read stalled the game thread while the mouse moved. mem_guest_readable answers from the layout for the committed heap and the loaded modules, where the player and its components live, and asks the OS only for anything else. Together with the same change in the menu pointer, a Ryzen 5 4500 runs the scene that fell to 50-54 fps at 58-60 fps again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
27f4d40e80
commit
27f64d6a29
4 files changed
+34
-2
No files matched your search
@@ -173,7 +173,7 @@ enum { VERB_USE_BOW = 59, VERB_USE_SPECIAL_POWER = 61, VERB_DRAWN_BOW = 205, VER
|
||||
enum { PLAYER_FOUND = 1, PLAYER_ABILITY = 2, PLAYER_BOW = 4 };
|
||||
|
||||
static int readable(uint64_t p, uint64_t n) {
|
||||
return p >= 0x10000 && p < (1ull << 47) && !(p & 7) && plat_mem_readable(p, n);
|
||||
return p >= 0x10000 && p < (1ull << 47) && !(p & 7) && mem_guest_readable(p, n);
|
||||
}
|
||||
static int32_t guest_s32(uint64_t at) { int32_t v; memcpy(&v, (void *)(uintptr_t)at, sizeof v); return v; }
|
||||
static int game_object(uint64_t p, uint64_t n) { // readable, its vtable in main's image
|
||||
|
||||
Reference in new issue
Block a user