From d35b83d29f7e72dce5df50a698362bbff666fdc3 Mon Sep 17 00:00:00 2001 From: rsn8887 Date: Tue, 12 Feb 2019 23:12:04 -0600 Subject: [PATCH] fix mounting hd dirs and fix widescreen load menu --- src/gp2x/menu/menu.cpp | 2 +- src/gp2x/menu/menu_config.cpp | 9 ++-- src/gp2x/menu/menu_load.cpp | 70 ++++++++++++++++-------------- src/gp2x/menu/menu_memory_disk.cpp | 7 --- src/main.cpp | 7 +-- 5 files changed, 42 insertions(+), 53 deletions(-) diff --git a/src/gp2x/menu/menu.cpp b/src/gp2x/menu/menu.cpp index d390216..91f0ea0 100755 --- a/src/gp2x/menu/menu.cpp +++ b/src/gp2x/menu/menu.cpp @@ -729,7 +729,7 @@ void write_text_pos(int x, int y, const char * str) SDL_FillRect(text_screen, &dest, menu_barra0_color); } - if (i>42) + if (i>60) break; } } diff --git a/src/gp2x/menu/menu_config.cpp b/src/gp2x/menu/menu_config.cpp index 7962cb6..74da038 100755 --- a/src/gp2x/menu/menu_config.cpp +++ b/src/gp2x/menu/menu_config.cpp @@ -979,12 +979,10 @@ void set_joyConf() void kill_hd_configs() { //properly close all open hdf and hd dirs - if (mainMenu_filesysUnits > 0) { - for (int i=mainMenu_filesysUnits - 1; i >= 0; i--) { - kill_filesys_unit(currprefs.mountinfo, i); - } - mainMenu_filesysUnits = 0; + for (int i = 0; i < mainMenu_filesysUnits; i++) { + kill_filesys_unit(currprefs.mountinfo, 0); } + mainMenu_filesysUnits = 0; } void reset_hdConf() @@ -1921,5 +1919,4 @@ void loadconfig(int general) } UpdateMemorySettings(); set_joyConf(); - reset_hdConf(); } diff --git a/src/gp2x/menu/menu_load.cpp b/src/gp2x/menu/menu_load.cpp index a669ab3..e8b71df 100755 --- a/src/gp2x/menu/menu_load.cpp +++ b/src/gp2x/menu/menu_load.cpp @@ -48,7 +48,7 @@ extern char currentDir[300]; extern char config_load_filename[300]; extern char save_import_filename[300]; -const char *text_str_load_separator="-----------------------------------------------------"; +const char *text_str_load_separator="------------------------------------------------------"; const char *text_str_load_dir="#DIR#"; static const char *text_str_load_title="Filemanager"; int text_dir_num_files=0, text_dir_num_files_index=0; @@ -123,103 +123,107 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel) extern SDL_Surface *text_screen; text_draw_background(); // widescreen file list allows for longer filename display - r.x=80-64; r.y=0; r.w=150-24+64+64+(text_screen->w-320)/2; r.h=240; + r.x=80-64; r.y=0; r.w=150-24+64+64+(text_screen->w-320)/2+32; r.h=240; int x_win = 2 - (text_screen->w - 320) / 2 / 7; int y_win = 2; +#ifdef __PSP2__ + int w_win = 42 + (text_screen->w - 320) / 7; +#else int w_win = 41 + (text_screen->w - 320) / 7; +#endif int h_win = 25; int x_sep = 3 - (text_screen->w - 320) / 2 / 7; - int x_file = 4 - (text_screen->w - 320) / 2 / 7; + int x_file = 3 - (text_screen->w - 320) / 2 / 7; int x_dir = 38 + (text_screen->w - 320) / 2 / 7; if (menu_load_type == MENU_LOAD_HD_DIR) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Press SELECT to load HD-dir (Tri.=Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Press SELECT to load HD-dir (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Press MINUS to load HD-dir (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Press MINUS to load HD-dir (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Press L-key to load HD-dir "); + text_draw_window(x_win,y_win,w_win,h_win,"Press L-key to load HD-dir"); #endif #endif else if (menu_load_type == MENU_LOAD_HDF) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Select .HDF-file (Triangle = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .HDF-file (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Select .HDF-file (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .HDF-file (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Select .HDF-file "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .HDF-file"); #endif #endif else if (menu_load_type == MENU_LOAD_CONFIG) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Select .CONF-file (Triangle = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .CONF-file (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Select .CONF-file (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .CONF-file (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Select .CONF-file "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .CONF-file"); #endif #endif else if (menu_load_type == MENU_LOAD_DELETE_CONFIG) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Delete .CONF-file (Triangle = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .CONF-file (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Delete .CONF-file (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .CONF-file (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Delete .CONF-file "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .CONF-file"); #endif #endif else if (menu_load_type == MENU_LOAD_IMPORT_SAVE) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Select .ASF-file (Triangle = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .ASF-file (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Select .ASF-file (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .ASF-file (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Select .ASF-file "); + text_draw_window(x_win,y_win,w_win,h_win,"Select .ASF-file"); #endif #endif else if (menu_load_type == MENU_LOAD_DELETE_SAVE) #ifdef __PSP2__ - text_draw_window(x_win,y_win,w_win,h_win," Delete .ASF-file (Triangle = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .ASF-file (Triangle = Info)"); #else #ifdef __SWITCH__ - text_draw_window(x_win,y_win,w_win,h_win," Delete .ASF-file (X = Info) "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .ASF-file (X = Info)"); #else - text_draw_window(x_win,y_win,w_win,h_win," Delete .ASF-file "); + text_draw_window(x_win,y_win,w_win,h_win,"Delete .ASF-file"); #endif #endif #ifdef __PSP2__ else if (current_drive==0) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF0 (Triangle = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF0 (Triangle = Info)"); else if (current_drive==1) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF1 (Triangle = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF1 (Triangle = Info)"); else if (current_drive==2) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF2 (Triangle = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF2 (Triangle = Info)"); else if (current_drive==3) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF3 (Triangle = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF3 (Triangle = Info)"); #else #ifdef __SWITCH__ else if (current_drive==0) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF0 (X = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF0 (X = Info)"); else if (current_drive==1) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF1 (X = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF1 (X = Info)"); else if (current_drive==2) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF2 (X = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF2 (X = Info)"); else if (current_drive==3) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF3 (X = Info)"); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF3 (X = Info)"); #else else if (current_drive==0) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF0 "); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF0"); else if (current_drive==1) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF1 "); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF1"); else if (current_drive==2) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF2 "); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF2"); else if (current_drive==3) - text_draw_window(x_win,y_win,w_win,h_win," Insert .ADF or .ADZ into DF3 "); + text_draw_window(x_win,y_win,w_win,h_win,"Insert .ADF or .ADZ into DF3"); #endif #endif else diff --git a/src/gp2x/menu/menu_memory_disk.cpp b/src/gp2x/menu/menu_memory_disk.cpp index c203d86..90ac3fa 100755 --- a/src/gp2x/menu/menu_memory_disk.cpp +++ b/src/gp2x/menu/menu_memory_disk.cpp @@ -62,7 +62,6 @@ enum { }; extern char currentDir[300]; -extern void reset_hdConf(); static void draw_memDiskMenu(int c) { @@ -544,25 +543,21 @@ static int key_memDiskMenu(int *c) mainMenu_bootHD--; else mainMenu_bootHD = 2; - reset_hdConf(); } else if (right) { if (mainMenu_bootHD < 2) mainMenu_bootHD++; else mainMenu_bootHD = 0; - reset_hdConf(); } break; case MENUDISK_HDDIR: if (hit0) { if (run_menuLoad(currentDir, MENU_LOAD_HD_DIR)) { make_hard_dir_cfg_line(uae4all_hard_dir); - reset_hdConf(); loadconfig(4); } } else if (del) { uae4all_hard_dir[0] = '\0'; - reset_hdConf(); } break; case MENUDISK_HDFILE: @@ -576,7 +571,6 @@ static int key_memDiskMenu(int *c) make_hard_file_cfg_line(uae4all_hard_file2); else if (current_hdf==3) make_hard_file_cfg_line(uae4all_hard_file3); - reset_hdConf(); if (current_hdf==0) { loadconfig(2); } @@ -590,7 +584,6 @@ static int key_memDiskMenu(int *c) uae4all_hard_file2[0] = '\0'; else if (current_hdf==3) uae4all_hard_file3[0] = '\0'; - reset_hdConf(); } break; case MENUDISK_SAVEHDCONF: diff --git a/src/main.cpp b/src/main.cpp index 50afad5..66ff44d 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -182,15 +182,10 @@ void reset_all_systems (void) { init_eventtab (); memory_reset (); - filesys_reset (); - filesys_start_threads (); -#ifdef __SWITCH__ // the following is a workaround to prevent failed fdopen commands for hdf files - // because, on Switch, the same file can not be opened multiple times - reset_hdConf(); filesys_reset (); + reset_hdConf(); filesys_start_threads (); -#endif } /* Okay, this stuff looks strange, but it is here to encourage people who