View Single Post
Old 06-04-2012, 07:44 PM   #1
The Fifth Horseman
FUTURE SCIENCE BASTARD
 
The Fifth Horseman's Avatar


 
Join Date: Oct 2004
Location: Opole, Poland
Posts: 14,276
Default A tiny but useful contraption

Right, so I've solved the problem with Warcraft 2 today, but then it struck me that a more generalized version of the utility I've created for it might have a wider use for us.

I'm attaching a copy of the updated program, compiled into a DOS executable using a 20 year old version of Borland Turbo C.
Source code (C)


Now, what DOES it do?
Let's assume you're peparing a game archive and the particular game needs something to be mounted under a separate drive letter. Do we know where the user will chuck the game archive? Do we know what mount commands will work? Nope. It would save both us and the users some grief if we were able to automatically determine the required paths...
And that's exactly where this little toy comes in.
You'll need to include three things in the game directory: the first is of course the utility itself. The second is a startup batch script, like this:
Code:
@echo off
@cls
mount > mounts.txt
prep
start
The third and last is a batch.txt file where you'll include the mounting commands (and any other commands you need to execute). If you've written any batch scripts before, you'll remember that variables are substituted into commands by using %variablename%.

What my tool does is create a start.bat, setting four variables there: absolutepath, mountpath, dosboxpath and dosboxdrive and then appending the contents of batch.txt

%absolutepath% is the absolute path on the host system to the current directory in DOSBox.
%mountpath% is the path on the host system to the directory mounted as the current drive in DOSBox.
%dosboxpath% is the path to the current directory in DOSBox from the root of the current drive.
%dosboxdrive% is the letter of the current drive in DOSBox.

So let's say for an example that the tool generated these variable assignments:
Code:
SET absolutepath=c:\games\dosgames\WAR2
SET mountpath=c:\games\dosgames
SET dosboxpath=\WAR2
SET dosboxdrive=C
And appended this batch script:
The rest of the script

Now what will happen in the example is that depending on the user's choice, either the \TOD or \DP subdirectory of the current DOSBox directory will be mounted as the cdrom drive d, no matter how the current directory is named or what is its' path.
Attached Files
File Type: rar PREP.rar (7.7 KB, 1 views)
__________________

"God. Can't you people see I'm trying to commit a crime against science and nature here?"
-- Reed Richards
The Fifth Horseman is offline                         Send a private message to The Fifth Horseman
Reply With Quote