libretro / dolphin

Dolphin is a GameCube / Wii emulator, allowing you to play games for these two platforms on PC with improvements.
https://dolphin-emu.org/
GNU General Public License v2.0
82 stars 67 forks source link

Eternal darkness freezes after first screen #32

Closed ghost closed 5 years ago

ghost commented 5 years ago

Eternal Darkness Sanity's Réquiem freezes after fist screen. Tested on Europe version and the latest version of Dolphin core.

Papermanzero commented 5 years ago

Try with the right donfig and sys files. However the game is sporadically freezing.

i30817 commented 5 years ago

I suspect this is one of those games that requires special configs overrides in upstream to work and that data is simply missing from the RA core build. It's not unusual.

Papermanzero commented 5 years ago

Maybe it is due to audio streaming. I guess libretro has an issue with audio streaming games like Eternal darkness.

i30817 commented 5 years ago

I tried it now with the core from the core downloader (not the ppa), and it crashed after the (horribly enormous unskippable) intro with a

*** buffer overflow detected ***: retroarch terminated
Aborted

That's what you meant? I have the latest version of the files the manual says i do from dolphin upstream too.

Edit: the dolphin wiki also says a old version of dolphin had a hang right after the quote at the very start of the game on some configs: https://wiki.dolphin-emu.org/index.php?title=Eternal_Darkness%3A_Sanity%27s_Requiem#Hang_Post_Initial_Quote

This was fixed upstream by configuration override.

ghost commented 5 years ago

I don't get any error message. It freezes after saying the initial sentence

Edit: Ok, I just read your last edit and the problem is exactly the one described in the wiki.

The wiki says "Use Deterministic GPU or Single Core to avoid the issue. Deterministic GPU is now set by default as of 5.0-4788", but I have not seen any option to use deterministic gpu or single core.

i30817 commented 5 years ago

Well that freeze was fixed upstream as the wiki says, but it easily crashes afterwards in gameplay.

Use Deterministic GPU or Single Core to avoid the issue. Deterministic GPU is now set by default as of 5.0-4788

There isn't actually a setting to disable 'dual core' or enable 'deterministic GPU' on the RA core options, but i'm assuming that the data downloaded takes care of that. Or something.

I avoided it completely by using the last version of the core from the buildbot at http://buildbot.libretro.com/nightly/ and follow instructions to get extra data files at : https://docs.libretro.com/library/dolphin/#setup

Notice that the ppa is outdated if you're using that. The retroarch devs don't really mantain distro packages and prefer everyone to use flatpak and download statically built cores from their buildbot (that this is actually a security disaster... is irrelevant to them).

I tried it again and the segmentation fault is kind of random, not 'immediately' after entering gameplay (i managed to get the key off the clock in the first room after the zombie room and the video with the boorish detective) but there is a high probability of crashing until it does (you enter other rooms). I didn't try upstream yet, or other renderers.

Papermanzero commented 5 years ago

My game does not freeze after the initial screen. You can exchange the settings in the sys folder. However it freezes now sporadically during game play.

i30817 commented 5 years ago

Yes, that was the crash i meant (in linux it manifests as a segmentation fault, not a 'freeze', but from what i recall that's not unusual in windows).

i30817 commented 5 years ago

Ok, I finally grepped the files on the sys folder, and @Papermanzero was right - it's DSPHLE being on by default.

This file is for the game fixes system/dolphin-emu/Sys/GameSettings/GED.ini

i edited it to add the DSPHLE = False and haven't had the segmentation fault since (the GPUDeterminismMode is the reason i didn't have the crash after the quote - you guys were missing the dolphin data files).

# GEDE01, GEDP01 - Eternal Darkness

[Core]
# Values set here will override the main Dolphin settings.
GPUDeterminismMode = fake-completion
DSPHLE = False

[OnLoad]
# Add memory patches to be loaded once on boot here.

[OnFrame]
# Add memory patches to be applied every frame here.

[ActionReplay]
# Add action replay cheats here.

[Video_Settings]
SafeTextureCacheColorSamples = 512

Someone should probably report this upstream. checks... searching for 'DSPHLE Eternal Darkness' has no result on the dolphin issue tracker. It's fair game to open a report, and i may, if they accept reports that come from the RA core. Maybe it's better to try to reproduce the problem in dolphin itself before bothering them though.

i30817 commented 5 years ago

Ok i found out why this DSPHLE crash problem isn't reported upstream:

It doesn't happen there.

So it's either some commits that the RA devs missed or something they screwed up. For this reason there is no point opening a bug report upstream, since it'd just be closed.

The good news is that the workaround appears to work, at the cost of lower performance AFAICT.

ghost commented 5 years ago

Ok, after copying sys folder to system/dolphin-emu/ and add "DSPHLE = False" to "GED.ini", it does not freeze at the beginning but, like papermanzero said, the game freezes sporadically during game play.

Thanks a lot!

Papermanzero commented 5 years ago

Yes, it has a dependency with following issue: https://github.com/libretro/dolphin/issues/49

i30817 commented 5 years ago

I played though it without a 'freeze' with that configuration, when i had them before - i'm assuming what you're calling a 'freeze' is a crash instead of just a 'pause' (i wouldn't notice a pause because my computer is dogshit and i played at sub 20 fps the whole time).

Except savestates - it's relatively easy to get savestates crashing on the dolphin core. I do not have the firmware bios on the system dir either. In a certain boss near the end of the game (the 'black guardian' in the large 'blue church' area) never savestate on 'stage 2' of his fight - when he summons - it always crashes, in upstream too iirc - something is not getting saved that is probably fundamental for that code there, but there are many others less reliable crashes with savestates.

bluefunoodle311 commented 5 years ago

So, I followed the steps with overwriting the sys folder and editing GED.ini and the game still crashes on boot. All other games seem to be working just fine. I even grabbed a new .ISO to make sure that wasn't corrupted. I'm at a loss here. Using latest and greatest updates of everything within retroarch that I am aware of. Thanks in advance!

i30817 commented 5 years ago

Check if you have this on the GED.ini is set to default before giving up:

# GEDE01, GEDP01 - Eternal Darkness

[Core]
# Values set here will override the main Dolphin settings.
GPUDeterminismMode = fake-completion

[OnLoad]
# Add memory patches to be loaded once on boot here.

[OnFrame]
# Add memory patches to be applied every frame here.

[ActionReplay]
# Add action replay cheats here.

[Video_Settings]
SafeTextureCacheColorSamples = 512

I tried this again and it was crashing before i reset everything again to 'upstream defaults'. I 'suspect' this turns on HLE again but it's probably better not to specify (not to have the DSPHLE line). I tried with it to false (didn't start) with it to True (crashed right away) and without it (managed to get into the first scene but didn't bother playing on (i finished the game 3 times for the 'good ending' and it gets tiresome). Just redownload the dolphin-master zip file and replace the Sys folder on the right place the page tells you to https://docs.libretro.com/library/dolphin/#setup

bluefunoodle311 commented 5 years ago

No joy with any of the 3 DSPHLE settings. :( I have all the files from that link placed in the sys folder.

i30817 commented 5 years ago

Show your log on gist, something is probably wrong in your paths.

Make sure the 'system' did in retroarch.ini exists. I name it bios, but other people named it 'system'. system_directory = "~/.config/retroarch/bios"

Then make sure the Sys folder you downloaded gets put inside it like this: /home/i30817/.config/retroarch/bios/dolphin-emu/Sys (well this is my version, if you have a different home or 'changed system_directory it's slightly different but it always has 'dolphin-emu/Sys'.

bluefunoodle311 commented 5 years ago

Awesome, thanks for that. I did a fresh extract of retroarch files and put the Sys folder in the right directory (it was not originally...), set the DSPHLE = True in GED.ini (no DSPHLE entry resulted in crash on load, DSPHLE = False entry resulted in crash at Poe quote screen)and the game now loads as far as the Start/Load/Options screen, but then crashes. Progress, though!

i30817 commented 5 years ago

Ok i think i have a solution. If you look back at the history of the file modifications of GED.ini in the dolphin github you'll find that 'fake-completion' was added because of this bug:

https://bugs.dolphin-emu.org/issues/10336

This indicates the original problem was because of dual core mode in dolphin, and presumably someone tested 'fake-completion' and found it was 'enough'.

Try to remove/comment the GPUDeterminismMode = fake-completion line and add CPUThread = False (from https://wiki.dolphin-emu.org/index.php?title=GameINI#Dual_Core ) instead (the other name for 'GPUDeterminismMode is 'Dualcore Determinism').

Apparently your hardware is extra sensitive to the dual core hack and the 'lesser' workaround is not working around. Well, if this works. If not you can also try this setting: https://wiki.dolphin-emu.org/index.php?title=GameINI#Synchronize_GPU_Thread

As always when experimenting with settings find the minimal set of changes that turn it working.

Other ideas: crashes when creating/accessing the memory card for some reason, another setting on retroarch core options or save options.

i30817 commented 5 years ago

BTW, this game has native widescreen so you don't need to enable the dolphin hack, just press a button when it's saying the beginning Poe quote, or go into the options and change it before starting the game.

bluefunoodle311 commented 5 years ago

Tried all suggestions with no joy. Reset retroarch config and had to switch GED.ini to the following to get anything past the initial screen:

# GEDE01, GEDP01 - Eternal Darkness

[Core]
# Values set here will override the main Dolphin settings.
GPUDeterminismMode = fake-completion

[OnLoad]
# Add memory patches to be loaded once on boot here.

[OnFrame]
# Add memory patches to be applied every frame here.

[ActionReplay]
# Add action replay cheats here.

[Video_Settings]
SafeTextureCacheColorSamples = 512

Made it as far as the memory card/options page twice, but it tends to crash before I get that far.

I'm at a point where there's no real consistency in testing the changes. Might try on another workstation and see if I can replicate the issues or create other ones. Is there a way to export logs to post here for review?

i30817 commented 5 years ago

Uh. You're right, CPUThread = False actually stops the game booting, which doesn't make much sense, since that double core setting is supposed to be a hack (always on barring exceptions, since it's much faster).

Anyway i can run it, so now it's probably something in your settings. Or hardware, or the core.

I'm running the latest core from the core downloader (but could also run it before from the ppa).

Suggestion: rename the ~/.config/retroarch dir, start retroarch again (to create a new one) copy the 'system/dolphin' dir to the new one and try again. This is to make sure it's not a 'different' retroarch setting.

If not the only possibility is that your hardware is doing something the game doesn't like, and you need to take it up with the dolphin devs.

However, before you do that, try to run the game in upstream dolphin, it might run, and if so, they'll tell you to pound sand if you try to report a libretro port bug (probably).

i30817 commented 5 years ago

You can also try to create a save state when you boot to the menu, turn the CPUThread = False on, and then try to load the savestate to see what happens. But even if that 'works' it's more of a workaround to something crazy.

i30817 commented 5 years ago

I have these options on the dolphin section of the retroarch core options:


dolphin_cpu_clock_rate = "100%"
dolphin_cpu_core = "JIT64"
dolphin_dsp_hle = "enabled"
dolphin_dsp_jit = "enabled"
dolphin_efb_scale = "x1 (640 x 528)"
dolphin_efb_scaled_copy = "enabled"
dolphin_efb_to_texture = "enabled"
dolphin_efb_to_vram = "disabled"
dolphin_fastmem = "enabled"
dolphin_gpu_texture_decoding = "disabled"
dolphin_language = "English"
dolphin_log_level = "Info"
dolphin_max_anisotropy = "0"
dolphin_mixer_rate = "32000"
dolphin_pal60 = "enabled"
dolphin_progressive_scan = "enabled"
dolphin_renderer = "Hardware"
dolphin_sensor_bar_position = "Bottom"
dolphin_shader_compilation_mode = "sync"
dolphin_wait_for_shaders = "disabled"
dolphin_widescreen = "enabled"
dolphin_widescreen_hack = "disabled"

Nothing special as you can see.

i30817 commented 5 years ago

Ok this may be a startup creation bug. I just tried removing the 'User' dir on the save dir on retroarch (it's the dolphin savedir) and the game didn't boot even with "GPUDeterminismMode = fake-completion", nor am i able to access the menu

It only started booting again after i force-quit and retried (the User dir was created the first time). So there is a deadlock the first time. I'm going to try to debug it and open a bug for that.

edit bug opened.

edit2: never mind don't try the below because the debug build always crashes with the same bug that i opened right now. Which probably means this is a threading bug that i'm lucky to avoid always and you aren't.

You bug is a bit different since you can 'get to the menu'. I think you should build the core yourself to post the backtrace here.

basically, run the game once to make sure it created the necessary dirs and files and that you have the GPUDeterminismMode = fake-completion mode turned on, quit the game then:

git clone --depth 1 https://github.com/libretro/libretro-super/ cd libretro-super ./libretro-fetch.sh dolphin cd libretro-dolphin gedit Source/Core/Core/IOS/FS/HostBackend/FS.cpp (comment line 198, with the debug assert because it creates false positive cashes on debug builds, save and close the file) mkdir build cd build cmake .. -DLIBRETRO=ON -DCMAKE_BUILD_TYPE=Debug cmake --build . --target dolphin_libretro --config Debug

Wait for it to build. Then copy paste the new libretro_dolphin.so to wherever your retroarch is picking up the cores, overwriting your old one.

then run the game with gdb retroarch (wait for the debugger to load r then load a Eternal Darkness as normal and wait for the crash return to the console and press 'bt'

copy the backtrace here.

bluefunoodle311 commented 5 years ago

I see what you’re saying with the startup bug. Same issue here the first time up. Has to be a hardware issue with my older desktop not playing nice because it’s working just fine on my newer Dell G7 laptop. Well, in comparison. Time to address the purple screen bug. Thanks for all the assistance and glad I could help isolate another problem for report.

i30817 commented 5 years ago

The startup bug should be general, it happens here too. I think that one will need to be solved before you can debug this one, because that crash always manifests on Debug builds, even after the first time.

ie: it prevents debugging your later 'in-menu' crash. And may even be the cause (from memory corruption).

So what i think is happening is a combination of software and memory which on my end 'doesn't mind a bit of corruption' on release builds - after the first time - and on your end - after the first time - the earlier ignored crash on exit of the thread is causing later crashes (if we are lucky, fixing that will fix this one, if we aren't, it will allow debugging this).

flyinghead commented 5 years ago

This game needs GPU determinism to be on (GPUDeterminismMode = fake-completion) as set by the per-game setting (GED.ini -> Make sure to use an up to date Sys folder tree) The PR above should fix the crash/hang when GPU determinism is on.

i30817 commented 5 years ago

@bluefunoodle311 can you confirm that a update of the dolphin core and a 'clean' Sys folder in the right place fixes your crashes all the time? It seems to have fixed the first time crash issue i opened.

BTW, the game itself crashes dolphin (upstream too) on loadstate during the stages 2 and 3 of 'black guardian' boss on the blue church area, so you should do that boss segment without savestates and with one or two extra saves before entering the boss room. It's during the soldier chapter.

bluefunoodle311 commented 5 years ago

It took a clean install on a separate (newer) computer and the above changes to the GED.ini file, but it appears to be working without crashes thus far (barring the initial user directory crash on load). I also had one at first due to the purple screen, but I implemented the fix for that and no more crashing. However, I do still have the purple transitions.

i30817 commented 5 years ago

barring the initial user directory crash on load

That's what we need tested to close this, please update the core with the online updater (if you can) and retry it. Hell, retry it on your old computer to see if this fixes your other crashing problems (with the default dolphin sys).

However, I do still have the purple transitions

https://wiki.dolphin-emu.org/index.php?title=Eternal_Darkness:_Sanity%27s_Requiem#Green_.2F_Purple_Transitions

Dolphin has a great wiki which is often a good idea to read because it sometimes has tweaks and common config fixes. For instance if you play beyond good and evil in dolphin you might be disappointed by the aspect ratio even if you use the widescreen hack, but there is a scaler on the wiki to zoom in

bluefunoodle311 commented 5 years ago

I did a clean install and still received the user directory crash on load with multiple games. Loaded Eternal Darkness and crashed at first purple transition. Used the link you referenced and changed Store XFB Copies to Texture Only to "off" and still get purple transitions, but no more crashing (at least thus far).

i30817 commented 5 years ago

I can only think you're not getting the latest core. I'm getting the nightly for my platform (x86-64 linux) from here:

http://buildbot.libretro.com/nightly/ (from the gui for the online updater in retroarch)

which was built 10 minutes ago and has crc32 e14397c9.

If you're using the ppa, you'll have to wait for it to build and do the apt-get update; apt-get upgrade dance but if you're using snap, flatpak or the standalone zip in windows, you should be able to use the online updater->core updater->Nintendo Gamecube/Wii (Dolphin) to get this latest version and prove it fixes things.

bluefunoodle311 commented 5 years ago

That would make sense. I tested late late last night (12 or more hours ago) and pulled the files from the nightly at that time. I will take a look when I get back to my computer and post an update here with findings.

i30817 commented 5 years ago

The XFB setting needs to be under video hacks, which is not on the original ini

edit: actually you're right, both variants do nothing to the 'purple fade' in the first 3d scene of the pc with the shotgun and zombies.

I was at first thinking it was because the RA fork of dolphin doesn't have hybrid XFB and then tried enabling 'real XFB' with

[Video_Settings]
SafeTextureCacheColorSamples = 512
UseXFB = True
UseRealXFB = True

since the wiki says that's the workaround before hybrid xfb was merged, but no luck on that first scene.

Anyway, i don't recommend enabling any of these workarounds, on my (quite bad) computer it tanks the already rickety fps for a fade in that only happens at the beginning and end of a chapter. It's a bit annoying, but no big deal...

I hope you're using a real controller though, currently this core doesn't recognize the keys mapped to the L and R gamecube controller buttons on a keyboard, due to another bug i reported. There should be no problem with a controller i think, but if there is, mention it there, because i don't have one.

bluefunoodle311 commented 5 years ago

Okay, so I got some time to play around on my Dell G7 and here is what I discovered:

1)The latest dolphin core has resolved the user directory crash on initial boot problem. 2)I use a rock candy USB Xbox 360 controller and have no problems with the button mapping for Eternal Darkness (or any other gamecube game) 3)No crashing on Eternal Darkness like I was experiencing before 4)Still experiencing the purple transitions

GED.ini looks like this:

# GEDE01, GEDP01 - Eternal Darkness

[Core]
# Values set here will override the main Dolphin settings.

GPUDeterminismMode = fake-completion

[OnLoad]
# Add memory patches to be loaded once on boot here.

[OnFrame]
# Add memory patches to be applied every frame here.

[ActionReplay]
# Add action replay cheats here.

[Video_Settings]
SafeTextureCacheColorSamples = 512

[Video_Hacks]EFBToTextureEnable = False

Beyond the EFBToTextureEnable entry (which is probably the wrong one...I'm still learning all this stuff), I made no configuration changes to the clean install.

i30817 commented 5 years ago

Now you can play the same game 3 times to get the real ending! FSM, i wish they'd made more things different, but damn if i didn't.

ghost commented 5 years ago

After the last commit everything works fine. I close the issue. Thank you very much

bluefunoodle311 commented 5 years ago

Issue is also fixed on my older hardware now!