From d64c9621af4ddb6e178ab8782b6a29db0839e128 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Sun, 17 Dec 2023 18:06:45 -0800 Subject: [PATCH] fix converted 6x70 subcommand size field --- src/ReceiveSubcommands.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ReceiveSubcommands.cc b/src/ReceiveSubcommands.cc index bdbda2f2..e9381538 100644 --- a/src/ReceiveSubcommands.cc +++ b/src/ReceiveSubcommands.cc @@ -455,8 +455,11 @@ static void on_sync_joining_player_disp_and_inventory( send_or_enqueue_joining_player_command(target, command, flag, data, size); } else if (sender_is_gc) { - // Convert GC command to XB command + // Convert the GC command to the XB command format. There are some extra + // fields on the end, so we also need to adjust the size field in the + // extended header to account for that. G_SyncPlayerDispAndInventory_XB_6x70 out_cmd = {check_size_t(data, size), 0, 0, 0}; + out_cmd.header.size = sizeof(out_cmd); if (c->license->xb_user_id) { out_cmd.xb_user_id_high = static_cast((c->license->xb_user_id >> 32) & 0xFFFFFFFF); out_cmd.xb_user_id_low = static_cast(c->license->xb_user_id & 0xFFFFFFFF); @@ -471,7 +474,8 @@ static void on_sync_joining_player_disp_and_inventory( send_or_enqueue_joining_player_command(target, command, flag, out_cmd); } else { - // Convert XB command to GC command + // The XB command has some extra fields on the end; PSO GC will just ignore + // them, so we don't bother to remove them. static_assert( sizeof(G_SyncPlayerDispAndInventory_DC_PC_GC_6x70) < sizeof(G_SyncPlayerDispAndInventory_XB_6x70), "GC 6x70 command is larger than XB 6x70 command");