Core: ygol_query_tag_cards(pduel, playerid, out) reads the waiting tag partner's tag_list_hand / tag_list_extra (bit 31 = face-up, like MSG_TAG_SWAP) and tag_list_main sorted ascending; returns the byte length, 0 when not a tag duel. Read only. Server: STOC_TAG_PARTNER_CARDS 0x5F = u8 side + those bytes, no stamp, to that side's two seats only (never the other team, never an observer): after start_duel, after every MSG_TAG_SWAP, and in a seated duelist's field resync. FEATURE_TAG_PARTNER_CARDS 0x2000 advertised by single_duel and tag_duel; FEATURE_PROTOCOL 8 -> 9. 0x800 / 0x1000 stay reserved for proposals 44 / 45. Binding: StocMessage.TagPartnerCards, FeatureFlags.TagPartnerCards, the TagPartnerCards record + StocCodecs.TagPartnerCards, EngineApi.ygol_query_tag_cards, Capability.ProtocolVersion 9, tests. Contract rows, CHANGELOG v1.2.0, the probe's tag partner cards room, the export gates 334 / 855 / 849 -> 335 / 856 / 850. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
158 lines
8.4 KiB
C#
158 lines
8.4 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace YGOLegacy.Engine
|
|
{
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
public unsafe delegate IntPtr ScriptReader([MarshalAs(UnmanagedType.LPUTF8Str)] string script_name, int* len);
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
public delegate uint CardReader(uint code, IntPtr data);
|
|
|
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
public delegate uint MessageHandler(IntPtr pduel, uint msg_type);
|
|
|
|
public static unsafe class EngineApi
|
|
{
|
|
private const string Library = "ygol-engine";
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_script_reader(ScriptReader f);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_card_reader(CardReader f);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_message_handler(MessageHandler f);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr create_duel(uint seed);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr create_duel_v2(uint[] seed_sequence);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr create_duel_ex(uint seed, uint create_flags);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr create_duel_v2_ex(uint[] seed_sequence, uint create_flags);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void start_duel(IntPtr pduel, uint options);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void end_duel(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_player_info(IntPtr pduel, int playerid, int lp, int startcount, int drawcount);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void get_log_message(IntPtr pduel, byte[] buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int get_message(IntPtr pduel, byte[] buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern uint process(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void new_card(IntPtr pduel, uint code, byte owner, byte playerid, byte location, byte sequence, byte position);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void new_tag_card(IntPtr pduel, uint code, byte owner, byte location);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int query_card(IntPtr pduel, byte playerid, byte location, byte sequence, uint query_flag, byte[] buf, int use_cache);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int query_field_count(IntPtr pduel, byte playerid, byte location);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int query_field_card(IntPtr pduel, byte playerid, byte location, uint query_flag, byte[] buf, int use_cache);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int query_field_info(IntPtr pduel, byte[] buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_responsei(IntPtr pduel, int value);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_responseb(IntPtr pduel, byte[] buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int preload_script(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string script_name);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr default_script_reader([MarshalAs(UnmanagedType.LPUTF8Str)] string script_name, int* len);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_preview_attack(IntPtr pduel, byte playerid, byte location, byte sequence, byte target_location, byte target_sequence, byte[] @out);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_query_tag_cards(IntPtr pduel, byte playerid, byte[] @out);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int get_registry_value(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string key, byte[] out_buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void set_registry_value(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string key, [MarshalAs(UnmanagedType.LPUTF8Str)] string value);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int get_registry_keys(IntPtr pduel, byte[] out_buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void clear_registry(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int dump_registry(IntPtr pduel, byte[] out_buf);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void load_registry(IntPtr pduel, byte[] in_buf, int in_len);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int get_lua_coverage_dump_size(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string name);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int dump_lua_coverage(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string name, byte[] out_buf, int out_len);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int get_all_lua_coverages_dump_size(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int dump_all_lua_coverages(IntPtr pduel, byte[] out_buf, int out_len);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void clear_lua_coverage(IntPtr pduel, [MarshalAs(UnmanagedType.LPUTF8Str)] string name);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void clear_all_lua_coverages(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_add(IntPtr pduel, uint code, byte owner, byte playerid, byte location, byte sequence, byte position);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_move(IntPtr pduel, byte playerid, byte location, byte sequence, byte dst_playerid, byte dst_location, byte dst_sequence, byte position);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_remove(IntPtr pduel, byte playerid, byte location, byte sequence);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_set_position(IntPtr pduel, byte playerid, byte location, byte sequence, byte position);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_set_lp(IntPtr pduel, byte playerid, int lp);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int ygol_sb_reask(IntPtr pduel);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern int start_server([MarshalAs(UnmanagedType.LPUTF8Str)] string args);
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern void stop_server();
|
|
|
|
[DllImport(Library, CallingConvention = CallingConvention.Cdecl)]
|
|
public static extern IntPtr ygol_engine_version();
|
|
}
|
|
}
|