View Single Post
Old 28-07-2013, 11:20 PM   #7
Japo
Autonomous human
 
Japo's Avatar


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

Quote:
Originally Posted by BentleyVA View Post
E
P
C:\POOLRAD\
C:\POOLRAD\
N
The meanings of the pool.cfg file lines are:

1.- Graphic mode: E(GA) / C(GA) / T(andy)
2.- Sound mode: P(C speaker) / T(andy) / S(ilent)
3.- Where the game is installed.
4.- Where the saves will be stored.
5.- I don't know the meaning of this, apparently it can be F or N. Does anyone know??

But later Goldbox games have more, different lines!

I think 3 and 4 can be relative paths, but I haven't tried extensively, specially with 3.

But one important thing about them is that they must end with a trailing backslash "\". So for example "c:\poolrad\", not "c:\poolrad". Also a root such as "c:\" is possible. But both lines behave differently when this fails. If line 3 has no trailing backslash you will get the error and the game won't run.

For the save directory, the engine actually removes internally the trailing backslash, in fact it removes any last character: so if the trailing backslash is missing from the file, the game will work the same, saving in another folder missing the last character of the intended one. For example it will create "c:\poolrad\sav" instead of ""c:\poolrad\save", or "c:\poolra" instead of "c:\poolrad". Funny.
__________________

I've included in the archive for Pool of radiance a script to create the .cfg file each time no matter where the game was mounted. Because of the stupid trailing backslash, batch commands weren't enough, and I created a program cfg.exe:

Code:
@echo off

rem  Gold Box Starter by Japo @ Abandonia.com

cfg.exe EGA PCsound F > pool.cfg
if errorlevel 1 goto error
start.exe
goto end
:error
type pool.cfg
del pool.cfg
:end
This is the C source code of cfg.exe (which was compiled as a DOS program, it won't work in Windows x64):

Code:
/* Gold Box Starter by Japo @ Abandonia.com
Allows Pool of Radiance to be run from any different folder every time (e.g. different DOSBox mount).
Redirect output to .CFG file.
*/

#include <stdio.h>
#include <dir.h>

void uppercase(char *c);

#define POSG 1
#define POSS 2
#define POS3 3

int main(int argc, char *argv[])
{
	char *param;
	char optg, opts, opt3;
	char curdir[MAXPATH];
	
	if(argc <= POSG)
		optg = 'E';
	else
	{
		param = argv[POSG]; /* graphic mode */
		optg = param[0];
		uppercase(&optg);
		switch(optg)
		{
			case 'E': /* EGA   */
			case 'C': /* CGA   */
			case 'T': /* Tandy */
				break;
			default:
				printf("Invalid graphic mode:\n%s\n", param);
				return POSG;
		}
	}
	if(argc <= POSS)
		opts = 'P';
	else
	{
		param = argv[POSS]; /* sound mode */
		opts = param[0];
		uppercase(&opts);
		switch(opts)
		{
			case 'P': /* PC speaker */
			case 'T': /* Tandy      */
			case 'S': /* Silent     */
				break;
			default:
				printf("Invalid sound mode:\n%s\n", param);
				return POSS;
		}
	}
	if(argc <= POS3)
		opt3 = 'F';
	else
	{
		param = argv[POS3]; /* sound mode */
		opt3 = param[0];
		uppercase(&opt3);
		switch(opt3)
		{
			case 'F':
			case 'N':
				break;
			default:
				printf("Invalid 3rd param:\n%s\n", param);
				return POS3;
		}
	}
	
	if(getcwd(curdir, MAXPATH) == NULL)
	{
		puts("Error retrieving current directory from DOS!");
		return 9;
	}
	/* If it happens to be a drive root, remove trailing '\' that will be added after.  */
	if(!curdir[3])
		curdir[2] = 0;

	printf("%c\n%c\n%s\\\n%s\\SAVE\\\n%c\n",
		optg, opts, curdir, curdir, opt3);
   return 0;
}

void uppercase(char *c)
{
	if(*c > 96)
		*c -= 32;
}
Quote:
Originally Posted by Smiling Spectre View Post
There is better solution: if you'll delete .cfg altogether, game will ask all needed questions again upon first start.
What version do you have? I've seen several programs and batch scripts included in some, but many don't look original. I found a conf.exe that doesn't add the backslash and so won't work, and a .bat script that relies on the "find" DOS command, which isn't included in DOSBox. At least Pool of Radiance, I don't think the configuration could be changed originally without the floppies: running start.exe when pool.cfg doesn't exist raises an error "Please insert startup disk."
__________________
Life starts every day anew. Prospects not so good...

Last edited by Japo; 01-08-2013 at 10:12 PM.
Japo is offline                         Send a private message to Japo
Reply With Quote