VOGONS

Common searches


First post, by RocknRollTim

User metadata
Rank Newbie
Rank
Newbie

Hi there,

How do you select a particular .cue or .iso file in DosBox after the commands below?

Z:>mount c c:\dosgames
Z:>imgmount d c:\images\image.cue c:\images\quake101.cue c:\images\rayedu_gb_1.cue c:\images\rayedu_gb_2.cue c:\images\rayedu_gb_3.cue c:\images\raygold.cue c:\images\raygold.iso c:\images\rayqui_gf.cue c:\images\tombeng.cue -t iso

quake101.cue = Quake
image.cue = Tomb Raider Unfinished Business
rayedu_gb_1.cue = Maths and English with Rayman Volume 1
rayedu_gb_2.cue = Maths and English with Rayman Volume 2
rayedu_gb_3.cue = Maths and English with Rayman Volume 3
raygold.cue = Original Rayman with music but can't install Rayman Gold and Rayman Designer in DosBox and only works in 32-bit versions of Windows
raygold.iso = Original Rayman without music but can't install Rayman Gold and Rayman Designer in DosBox and only works in 32-bit versions of Windows
rayqui_gf.cue = French with Rayman
tombeng.cue = Tomb Raider

All image files have been made from original CDs using ImgBurn with ISO9660 Joliet.

The only other plausible way I could think of choosing a mounted image file without having to come in and out of DosBox and to reprogram the same commands for C and D in order to use one image file at a time was to assign each image file with a separate virtual drive letter in which the code is mentioned below but found when launching games using the install.bat files, MSCDEX keeps saying to insert disc in D and to either press Esc to quit or to press Space to initiate the game in limited mode in which I have to press Alt + Tab to return back to the Desktop as I managed to break full screen mode by changing the screen resolution after the laptop went into screen saver mode.

Z:>mount c c:\dosgames
Z:>imgmount d c:\images\image.cue
Z:>imgmount e c:\images\quake101.cue
Z:>imgmount f c:\images\rayedu_gb_1.cue
Z:>imgmount g c:\images\rayedu_gb_2.cue
Z:>imgmount h c:\images\rayedu_gb_3.cue
Z:>imgmount i c:\images\raygold.cue
Z:>imgmount j c:\images\raygold.iso
Z:>imgmount k c:\images\rayqui_gf.cue
Z:>imgmount l c:\images\tombeng.cue -t iso

Lastly am I always not able to play the Rayman games using their executables in their designated folders or using their batch files out of their designated folders in which I have to keep going to the .cue or .iso file in order to run the install.bat for me to initiate each game, MSCDEX keeps saying specify a version when running from the executables whereas MSCDEX keeps saying to insert disc in D and to either press Esc to quit or to press Space to initiate the game in limited mode in which I have to press Alt + Tab to return back to the Desktop and to close the main DOS window in order to close DosBox.

C:\dosgames\EDUGB1\RAYEDU.EXE - doesn't work
C:\dosgames\EDUGB2\RAYEDU.EXE - doesn't work
C:\dosgames\EDUGB3\RAYEDU.EXE - doesn't work
C:\dosgames\QUAKE\QUAKE.EXE - works
C:\dosgames\QUIZGF\RAYQUI.EXE - doesn't work
C:\dosgames\RAYMAN.EXE - doesn't work
C:\dosgames\TOMBRAID\TOMB.EXE - works
C:\dosgames\TOMBRAID\TOMBUB.EXE - works
C:\dosgames\EDUGB1.BAT - doesn't work
C:\dosgames\EDUGB2.BAT - doesn't work
C:\dosgames\EDUGB3.BAT - doesn't work
C:\dosgames\QUIZGF.BAT - doesn't work
C:\dosgames\RAYMAN.BAT - doesn't work
C:\dosgames\TUBPATH.BAT - doesn't work but tells you to go to C:\TOMBRAID\TOMB.EXE

D:\install.bat - works for all Rayman education games and Tomb Raider even though this can be ran from C:\dosgames\TOMBRAID\TOMB.EXE
D:\Rayman\install.bat - works for Rayman
D:\instr.bat - works for Tomb Raider Unfinished Business even though this can be ran from C:\dosgames\TOMBRAID\TOMBUB.EXE
Can't use install.bat to launch Quake apart from install

Your help would be much appreciated and sorry for the long winded post.

Thanks,

RocknRollTim

Reply 1 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Don't force one dosbox setup for all games. Either use a frontend or create batch files for each game which imgmounts the correct iso then. You won't play them all at once 😉

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 2 of 26, by Rekrul

User metadata
Rank Member
Rank
Member

As Dominus says, make a separate DOSBox .CONF file for each game and then call it with a batch file.

For example;

Make a copy of your DOSBox.conf file and name it "DOSBox.TombRaider.conf". Edit this file to contain only the commands needed to run Tomb Raider. Now open Notepad (or the text editor of your choice) and add the following;

@echo off
start dosbox.exe -nogui -noconsole -conf DOSBox.TombRaider.conf

Save this with a name like "Play Tomb Raider.bat". The .BAT on the end is important. If it saves with the extension .TXT, rename it to .BAT. When you double-click it, it will call DOSBox with the specified .CONF file.

Note that you can also include the full path to DOSBox and the .CONF file, but if it includes spaces, you'll need to enclose it in quotes. For example;

@echo off
start "C:\Program Files\DOSBox\dosbox.exe" -nogui -noconsole -conf "C:\Program Files\DOSBox\DOSBox.TombRaider.conf"

If you want to get fancy, you can create simple menus in the DOSBox .CONF file, but as far as I know, you're limited to nine options. At least I don't know how to make a menu with more than Nine. You can make sub-menus though. You have one menu option that jumps to a second menu and so on. Each menu is limited to nine items, but you can have unlimited menus because each one is called via a name rather than just a number.

This is all done using standard DOS commands, for which you can find tutorials on the net. I can post some samples if you want...

Reply 3 of 26, by RocknRollTim

User metadata
Rank Newbie
Rank
Newbie

Hi Rektrul,

Thank you for your response as well as Dominus, I was going to ask him how to go about the batch route but as you have already answered my query I no longer need to ask, I was aware that there were DOSBOX Frontends such as D-Fend Reloaded, however when I compared DOSBOX with DOSBOX frontends I couldn't resist the compatibility it offered with other OSs other than Windows as I like experimenting with various OSs as well as various software programs, I also like the fact that DOSBOX is one of the best DOS emulators I have ever experimented with due to it's compatibility with DOS games plus it feels like using good old MSDOS again which I liked very much back in the days of Windows 95 and 98 but getting back to my thread though, if you could post me some more samples of .CONF files in order to get batch files for games to work with DOSBOX that would be much appreciated. Lastly I would like to say thank you for posting your .CONF files and for explaining how they work as I wouldn't have had a clue on how to go about compiling the .CONF files for DOSBOX.

Many thanks,

RocknRollTim

Reply 5 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Actually I wouldn't use specific conf files but add batch files to the dosgames folder you always mount as c...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 6 of 26, by RocknRollTim

User metadata
Rank Newbie
Rank
Newbie

Stiletto, sorry I posted another one of my threads in the wrong forum, I'll ensure to post it the right forum next time.

Dominus, please could you give me some examples on how write to batch files in order to initiate games in DOSBox using the dosgames folder, thanks.

RocknRollTim

Reply 7 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Basically the same as with confs.
A text file in c:/dosgames with the file ending bat, for example tomb.bat.
In the text file you have the commands for starting tombraider:
Imgmount d pathto/image.cue
C:
cd tomb
Tomb.exe

(Or similar, not exactly sure what to enter for starting tomb raider)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 8 of 26, by collector

User metadata
Rank l33t
Rank
l33t
"%ProgramFiles(x86)%\DOSBox 0.74\dosbox.exe" -conf dosbox.conf -noconsole

Adjust the path to match your needs

The Sierra Help Pages -- New Sierra Game Installers -- Sierra Game Patches -- New Non-Sierra Game Installers

Reply 9 of 26, by RocknRollTim

User metadata
Rank Newbie
Rank
Newbie

Thanks Dominus and collector, I'll try both of your suggestions as well as Rektrul's suggestion, I should have enough info to work for the time being, thank you for all your help.

Many thanks,

RocknRollTim

Reply 10 of 26, by Rekrul

User metadata
Rank Member
Rank
Member
Dominus wrote:

Actually I wouldn't use specific conf files but add batch files to the dosgames folder you always mount as c...

Using individual CONF files for each game keeps things neat while allowing you to set individual settings for each game.

Using a BAT file that runs DOSBox with the appropriate CONF file allows you to easily set up a shortcut to run each game automatically without having to type in the name of a separate BAT file from within DOSBox.

RocknRollTim wrote:

...if you could post me some more samples of .CONF files in order to get batch files for games to work with DOSBOX that would be much appreciated. Lastly I would like to say thank you for posting your .CONF files and for explaining how they work as I wouldn't have had a clue on how to go about compiling the .CONF files for DOSBOX.

I'm going to explain two different ways to set up DOSBox and some games. It's more work initially, but once you have everything set up, it makes running the games much easier.

Let's assume that you're starting from scratch. You install DOSBox and it goes into;

C:\Program Files\DOSBox 0.74\

You then create a directory in C: to hold your DOS games, like so;

C:\DOSGames\

Then, inside of that, you create a separate directory for each game that you want to install, like this;

C:\DOSGames\Screamer\
C:\DOSGames\TombRaider\

Etc.

Also make a directory called;

C:\DOSGames\Configs\

Run DOSBox and mount the directory for the game you want to install as C:. For example, if you wanted to install Tomb Raider, you would type;

mount c C:\DOSGames\TombRaider

The reason for mounting the "TombRaider" directory as C: rather than just making "DOSGames" the C: drive is that each game can have its own separate version of the C: drive and there's no chance that they will interfere with each other.

Once it's mounted, you would mount your CD drive and install the game as you normally would. Or you would mount the ISO file of your game and install from that. However you do it, it will install the game inside of the "TombRaider" directory.

When it finishes, you would switch to the C: drive by typing

C:

Then type;

CD TOMBRAID

To go into the Tomb Raider install directory, then type;

TOMB.EXE

To run the game. Assuming all is well, the game will run. Quit it. If necessary, run the setup file to configure the sound and such. It should be good with the defaults though. Close DOSBox.

Now you need to get a copy of the DOSBox CONF file. If you installed it under Windows, there should a shortcut in the Start menu Under DOSBox that says "DOSBox 0.74 Options". Select that and the CONF file should open in Notepad. If not, then when you run DOSBox, the location of the CONF file should be printed in the console window. You need to find that file and open it in an editor.

Scroll all the way to the end of the file. You will see a section that says;

[autoexec]
# Lines in this section will be run at startup.
# You can put your MOUNT lines here.

What you want to do here is to put all the commands needed to run the game. For example, let's say that you have an image copy of the CD in "c:\images\tombeng.cue" as you said. You would put;

mount c C:\DOSGames\TombRaider
imgmount D c:\images\tombeng.cue -t iso
C:
CD TOMBRAID
TOMB.EXE
exit

The first line mounts the directory as the C: drive. The second mounts the image file as the D: drive. The third line switches to the C: drive. The fourth switches to the Tomb Raider installation directory. The fifth runs the game and the last one closes DOSBox when you exit the game.

Use Notepad's "Save As" function and save that file to the "Configs" directory with the name "TombRaider.conf". Make sure not to just hit the normal "Save" option as that will replace DOSBox's default config file and it will run Tomb Raider every time you start DOSBox. If that happens, just edit it again and delete the lines you added.

Start a new document in Notepad and type;

@echo off
start "C:\Program Files\DOSBox 0.74\dosbox.exe" -nogui -noconsole -conf C:\DOSGames\Configs\TombRaider.conf

Then save that to the "C:\DOSGames\" directory with a name like "Tomb Raider.bat". Make sure that the filename ends in .BAT. If it ends in .TXT, rename it to end in .BAT. When you double-click this file, it will run DOSBox using the config file "TombRaider.conf", which contains the commands to run Tomb Raider. Try it; Double-click the BAT file and if everything is correct, DOSBox should open and then immediately launch Tomb Raider.

Assuming that everything works the way it's supposed to and the game runs, you can then go into "Configs" and edit "TombRaider.conf" to change any DOSBox options you want. For example, you may want to change;

fullscreen=false

To;

fullscreen=true

To be able to play in fullscreen.

Most of the options are explained and it can't do any harm to experiment. If you want to be safe, make a copy of the file before you change anything, then if you break anything, you can just copy it back.

To create a desktop shortcut, drag the "Tomb Raider.bat" file onto the desktop while holding down the ALT key on the keyboard. Alternately, you can drag it to the Start button to create a shortcut in the Start Menu (unless you're using Windows 8 ). You can then use the shortcut to start that game automatically without having to type any commands into DOSBox.

With this method, all your DOSBox CONF files for each game are stored in "Configs", and all the BAT files to start the games are stored in "DOSGames". Since each game is using its own CONF file, once you get a game set up and working properly, you don't have to worry about messing it up when you install another game. Each game will have its own directory, its own settings, etc.

The second way is very similar, but makes a self-contained, portable installation of the game that you can copy to a USB drive or other device.

You still make a separate directory for each game, but inside that you make two other directories;

C
DOSBox

So that you have;

C:\DOSGames\TombRaider\C
C:\DOSGames\TombRaider\DOSBox

Copy "DOSBox.exe", "SDL.dll" and "SDL_net.dll" from the DOSBox install directory, into the "DOSBox" directory. Copy the "tombeng.cue" file into "C". If you've already installed the game, move the "TOMBRAID" directory into the "C" directory. If you haven't yet installed it, follow the directions above to install it, but mount C as;

mount c C:\DOSGames\TombRaider\C

If you haven't yet created a "TombRaider.conf" file, follow the directions above, but add these lines to the end instead of the ones above;

mount c C
imgmount D C\tombeng.cue -t iso
C:
CD TOMBRAID
TOMB.EXE
exit

If you already created the file, open it in Notepad and make the changes above. Save it to the "DOSBox" directory.

Start a new document in Notepad and type;

@echo off
start DOSBox\dosbox.exe -nogui -noconsole -conf DOSBox\TombRaider.conf

Then save this to the "C:DOSGames\TombRaider" directory as "Tomb Raider.bat"

When you double-click that BAT file, the game should run. You should also be able to move the entire "TombRaider" directory to any location you'd like and the game should still work.

The advantage of this method is that you can easily back up the entire game installation and restore it at a later date without having to worry about putting all the files in the proper directories.

Note that whichever method you choose, you may have to adjust the paths used to reflect your system.

DISCLAIMER: I have checked and re-checked what I've typed above and I am reasonably sure that I haven't made any major mistakes. It should work. If not, nothing above should do any harm. The worst that will happen is that it will fail to work and I'll look dumb. 😀

Reply 11 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Using the batch files can make it independent of the OS and you can make a nice in dosbox batch menu to start the games.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 12 of 26, by Rekrul

User metadata
Rank Member
Rank
Member
Dominus wrote:

Using the batch files can make it independent of the OS and you can make a nice in dosbox batch menu to start the games.

The problem, as far as I can see, is that you can't put internal DOSBox settings into a batch file to be called from within DOSBox's CONF file. For example, you can't add "fullscreen=true" to a batch file and expect it to switch DOSBox to fullscreen mode. If a game needs higher mouse sensitivity than the default, putting "sensitivity=500" into a batch file does absolutely nothing.

How do you automatically adjust DOSBox's settings for each game if you're using the default CONF file and can't alter such settings in the batch files used to start the games?

Maybe I'm doing it wrong...

I tested it on my installation of Alien Trilogy, which needs the sensitivity set to 500 to provide decent turning in fullscreen mode. I copied everything from the end of my custom CONF file and placed it all into a batch file named "AT.BAT". I then replaced my custom CONF file with a copy of the default one. The only change I made was to set "fullscreen=true".

At the top of the batch file I added;

[sdl]
sensitivity=500

Followed by the commands necessary to run the game.

I saved this file into a subdirectory named "E".

At the end of the default CONF file, I placed the following commands;

mount e E
e:\AT.BAT

I then ran DOSBox. It called the "AT.BAT" file and ran the game. However the sensitivity setting in the batch file was ignored and the turning was much too slow.

Did I do something wrong, or is it impossible to set such options from within a batch file?

If it can't be done, then using one CONF file and bunches of batch files to run the games is less than ideal because there's no one perfect CONF file to run everything.

Reply 13 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I never had to adjust these things. If I want to play fullscreen I use the keyboard shortcut. Never had to mess with mouse sensitivity...

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 14 of 26, by Rekrul

User metadata
Rank Member
Rank
Member
Dominus wrote:

I never had to adjust these things. If I want to play fullscreen I use the keyboard shortcut. Never had to mess with mouse sensitivity...

What do you do if you need to adjust those settings? What if you need different joystick settings, such as autofire for shoot em up games? Or you want to apply a different scaler to a game? It seems to me that that's the main reason DOSBox is capable of loading different CONF files on the command line.

Besides, how do you write all the batch files with only relative paths in their mounting statements, but run them in such a way that they know where to look for those directories regardless of what OS they're on?

Reply 15 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Most settings can be set via a batch file, scaler cannot, another one I do not change per game. I chose the one I like best and am done with it.
If the location of your images is part of the c:/dosgames you can mount them from your new c drive in dosbox. So on another OS you only need to adjust the mount c command.

I use different confs for different "hardware" settings like scalers or midi device, all those things you cannot change from the dosbox prompt. These are, for me, independant of settings needed for games.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 17 of 26, by Rekrul

User metadata
Rank Member
Rank
Member
Dominus wrote:

Most settings can be set via a batch file, scaler cannot, another one I do not change per game. I chose the one I like best and am done with it.

Setting things like windowed/fullscreen, or the mouse sensitivity are things a user might want to adjust per game, but which can't be set via a batch file. You also can't set a custom keymap via a batch file.

I'm not about to go through and test every single option via a batch file, but suffice it to say that you lose a lot of flexibility in being able to configure DOSBox for each game by always using the same default CONF file and calling batch files to run the games.

Dominus wrote:

If the location of your images is part of the c:/dosgames you can mount them from your new c drive in dosbox. So on another OS you only need to adjust the mount c command.

Except that doesn't quite work, at least not on Windows.

First of all, I don't like mounting a single directory as C: and then installing everything into that. While most programs make their own sub-directory and neatly install into that, not every program is guaranteed to do that. It's much neater to make a separate directory for each game and then mount that as the C: drive for that game. This poses problems for using batch files, as the batch files have to exist on a mounted drive in order for DOSBox to be able to read them.

You can make a sub-directory called "E", put all the batch files in there and then mount that as your E: drive. Then DOSBox will be able to read the batch files, which can then mount the C: drive for each game. But that doesn't quite work under Windows, at least not without some other tricks.

When you install DOSBox (which is the only way the official Windows version comes), it places it in the "Program FIles" directory. This is where the shortcuts for starting DOSBox point to and this directory is used as the base for which all other relative paths will be derived from.

So even if you mount "C:\DOSGames\E" as your E: drive, put all the batch files in there and then call them with "E:\Game.bat", the mount commands will fail because they'll be trying to find the directories in the DOSBox directory. You could put absolute paths in the batch files, such as "mount c C:\DOSGames\TombRaider", but then the batch files are no longer OS independent and would have to be re-written for each system.

To counteract this, you have to go into the Windows shortcut properties and change the "Start in:" directory to the base directory that all the game directories are in. Then the batch files will be able to find the relative paths specified in the mount commands.

Of course this can cause problems and limits the flexibility of DOSBox too. What if you want to have separate directories for different types of games? Or you want to set up a second directory solely for testing things? You have to manually change the "Start in:" parameter in the shortcut each time.

I have no idea how this is even handled on the Mac or Linux.

Under Windows, creating a BAT file that runs DOSBox avoids this problem. The working directory is automatically set to whatever directory the BAT file is in when you double-click it.

Another advantage to this method is that you can have the BAT file run additional programs. According to the DOSBox manual, the "-c" parameter is supposed to allow you to run additional commands along with DOSBox, however I could never get this to work. DOSBox just ignores the extra commands.

What other commands could I possibly want to run you ask? Well, my installation of Tomb Raider runs a small program to temporarily disable the Windows key so that I don't accidentally press it and switch back to Windowed mode. Doing so is a problem because you can't switch back to fullscreen Glide mode without restarting DOSBox (Daum SVN). My installation for Dark Forces runs GlovePIE to map the look up/down keys to the mouse movement to simulate mouselook, maps the switch weapon keys to the mousewheel, and runs a program called OverlayXHair to put a crosshair in the center of the screen.

Reply 18 of 26, by Rekrul

User metadata
Rank Member
Rank
Member
RocknRollTim wrote:

Thanks Rekrul and Dominus, I'll consider all this when testing both methods.

Regardless of what method you choose, I wanted to write a short tutorial on making menus in DOS batch files. These menus can be placed at the end of the DOSBox CONF file if you want, so like Dominus says, you could have DOSBox come up with a menu to let you select what you want to play, or in a separate BAT file to be called from within DOSBox. Personally, I create these menus at the end of each CONF file for the game I want to configure. So then it has the DOSBox settings for that game and a nice menu to let you select the various options. I was going to add this info to my other post, but it was already reaching book length. 😀

Also, I learned a new trick (which is explained in the DOSBox manual, but which didn't really register until now);

You can save a copy of the current CONF file from within DOSBox by typing;

config -writeconf C:\DOSGames\dosbox.conf

Of course, you can change the path and name to whatever you want.

Anyway, on to the menu tutorial...

A menu in a batch file typically prints a list of choices to the screen, waits for user input and then branches to other parts of the file based on what the user enters. Here's a simple menu template;

cls

@echo off
@echo 1) Option #1
@echo 2) Option #2
@echo.
@echo Q) Quit
@echo D) DOS

@choice /s /n /c12qd Please choose [1-2,Q,D]:

if errorlevel 4 goto DOS
if errorlevel 3 goto Quit
if errorlevel 2 goto Option2
if errorlevel 1 goto Option1

:Option1
cls
@echo You chose Option #1!
goto dos

:Option2
cls
@echo You chose Option #2!
goto dos

:Quit
exit

:DOS
@echo.

Note: The font in the Code boxes makes the number "1" look like lower case letter "l". Hopefully you can figure out which is which. If you copy it and paste it into Notepad, it will be correct.

"cls" clears the screen. It's optional, but makes things look neater.

"@echo off" is required to keep the lines from being double-spaced. The "@" is required in front of the commands to keep them from breaking out of the batch file. The rest of the "@echo" commands print the menu to the screen. Or to be more accurate, they print text to the screen. That it just happens to be a menu in this example is incidental. The "@echo.", which is "@echo" immediately followed by a single period, causes a blank line to be printed. The text of all these lines is completely optional. You can add as many or as few lines as you want. You can put a title up at the top, followed by lines of dashes as dividers. You can put notes explaining quirks of the games, etc. What you put in the menu is entirely up to you. Normally You'd list the options available and what keys to press to select them. Note that nothing says you can't list multiple options on a single line, such as "@echo 1) Game 2) Setup 3) Quit", etc. Remember, it's all just text.

"@choice /s /n /c12qd Please choose [1-2,Q,D]:" is the command that watches for keyboard input and makes the magic happen. "/s" tells it that the selection is case sensitive. In other words, you can have "a" and "A" select different options if you want to. If not, you can omit this parameter. In this particular example, if the user were to press "Q", it wouldn't work, because the "/s" switch has been used, so an upper case "Q" wouldn't register. However, most people wouldn't think to enter a capital letter and would probably just press the "q" key by itself. The "/n" keeps it from printing the list of choices to the scree. Trust me, it looks ugly. "/c12qd" lists the available choices. "/c" tells it that what follows are the allowed choices and then the characters that follow are what the user is allowed to enter. You can use any letters and numbers or a combination of both. Any other keys not listed here will be ignored. In this case, the only keys that will work are "1", "2", "q" and "d". It's important to note that the order of the characters is what matters. Let's say that you changed it to "/c1q2d". Pressing "q" would select option 2, because it's the second key listed and "2" would quit, because it's the third key listed. The computer doesn't see it as "The user pressed '2' so he must want option #2." It thinks "The user pressed the second choice, so he must want option #2." Finally, "Please choose [1-2,Q,D]:" is just the text it prints to the screen to let the user know that they're expected to make a selection. You can make it say anything you want.

"if errorlevel 4 goto DOS", etc. These are the lines that jump to the various subroutines based on what the user chooses. They MUST be listed in reverse order or it won't work properly. When the user presses the last key listed in the "@choice" command, it will execute the first "if errorlevel..." line under it. When they press the second to last key, it will execute the second line down and so on. You must have the same number of "if errorlevel..." lines as you have keys listed in the "@choice" command. The "goto DOS" command on the end, tells it to jump directly to the subroutine marked with that name. All of the "goto" commands work the same way. They search the file for a section with that name and then execute whatever commands they find there.

":Option1" denotes the start of the subroutine named "Option1". The line must start with a colon which is immediately followed by the name of the subroutine. Any time the batch file encounters the command "goto Option1" it will immediately jump here and start executing the commands it finds. In this case, it will clear the screen, print a message and then jump to the subroutine named "DOS". ":DOS" simply prints a blank line (otherwise the DOS prompt appears at the end of the line) and then has no further commands, so it it will drop to a DOS prompt. Its important that subroutines be closed in some way, otherwise the computer will simply continue through the rest of the batch file executing whatever commands it finds. For example, if you remove the "goto DOS" line, after executing the instructions under ":Option1", it would continue on and also execute the instructions under ":Option2" as well. Marking part of the file as a subroutine allows you to jump directly to that section, but it doesn't prevent it from being executed as the computer moves through the file. You have to manually ensure that it doesn't continue past the point you want it to. Subroutines can appear in any order since they're referenced by name, however if you want the option to drop to DOS without closing DOSbox, it has to be the last one in the file because in essence, it's the end of the file. It reaches that, sees that there are no more commands and just stops. In contrast, the "exit" command will actually close DOSBox, which is normally what you'd want after quitting a game.

So how would you fit a long list of options in the menu, when the screen can only hold so much? Easy, you make multiple menus. How do you do that? Easy, you make each menu a subroutine. For example;

:Menu1
cls
@echo off
@echo 1) Option #1
@echo 2) Option #2
@echo.
@echo 3) Menu #2
@echo.
@echo Q) Quit
@echo D) DOS
@choice /s /n /c123qd Please choose [1-3,Q,D]:
if errorlevel 5 goto DOS
if errorlevel 4 goto Quit
if errorlevel 3 goto Menu2
if errorlevel 2 goto Option2
if errorlevel 1 goto Option1

:Menu2
cls
@echo off
@echo 1) Option #3
@echo 2) Option #4
@echo.
@echo 3) Menu #1
@echo.
@echo Q) Quit
@echo D) DOS
@choice /s /n /c123qd Please choose [1-3,Q,D]:
if errorlevel 5 goto DOS
if errorlevel 4 goto Quit
if errorlevel 3 goto Menu1
if errorlevel 2 goto Option4
if errorlevel 1 goto Option3

:Option1
cls
@echo You chose Option #1!
goto dos

:Option2
cls
@echo You chose Option #2!
goto dos

:Option3
cls
@echo You chose Option #3!
goto dos

:Option4
cls
@echo You chose Option #4!
goto dos

:Quit
exit

:DOS
@echo.

Each menu is now a subroutine, so that when you press "3" it jumps to the other menu. The first menu tells it to jump to the second and the second menu tells it to jump to the first.

You can put DOSBox mount commands into the subroutines as well. However, as noted in my messages to Dominus, you can't seem to change some of the DOSBox settings this way. For example, you can't have it switch to fullscreen or windowed mode, or adjust the mouse sensitivity. In fact, even if you put your menu at the end of the DOSBox CONF file for a particular game, some of those settings can only be changed by editing them in the normal part of the CONF file.

Anyway, how about some actual examples? I've attached my DOSBox CONF files for the games Blood and Screamer. All the custom commands are at the end in the "[autoexec]" section. You should be able to work out what's going on, however a few things in the Blood CONF file could use a little explaining...

My Blood directory is set up, like this;

Monolith\Blood
Monolith\BOWUCD

"Monolith" is the C drive in DOSBox, the game is installed in "Blood" and the CD image is in "BOWUCD" (Blood One Whole Unit CD).

When you launch the games (Blood or the Cryptic Passage add-on), it first attempts to mount the CD image, and then sets the CD volume to 50% with "Mixer CDAudio 50:50", then it CDs to the "Blood" directory, clears the screen and launches the game via an external mouse driver called "BMOUSE.EXE" which I placed in the game's directory. This gives much better mouse control, but it has to configured in the Setup program to work. When the user quits the game, it exits, closing DOSBox.

The game doesn't give you the choice of selecting MIDI music or CD audio. If the CD (or image) is mounted, it plays CD audio. To allow you to select music or CD, I used a quick & dirty hack. If you select music, it simply renames the "BOWUCD" directory so that the imgmount command can't find the CD image. No CD, no CD Audio, so it plays music. If you select CD audio, it renames the directory back to what it should be.

Each time the user switches between music or CD audio, the "@ECHO" is used to send a string of text to the file "audio.txt". This is done by using the ">" symbol which sends the output to a file rather than the screen. When the menu is printed to the screen the "@type audio.txt" line types the contents of that file to the screen. It's not a perfect solution, but it works. In case this is the first time the script has been run and the audio file hasn't yet been created, the line "@if not exist audio.txt goto fix" checks for the file and if it can't find it, it jumps to the ":fix" subroutine, which creates a default file so that the "@type" command won't display an error because the file is missing.

Looking back on it now, I probably should have just checked the directory names and set a variable that could be printed to the menu. I'll probably change it at some point. 😀

There are various other ways I could have handled it, such as making separate menu options to run the games with music or CD audio, or make that menu run the games with music and make a second menu that runs them with CD audio. However, neither choice would be permanent, the user would have to choose each time they play it. By renaming the directory, it stays in effect until you change it back.

You'll notice that some of the "@echo" lines have some strange characters after them, such as "[40;1m". These change the color and style. To be honest, I'm not 100% sure how these work as every web page on the subject seems to have conflicting information and none of them explain it very well. I just copied what I found in another file and pasted it into my own. If you search for terms like DOS, colors and batch, you'll find various sources of information.

Most of the time, when setting up a new game, I just copy one of these menus, paste it into the CONF file for the new game and then customize it as needed. Often some level of experimentation is needed to get everything to look just right. Should I make the "cls" part of the menu, or add it to the subroutines. Why is there an extra line in the menu, screwing up the spacing? Why is that part of the menu printed in the wrong color? Etc.

Couple final notes: It doesn't matter if you type the commands in upper case, lower case or a combination of both. Also, you don't have to leave blank lines between the various sections, I only did for the sake of making them easier to follow. Normally, I only leave blank lines between major sections.

Anyway, I hope this helps. 😀

Attachments

  • Filename
    dosbox.blood.conf
    File size
    12 KiB
    Downloads
    84 downloads
    File comment
    DOSBox CONF file for the game Blood
    File license
    Fair use/fair dealing exception
  • Filename
    dosbox.screamer.conf
    File size
    11.45 KiB
    Downloads
    84 downloads
    File comment
    DOSBox CONF file for the game Screamer
    File license
    Fair use/fair dealing exception

Reply 19 of 26, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I'm at the disadvantage of being on a smartphone right now hence the short answers.
- all stuff I really needed to do per game can be done via batch file (cycles, cpu-type, ems, xms)
- when I wrote the part of OS independence I assumed using Dosbox like Dos where you typically had one drive C:/ where everything got installed to. So "mount c somepath" is all one needs to adjust in the default config. Then have the batch files in somepath/batch and add c:/batch to the PATH environment via main config.
Have all cd-rom images in somepath/images and when you need to imgmount for a game use "imgmount d c:/images/game.iso" in the game.bat.
See?
Of course this doesn't work really if you want to mount a special folder for each game (though that should work, too, contrary to what you wrote if you first change to the e: drive from your example and your special folders are part of the e: drive)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper