\r
#include <Pico/PicoInt.h>\r
#include <Pico/Patch.h>\r
+#include <Pico/cd/cue.h>\r
#include <zlib/zlib.h>\r
\r
#if defined(__GP2X__)\r
{\r
unsigned char buf[32];\r
pm_file *cd_f;\r
- int type = 0, region = 4; // 1: Japan, 4: US, 8: Europe\r
+ int region = 4; // 1: Japan, 4: US, 8: Europe\r
+ char ext[5], *fname = romFileName;\r
+ cue_track_type type = CT_UNKNOWN;\r
+ cue_data_t *cue_data = NULL;\r
+\r
+ get_ext(romFileName, ext);\r
+ if (strcasecmp(ext, ".cue") == 0) {\r
+ cue_data = cue_parse(romFileName);\r
+ if (cue_data != NULL) {\r
+ fname = cue_data->tracks[1].fname;\r
+ type = cue_data->tracks[1].type;\r
+ }\r
+ }\r
+\r
+ cd_f = pm_open(fname);\r
+ if (cue_data != NULL)\r
+ cue_destroy(cue_data);\r
\r
- cd_f = pm_open(romFileName);\r
if (!cd_f) return 0; // let the upper level handle this\r
\r
if (pm_read(buf, 32, cd_f) != 32) {\r
return 0;\r
}\r
\r
- if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x00, 14)) type = 1; // Sega CD (ISO)\r
- if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x10, 14)) type = 2; // Sega CD (BIN)\r
- if (type == 0) {\r
+ if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x00, 14)) {\r
+ if (type && type != CT_ISO)\r
+ elprintf(EL_STATUS, ".cue has wrong type: %i", type);\r
+ type = CT_ISO; // Sega CD (ISO)\r
+ }\r
+ if (!strncasecmp("SEGADISCSYSTEM", (char *)buf+0x10, 14)) {\r
+ if (type && type != CT_BIN)\r
+ elprintf(EL_STATUS, ".cue has wrong type: %i", type);\r
+ type = CT_BIN; // Sega CD (BIN)\r
+ }\r
+\r
+ if (type == CT_UNKNOWN) {\r
pm_close(cd_f);\r
return 0;\r
}\r
\r
- pm_seek(cd_f, (type == 1) ? 0x100 : 0x110, SEEK_SET);\r
+ pm_seek(cd_f, (type == CT_ISO) ? 0x100 : 0x110, SEEK_SET);\r
pm_read(id_header, sizeof(id_header), cd_f);\r
\r
/* it seems we have a CD image here. Try to detect region now.. */\r
- pm_seek(cd_f, (type == 1) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);\r
+ pm_seek(cd_f, (type == CT_ISO) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);\r
pm_read(buf, 1, cd_f);\r
pm_close(cd_f);\r
\r
if (buf[0] == 0xa1) region = 1; // JAP\r
\r
lprintf("detected %s Sega/Mega CD image with %s region\n",\r
- type == 2 ? "BIN" : "ISO", region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");\r
+ type == CT_BIN ? "BIN" : "ISO", region != 4 ? (region == 8 ? "EU" : "JAP") : "USA");\r
\r
if (pregion != NULL) *pregion = region;\r
\r
return type;\r
}\r
\r
-static int extract_text(char *dest, unsigned char *src, int len, int swab)\r
+static int extract_text(char *dest, const unsigned char *src, int len, int swab)\r
{\r
char *p = dest;\r
int i;\r
\r
// check for MegaCD image\r
cd_state = emu_cdCheck(&cd_region);\r
- if (cd_state > 0)\r
+ if (cd_state != CIT_NOT_CD)\r
{\r
PicoAHW |= PAHW_MCD;\r
// valid CD image, check for BIOS..\r
return 0;\r
}\r
\r
- Pico.m.frame_count = 0;\r
-\r
// insert CD if it was detected\r
- if (cd_state > 0) {\r
- ret = Insert_CD(romFileName, cd_state == 2);\r
+ if (cd_state != CIT_NOT_CD) {\r
+ ret = Insert_CD(romFileName, cd_state);\r
if (ret != 0) {\r
sprintf(menuErrorMsg, "Insert_CD() failed, invalid CD image?");\r
lprintf("%s\n", menuErrorMsg);\r
if(movie_data[0x14] == '6')\r
PicoOpt |= POPT_6BTN_PAD; // 6 button pad\r
else PicoOpt &= ~POPT_6BTN_PAD;\r
- PicoOpt |= POPT_DIS_VDP_FIFO|POPT_ACC_TIMING; // accurate timing, no VDP fifo timing\r
+ PicoOpt |= POPT_DIS_VDP_FIFO; // no VDP fifo timing\r
if(movie_data[0xF] >= 'A') {\r
if(movie_data[0x16] & 0x80) {\r
PicoRegionOverride = 8;\r
if (currentConfig.CPUclock < 10 || currentConfig.CPUclock > 4096) currentConfig.CPUclock = 200;\r
#ifdef PSP\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
}\r
}\r
\r
+#ifdef PSP\r
+#define MAX_COMBO_KEY 23\r
+#else\r
+#define MAX_COMBO_KEY 31\r
+#endif\r
+\r
void emu_findKeyBindCombos(void)\r
{\r
int act, u;\r
if (act == 16 || act == 17) continue; // player2 flag\r
if (act > 17)\r
{\r
- for (u = 0; u < 32; u++)\r
+ for (u = 0; u <= MAX_COMBO_KEY; u++)\r
if (currentConfig.KeyBinds[u] & (1 << act)) keyc++;\r
}\r
else\r
{\r
- for (u = 0; u < 32; u++)\r
+ for (u = 0; u <= MAX_COMBO_KEY; u++)\r
if ((currentConfig.KeyBinds[u] & 0x30000) == 0 && // pl. 1\r
(currentConfig.KeyBinds[u] & (1 << act))) keyc++;\r
- for (u = 0; u < 32; u++)\r
+ for (u = 0; u <= MAX_COMBO_KEY; u++)\r
if ((currentConfig.KeyBinds[u] & 0x30000) == 1 && // pl. 2\r
(currentConfig.KeyBinds[u] & (1 << act))) keyc2++;\r
if (keyc2 > keyc) keyc = keyc2;\r
if (keyc > 1)\r
{\r
// loop again and mark those keys and actions as combo\r
- for (u = 0; u < 32; u++)\r
+ for (u = 0; u <= MAX_COMBO_KEY; u++)\r
{\r
if (currentConfig.KeyBinds[u] & (1 << act)) {\r
kb_combo_keys |= 1 << u;\r