From bd9ea67c6392ac12188db816ce4866f5729e8ec7 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Sat, 2 May 2020 15:12:19 +0800 Subject: [PATCH] Add sniper mode option in ini. --- MiSTer.ini | 5 +++++ cfg.cpp | 1 + cfg.h | 1 + input.cpp | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/MiSTer.ini b/MiSTer.ini index 8b0fa0a..3b0ba2c 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -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 diff --git a/cfg.cpp b/cfg.cpp index 91fb7ff..55cce9a 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -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)); diff --git a/cfg.h b/cfg.h index 2664d4b..4e10716 100644 --- a/cfg.h +++ b/cfg.h @@ -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]; diff --git a/input.cpp b/input.cpp index 36b7e88..22ec881 100644 --- a/input.cpp +++ b/input.cpp @@ -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;