zBin Packer SDK - Crossplattform

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: zBin Packer SDK - Crossplattform

Post by ts-soft »

skywalk wrote:Hi ts-soft,
Can you check if this is correct? ...
I think, the help is not correct. The ciphering using always 16 Bytes.
skywalk wrote:And PB5 updated to zlib v125, so safe to use internal compressBound() and crc32().

Code: Select all

destLen = compressBound(sourceLen)  ; destLen = sourceLen + 13 + (Int(sourceLen / 100))

FileHeader\crc = crc32(#Null, *mem, size)    ; CRC32Fingerprint(*mem, size)
Thanks for the hint, i have changed to compressBound, crc is unchanged, this make no difference.
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: zBin Packer SDK - Crossplattform

Post by ts-soft »

Update:
History wrote:; V 1.6.3 12/11/25
; using compressBound(sourceLen)
; changed stringcompare with not to = 0 for compatibility to PB 5.00
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Re: zBin Packer SDK - Crossplattform

Post by JCV »

I tried to update the code to PB 5.4 Beta but I'm getting crc error when reading *.ico files but ok with png in zbin file. Any idea?

Code: Select all

UseMD5Fingerprint()
;If MD5Fingerprint(*keybuffer, #zBin_HASH_Size) <> PeekS(@\Header\HASH[0], -1, #PB_Ascii)
If Fingerprint(*keybuffer, #zBin_HASH_Size, #PB_Cipher_MD5) <> PeekS(@\Header\HASH[0], -1, #PB_Ascii)

Code: Select all

UseCRC32Fingerprint()
;If CRC32Fingerprint(*dest, MemorySize(*dest)) = \FileInfo(Number - 1)\crc
If Val("$" + Fingerprint(*dest, MemorySize(*dest), #PB_Cipher_CRC32)) = \FileInfo(Number - 1)\crc

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: zBin Packer SDK - Crossplattform

Post by ts-soft »

Add at the end of "zBin_Common.pbi"

Code: Select all

CompilerIf #PB_Compiler_Version >= 540
  UseMD5Fingerprint()
  Procedure.s MD5Fingerprint(*hashbuffer, Size)
    ProcedureReturn Fingerprint(*hashbuffer, Size, #PB_Cipher_MD5)
  EndProcedure
  UseCRC32Fingerprint()
  Procedure CRC32Fingerprint(*mem, size)
    ProcedureReturn Val("$" + Fingerprint(*mem, size, #PB_Cipher_CRC32))
  EndProcedure
CompilerEndIf
I hope, this works.

Greetings Thomas
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Re: zBin Packer SDK - Crossplattform

Post by JCV »

Hi Thomas, its still crc error. It only happens when reading *.ico files in zbin. I'm testing the gui unpacker code.
\FileInfo(Number-1)\crc
negative value when reading *.ico in zBinUnpack_CatchFile. Reading png is ok.

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
DK5UR
User
User
Posts: 23
Joined: Mon Jun 23, 2008 9:44 pm
Location: Laubach

Re: zBin Packer SDK - Crossplattform

Post by DK5UR »

It's an unsigned long comparing with integer probem.
NicTheQuick pointed me to this at http://www.purebasic.fr/german/viewtopi ... 75#p332175 :idea: .
Just replace each
\FileInfo(Number-1)\crc
in the zBin_Unpack.pbi with

Code: Select all

\FileInfo(Number-1)\crc & $ffffffff
This do the trick, quick and dirty

Heinz
JCV
Enthusiast
Enthusiast
Posts: 579
Joined: Fri Jun 30, 2006 4:30 pm
Location: Middle East

Re: zBin Packer SDK - Crossplattform

Post by JCV »

Thanks DK5UR! It did the trick.

[Registered PB User since 2006]
[PureBasic 5.7][SpiderBasic 2.2] [Win 10 64bit]
[Intel i7 990x 4.20 Ghz] [18GB DDR3]
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: zBin Packer SDK - Crossplattform

Post by ts-soft »

Update:
Historie wrote:; V 1.7.0 15/10/22
; changed crc fingerprint and casting to reflect new PB5.40
; changed waponez-example to comptatible with modern GrafikCards
; some GUI changes to work with GTK3
; all tools recompiled and tested
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
GoodNPlenty
Enthusiast
Enthusiast
Posts: 107
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

Re: zBin Packer SDK - Crossplattform

Post by GoodNPlenty »

Thank You for the update and awesome packer SDK :D
Post Reply