About The Mir3 Wil ,What's The Different Between Type1 and Type2?

sgf

Dedicated Member
Dedicated Member
Apr 13, 2012
41
2
35
As The Title,

---------- Post Merged at 10:33 AM ---------- Previous Post was at 10:30 AM ----------

As The Title,
Hi,Guys,I don't Understand,What's The Different Between Type1 and Type2?
is there any Attribute with the Wix or Wil Files ?

---------- Post Merged at 10:37 AM ---------- Previous Post was at 10:30 AM ----------

I Saw http://www.lomcn.org/forum/showthread.php?59553-New-Mir3-Source-discussion-Thread/page3
and http://www.lomcn.org/forum/showthread.php?67450-Mir-2-and-Mir-3-Map-Structure-Etc

but there's none any useful informations about my question.
so,any one understand about my question?
 

sgf

Dedicated Member
Dedicated Member
Apr 13, 2012
41
2
35
You can have a look here : http://www.lomcn.org/forum/showthre...cussion-Thread&p=650205&viewfull=1#post650205

in the File Header the LibType Field says what type it is.

17=Type1 (Wil/Wix)
5000=Type2 (Wil/Wix)
6000=Type3 (WTL)
thank u.

"LibType" it seems like the filed "Lib_Version" of struct TWIL_Header.
tks a lot,^^

---------- Post Merged on 09-04-2013 at 07:12 AM ---------- Previous Post was on 08-04-2013 at 07:04 AM ----------

You can have a look here : http://www.lomcn.org/forum/showthre...cussion-Thread&p=650205&viewfull=1#post650205

in the File Header the LibType Field says what type it is.

17=Type1 (Wil/Wix)
5000=Type2 (Wil/Wix)
6000=Type3 (WTL)


hi,Coly,i looked this
http://www.lomcn.org/forum/showthread.php?62299-Mir-3-WTL&p=683950&viewfull=1#post683950
.it seems long time ago,
have u made out of the WTL Format Editor,Now?
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
Not many infos here. I started to look deeply into wix/wil. Wix files are simple but there is one thing.

First - how i tested wix files:

Code:
        public bool ReadWixFile()
        {
            try
            {
                using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read))
                {
                    using (BinaryReader br = new BinaryReader(fs))
                    {
                        LibInfo = new char[20];
                        LibInfo = br.ReadChars(20);
                        ImageNumber = br.ReadInt32();

                        strangethings = new List<byte>();
                        strangethings.Add((byte)fs.Position);
                        strangethings.Add((byte)(fs.Length - (4 * ImageNumber)));
                        for(int i = (int)fs.Position; i<(int)fs.Length - (4 * ImageNumber);i++)
                        {
                            strangethings.Add((byte)fs.Position);
                            strangethings.Add(br.ReadByte());
                        }
                        

                        fs.Seek(fs.Length - (4 * ImageNumber),SeekOrigin.Begin);
                        ImagePosition = new List<int>();
                        for (int i = 0; i < ImageNumber; i++)
                        {
                            ImagePosition.Add(br.ReadInt32());
                        }
                    }
                }
            }
            catch (Exception e)
            {
#if DEBUG
                MessageBox.Show(e.ToString());
#endif
                return false;
            }
            return true;
        }

Here some output i got (Filename :: strangethings[0] _ strangethings[1] _ etc till end of list):

Code:
D:\Legend of Mir 3 - Gate of Avalon\Data\MonS-8.wix :: 24 _ 28 _ 24 _ 253 _ 25 _ 115 _ 26 _ 58 _ 27 _ 177 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\MonS-9.wix :: 24 _ 28 _ 24 _ 253 _ 25 _ 117 _ 26 _ 58 _ 27 _ 177 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\NPC.wix :: 24 _ 24 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\NPCface.wix :: 24 _ 28 _ 24 _ 251 _ 25 _ 81 _ 26 _ 58 _ 27 _ 177 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\object1c.wix :: 24 _ 24 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\object2c.wix :: 24 _ 24 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\ProgUse.wix :: 24 _ 24 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\SmObjectsc.wix :: 24 _ 28 _ 24 _ 246 _ 25 _ 123 _ 26 _ 58 _ 27 _ 177 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\SmTilesc.wix :: 24 _ 28 _ 24 _ 245 _ 25 _ 95 _ 26 _ 58 _ 27 _ 177 _ 
D:\Legend of Mir 3 - Gate of Avalon\Data\StoreItem.wix :: 24 _ 24 _

From what i see using kaorimim and kaorimim source mir3 lib type 1 wix file is like:

Code:
char[20] Info
int16 ImageNumber
int32[ImageNumber]

But type2 wix is different:

Code:
char[20] Info
int16 ImageNumber
byte[4] SomeDataIdontKnowForWhat
int32[ImageNumber]

I know wil/wix format is old - there coming new one with new client. But still many servers using wil/wix and im curious what is this strange data in type 2. If u know please share with us :) Thanks
 

Coly

LOMCN Developer
Developer
Mar 31, 2005
1,399
33
195
Germany
o.O ?? Wix is only a List with many DWords... no magic here...
the only thing on Wix file is the start offset not more...

with Mir3 Type 1
Lib_Type : 17 then the offset is 24
with Mir3 Type 2
Lib_Type : 5000 then the offset is 28

Delphi Header for wil / wix file operations :

Code:
      PWIL_Header =^TWIL_Header;
      TWIL_Header = packed record
        whValid            : Byte;                          // 1
        whLib_Info         : array [0..20] of AnsiChar;     // ILIB v1.0-WEMADE
        whLib_Type         : Word;                          // 5000=Type2 | 17=Type1
        whTotal_Index      : Word;                          // Total Image in this File
      end;

      PWIX_Header = ^TWIX_Header;
      TWIX_Header = packed record
        whLib_Info         : array [0..19] of AnsiChar;
        whTotal_Index      : Word;
      end;

      PWIL_Img_Header = ^TWIL_Img_Header;                   // WIL-File Image Offset Header
      TWIL_Img_Header = packed record
        imgWidth           : Word;                          // Image Width
        imgHeight          : Word;                          // Image Height
        imgOffset_X        : Smallint;                      // Image Offset X
        imgOffset_Y        : Smallint;                      // Image Offset Y
        imgShadow_type     : Byte;                          // Image Shadow Type
        imgShadow_Offset_X : Smallint;                      // Image Shadow Offset X
        imgShadow_Offset_Y : Smallint;                      // Image Shadow Offset Y
        imgFileSize        : Cardinal;                      // FileSize Only in Type2 
      end;
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
KaoriMiM code:
Code:
if (mirType == 3) {
            buffer.putInt(0, 0);
            buffer.putInt(4, 0);
            buffer.putInt(8, 0);
            buffer.putInt(12, 0);
            buffer.putInt(16, 0);
            buffer.putInt(20, indexCount);
            if (libType == 1) {
                for (int i = 0; i < indexCount; i++) {
                    buffer.putInt(24 + i * 4, 0);
                }
                in.write(buffer.array(), 0, 24 + indexCount * 4);
            }
            if (libType == 2) {
                buffer.putInt(24, (indexCount + 0x4E35) | 0xB13A11F0);
                for (int i = 0; i < indexCount; i++) {
                    buffer.putInt(28 + i * 4, 0);
                }
                in.write(buffer.array(), 0, 28 + indexCount * 4);
            }
        }
Kaori using this 4 bytes to check lib type + when u save lib as type 2 buffer.putInt(24, (indexCount + 0x4E35) | 0xB13A11F0);

So this is not just simple skip to other offset. But i think i just use kaori source and describe it as unknown.
 

dida

Banned
Banned
Dedicated Member
Feb 17, 2013
31
0
32
USA
do you have KaoriMiM's sources code? her svn is not accessable anymore.
 

wbrian

Dedicated Member
Dedicated Member
Aug 31, 2007
193
2
64
I do but i dont know if its complete (i have it somewhere on my old hdd). I think u should ask Kaori for the source
 

dida

Banned
Banned
Dedicated Member
Feb 17, 2013
31
0
32
USA
it seems that her is not here for a long time, and her svn is not accessable anymore, so could you plz share yours?