diff options
author | negativeExponent | 2020-05-08 01:44:24 +0800 |
---|---|---|
committer | negativeExponent | 2020-05-08 01:44:24 +0800 |
commit | e16ecc894d054792c137072161138ad7bd576336 (patch) | |
tree | c6cb53e2de18b5d0cb53219a04dd3357d8977bc5 /frontend | |
parent | 3abd263a60b0fd2bce21f01df9205eebe97e9915 (diff) | |
download | pcsx_rearmed-e16ecc894d054792c137072161138ad7bd576336.tar.gz pcsx_rearmed-e16ecc894d054792c137072161138ad7bd576336.tar.bz2 pcsx_rearmed-e16ecc894d054792c137072161138ad7bd576336.zip |
Move guncon options to update_variables
- This should stop unnecessary RETRO_ENVIRONMENT_GET_VARIABLE callback and log spamming
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/libretro.c | 87 |
1 files changed, 43 insertions, 44 deletions
diff --git a/frontend/libretro.c b/frontend/libretro.c index 9226736..cfcb760 100644 --- a/frontend/libretro.c +++ b/frontend/libretro.c @@ -1615,6 +1615,14 @@ static const unsigned short retro_psx_map[] = { }; #define RETRO_PSX_MAP_LEN (sizeof(retro_psx_map) / sizeof(retro_psx_map[0])) +//Percentage distance of screen to adjust +static int GunconAdjustX = 0; +static int GunconAdjustY = 0; + +//Used when out by a percentage +static float GunconAdjustRatioX = 1; +static float GunconAdjustRatioY = 1; + static void update_variables(bool in_flight) { struct retro_variable var; @@ -2150,6 +2158,41 @@ static void update_variables(bool in_flight) } #endif // GPU_UNAI + //This adjustment process gives the user the ability to manually align the mouse up better + //with where the shots are in the emulator. + + var.value = NULL; + var.key = "pcsx_rearmed_gunconadjustx"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + GunconAdjustX = atoi(var.value); + } + + var.value = NULL; + var.key = "pcsx_rearmed_gunconadjusty"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + GunconAdjustY = atoi(var.value); + } + + var.value = NULL; + var.key = "pcsx_rearmed_gunconadjustratiox"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + GunconAdjustRatioX = atof(var.value); + } + + var.value = NULL; + var.key = "pcsx_rearmed_gunconadjustratioy"; + + if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) + { + GunconAdjustRatioY = atof(var.value); + } + if (in_flight) { // inform core things about possible config changes plugin_call_rearmed_cbs(); @@ -2345,55 +2388,11 @@ void retro_run(void) int gunx = input_state_cb(1, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_X); int guny = input_state_cb(1, RETRO_DEVICE_POINTER, 0, RETRO_DEVICE_ID_POINTER_Y); - //This adjustment process gives the user the ability to manually align the mouse up better - //with where the shots are in the emulator. - - //Percentage distance of screen to adjust - int GunconAdjustX = 0; - int GunconAdjustY = 0; - - //Used when out by a percentage - float GunconAdjustRatioX = 1; - float GunconAdjustRatioY = 1; - - struct retro_variable var; - var.value = NULL; - var.key = "pcsx_rearmed_gunconadjustx"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - { - GunconAdjustX = atoi(var.value); - } - - var.value = NULL; - var.key = "pcsx_rearmed_gunconadjusty"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - { - GunconAdjustY = atoi(var.value); - } - - - var.value = NULL; - var.key = "pcsx_rearmed_gunconadjustratiox"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - { - GunconAdjustRatioX = atof(var.value); - } - - - var.value = NULL; - var.key = "pcsx_rearmed_gunconadjustratioy"; - if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) - { - GunconAdjustRatioY = atof(var.value); - } - //Mouse range is -32767 -> 32767 //1% is about 655 //Use the left analog stick field to store the absolute coordinates in_analog_left[0][0] = (gunx*GunconAdjustRatioX) + (GunconAdjustX * 655); in_analog_left[0][1] = (guny*GunconAdjustRatioY) + (GunconAdjustY * 655); - - } if (in_type[i] == PSE_PAD_TYPE_NEGCON) { |