Hello,
i stuck on how to interpret some byte values i got from a game.
In this case i read data from a bytearray
From my research i found information on a simular app written in C.
So i guess i need to do the same with the values...
In this example i would like to split the byte into its two values. Here the values of
How could i do this in b4j?
i stuck on how to interpret some byte values i got from a game.
In this case i read data from a bytearray
B4X:
Dim b As Byte = raf.ReadunsignedByte(10)
Log("RaceStateFlags:"&NumberFormat2(Bit.ToBinaryString(Bit.And(0xff, b)), 8, 0, 0, False)&" -> "&b)
From my research i found information on a simular app written in C.
B4X:
// mTelemetryData.sGameSessionState=((u8)pMemory->mGameState)|(((u8)pMemory->mSessionState)<<4); // (enum 3 bits/enum 3 bits)->u8
#define UNPACK_TELEMETRY_GAMESTATE(ptr) UNPACK_UNSIGNED((ptr)->sGameSessionState, 3, 0)
#define UNPACK_TELEMETRY_SESSIONSTATE(ptr) UNPACK_UNSIGNED((ptr)->sGameSessionState, 3, 4)
So i guess i need to do the same with the values...
In this example i would like to split the byte into its two values. Here the values of
andUNPACK_UNSIGNED((ptr)->sGameSessionState, 3, 0)
UNPACK_UNSIGNED((ptr)->sGameSessionState, 3, 4)
How could i do this in b4j?