JubeatPlus 3.9.11
Loading...
Searching...
No Matches
packed_bit_table.h File Reference

A helper that stores a two-bit value into a packed byte table. More...

Go to the source code of this file.

Functions

void SetPackedTwoBitValue (unsigned char *pbTable, unsigned int nIndex, unsigned int nValue)
 Stores a two-bit value at an entry index into a packed byte table.

Detailed Description

A helper that stores a two-bit value into a packed byte table.

Reconstructed from Ghidra program Jubeat (image base 0x100000000); all

Ghidra address:
values are offsets relative to that image base. This is a genuine free function: it takes a raw byte buffer rather than an object receiver, and the binary carries no RTTI, embedded source path, or owning class for it, so the reconstruction rules' search for an owning class is exhausted. The basename is inferred because the shipped binary embeds no __FILE__ path. Called three times from -[GameViewController saveScore] at 0x121f8, which packs per-marker state into a compact table.

Function Documentation

◆ SetPackedTwoBitValue()

void SetPackedTwoBitValue ( unsigned char * pbTable,
unsigned int nIndex,
unsigned int nValue )

Stores a two-bit value at an entry index into a packed byte table.

Four entries share each byte: entry nIndex lives at byte nIndex>>2 and occupies the two bits at shift (nIndex&3)*2. The two bits are written independently, each with its own test-and-mask, and the intermediate byte from the first bit is carried into the second, so there is exactly one load and up to two stores rather than a read-modify-write per bit. Bits belonging to neighbouring entries in the same byte are preserved. There is no bounds check: the caller owns the table's size.

Parameters
pbTableThe base of the packed byte table.
nIndexThe entry index, not a byte offset.
nValueThe value to store; only bits 0 and 1 are used and higher bits are ignored.
Ghidra address:
0x1ab548