Skip to content

Commit

Permalink
Dynamic orientation support with attached controllers like the Backbone
Browse files Browse the repository at this point in the history
  • Loading branch information
lonkelle committed Dec 28, 2022
1 parent 657d946 commit 440c748
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Delta/Emulation/GameViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ class GameViewController: DeltaCore.GameViewController
private var presentedJITAlert = false

override var shouldAutorotate: Bool {
return !self.isGyroActive
return !self.isGyroActive && isExternalGameControllerConnected && UIDevice.current.orientation == .landscapeLeft
}

var isExternalGameControllerConnected: Bool {
return ExternalGameControllerManager.shared.connectedControllers.contains(where: { $0.playerIndex != nil })
}

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
Expand Down Expand Up @@ -565,7 +569,6 @@ private extension GameViewController
{
@objc func updateControllers()
{
let isExternalGameControllerConnected = ExternalGameControllerManager.shared.connectedControllers.contains(where: { $0.playerIndex != nil })
if !isExternalGameControllerConnected && Settings.localControllerPlayerIndex == nil
{
Settings.localControllerPlayerIndex = 0
Expand Down

0 comments on commit 440c748

Please sign in to comment.