Exemplo n.º 1
0
int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val)
{
    PHYSFS_uint32 in;
    BAIL_IF_MACRO(val == NULL, ERR_INVALID_ARGUMENT, 0);
    BAIL_IF_MACRO(PHYSFS_read(file, &in, sizeof (in), 1) != 1, NULL, 0);
    *val = PHYSFS_swapUBE32(in);
    return(1);
} /* PHYSFS_readUBE32 */
Exemplo n.º 2
0
// create the hash for that data block.
// Data should be converted to Network byte order
static void calcDataHash(uint8_t *pBuffer, uint32_t size, uint32_t index)
{
	const uint32_t oldHash = DataHash[index];

	if (!bMultiPlayer)
	{
		return;
	}

	DataHash[index] ^= PHYSFS_swapUBE32(hashBuffer(pBuffer, size));

	if (!DataHash[index] && oldHash)
	{
		debug(LOG_NET, "The new hash is 0, the old hash was %u. We XOR'ed the same value!", oldHash);
	}

	debug(LOG_NET, "DataHash[%2u] = %08x", index, PHYSFS_swapUBE32(DataHash[index])); 

	return;
}
Exemplo n.º 3
0
int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val)
{
    PHYSFS_uint32 out = PHYSFS_swapUBE32(val);
    BAIL_IF_MACRO(PHYSFS_write(file, &out, sizeof (out), 1) != 1, NULL, 0);
    return(1);
} /* PHYSFS_writeUBE32 */
Exemplo n.º 4
0
uint32 Util::swapUBE32(uint32 value) {
	return PHYSFS_swapUBE32(value);
}