ini: spinner_axis option.

This commit is contained in:
sorgelig
2021-07-26 22:45:44 +08:00
parent b19f6440c1
commit 1f9a325602
4 changed files with 12 additions and 6 deletions

View File

@@ -143,12 +143,16 @@ shared_folder=
;custom_aspect_ratio_2=1:1
; use specific (VID/PID) mouse X movement as a spinner and paddle. Use VID=0xFFFF/PID=0xFFFF to use all mice as spinners.
; spinner_throttle with base value 100 gives one spinner step per one tick. Higher value makes spinner slower.
; Lower than 100 makes spinner faster. Negative value gives opposite direction.
;spinner_vid=0x1BCF
;spinner_pid=0x0005
; spinner_throttle with base value 100 gives one spinner step per one tick. Higher value makes spinner slower.
; Lower than 100 makes spinner faster. Negative value gives opposite direction.
;spinner_throttle=-50
; 0 - X axis, 1 - Y axis.
;spinner_axis=1
; Default filters for video scaler and audio. Paths must be relative to scaler/audio filter folder without leading slash.
;vfilter_default=LCD Effects/LCD_Effect_07.txt
;afilter_default=LPF2000_3tap.txt

View File

@@ -79,6 +79,7 @@ static const ini_var_t ini_vars[] =
{ "CUSTOM_ASPECT_RATIO_2", (void*)(&(cfg.custom_aspect_ratio[1])), STRING, 0, sizeof(cfg.custom_aspect_ratio[1]) - 1 },
{ "SPINNER_VID", (void*)(&(cfg.spinner_vid)), UINT16, 0, 0xFFFF },
{ "SPINNER_PID", (void*)(&(cfg.spinner_pid)), UINT16, 0, 0xFFFF },
{ "SPINNER_AXIS", (void*)(&(cfg.spinner_axis)), UINT8, 0, 1 },
{ "SPINNER_THROTTLE", (void*)(&(cfg.spinner_throttle)), INT32, -10000, 10000 },
{ "AFILTER_DEFAULT", (void*)(&(cfg.afilter_default)), STRING, 0, sizeof(cfg.afilter_default) - 1 },
{ "VFILTER_DEFAULT", (void*)(&(cfg.vfilter_default)), STRING, 0, sizeof(cfg.vfilter_default) - 1 },

1
cfg.h
View File

@@ -48,6 +48,7 @@ typedef struct {
uint16_t spinner_vid;
uint16_t spinner_pid;
int spinner_throttle;
uint8_t spinner_axis;
uint8_t sniper_mode;
uint8_t browse_expand;
uint8_t logo;

View File

@@ -2926,7 +2926,6 @@ void mergedevs()
{
//All mice as spinners
if ((cfg.spinner_vid == 0xFFFF && cfg.spinner_pid == 0xFFFF)
//Mouse as spinner
|| (cfg.spinner_vid && cfg.spinner_pid && input[i].vid == cfg.spinner_vid && input[i].pid == cfg.spinner_pid))
{
@@ -2935,7 +2934,7 @@ void mergedevs()
input[i].spinner_prediv = 1;
}
//Arcade Spinner TS-BSP01
//Arcade Spinner TS-BSP01 (X axis) and Atari (Y axis)
if (input[i].vid == 0x32be && input[i].pid == 0x1420)
{
input[i].quirk = QUIRK_MSSP;
@@ -3942,6 +3941,7 @@ int input_test(int getchar)
if (input[dev].quirk == QUIRK_MSSP)
{
int val = cfg.spinner_axis ? yval : xval;
int btn = (data[0] & 7) ? 1 : 0;
if (input[i].misc_flags != btn)
{
@@ -3955,7 +3955,7 @@ int input_test(int getchar)
int throttle = (cfg.spinner_throttle ? abs(cfg.spinner_throttle) : 100) * input[i].spinner_prediv;
int inv = cfg.spinner_throttle < 0;
input[i].spinner_acc += (xval * 100);
input[i].spinner_acc += (val * 100);
int spinner = (input[i].spinner_acc <= -throttle || input[i].spinner_acc >= throttle) ? (input[i].spinner_acc / throttle) : 0;
input[i].spinner_acc -= spinner * throttle;
@@ -3976,7 +3976,7 @@ int input_test(int getchar)
input_cb(&ev, &absinfo, i);
}
if (is_menu() && !video_fb_state()) printf("%s: xval=%d, btn=%d, spinner=%d, paddle=%d\n", input[i].devname, xval, btn, spinner, input[i].paddle_val);
if (is_menu() && !video_fb_state()) printf("%s: xval=%d, btn=%d, spinner=%d, paddle=%d\n", input[i].devname, val, btn, spinner, input[i].paddle_val);
}
else
{