OpenAWE-Project / OpenAWE

A reimplementation of Remedy Entertainments Alan Wake Engine, in later iterations known as the Northlight Engine
GNU General Public License v3.0
159 stars 13 forks source link

Read and use resolution.xml #32

Open maaxxaam opened 1 year ago

maaxxaam commented 1 year ago

This PR's goal is to make OpenAWE read resolution.xml, which it currently only writes zeroes to, and use it to actually resize the window and make it fullscreen if specified. Also adds defaults for resolution.xml based of user's current video mode if file is absent.

This is a draft PR now because fullscreen scaling for lower resolutions is wrong (doesn't stretch to the full screen) and needs fixing before being useful. Windowed mode works fine:

Screenshot from 2023-05-29 00-27-16 Screenshot: OpenAWE running at 1280x720

Note: check if you have pre-existing resolution.xml before running. Most likely, it's filled with zeroes - change those to the desired resolution, or OpenAWE will crash.

maaxxaam commented 1 year ago

Thank you for your feedback. I hope to get to it soon enough.

I am currently working on a big update <..>. Do you want me to push this first or wait for your PR?

You should definitely go along with your plans. Unfortunately, I still don't have much time to work on this PR for personal reasons, so this might take a while.

maaxxaam commented 12 months ago

Alright, looks like this PR was able to withstand a rebase with a couple of merges. Good to know that's possible.

I managed to get down to the reason why fullscreen didn't scale properly for me: as it turns out, as of GLFW 3.3.8 fullscreen apps in Wayland use a system-wide resolution no matter what, meaning that calling glfwSetWindowSize() and alike while the window is in fullscreen mode does nothing. I've tried to remedy this by introducing scaling, but ran into some weird behavior: while GUI does seem to scale correctly, the world itself still tries to render with as much quality as possible.

Edit: here's an example of the behavior I'm talking about:

Screenshot ![image](https://github.com/OpenAWE-Project/OpenAWE/assets/65228215/8e7424e1-e900-493c-963f-b0d1353981cb)

Running OpenAWE on Wayland. `resolution.xml` is set to 640x360 fullscreen while the screen resolution is 1920x1080.

Also, I forgot to mention in the commit message that now configuration code treats 0x0 resolution (usually left by latest commits in the config) as unknown, which should be a touch better handling.