Open heavyrain266 opened 2 years ago
Could you provide some more information about the platform? How is it supported by Rust (target info), links to how to use it in practice (cargo
tools), example of how the user would use it, does it work with graphics libraries like wgpu
?
It's pretty much modified Windows based on the same win32 API (used to be UWP), it doesn't require compiler port unlike Switch or PlayStation 5. What you need is, generated target JSON file.
Input is a bit different story. We will have to introduce gamepad support using standard xinput from Windows APIs
From the tests, works perfectly fine with wgpu
's DX12 renderer except rare cases where winapi
links random DLLs which are unsupported there but they have plans for windows-rs
switch in d3d12-rs
crate. What you need to create the window is to disable GDI
feature in windows-rs
then remove related functions and use something different from same library.
Hmm, we've long been working on a rewrite of the keyboard event handling, so maybe see the probably a bit outdated branch new-keyboard
and/or the two keyboard/gamepad issues https://github.com/rust-windowing/winit/issues/1806 and https://github.com/rust-windowing/winit/issues/944, perhaps the problem is already solved by those?
Whether or not that is the case, we could probably accept code to support it. It sounds like there is a lot of duplication with the normal Windows platform, and that this is a rather niche use-case, so perhaps it would be better to have it as a cargo feature?
If compiler licensing team will agree on adding it as new target then it will be much easier than cargo feature. For now I have to dig more into getting device context because using plain win32 for xbox is wild guessing and testing since it's not documented. Microsoft only provides documented GDKX wrapper which is pre-compiled and window creation is single call in main function.
For the time being, I will look into introducing gamepad support through xinput.
Added simple gamepad API and it seems to work on xbox series devkit, but here is simple problem. For some reason, windows-rs have two different ways to provide gamepad support 🤦🏼♂️
One of them is, "Windows Gaming Input" windows::Game::Input
(WGI) and second is plain Xinput and I'm confused about which one should be added.
Did some research on gamepad support on Windows and there are literally five different input libraries which can handle it... DirectInput (from 95 era), Xinput, Rawinput, Windows Gaming Input (WinRT) and GameInput (GDK). Last two ones seems to be prefered by Microsoft, while all the previous are deprecated, you can still use because of backwards compatibility.
EDIT: Last two ones also requires focused window to work, unlike others
@madsmtm There are some implementation details for gamepad support which should discuss. It will be HUGE change, WGI (Windows Gaming Input) will provide a lot of new features under e.g. xbox
feature. For example everything in Gamepad
class depends on focused window, it includes vibration control, fetching users connected to each gamepad and many more non-input oriented stuff which must be implemented in winit for proper xbox support.
@heavyrain266 hello there, appreciate your Xbox research efforts! Are there any updates on this topic? I am trying to run at least a simple rust UWP app on Xbox Series S and no luck so far.. The app runs on Windows though.
I'm not working on anything related anymore nor have devkit access, can't help you unfortunatelly.
After series of tests on console's devkit made by friend's studio, It's mainly possible to upstream Xbox as the new supported platform (NO CI)
Implementation is simple, mostly copy-paste windows code under
xbox
module which requires disabling GDI support in windows-rs and removal of related functions and some other stuff.NOTE: I cannot create Pull Request at the moment because I'm waiting for private devkit for my studio @eukaryote-interactive.