blind-coder / pz-mapmap

A commandline tool to convert Project Zomboid map data / savegames into PNG files
36 stars 11 forks source link

Not compatible with latest version #6

Open cff29546 opened 2 years ago

cff29546 commented 2 years ago

I'm running with mono, this command used to work with game version 41.65

C:
cd "C:\Program Files\Mono\bin"
mono.exe E:\MapMap\MapMap.exe -gfxsource E:\MapMap\TexturePacks\Erosion.pack -gfxsource E:\MapMap\TexturePacks\Tiles2x.pack -gfxsource E:\MapMap\TexturePacks\Tiles2x.floor.pack -gfxsource E:\MapMap\TexturePacks\ApCom.pack -gfxsource E:\MapMap\texturepacks\RadioIcons.pack -gfxsource E:\MapMap\TexturePacks\ApComUI.pack -mapsource E:\MapMap\Mapname_lotpack -output E:\MapMap\Mapname_output\ -dolayers true -divider 4 -maxthreads 2

but when updated E:\MapMap\TexturePacks\ and E:\MapMap\Mapname_lotpack with files from 41.66, program ended with Unhandled Exception

Boundaries: minx -99999 maxx 99999 miny -99999 maxy 99999
Threads: 2
Starting programm...
Reading texture data from: Erosion.pack
Sheet count: 5
Reading texture data from: Tiles2x.pack
Sheet count: 1263557200

Unhandled Exception:
System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.

Parameter name: chars

  at System.Text.Encoding.ThrowCharsOverflow () [0x00027] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.Encoding.ThrowCharsOverflow (System.Text.DecoderNLS decoder, System.Boolean nothingDecoded) [0x00026] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.UTF8Encoding.GetChars (System.Byte* bytes, System.Int32 byteCount, System.Char* chars, System.Int32 charCount, System.Text.DecoderNLS baseDecoder) [0x0023c] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte* bytes, System.Int32 byteCount, System.Char* chars, System.Int32 charCount, System.Boolean flush) [0x00059] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte[] bytes, System.Int32 byteIndex, System.Int32 byteCount, System.Char[] chars, System.Int32 charIndex, System.Boolean flush) [0x000a2] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte[] bytes, System.Int32 byteIndex, System.Int32 byteCount, System.Char[] chars, System.Int32 charIndex) [0x00000] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.InternalReadOneChar () [0x000e8] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.Read () [0x0000d] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.ReadChar () [0x00000] in <32116eccb94d4ed685ca661d98e36637>:0 

  at MapMapLib.MMTextures.readString (System.IO.BinaryReader binReader) [0x0001a] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.loadFromPackFile (System.IO.BinaryReader binReader, System.Int32 sn) [0x00023] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.readPackFile (System.IO.BinaryReader binReader) [0x0001e] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.Load (System.String path) [0x0003d] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Main.readTexturePacks () [0x00019] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Main.Run (System.String[] args) [0x0000c] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Program.Main (System.String[] args) [0x00006] in <36cf778331e542fdb1e14be4e7371385>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'.

Parameter name: chars

  at System.Text.Encoding.ThrowCharsOverflow () [0x00027] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.Encoding.ThrowCharsOverflow (System.Text.DecoderNLS decoder, System.Boolean nothingDecoded) [0x00026] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.UTF8Encoding.GetChars (System.Byte* bytes, System.Int32 byteCount, System.Char* chars, System.Int32 charCount, System.Text.DecoderNLS baseDecoder) [0x0023c] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte* bytes, System.Int32 byteCount, System.Char* chars, System.Int32 charCount, System.Boolean flush) [0x00059] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte[] bytes, System.Int32 byteIndex, System.Int32 byteCount, System.Char[] chars, System.Int32 charIndex, System.Boolean flush) [0x000a2] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.Text.DecoderNLS.GetChars (System.Byte[] bytes, System.Int32 byteIndex, System.Int32 byteCount, System.Char[] chars, System.Int32 charIndex) [0x00000] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.InternalReadOneChar () [0x000e8] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.Read () [0x0000d] in <32116eccb94d4ed685ca661d98e36637>:0 

  at System.IO.BinaryReader.ReadChar () [0x00000] in <32116eccb94d4ed685ca661d98e36637>:0 

  at MapMapLib.MMTextures.readString (System.IO.BinaryReader binReader) [0x0001a] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.loadFromPackFile (System.IO.BinaryReader binReader, System.Int32 sn) [0x00023] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.readPackFile (System.IO.BinaryReader binReader) [0x0001e] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMapLib.MMTextures.Load (System.String path) [0x0003d] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Main.readTexturePacks () [0x00019] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Main.Run (System.String[] args) [0x0000c] in <36cf778331e542fdb1e14be4e7371385>:0 

  at MapMap.Program.Main (System.String[] args) [0x00006] in <36cf778331e542fdb1e14be4e7371385>:0 
R4to0 commented 2 years ago

Pack format was updated it seems. Theres an extra header at start for some of the .pack file now and might have other internal structural changes, I haven't looked further. The tool will need an update.

cff29546 commented 2 years ago

Game version 41.66 introduced a new version of the texture pack file. The latest version has different behavior for serializing png files. I wrote a tool in python to convert map data into Deep zoom that can correctly parse it. Here is the part related to texture version parsing: https://github.com/cff29546/pzmap2dzi/blob/main/pzmap2dzi/texture.py#L47

blind-coder commented 2 years ago

@cff29546 Hey, that looks pretty cool! Mind if I take a poke at it?

cff29546 commented 2 years ago

@blind-coder No problem, serve yourself.

blind-coder commented 2 years ago

@cff29546 I think with a bit of work I could use that to generate the official map instead. Needs some documentation, and a tiny change to make layer 0 jpg instead of png. I'll look into it.

cff29546 commented 2 years ago

@blind-coder I think I can add a config to set the image file extension.

cff29546 commented 2 years ago

@blind-coder just added an option to use jpg for layer0, https://github.com/cff29546/pzmap2dzi/commit/4b58a094f827f65f18194eb0f74685f397e32287