Skip to content

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

feat(app): --install-into-steam deploys without the Update button

raymondchinsa36b2b667ebb
diff --git a/app/Sources/NotProtonApp/Support/InstallIntoSteamCommand.swift b/app/Sources/NotProtonApp/Support/InstallIntoSteamCommand.swift
new file mode 100644
index 0000000..83fe7c9
--- /dev/null
+++ b/app/Sources/NotProtonApp/Support/InstallIntoSteamCommand.swift
@@ -0,0 +1,48 @@
+import Foundation
+
+// What the Update button on the Status page does, for scripts: deploys this app's files
+// into Steam and exits. Refuses the same cases the button refuses.
+enum InstallIntoSteamCommand {
+ static let flag = "--install-into-steam"
+
+ static func run() -> Never {
+ Task.detached { exit(await perform()) }
+ dispatchMain()
+ }
+
+ private static func perform() async -> Int32 {
+ do {
+ if DeploymentContent.current(version: AppVersion.bundled).blocksInstallation {
+ throw StepFailure(step: SteamInstaller.step,
+ detail: "Installation is blocked. Use the NotProton app that installed this build.")
+ }
+ if RunnerStore.clonedBuilds().contains(where: {
+ RunnerInstaller.isRunning(from: SupportPaths.runnerRoot(forBuild: $0))
+ }) {
+ throw StepFailure(step: SteamInstaller.step,
+ detail: "A game or Wine tool is running. Quit it before updating NotProton.")
+ }
+ let lock = try DeploymentContent.acquireInstallationLock(for: SupportPaths.Steam.app)
+ defer { close(lock) }
+ let result = try SteamInstaller.run(holdingInstallationLock: true, report: { say($0.label) })
+
+ let valve = try ValvePackageManifest.bundled()
+ if valve.files.contains(where: {
+ Digest.sha256IfPresent(SupportPaths.bridge.appending(path: $0.bridgePath)) != $0.sha256
+ }) {
+ say("Downloading missing components")
+ _ = try await ValveFetcher.run { say($0.label) }
+ }
+ try SteamInstaller.finish(result)
+ say("NotProton \(result.version) installed into Steam.")
+ return 0
+ } catch {
+ FileHandle.standardError.write(Data("\(RemoveEverythingCommand.failureMessage(error))\n".utf8))
+ return 1
+ }
+ }
+
+ private static func say(_ line: String) {
+ FileHandle.standardOutput.write(Data("\(line)\n".utf8))
+ }
+}
diff --git a/app/Sources/NotProtonApp/Support/Launch.swift b/app/Sources/NotProtonApp/Support/Launch.swift
index 945ec62..78565c9 100644
--- a/app/Sources/NotProtonApp/Support/Launch.swift
+++ b/app/Sources/NotProtonApp/Support/Launch.swift
@@ -6,6 +6,9 @@ enum Launch {
if CommandLine.arguments.dropFirst().contains(RemoveEverythingCommand.flag) {
RemoveEverythingCommand.run()
}
+ if CommandLine.arguments.dropFirst().contains(InstallIntoSteamCommand.flag) {
+ InstallIntoSteamCommand.run()
+ }
NotProtonApp.main()
}
}
diff --git a/dylib/version.h b/dylib/version.h
index 66a41ab..7313547 100644
--- a/dylib/version.h
+++ b/dylib/version.h
@@ -2,6 +2,6 @@
#ifndef NOTPROTON_VERSION_H
#define NOTPROTON_VERSION_H
-#define NOTPROTON_VERSION "1.1.5-winehq.1-ray.7"
+#define NOTPROTON_VERSION "1.1.5-winehq.1-ray.8"
#endif // NOTPROTON_VERSION_H