Main > Linux

Guide to getting MAME up and running in linux

<< < (2/3) > >>

ddr:
When mine was doing that it was the audio.  My notes are at https://github.com/DanRoscigno/mame-attractmode-cab/blob/master/README.md#setup-sound

keilmillerjr:

--- Quote from: canussie on February 27, 2020, 01:03:32 am ---Awesome guide...

I purchased a 1500-in-1 cocktail cabinet a few months back, its basically just a PC with JAMMA joysticks plugged into. It came pre loaded with a really crappy win2k install. Being a linux guy I had to idea to install Linux on the box. Came across your post, followed it for the most part, instead I used a Ubuntu 18 i386 ISO. I had to upgrade the kernel, because the 4.4 had issues with USB keyboards... fun times. Anyways long story short, I configured it all up, got the Attractmode and MAME working together, however when I launch Donkey Kong (only game i've test thus far) it seems to be running at about a quarter speed and the audio is lagging. Searching around for stuff I maybe need to configure etc, thought I would use this thread as first cab off the rank incase anyone had some tips!

I did a bit of a write up about how I went about things if anyone is interested:
https://www.aussiearcade.com/forum/arcade/arcade-technical-and-repair-questions/multi-board-discussion-and-help/2111395-linux-on-a-xxxx-in-1-device

--- End quote ---

Try mame 0.106 or older. Video changes were made that will require more computing power.

dauntless:
It's been 4 years since I setup a mame machine from scratch. This guide helped refresh my memory. Double Thanks :)

dauntless:
Updated for Ubuntu 21.10 / MAME 0.240 / Attract-Mode 2.6.2

I built a new system with new hardware for a newer version of MAME (0.240). To support the new hardware I needed new drivers, and thus a more recent version of Ubuntu with a newer kernel. The process is almost the same as the original guide user loupg wrote. However getting this up and running with Ubuntu 21.10 had its own set of new challenges. Most of what I had to do specifically for 21.10 will likely apply to 22.04 when its released. Other than what I detailed below the rest of loupg's guide still applies. I thought I should write this down before I completely forget as it might help you. After figuring it all out everything is working. With a newer MAME there is some additional new games and a lot of bug fixes for existing ones. This kind of setup is great because it gets rid of the windows bloat. Also with Linux you don't have to worry about Window's licensing, or Microsoft phoning home, and killing your system with forced updates.

XORG Installation

Starting with Ubuntu 20.04 Gnome seems to be bundled with Xorg. I want Openbox and not Gnome. I was freaking out when my Openbox looked like Gnome because it wasn't actually Openbox running. What kind of OS gives you Gnome when you want Openbox? The whole point of this setup is to get away from Gnome and not run a full desktop environment. To avoid Gnome you have to install the following packages separately in this exact order.


--- Code: ---sudo apt-get install xserver-xorg-core
sudo apt-get install openbox
sudo apt-get install xinit

--- End code ---

If you dare try and install something else like terminator terminal emulator for your Openbox it will download gnome and the gnome desktop will get installed and you will need to purge it. Be careful. Ubuntu 21.10 likes to install gnome any chance it gets.

Compiling MAME 0.240

MAME source files now come in self extracting 7zip Windows EXEs. Unzip can't handle this. You will need to install p7Zip to extract it.


--- Code: ---sudo apt-get install p7zip
--- End code ---

Download and extract the source code.


--- Code: ---wget "https://github.com/mamedev/mame/releases/download/mame0240/mame0240s.exe"
7z x mame0240s.exe -omame/

--- End code ---

MAME has some missing dependencies. qt5-default is deprecated in 21.10. 20.04 looks like the last version to support it. The way around this is to install all of qt5-default's dependencies with ...


--- Code: ---sudo apt-get install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools
--- End code ---

You can than install the rest of the prerequisites for compiling the newer MAME 0.240 on Ubuntu 21.10.


--- Code: ---sudo apt-get install git build-essential python libsdl2-dev libsdl2-ttf-dev libfontconfig-dev libpulse-dev
--- End code ---

Compiling Attract-Mode 2.6.2

Attract-Mode needs alternative dependencies. libavresample-dev is deprecated in Ubuntu 21.10. 20.04 looks like the last version to support it. Going forward you will need to use libswresample-dev instead. These are the new dependencies to install and compile Attract-Mode 2.6.2 on Ubuntu 21.10.


--- Code: ---sudo apt-get -y install git libsfml-dev libopenal-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libxrandr-dev
--- End code ---

Openbox Issues

To stop Openbox from blanking the screen after 10 minutes of idle time add these lines to the top of your autostart file


--- Code: ---vim ~/.config/openbox/autostart
--- End code ---


--- Code: ---# Keep screen on
xset -dpms     # Disable DPMS (Energy Star) Features
xset s off     # Disable screenasver
xset s noblank # Don't blank video device

--- End code ---

Ubuntu 21.10 Server Network Issues

The newer Ubuntu server likes to hang for a couple minutes trying to find a network connection when no Ethernet cable is plugged in. This adds needless startup time for an offline system that doesn't need to be connected to the internet once setup. To avoid this, for a faster startup you need to change netplan and add 'optional: true' to the config. You will need to modify your network config to look something like this. Note: The Ethernet network adapter enp0s31f6 will be a different name based on your hardware.


--- Code: ---sudo vim /etc/netplan/00-installer-config.yaml
--- End code ---

--- Code: ---# This is the network config written by 'subiquity'
network:
  ethernets:
    enp0s31f6:
      dhcp4: true
      optional: true
  version: 2

--- End code ---

--- Code: ---sudo netplan generate
sudo netplan apply

--- End code ---

Additional Notes

These are things I did slightly different and I may not remember why exactly anymore. Some of it is optional. You may not need to do it exactly the same, but it worked for me.

• To stop the terminal from blanking the screen when idle add this line to the end of bashrc


--- Code: ---vim ~/.bashrc
--- End code ---

--- Code: ---#prevent screen blanking when idle
setterm -blank 0

--- End code ---

• When you make your openbox directory for the first time add -p flag to create child & parent directories.


--- Code: ---mkdir -p ~/.config/openbox
--- End code ---

• I used a slightly different script for the autologin on the newer ubuntu

--- Code: ---[Service]
ExecStart=
ExecStart=-/sbin/agetty --noissue --autologin <USERNAME> %I $TERM
Type=idle

--- End code ---

• I added this slightly different script to the .profile file to ensure that X only autostarts on terminal 1 if you should choose to login to other text terminals.


--- Code: ---vim ~/.profile
--- End code ---

--- Code: ---if [[ -z $DISPLAY ]] && [[ $(tty) = /dev/tty1 ]]; then
    startx
fi

--- End code ---

• MAME can take an hour to compile. You can speed it up on multi core cpus as mentioned in other posts. On a dual core system use -j3, or -j5 with a quad core cpu. The STRIP_SYMBOLS option will cut down on the core size by removing debug symbols you don’t need for a computer kiosk. Also if you only need MAME to emulate arcade systems and not home consoles you can build an arcade only core with the SUBTARGET option. This reduced the MAME executable file size by 50% for me.


--- Code: ---make -j5 STRIP_SYMBOLS=1 SUBTARGET=arcade
--- End code ---

dauntless:
How to Manually Patch MAME to get rid of Nag Screens (instructions for mame 0.240 and similar versions)

MKChamp didn't have a patch file for MAME 0.240 to disable the nag screens at the time when I compiled from source. So I looked through the latest previous versions to determine what changes were made and manually changed them myself. If you are compiling a version only a few months apart from .240 the process is likely the same.

There are two files that need to be patched, ui.cpp and mainmenu.cpp. They are located in the directory mame0240s/src/frontend/mame/ui/

Open ui.cpp in a text editor, not a word processor.

At line 217 (unmodified v0.240 file) where it says "draw_text_box(container, messagebox_text, ui::text_layout::text_justify::LEFT, 0.5f, 0.5f, colors().background_color());" you need to add this line before "if (!machine().options().skip_gameinfo())". The modified block of code should look like this.

--- Code: ---{
// DISABLE INITIALIZING, LOADING & DECRYPTING MESSAGES
if (!machine().options().skip_gameinfo())
draw_text_box(container, messagebox_text, ui::text_layout::text_justify::LEFT, 0.5f, 0.5f, colors().background_color());
return 0;
}));

--- End code ---

At line 411 (unmodified v0.240 file) where is says "bool video_none = strcmp(downcast<osd_options &>(machine().options()).video(), OSDOPTVAL_NONE) == 0;" you want to add this code right after "first_time = show_gameinfo;". The modified block of code should look like this.

--- Code: ---bool video_none = strcmp(downcast<osd_options &>(machine().options()).video(), OSDOPTVAL_NONE) == 0;

// FORCE INTERACTIVE WARNING MESSAGES (HARD RESET)
first_time = show_gameinfo;

--- End code ---

Save the file and than open mainmenu.cpp.

In mainmenu.cpp at line 193 (unmodified v0.240 file) look for "if (!mame_machine_manager::instance()->favorite().is_favorite(machine()))". This if statement needs to be enclosed by another if statement "if (!machine().options().skip_gameinfo())". The modified block of code should look like this.

--- Code: ---// DISABLE SELECT NEW MACHINE & FAVORITES
if (!machine().options().skip_gameinfo())
{
if (!mame_machine_manager::instance()->favorite().is_favorite(machine()))
item_append(_("Add To Favorites"), 0, (void *)ADD_FAVORITE);
else
item_append(_("Remove From Favorites"), 0, (void *)REMOVE_FAVORITE);

item_append(menu_item_type::SEPARATOR);

item_append(string_format(_("About %1$s"), emulator_info::get_appname()), 0, (void *)ABOUT);

item_append(menu_item_type::SEPARATOR);
}

--- End code ---

Just below at line 212 (unmodified v0.240 file) where it says "item_append(_("Select New Machine"), 0, (void *)SELECT_GAME);" you need to add "if (!machine().options().skip_gameinfo())" just above. The modified block of code should look like this.

--- Code: ---//  item_append(_("Quit from Machine"), 0, (void *)QUIT_GAME);

if (machine_phase::INIT == m_phase)
{
item_append(_("Start Machine"), 0, (void *)DISMISS);
}
else
{
if (!machine().options().skip_gameinfo())
item_append(_("Select New Machine"), 0, (void *)SELECT_GAME);
item_append(_("Return to Machine"), 0, (void *)DISMISS);
}

--- End code ---

Save the file after making the changes and you are ready to compile a nag free version of MAME. If there hasn't been a major ui revision in the version you are using, or user typos in your code, MAME should compile without error provided that you were able to compile the source without error before making any changes.

You will still need to add these lines to the mame.ini file.


--- Code: ---#
# CORE MKChamp OPTIONS
#
skip_gameinfo             1

--- End code ---

or

Run MAME with the -skip_gameinfo flag

--- Code: ---mame64 <game> -skip_gameinfo

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version