Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

Key check: the message names the missing key, not the generation in decimal beside it in hex

v0lumehi37289d8bdcba
diff --git a/frontend/Sources/NSPortBuilder/KeyCheck.swift b/frontend/Sources/NSPortBuilder/KeyCheck.swift
index 4cd9b786..a05ba145 100644
--- a/frontend/Sources/NSPortBuilder/KeyCheck.swift
+++ b/frontend/Sources/NSPortBuilder/KeyCheck.swift
@@ -232,7 +232,7 @@ enum KeyCheck {
case .wrongHeaderKey(let file): return String(format: t("keycheck.wrongHeaderKey"), file)
case .cannotCheck(let file): return String(format: t("keycheck.cannotCheck"), file)
case let .tooOld(part, generation, missing):
- var s = String(format: t("keycheck.tooOld"), t("keycheck.part." + part.rawValue), generation, missing)
+ var s = String(format: t("keycheck.tooOld"), t("keycheck.part." + part.rawValue), missing) // the key's name carries the generation, in hex
if generation - 1 < firmware.count { s += " " + String(format: t("keycheck.firmware"), firmware[generation - 1]) }
return s
}
diff --git a/frontend/Sources/NSPortBuilder/Localization.swift b/frontend/Sources/NSPortBuilder/Localization.swift
index aec5abf4..d67eaf58 100644
--- a/frontend/Sources/NSPortBuilder/Localization.swift
+++ b/frontend/Sources/NSPortBuilder/Localization.swift
@@ -148,7 +148,7 @@ enum L10n {
"keycheck.noHeaderKey": ("prod.keys 中缺少 header_key", "header_key is missing from prod.keys"),
"keycheck.wrongHeaderKey": ("prod.keys 中的 header_key 打不开 %@", "The header_key in prod.keys doesn’t open %@"),
"keycheck.cannotCheck": ("构建前无法检查这种格式:%@", "Can’t check this format before building: %@"),
- "keycheck.tooOld": ("这些密钥比%1$@所需的旧:需要密钥世代 %2$ld(缺少 %3$@)。", "These keys are older than %1$@ needs: key generation %2$ld (%3$@ is missing)."),
+ "keycheck.tooOld": ("这些密钥比%1$@所需的旧:缺少 %2$@。", "These keys are older than %1$@ needs: %2$@ is missing."),
"keycheck.firmware": ("请从系统版本 %@ 或更新的 Switch 重新导出 prod.keys。", "Dump prod.keys again from a Switch on firmware %@ or newer."),
"keycheck.part.base": ("游戏本体", "the base game"),
"keycheck.part.update": ("更新包", "the update"),
diff --git a/frontend/Tests/NSPortBuilderTests/KeyCheckTests.swift b/frontend/Tests/NSPortBuilderTests/KeyCheckTests.swift
index 43e29e08..058ef1d9 100644
--- a/frontend/Tests/NSPortBuilderTests/KeyCheckTests.swift
+++ b/frontend/Tests/NSPortBuilderTests/KeyCheckTests.swift
@@ -98,7 +98,7 @@ final class KeyCheckTests: XCTestCase {
let outcome = KeyCheck.run(.init(keys: keys, files: [base, update]))
XCTAssertEqual(outcome, .tooOld(part: .update, generation: 0x13, missing: "titlekek_12"), "the newest generation that is missing")
let text = KeyCheck.message(outcome) { L10n.string($0, .en) }
- XCTAssertTrue(text.contains("the update") && text.contains("key generation 19") && text.contains("titlekek_12") && text.contains("19.0.0"), text)
+ XCTAssertTrue(text.contains("the update") && !text.contains("generation 19") && text.contains("titlekek_12") && text.contains("19.0.0"), text)
XCTAssertFalse(text.contains(hex(headerKey)) || text.contains("5a5a"), "never a key value")
XCTAssertEqual(KeyCheck.run(.init(keys: keys, files: [base, ""])), .fits)