Data Types: Difference between revisions
From RuneWiki
No edit summary |
|||
Line 70: | Line 70: | ||
|pjstr | |pjstr | ||
|Writes a string. | |Writes a string. | ||
|- | |||
|ip2 | |||
|Writes a little-endian short. | |||
|- | |||
|ip4 | |||
|Writes a little-endian int. | |||
|- | |||
|g2s | |||
|Reads a signed short. | |||
|- | |||
|g2sadd | |||
|Reads a signed short, and applies the "add" transformation. | |||
|} | |} |
Revision as of 12:56, 7 June 2023
Nomenclature
Endianness
(none) - big (DCBA)
i - "inverse" (little) (ABCD)
m - "middle" (CDAB) - not an authentic name, no clue on original
im - "inverse-middle" (reverse) (BADC) - not an authentic name, jagex may call this "_alt3"
Operations
g - get
p - put
Types
number of bytes - fixed size
smart - 0 to 32768 (unsigned), -16384 to +16383 (signed)
float - standard 32-bit floating point number
jstr - NUL-terminated / Newline-terminated (depending on revision) string
jstr2 - version-prefixed jstr (unused)
data - raw data (size known ahead of time/elsewhere)
VarSmart - variable-length smart
VarInt - variable-length int
VarLong - variable-length long
Signedness
(none) - unsigned, depending on exact circumstances with Java's int/long implementation
signed - explicitly signed, allowed to overflow
Transformation
(none) - no change
add - add 128 to the lowest byte
sub - subtract lowest byte from 128
neg - negate, only used on byte types
Operation Table
Operation | Description |
---|---|
p1 | Writes a single byte (8-bits). |
p2 | Writes a short (2 bytes / 16-bits). |
p3 | Writes a medium (3 bytes / 24-bits). |
p4 | Writes an int (4 bytes / 32-bits). |
p8 | Writes a long (8 bytes / 64-bits). |
pjstr | Writes a string. |
ip2 | Writes a little-endian short. |
ip4 | Writes a little-endian int. |
g2s | Reads a signed short. |
g2sadd | Reads a signed short, and applies the "add" transformation. |