ufoaiorg / ufoai

UFO:Alien Invasion
http://ufoai.org
GNU General Public License v2.0
148 stars 51 forks source link

Strange order of config.cfg write #42

Closed nick87720z closed 1 month ago

nick87720z commented 6 years ago

ufoai trunk was compiled at 24.10.2017. But still exists. The begining is that i tried to write custom resolution (1600x900) to config.cfg, since it is not in menu. However, on game restart it is overwritten to previous value (for now the closest resolution i can have without truncation is 1440x900, with disabled stretching).

Today i tried first time to track, how config.cfg changes during ufo run.

Monitoring file: ~/.ufoai/2.6-dev/base/config.cfg Initial resolution (after previous attempts): 1152x864 (both was selected in game, now written in config.cfg)

  1. Starting ufo, config.cfg is unchanged
  2. In settings - choosing another resolution, 1440x900. Log message: "Modified render related cvars"
  3. Pressing ok, ok and exiting game. It tells in log, that wrote config.cfg and keys.cfg. config.cfg modification time is increased, but only from first look. Looking into that file, i get resolution properties with old values: set vid_width "1152" a set vid_height "864" a
  4. Starting game again. From log: I: try to get display with 1440x900 Game settings show this resolution, which was selected earlier. but... config.cfg is unchanged, and still has: set vid_width "1152" a set vid_height "864" a
  5. Closing game. config.cfg is changed, and now has resolution according to settings: set vid_height "900" a set vid_width "1440" a

It seems, that it stores resolution somewhere else, but i failed to find it even with strace.

$ strace -e trace=open ufo 2>&1 | cat > ~/ufo-ai-strace
$ cat ~/ufo-ai-strace | grep WR
open("/home/nick87720z/.ufoai/2.6-dev/base/ufoconsole.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 14
open("/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2/uevent", O_RDONLY|O_CLOEXEC) = 26
open("/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2/event2/uevent", O_RDONLY|O_CLOEXEC) = 26
open("/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2/uevent", O_RDONLY|O_CLOEXEC) = 26
open("/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input2/event2/uevent", O_RDONLY|O_CLOEXEC) = 26
open("/home/nick87720z/.ufoai/2.6-dev/base/config.cfg", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 26
open("/home/nick87720z/.ufoai/2.6-dev/base/history", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 26
open("/home/nick87720z/.ufoai/2.6-dev/base/keys.cfg", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 26

Other written files don't have new resolution values.

Probably not only resolution is affected, there is report at forum, made with point to discuss before to report at bugtracker: https://ufoai.org/forum/index.php/topic,9131.0.html

DarkRainX commented 6 years ago

Hi, when you choose the resolution from within the game it will set the console variable vid_mode to the selected video mode, when that happens the game will ignore both vid_height and vid_width (even if it updates them when saving config.cfg) if you want to use a custom resolution set vid_mode to -1 to tell the game to not use any of the default modes then set vid_height and vid_width to the desired values

nick87720z commented 6 years ago

Thanks, this helped. That variable is in config file, though i would never notice it without hint) (may be only occasionally doing diff for old/new configs).

DarthMoulByte commented 6 years ago

@DarkRainX can you help me?? who i need contact to register in the forum ? chrome_2018-04-26_14-40-54