if (f == NULL)\r
goto cso_failed;\r
\r
+ /* we use our own buffering */\r
+ setvbuf(f, NULL, _IONBF, 0);\r
+\r
cso = malloc(sizeof(*cso));\r
if (cso == NULL)\r
goto cso_failed;\r
val1 = iram_context_map[(val>>1)&0x3f];
if (val1 == 0) {
- printf("val: %02x PC=%04x\n", (val>>1)&0x3f, rPC);
+ elprintf(EL_ANOMALY, "svp: iram ctx val: %02x PC=%04x\n", (val>>1)&0x3f, rPC);
//debug_dump2file(name, svp->iram_rom, 0x800);
- exit(1);
+ //exit(1);
}
-// elprintf(EL_ANOMALY, "iram_context: %02i", val1);
return val1;
}
void tr_unhandled(void)
{
- FILE *f = fopen("tcache.bin", "wb");
- fwrite(tcache, 1, (tcache_ptr - tcache)*4, f);
- fclose(f);
- printf("unhandled @ %04x\n", known_regs.gr[SSP_PC].h<<1);
- exit(1);
+ //FILE *f = fopen("tcache.bin", "wb");
+ //fwrite(tcache, 1, (tcache_ptr - tcache)*4, f);
+ //fclose(f);
+ elprintf(EL_ANOMALY, "unhandled @ %04x\n", known_regs.gr[SSP_PC].h<<1);
+ //exit(1);
}
/* update P, if needed. Trashes r0 */
EOP_STR_IMM(1,7,0x400+SSP_PMC*4);
if (known_regs.emu_status & (SSP_PMC_SET|SSP_PMC_HAVE_ADDR)) {
- printf("!! SSP_PMC_SET|SSP_PMC_HAVE_ADDR set on flush\n");
+ elprintf(EL_ANOMALY, "!! SSP_PMC_SET|SSP_PMC_HAVE_ADDR set on flush\n");
tr_unhandled();
}
}
EOP_TST_IMM(6, 0, 8);
return f ? A_COND_NE : A_COND_EQ;
default:
- printf("unimplemented cond?\n");
+ elprintf(EL_ANOMALY, "unimplemented cond?\n");
tr_unhandled();
return 0;
}
static int tr_neg_cond(int cond)
{
switch (cond) {
- case A_COND_AL: printf("neg for AL?\n"); exit(1);
+ case A_COND_AL: elprintf(EL_ANOMALY, "neg for AL?\n"); exit(1);
case A_COND_EQ: return A_COND_NE;
case A_COND_NE: return A_COND_EQ;
case A_COND_MI: return A_COND_PL;
case A_COND_PL: return A_COND_MI;
- default: printf("bad cond for neg\n"); exit(1);
+ default: elprintf(EL_ANOMALY, "bad cond for neg\n"); exit(1);
}
return 0;
}
*/
static void emit_block_epilogue(int cycles, int cond, int pc, int end_pc)
{
- if (cycles > 0xff) { printf("large cycle count: %i\n", cycles); cycles = 0xff; }
+ if (cycles > 0xff) { elprintf(EL_ANOMALY, "large cycle count: %i\n", cycles); cycles = 0xff; }
EOP_SUB_IMM(11,11,0,cycles); // sub r11, r11, #cycles
if (cond < 0 || (end_pc >= 0x400 && pc < 0x400)) {
unsigned int *block_start;
int ret, end_cond = A_COND_AL, jump_pc = -1;
- printf("translate %04x -> %04x\n", pc<<1, (tcache_ptr-tcache)<<2);
+ //printf("translate %04x -> %04x\n", pc<<1, (tcache_ptr-tcache)<<2);
block_start = tcache_ptr;
known_regb = 0;
dirty_regb = KRREG_P;
ret = translate_op(op, &pc, imm, &end_cond, &jump_pc);
if (ret <= 0)
{
- printf("NULL func! op=%08x (%02x)\n", op, op1);
- exit(1);
+ elprintf(EL_ANOMALY, "NULL func! op=%08x (%02x)\n", op, op1);
+ //exit(1);
}
ccount += ret & 0xffff;
emit_block_epilogue(ccount, end_cond, jump_pc, pc);
if (tcache_ptr - tcache > SSP_TCACHE_SIZE/4) {
- printf("tcache overflow!\n");
+ elprintf(EL_ANOMALY, "tcache overflow!\n");
fflush(stdout);
exit(1);
}
// stats
nblocks++;
- printf("%i blocks, %i bytes, k=%.3f\n", nblocks, (tcache_ptr - tcache)*4,
- (double)(tcache_ptr - tcache) / (double)n_in_ops);
+ //printf("%i blocks, %i bytes, k=%.3f\n", nblocks, (tcache_ptr - tcache)*4,
+ // (double)(tcache_ptr - tcache) / (double)n_in_ops);
#ifdef DUMP_BLOCK
{
void ssp1601_dyn_reset(ssp1601_t *ssp)
{
- // debug
- {
- int i, u;
- FILE *f = fopen("tcache.bin", "wb");
- fwrite(tcache, 1, (tcache_ptr - tcache)*4, f);
- fclose(f);
-
- for (i = 0; i < 0x5090/2; i++)
- if (ssp_block_table[i])
- printf("%06x -> __:%04x\n", (ssp_block_table[i] - tcache)*4, i<<1);
- for (u = 1; u < 15; u++)
- for (i = 0; i < 0x800/2; i++)
- if (ssp_block_table_iram[u][i])
- printf("%06x -> %02i:%04x\n", (ssp_block_table_iram[u][i] - tcache)*4, u, i<<1);
- }
-
ssp1601_reset(ssp);
ssp->drc.iram_dirty = 1;
ssp->drc.iram_context = 0;
because they monitor state of this audio chip.\r
\r
@@2. "ReadAhead buffer"\r
-#ifdef GP2X\r
-This option is for dealing with slow SD card access in GP2X, which makes FMV\r
-games unplayable. It will allow emulator not to access SD card for longer periods\r
-of time, but it will take more time to fill the buffer.\r
-#endif\r
-#ifdef GIZ\r
-This option can prefetch more data from the CD then read by the game - not really\r
-useful for Gizmondo (this is a workaround for SD access problems on GP2X port).\r
+This option can prefetch more data from the CD image then requested by game\r
+(to avoid accessing card later), what can improve performance in some cases.\r
+#ifndef PSP\r
+"OFF" is the recommended setting.\r
#endif\r
\r
@@2. "Save RAM cart"\r
* A_SN for his gamma code.\r
* craigix for supplying the GP2X hardware and making this port possible.\r
* Alex for the icon.\r
+* Exophase and Rokas for various ideas.\r
* All the people from gp32x boards for their support.\r
#endif\r
#ifdef GIZ\r
---------\r
1.40\r
+ Added support for SVP (Sega Virtua Processor) to emulate Virtua Racing,\r
- wrote ARM recompiler and some HLE code for VR.\r
+ wrote ARM recompiler and some HLE code for VR. Credits to Exophase and\r
+ Rokas for various ideas.\r
* Changed config file format, files are now human-readable. Game specific\r
configs are now held in single file (but old game config files are still\r
- read).\r
+ read when new one is missing).\r
* Fixed a bug where some key combos didn't work as expected.\r
* Fixed a regression in renderer (some graphic glitches in rare cases).\r
- * Adjusted fast rernderer to work with more games, including VR.\r
+ * Adjusted fast renderer to work with more games, including VR.\r
* Fixed a problem where SegaCD RAM cart data was getting lost on reset.\r
+ * Greatly reduced SegaCD FMV game slowdowns by disabling read-ahead in the\r
+ Linux kernel and C library (thanks to Rokas and Exophase for ideas again).\r
+ Be sure to keep "ReadAhead buffer" OFF to avoid slowdowns.\r
+ + PicoDrive now comes with a game config file for some games which need\r
+ special settings, so they should now work out-of-the-box. More games will\r
+ be added with later updates.\r
\r
1.35b\r
* PSP: mp3 code should no longer fail on 1.5 firmware.\r
strlwr_(ext);\r
}\r
\r
-char *biosfiles_us[] = { "us_scd2_9306", "SegaCDBIOS9303", "us_scd1_9210" };\r
-char *biosfiles_eu[] = { "eu_mcd2_9306", "eu_mcd2_9303", "eu_mcd1_9210" };\r
+char *biosfiles_us[] = { "us_scd1_9210", "us_scd2_9306", "SegaCDBIOS9303" };\r
+char *biosfiles_eu[] = { "eu_mcd1_9210", "eu_mcd2_9306", "eu_mcd2_9303" };\r
char *biosfiles_jp[] = { "jp_mcd1_9112", "jp_mcd1_9111" };\r
\r
int emu_findBios(int region, char **bios_file)\r
free(movie_data);\r
movie_data = 0;\r
}\r
- if (!strcmp(ext, ".gmv")) {\r
+ if (!strcmp(ext, ".gmv"))\r
+ {\r
// check for both gmv and rom\r
int dummy;\r
FILE *movie_file = fopen(romFileName, "rb");\r
PsndRate = currentConfig.s_PsndRate;\r
PicoRegionOverride = currentConfig.s_PicoRegion;\r
PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder;\r
- PicoCDBuffers = currentConfig.s_PicoCDBuffers;\r
+ // PicoCDBuffers = currentConfig.s_PicoCDBuffers; // ignore in this case\r
}\r
}\r
else\r
selected_id == MA_CDOPT_READAHEAD) {\r
if (inp & BTN_LEFT) {\r
PicoCDBuffers >>= 1;\r
- if (PicoCDBuffers < 64) PicoCDBuffers = 0;\r
+ if (PicoCDBuffers < 2) PicoCDBuffers = 0;\r
} else {\r
- if (PicoCDBuffers < 64) PicoCDBuffers = 64;\r
+ if (PicoCDBuffers < 2) PicoCDBuffers = 2;\r
else PicoCDBuffers <<= 1;\r
if (PicoCDBuffers > 8*1024) PicoCDBuffers = 8*1024; // 16M\r
}\r
defaultConfig.s_PsndRate = 44100;\r
defaultConfig.s_PicoRegion = 0; // auto\r
defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP\r
- defaultConfig.s_PicoCDBuffers = 64;\r
+ defaultConfig.s_PicoCDBuffers = 0;\r
defaultConfig.Frameskip = -1; // auto\r
defaultConfig.CPUclock = 200;\r
defaultConfig.volume = 50;\r
--- /dev/null
+#\r
+# Sega/Mega CD games\r
+#\r
+\r
+[CD|GM MK-4432 -00|U|ADVENTURES OF BA]\r
+Scale/Rot. fx (slow) = 1\r
+Better sync (slow) = 1\r
+\r
+[CD|GM T-60055-00|U|AH3-THUNDERSTRIKE]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM MK-4401 -00|U|BATMAN RETURNS]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM T-115075-00|U|BCRACERS]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM MK-4402|U|COBRA COMMAND]\r
+Better sync (slow) = 1\r
+\r
+[CD|GM MK-4651 -00|U|DARK WIZARD]\r
+Better sync (slow) = 1\r
+\r
+[CD|GM T-121015-00|U|DRAGONS LAIR]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-60094|J|JAGUAR XJ220]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-127015-00|U|LUNAR]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM T-111065 -0|U|MAD DOG II THE LOST GOLD]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-11105 -00|U|MAD DOG MCCREE]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-81025-00|U|MORTAL KOMBAT]\r
+Renderer = 16bit accurate\r
+Better sync (slow) = 1\r
+\r
+[CD|GM T-04903-01|U|NIGHT TRAP]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-113025-00|U|NOVASTORM]\r
+Better sync (slow) = 1\r
+\r
+[CD|GM T-127035-00|U|Popful MAIL]\r
+Better sync (slow) = 1\r
+\r
+[CD|MK 4603-50|JUE|ROAD AVENGER]\r
+Renderer = 16bit accurate\r
+Better sync (slow) = 1\r
+\r
+[CD|GM T-50085|U|ROAD RASH]\r
+Renderer = 16bit accurate\r
+Better sync (slow) = 1\r
+\r
+[CD|GM MK-4416 -00|E|ROBO ALESTE]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-06201-03|U|SEWER SHARK]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM T-113045-00|E|SHADOW OF THE BEAST TWO]\r
+Renderer = 16bit accurate\r
+\r
+[CD|GM MK-4404|U|SOL-FEACE]\r
+Better sync (slow) = 1\r
+\r
+[CD|GM MK-4407-00|E|SONIC THE HEDGEHOG-CD]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM MK-4407 -00|U|SONIC THE HEDGEHOG-CD]\r
+Scale/Rot. fx (slow) = 1\r
+\r
+[CD|GM T-22025-00|U|THE 3RD WORLD WAR]\r
+Better sync (slow) = 1\r
+\r
+[CD|GM MK- 4430 -|E|YUMEMI MISTERY MANSION]\r
+Renderer = 16bit accurate\r
+\r
+#\r
+# Virtua Racing\r
+#\r
+[MD|GM MK-1229 -00|U|Virtua Racing]\r
+Renderer = 8bit fast\r
+Show FPS = 1\r
+GP2X CPU clocks = 235\r
+\r
+[MD|GM G-7001 -00|J|Virtua Racing]\r
+Renderer = 8bit fast\r
+Show FPS = 1\r
+GP2X CPU clocks = 235\r
+\r
+[MD|GM MK-1229 -00|E|Virtua Racing]\r
+Renderer = 8bit fast\r
+Show FPS = 1\r
+GP2X CPU clocks = 235\r
+\r
+[MD|GM MK-1229 -00|E|VIRTUA RACING \00\00\00\00\00\00\00\00\00]\r
+Renderer = 8bit fast\r
+Show FPS = 1\r
+GP2X CPU clocks = 235\r
+\r
+#\r
+# Genesis/MegaDrive games\r
+#\r
gp2x_memregs[0x3B48>>1] = ((yes&1) << 7) | (bank & 0x03);\r
}\r
\r
+static void proc_set(const char *path, const char *val)\r
+{\r
+ FILE *f;\r
+ char tmp[16];\r
+\r
+ f = fopen(path, "w");\r
+ if (f == NULL) {\r
+ printf("failed to open: %s\n", path);\r
+ return;\r
+ }\r
+\r
+ fprintf(f, "0\n");\r
+ fclose(f);\r
+\r
+ printf("\"%s\" is set to: ", path);\r
+ f = fopen(path, "r");\r
+ if (f == NULL) {\r
+ printf("(open failed)\n");\r
+ return;\r
+ }\r
+\r
+ fgets(tmp, sizeof(tmp), f);\r
+ printf("%s", tmp);\r
+ fclose(f);\r
+}\r
\r
\r
/* common */\r
/* init usb joys -GnoStiC */\r
gp2x_usbjoy_init();\r
\r
+ /* disable Linux read-ahead */\r
+ proc_set("/proc/sys/vm/max-readahead", "0\n");\r
+ proc_set("/proc/sys/vm/min-readahead", "0\n");\r
+\r
printf("exitting init()\n"); fflush(stdout);\r
}\r
\r
selected_id == MA_CDOPT_READAHEAD) {\r
if (inp & GP2X_LEFT) {\r
PicoCDBuffers >>= 1;\r
- if (PicoCDBuffers < 64) PicoCDBuffers = 0;\r
+ if (PicoCDBuffers < 2) PicoCDBuffers = 0;\r
} else {\r
- if (PicoCDBuffers < 64) PicoCDBuffers = 64;\r
+ if (PicoCDBuffers < 2) PicoCDBuffers = 2;\r
else PicoCDBuffers <<= 1;\r
if (PicoCDBuffers > 8*1024) PicoCDBuffers = 8*1024; // 16M\r
}\r
selected_id == MA_CDOPT_READAHEAD) {
if (inp & BTN_LEFT) {
PicoCDBuffers >>= 1;
- if (PicoCDBuffers < 64) PicoCDBuffers = 0;
+ if (PicoCDBuffers < 2) PicoCDBuffers = 0;
} else {
- if (PicoCDBuffers < 64) PicoCDBuffers = 64;
+ if (PicoCDBuffers < 2) PicoCDBuffers = 2;
else PicoCDBuffers <<= 1;
if (PicoCDBuffers > 8*1024) PicoCDBuffers = 8*1024; // 16M
}