void *get_network_physics_buffer( long *physics_length) { void *data= get_flat_data(PhysicsFileSpec, false, 0); if(data) { *physics_length= get_flat_data_length(data); } else { *physics_length= 0; } return data; }
void *get_network_physics_buffer( int32 *physics_length) { if (physics_file_is_m1()) { bool success = false; uint8 *data = NULL; OpenedFile PhysicsFile; if (PhysicsFileSpec.Open(PhysicsFile) && PhysicsFile.GetLength(*physics_length)) { data = (uint8 *)malloc(*physics_length + 4); SDL_RWops *ops = SDL_RWFromMem(data, *physics_length + 4); success = SDL_WriteBE32(ops, uint32(M1_PHYSICS_MAGIC_COOKIE)); if (success) success = SDL_WriteBE32(ops, uint32(*physics_length)); SDL_RWclose(ops); if (success) success = PhysicsFile.Read(*physics_length, &data[8]); if (!success) free(data); } if (!success) { *physics_length = 0; return NULL; } return data; } short SavedType, SavedError = get_game_error(&SavedType); void *data= get_flat_data(PhysicsFileSpec, false, 0); set_game_error(SavedType, SavedError); if(data) { *physics_length= get_flat_data_length(data); } else { *physics_length= 0; } return data; }