Aloshi / EmulationStation

A flexible emulator front-end supporting keyboardless navigation and custom system themes.
MIT License
2.08k stars 905 forks source link

ES on RetroPie: Black screen with just "CHOOSE" after adding ROMs #250

Closed cpw83 closed 10 years ago

cpw83 commented 10 years ago

Hi,

I (and obviously some other people, see http://blog.petrockblock.com/forums/topic/adding-games-causes-black-screen-after-splash-screen) have a weird problem with ES on RetroPie.

I'm using RetroPie 2.3 (the SD card image) on a RasPi Model B, memory split left at the default 512/512.

When I was first trying RetroPie, I copied some ROMs for some different systems via SMB to the corresponding folders, just to try out the whole thing, this worked fine so far. After that I copied all of my ROMs (BTW: ES exited while copying); here's where the problem first occured:

When launching ES, the screen after the "Loading"-splashscreen stays black, there's only "CHOOSE" in white letters at the bottom left of the screen. It seems Emulationstation is still responding though - you can blindly flick through the menu and start a game, also pressing F4 will exit Emulationstation in what seems to be a clean shutdown. Sometimes (I think when this problem occurs for the first time after copying ROMs) the loading-splashscreen screen flickers like crazy.

After trying this and that I tried to isolate the problem:

First of all I did a fresh reinstall of the RetroPie image on the SD Card. Then I updated Raspbian (sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo rpi-update) and everything emulation-related with the RetroPie-Setup-script, set up the controls (Xbox 360 wireless controller) for Emulationstation and RetroArch, set the audio to HDMI only etc. After that I created an image of the SD card of this working configuration.

Now I copied all of my ROMs in the corresponding folders. When I started ES, the problem occured again: Black screen, only "CHOOSE".

As updating everything obvioulsy didn't help, I was convinced that this problem was caused by some ROM or its filename, e.g. a problem concerning a regular expression of some kind, maybe one that's looking for the file extension or something.

So I put my clean, working image back on the SD card and instead of copying all my ROMs for the different systems at once, I copied them seperately for every system: I quit ES and started with "amiga", started ES again, checked if everything worked, rebooted and made sure everything still worked. Then I quit ES again, went on with "amstradcpc", checked, rebooted and so on.

Finally I thought I found something:

The problem occured after copying some N64 ROMs in the corresponding "n64" folder. Now I deleted them one by one by exiting ES (F4), deleting a single file at a time and restarting ES. The problem persisted until the n64 directory was completely empty. Now every single N64 ROM I copied back in caused the problem.

Now I thought I figured out what was happening:

The problem seemed to be caused either by files themselves or their filename. If you copy such a file into a ROM folder and ES looks for it while starting, something crashes. Furthermore there seemed to be some kind of "cache file" (which I wasn’t able to locate so far) for every ROM folder containing the filenames, which gets damaged/inconsistent/broken in the process. It seemed if the "broken" directory is completely empty, the corresponding broken cache file won't be opened and everything works fine. If you put any file (regardless of its name) in there afterwards, everything will stop working again, because the cache is accessed.

Now I just needed to find out which file caused the error, so I reset everything to my clean SD card image and copied my N64 ROMs one by one, stopping ES before, starting it afterwards and then additionally rebooted after every single file.

And now guess what: The problem didn't occur...

So it's not a specific ROM causing it, but something else, maybe some weird combination of ROMs or their names in different folders. I can't figure out a pattern here. Of course the problem occured again after copying the rest of the ROMs.

I'm pretty much through all the logfiles I could think of (/var/log and ~/home/pi/.emulationstation/es_log.txt), I can't find anything unusual, nothing pointing out any error or warning at all. The only thing worth mentioning might be

lvl1: Error - folder with path ""/home/pi/RetroPie/roms/esconfig"" is not a directory!

but this does also appear if ES is working fine, so it has probably nothing to do with the problem.

I also tried to start emulationstation with the "–-debug"-switch at the shell, hoping this might output more information in the logfile or the shell, but it doesn't.

Any ideas? Any logfiles in other folders I could check?

// EDIT:

I just tried to reproduce the problem on a x86 platform (Ubuntu 14.04 Desktop x64 in VirtualBox, installed ES from the _latest DEB, made a ~/RetroPie/roms directory with all the systems, copied the es_systems.cfg from the RasPi and then all the ROMs at once) - this doesn't glitch out, it works fine.

Additionally I'll try to run the whole thing on "real" x86 hardware without virtualization.

nilsbyte commented 10 years ago

First of all, a memory split of 512/512 is not good at all, this means the GPU will use the whole RAM and i am sure this isn't possible. Recommended memory split value for RetroPie is 256 (set it with raspi-config). Or was this just a typo? :)

Second, the RetroPie SD images are meant to be used 'as is'. We can't give support to altered versions because we simply can't reproduce it easily. In addition to that, RetroPie is not our piece of work, it's @petrockblog 's.

The cache files you are mentioning are the XMLs for meta data, they store all the information such as paths to ROM, image and description.

I personally prefer to install RetroPie-Setup with git on the base of a clean Raspbian installation, because the SD image has some adjustments i don't like.

Did you problem only occur with N64 or other systems too?

cpw83 commented 10 years ago

Or was this just a typo? :)

Yes, of course that was supposed to be 256/256, adding up to 512.

The cache files you are mentioning are the XMLs for meta data, they store all the information such as paths to ROM, image and description.

That's not what I mean - as far as I can tell those are just populated after ROMs for a system were scraped? As I didn't do any scraping at all, they are all "empty", respectively just contain an XML header and a self closing "gameList"-Tag:

<?xml version="1.0"?> <gameList />

(in (/home/pi/.emulationstation/gamelists/<system>/gamelist.xml)

Did you problem only occur with N64 or other systems too?

That's the thing: I don't know and I can't reproduce it in a way to nail it down to a specific ROM. As said I thought I was close to figuring it out when the problems started after copying ROMs to the N64 folder, but then again copying all the N64 ROMs into the N64 directory without anything else in any other ROM directory does not reproduce the problem.

Second, the RetroPie SD images are meant to be used 'as is'. We can't give support to altered versions because we simply can't reproduce it easily. In addition to that, RetroPie is not our piece of work, it's @petrockblog 's.

I personally prefer to install RetroPie-Setup with git on the base of a clean Raspbian installation, because the SD image has some adjustments i don't like.

OK, I'll try that.

I'm just curious if there's anything else I can do to figure out the problem. As I read in some other issue-threads, Aloshi recommended running ES through gdb. I tried that, but it doesn't seem to give any hint for the specific problem (the libcrypto errors are normal as Aloshi said somewhere else):

pi@retropie ~ $ gdb /opt/retropie/supplementary/EmulationStation/emulationstation GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /opt/retropie/supplementary/EmulationStation/emulationstation...(no debugging symbols found)...done. (gdb) run --windowed Starting program: /opt/retropie/supplementary/EmulationStation/emulationstation --windowed [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGILL, Illegal instruction. 0xb6359600 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (gdb) continue Continuing. Cannot access memory at address 0x0

Program received signal SIGILL, Illegal instruction. 0xb6359608 in ?? () from /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.0.0 (gdb) continue Continuing. Cannot access memory at address 0x0 [New Thread 0xb5d72410 (LWP 2507)] [New Thread 0xb5572410 (LWP 2508)] [New Thread 0xb4d72410 (LWP 2509)] [New Thread 0xb4572410 (LWP 2510)] [Thread 0xb4572410 (LWP 2510) exited] [Thread 0xb4d72410 (LWP 2509) exited] [Thread 0xb5572410 (LWP 2508) exited] [Thread 0xb5d72410 (LWP 2507) exited] [Inferior 1 (process 2501) exited normally] (gdb) quit

nilsbyte commented 10 years ago

Please try with a fresh Raspbian,

  1. Set memory split to 128 with raspi-config
  2. sudo apt-get update
  3. sudo apt-get upgrade -y
  4. sudo apt-get install -y git dialog
  5. cd
  6. git clone --depth=0 git://github.com/petrockblog/RetroPie-Setup.git
  7. cd RetroPie-Setup
  8. chmod +x retropie_setup.sh
  9. sudo ./retropie_setup.sh

Choose 'Source based installation' and select everything you want + EmulationStation. Let me know if it resolved your issue.

InkyPi commented 10 years ago

I'm experiencing the same problem, I've tried simply renaming directories (nes to xnes, amiga to xamiga etc) and sometimes it works and sometimes it doesn't. I have noticed that if I 'hide' a bunch of folders in this way it runs fine...could it just be the sheer amount of roms emulationstation is trying to list (I've got full romsets on most of the emulators)? Is there a way to give emulationstation more time to read through all the roms before attempting to list them?

nilsbyte commented 10 years ago

Can you activate the FPS display and rename the folders to their default names? There should be also imformation about used GPU memory after the FPS count. How much is used?

cpw83 commented 10 years ago

Not getting anything to work at all.

Exactly following your instructions and doing a RetroPie source based install (BTW: "16-20 hours(!)"... make that "44 hours(!)" with the default selection ;-)) results in:

[ 24%] Building CXX object es-core/CMakeFiles/es-core.dir/src/components/HelpComponent.cpp.o es-core/CMakeFiles/es-core.dir/build.make:606: recipe for target 'es-core/CMakeFiles/es-core.dir/src/components/HelpComponent.cpp.o' failed CMakeFiles/Makefile2:194: recipe for target 'es-core/CMakeFiles/es-core.dir/all' failed Makefile:133: recipe for target 'all' failed

(from the logfile in /home/pi/RetroPie-Setup) amongst different other errors ("Could not successfully compile jzintv, mame4all-pi, PiSNES, Amiga emulator, PC Engine core")

Before that I tried compiling only ES on a fresh Raspbian installation according to http://www.emulationstation.org/gettingstarted.html#install_rpi_standalone :

g++-4.7: internal compiler error: Getötet (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions. es-app/CMakeFiles/emulationstation.dir/build.make:744: recipe for target 'es-app/CMakeFiles/emulationstation.dir/src/views/ViewController.cpp.o' failed make[2]: *** [es-app/CMakeFiles/emulationstation.dir/src/views/ViewController.cpp.o] Error 4 CMakeFiles/Makefile2:246: recipe for target 'es-app/CMakeFiles/emulationstation.dir/all' failed make[1]: *** [es-app/CMakeFiles/emulationstation.dir/all] Error 2 Makefile:133: recipe for target 'all' failed make: *** [all] Error 2

I'm starting to wonder if I might have some kind of hardware issue?

cpw83 commented 10 years ago

There should be also imformation about used GPU memory after the FPS count. How much is used?

Exactly that seems to be the problem: When the issue occurs, it's VRAM: 236.10 MB (texs: 210.93 MB, fonts 25.17 MB) The FPS count is not readable.

So it seems it has nothing to do with the ROMs themselves or the ROM count, it's the number of systems - if you have "too many", ES won't have enough VRAM for its UI and crash.

I can recreate the exact problem with just putting an empty file with the correct extension (e.g. Test.gb for Gameboy, Test.smc for SNES and so on) in every corresponding ROM folder - it'll start crashing at about 17 systems.

I tried setting the memory split from 256 to 384, it still shows the same values as above.

nilsbyte commented 10 years ago

Sorry for my late reply.

The problem is the stock theme 'simple' created by me. I fixed it, but let me explain.

When using the theme, every system uses a background image which uses VRAM. If you have ROMs for all supported systems, the VRAM usage is at about 468 MB (way too much for Pi). That's because I saved the background images in Full HD (1920x1080).

Fix: I recently updated the theme, scaling the Full HD images down to 1280x720 (720p) and optimizing file size. As the images are blurred anyways, you won't notice any difference, only the VRAM usage is reduced by 50% :) This should solve memory issues on Raspberry Pi.

Grab the newest version v1.2 here: http://blog.nilsbyte.de/downloads/

Please report if you problem is gone with the new version.

InkyPi commented 10 years ago

You, sir, are a gentleman and a scholar! Much appreciation :)

cpw83 commented 10 years ago

Thank you so much, that's it!

It's still too much for 23 systems - but I admit that this is not a very likely scenario for anyone. I was collecting ROMs for as many systems as possible, pretty much just to try out every single emulator I could find.

As a quick & dirty workaround I just deleted the background images for some systems - now for those there's just white in the background, but everything else works fine, so I don't mind. I assume it won't be possible or too slow/laggy to read the images directly from the filesystem without buffering them in VRAM?

Grab the newest version v1.2 here: http://blog.nilsbyte.de/downloads/

Just as a completion for those who don't know how to replace the theme (directly from the shell):

Quit ES (F4)

cd ~ mkdir dl_tmp cd dl_tmp wget http://blog.nilsbyte.de/download/emulationstation-theme-simple-v1-2/ sudo mv index.html /etc/emulationstation/themes/es_theme_simple_v1.2.zip cd .. rmdir dl_tmp cd /etc/emulationstation/themes sudo rm -rf simple sudo unzip es_theme_simple_v1.2.zip sudo rm es_theme_simple_v1.2.zip sudo reboot