mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-09-30 22:14:55 -07:00
sdk: get/set coin blocker (#918)
This commit is contained in:
@@ -248,6 +248,27 @@ typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_insert_coin_func)(
|
|||||||
uint8_t amount
|
uint8_t amount
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// get_coin_blocker (v0.6 and up)
|
||||||
|
// gets the current shared coin blocker state
|
||||||
|
// insert_coin bypasses the blocker regardless of this state
|
||||||
|
//
|
||||||
|
// blocked: receives true when coins are blocked, false when allowed
|
||||||
|
|
||||||
|
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_coin_blocker_func)(
|
||||||
|
bool *blocked
|
||||||
|
);
|
||||||
|
|
||||||
|
// set_coin_blocker (v0.6 and up)
|
||||||
|
// sets the shared coin blocker state used by normal coin input
|
||||||
|
// this is not a persistent override; the game can change the state again
|
||||||
|
// insert_coin bypasses the blocker regardless of this state
|
||||||
|
//
|
||||||
|
// blocked: true to block coins, false to allow them
|
||||||
|
|
||||||
|
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_coin_blocker_func)(
|
||||||
|
bool blocked
|
||||||
|
);
|
||||||
|
|
||||||
typedef struct SPICE_SDK_MODULE_INFO {
|
typedef struct SPICE_SDK_MODULE_INFO {
|
||||||
uint32_t size; // initialize to sizeof(SPICE_SDK_MODULE_INFO)
|
uint32_t size; // initialize to sizeof(SPICE_SDK_MODULE_INFO)
|
||||||
uintptr_t base; // loaded address, not the preferred PE image base
|
uintptr_t base; // loaded address, not the preferred PE image base
|
||||||
@@ -383,6 +404,9 @@ typedef struct SPICE_SDK_V0 {
|
|||||||
|
|
||||||
spice_sdk_hook_library_func *hook_library;
|
spice_sdk_hook_library_func *hook_library;
|
||||||
|
|
||||||
|
spice_sdk_get_coin_blocker_func *get_coin_blocker;
|
||||||
|
spice_sdk_set_coin_blocker_func *set_coin_blocker;
|
||||||
|
|
||||||
} SPICE_SDK_V0;
|
} SPICE_SDK_V0;
|
||||||
|
|
||||||
typedef void (__cdecl spice_sdk_destroy_callback_func)(
|
typedef void (__cdecl spice_sdk_destroy_callback_func)(
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ static spice_sdk_insert_card_func sdk_insert_card;
|
|||||||
static spice_sdk_set_keypad_func sdk_set_keypad;
|
static spice_sdk_set_keypad_func sdk_set_keypad;
|
||||||
static spice_sdk_add_toast_func sdk_add_toast;
|
static spice_sdk_add_toast_func sdk_add_toast;
|
||||||
static spice_sdk_insert_coin_func sdk_insert_coin;
|
static spice_sdk_insert_coin_func sdk_insert_coin;
|
||||||
|
static spice_sdk_get_coin_blocker_func sdk_get_coin_blocker;
|
||||||
|
static spice_sdk_set_coin_blocker_func sdk_set_coin_blocker;
|
||||||
static spice_sdk_get_module_info_func sdk_get_module_info;
|
static spice_sdk_get_module_info_func sdk_get_module_info;
|
||||||
static spice_sdk_get_plugin_directory_func sdk_get_plugin_directory;
|
static spice_sdk_get_plugin_directory_func sdk_get_plugin_directory;
|
||||||
static spice_sdk_register_d3d9_func sdk_register_d3d9;
|
static spice_sdk_register_d3d9_func sdk_register_d3d9;
|
||||||
@@ -211,6 +213,14 @@ sdk_init(
|
|||||||
}
|
}
|
||||||
// end of 0.5
|
// end of 0.5
|
||||||
|
|
||||||
|
if (v0->size >= RTL_SIZEOF_THROUGH_FIELD(SPICE_SDK_V0, get_coin_blocker)) {
|
||||||
|
v0->get_coin_blocker = sdk_get_coin_blocker;
|
||||||
|
}
|
||||||
|
if (v0->size >= RTL_SIZEOF_THROUGH_FIELD(SPICE_SDK_V0, set_coin_blocker)) {
|
||||||
|
v0->set_coin_blocker = sdk_set_coin_blocker;
|
||||||
|
}
|
||||||
|
// end of 0.6
|
||||||
|
|
||||||
// any newer minor iterations will need to check the size
|
// any newer minor iterations will need to check the size
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -746,4 +756,37 @@ sdk_insert_coin(
|
|||||||
return SPICE_SDK_STATUS_SUCCESS;
|
return SPICE_SDK_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPICE_SDK_STATUS_CODE
|
||||||
|
__cdecl
|
||||||
|
sdk_get_coin_blocker(
|
||||||
|
bool *blocked
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::shared_lock lock(sdk_global_mutex);
|
||||||
|
if (!sdk_initialized) {
|
||||||
|
return SPICE_SDK_STATUS_TOO_LATE;
|
||||||
|
}
|
||||||
|
if (!blocked) {
|
||||||
|
return SPICE_SDK_STATUS_INVALID_ARGUMENT_1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*blocked = eamuse_coin_get_block();
|
||||||
|
return SPICE_SDK_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPICE_SDK_STATUS_CODE
|
||||||
|
__cdecl
|
||||||
|
sdk_set_coin_blocker(
|
||||||
|
bool blocked
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::shared_lock lock(sdk_global_mutex);
|
||||||
|
if (!sdk_initialized) {
|
||||||
|
return SPICE_SDK_STATUS_TOO_LATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
eamuse_coin_set_block(blocked);
|
||||||
|
return SPICE_SDK_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sdk
|
} // namespace sdk
|
||||||
Reference in New Issue
Block a user