Ok, this is what I did to get it to work. I'm using 1.4a_W32 to be exact. Here's what needs to be changed in order for it to work:
Ok, first, service.c needs to be changed.
First off, you need to change the declaration of worker_thread from
VOID worker_thread(VOID *notused);
to
VOID worker_thread( int argc, char **argv);
This was the main problem, main takes the command line paramaters, but the way they had it, didn't actually pass it on to the mainthread in comm.c where the game is actually booted, which was why it wasn't working.
Then, you need to change
if ((argc == 2) &&
((*argv[1] == '-') || (*argv[1] == '/') || (*argv[1] == '\'))
)
{
to
if ( (argc >= 2) && ( (*argv[1] == '-') || (*argv[1] == '/') || (*argv[1] == '\') ) )
{
That's required so it won't keep popping up the uses statement, because hotboot passes several paramaters to the new copy of the program, and with the old way it wouldn't run the new copy because you gave it more than 1 command line paramater.
After that, the actual worker_thread function needs to be changed from
static VOID worker_thread(VOID *notused)
{
to
static VOID worker_thread( int argc, char **argv)
{
So that pass on the commandline parameters.
Then, delete the lines
and
char * argv [2] = {"", ""} ;
Worker_thread was setting up empty commandline paramaters and that's what was getting passed to mainthread in comm.c
Lastly for service.c, you need to change all 3 calls to worker_thread from
to
worker_thread ( argc, argv );
Now for comm.c, in mainthread, go to
/*
* Get the port number.
*/
port = 4000;
if ( argc > 1 )
{
if ( !is_number( argv[1] ) )
{
fprintf( stderr, "Usage: %s [port #]\n", argv[0] );
exit( 1 );
}
else if ( ( port = atoi( argv[1] ) ) <= 1024 )
{
fprintf( stderr, "Port number must be above 1024.\n" );
exit( 1 );
}
if (argv[2] && argv[2][0])
{
fCopyOver = TRUE;
control = atoi( argv[3] );
control2 = atoi( argv[4] );
conclient = atoi( argv[5] );
conjava = atoi( argv[6] );
}
else
fCopyOver = FALSE;
}
and change it to
/*
* Get the port number.
*/
port = 4000;
if ( argc > 1 )
{
if ( argv[2] ) // Have to make sure there's actually a second argument
{
if ( !is_number( argv[2] ) ) // This is assuming the port will be the second arguement
{ // Will take additional coding to make the / commands and
fprintf( stderr, "Usage: %s [port #]\n", argv[0] ); // a commandline port
exit( 1 );
}
else if ( ( port = atoi( argv[2] ) ) <= 1024 )
{
fprintf( stderr, "Port number must be above 1024.\n" );
exit( 1 );
}
}
if ( argv[2] && argv[3] ) // Makes sure there's a port and a descriptor
{
fCopyOver = TRUE;
control = atoi( argv[3] );
control2 = atoi( argv[4] );
conclient = atoi( argv[5] );
conjava = atoi( argv[6] );
}
else
fCopyOver = FALSE;
}
Not only will that fix the problem with it not taking a command line port in windows, that also what makes the hotboot work. So with those changes, hotboot should work, but I might be forgetting something (it's 6 am and I'm sleepy, soooo), so if that doesn't work, post here and I'll see if I'm forgetting something. |