Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

Fix installation status and renamed Steam JavaScript bindings

Nils Schröder9663cfbaa02b
diff --git a/app/Sources/NotProtonApp/Model/PayloadState.swift b/app/Sources/NotProtonApp/Model/PayloadState.swift
index a83574e..ab2f8e5 100644
--- a/app/Sources/NotProtonApp/Model/PayloadState.swift
+++ b/app/Sources/NotProtonApp/Model/PayloadState.swift
@@ -14,9 +14,20 @@ struct PayloadState: Sendable {
var legacyCompatExpected: Int
var manifestProblem: String?
+ var isSteamComplete: Bool {
+ manifestProblem == nil && missingSteamFiles.isEmpty && signatureDatabase != nil
+ }
+
+ var missingSteamFiles: [String] {
+ var names = missing(origin: .built).map(\.path)
+ if !overlayShimPresent { names.append("overlay-shim.dylib") }
+ if !iconmakerPresent { names.append("iconmaker") }
+ if !appinfoPresent { names.append("appinfo") }
+ return names
+ }
+
var isComplete: Bool {
- manifestProblem == nil && missing.isEmpty && overlayShimPresent && iconmakerPresent
- && appinfoPresent && signatureDatabase != nil
+ isSteamComplete && missing.isEmpty
}
var isEmpty: Bool {
diff --git a/app/Sources/NotProtonApp/Model/SteamInstaller.swift b/app/Sources/NotProtonApp/Model/SteamInstaller.swift
index a02a65a..85d03c5 100644
--- a/app/Sources/NotProtonApp/Model/SteamInstaller.swift
+++ b/app/Sources/NotProtonApp/Model/SteamInstaller.swift
@@ -293,9 +293,9 @@ enum SteamInstaller {
static func assertBundleIsWritable(_ app: URL) throws {
let directory = app.appending(path: "Contents/MacOS")
- let probe = directory.appending(path: ".notproton-write-probe")
+ let probe = directory.appending(path: ".notproton-write-probe-\(UUID().uuidString)")
do {
- try Data("probe".utf8).write(to: probe)
+ try Data("probe".utf8).write(to: probe, options: .withoutOverwriting)
try FileManager.default.removeItem(at: probe)
} catch let error as NSError where error.code == NSFileWriteNoPermissionError {
throw WriteRefused(path: directory.path(percentEncoded: false))
diff --git a/app/Sources/NotProtonApp/Resources/Localization/Localizable.xcstrings b/app/Sources/NotProtonApp/Resources/Localization/Localizable.xcstrings
index 65cc179..767076f 100644
--- a/app/Sources/NotProtonApp/Resources/Localization/Localizable.xcstrings
+++ b/app/Sources/NotProtonApp/Resources/Localization/Localizable.xcstrings
@@ -1845,16 +1845,6 @@
}
}
},
- "Installed, but not for this account." : {
- "localizations" : {
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "已安装,但当前账户尚未配置。"
- }
- }
- }
- },
"Installing" : {
"localizations" : {
"zh-Hans" : {
@@ -2065,6 +2055,16 @@
}
}
},
+ "Missing: %@. Install to restore these files for your macOS user." : {
+ "localizations" : {
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "缺少:%@。请点击“安装”,为当前 macOS 用户恢复这些文件。"
+ }
+ }
+ }
+ },
"More" : {
"localizations" : {
"zh-Hans" : {
@@ -3321,42 +3321,42 @@
}
}
},
- "Steam is restored to its unmodified state and NotProton is removed, including the compatibility tool that lives inside the Steam folder. Windows games and Steam Play prefixes are not removed." : {
+ "Steam integration needs repair." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "此操作会将 Steam 恢复为未修改的状态,并移除 NotProton(包括 Steam 文件夹内的兼容工具)。不会删除 Windows 游戏及 Steam Play 游戏容器。"
+ "value" : "Steam 集成需要修复。"
}
}
}
},
- "Steam is running" : {
+ "Steam is restored to its unmodified state and NotProton is removed, including the compatibility tool that lives inside the Steam folder. Windows games and Steam Play prefixes are not removed." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Steam 正在运行"
+ "value" : "此操作会将 Steam 恢复为未修改的状态,并移除 NotProton(包括 Steam 文件夹内的兼容工具)。不会删除 Windows 游戏及 Steam Play 游戏容器。"
}
}
}
},
- "Steam is running, please close Steam." : {
+ "Steam is running" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Steam 正在运行,请先关闭 Steam。"
+ "value" : "Steam 正在运行"
}
}
}
},
- "Steam is set up for NotProton, but this account is missing its components. Install to add them." : {
+ "Steam is running, please close Steam." : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Steam 已配置 NotProton,但当前账户缺少所需组件。请点击“安装”添加组件。"
+ "value" : "Steam 正在运行,请先关闭 Steam。"
}
}
}
diff --git a/app/Sources/NotProtonApp/Views/StatusView.swift b/app/Sources/NotProtonApp/Views/StatusView.swift
index 05b739e..dca7509 100644
--- a/app/Sources/NotProtonApp/Views/StatusView.swift
+++ b/app/Sources/NotProtonApp/Views/StatusView.swift
@@ -468,7 +468,7 @@ struct StatusView: View {
action: installAction(prominent: true)
)
case .installed(let version):
- if payload.isComplete {
+ if payload.isSteamComplete {
StatusRow(
title: "NotProton",
value: String(localized: "Installed") + (version.map { " (\($0))" } ?? ""),
@@ -477,9 +477,9 @@ struct StatusView: View {
} else {
StatusRow(
title: "NotProton",
- value: String(localized: "Installed, but not for this account."),
+ value: String(localized: "Steam integration needs repair."),
tone: .warning,
- detail: String(localized: "Steam is set up for NotProton, but this account is missing its components. Install to add them."),
+ detail: steamRepairDetail(payload),
action: installAction(prominent: true)
)
}
@@ -697,6 +697,13 @@ struct StatusView: View {
}
}
+ private func steamRepairDetail(_ payload: PayloadState) -> String {
+ if let problem = payload.manifestProblem { return problem }
+ var names = payload.missingSteamFiles
+ if payload.signatureDatabase == nil { names.append(String(localized: "Signature database")) }
+ return String(localized: "Missing: \(names.joined(separator: ", ")). Install to restore these files for your macOS user.")
+ }
+
private func fetchAction() -> StatusAction {
StatusAction(
label: String(localized: "Fetch Valve Binaries"),
diff --git a/app/Tests/NotProtonAppTests/PayloadStateTests.swift b/app/Tests/NotProtonAppTests/PayloadStateTests.swift
index d985bf0..44d3c3b 100644
--- a/app/Tests/NotProtonAppTests/PayloadStateTests.swift
+++ b/app/Tests/NotProtonAppTests/PayloadStateTests.swift
@@ -148,6 +148,22 @@ struct PayloadStateTests {
#expect(!broken.isComplete)
}
+ @Test("Only what Install stages makes Steam need repair")
+ func steamCompletenessIgnoresRunnerFiles() {
+ let valve = PayloadEntry(origin: .valve, path: "steamclient64.dll")
+ let patched = PayloadEntry(origin: .patched, path: "wine/i386-windows/ntdll.dll")
+ let built = PayloadEntry(origin: .built, path: "x86_64-unix/lsteamclient.so")
+
+ #expect(state(missing: [valve, patched]).isSteamComplete)
+ #expect(!state(missing: [valve, patched]).isComplete)
+ #expect(!state(missing: [built]).isSteamComplete)
+ #expect(!state(overlay: false).isSteamComplete)
+ #expect(!state(signatures: nil).isSteamComplete)
+ #expect(!state(problem: "the manifest will not parse").isSteamComplete)
+ #expect(state(missing: [built, valve], overlay: false).missingSteamFiles
+ == ["x86_64-unix/lsteamclient.so", "overlay-shim.dylib"])
+ }
+
@Test("Missing entries are reported per origin")
func splitsMissingByOrigin() {
let built = PayloadEntry(origin: .built, path: "x86_64-unix/lsteamclient.so")
diff --git a/dylib/feats/webpatch.c b/dylib/feats/webpatch.c
index dfa31fc..d46bd18 100644
--- a/dylib/feats/webpatch.c
+++ b/dylib/feats/webpatch.c
@@ -13,7 +13,12 @@
#define NP_C6 "\006"
#define NP_C7 "\007"
#define NP_C8 "\010"
-#define NP_CAP_MAX 8
+// 9-12 sit past whitespace and the \021/\022 markers.
+#define NP_C9 "\023"
+#define NP_C10 "\024"
+#define NP_C11 "\025"
+#define NP_C12 "\026"
+#define NP_CAP_MAX 12
// Stands for the name set by np_webpatch_set_fallback_tool.
#define NP_FALLBACK_TOOL "\021"
@@ -39,7 +44,9 @@ static int is_ident_char(unsigned char c) {
}
static int cap_index(unsigned char c) {
- return (c >= 1 && c <= NP_CAP_MAX) ? c - 1 : -1;
+ if (c >= (unsigned char)NP_C1[0] && c <= (unsigned char)NP_C8[0]) return c - NP_C1[0];
+ if (c >= (unsigned char)NP_C9[0] && c <= (unsigned char)NP_C12[0]) return c - NP_C9[0] + 8;
+ return -1;
}
static int is_tool_name(const char *name) {
@@ -83,6 +90,9 @@ static size_t match_at(const char *src, size_t len, size_t pos,
const char *find, np_cap_t *caps) {
for (int i = 0; i < NP_CAP_MAX; i++) { caps[i].at = NULL; caps[i].len = 0; }
+ if (cap_index((unsigned char)find[0]) >= 0 && pos &&
+ (is_ident_char((unsigned char)src[pos - 1]) || src[pos - 1] == '.')) return 0;
+
size_t s = pos;
for (const char *f = find; *f; f++) {
const char *text = marker_text(*f);
@@ -99,6 +109,7 @@ static size_t match_at(const char *src, size_t len, size_t pos,
continue;
}
+ if (s >= len || (src[s] >= '0' && src[s] <= '9')) return 0;
size_t run = 0;
while (s + run < len && is_ident_char((unsigned char)src[s + run])) run++;
if (run == 0) return 0;
@@ -296,14 +307,17 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {
"\"允许游戏直接读取控制器\"),\"1\",\"\")},\"ctl\")" \
"]})})}"
+#define NP_CX_OPTIONS_CAPTURE(RT, BARREL) \
+ "((npReact,npUI)=>" NP_CX_OPTIONS_BODY("np", "npReact()", "npUI()") ")(()=>" RT ",()=>" BARREL ")"
+
#define NP_CX_OPTIONS_COMPONENT \
"MSCXLaunch=" NP_CX_LAUNCH ",MSCXPick=" NP_CX_PICK "," \
- "MSCXOpts=" NP_CX_OPTIONS_BODY("e", "i", "c") ","
+ "MSCXOpts=" NP_CX_OPTIONS_CAPTURE(NP_C4, NP_C5) ","
// Valve is testing a new compatibility page UI, this logic relates to supporting that
#define NP_CX_OPTIONS_STATEMENT \
"var MSCXLaunch=" NP_CX_LAUNCH ";" \
- "var MSCXOpts=" NP_CX_OPTIONS_BODY("np", NP_C3, NP_C4) ";"
+ "var MSCXOpts=" NP_CX_OPTIONS_CAPTURE(NP_C3, NP_C4) ";"
// 1.0.x saved CrossOver settings without %command%, this migrates them.
#define NP_LAUNCH_MIGRATION_RULE \
@@ -336,39 +350,44 @@ static int out_expand(np_out_t *o, const char *replace, const np_cap_t *caps) {
static const np_gate_t g_gates_forcetool[] = {
// SteamPlay settings section
- { "function ue(e){return(0,T.CI)()?",
- "function ue(e){return true?", 1 },
+ { "function " NP_C1 "(" NP_C2 "){return(0," NP_C3 ".CI)()?",
+ "function " NP_C1 "(" NP_C2 "){return true?", 1 },
// AppProperties Compatibility tab (app and non-Steam-shortcut variants)
- { "(0,f.CI)()&&o.push({title:(0,A.we)(\"#AppProperties_CompatibilityPage\")",
- "true&&o.push({title:(0,A.we)(\"#AppProperties_CompatibilityPage\")", 2 },
+ { "(0," NP_C1 ".CI)()&&" NP_C2 ".push({title:(0," NP_C3 ".we)(\"#AppProperties_CompatibilityPage\")",
+ "true&&" NP_C2 ".push({title:(0," NP_C3 ".we)(\"#AppProperties_CompatibilityPage\")", 2 },
// Settings page Compatibility entry, keeping the SteamOS exclusion (!rf())
- { "Compatibility:{visible:t&&(0,f.CI)()&&!(0,f.rf)()",
- "Compatibility:{visible:t&&true&&!(0,f.rf)()", 1 },
- { "return(0,i.jsxs)(i.Fragment,{children:[0!=a.length&&(0,i.jsx)(_r,{label:(0,A.we)"
- "(\"#AppProperties_CompatilibityForceTool\"),checked:g,onChange:C,disabled:!r||0===a.length}),"
- "g&&a.length>0&&(0,i.jsx)(c.m,{strClassName:K().TopGap,rgOptions:d,"
- "selectedOption:t.strCompatToolName,onChange:e=>SteamClient.Apps.SpecifyCompatTool"
- "(t.unAppID,e.data)})]})",
- "return(0,i.jsxs)(i.Fragment,{children:[0!=a.length&&(0,i.jsx)(_r,{label:(0,A.we)"
- "(\"#AppProperties_CompatilibityForceTool\"),checked:g,onChange:C,disabled:!r||0===a.length}),"
- "g&&a.length>0&&(0,i.jsx)(c.m,{strClassName:K().TopGap+\" MSCXNoBottomGap\",rgOptions:d,"
- "selectedOption:t.strCompatToolName,onChange:e=>{SteamClient.Apps.SpecifyCompatTool"
- "(t.unAppID,e.data);MSCXPick(t,e.data)}})]})", 1 },
+ { "Compatibility:{visible:" NP_C1 "&&(0," NP_C2 ".CI)()&&!(0," NP_C2 ".rf)()",
+ "Compatibility:{visible:" NP_C1 "&&true&&!(0," NP_C2 ".rf)()", 1 },
+ { "return(0," NP_C1 ".jsxs)(" NP_C1 ".Fragment,{children:[0!=" NP_C2 ".length&&(0," NP_C1 ".jsx)(" NP_C3 ",{label:(0," NP_C4 ".we)"
+ "(\"#AppProperties_CompatilibityForceTool\"),checked:" NP_C5 ",onChange:" NP_C6 ",disabled:!" NP_C7 "||0===" NP_C2 ".length}),"
+ NP_C5 "&&" NP_C2 ".length>0&&(0," NP_C1 ".jsx)(" NP_C8 ".m,{strClassName:" NP_C9 "().TopGap,rgOptions:" NP_C10 ","
+ "selectedOption:" NP_C11 ".strCompatToolName,onChange:" NP_C12 "=>SteamClient.Apps.SpecifyCompatTool"
+ "(" NP_C11 ".unAppID," NP_C12 ".data)})]})",
+ "return(0," NP_C1 ".jsxs)(" NP_C1 ".Fragment,{children:[0!=" NP_C2 ".length&&(0," NP_C1 ".jsx)(" NP_C3 ",{label:(0," NP_C4 ".we)"
+ "(\"#AppProperties_CompatilibityForceTool\"),checked:" NP_C5 ",onChange:" NP_C6 ",disabled:!" NP_C7 "||0===" NP_C2 ".length}),"
+ NP_C5 "&&" NP_C2 ".length>0&&(0," NP_C1 ".jsx)(" NP_C8 ".m,{strClassName:" NP_C9 "().TopGap+\" MSCXNoBottomGap\",rgOptions:" NP_C10 ","
+ "selectedOption:" NP_C11 ".strCompatToolName,onChange:" NP_C12 "=>{SteamClient.Apps.SpecifyCompatTool"
+ "(" NP_C11 ".unAppID," NP_C12 ".data);MSCXPick(" NP_C11 "," NP_C12 ".data)}})]})", 1 },
// Compatibility page container
- { "Rt=(0,a.PA)(e=>(0,i.jsxs)(c.nB,{children:[(0,i.jsx)(\"div\",{className:K().HiddenIfNotLast,"
- "children:(0,A.we)(\"#AppProperties_CompatibilityNoOptions\")}),(0,i.jsx)(It,{...e}),"
- "(0,i.jsx)(xt,{...e})]}));",
+ { NP_C1 "=(0," NP_C2 ".PA)(" NP_C3 "=>(0," NP_C4 ".jsxs)(" NP_C5
+ ".nB,{children:[(0," NP_C4 ".jsx)(\"div\",{className:" NP_C6
+ "().HiddenIfNotLast,children:(0," NP_C7 ".we)(\"#AppProperties_CompatibilityNoOptions\")}),"
+ "(0," NP_C4 ".jsx)(" NP_C8 ",{..." NP_C3 "}),(0," NP_C4 ".jsx)(" NP_C9
+ ",{..." NP_C3 "})]}));",
NP_CX_OPTIONS_COMPONENT
- "Rt=(0,a.PA)(e=>(0,i.jsxs)(c.nB,{children:[(0,i.jsx)(\"div\",{className:K().HiddenIfNotLast,"
- "children:(0,A.we)(\"#AppProperties_CompatibilityNoOptions\")}),(0,i.jsx)(It,{...e}),"
- "(0,i.jsx)(xt,{...e}),(0,i.jsx)(MSCXOpts,{...e})]}));", 1 },
+ NP_C1 "=(0," NP_C2 ".PA)(" NP_C3 "=>(0," NP_C4 ".jsxs)(" NP_C5
+ ".nB,{children:[(0," NP_C4 ".jsx)(\"div\",{className:" NP_C6
+ "().HiddenIfNotLast,children:(0," NP_C7 ".we)(\"#AppProperties_CompatibilityNoOptions\")}),"
+ "(0," NP_C4 ".jsx)(" NP_C8 ",{..." NP_C3 "}),(0," NP_C4 ".jsx)(" NP_C9
+ ",{..." NP_C3 "}),(0," NP_C4 ".jsx)(MSCXOpts,{..." NP_C3 "})]}));", 1 },
{ "get is_invalid_os_type(){return this.most_available_per_client_data.is_invalid_os_type}",
"get is_invalid_os_type(){return false}", 1 },
// Reminder banner for 32 bit Mac games
- { "s.is_invalid_os_type&&(0,n.jsx)(U,{})",
- "!s.local_per_client_data?.installed&&"
- "s.most_available_per_client_data?.is_invalid_os_type&&(0,n.jsx)(U,{})", 1 },
- { "(0,h.we)(\"#GameList_Entry_Invalid_OSType2\")",
+ { NP_C1 ".is_invalid_os_type&&(0," NP_C2 ".jsx)(" NP_C3 ",{})",
+ "!" NP_C1 ".local_per_client_data?.installed&&"
+ NP_C1 ".most_available_per_client_data?.is_invalid_os_type&&"
+ "(0," NP_C2 ".jsx)(" NP_C3 ",{})", 1 },
+ { "(0," NP_C1 ".we)(\"#GameList_Entry_Invalid_OSType2\")",
NP_COMPAT_HINT, 1 },
};
diff --git a/dylib/tests/gatecheck.c b/dylib/tests/gatecheck.c
index d5126bd..fafe4ef 100644
--- a/dylib/tests/gatecheck.c
+++ b/dylib/tests/gatecheck.c
@@ -87,6 +87,38 @@ static void check_fex_tools(void) {
np_webpatch_set_fex_tools(NULL, 0);
}
+static void check_captures(void) {
+ int seen = 0;
+ for (int c = 1; c < 256; c++) {
+ int ci = cap_index((unsigned char)c);
+ if (ci < 0) continue;
+ seen |= 1 << ci;
+ if (ci >= NP_CAP_MAX || c == ' ' || (c >= '\t' && c <= '\r') || marker_text((char)c))
+ wrong("byte %d reads as capture %d", c, ci + 1);
+ }
+ if (seen != (1 << NP_CAP_MAX) - 1) wrong("captures bound by byte: %#x", seen);
+
+ static const struct { const char *src, *find; size_t want; } cases[] = {
+ { "(0,T.CI)()", "(0," NP_C1 ".CI)()", 10 },
+ { "(0,9T.CI)()", "(0," NP_C1 ".CI)()", 0 },
+ { "(0,.CI)()", "(0," NP_C1 ".CI)()", 0 },
+ { "ab.CI", NP_C1 ".CI", 5 },
+ { "a.b(a)", NP_C1 ".b(" NP_C1 ")", 6 },
+ { "a.b(c)", NP_C1 ".b(" NP_C1 ")", 0 },
+ };
+ np_cap_t caps[NP_CAP_MAX];
+ for (size_t i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
+ const char *s = cases[i].src;
+ size_t got = match_at(s, strlen(s), 0, cases[i].find, caps);
+ if (got != cases[i].want) wrong("capture case %zu matched %zu bytes, wanted %zu",
+ i, got, cases[i].want);
+ }
+ if (match_at("xab.CI", 6, 1, NP_C1 ".CI", caps))
+ wrong("a capture matched from the middle of a name");
+ if (match_at("x.ab.CI", 7, 2, NP_C1 ".CI", caps) || match_at("x?.ab.CI", 8, 3, NP_C1 ".CI", caps))
+ wrong("a capture matched a member");
+}
+
// Invariants the transform relies on but cannot check at run time. A replacement still
// holding its own anchor would be found again next pass, and an anchor inside another
// anchor would make the result depend on table order rather than on the chunk.
@@ -278,7 +310,10 @@ int main(int argc, char **argv) {
if (argc == 4 && strcmp(argv[1], "--extract") == 0)
return extract(argv[2], argv[3]);
- if (argc < 2) { selfcheck(); check_fallback(); check_fex_tools(); return g_wrong; }
+ if (argc < 2) {
+ selfcheck(); check_captures(); check_fallback(); check_fex_tools();
+ return g_wrong;
+ }
np_webpatch_set_fallback_tool("notproton-fex");
np_webpatch_set_fex_tools((const char *[]){ "notproton-fex", "notproton-fex-41069" }, 2);
diff --git a/dylib/tests/panel-behavior/behavior.js b/dylib/tests/panel-behavior/behavior.js
index c71d229..a82053b 100644
--- a/dylib/tests/panel-behavior/behavior.js
+++ b/dylib/tests/panel-behavior/behavior.js
@@ -96,6 +96,11 @@ for (const form of Object.keys(FORMS)) {
t.ok(css.length === 1 && css[0].props.children.includes('.MSCXPanel .MSCXRow{'),
'the panel carries one stylesheet defining the row rule');
+ const { render: S } = panel(emit, form, undefined, { names: ['o', 't'] });
+ const shadowed = walk(S({ details: details('CX_GRAPHICS_BACKEND=dxmt %command%') }));
+ t.ok(JSON.stringify(shadowed) === JSON.stringify(nodes('CX_GRAPHICS_BACKEND=dxmt')),
+ 'a page naming its runtime and barrel o and t renders the same panel');
+
failed += t.failed;
}
console.log(failed ? `\n${failed} failure(s)` : '\nboth shapes pass');
diff --git a/dylib/tests/panel-behavior/harness.js b/dylib/tests/panel-behavior/harness.js
index a03c668..eab2afc 100644
--- a/dylib/tests/panel-behavior/harness.js
+++ b/dylib/tests/panel-behavior/harness.js
@@ -8,10 +8,9 @@
const fs = require('fs');
const { execFileSync } = require('child_process');
-const CAPS = { '\u0003': 'R0', '\u0004': 'B0' };
-const expand = s => s.replace(/[\u0001-\u0008]/g, c => {
- if (!(c in CAPS)) throw new Error('payload uses unbound capture ' + c.charCodeAt(0));
- return CAPS[c];
+const expand = (s, caps) => s.replace(/[\u0001-\u0008\u0013-\u0016]/g, c => {
+ if (!(c in caps)) throw new Error('payload uses unbound capture ' + c.charCodeAt(0));
+ return caps[c];
});
const mk = (type, props) => ({ type, props });
@@ -21,23 +20,22 @@ const barrel = { XY: 'Section', m: 'Dropdown', Yh: 'Toggle' };
// The two shapes take the payload in different forms and bind different names, which
// is the whole of the difference between them.
const FORMS = {
- component: { arg: 'component', react: 'i', barrel: 'c' },
- statement: { arg: 'statement', react: 'R0', barrel: 'B0' },
+ component: { react: '\u0004', barrel: '\u0005' },
+ statement: { react: '\u0003', barrel: '\u0004' },
};
// `fallback` and `fexTools` stand in for what the hook sets before the transform.
function panel(emit, form, globals = { document: { documentElement: { lang: 'en' } } },
- { fallback = 'notproton', fexTools = [] } = {}) {
+ { fallback = 'notproton', fexTools = [], names = ['R0', 'B0'] } = {}) {
const raw = execFileSync(emit, [form, fallback, ...fexTools], { encoding: 'utf8' }).trim();
- const src = form === 'component'
- ? 'var ' + raw.replace(/,$/, '')
- : expand(raw).replace(/;$/, '');
const f = FORMS[form];
+ const body = expand(raw, { [f.react]: names[0], [f.barrel]: names[1] });
+ const src = form === 'component' ? 'var ' + body.replace(/,$/, '') : body.replace(/;$/, '');
const written = [];
const SteamClient = {
Apps: { SetAppLaunchOptions: (appid, opts) => written.push({ appid, opts }) },
};
- const build = new Function(f.react, f.barrel, 'SteamClient', 'globalThis',
+ const build = new Function(names[0], names[1], 'SteamClient', 'globalThis',
src + '\nreturn { MSCXOpts, MSCXPick: typeof MSCXPick === "function" ? MSCXPick : null };');
const { MSCXOpts, MSCXPick } = build(react, barrel, SteamClient, globals);
return { render: MSCXOpts, pick: MSCXPick, written };
diff --git a/dylib/tests/webpatch-fixtures/gates.forcetool-renamed.js b/dylib/tests/webpatch-fixtures/gates.forcetool-renamed.js
new file mode 100644
index 0000000..c1782c6
--- /dev/null
+++ b/dylib/tests/webpatch-fixtures/gates.forcetool-renamed.js
@@ -0,0 +1,11 @@
+Developer_HDRCompatTesting"),description:(0,i.we)("#Settings_Developer_HDRCompatTesting_Desc")}),(0,mo.jsx)(U.M3,{}),(0,mo.jsx)(Tt.Y6,{showWhenUnavailable:!0})]})}function C(k){return(0,d.CI)()?(0,mo.jsxs)(xt.XY,{label:(0,i.we)("#Settings_SteamPlay_SteamPlay"),children:[(0,mo.jsx)("div",{children:(0,i.we)("#Settings_SteamPlay_IsWildcardEnabled")}),(0,mo.js
+title:(0,L.we)("#AppProperties_ShortcutPage"),route:Ot.BV.AppProperties.Shortcut(),link:Ot.BV.AppProperties.Shortcut(A),content:(0,mo.jsx)(ls,{appId:x.unAppID})}),(0,ks.CI)()&&ue.push({title:(0,L.we)("#AppProperties_CompatibilityPage"),route:Ot.BV.AppProperties.Compatibility(),link:Ot.BV.AppProperties.Compatibility(A),content:(0,mo.jsx)(a,{details:x})}),ue.push({title:(0,L.we)("#AppProperties_Co
+(ue.push({title:(0,L.we)("#AppProperties_GeneralPage"),route:Ot.BV.AppProperties.General(),link:Ot.BV.AppProperties.General(A),content:(0,mo.jsx)(N,{details:x})}),(0,ks.CI)()&&ue.push({title:(0,L.we)("#AppProperties_CompatibilityPage"),route:Ot.BV.AppProperties.Compatibility(),link:Ot.BV.AppProperties.Compatibility(A),content:(0,mo.jsx)(a,{details:x})}),ue.push({title:(0,L.we)("#AppProperties_Up
+:(0,mo.jsx)(s,{})},InGame:{visible:A,title:(0,L.we)("#Settings_Page_InGame"),icon:(0,mo.jsx)(st.InGame,{}),route:xt.BV.Settings.InGame(),content:(0,mo.jsx)(p,{})},Compatibility:{visible:A&&(0,ks.CI)()&&!(0,ks.rf)(),title:(0,L.we)("#Settings_Page_Compatibility"),icon:(0,mo.jsx)(st.SteamLogo,{}),route:xt.BV.Settings.Compatibility(),content:(0,mo.jsx)(Rt.Y,{})},Interface:{visibl
+k(!1),l=ue||st,Nt=u.useCallback(k=>{vt(k),k?SteamClient.Apps.SpecifyCompatTool(A.unAppID,ue?"":r):SteamClient.Apps.SpecifyCompatTool(A.unAppID,"")},[A.unAppID,r,ue]);return(0,mo.jsxs)(mo.Fragment,{children:[0!=h.length&&(0,mo.jsx)(gr,{label:(0,L.we)("#AppProperties_CompatilibityForceTool"),checked:l,onChange:Nt,disabled:!x||0===h.length}),l&&h.length>0&&(0,mo.jsx)(i.m,{strClassName:T().TopGap,rgOptions:ie,selectedOption:A.strCompatToolName,onChange:k=>SteamClient.Apps.SpecifyCompatTool(A.unAppID,k.data)})]})}),It=(0,h.PA)(k=>{const{details:A}=k,x=(0,z.GY)();if(!ks.TS.ON_FRAME||!x)return null;const h={ThunksDB_GL:0,ThunksDB_Vulkan:0,Multiblock:1},ue=(0,xt.q3)(()=>At.rV
+ibity_OverrideArmTranslationOptions"),checked:l,onChange:m,disabled:!ue},"fexgroup"),l&&(0,mo.jsx)("div",{className:T().CompatExperimentOptions,children:g})]})}),a=(0,h.PA)(k=>(0,mo.jsxs)(i.nB,{children:[(0,mo.jsx)("div",{className:T().HiddenIfNotLast,children:(0,L.we)("#AppProperties_CompatibilityNoOptions")}),(0,mo.jsx)(St,{...k}),(0,mo.jsx)(It,{...k})]}));function e(k){const{details:A}=k,[x]=(0,At.e_)("b24HourClock");return(0,mo.jsxs)(i.nB,{children:[(0,mo.jsx)(_,{details:A}),(0,mo.jsx)(_r,{details:A}),(0,mo.jsxs)("
+r_client_data.active_beta}get is_available_on_current_platform(){return this.local_per_client_data&&this.local_per_client_data.is_available_on_current_platform}get is_invalid_os_type(){return this.most_available_per_client_data.is_invalid_os_type}get selected_per_client_data(){let k=this.per_client_data.find(k=>k.clientid==this.selected_clientid);return k||(k=this.most_available_per_client_data),k}get t
+n().HidePlayBar,bInPage:!0,details:h,overview:xt,stickyheader:vt,onGameInfoToggle:ue,onSeek:A.SeekToSection,bShowInfoExpanded:m,bShowingLaunchDetails:g},xt.appid),xt.is_invalid_os_type&&(0,u.jsx)(f,{}),x.has("info")&&(0,u.jsx)(Ia.b,{concise:mo,overview:xt,details:h,expand:m,suppressTransition:Nt}),(0,u.jsx)(o.Qd,{overview:xt,details:h,workshopVisible:ks,marketPrese
+,{})}),(0,m.we)("#GameList_Entry_Invalid_OSType")]}),(0,u.jsx)("div",{className:K().WarningText,children:(0,u.jsxs)("div",{className:K().WarningText2,children:[(0,m.we)("#GameList_Entry_Invalid_OSType2"),(0,u.jsx)("h",{href:"https://help.steampowered.com/faqs/view/5E0D-522A-4E62-B6EF",className:K().WarningText3,children:(0,m.we)("#GameList_Entry_Invalid_OSType3
+,mo.jsx)(c,{details:A,rgLaunchOptionsForApp:x}),(0,mo.jsx)(F,{details:A,bAndroidArm64Native:u,bLinuxArm64Native:xt})]})}const St=(0,h.PA)(k=>{const{details:A}=k,x=(0,xt.q3)(()=>At.rV.settings.bCompatEnabled),h=function(k,A){const[x,mo]=u.useState([]);return u.useEffect(()=>{SteamClient.Apps.GetAvailableCompatTools(k).then(mo)},[k,A]),x}(A.unAppID,x),ue=x&&!!A.strCompatToolName&&A.nCompatToolPriority==m.JN,r=h.length?h[0].strToolName:"",ie=h.map(k=>({data:k.strToolName,label:k.strDisplayName})),[st,vt]=u.useState(!1),l=ue||st,Nt=u.useCallback(k=>{vt(k),k?SteamClient.Apps.SpecifyCompatTool(A.unAppID,ue
+estartLater"),fnOnOK:()=>{},ownerWindow:k.ownerWindow})},[k])]}(),L=x?.map(k=>({label:k.strDisplayName,data:k.strToolName}))??[],l=u.useCallback(k=>{xt(k)},[xt]);return A?(0,mo.jsx)(st.B,{feature:vt.OK,label:(0,r.we)("#Settings_SteamPlay_DefaultTool"),rgOptions:L,disabled:0==L.length,selectedOption:A,onChange:k=>l(k.data),strDropDownButtonClassName:h().EnableSteamPlayForOthersDropdownButton,bMatchWidth:!1,bottomSeparator:k.bottomSeparator}):null}function m(k