mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-10-09 19:38:57 -07:00
fix line endings
This commit is contained in:
+293
-293
@@ -1,293 +1,293 @@
|
||||
#pragma once
|
||||
#ifndef SPICE_SDK_H
|
||||
#define SPICE_SDK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define SPICE_SDK_ENTRY_POINT extern "C" __declspec(dllexport) int __cdecl
|
||||
#else
|
||||
#define SPICE_SDK_ENTRY_POINT __declspec(dllexport) int __cdecl
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum SPICE_SDK_STATUS_CODE {
|
||||
SPICE_SDK_STATUS_SUCCESS = 0,
|
||||
|
||||
// 000: generic
|
||||
SPICE_SDK_STATUS_GENERIC_ERROR = 1,
|
||||
SPICE_SDK_STATUS_NOT_INITIALIZED = 2,
|
||||
SPICE_SDK_STATUS_NOT_SUPPORTED = 3,
|
||||
SPICE_SDK_STATUS_TOO_SMALL = 4,
|
||||
SPICE_SDK_STATUS_TOO_LATE = 5,
|
||||
|
||||
// 1000: invalid args
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_1 = 1001,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_2 = 1002,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_3 = 1003,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_4 = 1004,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_5 = 1005,
|
||||
|
||||
} SPICE_SDK_STATUS_CODE;
|
||||
|
||||
typedef enum SPICE_SDK_LOG_LEVEL {
|
||||
SPICE_SDK_LOG_LEVEL_MISC = 0,
|
||||
SPICE_SDK_LOG_LEVEL_INFO = 1,
|
||||
SPICE_SDK_LOG_LEVEL_WARNING = 2,
|
||||
SPICE_SDK_LOG_LEVEL_FATAL = 3,
|
||||
} SPICE_SDK_LOG_LEVEL;
|
||||
|
||||
typedef enum SPICE_SDK_TOAST_SEVERITY {
|
||||
SPICE_SDK_TOAST_LEVEL_INFO = 0,
|
||||
SPICE_SDK_TOAST_LEVEL_SUCCESS = 1,
|
||||
SPICE_SDK_TOAST_LEVEL_WARNING = 2,
|
||||
SPICE_SDK_TOAST_LEVEL_ERROR = 3,
|
||||
} SPICE_SDK_TOAST_SEVERITY;
|
||||
|
||||
typedef struct SPICE_SDK_TOUCH_POINT {
|
||||
uint32_t id;
|
||||
int x;
|
||||
int y;
|
||||
} SPICE_SDK_TOUCH_POINT;
|
||||
|
||||
typedef struct SPICE_SDK_GAME_INFO {
|
||||
char name[64]; // null-terminated
|
||||
} SPICE_SDK_GAME_INFO;
|
||||
|
||||
typedef struct SPICE_SDK_AVS_INFO {
|
||||
char model[4]; // "MDX", null-terminated
|
||||
char dest; // J
|
||||
char spec; // A
|
||||
char rev; // A
|
||||
char ext[11]; // "2025061002", null-terminated
|
||||
} SPICE_SDK_AVS_INFO;
|
||||
|
||||
// get_game_info (v0.1 and up)
|
||||
//
|
||||
// get info about the currently running game
|
||||
//
|
||||
// info: receives game info
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_game_info_func)(
|
||||
SPICE_SDK_GAME_INFO *info
|
||||
);
|
||||
|
||||
// get_avs_info (v0.1 and up)
|
||||
//
|
||||
// get AVS info (model, dest, spec, rev, ext)
|
||||
//
|
||||
// info: receives AVS info
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_avs_info_func)(
|
||||
SPICE_SDK_AVS_INFO *info
|
||||
);
|
||||
|
||||
// log (v0.1 and up)
|
||||
// logs a message to the log
|
||||
// writing a FATAL message will terminate spice, only use in catastrophic failure
|
||||
//
|
||||
// level: see log level enum
|
||||
// module: short string that identifies the facility / module / submodule
|
||||
// message: the message to log
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_log_func)(
|
||||
SPICE_SDK_LOG_LEVEL level,
|
||||
const char *module,
|
||||
const char *message
|
||||
);
|
||||
|
||||
// get_button (v0.1 and up)
|
||||
// gets the button state
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// pressed: (optional) is the button pressed?
|
||||
// velocity: (optional) MIDI velocity of the button
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_button_func)(
|
||||
uint32_t button_id,
|
||||
bool *pressed,
|
||||
float *velocity
|
||||
);
|
||||
|
||||
// set_button (v0.1 and up)
|
||||
// sets or clears the button override
|
||||
//
|
||||
// make sure to hold the button long enough for the game's I/O engine to pick up
|
||||
// usually, one or two frames
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// pressed: true to set the button override (permanently set the button to be ON until cleared),
|
||||
// false to clear the override (allow user's controller to provide input again)
|
||||
// velocity: MIDI velocity of the button; only valid when pressed is true
|
||||
// can be between 0.0 and 1.0, inclusive
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_button_func)(
|
||||
uint32_t button_id,
|
||||
bool pressed,
|
||||
float velocity
|
||||
);
|
||||
|
||||
// get_analog (v0.1 and up)
|
||||
// gets the analog state
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// value: receives the state of the analog
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_analog_func)(
|
||||
uint32_t analog_id,
|
||||
float *value
|
||||
);
|
||||
|
||||
// set_analog (v0.1 and up)
|
||||
// sets or clears the analog override
|
||||
//
|
||||
// analog_id: ID of the analog; see spicesdk_io.h for named values
|
||||
// override_active: true to set override (gain exclusive control)
|
||||
// false to clear it (allow user's controller provide input again)
|
||||
// value: value of the analog; only valid when override_active is true
|
||||
// can be between 0.0 and 1.0, inclusive
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_analog_func)(
|
||||
uint32_t analog_id,
|
||||
bool override_active,
|
||||
float value
|
||||
);
|
||||
|
||||
// get_light (v0.1 and up)
|
||||
// gets the last observed value of a light
|
||||
//
|
||||
// light_id: ID of the light; see spicesdk_io.h for named values
|
||||
// value: output parameter for the light value; 0.0 to 1.0
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_light_func)(
|
||||
uint32_t light_id,
|
||||
float *value
|
||||
);
|
||||
|
||||
// set_light (v0.1 and up)
|
||||
// sets or clears the light override
|
||||
//
|
||||
// light_id: ID of the light; see spicesdk_io.h for named values
|
||||
// light_value: output parameter for the light value; 0.0 to 1.0
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_light_func)(
|
||||
uint32_t light_id,
|
||||
bool override_active,
|
||||
float light_value
|
||||
);
|
||||
|
||||
// set_touch (v0.1 and up)
|
||||
// adds or updates touch points
|
||||
//
|
||||
// points: array of touch points to add or update
|
||||
// count: number of touch points in the array
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_touch_func)(
|
||||
const SPICE_SDK_TOUCH_POINT *points,
|
||||
uint32_t count
|
||||
);
|
||||
|
||||
// clear_touch (v0.1 and up)
|
||||
// clears touch points (i.e., no longer being touched)
|
||||
//
|
||||
// ids: array of touch point IDs to clear
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_clear_touch_func)(
|
||||
const uint32_t *ids,
|
||||
uint32_t count
|
||||
);
|
||||
|
||||
// insert_card (v0.1 and up)
|
||||
// simulates inserting an e-amuse card with the given ID
|
||||
//
|
||||
// unit: 0 for player 1, 1 for player 2
|
||||
// card_id: null-terminated string of the card ID
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_insert_card_func)(
|
||||
uint8_t unit,
|
||||
const char *card_id
|
||||
);
|
||||
|
||||
// set_keypad (v0.1 and up)
|
||||
// sets keypad state
|
||||
//
|
||||
// make sure to hold the button long enough for the game to pick up
|
||||
// 70ms is usually sufficient, except for DDR which needs 150ms
|
||||
//
|
||||
// unit: 0 for player 1, 1 for player 2
|
||||
// key: '0' to '9' for numbers, 'A' for 00, 'D' for decimal point, 0 or '\0' to release all keys
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_keypad_func)(
|
||||
uint8_t unit,
|
||||
char key
|
||||
);
|
||||
|
||||
// add_toast (v0.2 and up)
|
||||
// adds an overlay toast notification
|
||||
//
|
||||
// severity: see SPICE_SDK_TOAST_SEVERITY; controls the accent color (purely cosmetic)
|
||||
// text: null-terminated UTF-8 message to display; wraps inside the toast
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_add_toast_func)(
|
||||
SPICE_SDK_TOAST_SEVERITY severity,
|
||||
const char *text
|
||||
);
|
||||
|
||||
typedef struct SPICE_SDK_V0 {
|
||||
uint32_t size;
|
||||
|
||||
spice_sdk_log_func *log;
|
||||
|
||||
spice_sdk_get_game_info_func *get_game_info;
|
||||
spice_sdk_get_avs_info_func *get_avs_info;
|
||||
|
||||
spice_sdk_get_button_func *get_button;
|
||||
spice_sdk_set_button_func *set_button;
|
||||
|
||||
spice_sdk_get_analog_func *get_analog;
|
||||
spice_sdk_set_analog_func *set_analog;
|
||||
|
||||
spice_sdk_get_light_func *get_light;
|
||||
spice_sdk_set_light_func *set_light;
|
||||
|
||||
spice_sdk_set_touch_func *set_touch;
|
||||
spice_sdk_clear_touch_func *clear_touch;
|
||||
|
||||
spice_sdk_insert_card_func *insert_card;
|
||||
spice_sdk_set_keypad_func *set_keypad;
|
||||
|
||||
spice_sdk_add_toast_func *add_toast;
|
||||
|
||||
} SPICE_SDK_V0;
|
||||
|
||||
typedef void (__cdecl spice_sdk_destroy_callback_func)(
|
||||
void
|
||||
);
|
||||
|
||||
// init (v0.1 and up)
|
||||
//
|
||||
// version: supply 0
|
||||
// destroy_callback: supply a function pointer that will be called when spice
|
||||
// is shutting down
|
||||
// sdk_functions: supply a pointer to SPICE_SDK_V0; ensure size field is initialized
|
||||
// to sizeof(SPICE_SDK_V0) before calling this function
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_init_func)(
|
||||
uint32_t version,
|
||||
spice_sdk_destroy_callback_func *destroy_callback,
|
||||
void *sdk_functions
|
||||
);
|
||||
|
||||
typedef int (__cdecl spice_sdk_entry_point_func)(
|
||||
spice_sdk_init_func *init
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // SPICE_SDK_H
|
||||
#pragma once
|
||||
#ifndef SPICE_SDK_H
|
||||
#define SPICE_SDK_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define SPICE_SDK_ENTRY_POINT extern "C" __declspec(dllexport) int __cdecl
|
||||
#else
|
||||
#define SPICE_SDK_ENTRY_POINT __declspec(dllexport) int __cdecl
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum SPICE_SDK_STATUS_CODE {
|
||||
SPICE_SDK_STATUS_SUCCESS = 0,
|
||||
|
||||
// 000: generic
|
||||
SPICE_SDK_STATUS_GENERIC_ERROR = 1,
|
||||
SPICE_SDK_STATUS_NOT_INITIALIZED = 2,
|
||||
SPICE_SDK_STATUS_NOT_SUPPORTED = 3,
|
||||
SPICE_SDK_STATUS_TOO_SMALL = 4,
|
||||
SPICE_SDK_STATUS_TOO_LATE = 5,
|
||||
|
||||
// 1000: invalid args
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_1 = 1001,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_2 = 1002,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_3 = 1003,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_4 = 1004,
|
||||
SPICE_SDK_STATUS_INVALID_ARGUMENT_5 = 1005,
|
||||
|
||||
} SPICE_SDK_STATUS_CODE;
|
||||
|
||||
typedef enum SPICE_SDK_LOG_LEVEL {
|
||||
SPICE_SDK_LOG_LEVEL_MISC = 0,
|
||||
SPICE_SDK_LOG_LEVEL_INFO = 1,
|
||||
SPICE_SDK_LOG_LEVEL_WARNING = 2,
|
||||
SPICE_SDK_LOG_LEVEL_FATAL = 3,
|
||||
} SPICE_SDK_LOG_LEVEL;
|
||||
|
||||
typedef enum SPICE_SDK_TOAST_SEVERITY {
|
||||
SPICE_SDK_TOAST_LEVEL_INFO = 0,
|
||||
SPICE_SDK_TOAST_LEVEL_SUCCESS = 1,
|
||||
SPICE_SDK_TOAST_LEVEL_WARNING = 2,
|
||||
SPICE_SDK_TOAST_LEVEL_ERROR = 3,
|
||||
} SPICE_SDK_TOAST_SEVERITY;
|
||||
|
||||
typedef struct SPICE_SDK_TOUCH_POINT {
|
||||
uint32_t id;
|
||||
int x;
|
||||
int y;
|
||||
} SPICE_SDK_TOUCH_POINT;
|
||||
|
||||
typedef struct SPICE_SDK_GAME_INFO {
|
||||
char name[64]; // null-terminated
|
||||
} SPICE_SDK_GAME_INFO;
|
||||
|
||||
typedef struct SPICE_SDK_AVS_INFO {
|
||||
char model[4]; // "MDX", null-terminated
|
||||
char dest; // J
|
||||
char spec; // A
|
||||
char rev; // A
|
||||
char ext[11]; // "2025061002", null-terminated
|
||||
} SPICE_SDK_AVS_INFO;
|
||||
|
||||
// get_game_info (v0.1 and up)
|
||||
//
|
||||
// get info about the currently running game
|
||||
//
|
||||
// info: receives game info
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_game_info_func)(
|
||||
SPICE_SDK_GAME_INFO *info
|
||||
);
|
||||
|
||||
// get_avs_info (v0.1 and up)
|
||||
//
|
||||
// get AVS info (model, dest, spec, rev, ext)
|
||||
//
|
||||
// info: receives AVS info
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_avs_info_func)(
|
||||
SPICE_SDK_AVS_INFO *info
|
||||
);
|
||||
|
||||
// log (v0.1 and up)
|
||||
// logs a message to the log
|
||||
// writing a FATAL message will terminate spice, only use in catastrophic failure
|
||||
//
|
||||
// level: see log level enum
|
||||
// module: short string that identifies the facility / module / submodule
|
||||
// message: the message to log
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_log_func)(
|
||||
SPICE_SDK_LOG_LEVEL level,
|
||||
const char *module,
|
||||
const char *message
|
||||
);
|
||||
|
||||
// get_button (v0.1 and up)
|
||||
// gets the button state
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// pressed: (optional) is the button pressed?
|
||||
// velocity: (optional) MIDI velocity of the button
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_button_func)(
|
||||
uint32_t button_id,
|
||||
bool *pressed,
|
||||
float *velocity
|
||||
);
|
||||
|
||||
// set_button (v0.1 and up)
|
||||
// sets or clears the button override
|
||||
//
|
||||
// make sure to hold the button long enough for the game's I/O engine to pick up
|
||||
// usually, one or two frames
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// pressed: true to set the button override (permanently set the button to be ON until cleared),
|
||||
// false to clear the override (allow user's controller to provide input again)
|
||||
// velocity: MIDI velocity of the button; only valid when pressed is true
|
||||
// can be between 0.0 and 1.0, inclusive
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_button_func)(
|
||||
uint32_t button_id,
|
||||
bool pressed,
|
||||
float velocity
|
||||
);
|
||||
|
||||
// get_analog (v0.1 and up)
|
||||
// gets the analog state
|
||||
//
|
||||
// button_id: ID of the button; see spicesdk_io.h for named values
|
||||
// value: receives the state of the analog
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_analog_func)(
|
||||
uint32_t analog_id,
|
||||
float *value
|
||||
);
|
||||
|
||||
// set_analog (v0.1 and up)
|
||||
// sets or clears the analog override
|
||||
//
|
||||
// analog_id: ID of the analog; see spicesdk_io.h for named values
|
||||
// override_active: true to set override (gain exclusive control)
|
||||
// false to clear it (allow user's controller provide input again)
|
||||
// value: value of the analog; only valid when override_active is true
|
||||
// can be between 0.0 and 1.0, inclusive
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_analog_func)(
|
||||
uint32_t analog_id,
|
||||
bool override_active,
|
||||
float value
|
||||
);
|
||||
|
||||
// get_light (v0.1 and up)
|
||||
// gets the last observed value of a light
|
||||
//
|
||||
// light_id: ID of the light; see spicesdk_io.h for named values
|
||||
// value: output parameter for the light value; 0.0 to 1.0
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_get_light_func)(
|
||||
uint32_t light_id,
|
||||
float *value
|
||||
);
|
||||
|
||||
// set_light (v0.1 and up)
|
||||
// sets or clears the light override
|
||||
//
|
||||
// light_id: ID of the light; see spicesdk_io.h for named values
|
||||
// light_value: output parameter for the light value; 0.0 to 1.0
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_light_func)(
|
||||
uint32_t light_id,
|
||||
bool override_active,
|
||||
float light_value
|
||||
);
|
||||
|
||||
// set_touch (v0.1 and up)
|
||||
// adds or updates touch points
|
||||
//
|
||||
// points: array of touch points to add or update
|
||||
// count: number of touch points in the array
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_touch_func)(
|
||||
const SPICE_SDK_TOUCH_POINT *points,
|
||||
uint32_t count
|
||||
);
|
||||
|
||||
// clear_touch (v0.1 and up)
|
||||
// clears touch points (i.e., no longer being touched)
|
||||
//
|
||||
// ids: array of touch point IDs to clear
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_clear_touch_func)(
|
||||
const uint32_t *ids,
|
||||
uint32_t count
|
||||
);
|
||||
|
||||
// insert_card (v0.1 and up)
|
||||
// simulates inserting an e-amuse card with the given ID
|
||||
//
|
||||
// unit: 0 for player 1, 1 for player 2
|
||||
// card_id: null-terminated string of the card ID
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_insert_card_func)(
|
||||
uint8_t unit,
|
||||
const char *card_id
|
||||
);
|
||||
|
||||
// set_keypad (v0.1 and up)
|
||||
// sets keypad state
|
||||
//
|
||||
// make sure to hold the button long enough for the game to pick up
|
||||
// 70ms is usually sufficient, except for DDR which needs 150ms
|
||||
//
|
||||
// unit: 0 for player 1, 1 for player 2
|
||||
// key: '0' to '9' for numbers, 'A' for 00, 'D' for decimal point, 0 or '\0' to release all keys
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_set_keypad_func)(
|
||||
uint8_t unit,
|
||||
char key
|
||||
);
|
||||
|
||||
// add_toast (v0.2 and up)
|
||||
// adds an overlay toast notification
|
||||
//
|
||||
// severity: see SPICE_SDK_TOAST_SEVERITY; controls the accent color (purely cosmetic)
|
||||
// text: null-terminated UTF-8 message to display; wraps inside the toast
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_add_toast_func)(
|
||||
SPICE_SDK_TOAST_SEVERITY severity,
|
||||
const char *text
|
||||
);
|
||||
|
||||
typedef struct SPICE_SDK_V0 {
|
||||
uint32_t size;
|
||||
|
||||
spice_sdk_log_func *log;
|
||||
|
||||
spice_sdk_get_game_info_func *get_game_info;
|
||||
spice_sdk_get_avs_info_func *get_avs_info;
|
||||
|
||||
spice_sdk_get_button_func *get_button;
|
||||
spice_sdk_set_button_func *set_button;
|
||||
|
||||
spice_sdk_get_analog_func *get_analog;
|
||||
spice_sdk_set_analog_func *set_analog;
|
||||
|
||||
spice_sdk_get_light_func *get_light;
|
||||
spice_sdk_set_light_func *set_light;
|
||||
|
||||
spice_sdk_set_touch_func *set_touch;
|
||||
spice_sdk_clear_touch_func *clear_touch;
|
||||
|
||||
spice_sdk_insert_card_func *insert_card;
|
||||
spice_sdk_set_keypad_func *set_keypad;
|
||||
|
||||
spice_sdk_add_toast_func *add_toast;
|
||||
|
||||
} SPICE_SDK_V0;
|
||||
|
||||
typedef void (__cdecl spice_sdk_destroy_callback_func)(
|
||||
void
|
||||
);
|
||||
|
||||
// init (v0.1 and up)
|
||||
//
|
||||
// version: supply 0
|
||||
// destroy_callback: supply a function pointer that will be called when spice
|
||||
// is shutting down
|
||||
// sdk_functions: supply a pointer to SPICE_SDK_V0; ensure size field is initialized
|
||||
// to sizeof(SPICE_SDK_V0) before calling this function
|
||||
|
||||
typedef SPICE_SDK_STATUS_CODE (__cdecl spice_sdk_init_func)(
|
||||
uint32_t version,
|
||||
spice_sdk_destroy_callback_func *destroy_callback,
|
||||
void *sdk_functions
|
||||
);
|
||||
|
||||
typedef int (__cdecl spice_sdk_entry_point_func)(
|
||||
spice_sdk_init_func *init
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // SPICE_SDK_H
|
||||
|
||||
+1870
-1870
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
LIBRARY sdk_sample_v0_cpp
|
||||
|
||||
EXPORTS
|
||||
LIBRARY sdk_sample_v0_cpp
|
||||
|
||||
EXPORTS
|
||||
spice_sdk_entry_point
|
||||
@@ -1,318 +1,318 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
#include "sdk/include/spicesdk.h"
|
||||
#include "sdk/include/spicesdk_io.h"
|
||||
|
||||
static SPICE_SDK_V0 spice;
|
||||
|
||||
static spice_sdk_destroy_callback_func destroy_callback;
|
||||
|
||||
static void test_logging();
|
||||
static void test_game_info();
|
||||
static void test_avs_info();
|
||||
|
||||
static void get_buttons();
|
||||
static void set_buttons();
|
||||
static void clear_buttons();
|
||||
|
||||
static void get_analogs();
|
||||
static void set_analogs();
|
||||
static void clear_analogs();
|
||||
|
||||
static void get_lights();
|
||||
static void set_lights();
|
||||
static void clear_lights();
|
||||
|
||||
static void set_touch();
|
||||
static void clear_touch();
|
||||
static void insert_card();
|
||||
static void set_keypad();
|
||||
static void clear_keypad();
|
||||
|
||||
static HANDLE worker_stop_event;
|
||||
static HANDLE worker_handle;
|
||||
static unsigned __stdcall worker_thread(void *arg);
|
||||
|
||||
// this sample assumes that the game is IIDX, but it doesn't check for it.
|
||||
|
||||
SPICE_SDK_ENTRY_POINT
|
||||
spice_sdk_entry_point(
|
||||
spice_sdk_init_func *init
|
||||
)
|
||||
{
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
memset(&spice, 0, sizeof(spice));
|
||||
spice.size = sizeof(spice);
|
||||
status = init(0, destroy_callback, &spice);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "plugin loaded");
|
||||
test_logging();
|
||||
test_game_info();
|
||||
test_avs_info();
|
||||
|
||||
worker_stop_event = CreateEventA(NULL, TRUE, FALSE, NULL);
|
||||
if (!worker_stop_event) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "failed to create worker stop event");
|
||||
return 0;
|
||||
}
|
||||
|
||||
worker_handle = (HANDLE)_beginthreadex(
|
||||
NULL, // security
|
||||
0, // stack size
|
||||
worker_thread, // function
|
||||
NULL, // argument
|
||||
0, // flags
|
||||
NULL // thread id
|
||||
);
|
||||
if (!worker_handle) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "failed to create worker thread");
|
||||
CloseHandle(worker_stop_event);
|
||||
worker_stop_event = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
__cdecl
|
||||
destroy_callback(
|
||||
void
|
||||
)
|
||||
{
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "plugin unloaded");
|
||||
if (worker_stop_event) {
|
||||
SetEvent(worker_stop_event);
|
||||
}
|
||||
if (worker_handle) {
|
||||
WaitForSingleObject(worker_handle, INFINITE);
|
||||
CloseHandle(worker_handle);
|
||||
worker_handle = NULL;
|
||||
}
|
||||
if (worker_stop_event) {
|
||||
CloseHandle(worker_stop_event);
|
||||
worker_stop_event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned __stdcall worker_thread(void *arg) {
|
||||
int phase = 0;
|
||||
while (WaitForSingleObject(worker_stop_event, 0) == WAIT_TIMEOUT) {
|
||||
phase += 1;
|
||||
switch (phase) {
|
||||
case 1:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get buttons...");
|
||||
get_buttons();
|
||||
break;
|
||||
case 2:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set buttons...");
|
||||
set_buttons();
|
||||
break;
|
||||
case 3:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear buttons...");
|
||||
clear_buttons();
|
||||
break;
|
||||
case 4:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get analogs...");
|
||||
get_analogs();
|
||||
break;
|
||||
case 5:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set analogs...");
|
||||
set_analogs();
|
||||
break;
|
||||
case 6:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear analogs...");
|
||||
clear_analogs();
|
||||
break;
|
||||
case 7:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get lights...");
|
||||
get_lights();
|
||||
break;
|
||||
case 8:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set lights...");
|
||||
set_lights();
|
||||
break;
|
||||
case 9:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear lights...");
|
||||
clear_lights();
|
||||
break;
|
||||
case 10:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "set touch...");
|
||||
set_touch();
|
||||
break;
|
||||
case 11:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear touch...");
|
||||
clear_touch();
|
||||
break;
|
||||
case 12:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_SUCCESS, "insert card...");
|
||||
insert_card();
|
||||
break;
|
||||
case 13:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_SUCCESS, "set keypad...");
|
||||
set_keypad();
|
||||
break;
|
||||
case 14:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear keypad...");
|
||||
clear_keypad();
|
||||
break;
|
||||
default:
|
||||
phase = 0;
|
||||
break;
|
||||
}
|
||||
if (phase != 0) {
|
||||
WaitForSingleObject(worker_stop_event, 3000);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_logging() {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_MISC, "sample_v0", "this is a misc message");
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "this is an info message");
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "this is a warning message");
|
||||
}
|
||||
|
||||
static void test_game_info() {
|
||||
SPICE_SDK_GAME_INFO info;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_game_info(&info);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_game_info failed");
|
||||
return;
|
||||
}
|
||||
char log_message[128];
|
||||
snprintf(log_message, sizeof(log_message), "game info - name: %s", info.name);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void test_avs_info() {
|
||||
SPICE_SDK_AVS_INFO info;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_avs_info(&info);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_avs_info failed");
|
||||
return;
|
||||
}
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"avs - model: %s, dest: %c, spec: %c, rev: %c, ext: %s",
|
||||
info.model, info.dest, info.spec, info.rev, info.ext);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void get_buttons() {
|
||||
bool pressed;
|
||||
float velocity;
|
||||
spice.get_button(IIDX_Button_P1_Headphone, &pressed, &velocity);
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"button P1_Headphone pressed: %s, velocity: %.2f",
|
||||
pressed ? "ON" : "off", velocity);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void set_buttons() {
|
||||
spice.set_button(IIDX_Button_P1_1, true, 0.3f);
|
||||
spice.set_button(IIDX_Button_P1_3, true, 0.5f);
|
||||
spice.set_button(IIDX_Button_P1_5, true, 0.7f);
|
||||
}
|
||||
|
||||
static void clear_buttons() {
|
||||
spice.set_button(IIDX_Button_P1_1, false, 0.f);
|
||||
spice.set_button(IIDX_Button_P1_3, false, 0.f);
|
||||
spice.set_button(IIDX_Button_P1_5, false, 0.f);
|
||||
}
|
||||
|
||||
static void get_analogs() {
|
||||
float value;
|
||||
spice.get_analog(IIDX_Analog_TT_P1, &value);
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"analog TT_P1: %.2f",
|
||||
value);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void set_analogs() {
|
||||
spice.set_analog(IIDX_Analog_TT_P1, true, 0.25f);
|
||||
spice.set_analog(IIDX_Analog_TT_P2, true, 0.75f);
|
||||
}
|
||||
|
||||
static void clear_analogs() {
|
||||
spice.set_analog(IIDX_Analog_TT_P1, false, 0.f);
|
||||
spice.set_analog(IIDX_Analog_TT_P2, false, 0.f);
|
||||
}
|
||||
|
||||
static void get_lights() {
|
||||
float value;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_light(IIDX_Light_TT_P1_Resistance, &value);
|
||||
if (status == SPICE_SDK_STATUS_SUCCESS) {
|
||||
char log_message[64];
|
||||
snprintf(log_message, sizeof(log_message), "P1 TT resistance value: %.2f", value);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
} else {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_light failed");
|
||||
}
|
||||
}
|
||||
|
||||
static void set_lights() {
|
||||
spice.set_light(IIDX_Light_P1_Start, true, 1.f);
|
||||
}
|
||||
|
||||
static void clear_lights() {
|
||||
spice.set_light(IIDX_Light_P1_Start, false, 0.f);
|
||||
}
|
||||
|
||||
static void set_touch() {
|
||||
SPICE_SDK_TOUCH_POINT points[2] = {
|
||||
{ .id = 1, .x = 100, .y = 200 },
|
||||
{ .id = 2, .x = 300, .y = 400 },
|
||||
};
|
||||
spice.set_touch(points, 2);
|
||||
}
|
||||
|
||||
static void clear_touch() {
|
||||
uint32_t ids[2] = { 1, 2 };
|
||||
spice.clear_touch(ids, 2);
|
||||
}
|
||||
|
||||
static void insert_card() {
|
||||
spice.insert_card(0, "E004010000001234");
|
||||
}
|
||||
|
||||
static void set_keypad() {
|
||||
SPICE_SDK_STATUS_CODE ret = spice.set_keypad(0, '3');
|
||||
if (ret != SPICE_SDK_STATUS_SUCCESS) {
|
||||
char log_message[64];
|
||||
snprintf(log_message, sizeof(log_message), "set_keypad failed: %d", ret);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", log_message);
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_keypad() {
|
||||
spice.set_keypad(0, 0);
|
||||
}
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
#include "sdk/include/spicesdk.h"
|
||||
#include "sdk/include/spicesdk_io.h"
|
||||
|
||||
static SPICE_SDK_V0 spice;
|
||||
|
||||
static spice_sdk_destroy_callback_func destroy_callback;
|
||||
|
||||
static void test_logging();
|
||||
static void test_game_info();
|
||||
static void test_avs_info();
|
||||
|
||||
static void get_buttons();
|
||||
static void set_buttons();
|
||||
static void clear_buttons();
|
||||
|
||||
static void get_analogs();
|
||||
static void set_analogs();
|
||||
static void clear_analogs();
|
||||
|
||||
static void get_lights();
|
||||
static void set_lights();
|
||||
static void clear_lights();
|
||||
|
||||
static void set_touch();
|
||||
static void clear_touch();
|
||||
static void insert_card();
|
||||
static void set_keypad();
|
||||
static void clear_keypad();
|
||||
|
||||
static HANDLE worker_stop_event;
|
||||
static HANDLE worker_handle;
|
||||
static unsigned __stdcall worker_thread(void *arg);
|
||||
|
||||
// this sample assumes that the game is IIDX, but it doesn't check for it.
|
||||
|
||||
SPICE_SDK_ENTRY_POINT
|
||||
spice_sdk_entry_point(
|
||||
spice_sdk_init_func *init
|
||||
)
|
||||
{
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
memset(&spice, 0, sizeof(spice));
|
||||
spice.size = sizeof(spice);
|
||||
status = init(0, destroy_callback, &spice);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "plugin loaded");
|
||||
test_logging();
|
||||
test_game_info();
|
||||
test_avs_info();
|
||||
|
||||
worker_stop_event = CreateEventA(NULL, TRUE, FALSE, NULL);
|
||||
if (!worker_stop_event) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "failed to create worker stop event");
|
||||
return 0;
|
||||
}
|
||||
|
||||
worker_handle = (HANDLE)_beginthreadex(
|
||||
NULL, // security
|
||||
0, // stack size
|
||||
worker_thread, // function
|
||||
NULL, // argument
|
||||
0, // flags
|
||||
NULL // thread id
|
||||
);
|
||||
if (!worker_handle) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "failed to create worker thread");
|
||||
CloseHandle(worker_stop_event);
|
||||
worker_stop_event = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
__cdecl
|
||||
destroy_callback(
|
||||
void
|
||||
)
|
||||
{
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "plugin unloaded");
|
||||
if (worker_stop_event) {
|
||||
SetEvent(worker_stop_event);
|
||||
}
|
||||
if (worker_handle) {
|
||||
WaitForSingleObject(worker_handle, INFINITE);
|
||||
CloseHandle(worker_handle);
|
||||
worker_handle = NULL;
|
||||
}
|
||||
if (worker_stop_event) {
|
||||
CloseHandle(worker_stop_event);
|
||||
worker_stop_event = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned __stdcall worker_thread(void *arg) {
|
||||
int phase = 0;
|
||||
while (WaitForSingleObject(worker_stop_event, 0) == WAIT_TIMEOUT) {
|
||||
phase += 1;
|
||||
switch (phase) {
|
||||
case 1:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get buttons...");
|
||||
get_buttons();
|
||||
break;
|
||||
case 2:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set buttons...");
|
||||
set_buttons();
|
||||
break;
|
||||
case 3:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear buttons...");
|
||||
clear_buttons();
|
||||
break;
|
||||
case 4:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get analogs...");
|
||||
get_analogs();
|
||||
break;
|
||||
case 5:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set analogs...");
|
||||
set_analogs();
|
||||
break;
|
||||
case 6:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear analogs...");
|
||||
clear_analogs();
|
||||
break;
|
||||
case 7:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "get lights...");
|
||||
get_lights();
|
||||
break;
|
||||
case 8:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_WARNING, "set lights...");
|
||||
set_lights();
|
||||
break;
|
||||
case 9:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear lights...");
|
||||
clear_lights();
|
||||
break;
|
||||
case 10:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_INFO, "set touch...");
|
||||
set_touch();
|
||||
break;
|
||||
case 11:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear touch...");
|
||||
clear_touch();
|
||||
break;
|
||||
case 12:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_SUCCESS, "insert card...");
|
||||
insert_card();
|
||||
break;
|
||||
case 13:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_SUCCESS, "set keypad...");
|
||||
set_keypad();
|
||||
break;
|
||||
case 14:
|
||||
spice.add_toast(SPICE_SDK_TOAST_LEVEL_ERROR, "clear keypad...");
|
||||
clear_keypad();
|
||||
break;
|
||||
default:
|
||||
phase = 0;
|
||||
break;
|
||||
}
|
||||
if (phase != 0) {
|
||||
WaitForSingleObject(worker_stop_event, 3000);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_logging() {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_MISC, "sample_v0", "this is a misc message");
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", "this is an info message");
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "this is a warning message");
|
||||
}
|
||||
|
||||
static void test_game_info() {
|
||||
SPICE_SDK_GAME_INFO info;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_game_info(&info);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_game_info failed");
|
||||
return;
|
||||
}
|
||||
char log_message[128];
|
||||
snprintf(log_message, sizeof(log_message), "game info - name: %s", info.name);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void test_avs_info() {
|
||||
SPICE_SDK_AVS_INFO info;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_avs_info(&info);
|
||||
if (status != SPICE_SDK_STATUS_SUCCESS) {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_avs_info failed");
|
||||
return;
|
||||
}
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"avs - model: %s, dest: %c, spec: %c, rev: %c, ext: %s",
|
||||
info.model, info.dest, info.spec, info.rev, info.ext);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void get_buttons() {
|
||||
bool pressed;
|
||||
float velocity;
|
||||
spice.get_button(IIDX_Button_P1_Headphone, &pressed, &velocity);
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"button P1_Headphone pressed: %s, velocity: %.2f",
|
||||
pressed ? "ON" : "off", velocity);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void set_buttons() {
|
||||
spice.set_button(IIDX_Button_P1_1, true, 0.3f);
|
||||
spice.set_button(IIDX_Button_P1_3, true, 0.5f);
|
||||
spice.set_button(IIDX_Button_P1_5, true, 0.7f);
|
||||
}
|
||||
|
||||
static void clear_buttons() {
|
||||
spice.set_button(IIDX_Button_P1_1, false, 0.f);
|
||||
spice.set_button(IIDX_Button_P1_3, false, 0.f);
|
||||
spice.set_button(IIDX_Button_P1_5, false, 0.f);
|
||||
}
|
||||
|
||||
static void get_analogs() {
|
||||
float value;
|
||||
spice.get_analog(IIDX_Analog_TT_P1, &value);
|
||||
|
||||
char log_message[128];
|
||||
snprintf(
|
||||
log_message,
|
||||
sizeof(log_message),
|
||||
"analog TT_P1: %.2f",
|
||||
value);
|
||||
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
}
|
||||
|
||||
static void set_analogs() {
|
||||
spice.set_analog(IIDX_Analog_TT_P1, true, 0.25f);
|
||||
spice.set_analog(IIDX_Analog_TT_P2, true, 0.75f);
|
||||
}
|
||||
|
||||
static void clear_analogs() {
|
||||
spice.set_analog(IIDX_Analog_TT_P1, false, 0.f);
|
||||
spice.set_analog(IIDX_Analog_TT_P2, false, 0.f);
|
||||
}
|
||||
|
||||
static void get_lights() {
|
||||
float value;
|
||||
SPICE_SDK_STATUS_CODE status;
|
||||
|
||||
status = spice.get_light(IIDX_Light_TT_P1_Resistance, &value);
|
||||
if (status == SPICE_SDK_STATUS_SUCCESS) {
|
||||
char log_message[64];
|
||||
snprintf(log_message, sizeof(log_message), "P1 TT resistance value: %.2f", value);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_INFO, "sample_v0", log_message);
|
||||
} else {
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", "get_light failed");
|
||||
}
|
||||
}
|
||||
|
||||
static void set_lights() {
|
||||
spice.set_light(IIDX_Light_P1_Start, true, 1.f);
|
||||
}
|
||||
|
||||
static void clear_lights() {
|
||||
spice.set_light(IIDX_Light_P1_Start, false, 0.f);
|
||||
}
|
||||
|
||||
static void set_touch() {
|
||||
SPICE_SDK_TOUCH_POINT points[2] = {
|
||||
{ .id = 1, .x = 100, .y = 200 },
|
||||
{ .id = 2, .x = 300, .y = 400 },
|
||||
};
|
||||
spice.set_touch(points, 2);
|
||||
}
|
||||
|
||||
static void clear_touch() {
|
||||
uint32_t ids[2] = { 1, 2 };
|
||||
spice.clear_touch(ids, 2);
|
||||
}
|
||||
|
||||
static void insert_card() {
|
||||
spice.insert_card(0, "E004010000001234");
|
||||
}
|
||||
|
||||
static void set_keypad() {
|
||||
SPICE_SDK_STATUS_CODE ret = spice.set_keypad(0, '3');
|
||||
if (ret != SPICE_SDK_STATUS_SUCCESS) {
|
||||
char log_message[64];
|
||||
snprintf(log_message, sizeof(log_message), "set_keypad failed: %d", ret);
|
||||
spice.log(SPICE_SDK_LOG_LEVEL_WARNING, "sample_v0", log_message);
|
||||
}
|
||||
}
|
||||
|
||||
static void clear_keypad() {
|
||||
spice.set_keypad(0, 0);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
LIBRARY sdk_sample_v0_flat_c
|
||||
|
||||
EXPORTS
|
||||
LIBRARY sdk_sample_v0_flat_c
|
||||
|
||||
EXPORTS
|
||||
spice_sdk_entry_point
|
||||
+643
-643
File diff suppressed because it is too large
Load Diff
+11
-11
@@ -1,12 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
namespace sdk {
|
||||
|
||||
void register_sdk_hooks(std::string dll, HINSTANCE module);
|
||||
void init_sdk_modules();
|
||||
void fini_sdk_modules();
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
namespace sdk {
|
||||
|
||||
void register_sdk_hooks(std::string dll, HINSTANCE module);
|
||||
void init_sdk_modules();
|
||||
void fini_sdk_modules();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user