Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ DEPS := $(OBJS:.o=.d)
featcheck featstagecheck runnervariantcheck conf-fixtures confcheck \
tests-list overlay-shim overlay-shim-install overlay-shim-tests \
overlay-shim-bench iconmaker icon \
appinfo helpers-install ntdll-resolve bridge runcheck compatcheck envpasscheck \
appinfo audiowatch helpers-install ntdll-resolve bridge runcheck compatcheck envpasscheck \
compatsvc-check prefixstate-check defaults-check compatpage-check defaults-drift shortcutcheck scriptcheck envcheck buildcheck settingscheck routecheck bridgecheck gamedrivecheck launchercheck bundlecheck launch-shell activatecheck FORCE

APP_PAYLOAD := app/Sources/NotProtonApp/Resources/payload
Expand Down Expand Up @@ -620,10 +620,20 @@ $(APPINFO): helpers/appinfo.swift
swiftc -O -target $(ARCH)-apple-macos$(MIN_VER) -o $@ $<
@echo "==> Built $@"

helpers-install: $(ICONMAKER) $(APPINFO)
AUDIOWATCH := $(OUT_DIR)/audiowatch

audiowatch: $(AUDIOWATCH)

$(AUDIOWATCH): helpers/audiowatch.swift
@mkdir -p $(OUT_DIR)
swiftc -O -target $(ARCH)-apple-macos$(MIN_VER) -o $@ $<
@echo "==> Built $@"

helpers-install: $(ICONMAKER) $(APPINFO) $(AUDIOWATCH)
$(call install_atomically,$(ICONMAKER),$(SUPPORT_DIR)/iconmaker)
$(call install_atomically,$(APPINFO),$(SUPPORT_DIR)/appinfo)
@echo "==> Installed: $(SUPPORT_DIR)/{iconmaker,appinfo}"
$(call install_atomically,$(AUDIOWATCH),$(SUPPORT_DIR)/audiowatch)
@echo "==> Installed: $(SUPPORT_DIR)/{iconmaker,appinfo,audiowatch}"

dobby:
@mkdir -p $(DOBBY_DIR)
Expand Down Expand Up @@ -694,13 +704,14 @@ bridge:
fonts:
fonts/build.sh

app-payload: $(TARGET) $(OVERLAY_SHIM) $(ICONMAKER) $(APPINFO)
app-payload: $(TARGET) $(OVERLAY_SHIM) $(ICONMAKER) $(APPINFO) $(AUDIOWATCH)
@mkdir -p "$(APP_PAYLOAD)/signatures/macos.arm64"
@mkdir -p "$(APP_PAYLOAD)/bridge"
cp -f $(TARGET) "$(APP_PAYLOAD)/notproton.dylib"
cp -f $(OVERLAY_SHIM) "$(APP_PAYLOAD)/overlay-shim.dylib"
cp -f $(ICONMAKER) "$(APP_PAYLOAD)/iconmaker"
cp -f $(APPINFO) "$(APP_PAYLOAD)/appinfo"
cp -f $(AUDIOWATCH) "$(APP_PAYLOAD)/audiowatch"
cp -f dylib/feats/compat_run.sh "$(APP_PAYLOAD)/run"
cp -f signatures/macos.arm64/*.json "$(APP_PAYLOAD)/signatures/macos.arm64/"
@set -e; for spec in $(BRIDGE_FILES); do \
Expand Down
5 changes: 4 additions & 1 deletion app/Sources/NotProtonApp/Model/DeploymentContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ enum DeploymentContent {
static func files(
payload: InstallPayload.Located, bridgePayload: BridgePayload.Located,
app: URL, bridge: URL, signatures: URL, fonts: URL, overlayShim: URL, iconmaker: URL, appinfo: URL,
audiowatch: URL,
compatTools: URL, tools: [InstalledTool], runners: URL
) -> [File] {
var files = [
Expand All @@ -167,6 +168,7 @@ enum DeploymentContent {
File(source: payload.overlayShim, destination: overlayShim, name: "overlay-shim.dylib"),
File(source: payload.iconmaker, destination: iconmaker, name: "iconmaker", executable: true),
File(source: payload.appinfo, destination: appinfo, name: "appinfo", executable: true),
File(source: payload.audiowatch, destination: audiowatch, name: "audiowatch", executable: true),
]
files += payload.signatures.map {
File(source: $0, destination: signatures.appending(path: $0.lastPathComponent),
Expand Down Expand Up @@ -208,7 +210,8 @@ enum DeploymentContent {
bridge: SupportPaths.bridge, signatures: SupportPaths.signatures,
fonts: SupportPaths.fonts,
overlayShim: SupportPaths.overlayShim, iconmaker: SupportPaths.iconmaker,
appinfo: SupportPaths.appinfo, compatTools: SupportPaths.Steam.compatTools,
appinfo: SupportPaths.appinfo, audiowatch: SupportPaths.audiowatch,
compatTools: SupportPaths.Steam.compatTools,
tools: CompatToolList.installed(), runners: SupportPaths.runners)
return try inspect(files: files, bundled: Build(version: version, builtAt: payload.builtAt),
installed: readBuild(at: record(beside: SupportPaths.deployedVersion)),
Expand Down
7 changes: 6 additions & 1 deletion app/Sources/NotProtonApp/Model/InstallPayload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ enum InstallPayload {
let overlayShim: URL
let iconmaker: URL
let appinfo: URL
let audiowatch: URL
let run: URL
let builtAt: Int64

Expand Down Expand Up @@ -39,6 +40,7 @@ enum InstallPayload {
let shim = root.appending(path: "overlay-shim.dylib")
let iconmaker = root.appending(path: "iconmaker")
let appinfo = root.appending(path: "appinfo")
let audiowatch = root.appending(path: "audiowatch")
let run = root.appending(path: "run")
let stamp = try? String(contentsOf: root.appending(path: "build-time"), encoding: .utf8)
let builtAt = stamp.flatMap { Int64($0.trimmingCharacters(in: .whitespacesAndNewlines)) }
Expand All @@ -56,6 +58,9 @@ enum InstallPayload {
if !files.fileExists(atPath: appinfo.path(percentEncoded: false)) {
missing.append("appinfo")
}
if !files.fileExists(atPath: audiowatch.path(percentEncoded: false)) {
missing.append("audiowatch")
}
if !files.fileExists(atPath: run.path(percentEncoded: false)) { missing.append("run") }
if (builtAt ?? 0) <= 0 { missing.append("build-time") }

Expand All @@ -80,7 +85,7 @@ enum InstallPayload {

return Located(
dylib: dylib, overlayShim: shim, iconmaker: iconmaker,
appinfo: appinfo, run: run, builtAt: builtAt, signatures: signatures,
appinfo: appinfo, audiowatch: audiowatch, run: run, builtAt: builtAt, signatures: signatures,
fontsRoot: fontsRoot, fonts: fonts
)
}
Expand Down
4 changes: 4 additions & 0 deletions app/Sources/NotProtonApp/Model/PayloadState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ struct PayloadState: Sendable {
var overlayShimPresent: Bool
var iconmakerPresent: Bool
var appinfoPresent: Bool
var audiowatchPresent: Bool
var signatureDatabase: String?
var legacyCompatPresent: Int
var legacyCompatExpected: Int
Expand All @@ -23,6 +24,7 @@ struct PayloadState: Sendable {
if !overlayShimPresent { names.append("overlay-shim.dylib") }
if !iconmakerPresent { names.append("iconmaker") }
if !appinfoPresent { names.append("appinfo") }
if !audiowatchPresent { names.append("audiowatch") }
return names
}

Expand All @@ -32,6 +34,7 @@ struct PayloadState: Sendable {

var isEmpty: Bool {
present == 0 && !overlayShimPresent && !iconmakerPresent && !appinfoPresent
&& !audiowatchPresent
&& signatureDatabase == nil
}

Expand Down Expand Up @@ -79,6 +82,7 @@ enum PayloadInspector {
overlayShimPresent: fm.fileExists(atPath: SupportPaths.overlayShim.path(percentEncoded: false)),
iconmakerPresent: fm.fileExists(atPath: SupportPaths.iconmaker.path(percentEncoded: false)),
appinfoPresent: fm.fileExists(atPath: SupportPaths.appinfo.path(percentEncoded: false)),
audiowatchPresent: fm.fileExists(atPath: SupportPaths.audiowatch.path(percentEncoded: false)),
signatureDatabase: newestSignatureDatabase(),
legacyCompatPresent: legacyPresent,
legacyCompatExpected: legacyNames.count,
Expand Down
2 changes: 2 additions & 0 deletions app/Sources/NotProtonApp/Model/SteamInstaller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ enum SteamInstaller {
overlayShim: URL = SupportPaths.overlayShim,
iconmaker: URL = SupportPaths.iconmaker,
appinfo: URL = SupportPaths.appinfo,
audiowatch: URL = SupportPaths.audiowatch,
deployedVersion: URL = SupportPaths.deployedVersion,
backups: URL = SupportPaths.backups,
compatTools: URL = SupportPaths.Steam.compatTools,
Expand Down Expand Up @@ -104,6 +105,7 @@ enum SteamInstaller {
let files = DeploymentContent.files(
payload: payload, bridgePayload: bridgeLocated, app: app, bridge: bridge,
signatures: signatures, fonts: fonts, overlayShim: overlayShim, iconmaker: iconmaker, appinfo: appinfo,
audiowatch: audiowatch,
compatTools: compatTools, tools: tools, runners: runners)
let content = try DeploymentContent.inspect(files: files, bundled: build, installed: previousBuild,
legacyVersion: SteamBundle.deployedVersion(at: deployedVersion))
Expand Down
1 change: 1 addition & 0 deletions app/Sources/NotProtonApp/Support/AppLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ enum AppLog {
+ "overlayShim=\(payload.overlayShimPresent) "
+ "iconmaker=\(payload.iconmakerPresent) "
+ "appinfo=\(payload.appinfoPresent) "
+ "audiowatch=\(payload.audiowatchPresent) "
+ "signatures=\(payload.signatureDatabase ?? "none") "
+ "legacycompat=\(payload.legacyCompatPresent)/\(payload.legacyCompatExpected)"
)
Expand Down
1 change: 1 addition & 0 deletions app/Sources/NotProtonApp/Support/SupportPaths.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ enum SupportPaths {
static var overlayShim: URL { support.appending(path: "overlay-shim.dylib") }
static var iconmaker: URL { support.appending(path: "iconmaker") }
static var appinfo: URL { support.appending(path: "appinfo") }
static var audiowatch: URL { support.appending(path: "audiowatch") }

static var packageDownloads: URL {
home.appending(path: "Library/Caches/\(supportDirName)/valve-packages")
Expand Down
6 changes: 4 additions & 2 deletions app/Tests/NotProtonAppTests/DeploymentContentTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ struct DeploymentContentTests {
func unavailableInstallAction() {
let status = SystemStatus()
let payload = PayloadState(expected: 0, present: 0, missing: [], overlayShimPresent: true,
iconmakerPresent: true, appinfoPresent: true, signatureDatabase: "fixture",
iconmakerPresent: true, appinfoPresent: true, audiowatchPresent: true,
signatureDatabase: "fixture",
legacyCompatPresent: 0, legacyCompatExpected: 0, manifestProblem: nil)
status.snapshot = StatusSnapshot(steam: .notInstalled, steamRunning: false, updateBlocked: false,
crossOver: [], runner: .none, payload: payload,
Expand All @@ -160,7 +161,8 @@ struct DeploymentContentTests {
func newerInstallBlocksRemoval() {
let status = SystemStatus()
let payload = PayloadState(expected: 0, present: 0, missing: [], overlayShimPresent: true,
iconmakerPresent: true, appinfoPresent: true, signatureDatabase: "fixture",
iconmakerPresent: true, appinfoPresent: true, audiowatchPresent: true,
signatureDatabase: "fixture",
legacyCompatPresent: 0, legacyCompatExpected: 0, manifestProblem: nil)
status.snapshot = StatusSnapshot(steam: .notInstalled, steamRunning: false, updateBlocked: false,
crossOver: [], runner: .none, payload: payload,
Expand Down
8 changes: 6 additions & 2 deletions app/Tests/NotProtonAppTests/InstallPayloadTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import Testing
@Suite("Install payload")
struct InstallPayloadTests {

private func stage(_ root: URL, dylib: Bool = true, shim: Bool = true, iconmaker: Bool = true, appinfo: Bool = true, signatures: [String] = ["1788400362.json"], fonts: [String] = ["arial.ttf"]) throws {
private func stage(_ root: URL, dylib: Bool = true, shim: Bool = true, iconmaker: Bool = true, appinfo: Bool = true, audiowatch: Bool = true, signatures: [String] = ["1788400362.json"], fonts: [String] = ["arial.ttf"]) throws {
let files = FileManager.default
let signatureDir = root.appending(path: "signatures/macos.arm64")
try files.createDirectory(at: signatureDir, withIntermediateDirectories: true)
if dylib { try Data("dylib".utf8).write(to: root.appending(path: SupportPaths.dylibName)) }
if shim { try Data("shim".utf8).write(to: root.appending(path: "overlay-shim.dylib")) }
if iconmaker { try Data("iconmaker".utf8).write(to: root.appending(path: "iconmaker")) }
if appinfo { try Data("appinfo".utf8).write(to: root.appending(path: "appinfo")) }
if audiowatch { try Data("audiowatch".utf8).write(to: root.appending(path: "audiowatch")) }
try Data("#!/bin/sh\nexit 0\n".utf8).write(to: root.appending(path: "run"))
try Data("100\n".utf8).write(to: root.appending(path: "build-time"))
for name in signatures {
Expand All @@ -33,6 +34,7 @@ struct InstallPayloadTests {
#expect(located.dylib.lastPathComponent == "notproton.dylib")
#expect(located.overlayShim.lastPathComponent == "overlay-shim.dylib")
#expect(located.appinfo.lastPathComponent == "appinfo")
#expect(located.audiowatch.lastPathComponent == "audiowatch")
#expect(!located.signatures.isEmpty)
#expect(located.fonts.contains("arial.ttf"))
#expect(located.fonts.contains("alt/arial.ttf"))
Expand Down Expand Up @@ -94,7 +96,8 @@ struct InstallPayloadTests {
func reportsEverythingMissing() throws {
let root = try scratchDirectory("payload")
defer { try? FileManager.default.removeItem(at: root) }
try stage(root, dylib: false, shim: false, iconmaker: false, appinfo: false, signatures: [], fonts: [])
try stage(root, dylib: false, shim: false, iconmaker: false, appinfo: false,
audiowatch: false, signatures: [], fonts: [])

do {
_ = try InstallPayload.locate(root: root)
Expand All @@ -104,6 +107,7 @@ struct InstallPayloadTests {
#expect(failure.detail.contains("overlay-shim.dylib"))
#expect(failure.detail.contains("iconmaker"))
#expect(failure.detail.contains("appinfo"))
#expect(failure.detail.contains("audiowatch"))
#expect(failure.detail.contains("signatures/macos.arm64"))
#expect(failure.detail.contains("fonts"))
}
Expand Down
2 changes: 2 additions & 0 deletions app/Tests/NotProtonAppTests/PayloadStateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ struct PayloadStateTests {
overlayShimPresent: overlay,
iconmakerPresent: true,
appinfoPresent: true,
audiowatchPresent: true,
signatureDatabase: signatures,
legacyCompatPresent: 6,
legacyCompatExpected: 6,
Expand Down Expand Up @@ -140,6 +141,7 @@ struct PayloadStateTests {
overlayShimPresent: true,
iconmakerPresent: true,
appinfoPresent: true,
audiowatchPresent: true,
signatureDatabase: "1788400362.json",
legacyCompatPresent: 6,
legacyCompatExpected: 6,
Expand Down
8 changes: 7 additions & 1 deletion app/Tests/NotProtonAppTests/SteamInstallerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ struct SteamInstallerTests {

let appinfo = root.appending(path: "appinfo")
try FileManager.default.copyItem(at: dylib, to: appinfo)

let audiowatch = root.appending(path: "audiowatch")
try FileManager.default.copyItem(at: dylib, to: audiowatch)
try Data("#!/bin/sh\nexit 0\n".utf8).write(to: root.appending(path: "run"))
try Data("100\n".utf8).write(to: root.appending(path: "build-time"))

Expand All @@ -68,6 +71,7 @@ struct SteamInstallerTests {
var overlayShim: URL { support.appending(path: "overlay-shim.dylib") }
var iconmaker: URL { support.appending(path: "iconmaker") }
var appinfo: URL { support.appending(path: "appinfo") }
var audiowatch: URL { support.appending(path: "audiowatch") }
var deployedVersion: URL { support.appending(path: "dylib.version") }
var backups: URL { support.appending(path: "backups") }
var bridge: URL { support.appending(path: "bridge") }
Expand Down Expand Up @@ -116,6 +120,7 @@ struct SteamInstallerTests {
overlayShim: fixture.overlayShim,
iconmaker: fixture.iconmaker,
appinfo: fixture.appinfo,
audiowatch: fixture.audiowatch,
deployedVersion: fixture.deployedVersion,
backups: fixture.backups,
compatTools: fixture.work.appending(path: "compatibilitytools.d"),
Expand Down Expand Up @@ -621,7 +626,8 @@ struct SteamInstallerTests {
let files = DeploymentContent.files(payload: fixture.payload, bridgePayload: bridge, app: fixture.app,
bridge: fixture.bridge, signatures: fixture.signatures,
fonts: fixture.fonts, overlayShim: fixture.overlayShim, iconmaker: fixture.iconmaker,
appinfo: fixture.appinfo, compatTools: work.appending(path: "compatibilitytools.d"),
appinfo: fixture.appinfo, audiowatch: fixture.audiowatch,
compatTools: work.appending(path: "compatibilitytools.d"),
tools: tools, runners: runners)
#expect(try files.allSatisfy { try $0.matches() })
}
Expand Down
7 changes: 7 additions & 0 deletions dylib/feats/compat_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3186,6 +3186,13 @@ NP_FEAT_ENVS
fi
open_pid=$!
/usr/bin/caffeinate -d -i -w "$open_pid" >> "$log" 2>&1 &
np_audiowatch="$np_support/audiowatch"
if [ -x "$np_audiowatch" ]; then
env -u DYLD_INSERT_LIBRARIES -u DYLD_LIBRARY_PATH -u DYLD_FRAMEWORK_PATH \
"$np_audiowatch" -w "$open_pid" >> "$log" 2>&1 &
else
echo "=== no audiowatch, audio stays on the launch-time device ===" >> "$log" 2>&1 || true
fi
status=0
wait "$open_pid" || status=$?
echo "=== game exited status=$status, killing wine prefix ===" >> "$log" 2>&1 || true
Expand Down
Loading
Loading