From 22ca5da387c1c4c145cbde8c5e7a52b2087638b1 Mon Sep 17 00:00:00 2001 From: shenlei Date: Mon, 28 Sep 2026 16:56:36 +0900 Subject: [PATCH] UserInterface: 32-bit LONG sockets in TItemData/TShopItemData The 40250 wire structs hold Win32 long (4 bytes) sockets; on LP64 `long` is 8, so each TShopItemData was too wide and SHOP_SUBHEADER_GC_START/_EX misread every item after the first. Pin the wire size with a static_assert. Co-Authored-By: Claude Opus 5.5 --- extension/src/port/UserInterface/GameType.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extension/src/port/UserInterface/GameType.h b/extension/src/port/UserInterface/GameType.h index 114d022a..e2f17e12 100644 --- a/extension/src/port/UserInterface/GameType.h +++ b/extension/src/port/UserInterface/GameType.h @@ -321,7 +321,7 @@ typedef struct packet_item BYTE count; DWORD flags; DWORD anti_flags; - long alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; + LONG alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; // PORT: LONG, the 32-bit Win32 long TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM]; } TItemData; @@ -331,12 +331,15 @@ typedef struct packet_shop_item DWORD price; BYTE count; BYTE display_pos; - long alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; + LONG alSockets[ITEM_SOCKET_SLOT_MAX_NUM]; // PORT: LONG, the 32-bit Win32 long TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_SLOT_MAX_NUM]; } TShopItemData; #pragma pack(pop) +// PORT: wire sizes of the 32-bit client (SHOP_SUBHEADER_GC_START/_EX send 40 of these back to back). +static_assert(sizeof(TShopItemData) == 43, "TShopItemData must match the 40250 wire layout"); + inline float GetSqrtDistance(int ix1, int iy1, int ix2, int iy2) // By sqrt { float dx, dy;