aboutsummaryrefslogtreecommitdiff
path: root/export
diff options
context:
space:
mode:
author1992414357@qq.com <1992414357@qq.com>2025-06-09 01:46:26 +0800
committer1992414357@qq.com <1992414357@qq.com>2025-06-09 01:46:26 +0800
commit8db4f6af3421392fb75d4a2257d39a10bcefa493 (patch)
tree15ef19c71fdb4d361709b4ef922efa948770e127 /export
parent49192dbb98e0ab1f2a66b4786fac86d63f69be64 (diff)
重构所有部分
Diffstat (limited to 'export')
-rw-r--r--export/dev/bin/padc.exebin0 -> 2452992 bytes
-rw-r--r--export/dev/bridge/nogamepads.h249
-rw-r--r--export/dev/bridge/nogamepads_cpp.h257
-rw-r--r--export/dev/bridge/nogamepads_lib_c.dllbin0 -> 2018816 bytes
4 files changed, 506 insertions, 0 deletions
diff --git a/export/dev/bin/padc.exe b/export/dev/bin/padc.exe
new file mode 100644
index 0000000..4630768
--- /dev/null
+++ b/export/dev/bin/padc.exe
Binary files differ
diff --git a/export/dev/bridge/nogamepads.h b/export/dev/bridge/nogamepads.h
new file mode 100644
index 0000000..f8b58cf
--- /dev/null
+++ b/export/dev/bridge/nogamepads.h
@@ -0,0 +1,249 @@
+/* NoGamepads C Bindings. */
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+typedef enum ConnCallbackMsgCTag {
+ Profile,
+ Deny,
+ Fail,
+ Ok,
+ Welcome,
+ Err,
+} ConnCallbackMsgCTag;
+
+typedef enum ConnErrTypeC {
+ ContainSamePlayer,
+ PlayerBanned,
+ Timeout,
+ GameLocked,
+ WhatTheHell,
+} ConnErrTypeC;
+
+typedef enum ConnMsgCTag {
+ Connection,
+ RequestProfile,
+ RequestLayoutConfigure,
+ RequestSkinPackage,
+ Ready,
+ Err,
+} ConnMsgCTag;
+
+typedef enum CtrlMsgCTag {
+ Msg,
+ Pressed,
+ Released,
+ Axis,
+ Dir,
+ Exit,
+ Err,
+} CtrlMsgCTag;
+
+typedef enum GameMsgCTag {
+ SkinEventTrigger,
+ DisableKey,
+ EnableKey,
+ Leave,
+ Err,
+} GameMsgCTag;
+
+typedef enum LeaveReasonData {
+ GameOver,
+ ServerClosed,
+ YouAreKicked,
+ YouAreBanned,
+} LeaveReasonData;
+
+typedef struct GameProfileC {
+ const char *game_name;
+ const char *game_description;
+ const char *organization;
+ const char *version;
+ const char *website;
+ const char *email;
+} GameProfileC;
+
+typedef struct PlayerInfoC {
+ const char *account_id;
+ const char *account_hash;
+ const char *customize_nickname;
+ int32_t customize_color_hue;
+ double customize_color_saturation;
+ double customize_color_value;
+} PlayerInfoC;
+
+typedef struct PadClientC {
+ const char *target_address;
+ uint16_t target_port;
+ struct PlayerInfoC bind_player;
+ bool enable_console;
+ bool quiet;
+} PadClientC;
+
+typedef struct KeyData {
+ uint8_t key;
+} KeyData;
+
+typedef struct AxisData {
+ uint8_t key;
+ double ax;
+} AxisData;
+
+typedef struct DirData {
+ uint8_t key;
+ double x;
+ double y;
+} DirData;
+
+typedef struct StrData {
+ const char *str;
+} StrData;
+
+typedef union CtrlMsgCUnion {
+ void *nul;
+ struct KeyData key;
+ struct AxisData axis;
+ struct DirData dir;
+ struct StrData str;
+} CtrlMsgCUnion;
+
+typedef struct ControlMessageC {
+ enum CtrlMsgCTag tag;
+ union CtrlMsgCUnion data;
+} ControlMessageC;
+
+typedef union GameMsgCUnion {
+ void *nul;
+ struct KeyData key;
+ enum LeaveReasonData reason;
+} GameMsgCUnion;
+
+typedef struct GameMessageC {
+ enum GameMsgCTag tag;
+ union GameMsgCUnion data;
+} GameMessageC;
+
+typedef struct PlayerList {
+ struct PlayerInfoC *players;
+ uintptr_t len;
+ uintptr_t capacity;
+} PlayerList;
+
+typedef union ConnMsgCUnion {
+ void *nul;
+ PlayerInfo info;
+} ConnMsgCUnion;
+
+typedef struct ConnectionMessageC {
+ enum ConnMsgCTag tag;
+ union ConnMsgCUnion data;
+} ConnectionMessageC;
+
+typedef union ConnCallbackMsgCUnion {
+ void *nul;
+ struct GameProfileC profile;
+ enum ConnErrTypeC conn_err;
+} ConnCallbackMsgCUnion;
+
+typedef struct ConnectionCallbackMessageC {
+ enum ConnCallbackMsgCTag tag;
+ union ConnCallbackMsgCUnion data;
+} ConnectionCallbackMessageC;
+
+struct GameProfileC init_game_profile(void);
+
+struct GameProfileC set_game_profile_name(struct GameProfileC game_profile, const char *value);
+
+struct GameProfileC set_game_profile_description(struct GameProfileC game_profile,
+ const char *value);
+
+struct GameProfileC set_game_profile_organization(struct GameProfileC game_profile,
+ const char *value);
+
+struct GameProfileC set_game_profile_version(struct GameProfileC game_profile, const char *value);
+
+struct GameProfileC set_game_profile_website(struct GameProfileC game_profile, const char *value);
+
+struct GameProfileC set_game_profile_email(struct GameProfileC game_profile, const char *value);
+
+struct PlayerInfoC init_player_info(void);
+
+struct PlayerInfoC set_player_info_account(struct PlayerInfoC info,
+ const char *id,
+ const char *password);
+
+struct PlayerInfoC set_player_info_color(struct PlayerInfoC info, int32_t h, double s, double v);
+
+struct PlayerInfoC set_player_info_nickname(struct PlayerInfoC info, const char *nickname);
+
+uint16_t get_default_port(void);
+
+struct PadClientC init_client(const char *address);
+
+struct PadClientC init_client_with_port(const char *address, uint16_t port);
+
+struct PadClientC set_client_quiet(struct PadClientC client);
+
+struct PadClientC enable_client_console(struct PadClientC client);
+
+struct PadClientC bind_player_to_client(struct PadClientC client, struct PlayerInfoC info);
+
+PadClient *complete(struct PadClientC client);
+
+void connect_client_to_server(PadClient *client);
+
+void exit_client_from_server(const PadClient *client);
+
+void put_a_msg_to_server(const PadClient *client, struct ControlMessageC msg);
+
+struct GameMessageC pop_a_msg_from_server(const PadClient *client);
+
+struct GameMessageC pop_msg_from_server_or(const PadClient *client, struct GameMessageC or);
+
+PadServer *init_server(const char *address);
+
+PadServer *init_server_with_port(const char *address, uint16_t port);
+
+void set_server_quiet(PadServer *server);
+
+void enable_server_console(PadServer *server);
+
+void bind_profile_to_server(PadServer *server, const struct GameProfileC *profile);
+
+void start_server(PadServer *server);
+
+void stop_server(PadServer *server);
+
+void lock_game_on_server(PadServer *server);
+
+void unlock_game_on_server(PadServer *server);
+
+bool is_server_game_locked(PadServer *server);
+
+void put_a_msg_to_player(PadServer *server,
+ struct GameMessageC msg,
+ const struct PlayerInfoC *player);
+
+void put_msg_to_all_players(PadServer *server, struct GameMessageC msg);
+
+struct ControlMessageC pop_a_msg_from_player(PadServer *server, const struct PlayerInfoC *player);
+
+struct ControlMessageC pop_msg_from_player_or(PadServer *server,
+ const struct PlayerInfoC *player,
+ struct ControlMessageC or);
+
+bool is_player_online(PadServer *server, const struct PlayerInfoC *player);
+
+bool is_player_banned(PadServer *server, const struct PlayerInfoC *player);
+
+void kick_player(PadServer *server, const struct PlayerInfoC *player);
+
+void ban_player(PadServer *server, const struct PlayerInfoC *player);
+
+void pardon_player(PadServer *server, const struct PlayerInfoC *player);
+
+struct PlayerList list_online_players(PadServer *server);
+
+struct PlayerList list_banned_players(PadServer *server);
diff --git a/export/dev/bridge/nogamepads_cpp.h b/export/dev/bridge/nogamepads_cpp.h
new file mode 100644
index 0000000..cd31b65
--- /dev/null
+++ b/export/dev/bridge/nogamepads_cpp.h
@@ -0,0 +1,257 @@
+/* NoGamepads C++ Bindings. */
+
+/* Generated with cbindgen:0.29.0 */
+
+#include <cstdarg>
+#include <cstdint>
+#include <cstdlib>
+#include <ostream>
+#include <new>
+
+namespace nogamepads {
+
+enum class ConnCallbackMsgCTag {
+ Profile,
+ Deny,
+ Fail,
+ Ok,
+ Welcome,
+ Err,
+};
+
+enum class ConnErrTypeC {
+ ContainSamePlayer,
+ PlayerBanned,
+ Timeout,
+ GameLocked,
+ WhatTheHell,
+};
+
+enum class ConnMsgCTag {
+ Connection,
+ RequestProfile,
+ RequestLayoutConfigure,
+ RequestSkinPackage,
+ Ready,
+ Err,
+};
+
+enum class CtrlMsgCTag {
+ Msg,
+ Pressed,
+ Released,
+ Axis,
+ Dir,
+ Exit,
+ Err,
+};
+
+enum class GameMsgCTag {
+ SkinEventTrigger,
+ DisableKey,
+ EnableKey,
+ Leave,
+ Err,
+};
+
+enum class LeaveReasonData {
+ GameOver,
+ ServerClosed,
+ YouAreKicked,
+ YouAreBanned,
+};
+
+template<typename T = void>
+struct ManuallyDrop;
+
+struct GameProfileC {
+ const char *game_name;
+ const char *game_description;
+ const char *organization;
+ const char *version;
+ const char *website;
+ const char *email;
+};
+
+struct PlayerInfoC {
+ const char *account_id;
+ const char *account_hash;
+ const char *customize_nickname;
+ int32_t customize_color_hue;
+ double customize_color_saturation;
+ double customize_color_value;
+};
+
+struct PadClientC {
+ const char *target_address;
+ uint16_t target_port;
+ PlayerInfoC bind_player;
+ bool enable_console;
+ bool quiet;
+};
+
+struct KeyData {
+ uint8_t key;
+};
+
+struct AxisData {
+ uint8_t key;
+ double ax;
+};
+
+struct DirData {
+ uint8_t key;
+ double x;
+ double y;
+};
+
+struct StrData {
+ const char *str;
+};
+
+union CtrlMsgCUnion {
+ void *nul;
+ KeyData key;
+ AxisData axis;
+ DirData dir;
+ StrData str;
+};
+
+struct ControlMessageC {
+ CtrlMsgCTag tag;
+ CtrlMsgCUnion data;
+};
+
+union GameMsgCUnion {
+ void *nul;
+ KeyData key;
+ LeaveReasonData reason;
+};
+
+struct GameMessageC {
+ GameMsgCTag tag;
+ GameMsgCUnion data;
+};
+
+struct PlayerList {
+ PlayerInfoC *players;
+ uintptr_t len;
+ uintptr_t capacity;
+};
+
+union ConnMsgCUnion {
+ void *nul;
+ ManuallyDrop<PlayerInfo> info;
+};
+
+struct ConnectionMessageC {
+ ConnMsgCTag tag;
+ ConnMsgCUnion data;
+};
+
+union ConnCallbackMsgCUnion {
+ void *nul;
+ ManuallyDrop<GameProfileC> profile;
+ ConnErrTypeC conn_err;
+};
+
+struct ConnectionCallbackMessageC {
+ ConnCallbackMsgCTag tag;
+ ConnCallbackMsgCUnion data;
+};
+
+extern "C" {
+
+GameProfileC init_game_profile();
+
+GameProfileC set_game_profile_name(GameProfileC game_profile, const char *value);
+
+GameProfileC set_game_profile_description(GameProfileC game_profile, const char *value);
+
+GameProfileC set_game_profile_organization(GameProfileC game_profile, const char *value);
+
+GameProfileC set_game_profile_version(GameProfileC game_profile, const char *value);
+
+GameProfileC set_game_profile_website(GameProfileC game_profile, const char *value);
+
+GameProfileC set_game_profile_email(GameProfileC game_profile, const char *value);
+
+PlayerInfoC init_player_info();
+
+PlayerInfoC set_player_info_account(PlayerInfoC info, const char *id, const char *password);
+
+PlayerInfoC set_player_info_color(PlayerInfoC info, int32_t h, double s, double v);
+
+PlayerInfoC set_player_info_nickname(PlayerInfoC info, const char *nickname);
+
+uint16_t get_default_port();
+
+PadClientC init_client(const char *address);
+
+PadClientC init_client_with_port(const char *address, uint16_t port);
+
+PadClientC set_client_quiet(PadClientC client);
+
+PadClientC enable_client_console(PadClientC client);
+
+PadClientC bind_player_to_client(PadClientC client, PlayerInfoC info);
+
+PadClient *complete(PadClientC client);
+
+void connect_client_to_server(PadClient *client);
+
+void exit_client_from_server(const PadClient *client);
+
+void put_a_msg_to_server(const PadClient *client, ControlMessageC msg);
+
+GameMessageC pop_a_msg_from_server(const PadClient *client);
+
+GameMessageC pop_msg_from_server_or(const PadClient *client, GameMessageC or);
+
+PadServer *init_server(const char *address);
+
+PadServer *init_server_with_port(const char *address, uint16_t port);
+
+void set_server_quiet(PadServer *server);
+
+void enable_server_console(PadServer *server);
+
+void bind_profile_to_server(PadServer *server, const GameProfileC *profile);
+
+void start_server(PadServer *server);
+
+void stop_server(PadServer *server);
+
+void lock_game_on_server(PadServer *server);
+
+void unlock_game_on_server(PadServer *server);
+
+bool is_server_game_locked(PadServer *server);
+
+void put_a_msg_to_player(PadServer *server, GameMessageC msg, const PlayerInfoC *player);
+
+void put_msg_to_all_players(PadServer *server, GameMessageC msg);
+
+ControlMessageC pop_a_msg_from_player(PadServer *server, const PlayerInfoC *player);
+
+ControlMessageC pop_msg_from_player_or(PadServer *server,
+ const PlayerInfoC *player,
+ ControlMessageC or);
+
+bool is_player_online(PadServer *server, const PlayerInfoC *player);
+
+bool is_player_banned(PadServer *server, const PlayerInfoC *player);
+
+void kick_player(PadServer *server, const PlayerInfoC *player);
+
+void ban_player(PadServer *server, const PlayerInfoC *player);
+
+void pardon_player(PadServer *server, const PlayerInfoC *player);
+
+PlayerList list_online_players(PadServer *server);
+
+PlayerList list_banned_players(PadServer *server);
+
+} // extern "C"
+
+} // namespace nogamepads
diff --git a/export/dev/bridge/nogamepads_lib_c.dll b/export/dev/bridge/nogamepads_lib_c.dll
new file mode 100644
index 0000000..6c376db
--- /dev/null
+++ b/export/dev/bridge/nogamepads_lib_c.dll
Binary files differ