Skip to content

[Port Request] WinRT (aka UWP) support #408

Open
MoeMod opened this issue Sep 23, 2018 · 12 comments
Open

[Port Request] WinRT (aka UWP) support #408

MoeMod opened this issue Sep 23, 2018 · 12 comments

Comments

@MoeMod
Copy link
Contributor

MoeMod commented Sep 23, 2018

Nowadays Windows Tablets become popular, such as Surface lineup.
However most of them are packaged with Windows 10 S where win32 app is not recommended, so UWP apps are preferred.

Possible solutions

  1. filesystem: SDL_WinRTGetFSPathUTF8 that returns somewhere in AppData
  2. library loader: LoadPackagedLibrary
  3. video: Angle project (https://github.com/Microsoft/angle) that are supported by SDL2
  4. network: winsock2 (only need to change header)

Problems up to now

However, I had a hard time debugging SDL2 video initialization... so that the engine cannot be loaded.

@MoeMod
Copy link
Contributor Author

MoeMod commented Sep 23, 2018

The half-made VS project can be found on https://github.com/MoeMod/xash3d/tree/winrt-port

Additional files needed:

  1. SDL source code
  2. Angle binaries (libEGL.dll, libGLESv2.dll)

Notes:

  • The GL initialization fails... hope someone can fix it
  • Win32 .dll binaries are not supported. All binaries should be compiled under WinRT (Windows Store App Support).

@mittorn
Copy link
Member

mittorn commented Sep 24, 2018

What about library loading? Is LoadLibrary availiable in UWP?
You need gl-wes-v2 to make GL it work with angle. It already used in WebGL port. And of cause adapt it for UWP, where libraries loaded (i think) different way

@MoeMod
Copy link
Contributor Author

MoeMod commented Sep 24, 2018

Libraries need to be compiled under WinRT. And then replace LoadLibrary by LoadPackagedLibrary.

@MoeMod
Copy link
Contributor Author

MoeMod commented Sep 24, 2018

In additional, WinRT projects only provides unicode APIs, so LoadPackagedLibrary accepts wchar_t * library path and needs some encodings.
This should work:
https://github.com/MoeMod/xash3d/blob/winrt-port/engine/common/library.c

@mittorn
Copy link
Member

mittorn commented Sep 24, 2018

And how to load angle? We need to patch gl-wes-v2 to work on winrt and use angle

@MoeMod
Copy link
Contributor Author

MoeMod commented Sep 25, 2018

seems that angle (libEGL.dll, libGLESv2.dll) will be loaded by SDL2-UWP.

@MoeMod
Copy link
Contributor Author

MoeMod commented Sep 25, 2018

In my latest test, the engine fails when SDL_CreateWindow returns nullptr.

@a1batross
Copy link
Member

You should try to run Xash Dedicated Server at least. If it runs well, then filesystem at least is ported correctly.

Don't know about UWP support state in SDL2, but looks like it abstracts graphics for us, so we can just create GLES2 context. You need only define XASH_GLES and XASH_WES and compile in gl-wes-v2 source code.

@mittorn
Copy link
Member

mittorn commented Sep 26, 2018

gl-wes-v2 already works with SDL2. Just define XASH_SDL in it. And maybe some changes needed to build it on windows. I not tested it on win32.

@a1batross
Copy link
Member

Yeah, I tried gl-wes-v2 before on Linux. Worked flawlessly!
Sadly, using our forks of nanogl or gl-wes-v2 isn't intuitive enough. You need to clone repository with source and add them to engine build process, so compiler flags will be same.

@HeadClot
Copy link

Hey - Has there been any further progress made on this?

@a1batross
Copy link
Member

Never heard that anyone is ported engine to UWP.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants