Game Controller

RSS for tag

Support hardware game controllers in your game using Game Controller.

Posts under Game Controller tag

22 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Emulated GCGameController not working with non fullscreen Designed for iPad apps on MacBook
Hello, I have an iPad app that users are running on their M1 / M2 MacBooks thanks to the "Designed for iPad" feature. Some of them reported to me that the pressed keyboard keys were not recognized. According to my source code, it seems that my custom views (that are set as firstResponder) do not get pressesBegan events. While I could not reproduce this specific problem on my M1 Macbook, I found a strange problem that may be related. My view also supports interaction with game controllers. I found that the emulated controller (which is using the keyboard, when the controller emulation feature of the Designed for iPad app is set to On) has some problems. The valueChangedHandler of the GCExtendedGamepad from the GCGameController is only fired if the app is compiled with the "Requires full screen" option set to On. If Requires full screen is unchecked in XCode, the Emulated Controller is still present in the list of game controllers, but no button callbacks are triggered. Note that a real game controller connected via USB will work correctly no matter how Requires full screen is set. Could there be a focus bug of the keyboard not sending events when the app is not a full screen app (resizable on mac, and multitask on iPad)? Or is there something I can change to avoid this problem? I'm lost.
0
0
178
1w
AppleTV Simulator SiriRemote not working in App
Hi, I'm having a small App in the AppleTV-Simulator which is supposed to use the Siri-Remotes Swipe-Gesture. It works perfect on the real device but on the simulator the Swipe-Gesture is not recognized in the App but it works on the Start-Screen of the Simulator using the simulated Siri-Remote app. Here is the code which sets up the xAxis ans yAxis value change handlers: #if targetEnvironment(simulator) // Simulator let siriRemote = GCController.controllers().filter { controller in if controller.vendorName == "Gamepad" { return true } else { return false } } let sController = siriRemote.first! let inputProfile = sController.physicalInputProfile let dPad = inputProfile.dpads["Direction Pad"] self.dPad = dPad self.dPad!.xAxis.valueChangedHandler = self.directionPadXAxisValueChangeHandler self.dPad!.yAxis.valueChangedHandler = self.directionPadYAxisValueChangeHandler } #else // Device if let _ = ( notification.object as? GCController)?.microGamepad { let microProfileController = notification.object as! GCController self.microGamePad = microProfileController.microGamepad self.dPad = self.microGamePad!.dpad self.dPad!.xAxis.valueChangedHandler = self.directionPadXAxisValueChangeHandler self.dPad!.yAxis.valueChangedHandler = self.directionPadYAxisValueChangeHandler } #endif Any help is greatly appreciated. Cheers, Frank
0
0
207
3w
Xbox controller and visionOS 2
I am having problems getting button input from an Xbox game controller. I have the visionOS 2 beta on my Apple Vision Pro, and I am trying to use an Xbox game controller with a RealityView following the instructions from the WWDC session Explore game input in visionOS. The notification about a game controller is picking up the game controller, finds GCInputButtonA, and I am setting closures for touchedChangedHandler, pressedChangedHandler, and valueChangedHandler that just print an os_log statement. buttonA.valueChangedHandler = { button, value, pressed in os_log("Got valueChangedHandler") } At the end of RealityView, I have the modifier RealityView { content in // stuff } .handlesGameControllerEvents(matching: .gamepad) But I am never seeing the log message appear in the console when I press the 'A' button (or any other button). Any ideas what I might be doing wrong? The Xbox controller is pretty old. Settings is reporting it as version 9.0.3
1
0
304
4w
RealityKit for macOS example
I would like to code some RealityViews to run on my Mac first (and then incorporate them in a visionOS project) so that my code/test loop is faster, but I have not been able to find a simple example that supports Mac. Is it possible to have volumes on a Mac? Is there support for using a game controller to move around the RealityView, like in the visionOS simulator?
1
0
269
Jun ’24
Compatibility Inquiry: 8BitDo Ultimate 2.4G Wireless Controller on macOS
Hi there, I'm reaching out to inquire about compatibility restrictions regarding the 8BitDo Ultimate 2.4G Wireless Controller on macOS systems, particularly its functionality with third-party applications such as Construct 3, a browser-based game development software. As an indie game developer, I recently acquired the 8BitDo Ultimate controller for its touted compatibility and functionality. While I've primarily used it in Bluetooth mode on my Mac without encountering any significant issues, I've stumbled upon a peculiar problem when using the controller while developing projects in Construct 3, specifically within the preview mode of the game engine. In attempting to test my projects using Construct 3's preview feature, the controller fails to detect any of my inputs. This is particularly confounding as the controller operates flawlessly when I export a proper macOS build of the game from the engine and play it externally. To further investigate, I experimented with Nintendo Switch Joy-Cons, which surprisingly worked seamlessly without encountering any issues during testing within Construct 3's preview mode. Upon reaching out to both Construct 3 and 8BitDo customer support, I was informed that the compatibility restriction with third-party controllers on macOS is due to limitations imposed by Apple, which are beyond their control. Consequently, I sought assistance from Apple Developer Program Support, who directed me to contact the Code-level Technical Support team or inquire on the developer forum. The lack of compatibility with crucial development tools like Construct 3 significantly hampers my workflow as an indie developer, and I'm eager to find a resolution to this issue. Thank you for your time, and I'm hopeful that someone within the community might be able to provide guidance on this matter.
4
0
775
Mar ’24
Issues using xbox 360 controller on Macbook Air
Hi all, I have a macbook air 2022 with the M2 chip inside. I am trying to use a wired xbox 360 controller to play games on steam. However, whenever I try to plug it it, the light shines green for a little bit and then turns off. I checked in my usb device tree through the system report and it says that there is a controller plugged in. The controller doesn't work in the game either, are there any fixes? I am also on macOS Monterey version 12.4
0
0
566
Mar ’24
A Game Controller For visionOS RealityView
Im searching for a simple swiftUI code that can move a cube in immersive space when I click the X button on Sony Playstation Game Controller, I did load a USD entity and connect the game controller but when it comes to get a simple click into the reality view to change position or rotate the entity it always not even accepted in codes. although I can control it with a finger or hand gestures, and yes I have closed the "Send Game Controller to device" in the simulator to make sure the controller would not effect the system but only effect in the game, here is a sample import SwiftUI import RealityKit import GameController struct ImmersiveView: View { @State var entity = ModelEntity() @State var z: Float = -4.0 var body: some View { RealityView { content in if let cube = try? await ModelEntity(named: "am.usdz") { entity = cube entity.generateCollisionShapes(recursive: true) entity.name = "Cube" entity.position = [0, 0, -4] entity.components.set(InputTargetComponent(allowedInputTypes: .indirect)) entity.components.set(HoverEffectComponent()) content.add(entity) } } .gesture( SpatialTapGesture() .targetedToEntity(entity) .onEnded { value in print(value) z -= 1.0 entity.position = [0, 0, z] } ) // What to do here to make game controller button X act as the gesture do } }
1
0
689
Feb ’24
Handling tvOS Siri remote + iOS remote + Nimbus/PS
Hi guys, Since SwiftUI is not completely suporting tvOS remote and swipe/pan gestures (targeting tvOS 16 and higher, using Xcode 15.1 and its tvOS SDK), I have implemented custom remote control handling using GameController framework and GCController class to detects Siri Remote (1st and 2nd generation), iOS Remote (tvOS remote controller on iPhone) and Nimbus+ and PS game controllers. For video streaming app I specifically needed to handle arrows on old Siri remote and new Siri remote the same way - arrow press (not just touch) switches TV channel. In the standard SwiftUI remote control handling the arrow presses are triggered on old remote just by touching edges of the touch pad. We use Up/Down arrow presses to switch TV channel. Our testers reported that they too often accidentally change channel when picking up remote or simply laying down finger on the pad in preparation to use the remote for some action. That's why we needed to override default behavior on old remote and detect arrow press only when user touches the edge and "clicks" the touch pad. Simultaneously we detect input from all controllers, because for example when you have Nimbus game controller connected it becomes current controller - it is set in GCController.current - while we still need to handle Siri remote, so user didn't have to turn off Game controller and could just pick up the Siri remote and use it right away. But there are still some problems. For example if I open tvOS remote control app on iPhone it has higher priority over Siri remote. Although I'm able to hold iPhone in one hand and Siri remote in the other and use them simulatanously, pressing down arrow buttons on Siri remote triggers event, which is being detected as if it came from iOS remote. This problem occurs even if user locks iPhone while remote app is active. User has to unlock iPhone and minimize iOS remote to fix the problem and make Siri remote fully active controller with arrows working as expected. Is there a way of detecting from which remote the button press event came? GCController.current reports that iOS remote is current controller, notification GCControllerDidConnect and GCControllerDidBecomeCurrent does not help either. When I use iOS remote it becomes current controller and when I start using Siri remote and press button it does not become current controller. GCController.physicalInputProfile does not help either. It is as if iOS remote while being connected to tvOS has higher priority over Siri remote. Why don't I receive current controller change when pressing button on Siri remote? When pressing the button on Siri remote and receiving event, it comes from handler with GCController.microGamepad.elements.count == 10, instead of 17, so although I'm pressing button on Siri remote I'm getting events as if I pressed button on old remote (or iOS remote which is handled as old Siri remote). Even button.controller instance is wrong and holds a reference to iOS remote instead of the correct new Siri remote. I tried to look at button.aliases to see if I find "Cardinal Direction", which would hint at arrow press on new controller, but it does not contain this type of alias. I'm trying to find some hack for detection of currently used Siri remote, but without any success. It looks like somewhere in the core the GCController converts button presses to more generic events making the button presses anonymous (losing hardware info). But clearly the low level code must see from which controller the button press came. Any idea if there is a way of detecting from which remote controller the button press came?
0
0
670
Feb ’24
DS4macOS Compiled Things Partially and Run But it Has 30+ Yellow Warnings & Doesn't Show the Setting
Hi Apple and Swift friends. I'm not really a fluent Swift programmer (or any language) just knowledgable, I just a vague logic of what's going on. This is a gamepad controller remapper similar to DS4Windows on the PC and DSX on Steam gaming. On macOS Sonoma, it successfully compiled and connected the amazing Sony Playstation DualSense but because it has 33 yellow warning, the Setting doesn't show. It says something about outdated something and needs to be replaced by a newer framework.network. It also says it can't use self: It should look like these: What could be the syntax changes that won't produce the 30+ yellow warnings? The file can be had here: [https://github.com/marcowindt/ds4macos) God bless.
0
0
617
Feb ’24
GCSystemGestureStateDisabled is now working on macOS 14.2
I am using GCSystemGestureStateDisabled to suppress home button being capture by gesture recognizer so the system menu is not triggered while my app is using the gamepad. It was working well on macOS 14.1 but stop working after I migrated to 14.2. boundToSystemGesture is still showing "Yes" after button.preferredSystemGestureState = GCSystemGestureStateDisabled is assigned. Is it possible some change was introduced on 14.2 causing the issue?
1
0
566
Dec ’23
Bluetooth Low Energy HID Gamepad PnP not accepted by iOS devices
Dear support We are developing a Bluetooth Low Energy HID Gamepad and are having issues connecting it to iOS devices (iPhone). Pairing is always successful. The issue is related to the PnP ID used. If we use a PnP ID for a gamepad currently on the market - like a Google Stadia - there is no issue. The Gamepad connects (pairs) with the iPhone and is recognised in the iPhone "settings->general->game controller" Also if a "Game Controller Tester" APP is installed on the iPhone this works ok. If we use our own PnP the Gamepad connects (pairs) but iPhone does not recognise it in "settings->general->game controller" . Also the "Game Controller Tester" APP does not work. The question is :- Is there something we need to do with our own PnP for it to be recognised by iOS devices. For info - on Android and Windows our PnP is recognised ok - we can control a Game Controller APP with it. The issue is only with Apple iOS devices. Any help would be welcome. Thanks JESP
4
0
857
Nov ’23
Game Controller Framework for visionOS Apps
Hi, I was working on implementation of game controller input to my game. I've connected my Xbox controller and tried to do a test and it is working in an macOS application. I wanted to port it to my visionOS app but the app can't seem to recognize my gamepad inputs. But visionOS simulator can recognize because it is changing camera by gamepad input. According to documentation GCController functions supports visionOS. Do the apps directly supports GC input? Or do I make mistake in my code? Thanks
2
0
783
Oct ’23
[GPTK] Unity game controller support
While my GPTK setup works fine with games like Rocket League, any Unity made game will freeze when a joystick input is given. I've tested this with 'Zeepkist' and 'Engine Evolution 2021', both have full steam controller support enabled. If I run the GPTK game in foreground, right after moving the joystick, this error is logged: 0bac:fixme:rawinput:rawinput_from_hardware_message Unhandled rawinput type 0x100 This only happens when Steam is running. For example, running the 'Zeepkist' .exe manually while Steam is NOT RUNNING, the controller works fine! Most of the time this results in a crash throwing: 0bbc:fixme:dbghelp:SymLoadModuleExW Unsupported Flags 00000005 for (null) 0bbc:fixme:dbghelp:SymLoadModuleExW Unsupported Flags 00000005 for (null) 0bbc:fixme:dbghelp:SymRegisterFunctionEntryCallback64 (0000000000000084 0000000140036E50 2508e0): stub! wine: Unhandled page fault on read access to 0000001BFFFFFFE4 at address 000000006E73B991 (thread 0bac), starting debugger... 0bbc:fixme:file:CancelSynchronousIo (000000000000007C): stub 0810:fixme:imm:ImeSetActiveContext (0x36ed10, 1): stub 0810:fixme:imm:ImmReleaseContext (000000000009020A, 000000000036ED10): stub I would love to play Unity games using GPTK. Please suggest any tips/tricks to resolve this issue.
0
0
833
Oct ’23