Skip to content
Closed
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
18 changes: 14 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ jobs:
fail-fast: false
matrix:
include:
- suffix: SwiftUI-Release
- suffix: SwiftUI-Debug
- suffix: SDL-Release
- suffix: SDL-Debug
- suffix: Arm-SwiftUI-Release
- suffix: Arm-SwiftUI-Debug
- suffix: Arm-SDL-Release
- suffix: Arm-SDL-Debug
- suffix: x86-SwiftUI-Release
- suffix: x86-SwiftUI-Debug
- suffix: x86-SDL-Release
- suffix: x86-SDL-Debug

runs-on: macos-15

Expand Down Expand Up @@ -60,10 +64,16 @@ jobs:
else
echo "FRONTEND_MODE=SDL3" >> $GITHUB_ENV
fi
if [[ ${{ matrix.suffix }} == *'x86'* ]]; then
echo "ARCH=x86_64" >> $GITHUB_ENV
else
echo "ARCH=arm64" >> $GITHUB_ENV
fi

- name: Build Hydra
run: |
cmake hydra -B build \
-DCMAKE_OSX_ARCHITECTURES=${{ env.ARCH }} \
-DCMAKE_BUILD_TYPE=${{ env.BUILD_MODE }} \
-DFRONTEND=${{ env.FRONTEND_MODE }} \
-DMACOS_BUNDLE=ON \
Expand Down
14 changes: 14 additions & 0 deletions src/frontend/swiftui/EmulationToolbarItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ struct EmulationToolbarItems: ToolbarContent {
isRunning = globalState.emulationContext!.isRunning()
}
}

ToolbarItemGroup(placement: .confirmationAction) {
Button("Console Mode", systemImage: "inset.filled.tv") {
globalState.isHandheldMode.toggle()
}
.disabled(!globalState.isHandheldMode)
.help("Change to Console mode")

Button("Handheld Mode", systemImage: "formfitting.gamecontroller.fill") {
globalState.isHandheldMode.toggle()
}
.disabled(globalState.isHandheldMode)
.help("Change to Handheld mode")
}
#else
// TODO: options
ToolbarItemGroup(placement: .principal) {}
Expand Down
12 changes: 6 additions & 6 deletions src/frontend/swiftui/GameListToolbarItems.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ struct GameListToolbarItems: ToolbarContent {

var body: some ToolbarContent {
#if os(macOS)
ToolbarItem(placement: .principal) {
ToolbarItemGroup(placement: .principal) {
Button("List View", systemImage: "list.bullet") {
viewMode = ViewMode.list.rawValue
}.disabled(ViewMode(rawValue: viewMode) == .list)
}

ToolbarItem(placement: .principal) {
}
.disabled(ViewMode(rawValue: viewMode) == .list)

Button("Grid View", systemImage: "rectangle.grid.3x2.fill") {
viewMode = ViewMode.grid.rawValue
}.disabled(ViewMode(rawValue: viewMode) == .grid)
}
.disabled(ViewMode(rawValue: viewMode) == .grid)
}
#endif

Expand Down
11 changes: 10 additions & 1 deletion src/frontend/swiftui/HydraApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,19 @@ class GlobalState: ObservableObject {
@Published var activeGame: Game? = nil
@Published var emulationContext: HydraEmulationContext? = nil
@Published var isStopping = false
@Published var isHandheldMode: Bool {
didSet {
hydraConfigGetHandheldMode().pointee = isHandheldMode
hydraConfigSerialize()
guard let emulationContext = emulationContext else { return }
emulationContext.notifyOperationModeChanged()
}
}

init() {
hydraLoaderPluginManagerRefresh()

isHandheldMode = hydraConfigGetHandheldMode().pointee

let gamePathsOption = hydraConfigGetGamePaths()
for i in 0..<gamePathsOption.count {
let gamePath = gamePathsOption.get(at: i)
Expand Down
13 changes: 2 additions & 11 deletions src/frontend/swiftui/MenuCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ struct MenuCommands: Commands {
@Binding var globalState: GlobalState

@State private var firmwareApplets: [Game] = []
@State private var handheldMode = false

var body: some Commands {
CommandGroup(after: .newItem) {
Expand Down Expand Up @@ -44,18 +43,10 @@ struct MenuCommands: Commands {
Button("Stop") {
globalState.isStopping = true
}
Button("Switch to \(self.handheldMode ? "Console" : "Handheld") mode") {
self.handheldMode = !self.handheldMode
hydraConfigGetHandheldMode().pointee = self.handheldMode
hydraConfigSerialize()

guard let emulationContext = globalState.emulationContext else { return }
emulationContext.notifyOperationModeChanged()
Button("Switch modes") {
globalState.isHandheldMode.toggle()
}
.keyboardShortcut(KeyEquivalent("o"), modifiers: .command)
.onAppear {
self.handheldMode = hydraConfigGetHandheldMode().pointee
}
}

CommandMenu("Debug") {
Expand Down
Loading