Skip to content

Commit

Permalink
fix mounting hd dirs and fix widescreen load menu
Browse files Browse the repository at this point in the history
  • Loading branch information
rsn8887 committed Feb 13, 2019
1 parent cf9ee48 commit d35b83d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/gp2x/menu/menu.cpp
Expand Up @@ -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;
}
}
Expand Down
9 changes: 3 additions & 6 deletions src/gp2x/menu/menu_config.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -1921,5 +1919,4 @@ void loadconfig(int general)
}
UpdateMemorySettings();
set_joyConf();
reset_hdConf();
}
70 changes: 37 additions & 33 deletions src/gp2x/menu/menu_load.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
7 changes: 0 additions & 7 deletions src/gp2x/menu/menu_memory_disk.cpp
Expand Up @@ -62,7 +62,6 @@ enum {
};

extern char currentDir[300];
extern void reset_hdConf();

static void draw_memDiskMenu(int c)
{
Expand Down Expand Up @@ -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:
Expand All @@ -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);
}
Expand All @@ -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:
Expand Down
7 changes: 1 addition & 6 deletions src/main.cpp
Expand Up @@ -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
Expand Down

0 comments on commit d35b83d

Please sign in to comment.