Add sniper mode option in ini.

This commit is contained in:
sorgelig
2020-05-02 15:12:19 +08:00
parent da693b0bc4
commit bd9ea67c63
4 changed files with 8 additions and 1 deletions

View File

@@ -102,3 +102,8 @@ controller_info=6
; You have to provide correct VID and PID of your input device
jammasd_vid=0x04D8
jammasd_pid=0xF3AD
; Speeds in sniper/non-sniper modes of mouse emulation by joystick
; 0 - (default) - faster move in non-sniper mode, slower move in sniper mode.
; 1 - movement speeds are swapped.
sniper_mode=0

View File

@@ -68,6 +68,7 @@ static const ini_var_t ini_vars[] =
{ "REFRESH_MAX", (void*)(&(cfg.refresh_max)), UINT8, 0, 150 },
{ "JAMMASD_VID", (void*)(&(cfg.jammasd_vid)), UINT16, 0, 0xFFFF },
{ "JAMMASD_PID", (void*)(&(cfg.jammasd_pid)), UINT16, 0, 0xFFFF },
{ "SNIPER_MODE", (void*)(&(cfg.sniper_mode)), UINT8, 0, 1 },
};
static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t));

1
cfg.h
View File

@@ -42,6 +42,7 @@ typedef struct {
uint8_t recents;
uint16_t jammasd_vid;
uint16_t jammasd_pid;
uint8_t sniper_mode;
char bootcore[256];
char video_conf[1024];
char video_conf_pal[1024];

View File

@@ -3418,7 +3418,7 @@ int input_poll(int getchar)
int dx = mouse_emu_x;
int dy = mouse_emu_y;
if (mouse_sniper)
if (mouse_sniper ^ cfg.sniper_mode)
{
if (dx > 2) dx = 2;
if (dx < -2) dx = -2;