\r
// -------------- ROM selector --------------\r
\r
-// rrrr rggg gggb bbbb\r
-static unsigned short file2color(const char *fname)\r
-{\r
- const char *ext = fname + strlen(fname) - 3;\r
- static const char *rom_exts[] = { "zip", "bin", "smd", "gen", "iso", "cso", "cue" };\r
- static const char *other_exts[] = { "gmv", "pat" };\r
- int i;\r
-\r
- if (ext < fname) ext = fname;\r
- for (i = 0; i < array_size(rom_exts); i++)\r
- if (strcasecmp(ext, rom_exts[i]) == 0) return 0xbdff; // FIXME: mk defines\r
- for (i = 0; i < array_size(other_exts); i++)\r
- if (strcasecmp(ext, other_exts[i]) == 0) return 0xaff5;\r
- return 0xffff;\r
-}\r
-\r
static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)\r
{\r
int max_cnt, start, i, x, pos;\r
smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6);\r
smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6);\r
} else {\r
- unsigned short color = file2color(namelist[i+1]->d_name);\r
+ unsigned short color = fname2color(namelist[i+1]->d_name);\r
smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color);\r
}\r
}\r
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