Skip to content

Instantly share code, notes, and snippets.

@frame
Last active May 20, 2021 14:20

Revisions

  1. frame revised this gist May 20, 2021. 1 changed file with 61 additions and 0 deletions.
    61 changes: 61 additions & 0 deletions picade.md
    Original file line number Diff line number Diff line change
    @@ -133,6 +133,8 @@ mame2003-skip_disclaimer = "enabled"
    mame2003-skip_warnings = "enabled"
    ```

    ### Bash version

    * `$ mkdir ~/random-mame && cd "$_"`
    * `$ nano random-mame.sh`

    @@ -153,6 +155,65 @@ echo launching $ROM

    * `crontab -l | { cat; echo "*/19 * * * * /home/pi/random-mame/random-mame.sh"; } | crontab -`

    ### PHP Version

    This version is superior: It features a block-list (`nslasher`, `raiden2` and `thndrbld` never worked on my setup) and makes sure all games get displayed before it shuffles the whole list again.

    * `$ sudo apt install php-cli php-xml`
    * `$ mkdir ~/random-mame && cd "$_"`
    * `$ nano random-mame.php`

    ```php
    <?php

    chdir(dirname(__FILE__));

    $xml = '/home/pi/.emulationstation/gamelists/mame-libretro/gamelist.xml';
    $json = 'queue.json';
    $blocked = [
    'nslasher.zip',
    'raiden2.zip',
    'thndrbld.zip'
    ];

    $valid = true;
    if (!file_exists($json)) {
    $valid = false;
    } else {
    $queue = json_decode(file_get_contents($json));
    if ($queue === false || !is_countable($queue) || !count($queue)) {
    $valid = false;
    }
    }

    $queue = false;
    if (!$valid) {
    $roms = simplexml_load_string(file_get_contents($xml));
    if (is_countable($roms) && count($roms)) {
    $queue = [];
    foreach ($roms as $rom) {
    if (!in_array(basename((string)$rom->path), $blocked)) {
    $queue[] = (string)$rom->path;
    }
    }
    shuffle($queue);
    file_put_contents($json, json_encode($queue, JSON_PRETTY_PRINT));
    }
    } else {
    $queue = json_decode(file_get_contents($json));
    }

    if ($queue !== false && is_countable($queue) && count($queue)) {
    $rom = array_shift($queue);
    file_put_contents($json, json_encode($queue, JSON_PRETTY_PRINT));
    echo 'launching ' . $rom . "\n";
    shell_exec('killall -q emulationstation retroarch');
    shell_exec('/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so --config /opt/retropie/configs/mame-libretro/retroarch.cfg "' . $rom . '" --appendconfig /dev/shm/retroarch.cfg >/dev/null 2>/dev/null &');
    }
    ```

    * `crontab -l | { cat; echo "*/19 * * * * php /home/pi/random-mame/random-mame.php"; } | crontab -`

    ## Emulationstation:

    ```
  2. frame revised this gist Sep 23, 2018. 1 changed file with 0 additions and 190 deletions.
    190 changes: 0 additions & 190 deletions picade.md
    Original file line number Diff line number Diff line change
    @@ -18,34 +18,6 @@ hdmi_mode=16
    * F4 to exit Emulationstation
    * `$ sudo raspi-config`

    ```
    2 Network Option
    N1 Hostname
    picade
    N2 Wi-fi
    AT Austria
    OK, Enter SSID, Enter Password
    5 Interface Options
    P2 SSH# Retropie Setup
    ## Preparations on Windows/MacOS
    * Use Etcher (https://etcher.io/) to write latest image from https://retropie.org.uk/download/
    * `$ subl /boot/config.txt`
    ```
    hdmi_force_hotplug=1
    hdmi_group=2
    hdmi_mode=16
    ```
    (Power up external HDMI screen and set resultion to 1024x768@60Hz)
    ## Picade first boot
    * Connect USB keyboard
    * F4 to exit Emulationstation
    * `$ sudo raspi-config`
    ```
    2 Network Option
    N1 Hostname
    @@ -214,168 +186,6 @@ U Update

    ### picade-hat

    * `$ cd ~/picade-hat`
    * `$ git pull`
    * `# sudo ./install.sh`

    Ok
    Leave
    ```
    * `$ sudo reboot`
    ## Via SSH
    * `$ passwd`
    * `nano ~/.bash_aliases`
    ```bash
    alias ll='ls -al'
    alias vol0='amixer set 'PCM' 0%'
    alias vol1='amixer set 'PCM' 70%'
    alias volup='amixer set 'PCM' 10%+'
    alias voldown='amixer set 'PCM' 10%-'
    ```
    * `$ sudo RetroPie-Setup/retropie_setup.sh`

    ```
    U Update
    Ok
    C Configuration / tools
    802 autostart
    1 Start Emulation Station at boot
    805 configedit
    2 Advanced configuration
    1 Configure Libretro options
    0 all/retroarch.cfg
    14 video_scale_integer (true)
    14 mame-libretro/retroarch.cfg
    R Reboot
    ```

    * `$ curl -sS https://get.pimoroni.com/picadehat | bash`
    * `$ mkdir ~/picade-hat && cd "$_"`
    * `$ git clone https://github.com/pimoroni/picade-hat .`
    * `$ sudo ./install.sh`

    ```
    Picade HAT: Installer
    Notice: building picade.dtbo
    Notice: copying /boot/config.txt to /boot/config.txt.picade-preinstall
    Installed: /boot/overlays/picade.dtbo
    Installed /etc/udev/rules.d/10-picade.rules
    Installed /etc/asound.conf
    Config: Added "dtoverlay=picade" to /boot/config.txt
    Config: Added "dtparam=audio=off" to /boot/config.txt
    Config: Skipped "hdmi_force_hotplug=1", already exists in /boot/config.txt
    ```

    * `$ sudo reboot`
    * `$ sudo apt-get install qt5-default`
    * `$ mkdir ~/skysource && cd "$_"`
    * `$ wget -q -O - https://raw.githubusercontent.com/muldjord/skyscraper/master/update_skyscraper.sh | bash`
    * `# killall emulationstation`
    * `# Skyscraper`
    * `$ nano ~/.skyscraper/skyscript.sh && chmod +x "$_"`

    ```bash
    #!/bin/bash
    Skyscraper -p mame-libretro -s arcadedb --pretend
    Skyscraper -p mame-libretro -s screenscraper --pretend
    Skyscraper -p mame-libretro -s localdb
    ```

    * `$ nano ~/.skyscraper/config.ini`

    ```ini
    [main]
    gamelistFolder="/home/pi/.emulationstation/gamelists"
    mediaFolder="/home/pi/.emulationstation/media"
    videos="true"
    brackets="false"
    unattend="true"
    interactive="true"

    [mame-libretro]
    artworkXml="artwork_mame-libretro.xml"
    ```

    * `$ nano ~/.skyscraper/artwork_mame-libretro.xml`

    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <artwork>
    <output type="screenshot" width="640" height="480">
    <layer resource="screenshot" x="20" width="520" height="390" align="center" valign="middle">
    </layer>
    <layer resource="wheel" width="250" x="-10" align="right">
    <shadow distance="5" softness="5" opacity="70"/>
    </layer>
    </output>
    </artwork>
    ```
    ## Start random mame game every 19 minutes:

    * `$ nano /opt/retropieconfigs/all/retroarch-core-options.cfg`

    ```
    mame2003-skip_disclaimer = "enabled"
    mame2003-skip_warnings = "enabled"
    ```

    * `$ mkdir ~/random-mame && cd "$_"`
    * `$ nano random-mame.sh`

    ```bash
    #!/bin/bash
    killall -q emulationstation retroarch

    ROM=`xmlstarlet sel -B -T -t -c "/gameList/game[$RANDOM mod last() + 1]/path" ~/.emulationstation/gamelists/mame-libretro/gamelist.xml`
    echo launching $ROM

    /opt/retropie/emulators/retroarch/bin/retroarch \
    -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so \
    --config /opt/retropie/configs/mame-libretro/retroarch.cfg \
    "$ROM" \
    --appendconfig /dev/shm/retroarch.cfg \
    &
    ```

    * `crontab -l | { cat; echo "*/19 * * * * /home/pi/random-mame/random-mame.sh"; } | crontab -`

    ## Emulationstation:

    ```
    D-PAD UP/DOWN/LEFT/RIGHT -> Stick
    START -> Right button
    SELECT -> Left button
    A -> Yellow upper row
    B -> Red upper row
    X -> Yellow lower row
    Y -> Red lower row
    LEFT SHOULDER -> Blue upper row
    RIGHT SHOULDER -> Blue lower row
    HOTKEY ENABLE -> Front left
    ```

    ## Keep things up to date

    **Note**: Don't run `apt upgrade` or `apt dist-upgrade` because it will overwrite optimized packages and kernels. Only use `retropie_setup.sh` to update the system.

    ### System

    * `$ sudo RetroPie-Setup/retropie_setup.sh`
    ```
    U Update
    ```

    ### Skyscraper

    * `$ cd ~/skysource`
    * `$ ./update_skyscraper.sh`

    ### picade-hat

    * `$ cd ~/picade-hat`
    * `$ git pull`
    * `# sudo ./install.sh`
  3. frame revised this gist Sep 23, 2018. 1 changed file with 191 additions and 0 deletions.
    191 changes: 191 additions & 0 deletions picade.md
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,34 @@ hdmi_mode=16
    * F4 to exit Emulationstation
    * `$ sudo raspi-config`

    ```
    2 Network Option
    N1 Hostname
    picade
    N2 Wi-fi
    AT Austria
    OK, Enter SSID, Enter Password
    5 Interface Options
    P2 SSH# Retropie Setup
    ## Preparations on Windows/MacOS
    * Use Etcher (https://etcher.io/) to write latest image from https://retropie.org.uk/download/
    * `$ subl /boot/config.txt`
    ```
    hdmi_force_hotplug=1
    hdmi_group=2
    hdmi_mode=16
    ```
    (Power up external HDMI screen and set resultion to 1024x768@60Hz)
    ## Picade first boot
    * Connect USB keyboard
    * F4 to exit Emulationstation
    * `$ sudo raspi-config`
    ```
    2 Network Option
    N1 Hostname
    @@ -31,6 +59,169 @@ hdmi_mode=16
    Leave
    ```
    * `$ sudo reboot`
    * Disconnect USB keyboard
    ## Via SSH
    * `$ passwd`
    * `nano ~/.bash_aliases`
    ```
    alias ll='ls -al'
    alias vol0='amixer set 'PCM' 0%'
    alias vol1='amixer set 'PCM' 70%'
    alias volup='amixer set 'PCM' 10%+'
    alias voldown='amixer set 'PCM' 10%-'
    ```
    * `$ sudo RetroPie-Setup/retropie_setup.sh`
    ```
    U Update
    Ok
    C Configuration / tools
    802 autostart
    1 Start Emulation Station at boot
    805 configedit
    2 Advanced configuration
    1 Configure Libretro options
    0 all/retroarch.cfg
    14 video_scale_integer (true)
    14 mame-libretro/retroarch.cfg
    R Reboot
    ```
    * `$ curl -sS https://get.pimoroni.com/picadehat | bash`
    * `$ mkdir ~/picade-hat && cd "$_"`
    * `$ git clone https://github.com/pimoroni/picade-hat .`
    * `$ sudo ./install.sh`
    ```
    Picade HAT: Installer
    Notice: building picade.dtbo
    Notice: copying /boot/config.txt to /boot/config.txt.picade-preinstall
    Installed: /boot/overlays/picade.dtbo
    Installed /etc/udev/rules.d/10-picade.rules
    Installed /etc/asound.conf
    Config: Added "dtoverlay=picade" to /boot/config.txt
    Config: Added "dtparam=audio=off" to /boot/config.txt
    Config: Skipped "hdmi_force_hotplug=1", already exists in /boot/config.txt
    ```
    * `$ sudo reboot`
    * `$ sudo apt-get install qt5-default`
    * `$ mkdir ~/skysource && cd "$_"`
    * `$ wget -q -O - https://raw.githubusercontent.com/muldjord/skyscraper/master/update_skyscraper.sh | bash`
    * `# killall emulationstation`
    * `# Skyscraper`
    * `$ nano ~/.skyscraper/skyscript.sh && chmod +x "$_"`
    ```bash
    #!/bin/bash
    Skyscraper -p mame-libretro -s arcadedb --pretend
    Skyscraper -p mame-libretro -s screenscraper --pretend
    Skyscraper -p mame-libretro -s localdb
    ```

    * `$ nano ~/.skyscraper/config.ini`

    ```ini
    [main]
    gamelistFolder="/home/pi/.emulationstation/gamelists"
    mediaFolder="/home/pi/.emulationstation/media"
    videos="true"
    brackets="false"
    unattend="true"
    interactive="true"

    [mame-libretro]
    artworkXml="artwork_mame-libretro.xml"
    ```

    * `$ nano ~/.skyscraper/artwork_mame-libretro.xml`

    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <artwork>
    <output type="screenshot" width="640" height="480">
    <layer resource="screenshot" x="20" width="520" height="390" align="center" valign="middle">
    </layer>
    <layer resource="wheel" width="250" x="-10" align="right">
    <shadow distance="5" softness="5" opacity="70"/>
    </layer>
    </output>
    </artwork>
    ```
    ## Start random mame game every 19 minutes:

    * `$ nano /opt/retropieconfigs/all/retroarch-core-options.cfg`

    ```
    mame2003-skip_disclaimer = "enabled"
    mame2003-skip_warnings = "enabled"
    ```

    * `$ mkdir ~/random-mame && cd "$_"`
    * `$ nano random-mame.sh`

    ```bash
    #!/bin/bash
    killall -q emulationstation retroarch

    ROM=`xmlstarlet sel -B -T -t -c "/gameList/game[$RANDOM mod last() + 1]/path" ~/.emulationstation/gamelists/mame-libretro/gamelist.xml`
    echo launching $ROM

    /opt/retropie/emulators/retroarch/bin/retroarch \
    -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so \
    --config /opt/retropie/configs/mame-libretro/retroarch.cfg \
    "$ROM" \
    --appendconfig /dev/shm/retroarch.cfg \
    &
    ```

    * `crontab -l | { cat; echo "*/19 * * * * /home/pi/random-mame/random-mame.sh"; } | crontab -`

    ## Emulationstation:

    ```
    D-PAD UP/DOWN/LEFT/RIGHT -> Stick
    START -> Right button
    SELECT -> Left button
    A -> Yellow upper row
    B -> Red upper row
    X -> Yellow lower row
    Y -> Red lower row
    LEFT SHOULDER -> Blue upper row
    RIGHT SHOULDER -> Blue lower row
    HOTKEY ENABLE -> Front left
    ```

    ## Keep things up to date

    **Note**: Don't run `apt upgrade` or `apt dist-upgrade` because it will overwrite optimized packages and kernels. Only use `retropie_setup.sh` to update the system.

    ### System

    * `$ sudo RetroPie-Setup/retropie_setup.sh`
    ```
    U Update
    ```

    ### Skyscraper

    * `$ cd ~/skysource`
    * `$ ./update_skyscraper.sh`

    ### picade-hat

    * `$ cd ~/picade-hat`
    * `$ git pull`
    * `# sudo ./install.sh`

    Ok
    Leave
    ```
    * `$ sudo reboot`
    ## Via SSH
  4. frame revised this gist Sep 23, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion picade.md
    Original file line number Diff line number Diff line change
    @@ -37,7 +37,8 @@ Leave

    * `$ passwd`
    * `nano ~/.bash_aliases`
    ```

    ```bash
    alias ll='ls -al'
    alias vol0='amixer set 'PCM' 0%'
    alias vol1='amixer set 'PCM' 70%'
  5. frame revised this gist Sep 23, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion picade.md
    Original file line number Diff line number Diff line change
    @@ -10,7 +10,7 @@ hdmi_force_hotplug=1
    hdmi_group=2
    hdmi_mode=16
    ```
    (Power up external HDMI screen and set resultion to 1024x748@60Hz)
    (Power up external HDMI screen and set resultion to 1024x768@60Hz)

    ## Picade first boot

  6. frame revised this gist Sep 23, 2018. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions picade.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    ## Preparations on Windows/MacOS

    * Use Etcher to write latest image from https://retropie.org.uk/download/
    * Use Etcher (https://etcher.io/) to write latest image from https://retropie.org.uk/download/
    * `$ subl /boot/config.txt`

    ```
    @@ -122,11 +122,10 @@ artworkXml="artwork_mame-libretro.xml"
    </output>
    </artwork>
    ```
    ## Start random mame game every 19 minutes:

    * `$ nano /opt/retropieconfigs/all/retroarch-core-options.cfg`

    ## Start random mame game every 19 minutes:

    ```
    mame2003-skip_disclaimer = "enabled"
    mame2003-skip_warnings = "enabled"
  7. frame created this gist Sep 23, 2018.
    190 changes: 190 additions & 0 deletions picade.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,190 @@
    # Retropie Setup

    ## Preparations on Windows/MacOS

    * Use Etcher to write latest image from https://retropie.org.uk/download/
    * `$ subl /boot/config.txt`

    ```
    hdmi_force_hotplug=1
    hdmi_group=2
    hdmi_mode=16
    ```
    (Power up external HDMI screen and set resultion to 1024x748@60Hz)

    ## Picade first boot

    * Connect USB keyboard
    * F4 to exit Emulationstation
    * `$ sudo raspi-config`

    ```
    2 Network Option
    N1 Hostname
    picade
    N2 Wi-fi
    AT Austria
    OK, Enter SSID, Enter Password
    5 Interface Options
    P2 SSH
    Ok
    Leave
    ```

    * `$ sudo reboot`

    ## Via SSH

    * `$ passwd`
    * `nano ~/.bash_aliases`
    ```
    alias ll='ls -al'
    alias vol0='amixer set 'PCM' 0%'
    alias vol1='amixer set 'PCM' 70%'
    alias volup='amixer set 'PCM' 10%+'
    alias voldown='amixer set 'PCM' 10%-'
    ```
    * `$ sudo RetroPie-Setup/retropie_setup.sh`

    ```
    U Update
    Ok
    C Configuration / tools
    802 autostart
    1 Start Emulation Station at boot
    805 configedit
    2 Advanced configuration
    1 Configure Libretro options
    0 all/retroarch.cfg
    14 video_scale_integer (true)
    14 mame-libretro/retroarch.cfg
    R Reboot
    ```

    * `$ curl -sS https://get.pimoroni.com/picadehat | bash`
    * `$ mkdir ~/picade-hat && cd "$_"`
    * `$ git clone https://github.com/pimoroni/picade-hat .`
    * `$ sudo ./install.sh`

    ```
    Picade HAT: Installer
    Notice: building picade.dtbo
    Notice: copying /boot/config.txt to /boot/config.txt.picade-preinstall
    Installed: /boot/overlays/picade.dtbo
    Installed /etc/udev/rules.d/10-picade.rules
    Installed /etc/asound.conf
    Config: Added "dtoverlay=picade" to /boot/config.txt
    Config: Added "dtparam=audio=off" to /boot/config.txt
    Config: Skipped "hdmi_force_hotplug=1", already exists in /boot/config.txt
    ```

    * `$ sudo reboot`
    * `$ sudo apt-get install qt5-default`
    * `$ mkdir ~/skysource && cd "$_"`
    * `$ wget -q -O - https://raw.githubusercontent.com/muldjord/skyscraper/master/update_skyscraper.sh | bash`
    * `# killall emulationstation`
    * `# Skyscraper`
    * `$ nano ~/.skyscraper/skyscript.sh && chmod +x "$_"`

    ```bash
    #!/bin/bash
    Skyscraper -p mame-libretro -s arcadedb --pretend
    Skyscraper -p mame-libretro -s screenscraper --pretend
    Skyscraper -p mame-libretro -s localdb
    ```

    * `$ nano ~/.skyscraper/config.ini`

    ```ini
    [main]
    gamelistFolder="/home/pi/.emulationstation/gamelists"
    mediaFolder="/home/pi/.emulationstation/media"
    videos="true"
    brackets="false"
    unattend="true"
    interactive="true"

    [mame-libretro]
    artworkXml="artwork_mame-libretro.xml"
    ```

    * `$ nano ~/.skyscraper/artwork_mame-libretro.xml`

    ```xml
    <?xml version="1.0" encoding="UTF-8"?>
    <artwork>
    <output type="screenshot" width="640" height="480">
    <layer resource="screenshot" x="20" width="520" height="390" align="center" valign="middle">
    </layer>
    <layer resource="wheel" width="250" x="-10" align="right">
    <shadow distance="5" softness="5" opacity="70"/>
    </layer>
    </output>
    </artwork>
    ```

    * `$ nano /opt/retropieconfigs/all/retroarch-core-options.cfg`

    ## Start random mame game every 19 minutes:

    ```
    mame2003-skip_disclaimer = "enabled"
    mame2003-skip_warnings = "enabled"
    ```

    * `$ mkdir ~/random-mame && cd "$_"`
    * `$ nano random-mame.sh`

    ```bash
    #!/bin/bash
    killall -q emulationstation retroarch

    ROM=`xmlstarlet sel -B -T -t -c "/gameList/game[$RANDOM mod last() + 1]/path" ~/.emulationstation/gamelists/mame-libretro/gamelist.xml`
    echo launching $ROM

    /opt/retropie/emulators/retroarch/bin/retroarch \
    -L /opt/retropie/libretrocores/lr-mame2003/mame2003_libretro.so \
    --config /opt/retropie/configs/mame-libretro/retroarch.cfg \
    "$ROM" \
    --appendconfig /dev/shm/retroarch.cfg \
    &
    ```

    * `crontab -l | { cat; echo "*/19 * * * * /home/pi/random-mame/random-mame.sh"; } | crontab -`

    ## Emulationstation:

    ```
    D-PAD UP/DOWN/LEFT/RIGHT -> Stick
    START -> Right button
    SELECT -> Left button
    A -> Yellow upper row
    B -> Red upper row
    X -> Yellow lower row
    Y -> Red lower row
    LEFT SHOULDER -> Blue upper row
    RIGHT SHOULDER -> Blue lower row
    HOTKEY ENABLE -> Front left
    ```

    ## Keep things up to date

    **Note**: Don't run `apt upgrade` or `apt dist-upgrade` because it will overwrite optimized packages and kernels. Only use `retropie_setup.sh` to update the system.

    ### System

    * `$ sudo RetroPie-Setup/retropie_setup.sh`
    ```
    U Update
    ```

    ### Skyscraper

    * `$ cd ~/skysource`
    * `$ ./update_skyscraper.sh`

    ### picade-hat

    * `$ cd ~/picade-hat`
    * `$ git pull`
    * `# sudo ./install.sh`