diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp index 39e12d83..365dfcb0 100644 --- a/src/osdep/amiberry_input.cpp +++ b/src/osdep/amiberry_input.cpp @@ -804,7 +804,7 @@ static int init_joystick(void) else sprintf(joystick_name[cpt], "Joystick%d", cpt); - // printf("Real Name >>%s<<\n",joystick_name[cpt]); + // printf("Real Name >>%s<<\n",joystick_name[cpt]); //this now uses controllers path (in tmp) char control_config[255]; @@ -812,27 +812,26 @@ static int init_joystick(void) auto sanitized_name = sanitize_retroarch_name(joystick_name[cpt]); strcat(control_config, sanitized_name.c_str()); //strcat(control_config, joystick_name[cpt]); - strcat(control_config, ".cfg"); - - //printf("Trying to match >>%s<<\n",control_config); + strcat(control_config, ".cfg"); + + //printf("Trying to match >>%s<<\n",control_config); if (zfile_exists(control_config)) { fill_blank_controller(); host_input_buttons[cpt] = default_controller_map; - - //printf("Retroarch search for: >>%s<<\n",joystick_name[cpt]); - + //printf("Retroarch search for: >>%s<<\n",joystick_name[cpt]); + host_input_buttons[cpt].is_retroarch = true; host_input_buttons[cpt].hotkey_button = find_retroarch("input_enable_hotkey_btn", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); host_input_buttons[cpt].quit_button = find_retroarch("input_exit_emulator_btn", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); host_input_buttons[cpt].menu_button = find_retroarch("input_menu_toggle_btn", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); host_input_buttons[cpt].reset_button = find_retroarch("input_reset_btn", control_config, host_input_buttons[cpt]); host_input_buttons[cpt].east_button = find_retroarch("input_a_btn", control_config, host_input_buttons[cpt]); @@ -856,41 +855,41 @@ static int init_joystick(void) host_input_buttons[cpt].rstick_button = find_retroarch("input_r3_btn", control_config, host_input_buttons[cpt]); host_input_buttons[cpt].lstick_axis_x = find_retroarch("input_l_x_plus_axis", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); if (host_input_buttons[cpt].lstick_axis_x == -1) host_input_buttons[cpt].lstick_axis_x = find_retroarch("input_right_axis", control_config, host_input_buttons[cpt]); host_input_buttons[cpt].lstick_axis_y = find_retroarch("input_l_y_plus_axis", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); if (host_input_buttons[cpt].lstick_axis_y == -1) host_input_buttons[cpt].lstick_axis_y = find_retroarch("input_down_axis", control_config, host_input_buttons[cpt]); host_input_buttons[cpt].rstick_axis_x = find_retroarch("input_r_x_plus_axis", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); host_input_buttons[cpt].rstick_axis_y = find_retroarch("input_r_y_plus_axis", control_config, - host_input_buttons[cpt]); + host_input_buttons[cpt]); - // specials - // hats + // specials + // hats host_input_buttons[cpt].number_of_hats = find_retroarch("count_hats", control_config, host_input_buttons[cpt]); - - // invert on axes - host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_down_axis",control_config); - if (host_input_buttons[cpt].lstick_axis_y_invert == false) - host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_l_y_plus_axis",control_config); - - host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_right_axis",control_config); - if (host_input_buttons[cpt].lstick_axis_x_invert == false) - host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_l_x_plus_axis",control_config); - host_input_buttons[cpt].rstick_axis_x_invert = find_retroarch_polarity("input_r_x_plus_axis",control_config); - host_input_buttons[cpt].rstick_axis_y_invert = find_retroarch_polarity("input_r_y_plus_axis",control_config); - -// i'll just leave this here for when we have a working debug logging -// printf("invert left y axis: %d\n",host_input_buttons[cpt].lstick_axis_y_invert); -// printf("invert left x axis: %d\n",host_input_buttons[cpt].lstick_axis_x_invert); -// printf("invert right y axis: %d\n",host_input_buttons[cpt].rstick_axis_y_invert); -// printf("invert right x axis: %d\n",host_input_buttons[cpt].rstick_axis_x_invert); + // invert on axes + host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_down_axis", control_config); + if (!host_input_buttons[cpt].lstick_axis_y_invert) + host_input_buttons[cpt].lstick_axis_y_invert = find_retroarch_polarity("input_l_y_plus_axis", control_config); + + host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_right_axis", control_config); + if (!host_input_buttons[cpt].lstick_axis_x_invert) + host_input_buttons[cpt].lstick_axis_x_invert = find_retroarch_polarity("input_l_x_plus_axis", control_config); + + host_input_buttons[cpt].rstick_axis_x_invert = find_retroarch_polarity("input_r_x_plus_axis", control_config); + host_input_buttons[cpt].rstick_axis_y_invert = find_retroarch_polarity("input_r_y_plus_axis", control_config); + + //i'll just leave this here for when we have a working debug logging +// printf("invert left y axis: %d\n",host_input_buttons[cpt].lstick_axis_y_invert); +// printf("invert left x axis: %d\n",host_input_buttons[cpt].lstick_axis_x_invert); +// printf("invert right y axis: %d\n",host_input_buttons[cpt].rstick_axis_y_invert); +// printf("invert right x axis: %d\n",host_input_buttons[cpt].rstick_axis_x_invert); // //input_state_slot_increase_axis //input_state_slot_decrease_axis @@ -1353,20 +1352,17 @@ int input_get_default_joystick(struct uae_input_device* uid, const int num, int } } - // - // ASSIGN ALL INPUT EVENT ACTIONS, EITHER CUSTOM OR DEFAULT // // set up a temporary control layout/ called 'thismap' struct joypad_map_layout thismap[4]; - // here, we will fill thismap with defaults, if a custom value is not set. // this will do a lot of the 'logic' of the original code. thismap[0] = currprefs.jports[port].amiberry_custom_none; // grab the 'no selection' options for the current map - // directions + // directions if (port < 2) // ports 0, 1 ... { @@ -1561,11 +1557,11 @@ int input_get_default_joystick(struct uae_input_device* uid, const int num, int thismap[1] = currprefs.jports[port].amiberry_custom_hotkey; // grab the 'select button' options for the current map - // currently disabled - // thismap[2] = currprefs.jports[port].amiberry_custom_left_trigger; // grab the 'left trigger' options for the current map - // thismap[3] = currprefs.jports[port].amiberry_custom_right_trigger; // grab the 'right trigger' options for the current map + // currently disabled + // thismap[2] = currprefs.jports[port].amiberry_custom_left_trigger; // grab the 'left trigger' options for the current map + // thismap[3] = currprefs.jports[port].amiberry_custom_right_trigger; // grab the 'right trigger' options for the current map - // Now assign the actual buttons VALUES (TRUE/FALSE) to trigger the EVENTS + // Now assign the actual buttons VALUES (TRUE/FALSE) to trigger the EVENTS auto function_offset = 0; diff --git a/src/osdep/gui/PanelCustom.cpp b/src/osdep/gui/PanelCustom.cpp index d1d43173..e6313dd4 100644 --- a/src/osdep/gui/PanelCustom.cpp +++ b/src/osdep/gui/PanelCustom.cpp @@ -160,50 +160,32 @@ public: void action(const gcn::ActionEvent& actionEvent) override { if (actionEvent.getSource() == optPort0) - { SelectedPort = 0; - } else if (actionEvent.getSource() == optPort1) - { SelectedPort = 1; - } else if (actionEvent.getSource() == optPort2) - { SelectedPort = 2; - } else if (actionEvent.getSource() == optPort3) - { SelectedPort = 3; - } else if (actionEvent.getSource() == optMultiNone) - { SelectedFunction = 0; - } else if (actionEvent.getSource() == optMultiSelect) - { SelectedFunction = 1; - } else if (actionEvent.getSource() == optMultiLeft) - { SelectedFunction = 2; - } else if (actionEvent.getSource() == optMultiRight) - { SelectedFunction = 3; - } - - else if (actionEvent.getSource() == chkAnalogRemap) - changed_prefs.input_analog_remap = chkAnalogRemap->isSelected(); - + else if (actionEvent.getSource() == chkAnalogRemap) + changed_prefs.input_analog_remap = chkAnalogRemap->isSelected(); + RefreshPanelCustom(); } }; static GroupActionListener* grpActionListener; - class CustomActionListener : public gcn::ActionListener { public: @@ -330,7 +312,6 @@ public: break; } - // and here, we will scroll through the custom-map and // push it into the currprefs config file @@ -394,7 +375,7 @@ void InitPanelCustom(const struct _ConfigCategory& category) chkAnalogRemap = new gcn::UaeCheckBox("Remap DPad to left axis"); chkAnalogRemap->setId("chkAnalogRemap"); chkAnalogRemap->addActionListener(grpActionListener); - chkAnalogRemap->setEnabled(true); + chkAnalogRemap->setEnabled(true); grpPort = new gcn::Window("Joystick Port"); grpPort->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); @@ -506,15 +487,14 @@ void ExitPanelCustom() delete optMultiLeft; delete optMultiRight; delete grpFunction; - delete chkAnalogRemap; + delete chkAnalogRemap; for (auto & i : lblCustomAction) { delete i; - // delete cboCustomAction[i]; + //delete cboCustomAction[i]; } - delete lblPortInput; delete txtPortInput; delete lblRetroarch;