Contract: the export row (22 bytes, the stable index, the hidden rule), the
0x44 message row (23 bytes), bit 0x8000, protocol 12, binding rows. README
export counts. Probe: Single, a second Single duel with another deck order
and an opponent without the bit, Tag: a card asks in cost, target and
operation, a Fusion's material procedure asks inside that operation and the
outer context comes back, then the card hides in the deck and asks both
players.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Namespace YGOLegacy.Engine in binding/YGOLegacy.Engine:
- EngineApi: one DllImport("ygol-engine", Cdecl) extern per export of contract/ocgapi.h (45),
C names kept, types by the contract's type rule; delegates ScriptReader, CardReader,
MessageHandler beside it.
- MessageScan: MsgInfo, Scan, Blank, BlankPileCodes, PromptName moved from the Unity bot host
(LocalDuelHost), public, bodies unchanged (+ the private FieldOffset helper and the five
constants they read).
- GameMessage: enum : byte, one member per #define MSG_* in core/common.h (84), PascalCase names.
- EngineBinding: const Version generated at build from the EngineVersion property into
obj/EngineBindingVersion.cs (local by default); CheckNative() compares it with
ygol_engine_version() and throws InvalidOperationException naming both.
Tests: EngineApiParityTests (header names vs extern names, both ways; public, Cdecl, no
CharSet.Unicode, no overloads) and GameMessageParityTests (missing, extra, renumbered).
114 -> 122 tests, green.
contract/engine-contract.md: five parts; "(e) C# binding" with the 45-row extern table, the type
rule and the version rule; engine.json's binding key documented. CHANGELOG.md: Unreleased ->
v1.1.0 with the TICKET-397 and TICKET-398 rows. README.md: the Binding section names the four
types and CheckNative().
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJUFwdiGCHipsxLkgxssSR
binding/YGOLegacy.Engine (netstandard2.1, LangVersion 9, unsafe, no package, no Unity
reference) holds the Unity repo's Assets/YGOLegacy/Scripts/Protocol/ as
Protocol/{Contracts,Codecs,Framing,Routing}: 12 files copied byte-identical (LF), namespaces
YGOLegacy.Protocol.* unchanged. EngineVersion (default local) is stamped as the informational
version, so the DLL's ProductVersion is the tag it was built for.
binding/YGOLegacy.Engine.Tests (net8.0, NUnit 3.14) holds the six fixtures. 114 tests pass,
the Unity Edit Mode count. Two deviations from "as-is", lead-approved 2026-10-15:
LegacyReaders.cs is a frozen test-only copy of the legacy MDPro3 / YGOSharp readers and enums
the parity tests compare against (they live only in the Unity repo), and FrameCodecTests.cs
line 35 casts (short) instead of (byte): BitConverter.GetBytes((byte)) is ambiguous on
net8.0 (the Half overload), same bytes written.
The windows job builds and tests the binding after the native gates (both with
-p:EngineVersion so the test's project reference does not restamp the DLL as local), checks
the ProductVersion and stages ygol-engine-binding.zip (YGOLegacy.Engine.dll + .pdb) beside
ygol-engine-win64.zip; attach-windows attaches both. engine.json gains "binding": "<version>"
on every platform (windows.ps1 and the Dockerfile's export-gate, the only writers) and the
release job's agreement check includes it. README gains the Binding section and the asset row;
.gitignore ignores binding/**/bin and obj.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJUFwdiGCHipsxLkgxssSR