Add api versioning to divaio

This commit is contained in:
Tau 2021-06-06 09:40:55 -04:00
parent 8dddb18793
commit a940c0b47b
2 changed files with 35 additions and 7 deletions

View File

@ -16,6 +16,11 @@ static HANDLE diva_io_slider_thread;
static bool diva_io_slider_stop_flag; static bool diva_io_slider_stop_flag;
static struct diva_io_config diva_io_cfg; static struct diva_io_config diva_io_cfg;
uint16_t diva_io_get_api_version(void)
{
return 0x0100;
}
HRESULT diva_io_jvs_init(void) HRESULT diva_io_jvs_init(void)
{ {
diva_io_config_load(&diva_io_cfg, L".\\segatools.ini"); diva_io_config_load(&diva_io_cfg, L".\\segatools.ini");

View File

@ -5,13 +5,24 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
/* Get the version of the Project Diva IO API that this DLL supports. This
function should return a positive 16-bit integer, where the high byte is
the major version and the low byte is the minor version (as defined by the
Semantic Versioning standard).
The latest API version as of this writing is 0x0100. */
uint16_t diva_io_get_api_version(void);
/* Initialize JVS-based input. This function will be called before any other /* Initialize JVS-based input. This function will be called before any other
diva_io_jvs_*() function calls. Errors returned from this function will diva_io_jvs_*() function calls. Errors returned from this function will
manifest as a disconnected JVS bus. manifest as a disconnected JVS bus.
All subsequent calls may originate from arbitrary threads and some may All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is overlap with each other. Ensuring synchronization inside your IO DLL is
your responsibility. */ your responsibility.
Minimum API version: 0x0100 */
HRESULT diva_io_jvs_init(void); HRESULT diva_io_jvs_init(void);
@ -22,13 +33,17 @@ HRESULT diva_io_jvs_init(void);
gamebtn bits, from least significant to most significant, are: gamebtn bits, from least significant to most significant, are:
Circle Cross Square Triangle Start UNUSED UNUSED UNUSED */ Circle Cross Square Triangle Start UNUSED UNUSED UNUSED
Minimum API version: 0x0100 */
void diva_io_jvs_poll(uint8_t *opbtn, uint8_t *gamebtn); void diva_io_jvs_poll(uint8_t *opbtn, uint8_t *gamebtn);
/* Read the current state of the coin counter. This value should be incremented /* Read the current state of the coin counter. This value should be incremented
for every coin detected by the coin acceptor mechanism. This count does not for every coin detected by the coin acceptor mechanism. This count does not
need to persist beyond the lifetime of the process. */ need to persist beyond the lifetime of the process.
Minimum API Version: 0x0100 */
void diva_io_jvs_read_coin_counter(uint16_t *out); void diva_io_jvs_read_coin_counter(uint16_t *out);
@ -43,7 +58,9 @@ void diva_io_jvs_set_coin_blocker(bool open);
All subsequent calls may originate from arbitrary threads and some may All subsequent calls may originate from arbitrary threads and some may
overlap with each other. Ensuring synchronization inside your IO DLL is overlap with each other. Ensuring synchronization inside your IO DLL is
your responsibility. */ your responsibility.
Minimum API version: 0x0100 */
HRESULT diva_io_slider_init(void); HRESULT diva_io_slider_init(void);
@ -67,7 +84,9 @@ typedef void (*diva_io_slider_callback_t)(const uint8_t *state);
preferred interval then 1 kHz is a reasonable maximum frequency. preferred interval then 1 kHz is a reasonable maximum frequency.
Note that you do have to have to call the callback "occasionally" even if Note that you do have to have to call the callback "occasionally" even if
nothing is changing, otherwise the game will raise a comm timeout error. */ nothing is changing, otherwise the game will raise a comm timeout error.
Minimum API version: 0x0100 */
void diva_io_slider_start(diva_io_slider_callback_t callback); void diva_io_slider_start(diva_io_slider_callback_t callback);
@ -80,11 +99,15 @@ void diva_io_slider_start(diva_io_slider_callback_t callback);
Following on from the above, the slider polling loop *will* be restarted Following on from the above, the slider polling loop *will* be restarted
after being stopped in the course of regular operation. Do not permanently after being stopped in the course of regular operation. Do not permanently
tear down your input driver in response to this function call. */ tear down your input driver in response to this function call.
Minimum API version: 0x0100 */
void diva_io_slider_stop(void); void diva_io_slider_stop(void);
/* Update the RGB lighting on the slider. A pointer to an array of 32 * 3 = 96 /* Update the RGB lighting on the slider. A pointer to an array of 32 * 3 = 96
bytes is supplied. Layout is probably strictly linear but still TBD. */ bytes is supplied. Layout is probably strictly linear but still TBD.
Minimum API version: 0x0100 */
void diva_io_slider_set_leds(const uint8_t *rgb); void diva_io_slider_set_leds(const uint8_t *rgb);