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 Appliance on a Raspberry Pi 4B  (Read 7684 times)

1 Member and 1 Guest are viewing this topic.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Hi all,

I worked on a personal project for the last 2 months.

The objective was to use a Raspberry Pi 4B and make it as a dedicated MAME Appliance. The system is minimal (following the JeOS principle) and boot straight into MAME 0.224, the latest version as of today. No clutter, no waste of resources and most of all, no useless GUI (X11).

The performances are really good, as most of the '80s and '90s arcade games run at full speed. Many 2000s games run at full speed as well.

Features and functionalities:
  • Based on Raspbian Lite (minimal Linux edition based on Debian);
  • At startup, display of a custom splash screen (for example, the MAME logo);
  • The MAME emulator starts automatically and displays the ROM selection screen;
  • When you exit MAME, the system initiates a shutdown;
  • During the shutdown, display of a personalized splash screen (for example, the MAME logo);
  • When the stop operations are completed, the system powers off;
  • To preserve the life of the SD card, the root filesystem is kept in read-only mode;
  • ROMs Hiscores are persistent;
  • A maintenance mode is proposed (it's called the Service Mode) to allow system updates and the management of ROMs and Snapshots (via a Samba file share).

Youtube demonstration video:


I made a How-To Guide and hosted it on GitHub, but as I am French-speaking, it is written in French. Feel free to translate it to English with Google Translate.

Here is the link to the Step-by-Step How-to Guide:

https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Google Translate to English : https://translate.google.ca/translate?hl=fr&tab=wT&sl=fr&tl=en&u=https%3A%2F%2Fgist.github.com%2Fsonicprod%2Ff5a7bb10fb9ed1cc5124766831e120c4

Feel free to comment.

Thanks and happy classic/arcade gaming!  :D
-------------------
EDIT 2020/09/20: Here is a new 10 GB SD card image of the system with MAME 0.224 (arcade systems *and* classic computer systems), without ROMs (just put them into /data/roms using the Samba share while in Service mode):

https://drive.google.com/file/d/1IpnNJItYmzTxHWIPWItnyTjNfiOJInGB

Important information:
   - The password of the user pi is left to default (raspberry)
   - The Wi-Fi has not been disabled
   - No overclocking has been configured in /boot/config.txt
   - No controller has been configured in mame.ini
   - You will have to expand the /data partition by executing a script (see below)

The system will initially boot in Service mode. Just log in and type:

Code: [Select]
./expand-data-partition.sh
This script will expand /data from 100 MB to all the available free space of the SD Card.

Basically, these commands are executed when you launch the expand script:
Code: [Select]
#!/bin/bash

# This script will expand /dev/mmcblk0p3 partition (data) to all the available space on the storage device.

if (systemctl -q is-active mame-autostart.service) then
    echo "The system must be put in SERVICE Mode first."
    exit
fi

echo ---------------------------------------------
echo CURRENT size of /data: $(df -Th /data | awk '{if ($7 == "/data") print $3}')
echo ---------------------------------------------
sudo umount /data
echo ", +" | sudo sfdisk -q -N 3 --force /dev/mmcblk0
sudo partprobe /dev/mmcblk0
sudo resize.f2fs /dev/mmcblk0p3
sudo mount -a
echo ---------------------------------------------
echo NEW size of /data: $(df -Th /data | awk '{if ($7 == "/data") print $3}')
echo ---------------------------------------------
echo Expand operation completed.
-----

Let me know of your appreciation of the system!  :-)
« Last Edit: September 23, 2020, 05:12:40 pm by bbegin »

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #1 on: May 26, 2020, 04:57:54 pm »
Interesting project. I guess you could get an even more trimmed down OS by using something else thatn Raspbian, but it would be much more complicated.

One question though: the default SDL2 raspbian package doesn't have KMS support ???
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #2 on: May 26, 2020, 07:50:08 pm »
Interesting project. I guess you could get an even more trimmed down OS by using something else thatn Raspbian, but it would be much more complicated.

Yes, you are correct (at least in my opinion).

One question though: the default SDL2 raspbian package doesn't have KMS support ???

There are two (2) problems with the available SDL2 pre-built .deb package from Raspbian repository:
1) SDL2 is built with X11 support, wich drain way too much resources from the Rasperry Pi 4. We are rather using Open GL ES 2 as the graphic rendering engine.
2) Starting from version 2.0.11 of SDL2, a bug is introduced when using KMS/DRM backend and MAME will systematically output a Segmentation fault as soon as we select a game (graphic mode switching).
« Last Edit: May 26, 2020, 07:54:28 pm by bbegin »

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #3 on: May 27, 2020, 01:57:43 pm »
Yes, cool project.
I'm building it right now with gcc8 on armbian buster minimal for an odroid xu4.
I'm curious if it'll work out and how its performance will be.
Always nice to try something new.
Thank you.

Edit: I just looked at your video - you really should try https://github.com/mgzme/MAME-PSGS as it looks stunning.
« Last Edit: May 27, 2020, 02:06:02 pm by ZoOl007 »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #4 on: May 27, 2020, 07:36:11 pm »
Yes, cool project.
I'm building it right now with gcc8 on armbian buster minimal for an odroid xu4.
I'm curious if it'll work out and how its performance will be.
Always nice to try something new.
Thank you.

Edit: I just looked at your video - you really should try https://github.com/mgzme/MAME-PSGS as it looks stunning.

Yes, most of the steps (if not all of them) should work with your Odroid XU4 based on Armbian Buster.

Please keep me informed of the level of performance you get on game emulation with MAME. :)

Thanks,
« Last Edit: May 27, 2020, 11:52:23 pm by bbegin »

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #5 on: May 28, 2020, 08:26:32 am »
Not trying to sell groovyarcade, but Arch Linux is a great and up to date distro, and pretty lightweight. You could give a try to archlinuxarm (the mame binary should be compatible). The main adgantage is that the steps would be pretty much the same for pi, xu4 or whichever SBC.

See https://archlinuxarm.org/platforms
.
The real question is: did they compile SDL2 with KMS ... If it's using the same package as on x86, the answer should be yes as I've tried MAME on KMS on x86 and it was working pretty well.
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #6 on: May 28, 2020, 04:55:56 pm »
Not trying to sell groovyarcade, but Arch Linux is a great and up to date distro, and pretty lightweight. You could give a try to archlinuxarm (the mame binary should be compatible). The main adgantage is that the steps would be pretty much the same for pi, xu4 or whichever SBC.

See https://archlinuxarm.org/platforms

Thanks for the suggestion, Substring.

I took a look at ArchLinux ARM, installed it and got stucked at installing the proper build tools (gcc) to build and install SDL2 with KMS and OpenGL ES 2 support enabled, but X11 and OpenGL support disabled. I'm really not familiar at all with pacman.

I was able to enable the Fake KMS driver (in /boot/config.txt) and I can see /dev/dri is successfully enumerated.

I think I will stick with Raspbian Buster Lite as it is based on Debian and I am way more confortable with this flavor of Linux.  ;D
« Last Edit: May 28, 2020, 07:13:24 pm by bbegin »

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #7 on: May 29, 2020, 02:12:54 am »
Just
Code: [Select]
pacman -Sy base-devel sdl2 mame, it should be enough. Arch already has sdl 2.0.12, so you don't need to compile anything. It will probably install some X dependencies, but it doesn't mean you must start mame in X rather than KMS
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

mamemaniac

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 60
  • Last login:September 23, 2020, 11:27:02 am
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #8 on: May 29, 2020, 09:09:13 am »
Can you just upload a torrent? We can add the roms.


Hi all,

I worked on a personal project for the last 2 months.

The objective was to use a Raspberry Pi 4B and make it as a dedicated MAME Appliance. The system is minimal (following the JeOS principle) and boot straight into MAME 0.221, the latest version as of today. No clutter, no waste of resources and most of all, no useless GUI (X11).

The performances are really good, as most of the '80s and '90s arcade games run at full speed. Many 2000s games run at full speed as well.

Features and functionalities:
  • Based on Raspbian Lite (minimal Linux edition based on Debian);
  • At startup, display of a custom splash screen (for example, the MAME logo);
  • The MAME emulator starts automatically and displays the ROM selection screen;
  • When you exit MAME, the system initiates a shutdown;
  • During the shutdown, display of a personalized splash screen (for example, the MAME logo);
  • When the stop operations are completed, the system powers off;
  • To preserve the life of the SD card, the root filesystem is kept in read-only mode;
  • A maintenance mode is proposed (it's called the Service Mode) to allow system updates and the management of ROMs and Snapshots (via a Samba file share).

Youtube demonstration video:


I made a How-To Guide and hosted it on GitHub, but as I am French-speaking, it is written in French. Feel free to translate it to English with Google Translate.

Here is the link to the Step-by-Step How-to Guide:

https://gist.github.com/sonicprod/f5a7bb10fb9ed1cc5124766831e120c4

Google Translate to English : https://translate.google.ca/translate?hl=fr&tab=wT&sl=fr&tl=en&u=https%3A%2F%2Fgist.github.com%2Fsonicprod%2Ff5a7bb10fb9ed1cc5124766831e120c4

Feel free to comment.

Thanks and happy classic/arcade gaming!  :D

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #9 on: May 29, 2020, 10:07:22 am »
Can you just upload a torrent? We can add the roms.

Yes, I will provide a link with a pre-built image ready to be flashed to the SD card.

The only thing to do will be to add ROMs to the /data/roms folder.

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #10 on: May 29, 2020, 01:10:01 pm »
On the xu4 the newly compiled binary bombs with 'Illegal instruction'.
the assembler also gave the following warning:
IT blocks containing 32-bit Thumb instructions are performance deprecated in ARMv8-A and Armv8R just before linking.
If you have any idea or you encountered the same thing please do share or could you provide your binary through pm? I'm curious if yours does the same on my os.
We can exchange them through wetransfer or something...
edit: oh yes, I compiled mame 0219
« Last Edit: May 29, 2020, 01:15:06 pm by ZoOl007 »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #11 on: May 29, 2020, 01:55:20 pm »
On the xu4 the newly compiled binary bombs with 'Illegal instruction'.
the assembler also gave the following warning:
IT blocks containing 32-bit Thumb instructions are performance deprecated in ARMv8-A and Armv8R just before linking.
If you have any idea or you encountered the same thing please do share or could you provide your binary through pm? I'm curious if yours does the same on my os.

I'm sorry, I've never had this message while linking MAME. I think it has to do the build architecture flags (ARCHOPTS) when building MAME.

You may take a look at this page to select the proper values for your ARM system:
https://gist.github.com/fm4dd/c663217935dc17f0fc73c9c81b0aa845

We can exchange them through wetransfer or something...
edit: oh yes, I compiled mame 0219

Here is my mamearcade binary (0.221) via Firefox Send : https://send.firefox.com/download/d25b295c469e7fdf/#KR9ojBH4J08N2mY_Ep7BuQ
« Last Edit: May 29, 2020, 02:22:16 pm by bbegin »

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #12 on: May 29, 2020, 03:02:04 pm »
ha... your binary runs. I can create mame.ini but then it fails with
MESA-LOADER: failed to retrieve device information
gbm: failed to open any driver (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/exynos_dri.so: cannot open shared object file: No such file or directory
failed to load driver: exynos
OpenGL not supported on this driver: Could not initialize EGL
video_init: Initialization failed!

Oh well... it's proving to be more difficult than I assumed. I'll have a look at the link you gave me for the archopts... It's just that it takes hours to compile... but, I guess you've been through that rabbit hole a lot. ;-)

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #13 on: May 29, 2020, 03:20:14 pm »
ha... your binary runs. I can create mame.ini but then it fails with
MESA-LOADER: failed to retrieve device information
gbm: failed to open any driver (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
gbm: Last dlopen error: /usr/lib/dri/exynos_dri.so: cannot open shared object file: No such file or directory
failed to load driver: exynos
OpenGL not supported on this driver: Could not initialize EGL
video_init: Initialization failed!

Oh well... it's proving to be more difficult than I assumed. I'll have a look at the link you gave me for the archopts... It's just that it takes hours to compile... but, I guess you've been through that rabbit hole a lot. ;-)

Do the DRI drivers are created under /dev ? To check, just type:

ls -l /dev/dri*

You should see "card0" and "renderD128" under /dev/dri.

Did you compiled SDL2 with KMS and OpenGL ES 2 support enabled, and X11 and OpenGL support disabled as per the procedure I made?

If so, you should check carefully in the summary of the configuration utility and the keyword "dynamic" should apper next to "kmsdrm" at the "Video drivers" line (meaning it was dynamically detected):

Video drivers   : dummy kmsdrm(dynamic) opengl_es2
« Last Edit: May 29, 2020, 03:58:42 pm by bbegin »

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #14 on: May 30, 2020, 01:41:48 am »

Do the DRI drivers are created under /dev ? To check, just type:

ls -l /dev/dri*

You should see "card0" and "renderD128" under /dev/dri.

Did you compiled SDL2 with KMS and OpenGL ES 2 support enabled, and X11 and OpenGL support disabled as per the procedure I made?

If so, you should check carefully in the summary of the configuration utility and the keyword "dynamic" should apper next to "kmsdrm" at the "Video drivers" line (meaning it was dynamically detected):

Video drivers   : dummy kmsdrm(dynamic) opengl_es2

well yes it all checks out as far I see

drwxr-xr-x  2 root root        120 Mar 26 23:47 by-path
crw-rw----+ 1 root video  226,   0 Mar 26 23:47 card0
crw-rw----+ 1 root video  226,   1 Mar 26 23:47 card1
crw-rw----+ 1 root render 226, 128 Mar 26 23:47 renderD128
crw-rw----+ 1 root render 226, 129 Mar 26 23:47 renderD129

Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   :
Audio drivers   : disk dummy oss alsa(dynamic) sndio(dynamic)
Video drivers   : dummy kmsdrm(dynamic) opengl_es2
Input drivers   : linuxev linuxkd
Using libsamplerate : NO
Using libudev       : YES
Using dbus          : YES
Using ime           : YES
Using ibus          : YES
Using fcitx         : NO

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #15 on: May 30, 2020, 02:58:33 am »
What about the missing exynos_dri.so ? Can you find it on your FS ?
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #16 on: May 30, 2020, 12:01:06 pm »
What about the missing exynos_dri.so ? Can you find it on your FS ?

nope - no exynos_dri.so to be found. I've been looking around a bit but I haven't figured it out yet.

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #17 on: May 30, 2020, 12:53:15 pm »
No wonder DRM is not working then ;) which distro are you using; n your xu4 ? Hardkernel's ubuntu ?
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #18 on: May 30, 2020, 02:30:30 pm »
As promised, here is a 32 GB SD card image of the system, without ROMs (just put them into /data/roms using the Samba share while in Service mode):

https://drive.google.com/file/d/1I6N4ocQxNH-PhAUYzS8f-6PA_lkmCLeq

Important information:
  • The password of the user pi is left to default (raspberry)
  • The Wi-Fi has not been disabled
  • No overclocking has been configured in /boot/config.txt
  • No controller has been configured in mame.ini

Let me know how your appreciation of the system!

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #19 on: May 30, 2020, 02:32:02 pm »
No wonder DRM is not working then ;) which distro are you using; n your xu4 ? Hardkernel's ubuntu ?

 :o indeed - no, I'm using Armbian_20.02.7_Odroidxu4_buster_current_5.4.28_minimal.img
No idea how to add that feature as of yet...

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #20 on: May 30, 2020, 06:04:30 pm »
As promised, here is a 32 GB SD card image of the system, without ROMs (just put them into /data/roms using the Samba share while in Service mode):

https://drive.google.com/file/d/1I6N4ocQxNH-PhAUYzS8f-6PA_lkmCLeq

Important information:
  • The password of the user pi is left to default (raspberry)
  • The Wi-Fi has not been disabled
  • No overclocking has been configured in /boot/config.txt
  • No controller has been configured in mame.ini

Let me know how your appreciation of the system!

I haven't tried your img, but if you allow me to share my experience :
- sharibg an image of a sd card can be risky as most cards thay say 32GB don't have the same size, so the flashing fails
- there is a raspbian image maker that you can very easily customize. This would be a great improvement. See https://github.com/RPi-Distro/pi-gen
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #21 on: May 30, 2020, 06:07:07 pm »
No wonder DRM is not working then ;) which distro are you using; n your xu4 ? Hardkernel's ubuntu ?

 :o indeed - no, I'm using Armbian_20.02.7_Odroidxu4_buster_current_5.4.28_minimal.img
No idea how to add that feature as of yet...
The so may bot be in the search path listed in the mesa error, but the file may indeed exist. Find it, then symlink it to one of the paths listed
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #22 on: May 30, 2020, 06:48:29 pm »
As promised, here is a 32 GB SD card image of the system, without ROMs (just put them into /data/roms using the Samba share while in Service mode):

https://drive.google.com/file/d/1I6N4ocQxNH-PhAUYzS8f-6PA_lkmCLeq

Important information:
  • The password of the user pi is left to default (raspberry)
  • The Wi-Fi has not been disabled
  • No overclocking has been configured in /boot/config.txt
  • No controller has been configured in mame.ini

Let me know how your appreciation of the system!

I haven't tried your img, but if you allow me to share my experience :
- sharibg an image of a sd card can be risky as most cards thay say 32GB don't have the same size, so the flashing fails
- there is a raspbian image maker that you can very easily customize. This would be a great improvement. See https://github.com/RPi-Distro/pi-gen

I agree that that flashing will fail if the SD Card is smaller than 32 GB in capacity. I just did a quick image with dd and then I compressed it.

I will use a more elaborate imaging solution to make let's say a 8 GB image so it could fit on the vast majority of the SD Cards. The 3rd partition (data) may then be expanded with a utility like gparted or similar.

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #23 on: May 31, 2020, 03:29:17 am »
You can find some tools that can trim down a partition or image to almost the bare necessary. Some distros (like raspbian) have a script that can resize the / partition to extend it to the full capacity. This could be a better idea than having a second partition that require some tools to edit partitions. Not all people are comfortable with this
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #24 on: June 01, 2020, 02:49:22 pm »
You can find some tools that can trim down a partition or image to almost the bare necessary. Some distros (like raspbian) have a script that can resize the / partition to extend it to the full capacity. This could be a better idea than having a second partition that require some tools to edit partitions. Not all people are comfortable with this

I published a new 8 GB version of the image (see the original post of the topic).

In the next version, I will automate the resizing of /data (using the same principle from Raspbian with expanding the root filesystem).

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #25 on: June 02, 2020, 10:32:54 am »
In the mean time I managed to compile an odoid xu4 version using the same methodology as you.
I'm using other archops reflecting my cpu etc.
ARCHOPTS = -mcpu=cortex-a15.cortex-a7 -mtune=cortex-a15.cortex-a7 -mfpu=auto -mfloat-abi=hard -funsafe-math-optimizations -fexpensive-optimizations -fprefetch-loop-arrays
build cmd
make -j $(nproc) CFLAGS="-Wno-error=format-truncation -fPIC" SUBTARGET=arcade OSD=sdl NO_X11=1 NOWERROR=1 NO_USE_XINPUT=1 NO_USE_XINPUT_WII_LIGHTGUN_HACK=1 NO_OPENGL=1 USE_QTDEBUG=0 DEBUG=0 REGENIE=1 NO_BGFX=1
It all checks out but it is extremely slow.
Cabal runs at 16% for example. The mouse barely moves when the qt window is open.
I find it odd. It is just too slow so something must still be wrong. I am thinking that maybe it's not using the gpu but I do not (yet) know how I can check that.
I first made a non optimized version and than the optimized one but both are very very slow.
The board is connected to a 1200*1920 tft at the moment. It is a 32bit cpu so a 32bit os.
I'm using ubuntu-18.04.3-4.14-minimal-odroid-xu4-20190910 atm.
If anyone has an idea (or some test program/code) do share please. 
« Last Edit: June 02, 2020, 10:36:01 am by ZoOl007 »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #26 on: June 02, 2020, 11:35:47 am »
In the mean time I managed to compile an odoid xu4 version using the same methodology as you.
I'm using other archops reflecting my cpu etc.
ARCHOPTS = -mcpu=cortex-a15.cortex-a7 -mtune=cortex-a15.cortex-a7 -mfpu=auto -mfloat-abi=hard -funsafe-math-optimizations -fexpensive-optimizations -fprefetch-loop-arrays
build cmd
make -j $(nproc) CFLAGS="-Wno-error=format-truncation -fPIC" SUBTARGET=arcade OSD=sdl NO_X11=1 NOWERROR=1 NO_USE_XINPUT=1 NO_USE_XINPUT_WII_LIGHTGUN_HACK=1 NO_OPENGL=1 USE_QTDEBUG=0 DEBUG=0 REGENIE=1 NO_BGFX=1
It all checks out but it is extremely slow.
Cabal runs at 16% for example. The mouse barely moves when the qt window is open.
I find it odd. It is just too slow so something must still be wrong. I am thinking that maybe it's not using the gpu but I do not (yet) know how I can check that.
I first made a non optimized version and than the optimized one but both are very very slow.
The board is connected to a 1200*1920 tft at the moment. It is a 32bit cpu so a 32bit os.
I'm using ubuntu-18.04.3-4.14-minimal-odroid-xu4-20190910 atm.
If anyone has an idea (or some test program/code) do share please.

Hi ZoOl007,

Did you also compiled SDL2 with the provided build parameters?

Did you forced MAME to use the KMSDRM backend and OpenGL ES rendering engine (start MAME with -videodriver kmsdrm -renderdriver opengles2 -video accel)?

Make sure your user account running MAME is a member of the render group (see my procedure).
You could test if your hardware acceleration is OK with the kmscube test utility (https://gitlab.freedesktop.org/mesa/kmscube/).
 

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #27 on: June 02, 2020, 07:12:49 pm »
Hi all,

Here is a new 4GB image file of the system. Again, without ROMs (just put them in /data/roms) - see the link in the original topic post.

I put the system in Service mode, so you can start with expanding the /data partition and add ROMs with Samba.

To put back in Arcade mode, just issue:

rw
arcademode
sudo reboot
« Last Edit: June 02, 2020, 07:50:26 pm by bbegin »

Substring

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 466
  • Last login:Today at 05:39:16 am
  • Forking GroovyArcade
    • forum.arcadecontrols.com/index.php/topic,160023.0.html
    • GroovyArcade active fork
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #28 on: June 03, 2020, 03:10:58 am »
Nice !

Have you tried sdl 2.0.12 ?
GroovyMAME / GroovyArcade discord: https://discord.gg/YtQ6pJh
GroovyArcade doc: https://gitlab.com/groovyarcade/support/-/wikis/home

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #29 on: June 03, 2020, 06:25:01 pm »
Nice !

Have you tried sdl 2.0.12 ?

Thanks!

FYI, we need to build SDL 2.0.10, not 2.0.12 (as stated in the How-to Guide, there is a bug with version 2.0.11 and up, so we should stay at 2.0.10 until the bug is fixed).
« Last Edit: June 03, 2020, 06:53:02 pm by bbegin »

ZoOl007

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 161
  • Last login:August 02, 2020, 12:03:38 pm
    • RGBcommander
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #30 on: June 06, 2020, 11:36:06 am »
I managed to get it to work on the OdroidXU4. I did not yet set it up as a dedicated tv appliance as you did but I did get mame 0.219 running smoothly.
I tried several games including the ones in your movie and performance is top. WonderBoy3 isn't running at 100% - does that run 100% on the Pi4?
As for audio I can't say as I'm using hdmi to dvi atm.
The only thing that is a pity is that glsl can't work. If that could work it would be perfect.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #31 on: June 06, 2020, 01:09:09 pm »
I managed to get it to work on the OdroidXU4. I did not yet set it up as a dedicated tv appliance as you did but I did get mame 0.219 running smoothly.
I tried several games including the ones in your movie and performance is top. WonderBoy3 isn't running at 100% - does that run 100% on the Pi4?
As for audio I can't say as I'm using hdmi to dvi atm.
The only thing that is a pity is that glsl can't work. If that could work it would be perfect.

Great to know that you've been able to successfully replicate the steps on your Odroid XU4 :)

The objective for me is to integrate the Raspberry 4B in a bartop arcade cabinet.

FYI, I also tried Wonder Boy 3, as you proposed and the speed isn't running at 100 % for me too on the Raspberry Pi 4.
« Last Edit: June 06, 2020, 01:18:41 pm by bbegin »

HannibalAnthrope

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:August 27, 2020, 10:00:25 am
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #32 on: August 25, 2020, 09:34:35 pm »
I burned your latest chip image to a clean chip and tried to boot it in a Pi4B 2gb.  Mame splash appears, boot never completes.  On tty3 I see a number of "FAILED" messages (Load/Save RF Kill Switch, dependency failed for local file systems, dependency failed for MAME autostart, etc..etc..) and then finally emergency mode.  Except it cannot open access to the console and reports the root account is locked.  LOL
Can't even get to a # prompt to try to fix it.  Shame too because it looks like you put a lotta work into this.  Seems like you may have overcooked the soup!  A bit too much automation maybe?  No offense intended.  I'll take a look around it and see if I can find the main issues.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #33 on: August 25, 2020, 10:08:22 pm »
I burned your latest chip image to a clean chip and tried to boot it in a Pi4B 2gb.  Mame splash appears, boot never completes.  On tty3 I see a number of "FAILED" messages (Load/Save RF Kill Switch, dependency failed for local file systems, dependency failed for MAME autostart, etc..etc..) and then finally emergency mode.  Except it cannot open access to the console and reports the root account is locked.  LOL
Can't even get to a # prompt to try to fix it.  Shame too because it looks like you put a lotta work into this.  Seems like you may have overcooked the soup!  A bit too much automation maybe?  No offense intended.  I'll take a look around it and see if I can find the main issues.

I would try first to get back the kernel messages on the console so you can pinpoint the problem.

From another computer, you can edit the file /boot/cmdline.txt on the SD card and remove the following arguments from the kernel command-line:

    logo.nologo vt.global_cursor_default=0 quiet

And put back "console=tty1", instead of "console=tty3".

Can you take a picture of the kernel messages (and post it here) once the boot process is stucked?

To make an offline switch to Service mode, delete these 2 files from the SD card:
/etc/systemd/systm/network.target.wants/mame-autostart.service.
/etc/systemd/system/multi-user.target.wants/shutdown.service.
« Last Edit: August 25, 2020, 10:50:58 pm by bbegin »

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #34 on: August 25, 2020, 10:53:00 pm »
I burned your latest chip image to a clean chip and tried to boot it in a Pi4B 2gb.  Mame splash appears, boot never completes.  On tty3 I see a number of "FAILED" messages (Load/Save RF Kill Switch, dependency failed for local file systems, dependency failed for MAME autostart, etc..etc..) and then finally emergency mode.  Except it cannot open access to the console and reports the root account is locked.  LOL
Can't even get to a # prompt to try to fix it.  Shame too because it looks like you put a lotta work into this.  Seems like you may have overcooked the soup!  A bit too much automation maybe?  No offense intended.  I'll take a look around it and see if I can find the main issues.

I would try first to get back the kernel messages on the console so you can pinpoint the problem.

From another computer, you can edit the file /boot/cmdline.txt on the SD card and remove the following arguments from the kernel command-line:

    logo.nologo vt.global_cursor_default=0 quiet

And put back "console=tty1", instead of "console=tty3".

Can you take a picture of the kernel messages (and post it here) once the boot process is stucked?

To make an offline switch to Service mode, delete these 2 files from the SD card:
  -  /etc/systemd/systm/network.target.wants/mame-autostart.service          OR (old name)        autostart-mame.service
  -  /etc/systemd/system/multi-user.target.wants/shutdown.service
« Last Edit: August 26, 2020, 09:03:26 am by bbegin »

HannibalAnthrope

  • Trade Count: (0)
  • Jr. Member
  • **
  • Offline Offline
  • Posts: 3
  • Last login:August 27, 2020, 10:00:25 am
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #35 on: August 27, 2020, 09:56:09 am »
I had the same ideas, plus I just loaded the overlay to disable wifi because I don't use it.
I got the failed messages pretty much cleared up, and I cleaned up the filesystems on another Pi but I was never able to get past the root account locked problem and a few hours trying to research that on the net was painful and unfruitful.  I still don't know what to do to solve it or what causes it because there were as many "answers" as people.  I did try more than one Pi even though this one was brand new and is running fine now (and it ran RetroPie just fine too although that was a short test because I hate it and think it's garbage LOL).

If you'd like me to test again I can probably do that, but I would ask that you re-download the image you've posted, burn it to a chip and test it on your Pi4 to verify - and not that I don't appreciate your work, I do - but debugging a bootable chip image is time consuming and frustrating.  And I'm pretty sure the final result is going to be confirming for me that MAME still does NOT work right on a Pi4, at least not with the classic games I use (Space Invaders for one).  Even back to build .078 and having compiled SDL2 correctly MAME just eats the cpu and is far too slow to even play Space Invaders.  I'm not sure how others are reporting it to work ok for them <shrug>.  Anyway, let me know if you want try fixing it.

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #36 on: August 27, 2020, 02:53:43 pm »
I had the same ideas, plus I just loaded the overlay to disable wifi because I don't use it.
I got the failed messages pretty much cleared up, and I cleaned up the filesystems on another Pi but I was never able to get past the root account locked problem and a few hours trying to research that on the net was painful and unfruitful.  I still don't know what to do to solve it or what causes it because there were as many "answers" as people.  I did try more than one Pi even though this one was brand new and is running fine now (and it ran RetroPie just fine too although that was a short test because I hate it and think it's garbage LOL).

I think your problem is caused by the kernel not being able to mount the root filesystem (for some reason). Maybe because of the wrong PARTUUID, depending the tool you used to write the .img file to the SD card. I will update the procedure to switch to LABEL= in /etc/fstab.

Can you try this solution, please:
1. Mount the Raspberry Pi SD card on another computer
2. Edit the file /etc/fstab
3. Make sure you update these 3 lines (notice the LABEL= at leftmost):

LABEL=boot            /boot           vfat    defaults,ro                 0    2
LABEL=rootfs          /               ext4    defaults,noatime,ro         0    1
LABEL=data            /data           f2fs    defaults,noatime,discard    0    2


4. Edit /boot/cmdline.txt and replace the parameter "root=PARTUUID=xxxxxxxx" by:
root=/dev/mmcblk0p2

If you'd like me to test again I can probably do that, but I would ask that you re-download the image you've posted, burn it to a chip and test it on your Pi4 to verify - and not that I don't appreciate your work, I do - but debugging a bootable chip image is time consuming and frustrating.  And I'm pretty sure the final result is going to be confirming for me that MAME still does NOT work right on a Pi4, at least not with the classic games I use (Space Invaders for one).  Even back to build .078 and having compiled SDL2 correctly MAME just eats the cpu and is far too slow to even play Space Invaders.  I'm not sure how others are reporting it to work ok for them <shrug>.  Anyway, let me know if you want try fixing it.

If you are not able to emulate Space Invaders on a Raspberry Pi with MAME, it's because the hardware acceleration is not enabled.
I am able to emulate much more complex games with full speed (DoDonPachi, Truxton II, etc.) on my Raspberry Pi 4 with the provided How-To.
« Last Edit: August 27, 2020, 06:01:51 pm by bbegin »

teller

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 22
  • Last login:Today at 06:00:55 am
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #37 on: September 16, 2020, 03:03:30 am »
I got your image running and it's a great project! I would like to know how I can update MAME to the latest version (0.224). As far I followed to your step-by-step tutorial you excluded MESS. I would like to include the whole MAME (with the systems from MESS). What do I need to modify in the update script?

bbegin

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 40
  • Last login:Yesterday at 12:54:20 pm
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #38 on: September 16, 2020, 08:30:54 am »
Hi teller,

To get the full MAME (arcade and classic systems), just remove SUBTARGET=arcade from MAKEOPTS variable asingment.

Be advised that I did not tested this build/compilation.

teller

  • Trade Count: (0)
  • Full Member
  • ***
  • Online Online
  • Posts: 22
  • Last login:Today at 06:00:55 am
  • I want to build my own arcade controls!
Re: How to make a dedicated MAME Appliance on a Raspberry Pi 4B
« Reply #39 on: September 16, 2020, 08:51:36 am »
Thanks for your quick reply.
So I better make a backup before I update.
What are the update commands in servicemode?