updating graphics settings without winecfg GUI

Questions about Wine on Linux
Locked
sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

updating graphics settings without winecfg GUI

Post by sponsor61 »

Can winecfg graphics options be changed from a script, without manually clicking in the winecfg GUI? Thanks!

Background:

I have the 1998 game Mig Alley running under wine, but the only problem is that the winecfg settings that work for 2D mode don't work for 3D mode, and visa versa. Whenever I switch modes I have to save the game, exit, change graphics settings in winecfg, start the game and then load the saved game. This repetative task would be easier if I could run a cli script to change the winecfg graphics settings rather than picking options from the winecfg GUI every time.

Here's some more detail: I've gotten the 1998 game Mig Alley running almost perfectly under wine. This game has two parts, a 2D board game about war strategy and a 3D flight simulator. Gameplay involves setting up a mission on the 2D screen by manipulating icons and work with pop-up windows, then switching to the 3D world to fly a mission.

Here's the problem: 3D mode doesn't display correctly unless either virtual desktop is enabled, or virtual desktop and window manager controls windows are both disabled. Many icons disappear or become invisible in 2D mode if window manager controls windows is disabled or if virtual desktop is enabled.
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: updating graphics settings without winecfg GUI

Post by spoon0042 »

This should work, I think, with a little work. winecfg settings are all stored in the registry, so...

If you haven't yet, in winecfg click "Add application" and find the exe for the game.

With the game selected click the Graphics tab and set it to what works for 2D.

Exit winecfg, open regedit, and find HKEY_CURRENT_USER\Software\Wine\AppDefaults

You should see the exe name there, right click it and select Export. "Selected branch" should be set, save it as something like 'mig2d.reg'.

Exit regedit, open winecfg, select the name, Graphics again and then set it for 3D.

Then regedit one more time, saving as like 'mig3d.reg' this time.

Now you have two .reg files and should be able to just run 'regedit mig2d.reg' to set 2D mode or the other for 3D.

You could even write a script that either checks or keeps track somehow of which was last run then do the other.

And you could always file a bug, may not go anywhere but it's worth a shot. :)
sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

Re: updating graphics settings without winecfg GUI

Post by sponsor61 »

This command succeeds: regedit mig3d.reg
This command has no effect: regedit mig2d.reg

For the 3D mode, virtual desktop must be turned on. For 2D mode virtual desktop must be turned off. That's the only difference between the 2D and 3D winecfg settings. It seems this method can turn on virtual desktop on if it's off, but it cannot turn off virtual desktop when it's on. Do you see a way to fix this?

Thanks!
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: updating graphics settings without winecfg GUI

Post by spoon0042 »

ok, yeah I didn't realize that you'd need to delete a key to disable virtual desktop. If that's the case then instead of the reg file for 2D mode you'd want to run: regedit /D "HKEY_CURRENT_USER\Software\Wine\AppDefaults\exe_name_here\Explorer"

I think. Seemed to do what I expected here anyway. :)

...

Just occurred to me to look at what winetricks does, which would seem to be "Desktop"=- in the 2D reg file. Another option I guess. Yet another would be just using winetricks if you have a dedicated wineprefix for the game so you don't care about it affecting anything else. 'winetricks vd=off' and 'winetricks vd=640x480' or whatever.
sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

Re: updating graphics settings without winecfg GUI

Post by sponsor61 »

Success! Alternating between

winetricks vd=off

and

winetricks vd=1280x1024

worked.

Two more questions:

1. I have a corner case in which the user enters the 3D view from the 2D view to recon a potential target area. With virtual desktop on, this causes the game to freeze. Is there a way in a script to start the game under wine and then kill the wine process after, e.g. 60 seconds? Something using the "sleep" command, perhaps?

2. The reason I need a virtual desktop in the first place is the following: without it, in the 3D view a black window is placed over the lower right part of the screen. On the top and right you can see the correct 3D screen, though it's mostly blocked from view. Is there anything else I could try, other than virtual desktop, to remove this black box the occludes most of the 3D view?
sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

Re: updating graphics settings without winecfg GUI

Post by sponsor61 »

The correct 3D view is on the top and left, not the top and right as I wrote above.

I am using wine 5.0 on Ubuntu 20.04, with a five year old Intel i7 and geforce graphics card hardware
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: updating graphics settings without winecfg GUI

Post by spoon0042 »

re: 1 - You could do that if you wanted, sure. In a script something like

Code: Select all

export WINEPREFIX=whatever
BINDIR=/opt/wine-stable/bin #or devel or staging
$BINDIR/wine program.exe &
sleep 60
$BINDIR/wineserver -k
...which will kill any instance of wine running from that wineprefix after 60 seconds.

re: 2 - Can't really offer much help here. I know that old games can have odd behavior in wine. There are a couple test results in the appdb that mention the 2D problems. Only idea I have is to maybe look into a ddraw wrapper.
sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

Re: updating graphics settings without winecfg GUI

Post by sponsor61 »

Thanks, the 60 second script works great!

Another question: when I execute

winetricks vd=off

I see that winetricks ran regedit on a file it apparently created called c:\windows\Temp\vd.reg

But after the command executes, the Temp directory is empty. How can I save this vd.reg file that winetricks created?

winetricks vd=off

flashes the screen and takes several seconds to execute. I expect

regedit vd.reg

would be faster and do only what I need.
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: updating graphics settings without winecfg GUI

Post by spoon0042 »

You can copy them out of winetricks, in my copy they're in "load_vd()" starting at line 21365. May as well just post it, "vd=off" clears these two keys:

Code: Select all

REGEDIT4

[HKEY_CURRENT_USER\\Software\\Wine\\Explorer]
"Desktop"=-
[HKEY_CURRENT_USER\\Software\\Wine\\Explorer\\Desktops]
"Default"=-

sponsor61
Level 3
Level 3
Posts: 65
Joined: Tue Apr 07, 2020 10:05 pm

Re: updating graphics settings without winecfg GUI

Post by sponsor61 »

I don't know what you mean by "copy out of winetricks". Do you mean start regedit and look at the changes the winetricks command made in the registry?

Thanks to your help, I've got Mig Alley to gold or platinum wine compatibility status!
spoon0042
Level 6
Level 6
Posts: 572
Joined: Thu Dec 24, 2009 11:00 am

Re: updating graphics settings without winecfg GUI

Post by spoon0042 »

winetricks is a (very large) shell script, you can open it in any text editor (or 'less', etc). When it needs to change a registry setting it generates a file like the one above and runs regedit.

Glad I could help. :)
Locked