menu: setup colors for file browser
[pcsx_rearmed.git] / frontend / menu.c
index cae99a3..3559f55 100644 (file)
@@ -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
@@ -526,6 +545,7 @@ const char *plat_get_credits(void)
 
 static char *romsel_run(void)
 {
+       extern void set_cd_image(const char *fname);
        char *ret;
 
        ret = menu_loop_romsel(last_selected_fname, sizeof(last_selected_fname));
@@ -535,7 +555,7 @@ static char *romsel_run(void)
        lprintf("selected file: %s\n", ret);
        ready_to_go = 0;
 
-       SetIsoFile(ret);
+       set_cd_image(ret);
        LoadPlugins();
        NetOpened = 0;
        if (OpenPlugins() == -1) {