Jump to content
SubSpace Forum Network

Recommended Posts

Posted

Open #boss.lvl , import PsyBoss1.lvz, save lvl and lvz, exit.

 

Once you get back into it, it gives an elvl error. and some tiles out of range or something.

 

Hope this helps, and I would like a fix =).

Drake-Bug.zip

Posted

DCME usually adds a custom eLVL tag in the file to indicate a lvz file associated with the map. It doesn't seem to be adding it properly, though... I'll have to look into it later.

 

#boss.lvl @ OpenMap, Bitmap info header:

--- Color Depth: 24

--- Size: 304x160

--- BiSizeImage: 145920

--- Compression: 0

#boss.lvl @ OpenMap, Bitmap info header:

--- bfType: 19778

--- bfSize: 146176

--- bfReserved1: 145976 (145976)

#boss.lvl @ Openmap, BMPData is read from lvl file

#boss.lvl @ OpenMap, trying to read eLVL data

#boss.lvl @ eLVL.GetELVLData, eLVL header info:

--- magic: elvl

--- size: 200

--- reserved: 0

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (10) at 145989

#boss.lvl @ Name = #boss

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (11) at 146009

#boss.lvl @ Version = 1.0

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (5) at 146029

#boss.lvl @ Zone =

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (17) at 146045

#boss.lvl @ MapCreator = PsyOps

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (19) at 146073

#boss.lvl @ Program = DCME 3.4.13

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: ATTR (15) at 146101

#boss.lvl @ TilesetCreator =

#boss.lvl @ eLVL.GetELVLData, Chunk loaded: DCID (:D at 146125

#boss.lvl @ MapID = 2B617057

--- Mbox prompt --- DCME - Invalid eLVL chunk size;48

--- Mbox result --- DCME - Invalid eLVL chunk size;1

 

[...]

 

Map loaded successfully

Reading ''

Attempting to loaddd ''

Posted

Wow... I see the problem in the data, but I have no idea how it occured...

 

As I said, we put a "DCLV" eLVL chunk to associate a lvz file with the map. This chunk is supposed to go like this:

 

Bytes 1-4: "DCLV"

Bytes 5-8: size of chunk (32 + strlen(filename))

Bytes 9-40:MD5 checksum of the file to see if it still matches (this SHOULD be 32 bytes long)

Bytes 41-...: Filename (non-null terminated)

 

For some reason, the MD5 checksum is only 16 bytes long in the file...

 

Are you using a 64-bit OS?

 

... Actually, when I look at the code that generates the MD5 checksum, I have no idea how it could ever output 32 bytes... It's an array of 4 'Long' integers, which are 4 bytes in VB6 ('Integer's being 2 bytes)

 

Edit: MD5 checksums are actually 128 bits, or 16 bytes... but they're often represented as hexadecimal strings, which use 2 characters to represent one byte, which gives a 32 bytes string.

 

That's quite a massive bug, actually... and I have no idea why it doesn't crash more often. Most of my maps that have this load without any problem, even though the eLVL chunk is clearly the wrong size.

 

Relevant code:

 

 

   '... eLVL save function

   'DCLV lvz paths chunks
   If FlagIs(flags, SFsaveELVLdclv) Then
       For i = 0 To parent.lvz.getLVZCount - 1
           Dim lvzname As String
           lvzname = parent.lvz.getLVZname(i)
           parent.AddDebug "eLVL.PutELVLData, Saving LVZ '" & lvzname & "' at " & Seek(f)
           
           Put #f, , stringToBytes("DCLV")
           Put #f, , CLng(32 + Len(lvzname))
           
           'MD5 hash
           Dim md5 As New clsMD5
           Put #f, , md5.CalculateMD5(parent.lvz.getLVZpath(i))
           
           'Lvz name (relative path)
           Put #f, , stringToBytes(lvzname)
           
           Seek #f, Next4bytes(Seek(f))
       Next
   End If

 

 

 

 

 

Public Function CalculateMD5(filename As String) As Long()
         Dim bytBuffer() As Byte
10        If Not FileExists(filename) Then
20            ReDim bytBuffer(0)
30            bytBuffer(0) = 0
40        Else
50            ReDim bytBuffer(FileLen(filename) - 1)
             
             Dim f As Integer
60            f = FreeFile
70            Open filename For Binary As #f
80            Get #f, , bytBuffer
90            Close #f
             
100       End If
         
110       MD5Start
120       MD564Split UBound(bytBuffer) + 1, bytBuffer
130       MD5Finish
         
         Dim retlng() As Long
140       ReDim retlng(3)
         
         Dim i As Integer
150       For i = 0 To 3
160           retlng(i) = arrLongConversion(i + 1)
170       Next
         
180       CalculateMD5 = retlng
         
End Function

 

 

  • 2 weeks later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...