X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fgp2x%2Femu.c;h=17e7028d6277b9bf25118da1d692d1c224c58f9e;hb=51a902ae2512cffdb3ac7751988c1bde4a641be4;hp=bea1569511c887437e6acd9d873b64f37f57d114;hpb=ab0607f7e4bb7cb12e6c0c18dce6f9c77ac466ad;p=picodrive.git diff --git a/platform/gp2x/emu.c b/platform/gp2x/emu.c index bea1569..17e7028 100644 --- a/platform/gp2x/emu.c +++ b/platform/gp2x/emu.c @@ -187,11 +187,11 @@ static int cd_check(char *ext, char **bios_file) } /* it seems we have a CD image here. Try to detect region and load a suitable BIOS now.. */ - fseek(cd_f, (type == 1) ? 0x100 : 0x110, SEEK_SET); + fseek(cd_f, (type == 1) ? 0x100+0x10B : 0x110+0x10B, SEEK_SET); fread(buf, 1, 1, cd_f); fclose(cd_f); - if (buf[0] == 0x64) region = 4; // EU + if (buf[0] == 0x64) region = 8; // EU if (buf[0] == 0xa1) region = 1; // JAP printf("detected %s Sega/Mega CD image with %s region\n", @@ -374,7 +374,7 @@ int emu_ReloadRom(void) } } gettimeofday(¬iceMsgTime, 0); - +printf("PicoMCD: %x\n", PicoMCD); // load SRAM for this ROM if(currentConfig.EmuOpt & 1) emu_SaveLoadGame(1, 1); @@ -452,10 +452,11 @@ int emu_ReadConfig(int game) // set default config memset(¤tConfig, 0, sizeof(currentConfig)); currentConfig.lastRomFile[0] = 0; - currentConfig.EmuOpt = 0x1f; - currentConfig.PicoOpt = 0x0f; - currentConfig.PsndRate = 22050; + currentConfig.EmuOpt = 0x1f | 0xc00; // | cd_leds | cd_cdda + currentConfig.PicoOpt = 0x0f | 0x200; // | use_940 + currentConfig.PsndRate = 44100; currentConfig.PicoRegion = 0; // auto + currentConfig.PicoAutoRgnOrder = 0x184; // US, EU, JP currentConfig.Frameskip = -1; // auto currentConfig.CPUclock = 200; currentConfig.volume = 50; @@ -490,6 +491,7 @@ int emu_ReadConfig(int game) PicoOpt = currentConfig.PicoOpt; PsndRate = currentConfig.PsndRate; PicoRegionOverride = currentConfig.PicoRegion; + PicoAutoRgnOrder = currentConfig.PicoAutoRgnOrder; if (PicoOpt & 0x20) { actionNames[ 8] = "Z"; actionNames[ 9] = "Y"; actionNames[10] = "X"; actionNames[11] = "MODE"; @@ -527,6 +529,7 @@ int emu_WriteConfig(int game) currentConfig.PicoOpt = PicoOpt; currentConfig.PsndRate = PsndRate; currentConfig.PicoRegion = PicoRegionOverride; + currentConfig.PicoAutoRgnOrder = PicoAutoRgnOrder; bwrite = fwrite(¤tConfig, 1, sizeof(currentConfig), f); fflush(f); fclose(f); @@ -586,8 +589,10 @@ void osd_text(int x, int y, char *text) static void cd_leds(void) { - static int old_reg = 0; - if (!((Pico_mcd->s68k_regs[0] ^ old_reg) & 3)) return; // no change + // mmu problems? +// static + int old_reg; +// if (!((Pico_mcd->s68k_regs[0] ^ old_reg) & 3)) return; // no change old_reg = Pico_mcd->s68k_regs[0]; if ((PicoOpt&0x10)||!(currentConfig.EmuOpt&0x80)) { @@ -1021,7 +1026,7 @@ void emu_Loop(void) if(PsndRate != PsndRate_old || (PicoOpt&0x20b) != (PicoOpt_old&0x20b) || Pico.m.pal != pal_old || crashed_940) { /* if 940 is turned off, we need it to be put back to sleep */ if (!(PicoOpt&0x200) && ((PicoOpt^PicoOpt_old)&0x200)) { - Reset940(1); + Reset940(1, 2); Pause940(1); } sound_rerate(); @@ -1229,6 +1234,7 @@ if (Pico.m.frame_count == 31563) { // save SRAM if((currentConfig.EmuOpt & 1) && SRam.changed) { + blit("", "Writing SRAM/BRAM.."); emu_SaveLoadGame(0, 1); SRam.changed = 0; } @@ -1319,14 +1325,16 @@ int emu_SaveLoadGame(int load, int sram) if( (PmovFile = gzopen(saveFname, load ? "rb" : "wb")) ) { areaRead = gzRead2; areaWrite = gzWrite2; + areaEof = (areaeof *) gzeof; if(!load) gzsetparams(PmovFile, 9, Z_DEFAULT_STRATEGY); } else saveFname[strlen(saveFname)-3] = 0; } if(!PmovFile) { // gzip failed or was disabled if( (PmovFile = fopen(saveFname, load ? "rb" : "wb")) ) { - areaRead = (STATE_SL_FUNC) fread; - areaWrite = (STATE_SL_FUNC) fwrite; + areaRead = (arearw *) fread; + areaWrite = (arearw *) fwrite; + areaEof = (areaeof *) feof; } } if(PmovFile) {