Skip to content

Use #pragma pack instead of PABB_PACK in the shared protocol headers - #1886

Merged
Mysticial merged 2 commits into
mainfrom
cleanup-pragma-pack
Nov 11, 2026
Merged

Mysticial merged 2 commits into
mainfrom
cleanup-pragma-pack

Conversation

@pa-devbot

Copy link
Copy Markdown
Collaborator

Summary

#if _WIN32
#pragma pack(push, 1)
#define PABB_PACK
#elif __GNUC__
#define PABB_PACK   __attribute__((packed))
#else
#define PABB_PACK
#endif

#pragma pack(push, 1) / #pragma pack(pop) is supported by MSVC, GCC/Clang and avr-gcc alike, so this mess is replaced by a single pack(1) region around the message structs in the 9 shared headers under Common/, and all PABB_PACK tokens are dropped from the struct declarations (plus the inline block in SerialPrograms/Source/NintendoSwitch/Controllers/PABotBase2/NintendoSwitch_PABotBase2_OemController.cpp).

These headers are the shared wire format with Firmware, and after this PR the 9 files are byte-identical in both repos (Firmware has the matching PR: PokemonAutomation/Firmware#57).

Also in this PR

Second commit: syncs PABB2_MESSAGE_PROTOCOL_VERSION to 2026061806 (the value the firmware reports; this copy was stale at 2026061804 since the 2026-09-02 sync). The constant is informational on the PC side — compatibility is decided by SerialPABotBase::SUPPORTED_VERSIONS2() — so this is a pure sync to keep the shared file identical.

Verification

  • Full pa-build (Linux, Qt 6.10.2, ONNX Runtime) passes.
  • pa-test (command-line test mode): 20,516 passed, 0 failed, 5 skipped.
  • sizeof of every message struct in the shared headers is byte-identical before/after the change (C harness over 35 MLC types, C++ harness over 12 PABotBase2 types).

#pragma pack(push, 1) / #pragma pack(pop) is supported by MSVC, GCC/Clang
and avr-gcc alike, so the #if _WIN32 / #elif __GNUC__ PABB_PACK macro
(#define PABB_PACK __attribute__((packed)) on GCC, empty on MSVC) is
replaced by a single pack(1) region around the message structs, and the
PABB_PACK tokens are dropped from the struct declarations.
The PC copy was still at 2026061804 from the 2026-09-02 sync, while the
firmware reports 2026061806. The constant is only informational on the PC
side (compatibility is decided by SerialPABotBase::SUPPORTED_VERSIONS2()),
but keeping the shared header byte-identical in both repos.
@Mysticial
Mysticial merged commit ad430c3 into main Nov 11, 2026
8 checks passed
@Mysticial
Mysticial deleted the cleanup-pragma-pack branch November 11, 2026 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants