REDIVIVUS

Proposals / #1102

Type eight S2C handlers that copy their packet into a local of its own struct as that struct

checked · by dtchitt · submitted 2026-11-03

These handlers take char * pBytes and copy it, dword by dword, into a local typed as the packet's own D2GSPacketSrv struct, then pass &local on: 0x2A to NPCMENU_HandleTradePacket, 0x3F to ITEM_HandleItemCursorAssign, 0x40 to ITEM_HandleItemFlagEditPacket, 0x50 to NET_D2GS_CLIENT_Handle0x50_QuestSpecial, 0x74 to PLAYER_HandlePlayerDeath, 0x76 to TEXT_ClearUnitHoverText, 0x7D to ITEM_HandleItemRepairBreak. The copies cover exactly the struct (15 bytes for 0x2A, 0x12 for 0x7D), which is a struct assignment the compiler unrolled. 0x9B reads wMercNameId (u16 at 1) and the low word of dwReviveCost (3). Each is its opcode's slot in the client handler table at 007114d0 (12-byte entries). Typing the argument as the struct lets the copy read as one assignment, as in 1099; the chosen name pBytes stays.

Changes 8, applied together

  1. Retype variable win 0x0045e0d0 ECX

    typechar *→D2GSPacketSrv0x2A *
  2. Retype variable win 0x0045e220 ECX

    typechar *→D2GSPacketSrv0x3F *
  3. Retype variable win 0x0045e240 ECX

    typechar *→D2GSPacketSrv0x40 *
  4. Retype variable win 0x0045e370 ECX

    typechar *→D2GSPacketSrv0x50 *
  5. Retype variable win 0x0045e7b0 ECX

    typechar *→D2GSPacketSrv0x74 *
  6. Retype variable win 0x0045e050 ECX

    typechar *→D2GSPacketSrv0x76 *
  7. Retype variable win 0x0045e930 ECX

    typechar *→D2GSPacketSrv0x7D *
  8. Retype variable win 0x0045eac0 ECX

    typechar *→D2GSPacketSrv0x9B *