diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a6c17df..303d86d5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 \ diff --git a/src/frontend/swiftui/EmulationToolbarItems.swift b/src/frontend/swiftui/EmulationToolbarItems.swift index 3d5d722d..37c0eac1 100644 --- a/src/frontend/swiftui/EmulationToolbarItems.swift +++ b/src/frontend/swiftui/EmulationToolbarItems.swift @@ -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) {} diff --git a/src/frontend/swiftui/GameListToolbarItems.swift b/src/frontend/swiftui/GameListToolbarItems.swift index 982c2b03..d83c4910 100644 --- a/src/frontend/swiftui/GameListToolbarItems.swift +++ b/src/frontend/swiftui/GameListToolbarItems.swift @@ -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 diff --git a/src/frontend/swiftui/HydraApp.swift b/src/frontend/swiftui/HydraApp.swift index e0615a2c..935fe056 100644 --- a/src/frontend/swiftui/HydraApp.swift +++ b/src/frontend/swiftui/HydraApp.swift @@ -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..