Provenance-Emu / Provenance

iOS & tvOS multi-emulator frontend, supporting various Atari, Bandai, NEC, Nintendo, Sega, SNK and Sony console systems… Get Started: https://wiki.provenance-emu.com |
https://provenance-emu.com
Other
5.96k stars 686 forks source link

PSX: Black screen on initial launch #1066

Closed sevdestruct closed 4 years ago

sevdestruct commented 5 years ago

PSX: mednafen…Getting a black screen on first launch of a game. Have to pause and relaunch to get the screen to be visible.

Expected:

Visuals

Actual:

Black Screen

Reproduce:

  1. Launch PSX game
  2. Black Screen… can hear audio
  3. Pause…Quit. Relaunch game -> can see
  4. Rinse, Repeat

NOTES

#

APP VERSION

APP SOURCE

INSTALLED BY

PLATFORM

iOS/tvOS VERSION


🚫 We DO NOT support unofficial builds installed from 3rd-party sites. (Official Install)
Need help or have a suggestion? Join our Official Discord

mymikemiller commented 5 years ago

I'd like to take try my hand at resolving this issue. Have you dug into this at all and have any state to transfer?

JoeMatt commented 5 years ago

I haven't looked but there's 2 things to consider,

  1. There was a small bug fix update to Mednafen not to long ago, I'd start with upating the Mednafen core.
  2. There were some changes to loading cores, OpenGL es init, some other things, over the last couple months. IF this is a new bug I'd dig into those commits. Mednfen like other cores uses globals and statics a lot to expose an API to GUIs. iOS doesn't deal with dynamic framework unloading correctly and doesn't clear statics between runs. Many of these cores are coded in a way from Desktop apps where they would basically be started once and killed between plays, so they don't' do a good job of cleaning up global and statics, because they didn't have to care since they're automatically cleared and reset by the fact that the OS unloads the memory mappings when their processes are killed.

IOS though doesn't unload dynamic frameworks even when all referecnes to them are unloaded and dereferenced. Meaning that statics and globals are created lazily the first time a core is loaded. And I think for Mednafen I had some custom additions to correctly clear some global state when a rom is unloaded since iOS has this weird behaviour. Technically i'd consider it a bug in Mednafen but since most OS's are either running a single process per play, or correctly unload their dylib memory after each play to prevent filling up the process memory space over time, it's probably never caught anywhere else

Point of that was that if it's not working the first time but is after, it's possible some of the tweaks to fix static memory after first run, is fixing another bug where something isnt properly initialized, or there's a race condition or something being init'd out of order on first run that self correctts on the next run due to this never deallocating globals and statics behaviour.

mymikemiller commented 5 years ago

Awesome, thank you for this brain dump! Definitely gives me some idea of where to look for a solution. Wish me luck!

richlira commented 5 years ago

I have the same issue with SNES Games in Apple TV 4K. Thanks @sevdestruct for the steps, now I can play SNES Games lol.

I dont know if I should open another Issue.

Some data: APP VERSION 1.5 Beta

APP SOURCE Provenance-Emu GitHub (Official)

INSTALLED BY Building from Source Xcode 9.3+

PLATFORM Apple TV

iOS/tvOS VERSION Latest (11.3)

tristan-k commented 5 years ago

I've the same issue with the latest beta build 1.5 2770 on an iPad 6th Gen. iOS 12.2 with the Snes9x and Mednafen. For me quiting the game and starting it again does not work. This makes Provenance unusable. RetroArch on the other hand starts the ROM just fine.

JoeMatt commented 5 years ago

The version numbers got a little out of whack on the build bot server.

https://builds.provenance-emu.com/iOS/Latest/Develop/

2602 is the newest, just sort by modified date. [Update: prebuild in wiki is considered latest pre-release]

Pretty sure this bug doesn't still exist but i can't look at the moment.

sevdestruct commented 5 years ago

Bug still exists. Confirmed it for PSX just now. Quitting and relaunching ROM workaround still works. SNES on mednafen may be a different issue. It may seem black screen but wait for a bit and it seems to be glitched rendering. SNES9x core is fine as far as I can tell from a quick test.

xoniq commented 5 years ago

Same happens to me for PSX (Latest build). That’s how I got here, searched for this exact issue and found this issue report.

chrisballinger commented 4 years ago

I can confirm this bug still exists on the latest master branch, stopping/starting still works as a workaround.

Nakide commented 4 years ago

Hi folks, just to chime in on this issue. i'm a new user on Github and to provenance on tvOS. Been testing for some days now on my Apple TV to figure it out. Bug still exist in 1.5 beta. Sega genesis games do not launch at all in beta version; it crashes instantly. As i speak, PS1 games do work consistently on version 1.4 on every first launch including SNES, NES, Sega genesis. It appears the only thing the beta version is good for at the moment is N64 games since it is not supported in 1.4. Currently working on how to load PS2 games successfully in 1.4

urherenow commented 4 years ago

Repeat issue and you don’t need to keep reporting it. This will be closed when it’s fixed. Any issue that is not closed, is both known, and not fixed.

Don’t know how I can put that more simply.

sevdestruct commented 4 years ago

Thanks, @urherenow. @Nakide Please refrain from "me too" comments which unnecessarily ping us and our GitHub subscribers.

Note, there is no PS2 support—systems supported are listed in the wiki…Sega Genesis roms are working in latest official builds, jut fired up Shining Force just now to confirm, PS1 emulation has been improved in 1.5 including multi-disc support, full changelog for 1.5 is actually quite extensive and will be posted upon release——and…none of these are related to this topic

Please stay on topic when using Issues board, and take unrelated discussions and commentary to our Discord server.

Anjum9694 commented 3 years ago

I still have this issue in the latest version in 2021 (iOS 13)