mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-02-02 19:56:13 +01:00
Fix 64 bit by skipping static_asserts for structs with pointers
This commit is contained in:
@@ -41,8 +41,9 @@ typedef struct rct_ride_music {
|
||||
uint16 frequency;
|
||||
void* sound_channel;
|
||||
} rct_ride_music;
|
||||
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_ride_music) == 12, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_ride_music_info {
|
||||
uint32 length;
|
||||
@@ -50,7 +51,6 @@ typedef struct rct_ride_music_info {
|
||||
uint8 path_id;
|
||||
uint8 var_9;
|
||||
} rct_ride_music_info;
|
||||
|
||||
STATIC_ASSERT (sizeof(rct_ride_music_info) == 10, "Improper struct size");
|
||||
|
||||
typedef struct rct_ride_music_params {
|
||||
@@ -61,7 +61,6 @@ typedef struct rct_ride_music_params {
|
||||
sint16 pan;
|
||||
uint16 frequency;
|
||||
} rct_ride_music_params;
|
||||
|
||||
STATIC_ASSERT (sizeof(rct_ride_music_params) == 12, "Improper struct size");
|
||||
|
||||
typedef struct rct_vehicle_sound {
|
||||
@@ -78,8 +77,9 @@ typedef struct rct_vehicle_sound {
|
||||
void* sound1_channel;
|
||||
void* sound2_channel;
|
||||
} rct_vehicle_sound;
|
||||
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_vehicle_sound) == 28, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_vehicle_sound_params {
|
||||
uint16 id;
|
||||
@@ -89,7 +89,6 @@ typedef struct rct_vehicle_sound_params {
|
||||
sint16 volume;
|
||||
uint16 var_A;
|
||||
} rct_vehicle_sound_params;
|
||||
|
||||
STATIC_ASSERT (sizeof(rct_vehicle_sound_params) == 12, "Improper struct size");
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
#define PLATFORM_X86
|
||||
#endif
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64)
|
||||
#define PLATFORM_64BIT
|
||||
#else
|
||||
#define PLATFORM_32BIT
|
||||
#endif
|
||||
|
||||
// C99's restrict keywords guarantees the pointer in question, for the whole of its lifetime,
|
||||
// will be the only way to access a given memory region. In other words: there is no other pointer
|
||||
// aliasing the same memory area. Using it lets compiler generate better code. If your compiler
|
||||
|
||||
@@ -31,7 +31,9 @@ typedef struct rct_drawpixelinfo {
|
||||
short pitch; // 0x0C note: this is actually (pitch - width)
|
||||
uint16 zoom_level; // 0x0E
|
||||
} rct_drawpixelinfo;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_drawpixelinfo) == 0x10, "Improper struct size");
|
||||
#endif
|
||||
|
||||
// Size: 0x10
|
||||
typedef struct rct_g1_element {
|
||||
@@ -43,7 +45,9 @@ typedef struct rct_g1_element {
|
||||
uint16 flags; // 0x0C
|
||||
uint16 zoomed_offset; // 0x0E
|
||||
} rct_g1_element;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_g1_element) == 0x10, "Improper struct size");
|
||||
#endif
|
||||
|
||||
enum {
|
||||
G1_FLAG_BMP = (1 << 0), //No invisible sections
|
||||
@@ -68,7 +72,9 @@ typedef struct rct_gx {
|
||||
rct_g1_element *elements;
|
||||
void *data;
|
||||
} rct_gx;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_gx) == 16, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_palette_entry {
|
||||
uint8 blue;
|
||||
|
||||
@@ -81,7 +81,9 @@ typedef struct rct_object_entry_group {
|
||||
uint8 **chunks;
|
||||
rct_object_entry_extended *entries;
|
||||
} rct_object_entry_group;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_object_entry_group) == 8, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_ride_filters {
|
||||
uint8 category[2];
|
||||
|
||||
@@ -39,8 +39,10 @@ struct attached_paint_struct {
|
||||
uint8 pad_0D;
|
||||
attached_paint_struct* next; //0x0E
|
||||
};
|
||||
#ifdef PLATFORM_32BIT
|
||||
// TODO: drop packing from this when all rendering is done.
|
||||
STATIC_ASSERT (sizeof(attached_paint_struct) == 0x12, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct paint_struct paint_struct;
|
||||
|
||||
@@ -73,8 +75,10 @@ struct paint_struct {
|
||||
uint16 map_y; // 0x2E
|
||||
rct_map_element *mapElement; // 0x30 (or sprite pointer)
|
||||
};
|
||||
#ifdef PLATFORM_32BIT
|
||||
// TODO: drop packing from this when all rendering is done.
|
||||
STATIC_ASSERT (sizeof(paint_struct) == 0x34, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct paint_string_struct paint_string_struct;
|
||||
|
||||
@@ -87,7 +91,9 @@ struct paint_string_struct {
|
||||
uint32 args[4]; // 0x0A
|
||||
uint8 *y_offsets; // 0x1A
|
||||
};
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(paint_string_struct) == 0x1e, "Improper struct size");
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct sprite_bb {
|
||||
|
||||
@@ -122,7 +122,9 @@ typedef struct rct_ride_entry {
|
||||
uint8 shop_item; // 0x1C0
|
||||
uint8 shop_item_secondary; // 0x1C1
|
||||
} rct_ride_entry;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_ride_entry) == 0x1c2, "Improper struct size");
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Ride structure.
|
||||
@@ -363,7 +365,9 @@ typedef struct track_begin_end {
|
||||
int end_direction;
|
||||
rct_map_element *end_element;
|
||||
} track_begin_end;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(track_begin_end) == 36, "Improper struct size");
|
||||
#endif
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
@@ -147,7 +147,9 @@ typedef struct rct_track_td6 {
|
||||
utf8 *name;
|
||||
} rct_track_td6;
|
||||
//Warning: improper struct size in comment
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_track_td6) == 0xbf, "Improper struct size");
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef struct track_design_file_ref {
|
||||
|
||||
@@ -77,7 +77,9 @@ typedef struct rct_ride_entry_vehicle {
|
||||
uint8 special_frames; // 0x60 , 0x7A
|
||||
sint8* peep_loading_positions; // 0x61 , 0x7B
|
||||
} rct_ride_entry_vehicle;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_ride_entry_vehicle) == 0x65, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_vehicle {
|
||||
uint8 sprite_identifier; // 0x00
|
||||
|
||||
@@ -398,7 +398,9 @@ typedef struct scenario_highscore_entry {
|
||||
datetime64 timestamp;
|
||||
} scenario_highscore_entry;
|
||||
// NOTE: Check if needed
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(scenario_highscore_entry) == 20, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct scenario_index_entry {
|
||||
utf8 path[MAX_PATH];
|
||||
|
||||
@@ -276,7 +276,9 @@ typedef struct rct_xy_element {
|
||||
int x, y;
|
||||
rct_map_element *element;
|
||||
} rct_xy_element;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_xy_element) == 12, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct2_peep_spawn {
|
||||
uint16 x;
|
||||
@@ -442,7 +444,9 @@ typedef struct map_element_iterator {
|
||||
int y;
|
||||
rct_map_element *element;
|
||||
} map_element_iterator;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(map_element_iterator) == 12, "Improper struct size");
|
||||
#endif
|
||||
|
||||
void map_element_iterator_begin(map_element_iterator *it);
|
||||
int map_element_iterator_next(map_element_iterator *it);
|
||||
|
||||
@@ -104,8 +104,9 @@ typedef struct rct_large_scenery_entry {
|
||||
rct_large_scenery_text* text; // 0x12
|
||||
uint32 text_image; // 0x16
|
||||
} rct_large_scenery_entry;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_large_scenery_entry) == 20, "Improper struct size");
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct rct_wall_scenery_entry {
|
||||
uint8 tool_id; // 0x06
|
||||
@@ -161,7 +162,9 @@ typedef struct rct_scenery_entry {
|
||||
rct_banner_scenery_entry banner;
|
||||
};
|
||||
} rct_scenery_entry;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_scenery_entry) == 6 + 21, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_scenery_set_entry {
|
||||
rct_string_id name; // 0x00
|
||||
|
||||
@@ -352,13 +352,17 @@ typedef struct rct_sprite_image {
|
||||
uint32 base_image; // 0x00
|
||||
uint8* unkn_04; // 0x04
|
||||
} rct_sprite_image;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_sprite_image) == 8, "Improper struct size");
|
||||
#endif
|
||||
|
||||
typedef struct rct_sprite_entry {
|
||||
rct_sprite_image *sprite_image; // 0x00
|
||||
rct_sprite_bounds *sprite_bounds; // 0x04
|
||||
} rct_sprite_entry;
|
||||
#ifdef PLATFORM_32BIT
|
||||
STATIC_ASSERT (sizeof(rct_sprite_entry) == 8, "Improper struct size");
|
||||
#endif
|
||||
#pragma pack(pop)
|
||||
|
||||
enum {
|
||||
|
||||
Reference in New Issue
Block a user