Emulator Issues #4564
Lag while running games from DVD.
What's the problem?
Many games are too slow while they are reading the DVD.
Some games freeze when running videos when running the DVD.
Dolphin version with the problem (as it appears in the title bar, Ex.: "R
4779" or "R 6403M"):
Operating system and version:
32-bit or 64-bit:
Game ID (as it appears in game properties, Ex.: "GZ2P01" or "RSBE01"):
Build command-line (not on Windows):
Was the ISO a plain dump from disc, compressed and/or scrubbed?
Please provide any additional information below.
In other emulators that happens, PCSX for example, is the storage in the disk cache that makes it very slow, disabling the cache, the game runs much better, but in PCSX2, the problem was corrected by reducing the demand for DVD drive emulator, allowing re-enable the option in Speed hacks, this hack allows the loading time of games are faster, but it is the same that is happening in the Dolphin.
#3 Updated by arturbc93 over 9 years ago
Well, I'm not talking something that is easy to fix, because as originally posted, this also happened with other emulators that I use, but managed to fix them, why the dolphin would not have this opportunity to fix or at least improve it?!
My drive to read games is an LG "BH10LS30" BD-RE and tested games work well on the Wii!
#5 Updated by arturbc93 over 9 years ago
I tried but just got worse.
I think to improve this should be done the opposite.
This could cause a slight increase in load time of the game, but I think it would help start the games faster and give less trouble playing video and loadings the same time.
On PCSX2 they corrected this problem by using something like that, but before, loading the game kept crashing sound, animations, etc, equal to Dolphin, but after they made that improvement, the emulation works without crashes using the DVD then after this improvement almost there is no difference between using the image and use the DVD, I think here at the Dolphin would do something like that.
Sorry for my bad writing.
#7 Updated by mbc07 over 7 years ago
The only issue I encountered when running a backup disc directly from DVD drive was slow loading time and some stuttering when the disc stop spinning: for example, in Zelda TP, when you go to a room, data is read from the disc. After you stay some minutes in this room (the amount vary from drive to drive), the disc stop spinning, but the game still works ok. Then, if you go to another room, the game will become unresponsible until the drive start reading the disc again, but no crashing or any other issue with Dolphin, just some stuttering...
#8 Updated by arturbc93 over 7 years ago
I have posted this issue, because other emulators "PCSX2 and ePSXe" had a similar problem but both patched decreasing dependence of emulator to the data from DVD. So, on Dolphin, every time the emulator performs a reading on the DVD, the game freezes while this read don't finish. If the game needs to maintain a constant reading, you can not play from DVD, some times, if you are playing a game too long time and the DVD drive stop spinning, when reading back, the emulator crash, and now on last version, if I try a left click on game from DVD on game list, the emulador show a message "An unhandled exception occurred. Press "Abort" to terminate the program, "Retry" to exit the program normally and "Ignore"to continue.". Examples: Naruto Shippuden Clash of Ninja Revolution 3 (RNEEDA) on load of subtitles and dialogues, Red Steel 2 (RD2E41) on load of new scenarios and fast moves, Wii Sports (RSPE01) on load of finish match celebration, race games, etc...
#15 Updated by JosJuice over 5 years ago
PR 2149 should improve the performance when reading from discs. Could someone who has a DVD drive and a burned copy of a game test it? A Windows build is available at: http://dl.dolphin-emu.org/prs/pr-2149-dolphin-latest-x64.7z
#18 Updated by mbc07 over 5 years ago
I tested in a clean copy, so Speed Up Disc Transfer Rate was off (and I checked again before booting). My disc drive can read DVD media up to 16x and the DVD+RW disc I used can be read up to 10x. In that setup, there's no difference between master and PR 2149. Maybe my DVD+RW disc is limiting the read speed?
#19 Updated by mbc07 over 5 years ago
Hey JosJuice, I tested your PR more and there's no difference between using a DVD+RW disc or a DVD-R. I re burned Zelda TP (GC) and DKCR (Wii) in a faster DVD-R disc and the results were the same. Using an optical drive benchmark tool I could get read speeds of around 10x with the DVD+RW disc and around 16x with the DVD-R disc, so I'm crossing the disc and optical drive from the possible culprits.
< PS: besides veeery basic C skills, I have zero knowledge about how Dolphin emulate disc reads or how it should behave when reading data from backup discs, so, for anyone reading this, please ignore any non-sense I may have written below >
I think the code that handles DVD reads from a backup disc isn't async and that's the cause of stuttering, so, this issue may be completely unrelated to the changes from JosJuice's PR: from my understanding, his PR changes only when the read occur (this read command, at least for DVD backups, is executed somewhere else).
Enabling logging, I could see when the game asked data from disc (thanks to FileMon) and what I noted is that when a new FileMon entry show in the log, the game will freeze while the drive is seeking (it's very quick if the disc already is spinning, I guess the seeks takes around 100-200ms in my drive) but will unfreeze when the data starts to be "streamed". For example, leaving Zelda TP at title screen will play a video, while the game is loading the required files (probably the code responsible for the video player) I note that for every new FileMon entry the game freezes momentarily, but since the seek times are small, the game unfreeze quickly too (hence the sensation of stuttering). However, as soon as it starts "streaming" the movie file (around 140 MB), all stuttering goes away (I guess it's because the drive doesn't need to seek to anywhere else while the movie is playing).
This micro stuttering occurs again when you're walking around in the game and go near a door or new map area (sections from Hyrule Field, doors from dungeons, etc) and it's even more noticeable when the disc stop spinning. For example, going to any place and standing still will eventually make the drive stop spinning. After it stopped, go to a new area: the game will freeze for a couple of seconds (until the disc start spinning again) but after that it'll unfreeze and you'll experience only the stutterings that I think are caused by the seeking of the drive.
Things get even worse with DKCR, the game apparently packs a lot of data in a couple of big files (like FrontEnd.pak -- 30 MB, Stage7-1.pak -- 50 MB, etc). Since the game apparently never streams all content from the file at once, you can "hear" the drive seeking almost constantly -- probably reading small parts of those files, and with even seek, there's a micro stutter. Starting any stage is also guaranteed to make the game stutters every one or two seconds and by looking at FileMon in the log we see the game reading small parts of different files (judging by the file names there's a file with stage data, another file that looks like the background music, another that looks like the enemy data, etc -- FileMon keeps spamming new entries of the same files every one or two seconds as well). DKCR simply isn't playable from a backup disc due stuttering, no matter if it's master or your PR.
Compared to what I remember from my (now dead) Wii, the game isn't supposed to freeze while the drive is seeking -- the game keeps running without any stutter on a real Wii even while it's seeking (I assume that because although it was a very low noise, I used to clearly hear the drive from my Wii seeking), so that's why I think it's the cause of the issue. Even if the read speed get very low (generally reproducible with scratched/damaged discs) the worst thing that may occur in a real Wii is the game taking longer to load or eventually giving that generic error message ("A error occured, please turn of the Wii and refer to your manual", blablabla).
I also know that GC/Wii disc drives are different from normal PC drives (the proprietary media format, the CAV thing, etc) and because of that it may not be possible to get similar reading performance with ordinary PC drives, but from from my point of view, we can fix that by implementing code in Dolphin to make sure the disc drive never stops spinning (hence accurate to a real Wii) and find out what code path is responsible for reading the data from the disc drive, thus discovering why it's blocking the CPU/GPU threads when seeking -- maybe turning that code path async may fix this particular problem...
PS: sorry for the wall text but I tried to be as accurate as I could with the findings from my testings :P
#20 Updated by magumagu9 over 5 years ago
The reason that games still stutter even with that PR is that the amount of emulated time allocated for a read is based on a model of how the Wii drive works, not on the amount of time your PC drive takes. If the PC drive takes too long, it intentionally blocks, so read times are consistent from the perspective of the game. We would prefer not to change that, at least not for the default configuration; inaccurate timings can cause glitches in games.
If someone was interested, it probably wouldn't be too hard to perform dummy reads to keep the drive spinning. It's possible that a more accurate model for seeks in our emulated timings would reduce stuttering by making the timings closer to a physical drive (our current model assumes seeking always takes exactly 50ms). And we could add a setting to make reads never block, for people willing to trade off potential glitches for smoother gameplay.
#21 Updated by mbc07 over 5 years ago
"And we could add a setting to make reads never block, for people willing to trade off potential glitches for smoother gameplay.“
I always thought Speedup Disc Transfer Rate was supposed to do that but I'm wrong since it doesn't change anything for backup discs =/
Anyway, thanks for explaining disc seek time stuff
#22 Updated by JosJuice over 5 years ago
Speed Up Disc Transfer Rate will actually do the opposite of that. It will change our model of the Wii drive so that all reads complete immediately, which means that your disc drive will need to be almost infinitely fast to keep up. Replacing SUDTR with a more flexible setting is what I'm going to be working on after PR 2149, so I hope that this issue will be fixed then. More accurate seek time prediction is also something that I would like to have in Dolphin, but I don't think that that would fix the stuttering completely, because most PC drives don't have the exact same access times as Wii drives, and access times can be a bit random too.
Most of the wall of text is correct, but I don't think reads from the backup disc still are happening on the CPU thread. I moved it all to a new thread, and it's very implausible that the PC disc reading code somehow would be forcing itself to run on the CPU thread. Maybe the multithreading only helped a little bit, not enough to get past the blocking that magumagu explained.
#27 Updated by prismsub7 about 4 years ago
Same thing happens to me.
I have a lot of random crashes (tested with super smash, okami, metroid prime) when loading from a networked hard drive (limited to 100mb/s).
When you stream a game on real hardware using 10mb/s mode (PSO exploit with PSUL), the game/video stutters when it loads too slow, not crashing (in most cases).