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