VOGONS


Write Dosbox.conf

Topic actions

First post, by Pickle

User metadata
Rank Member
Rank
Member

First off I dont know of this has ever come up before, sorry if it has.

Has anyone thought to add a option to update the dosbox.conf from within dosbox itself? I now such an option is really demanding on a full PC install, but it would be helpful and a time saver to keyboardless devices.

Im not expecting all the options to be updated, just the big ones cycles and frame skip.

Reply 4 of 20, by Pickle

User metadata
Rank Member
Rank
Member

I see a couple issues with using it.
Typing all of that out with no kb. Maybe creating a mapper action item to run this command would be possible.
Can only be run in dos prompt, unless the option above would work at any point.
Also where does it update, where the existing dosbox.conf is or where the dosbox binary is? In my case I have a dosbox.conf for every game and its in the game folder (i.e /dosbox/mygame/dosbox.conf)

Reply 5 of 20, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

for cycles and such.. I don't know if it catches the cycles changed with ctrl-f11, but stuff changed with the
config -set "cpu cycles=xx"
should be written out on a config -wc dosbox.conf

Water flows down the stream
How to ask questions the smart way!

Reply 6 of 20, by Pickle

User metadata
Rank Member
Rank
Member

Still the same problem with no ability to type that command in and also if i could it wouldnt work while in game.
I am also using the mapper items what you refered to Ctrl-F11 so there would be another problem.

Reply 7 of 20, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

well I could code support for CTRL-f11 to update the internal configuration structure.

For writing out the configfile on a keycombo you have to code that yourself.
I think it will be ~10 lines of code (Add a mapper handler. 1 line. Code the mapper handler so it writes the configfile out (4 lines ?) (the write function can be found in config.com) )

Water flows down the stream
How to ask questions the smart way!

Reply 9 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

No, you misunderstand. What Qbix means is it takes 4 lines to write a mapper handler that writes the configfile.

The config.com writes out the entire file, but that includes the present settings so it doesn't matter. Don't get hung up on just changing a part of the existing file. It's difficult and unnecessary. That's not what you need, just what you think you need.

My site: Ramblings on mostly tech stuff.

Reply 10 of 20, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Pickle - what is the problem you are trying to solve here? When and why would you need to update the config-file from within DOSBox?

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 11 of 20, by Pickle

User metadata
Rank Member
Rank
Member

I am trying to save some time.

The process for getting games up and running on the GP2X basically involves popping the sd card in and out each time you want to change a setting. The main changes are with cycles and frame skip. Those can be adjusted in game but if want to permanantly save them, you have to pop the card out, find a pc and edit it. I think it would be useful to just hit a button combination and have it autoically write the values back to the file.

Reply 12 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

Yes, and to do that, you should just write the current settings to the file (if you can't call config.com -writeconf directly, then you can do as Qbix suggested and add your own handler for that same code).

My site: Ramblings on mostly tech stuff.

Reply 14 of 20, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Pickle - you do know that DOSBox (since 0.70 I think), supports loading multiple configuration files, where each file overrides the previous files settings?

So you could have a "base" configuration, and then 4 different files with different cycle settings in, and 2 files with frameskip settings.

E.g. if you had a file called "cycles3000.conf" and one called "fskip3.conf" you can launch DOSBox like this:

dosbox -conf "base.conf" -conf "cycles3000.conf" -conf "fskip3.conf"

The cycle- and skip-files only need to contain the absolute minimum of lines to set the values. E.g.

[cpu]
cycles=3000

and

[render]
frameskip=3

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 15 of 20, by Pickle

User metadata
Rank Member
Rank
Member

Ok I having it working. I made the mapper item that triggers a function that opens the dosbox.conf and overwrites the cycles and frameskip lines in game.
Im using the GFX_SetTitle to get the cycles and frameskip to pass to my write to file function.
Works pretty well I have one minor bug to fix ( if i go from 1000 to 500 i would end with 5000, so i just need to get rid of the extra characters)

Reply 16 of 20, by Pickle

User metadata
Rank Member
Rank
Member

Fixed the last problem by just forcing a 4 character width so if I go from 1000 cycles to 500 i will get cycles= 500 instead of cycles=5000. It should be good enough we dont ever need to go above 9999.

Thanks for the ideas, this feature is pretty nice.

Reply 17 of 20, by Kippesoep

User metadata
Rank Oldbie
Rank
Oldbie

I still think you're doing it in a very, very, very bad way. Think about what happens when you simply use the writeconf method that's in DOSBox:

  • DOSBox loads its own configuration file.
  • You change settings and trigger DOSBox own configuration writing code.
  • DOSBox writes its own configuration file.

Since the only thing changed are the settings you want to change, the end result is that only those are changed in the config file. Yes, behind the scenes it's been written from the start, but that doesn't matter.

Doing it that way will ensure that it keeps working even if DOSBox' config format changes (and in fact, the cycles line is one of those that has changed in the current CVS version) and works even if the cycles change from 100 to 100000 (yes, I have certain configs where it's set to 100000 cycles).

You're making things *way* too difficult on yourself and introducing too many opportunities for errors.

My site: Ramblings on mostly tech stuff.

Reply 18 of 20, by Pickle

User metadata
Rank Member
Rank
Member

yeah your right, Im going to need some help calling the correct code.
I see the CONFIG class with one method RUN.
Is there an instance of this vglobally available somewhere? Or should I delare my own?

Reply 19 of 20, by Pickle

User metadata
Rank Member
Rank
Member

Im not getting anywhere with running config.com internally.
But Qbix I dont know if you meant to do this from the beginning. It just dawned on me that I can put your first command suggestion into the autoexec section after the game exe runs. Ive tried it and it does update the correct dosbox.conf file, but as you expected the cycles and frameskip are not updated by the shortcut keys.

Qbix: can you point me in the direction to update the cycles and frameskip so that are written to file?