*prepares for screams* Windows.. Copyover..

Posted by Marowi on Tue 22 Jun 2004 12:39 PM — 22 posts, 88,699 views.

#0
I'm ready for you all this time.

Yes, I want to copyover on Windows. No, I'm not joking.
Yes, I think copyover is worth it. No, I'm really not joking.

The biggest problem I have at the moment is that I cannot find a snippet that work with the codebase I'm on. I picked it up ages ago, not even knowing the difference, and started messing around with it. I've made a crud-load of changes, and I'm not -really- wanting to move to a new codebase at this time. (The codebase I'm currently using I found available from: http://www.archsysinc.com/lotj/archive/swr102port.zip)

When I try to install the many different copyover snippets, they all tell me there's multiple definitions of fCopyOver, or that it's not defined, or that it's not being used.

When I get the copyover snippet to compile, I have a few ideas to go from there, but right now I'm stuck at "getting copyover to compile with my damn codebase".

Please don't tell me how ridiculously hard and unworthwhile Windows Copyovers are; to many people they are the only option.

Thanks in advance,
Marowi
USA #1
Well, post the exact errors here. If its not being defined its easy enough, to many definitions is easy as well. We just need the errors you have to be able to fix them.

Also, if your on swr I suggest getting greven's copyover. Its available on the dark warriors web site I believe.
Amended on Tue 22 Jun 2004 06:11 PM by Nick Cash
USA #2
Has anybody ever gotten copyover to work on Windows?
USA #3
Good point :P
USA #4
I believe yes, there was one person on here that got it to work, but not very well. If its not on here, it was either on another forums, or I was imagining it. :P
#5
My reason for wanting copyover isn't for a pseudo-reboot. It's moreso I don't have to copy/rename the file I compile to over to the file that I execute the mud from, because Windows won't let me compile over the top (write errors).

INSTEAD of having a copyover (because this codebase is NOT happy with any snippet i've seen - I tried 4), I've thought of another way around it.

Basically my current processes are these:
- I compile to maketoto.exe.
- The mud startups from toto$num.exe.
- $num starts as 1 the first time the mud is loaded up.
- When I reboot, '@ num++', so $num becomes 2 after one reboot.
- I then copy/rename 'maketoto.exe' to 'toto$num.exe' in the startup file.

Here is the relevant code to what I have done.
set num = 1
while ( 1 )
    set index = 1000
    while ( 1 )
	set logfile = ../log/$index.log
	if ( ! -e $logfile ) break
	@ index++
    end

    date > $logfile
    date > ../area/boot.txt

    cp ../area/maketoto.exe ../area/toto$num.exe

    ../area/toto$num $port >&! $logfile

    if ( -e shutdown.txt ) then
	rm -f shutdown.txt
	exit 0
    endif
    rm ../area/toto$num.exe
    @ num++
    sleep 10

end

This is but a temporary fix, I'm really hoping to have a copyover code working. I'll go grab Greven's snippet and stick it in, then paste the compile errors and relevant sections of code.

(I was fairly mind-wasted last night. Just finished exams and had barely slept - the post made little sense, reading it now)

Thanks for the patience!
Marowi.

[I edited it because when I started the post, I was asking how to do it, and I'd done it before I finished writing the post - had to clean it up]
Amended on Wed 23 Jun 2004 08:19 AM by Marowi
USA #6
In answer to one question, whether *anyone* ever got copyover to work under Windows, I can take some credit there. I have and continue to use it under Win98 and 98SE without issue. Samson helped me identify a problem a long ways back (security thing), but with that out of the way it seems to work fine.

Here the relevant link from my old post:

http://www.gammon.com.au/forum/bbshowpost.php?token=1925d42e8b6160a8b4a5b8889536ee5e&bbsubject_id=3415

Check it out, hope it helps!
USA #7
You guys are cheating - you're using Cygwin, which changes the rules of the game. :) As far as I know, nobody has gotten it to work under native Windows.

Marowi, I admit to not spending a lot of time perusing that code, but what is the problem and what is not working?
USA #8
Well not technically running Cygwin, but just using it to compile and then firing up SMAUG with the cygwin.dll file in the directory (areas) that it's being executed from. I do NOT run from within Cygwin's shell, if that's what you're thinking.

I don't know, maybe you can call that half way cheating since I'm using but not technically running Cygwin to run SMAUG? Anyway, just trying to point that out. I use it to compile, but I don't run SMAUG under Cygwin as I assume most might think.

Hope that helps or at least reduces the confusion.
#9
I seriously don't care about 'cheating' at this time. I just want it to work, regardless of how many traditions (or whatever) I have to break.

I haven't found a copyover snippet to successfully install. If anyone could direct me towards one they'd suggest implementing, i'll stick it in and list off the errors/relevant code/stuff.

Hasty post, going to an 18th.

Thanks,
Marowi.
Canada #10
Try this is you happen to be running SWR:

http://www.darkwarriors.net/downloads/snippets.html

or here is your using SMAUG:

http://www.afkmud.com/scripts/download.php?file=hotboot.zip


That might work, you may need to go in manually through www.afkmud.com into the "SMAUG code and Snippets" section.


This is a easier version of Samsons, but in my opinion inferior:

http://www.andreasen.org/ftp/copyover-7.tar.gz

Can try here as well:

http://www.mudmagic.com/cgi-bin/codes/jump.cgi?ID=1424
#11
Righto, I've been busy but I've finally got it done.

I installed the SWR copyover from darkwarriors, as suggested, and the following errors come up.

In function 'do_hotboot':

error: 'timer' undeclared (first use in this function)
error: 'timer_next' undeclared (first use in this function)
for ( timer = och->first_timer; timer; timer = timer_next )

warning: format argument is not a pointer (arg 8)
warning: too many arguments for format
fprintf( fp, "%d %d %d %d %d %s %s\n",
d->descriptor,
#ifdef MCCP
d->can_compress,
#else
0,
#endif

#ifdef GAVMXP
(int) d->mxp_detected,
#else
0,
#endif
och->in_room->vnum, d->port, d->idle, och->name, d->host );

In function 'hotboot_recover':

warning: char format, different type arg (arg 8)
warning: too many arguments for format
fscanf( fp, "%d %d %d %d %d %s %s\n", &desc, &dcompress, &room, &mxp, &dport, &idle, name, host );


The warnings just need another '%d' but I posted every problem with the compile. (surprisingly less than all the other times I've tried, but I've never used this snippet - nor has it had seperate files for hotboot.c and hotboot.h before)

Marowi

{edit}
Something I noticed. It fprints in the order of "desc, dcompress, mxp, room, dport, idle, name, host" but fscanfs in the order of "desc, dcompress, room, mxp, dport, idle, name, host" (mxp and room are switched around). I've fixed this in my copy.
Amended on Sun 04 Jul 2004 12:21 PM by Marowi
Canada #12
Thanks for pointing out these errors. I've had a couple people install this without telling me about these. I have corrected them in the snippet on the site. Thanks.

Yeah, add another %d. You can either remove the section on timers, or declare the timer at the top, your choice, dunno how that got removed.

I also put mxp and room in the proper order.

Hope that helps, thanks for the input on this, its pretty new snippet.
#13
Perhaps I'm paranoid, or maybe I'm lazy...

If you could tell me -exactly- where to add what, I'd much rather that than me add something incorrectly and be bugging you indefinately.

Marowi
Amended on Mon 05 Jul 2004 02:02 AM by Marowi
Canada #14
heh, k, here is what it should look like:
            fprintf( fp, "%d %d %d %d %d %d %s %s\n",                     d->descriptor,
#ifdef MCCP
                     d->can_compress,
#else
                     0,
#endif

#ifdef GAVMXP
					(int) d->mxp_detected,
#else
					0,
#endif
                     och->in_room->vnum, d->port, d->idle, och->name, d->host );
And in hotboot_recover:
        fscanf( fp, "%d %d %d %d %d %d %s %s\n", &desc, &dcompress, &mxp, &room, &dport, &idle, name, host );


And remove this:
			for ( timer = och->first_timer; timer; timer = timer_next )
			{
		    	timer_next = timer->next;
				if ( timer->type == TIMER_DO_FUN )
				{
				    int tempsub;
				    tempsub = ch->substate;
				    och->substate = timer->value;
				    (timer->do_fun)( och, "" );
				    if ( char_died(och) )
						break;
			    	och->substate = tempsub;
				}
				extract_timer( och, timer );
	    	}


If there are other problems, lemme know
Amended on Mon 05 Jul 2004 02:00 AM by Greven
#15
I was editing my previous post as you wrote that post up. Here's what it said:

I commented out the whole timer section, just for laughs. Hotboot seems to work as well as I could expect. (It didn't work entirely, but I knew it wouldn't.. yet)

At the moment, I'm compiling to 'maketoto.exe' and copying it to 'toto$num.exe'. This works for rebooting, but now I need to incorporate it into hotbooting as well.

In hotboot.h:
#define EXE_FILE "../area/toto2"

I need to somehow make it so EXE_FILE changes to "../area/toto3" after the first execution, etc.

I was thinking of having an external int called 'maketoto' and storing it to that, but I'm still unsure how to incorporate that into EXE_FILE definition. That is, "../area/toto%d", &maketoto

I don't mind where or how this is done, just that it is. Please help.

Marowi

[edit]
I just thought of another possible problem...
It's the startup file that copies maketoto.exe to toto$num.exe - When it tries to execute that file wouldn't be there.

When I try to hotboot currently, it prints to the mud:
"You feel a great disturbance in the Force.
The Force swirls around you.
Suddenly, you remember nothing as the Force continues into the Galaxy."

In cygwin it spams it down the page until it says "Segmentation fault (core dumped)" and in the bugs.txt file we get:
[*****] BUG: Buffer overflow. Closing (Marowi).
[*****] BUG: Buffer overflow. Closing (Marowi).
(Both, for the one time)

Hrm.
Marowi
Amended on Mon 05 Jul 2004 02:29 AM by Marowi
Canada #16
K, so just to clarify, thats alot to go through, the copyover code in itself works? If thats the case, good.

As to the other questions I have no idea, sorry. I don't think it can be done.
#17
Arg, not what I was hoping to hear. Niiick?!

[edit]
Okay, now i'm fiddling. I've noticed that hotboot.dat creates but quickly deletes itself. Also, the 'hotboot' directory the instructions said to create is seemingly useless.

Basically I'm currently getting:

You feel a great disturbance in the Force.
The Force swirls around you.
Suddenly, you remember nothing as the Force continues into the Galaxy.
%%% Disconnected from server.

Has anyone any idea why the code continues to loop through the lines:
"The Force swirls around you.
Suddenly, you remember nothing as the Force continues into the Galaxy."

This seems weird because I WAS getting a message as it went through the logs. When I work out just what I did to break it again, I'll let you know.

[edit]
I worked out what it was saying.

You feel a great disturbance in the Force.Log: Hotboot initiated by Marowi.
Log: Preserving world state....
Log: Saving player files and connection states....
Log: Executing hotboot....
Log: [*****] BUG: Hotboot execution failed!!
Hotboot FAILED!

The exe file I had it pointed to wasn't there.
No progress, obviously. Please help.

Marowi

[edit]
Last edit for a while, I promise.

Even if I define EXE_FILE to a file that's definitely there, the hotboot goes into the infinite loop until it drops.

Even if I take the 'sleep 10' out of the startup file it doesn't work. I ran it through gdb and it spammed pages of:
"The Force swirls around you.
Mon Jul 5 18:28:54 2004 :: Loading player data for: Marowi (5K)
Suddenly, you remember nothing as the Force continues into the Galaxy."

I'm at a loss.
Please help.
Amended on Mon 05 Jul 2004 08:30 AM by Marowi
Canada #18
Well, I've asked a few others that are using this snippet, no one else has this same problem. The hotboot directory isn't useless, try this:

"hotboot debug"

and see what comes up. That is where all the mobs, objects, and other files are stored during hotboot. They are deleted upon the mud restarting, thats why it seems perpetually empty.

It sounds like that file was either written a whole lot to the copyover file, or its reading it in but not removing it. chech the file to see which it is.

Are you sure that this line:

fprintf(fp, "%s", "-1\n");

Is in do_hotboot? Cause its sounding like this condition is not being met:

if (desc == -1 || feof(fp) )
break;

You could use gdb to put a break point at that check. If your the only one on, it should happen once, then break out of the loop.

Let me know, we'll see whats going on.
Amended on Mon 05 Jul 2004 03:49 PM by Greven
#19
It's there:

/* For each playing descriptor, save its state */
for( d = first_descriptor; d ; d = de_next )
{
(saving descriptor states)
}
fprintf( fp, "0 0 0 0 %d maxp maxp\n", sysdata.maxplayers );
fprintf( fp, "%s", "-1\n" );
FCLOSE( fp );

It does get to hotboot_recover because it keeps displaying 'Suddenly, you remember nothing as the Force continues into the Galaxy.', which is in the hotboot_recover section.

Use gdb to put a break point at that check. Right, okay.
I've only ever used GDB to check to see where things are crashing (target exec, run) - how do I do this break point thing...

[edit]
Just remembered, I tried hotboot debug and well.. here it is:

You feel a great disturbance in the Force.Log: Hotboot initiated by Marowi.
Log: Preserving world state....
Log: Saving player files and connection states....
Log: Hotboot debug - Aborting before execl
Amended on Tue 06 Jul 2004 02:45 PM by Marowi
Canada #20
Heh, I meant use "hotboot debug" and take a look at the hotboot.dat file, see whats written to it.

Nick has a good tutorial on how to use gdb on these forums, check this out, it should tell you what to do:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3653

Hope that helps some, if your stil having problems, I can give you step by step instructions
USA #21
Personally... I just DLed my mud (SmaugFUSS modified) to my computer (WinXP), ran Cygwin to test a bug, did a hotboot without thinking... Thought "Oh damn, can't hotboot" in the middle. And then the hotboot went through. No issues... So I guess I can't say "Windows can't hotboot" anymore.