VOGONS


First post, by Polar

User metadata
Rank Newbie
Rank
Newbie

Sorry if I have overseen something obvious, but is it possible to add a command from the DosBox command line to be executed *after* the config file is processed, but *without* mounting anything?
(<name> seems to try to mount to C, "-C " seems to add a command *before* the config file is read)

Reply 1 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

😕 I created a config-file that said "echo Hello World" in the autoexec-section, and then I fired up DOSBox like this:

dosbox -conf db.cfg -c "dir"

and got a nice

Z:\>echo Hello World
Hello World

Z:\>dir
Directory of Z:\.
....
....

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 2 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Ok, I will specify the problem further with an example (attached is my dosbox.conf for reference):

- 1) If I start DosBox just with "DosBox -conf dosbox.conf", and then manually type "drawperf" (to start a batch file in the path that launches the DOS graphics program Draw Perfect), it works fine.

- 2) If I add a line at the end of dosbox.conf, in which I give the command "drawperf", and start DosBox again with "DosBox -conf dosbox.conf", it also works fine (but I don't want a separate dosbox.conf for each program I'm ever starting...)

- 3) If I remove that additional line in dosbox.conf again, and type "DosBox -conf dosbox.conf -c "drawperf" ", I would hope that it does just the same as in 2), but unfortunately it doesn't; instead, it gives me an error "Exit to error: autoexec: allready created... (then follow some environment path settings)"

So what I would hope for is that -c "command" (or some other parameter to be defined in the command line) would have just the same effect as starting a program manually after startup, or as adding that command to the end of the autoexec section of dosbox.conf - but unfortunately this doesn't seem to be the case right now.

- Is this a bug, is there some other way?

Reply 3 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

P.S.: This behaviour as described in 3) above seems to be independent of what is the command, also if I change it to "dir" it's the same

P.S.2: Finally comes the DosBox.conf (I hope)

Reply 4 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Attachments don't seem to work for some reason, so here is dosbox.conf:

[sdl]
# fullscreen -- Start dosbox directly in fullscreen.
# fulldouble -- Use double buffering in fullscreen.
# fullresolution -- What resolution to use for fullscreen: original or fixed size (e.g. 1024x768).
# windowresolution -- Scale the window to this size IF the output device supports hardware scaling.
# output -- What to use for output: surface,overlay,opengl,openglnb,ddraw.
# autolock -- Mouse will automatically lock, if you click on the screen.
# sensitiviy -- Mouse sensitivity.
# waitonerror -- Wait before closing the console if dosbox has an error.
# priority -- Priority levels for dosbox: lowest,lower,normal,higher,highest.
# Second entry behind the comma is for when dosbox is not focused/minimized.
# mapperfile -- File used to load/save the key/event mappings from.
# usescancodes -- Avoid usage of symkeys, might not work on all operating systems.

fullscreen=false
fulldouble=false
fullresolution=original
windowresolution=original
output=surface
autolock=true
sensitivity=100
waitonerror=true
priority=higher,normal
mapperfile=mapper.txt
usescancodes=true

[dosbox]
# language -- Select another language file.
# memsize -- Amount of memory dosbox has in megabytes.
# machine -- The type of machine tries to emulate:hercules,cga,tandy,pcjr,vga.
# captures -- Directory where things like wave,midi,screenshot get captured.

language=c:\Dosbox-0.65\deutsch.lng
machine=vga
captures=capture
memsize=63

[render]
# frameskip -- How many frames dosbox skips before drawing one.
# aspect -- Do aspect correction, if your output method doesn't support scaling this can slow things down!.
# scaler -- Scaler used to enlarge/enhance low resolution modes.
# Supported are none,normal2x,normal3x,advmame2x,advmame3x,advinterp2x,advinterp3x,tv2x,tv3x,rgb2x,rgb3x,scan2x,scan3x.

frameskip=0
aspect=false
scaler=normal2x

[cpu]
# core -- CPU Core used in emulation: simple,normal,full,dynamic.
# cycles -- Amount of instructions dosbox tries to emulate each millisecond.
# Setting this higher than your machine can handle is bad!
# You can also let DOSBox guess the correct value by setting it to auto.
# Please note that this guessing feature is still experimental.
# cycleup -- Amount of cycles to increase/decrease with keycombo.
# cycledown Setting it lower than 100 will be a percentage.

core=normal
cycles=10000
cycleup=500
cycledown=20

[mixer]
# nosound -- Enable silent mode, sound is still emulated though.
# rate -- Mixer sample rate, setting any devices higher than this will
# probably lower their sound quality.
# blocksize -- Mixer block size, larger blocks might help sound stuttering
# but sound will also be more lagged.
# prebuffer -- How many milliseconds of data to keep on top of the blocksize.

nosound=false
rate=22050
blocksize=2048
prebuffer=10

[midi]
# mpu401 -- Type of MPU-401 to emulate: none, uart or intelligent.
# device -- Device that will receive the MIDI data from MPU-401.
# This can be default,alsa,oss,win32,coreaudio,none.
# config -- Special configuration options for the device. In Windows put
# the id of the device you want to use. See README for details.

mpu401=intelligent
device=default
config=

[sblaster]
# sbtype -- Type of sblaster to emulate:none,sb1,sb2,sbpro1,sbpro2,sb16.
# sbbase,irq,dma,hdma -- The IO/IRQ/DMA/High DMA address of the soundblaster.
# mixer -- Allow the soundblaster mixer to modify the dosbox mixer.
# oplmode -- Type of OPL emulation: auto,cms,opl2,dualopl2,opl3.
# On auto the mode is determined by sblaster type.
# All OPL modes are 'Adlib', except for CMS.
# oplrate -- Sample rate of OPL music emulation.

sbtype=sb16
sbbase=220
irq=7
dma=1
hdma=5
mixer=true
oplmode=auto
oplrate=22050

[gus]
# gus -- Enable the Gravis Ultrasound emulation.
# gusbase,irq1,irq2,dma1,dma2 -- The IO/IRQ/DMA addresses of the
# Gravis Ultrasound. (Same IRQ's and DMA's are OK.)
# gusrate -- Sample rate of Ultrasound emulation.
# ultradir -- Path to Ultrasound directory. In this directory
# there should be a MIDI directory that contains
# the patch files for GUS playback. Patch sets used
# with Timidity should work fine.

gus=false
gusrate=22050
gusbase=240
irq1=5
irq2=5
dma1=3
dma2=3
ultradir=C:\ULTRASND

[speaker]
# pcspeaker -- Enable PC-Speaker emulation.
# pcrate -- Sample rate of the PC-Speaker sound generation.
# tandy -- Enable Tandy Sound System emulation (off,on,auto).
# For auto Tandysound emulation is present only if machine is set to tandy.
# tandyrate -- Sample rate of the Tandy 3-Voice generation.
# disney -- Enable Disney Sound Source emulation.

pcspeaker=true
pcrate=22050
tandy=auto
tandyrate=22050
disney=true

[bios]
# joysticktype -- Type of joystick to emulate: none, 2axis, 4axis,
# fcs (Thrustmaster) ,ch (CH Flightstick).
# none disables joystick emulation.
# 2axis is the default and supports two joysticks.

joysticktype=2axis

[serial]
# serial1-4 -- set type of device connected to com port.
# Can be disabled, dummy, modem, directserial.
# Additional parameters must be in the same line in the form of
# parameter:value. Parameters for all types are irq, startbps, bytesize,
# stopbits, parity (all optional).
# for directserial: realport (required).
# for modem: listenport (optional).
# Example: serial1=modem listenport:5000

serial1=dummy
serial2=dummy
serial3=disabled
serial4=disabled

[dos]
# xms -- Enable XMS support.
# ems -- Enable EMS support.
# umb -- Enable UMB support (false,true,max).

xms=true
ems=true
umb=true

[ipx]
# ipx -- Enable ipx over UDP/IP emulation.

ipx=false

[autoexec]
# Lines in this section will be run at startup.

mount C c:\DOSBox-0.65\
mount E e:\
mount F f:\
mount G g:\
c:\KEYB\keyb su

SET DIRCMD=/p
SET IONDAT=f:\daten\test
SET IONDRV=e:
SET IONEXE=e:\exe\ionsp
SET IONGRAF=g:\tmp
SET IONTMP=g:\tmp
SET MG=e:\graf\mg321
SET OOS=WXP_H
SET PATH=%PATH%;e:\bat;e:\graf\mg321;e:\spra\vbdos;e:\exe\ionsp
SET TEMP=g:\tmp
SET TMP=g:\tmp

Reply 5 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

P.S.3: The mentioned behavious seems to come up if there are any executable commands in the autoexec section of dosbox.conf... (only, e.g., "SET" is ok, but with, e.g., "mount" the error appears)

Reply 6 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

You must have a different DOSBox than I...

Here is a new dosbox.conf I just made:

<Lot of stuff deleted>
[autoexec]
# Lines in this section will be run at startup.

mount C H:\Temp
set VARIABLE=value

I start it up like this:

H:> H:\Programmer\DOSBox-0.65\DOSBox.exe -conf H:\Temp\dosbox.conf -c "echo %%VARIABLE%%" -c "drawpe
rf"

(don't ask me why the %% is necessary, but it is - some CMD weirdness I guess).
And the output is here:

drawperfbf1.th.png

Seems to me like DOSBox executes the commands in the autoexec-section and then the commands specified on the command line with -c "....."

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 7 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Strange... Could you try exactly my dosbox.conf (or at least its autoexec section), for most exact reproduction? It seems that that error message ("Exit to error: autoexec: allready created...") continues with the 14th character of the first executable line in the autoexec section.

Reply 8 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Yep - something weird is going on with the

SET PATH=%PATH%;e:\bat;e:\graf\mg321;e:\spra\vbdos;e:\exe\ionsp

line

If it is commented out, as in

#ET PATH=%PATH%;e:\bat;e:\graf\mg321;e:\spra\vbdos;e:\exe\ionsp

then it don't get confused and don't spew out the

Exit to error: autoexec: allready created \spra\vbdos;e:\exe\ionsp

(and isn't allready misspelled? Shouldn't it be already?)

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 9 of 18, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

how does z:\ work instead of %path% ?
although I don't see a reason why it is broken though.

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

Reply 10 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Yes, I can reproduce that: If I comment out the line with SET PATH=... , it works correctly. However, changing %PATH% in that line to Z:\ does not help...

(yes, it should be "already", not "allready" - I just wrote the error message as it appears on the screen)

Reply 11 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

(the above doesn't solve the problem, though, since the PATH settings are needed for the programs to work... so is this a bug?)

Reply 12 of 18, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

it's a buffer overflow .
the length of something that can be added to the autoexec.bat is limited to 256 characters in 0.65 (and cvs atm)
(the whole [autoexec] in the configfile is considered one object)

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

Reply 13 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Thanks Qbix, but why does the same dosbox.conf (*with* the PATH command) then work without any "-c" in the command line??

And why does it also seem to work, as I found out, if I delete the PATH command from dosbox.conf, and write dosbox -conf dosbox.conf -c "set PATH=z:\;e:\bat\e:\graf\mg321\;e:\spra\vbdos;e:\exe\ionsp" -c "drawperf" ?? (although this looks quite an ugly command line...)

Reply 14 of 18, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

You have work-arounds for this. You can put the whole SET-shebang into a BAT-file in one of your mounted drives, e.g. in E:\bat\my_auto.bat and call that when C, E. F and G has been mounted. Then the autoexec-section wil be within the 255 character limit.

Maybe the 255 character limit will be lifted in the future....

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 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Yes, thanks, I got it working now with such a work-around (or one like I described in my previous message).

Just I still don't understand that if it's a character limit of autoexec, why does it work fine if only I don't put any "-c ... " in the command line...

Reply 16 of 18, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Re-read what Qbix wrote.

Reply 17 of 18, by Polar

User metadata
Rank Newbie
Rank
Newbie

Done. 😕

Still don't understand it... as the autoexec is the same with or without "-c .."; and on the other hand adding the same PATH stuff from autoexec into a "-c .." command works again.

wd, maybe you could be a bit more eloquent to a newbie? 😉

Reply 18 of 18, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

There's a buffer in-between which limits what can be *added* in this way
to the autoexec.bat