Mednafen Members Members   Search Search   Help Help   Register Register   Login Login   Home Home
Home » Mednafen » General » Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command line?
Show: Today's Messages  :: Show Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command line? [message #6873] Tue, 11 April 2023 05:41 Go to next message
Lollie  [PM]
I've been using Mednafen with a VR headset to play Virtual Boy games in 3D, so I've set up a batch file for launching Virtual Boy games via drag-and-drop. Since there's currently no way to manually load custom config files (as far as I can tell, at least - I couldn't find anything in the documentation), this batch file passes settings manually via command line arguments:

%~dp0mednafen -vb.3dmode sidebyside -vb.sidebyside.separation 43 -vb.stretch 0 -vb.xscalefs 3 -vb.yscalefs 6 -video.fs 1 %1


However, it seems that Mednafen takes these arguments and updates mednafen.cfg with them. It makes the whole point of passing settings via command line kind of useless, and a real pain.

I'm currently working around this issue by backing up the config to a backup folder ("cfgbak") before running Mednafen, and then restoring the config file after I'm done playing, like so:

copy %~dp0mednafen.cfg %~dp0cfgbak
%~dp0mednafen -vb.3dmode sidebyside -vb.sidebyside.separation 43 -vb.stretch 0 -vb.xscalefs 3 -vb.yscalefs 6 -video.fs 1 %1
pause
copy %~dp0cfgbak\mednafen.cfg %~dp0


That said, there's a few solutions that would make this a lot better.
  1. Allow for config files to be manually loaded via command line.
  2. Prevent Mednafen from updating mednafen.cfg with settings that have been passed through via command line.
  3. Add a setting to enable or disable Mednafen's ability to automatically update mednafen.cfg upon closing.(This would probably necessitate a prompt to confirm whether to save settings upon closing.)
Re: Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command lin [message #6874 is a reply to message #6873 ] Tue, 11 April 2023 14:03 Go to previous messageGo to next message
AmatCoder  [PM]
Quote:

[...] Since there's currently no way to manually load custom config files (as far as I can tell, at least - I couldn't find anything in the documentation) [...]


Not manually load but per-system override configuration is possible.

Just create a file named vb.cfg with your settings. This allows to override mednafen.cfg and it will not be written by Mednafen.
See documentation.

Quote:

[...] I'm currently working around this issue by backing up the config to a backup folder ("cfgbak") before running Mednafen, and then restoring the config file after I'm done playing [...]


I don't use Windows but... isn't it easier to set mednafen.cfg file as read-only?

[Updated on: Tue, 11 April 2023 14:06]

Re: Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command lin [message #6875 is a reply to message #6874 ] Wed, 12 April 2023 06:31 Go to previous messageGo to next message
Lollie  [PM]
AmatCoder wrote on Tue, 11 April 2023 14:03

Quote:

[...] Since there's currently no way to manually load custom config files (as far as I can tell, at least - I couldn't find anything in the documentation) [...]


Not manually load but per-system override configuration is possible.

Just create a file named vb.cfg with your settings. This allows to override mednafen.cfg and it will not be written by Mednafen.
See documentation.

I did see this, but unfortunately it doesn't fit my needs. I only need these custom settings for VR play, I have a different set of settings for normal use. And it turns out, using "vb.cfg" causes it to override any settings that I try to pass as command line arguments.

AmatCoder wrote on Tue, 11 April 2023 14:03

Quote:

[...] I'm currently working around this issue by backing up the config to a backup folder ("cfgbak") before running Mednafen, and then restoring the config file after I'm done playing [...]


I don't use Windows but... isn't it easier to set mednafen.cfg file as read-only?


You'd think so, but no! This was the first thing I tried, and for whatever reason, Mednafen throws this error:
Failed to load settings from "mednafen.cfg": Error opening file "mednafen.cfg": Permission denied

[Updated on: Wed, 12 April 2023 20:10]

Re: Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command lin [message #6876 is a reply to message #6873 ] Wed, 12 April 2023 09:14 Go to previous messageGo to next message
Speedvicio  [PM]
the suggestion of Amatcoder by using a per-console config is your solution.
The per-console config do not touch your mednafen config.
mednafen gives priority to per-game config, per-console config and at the and to main mednafen config.

You need to create a vb.cfg and put this into it:

vb.3dmode sidebyside
vb.sidebyside.separation 43
vb.stretch 0
vb.xscalefs 3
vb.yscalefs 6
video.fs 1

All parameters not listed on custom config will be read from main mednafen.cfg.

[Updated on: Wed, 12 April 2023 09:16]

Re: Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command lin [message #6877 is a reply to message #6873 ] Wed, 12 April 2023 10:02 Go to previous messageGo to next message
AmatCoder  [PM]
It seems that Lollie wants to play the same game with two different settings (one regular, other with VR headset) so a per-system or per-game config is not useful there. Additionally:

Quote:


[...] Mednafen throws this error:
Failed to load settings from "mednafen.cfg": Error opening file "mednafen.cfg": Permission denied




True Embarassed . This was changed on 1.27.x version. From changelog:

-- 1.27.0-UNSTABLE: --
[...]
Open the main settings file for both reading+writing on startup instead of just reading, 
to allow file locking to work over NFS, and as a quick check to make sure the file 
is writeable before it's too late upon exit.


So you are doomed to use a batch file or two instances of Mednafen in separate folders.

[Updated on: Wed, 12 April 2023 10:06]

Re: Any better way to stop Mednafen from updating mednafen.cfg when passing settings via command lin [message #6878 is a reply to message #6877 ] Wed, 12 April 2023 20:09 Go to previous message
Lollie  [PM]
AmatCoder wrote on Wed, 12 April 2023 10:02

True Embarassed . This was changed on 1.27.x version. From changelog:

-- 1.27.0-UNSTABLE: --
[...]
Open the main settings file for both reading+writing on startup instead of just reading, 
to allow file locking to work over NFS, and as a quick check to make sure the file 
is writeable before it's too late upon exit.


So you are doomed to use a batch file or two instances of Mednafen in separate folders.


Hah, good spotting, so read-only would've worked a few versions ago. Oh well, relying on a batch file isn't the end of the world, what I've set up is working for me. I was mostly curious to see if there was something I was overlooking!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic:New Version Planned?
Next Topic:Saturn debugging on mednafen
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ ]

Current Time: Sun May 12 07:02:25 CDT 2024
.:: Contact :: Home ::.

Powered by FUDforum.
Copyright © FUDforum Bulletin Board Software