Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Search Today's Posts Mark Forums Read
Search Forums:
Click here to use Advanced Search

Thread Tools Display Modes
Old 06-04-2012, 08:44 PM   #1
The Fifth Horseman
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:
@echo off
mount > mounts.txt
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:
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
Old 06-04-2012, 11:20 PM   #2
Autonomous human
Japo's Avatar

Join Date: Mar 2006
Location: ,
Posts: 4,613

Nice. I didn't even know you could get that information from running mount without parameters.
Life starts every day anew. Prospects not so good...
Japo is offline                         Send a private message to Japo
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tiny Toon Adventures - Buster and the Beanstalk Expack2 Approved Requests 4 22-07-2011 01:34 PM
Contraption Zack Romano Games Discussion 14 04-09-2006 01:04 PM
Tiny Text In Sig guesst Blah, blah, blah... 7 19-06-2006 09:05 PM
Tiny Skweeks Reup Games Discussion 8 10-12-2005 02:15 AM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

The current time is 05:52 PM (GMT)

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.