mirror of
https://github.com/libretro/beetle-saturn-libretro.git
synced 2024-11-23 09:19:49 +00:00
Mouse sensitivity
This commit is contained in:
parent
fc069226af
commit
ea05057b1b
12
input.cpp
12
input.cpp
@ -20,6 +20,7 @@ static unsigned players = MAX_CONTROLLERS;
|
||||
static int astick_deadzone = 0;
|
||||
static int trigger_deadzone = 0;
|
||||
static bool virtua_gun_trigger_rmb = false;
|
||||
static float mouse_sensitivity = 0.5f;
|
||||
|
||||
typedef union
|
||||
{
|
||||
@ -304,6 +305,13 @@ void input_set_virtua_gun_trigger( bool use_rmb )
|
||||
virtua_gun_trigger_rmb = use_rmb;
|
||||
}
|
||||
|
||||
void input_set_mouse_sensitivity( int percent )
|
||||
{
|
||||
if ( percent > 0 && percent <= 200 ) {
|
||||
mouse_sensitivity = (float)percent / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void input_update( retro_input_state_t input_state_cb )
|
||||
{
|
||||
// For each player (logical controller)
|
||||
@ -554,8 +562,8 @@ void input_update( retro_input_state_t input_state_cb )
|
||||
|
||||
int *delta;
|
||||
delta = (int*)p_input;
|
||||
delta[ 0 ] = dx_raw;
|
||||
delta[ 1 ] = dy_raw;
|
||||
delta[ 0 ] = (int)roundf( dx_raw * mouse_sensitivity );
|
||||
delta[ 1 ] = (int)roundf( dy_raw * mouse_sensitivity );
|
||||
}
|
||||
|
||||
break;
|
||||
|
1
input.h
1
input.h
@ -16,6 +16,7 @@ extern void input_set_env( retro_environment_t environ_cb );
|
||||
extern void input_set_deadzone_stick( int percent );
|
||||
extern void input_set_deadzone_trigger( int percent );
|
||||
extern void input_set_virtua_gun_trigger( bool use_rmb );
|
||||
extern void input_set_mouse_sensitivity( int percent );
|
||||
|
||||
extern void input_update( retro_input_state_t input_state_cb );
|
||||
|
||||
|
@ -849,7 +849,6 @@ static void Emulate(EmulateSpecStruct* espec_arg)
|
||||
|
||||
espec = espec_arg;
|
||||
AllowMidSync = MDFN_GetSettingB("ss.midsync");
|
||||
MDFNGameInfo->mouse_sensitivity = MDFN_GetSettingF("ss.input.mouse_sensitivity");
|
||||
|
||||
cur_clock_div = SMPC_StartFrame(espec);
|
||||
UpdateSMPCInput(0);
|
||||
@ -2113,7 +2112,6 @@ static MDFNSetting SSSettings[] =
|
||||
{ "ss.scsp.resamp_quality", MDFNSF_NOFLAGS, "SCSP output resampler quality.",
|
||||
"0 is lowest quality and CPU usage, 10 is highest quality and CPU usage. The resampler that this setting refers to is used for converting from 44.1KHz to the sampling rate of the host audio device Mednafen is using. Changing Mednafen's output rate, via the \"sound.rate\" setting, to \"44100\" may bypass the resampler, which can decrease CPU usage by Mednafen, and can increase or decrease audio quality, depending on various operating system and hardware factors.", MDFNST_UINT, "4", "0", "10" },
|
||||
|
||||
{ "ss.input.mouse_sensitivity", MDFNSF_NOFLAGS, "Emulated mouse sensitivity.", NULL, MDFNST_FLOAT, "0.50", NULL, NULL },
|
||||
{ "ss.input.sport1.multitap", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Enable multitap on Saturn port 1.", NULL, MDFNST_BOOL, "0", NULL, NULL },
|
||||
{ "ss.input.sport2.multitap", MDFNSF_EMU_STATE | MDFNSF_UNTRUSTED_SAFE, "Enable multitap on Saturn port 2.", NULL, MDFNST_BOOL, "0", NULL, NULL },
|
||||
|
||||
@ -2642,6 +2640,12 @@ static void check_variables(bool startup)
|
||||
if ( environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value )
|
||||
input_set_deadzone_trigger( atoi( var.value ) );
|
||||
|
||||
var.key = "beetle_saturn_mouse_sensitivity";
|
||||
var.value = NULL;
|
||||
|
||||
if ( environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value )
|
||||
input_set_mouse_sensitivity( atoi( var.value ) );
|
||||
|
||||
var.key = "beetle_saturn_virtuagun_trigger";
|
||||
var.value = NULL;
|
||||
|
||||
@ -3093,6 +3097,7 @@ void retro_set_environment( retro_environment_t cb )
|
||||
{ "beetle_saturn_cart", "Cartridge; Auto Detect|None|Backup Memory|Extended RAM (1MB)|Extended RAM (4MB)|The King of Fighters '95|Ultraman: Hikari no Kyojin Densetsu" },
|
||||
{ "beetle_saturn_analog_stick_deadzone", "3D Pad - Analog Deadzone; 15%|20%|25%|30%|0%|5%|10%"},
|
||||
{ "beetle_saturn_trigger_deadzone", "3D Pad - Trigger Deadzone; 15%|20%|25%|30%|0%|5%|10%"},
|
||||
{ "beetle_saturn_mouse_sensitivity", "Mouse - Sensitivity; 100%|105%|110%|115%|120%|125%|130%|135%|140%|145%|150%|155%|160%|165%|170%|175%|180%|185%|190%|195%|200%|5%|10%|15%|20%|25%|30%|35%|40%|45%|50%|55%|60%|65%|70%|75%|80%|85%|90%|95%" },
|
||||
{ "beetle_saturn_virtuagun_trigger", "Virtua Gun - Trigger; Left Mouse Button|Right Mouse Button" },
|
||||
{ "beetle_saturn_cdimagecache", "CD Image Cache (restart); disabled|enabled" },
|
||||
{ "beetle_saturn_autortc", "Automatically set RTC on game load; enabled|disabled" },
|
||||
|
@ -472,9 +472,6 @@ typedef struct
|
||||
|
||||
std::vector<const char *>DesiredInput; // Desired input device for the input ports, NULL for don't care
|
||||
|
||||
// For mouse relative motion.
|
||||
double mouse_sensitivity;
|
||||
|
||||
|
||||
// For absolute coordinates(IDIT_X_AXIS and IDIT_Y_AXIS), usually mapped to a mouse(hence the naming).
|
||||
float mouse_scale_x, mouse_scale_y;
|
||||
|
@ -56,15 +56,6 @@ int64 MDFN_GetSettingI(const char *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
double MDFN_GetSettingF(const char *name)
|
||||
{
|
||||
if (!strcmp("ss.input.mouse_sensitivity", name))
|
||||
return 0.50; /* TODO - make configurable */
|
||||
|
||||
fprintf(stderr, "unhandled setting F: %s\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MDFN_GetSettingB(const char *name)
|
||||
{
|
||||
if (!strcmp("cheats", name))
|
||||
|
@ -9,7 +9,6 @@ extern bool DoHBlend;
|
||||
// be a totally tubular error!
|
||||
uint64 MDFN_GetSettingUI(const char *name);
|
||||
int64 MDFN_GetSettingI(const char *name);
|
||||
double MDFN_GetSettingF(const char *name);
|
||||
bool MDFN_GetSettingB(const char *name);
|
||||
std::string MDFN_GetSettingS(const char *name);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user