Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up --- Bug Reports --- Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: How to make a dedicated MAME 0.237 Appliance on a Raspberry Pi 4/Pi 400  (Read 63796 times)

0 Members and 2 Guests are viewing this topic.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #240 on: September 30, 2021, 07:43:22 am »
Just to let you know the availability of the NEW disk image file with MAME 0.236 (please see the original post of this thread for the download link).  :cheers:

Enjoy!
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #241 on: September 30, 2021, 08:25:38 am »
Just to let you know the availability of the NEW disk image file with MAME 0.236 (please see the original post of this thread for the download link).  :cheers:

Enjoy!
Thanks so much for continuing with this.  Iím finally back to working on my project after a break over the summer.

Iím going to try (again) to get this working so that when I press the power button, AttractMode will show up on screen with the list of MAME games and when I press the power button again everything shuts down safely.

My CP will consist of one 4-way joystick, 2 buttons, P1 Start, P2 Start and an Exit button.  Ideally, Exit will double as Pause (press to Pause/hold down for 2 seconds to Exit to game list).

My deadline is Christmas so I need to get moving!

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #242 on: September 30, 2021, 06:21:08 pm »
Just to let you know the availability of the NEW disk image file with MAME 0.236 (please see the original post of this thread for the download link).  :cheers:

Enjoy!
Thanks so much for continuing with this.  Iím finally back to working on my project after a break over the summer.

Iím going to try (again) to get this working so that when I press the power button, AttractMode will show up on screen with the list of MAME games and when I press the power button again everything shuts down safely.

My CP will consist of one 4-way joystick, 2 buttons, P1 Start, P2 Start and an Exit button.  Ideally, Exit will double as Pause (press to Pause/hold down for 2 seconds to Exit to game list).

My deadline is Christmas so I need to get moving!

Seems to be a very nice project! I guess you will use some form of relay for the power-on and power-off button (after a clean shutdown)? Alternatively, if the Pi is still powered-on, once in a shutdown state, you can wake it up by simply shorting 2 of the GPIO pins (see https://howchoo.com/g/mwnlytk3zmm/how-to-add-a-power-button-to-your-raspberry-pi). Anyway, the behavior of the image is that once you quit the front-end, the system shuts itself automatically and cleanly.
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #243 on: October 06, 2021, 07:20:04 pm »
OK I've been messing around and I figured out how to get Attract Mode to at least display properly - there are a few people in this thread wondering what was happening when you typed "frontend attract" in rw mode and then "sudo reboot".  Attract Mode definitely works but it just says "MAME 0/1" in the bottom right corner.  This is because the default name for the Game List is "MAME" and the "0/1" means you have no games in this list.  So hit TAB and the Attract Mode menu will come up and you can play around with the settings, including populating the game list.

EDIT: I've made some progress on this.  Upon boot-up, Attract Mode launches and displays the "SDarcadeMod_v3f" theme in vertical orientation.  I got this theme off of the Attract Mode website.  It's pretty slick.  Looks exactly like the ArcadeSD menu.  I only have a keyboard connected but so far games are launching.  One thing I cannot figure out is why the menu doesn't recognize the vertical orientation - pressing left/right should scroll through the games but you still need to press up/down.  Not a huge deal but something I'd like to fix, if possible.

To make the games launch vertically, I had to go into the MAME settings ("frontend mame") and change the Advanced Configuration Options to turn on "Rotate Right".

I still have several things I need to figure out but I think this is going to be a great solution.
« Last Edit: October 07, 2021, 04:41:12 pm by javeryh »

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #244 on: October 07, 2021, 04:52:29 pm »
bbegin - I was hoping you could help me with something.  I have your image up and running and it works great.  I made a little video of it running Attract Mode.



After playing for a while, there is lots of text that appears on the screen when switching between games.  It looks like this:



Is there a way to not make this appear?  It's not a huge deal but I thought I'd ask in case there was a simple fix.

Thanks!
« Last Edit: October 08, 2021, 05:41:02 pm by javeryh »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #245 on: October 09, 2021, 12:04:37 am »
Hi Javeryh,

To answer your question, yes there is a way to suppress those messages, wich are produced by the MAME emulator.

What you need to do is to customize the command-line used to launch MAME (configured in Attract Mode under your Emulator menu). You need to add this below at the END of the command-line:

Code: [Select]
>/dev/null 2>/dev/null
EDIT (2021-10-10): in fact, you should append the line above to the "Command Arguments", from the properties of your MAME emulator definition in Attract Mode.
« Last Edit: October 10, 2021, 11:53:26 am by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #246 on: October 10, 2021, 12:32:56 pm »
Hi Javeryh,

To answer your question, yes there is a way to suppress those messages, wich are produced by the MAME emulator.

What you need to do is to customize the command-line used to launch MAME (configured in Attract Mode under your Emulator menu). You need to add this below at the END of the command-line:

Code: [Select]
>/dev/null 2>/dev/null
EDIT (2021-10-10): in fact, you should append the line above to the "Command Arguments", from the properties of your MAME emulator definition in Attract Mode.

Thanks for this.  I am not sure I am doing it correctly.  I hit "Tab" while in Attract Mode and select Emulators -> MAME -> Command Arguments and change the default "[name]" to ">/dev/null 2>/dev/null".  When I exit back to the Attract Mode game list and select a game to play, it launches the MAME GUI instead of the game.   I also tried "[name]>/dev/null 2>/dev/null" in that spot with the same result.

I'm sure I'm missing something simple...

Also, another question not really related to your application but I thought you might know the answer... I added a power button to the pi by modifying "sudo nano /boot/config.txt" and adding these two lines to the file at the end:

Code: [Select]
#shutdown button
dtoverlay=gpio-shutdown

Now bridging GPIO3 and Ground (pins 5 and 6) will shut the pi off.  Doing it again will turn it back on.  Is this a "safe shutdown"?  The shutdown is a little abrupt but it seems to be working.  I've powered on/off probably 20 times now with no issues.  It almost seems too easy!  Boots right into the Attract Mode game list.
« Last Edit: October 10, 2021, 12:42:36 pm by javeryh »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #247 on: October 10, 2021, 01:10:12 pm »
Thanks for this.  I am not sure I am doing it correctly.  I hit "Tab" while in Attract Mode and select Emulators -> MAME -> Command Arguments and change the default "[name]" to ">/dev/null 2>/dev/null".  When I exit back to the Attract Mode game list and select a game to play, it launches the MAME GUI instead of the game.   I also tried "[name]>/dev/null 2>/dev/null" in that spot with the same result.

I'm sure I'm missing something simple...

I suspect that Attract Mode is validating the input from the GUI and strip some characters (like the ">").

As an alternative way to do this, edit mame.cfg (if you called your emulator "mame"):

Code: [Select]
nano /data/attract/mame.cfg
From:

Code: [Select]
args                 [name]
To:

Code: [Select]
args                 [name] >/dev/null 2>/dev/null
Also, another question not really related to your application but I thought you might know the answer... I added a power button to the pi by modifying "sudo nano /boot/config.txt" and adding these two lines to the file at the end:

Code: [Select]
#shutdown button
dtoverlay=gpio-shutdown

Now bridging GPIO3 and Ground (pins 5 and 6) will shut the pi off.  Doing it again will turn it back on.  Is this a "safe shutdown"?  The shutdown is a little abrupt but it seems to be working.  I've powered on/off probably 20 times now with no issues.  It almost seems too easy!  Boots right into the Attract Mode game list.

Yes, I can confirm this method is good to safely shutdown the Raspberry Pi (clean unmount of the filesystem, including the read/write /data partition).
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #248 on: October 10, 2021, 01:44:17 pm »
Thanks for this.  I am not sure I am doing it correctly.  I hit "Tab" while in Attract Mode and select Emulators -> MAME -> Command Arguments and change the default "[name]" to ">/dev/null 2>/dev/null".  When I exit back to the Attract Mode game list and select a game to play, it launches the MAME GUI instead of the game.   I also tried "[name]>/dev/null 2>/dev/null" in that spot with the same result.

I'm sure I'm missing something simple...

I suspect that Attract Mode is validating the input from the GUI and strip some characters (like the ">").

As an alternative way to do this, edit mame.cfg (if you called your emulator "mame"):

Code: [Select]
nano /data/attract/mame.cfg
From:

Code: [Select]
args                 [name]
To:

Code: [Select]
args                 [name] >/dev/null 2>/dev/null
Also, another question not really related to your application but I thought you might know the answer... I added a power button to the pi by modifying "sudo nano /boot/config.txt" and adding these two lines to the file at the end:

Code: [Select]
#shutdown button
dtoverlay=gpio-shutdown

Now bridging GPIO3 and Ground (pins 5 and 6) will shut the pi off.  Doing it again will turn it back on.  Is this a "safe shutdown"?  The shutdown is a little abrupt but it seems to be working.  I've powered on/off probably 20 times now with no issues.  It almost seems too easy!  Boots right into the Attract Mode game list.

Yes, I can confirm this method is good to safely shutdown the Raspberry Pi (clean unmount of the filesystem, including the read/write /data partition).
Thanks!  This made things better but not perfect.  Good enough for sure.  I am still getting a text readout of ďaverage speedĒ between games.  Every time I exit it adds a line.



Not a big deal at all.  Also good to know that my shutdown is ďsafeĒ.  Iím pretty much finished with co figuring this setup and itís going to work out great.  Much much easier to not have to include a full Windows PC just to run some 80s arcade games!

Thanks!

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #249 on: October 11, 2021, 12:48:22 am »
Thanks!  This made things better but not perfect.  Good enough for sure.  I am still getting a text readout of ďaverage speedĒ between games.  Every time I exit it adds a line.



It's like the first redirection was not used by AM. I would suggest you put this variation (notice the 1 before the redirect character >):

Code: [Select]
args                 [name] 1>/dev/null 2>/dev/null
If it's not woking, you can at least rotate the console text output:

Code: [Select]
sudo nano /boot/cmdline.txt
Append the below text to the kernel command-line:

Code: [Select]
fbcon=rotate:1
Not a big deal at all.  Also good to know that my shutdown is ďsafeĒ.  Iím pretty much finished with co figuring this setup and itís going to work out great.  Much much easier to not have to include a full Windows PC just to run some 80s arcade games!

Thanks!

Oh yes you're right, I think this solution is WAY simpler and more effective than a full-blown Windows PC in an arcade cabinet.  :D  Enjoy!  :cheers:
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #250 on: October 11, 2021, 02:05:16 pm »
No dice.  Oh well.  I can live with it.  The text is already rotated to the bottom left of the screen because I am running everything in portrait mode so I don't have to do anything else... I think haha.  I've had it running almost continuously during the day for the last 4 or 5 days and I've rebooted probably 25+ times now and no issues.

A few things to note:
- When I exit back to Attract Mode, the video snap is off center almost like it is between game selections.  This definitely seems like an Attract Mode issue.  Moving left or right fixes this so no big deal.
- Astro Blaster is unplayable, which was surprising to me.  There is synthesized speech in the game so maybe that is causing the slow down but it's a really old game so I expected it to run.  Everything else in my game list appears to be working great!

 :cheers:

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #251 on: October 12, 2021, 09:30:25 am »
It's like the first redirection was not used by AM. I would suggest you put this variation (notice the 1 before the redirect character >):

Code: [Select]
args                 [name] 1>/dev/null 2>/dev/null
bbegin - since this isn't working, Ond had an idea to make the text a different color (black or clear?) to make it blend into the blank screen.  Is this possible?

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #252 on: October 12, 2021, 10:21:31 am »
It's like the first redirection was not used by AM. I would suggest you put this variation (notice the 1 before the redirect character >):

Code: [Select]
args                 [name] 1>/dev/null 2>/dev/null

bbegin - since this isn't working, Ond had an idea to make the text a different color (black or clear?) to make it blend into the blank screen.  Is this possible?

Maybe you could ajust the executable variable of Attract Mode to inject a foreground color change just prior to launch MAME:

Code: [Select]
nano /data/attract/emulators/mame.cfg
Change:
Code: [Select]
executable           /home/pi/mame/mame
To:
Code: [Select]
executable           setterm -foreground black;/home/pi/mame/mame
« Last Edit: October 12, 2021, 10:56:13 am by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 57
  • Last login:Today at 06:22:07 pm
  • L BREAK into program
    • DKAFE Frontend
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #253 on: October 12, 2021, 11:19:52 am »
I use a combination of nohup and redirection to suppress output on Raspberry Pi.  Works for me.  Here's a simple example.

Code: [Select]
nohup mame dkong >/dev/null 2>&1
I figure this will work for your scenario by updating your executable line to be:

Code: [Select]
executable           nohup /home/pi/mame/mame
and your args line to be:

Code: [Select]
args                  [name] >/dev/null 2>&1
« Last Edit: October 12, 2021, 11:23:05 am by 10yard »
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #254 on: October 12, 2021, 11:56:55 am »
Thanks guys - unfortunately, neither option is working.  I get an error trying to launch a game that brings me back to the game list.  I don't think it likes any instructions before the "/home/pi/mame/mame" executable. 

I'm good.  Really, this has worked out better than I thought it was going to.  If (ok... when) I build another cabinet down the road I might look to make some further tweaks but this is going inside of a Christmas gift to someone who won't know the difference at all.  They will just be happy to play Ms. Pac-Man again.   :cheers:

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #255 on: October 13, 2021, 04:14:07 pm »
OK.. I found this thread (http://forum.arcadecontrols.com/index.php?topic=157745.0) and the fix apparently works on Retropie but it involves changing autostart.sh and I'm a little afraid to mess with this... but maybe it's a solution?

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #256 on: October 13, 2021, 05:21:54 pm »
OK.. I found this thread (http://forum.arcadecontrols.com/index.php?topic=157745.0) and the fix apparently works on Retropie but it involves changing autostart.sh and I'm a little afraid to mess with this... but maybe it's a solution?

Good finding! :)

To adapt the fix presented in the thread to the autostart.sh script:

Code: [Select]
nano ~/scripts/autostart.sh
Add the lines to get the following (partial shown):

Code: [Select]
if [ ! -z $FRONTEND ]; then
  while
    case ${FRONTEND,,} in
      attract)  # Attract Mode
        setterm -cursor off
        stty -echo
        /usr/local/bin/attract --loglevel silent 2>&1 | grep -o $'\033\[2J'
        ;;
      advance)  # AdvanceMENU

I tested and it works great! :)
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Ond

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2171
  • Last login:November 25, 2021, 02:46:15 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #257 on: October 13, 2021, 06:01:35 pm »
Can you make this a part of a new build release?  If you address all the issues of a visible OS in the background you have a strong contender for an up-to-date alternative to other emulation platforms regardless of whether they are based in hardware or software.   :cheers:

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #258 on: October 13, 2021, 07:31:48 pm »
OK, just so I'm clear I need to:

1.  modify autostart.sh changing it from this:

Code: [Select]
#!/bin/bash

# This script launch the selected application (front-end or MAME emulator) and respawn it if quit unexpectedly.

if [ ! -z $FRONTEND ]; then
  while
    case ${FRONTEND,,} in
      attract)
        /usr/local/bin/attract --loglevel silent
        ;;
      advance)
        /home/pi/frontend/advance/advmenu
        ;;
      mame)
        /home/pi/mame/mame > /dev/null
        ;;
    esac
    (( $? != 0 ))
  do
    :
  done
else
    echo $0 - Variable FRONTEND is not defined!
    read -n 1 -s -r -p "Press any key to continue..."
    echo
fi

to this:

Code: [Select]
#!/bin/bash

# This script launch the selected application (front-end or MAME emulator) and respawn it if quit unexpectedly.

if [ ! -z $FRONTEND ]; then
  while
    case ${FRONTEND,,} in
      attract)  # Attract Mode
        setterm -cursor off
        stty -echo
        /usr/local/bin/attract --loglevel silent 2>&1 | grep -o $'\033\[2J'
        ;;
      advance)  # AdvanceMENU
        /home/pi/frontend/advance/advmenu
        ;;
      mame)
        /home/pi/mame/mame > /dev/null
        ;;
    esac
    (( $? != 0 ))
  do
    :
  done
else
    echo $0 - Variable FRONTEND is not defined!
    read -n 1 -s -r -p "Press any key to continue..."
    echo
fi

2.  Create a new file named runcommand-onstart.sh (create a .txt file first and change the file extension to .sh) that contains only:

Code: [Select]
printf "\033[H\033[2J"

3.  Create a new file named runcommand-onend.sh (create a .txt file first and change the file extension to .sh) that contains only:

Code: [Select]
printf "\033[H\033[2J"

4.  Put runcommand-onstart.sh and runcommand-onend.sh into /home/pi/scripts/

5.  sudo rebooot.

Is that correct?

Can you ​make this a part of a new build release?  If you address all the issues of a visible OS in the background you have a strong contender for an up-to-date alternative to other emulation platforms regardless of whether they are based in hardware or software.   :cheers:

I agree!  I've had to make several minor tweaks to get it to behave like I want (and I am as anal as they come on presentation).  Nothing major but I was going for as clean of an install as possible.  I'll have to make a list of everything I did after mounting the image on the microSD card...

I should be clear though - bbegin did an AMAZING job with this and has been wonderful answering very specific questions.  This is a game changer as far as I'm concerned for cabinets running the classics.  I've had my pi on for about 5 days straight (rebooting 30+ times by now) and everything is still working as expected.   :cheers:
« Last Edit: October 13, 2021, 07:34:48 pm by javeryh »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #259 on: October 13, 2021, 09:25:48 pm »
Hi javeryh ,

You just have to do step 1 and 5 (steps 2, 3, 4 are not applicable to the system I publish).

I will publish today a new version of the image file with these changes implemented.

The system is very stable, it was a condition for me in the first place to publish it. An arcade machine HAS to be very reliable. :)
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #260 on: October 13, 2021, 09:47:19 pm »
As promised, I just uploaded an UPDATED version of the image file incorporating the suppression of the output from MAME while using the Attract Mode frontend. Please refer to the original post of this thread (the download link remain the same).

Enjoy!  :cheers:
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Ond

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2171
  • Last login:November 25, 2021, 02:46:15 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #261 on: October 14, 2021, 01:31:36 am »

I should be clear though - bbegin did an AMAZING job with this and has been wonderful answering very specific questions.  This is a game changer as far as I'm concerned for cabinets running the classics.  I've had my pi on for about 5 days straight (rebooting 30+ times by now) and everything is still working as expected.   :cheers:

Agreed, without his work we wouldn't have an up-to-date, ready to go solution for Raspberry Pi 4.  It's early days, but certainly more desirable than RetroPie.   :applaud:  :cheers:

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #262 on: October 14, 2021, 09:32:31 am »
Hi javeryh ,

You just have to do step 1 and 5 (steps 2, 3, 4 are not applicable to the system I publish).

I will publish today a new version of the image file with these changes implemented.

The system is very stable, it was a condition for me in the first place to publish it. An arcade machine HAS to be very reliable. :)

It works!!!  It's so clean.  Looks absolutely commercial grade now.  Boots directly to front end -> after selecting a game it flashes to a black screen -> play the game -> press 'exit' and it flashes to a black screen -> back to the front end.  Repeat.  With the safe shutdown button script installed you get one button power on/off too.  So cool.

I'll post a video and a list of all the little tweaks I made when I get a chance (removing MAME logos, installing AM theme, fixing AM centering issue, configuring controls so no ESC from AM, adding skips to mame.ini, etc.).  This is behaving exactly like I envisioned.

EDIT: I also fixed the centering issue when exiting games back to the front end:

You just have to set the ResFix-Plugin in Attract Mode.

Start AM > press TAB key > Plug-Ins > ResFix > Enabled : Yes > Specific Emulators : your_Display_Name (or leave this blank for it to apply to all of them).

Once I did this, exiting a game goes back to the list and the snap is centered like it should be.
« Last Edit: October 14, 2021, 09:38:10 am by javeryh »

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #263 on: October 14, 2021, 11:58:10 am »
Hereís a quick video of it in action:



Itís perfect!

Ond

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2171
  • Last login:November 25, 2021, 02:46:15 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #264 on: October 14, 2021, 04:07:10 pm »
Excellent. Simple, clean and quick.  Your original criteria when we were discussing the options months ago have been met.  I felt strongly then that this was a great solution.  I think there's going to be some very happy people getting some cool arcade machines  ;)

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4B
« Reply #265 on: October 14, 2021, 07:31:15 pm »
Excellent. Simple, clean and quick.  Your original criteria when we were discussing the options months ago have been met.  I felt strongly then that this was a great solution.  I think there's going to be some very happy people getting some cool arcade machines  ;)
Yeah - I canít say enough good things about this.  When I find some time Iíll make a post on the main forum giving bbegin full credit of course.  I can also list my tweaks, theme, etc. if people are interested.  I think more people need to see this solution and I get the sense that not a lot of people are on this particular forum.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #266 on: October 20, 2021, 07:11:51 pm »
How would you react if I told you that I successfully added a fully-working LaserDisc games emulator (formerly Daphne, the updated fork is named Hypseus) to the image, so you can play games like Dragon's Lair, Space Ace and many others?

I will make the updated image file (wich include Hypseus version 2.6.16) available in a couple of minutes. :)

Note that you must use a front-end to launch your LaserDisc games (Attract Mode and AdvanceMENU are available).

Cheers!  :cheers:
« Last Edit: October 20, 2021, 08:24:43 pm by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Gilrock

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 938
  • Last login:November 24, 2021, 01:10:55 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #267 on: October 21, 2021, 07:53:58 am »
Ok now you got my attention adding one of my favorites. Awesome job!

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #268 on: October 21, 2021, 01:34:07 pm »
The updated image is now available (see original post, the download URL remain the same).

PLEASE NOTE: at this time, there is an issue (minor, cosmetic) when exiting Hypseus: I get this warning message:

Code: [Select]
WARN:

Assertion failure at SDL_DestroyTexture_REAL (/home/pi/SDL2-2.0.16/src/render/SDL_render.c:3349), triggered 1 time:
  'texture && texture->magic == &texture_magic'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] :

The gameplay is not affected and the emulator is 100% functionnal. I need to investigate further as to why this message is displayed and if there is a way to get rid of it.
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

javeryh

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 7604
  • Last login:Today at 08:40:53 pm
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #269 on: October 21, 2021, 02:50:42 pm »
How would you react if I told you that I successfully added a fully-working LaserDisc games emulator (formerly Daphne, the updated fork is named Hypseus) to the image, so you can play games like Dragon's Lair, Space Ace and many others?

I will make the updated image file (wich include Hypseus version 2.6.16) available in a couple of minutes. :)

Note that you must use a front-end to launch your LaserDisc games (Attract Mode and AdvanceMENU are available).

Cheers!  :cheers:

Awesome!  Can the laserdisc games be merged into one gamelist with the MAME games or does it need to remain separate?

Also, I posted my setup on the Main Forum and there is some interest...

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #270 on: October 21, 2021, 08:51:35 pm »
Awesome!  Can the laserdisc games be merged into one gamelist with the MAME games or does it need to remain separate?

Also, I posted my setup on the Main Forum and there is some interest...

I think you may be able (not tested) to run your laserdisc games with a single gamelist, although you will need to edit the laserdisc entries and customize the binary location to call the hypseus binary as well as the arguments to launch your specific LD game.

Thanks for the post on the main forum, I appreciate! :)
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

10yard

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 57
  • Last login:Today at 06:22:07 pm
  • L BREAK into program
    • DKAFE Frontend
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #271 on: October 22, 2021, 04:18:18 am »
The updated image is now available (see original post, the download URL remain the same).

PLEASE NOTE: at this time, there is an issue (minor, cosmetic) when exiting Hypseus: I get this warning message:

Code: [Select]
WARN:

Assertion failure at SDL_DestroyTexture_REAL (/home/pi/SDL2-2.0.16/src/render/SDL_render.c:3349), triggered 1 time:
  'texture && texture->magic == &texture_magic'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] :

The gameplay is not affected and the emulator is 100% functionnal. I need to investigate further as to why this message is displayed and if there is a way to get rid of it.

As you are building SDL2 without X11 support you may as well suppress the output of SDL warning messages - since you should already have the source code sitting on your build machine.   You could suppress this one specific message by commenting out the "CHECK_TEXTURE_MAGIC" code at line 3349 in src/render/SDL_render.c

Code: [Select]
// ** Suppress error message output **
//    CHECK_TEXTURE_MAGIC(texture, );

or you could suppress output of ALL error messages by updating /src/SDL_error.c around line 40 i.e.:

Code: [Select]
       
// ** Suppress error message output **
//va_start(ap, fmt);
//SDL_vsnprintf(error->str, ERR_MAX_STRLEN, fmt, ap);
//va_end(ap);

Compile it and install it.  Done.
Check out my Donkey Kong Arcade Frontend at https://github.com/10yard/dkafe#readme

DirtBagXon

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 01, 2021, 09:04:50 pm
  • Hypseus Singe developer.
    • Hypseus Singe
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #272 on: October 22, 2021, 03:54:27 pm »
PLEASE NOTE: at this time, there is an issue (minor, cosmetic) when exiting Hypseus: I get this warning message:

Code: [Select]
WARN:

Assertion failure at SDL_DestroyTexture_REAL (/home/pi/SDL2-2.0.16/src/render/SDL_render.c:3349), triggered 1 time:
  'texture && texture->magic == &texture_magic'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] :


Hi,

Hypseus developer here.

I have downloaded the image from the first post, and have it running on a Pi 4.

Can you give me a quick run down, either here or PM, on how/where I would run hypseus from in 'arcademode'

Where do I place roms/m2v/ogg and framefiles in the standard setup and more importantly how I would compile and install the binary to match the default setup.

I assume you are using the 'RetroPie' branch from the hypseus repo as it's using the system libmpeg2.so.0

Also, how and where do I see the output of the logs and be able to see the assertion errors above ?

Thanks.
« Last Edit: October 22, 2021, 04:03:47 pm by DirtBagXon »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #273 on: October 22, 2021, 06:09:54 pm »
PLEASE NOTE: at this time, there is an issue (minor, cosmetic) when exiting Hypseus: I get this warning message:

Code: [Select]
WARN:

Assertion failure at SDL_DestroyTexture_REAL (/home/pi/SDL2-2.0.16/src/render/SDL_render.c:3349), triggered 1 time:
  'texture && texture->magic == &texture_magic'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] :


Hi,

Hypseus developer here.

I have downloaded the image from the first post, and have it running on a Pi 4.

Can you give me a quick run down, either here or PM, on how/where I would run hypseus from in 'arcademode'

Where do I place roms/m2v/ogg and framefiles in the standard setup and more importantly how I would compile and install the binary to match the default setup.

I assume you are using the 'RetroPie' branch from the hypseus repo as it's using the system libmpeg2.so.0

Also, how and where do I see the output of the logs and be able to see the assertion errors above ?

Thanks.

Hi DirtBagXon,

I think I can answer your questions:
1. For now, to manually launch Hypseus and be able to see the log output, you have to switch to Service Mode (just type servicemode from an SSH session).
2. You have to expand the /data partition with the execution of ./expand-data-partition.sh
3. Place the video/audio files under /data/hypseus/framefile/<your-game>
4. Place the ROMs files (unzipped) under /data/hypseus/roms/<your-game>
5. Run Hypseus from the /home/pi/hypseus location. Take a look at the 2 launch scripts already there (Dragon's Lair and Space Ace).
6. I use the v2.6.16-RPi realease (wget https://github.com/DirtBagXon/hypseus-singe/archive/refs/tags/v2.6.16-RPi.zip)
7. Launch Hypseus in Service Mode from a SSH session, you will see the log output and the video will play on the console output of the Pi.
8. I compiled the Hypseus binary simply by following your instructions (mkdir build; cd build; cmake ../src; make -j4) - note that you may need to install cmake and build-essential packages with apt-get install.

Thanks very much for your great help!
« Last Edit: October 22, 2021, 06:23:32 pm by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Vocalitus

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 400
  • Last login:October 25, 2021, 06:16:58 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #274 on: October 22, 2021, 07:18:44 pm »
PLEASE NOTE: at this time, there is an issue (minor, cosmetic) when exiting Hypseus: I get this warning message:

Code: [Select]
WARN:

Assertion failure at SDL_DestroyTexture_REAL (/home/pi/SDL2-2.0.16/src/render/SDL_render.c:3349), triggered 1 time:
  'texture && texture->magic == &texture_magic'

Abort/Break/Retry/Ignore/AlwaysIgnore? [abriA] :


Hi,

Hypseus developer here.

I have downloaded the image from the first post, and have it running on a Pi 4.

Can you give me a quick run down, either here or PM, on how/where I would run hypseus from in 'arcademode'

Where do I place roms/m2v/ogg and framefiles in the standard setup and more importantly how I would compile and install the binary to match the default setup.

I assume you are using the 'RetroPie' branch from the hypseus repo as it's using the system libmpeg2.so.0

Also, how and where do I see the output of the logs and be able to see the assertion errors above ?

Thanks.

Sorry to thread Hijack.

Hi can you fix the bug that is stopping Daphne and Hypseus from detecting the Dragonrise encoder?

No matter how you change the daphinput file, the controls are reversed for left and right and up and down does not work.

It has been a pain to get working for like ever.  Works fine on Xbox controller and keyboard so it could be a mapping issue.

Thanks.

DirtBagXon

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 01, 2021, 09:04:50 pm
  • Hypseus Singe developer.
    • Hypseus Singe
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #275 on: October 22, 2021, 08:26:08 pm »
Hi DirtBagXon,

I think I can answer your questions:
1. For now, to manually launch Hypseus and be able to see the log output, you have to switch to Service Mode (just type servicemode from an SSH session).
2. You have to expand the /data partition with the execution of ./expand-data-partition.sh
3. Place the video/audio files under /data/hypseus/framefile/<your-game>
4. Place the ROMs files (unzipped) under /data/hypseus/roms/<your-game>
5. Run Hypseus from the /home/pi/hypseus location. Take a look at the 2 launch scripts already there (Dragon's Lair and Space Ace).
6. I use the v2.6.16-RPi realease (wget https://github.com/DirtBagXon/hypseus-singe/archive/refs/tags/v2.6.16-RPi.zip)
7. Launch Hypseus in Service Mode from a SSH session, you will see the log output and the video will play on the console output of the Pi.
8. I compiled the Hypseus binary simply by following your instructions (mkdir build; cd build; cmake ../src; make -j4) - note that you may need to install cmake and build-essential packages with apt-get install.

Thanks very much for your great help!

Hi, thanks that made it fairly straightforward. I also somehow managed to delete the repo discussion, but will put the patch here that fixes the assertions:

Code: [Select]
diff --git a/src/hypseus.cpp b/src/hypseus.cpp
index a939731..82e82ed 100644
--- a/src/hypseus.cpp
+++ b/src/hypseus.cpp
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
     restore_leds(); // sets keyboard leds back how they were (this is safe even
                     // if we have the led's disabled)
 
-    SDL_Quit();
+    //SDL_Quit();
     exit(result_code);
 }
 
diff --git a/src/video/video.cpp b/src/video/video.cpp
index eed7c43..63fa1e8 100644
--- a/src/video/video.cpp
+++ b/src/video/video.cpp
@@ -440,14 +440,26 @@ void vid_free_yuv_overlay () {
 // returns true if successful, false if failure
 bool deinit_display()
 {
-    SDL_FreeSurface(g_screen_blitter);
-    SDL_FreeSurface(g_leds_surface);
 
-    SDL_DestroyTexture(g_overlay_texture);
-    SDL_DestroyTexture(g_sb_texture);
+    if (g_screen_blitter)
+        SDL_FreeSurface(g_screen_blitter);
 
-    SDL_DestroyRenderer(g_sb_renderer);
-    SDL_DestroyRenderer(g_renderer);
+    if (g_leds_surface)
+        SDL_FreeSurface(g_leds_surface);
+
+    if (g_overlay_texture)
+        SDL_DestroyTexture(g_overlay_texture);
+
+    if (g_sb_texture)
+        SDL_DestroyTexture(g_sb_texture);
+
+    if (g_sb_renderer)
+        SDL_DestroyRenderer(g_sb_renderer);
+
+/*
+    if (g_renderer)
+        SDL_DestroyRenderer(g_renderer);
+*/
 
     return (true);
 }

This is a broken display environment as far as I can currently see.

Checks to detect if the main SDL renderer is present, return that it is there, but then a subsequent attempt to remove it asserts.
Don't use `-software_scoreboard` that is within your script, it seems to leave the display in an unrecoverable state.

Also `SDL_Quit()` asserts, which is just bizzare.

The above patch should allow the emulator to exit cleanly from testing with `ace`.

DirtBagXon

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 10
  • Last login:November 01, 2021, 09:04:50 pm
  • Hypseus Singe developer.
    • Hypseus Singe
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #276 on: October 22, 2021, 08:34:52 pm »
Sorry to thread Hijack.

Hi can you fix the bug that is stopping Daphne and Hypseus from detecting the Dragonrise encoder?

No matter how you change the daphinput file, the controls are reversed for left and right and up and down does not work.

It has been a pain to get working for like ever.  Works fine on Xbox controller and keyboard so it could be a mapping issue.

Thanks.

Hi,

Not certain what you are seeing here, I have an Arcade1Up with two DragonRise controllers that map fine.

Reports from RetroPie users have also successfully used DragonRise controllers without issues I am aware of.

Are you seeing the axis changes and button pushes with `jstest` ?

Are you doing the appropriate transposition of the controller number definitions in config ?

I would post my DR config, but would probably not correlate to anything like you have.

Edit: Noticed you stated "daphinput file" - Hypseus will ignore that.
It uses the hypinput,ini file and SDL2 scancode values as per the example: https://github.com/DirtBagXon/hypseus-singe/blob/master/doc/hypinput.ini
« Last Edit: October 22, 2021, 08:45:11 pm by DirtBagXon »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #277 on: October 22, 2021, 09:11:10 pm »
Hi, thanks that made it fairly straightforward. I also somehow managed to delete the repo discussion, but will put the patch here that fixes the assertions:

Code: [Select]
diff --git a/src/hypseus.cpp b/src/hypseus.cpp
index a939731..82e82ed 100644
--- a/src/hypseus.cpp
+++ b/src/hypseus.cpp
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
     restore_leds(); // sets keyboard leds back how they were (this is safe even
                     // if we have the led's disabled)
 
-    SDL_Quit();
+    //SDL_Quit();
     exit(result_code);
 }
 
diff --git a/src/video/video.cpp b/src/video/video.cpp
index eed7c43..63fa1e8 100644
--- a/src/video/video.cpp
+++ b/src/video/video.cpp
@@ -440,14 +440,26 @@ void vid_free_yuv_overlay () {
 // returns true if successful, false if failure
 bool deinit_display()
 {
-    SDL_FreeSurface(g_screen_blitter);
-    SDL_FreeSurface(g_leds_surface);
 
-    SDL_DestroyTexture(g_overlay_texture);
-    SDL_DestroyTexture(g_sb_texture);
+    if (g_screen_blitter)
+        SDL_FreeSurface(g_screen_blitter);
 
-    SDL_DestroyRenderer(g_sb_renderer);
-    SDL_DestroyRenderer(g_renderer);
+    if (g_leds_surface)
+        SDL_FreeSurface(g_leds_surface);
+
+    if (g_overlay_texture)
+        SDL_DestroyTexture(g_overlay_texture);
+
+    if (g_sb_texture)
+        SDL_DestroyTexture(g_sb_texture);
+
+    if (g_sb_renderer)
+        SDL_DestroyRenderer(g_sb_renderer);
+
+/*
+    if (g_renderer)
+        SDL_DestroyRenderer(g_renderer);
+*/
 
     return (true);
 }

This is a broken display environment as far as I can currently see.

Checks to detect if the main SDL renderer is present, return that it is there, but then a subsequent attempt to remove it asserts.
Don't use `-software_scoreboard` that is within your script, it seems to leave the display in an unrecoverable state.

Also `SDL_Quit()` asserts, which is just bizzare.

The above patch should allow the emulator to exit cleanly from testing with `ace`.

Thanks very much for your help, it solved the assertion problem.

If your assumption is true about the broken display environment, then I'm wondering why MAME, Attract Mode or AdvanceMENU do not complain when exiting, I guess these will free the allocated resources before exiting?

Anyway thanks a lot, I will try to double check my video stack to make sure I did'nt introduced weird configs or incompatibilities between components.
« Last Edit: October 22, 2021, 09:17:36 pm by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 153
  • Last login:November 23, 2021, 12:23:43 pm
  • Arcade games enthusiast, bartop arcade project WIP
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #278 on: October 22, 2021, 09:18:35 pm »
Hi, thanks that made it fairly straightforward. I also somehow managed to delete the repo discussion, but will put the patch here that fixes the assertions:

Code: [Select]
diff --git a/src/hypseus.cpp b/src/hypseus.cpp
index a939731..82e82ed 100644
--- a/src/hypseus.cpp
+++ b/src/hypseus.cpp
@@ -290,7 +290,7 @@ int main(int argc, char **argv)
     restore_leds(); // sets keyboard leds back how they were (this is safe even
                     // if we have the led's disabled)
 
-    SDL_Quit();
+    //SDL_Quit();
     exit(result_code);
 }
 
diff --git a/src/video/video.cpp b/src/video/video.cpp
index eed7c43..63fa1e8 100644
--- a/src/video/video.cpp
+++ b/src/video/video.cpp
@@ -440,14 +440,26 @@ void vid_free_yuv_overlay () {
 // returns true if successful, false if failure
 bool deinit_display()
 {
-    SDL_FreeSurface(g_screen_blitter);
-    SDL_FreeSurface(g_leds_surface);
 
-    SDL_DestroyTexture(g_overlay_texture);
-    SDL_DestroyTexture(g_sb_texture);
+    if (g_screen_blitter)
+        SDL_FreeSurface(g_screen_blitter);
 
-    SDL_DestroyRenderer(g_sb_renderer);
-    SDL_DestroyRenderer(g_renderer);
+    if (g_leds_surface)
+        SDL_FreeSurface(g_leds_surface);
+
+    if (g_overlay_texture)
+        SDL_DestroyTexture(g_overlay_texture);
+
+    if (g_sb_texture)
+        SDL_DestroyTexture(g_sb_texture);
+
+    if (g_sb_renderer)
+        SDL_DestroyRenderer(g_sb_renderer);
+
+/*
+    if (g_renderer)
+        SDL_DestroyRenderer(g_renderer);
+*/
 
     return (true);
 }

This is a broken display environment as far as I can currently see.

Checks to detect if the main SDL renderer is present, return that it is there, but then a subsequent attempt to remove it asserts.
Don't use `-software_scoreboard` that is within your script, it seems to leave the display in an unrecoverable state.

Also `SDL_Quit()` asserts, which is just bizzare.

The above patch should allow the emulator to exit cleanly from testing with `ace`.

Thanks very much for your help, it solved the assertion problem.  :notworthy:  :applaud:

If your assumption is true about the broken display environment, then I'm wondering why MAME, Attract Mode or AdvanceMENU do not complain when exiting, I guess these will free the allocated resources before exiting...   :dizzy:  Maybe that's because I maintain the boot splash (I use fim and it uses SDL) even after the boot is complete... I will validate if this could be the cause or not.

Anyway thanks a lot, I will try to double check my video stack to make sure I did'nt introduced weird configs or incompatibilities between components.
« Last Edit: October 22, 2021, 10:16:26 pm by bbegin »
Personal project:
How to make a dedicated MAME Appliance on a Raspberry Pi 4/Pi 400
https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

bobbyb13

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 947
  • Last login:Today at 11:58:59 am
  • I'm TRYing to build arcade controls!
Re: How to make a dedicated MAME 0.236 Appliance on a Raspberry Pi 4/Pi 400
« Reply #279 on: October 22, 2021, 10:27:41 pm »
Can't wait to try this. Thank you everyone for your work on this project!
What's that watermelon doing there?