aboutsummaryrefslogtreecommitdiff
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/common/menu.c18
-rw-r--r--frontend/menu.c19
2 files changed, 20 insertions, 17 deletions
diff --git a/frontend/common/menu.c b/frontend/common/menu.c
index 5f97730..a571ddd 100644
--- a/frontend/common/menu.c
+++ b/frontend/common/menu.c
@@ -729,22 +729,6 @@ static void do_delete(const char *fpath, const char *fname)
// -------------- ROM selector --------------
-// rrrr rggg gggb bbbb
-static unsigned short file2color(const char *fname)
-{
- const char *ext = fname + strlen(fname) - 3;
- static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso", "cso", "cue" };
- static const char *other_exts[] = { "gmv", "pat" };
- int i;
-
- if (ext < fname) ext = fname;
- for (i = 0; i < array_size(rom_exts); i++)
- if (strcasecmp(ext, rom_exts[i]) == 0) return 0xbdff; // FIXME: mk defines
- for (i = 0; i < array_size(other_exts); i++)
- if (strcasecmp(ext, other_exts[i]) == 0) return 0xaff5;
- return 0xffff;
-}
-
static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
{
int max_cnt, start, i, x, pos;
@@ -773,7 +757,7 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6);
smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6);
} else {
- unsigned short color = file2color(namelist[i+1]->d_name);
+ unsigned short color = fname2color(namelist[i+1]->d_name);
smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color);
}
}
diff --git a/frontend/menu.c b/frontend/menu.c
index 1b7418b..3559f55 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -125,6 +125,25 @@ static int menu_load_config(int is_game)
return 0;
}
+// rrrr rggg gggb bbbb
+static unsigned short fname2color(const char *fname)
+{
+ static const char *cdimg_exts[] = { ".bin", ".img", ".iso", ".z" };
+ static const char *other_exts[] = { ".cue", ".ccd", ".sub", ".table" };
+ const char *ext = strrchr(fname, '.');
+ int i;
+
+ if (ext == NULL)
+ return 0xffff;
+ for (i = 0; i < array_size(cdimg_exts); i++)
+ if (strcasecmp(ext, cdimg_exts[i]) == 0)
+ return 0x7bff;
+ for (i = 0; i < array_size(other_exts); i++)
+ if (strcasecmp(ext, other_exts[i]) == 0)
+ return 0xa514;
+ return 0xffff;
+}
+
#define menu_init menu_init_common
#include "common/menu.c"
#undef menu_init