scorbit-py2 1.99.72__py2-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
scorbit/__init__.py ADDED
@@ -0,0 +1,145 @@
1
+ # Scorbit SDK
2
+ #
3
+ # (c) 2025 Spinner Systems, Inc. (DBA Scorbit), scorbit.io, All Rights Reserved
4
+ #
5
+ # MIT License
6
+ #
7
+ # The above copyright notice and this permission notice shall be included in
8
+ # all copies or substantial portions of the Software.
9
+
10
+ """Scorbit SDK - Python 2.7 wrapper (pure-Python / ctypes).
11
+
12
+ This package provides a Pythonic interface to the Scorbit SDK C library.
13
+ The SDK shared library (``libscorbit_sdk.so`` / ``.dylib`` / ``.dll``) must
14
+ be installed separately; see :mod:`scorbit._loader` for discovery rules.
15
+
16
+ Quick start::
17
+
18
+ import scorbit
19
+
20
+ config = scorbit.Config()
21
+ config.set_provider("myprovider")
22
+ config.set_machine_id(4419)
23
+ config.set_game_code_version("1.0.0")
24
+ config.set_encrypted_key(encrypted_key)
25
+
26
+ def on_event(event):
27
+ print("Event:", event.type)
28
+
29
+ config.set_event_callback(on_event)
30
+
31
+ with scorbit.create_game_state(config) as gs:
32
+ gs.set_game_started(scorbit.GameStartOrigin.StartButton)
33
+ gs.set_score(1, 42000)
34
+ gs.commit()
35
+ """
36
+
37
+ from __future__ import absolute_import
38
+
39
+ from ._version import __version__
40
+
41
+ # -- public API ---------------------------------------------------------------
42
+
43
+ from ._enums import (
44
+ AuthStatus,
45
+ Capability,
46
+ Error,
47
+ EventType,
48
+ GameStartOrigin,
49
+ LeaderboardPeriod,
50
+ LeaderboardScope,
51
+ LeaderboardVpinFilter,
52
+ LogLevel,
53
+ )
54
+ from ._types import (
55
+ BundlePrice,
56
+ LeaderboardEntry,
57
+ LeaderboardPlayer,
58
+ LeaderboardResult,
59
+ PlayerInfo,
60
+ PricingInfo,
61
+ )
62
+ from .config import Config
63
+ from .event import Event
64
+ from .game_state import GameState, create_game_state
65
+
66
+ # -- logger API (only when the native library wires callbacks; spdlog builds omit it).
67
+ from ._bindings import _has_logger as _has_logger, _lib as _lib
68
+
69
+ if _has_logger:
70
+ import traceback as _traceback
71
+
72
+ from . import config as _config_mod
73
+ from ._bindings import sb_log_callback_t as _sb_log_callback_t
74
+
75
+ _logger_prevent_gc = [] # type: list
76
+
77
+ def add_logger_callback(callback, max_length=512):
78
+ # type: (..., int) -> None
79
+ """Register a custom log callback.
80
+
81
+ The callback signature is::
82
+
83
+ def my_logger(message, level, file, line, timestamp):
84
+ ...
85
+
86
+ Args:
87
+ callback: The logger function.
88
+ max_length: Maximum log message length passed to the callback.
89
+ """
90
+
91
+ @_sb_log_callback_t
92
+ def _trampoline(message, level, file, line, timestamp, user_data):
93
+ if _config_mod._shutting_down:
94
+ return
95
+ try:
96
+ msg = message
97
+ if isinstance(msg, bytes):
98
+ msg = msg.decode("utf-8", "replace")
99
+ f = file
100
+ if isinstance(f, bytes):
101
+ f = f.decode("utf-8", "replace")
102
+ callback(msg, LogLevel(level), f or "", line, timestamp)
103
+ except Exception:
104
+ _traceback.print_exc()
105
+
106
+ _logger_prevent_gc.append(_trampoline)
107
+ _lib.sb_add_logger_callback(_trampoline, None, max_length)
108
+
109
+ def reset_logger():
110
+ # type: () -> None
111
+ """Remove all previously registered logger callbacks."""
112
+ _lib.sb_reset_logger()
113
+ del _logger_prevent_gc[:]
114
+
115
+
116
+ __all__ = [
117
+ # Version
118
+ "__version__",
119
+ # Enums
120
+ "AuthStatus",
121
+ "Capability",
122
+ "Error",
123
+ "EventType",
124
+ "GameStartOrigin",
125
+ "LeaderboardPeriod",
126
+ "LeaderboardScope",
127
+ "LeaderboardVpinFilter",
128
+ "LogLevel",
129
+ # Types
130
+ "BundlePrice",
131
+ "LeaderboardEntry",
132
+ "LeaderboardPlayer",
133
+ "LeaderboardResult",
134
+ "PlayerInfo",
135
+ "PricingInfo",
136
+ # Classes
137
+ "Config",
138
+ "Event",
139
+ "GameState",
140
+ # Factory
141
+ "create_game_state",
142
+ ]
143
+
144
+ if _has_logger:
145
+ __all__ = __all__ + ["add_logger_callback", "reset_logger"]
scorbit/_bindings.py ADDED
@@ -0,0 +1,506 @@
1
+ # Scorbit SDK
2
+ #
3
+ # (c) 2025 Spinner Systems, Inc. (DBA Scorbit), scorbit.io, All Rights Reserved
4
+ #
5
+ # MIT License
6
+ #
7
+ # The above copyright notice and this permission notice shall be included in
8
+ # all copies or substantial portions of the Software.
9
+
10
+ """Raw ctypes declarations for every exported C function in the Scorbit SDK.
11
+
12
+ All functions are declared on the module-level ``_lib`` object imported from
13
+ :mod:`scorbit._loader`. Callback function-pointer types (``CFUNCTYPE``) are
14
+ also defined here so higher-level modules can create type-safe trampolines.
15
+ """
16
+
17
+ from __future__ import absolute_import
18
+
19
+ from ctypes import (
20
+ CFUNCTYPE,
21
+ POINTER,
22
+ c_bool,
23
+ c_char,
24
+ c_char_p,
25
+ c_int,
26
+ c_int32,
27
+ c_int64,
28
+ c_size_t,
29
+ c_uint,
30
+ c_uint8,
31
+ c_uint32,
32
+ c_uint64,
33
+ c_void_p,
34
+ )
35
+
36
+ from ._loader import _lib
37
+
38
+ # ---------------------------------------------------------------------------
39
+ # Opaque handle types (all represented as void*)
40
+ # ---------------------------------------------------------------------------
41
+ sb_game_handle_t = c_void_p
42
+ sb_config_t = c_void_p
43
+ sb_leaderboard_t = c_void_p
44
+
45
+ # ---------------------------------------------------------------------------
46
+ # Constants from net_types_c.h
47
+ # ---------------------------------------------------------------------------
48
+ SB_DIGEST_LENGTH = 32
49
+ SB_UUID_LENGTH = 16
50
+ SB_SIGNATURE_MAX_LENGTH = 72
51
+ SB_KEY_LENGTH = 32
52
+
53
+ # ---------------------------------------------------------------------------
54
+ # C callback function-pointer types
55
+ # ---------------------------------------------------------------------------
56
+
57
+ # void (*sb_event_callback_t)(const sb_event_t *event, void *user_data)
58
+ sb_event_callback_t = CFUNCTYPE(None, c_void_p, c_void_p)
59
+
60
+ # void (*sb_string_callback_t)(sb_error_t error, const char *reply, void *user_data)
61
+ sb_string_callback_t = CFUNCTYPE(None, c_int, c_char_p, c_void_p)
62
+
63
+ # void (*sb_buffer_callback_t)(sb_error_t error, const uint8_t *data, size_t size, void *user_data)
64
+ sb_buffer_callback_t = CFUNCTYPE(None, c_int, POINTER(c_uint8), c_size_t, c_void_p)
65
+
66
+ # void (*sb_leaderboard_callback_t)(sb_error_t error, sb_leaderboard_t*, void *user_data)
67
+ sb_leaderboard_callback_t = CFUNCTYPE(None, c_int, sb_leaderboard_t, c_void_p)
68
+
69
+ # int (*sb_signer_callback_t)(uint8_t signature[72], size_t *signature_len,
70
+ # const uint8_t digest[32], void *user_data)
71
+ sb_signer_callback_t = CFUNCTYPE(
72
+ c_int,
73
+ POINTER(c_uint8), # signature buffer
74
+ POINTER(c_size_t), # signature_len out
75
+ POINTER(c_uint8), # digest
76
+ c_void_p, # user_data
77
+ )
78
+
79
+ # void (*sb_save_key_callback_t)(const char *key, void *user_data)
80
+ sb_save_key_callback_t = CFUNCTYPE(None, c_char_p, c_void_p)
81
+
82
+ # int (*sb_load_key_callback_t)(char *buffer, size_t buffer_size, void *user_data)
83
+ # POINTER(c_char): writable buffer; c_char_p becomes immutable str/bytes in callbacks (Py2 breaks).
84
+ sb_load_key_callback_t = CFUNCTYPE(c_int, POINTER(c_char), c_size_t, c_void_p)
85
+
86
+ # void (*sb_log_callback_t)(const char *message, sb_log_level_t level,
87
+ # const char *file, int line, int64_t timestamp, void *user_data)
88
+ sb_log_callback_t = CFUNCTYPE(
89
+ None,
90
+ c_char_p, # message
91
+ c_int, # level
92
+ c_char_p, # file
93
+ c_int, # line
94
+ c_int64, # timestamp
95
+ c_void_p, # user_data
96
+ )
97
+
98
+ # ---------------------------------------------------------------------------
99
+ # config_c.h
100
+ # ---------------------------------------------------------------------------
101
+
102
+ # sb_config_t sb_config_create(void)
103
+ _lib.sb_config_create.restype = sb_config_t
104
+ _lib.sb_config_create.argtypes = []
105
+
106
+ # void sb_config_destroy(sb_config_t config)
107
+ _lib.sb_config_destroy.restype = None
108
+ _lib.sb_config_destroy.argtypes = [sb_config_t]
109
+
110
+ # void sb_config_set_provider(sb_config_t, const char*)
111
+ _lib.sb_config_set_provider.restype = None
112
+ _lib.sb_config_set_provider.argtypes = [sb_config_t, c_char_p]
113
+
114
+ # void sb_config_set_machine_id(sb_config_t, int32_t)
115
+ _lib.sb_config_set_machine_id.restype = None
116
+ _lib.sb_config_set_machine_id.argtypes = [sb_config_t, c_int32]
117
+
118
+ # void sb_config_set_game_code_version(sb_config_t, const char*)
119
+ _lib.sb_config_set_game_code_version.restype = None
120
+ _lib.sb_config_set_game_code_version.argtypes = [sb_config_t, c_char_p]
121
+
122
+ # void sb_config_set_hostname(sb_config_t, const char*)
123
+ _lib.sb_config_set_hostname.restype = None
124
+ _lib.sb_config_set_hostname.argtypes = [sb_config_t, c_char_p]
125
+
126
+ # void sb_config_set_cf_hostname(sb_config_t, const char*)
127
+ _lib.sb_config_set_cf_hostname.restype = None
128
+ _lib.sb_config_set_cf_hostname.argtypes = [sb_config_t, c_char_p]
129
+
130
+ # void sb_config_set_uuid(sb_config_t, const char*)
131
+ _lib.sb_config_set_uuid.restype = None
132
+ _lib.sb_config_set_uuid.argtypes = [sb_config_t, c_char_p]
133
+
134
+ # void sb_config_set_serial_number(sb_config_t, uint64_t)
135
+ _lib.sb_config_set_serial_number.restype = None
136
+ _lib.sb_config_set_serial_number.argtypes = [sb_config_t, c_uint64]
137
+
138
+ # void sb_config_set_auto_download_player_pics(sb_config_t, bool)
139
+ _lib.sb_config_set_auto_download_player_pics.restype = None
140
+ _lib.sb_config_set_auto_download_player_pics.argtypes = [sb_config_t, c_bool]
141
+
142
+ # void sb_config_set_threads_priority(sb_config_t, int)
143
+ _lib.sb_config_set_threads_priority.restype = None
144
+ _lib.sb_config_set_threads_priority.argtypes = [sb_config_t, c_int]
145
+
146
+ # void sb_config_set_score_features(sb_config_t, const char**, size_t, int)
147
+ _lib.sb_config_set_score_features.restype = None
148
+ _lib.sb_config_set_score_features.argtypes = [
149
+ sb_config_t,
150
+ POINTER(c_char_p),
151
+ c_size_t,
152
+ c_int,
153
+ ]
154
+
155
+ # void sb_config_set_encrypted_key(sb_config_t, const char*)
156
+ _lib.sb_config_set_encrypted_key.restype = None
157
+ _lib.sb_config_set_encrypted_key.argtypes = [sb_config_t, c_char_p]
158
+
159
+ # void sb_config_set_signer(sb_config_t, sb_signer_callback_t, void*)
160
+ _lib.sb_config_set_signer.restype = None
161
+ _lib.sb_config_set_signer.argtypes = [sb_config_t, sb_signer_callback_t, c_void_p]
162
+
163
+ # void sb_config_set_scorbitd_version(sb_config_t, const char*)
164
+ _lib.sb_config_set_scorbitd_version.restype = None
165
+ _lib.sb_config_set_scorbitd_version.argtypes = [sb_config_t, c_char_p]
166
+
167
+ # void sb_config_set_scorbitd_platform_id(sb_config_t, const char*)
168
+ _lib.sb_config_set_scorbitd_platform_id.restype = None
169
+ _lib.sb_config_set_scorbitd_platform_id.argtypes = [sb_config_t, c_char_p]
170
+
171
+ # void sb_config_set_machine_title(sb_config_t, const char*)
172
+ _lib.sb_config_set_machine_title.restype = None
173
+ _lib.sb_config_set_machine_title.argtypes = [sb_config_t, c_char_p]
174
+
175
+ # void sb_config_set_extra_fingerprint(sb_config_t, const char*)
176
+ _lib.sb_config_set_extra_fingerprint.restype = None
177
+ _lib.sb_config_set_extra_fingerprint.argtypes = [sb_config_t, c_char_p]
178
+
179
+ # void sb_config_set_event_callback(sb_config_t, sb_event_callback_t, void*)
180
+ _lib.sb_config_set_event_callback.restype = None
181
+ _lib.sb_config_set_event_callback.argtypes = [sb_config_t, sb_event_callback_t, c_void_p]
182
+
183
+ # void sb_config_set_save_key_callback(sb_config_t, sb_save_key_callback_t, void*)
184
+ _lib.sb_config_set_save_key_callback.restype = None
185
+ _lib.sb_config_set_save_key_callback.argtypes = [sb_config_t, sb_save_key_callback_t, c_void_p]
186
+
187
+ # void sb_config_set_load_key_callback(sb_config_t, sb_load_key_callback_t, void*)
188
+ _lib.sb_config_set_load_key_callback.restype = None
189
+ _lib.sb_config_set_load_key_callback.argtypes = [sb_config_t, sb_load_key_callback_t, c_void_p]
190
+
191
+ # ---------------------------------------------------------------------------
192
+ # game_state_c.h
193
+ # ---------------------------------------------------------------------------
194
+
195
+ # sb_game_handle_t sb_create_game_state(sb_config_t)
196
+ _lib.sb_create_game_state.restype = sb_game_handle_t
197
+ _lib.sb_create_game_state.argtypes = [sb_config_t]
198
+
199
+ # void sb_destroy_game_state(sb_game_handle_t)
200
+ _lib.sb_destroy_game_state.restype = None
201
+ _lib.sb_destroy_game_state.argtypes = [sb_game_handle_t]
202
+
203
+ # void sb_set_game_started(sb_game_handle_t, sb_game_start_origin_t)
204
+ _lib.sb_set_game_started.restype = None
205
+ _lib.sb_set_game_started.argtypes = [sb_game_handle_t, c_int]
206
+
207
+ # void sb_set_game_finished(sb_game_handle_t)
208
+ _lib.sb_set_game_finished.restype = None
209
+ _lib.sb_set_game_finished.argtypes = [sb_game_handle_t]
210
+
211
+ # void sb_set_current_ball(sb_game_handle_t, sb_ball_t)
212
+ _lib.sb_set_current_ball.restype = None
213
+ _lib.sb_set_current_ball.argtypes = [sb_game_handle_t, c_uint]
214
+
215
+ # void sb_set_active_player(sb_game_handle_t, sb_player_t)
216
+ _lib.sb_set_active_player.restype = None
217
+ _lib.sb_set_active_player.argtypes = [sb_game_handle_t, c_uint]
218
+
219
+ # void sb_set_score(sb_game_handle_t, sb_player_t, sb_score_t, sb_score_feature_t)
220
+ _lib.sb_set_score.restype = None
221
+ _lib.sb_set_score.argtypes = [sb_game_handle_t, c_uint, c_int64, c_int32]
222
+
223
+ # void sb_add_mode(sb_game_handle_t, const char*)
224
+ _lib.sb_add_mode.restype = None
225
+ _lib.sb_add_mode.argtypes = [sb_game_handle_t, c_char_p]
226
+
227
+ # void sb_add_mode_expiring(sb_game_handle_t, const char*, uint32_t)
228
+ _lib.sb_add_mode_expiring.restype = None
229
+ _lib.sb_add_mode_expiring.argtypes = [sb_game_handle_t, c_char_p, c_uint32]
230
+
231
+ # void sb_remove_mode(sb_game_handle_t, const char*)
232
+ _lib.sb_remove_mode.restype = None
233
+ _lib.sb_remove_mode.argtypes = [sb_game_handle_t, c_char_p]
234
+
235
+ # void sb_clear_modes(sb_game_handle_t)
236
+ _lib.sb_clear_modes.restype = None
237
+ _lib.sb_clear_modes.argtypes = [sb_game_handle_t]
238
+
239
+ # void sb_commit(sb_game_handle_t)
240
+ _lib.sb_commit.restype = None
241
+ _lib.sb_commit.argtypes = [sb_game_handle_t]
242
+
243
+ # sb_auth_status_t sb_get_status(sb_game_handle_t)
244
+ _lib.sb_get_status.restype = c_int
245
+ _lib.sb_get_status.argtypes = [sb_game_handle_t]
246
+
247
+ # const char* sb_get_machine_uuid(sb_game_handle_t)
248
+ _lib.sb_get_machine_uuid.restype = c_char_p
249
+ _lib.sb_get_machine_uuid.argtypes = [sb_game_handle_t]
250
+
251
+ # uint64_t sb_get_machine_serial(sb_game_handle_t)
252
+ _lib.sb_get_machine_serial.restype = c_uint64
253
+ _lib.sb_get_machine_serial.argtypes = [sb_game_handle_t]
254
+
255
+ # const char* sb_get_pair_deeplink(sb_game_handle_t)
256
+ _lib.sb_get_pair_deeplink.restype = c_char_p
257
+ _lib.sb_get_pair_deeplink.argtypes = [sb_game_handle_t]
258
+
259
+ # void sb_request_top_scores(sb_game_handle_t, sb_leaderboard_scope_t,
260
+ # sb_leaderboard_period_t, const char*,
261
+ # sb_leaderboard_vpin_filter_t,
262
+ # sb_leaderboard_callback_t, void*)
263
+ _lib.sb_request_top_scores.restype = None
264
+ _lib.sb_request_top_scores.argtypes = [
265
+ sb_game_handle_t, c_int, c_int, c_char_p, c_int, sb_leaderboard_callback_t, c_void_p
266
+ ]
267
+
268
+ # size_t sb_leaderboard_entries_count(const sb_leaderboard_t*)
269
+ _lib.sb_leaderboard_entries_count.restype = c_size_t
270
+ _lib.sb_leaderboard_entries_count.argtypes = [sb_leaderboard_t]
271
+
272
+ # leaderboard entry accessors
273
+ _lib.sb_leaderboard_entry_id.restype = c_bool
274
+ _lib.sb_leaderboard_entry_id.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_uint64)]
275
+ _lib.sb_leaderboard_entry_rank.restype = c_bool
276
+ _lib.sb_leaderboard_entry_rank.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int)]
277
+ _lib.sb_leaderboard_entry_high_score.restype = c_bool
278
+ _lib.sb_leaderboard_entry_high_score.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int64)]
279
+ _lib.sb_leaderboard_entry_image.restype = c_bool
280
+ _lib.sb_leaderboard_entry_image.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
281
+ _lib.sb_leaderboard_entry_reaction_count.restype = c_bool
282
+ _lib.sb_leaderboard_entry_reaction_count.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int)]
283
+ _lib.sb_leaderboard_entry_score_count.restype = c_bool
284
+ _lib.sb_leaderboard_entry_score_count.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int)]
285
+ _lib.sb_leaderboard_entry_is_nfc_verified.restype = c_bool
286
+ _lib.sb_leaderboard_entry_is_nfc_verified.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_bool)]
287
+ _lib.sb_leaderboard_entry_is_verified.restype = c_bool
288
+ _lib.sb_leaderboard_entry_is_verified.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_bool)]
289
+ _lib.sb_leaderboard_entry_is_vpin.restype = c_bool
290
+ _lib.sb_leaderboard_entry_is_vpin.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_bool)]
291
+ _lib.sb_leaderboard_entry_created.restype = c_bool
292
+ _lib.sb_leaderboard_entry_created.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
293
+
294
+ # leaderboard player accessors
295
+ _lib.sb_leaderboard_entry_player_id.restype = c_bool
296
+ _lib.sb_leaderboard_entry_player_id.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
297
+ _lib.sb_leaderboard_entry_player_username.restype = c_bool
298
+ _lib.sb_leaderboard_entry_player_username.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
299
+ _lib.sb_leaderboard_entry_player_display_name.restype = c_bool
300
+ _lib.sb_leaderboard_entry_player_display_name.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
301
+ _lib.sb_leaderboard_entry_player_initials.restype = c_bool
302
+ _lib.sb_leaderboard_entry_player_initials.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
303
+ _lib.sb_leaderboard_entry_player_avatar.restype = c_bool
304
+ _lib.sb_leaderboard_entry_player_avatar.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
305
+ _lib.sb_leaderboard_entry_player_follower_count.restype = c_bool
306
+ _lib.sb_leaderboard_entry_player_follower_count.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int)]
307
+ _lib.sb_leaderboard_entry_player_following_count.restype = c_bool
308
+ _lib.sb_leaderboard_entry_player_following_count.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_int)]
309
+ _lib.sb_leaderboard_entry_player_last_login.restype = c_bool
310
+ _lib.sb_leaderboard_entry_player_last_login.argtypes = [sb_leaderboard_t, c_size_t, POINTER(c_char_p)]
311
+
312
+ # void sb_request_pair_code(sb_game_handle_t, sb_string_callback_t, void*)
313
+ _lib.sb_request_pair_code.restype = None
314
+ _lib.sb_request_pair_code.argtypes = [sb_game_handle_t, sb_string_callback_t, c_void_p]
315
+
316
+ # void sb_request_unpair(sb_game_handle_t, sb_string_callback_t, void*)
317
+ _lib.sb_request_unpair.restype = None
318
+ _lib.sb_request_unpair.argtypes = [sb_game_handle_t, sb_string_callback_t, c_void_p]
319
+
320
+ # void sb_set_capabilities(sb_game_handle_t, sb_capabilities_t)
321
+ _lib.sb_set_capabilities.restype = None
322
+ _lib.sb_set_capabilities.argtypes = [sb_game_handle_t, c_uint32]
323
+
324
+ # void sb_set_credits_dropped(sb_game_handle_t, int, const char*, bool)
325
+ _lib.sb_set_credits_dropped.restype = None
326
+ _lib.sb_set_credits_dropped.argtypes = [sb_game_handle_t, c_int, c_char_p, c_bool]
327
+
328
+ # void sb_set_credits_status(sb_game_handle_t, bool, int, int, const char*)
329
+ _lib.sb_set_credits_status.restype = None
330
+ _lib.sb_set_credits_status.argtypes = [sb_game_handle_t, c_bool, c_int, c_int, c_char_p]
331
+
332
+ # void sb_game_request_pair_machine(sb_game_handle_t, const char*, const char*,
333
+ # sb_string_callback_t, void*)
334
+ _lib.sb_game_request_pair_machine.restype = None
335
+ _lib.sb_game_request_pair_machine.argtypes = [
336
+ sb_game_handle_t, c_char_p, c_char_p, sb_string_callback_t, c_void_p
337
+ ]
338
+
339
+ # void sb_download(sb_game_handle_t, const char*, const char*, const char*,
340
+ # sb_string_callback_t, void*)
341
+ _lib.sb_download.restype = None
342
+ _lib.sb_download.argtypes = [
343
+ sb_game_handle_t, c_char_p, c_char_p, c_char_p, sb_string_callback_t, c_void_p
344
+ ]
345
+
346
+ # void sb_download_buffer(sb_game_handle_t, const char*, size_t, const char*,
347
+ # sb_buffer_callback_t, void*)
348
+ _lib.sb_download_buffer.restype = None
349
+ _lib.sb_download_buffer.argtypes = [
350
+ sb_game_handle_t, c_char_p, c_size_t, c_char_p, sb_buffer_callback_t, c_void_p
351
+ ]
352
+
353
+ # ---------------------------------------------------------------------------
354
+ # event_helpers_c.h
355
+ # ---------------------------------------------------------------------------
356
+
357
+ # sb_event_type_t sb_event_type(const sb_event_t*)
358
+ _lib.sb_event_type.restype = c_int
359
+ _lib.sb_event_type.argtypes = [c_void_p]
360
+
361
+ # bool sb_event_game_start_requested(const sb_event_t*, int*)
362
+ _lib.sb_event_game_start_requested.restype = c_bool
363
+ _lib.sb_event_game_start_requested.argtypes = [c_void_p, POINTER(c_int)]
364
+
365
+ # bool sb_event_credits_add_requested(const sb_event_t*, int*, const char**)
366
+ _lib.sb_event_credits_add_requested.restype = c_bool
367
+ _lib.sb_event_credits_add_requested.argtypes = [c_void_p, POINTER(c_int), POINTER(c_char_p)]
368
+
369
+ # bool sb_event_players_updated(const sb_event_t*, int*)
370
+ _lib.sb_event_players_updated.restype = c_bool
371
+ _lib.sb_event_players_updated.argtypes = [c_void_p, POINTER(c_int)]
372
+
373
+ # bool sb_event_player_has_info(const sb_event_t*, sb_player_t, bool*)
374
+ _lib.sb_event_player_has_info.restype = c_bool
375
+ _lib.sb_event_player_has_info.argtypes = [c_void_p, c_uint, POINTER(c_bool)]
376
+
377
+ # bool sb_event_player_id(const sb_event_t*, sb_player_t, const char**)
378
+ _lib.sb_event_player_id.restype = c_bool
379
+ _lib.sb_event_player_id.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
380
+
381
+ # bool sb_event_player_preferred_name(const sb_event_t*, sb_player_t, const char**)
382
+ _lib.sb_event_player_preferred_name.restype = c_bool
383
+ _lib.sb_event_player_preferred_name.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
384
+
385
+ # bool sb_event_player_name(const sb_event_t*, sb_player_t, const char**)
386
+ _lib.sb_event_player_name.restype = c_bool
387
+ _lib.sb_event_player_name.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
388
+
389
+ # bool sb_event_player_initials(const sb_event_t*, sb_player_t, const char**)
390
+ _lib.sb_event_player_initials.restype = c_bool
391
+ _lib.sb_event_player_initials.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
392
+
393
+ # bool sb_event_player_picture_url(const sb_event_t*, sb_player_t, const char**)
394
+ _lib.sb_event_player_picture_url.restype = c_bool
395
+ _lib.sb_event_player_picture_url.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
396
+
397
+ # bool sb_event_player_claim_deeplink(const sb_event_t*, sb_player_t, const char**)
398
+ _lib.sb_event_player_claim_deeplink.restype = c_bool
399
+ _lib.sb_event_player_claim_deeplink.argtypes = [c_void_p, c_uint, POINTER(c_char_p)]
400
+
401
+ # bool sb_event_player_picture_ready(const sb_event_t*, sb_player_t*, const uint8_t**, size_t*)
402
+ _lib.sb_event_player_picture_ready.restype = c_bool
403
+ _lib.sb_event_player_picture_ready.argtypes = [
404
+ c_void_p, POINTER(c_uint), POINTER(POINTER(c_uint8)), POINTER(c_size_t)
405
+ ]
406
+
407
+ # bool sb_event_config_received(const sb_event_t*, const char**)
408
+ _lib.sb_event_config_received.restype = c_bool
409
+ _lib.sb_event_config_received.argtypes = [c_void_p, POINTER(c_char_p)]
410
+
411
+ # bool sb_event_scorbitd_update_received(const sb_event_t*, const char**)
412
+ _lib.sb_event_scorbitd_update_received.restype = c_bool
413
+ _lib.sb_event_scorbitd_update_received.argtypes = [c_void_p, POINTER(c_char_p)]
414
+
415
+ # bool sb_event_scorbitd_updated(const sb_event_t*, const char**, const char**)
416
+ _lib.sb_event_scorbitd_updated.restype = c_bool
417
+ _lib.sb_event_scorbitd_updated.argtypes = [c_void_p, POINTER(c_char_p), POINTER(c_char_p)]
418
+
419
+ # bool sb_event_firmwares_list_received(const sb_event_t*, const char**)
420
+ _lib.sb_event_firmwares_list_received.restype = c_bool
421
+ _lib.sb_event_firmwares_list_received.argtypes = [c_void_p, POINTER(c_char_p)]
422
+
423
+ # bool sb_event_diagnostics_upload_requested(const sb_event_t*, bool*)
424
+ _lib.sb_event_diagnostics_upload_requested.restype = c_bool
425
+ _lib.sb_event_diagnostics_upload_requested.argtypes = [c_void_p, POINTER(c_bool)]
426
+
427
+ # bool sb_event_diagnostics_uploaded(const sb_event_t*, bool*)
428
+ _lib.sb_event_diagnostics_uploaded.restype = c_bool
429
+ _lib.sb_event_diagnostics_uploaded.argtypes = [c_void_p, POINTER(c_bool)]
430
+
431
+ # -- Pricing event helpers --
432
+
433
+ # bool sb_event_pricing_free_play(const sb_event_t*, bool*)
434
+ _lib.sb_event_pricing_free_play.restype = c_bool
435
+ _lib.sb_event_pricing_free_play.argtypes = [c_void_p, POINTER(c_bool)]
436
+
437
+ # bool sb_event_pricing_payments_enabled(const sb_event_t*, bool*)
438
+ _lib.sb_event_pricing_payments_enabled.restype = c_bool
439
+ _lib.sb_event_pricing_payments_enabled.argtypes = [c_void_p, POINTER(c_bool)]
440
+
441
+ # bool sb_event_pricing_credit_price(const sb_event_t*, const char**)
442
+ _lib.sb_event_pricing_credit_price.restype = c_bool
443
+ _lib.sb_event_pricing_credit_price.argtypes = [c_void_p, POINTER(c_char_p)]
444
+
445
+ # bool sb_event_pricing_credit_regular_price(const sb_event_t*, const char**)
446
+ _lib.sb_event_pricing_credit_regular_price.restype = c_bool
447
+ _lib.sb_event_pricing_credit_regular_price.argtypes = [c_void_p, POINTER(c_char_p)]
448
+
449
+ # bool sb_event_pricing_credit_sale_price(const sb_event_t*, const char**)
450
+ _lib.sb_event_pricing_credit_sale_price.restype = c_bool
451
+ _lib.sb_event_pricing_credit_sale_price.argtypes = [c_void_p, POINTER(c_char_p)]
452
+
453
+ # bool sb_event_pricing_bundles_count(const sb_event_t*, int*)
454
+ _lib.sb_event_pricing_bundles_count.restype = c_bool
455
+ _lib.sb_event_pricing_bundles_count.argtypes = [c_void_p, POINTER(c_int)]
456
+
457
+ # bool sb_event_pricing_bundle_credits(const sb_event_t*, int, int*)
458
+ _lib.sb_event_pricing_bundle_credits.restype = c_bool
459
+ _lib.sb_event_pricing_bundle_credits.argtypes = [c_void_p, c_int, POINTER(c_int)]
460
+
461
+ # bool sb_event_pricing_bundle_price(const sb_event_t*, int, const char**)
462
+ _lib.sb_event_pricing_bundle_price.restype = c_bool
463
+ _lib.sb_event_pricing_bundle_price.argtypes = [c_void_p, c_int, POINTER(c_char_p)]
464
+
465
+ # bool sb_event_pricing_bundle_regular_price(const sb_event_t*, int, const char**)
466
+ _lib.sb_event_pricing_bundle_regular_price.restype = c_bool
467
+ _lib.sb_event_pricing_bundle_regular_price.argtypes = [c_void_p, c_int, POINTER(c_char_p)]
468
+
469
+ # bool sb_event_pricing_bundle_sale_price(const sb_event_t*, int, const char**)
470
+ _lib.sb_event_pricing_bundle_sale_price.restype = c_bool
471
+ _lib.sb_event_pricing_bundle_sale_price.argtypes = [c_void_p, c_int, POINTER(c_char_p)]
472
+
473
+ # bool sb_event_pairing_status_changed(const sb_event_t*, bool*)
474
+ _lib.sb_event_pairing_status_changed.restype = c_bool
475
+ _lib.sb_event_pairing_status_changed.argtypes = [c_void_p, POINTER(c_bool)]
476
+
477
+ # void sb_upload_diagnostics(sb_game_handle_t, const char**, size_t,
478
+ # const char**, size_t, const char*)
479
+ _lib.sb_upload_diagnostics.restype = None
480
+ _lib.sb_upload_diagnostics.argtypes = [
481
+ sb_game_handle_t, POINTER(c_char_p), c_size_t,
482
+ POINTER(c_char_p), c_size_t, c_char_p
483
+ ]
484
+
485
+ # ---------------------------------------------------------------------------
486
+ # log_c.h (sb_add_logger_callback / sb_reset_logger; no-ops when SDK uses spdlog)
487
+ # ---------------------------------------------------------------------------
488
+
489
+ _has_logger = False
490
+ if hasattr(_lib, "sb_add_logger_callback"):
491
+ if hasattr(_lib, "sb_logger_callbacks_supported"):
492
+ _lib.sb_logger_callbacks_supported.restype = c_bool
493
+ _lib.sb_logger_callbacks_supported.argtypes = []
494
+ _has_logger = bool(_lib.sb_logger_callbacks_supported())
495
+ else:
496
+ # Older SDKs: symbol exists but we cannot tell spdlog stub vs callback at runtime.
497
+ _has_logger = True
498
+
499
+ if _has_logger:
500
+ # void sb_add_logger_callback(sb_log_callback_t, void*, size_t)
501
+ _lib.sb_add_logger_callback.restype = None
502
+ _lib.sb_add_logger_callback.argtypes = [sb_log_callback_t, c_void_p, c_size_t]
503
+
504
+ # void sb_reset_logger(void)
505
+ _lib.sb_reset_logger.restype = None
506
+ _lib.sb_reset_logger.argtypes = []