Project

General

Profile

Actions

Emulator Issues #4564

closed

Lag while running games from DVD.

Added by arturbc93 almost 13 years ago. Updated over 1 year ago.

Status:
Won't fix
Priority:
Low
Assignee:
-
% Done:

0%

Operating system:
N/A
Issue type:
Bug
Milestone:
Regression:
No
Relates to usability:
No
Relates to performance:
Yes
Easy:
No
Relates to maintainability:
No
Regression start:
Fixed in:

Description

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"):
Dolphin r7583

Operating system and version:
32-bit or 64-bit:
Both

Game ID (as it appears in game properties, Ex.: "GZ2P01" or "RSBE01"):
Any Game.

Build command-line (not on Windows):

Was the ISO a plain dump from disc, compressed and/or scrubbed?
from disc

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.

Actions #1

Updated by MofoMan2000 almost 13 years ago

What kind of DVD drive can Dolphin use to read GCN/Wii games anyway? Because it won't even use my LG 8362b (or whatever) that I use with Rawdump2 to rip ROMs.

Actions #2

Updated by lpfaint99 almost 13 years ago

It only works with backups burnt to disc with any dvd drive

Actions #3

Updated by arturbc93 almost 13 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!

Actions #4

Updated by mbc07 almost 13 years ago

Have you tried "Speed up Disc Transfer"?

Actions #5

Updated by arturbc93 almost 13 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.

Actions #6

Updated by Billiard26 over 11 years ago

  • Status changed from New to Questionable
  • Relates to performance set to Yes

For testing purposes, please list game(s) greatly affected by disc read latency.

Actions #7

Updated by mbc07 over 11 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...

Actions #8

Updated by arturbc93 over 11 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...

Actions #9

Updated by Billiard26 about 11 years ago

  • Issue type set to Bug
Actions #10

Updated by ZephyrSurfer over 9 years ago

Can this be retested on latest since the disc read changes.

Actions #11

Updated by JosJuice over 9 years ago

The disc read changes are unlikely to have any meaningful impact on this issue. The problem of disc reads (real ones, not emulated ones) pausing the CPU thread until they're done remains.

Actions #12

Updated by ZephyrSurfer over 9 years ago

Is there a way to solve some issues by keeping the disc spinning.
That part should be relatively easy to fix; I think.

Might require a load from drive option in the GUI -> File though.

Actions #13

Updated by mbc07 over 9 years ago

The GUI already have an option like that, it's under File menu...

Actions #14

Updated by ZephyrSurfer over 9 years ago

My bad. I don't have dolphin in front of me.

Actions #15

Updated by JosJuice about 9 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

Actions #16

Updated by mbc07 about 9 years ago

Did a quick test with Donkey Kong Country Returns (burned on a regular DVD+RW disc) and and PR 2149 works the same as master performance-wise: lots of stuttering when the game is reading data from the disk (loading screens, transitions to other areas, etc)...

Actions #17

Updated by JosJuice about 9 years ago

How fast is your disc drive? I think a 6x-8x drive should be fast enough to handle Wii games, or at least fast enough to notice a difference from this PR, but maybe not... Also, turn Speed Up Disc Transfer Rate off if you had it on.

Actions #18

Updated by mbc07 about 9 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?

Actions #19

Updated by mbc07 about 9 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

Actions #20

Updated by magumagu9 about 9 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.

Actions #21

Updated by mbc07 about 9 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

Actions #22

Updated by JosJuice about 9 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.

Actions #24

Updated by JMC4789 almost 9 years ago

Should we even be keeping this feature up? Should we "wontfix" this? Remove it altogether? I don't know.

Actions #25

Updated by JosJuice almost 9 years ago

I am going to fix this after PR 2149 is merged.

Actions #26

Updated by JMC4789 almost 9 years ago

  • Status changed from Questionable to Accepted
Actions #27

Updated by prismsub7 almost 8 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).

Actions #28

Updated by JosJuice over 3 years ago

  • Assignee deleted (JosJuice)
  • Priority changed from Normal to Low

So, uh... PR 2149 was merged 5 years ago and I haven't done this yet. I don't think I'll do it in the foreseeable future either (I have too much other Dolphin stuff to do that has higher priority (blame Android)), so I'm unassigning myself from this.

Actions #29

Updated by MayImilae over 1 year ago

  • Status changed from Accepted to Won't fix

Boot from DVD Backup has been removed. https://github.com/dolphin-emu/dolphin/pull/11456

Actions

Also available in: Atom PDF