Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Development

Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 12-28-2003, 09:31 AM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default WLD file format

Not sure which forum this is appropriate in, so I'll just drop it here.

The WLD file format is fairly simple once you break it down into fragments. The header is 24 bytes long, and is as follows:

Code:
struct WLD_Header {
/* 0x0000 */ unsigned long features[2]; // Info used to analyze what features the WLD uses.
/* 0x0008 */ unsigned long maxFragment; // Number of fragments in the file.
/* 0x000C */ unsigned long unk[2]; // 8 bytes of unknown data, usually 0x1DBB and 0x680D4.
/* 0x0014 */ unsigned long nameHash_size; // The length of the namehash.
};
I am unsure as to what the values of the two longs in the features field or in the unk field are used for, as of yet. The maxFragment field is the number of fragments. The nameHash_size field is the length of the namehash in the file.

After the header comes the namehash, and its length is, of course, the value of nameHash_size. The namehash is encoded and decoded using the following algorithm (thanks to the creators of ZoneConvertor for the algorithm):

Code:
function Code($data, $size)
{
  $codes = array(0x95, 0x3A, 0xC5, 0x2A, 0x95, 0x7A, 0x95, 0x6A);
  for($i = 0; $i < $size; ++$i)
    $data{$i} = chr(ord($data{$i}) ^ $codes[$i & 7]);
}
Next comes maxFragment number of fragments which are in the format of this struct:

Code:
struct WLD_Fragment {
/* 0x0000 */ unsigned long size; // The size of the fragment.
/* 0x0004 */ unsigned long object; // Fragment type.
};
After the struct, comes the fragment data itself, which is as long as the size field of the struct indicates. Valid fragment/object types are 0x03, 0x04, 0x05, 0x06, 0x07, 0x10, 0x11, 0x12, 0x13, 0x14, 0x17, 0x18, 0x21, 0x22, 0x26, 0x27, 0x2C, 0x2D, 0x30, 0x31, 0x34, 0x36. If the fragment/object type is set to something else, then it's of type "DataWithName", according to ZoneConvertor. What is done with the fragment data depends on the fragment/object type.


Hopefully my info is accurate

Cheers,
Daeken
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
  #2  
Old 12-28-2003, 10:12 AM
daeken_bb
Discordant
 
Join Date: Mar 2003
Location: Chambersburg, PA
Posts: 469
Default Data03 and Data04

Data03 fragments start with an unsigned long that has the count of chunks in the fragment. Each chunk has an unsigned short which is the length of the data stored in the chunk, and then that many bytes of data.
This data is encoded using the algorithm used for the nameHash in the WLD file header.

Data04 fragments start with an unsigned long containing flags, and then an unsigned long with the count of fragment references.
If the flags & 0x4 != 0, then there is an unsigned long containing "parameter" 1.
If the flags & 0x8 != 0, then there is an unsigned long containing "parameter" 2.
After the optional data is a number of fragment references, indicated by the count in the Data04 header.
Each fragment reference is unsigned long containing the fragment index it references.
__________________
Keep me unemployed and working on OpenEQ, PM me about donating

Check out my deviantART page at http://daeken.deviantart.com/
Reply With Quote
Reply


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

   

All times are GMT -4. The time now is 06:39 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3