Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
Make removing a CrossOver build fail safely
NotProtonNot5af2f77efd4f
diff --git a/app/Sources/NotProtonApp/Model/RunnerInstaller.swift b/app/Sources/NotProtonApp/Model/RunnerInstaller.swiftindex 074aa1b..341b32b 100644--- a/app/Sources/NotProtonApp/Model/RunnerInstaller.swift+++ b/app/Sources/NotProtonApp/Model/RunnerInstaller.swift@@ -67,10 +67,20 @@ enum RunnerInstaller {)}- try WriteRefused.catching(path) { try FileManager.default.removeItem(at: target) }- let changed = try CompatToolList.sync(- runners: runners, bridge: bridge, file: toolList, compatTools: compatTools- )+ let fm = FileManager.default+ let trash = target.deletingLastPathComponent().appending(path: ".\(target.lastPathComponent).removing")+ removeLeftoverRemovals(runners: runners)+ try WriteRefused.catching(path) { try fm.moveItem(at: target, to: trash) }+ let changed: Bool+ do {+ changed = try CompatToolList.sync(+ runners: runners, bridge: bridge, file: toolList, compatTools: compatTools+ )+ } catch {+ try? fm.moveItem(at: trash, to: target)+ throw error+ }+ try WriteRefused.catching(trash) { try fm.removeItem(at: trash) }let failures = removeStalePrefixTemplates(runners: runners, libraries: libraries)if !failures.isEmpty {throw StepFailure(step: removeStep, detail: failures.map(\.detail).joined(separator: "\n"))@@ -78,6 +88,15 @@ enum RunnerInstaller {return changed}+ static func removeLeftoverRemovals(runners: URL) {+ let fm = FileManager.default+ let entries = (try? fm.contentsOfDirectory(at: runners, includingPropertiesForKeys: nil)) ?? []+ for entry in entries where entry.lastPathComponent.hasPrefix(".crossover-")+ && entry.lastPathComponent.hasSuffix(".removing") {+ try? fm.removeItem(at: entry)+ }+ }+// Also catches templates left on a drive that was not present (unplugged or unmounted)// at the time the deployed copy of CrossOver was removed.static func removeStalePrefixTemplates(diff --git a/app/Sources/NotProtonApp/Model/RunnerSetup.swift b/app/Sources/NotProtonApp/Model/RunnerSetup.swiftindex 19244e1..a1eda68 100644--- a/app/Sources/NotProtonApp/Model/RunnerSetup.swift+++ b/app/Sources/NotProtonApp/Model/RunnerSetup.swift@@ -49,6 +49,7 @@ enum RunnerSetup {bridge: URL = SupportPaths.bridge,toolList: URL = SupportPaths.toolList,compatTools: URL = SupportPaths.Steam.compatTools,+ runScript: () throws -> URL = { try InstallPayload.locate().run },license: (URL) -> CrossOverLicense.Status = { CrossOverLicense.check(crossOverRoot: $0) },verify: (RunnerBuild, URL) throws -> Void = RunnerInstaller.verifyClone,stage: (RunnerBuild, URL, URL) throws -> [WineArch] = {@@ -81,6 +82,12 @@ enum RunnerSetup {outcome.toolsChanged = try CompatToolList.sync(runners: runners, bridge: bridge, file: toolList, compatTools: compatTools)+ for tool in CompatToolList.installed(runners: runners, file: toolList) {+ let run = compatTools.appending(path: "\(tool.name)/run")+ if FileManager.default.fileExists(atPath: run.path(percentEncoded: false)) { continue }+ try SteamInstaller.installIfChanged(DeploymentContent.File(+ source: try runScript(), destination: run, name: "\(tool.name)/run", executable: true))+ }report(.finished)return outcomediff --git a/app/Sources/NotProtonApp/Model/RunnerStore.swift b/app/Sources/NotProtonApp/Model/RunnerStore.swiftindex 48a2ef4..7da95d6 100644--- a/app/Sources/NotProtonApp/Model/RunnerStore.swift+++ b/app/Sources/NotProtonApp/Model/RunnerStore.swift@@ -139,15 +139,16 @@ enum CompatToolList {compatTools: URL = SupportPaths.Steam.compatTools) throws -> Bool {let (builds, listed, tools) = resolved(runners: runners, file: file)- prune(keeping: Set(builds.map(\.id)), runners: runners, bridge: bridge, compatTools: compatTools)-let text = contents(tools)- if listed == text || (listed == nil && text.isEmpty) { return false }- try FileManager.default.createDirectory(- at: file.deletingLastPathComponent(), withIntermediateDirectories: true- )- try atomicReplace(file, with: Data(text.utf8), step: "Update compatibility tools")- return true+ let changed = !(listed == text || (listed == nil && text.isEmpty))+ if changed {+ try FileManager.default.createDirectory(+ at: file.deletingLastPathComponent(), withIntermediateDirectories: true+ )+ try atomicReplace(file, with: Data(text.utf8), step: "Update compatibility tools")+ }+ prune(keeping: Set(builds.map(\.id)), runners: runners, bridge: bridge, compatTools: compatTools)+ return changed}private static func prune(diff --git a/app/Sources/NotProtonApp/Model/SteamInstaller.swift b/app/Sources/NotProtonApp/Model/SteamInstaller.swiftindex c378516..f662683 100644--- a/app/Sources/NotProtonApp/Model/SteamInstaller.swift+++ b/app/Sources/NotProtonApp/Model/SteamInstaller.swift@@ -35,6 +35,7 @@ enum InstallPhase: Sendable {struct InstallOutcome: Sendable {let stoppedClient: Boollet version: String+ let build: DeploymentContent.Buildlet signatureDatabases: Intlet backedUpPlist: Boollet bridgeStaged: Int@@ -63,7 +64,6 @@ enum SteamInstaller {deployedVersion: URL = SupportPaths.deployedVersion,backups: URL = SupportPaths.backups,compatTools: URL = SupportPaths.Steam.compatTools,- recordBuild: Bool = true,holdingInstallationLock: Bool = false,runnerIsRunning: @Sendable (URL) -> Bool = { RunnerInstaller.isRunning(from: $0) },verifyRunner: (RunnerBuild, URL) throws -> Void = RunnerInstaller.verifyClone,@@ -146,11 +146,7 @@ enum SteamInstaller {report(.installingSignatures)report(.installingOverlayShim)for file in files where file.destination != dylib {- if try file.matches() { continue }- try install(file.source, at: file.destination)- if file.executable {- try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: file.destination.path(percentEncoded: false))- }+ try installIfChanged(file)}var backedUp = false@@ -189,21 +185,40 @@ enum SteamInstaller {guard remaining.isEmpty else {throw StepFailure(step: step, detail: "These files did not update: \(remaining.joined(separator: ", ")).")}- if recordBuild {- try write(version, to: deployedVersion)- try atomicReplace(record, with: JSONEncoder().encode(build), step: step)- }report(.finished)return InstallOutcome(stoppedClient: stopped,version: version,+ build: build,signatureDatabases: payload.signatures.count,backedUpPlist: backedUp,bridgeStaged: bridgeResult.staged.count)}+ static func finish(+ _ outcome: InstallOutcome,+ deployedVersion: URL = SupportPaths.deployedVersion,+ isCurrent: (String) -> Bool = { DeploymentContent.current(version: $0) == .current }+ ) throws {+ guard isCurrent(outcome.version) else {+ throw StepFailure(step: step,+ detail: "Installed content could not be verified. Refresh the Status view for the files that still need attention.")+ }+ try write(outcome.version, to: deployedVersion)+ try atomicReplace(DeploymentContent.record(beside: deployedVersion),+ with: JSONEncoder().encode(outcome.build), step: step)+ }++ static func installIfChanged(_ file: DeploymentContent.File) throws {+ if try file.matches() { return }+ try install(file.source, at: file.destination)+ if file.executable {+ try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: file.destination.path(percentEncoded: false))+ }+ }+static func assertBundleIsPresent(_ app: URL) throws {guard FileManager.default.fileExists(atPath: app.path(percentEncoded: false)) else {diff --git a/app/Sources/NotProtonApp/SystemStatus.swift b/app/Sources/NotProtonApp/SystemStatus.swiftindex c91a4d2..779f607 100644--- a/app/Sources/NotProtonApp/SystemStatus.swift+++ b/app/Sources/NotProtonApp/SystemStatus.swift@@ -226,7 +226,7 @@ final class SystemStatus {private(set) var pendingRemoval: String?func requestBuildRemoval(_ build: String) {- guard isIdle else { return }+ guard canInstall else { return }pendingRemoval = buildpendingConfirmation = .removeBuild}@@ -241,6 +241,7 @@ final class SystemStatus {await perform(from: RunnerInstaller.removeStep) { _ inlet lock = try DeploymentContent.acquireInstallationLock(for: SupportPaths.Steam.app)defer { close(lock) }+ try await requireUnblockedContent()let changed = try await Task.detached(priority: .userInitiated) {try RunnerInstaller.removeClone(forBuild: build)}.value@@ -363,6 +364,18 @@ final class SystemStatus {"The compatibility tool was not set up because CrossOver is not activated."private func requireInstallableContent() async throws {+ try await requireUnblockedContent()+ let running = await Task.detached(priority: .utility) {+ RunnerStore.clonedBuilds().contains {+ RunnerInstaller.isRunning(from: SupportPaths.runnerRoot(forBuild: $0))+ }+ }.value+ guard !running else {+ throw StepFailure(step: SteamInstaller.step, detail: "A game or Wine tool is running. Quit it before updating NotProton.")+ }+ }++ private func requireUnblockedContent() async throws {let version = AppVersion.bundledlet content = await Task.detached(priority: .utility) {DeploymentContent.current(version: version)@@ -372,14 +385,6 @@ final class SystemStatus {throw StepFailure(step: SteamInstaller.step,detail: "Installation is blocked. Refresh Status and use the NotProton app that installed this build.")}- let running = await Task.detached(priority: .utility) {- RunnerStore.clonedBuilds().contains {- RunnerInstaller.isRunning(from: SupportPaths.runnerRoot(forBuild: $0))- }- }.value- guard !running else {- throw StepFailure(step: SteamInstaller.step, detail: "A game or Wine tool is running. Quit it before updating NotProton.")- }}func installIntoSteam() async {@@ -387,8 +392,7 @@ final class SystemStatus {let lock = try DeploymentContent.acquireInstallationLock(for: SupportPaths.Steam.app)defer { close(lock) }let result = try await Task.detached(priority: .userInitiated) {- try SteamInstaller.run(recordBuild: false, holdingInstallationLock: true,- report: { progress($0.label) })+ try SteamInstaller.run(holdingInstallationLock: true, report: { progress($0.label) })}.valuevar parts = ["NotProton successfully installed."]@@ -423,25 +427,7 @@ final class SystemStatus {}try await Task.detached(priority: .userInitiated) {- let payload = try InstallPayload.locate()- for tool in CompatToolList.installed() {- let destination = SupportPaths.Steam.compatTools.appending(path: "\(tool.name)/run")- let file = DeploymentContent.File(source: payload.run, destination: destination, name: tool.name, executable: true)- if try !file.matches() {- try SteamInstaller.install(payload.run, at: destination)- try FileManager.default.setAttributes([.posixPermissions: 0o755], ofItemAtPath: destination.path(percentEncoded: false))- }- }- let verified = DeploymentContent.current(version: result.version)- guard verified == .current else {- throw StepFailure(step: SteamInstaller.step,- detail: "Installed content could not be verified. Refresh the Status view for the files that still need attention.")- }- let build = DeploymentContent.Build(version: result.version, builtAt: payload.builtAt,- dylibHashes: try MachOBuild.hashesIgnoringSignature(of: payload.dylib))- try SteamInstaller.write(result.version, to: SupportPaths.deployedVersion)- try atomicReplace(DeploymentContent.record(beside: SupportPaths.deployedVersion),- with: JSONEncoder().encode(build), step: SteamInstaller.step)+ try SteamInstaller.finish(result)}.valuereturn parts.joined(separator: " ")@@ -509,6 +495,10 @@ final class SystemStatus {) async {let known = runnerSizeslet measured = await Task.detached(priority: .utility) {+ if cleanTemplates, let lock = try? DeploymentContent.acquireInstallationLock(for: SupportPaths.Steam.app) {+ RunnerInstaller.removeLeftoverRemovals(runners: runners)+ close(lock)+ }let failures = cleanTemplates? RunnerInstaller.removeStalePrefixTemplates(runners: runners, libraries: libraries, reportBusy: false) : []var sizes: [String: Int64] = [:]diff --git a/app/Sources/NotProtonApp/Views/StatusView.swift b/app/Sources/NotProtonApp/Views/StatusView.swiftindex 8d7ba68..364df09 100644--- a/app/Sources/NotProtonApp/Views/StatusView.swift+++ b/app/Sources/NotProtonApp/Views/StatusView.swift@@ -672,7 +672,7 @@ struct StatusView: View {label: label,role: .destructive,help: "Delete NotProton's copy of this build.",- isEnabled: status.isIdle+ isEnabled: status.canInstall) {status.requestBuildRemoval(build)}diff --git a/app/Tests/NotProtonAppTests/DeploymentContentTests.swift b/app/Tests/NotProtonAppTests/DeploymentContentTests.swiftindex 41df001..427e9ea 100644--- a/app/Tests/NotProtonAppTests/DeploymentContentTests.swift+++ b/app/Tests/NotProtonAppTests/DeploymentContentTests.swift@@ -155,6 +155,25 @@ struct DeploymentContentTests {#expect(status.canInstall)}+ @MainActor+ @Test("A newer installed build also blocks removing a build")+ func newerInstallBlocksRemoval() {+ let status = SystemStatus()+ let payload = PayloadState(expected: 0, present: 0, missing: [], overlayShimPresent: true,+ iconmakerPresent: true, appinfoPresent: true, signatureDatabase: "fixture",+ legacyCompatPresent: 0, legacyCompatExpected: 0, manifestProblem: nil)+ status.snapshot = StatusSnapshot(steam: .notInstalled, steamRunning: false, updateBlocked: false,+ crossOver: [], runner: .none, payload: payload,+ installContent: .newerInstalled)+ status.requestBuildRemoval("crossover-26.0")+ #expect(status.pendingRemoval == nil)+ #expect(status.pendingConfirmation == nil)+ status.snapshot?.installContent = .unrecorded(["notproton.dylib"])+ status.requestBuildRemoval("crossover-26.0")+ #expect(status.pendingRemoval == "crossover-26.0")+ #expect(status.pendingConfirmation == .removeBuild)+ }+@Test("Installation locking excludes another caller and releases without a lock file")func installationLock() throws {let root = try scratchDirectory("content-lock")diff --git a/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift b/app/Tests/NotProtonAppTests/RunnerSwitchTests.swiftindex 68e74a1..36a8241 100644--- a/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift+++ b/app/Tests/NotProtonAppTests/RunnerSwitchTests.swift@@ -17,6 +17,8 @@ struct RunnerPrepareTests {licensed: false, detail: CrossOverLicense.notActivated, diagnostic: "test")+ private static let runScript = Data("#!/bin/sh\n".utf8)+private final class Calls: @unchecked Sendable {var staged: [String] = []var patched: [String] = []@@ -66,6 +68,11 @@ struct RunnerPrepareTests {bridge: runners.appending(path: "bridge"),toolList: runners.appending(path: "tools"),compatTools: runners.appending(path: "compatibilitytools.d"),+ runScript: {+ let script = runners.appending(path: "payload-run")+ try Self.runScript.write(to: script)+ return script+ },license: { _ in license },verify: { _, _ in },stage: { build, _, bridge in@@ -105,6 +112,36 @@ struct RunnerPrepareTests {#expect(!again.toolsChanged)}+ @Test("Every listed tool gets a run script")+ func writesMissingRunScripts() throws {+ let runners = try makeRunners(cloning: [Self.release, Self.fex])+ defer { try? FileManager.default.removeItem(at: runners) }++ _ = try prepare(Self.release, runners: runners, calls: Calls())++ let tools = CompatToolList.installed(runners: runners, file: runners.appending(path: "tools"))+ #expect(tools.count > 1)+ for tool in tools {+ let run = runners.appending(path: "compatibilitytools.d/\(tool.name)/run")+ #expect(try Data(contentsOf: run) == Self.runScript)+ #expect(FileManager.default.isExecutableFile(atPath: run.path))+ }+ }++ @Test("A tool's existing run script is left alone")+ func keepsExistingRunScript() throws {+ let runners = try makeRunners(cloning: [Self.release])+ defer { try? FileManager.default.removeItem(at: runners) }+ let tool = SupportedRunners.tools(for: [Self.release])[0].name+ let run = runners.appending(path: "compatibilitytools.d/\(tool)/run")+ let old = Data("#!/bin/sh\nexec runners/current\n".utf8)+ try atomicReplace(run, with: old, step: "test")++ _ = try prepare(Self.release, runners: runners, calls: Calls())++ #expect(try Data(contentsOf: run) == old)+ }+@Test("Preparing one build leaves another build's staged copies alone")func keepsOtherBuildsStaged() throws {let runners = try makeRunners(cloning: [Self.rosetta, Self.fex])@@ -434,6 +471,55 @@ struct RunnerRemovalTests {)}+ @Test("Removing a build leaves nothing of it in the runners folder")+ func removalLeavesNothing() throws {+ let runners = try makeRunners(cloning: [Self.rosetta.id, Self.fex.id])+ defer { try? FileManager.default.removeItem(at: runners) }+ let fm = FileManager.default+ let leftover = runners.appending(path: ".crossover-\(Self.rosetta.id).removing/CrossOver")+ try fm.createDirectory(at: leftover, withIntermediateDirectories: true)++ _ = try remove(Self.rosetta.id, runners: runners)++ let left = try fm.contentsOfDirectory(atPath: runners.path(percentEncoded: false))+ .filter { $0.contains(Self.rosetta.id) }+ #expect(left.isEmpty)+ #expect(RunnerStore.clonedBuilds(in: runners) == [Self.fex.id])+ }++ @Test("Removing a build also clears what an earlier failed removal of another build left")+ func removalClearsOtherLeftovers() throws {+ let runners = try makeRunners(cloning: [Self.rosetta.id])+ defer { try? FileManager.default.removeItem(at: runners) }+ let fm = FileManager.default+ let leftover = runners.appending(path: ".crossover-\(Self.fex.id).removing/CrossOver")+ try fm.createDirectory(at: leftover, withIntermediateDirectories: true)++ _ = try remove(Self.rosetta.id, runners: runners)++ #expect(try fm.contentsOfDirectory(atPath: runners.path(percentEncoded: false))+ .filter { $0.hasSuffix(".removing") }.isEmpty)+ }++ @Test("A removal whose tool list cannot be written puts the build back")+ func failedSyncRestoresBuild() throws {+ let runners = try makeRunners(cloning: [Self.rosetta.id, Self.fex.id])+ defer { try? FileManager.default.removeItem(at: runners) }+ let fm = FileManager.default+ try fm.createDirectory(at: runners.appending(path: "tools/blocked"), withIntermediateDirectories: true)+ let staged = runners.appending(path: "bridge/wine/\(Self.rosetta.id)/x86_64-windows/ntdll.dll")+ try fm.createDirectory(at: staged.deletingLastPathComponent(), withIntermediateDirectories: true)+ try Data("patched".utf8).write(to: staged)++ #expect(throws: (any Error).self) { try remove(Self.rosetta.id, runners: runners) }+ #expect(fm.fileExists(atPath: staged.path(percentEncoded: false)))++ #expect(RunnerStore.clonedBuilds(in: runners) == [Self.fex.id, Self.rosetta.id].sorted())+ #expect(RunnerInstaller.hasClone(forBuild: Self.rosetta.id, runners: runners))+ #expect(try fm.contentsOfDirectory(atPath: runners.path(percentEncoded: false))+ .filter { $0.hasSuffix(".removing") }.isEmpty)+ }+@Test("Removing a build deletes its prefix templates in every library and keeps the others")func removesThatBuildsTemplates() throws {let runners = try makeRunners(cloning: [Self.rosetta.id, Self.fex.id])diff --git a/app/Tests/NotProtonAppTests/SteamInstallerTests.swift b/app/Tests/NotProtonAppTests/SteamInstallerTests.swiftindex ffe3d59..dc04e68 100644--- a/app/Tests/NotProtonAppTests/SteamInstallerTests.swift+++ b/app/Tests/NotProtonAppTests/SteamInstallerTests.swift@@ -94,7 +94,7 @@ struct SteamInstallerTests {recordBuild: Bool = true,verifyRunner: (RunnerBuild, URL) throws -> Void = { _, _ in }) throws -> InstallOutcome {- try SteamInstaller.run(+ let outcome = try SteamInstaller.run(payload: fixture.payload,version: version,app: fixture.app,@@ -106,13 +106,16 @@ struct SteamInstallerTests {deployedVersion: fixture.deployedVersion,backups: fixture.backups,compatTools: fixture.work.appending(path: "compatibilitytools.d"),- recordBuild: recordBuild,runnerIsRunning: { _ in running },verifyRunner: verifyRunner,patchRunner: { _, _, _ in },stopClient: { _, onStopping in if stopped { onStopping() }; return stopped },register: { calls.register($0) })+ if recordBuild {+ try SteamInstaller.finish(outcome, deployedVersion: fixture.deployedVersion, isCurrent: { _ in true })+ }+ return outcome}@Test("A full install puts every artifact in place and declares the insert")@@ -574,7 +577,7 @@ struct SteamInstallerTests {#expect(!FileManager.default.fileExists(atPath: fixture.deployedDylib.path))}- @Test("An install can defer its build record until remaining setup steps finish")+ @Test("An install writes no build record until it is finished")func defersRecord() async throws {let work = try scratchDirectory("install-deferred")defer { try? FileManager.default.removeItem(at: work) }@@ -583,4 +586,32 @@ struct SteamInstallerTests {#expect(!FileManager.default.fileExists(atPath: DeploymentContent.record(beside: fixture.deployedVersion).path))#expect(!FileManager.default.fileExists(atPath: fixture.deployedVersion.path))}++ @Test("Finishing records the build")+ func finishRecordsBuild() async throws {+ let work = try scratchDirectory("install-finish")+ defer { try? FileManager.default.removeItem(at: work) }+ let fixture = try await self.fixture(into: work)+ let outcome = try install(fixture, recordBuild: false)++ try SteamInstaller.finish(outcome, deployedVersion: fixture.deployedVersion, isCurrent: { _ in true })++ #expect(try DeploymentContent.readBuild(at: DeploymentContent.record(beside: fixture.deployedVersion)) == outcome.build)+ #expect(try String(contentsOf: fixture.deployedVersion, encoding: .utf8)+ .trimmingCharacters(in: .whitespacesAndNewlines) == "9.9.9-test")+ }++ @Test("Finishing records nothing when the installed content is not current")+ func finishRefusesUnverifiedContent() async throws {+ let work = try scratchDirectory("install-unverified")+ defer { try? FileManager.default.removeItem(at: work) }+ let fixture = try await self.fixture(into: work)+ let outcome = try install(fixture, recordBuild: false)++ #expect(throws: StepFailure.self) {+ try SteamInstaller.finish(outcome, deployedVersion: fixture.deployedVersion, isCurrent: { _ in false })+ }+ #expect(!FileManager.default.fileExists(atPath: DeploymentContent.record(beside: fixture.deployedVersion).path))+ #expect(!FileManager.default.fileExists(atPath: fixture.deployedVersion.path))+ }}diff --git a/dylib/hooks/hook_compat.c b/dylib/hooks/hook_compat.cindex 1dcfa3e..a896877 100644--- a/dylib/hooks/hook_compat.c+++ b/dylib/hooks/hook_compat.c@@ -190,35 +190,30 @@ static np_patch_entry_t g_hooks[] = {.signature = "CCompatManager::Init",.entry = (void *)hook_CCompatManager_Init,.trampoline = &orig_CCompatManager_Init,- .tolerate_missing = 1,},{.label = "CCompatManager::BIsCompatibilityToolEnabled",.signature = "CCompatManager::BIsCompatibilityToolEnabled",.entry = (void *)hook_CCompatManager_BIsEnabled,.trampoline = &orig_CCompatManager_BIsEnabled,- .tolerate_missing = 1,},{.label = "CCompatManager::FindToolForTargetApp",.signature = "CCompatManager::FindToolForTargetApp",.entry = (void *)hook_FindToolForTargetApp,.trampoline = &orig_FindToolForTargetApp,- .tolerate_missing = 1,},{.label = "CCompatManager::InternalSpecifyCompatTool",.signature = "CCompatManager::InternalSpecifyCompatTool",.entry = (void *)hook_InternalSpecifyCompatTool,.trampoline = &orig_InternalSpecifyCompatTool,- .tolerate_missing = 1,},{.label = "CCompatManager::GetOSListOverrideForApp.oslist_gate",.signature = "CCompatManager::GetOSListOverrideForApp.oslist_gate",.entry = (void *)instrument_oslist_override_gate,.trampoline = NULL,- .tolerate_missing = 1,.mode = NP_PATCH_PREHOOK,},{@@ -226,7 +221,6 @@ static np_patch_entry_t g_hooks[] = {.signature = "CCompatManager::ResolveCompatToolForApp.local_redirect",.entry = (void *)instrument_resolver_local_redirect,.trampoline = NULL,- .tolerate_missing = 1,.mode = NP_PATCH_PREHOOK,},{@@ -234,7 +228,6 @@ static np_patch_entry_t g_hooks[] = {.signature = "CAppManager::TerminateProcessByPid",.entry = (void *)hook_TerminateProcessByPid,.trampoline = &orig_TerminateProcessByPid,- .tolerate_missing = 1,},};diff --git a/dylib/hooks/hook_icon.c b/dylib/hooks/hook_icon.cindex c6eac1c..31c79a3 100644--- a/dylib/hooks/hook_icon.c+++ b/dylib/hooks/hook_icon.c@@ -209,7 +209,6 @@ static np_patch_entry_t g_hooks[] = {.signature = "steamui::ShortcutIconRender",.entry = (void *)np_icon_render,.trampoline = (void **)&g_render_orig,- .tolerate_missing = 1,.mode = NP_PATCH_REPLACE,},};diff --git a/dylib/hooks/hook_launch.c b/dylib/hooks/hook_launch.cindex 7001c1a..fbfaae8 100644--- a/dylib/hooks/hook_launch.c+++ b/dylib/hooks/hook_launch.c@@ -131,7 +131,6 @@ static np_patch_entry_t g_hooks[] = {.signature = "LaunchBuilder::SteamVRSupportCheck",.entry = (void *)np_hook_vr_support,.trampoline = &orig_vr_support,- .tolerate_missing = 1,},};diff --git a/dylib/hooks/hook_shortcut.c b/dylib/hooks/hook_shortcut.cindex d1c0959..3f92f39 100644--- a/dylib/hooks/hook_shortcut.c+++ b/dylib/hooks/hook_shortcut.c@@ -48,7 +48,6 @@ static np_patch_entry_t g_hooks[] = {.signature = "steamui::ShortcutExtensionMatches",.entry = (void *)np_ext_matches,.trampoline = (void **)&g_ext_matches_orig,- .tolerate_missing = 0,.mode = NP_PATCH_REPLACE,},};diff --git a/dylib/hooks/hook_webui.c b/dylib/hooks/hook_webui.cindex f28be14..403b620 100644--- a/dylib/hooks/hook_webui.c+++ b/dylib/hooks/hook_webui.c@@ -21,15 +21,11 @@ static void register_routes(void *address, void *ctx) {np_compatsvc_register(g_mh, g_slide, g_text_base, g_text_size);}-// An unresolved site here leaves the CompatManager routes unregistered, and the panel-// then shows a service that answers nothing, so the miss is worth a warning where the-// optional hooks settle for a debug line.static np_patch_entry_t g_hooks[] = {{.label = LOOKUP_LABEL,.entry = (void *)register_routes,.trampoline = NULL,- .tolerate_missing = 0,.mode = NP_PATCH_PREHOOK,},};diff --git a/dylib/hooks/hooks.c b/dylib/hooks/hooks.cindex 5314059..7762987 100644--- a/dylib/hooks/hooks.c+++ b/dylib/hooks/hooks.c@@ -60,10 +60,7 @@ static int np_apply_entry(np_resolve_result_t *resolved, const char *group,uintptr_t addr = e->address ? e->address: e->signature ? np_lookup_address(resolved, e->signature) : 0;if (!addr) {- if (e->tolerate_missing)- NP_DBG("[%s] %s: unresolved (optional)", group, e->label);- else- NP_WARN("[%s] %s: unresolved, cannot install", group, e->label);+ NP_WARN("[%s] %s: unresolved, cannot install", group, e->label);return 0;}diff --git a/dylib/hooks/hooks.h b/dylib/hooks/hooks.hindex f3f9b7b..90dd872 100644--- a/dylib/hooks/hooks.h+++ b/dylib/hooks/hooks.h@@ -23,7 +23,6 @@ typedef struct {void *entry;void **trampoline;np_patch_mode_t mode;- int tolerate_missing; // when set, an unresolved signature only logs at debug} np_patch_entry_t;int np_hooks_compat_count(void);