gp2x+wiz binary support, wiz code wip
[libpicofe.git] / common / emu.c
index 542abf5..5f18dd0 100644 (file)
@@ -5,7 +5,6 @@
 \r
 #include <stdio.h>\r
 #include <stdlib.h>\r
-#include <ctype.h> // tolower\r
 #ifndef NO_SYNC\r
 #include <unistd.h>\r
 #endif\r
@@ -47,12 +46,13 @@ unsigned char *movie_data = NULL;
 static int movie_size = 0;\r
 \r
 \r
-// utilities\r
+/* don't use tolower() for easy old glibc binary compatibility */\r
 static void strlwr_(char *string)\r
 {\r
        char *p;\r
        for (p = string; *p; p++)\r
-               *p = (char)tolower(*p);\r
+               if ('A' <= *p && *p <= 'Z')\r
+                       *p += 'a' - 'A';\r
 }\r
 \r
 static int try_rfn_cut(char *fname)\r
@@ -621,17 +621,21 @@ int emu_ReadConfig(int game, int no_defaults)
                }\r
        }\r
 \r
+       plat_validate_config();\r
+\r
        // some sanity checks\r
-       if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;\r
 #ifdef PSP\r
+       /* TODO: mv to plat_validate_config() */\r
+       if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;\r
        if (currentConfig.gamma < -4 || currentConfig.gamma >  16) currentConfig.gamma = 0;\r
        if (currentConfig.gamma2 < 0 || currentConfig.gamma2 > 2)  currentConfig.gamma2 = 0;\r
-#else\r
-       if (currentConfig.gamma < 10 || currentConfig.gamma > 300) currentConfig.gamma = 100;\r
 #endif\r
-       if (currentConfig.volume < 0 || currentConfig.volume > 99) currentConfig.volume = 50;\r
+       if (currentConfig.volume < 0 || currentConfig.volume > 99)\r
+               currentConfig.volume = 50;\r
+\r
+       if (ret == 0)\r
+               config_slot_current = config_slot;\r
 \r
-       if (ret == 0) config_slot_current = config_slot;\r
        return (ret == 0);\r
 }\r
 \r