fixes after compiler upgrade

This commit is contained in:
Martin Michelsen
2025-04-03 10:38:42 -07:00
parent b28e9a5d54
commit c5b5ab3815
18 changed files with 103 additions and 88 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ struct BMLHeaderT {
parray<uint8_t, 0x04> unknown_a1;
U32T<BE> num_entries;
parray<uint8_t, 0x38> unknown_a2;
} __packed__;
} __attribute__((packed));
using BMLHeader = BMLHeaderT<false>;
using BMLHeaderBE = BMLHeaderT<true>;
@@ -30,7 +30,7 @@ struct BMLHeaderEntryT {
U32T<BE> compressed_gvm_size;
U32T<BE> decompressed_gvm_size;
parray<uint8_t, 0x0C> unknown_a2;
} __packed__;
} __attribute__((packed));
using BMLHeaderEntry = BMLHeaderEntryT<false>;
using BMLHeaderEntryBE = BMLHeaderEntryT<true>;
+1 -1
View File
@@ -40,7 +40,7 @@ struct ChoiceSearchConfigT {
}
return ret;
}
} __packed__;
} __attribute__((packed));
using ChoiceSearchConfig = ChoiceSearchConfigT<false>;
using ChoiceSearchConfigBE = ChoiceSearchConfigT<true>;
+29 -29
View File
@@ -275,7 +275,7 @@ struct S_ReconnectT {
be_uint32_t address = 0;
PortT port = 0;
le_uint16_t unused = 0;
} __packed__;
} __attribute__((packed));
using S_Reconnect_Patch_14 = S_ReconnectT<be_uint16_t>;
check_struct_size(S_Reconnect_Patch_14, 0x08);
@@ -340,7 +340,7 @@ struct S_ServerInitWithAfterMessageT_DC_PC_V3_02_17_91_9B {
// This field is not part of SEGA's implementation; the client ignores it.
// newserv sends a message here disavowing the preceding copyright notice.
pstring<TextEncoding::ASCII, AfterBytes> after_message;
} __packed__;
} __attribute__((packed));
// 03 (C->S): Legacy register (non-BB)
// Internal name: SndRegist
@@ -391,7 +391,7 @@ struct S_ServerInitWithAfterMessageT_BB_03_9B {
S_ServerInitDefault_BB_03_9B basic_cmd;
// As in 02, this field is not part of SEGA's implementation.
pstring<TextEncoding::ASCII, AfterBytes> after_message;
} __packed__;
} __attribute__((packed));
// 04 (C->S): Legacy login
// Internal name: SndLogin2
@@ -566,7 +566,7 @@ struct S_MenuItemT {
// 80 = Is Episode 2 (V3/BB)
// C0 = Is Episode 4 (BB)
uint8_t flags = 0;
} __packed__;
} __attribute__((packed));
using S_MenuItem_PC_BB_08 = S_MenuItemT<TextEncoding::UTF16>;
using S_MenuItem_DC_V3_08_Ep3_E6 = S_MenuItemT<TextEncoding::MARKED>;
check_struct_size(S_MenuItem_PC_BB_08, 0x2C);
@@ -628,7 +628,7 @@ struct SC_MeetUserExtensionT {
/* 40 */ le_uint32_t unknown_a2 = 0;
/* 44 */ pstring<Encoding, 0x20> player_name;
/* 64 (or 84 on UTF16 versions) */
} __packed__;
} __attribute__((packed));
using SC_MeetUserExtension_DC_V3 = SC_MeetUserExtensionT<TextEncoding::MARKED>;
using SC_MeetUserExtension_PC_BB = SC_MeetUserExtensionT<TextEncoding::UTF16>;
check_struct_size(SC_MeetUserExtension_DC_V3, 0x64);
@@ -683,7 +683,7 @@ template <TextEncoding Encoding>
struct C_MenuSelectionT_10_Flag01 {
C_MenuSelection_10_Flag00 basic_cmd;
pstring<Encoding, 0x10> name;
} __packed__;
} __attribute__((packed));
using C_MenuSelection_DC_V3_10_Flag01 = C_MenuSelectionT_10_Flag01<TextEncoding::MARKED>;
using C_MenuSelection_PC_BB_10_Flag01 = C_MenuSelectionT_10_Flag01<TextEncoding::UTF16>;
check_struct_size(C_MenuSelection_DC_V3_10_Flag01, 0x18);
@@ -693,7 +693,7 @@ template <TextEncoding Encoding>
struct C_MenuSelectionT_10_Flag02 {
C_MenuSelection_10_Flag00 basic_cmd;
pstring<Encoding, 0x10> password;
} __packed__;
} __attribute__((packed));
using C_MenuSelection_DC_V3_10_Flag02 = C_MenuSelectionT_10_Flag02<TextEncoding::MARKED>;
using C_MenuSelection_PC_BB_10_Flag02 = C_MenuSelectionT_10_Flag02<TextEncoding::UTF16>;
check_struct_size(C_MenuSelection_DC_V3_10_Flag02, 0x18);
@@ -704,7 +704,7 @@ struct C_MenuSelectionT_10_Flag03 {
C_MenuSelection_10_Flag00 basic_cmd;
pstring<Encoding, 0x10> name;
pstring<Encoding, 0x10> password;
} __packed__;
} __attribute__((packed));
using C_MenuSelection_DC_V3_10_Flag03 = C_MenuSelectionT_10_Flag03<TextEncoding::MARKED>;
using C_MenuSelection_PC_BB_10_Flag03 = C_MenuSelectionT_10_Flag03<TextEncoding::UTF16>;
check_struct_size(C_MenuSelection_DC_V3_10_Flag03, 0x28);
@@ -978,7 +978,7 @@ struct S_GuildCardSearchResultT {
// reconnect_command. When processing the 9D/9E, newserv uses only the
// lobby_id field within, but it fills in all fields when sending a 41.
SC_MeetUserExtensionT<Encoding> extension;
} __packed__;
} __attribute__((packed));
using S_GuildCardSearchResult_PC_41 = S_GuildCardSearchResultT<PSOCommandHeaderPC, TextEncoding::UTF16>;
using S_GuildCardSearchResult_DC_V3_41 = S_GuildCardSearchResultT<PSOCommandHeaderDCV3, TextEncoding::MARKED>;
using S_GuildCardSearchResult_BB_41 = S_GuildCardSearchResultT<PSOCommandHeaderBB, TextEncoding::UTF16>;
@@ -1258,7 +1258,7 @@ struct S_JoinGameT_DC_PC {
/* 010B */ uint8_t challenge_mode = 0;
/* 010C */ le_uint32_t random_seed = 0;
/* 0110 */
} __packed__;
} __attribute__((packed));
struct S_JoinGame_DCNTE_64 {
uint8_t client_id = 0;
@@ -1356,7 +1356,7 @@ struct S_JoinLobbyT {
LobbyDataT lobby_data;
PlayerInventory inventory;
DispDataT disp;
} __packed__;
} __attribute__((packed));
// Note: not all of these will be filled in and sent if the lobby isn't full
// (the command size will be shorter than this struct's size)
parray<Entry, 12> entries;
@@ -1364,7 +1364,7 @@ struct S_JoinLobbyT {
static inline size_t size(size_t used_entries) {
return offsetof(S_JoinLobbyT, entries) + used_entries * sizeof(Entry);
}
} __packed__;
} __attribute__((packed));
using S_JoinLobby_DCNTE_65_67_68 = S_JoinLobbyT<LobbyFlags_DCNTE, PlayerLobbyDataDCGC, PlayerDispDataDCPCV3>;
using S_JoinLobby_PC_65_67_68 = S_JoinLobbyT<LobbyFlags, PlayerLobbyDataPC, PlayerDispDataDCPCV3>;
using S_JoinLobby_DC_GC_65_67_68_Ep3_EB = S_JoinLobbyT<LobbyFlags, PlayerLobbyDataDCGC, PlayerDispDataDCPCV3>;
@@ -2111,7 +2111,7 @@ struct S_QuestMenuEntryT {
le_uint32_t item_id = 0;
pstring<Encoding, 0x20> name;
pstring<Encoding, ShortDescLength> short_description;
} __packed__;
} __attribute__((packed));
using S_QuestMenuEntry_PC_A2_A4 = S_QuestMenuEntryT<TextEncoding::UTF16, 0x70>;
using S_QuestMenuEntry_DC_GC_A2_A4 = S_QuestMenuEntryT<TextEncoding::MARKED, 0x70>;
using S_QuestMenuEntry_XB_A2_A4 = S_QuestMenuEntryT<TextEncoding::MARKED, 0x80>;
@@ -2495,7 +2495,7 @@ struct S_ChoiceSearchEntryT {
le_uint16_t parent_choice_id = 0; // 0 for top-level categories
le_uint16_t choice_id = 0;
pstring<Encoding, 0x1C> text;
} __packed__;
} __attribute__((packed));
using S_ChoiceSearchEntry_DC_V3_C0 = S_ChoiceSearchEntryT<TextEncoding::MARKED>;
using S_ChoiceSearchEntry_PC_BB_C0 = S_ChoiceSearchEntryT<TextEncoding::UTF16>;
check_struct_size(S_ChoiceSearchEntry_DC_V3_C0, 0x20);
@@ -2525,7 +2525,7 @@ struct C_CreateGameBaseT {
le_uint32_t item_id = 0;
pstring<Encoding, 0x10> name;
pstring<Encoding, 0x10> password;
} __packed__;
} __attribute__((packed));
using C_CreateGame_DCNTE = C_CreateGameBaseT<TextEncoding::SJIS>;
check_struct_size(C_CreateGame_DCNTE, 0x28);
@@ -2540,7 +2540,7 @@ struct C_CreateGameT : C_CreateGameBaseT<Encoding> {
// different meaning: if set to 0, the game can be joined by v1 and v2
// players; if set to 1, it's v2-only.
uint8_t episode = 0; // 1-4 on V3+ (3 on Episode 3); unused on DC/PC
} __packed__;
} __attribute__((packed));
using C_CreateGame_DC_V3_0C_C1_Ep3_EC = C_CreateGameT<TextEncoding::MARKED>;
using C_CreateGame_PC_C1 = C_CreateGameT<TextEncoding::UTF16>;
check_struct_size(C_CreateGame_DC_V3_0C_C1_Ep3_EC, 0x2C);
@@ -2580,7 +2580,7 @@ struct S_ChoiceSearchResultEntryT_C4 {
HeaderT reconnect_command_header; // Ignored by the client
S_Reconnect_19 reconnect_command;
SC_MeetUserExtensionT<NameEncoding> meet_user;
} __packed__;
} __attribute__((packed));
using S_ChoiceSearchResultEntry_DC_V3_C4 = S_ChoiceSearchResultEntryT_C4<PSOCommandHeaderDCV3, TextEncoding::ASCII, TextEncoding::MARKED, TextEncoding::ASCII>;
using S_ChoiceSearchResultEntry_PC_C4 = S_ChoiceSearchResultEntryT_C4<PSOCommandHeaderPC, TextEncoding::UTF16, TextEncoding::UTF16, TextEncoding::UTF16>;
using S_ChoiceSearchResultEntry_BB_C4 = S_ChoiceSearchResultEntryT_C4<PSOCommandHeaderBB, TextEncoding::UTF16_ALWAYS_MARKED, TextEncoding::UTF16, TextEncoding::UTF16>;
@@ -2602,7 +2602,7 @@ check_struct_size(S_ChoiceSearchResultEntry_BB_C4, 0x158);
template <size_t Count>
struct C_SetBlockedSendersT_C6 {
parray<le_uint32_t, Count> blocked_senders;
} __packed__;
} __attribute__((packed));
using C_SetBlockedSenders_V3_C6 = C_SetBlockedSendersT_C6<30>;
using C_SetBlockedSenders_BB_C6 = C_SetBlockedSendersT_C6<28>;
check_struct_size(C_SetBlockedSenders_V3_C6, 0x78);
@@ -2775,7 +2775,7 @@ template <TextEncoding NameEncoding, TextEncoding MessageEncoding>
struct S_InfoBoardEntryT_D8 {
pstring<NameEncoding, 0x10> name;
pstring<MessageEncoding, 0xAC> message;
} __packed__;
} __attribute__((packed));
using S_InfoBoardEntry_V3_D8 = S_InfoBoardEntryT_D8<TextEncoding::ASCII, TextEncoding::MARKED>;
using S_InfoBoardEntry_BB_D8 = S_InfoBoardEntryT_D8<TextEncoding::UTF16_ALWAYS_MARKED, TextEncoding::UTF16>;
check_struct_size(S_InfoBoardEntry_V3_D8, 0xBC);
@@ -2976,7 +2976,7 @@ struct S_GameInformationBaseT_Ep3_E1 {
/* 0100 */ RulesT rules;
/* 0114 */ parray<PlayerEntry, 8> spectator_entries;
/* 0294 */
} __packed__;
} __attribute__((packed));
using S_GameInformation_Ep3NTE_E1 = S_GameInformationBaseT_Ep3_E1<Episode3::RulesTrial>;
using S_GameInformation_Ep3_E1 = S_GameInformationBaseT_Ep3_E1<Episode3::Rules>;
check_struct_size(S_GameInformation_Ep3NTE_E1, 0x28C);
@@ -3102,7 +3102,7 @@ struct S_TournamentGameDetailsBaseT_Ep3_E3 {
/* 05BA */ le_uint16_t num_spectators = 0;
/* 05BC */ parray<PlayerEntry, 8> spectator_entries;
/* 073C */
} __packed__;
} __attribute__((packed));
using S_TournamentGameDetails_Ep3NTE_E3 = S_TournamentGameDetailsBaseT_Ep3_E3<Episode3::RulesTrial>;
using S_TournamentGameDetails_Ep3_E3 = S_TournamentGameDetailsBaseT_Ep3_E3<Episode3::Rules>;
check_struct_size(S_TournamentGameDetails_Ep3NTE_E3, 0x734);
@@ -3890,7 +3890,7 @@ template <typename HeaderT>
struct G_ExtendedHeaderT {
HeaderT basic_header;
le_uint32_t size = 0;
} __packed__;
} __attribute__((packed));
// 6x00: Invalid subcommand
// 6x01: Invalid subcommand
@@ -4018,7 +4018,7 @@ struct G_UpdateEnemyStateT_6x0A {
le_uint16_t enemy_index = 0; // [0, 0xB50)
le_uint16_t total_damage = 0;
typename std::conditional_t<BE, be_uint32_t, le_uint32_t> game_flags = 0;
} __packed__;
} __attribute__((packed));
using G_UpdateEnemyState_GC_6x0A = G_UpdateEnemyStateT_6x0A<true>;
using G_UpdateEnemyState_DC_PC_XB_BB_6x0A = G_UpdateEnemyStateT_6x0A<false>;
check_struct_size(G_UpdateEnemyState_GC_6x0A, 0x0C);
@@ -4097,7 +4097,7 @@ struct G_DragonBossActionsT_6x12 {
le_uint32_t unknown_a4 = 0;
F32T<BE> x = 0.0f;
F32T<BE> z = 0.0f;
} __packed__;
} __attribute__((packed));
using G_DragonBossActions_DC_PC_XB_BB_6x12 = G_DragonBossActionsT_6x12<false>;
using G_DragonBossActions_GC_6x12 = G_DragonBossActionsT_6x12<true>;
check_struct_size(G_DragonBossActions_DC_PC_XB_BB_6x12, 0x14);
@@ -5116,7 +5116,7 @@ struct G_WordSelectT_6x74 {
uint8_t size = 0;
U16T<BE> client_id = 0;
WordSelectMessage message;
} __packed__;
} __attribute__((packed));
using G_WordSelect_6x74 = G_WordSelectT_6x74<false>;
using G_WordSelectBE_6x74 = G_WordSelectT_6x74<true>;
check_struct_size(G_WordSelect_6x74, 0x20);
@@ -5155,7 +5155,7 @@ struct G_SyncQuestRegister_6x77 {
union {
le_uint32_t as_int;
le_float as_float;
} __packed__ value;
} __attribute__((packed)) value;
} __packed_ws__(G_SyncQuestRegister_6x77, 0x0C);
// 6x78: Unknown
@@ -5244,7 +5244,7 @@ struct G_BattleScoresT_6x7F {
} __packed_ws__(Entry, 8);
G_UnusedHeader header;
parray<Entry, 4> entries;
} __packed__;
} __attribute__((packed));
using G_BattleScores_6x7F = G_BattleScoresT_6x7F<false>;
using G_BattleScoresBE_6x7F = G_BattleScoresT_6x7F<true>;
check_struct_size(G_BattleScores_6x7F, 0x24);
@@ -5616,7 +5616,7 @@ struct G_GolDragonBossActionsT_6xA8 {
F32T<BE> z = 0.0f;
uint8_t unknown_a5 = 0;
parray<uint8_t, 3> unused;
} __packed__;
} __attribute__((packed));
using G_GolDragonBossActions_XB_BB_6xA8 = G_GolDragonBossActionsT_6xA8<false>;
using G_GolDragonBossActions_GC_6xA8 = G_GolDragonBossActionsT_6xA8<true>;
check_struct_size(G_GolDragonBossActions_XB_BB_6xA8, 0x18);
@@ -7038,7 +7038,7 @@ struct G_SetTournamentPlayerDecksT_Ep3_6xB4x3D {
/* 01C2:01CA */ uint8_t unknown_a4 = 0;
/* 01C3:01CB */ uint8_t unknown_a5 = 0;
/* 01C4:01CC */
} __packed__;
} __attribute__((packed));
using G_SetTournamentPlayerDecks_Ep3NTE_6xB4x3D = G_SetTournamentPlayerDecksT_Ep3_6xB4x3D<Episode3::RulesTrial>;
check_struct_size(G_SetTournamentPlayerDecks_Ep3NTE_6xB4x3D, 0x1C4);
+1 -1
View File
@@ -132,7 +132,7 @@ struct ArrayRefT {
/* 00 */ U32T<BE> count;
/* 04 */ U32T<BE> offset;
/* 08 */
} __packed__;
} __attribute__((packed));
using ArrayRef = ArrayRefT<false>;
using ArrayRefBE = ArrayRefT<true>;
check_struct_size(ArrayRef, 8);
+3 -3
View File
@@ -22,7 +22,7 @@ public:
struct Range {
IntT min;
IntT max;
} __packed__;
} __attribute__((packed));
Episode episode;
parray<uint8_t, 0x0C> base_weapon_type_prob_table;
@@ -254,7 +254,7 @@ public:
/* 50 */ U32T<BE> box_item_class_prob_table_offset;
// There are several unused fields here.
} __packed__;
} __attribute__((packed));
using Offsets = OffsetsT<false>;
using OffsetsBE = OffsetsT<true>;
check_struct_size(Offsets, 0x54);
@@ -337,7 +337,7 @@ public:
struct WeightTableEntry {
ValueT value;
WeightT weight;
} __packed__;
} __attribute__((packed));
using WeightTableEntry8 = WeightTableEntry<uint8_t>;
using WeightTableEntry32 = WeightTableEntry<be_uint32_t>;
+1 -1
View File
@@ -466,7 +466,7 @@ uint32_t specific_version_for_gc_header_checksum(uint32_t header_checksum) {
char developer_code2 = 'P';
uint8_t disc_number = 0;
uint8_t version_code;
} __packed__ data;
} __attribute__((packed)) data;
for (const char* game_code2 = "OS"; *game_code2; game_code2++) {
data.game_code2 = *game_code2;
for (const char* region_code = "JEP"; *region_code; region_code++) {
+1 -1
View File
@@ -15,7 +15,7 @@ struct GSLHeaderEntryT {
U32T<BE> offset; // In pages, so actual offset is this * 0x800
U32T<BE> size;
uint64_t unused;
} __packed__;
} __attribute__((packed));
using GSLHeaderEntry = GSLHeaderEntryT<false>;
using GSLHeaderEntryBE = GSLHeaderEntryT<true>;
+2 -2
View File
@@ -127,7 +127,7 @@ struct ItemData {
parray<be_uint16_t, 6> data1wb;
parray<le_uint32_t, 3> data1d;
parray<be_uint32_t, 3> data1db;
} __packed__;
} __attribute__((packed));
le_uint32_t id;
union {
parray<uint8_t, 4> data2;
@@ -135,7 +135,7 @@ struct ItemData {
parray<be_uint16_t, 2> data2wb;
le_uint32_t data2d;
be_uint32_t data2db;
} __packed__;
} __attribute__((packed));
ItemData();
ItemData(const ItemData& other);
+20 -20
View File
@@ -28,18 +28,18 @@ public:
// item's name in the text archive (e.g. TextEnglish) collection 0.
/* 00 */ U32T<BE> id = 0xFFFFFFFF;
/* 04 */
} __packed__;
} __attribute__((packed));
template <bool BE>
struct ItemBaseV3T : ItemBaseV2T<BE> {
/* 04 */ U16T<BE> type = 0; // "Model" in Soly's ItemPMT editor
/* 06 */ U16T<BE> skin = 0; // "Texture" in Soly's ItemPMT editor
/* 08 */
} __packed__;
} __attribute__((packed));
template <bool BE>
struct ItemBaseV4T : ItemBaseV3T<BE> {
/* 08 */ U32T<BE> team_points = 0;
/* 0C */
} __packed__;
} __attribute__((packed));
struct WeaponV4;
struct WeaponDCProtos {
@@ -142,7 +142,7 @@ public:
/* 28 */
WeaponV4 to_v4() const;
} __packed__;
} __attribute__((packed));
using WeaponV3 = WeaponV3T<false>;
using WeaponV3BE = WeaponV3T<true>;
@@ -197,7 +197,7 @@ public:
/* 12 */ uint8_t dfp_range = 0;
/* 13 */ uint8_t evp_range = 0;
/* 14 */
} __packed__;
} __attribute__((packed));
template <typename BaseT, bool BE>
struct ArmorOrShieldFinalT : ArmorOrShieldT<BaseT, BE> {
@@ -213,7 +213,7 @@ public:
/* 16 */ uint8_t flags_type = 0;
/* 17 */ uint8_t unknown_a4 = 0;
/* 18 */
} __packed__;
} __attribute__((packed));
using ArmorOrShieldV4 = ArmorOrShieldFinalT<ItemBaseV4T<false>, false>;
check_struct_size(ArmorOrShieldV4, 0x20);
struct ArmorOrShieldDCProtos : ArmorOrShieldT<ItemBaseV2T<false>, false> {
@@ -226,7 +226,7 @@ public:
template <bool BE>
struct ArmorOrShieldV3T : ArmorOrShieldFinalT<ItemBaseV3T<BE>, BE> {
ArmorOrShieldV4 to_v4() const;
} __packed__;
} __attribute__((packed));
using ArmorOrShieldV3 = ArmorOrShieldV3T<false>;
using ArmorOrShieldV3BE = ArmorOrShieldV3T<true>;
check_struct_size(ArmorOrShieldV3, 0x1C);
@@ -239,14 +239,14 @@ public:
/* 04 */ U16T<BE> stat = 0;
/* 06 */ U16T<BE> stat_amount = 0;
/* 08 */
} __packed__;
} __attribute__((packed));
template <typename BaseT, bool BE>
struct UnitFinalT : UnitT<BaseT, BE> {
/* 08 */ S16T<BE> modifier_amount = 0;
/* 0A */ parray<uint8_t, 2> unused;
/* 0C */
} __packed__;
} __attribute__((packed));
using UnitV4 = UnitFinalT<ItemBaseV4T<false>, false>;
check_struct_size(UnitV4, 0x14);
struct UnitDCProtos : UnitT<ItemBaseV2T<false>, false> {
@@ -258,7 +258,7 @@ public:
template <bool BE>
struct UnitV3T : UnitFinalT<ItemBaseV3T<BE>, BE> {
UnitV4 to_v4() const;
} __packed__;
} __attribute__((packed));
using UnitV3 = UnitV3T<false>;
using UnitV3BE = UnitV3T<true>;
check_struct_size(UnitV3, 0x10);
@@ -295,7 +295,7 @@ public:
/* 0E */ uint8_t on_death_flag = 0;
/* 0F */ uint8_t on_boss_flag = 0;
/* 10 */
} __packed__;
} __attribute__((packed));
struct MagV4 : MagT<ItemBaseV4T<false>, false> {
le_uint16_t class_flags = 0x00FF;
@@ -318,7 +318,7 @@ public:
/* 14 */
MagV4 to_v4() const;
} __packed__;
} __attribute__((packed));
using MagV3 = MagV3T<false>;
using MagV3BE = MagV3T<true>;
check_struct_size(MagV3, 0x18);
@@ -342,7 +342,7 @@ public:
// 00000080 - is rare (renders as red box; V3+)
/* 0C */ U32T<BE> item_flags = 0;
/* 10 */
} __packed__;
} __attribute__((packed));
using ToolV4 = ToolT<ItemBaseV4T<false>, false>;
check_struct_size(ToolV4, 0x18);
@@ -352,7 +352,7 @@ public:
template <bool BE>
struct ToolV3T : ToolT<ItemBaseV3T<BE>, BE> {
ToolV4 to_v4() const;
} __packed__;
} __attribute__((packed));
using ToolV3 = ToolV3T<false>;
using ToolV3BE = ToolV3T<true>;
check_struct_size(ToolV3, 0x14);
@@ -373,7 +373,7 @@ public:
template <bool BE>
struct MagFeedResultsListOffsetsT {
parray<U32T<BE>, 8> offsets; // Offsets of MagFeedResultsList objects
} __packed__;
} __attribute__((packed));
using MagFeedResultsListOffsets = MagFeedResultsListOffsetsT<false>;
using MagFeedResultsListOffsetsBE = MagFeedResultsListOffsetsT<true>;
check_struct_size(MagFeedResultsListOffsets, 0x20);
@@ -383,7 +383,7 @@ public:
struct SpecialT {
U16T<BE> type = 0xFFFF;
U16T<BE> amount = 0;
} __packed__;
} __attribute__((packed));
using Special = SpecialT<false>;
using SpecialBE = SpecialT<true>;
check_struct_size(Special, 4);
@@ -395,7 +395,7 @@ public:
uint8_t stat2 = 0;
U16T<BE> amount1 = 0;
U16T<BE> amount2 = 0;
} __packed__;
} __attribute__((packed));
using StatBoost = StatBoostT<false>;
using StatBoostBE = StatBoostT<true>;
check_struct_size(StatBoost, 6);
@@ -423,7 +423,7 @@ public:
uint8_t flags = 0;
parray<uint8_t, 2> unused;
F32T<BE> amount = 0.0f;
} __packed__;
} __attribute__((packed));
using TechniqueBoostEntry = TechniqueBoostEntryT<false>;
using TechniqueBoostEntryBE = TechniqueBoostEntryT<true>;
check_struct_size(TechniqueBoostEntry, 0x08);
@@ -445,7 +445,7 @@ public:
F32T<BE> shield_divisor = 0.0f;
F32T<BE> unit_divisor = 0.0f;
F32T<BE> mag_divisor = 0.0f;
} __packed__;
} __attribute__((packed));
using NonWeaponSaleDivisors = NonWeaponSaleDivisorsT<false>;
using NonWeaponSaleDivisorsBE = NonWeaponSaleDivisorsT<true>;
check_struct_size(NonWeaponSaleDivisors, 0x10);
@@ -599,7 +599,7 @@ protected:
/* 50 / F5F0 / 15014 */ U32T<BE> unwrap_table; // -> {count, offset -> [{count, offset -> [EventItem]}]}
/* 54 / F5F8 / 1501C */ U32T<BE> unsealable_table; // -> {count, offset -> [UnsealableItem]}
/* 58 / F600 / 15024 */ U32T<BE> ranged_special_table; // -> {count, offset -> [4-byte structs]}
} __packed__;
} __attribute__((packed));
using TableOffsetsV3V4 = TableOffsetsV3V4T<false>;
using TableOffsetsV3V4BE = TableOffsetsV3V4T<true>;
check_struct_size(TableOffsetsV3V4, 0x5C);
+3 -3
View File
@@ -33,7 +33,7 @@ struct CharacterStatsT {
ret.lck = this->lck.load();
return ret;
}
} __packed__;
} __attribute__((packed));
using CharacterStats = CharacterStatsT<false>;
using CharacterStatsBE = CharacterStatsT<true>;
check_struct_size(CharacterStats, 0x0E);
@@ -61,7 +61,7 @@ struct PlayerStatsT {
ret.meseta = this->meseta.load();
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerStats = PlayerStatsT<false>;
using PlayerStatsBE = PlayerStatsT<true>;
check_struct_size(PlayerStats, 0x24);
@@ -89,7 +89,7 @@ struct LevelStatsDeltaT {
ps.mst += this->mst;
ps.lck += this->lck;
}
} __packed__;
} __attribute__((packed));
using LevelStatsDelta = LevelStatsDeltaT<false>;
using LevelStatsDeltaBE = LevelStatsDeltaT<true>;
check_struct_size(LevelStatsDelta, 0x0C);
+1 -1
View File
@@ -292,7 +292,7 @@ public:
ret.store_raw(this->value);
return ret;
}
} __packed__;
} __attribute__((packed));
using ChallengeTime = ChallengeTimeT<false>;
using ChallengeTimeBE = ChallengeTimeT<true>;
check_struct_size(ChallengeTime, 4);
+4 -4
View File
@@ -77,7 +77,7 @@ struct PlayerInventoryItemT {
ret.data.id.store_raw(phosg::bswap32(ret.data.id.load_raw()));
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerInventoryItem = PlayerInventoryItemT<false>;
using PlayerInventoryItemBE = PlayerInventoryItemT<true>;
check_struct_size(PlayerInventoryItem, 0x1C);
@@ -101,7 +101,7 @@ struct PlayerBankItemT {
ret.present = this->present.load();
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerBankItem = PlayerBankItemT<false>;
using PlayerBankItemBE = PlayerBankItemT<true>;
check_struct_size(PlayerBankItem, 0x18);
@@ -292,7 +292,7 @@ struct PlayerInventoryT {
ret.items = this->items;
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerInventory = PlayerInventoryT<false>;
using PlayerInventoryBE = PlayerInventoryT<true>;
check_struct_size(PlayerInventory, 0x34C);
@@ -416,7 +416,7 @@ struct PlayerBankT {
}
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerBank60 = PlayerBankT<60, false>;
using PlayerBank200 = PlayerBankT<200, false>;
using PlayerBank200BE = PlayerBankT<200, true>;
+9 -9
View File
@@ -230,7 +230,7 @@ struct PlayerVisualConfigT {
ret.proportion_y = this->proportion_y.load();
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerVisualConfig = PlayerVisualConfigT<false>;
using PlayerVisualConfigBE = PlayerVisualConfigT<true>;
check_struct_size(PlayerVisualConfig, 0x50);
@@ -249,7 +249,7 @@ struct PlayerDispDataDCPCV3T {
}
PlayerDispDataBB to_bb(uint8_t to_language, uint8_t from_language) const;
} __packed__;
} __attribute__((packed));
using PlayerDispDataDCPCV3 = PlayerDispDataDCPCV3T<false>;
using PlayerDispDataDCPCV3BE = PlayerDispDataDCPCV3T<true>;
check_struct_size(PlayerDispDataDCPCV3, 0xD0);
@@ -382,7 +382,7 @@ struct GuildCardGCT {
/* 90:90 */
operator GuildCardBB() const;
} __packed__;
} __attribute__((packed));
using GuildCardGCNTE = GuildCardGCT<false, 0x80>;
using GuildCardGCNTEBE = GuildCardGCT<true, 0x80>;
using GuildCardGC = GuildCardGCT<false, 0x6C>;
@@ -530,7 +530,7 @@ struct ChallengeAwardStateT {
ret.maximum_rank = this->maximum_rank;
return ret;
}
} __packed__;
} __attribute__((packed));
using ChallengeAwardState = ChallengeAwardStateT<false>;
using ChallengeAwardStateBE = ChallengeAwardStateT<true>;
check_struct_size(ChallengeAwardState, 8);
@@ -563,7 +563,7 @@ struct PlayerRecordsChallengeDCPCT {
/* 78:B0 */ parray<ChallengeTimeT<false>, 9> times_ep1_offline; // TODO: This might be online times
/* 9C:D4 */ parray<uint8_t, 4> unknown_l4;
/* A0:D8 */
} __packed__;
} __attribute__((packed));
using PlayerRecordsChallengeDC = PlayerRecordsChallengeDCPCT<TextEncoding::ASCII, TextEncoding::CHALLENGE8>;
using PlayerRecordsChallengePC = PlayerRecordsChallengeDCPCT<TextEncoding::UTF16, TextEncoding::CHALLENGE16>;
check_struct_size(PlayerRecordsChallengeDC, 0xA0);
@@ -598,7 +598,7 @@ struct PlayerRecordsChallengeV3T {
/* C8:E4 */ ChallengeAwardStateT<BE> ep2_online_award_state;
/* D0:EC */ ChallengeAwardStateT<BE> ep1_offline_award_state;
/* D8:F4 */
} __packed__;
} __attribute__((packed));
/* 0000:001C */ Stats stats;
// On Episode 3, there are special cases that apply to this field - if the
// text ends with certain strings, the player will have particle effects
@@ -610,7 +610,7 @@ struct PlayerRecordsChallengeV3T {
/* 00D8:00F4 */ pstring<TextEncoding::CHALLENGE8, 0x0C> rank_title;
/* 00E4:0100 */ parray<uint8_t, 0x1C> unknown_l7;
/* 0100:011C */
} __packed__;
} __attribute__((packed));
using PlayerRecordsChallengeV3 = PlayerRecordsChallengeV3T<false>;
using PlayerRecordsChallengeV3BE = PlayerRecordsChallengeV3T<true>;
check_struct_size(PlayerRecordsChallengeV3, 0x100);
@@ -742,7 +742,7 @@ struct PlayerRecordsBattleT {
}
return ret;
}
} __packed__;
} __attribute__((packed));
using PlayerRecordsBattle = PlayerRecordsBattleT<false>;
using PlayerRecordsBattleBE = PlayerRecordsBattleT<true>;
check_struct_size(PlayerRecordsBattle, 0x18);
@@ -992,7 +992,7 @@ struct SymbolChatT {
ret.face_parts = this->face_parts;
return ret;
}
} __packed__;
} __attribute__((packed));
using SymbolChat = SymbolChatT<false>;
using SymbolChatBE = SymbolChatT<true>;
check_struct_size(SymbolChat, 0x3C);
+1 -1
View File
@@ -52,7 +52,7 @@ struct PSOMemCardDLQFileEncryptedHeaderT {
le_uint32_t decompressed_size;
le_uint32_t round3_seed;
// Data follows here.
} __packed__;
} __attribute__((packed));
using PSOVMSDLQFileEncryptedHeader = PSOMemCardDLQFileEncryptedHeaderT<false>;
using PSOGCIDLQFileEncryptedHeader = PSOMemCardDLQFileEncryptedHeaderT<true>;
check_struct_size(PSOVMSDLQFileEncryptedHeader, 0x10);
+1 -1
View File
@@ -82,7 +82,7 @@ protected:
/* 08 */ U32T<BE> box_areas_offset; // -> parray<uint8_t, 0x1E>
/* 0C */ U32T<BE> box_rares_offset; // -> parray<PackedDrop, 0x1E>
/* 10 */
} __packed__;
} __attribute__((packed));
using Offsets = OffsetsT<false>;
using OffsetsBE = OffsetsT<true>;
check_struct_size(Offsets, 0x10);
+4 -4
View File
@@ -112,7 +112,7 @@ struct SaveFileSymbolChatEntryT {
/* 04:04:04:04:04 */ pstring<Encoding, NameLength> name;
/* 1C:34:1C:1C:2C */ SymbolChatT<BE> spec;
/* 58:70:58:58:68 */
} __packed__;
} __attribute__((packed));
using SaveFileSymbolChatEntryPC = SaveFileSymbolChatEntryT<false, TextEncoding::UTF16, 0x18>;
using SaveFileSymbolChatEntryGC = SaveFileSymbolChatEntryT<true, TextEncoding::MARKED, 0x18>;
using SaveFileSymbolChatEntryDCXB = SaveFileSymbolChatEntryT<false, TextEncoding::MARKED, 0x18>;
@@ -141,7 +141,7 @@ struct WordSelectMessageT {
ret.unknown_a4 = this->unknown_a4.load();
return ret;
}
} __packed__;
} __attribute__((packed));
using WordSelectMessage = WordSelectMessageT<false>;
using WordSelectMessageBE = WordSelectMessageT<true>;
check_struct_size(WordSelectMessage, 0x1C);
@@ -160,7 +160,7 @@ struct SaveFileChatShortcutEntryT {
this->text = other.text;
return *this;
}
} __packed__;
} __attribute__((packed));
/* DC:GC:BB */
/* 00:00:00 */ U32T<BE> type; // 1 = text, 2 = word select, 3 = symbol chat
@@ -186,7 +186,7 @@ struct SaveFileChatShortcutEntryT {
}
return ret;
}
} __packed__;
} __attribute__((packed));
using SaveFileShortcutEntryDC = SaveFileChatShortcutEntryT<false, TextEncoding::MARKED, 0x3C>;
using SaveFileShortcutEntryPC = SaveFileChatShortcutEntryT<false, TextEncoding::UTF16, 0x3C>;
using SaveFileShortcutEntryGC = SaveFileChatShortcutEntryT<true, TextEncoding::MARKED, 0x50>;
+19 -4
View File
@@ -13,13 +13,12 @@
#include "Types.hh"
#define __packed__ __attribute__((packed))
#define check_struct_size(StructT, Size) \
static_assert(sizeof(StructT) >= Size, "Structure size is too small"); \
static_assert(sizeof(StructT) <= Size, "Structure size is too large")
#define __packed_ws__(StructT, Size) \
__packed__; \
__attribute__((packed)); \
check_struct_size(StructT, Size)
// Conversion functions
@@ -299,7 +298,7 @@ struct parray {
}
return true;
}
} __packed__;
} __attribute__((packed));
template <typename ItemT, size_t Count>
struct bcarray {
@@ -383,6 +382,22 @@ struct bcarray {
bool operator!=(const bcarray& s) const {
return !this->operator==(s);
}
void clear(ItemT v) {
for (size_t x = 0; x < Count; x++) {
this->items[x] = v;
}
}
void clear() {
for (size_t x = 0; x < Count; x++) {
this->items[x] = ItemT();
}
}
void clear_after(size_t position, ItemT v = 0) {
for (size_t x = position; x < Count; x++) {
this->items[x] = v;
}
}
};
// Packed text objects for use in protocol structs
@@ -704,7 +719,7 @@ struct pstring {
// Note: The contents of a pstring do not have to be null-terminated, so there
// is no .c_str() function.
} __packed__;
} __attribute__((packed));
// Helper functions
+1 -1
View File
@@ -40,7 +40,7 @@ struct NonWindowsRootT {
U32T<BE> table4;
U32T<BE> article_types_table;
U32T<BE> table6;
} __packed__;
} __attribute__((packed));
using NonWindowsRoot = NonWindowsRootT<false>;
using NonWindowsRootBE = NonWindowsRootT<true>;