From 0a83f8ccdd0114e5671bfdafef955713a5e811fa Mon Sep 17 00:00:00 2001 From: ekeeke31 Date: Tue, 18 May 2010 07:35:29 +0000 Subject: [PATCH] fixed ROM file selector --- source/cart_hw/ggenie.c | 1 - source/gx/fileio/file_dvd.c | 2 +- source/gx/fileio/file_fat.c | 3 +- source/gx/gui/filesel.c | 55 ++++++++++++++----------------------- 4 files changed, 23 insertions(+), 38 deletions(-) diff --git a/source/cart_hw/ggenie.c b/source/cart_hw/ggenie.c index f8360e0..37a8151 100644 --- a/source/cart_hw/ggenie.c +++ b/source/cart_hw/ggenie.c @@ -58,7 +58,6 @@ void ggenie_init(void) #ifdef LSB_FIRST /* Byteswap ROM */ - int i; uint8 temp; for(i = 0; i < 0x8000; i += 2) { diff --git a/source/gx/fileio/file_dvd.c b/source/gx/fileio/file_dvd.c index 32229cd..6e95001 100644 --- a/source/gx/fileio/file_dvd.c +++ b/source/gx/fileio/file_dvd.c @@ -227,7 +227,7 @@ void DVD_ClearDirectory(void) int DVD_UpdateDirectory(bool go_up, u64 offset, u32 length) { /* root has no parent directory */ - if (go_up && (basedir == rootdir)) + if ((basedir == rootdir) && (go_up || (offset == basedir))) return 0; /* simply update current root directory */ diff --git a/source/gx/fileio/file_fat.c b/source/gx/fileio/file_fat.c index 8b5a44c..bb041fe 100644 --- a/source/gx/fileio/file_fat.c +++ b/source/gx/fileio/file_fat.c @@ -48,7 +48,8 @@ void FAT_ClearDirectory(void) /*************************************************************************** * FAT_UpdateDirectory * - * Update FAT current root directory + * Update FAT current directory + * return zero if exiting root ***************************************************************************/ int FAT_UpdateDirectory(bool go_up, char *dirname) { diff --git a/source/gx/gui/filesel.c b/source/gx/gui/filesel.c index 9c1701e..a458e5c 100644 --- a/source/gx/gui/filesel.c +++ b/source/gx/gui/filesel.c @@ -484,12 +484,8 @@ int FileSelector(unsigned char *buffer, bool useFAT) /* ensure we are in focus area */ if (go_up || (m->selected < m->max_buttons)) { - /*** This is directory ***/ - if (filelist[selection].flags) + if (go_up || filelist[selection].flags) { - /* force going up */ - go_up = (selection == 0); - /* get new directory */ if (useFAT) ret = FAT_UpdateDirectory(go_up,filelist[selection].filename); @@ -528,41 +524,30 @@ int FileSelector(unsigned char *buffer, bool useFAT) return 0; } } - - /*** This is a file ***/ else { - /* root directory ? */ - if (go_up) - { - GUI_DeleteMenu(m); - return 0; - } + /* Load ROM file from device */ + if (useFAT) + size = FAT_LoadFile(buffer,selection); else + size = DVD_LoadFile(buffer,selection); + + /* Reload emulation */ + if (size) { - /* Load ROM file from device */ - if (useFAT) - size = FAT_LoadFile(buffer,selection); - else - size = DVD_LoadFile(buffer,selection); - - /* Reload emulation */ - if (size) - { - if (config.s_auto & 2) - slot_autosave(config.s_default,config.s_device); - reloadrom(size,filelist[selection].filename); - if (config.s_auto & 1) - slot_autoload(0,config.s_device); - if (config.s_auto & 2) - slot_autoload(config.s_default,config.s_device); - } - - /* Exit */ - GUI_MsgBoxClose(); - GUI_DeleteMenu(m); - return size; + if (config.s_auto & 2) + slot_autosave(config.s_default,config.s_device); + reloadrom(size,filelist[selection].filename); + if (config.s_auto & 1) + slot_autoload(0,config.s_device); + if (config.s_auto & 2) + slot_autoload(config.s_default,config.s_device); } + + /* Exit */ + GUI_MsgBoxClose(); + GUI_DeleteMenu(m); + return size; } } }