RetroPie / RetroPie-Setup

Shell script to set up a Raspberry Pi/Odroid/PC with RetroArch emulator and various cores
Other
10.06k stars 1.39k forks source link

Composite video shows black screen for pocketsnes and dgen #161

Closed adskiremote closed 11 years ago

adskiremote commented 11 years ago

I've tried this many ways round. Building a RetroPie system from scratch - compiling displaymanx to try fix the issue.

Nothing still black.

Then as I know Xbian displays perfectly on my old TV I thought ok set it up on that. Still the same.

But I'm determined to source the issue. From my conclusions it has to do with proposed resolution to the emulator.

Change EmulationStation default res to 800x600. Still nothing - black screen.

Forced dgen, pocketsnes to use resolution of 800x600 - still black screen. Nice sounds tho.

Changed /boot/config.txt to force composite output, changed hdmi settings even though I'm not using hdmi.

So I've come to a grinding halt. Gone through every conceivable approach through forums and help.

I'm determined to fix this issue to will post my updates here. If anyone can contribute, please do!

Many thanks,

Adskiremote

adskiremote commented 11 years ago

Further testing...

Using snes9x-rpi works. Composite video outup is perfect. Sound is choppy.

And I've realised DGEN isn't compiling and errors...

hq4x_16.o gcc-4.7: internal compiler error: Killed

Aloshi commented 11 years ago

That error generally means you've run out of memory. Try allocating very little RAM to the GPU in /boot/config.txt (something like 16mb), rebooting, and recompiling. (Don't forget to increase the GPU RAM again before you try to play a game!)

adskiremote commented 11 years ago

OK will do thanks. I compiled successfully doing --disable-hqx but something seems to go wrong still. Can't see anything in error logs.

I've found that PiSNES is the best snes emulator, well at least for me. Sound is perfect, better than all the others and runs v well.

I'll try get to the bottom of dgen today and post my results.

Thank you

adskiremote commented 11 years ago

Getting somewhere now. I have Dgen running through composite video outside of emulationstation. And not using the runcommand.sh

When I switch back and try it using the runcommand with the option 1 or 2 it goes to black screen. And exiting dgen just craps out the whole system.

I'll change it not to use runcommand.sh in es_systems.cfg and see if it boots in emulationstation.

adskiremote commented 11 years ago

ok I can get PiSNES and DGen running correctly if installing dispmanx.

But then they don't run correctly in EmulationStation.

I saw Kalehrl said he'd write a simple scripts instead and ditch dispmanx. Was that the runcommand.sh?

Can anyone offer further advice on this? As now I have dispmanx installed is there a way to get the other emulations to run correctly?

Anyone done anything similar?

adskiremote commented 11 years ago

All working now - followed advice to only use dispmanx library when needed. Perfect emulation of pisnes and dgen.

petrockblog commented 11 years ago

Could you describe your solution with some details and links? Maybe it could be included in the RetroPie Script somehow.

adskiremote commented 11 years ago

sure I'll put it together a little later after work and let you know.

On 7 May 2013 10:37, Florian notifications@github.com wrote:

Could you describe your solution with some details and links? Maybe it could be included in the RetroPie Script somehow.

— Reply to this email directly or view it on GitHubhttps://github.com/petrockblog/RetroPie-Setup/issues/161#issuecomment-17521684 .

adskiremote commented 11 years ago

Hi,

this is a breakdown of what I did. I received great advice from others so I can't claim to have done anything new.

But I have spent a long time testing different outcomes and emulators trying to find what works best.

My setup is:

rPi 512Mb Model B Stereo Audio Jack -> Speakers Composite video -> TV

My main goal was to get SNES, MegaDrive and Emulation Station working together and installed on Xbian.

Compiled and configured PiSNES, DGEN, RetroArch and Emulation Station using the RetroPie script.

I tested PiSnes and it worked well without dispmanx. With it, the sound is very choppy or it doesn't launch the rom.

Snes9x works great with dispmanx but not so well with the standard SDL. I found the sound too bad to play anything.

To get MegaDrive working I needed to compile Dispmanx.

So taking all this into account here's my setup.

Which goes a little something like this...

///////////////// mkdir /home/pi/RetroPie/supplementary/dispmax cd /home/pi/RetroPie/supplementary/dispmanx git clone --depth=0 git://github.com/vanfanel/SDL12-kms-dispmanx.git cd SDL12-kms-dispmanx nano Makefile ////////////////

// Now we need to edit the Makefile - there is a better way to do this I think but it works... // Append this to CFLAGS -I/opt/vc/include/interface/vmcs_host/linux // Save and exit

// Run configure ./configure

// Run make - DO NOT install - will break emulationstation and overwirtes some of your sdl library files make

Next is to edit the source file of EmulationStation and re-compile and install...

//////////////// git clone "/home/pi/RetroPie/supplementary/EmulationStation" git://github.com/Aloshi/EmulationStation.git cd /home/pi/RetroPie/supplementary/EmulationStation ///////////////

Find the file - Renderer_init_rpi.cpp

nano Renderer_init_rpi.cpp

Find line 182 and comment out: SDL_Quit(); So it looks like this...

// SDL_Quit();

Save and exit.

Run the make command

make

Now I needed to reconfigure and carry on the rest of the install but found it easier to copy and paste what I wanted out of the RetroPie-Setup.sh

You can download it here if it'll help...

https://mega.co.nz/#!J0sExY5Y

Here's the file key: MZY8rymMrPXnveYxfEd3dTUJls0NDgZFxDm9G1nanNY

Basically it copies EmulationStation to the right places and sets up the EmulationStation config.

Because you'll want a different config from normal I have amended the parts you'll need.

These were...

MegaDrive - to use the Dispmanx library

COMMAND=export LD_LIBRARY_PATH="/home/pi/RetroPie/supplementary/dispmanx/SDL12-kms-dispmanx/build/.libs"; /home/xbian/RetroPie/emulators/dgen-sdl/dgen %ROM%

Use PiSNES - which doesn't use dispmanx

COMMAND=/home/xbian/RetroPie/emulators/pisnes/snes9x %ROM%

I hope this helps anyone who has the same problems. But I must stress the solutions don't come from me but others in the community and credit goes to them.

My only hope was to test all options with every single emulator and have a working system based on the specification and TV I have.

btw - I am using a PlayStation One controller with this whole setup and it works very well.

I will be testing iMame and AdvanceMame using standard SDL and dispmanx.

I'll post the outcome so it might help others find out quickly which emulator will work best for them on their options.

Many thanks,

AdskiRemote

adskiremote commented 11 years ago

@petrockblog (Florian) - btw I have written a script that will switch the audio for the desired setup. I saw this was still an issue. Would you like me to submit it?

It basically disables audio based on preference eg: Enable HDMI, Enable jack / disable hdmi, enable jack / enable hdmi, disable jack / disable hdmi

Let me know :-)

adskiremote commented 11 years ago

I'm happy to implement if @petrockblog and @Aloshi could suggest how they want it to work in the script.

Aloshi commented 11 years ago

I actually have a potential solution (that I haven't tested) regarding EmulationStation's weird problems with the SDL dispmanx libs.

The problem with using ES and the dispmanx libs arises from both trying to initialize the dispmanx stuff. If my understanding of SDL is correct, it should be possible to force a particular SDL "video driver" - that is, I can force SDL to use, say, the "fbcon" driver, so it can't use the "dispmanx" driver. Which would make it work pretty much the same on any Raspberry Pi system, regardless of SDL library.

It should be a matter of calling SDL_putenv("SDL_VIDEODRIVER=fbcon") before SDL_InitVideo (in src/Renderer_init_rpi.cpp). You might need to add a matching SDL_putenv("SDLVIDEODRIVER=") in the renderer deinit function, as I'm not sure if these SDL environment variables carry over to child processes.

petrockblog commented 11 years ago

@adskiremote Thanks for the detailed information! This makes things clearer (at least for me).

petrockblog commented 11 years ago

@adskiremote About the audio preferences: I am sure that we would benefit from the option, to set audio preferences! You could either submit a pull request (much easier to integrate from my side) or copy-paste your code here and I would add that to the script.

adskiremote commented 11 years ago

Hi,

I forgot to mention - I decided to use specific arm cpu's for dgen..

Cyclone 68000 and DrZ80

You can change the cpu's in dgenrc configuration file.

Amending my dgen startup script to use the config file

COMMAND=export LD_LIBRARY_PATH="/home/pi/RetroPie/supplementary/dispmanx/SDL12-kms-dispmanx/build/.libs"; /home/xbian/RetroPie/emulators/dgen-sdl/dgen -r /home/pi/RetroPie/configs/all/dgenrc %ROM%

Hope that helps

Adski

On 8 May 2013 11:43, Florian notifications@github.com wrote:

@adskiremote https://github.com/adskiremote About the audio preferences: I am sure that we would benefit from the option, to set audio preferences! You could either submit a pull request (much easier to integrate from my side) or copy-paste your code here and I would add that to the script.

— Reply to this email directly or view it on GitHubhttps://github.com/petrockblog/RetroPie-Setup/issues/161#issuecomment-17586302 .

petrockblog commented 11 years ago

I have added Dispmanx to the RetroPie Script thanks to @adskiremote ! However, I did not enable the use of the dispmanx library per default in /home/pi/.emulationstation/es_systems.cfg. I hope that his helps somehow.

NintendudeCT commented 11 years ago

Sorry if I'm in the wrong section, but I'm newer to the Raspberry Pi scene. I've gotten everything working, aside from DGen. I've followed the instructions above, gotten the games to work, but no matter what I do there is screen tearing. It's driving me mad. I should point out that I only use composite output.

adskiremote commented 11 years ago

Hi NintendudeCT,

so you installed dispmanx and then changed the es_systems.cfg to point to the dispmanx library? Can you paste the dgen COMMAND from es_systems.cfg please.

Also did you compile dgen or install from the binary? Could you let me know which rom you're using for testing?

Hopefully I can help you with this.

NintendudeCT commented 11 years ago

Hello. Yes, I did. I used: COMMAND=export LD_LIBRARY_PATH="/home/pi/RetroPie/supplementary/dispmanx/SDL12-kms-dispmanx/build/.libs"; /home/pi/RetroPie/emulators/dgen-sdl/dgen -r /home/pi/RetroPie/configs/all/dgenrc %ROM%

I installed DGen via binary and am using Sonic the Hedgehog 1 to test.

Thank you.

adskiremote commented 11 years ago

thanks for that. ok perhaps there's something in your dgenrc that's causing it. Can you give me your email and I'll send you a copy of mine if that helps. I'm on holiday at the moment so it might take me a little longer to get to you.

Did you change the cpu's for the dgen emu in the config?

NintendudeCT commented 11 years ago

No problem take your time. Yeah I changed them as recommended and then changed them back to default to see if it made a difference. no luck though. email is riolu_lucario@yahoo.com

secgoat commented 11 years ago

Oops, deleted my comment so far. I am having similar issues but the Dispmax is only helping in some instances.

I am running rPi B 512MB 256 memory split compnent video instead of HDMI

using dispmax as commented in the Sega Master drive works for all emulators that are not retroarch.

How can I get dispmax working with retro arch as well? Is it worth trying the HDMI cable as it seems some people have had issues with the component video vs HDMI?

EDIT: yes HDMI fixed the issue for me, it appears all the emulators are now playing properly. Thanks!

samisabik commented 11 years ago

@adskiremote Hello ! I did follow exactly your instructions to implement dispmanx lib and recompile emulationstation, however it still catch that damn black screen using composite video output for dgen emulator.

At this point i'm considering buying an HDMI > S-Composite convertor, will this work ? (http://dx.com/p/playvision-hdv-m610-mini-hdmi-to-av-video-audio-converter-white-152345)

Aloshi commented 11 years ago

Err, the dispmanx SDL library isn't meant for EmulationStation (in fact using it with ES will make ES break after launching too many games). The recommendation is usually to compile the dispmanx SDL lib but not install it, then export the library path as part of the launch command for DGen.

samisabik commented 11 years ago

@Aloshi : Yes ! I've NOT make install. Just compiled dispmanx and link it in ES for dgen .. and still not sign of life from dgen !

es_log output : lvl2: Attempting to launch game... lvl2: export LD_LIBRARY_PATH=”/home/pi/RetroPie/supplementary/dispman$ lvl1: ...launch terminated with nonzero exit code 35584! lvl2: Starting SDL... lvl2: Creating surface... lvl2: Resolution: 720x480... lvl2: Created surface successfully!

samisabik commented 11 years ago

Found solution ! https://github.com/davidwinter/retrocade , I used these instructions to compile dispmanx and dgen outside ES, and it works like a charm !

I'm now reinstalling RetroPie and will try to relink dgen in es_systems ;)

MattDavidson commented 11 years ago

Hi, firstly thank you for the script and useful guides etc.

I have been trying to get this working via composite output all week and read several of the threads on here regarding the SDL / dispmanx issue. I have now installed from source and I've been trying to compile emulationstation with the //SDL_Quit() tweaks but I can't get it to compile.
My process is below, and I realise this is probably n00b stuff and may not be the right place to ask, but please could you advise on what I could do to get it to compile successfully. I have tried the following without modifying the code at all but it won't compile like that either.

So here goes... I've been following adskiremote's guide above but there was a few parts I had to presume. Firstly, I changed git clone "/home/pi/RetroPie/supplementary/EmulationStation" git://github.com/Aloshi/EmulationStation.git to simply git clone --depth=0 git://github.com/Aloshi/EmulationStation.git as I was getting fatal: repository '/home/pi/RetroPie/supplementary/EmulationStation' does not exist. I presume this is ok, (I renamed the existing folder first).

I then modified the source file as described and in order to build I tried this: cmake . I got an issue about version 4.7 of g++, which I was unable to update via apt-get (I have v4.6.3 and it kept saying I was using the latest version). So I opened CMakeLists.txt and commented out the error message line " message(SEND_ERROR "You need at least G++ 4.7 to compile EmulationStation") line. I think this might be the reason that the rest is failing, but this seemed to allow me to successfully run cmake .

So after running "cmake ." I ran "make" and get the following: pi@raspberrypi ~/RetroPie/supplementary/EmulationStation $ make [ 2%] Building CXX object CMakeFiles/emulationstation.dir/src/AudioManager.cpp.o cc1plus: error: unrecognized command line option â-std=c++11â make[2]: * [CMakeFiles/emulationstation.dir/src/AudioManager.cpp.o] Error 1 make[1]: * [CMakeFiles/emulationstation.dir/all] Error 2 make: *\ [all] Error 2

I presume this is because the compiler is not version 4.7. Any ideas how I can get it to compile?

Regarding the composite issues, I have an original model B (256) and have managed to get mastersystem and snes running but not megadrive, doom, duke nukem etc. These just flash a screen with a white dot and return to the menu screen. Before I built my sd from scratch, I tried using the sd card image and trying to run any of the emulators made the pi crash - black screen, and device no longer reachable via ssh. I'm a developer but haven't done any linux development so this isn't quite inline with my skills but I understand enough to follow wisdom from on here. Any ideas and advice would be very welcome. Thanks

petrockblog commented 11 years ago

The dispmanx library should compile fine with the current version of the RetroPie Script. Do not forget to modify es_systems.cfg.

MattDavidson commented 11 years ago

Yes I have modified es_systems.cfg but it still doesn't load dgen, which is why I was trying to do the //SDL_Quit() fix. So once I've changed the .cpp files to implement @adskiremote 's fix, are you saying I should use the retropie script to recompile it independently? Doesn't it just git clone everything and overwrite my changes?

adskiremote commented 11 years ago

Use RetroPie to compile dispmanx, DGEN and EmulationStation. Once you've compiled the dispmanx lib then use it in es_systems.cfg but I'd recommend trying to get DGEN to lauch in console first.

Mainly to make sure there isn't any other issues.

I have also just tried this from scratch with a clean install of everything. I selected RetroPie script to compile and configure dispmanx, DGEN and emulationstation.

Then amended es_systems'cfg file for DGEN to the following: COMMAND=export LD_LIBRARY_PATH="/home/pi/RetroPie/supplementary/dispmanx/build/.libs"; /home/pi/RetroPie/emulators/dgen-sdl/dgen %ROM%

Launched EmulationStation - playing DGEN through composite out on my TV. No need for SDL_Quit() fix for this.

Can you try how I've done? Just start from scratch, compile using RetroPie, change the COMMAND and you're ready to go.

:-)

unreasonablyturquoise commented 11 years ago

Once again, thanks for all your work on this issue and on the RetroPie project in general.

I've been trying to get DGEN to work with RCA for a while now. When I run DGEN without the dispmanx library I get a black screen for a second then get booted back to emulationstation where the system will hang completely after a second or two. I can confirm that COMMAND in es_systems.cfg launches successfully from the console. There is no issue with my other emulators or when I run DGEN using HDMI.

When I use the dispmanx libs, I get the following:

#################################

dispmanx: Opening display(0)... Physical video mode is 720 x 480 Adding video mode: 720 x 480 - 8 bpp Adding video mode: 720 x 480 - 16 bpp Adding video mode: 720 x 480 - 24 bpp Adding video mode: 720 x 480 - 32 bpp

Using internal program mode: width-640 height=464

Using physical mode: 720 x 400 16 bpp

#################################

And then nothing. Again, it works fine when I run it from the console.

I'm using a Pi Model B 512MB with a component video to a 7" TFT monitor.

Do I have to change the dispmanx config files somehow to work with my monitor?

petrockblog commented 11 years ago

This does not solve your problem, but, nevertheless, might be of interest: I added the Genesis libretro core “Picodrive” to the RetroPie Setup Script. I would suggest to try this. It would be interesting to see if Picodrive works fine for RCA video output. Currently, it does not come with the SD-card image, but using the binaries-based installation will install and configure it on your RPi.

unreasonablyturquoise commented 11 years ago

Thanks, I'll look into it when I get a change and let you know. Anyone else have any ideas?

Aloshi commented 11 years ago

Can you post exactly what your COMMAND is in ~/.emulationstation/es_systems.cfg?

unreasonablyturquoise commented 11 years ago

Sure. It was the line suggested by @adskiremote :

COMMAND=export LD_LIBRARY_PATH="/home/pi/RetroPie/supplementary/dispmanx/build/.libs"; /home/pi/RetroPie/emulators/dgen-sdl/dgen %ROM%

adskiremote commented 11 years ago

Hi @unreasonablyturquoise - do what @Aloshi suggests. As long as you've installed dispmanx using the RetroPie-Setup.sh the command will work with DGEN.

If you're still having problems let me know and I'm happy to edit you systems.cfg.

As you'll find some emulators etc don't work so well under RCA. You can see the table for RCA output in the wiki that'll help you determine what emulator you need.

unreasonablyturquoise commented 11 years ago

Thanks. I'll try it out soon as I get a chance.

unreasonablyturquoise commented 11 years ago

@adskiremote could you provide a link for this compatibility table please? I can't find it in the wiki. I've tried the Genesis-Plus-GX emulator and it works with RCA, but unfortunately its too slow to be a viable solution.

petrockblog commented 11 years ago

You could also try the Picodrive Libretro core, which also comes with the latest binaries.

Aloshi commented 11 years ago

Here's the compatibility sheet, I think.

ian57 commented 10 years ago

I've got the same issue with PicoDrive and composite (It works well with HDMI). Will try these libs.

ian57 commented 10 years ago

I compiled SDL12-kms-dispmanx successfully but

!/bin/bash

export LD_LIBRARY_PATH="/home/pi/PicoDrive/SDL12-kms-dispmanx/libs" ; /home/pi/PicoDrive/PicoDrive

goes in black screen with composite output. It works with HDMI. I'll try to recompile Picodrive with SDL12-kms-dispmanx

adskiremote commented 10 years ago

Try DGEN. I never got this working with Pico but didn't have a problem with DGEN over composite using the dispmanx library.

You may need to change the DGEN config file though.

On 19 August 2014 14:46, Yann Morere notifications@github.com wrote:

I compiled SDL12-kms-dispmanx successfully but

!/bin/bash

export LD_LIBRARY_PATH="/home/pi/PicoDrive/SDL12-kms-dispmanx/libs" ; /home/pi/PicoDrive/PicoDrive

goes in black screen with composite output. It works with HDMI. I'll try to recompile Picodrive with SDL12-kms-dispmanx

— Reply to this email directly or view it on GitHub https://github.com/petrockblog/RetroPie-Setup/issues/161#issuecomment-52600505 .

ian57 commented 10 years ago

Ok thanks for the reply, I will switch to dgen on composite arcade ;). Will try that. I'm not using retropie... but I'll compile the dgen retropie version. Using PicoDrive 1.91 with only 1 rom works. In fact only the menu part (SDL part?) does not work. So For my use, I modified PicoDrive to run Only One rom :) and quit when quitting the game.

Thans a lot

ian57 commented 9 years ago

Hi there, got an issue using Dgen 1.33 end ES2. When quitting a game from Dgen, the pi is freezing with this error (got with dmesg) :

[ 74.341949] bcm2835_audio_set_ctls:558 Controls set for stream 0 [ 75.384679] bcm2835_audio_set_ctls:558 Controls set for stream 0 [ 75.784440] bcm2835_audio_set_ctls:558 Controls set for stream 0 [ 77.375660] Unable to handle kernel paging request at virtual address da7eb000 [ 77.375666] pgd = d6344000 [ 77.375677] [da7eb000] pgd=162f1811, pte=00000000, ppte=00000000 [ 77.375687] Internal error: Oops: 807 [#1] PREEMPT ARM [ 77.375799] Unable to handle kernel paging request at virtual address da7eb000 [ 77.375802] pgd = d6344000 [ 77.375810] [da7eb000] pgd=162f1811, pte=00000000, ppte=00000000 [ 77.375816] Internal error: Oops: 807 [#2] PREEMPT ARM [ 77.375890] KGDB: re-enter exception: ALL breakpoints killed [ 77.375898] ---[ end trace e0a85f88f87742ff ]--- [ 77.375910] note: dgen[2331] exited with preempt_count 5

This bug does not appear with ES1

I tried to update Dgen and ES2... but the bug is stil there.

An idea ?