Skip to content

Commit

Permalink
locks GameViewController from rotating if an external game controller…
Browse files Browse the repository at this point in the history
… is connected
  • Loading branch information
ianclawson committed Nov 4, 2021
1 parent f1f75d8 commit f84aee2
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 @@ -168,7 +168,11 @@ class GameViewController: DeltaCore.GameViewController
private var presentedGyroAlert = false

override var shouldAutorotate: Bool {
return !self.isGyroActive
return !self.isGyroActive && !isExternalGameControllerConnected
}

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

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
Expand Down Expand Up @@ -546,7 +550,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 f84aee2

Please sign in to comment.