Saturday, May 5, 2012

Multi-day Dump

I haven't updated this recently, because individual little things I came across during my disassembly didn't really warrant a post to themselves.  But I can take the time to touch on a few things for a single update!

I was starting to run dry on sources to find information on various variables and functions.  But then I decided to take a different approach: disassemble LORDCFG.EXE as well.  This turned out to be a great idea, because it let me figure out the format of LORD.DAT, as well as figure out how the node files work.  I even figured out the registration code algorithm.  So I took this information with me back to LORD.EXE and quickly started filling in lots of stuff, and figuring out the bits of LORD.DAT which are impossible to know from LORDCFG.  I don't remember ever seeing anyone post what LORD.DAT's structure was before, now that I think about it, so maybe I'll do that here:

regcode1 : long
regcode2 : long
day_last_run : word ; The day of the month in which the game was last run
regcode3 : long
gamewinner : string[146] ; Name of the last winner of the game
multinode_support : byte ; Enable multi-node support
regcode4 : long
allow_bank_transfers : byte ; Allow bank transfers
max_bank_transfer : long ; Maximum amount of money transferable via the bank
human_fights : long ; Number of player vs player fights a day
regcode5 : long
grace_deletion_days : long ; Number of days until players are deleted
ANSI_score_filename : string[60] ; Path + filename to generated ANSI score file
ASCII_score_filename : string[60] ; Path + filename to generated ASCII score file
unknown_string : string[60] ; Nothing uses this that I can find
clean_mode: byte ; Enable clean mode
forest_fights : long ; Forest fights a day
registered_thanks : string ; Who to thank for registering the game
bank_transfers_per_day : byte ; Number of bank transfers allowed a day


I took the time just now to convert that from assembly stuff like "db" and "dw" to a Turbo Pascal-ish syntax, to match the PLAYER.DAT structure Seth gives in LORDSTRC.PAS.  Keep in mind that off the top of my head I don't know which of those are actually boolean/char/byte, signed/unsigned, etc.  If in question, assume it's signed.  If you're only interested in size though (like for loading it in C), long is 4 bytes, word is 2 bytes, byte is 1 byte, and strings are always 1 byte longer than specified (to hold the string length).  If no size is specified, the string is 1 size byte + 255 characters.  The entire structure is 628 bytes.

Let's see, what else?  I've been figuring out formats to all the in-game files like OUT.x, INFO.x, FIGHTx.DAT, etc.  I had to make a list of just all of the files the game uses, to keep track!  I've also been deducing/documenting the conditions which are required for certain random game events to occur.  And I started making a list of all of the special LORD color codes, since they're not all documented.

That reminds me.  Something strange I noticed is that LORDTXT.DAT has some ANSI art in it which is damaged.  I think Seth used a utility written in Pascal (probably something he wrote himself) to create the file, but unfortunately Pascal's string length limit of 255 characters resulted in some of the really long lines of ANSI getting chopped.  So the ANSI graphic of the dragon's lair, and I think the New World one, maybe another but I can't remember, have some damage; ANSI sequences just abruptly end on 2-3 lines.  That would imply it was broken like that back in the old days on the BBSes too, but I can't remember either way.

Thanks in part to Barak's House, I found the Turbo Pascal source files of some add-on libraries Seth used, which has made labeling some of the support sections and internal variables a little easier.  A lot of it I don't really need to have labeled for disassembling the game itself.  But doing so helps me find the stuff Seth himself wrote from the 3rd-party helper stuff he linked in.  But to be honest, I think I've identified 99% of the functions Seth made.  It's mostly some variables left which are giving me a headache to figure out.

I thought there was something else I wanted to mention too, but I can't think of it.  Maybe next time!


No comments:

Post a Comment