mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 09:00:25 +02:00
Runtime patches no longer use webpack module ids or minified export names, which change with every Steam UI build: - modules/lib/finders.js: finder library (getWebpackRequire, findModule/findExport by source text and shape, resolveAll with a per-page cache, findFiberUp/findFiberDown/findInReactTree), installed once per page as window.__sfuiFind. - modules/lib/signatures.json: the signatures, per patch, shared by the patches and the checker. lib/default.nix mkPatch wraps a patch `(find, sigs, opts) => ...` with the library, its signatures and options; exposed as steamFrame.uiPatches.lib. - Keyboard patch (VERSION 10): layouts module, current/enabled layout getters, arrow keys, VR keyboard status and VirtualKeyboardManager are found by signature; if one doesn't match it reports which and leaves Steam untouched. unpatch.js uses references the patch remembered. The helper logs inject results when they change. - launcher-menu launch/pinned-desktop use the library's fiber helpers; launch no longer depends on the bar popup's window name. - scripts/check-signatures.mjs (+ webpack-modules.mjs): extracts module factories from the installed bundles without a browser and checks every signature (found / ambiguous / missing, with module ids and export names). README: "Finders and signatures", "After a Steam update".
30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
// Reverts patch.js in Steam's SharedJSContext; evaluated by helper.mjs
|
|
// when it stops (service stopped, module disabled). Every patched function
|
|
// keeps its original as __vrkbdOrig; the patched objects Steam doesn't expose
|
|
// globally were remembered by patch.js (window.__vrkbdRefs, __vrkbdLayouts,
|
|
// __vrkbdProto, __vrkbdInst). Safe to run when nothing is patched.
|
|
(() => {
|
|
const refs = window.__vrkbdRefs;
|
|
if (!refs && !window.__vrkbdProto && !window.__vrkbdLayouts) return 'not patched';
|
|
const unwrap = (obj, name) => {
|
|
const f = obj?.[name];
|
|
if (f?.__vrkbdOrig) obj[name] = f.__vrkbdOrig;
|
|
};
|
|
for (const l of window.__vrkbdLayouts || []) unwrap(l, 'rgLayout');
|
|
unwrap(SteamClient.Input, 'ControllerKeyboardSendText');
|
|
unwrap(window.__vrkbdProto, 'TypeKeyInternal');
|
|
unwrap(refs?.Manager, 'GetEnterKeyLabel');
|
|
unwrap(refs?.Manager, 'HandleVirtualKeyDown');
|
|
clearInterval(window.__vrkbdHoldTimer);
|
|
|
|
const inst = window.__vrkbdInst;
|
|
if (inst) {
|
|
delete inst.__vrkbd;
|
|
if (refs?.currentLayout) inst.setState({ standardLayout: refs.currentLayout() });
|
|
inst.forceUpdate();
|
|
}
|
|
for (const p of g_PopupManager.GetPopups?.() || []) p.window?.document.getElementById('vrkbd-style')?.remove();
|
|
for (const k of ['__vrkbdHoldTimer', '__vrkbdHeld', '__vrkbdInst', '__vrkbdProto', '__vrkbdLayouts', '__vrkbdRefs']) delete window[k];
|
|
return 'unpatched';
|
|
})()
|