From 99e13859edd307a4778d7a3a28bb4ff998f3f80c Mon Sep 17 00:00:00 2001 From: Horace And The Spider Date: Wed, 15 May 2019 07:50:42 +0100 Subject: [PATCH 1/2] AXIS / DPAD Controls bugfix (#480) * Bugfix for 2nd controller selection * ignore netbeans project * Add experimental `-autocd=` loading of files (.cue works very well - .iso should also) * CD Autoloading adapted to include .uae file check and hostconf controller options * Beginning of Booter Panel implentation * Booter Panel development .. start on XML reading for picked LHA file * New WHDLoad booter, included updated boot-data.zip, plus new hostprefs FIXED_HEIGHT= option and bugfixes for XML reading, and symlink ROM scan. Plus updated XML * Upload of .RTB files that need to accompany the Symlinked Kickstarts, for WHDLoad compatibility. * Allows for additional libraries from `boot-data.zip` to be linked on load, to aid compatibility (e.g. Dungeon Master), plus new XML * Fix hardware settings tab issues from XML reading, plus additional write_log reports for debugging WHD booter. * Code cleanup (non-essential) * XML Download button added to paths panel including date checking * WHDLoad local copy * Updated button to download WHDLoad and .RTB files (if not present) with XML file. * Creates a 'fall back' for the WHDLoad file if not present - should fix issues with RetroPie install not correctly providing this file. * Fixes bug in D-pad / AXIS handling --- src/osdep/amiberry_input.cpp | 75 ++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 33 deletions(-) diff --git a/src/osdep/amiberry_input.cpp b/src/osdep/amiberry_input.cpp index 56f513dd..0d74ff95 100644 --- a/src/osdep/amiberry_input.cpp +++ b/src/osdep/amiberry_input.cpp @@ -531,7 +531,7 @@ int find_retroarch(const TCHAR* find_setting, char* retroarch_file, host_input_b std::string line; std::string delimiter = " = "; - auto tempbutton = -1; + auto tempbutton = 0; // read each line in while (std::getline(readFile, line)) @@ -552,30 +552,38 @@ int find_retroarch(const TCHAR* find_setting, char* retroarch_file, host_input_b param.erase(param.length() - 1, 1); // time to get the output number - if (param.at(0) != 'h') // check it isnt some kind of hat starting 'h' (so if D-pad uses buttons) - tempbutton = abs(atol(param.c_str())); + if (param.find("h") != 0) // check it isnt some kind of hat starting 'h' (so if D-pad uses buttons) + { tempbutton = abs(atol(param.c_str())); + } + else + { + tempbutton = -1; + } + // gets the parameter - // this will need something separate to pull out the number of hats - // use SET_BIT on hX numbers - - if (strncmp(find_setting, "count_hats", 11) == 0 && param.at(0) == 'h') - { - if (param.at(1) == '0') { SET_BIT(tempbutton, 0); } - if (param.at(1) == '1') { SET_BIT(tempbutton, 1); } - if (param.at(1) == '2') { SET_BIT(tempbutton, 2); } - if (param.at(1) == '3') { SET_BIT(tempbutton, 3); } - } + if (strncmp(find_setting, "count_hats", 10) == 0 && param.find("h0") == 0) + { + tempbutton = 1; + break; + } + //else if (param.find("h0") == 0) + //{ + + //} // ok, this is the 'normal' storing of values if (option == find_setting) break; - if (strncmp(find_setting, "count_hats", 11) != 0) - tempbutton = -1; + // ignore anthing that isnt our special case(s), and keep looping + //if (strncmp(find_setting, "count_hats", 10) != 0) + // tempbutton = -1; } } + write_log("Controller Detection: %s : %d\n",find_setting,tempbutton); + return tempbutton; } @@ -713,6 +721,8 @@ static int init_joystick(void) { struct host_keyboard_button temp_keyboard_buttons{}; + + auto tempkey = find_retroarch_key("input_player1_y", retroarch_file); auto x = find_string_in_array(remap_key_map_list_strings, remap_key_map_list_size, tempkey); temp_keyboard_buttons.north_button = remap_key_map_list[x]; @@ -804,10 +814,9 @@ static int init_joystick(void) if (SDL_JoystickNameForIndex(cpt) != nullptr) strncpy(joystick_name[cpt], SDL_JoystickNameForIndex(cpt), sizeof joystick_name[cpt] - 1); #endif - else - sprintf(joystick_name[cpt], "Joystick%d", cpt); - - // printf("Real Name >>%s<<\n",joystick_name[cpt]); + //else + //sprintf(joystick_name[cpt], "Joystick%d", cpt); + write_log("Controller Detection for Device: %s \n",joystick_name[cpt]); //this now uses controllers path (in tmp) char control_config[255]; @@ -906,22 +915,22 @@ static int init_joystick(void) 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); + 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 + + write_log("Controller Detection: invert left y axis: %d\n",host_input_buttons[cpt].lstick_axis_y_invert); + write_log("Controller Detection: invert left x axis: %d\n",host_input_buttons[cpt].lstick_axis_x_invert); + write_log("Controller Detection: invert right y axis: %d\n",host_input_buttons[cpt].rstick_axis_y_invert); + write_log("Controller Detection: invert right x axis: %d\n",host_input_buttons[cpt].rstick_axis_x_invert); + //input_state_slot_increase_axis + + //input_state_slot_decrease_axis - //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 } // end of .cfg file found else // do manual checks if there is no .cfg From b723e47ad822647bd8ec8c2eb7c6ad0f1ef18453 Mon Sep 17 00:00:00 2001 From: Horace And The Spider Date: Mon, 10 Jun 2019 07:58:41 +0100 Subject: [PATCH 2/2] Screen Width/CD32 specific changes etc (#485) * Bugfix for 2nd controller selection * ignore netbeans project * Add experimental `-autocd=` loading of files (.cue works very well - .iso should also) * CD Autoloading adapted to include .uae file check and hostconf controller options * Beginning of Booter Panel implentation * Booter Panel development .. start on XML reading for picked LHA file * New WHDLoad booter, included updated boot-data.zip, plus new hostprefs FIXED_HEIGHT= option and bugfixes for XML reading, and symlink ROM scan. Plus updated XML * Upload of .RTB files that need to accompany the Symlinked Kickstarts, for WHDLoad compatibility. * Allows for additional libraries from `boot-data.zip` to be linked on load, to aid compatibility (e.g. Dungeon Master), plus new XML * Fix hardware settings tab issues from XML reading, plus additional write_log reports for debugging WHD booter. * Code cleanup (non-essential) * XML Download button added to paths panel including date checking * WHDLoad local copy * Updated button to download WHDLoad and .RTB files (if not present) with XML file. * Creates a 'fall back' for the WHDLoad file if not present - should fix issues with RetroPie install not correctly providing this file. * Fixes bug in D-pad / AXIS handling * bugfix for sprites in whd game prefs, plus added screen widths. * Download of `boot-data.zip` does not appear to be in the latest branch * new hostprefs options: Fixed width, and fixed width/height for CD32 autobooter --- src/osdep/amiberry_whdbooter.cpp | 71 +++++++++++++++++++++++++++++++- src/osdep/gui/PanelPaths.cpp | 12 +++++- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/src/osdep/amiberry_whdbooter.cpp b/src/osdep/amiberry_whdbooter.cpp index 5f05fb0a..a71d8d41 100644 --- a/src/osdep/amiberry_whdbooter.cpp +++ b/src/osdep/amiberry_whdbooter.cpp @@ -49,6 +49,7 @@ struct game_options TCHAR cpu_24bit[256] = "nul\0"; TCHAR sprites[256] = "nul\0"; TCHAR scr_height[256] = "nul\0"; + TCHAR scr_width[256] = "nul\0"; TCHAR y_offset[256] = "nul\0"; TCHAR ntsc[256] = "nul\0"; TCHAR chip[256] = "nul\0"; @@ -77,6 +78,9 @@ struct host_options TCHAR aspect_ratio[256] = "nul\0"; TCHAR line_double[256] = "nul\0"; TCHAR fixed_height[256] = "nul\0"; + TCHAR fixed_width[256] = "nul\0"; + TCHAR fixed_cd32_height[256] = "nul\0"; + TCHAR fixed_cd32_width[256] = "nul\0"; }; static xmlNode* get_node(xmlNode* node, const char* name) @@ -238,6 +242,7 @@ struct game_options get_game_settings(char* HW) strcpy(output_detail.cpu_comp, find_whdload_game_option("CPU_COMPATIBLE", HW).c_str()); strcpy(output_detail.sprites, find_whdload_game_option("SPRITES", HW).c_str()); strcpy(output_detail.scr_height, find_whdload_game_option("SCREEN_HEIGHT", HW).c_str()); + strcpy(output_detail.scr_width, find_whdload_game_option("SCREEN_WIDTH", HW).c_str()); strcpy(output_detail.y_offset, find_whdload_game_option("SCREEN_Y_OFFSET", HW).c_str()); strcpy(output_detail.ntsc, find_whdload_game_option("NTSC", HW).c_str()); strcpy(output_detail.fast, find_whdload_game_option("FAST_RAM", HW).c_str()); @@ -268,7 +273,10 @@ struct host_options get_host_settings(char* HW) strcpy(output_detail.frameskip, find_whdload_game_option("FRAMESKIP", HW).c_str()); strcpy(output_detail.line_double, find_whdload_game_option("LINE_DOUBLING", HW).c_str()); strcpy(output_detail.fixed_height, find_whdload_game_option("FIXED_HEIGHT", HW).c_str()); - + strcpy(output_detail.fixed_width, find_whdload_game_option("FIXED_WIDTH", HW).c_str()); + strcpy(output_detail.fixed_cd32_height, find_whdload_game_option("FIXED_CD32_HEIGHT", HW).c_str()); + strcpy(output_detail.fixed_cd32_width, find_whdload_game_option("FIXED_CD32_WIDTH", HW).c_str()); + return output_detail; } @@ -415,6 +423,17 @@ void cd_auto_prefs(struct uae_prefs* p, char* filepath) host_detail = get_host_settings(hardware_settings); } + + write_log("AutoBooter - Host: Controller 1 : %s \n", host_detail.controller1); + write_log("AutoBooter - Host: Controller 2 : %s \n", host_detail.controller2); + write_log("AutoBooter - Host: Controller 3 : %s \n", host_detail.controller3); + write_log("AutoBooter - Host: Controller 4 : %s \n", host_detail.controller4); + write_log("AutoBooter - Host: Mouse 1 : %s \n", host_detail.mouse1); + write_log("AutoBooter - Host: Mouse 2 : %s \n", host_detail.mouse2); + write_log("AutoBooter - Host: Fixed CD32 Hei't: %s \n", host_detail.fixed_cd32_height); + write_log("AutoBooter - Host: Fixed CD32 Width: %s \n", host_detail.fixed_cd32_width); + + // // *** EMULATED HARDWARE *** // @@ -509,6 +528,29 @@ void cd_auto_prefs(struct uae_prefs* p, char* filepath) _stprintf(txt2, "%s=joy1", _T("joyport1")); cfgfile_parse_line(p, txt2, 0); } + + + if (strcmpi(host_detail.fixed_cd32_height, "nul") != 0) + { + _stprintf(txt2, "gfx_height=%s", host_detail.fixed_cd32_height); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_height_windowed=%s", host_detail.fixed_cd32_height); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_height_fullscreen=%s", host_detail.fixed_cd32_height); + cfgfile_parse_line(p, txt2, 0); + } + + if (strcmpi(host_detail.fixed_cd32_width, "nul") != 0) + { + _stprintf(txt2, "gfx_width=%s", host_detail.fixed_cd32_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_windowed=%s", host_detail.fixed_cd32_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_fullscreen=%s", host_detail.fixed_cd32_width); + cfgfile_parse_line(p, txt2, 0); + } + + } @@ -796,7 +838,9 @@ void whdload_auto_prefs(struct uae_prefs* p, char* filepath) write_log("WHDBooter - Game: Chipset : %s \n", game_detail.chipset); write_log("WHDBooter - Game: JIT : %s \n", game_detail.jit); write_log("WHDBooter - Game: CPU Compat : %s \n", game_detail.cpu_comp); + write_log("WHDBooter - Game: Sprite Col : %s \n", game_detail.sprites); write_log("WHDBooter - Game: Scr Height : %s \n", game_detail.scr_height); + write_log("WHDBooter - Game: Scr Width : %s \n", game_detail.scr_width); write_log("WHDBooter - Game: Scr YOffset: %s \n", game_detail.y_offset); write_log("WHDBooter - Game: NTSC : %s \n", game_detail.ntsc); write_log("WHDBooter - Game: Fast Ram : %s \n", game_detail.fast); @@ -821,6 +865,10 @@ void whdload_auto_prefs(struct uae_prefs* p, char* filepath) //printf("aspect: %s \n", host_detail.aspect_ratio); //printf("frames: %s \n", host_detail.frameskip); write_log("WHDBooter - Host: Fixed Height : %s \n", host_detail.fixed_height); + write_log("WHDBooter - Host: Fixed Width : %s \n", host_detail.fixed_width); + write_log("WHDBooter - Host: Fixed CD32 Hei't: %s \n", host_detail.fixed_cd32_height); + write_log("WHDBooter - Host: Fixed CD32 Width: %s \n", host_detail.fixed_cd32_width); + // // *** EMULATED HARDWARE *** // @@ -1245,6 +1293,25 @@ void whdload_auto_prefs(struct uae_prefs* p, char* filepath) cfgfile_parse_line(p, txt2, 0); } + if (strcmpi(host_detail.fixed_width, "nul") != 0) + { + _stprintf(txt2, "gfx_width=%s", host_detail.fixed_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_windowed=%s", host_detail.fixed_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_fullscreen=%s", host_detail.fixed_width); + cfgfile_parse_line(p, txt2, 0); + } + else if (strcmpi(game_detail.scr_width, "nul") != 0) + { + _stprintf(txt2, "gfx_width=%s", game_detail.scr_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_windowed=%s", game_detail.scr_width); + cfgfile_parse_line(p, txt2, 0); + _stprintf(txt2, "gfx_width_fullscreen=%s", game_detail.scr_width); + cfgfile_parse_line(p, txt2, 0); + } + // Y OFFSET if (strcmpi(game_detail.y_offset, "nul") != 0) { @@ -1253,7 +1320,7 @@ void whdload_auto_prefs(struct uae_prefs* p, char* filepath) } // SPRITE COLLISION - if (strcmpi(game_detail.scr_height, "nul") != 0) + if (strcmpi(game_detail.sprites, "nul") != 0) { _stprintf(txt2, "collision_level=%s", game_detail.sprites); cfgfile_parse_line(p, txt2, 0); diff --git a/src/osdep/gui/PanelPaths.cpp b/src/osdep/gui/PanelPaths.cpp index 7266b2bd..3bf3018c 100644 --- a/src/osdep/gui/PanelPaths.cpp +++ b/src/osdep/gui/PanelPaths.cpp @@ -206,12 +206,20 @@ public: { auto afile = popen(download_command, "r"); pclose(afile); } + + // download boot-data.zip + snprintf(xml_path, MAX_DPATH, "%s/whdboot/boot-data.zip", start_path_data); + snprintf(download_command, MAX_DPATH, "wget -np -nv -O %s https://github.com/midwan/amiberry/blob/master/whdboot/boot-data.zip?raw=true",xml_path); + if (!zfile_exists(xml_path)) // ?? + { auto afile = popen(download_command, "r"); + pclose(afile); + } // download kickstart RTB files for maximum compatibility snprintf(xml_path, MAX_DPATH, "kick33180.A500.RTB"); download_rtb(xml_path); - snprintf(xml_path, MAX_DPATH, "kick33192.A500.RTB"); - download_rtb(xml_path); + //snprintf(xml_path, MAX_DPATH, "kick33192.A500.RTB"); + //download_rtb(xml_path); snprintf(xml_path, MAX_DPATH, "kick34005.A500.RTB"); download_rtb(xml_path); snprintf(xml_path, MAX_DPATH, "kick40063.A600.RTB");