Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for Xbox Series X|S based on windows-rs #2506

Open
heavyrain266 opened this issue Sep 30, 2022 · 9 comments
Open

Provide support for Xbox Series X|S based on windows-rs #2506

heavyrain266 opened this issue Sep 30, 2022 · 9 comments

Comments

@heavyrain266
Copy link

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.

@heavyrain266 heavyrain266 changed the title Provide support Xbox Series X|S based on windows-rs Provide support for Xbox Series X|S based on windows-rs Sep 30, 2022
@madsmtm
Copy link
Member

madsmtm commented Sep 30, 2022

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?

@heavyrain266
Copy link
Author

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.

@madsmtm
Copy link
Member

madsmtm commented Oct 2, 2022

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 #1806 and #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?

@heavyrain266
Copy link
Author

heavyrain266 commented Oct 2, 2022

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.

@heavyrain266
Copy link
Author

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.

@heavyrain266
Copy link
Author

heavyrain266 commented Oct 17, 2022

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

@heavyrain266
Copy link
Author

@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.

@sokyrko
Copy link

sokyrko commented Oct 7, 2024

@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.

@heavyrain266
Copy link
Author

I'm not working on anything related anymore nor have devkit access, can't help you unfortunatelly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants