Handmade Hero»Forums»Code
3 posts
Virtualbox Windows 10 XBox One Gamepad Not Working
Edited by apankow on
Hey everyone,


I have scoured the internets and have not figured out how to fix my problem... and maybe because I'm over-complicating the issue.

Following along until Handmade Hero Day 06...

I use a Windows 10 VM (VirtualBox) on a Linux (Ubuntu 16.04) Host with a wired XBox One gamepad. In my native Linux, the gamepad shows up in every place it's supposed to. VirtualBox registers my gamepad is connected and shows it to me in my devices list but the Virtual Windows refuses to see it. When I plug the gamepad into a native Windows machine, the gamepad shows up as expected and works perfectly with Handmade 'Moving-Gradients'.

I have tried this on AMD, i7, and dual Xeon Linux machines running Windows 10 in VirtualBox but the hardware doesn't seem to be the issue. And since it runs flawlessly on a native Windows computer, it doesn't seem to be the code.


(The native windows machine isn't always available to me so I cannot just use that one, unfortunately)
What am I doing wrong? Or what do I need to do?
Simon Anciaux
1341 posts
Virtualbox Windows 10 XBox One Gamepad Not Working
I don't know much about virtual machine but sometimes you need to install guest or host extensions to be able to use some devices.

Did you try to step in Win32LoadXInput in the debugger to see if everything is working as expected ?
3 posts
Virtualbox Windows 10 XBox One Gamepad Not Working
I've installed all of the necessary extensions and additions; the gamepad does show up as a ready-device as far as the VirtualBox guest is concerned... it's just that the Windows OS on that VirtualBox doesn't see it.

Keyboard
* Win10 = SUCCESS
* Linux = SUCCESS
* Linux WINE = SUCCESS
* Handmade Code + Win10 = SUCCESS
* Handmade Code + VirtualBox running Win10 = SUCCESS
* Handmade Code + Linux WINE = SUCCESS

XBox One Gamepad
* Win10 = SUCCESS
* Linux = SUCCESS
* Handmade Code + Win10 = SUCCESS
* Handmade Code + VirtualBox running Win10 = null
* Handmade Code + Linux WINE = null

The Debugger shows no issue and the app does compile and run on the VM (but just won't use the gamepad). When I press buttons or move the sticks, the VM shows me that it's being triggered in the little USB icon in the bottom of the VM window. When I copy/paste that exact .exe (without recompiling even) to a native Windows machine, it runs flawlessly and accepts the gamepad.

This seems like I just missed a very subtle configuration step but I'm only having this issue with the gamepad. The keyboard input works just fine (even in WINE outside of the VM). The buffers, rendering, and windowing all work just fine inside the VM or under WINE.
Mārtiņš Možeiko
2562 posts / 2 projects
Virtualbox Windows 10 XBox One Gamepad Not Working
Maybe small offtopic - if you are running on Linux host, I suggest trying out QEMU. I find it more performant and stable. As a bonus if you have multiple GPUs you can do GPU passthrough for full hw acceleration in guest. With latest Intel ones you can actually share GPU between host and guest - GVT-g (haven't tried this yet).
3 posts
Virtualbox Windows 10 XBox One Gamepad Not Working
I will definitely look into QEMU.

I don't have a system performance issue (yet); my CPUs are plenty fast, I have top-of-the-line GPUs, and plenty of RAM (32GB/workstation, 12GB/laptop)... I mostly do simulation and offline-rendering so power is necessary.

If anyone else can help with the VirtualBox issue, I'd still be very grateful. And maybe it's not a VBox issue at all since WINE doesn't like the Gamepad either.