Jump to content

Set full-screen resolution on game start with -xres=.. -yres=... doesn't work?


Recommended Posts

I run my computer on a 4k display for browsing and working, but my integrated gpu is too weak to properly run 0 A.D. in 4k.

I've seen that there's a way to start the game with a custom resolution by passing the command line arguments -xres and -res, e.g. -xres=1920 -yres=1080 to run at 1920x1080.

But when I run 0ad with these arguments it seems to ignore them... Is that not possible anymore, or am I doing it wrong?

I'm using the snap version and my command is:

env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/0ad_0ad.desktop /snap/bin/0ad -xres=1920 -yres=1080 %F

I've also tried editing these arguments into the 0ad_0ad.desktop file, with no results. The game still works at 4k resolution.

Any ideas?
 

Link to comment
Share on other sites

changing the display resolution requires me to also change the scaling factor, which means I have to restart X, which is inconvenient. 

I'd greatly appreciate it if it were possible to run the game at fullscreen in a different resolution, without having to change the resolution of my whole system every time I want to play.

Link to comment
Share on other sites

55 minutes ago, cantfind said:

changing the display resolution requires me to also change the scaling factor, which means I have to restart X, which is inconvenient. 

I'd greatly appreciate it if it were possible to run the game at fullscreen in a different resolution, without having to change the resolution of my whole system every time I want to play.

Can you try to set bordeless.fullscreen=false in the config option?

EDIT: sorry not true, false.

Link to comment
Share on other sites

42 minutes ago, cantfind said:

changing the display resolution requires me to also change the scaling factor, which means I have to restart X, which is inconvenient. 

No need to restart X if you have the randr extension which you are almost guaranteed to have, just write a small script that sets mode, runs 0ad, resets mode. Then use that script to launch 0ad instead. Apart from some flickering when launching or closing 0ad there won't be any side effect.

 

14 hours ago, vladislavbelov said:

Not sure that it's true when borderless.fullscreen is false. Though not sure, if it's true it can be improved in A27.

Might also depend on wm/dm and sdl version, so not all that sure either that this is always true.

  • Thanks 1
Link to comment
Share on other sites

Just created the xrandr script, and it works great! thanks!

It's not the most user friendly experience, and I wonder what a Windows user would have done, though... 

Maybe consider adding a resolution picker to the advanced settings menu?

 

Edit: This seems to be an unreliable fix... sometimes it works, but sometimes it does weird things:

* the display lost signal - had to restart

* only a quarter of the display showed the 0ad screen, while the rest was black, mouse coordinates corresponded to the upper left qourter, but screen was on the lower left quarter - alt-tab twice resulted in a flickering upper left quarter and a non flickering lower left.

On all instances there was no sound (using hdmi, so the monitor is the speakers).

Edited by cantfind
Link to comment
Share on other sites

18 minutes ago, cantfind said:

Just created the xrandr script, and it works great! thanks!

It's not the most user friendly experience, and I wonder what a Windows user would have done, though... 

Maybe consider adding a resolution picker to the advanced settings menu?

Problem is the way the window is made hence why I suggested the bordeless.fullscreen=false in the config. If it's true the sdl doesn't let you set resolution

Link to comment
Share on other sites

I don't know why, but sometimes xrandr fails to change the resolution, sometimes xrandr stops the computer from outputing any signal, and every single time xrandr prevents sound from working... So the workaround with xrandr is not working all that well... I've filed bugs with xrandr.

 

What's wrong with using 

SDL_SetWindowDisplayMode

for changing the fullscreen resolution?

Link to comment
Share on other sites

On 09/10/2022 at 11:35 PM, cantfind said:

Edit: This seems to be an unreliable fix... sometimes it works, but sometimes it does weird things:

Works for me (tm).

If it only works sometimes maybe some sleep before launching 0ad might work. For sound maybe you use sound card by index in your config instead of identifier and some reordering happens?

Borderless fullscreen doesn't matter here either.

 

Link to comment
Share on other sites

I've tried adding sleep... It still doesn't work about half of the time... 

If I run it as a single line from the terminal, when I lose signal, I can rerun the command (arrow up and enter), and the signal comes back.

The error I get when the command fails is 

X Error of failed request:  BadMatch (invalid parameter attributes)
 Major opcode of failed request:  140 (RANDR)
 Minor opcode of failed request:  21 (RRSetCrtcConfig)
 Serial number of failed request:  31
 Current serial number in output stream:  31

As for the sound, I locked the profile in pavucontrol, but it still doesn't work - it says my HDMI is unplugged when in 1080, only when I return to 4k it sees it as plugged.

Interestingly, after recovering from losing the signal by running the same command a second time, I do get sound - but if it doesn't lose signal on the first time, running the command again doesn't restore the sound.

Something is very buggy - either in the intel drivers, my HDMI firmware, or xrandr. 
 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...