mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-11 18:01:03 +00:00
On Linux, write-protecting memory the GPU imported costs milliseconds per submit and the import's pinning clears the write watch, so each CPU-visible pool gets a host-visible copy instead: the pages the CPU wrote since the last sync go in right before each submit (skipping bytes the GPU still has to write back), and the replay's GPU writes are copied back into guest memory at their fence (vk_gpu_written). In 1.2.1 play it costs about 0.2 ms a frame. TOTK_SHADOW=1 turns it on under Windows too. Also: build_game.py fetches the VMA header the Windows release pins when the system has none; plat_localtime and plat_gmtime reject the times Windows rejects; the SDL text entry honours TOTK_SWKBD_TEST=cancel; probe-vkmem follows the replay's protocol for GPU writes and syncs.
22 lines
1015 B
C
22 lines
1015 B
C
// The software keyboard's front end for SDL windows (swkbd.h). Until the in-game text field exists (an ImGui entry in
|
|
// the menu overlay, which SDL_StartTextInput can pair with the Steam Deck's on-screen keyboard), the text entry takes
|
|
// the starting text at once, as TOTK_SWKBD_ANSWER=<initial> does: the game's initial text, else the default name from
|
|
// the catalog. TotK asks only for a horse's name. TOTK_SWKBD_TEST=cancel stands for Cancel pressed, as in the Win32
|
|
// window.
|
|
#include <string.h>
|
|
|
|
#include "cfg.h"
|
|
#include "host.h"
|
|
#include "swkbd.h"
|
|
|
|
int text_entry_run(const SwkbdRequest *req, uint16_t *out, size_t cap, size_t *n) {
|
|
const char *test = cfg_get("TOTK_SWKBD_TEST");
|
|
if (test && !strcmp(test, "cancel")) { *n = 0; return 0; }
|
|
size_t k = 0;
|
|
while (k < cap && req->initial[k]) k++;
|
|
memcpy(out, req->initial, k * 2);
|
|
*n = k;
|
|
rt_log("swkbd: no text entry window on this host yet: the %s name is taken", req->game_initial ? "game's" : "default");
|
|
return k > 0;
|
|
}
|