GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.waspscripts.com — CacheReader Helpers CacheReader Helpers¶The primitives every decoder in this library is built out of: big-endian integer reads that advance a shared offset, the cache’s variable width number encodings, and the colour and shift conversions its formats rely on. Read N Bits¶function Read8Bits(constref data: TByteArray; var offset: Integer): Integer; function Read16Bits(constref data: TByteArray; var offset: Integer): Integer; function Read24Bits(constref data: TByteArray; var offset: Integer): Integer; function Read32Bits(constref data: TByteArray; var offset: Integer): Integer; function Read64Bits(constref data: TByteArray; var offset: Integer): Int64; Reads the next
All reads are big-endian (most significant byte first) and For example, imagine the following data represented in hexadecimal and that our starting offset is 3: Data: 4A F3 02 C1 01 06 FF AB 2A C2 DF D7 66 Offset: ^^ If we use Data: 4A F3 02 C1 01 06 FF AB 2A C2 DF D7 66 Offset: ¯¯ ¯¯ ^^ Our result will be Data: 4A F3 02 C1 01 06 FF AB 2A C2 DF D7 66 Offset: ¯¯ ¯¯ ¯¯ ¯¯ ^^ The result will be Read16SignedBits¶function Read16SignedBits(constref data: TByteArray; var offset: Integer): Integer; Reads the next 16 bits from
Unsigned 16-bit values range from For example, the raw bytes Read8SignedBits¶function Read8SignedBits(constref data: TByteArray; var offset: Integer): Integer; Reads the next 8 bits from Unsigned 8-bit values range from ReadBigSmart¶function ReadBigSmart(constref data: TByteArray; var offset: Integer): Integer; Reads an id that may or may not fit in 16 bits. The top bit of the first byte says which: clear means the id was written as 2 bytes, set means
it was written as 4 with that flag bit masked back off. ReadBigSmart2¶function ReadBigSmart2(constref data: TByteArray; var offset: Integer): Integer; ReadBigSmart for fields that are allowed to be absent. The 2 byte form reserves ReadShortSmart¶function ReadShortSmart(constref data: TByteArray; var offset: Integer): Integer; Reads a signed value written in as few bytes as it needed. The top bit of the first byte picks the width: clear is a single byte biased by ReadUnsignedShortSmart¶function ReadUnsignedShortSmart(constref data: TByteArray; var offset: Integer): Integer; ReadShortSmart without the bias, so the value is never negative. A single byte covers ReadUnsignedIntSmartShortCompat¶function ReadUnsignedIntSmartShortCompat(constref data: TByteArray; var offset: Integer): Integer; Reads a value that can exceed what ReadUnsignedShortSmart alone can express.
ReadVarInt2¶function ReadVarInt2(constref data: TByteArray; var offset: Integer): Integer; Reads a value written as a run of 7-bit groups, least significant group first. Each byte contributes its low 7 bits to the result, in order; a set top bit says another byte follows. This is how TDBRowDefinition.Create reads a row’s table id - unlike the other smart encodings above, the byte count is not capped at two. TByteArray.ReadCString¶function TByteArray.ReadCString(var offset: Integer): String; Reads the NUL terminated string starting at
Char.ToHex¶function Char.ToHex(): Integer; The value of a single hexadecimal digit, in either case. Anything else reads as CacheString2Hash¶function CacheString2Hash(const s: String): Integer; The hash the cache stores in place of a name. Archives and files are named by this hash rather than by text, so looking one up by name means hashing the name and comparing - see TReferenceTable.ArchiveID. CacheString2UTF8¶function CacheString2UTF8(const s: String): String; Turns a string as the cache stores it, one byte per character, into UTF-8. TColor.ToHSLEx¶function TColor.ToHSLEx(): TColorHSLEx; Splits a colour into hue, saturation and lightness. The result carries each component twice: as the The channels are read back to front on purpose: the cache stores its colours as RGB while TColor is BGR, so the blue channel holds what this conversion treats as red. ArithmeticShr¶function ArithmeticShr(value, bits: Integer): Integer; Right shift that keeps the sign of Pascal’s |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |