mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 05:00:24 +02:00
lib: shared resolvePatch, ensureStyle, logger; legacy wrapper code removed
- finders.js (VERSION 2): resolvePatch (resolveAll or the "signature not found, ... left unpatched" status), ensureStyle and logger, used by the patches instead of their own copies. - hooks.js (VERSION 2) no longer unwinds per-patch wrappers of old patch versions; dashboard-windows and steam-close-button drop their handling of versions <= 2 / <= 6 (in-page only, gone with any SteamVR restart). - VERSIONs: dashboard-windows 4, steam-close-button 9, window-curvature 21, frame-controls 7, steam-keyboard-patch 22, launcher-menu grid 7, pinned-desktop 4, show-all 2.
This commit is contained in:
1 parent
36886d61df
commit
a5ecbad76d
11 files changed
+68
-108
No files matched your search
@@ -68,7 +68,7 @@
|
||||
// setPlacement(name or "icon:N", 'bar' | 'menu' | null), reset().
|
||||
((find, sigs, opts) => {
|
||||
const NAME = 'frame-controls';
|
||||
const VERSION = 6;
|
||||
const VERSION = 7;
|
||||
const T_SPACER = 1, T_ACTION = 2;
|
||||
// Action icon enums (sigs.controls anchors them): names for the options.
|
||||
const NAMES = { keyboard: 22, float: 26, dashboard: 27, theater: 28, dockLeft: 29, dockRight: 30, close: 31, curvature: 40 };
|
||||
@@ -96,12 +96,8 @@
|
||||
|
||||
const FS = window.FrameStore;
|
||||
if (!FS) return 'not patched: window.FrameStore missing';
|
||||
let mods;
|
||||
try {
|
||||
mods = find.resolveAll(find.getWebpackRequire('webpackChunkvrwebui'), sigs);
|
||||
} catch (e) {
|
||||
return `signature not found, dashboard left unpatched: ${e.message}`;
|
||||
}
|
||||
const mods = find.resolvePatch('webpackChunkvrwebui', sigs);
|
||||
if (typeof mods === 'string') return mods;
|
||||
const mx = mods.mobx.module;
|
||||
const P = mods.frame.exports.Frame.prototype;
|
||||
const actions = mods.actions.exports.store;
|
||||
@@ -122,10 +118,7 @@
|
||||
S = window.__sfuiFrameControlsState = { schema: 1, placement: ok ? { ...saved.placement } : {}, nixSeen: ok ? { ...saved.nixSeen } : {}, log: [] };
|
||||
}
|
||||
const logBuf = S.log ??= [];
|
||||
const log = (msg, data) => {
|
||||
logBuf.push({ t: new Date().toISOString().slice(11, 23), msg, ...(data !== undefined ? { data } : {}) });
|
||||
if (logBuf.length > 200) logBuf.splice(0, logBuf.length - 200);
|
||||
};
|
||||
const log = find.logger(logBuf);
|
||||
if (restored) log('state restored', { from: restored, popup: S.placement });
|
||||
let unsaved = true; // last save not sent (no injector binding): retried by check()
|
||||
const save = () => {
|
||||
@@ -342,12 +335,7 @@
|
||||
border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
|
||||
.sfui-fc-pressing { position: relative; }
|
||||
`;
|
||||
const ensureStyle = () => {
|
||||
if (document.getElementById(STYLE_ID)) return;
|
||||
const s = document.createElement('style');
|
||||
s.id = STYLE_ID; s.textContent = CSS;
|
||||
document.head.appendChild(s);
|
||||
};
|
||||
const ensureStyle = () => find.ensureStyle(document, STYLE_ID, CSS);
|
||||
|
||||
const PANEL_RE = /^legacy-frame-controls-(additional-options-)?(\d+)$/;
|
||||
// The control under an event target: { frame, actionId, where, button, panel } or null.
|
||||
|
||||
Reference in new issue
Block a user