diff --git a/src/addresses.h b/src/addresses.h index 23db0dd901..7c61b76a5f 100644 --- a/src/addresses.h +++ b/src/addresses.h @@ -666,7 +666,7 @@ typedef struct registers { struct { char al; char ah; - }; + } PACKED; }; union { int ebx; @@ -674,7 +674,7 @@ typedef struct registers { struct { char bl; char bh; - }; + } PACKED; }; union { int ecx; @@ -682,7 +682,7 @@ typedef struct registers { struct { char cl; char ch; - }; + } PACKED; }; union { int edx; @@ -690,7 +690,7 @@ typedef struct registers { struct { char dl; char dh; - }; + } PACKED; }; union { int esi; @@ -704,7 +704,7 @@ typedef struct registers { int ebp; short bp; }; -} registers; +} PACKED registers; static int RCT2_CALLFUNC_Y(int address, registers *inOut) { diff --git a/src/audio/audio.c b/src/audio/audio.c index 19e3a84354..95dbe006dc 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -32,7 +32,7 @@ typedef struct rct_audio_params { bool in_range; int volume; int pan; -} rct_audio_params; +} PACKED rct_audio_params; audio_device *gAudioDevices = NULL; int gAudioDeviceCount; diff --git a/src/audio/audio.h b/src/audio/audio.h index 77dadeef91..cb62ad8ba0 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -29,7 +29,7 @@ typedef struct audio_device { char name[AUDIO_DEVICE_NAME_SIZE]; -} audio_device; +} PACKED audio_device; typedef struct rct_ride_music { uint8 ride_id; @@ -38,14 +38,14 @@ typedef struct rct_ride_music { sint16 pan; uint16 frequency; void* sound_channel; -} rct_ride_music; +} PACKED rct_ride_music; typedef struct rct_ride_music_info { uint32 length; uint32 offset; uint8 path_id; uint8 var_9; -} rct_ride_music_info; +} PACKED rct_ride_music_info; typedef struct rct_ride_music_params { uint8 ride_id; @@ -54,7 +54,7 @@ typedef struct rct_ride_music_params { sint16 volume; sint16 pan; uint16 frequency; -} rct_ride_music_params; +} PACKED rct_ride_music_params; typedef struct rct_vehicle_sound { uint16 id; @@ -69,7 +69,7 @@ typedef struct rct_vehicle_sound { uint16 sound2_freq; void* sound1_channel; void* sound2_channel; -} rct_vehicle_sound; +} PACKED rct_vehicle_sound; typedef struct rct_vehicle_sound_params { uint16 id; @@ -78,7 +78,7 @@ typedef struct rct_vehicle_sound_params { uint16 frequency; sint16 volume; uint16 var_A; -} rct_vehicle_sound_params; +} PACKED rct_vehicle_sound_params; typedef enum RCT2_SOUND { SOUND_LIFT_1 = 0, diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index 79735ac26f..2b53e53e53 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -146,7 +146,7 @@ bool Source_Sample::LoadCSS1(const char *filename, unsigned int offset) Uint16 blockalign; Uint16 bitspersample; Uint16 extrasize; - } waveformat; + } PACKED waveformat; SDL_RWread(rw, &waveformat, sizeof(waveformat), 1); format.freq = waveformat.frequency; format.format = AUDIO_S16LSB; @@ -270,7 +270,7 @@ bool Source_SampleStream::LoadWAV(SDL_RWops* rw) Uint32 byterate; Uint16 blockalign; Uint16 bitspersample; - } waveformat; + } PACKED waveformat; SDL_RWread(rw, &waveformat, sizeof(waveformat), 1); SDL_RWseek(rw, chunkstart + fmtchunk_size, RW_SEEK_SET); const Uint16 pcmformat = 0x0001; diff --git a/src/audio/mixer.h b/src/audio/mixer.h index bac6effcaa..b2097a01f2 100644 --- a/src/audio/mixer.h +++ b/src/audio/mixer.h @@ -43,12 +43,12 @@ extern "C" { #include } -struct AudioFormat { - int BytesPerSample() const { return (SDL_AUDIO_BITSIZE(format)) / 8; }; +typedef struct AudioFormat { + int BytesPerSample() const { return (SDL_AUDIO_BITSIZE(format)) / 8; } int freq; SDL_AudioFormat format; int channels; -}; +} PACKED AudioFormat; class Source { diff --git a/src/cmdline/CommandLine.hpp b/src/cmdline/CommandLine.hpp index 52b96ae297..1633dc6a69 100644 --- a/src/cmdline/CommandLine.hpp +++ b/src/cmdline/CommandLine.hpp @@ -60,7 +60,7 @@ struct CommandLineExample { const char * Arguments; const char * Description; -}; +} PACKED; struct CommandLineOptionDefinition { @@ -69,7 +69,7 @@ struct CommandLineOptionDefinition char ShortName; const char * LongName; const char * Description; -}; +} PACKED; struct CommandLineCommand { @@ -78,7 +78,7 @@ struct CommandLineCommand const CommandLineOptionDefinition * Options; const CommandLineCommand * SubCommands; CommandLineFunc Func; -}; +} PACKED; enum { diff --git a/src/cmdline_sprite.c b/src/cmdline_sprite.c index 62d3a399d5..f4891747cc 100644 --- a/src/cmdline_sprite.c +++ b/src/cmdline_sprite.c @@ -29,11 +29,11 @@ extern int gSpriteMode; typedef struct rct_sprite_file_header { uint32 num_entries; uint32 total_size; -} rct_sprite_file_header; +} PACKED rct_sprite_file_header; typedef struct rct_sprite_file_palette_entry { uint8 b, g, r, a; -} rct_sprite_file_palette_entry; +} PACKED rct_sprite_file_palette_entry; rct_sprite_file_palette_entry spriteFilePalette[256]; static rct_sprite_file_palette_entry _standardPalette[256]; @@ -234,7 +234,7 @@ int get_palette_index(sint16 *colour) typedef struct rle_code { uint8 num_pixels; uint8 offset_x; -} rle_code; +} PACKED rle_code; bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **outBuffer, int *outBufferLength, int mode) { diff --git a/src/core/Nullable.hpp b/src/core/Nullable.hpp index 869d6d8ebe..e03d8a4fc2 100644 --- a/src/core/Nullable.hpp +++ b/src/core/Nullable.hpp @@ -58,4 +58,4 @@ public: private: T _value; bool _hasValue; -}; +} PACKED; diff --git a/src/core/stopwatch.h b/src/core/stopwatch.h index 56aa1a3c52..995bb36bb1 100644 --- a/src/core/stopwatch.h +++ b/src/core/stopwatch.h @@ -25,7 +25,7 @@ typedef struct stopwatch { void *context; -} stopwatch; +} PACKED stopwatch; void stopwatch_create(stopwatch *stopwatch); void stopwatch_dispose(stopwatch *stopwatch); diff --git a/src/core/textinputbuffer.h b/src/core/textinputbuffer.h index 787473609f..a0180af66b 100644 --- a/src/core/textinputbuffer.h +++ b/src/core/textinputbuffer.h @@ -28,7 +28,7 @@ typedef struct textinputbuffer { size_t selection_offset; // Selection start, in bytes size_t selection_size; // Selection length in bytes -} textinputbuffer; +} PACKED textinputbuffer; void textinputbuffer_init(textinputbuffer * tib, utf8 * buffer, size_t size); void textinputbuffer_clear(textinputbuffer * tib); diff --git a/src/drawing/drawing.h b/src/drawing/drawing.h index 53a309952c..61637604db 100644 --- a/src/drawing/drawing.h +++ b/src/drawing/drawing.h @@ -29,7 +29,7 @@ typedef struct rct_drawpixelinfo { short height; // 0x0A short pitch; // 0x0C note: this is actually (pitch - width) uint16 zoom_level; // 0x0E -} rct_drawpixelinfo; +} PACKED rct_drawpixelinfo; // Size: 0x10 typedef struct rct_g1_element { @@ -40,7 +40,7 @@ typedef struct rct_g1_element { sint16 y_offset; // 0x0A uint16 flags; // 0x0C uint16 zoomed_offset; // 0x0E -} rct_g1_element; +} PACKED rct_g1_element; enum { G1_FLAG_BMP = (1 << 0), //No invisible sections @@ -57,24 +57,24 @@ enum { typedef struct rct_g1_header { uint32 num_entries; uint32 total_size; -} rct_g1_header; +} PACKED rct_g1_header; typedef struct rct_gx { rct_g1_header header; rct_g1_element *elements; void *data; -} rct_gx; +} PACKED rct_gx; typedef struct rct_palette_entry { uint8 blue; uint8 green; uint8 red; uint8 alpha; -} rct_palette_entry; +} PACKED rct_palette_entry; typedef struct rct_palette { rct_palette_entry entries[256]; -} rct_palette; +} PACKED rct_palette; #define SPRITE_ID_PALETTE_COLOUR_1(colourId) ((IMAGE_TYPE_USE_PALETTE << 28) | ((colourId) << 19)) diff --git a/src/drawing/font.h b/src/drawing/font.h index 01321e6648..79d9a37ad5 100644 --- a/src/drawing/font.h +++ b/src/drawing/font.h @@ -45,11 +45,11 @@ typedef struct TTFFontDescriptor { int offset_y; int line_height; TTF_Font *font; -} TTFFontDescriptor; +} PACKED TTFFontDescriptor; typedef struct TTFFontSetDescriptor { TTFFontDescriptor size[FONT_SIZE_COUNT]; -} TTFFontSetDescriptor; +} PACKED TTFFontSetDescriptor; extern TTFFontSetDescriptor *gCurrentTTFFontSet; diff --git a/src/drawing/string.c b/src/drawing/string.c index 12ee28304a..259bfa62d0 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -36,7 +36,7 @@ typedef struct ttf_cache_entry { TTF_Font *font; utf8 *text; uint32 lastUseTick; -} ttf_cache_entry; +} PACKED ttf_cache_entry; static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = { 0 }; static int _ttfSurfaceCacheCount = 0; @@ -48,7 +48,7 @@ typedef struct ttf_getwidth_cache_entry { TTF_Font *font; utf8 *text; uint32 lastUseTick; -} ttf_getwidth_cache_entry; +} PACKED ttf_getwidth_cache_entry; static ttf_getwidth_cache_entry _ttfGetWidthCache[TTF_GETWIDTH_CACHE_SIZE] = { 0 }; static int _ttfGetWidthCacheCount = 0; @@ -908,7 +908,7 @@ typedef struct text_draw_info { uint8 palette[8]; uint16 font_sprite_base; const sint8 *y_offset; -} text_draw_info; +} PACKED text_draw_info; static void ttf_draw_character_sprite(rct_drawpixelinfo *dpi, int codepoint, text_draw_info *info) { diff --git a/src/input.c b/src/input.c index eb8a79b233..e182cb6059 100644 --- a/src/input.c +++ b/src/input.c @@ -51,7 +51,7 @@ typedef struct rct_mouse_data { uint32 x; uint32 y; uint32 state; -} rct_mouse_data; +} PACKED rct_mouse_data; static rct_mouse_data _mouseInputQueue[64]; static uint8 _mouseInputQueueReadIndex = 0; diff --git a/src/input.h b/src/input.h index 808a77276f..3ddc772690 100644 --- a/src/input.h +++ b/src/input.h @@ -66,7 +66,7 @@ typedef struct widget_ref { rct_windowclass window_classification; rct_windownumber window_number; rct_widgetindex widget_index; -} widget_ref; +} PACKED widget_ref; extern uint8 gInputState; extern uint8 gInputFlags; diff --git a/src/interface/Theme.cpp b/src/interface/Theme.cpp index d26191fb0c..bc3ed6f147 100644 --- a/src/interface/Theme.cpp +++ b/src/interface/Theme.cpp @@ -43,7 +43,7 @@ constexpr uint64 MAX_THEME_SIZE = 64 * 1024 * 1024; struct WindowTheme { colour_t Colours[6]; -}; +} PACKED; /** * Represents the style for a particular type of window. @@ -56,7 +56,7 @@ struct UIThemeWindowEntry json_t * ToJson() const; static UIThemeWindowEntry FromJson(const WindowThemeDesc * wtDesc, const json_t * json); -}; +} PACKED; /** * Represents a user interface theme. Contains window colour schemes and appearance features. @@ -95,7 +95,7 @@ struct WindowThemeDesc rct_string_id WindowName; uint8 NumColours; WindowTheme DefaultTheme; -}; +} PACKED; #pragma region Window Theme Descriptors @@ -495,7 +495,7 @@ namespace ThemeManager { utf8 Path[MAX_PATH]; utf8 Name[96]; - }; + } PACKED; utf8 * CurrentThemePath; UITheme * CurrentTheme; diff --git a/src/interface/colour.h b/src/interface/colour.h index c9144af39d..99a02f016b 100644 --- a/src/interface/colour.h +++ b/src/interface/colour.h @@ -79,7 +79,7 @@ typedef struct rct_colour_map_a { uint8 light; uint8 lighter; uint8 lightest; -} rct_colour_map_a; +} PACKED rct_colour_map_a; typedef struct rct_colour_map_b { uint8 a; @@ -90,7 +90,7 @@ typedef struct rct_colour_map_b { uint8 f; uint8 g; uint8 h; -} rct_colour_map_b; +} PACKED rct_colour_map_b; extern rct_colour_map_a *ColourMapA; extern rct_colour_map_b *ColourMapB; diff --git a/src/interface/console.c b/src/interface/console.c index ccd5f03a3b..520ef3023d 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -999,7 +999,7 @@ typedef struct console_command { console_command_func func; utf8 *help; utf8 *usage; -} console_command; +} PACKED console_command; utf8* console_variable_table[] = { "park_rating", diff --git a/src/interface/viewport.h b/src/interface/viewport.h index d62b8caad4..bfc4f07a72 100644 --- a/src/interface/viewport.h +++ b/src/interface/viewport.h @@ -82,7 +82,7 @@ typedef struct viewport_interaction_info { rct_peep *peep; rct_vehicle *vehicle; }; -} viewport_interaction_info; +} PACKED viewport_interaction_info; #define MAX_VIEWPORT_COUNT MAX_WINDOW_COUNT diff --git a/src/interface/window.h b/src/interface/window.h index 7a4dc8cc78..e51aabee6f 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -45,12 +45,12 @@ typedef sint16 rct_widgetindex; typedef struct window_identifier { rct_windowclass classification; rct_windownumber number; -} window_identifier; +} PACKED window_identifier; typedef struct widget_identifier { window_identifier window; int widget_index; -} widget_identifier; +} PACKED widget_identifier; extern widget_identifier gCurrentTextBox; @@ -67,7 +67,7 @@ typedef struct rct_widget { sint16 bottom; // 0x08 uint32 image; // 0x0A uint16 tooltip; // 0x0E -} rct_widget; +} PACKED rct_widget; /** * Viewport structure @@ -85,7 +85,7 @@ typedef struct rct_viewport { uint8 zoom; // 0x10 uint8 var_11; uint16 flags; // 0x12 -} rct_viewport; +} PACKED rct_viewport; /** * Scroll structure @@ -101,7 +101,7 @@ typedef struct rct_scroll { uint16 v_bottom; // 0x0C uint16 v_thumb_top; // 0x0E uint16 v_thumb_bottom; // 0x10 -} rct_scroll; +} PACKED rct_scroll; /** * Viewport focus structure. @@ -115,7 +115,7 @@ typedef struct coordinate_focus { sint16 z; //0x486 uint8 rotation;//0x488 uint8 zoom;//0x489 -} coordinate_focus; +} PACKED coordinate_focus; // Type is viewport_target_sprite_id & 0x80000000 != 0 typedef struct sprite_focus { @@ -164,14 +164,14 @@ typedef struct rct_window_event_list { void (*invalidate)(struct rct_window*); void (*paint)(struct rct_window*, rct_drawpixelinfo*); void (*scroll_paint)(struct rct_window*, rct_drawpixelinfo*, int); -} rct_window_event_list; +} PACKED rct_window_event_list; typedef struct campaign_variables { sint16 campaign_type; sint16 no_weeks; //0x482 uint16 ride_id; //0x484 uint32 pad_486; -} campaign_variables; +} PACKED campaign_variables; typedef struct new_ride_variables { sint16 selected_ride_id; //0x480 @@ -179,7 +179,7 @@ typedef struct new_ride_variables { uint16 pad_484; uint16 pad_486; uint16 selected_ride_countdown; //488 -} new_ride_variables; +} PACKED new_ride_variables; typedef struct news_variables { sint16 var_480; @@ -187,7 +187,7 @@ typedef struct news_variables { uint16 var_484; uint16 var_486; uint16 var_488; -} news_variables; +} PACKED news_variables; typedef struct map_variables { sint16 rotation; @@ -195,28 +195,28 @@ typedef struct map_variables { uint16 var_484; uint16 var_486; uint16 var_488; -} map_variables; +} PACKED map_variables; typedef struct ride_variables { sint16 view; sint32 var_482; sint32 var_486; -} ride_variables; +} PACKED ride_variables; typedef struct scenery_variables { sint16 selected_scenery_id; sint16 hover_counter; -} scenery_variables; +} PACKED scenery_variables; typedef struct track_list_variables { uint16 var_480; uint16 var_484; bool reload_track_designs; -} track_list_variables; +} PACKED track_list_variables; typedef struct error_variables { uint16 var_480; -} error_variables; +} PACKED error_variables; /** * Window structure @@ -288,7 +288,7 @@ typedef struct rct_window { sint8 var_4B8; sint8 var_4B9; uint8 colours[6]; // 0x4BA -} rct_window; +} PACKED rct_window; #define RCT_WINDOW_RIGHT(w) (w->x + w->width) #define RCT_WINDOW_BOTTOM(w) (w->y + w->height) diff --git a/src/localisation/LanguagePack.h b/src/localisation/LanguagePack.h index 0cd1966ec4..76bffdb295 100644 --- a/src/localisation/LanguagePack.h +++ b/src/localisation/LanguagePack.h @@ -56,7 +56,7 @@ private: { char name[8]; const utf8 * strings[4]; - }; + } PACKED; struct ScenarioOverride { @@ -67,9 +67,9 @@ private: const utf8 * name; const utf8 * park; const utf8 * details; - }; + } PACKED; }; - }; + } PACKED; uint16 _id; utf8 * _stringData; diff --git a/src/localisation/convert.c b/src/localisation/convert.c index 9daca90bec..9ce15a3b6e 100644 --- a/src/localisation/convert.c +++ b/src/localisation/convert.c @@ -19,7 +19,7 @@ typedef struct encoding_convert_entry { uint16 code; uint16 unicode; -} encoding_convert_entry; +} PACKED encoding_convert_entry; static const encoding_convert_entry GB2312ToUnicodeTable[7445]; static const encoding_convert_entry Big5ToUnicodeTable[13710]; diff --git a/src/localisation/currency.h b/src/localisation/currency.h index 7c96eb8ab1..631dfea0cd 100644 --- a/src/localisation/currency.h +++ b/src/localisation/currency.h @@ -58,7 +58,7 @@ typedef struct currency_descriptor { uint8 affix_ascii; char symbol_ascii[CURRENCY_SYMBOL_MAX_SIZE]; rct_string_id stringId; -} currency_descriptor; +} PACKED currency_descriptor; // List of currency formats extern const currency_descriptor CurrencyDescriptors[CURRENCY_END]; diff --git a/src/localisation/date.h b/src/localisation/date.h index df414533c6..05491335b2 100644 --- a/src/localisation/date.h +++ b/src/localisation/date.h @@ -43,7 +43,7 @@ typedef struct openrct_timeofday { uint8 second; uint8 minute; uint8 hour; -} openrct_timeofday; +} PACKED openrct_timeofday; extern const sint16 days_in_month[MONTH_COUNT]; extern const rct_string_id DateFormatStringIds[]; diff --git a/src/localisation/language.h b/src/localisation/language.h index 8e2d1f8511..b028cdef7f 100644 --- a/src/localisation/language.h +++ b/src/localisation/language.h @@ -52,7 +52,7 @@ typedef struct language_descriptor { const utf8 *native_name; TTFFontSetDescriptor *font; uint8 rct2_original_id; -} language_descriptor; +} PACKED language_descriptor; extern const language_descriptor LanguagesDescriptors[LANGUAGE_COUNT]; diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index fc632365fe..3e0f0d2044 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -38,7 +38,7 @@ uint8 gMapTooltipFormatArgs[40]; typedef struct format_code_token { uint32 code; const char *token; -} format_code_token; +} PACKED format_code_token; format_code_token format_code_tokens[] = { { FORMAT_MOVE_X, "MOVE_X" }, diff --git a/src/management/award.h b/src/management/award.h index 0edb722fe0..c372e2bc72 100644 --- a/src/management/award.h +++ b/src/management/award.h @@ -22,7 +22,7 @@ typedef struct rct_award { uint16 time; uint16 type; -} rct_award; +} PACKED rct_award; enum { PARK_AWARD_MOST_UNTIDY, diff --git a/src/management/news_item.h b/src/management/news_item.h index e270595cdd..5f55d7245c 100644 --- a/src/management/news_item.h +++ b/src/management/news_item.h @@ -45,7 +45,7 @@ typedef struct rct_news_item { uint8 day; // 0x0A uint8 pad_0B; // 0x0B utf8 text[256]; // 0x0C -} rct_news_item; +} PACKED rct_news_item; #define MAX_NEWS_ITEMS 60 diff --git a/src/management/research.h b/src/management/research.h index cb3dae2f58..e948e5d812 100644 --- a/src/management/research.h +++ b/src/management/research.h @@ -23,7 +23,7 @@ typedef struct rct_research_item { // Bit 16 (0: scenery entry, 1: ride entry) sint32 entryIndex; uint8 category; -} rct_research_item; +} PACKED rct_research_item; enum{ RESEARCH_ENTRY_FLAG_SCENERY_SET_ALWAYS_RESEARCHED = (1 << 29), diff --git a/src/network/NetworkTypes.h b/src/network/NetworkTypes.h index 0c933fba2b..face3cec77 100644 --- a/src/network/NetworkTypes.h +++ b/src/network/NetworkTypes.h @@ -72,7 +72,7 @@ struct ByteSwapT<1> { return value; } -}; +} PACKED; template <> struct ByteSwapT<2> @@ -81,7 +81,7 @@ struct ByteSwapT<2> { return SDL_SwapBE16(value); } -}; +} PACKED; template <> struct ByteSwapT<4> @@ -90,7 +90,7 @@ struct ByteSwapT<4> { return SDL_SwapBE32(value); } -}; +} PACKED; template T ByteSwapBE(const T& value) diff --git a/src/network/http.cpp b/src/network/http.cpp index 0ebcbea449..b5a647c988 100644 --- a/src/network/http.cpp +++ b/src/network/http.cpp @@ -43,13 +43,13 @@ typedef struct read_buffer { char *ptr; int length; int position; -} read_buffer; +} PACKED read_buffer; typedef struct write_buffer { char *ptr; int length; int capacity; -} write_buffer; +} PACKED write_buffer; #ifdef __WINDOWS__ static utf8 _caBundlePath[MAX_PATH]; @@ -203,7 +203,7 @@ void http_request_json_async(const http_json_request *request, void (*callback)( struct TempThreadArgs { http_json_request request; void (*callback)(http_json_response*); - }; + } PACKED; TempThreadArgs *args = (TempThreadArgs*)malloc(sizeof(TempThreadArgs)); args->request.url = _strdup(request->url); diff --git a/src/network/http.h b/src/network/http.h index c6c8a87284..58c7c37b36 100644 --- a/src/network/http.h +++ b/src/network/http.h @@ -25,12 +25,12 @@ typedef struct http_json_request { const char *method; const char *url; const json_t *body; -} http_json_request; +} PACKED http_json_request; typedef struct http_json_response { int status_code; json_t *root; -} http_json_response; +} PACKED http_json_response; #define HTTP_METHOD_GET "GET" #define HTTP_METHOD_POST "POST" diff --git a/src/network/network.h b/src/network/network.h index a436a13129..e323353281 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -57,12 +57,6 @@ extern "C" { #define NETWORK_STREAM_VERSION "9" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION -// Fixes issues on OS X -#if defined(_RCT2_H_) && !defined(_MSC_VER) -// use similar struct packing as MSVC for our structs -#pragma pack(1) -#endif - #ifdef __cplusplus #include @@ -182,7 +176,7 @@ private: bool operator<(const GameCommand& comp) const { return tick < comp.tick; } - }; + } PACKED; int mode = NETWORK_MODE_NONE; int status = NETWORK_STATUS_NONE; diff --git a/src/network/twitch.cpp b/src/network/twitch.cpp index 291e29c248..c22c4c32fc 100644 --- a/src/network/twitch.cpp +++ b/src/network/twitch.cpp @@ -96,7 +96,7 @@ namespace Twitch member.ShouldTrack = false; return member; } - }; + } PACKED; /** * The time between HTTP requests. diff --git a/src/object.h b/src/object.h index eebef4e10f..52637f904d 100644 --- a/src/object.h +++ b/src/object.h @@ -58,7 +58,7 @@ typedef struct rct_object_entry { uint32 flags; char name[8]; uint32 checksum; -} rct_object_entry; +} PACKED rct_object_entry; /** * Object entry structure extended. @@ -69,7 +69,7 @@ typedef struct rct_object_entry_extended { char name[8]; uint32 checksum; uint32 chunk_size; -} rct_object_entry_extended; +} PACKED rct_object_entry_extended; extern int object_entry_group_counts[]; extern int object_entry_group_encoding[]; @@ -77,18 +77,18 @@ extern int object_entry_group_encoding[]; typedef struct rct_object_entry_group { uint8 **chunks; rct_object_entry_extended *entries; -} rct_object_entry_group; +} PACKED rct_object_entry_group; typedef struct rct_ride_filters { uint8 category[2]; uint8 ride_type; -} rct_ride_filters; +} PACKED rct_ride_filters; typedef struct rct_object_filters { union { rct_ride_filters ride; }; -} rct_object_filters; +} PACKED rct_object_filters; extern rct_object_entry_group object_entry_groups[]; extern void** gObjectList; diff --git a/src/object_list.c b/src/object_list.c index 941af926b7..3794858252 100644 --- a/src/object_list.c +++ b/src/object_list.c @@ -37,7 +37,7 @@ typedef struct rct_plugin_header { uint32 date_modified_checksum; uint32 object_list_size; uint32 object_list_no_items; -} rct_plugin_header; +} PACKED rct_plugin_header; // 98DA00 int object_entry_group_counts[] = { diff --git a/src/paint/map_element/scenery_multiple.c b/src/paint/map_element/scenery_multiple.c index 4244ae9642..a2858acd95 100644 --- a/src/paint/map_element/scenery_multiple.c +++ b/src/paint/map_element/scenery_multiple.c @@ -157,7 +157,7 @@ void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_text *t typedef struct boundbox { rct_xy16 offset; rct_xy16 length; -} boundbox; +} PACKED boundbox; static const boundbox s98E3C4[] = { { 3, 3, 26, 26 }, diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 9fed05acd0..14a809e4d5 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -74,7 +74,7 @@ struct corner_height uint8 right; uint8 bottom; uint8 left; -}; +} PACKED; /** * rct2: 0x0097B4A4 (R), 0x0097B4C4 (T), 0x0097B4E4 (L), 0x0097B504 (B) @@ -312,7 +312,7 @@ struct tile_descriptor uint8 terrain; uint8 slope; corner_height corner_heights; -}; +} PACKED; uint8 viewport_surface_paint_setup_get_relative_slope(rct_map_element * mapElement, int rotation) { @@ -332,7 +332,7 @@ typedef struct viewport_surface_paint_struct_0 { uint32 var_0C; uint32 var_10; uint32 pad[3]; -} viewport_surface_paint_struct_0; +} PACKED viewport_surface_paint_struct_0; /** * rct2: 0x0065E890, 0x0065E946, 0x0065E9FC, 0x0065EAB2 diff --git a/src/paint/paint.h b/src/paint/paint.h index f350847d3d..ee19f1d3da 100644 --- a/src/paint/paint.h +++ b/src/paint/paint.h @@ -37,7 +37,7 @@ struct attached_paint_struct { uint8 flags; // 0x0C uint8 pad_0D; attached_paint_struct* next; //0x0E -}; +} PACKED; typedef struct paint_struct paint_struct; @@ -69,7 +69,7 @@ struct paint_struct { uint16 map_x; // 0x2C uint16 map_y; // 0x2E rct_map_element *mapElement; // 0x30 (or sprite pointer) -}; +} PACKED; typedef struct paint_string_struct paint_string_struct; @@ -81,14 +81,14 @@ struct paint_string_struct { uint16 y; // 0x08 uint32 args[4]; // 0x0A uint8 *y_offsets; // 0x1A -}; +} PACKED; typedef struct sprite_bb { uint32 sprite_id; rct_xyz16 offset; rct_xyz16 bb_offset; rct_xyz16 bb_size; -} sprite_bb; +} PACKED sprite_bb; enum PAINT_STRUCT_FLAGS { PAINT_STRUCT_FLAG_IS_MASKED = (1 << 0) diff --git a/src/paint/supports.c b/src/paint/supports.c index cbc676416f..af20c2fabb 100644 --- a/src/paint/supports.c +++ b/src/paint/supports.c @@ -24,7 +24,7 @@ typedef struct supports_id_desc { uint16 half; uint16 flat; uint16 slope; -} supports_id_desc; +} PACKED supports_id_desc; /* 0x0097B1C4 */ const supports_id_desc WoodenSupportImageIds[] = { @@ -61,17 +61,17 @@ const uint16 WoodenCurveSupportImageIds[] = { typedef struct unk_supports_desc_bound_box { struct { uint8 x, y, z; - } offset; + } PACKED offset; struct { uint8 y, x, z; - } length; -} unk_supports_desc_bound_box; + } PACKED length; +} PACKED unk_supports_desc_bound_box; typedef struct unk_supports_desc { unk_supports_desc_bound_box bounding_box; uint8 var_6; uint8 var_7; -} unk_supports_desc; +} PACKED unk_supports_desc; /* 0x0097B23C */ const unk_supports_desc byte_97B23C[] = { diff --git a/src/peep/peep.c b/src/peep/peep.c index ca40a45b4a..12135cec12 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1123,7 +1123,7 @@ typedef struct item_pref { uint8 type; // 0 for standard, 1 for extra uint32 item; // And this with the relevant flags uint8 sprite_type; -} item_pref; +} PACKED item_pref; item_pref item_order_preference[] = { { 0, PEEP_ITEM_ICE_CREAM, 15 }, diff --git a/src/peep/peep.h b/src/peep/peep.h index bffaf25db2..6695ea1d3f 100644 --- a/src/peep/peep.h +++ b/src/peep/peep.h @@ -375,7 +375,7 @@ typedef struct rct_peep_thought { uint8 item; //1 uint8 var_2; //2 uint8 var_3; //3 -} rct_peep_thought; +} PACKED rct_peep_thought; typedef struct rct_peep { uint8 sprite_identifier; // 0x00 @@ -449,12 +449,12 @@ typedef struct rct_peep { struct{ uint8 current_car; // 0x6B uint8 current_seat; // 0x6C - }; + } PACKED; uint16 time_to_sitdown; //0x6B struct{ uint8 time_to_stand; //0x6B uint8 standing_flags; //0x6C - }; + } PACKED; }; // Normally 0, 1 for carrying sliding board on spiral slide ride, 2 for carrying lawn mower uint8 special_sprite; // 0x6D @@ -545,7 +545,7 @@ typedef struct rct_peep { uint8 favourite_ride_rating; // 0xFA uint8 pad_FB; uint32 item_standard_flags; // 0xFC -} rct_peep; +} PACKED rct_peep; enum { EASTEREGG_PEEP_NAME_MICHAEL_SCHUMACHER, diff --git a/src/rct1.h b/src/rct1.h index fde853f762..81ca2fc65e 100644 --- a/src/rct1.h +++ b/src/rct1.h @@ -31,7 +31,7 @@ typedef struct rct1_entrance { uint16 y; uint16 z; uint8 direction; -} rct1_entrance; +} PACKED rct1_entrance; /** * RCT1 ride structure @@ -46,7 +46,7 @@ typedef struct rct1_ride { struct { colour_t body; colour_t trim; - } vehicle_colours[12]; + } PACKED vehicle_colours[12]; colour_t track_primary_colour; colour_t track_secondary_colour; colour_t track_support_colour; @@ -123,7 +123,7 @@ typedef struct rct1_ride { ride_rating excitement; ride_rating intensity; ride_rating nausea; - }; + } PACKED; }; uint16 value; uint16 var_F8; @@ -159,7 +159,7 @@ typedef struct rct1_ride { uint8 music; uint8 entrance_style; uint8 unk_17A[230]; -} rct1_ride; +} PACKED rct1_ride; typedef struct rct1_research_item { uint8 item; @@ -167,7 +167,7 @@ typedef struct rct1_research_item { uint8 category; uint8 flags; uint8 expenditure_area; -} rct1_research_item; +} PACKED rct1_research_item; /** * RCT1,AA,LL scenario / saved game structure. @@ -339,7 +339,7 @@ typedef struct rct1_s4 { uint32 scenario_flags; uint8 unk_1F8358[432]; uint32 expansion_pack_checksum; -} rct1_s4; +} PACKED rct1_s4; enum { RCT1_RIDE_TYPE_NULL = 255, @@ -688,7 +688,7 @@ typedef struct rct_track_td4 { }; uint8 pad_41[0x83]; uint16 start_track_data_AA_CF; // 0xC4 -} rct_track_td4; // Information based off RCTTechDepot +} PACKED rct_track_td4; // Information based off RCTTechDepot enum { RCT1_SCENARIO_FLAG_0 = 1 << 0, diff --git a/src/rct2.h b/src/rct2.h index ac9c01245e..6fb92d1902 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -113,7 +113,9 @@ typedef uint8 colour_t; #ifndef _MSC_VER // use similar struct packing as MSVC for our structs -#pragma pack(1) +#define PACKED __attribute__((packed,aligned(1))) +#else +#define PACKED #endif #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) @@ -190,7 +192,7 @@ typedef struct rct2_install_info { uint8 pad_210[256]; char expansionPackNames[16][128]; uint32 activeExpansionPacks; //0xB10 -} rct2_install_info; +} PACKED rct2_install_info; enum { // Although this is labeled a flag it actually means when diff --git a/src/ride/gentle/crooked_house.c b/src/ride/gentle/crooked_house.c index c1e3f3f520..ccbac23796 100644 --- a/src/ride/gentle/crooked_house.c +++ b/src/ride/gentle/crooked_house.c @@ -24,7 +24,7 @@ typedef struct rct_crooked_house_bound_box { sint16 offset_y; sint16 length_x; sint16 length_y; -} rct_crooked_house_bound_box; +} PACKED rct_crooked_house_bound_box; rct_crooked_house_bound_box crooked_house_data[] = { {6, 0, 42, 24}, diff --git a/src/ride/gentle/ferris_wheel.c b/src/ride/gentle/ferris_wheel.c index d4e67d0037..f7c2475b20 100644 --- a/src/ride/gentle/ferris_wheel.c +++ b/src/ride/gentle/ferris_wheel.c @@ -39,7 +39,7 @@ typedef struct ferris_wheel_bound_box sint16 length_y; sint16 offset_x; sint16 offset_y; -} ferris_wheel_bound_box; +} PACKED ferris_wheel_bound_box; /** rct2: 0x008A8CA8 */ static ferris_wheel_bound_box ferris_wheel_data[] = { @@ -187,4 +187,4 @@ TRACK_PAINT_FUNCTION get_track_paint_function_ferris_wheel(int trackType, int di } return paint_ferris_wheel; -} \ No newline at end of file +} diff --git a/src/ride/gentle/haunted_house.c b/src/ride/gentle/haunted_house.c index e7af92e66b..be60686241 100644 --- a/src/ride/gentle/haunted_house.c +++ b/src/ride/gentle/haunted_house.c @@ -26,7 +26,7 @@ typedef struct haunted_house_bound_box sint16 offset_y; sint16 length_x; sint16 length_y; -} haunted_house_bound_box; +} PACKED haunted_house_bound_box; /** rct2: 0x1428180 */ static haunted_house_bound_box haunted_house_data[] = { diff --git a/src/ride/ride.c b/src/ride/ride.c index 7228acdafa..07442377ac 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -5948,7 +5948,7 @@ foundRideEntry: struct { uint16 type_name; uint16 number; - } name_args; + } PACKED name_args; name_args.type_name = 2 + ride->type; name_args.number = 0; do { @@ -8519,7 +8519,7 @@ void ride_reset_all_names() struct { uint16 type_name; uint16 number; - } name_args; + } PACKED name_args; name_args.type_name = 2 + ride->type; name_args.number = 0; do { diff --git a/src/ride/ride.h b/src/ride/ride.h index b5dbb5c482..5f5dccc405 100644 --- a/src/ride/ride.h +++ b/src/ride/ride.h @@ -35,7 +35,7 @@ typedef struct rating_tuple { ride_rating excitement; ride_rating intensity; ride_rating nausea; -} rating_tuple; +} PACKED rating_tuple; /** * Couples a ride type and subtype together. @@ -45,32 +45,32 @@ typedef struct ride_list_item { struct { uint8 type; uint8 entry_index; - }; + } PACKED; uint16 ride_type_and_entry; }; -} ride_list_item; +} PACKED ride_list_item; typedef struct track_colour { uint8 main; uint8 additional; uint8 supports; -} track_colour; +} PACKED track_colour; typedef struct vehicle_colour { uint8 main; uint8 additional_1; uint8 additional_2; -} vehicle_colour; +} PACKED vehicle_colour; typedef struct track_colour_preset_list { uint8 count; track_colour list[256]; -} track_colour_preset_list; +} PACKED track_colour_preset_list; typedef struct vehicle_colour_preset_list { uint8 count; vehicle_colour list[256]; -} vehicle_colour_preset_list; +} PACKED vehicle_colour_preset_list; /** * Ride type structure. @@ -109,12 +109,12 @@ typedef struct rct_ride_entry { struct { uint32 enabledTrackPiecesA; // 0x1B6 uint32 enabledTrackPiecesB; // 0x1BA - }; + } PACKED; }; uint8 category[2]; // 0x1BE uint8 shop_item; // 0x1C0 uint8 shop_item_secondary; // 0x1C1 -} rct_ride_entry; +} PACKED rct_ride_entry; /** * Ride structure. @@ -138,7 +138,7 @@ typedef struct rct_ride { struct { rct_string_id name_arguments_type_name; // 0x04C uint16 name_arguments_number; // 0x04E - }; + } PACKED; }; uint16 overall_view; // 0x050 00XX = X, XX00 = Y (* 32 + 16) uint16 station_starts[4]; // 0x052 @@ -237,7 +237,7 @@ typedef struct rct_ride { ride_rating excitement; // 0x140 ride_rating intensity; // 0x142 ride_rating nausea; // 0x144 - }; + } PACKED; }; uint16 value; // 0x146 uint16 chairlift_bullwheel_rotation; // 0x148 @@ -320,7 +320,7 @@ typedef struct rct_ride { uint16 cable_lift; // 0x1FE uint16 queue_length[4]; // 0x200 uint8 pad_208[0x58]; -} rct_ride; +} PACKED rct_ride; #define RIDE_MEASUREMENT_MAX_ITEMS 4800 @@ -340,7 +340,7 @@ typedef struct rct_ride_measurement { sint8 lateral[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x12CC uint8 velocity[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x258C uint8 altitude[RIDE_MEASUREMENT_MAX_ITEMS]; // 0x384C -} rct_ride_measurement; +} PACKED rct_ride_measurement; typedef struct track_begin_end { int begin_x; @@ -352,7 +352,7 @@ typedef struct track_begin_end { int end_y; int end_direction; rct_map_element *end_element; -} track_begin_end; +} PACKED track_begin_end; enum { RIDE_CLASS_RIDE, diff --git a/src/ride/ride_data.h b/src/ride/ride_data.h index 7ec189ee80..d1ac3a63f8 100644 --- a/src/ride/ride_data.h +++ b/src/ride/ride_data.h @@ -25,7 +25,7 @@ typedef struct rct_ride_name_convention { rct_string_id structure_name; rct_string_id station_name; rct_string_id unk_name; -} rct_ride_name_convention; +} PACKED rct_ride_name_convention; typedef struct rct_ride_entrance_definition { uint32 sprite_index; @@ -34,14 +34,14 @@ typedef struct rct_ride_entrance_definition { rct_string_id string_id; uint32 base_image_id; uint16 colour_use_flags; -} rct_ride_entrance_definition; +} PACKED rct_ride_entrance_definition; typedef struct rct_shop_item_string_types { rct_string_id singular; // Balloon rct_string_id plural; // Balloons rct_string_id indefinite; // a Balloon rct_string_id display; // "Diamond Heights" Balloon -} rct_shop_item_string_types; +} PACKED rct_shop_item_string_types; typedef struct rct_ride_data_4 { uint8 price; @@ -50,12 +50,12 @@ typedef struct rct_ride_data_4 { uint8 default_music; uint8 var_3; uint8 pad[2]; -} rct_ride_data_4; +} PACKED rct_ride_data_4; typedef struct ride_cost { uint16 track_price; uint16 support_price; -} ride_cost; +} PACKED ride_cost; typedef struct rct_ride_data_5 { uint8 max_height; @@ -66,13 +66,13 @@ typedef struct rct_ride_data_5 { uint8 price; uint8 bonus_value; // Deprecated. Use rideBonusValue instead uint8 pad; -} rct_ride_data_5; +} PACKED rct_ride_data_5; typedef struct rct_ride_lift_data { uint8 sound_id; uint8 minimum_speed; uint8 maximum_speed; -} rct_ride_lift_data; +} PACKED rct_ride_lift_data; enum { RIDE_TYPE_FLAG4_0 = (1 << 0), diff --git a/src/ride/thrill/magic_carpet.c b/src/ride/thrill/magic_carpet.c index 073bedb77b..17d0a768c6 100644 --- a/src/ride/thrill/magic_carpet.c +++ b/src/ride/thrill/magic_carpet.c @@ -40,7 +40,7 @@ typedef struct bound_box { sint16 y; sint16 width; sint16 height; -} bound_box; +} PACKED bound_box; /** rct2: 0x01428220 */ static const sint16 MagicCarpetOscillationZ[] = { diff --git a/src/ride/thrill/pirate_ship.c b/src/ride/thrill/pirate_ship.c index afad6723be..b474e8796f 100644 --- a/src/ride/thrill/pirate_ship.c +++ b/src/ride/thrill/pirate_ship.c @@ -33,7 +33,7 @@ typedef struct pirate_ship_bound_box sint16 length_y; sint16 offset_x; sint16 offset_y; -} pirate_ship_bound_box; +} PACKED pirate_ship_bound_box; /** rct2: 0x008A83B0 */ static const uint32 pirate_ship_base_sprite_offset[] = { diff --git a/src/ride/thrill/swinging_inverter_ship.c b/src/ride/thrill/swinging_inverter_ship.c index f2f2cbf55d..a585a5a41c 100644 --- a/src/ride/thrill/swinging_inverter_ship.c +++ b/src/ride/thrill/swinging_inverter_ship.c @@ -35,7 +35,7 @@ typedef struct swinging_inverter_ship_bound_box sint16 length_y; sint16 offset_x; sint16 offset_y; -} swinging_inverter_ship_bound_box; +} PACKED swinging_inverter_ship_bound_box; /** rct2: 0x01428020 */ static const swinging_inverter_ship_bound_box swinging_inverter_ship_bounds[] = { diff --git a/src/ride/track.h b/src/ride/track.h index 0b68506c46..6333f6bde9 100644 --- a/src/ride/track.h +++ b/src/ride/track.h @@ -29,7 +29,7 @@ typedef struct rct_trackdefinition { uint8 bank_start; uint8 special; uint8 pad[2]; -} rct_trackdefinition; +} PACKED rct_trackdefinition; /** * Size: 0x0A @@ -42,7 +42,7 @@ typedef struct rct_preview_track { uint8 var_07; uint8 var_08; uint8 var_09; -} rct_preview_track; +} PACKED rct_preview_track; /* size 0x0A */ typedef struct rct_track_coordinates { @@ -52,7 +52,7 @@ typedef struct rct_track_coordinates { sint16 z_end; // 0x04 sint16 x; // 0x06 sint16 y; // 0x08 -} rct_track_coordinates; +} PACKED rct_track_coordinates; enum { TRACK_ELEMENT_FLAG_TERMINAL_STATION = 1 << 3, @@ -456,7 +456,7 @@ typedef struct track_circuit_iterator { rct_map_element *first; bool firstIteration; bool looped; -} track_circuit_iterator; +} PACKED track_circuit_iterator; extern const rct_trackdefinition *gFlatRideTrackDefinitions; extern const rct_trackdefinition *gTrackDefinitions; diff --git a/src/ride/track_data.h b/src/ride/track_data.h index 0a9bc8e0b6..bb59bbc74f 100644 --- a/src/ride/track_data.h +++ b/src/ride/track_data.h @@ -32,7 +32,7 @@ extern const uint8 TrackPieceLengths[256]; typedef struct track_curve_chain { uint16 next; uint16 previous; -} track_curve_chain; +} PACKED track_curve_chain; extern const track_curve_chain gTrackCurveChain[256]; extern const track_curve_chain gFlatRideTrackCurveChain[256]; @@ -48,13 +48,13 @@ typedef struct track_descriptor { uint8 slope_end; uint8 bank_end; uint8 track_element; -} track_descriptor; +} PACKED track_descriptor; extern const track_descriptor gTrackDescriptors[142]; typedef struct { uint16 size; const rct_vehicle_info info[]; -} rct_vehicle_info_list; +} PACKED rct_vehicle_info_list; extern const rct_vehicle_info_list **gTrackVehicleInfo[17]; diff --git a/src/ride/track_design.c b/src/ride/track_design.c index 9e3f8b14ab..2a65cf4111 100644 --- a/src/ride/track_design.c +++ b/src/ride/track_design.c @@ -42,7 +42,7 @@ typedef struct map_backup { uint16 map_size_units_minus_2; uint16 map_size; uint8 current_rotation; -} map_backup; +} PACKED map_backup; static rct_track_td6 *track_design_open_from_buffer(uint8 *src, size_t srcLength); diff --git a/src/ride/track_design.h b/src/ride/track_design.h index a6b28a67a6..e55390c612 100644 --- a/src/ride/track_design.h +++ b/src/ride/track_design.h @@ -36,17 +36,17 @@ typedef struct rct_td6_maze_element { struct{ uint8 unk_2; uint8 type; - }; + } PACKED; }; - }; + } PACKED; }; -} rct_td6_maze_element; +} PACKED rct_td6_maze_element; /* Track Element entry size: 0x02 */ typedef struct rct_td6_track_element { uint8 type; // 0x00 uint8 flags; // 0x01 -} rct_td6_track_element; +} PACKED rct_td6_track_element; /* Track Entrance entry size: 0x06 */ typedef struct rct_td6_entrance_element { @@ -54,7 +54,7 @@ typedef struct rct_td6_entrance_element { uint8 direction; // 0x01 sint16 x; // 0x02 sint16 y; // 0x04 -} rct_td6_entrance_element; +} PACKED rct_td6_entrance_element; /* Track Scenery entry size: 0x16 */ typedef struct rct_td6_scenery_element { @@ -65,7 +65,7 @@ typedef struct rct_td6_scenery_element { uint8 flags; // 0x13 direction quadrant tertiary colour uint8 primary_colour; // 0x14 uint8 secondary_colour; // 0x15 -} rct_td6_scenery_element; +} PACKED rct_td6_scenery_element; /** * Track design structure. @@ -140,17 +140,17 @@ typedef struct rct_track_td6 { rct_td6_scenery_element *scenery_elements; utf8 *name; -} rct_track_td6; +} PACKED rct_track_td6; typedef struct rct_track_design { rct_track_td6 track_td6; uint8 preview[4][TRACK_PREVIEW_IMAGE_SIZE]; // 0xA3 -} rct_track_design; +} PACKED rct_track_design; typedef struct track_design_file_ref { utf8 *name; utf8 *path; -} track_design_file_ref; +} PACKED track_design_file_ref; enum { TRACK_FLAGS2_CONTAINS_LOG_FLUME_REVERSER = (1 << 1), diff --git a/src/ride/track_design_index.c b/src/ride/track_design_index.c index ea0f98e708..dddbdd8219 100644 --- a/src/ride/track_design_index.c +++ b/src/ride/track_design_index.c @@ -27,7 +27,7 @@ typedef struct td_index_item { uint8 ride_type; char ride_entry[9]; utf8 path[MAX_PATH]; -} td_index_item; +} PACKED td_index_item; static bool track_design_index_read_header(SDL_RWops *file, uint32 *tdidxCount); static void track_design_index_scan(); diff --git a/src/ride/track_design_save.c b/src/ride/track_design_save.c index d6b5c1c16b..c981742a98 100644 --- a/src/ride/track_design_save.c +++ b/src/ride/track_design_save.c @@ -1249,7 +1249,7 @@ typedef struct auto_buffer { void *ptr; size_t length; size_t capacity; -} auto_buffer; +} PACKED auto_buffer; static void auto_buffer_write(auto_buffer *buffer, const void *src, size_t len) { diff --git a/src/ride/vehicle.c b/src/ride/vehicle.c index 821ee03720..333702d636 100644 --- a/src/ride/vehicle.c +++ b/src/ride/vehicle.c @@ -1885,7 +1885,7 @@ typedef struct rct_synchronised_vehicle { uint8 ride_id; uint8 station_id; uint16 vehicle_id; -} rct_synchronised_vehicle; +} PACKED rct_synchronised_vehicle; // 8 synchronised vehicle info rct_synchronised_vehicle *_synchronisedVehicles = (rct_synchronised_vehicle*)0x00F64E4C; diff --git a/src/ride/vehicle.h b/src/ride/vehicle.h index c1a4a386d2..ee3552e0dd 100644 --- a/src/ride/vehicle.h +++ b/src/ride/vehicle.h @@ -23,7 +23,7 @@ typedef struct rct_vehicle_colour { uint8 body_colour; uint8 trim_colour; -} rct_vehicle_colour; +} PACKED rct_vehicle_colour; /** * Ride type vehicle structure. @@ -74,7 +74,7 @@ typedef struct rct_ride_entry_vehicle { uint8 draw_order; uint8 special_frames; // 0x60 , 0x7A sint8* peep_loading_positions; // 0x61 , 0x7B -} rct_ride_entry_vehicle; +} PACKED rct_ride_entry_vehicle; typedef struct rct_vehicle { uint8 sprite_identifier; // 0x00 @@ -113,7 +113,7 @@ typedef struct rct_vehicle { struct { sint8 var_34; uint8 var_35; - }; + } PACKED; }; union { sint16 track_direction; // 0x36 (0000 0000 0000 0011) @@ -142,7 +142,7 @@ typedef struct rct_vehicle { struct { sint8 ferris_wheel_var_0; // 0x4C sint8 ferris_wheel_var_1; // 0x4D - }; + } PACKED; }; sint16 var_4E; uint8 status; // 0x50 @@ -192,12 +192,12 @@ typedef struct rct_vehicle { uint8 colours_extended; // 0xD7 uint8 seat_rotation; // 0xD8 uint8 target_seat_rotation; // 0xD9 -} rct_vehicle; +} PACKED rct_vehicle; typedef struct train_ref { rct_vehicle *head; rct_vehicle *tail; -} train_ref; +} PACKED train_ref; // Size: 0x09 typedef struct rct_vehicle_info { @@ -207,7 +207,7 @@ typedef struct rct_vehicle_info { uint8 direction; // 0x06 uint8 vehicle_sprite_type; // 0x07 uint8 bank_rotation; // 0x08 -} rct_vehicle_info; +} PACKED rct_vehicle_info; enum { VEHICLE_ENTRY_FLAG_A_0 = 1 << 0, diff --git a/src/ride/vehicle_paint.h b/src/ride/vehicle_paint.h index 99fe93de06..fba946f439 100644 --- a/src/ride/vehicle_paint.h +++ b/src/ride/vehicle_paint.h @@ -26,7 +26,7 @@ typedef struct vehicle_boundbox { uint8 length_x; uint8 length_y; uint8 length_z; -} vehicle_boundbox; +} PACKED vehicle_boundbox; extern const vehicle_boundbox VehicleBoundboxes[16][224]; diff --git a/src/scenario.h b/src/scenario.h index d2350befc1..b044a00454 100644 --- a/src/scenario.h +++ b/src/scenario.h @@ -40,7 +40,7 @@ typedef struct rct_s6_header { uint32 version; // 0x04 uint32 magic_number; // 0x08 uint8 pad_0C[0x14]; -} rct_s6_header; +} PACKED rct_s6_header; /** * SC6 information chunk @@ -57,7 +57,7 @@ typedef struct rct_s6_info { char name[64]; // 0x48 char details[256]; // 0x88 rct_object_entry entry; // 0x188 -} rct_s6_info; +} PACKED rct_s6_info; /** * Scenario scores file header. @@ -68,7 +68,7 @@ typedef struct rct_scenario_scores_header { uint32 var_4; uint32 var_8; uint32 scenario_count; // 0x0C -} rct_scenario_scores_header; +} PACKED rct_scenario_scores_header; typedef enum scenario_source { SCENARIO_SOURCE_RCT1, @@ -100,14 +100,14 @@ typedef struct rct_scenario_basic { char completed_by[64]; // 0x0270 // uint8 source_game; // new in OpenRCT2 // sint16 source_index; // new in OpenRCT2 -} rct_scenario_basic; +} PACKED rct_scenario_basic; typedef struct rct_stex_entry { rct_string_id scenario_name; // 0x00 rct_string_id park_name; // 0x02 rct_string_id details; // 0x04 uint8 var_06; -} rct_stex_entry; +} PACKED rct_stex_entry; #define g_stexEntries ((rct_stex_entry**)object_entry_groups[OBJECT_TYPE_SCENARIO_TEXT].chunks) @@ -335,7 +335,7 @@ typedef struct rct_s6_data { uint16 wide_path_tile_loop_x; uint16 wide_path_tile_loop_y; uint8 pad_13CE778[434]; -} rct_s6_data; +} PACKED rct_s6_data; enum { SCENARIO_FLAGS_VISIBLE = (1 << 0), @@ -386,7 +386,7 @@ typedef struct scenario_highscore_entry { utf8 *name; money32 company_value; datetime64 timestamp; -} scenario_highscore_entry; +} PACKED scenario_highscore_entry; typedef struct scenario_index_entry { utf8 path[MAX_PATH]; @@ -407,7 +407,7 @@ typedef struct scenario_index_entry { utf8 name[64]; utf8 details[256]; -} scenario_index_entry; +} PACKED scenario_index_entry; typedef struct source_desc { const utf8 *title; @@ -415,7 +415,7 @@ typedef struct source_desc { uint8 source; sint32 index; uint8 category; -} source_desc; +} PACKED source_desc; extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT]; diff --git a/src/util/sawyercoding.h b/src/util/sawyercoding.h index 1c25c0cc49..da0dc35446 100644 --- a/src/util/sawyercoding.h +++ b/src/util/sawyercoding.h @@ -23,7 +23,7 @@ typedef struct sawyercoding_chunk_header { uint8 encoding; uint32 length; -} sawyercoding_chunk_header; +} PACKED sawyercoding_chunk_header; enum { CHUNK_ENCODING_NONE, diff --git a/src/windows/editor_object_selection.c b/src/windows/editor_object_selection.c index 3d74519d74..75a2bcf2bb 100644 --- a/src/windows/editor_object_selection.c +++ b/src/windows/editor_object_selection.c @@ -279,7 +279,7 @@ typedef struct list_item { rct_object_entry *entry; rct_object_filters *filter; uint8 *flags; -} list_item; +} PACKED list_item; typedef int (*sortFunc)(const void *, const void *); diff --git a/src/windows/loadsave.c b/src/windows/loadsave.c index c068229904..1b012219b6 100644 --- a/src/windows/loadsave.c +++ b/src/windows/loadsave.c @@ -119,7 +119,7 @@ typedef struct loadsave_list_item { char path[MAX_PATH]; time_t date_modified; uint8 type; -} loadsave_list_item; +} PACKED loadsave_list_item; modal_callback gLoadSaveCallback; diff --git a/src/windows/news_options.c b/src/windows/news_options.c index 6ed9c9d2a5..774109a260 100644 --- a/src/windows/news_options.c +++ b/src/windows/news_options.c @@ -30,8 +30,7 @@ typedef struct notification_def { uint8 category; rct_string_id caption; size_t config_offset; - -} notification_def; +} PACKED notification_def; static const notification_def NewsItemOptionDefinitions[] = { { NOTIFICATION_CATEGORY_PARK, STR_NOTIFICATION_PARK_AWARD, offsetof(notification_configuration, park_award) }, diff --git a/src/windows/ride.c b/src/windows/ride.c index e0803f78e2..d5945663e5 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -958,7 +958,7 @@ static rct_window_event_list *window_ride_page_events[] = { typedef struct ride_overall_view_t { sint16 x, y, z; uint8 zoom; -} ride_overall_view; +} PACKED ride_overall_view; ride_overall_view ride_overall_views[MAX_RIDES] = {0}; @@ -2641,7 +2641,7 @@ typedef struct rct_vehichle_paintinfo { short y; int sprite_index; int tertiary_colour; -} rct_vehichle_paintinfo; +} PACKED rct_vehichle_paintinfo; rct_vehichle_paintinfo _sprites_to_draw[144]; diff --git a/src/windows/ride_construction.c b/src/windows/ride_construction.c index 50e02a9a90..f20489cbaa 100644 --- a/src/windows/ride_construction.c +++ b/src/windows/ride_construction.c @@ -446,7 +446,7 @@ union { struct { uint32 a; uint32 b; - }; + } PACKED; } _enabledRidePieces; static bool _trackPlaceCtrlState; diff --git a/src/windows/scenery.c b/src/windows/scenery.c index dcc3b93c81..7ecd2676e3 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -521,7 +521,7 @@ typedef struct scenery_item { int allRows; int selected_item; sint16 sceneryId; -} scenery_item; +} PACKED scenery_item; static scenery_item window_scenery_count_rows_with_selected_item(int tabIndex) { diff --git a/src/windows/title_command_editor.c b/src/windows/title_command_editor.c index ddd5dc85c3..dcb8a26a5a 100644 --- a/src/windows/title_command_editor.c +++ b/src/windows/title_command_editor.c @@ -32,7 +32,7 @@ typedef struct TITLE_COMMAND_ORDER { uint8 command; rct_string_id nameStringId; rct_string_id descStringId; -} TITLE_COMMAND_ORDER; +} PACKED TITLE_COMMAND_ORDER; TITLE_COMMAND_ORDER window_title_command_editor_orders[] = { { TITLE_SCRIPT_LOAD, 5413, 5431 }, diff --git a/src/windows/title_scenarioselect.c b/src/windows/title_scenarioselect.c index 65806de370..3e159272c2 100644 --- a/src/windows/title_scenarioselect.c +++ b/src/windows/title_scenarioselect.c @@ -40,11 +40,11 @@ typedef struct sc_list_item { union { struct { rct_string_id string_id; - } heading; + } PACKED heading; struct { scenario_index_entry *scenario; bool is_locked; - } scenario; + } PACKED scenario; }; } sc_list_item; diff --git a/src/world/banner.h b/src/world/banner.h index 52e5257ab3..1af945f82c 100644 --- a/src/world/banner.h +++ b/src/world/banner.h @@ -31,7 +31,7 @@ typedef struct rct_banner { uint8 text_colour; //0x05 uint8 x; //0x06 uint8 y; //0x07 -} rct_banner; +} PACKED rct_banner; enum{ BANNER_FLAG_NO_ENTRY = (1 << 0), diff --git a/src/world/climate.c b/src/world/climate.c index e1984e6882..cbce5caeac 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -37,7 +37,7 @@ typedef struct rct_weather_transition { sint8 base_temperature; sint8 distribution_size; sint8 distribution[24]; -} rct_weather_transition; +} PACKED rct_weather_transition; static const rct_weather_transition* climate_transitions[4]; diff --git a/src/world/climate.h b/src/world/climate.h index d8be5341ca..a5a552bbc7 100644 --- a/src/world/climate.h +++ b/src/world/climate.h @@ -41,7 +41,7 @@ typedef struct rct_weather { sint8 gloom_level; sint8 rain_level; uint32 sprite_id; -} rct_weather; +} PACKED rct_weather; #define gClimate RCT2_GLOBAL(RCT2_ADDRESS_CLIMATE, uint8) #define gClimateCurrentWeather RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_WEATHER, uint8) diff --git a/src/world/entrance.h b/src/world/entrance.h index 26ac7441a3..9054e83dd1 100644 --- a/src/world/entrance.h +++ b/src/world/entrance.h @@ -24,6 +24,6 @@ typedef struct rct_entrance_type { uint32 image_id; // 0x02 uint8 scrolling_mode; // 0x06 uint8 text_height; // 0x07 -} rct_entrance_type; +} PACKED rct_entrance_type; #endif diff --git a/src/world/footpath.c b/src/world/footpath.c index de619134eb..9ad8853e36 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -952,12 +952,12 @@ typedef struct rct_neighbour { uint8 direction; uint8 ride_index; uint8 entrance_index; -} rct_neighbour; +} PACKED rct_neighbour; typedef struct rct_neighbour_list { rct_neighbour items[8]; int count; -} rct_neighbour_list; +} PACKED rct_neighbour_list; static int rct_neighbour_compare(const void *a, const void *b) { diff --git a/src/world/footpath.h b/src/world/footpath.h index b82e8f830d..9f8610aada 100644 --- a/src/world/footpath.h +++ b/src/world/footpath.h @@ -33,7 +33,7 @@ typedef struct rct_footpath_entry { uint32 bridge_image; // 0x06 uint8 var_0A; uint8 flags; // 0x0B -} rct_footpath_entry; +} PACKED rct_footpath_entry; enum { FOOTPATH_SEARCH_SUCCESS, diff --git a/src/world/map.h b/src/world/map.h index 11f7334bda..3ff512f6b7 100644 --- a/src/world/map.h +++ b/src/world/map.h @@ -24,7 +24,7 @@ typedef struct rct_map_element_surface_properties { uint8 terrain; //5 0xE0 Terrain Style, 0x1F Water height uint8 grass_length; //6 uint8 ownership; //7 -} rct_map_element_surface_properties; +} PACKED rct_map_element_surface_properties; typedef struct rct_map_element_path_properties { uint8 type; //4 0xF0 Path type, 0x08 Unknown/Unused, 0x04 Set when path is diagonal, 0x03 Rotation @@ -34,7 +34,7 @@ typedef struct rct_map_element_path_properties { uint8 addition_status; //7 uint8 ride_index; }; -} rct_map_element_path_properties; +} PACKED rct_map_element_path_properties; typedef struct rct_map_element_track_properties { uint8 type; //4 @@ -42,42 +42,42 @@ typedef struct rct_map_element_track_properties { struct{ uint8 sequence; //5 uint8 colour; //6 - }; + } PACKED; uint16 maze_entry; // 5 }; uint8 ride_index; //7 -} rct_map_element_track_properties; +} PACKED rct_map_element_track_properties; typedef struct rct_map_element_scenery_properties { uint8 type; //4 uint8 age; //5 uint8 colour_1; //6 uint8 colour_2; //7 -} rct_map_element_scenery_properties; +} PACKED rct_map_element_scenery_properties; typedef struct rct_map_element_entrance_properties { uint8 type; //4 uint8 index; //5 uint8 path_type; //6 uint8 ride_index; //7 -} rct_map_element_entrance_properties; +} PACKED rct_map_element_entrance_properties; typedef struct rct_map_element_fence_properties { uint8 type; //4 uint8 item[3]; //5 -} rct_map_element_fence_properties; +} PACKED rct_map_element_fence_properties; typedef struct rct_map_element_scenerymultiple_properties { uint16 type; //4 uint8 colour[2]; //6 -} rct_map_element_scenerymultiple_properties; +} PACKED rct_map_element_scenerymultiple_properties; typedef struct rct_map_element_banner_properties { uint8 index; //4 uint8 position; //5 uint8 flags; //6 uint8 unused; //7 -} rct_map_element_banner_properties; +} PACKED rct_map_element_banner_properties; typedef union { rct_map_element_surface_properties surface; @@ -100,7 +100,7 @@ typedef struct rct_map_element { uint8 base_height; //2 uint8 clearance_height; //3 rct_map_element_properties properties; -} rct_map_element; +} PACKED rct_map_element; enum { MAP_ELEMENT_QUADRANT_SW, @@ -233,38 +233,38 @@ typedef struct rct_xy8 { union { struct { uint8 x, y; - }; + } PACKED; uint16 xy; }; -} rct_xy8; +} PACKED rct_xy8; typedef struct rct_xyz8 { uint8 x, y, z; -} rct_xyz8; +} PACKED rct_xyz8; typedef struct rct_xyzd8 { uint8 x, y, z, direction; -} rct_xyzd8; +} PACKED rct_xyzd8; typedef struct rct_xy16 { sint16 x, y; -} rct_xy16; +} PACKED rct_xy16; typedef struct rct_xyz16 { sint16 x, y, z; -} rct_xyz16; +} PACKED rct_xyz16; typedef struct rct_xy_element { int x, y; rct_map_element *element; -} rct_xy_element; +} PACKED rct_xy_element; typedef struct rct2_peep_spawn { uint16 x; uint16 y; uint8 z; uint8 direction; -} rct2_peep_spawn; +} PACKED rct2_peep_spawn; enum { MAP_SELECT_FLAG_ENABLE = 1 << 0, @@ -420,7 +420,7 @@ typedef struct map_element_iterator { int x; int y; rct_map_element *element; -} map_element_iterator; +} PACKED map_element_iterator; void map_element_iterator_begin(map_element_iterator *it); int map_element_iterator_next(map_element_iterator *it); diff --git a/src/world/map_animation.h b/src/world/map_animation.h index de4ae8fbbd..0579b65788 100644 --- a/src/world/map_animation.h +++ b/src/world/map_animation.h @@ -28,7 +28,7 @@ typedef struct rct_map_animation { uint8 type; uint16 x; uint16 y; -} rct_map_animation; +} PACKED rct_map_animation; enum { MAP_ANIMATION_TYPE_RIDE_ENTRANCE, diff --git a/src/world/scenery.h b/src/world/scenery.h index 5d3da5de56..b3fee27b6a 100644 --- a/src/world/scenery.h +++ b/src/world/scenery.h @@ -32,7 +32,7 @@ typedef struct rct_small_scenery_entry { uint16 var_16; uint16 var_18; uint8 scenery_tab_id; // 0x1A -} rct_small_scenery_entry; +} PACKED rct_small_scenery_entry; typedef enum { SMALL_SCENERY_FLAG_FULL_TILE = (1 << 0), // 0x1 @@ -71,14 +71,14 @@ typedef struct rct_large_scenery_tile { sint16 z_offset; uint8 z_clearance; uint16 var_7; -} rct_large_scenery_tile; +} PACKED rct_large_scenery_tile; typedef struct rct_large_scenery_text_glyph { uint8 image_offset; uint8 width; uint8 height; uint8 var_3; -} rct_large_scenery_text_glyph; +} PACKED rct_large_scenery_text_glyph; typedef struct rct_large_scenery_text { rct_xy16 offset[2]; // 0x0 @@ -86,7 +86,7 @@ typedef struct rct_large_scenery_text { uint16 var_A; // 0xA uint16 var_C; // 0xC rct_large_scenery_text_glyph glyphs[256]; // 0xE -} rct_large_scenery_text; +} PACKED rct_large_scenery_text; typedef struct rct_large_scenery_entry { uint8 tool_id; // 0x06 @@ -98,7 +98,7 @@ typedef struct rct_large_scenery_entry { uint8 var_11; rct_large_scenery_text* text; // 0x12 uint32 text_image; // 0x16 -} rct_large_scenery_entry; +} PACKED rct_large_scenery_entry; typedef struct rct_wall_scenery_entry { @@ -109,7 +109,7 @@ typedef struct rct_wall_scenery_entry { sint16 price; // 0x0A uint8 scenery_tab_id; // 0x0C uint8 var_0D; -} rct_wall_scenery_entry; +} PACKED rct_wall_scenery_entry; typedef enum { WALL_SCENERY_FLAG1 = (1 << 0), // 0x1 @@ -132,14 +132,14 @@ typedef struct rct_path_bit_scenery_entry { uint8 tool_id; // 0x09 sint16 price; // 0x0A uint8 scenery_tab_id; // 0x0C -} rct_path_bit_scenery_entry; +} PACKED rct_path_bit_scenery_entry; typedef struct rct_banner_scenery_entry { uint8 scrolling_mode; // 0x06 uint8 flags; // 0x07 sint16 price; // 0x08 uint8 scenery_tab_id; // 0x0A -} rct_banner_scenery_entry; +} PACKED rct_banner_scenery_entry; typedef struct rct_scenery_entry { rct_string_id name; // 0x00 @@ -151,7 +151,7 @@ typedef struct rct_scenery_entry { rct_path_bit_scenery_entry path_bit; rct_banner_scenery_entry banner; }; -} rct_scenery_entry; +} PACKED rct_scenery_entry; typedef struct rct_scenery_set_entry { rct_string_id name; // 0x00 @@ -162,7 +162,7 @@ typedef struct rct_scenery_set_entry { uint8 var_108; // 0x108, order? uint8 pad_109; uint32 var_10A; -} rct_scenery_set_entry; +} PACKED rct_scenery_set_entry; enum { PATH_BIT_FLAG_BIN = 1 << 0, diff --git a/src/world/sprite.h b/src/world/sprite.h index 3e5543ca6b..e1d1e14d43 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -74,7 +74,7 @@ typedef struct rct_unk_sprite { uint8 var_2B; uint8 pad_2C[0x45]; uint8 var_71; -} rct_unk_sprite; +} PACKED rct_unk_sprite; typedef struct rct_litter { uint8 sprite_identifier; // 0x00 @@ -95,7 +95,7 @@ typedef struct rct_litter { uint8 sprite_direction; // 0x1E uint8 pad_1F[5]; uint32 creationTick; // 0x24 -} rct_litter; +} PACKED rct_litter; typedef struct rct_balloon { uint8 sprite_identifier; // 0x00 @@ -119,12 +119,12 @@ typedef struct rct_balloon { struct { uint8 var_26a; uint8 var_26b; - }; + } PACKED; }; uint8 pad_28[4]; uint8 colour; // 0x2C uint8 var_2D; -} rct_balloon; +} PACKED rct_balloon; typedef struct rct_duck { uint8 sprite_identifier; // 0x00 @@ -150,7 +150,7 @@ typedef struct rct_duck { sint16 target_y; // 0x32 uint8 pad_34[0x14]; uint8 state; // 0x48 -} rct_duck; +} PACKED rct_duck; typedef struct rct_jumping_fountain { uint8 sprite_identifier; // 0x00 @@ -175,7 +175,7 @@ typedef struct rct_jumping_fountain { struct { uint8 var_26a; uint8 var_26b; - }; + } PACKED; }; uint8 pad_28[0x6]; uint8 var_2E; @@ -184,7 +184,7 @@ typedef struct rct_jumping_fountain { sint16 target_y; // 0x32 uint8 pad_34[0x12]; uint16 iteration; // 0x46 -} rct_jumping_fountain; +} PACKED rct_jumping_fountain; typedef struct rct_money_effect { uint8 sprite_identifier; // 0x00 @@ -208,7 +208,7 @@ typedef struct rct_money_effect { uint8 pad_2C[0x18]; sint16 offset_x; // 0x44 uint16 wiggle; // 0x46 -} rct_money_effect; +} PACKED rct_money_effect; typedef struct rct_crashed_vehicle_particle { uint8 sprite_identifier; // 0x00 @@ -250,7 +250,7 @@ typedef struct rct_crashed_vehicle_particle { sint32 acceleration_z; // 0x40 uint8 pad_44[0x2D]; uint8 var_71; -} rct_crashed_vehicle_particle; +} PACKED rct_crashed_vehicle_particle; typedef struct rct_crash_splash { uint8 sprite_identifier; // 0x00 @@ -279,7 +279,7 @@ typedef struct rct_crash_splash { uint16 name_string_idx; // 0x22 uint16 var_24; uint16 frame; // 0x26 -} rct_crash_splash; +} PACKED rct_crash_splash; typedef struct rct_steam_particle { uint8 sprite_identifier; // 0x00 @@ -308,7 +308,7 @@ typedef struct rct_steam_particle { uint16 name_string_idx; // 0x22 uint16 var_24; uint16 frame; // 0x26 -} rct_steam_particle; +} PACKED rct_steam_particle; /** * Sprite structure. @@ -334,17 +334,17 @@ typedef struct rct_sprite_bounds { uint8 sprite_height_negative; // 0x01 uint8 sprite_height_positive; // 0x02 uint8 unused; // 0x03 -} rct_sprite_bounds; +} PACKED rct_sprite_bounds; typedef struct rct_sprite_image { uint32 base_image; // 0x00 uint8* unkn_04; // 0x04 -} rct_sprite_image; +} PACKED rct_sprite_image; typedef struct rct_sprite_entry { rct_sprite_image *sprite_image; // 0x00 rct_sprite_bounds *sprite_bounds; // 0x04 -} rct_sprite_entry; +} PACKED rct_sprite_entry; enum { SPRITE_MISC_STEAM_PARTICLE, diff --git a/src/world/water.h b/src/world/water.h index b805979057..7dc545337a 100644 --- a/src/world/water.h +++ b/src/world/water.h @@ -25,6 +25,6 @@ typedef struct rct_water_type { uint32 var_06; uint32 var_0A; uint16 var_0E; -} rct_water_type; +} PACKED rct_water_type; #endif