forked from TeamTofuShop/segatools
swdc: add ffb and led emulation
This commit is contained in:
118
swdcio/swdcio.h
118
swdcio/swdcio.h
@ -2,6 +2,7 @@
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
enum {
|
||||
@ -26,6 +27,17 @@ enum {
|
||||
SWDC_IO_GAMEBTN_STEERING_PADDLE_RIGHT = 0x800,
|
||||
};
|
||||
|
||||
enum {
|
||||
/* These are the bitmasks to use when checking which
|
||||
lights are triggered on incoming IO4 GPIO writes. */
|
||||
SWDC_IO_LED_START = 1 << 31,
|
||||
SWDC_IO_LED_VIEW_CHANGE = 1 << 30,
|
||||
SWDC_IO_LED_UP = 1 << 25,
|
||||
SWDC_IO_LED_DOWN = 1 << 24,
|
||||
SWDC_IO_LED_LEFT = 1 << 23,
|
||||
SWDC_IO_LED_RIGHT = 1 << 22,
|
||||
};
|
||||
|
||||
struct swdc_io_analog_state {
|
||||
/* Current steering wheel position, where zero is the centered position.
|
||||
|
||||
@ -45,7 +57,7 @@ struct swdc_io_analog_state {
|
||||
uint16_t brake;
|
||||
};
|
||||
|
||||
/* Get the version of the IDAC IO API that this DLL supports. This
|
||||
/* Get the version of the SWDC 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).
|
||||
@ -89,3 +101,107 @@ void swdc_io_get_gamebtns(uint16_t *gamebtn);
|
||||
Minimum API version: 0x0100 */
|
||||
|
||||
void swdc_io_get_analogs(struct swdc_io_analog_state *out);
|
||||
|
||||
/* Initialize LED emulation. This function will be called before any
|
||||
other swdc_io_led_*() function calls.
|
||||
|
||||
All subsequent calls may originate from arbitrary threads and some may
|
||||
overlap with each other. Ensuring synchronization inside your IO DLL is
|
||||
your responsibility.
|
||||
|
||||
Minimum API version: 0x0101 */
|
||||
|
||||
HRESULT swdc_io_led_init(void);
|
||||
|
||||
/* Update the FET outputs. rgb is a pointer to an array up to 3 bytes.
|
||||
|
||||
The following bits are used to control the FET outputs:
|
||||
[0]: LEFT SEAT LED
|
||||
[1]: RIGHT SEAT LED
|
||||
|
||||
The LED is truned on when the byte is 255 and turned off when the byte is 0.
|
||||
|
||||
Minimum API version: 0x0101 */
|
||||
|
||||
void swdc_io_led_set_fet_output(const uint8_t *rgb);
|
||||
|
||||
/* Update the RGB LEDs. rgb is a pointer to an array up to 32 * 4 = 128 bytes.
|
||||
|
||||
The LEDs are laid out as follows:
|
||||
[0]: LEFT UP LED
|
||||
[1-2]: LEFT CENTER LED
|
||||
[3]: LEFT DOWN LED
|
||||
[5]: RIGHT UP LED
|
||||
[6-7]: RIGHT CENTER LED
|
||||
[8]: RIGHT DOWN LED
|
||||
|
||||
Each rgb value is comprised for 4 bytes in the order of R, G, B, Speed.
|
||||
Speed is a value from 0 to 255, where 0 is the fastest speed and 255 is the slowest.
|
||||
|
||||
Minimum API version: 0x0101 */
|
||||
|
||||
void swdc_io_led_gs_update(const uint8_t *rgb);
|
||||
|
||||
/* Update the cabinet button LEDs. rgb is a pointer to an array up to 6 bytes.
|
||||
|
||||
The LEDs are laid out as follows:
|
||||
[0]: START LED
|
||||
[1]: VIEW CHANGE LED
|
||||
[2]: UP LED
|
||||
[3]: DOWN LED
|
||||
[4]: RIGHT LED
|
||||
[5]: LEFT LED
|
||||
|
||||
The LED is turned on when the byte is 255 and turned off when the byte is 0.
|
||||
|
||||
Minimum API version: 0x0101 */
|
||||
|
||||
void swdc_io_led_set_leds(const uint8_t *rgb);
|
||||
|
||||
/* Initialize FFB emulation. This function will be called before any
|
||||
other swdc_io_ffb_*() function calls.
|
||||
|
||||
This will always be called even if FFB board emulation is disabled to allow
|
||||
the IO DLL to initialize any necessary resources.
|
||||
|
||||
Minimum API version: 0x0102 */
|
||||
|
||||
HRESULT swdc_io_ffb_init(void);
|
||||
|
||||
/* Toggle FFB emulation. If active is true, FFB emulation should be enabled.
|
||||
If active is false, FFB emulation should be disabled and all FFB effects
|
||||
should be stopped and released.
|
||||
|
||||
Minimum API version: 0x0102 */
|
||||
|
||||
void swdc_io_ffb_toggle(bool active);
|
||||
|
||||
/* Set a constant force FFB effect.
|
||||
|
||||
Direction is 0 for right and 1 for left.
|
||||
Force is the magnitude of the force, where 0 is no force and 127 is the
|
||||
maximum force in a given direction.
|
||||
|
||||
Minimum API version: 0x0102 */
|
||||
|
||||
void swdc_io_ffb_constant_force(uint8_t direction, uint8_t force);
|
||||
|
||||
/* Set a (sine) periodic force FFB effect.
|
||||
|
||||
Period is the period of the effect in milliseconds (not sure).
|
||||
Force is the magnitude of the force, where 0 is no force and 127 is the
|
||||
maximum force.
|
||||
|
||||
Minimum API version: 0x0102 */
|
||||
|
||||
void swdc_io_ffb_rumble(uint8_t period, uint8_t force);
|
||||
|
||||
/* Set a damper FFB effect.
|
||||
|
||||
Force is the magnitude of the force, where 0 is no force and 40 is the
|
||||
maximum force. Theoretically the maximum force is 127, but the game only
|
||||
uses a maximum of 40.
|
||||
|
||||
Minimum API version: 0x0102 */
|
||||
|
||||
void swdc_io_ffb_damper(uint8_t force);
|
||||
|
Reference in New Issue
Block a user