Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

follow-ups to #181: the audio header states the rate without naming a cause; reinstalling a damaged engine stops the bottles on it before the directory swap

Gauthier Piarretted5144527ed9b
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index b09ab51..054ee47 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -1844,6 +1844,14 @@ final class AppState {
runBusy(String(format: L("Installing engine %@ again"), id), expected: L("usually a few minutes"),
done: DoneState(title: L("Engine installed again"), ctaTitle: nil, cta: nil),
stop: .cancelTask(label: L("Stop"))) { [self] in
+ // The install swaps the engine directory under whatever runs on it. Nothing should
+ // be running on a damaged engine, but the detection is a heuristic, so stop the
+ // bottles on it first the way an engine move does, and the swap is safe either way.
+ if let damaged = engines.first(where: { $0.id == id }) {
+ for bottle in bottles where bottle.settings.engineID == id {
+ try? WineRunner(paths: paths, engine: damaged, bottle: bottle).kill()
+ }
+ }
_ = try await engineStore.install(manifest, accepted: accepted) { name, received, total in
Task { @MainActor in self.reportDownload(name, received: received, total: total) }
}
diff --git a/Sources/HighballKit/AudioOutput.swift b/Sources/HighballKit/AudioOutput.swift
index 56c0247..fb7a160 100644
--- a/Sources/HighballKit/AudioOutput.swift
+++ b/Sources/HighballKit/AudioOutput.swift
@@ -37,7 +37,10 @@ public enum AudioOutput {
public static func headerLine(sampleRate: Double?) -> String? {
guard let rate = sampleRate else { return nil }
let hz = Int(rate.rounded())
+ // The rate is the fact; what it means for a given crackle is the reader's to work out.
+ // Crackling under Wine on a Mac is at least as often a winecoreaudio underrun as a
+ // resample, so the header does not name a cause (highball#181 review).
guard hz != Int(gameSampleRate) else { return "# audio out=\(hz) Hz\n" }
- return "# audio out=\(hz) Hz (games mix at \(Int(gameSampleRate)) Hz, so macOS resamples)\n"
+ return "# audio out=\(hz) Hz (most games mix at \(Int(gameSampleRate)) Hz)\n"
}
}
diff --git a/Tests/HighballKitTests/AudioOutputTests.swift b/Tests/HighballKitTests/AudioOutputTests.swift
index 02a791d..790009f 100644
--- a/Tests/HighballKitTests/AudioOutputTests.swift
+++ b/Tests/HighballKitTests/AudioOutputTests.swift
@@ -10,7 +10,7 @@ final class AudioOutputTests: XCTestCase {
func testAMismatchSaysWhatItMeans() {
let line = AudioOutput.headerLine(sampleRate: 44100)
- XCTAssertEqual(line, "# audio out=44100 Hz (games mix at 48000 Hz, so macOS resamples)\n")
+ XCTAssertEqual(line, "# audio out=44100 Hz (most games mix at 48000 Hz)\n")
}
func testNoDeviceAddsNoLine() {