}\r
\r
/* it seems we have a CD image here. Try to detect region and load a suitable BIOS now.. */\r
- fseek(cd_f, (type == 1) ? 0x100 : 0x110, SEEK_SET);\r
+ fseek(cd_f, (type == 1) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET);\r
fread(buf, 1, 1, cd_f);\r
fclose(cd_f);\r
\r
- if (buf[0] == 0x64) region = 4; // EU\r
+ if (buf[0] == 0x64) region = 8; // EU\r
if (buf[0] == 0xa1) region = 1; // JAP\r
\r
printf("detected %s Sega/Mega CD image with %s region\n",\r
}\r
}\r
gettimeofday(¬iceMsgTime, 0);\r
-\r
+printf("PicoMCD: %x\n", PicoMCD);\r
// load SRAM for this ROM\r
if(currentConfig.EmuOpt & 1)\r
emu_SaveLoadGame(1, 1);\r
// set default config\r
memset(¤tConfig, 0, sizeof(currentConfig));\r
currentConfig.lastRomFile[0] = 0;\r
- currentConfig.EmuOpt = 0x1f;\r
- currentConfig.PicoOpt = 0x0f;\r
- currentConfig.PsndRate = 22050;\r
+ currentConfig.EmuOpt = 0x1f | 0xc00; // | cd_leds | cd_cdda\r
+ currentConfig.PicoOpt = 0x0f | 0x200; // | use_940\r
+ currentConfig.PsndRate = 44100;\r
currentConfig.PicoRegion = 0; // auto\r
+ currentConfig.PicoAutoRgnOrder = 0x184; // US, EU, JP\r
currentConfig.Frameskip = -1; // auto\r
currentConfig.CPUclock = 200;\r
currentConfig.volume = 50;\r
PicoOpt = currentConfig.PicoOpt;\r
PsndRate = currentConfig.PsndRate;\r
PicoRegionOverride = currentConfig.PicoRegion;\r
+ PicoAutoRgnOrder = currentConfig.PicoAutoRgnOrder;\r
if (PicoOpt & 0x20) {\r
actionNames[ 8] = "Z"; actionNames[ 9] = "Y";\r
actionNames[10] = "X"; actionNames[11] = "MODE";\r
currentConfig.PicoOpt = PicoOpt;\r
currentConfig.PsndRate = PsndRate;\r
currentConfig.PicoRegion = PicoRegionOverride;\r
+ currentConfig.PicoAutoRgnOrder = PicoAutoRgnOrder;\r
bwrite = fwrite(¤tConfig, 1, sizeof(currentConfig), f);\r
fflush(f);\r
fclose(f);\r
\r
static void cd_leds(void)\r
{\r
- static int old_reg = 0;\r
- if (!((Pico_mcd->s68k_regs[0] ^ old_reg) & 3)) return; // no change\r
+ // mmu problems?\r
+// static\r
+ int old_reg;\r
+// if (!((Pico_mcd->s68k_regs[0] ^ old_reg) & 3)) return; // no change\r
old_reg = Pico_mcd->s68k_regs[0];\r
\r
if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) {\r
if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) {\r
/* if 940 is turned off, we need it to be put back to sleep */\r
if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) {\r
- Reset940(1);\r
+ Reset940(1, 2);\r
Pause940(1);\r
}\r
sound_rerate();\r
\r
// save SRAM\r
if((currentConfig.EmuOpt & 1) && SRam.changed) {\r
+ blit("", "Writing SRAM/BRAM..");\r
emu_SaveLoadGame(0, 1);\r
SRam.changed = 0;\r
}\r
if( (PmovFile = gzopen(saveFname, load ? "rb" : "wb")) ) {\r
areaRead = gzRead2;\r
areaWrite = gzWrite2;\r
+ areaEof = (areaeof *) gzeof;\r
if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY);\r
} else\r
saveFname[strlen(saveFname)-3] = 0;\r
}\r
if(!PmovFile) { // gzip failed or was disabled\r
if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) {\r
- areaRead = (STATE_SL_FUNC) fread;\r
- areaWrite = (STATE_SL_FUNC) fwrite;\r
+ areaRead = (arearw *) fread;\r
+ areaWrite = (arearw *) fwrite;\r
+ areaEof = (areaeof *) feof;\r
}\r
}\r
if(PmovFile) {\r