Skip to content

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

Early-exit alert: say what was detected, keep the log path off it

Gauthier Piarrettec156c92c689f
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index e4952f3..eeda04a 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -74,8 +74,13 @@ final class AppState {
/// The bottle that was actually launched. The alert used to edit `selectedBottle`, which
/// `launchGame` never sets — so accepting could rewrite an unrelated bottle, or none.
let bottleName: String
+ /// The renderer to offer next.
let renderer: Renderer
let logPath: String
+ /// The renderer the program actually ran under, and how long it lived: the facts the
+ /// alert can state as detected.
+ var current: Renderer
+ var seconds: Int
/// Another installed engine to offer as the second way out, when there is one.
var alternateEngine: InstalledEngine? = nil
}
@@ -759,7 +764,7 @@ final class AppState {
await MainActor.run {
self.crashSuggestion = CrashSuggestion(program: pin.name, bottleName: bottle.name,
renderer: Renderer.suggestion(after: current),
- logPath: result.log.path,
+ logPath: result.log.path, current: current, seconds: Int(result.duration),
alternateEngine: self.alternateEngine(for: bottle))
}
}
@@ -885,7 +890,7 @@ final class AppState {
await MainActor.run {
self.crashSuggestion = CrashSuggestion(program: game.name, bottleName: bottle.name,
renderer: Renderer.suggestion(after: current),
- logPath: result.log.path,
+ logPath: result.log.path, current: current, seconds: Int(result.duration),
alternateEngine: self.alternateEngine(for: bottle))
}
return
@@ -1030,7 +1035,7 @@ final class AppState {
await MainActor.run {
self.crashSuggestion = CrashSuggestion(program: game.app_title, bottleName: bottle.name,
renderer: Renderer.suggestion(after: current),
- logPath: result.log.path,
+ logPath: result.log.path, current: current, seconds: Int(result.duration),
alternateEngine: self.alternateEngine(for: bottle))
}
}
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
index c80fdf8..569c4e1 100644
--- a/Sources/HighballApp/HighballApp.swift
+++ b/Sources/HighballApp/HighballApp.swift
@@ -345,18 +345,24 @@ struct ContentView: View {
if let bottle = state.bottles.first(where: { $0.name == s.bottleName }) { state.moveBottle(bottle, to: alt) }
}
}
+ Button(L("Show the log")) { NSWorkspace.shared.open(URL(fileURLWithPath: s.logPath)) }
Button(L("Keep current"), role: .cancel) {}
} message: { s in
- if let alt = s.alternateEngine {
- Text("That usually means the graphics backend doesn't suit it. Try \(s.renderer.rawValue.uppercased())? If that fails too, the bottle can move to engine \(alt.id) and back. The log is at \(s.logPath).")
- } else {
- Text("That usually means the graphics backend doesn't suit it. Try \(s.renderer.rawValue.uppercased())? The log is at \(s.logPath).")
- }
+ // What was detected, then what it usually means, then the one next thing. No path
+ // on this surface: the log is one click away (UX plan §3.6).
+ let seen = String(format: L("It was running with %@ and quit after %d seconds without an error the app could read."),
+ s.current.rawValue.uppercased(), s.seconds)
+ let next = s.alternateEngine.map { alt in
+ String(format: L("That usually means the graphics mode doesn't suit it on this Mac. Highball can switch this bottle to %@, or move it to engine %@."),
+ s.renderer.rawValue.uppercased(), alt.id)
+ } ?? String(format: L("That usually means the graphics mode doesn't suit it on this Mac. Highball can switch this bottle to %@."),
+ s.renderer.rawValue.uppercased())
+ Text(seen + " " + next)
}
}
private var crashTitle: String {
guard let s = state.crashSuggestion else { return "" }
- return "\(s.program) exited right away"
+ return s.seconds < 2 ? String(format: L("%@ quit right away"), s.program) : String(format: L("%@ quit after %d seconds"), s.program, s.seconds)
}
}