dreamlayers / em-dosbox

An Emscripten port of DOSBox
www.dosbox.com
GNU General Public License v2.0
1.21k stars 154 forks source link

Does the complied dosbox.js support the use of dosbox.conf configurations? #3

Closed bengarrett closed 8 years ago

bengarrett commented 9 years ago

As I couldn't find a way to force specific DOSBox audio and graphic modes without editing the /src/dosbox.cpp defaults and recompiling.

dreamlayers commented 9 years ago

You can put a dosbox.conf file in the root directory of the packaged files to change settings.

bengarrett commented 9 years ago

Unfortunately placing dosbox.conf file in the root directory of the packaged files has no effect to any settings I apply. Obvious, visual and audio setting changes such as [dosbox] machine=hercules, [mixer] nosound=true, [sblaster] sbtype=none have no effect for me. The default, hard coded settings are always used.

At launch the console generates the following output regardless of the package directory or user account. CONFIG: Generating default configuration. Writing it to /home/web_user/.dosbox/dosbox-0.74.conf CONFIG:Loading primary settings from config file /home/web_user/.dosbox/dosbox-0.74.conf MIDI:Opened device:none

dreamlayers commented 9 years ago

This works for me. I just tried with the 0.74 branch because that's what you're using. I made a conftest directory containing dosbox.conf and Gwbasic.exe. Then I used ./packager.py conftest conftest Gwbasic.exe. The conf file had:

[mixer]
nosound=true

Resulting output was:

DOSBox version d2e4a49 built with Emscripten 1.29.3 3675eb7
Copyright 2002-2010 DOSBox Team, published under GNU GPL.
---
CONFIG:Loading primary settings from config file dosbox.conf
MIXER:No Sound Mode Selected.
MIDI:Opened device:none
bengarrett commented 9 years ago

Okay brilliant it works. I discovered what the problem was.

I was using tab competition so instead of doing ... ./packager.py stryker major_stryker STRYKER.EXE

I was mistakenly including a forward slash when pointing to the executable. ./packager.py stryker major_stryker/STRYKER.EXE

Packager still compiled and created styker.html etc but the dosbox.conf would not be found.

bengarrett commented 9 years ago

If this is useful, I expanded the instructions to make the steps a bit more clear.

Packaging DOS programs

Web pages for running DOS programs can be created using the src/packager.py Python script. If you have a single DOS executable such as Gwbasic.exe, place it in the same src directory as packager.py and package it using.

./packager.py gwbasic Gwbasic.exe

This creates gwbasic.html and gwbasic.data. Placing those in the same directory as dosbox.js and viewing gwbasic.html will run the program in a web browser.

Some browsers have a same origin policy that prevents access to the required data files while using file:// URLs. To get around this you can use Python's built in Really Simple HTTP Server and point the browser to http://localhost:8000.

python -m SimpleHTTPServer 8000

If you need to package a collection of DOS files. Place all the files in a single directory and package that directory with the executable specified. For example, if Major Stryker's files are in the subdirectory src/major_stryker and it's launched using STRYKER.EXE you would package it using.

./packager.py stryker major_stryker STRYKER.EXE

Again, place the created stryker.html and stryker.data files in the same directory as dosbox.js and view stryker.html to run the game in browser.

You can also include a DOSBox configuration file that will be acknowledged by the emulator to modify any speed, audio or graphic settings. Simply include a dosbox.conf text file in the package directory before you run ./packager.py.

To attempt to run Major Stryker in CGA graphics mode. You would create the configuration file /src/major_stryker/dosbox.conf and include this body of text.

[dosbox]
machine=cga

Then package it using.

./packager.py stryker-cga major_stryker STRYKER.EXE

dreamlayers commented 9 years ago

Thanks for the improved instructions. I just committed them in f29337f with some slight tweaks.