From 88bfc63d316f9a19ce6d63421757f520cb4d6df9 Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 27 Mar 2008 22:42:54 +0000 Subject: [PATCH] read-ahead turn off, cfg file, minor adjustments git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@399 be3aeb3a-fb24-0410-a615-afba39da0efa --- base_readme.txt | 26 +++++++----- common/emu.c | 9 ++-- gp2x/emu.c | 2 +- gp2x/game.cfg | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ gp2x/gp2x.c | 29 +++++++++++++ gp2x/menu.c | 4 +- psp/menu.c | 4 +- 7 files changed, 163 insertions(+), 20 deletions(-) create mode 100644 gp2x/game.cfg diff --git a/base_readme.txt b/base_readme.txt index a50f80d..3d59588 100644 --- a/base_readme.txt +++ b/base_readme.txt @@ -391,14 +391,10 @@ This enables 8 channel PCM sound source. It is required for some games to run, because they monitor state of this audio chip. @@2. "ReadAhead buffer" -#ifdef GP2X -This option is for dealing with slow SD card access in GP2X, which makes FMV -games unplayable. It will allow emulator not to access SD card for longer periods -of time, but it will take more time to fill the buffer. -#endif -#ifdef GIZ -This option can prefetch more data from the CD then read by the game - not really -useful for Gizmondo (this is a workaround for SD access problems on GP2X port). +This option can prefetch more data from the CD image then requested by game +(to avoid accessing card later), what can improve performance in some cases. +#ifndef PSP +"OFF" is the recommended setting. #endif @@2. "Save RAM cart" @@ -616,6 +612,7 @@ Additional thanks * A_SN for his gamma code. * craigix for supplying the GP2X hardware and making this port possible. * Alex for the icon. +* Exophase and Rokas for various ideas. * All the people from gp32x boards for their support. #endif #ifdef GIZ @@ -638,14 +635,21 @@ Changelog --------- 1.40 + Added support for SVP (Sega Virtua Processor) to emulate Virtua Racing, - wrote ARM recompiler and some HLE code for VR. + wrote ARM recompiler and some HLE code for VR. Credits to Exophase and + Rokas for various ideas. * Changed config file format, files are now human-readable. Game specific configs are now held in single file (but old game config files are still - read). + read when new one is missing). * Fixed a bug where some key combos didn't work as expected. * Fixed a regression in renderer (some graphic glitches in rare cases). - * Adjusted fast rernderer to work with more games, including VR. + * Adjusted fast renderer to work with more games, including VR. * Fixed a problem where SegaCD RAM cart data was getting lost on reset. + * Greatly reduced SegaCD FMV game slowdowns by disabling read-ahead in the + Linux kernel and C library (thanks to Rokas and Exophase for ideas again). + Be sure to keep "ReadAhead buffer" OFF to avoid slowdowns. + + PicoDrive now comes with a game config file for some games which need + special settings, so they should now work out-of-the-box. More games will + be added with later updates. 1.35b * PSP: mp3 code should no longer fail on 1.5 firmware. diff --git a/common/emu.c b/common/emu.c index ab17a1f..50cfd2e 100644 --- a/common/emu.c +++ b/common/emu.c @@ -89,8 +89,8 @@ static void get_ext(char *file, char *ext) strlwr_(ext); } -char *biosfiles_us[] = { "us_scd2_9306", "SegaCDBIOS9303", "us_scd1_9210" }; -char *biosfiles_eu[] = { "eu_mcd2_9306", "eu_mcd2_9303", "eu_mcd1_9210" }; +char *biosfiles_us[] = { "us_scd1_9210", "us_scd2_9306", "SegaCDBIOS9303" }; +char *biosfiles_eu[] = { "eu_mcd1_9210", "eu_mcd2_9306", "eu_mcd2_9303" }; char *biosfiles_jp[] = { "jp_mcd1_9112", "jp_mcd1_9111" }; int emu_findBios(int region, char **bios_file) @@ -278,7 +278,8 @@ int emu_ReloadRom(void) free(movie_data); movie_data = 0; } - if (!strcmp(ext, ".gmv")) { + if (!strcmp(ext, ".gmv")) + { // check for both gmv and rom int dummy; FILE *movie_file = fopen(romFileName, "rb"); @@ -544,7 +545,7 @@ int emu_ReadConfig(int game, int no_defaults) PsndRate = currentConfig.s_PsndRate; PicoRegionOverride = currentConfig.s_PicoRegion; PicoAutoRgnOrder = currentConfig.s_PicoAutoRgnOrder; - PicoCDBuffers = currentConfig.s_PicoCDBuffers; + // PicoCDBuffers = currentConfig.s_PicoCDBuffers; // ignore in this case } } else diff --git a/gp2x/emu.c b/gp2x/emu.c index 3ee96f2..e329b5a 100644 --- a/gp2x/emu.c +++ b/gp2x/emu.c @@ -141,7 +141,7 @@ void emu_prepareDefaultConfig(void) defaultConfig.s_PsndRate = 44100; defaultConfig.s_PicoRegion = 0; // auto defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP - defaultConfig.s_PicoCDBuffers = 64; + defaultConfig.s_PicoCDBuffers = 0; defaultConfig.Frameskip = -1; // auto defaultConfig.CPUclock = 200; defaultConfig.volume = 50; diff --git a/gp2x/game.cfg b/gp2x/game.cfg new file mode 100644 index 0000000..40809c8 --- /dev/null +++ b/gp2x/game.cfg @@ -0,0 +1,109 @@ +# +# Sega/Mega CD games +# + +[CD|GM MK-4432 -00|U|ADVENTURES OF BA] +Scale/Rot. fx (slow) = 1 +Better sync (slow) = 1 + +[CD|GM T-60055-00|U|AH3-THUNDERSTRIKE] +Scale/Rot. fx (slow) = 1 + +[CD|GM MK-4401 -00|U|BATMAN RETURNS] +Scale/Rot. fx (slow) = 1 + +[CD|GM T-115075-00|U|BCRACERS] +Scale/Rot. fx (slow) = 1 + +[CD|GM MK-4402|U|COBRA COMMAND] +Better sync (slow) = 1 + +[CD|GM MK-4651 -00|U|DARK WIZARD] +Better sync (slow) = 1 + +[CD|GM T-121015-00|U|DRAGONS LAIR] +Renderer = 16bit accurate + +[CD|GM T-60094|J|JAGUAR XJ220] +Renderer = 16bit accurate + +[CD|GM T-127015-00|U|LUNAR] +Scale/Rot. fx (slow) = 1 + +[CD|GM T-111065 -0|U|MAD DOG II THE LOST GOLD] +Renderer = 16bit accurate + +[CD|GM T-11105 -00|U|MAD DOG MCCREE] +Renderer = 16bit accurate + +[CD|GM T-81025-00|U|MORTAL KOMBAT] +Renderer = 16bit accurate +Better sync (slow) = 1 + +[CD|GM T-04903-01|U|NIGHT TRAP] +Renderer = 16bit accurate + +[CD|GM T-113025-00|U|NOVASTORM] +Better sync (slow) = 1 + +[CD|GM T-127035-00|U|Popful MAIL] +Better sync (slow) = 1 + +[CD|MK 4603-50|JUE|ROAD AVENGER] +Renderer = 16bit accurate +Better sync (slow) = 1 + +[CD|GM T-50085|U|ROAD RASH] +Renderer = 16bit accurate +Better sync (slow) = 1 + +[CD|GM MK-4416 -00|E|ROBO ALESTE] +Renderer = 16bit accurate + +[CD|GM T-06201-03|U|SEWER SHARK] +Renderer = 16bit accurate + +[CD|GM T-113045-00|E|SHADOW OF THE BEAST TWO] +Renderer = 16bit accurate + +[CD|GM MK-4404|U|SOL-FEACE] +Better sync (slow) = 1 + +[CD|GM MK-4407-00|E|SONIC THE HEDGEHOG-CD] +Scale/Rot. fx (slow) = 1 + +[CD|GM MK-4407 -00|U|SONIC THE HEDGEHOG-CD] +Scale/Rot. fx (slow) = 1 + +[CD|GM T-22025-00|U|THE 3RD WORLD WAR] +Better sync (slow) = 1 + +[CD|GM MK- 4430 -|E|YUMEMI MISTERY MANSION] +Renderer = 16bit accurate + +# +# Virtua Racing +# +[MD|GM MK-1229 -00|U|Virtua Racing] +Renderer = 8bit fast +Show FPS = 1 +GP2X CPU clocks = 235 + +[MD|GM G-7001 -00|J|Virtua Racing] +Renderer = 8bit fast +Show FPS = 1 +GP2X CPU clocks = 235 + +[MD|GM MK-1229 -00|E|Virtua Racing] +Renderer = 8bit fast +Show FPS = 1 +GP2X CPU clocks = 235 + +[MD|GM MK-1229 -00|E|VIRTUA RACING \00\00\00\00\00\00\00\00\00] +Renderer = 8bit fast +Show FPS = 1 +GP2X CPU clocks = 235 + +# +# Genesis/MegaDrive games +# diff --git a/gp2x/gp2x.c b/gp2x/gp2x.c index 7a5156c..6db1d41 100644 --- a/gp2x/gp2x.c +++ b/gp2x/gp2x.c @@ -284,6 +284,31 @@ void Reset940(int yes, int bank) gp2x_memregs[0x3B48>>1] = ((yes&1) << 7) | (bank & 0x03); } +static void proc_set(const char *path, const char *val) +{ + FILE *f; + char tmp[16]; + + f = fopen(path, "w"); + if (f == NULL) { + printf("failed to open: %s\n", path); + return; + } + + fprintf(f, "0\n"); + fclose(f); + + printf("\"%s\" is set to: ", path); + f = fopen(path, "r"); + if (f == NULL) { + printf("(open failed)\n"); + return; + } + + fgets(tmp, sizeof(tmp), f); + printf("%s", tmp); + fclose(f); +} /* common */ @@ -337,6 +362,10 @@ void gp2x_init(void) /* init usb joys -GnoStiC */ gp2x_usbjoy_init(); + /* disable Linux read-ahead */ + proc_set("/proc/sys/vm/max-readahead", "0\n"); + proc_set("/proc/sys/vm/min-readahead", "0\n"); + printf("exitting init()\n"); fflush(stdout); } diff --git a/gp2x/menu.c b/gp2x/menu.c index df5ff8a..5039cab 100644 --- a/gp2x/menu.c +++ b/gp2x/menu.c @@ -960,9 +960,9 @@ static void cd_menu_loop_options(void) selected_id == MA_CDOPT_READAHEAD) { if (inp & GP2X_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 } diff --git a/psp/menu.c b/psp/menu.c index 19151cc..ca40cfe 100644 --- a/psp/menu.c +++ b/psp/menu.c @@ -936,9 +936,9 @@ static void cd_menu_loop_options(void) 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 } -- 2.39.5