Regamebox for Pi2Jamma

Regamebox

For the latest documentation go to the wiki page at
http://www.regamebox.com.

Regamebox is a retro game distribution for raspberry pi and the ArcadeForge Add on Boards pi2scart and pi2jamma.

Please download the latest image from the download page

Contents

End of content table.

After downloading  and decompression this files show up.

  • regamebox.img
    • This is the image file for the SD Card

We recommend to use this procedure

  1. Download the image file. Use MegaSync Program. Buy here if you don’t want to download.
  2. Unpack file with 7zip (http://www.7-zip.de/download.html).
  3. Please write image file regamebox.img to SD Card. Use 16 Gbyte SD Card. Use Windows Tool Win32diskimager Check this Youtube Video
  4. optional: If you want to use a USB Stick, attach a empty USB Stick to the raspberry pi and boot. You will be prompted for generating the needed folder on the USB Stick. After this procedure your USB stick will be ready to use. Copy yout game roms.

You are now finished with the basic software preparation Proceed with installation of your Pi2Jamma

Support on Facebook Group Pi2Jamma

ReGamebox has the following features

  • Configuration
    • Key Setting,
    • Video Settings,
    • Resolutions
    • Emulators Configurations
  • Flip Screen
  • Favourites Menu
  • History Menu
  • Gamelist Filters
  • Custom pixel perfect resolutions for all console emulators
  • Support of horizontal and vertical screen with automatic generation of game lists.
  • Video snaps in advmenu
  • Snaps for all other emulators
  • Dynamic Resolution Switcher Algorithms for Arcade Games
  • Patch Management System
  • Reboot and Shutdown Procedurs
  • Support of thousands of games
  • Game Menu is developed for display at 15Khz low resolutions and high resolution via hdmi.
  • Dozen of themes
  • backgound music
  • Backup solution
  • Export and import of configuration files
  • Logging
  • Support of USB sticks and HDs
  • Access via SFTP, SSH, Samba and Shell
  • Automatic turning of screens
  • Automatic recognition of used hardware addon

Installation of Pi2Jamma Hardware

Prerequisites

  • Pi2Jamma PCB
  • Stock Audio Cable for Pi2Jamma
  • SD Card for Raspberry Pi 16 Gbyte recommended
  • Raspberry Pi 3 b+
  • USB Stick otpional

The Pi2Jamma comes with a GPIO female connector and will be plugged directly on the Raspberry Pi.

The Pi2Jamma has a Jamma Interface. The Jamma harness will plugged on the Jamma connector without any modification on the cab. Parts side is the top Side.

For Audio the stock audio cable will be plugged to the audio connector of the Pi2Jamma and Raspberry Pi.

Volume control is on the black potentiometer on the Pi2Jamma. Adjust it to your needs.

Button 4, 5 for both Player is on Jamma Connector Pin 25 and 26 and bottom side. Bottom 6 for both players is available on the screw terminal. The screw terminals has also one GND.

Raspberry Pi is powered via Jamma. Again, there’s no need for extra power, just Jamma interface. Raspberry Pi has over voltage protection. Its safe to use up to 5,2V

Installation steps

Step 1. Insert SD card to Raspberry Pi
Step 2. Insert USB Stick to Raspberry Pi optional
Step 3. Plug Audio Cable to Raspberry Pi
Step 4. Plug Raspberry Pi to Pi2jamma
Step 5. Plug Audio Cable to Pi2jamma
Step 6. Plug Pi2jamma to your Arcade Cab

You should see menu booting up. Congratulations you can now start copying your roms to the USB Stick.

ReGamebox Software Image

ReGamebox is based on the Arch Linux OS.

Emulators and Roms

Regamebox supports retroarch. See here a selection which gaming system are supported

  • AdvMame
  • AdvMenu
  • Genesis
  • MegaDrive
  • lr-fbalpha
  • piFBA
  • Mame4All
  • Mame2000
  • Mame2003
  • Mame2003plus
  • Mame2010
  • PC Engine
  • Turbografx16
  • C64
  • C64dtv
  • SNES
  • NES
  • FDS
  • Atari 2600
  • PC Engine CD
  • SEGA CD
  • Master System
  • Game Gear
  • Sega 32x
  • PSX
  • NEC supergrafx
commodore
genesis
snes
gba
atari2600

Regamebox can be used with or without a USB stick for storing your games.

Using Regamebox with USB Stick

All roms are stored on USB Stick folder. On windows a USB Stick is listed as normal drive. Please format as ntfs, fat32 or extfs. The needed folder are generated automatically when plugging a empty USB Stick to the raspberry pi with regambox.

Folder name for your USB Stick on command shell in regamebox system is

/mnt/sda
Using Regamebox witout USB Stick

All roms stored on SD Card in the folder

/home/x/rpi2jamma/roms

Configuring and using WLAN

Follow this steps to connect your regamebox to the WLAN WIFI NETWORK

Start Regamebox with connected keyboard

1. Start WLAN
Go configuration – Options Menu – System – Wifi

2. Get your IP Adress
Go configuration – Options Menu – System – IP Address

Notice your IP, we use here 192.168.178.72

Go to your Home PC and establish connection via

SAMBA : Connect network folder to \\192.168.178.72\home

WINSCP Connect via sftp to 192.168.178.72 with account user “root” and pass “root”. Change to folder /home/x/rpi2jamma
Find in folder roms the roms.

PUTTY : Login with user “x” and pass “y” and type in cmd shell su for superuser. Password is root

Copying of roms

Next copying of roms is described. Please copy roms to rpi2jamma/roms plus the folder name in the table below.

i.e. Copy roms for atari2600 to folder rpi2jamma/roms/atari2600″ on USB stick. In the Pi2jamma distribution the path for the USB Stick is /mnt/sda.

SystemFolderEmulator
Mame2003plusmame2003plusmame2003plus
AdvMameadvmameAdvMame
mame4allm4allmame4all
piFbapifbapiFba
lr-fbalphalr-fbalphalr-fbalpha
GenesisgenesisGenesis Plus GX
MegadrivegenesisGenesis Plus GX
Master SystemmastersystemGenesis Plus GX
Sega CDsegacdGenesis Plus GX
GamegeargamegearGenesis Plus GX
C64C64Vice
C64dtvC64dtvVice
PCEpcelr-beetle-pce-fast
PCE CDpcecdlr-beetle-pce-fast
TG16pcelr-beetle-pce-fast
SNESsneslr-snes9x-next
NES/FDSnesfceumm
NESnestopianestopia
Atari2600atari2600stella
Mame2000mame2000mame2000
Mame2003mame2003mame2003
Sega 32xsega32xpicodrive
Playstationpsxpsx

For Rom Set information refer to https://github.com/retropie/retropie-setup/wiki/Managing-ROMs

Do check the correct rom set speccification. Roms will be scanned on each start of system. The game menu shows the roms according the roms in your rom folders.

For emulator specific setting refer to emulator documentation.

For NES emulator the alternative nestopia exists. Use rom folder nestopia for using this this emulator.

How to add new emulators or change memu item names

Start Regamebox with connected keyboard.

1. Goto Configuration – Options Menu – Emulators – Retroarch Menu
2. In Retroarch use enter and backspace to navigate menu. Goto Online Updater – Core Updater
3. Install your cores, quit retroarch menu.
4. Goto Configuration – Options Menu – Emulators – Edit emulators.conf
5. Add your desired folder name and the linked core name to that folder
6. Create folder name on rom folder and copy your roms to your new core.

For renaming folder names use steps 4 to 6 and use your wanted names in emulators.conf and folder names in rom folder.

Arcade Rom Versions

For downloading rom set basic knowledge of using zip files and torrent downloads is needed.

Arcade Rom Naming

Arcade roms come with a simple rom file and name like 1942b.zip. This name is unique and will be translated with the gamelister programm to the real name like “1942 (First Version)”. For this task a file name mapping table is needed. Find this files here:

/root/databases/gamelists/

Carefully edit this file when you need to alter or to add names. Data Format is CSV

 1942b;1942 (First Version);a
  1. parameter is rome name.
  2. parameter is game name, which will be shown in game menu
  3. third parameter is orientation of game
    a – all ( game will be shown in both orientations: horizontal and vertical
    h – game will be shown only in horizontal orientation
    v – game will be shown only in vertical orientation

Regamebox uses gamefilter for full lists and parents. Edit the wanted gamelist.

BIOS

The following console emulators require bios files to operate.

  • FDS – DISKSYS.ROM
  • PC Engine CD – SYSCARD3.PCE
  • Sega CD – bios_CD_E.bin, bios_CD_J.bin, bios_CD_U.bin

Place these bios files in their respective rom folders.

  • rpi2jamma/roms/nes
  • rpi2jamma/roms/pcecd
  • rpi2jamma/roms/segacd

Download the console bios files here

Dynamic Resolution Switching

Regamebox uses pixel perfect and game speed perfect resolutions. Therefore some configuration table are needed. Find this table in folder

/root/databases/

For the DRS the option Custom Res Mode must be enabled. Find it at Configuration – Options Menu – Turn Custom Res on or off. Default is on.

When starting a game the native resolution will be gathered from arcade_res_table.txt. The resolution will be then adapted to hdmi_timing that can be found in the table custom_resolution_table.txt.

Example Arcade Game Resolution

– User starts game Airwolf.
– regamebox recognises that airwolf is started with arcade core by looking in the emulators.txt
– regamebox looks in the arcade_res_table.txt for that arcade game airwolf and gets 288×224@60
– regamebox computes the best timings and stores them into /root/resolution/games.cfg
– regamebox set the hdmi_timings, modified the top level retroarch configuration file /root/.config/retroarch/retroarch.cfg and sets the resolution information. Thus the user can override the retroarch setting by use core or game specific resolutions.

Example Console Game Resolution

– User starts game Super Turrican.
– regamebox recognises that Super Turrican was started with SNES is started with a console core by looking in the emulators.conf
– regamebox looks in the table custom_resolution_table.txt and searches for the snes game resolution and get the correspondig hdmi_timing, custom_viewport_width, custom_viewport_x, custom_viewport_heigth, custom_viewport_y
– regamebox set the hdmi_timings, modified the top level retroarch configuration file /root/.config/retroarch/retroarch.cfg and sets the resolution information. Thus the user can override the retroarch setting by use core or game specific resolutions.

Configuration Menu

This section describes the features that can be used with the regamebox distribution. They gives you control about the whole software installation.

Find this features:

Configuration

  • Options Menu
    • Exit Options – Use this menu item to exit options menu again
    • Screen – Screen related features
      • Select CRT Profile
        • Select here between the different CRT Profile setting to achive the best 15 Khz video output. The list contains consumer CTR, Sony PVM BVM CRT Profile, Arcade CRTs and custom CRT profile. Select what suites best for you. All profiles despite of custom comes with presetting. The custom profile can be used for your own adjusted settings.
      • Calibrate screen. If you use the custom CRT Profile you can calibrate your screen here with a simple 4 step dialogue. Take care, the step pitch is very fine grained.
      • Switch to Vertical / Horizontal Screen : Toggle H/V changes the orientation settings for your CRT on the fly.
      • Set Menu Overscan : Change here the Lemonlauncher overscan.
      • Edit Custom Resolution Table: Each emulator core can be started with custom hdmi_timings. hdmi_timings define the resolution of the screen. Edit the resolution for your needs.
      • Edit Arcade Resolution : If you find a rom that has a wrong resolution setting or is missing you can add and correct it here.
      • Flip Screen : Turns screen upside down or left right.
      • Turn Custom Res on and off: Toggles custom res on or off. If off only the config.txt resolution is used.
      • Switch to Low/High Res:Use lowres for 15 khz screens and highres for other, ie bartops with hdmi, DVI or VGA
    • Music and Sound
      • Set Volume: Set colume with joystick from 0 – 100. Exit menu with Start Player 1 Button
      • Turn Music On/Off: Toggles music on and off. Find music on usb stick /mnt/sda/menu-audio Add mp3 and edit the arcade.pls playlist if you need new music.
      • Edit Playlist. Edit the playlist
    • Game Controls and Hardware
      • Start USB Gamepad Wizard
        • If you want to use regambox with usb gamepads and you don’t like the default setting you can modify it here.
      • Switch to Pi2Jamma or PI2SCART Mode : This mode shutdowns the pi2jamma control key demon pikeyd. Now the control interface is free and other hardware like pi2scart addon can be used. Default mode is automatic. This means the attached hardware is recognised automatically. Turn explicit settings if you know what hardware you are using (no, this is not self evident :)) and save 3 seconds boot up time.
      • Configure USB Gamepad : Take this option and select from a list of pre configured USB pads like snes usb pads, xbox360, c64 mini joystick and more.
      • Switch to 3 Button, 4 Buttons or 6 Buttons : Use this opion for lr-fbalpha. The default setting put fire button 1 to arcade control panel button 4. Correct, if you now have a 3 button panel you can not play any game. Use this option then.
      • Check Pi2jamma : Simple tool to check your button
    • Wifi
      • Wifi : use this feature to configure your wifi connection. It takes some seconds to establish all services like sftp, ssh, samba and so on. Everything is done for you.
      • Disable Wifi : So you are ready transfer your roms and your arcade cab is in the cellar and you do not have wifi at all. Turn it off to save 15sec boot time then for non active wifi search.
      • IP Address : simple tool to show ip address
    • Emulators
      • Show Retroarch Cores: Shows the currently installed retroarch cores
      • Retroarch Menu : Opens graphical retroarch configuration menu.
      • Edit Emulators.cfg  Change here the mapping bewteen folder names and emulators. Yes, here can change the menu item names. Rename Rom folder according to this file. Text editor nano is used. Save with CTRL+ s and CTRL + x.
      • C64 Vice Menu : Opens C64 Vice Config Screen.
      • Edit retroarch.config : retroarch config can be edited directly with the onboard editor nano. Save with CTRL+ s and CTRL + x.  There is one retroarch config for high res and one for low res. Find the retroarch configs in /root/.config/retroarch
      • Edit advmame.rc : Advmame.rc can be edited directly with the text editor nano. Save with CTRL +s and CTRL + x. Keyboard is needed. There is one advmame.rc config for high res and one for low res. Find the advmame configs in /root/.advance
      • Edit C64 Keys : pikeyd is the demon for controlling keys via pi2jamma. The config file is at /etc/pikey165.conf With this options the vice specific settings will be edited. It can be edited directly with the text editor nano. Save with CTRL +s and CTRL + x. Keyboard is needed.
      • Edit Keys : pikeyd is the demon for controlling keys via pi2jamma. The config file is at /etc/pikey165.conf With this options the Key settings will be edited. It can be edited directly with the text editor nano. Save with CTRL + s and CTRL + x. Keyboard is needed.
      • Lock Games: Lock mode, this mode lock the ESC key and options shortcuts from the keyboard layout. Take this option if you want to run only one game and user should not change any setting, ie cabs in your store or public.
      • Unlock Games: Lock mode, this mode lock the ESC key and options shortcuts from the keyboard layout. Take this option if you want to run only one game and user should not change any setting, ie cabs in your store or public.
    • System
      • Shutdown : Shutdown System
      • Command Shell : opens command shell with root rights. Execute “/root/autostart_test.sh” to get again to the menu.
      • Reboot : Reboots System
      • Edit Regamebox Config : opens up the text editor nano with all parameters in the file regamebox.conf. Make sure you have attached a keyboard. ctrl + s followed by strl+x to save and exit.
      • Generate USB Stick Folder : If you messed somehow up the automatic generation of the folder for your usb stick, then you can re-generate it here.
      • Copy roms from USB To SD: if you want to use sd card only setup generate a usb stick, copy your stuff to the usb and then use this option to copy the games from usb to sd card. Yes, size is checked before.
      • Show Config : All settings are shown in a list.
      • Make Backup : Whole Image will be backed up. The system files without roms of your USB Stick will be backed as well. All files will be copied as image file to “/mnt/sda/backup”.
      • Show Log : Shows the log of regamebox.
      • Export config : Stores important configurations files like keymapping, retroarch, advmame, front end lemonlauncher config to USB Stick “/mnt/sda/config”. Compressed file is generated “/mnt/sda/config_pi2jamma.tgz”.
      • Show Version : Shows version
      • Show Help : Show Help file
    • Keyboard Layout
      • Set German Keyboard: Set keyboard locale to german.
      • Set UK Keyboard: Set keyboard locale to UK.
      • Set US Keyboard: Set keyboard locale to US.
      • Set FR Keyboard: Set keyboard locale to FR.
    • Test
      • Test Keys: Keyboard is tested. This way pi2jamma can be tested. Keyboard is needed.
      • Test Gamepad : SNES USB Gamepad is tested.
  • Themes Menu
    • Exit Themes Menu
    • Lowres Themes : Themes for lowres 15khz resolution
    • Highres Themes : Themes for higher resolution screens
  • Game Lists
    • Exit Game lists
    • Refresh Game lists . Use this option if you added games via network and don want to reboot.
    • Autostart
      • Show last Game : check what the last played game was.
      • Turn Autostart On or Off : last played game will be in autostart loop when bootup
    • Favourites Menu
      • Show last Game : check what the last played game was.
      • Turn Favourites Menu On or Off : Favourites Menu will be shown in root menu or not.
      • Delete all Favourites: Favourites List will be deleted.
      • Delete last game from Favourites: Last played game will be deleted from Favourites List.
      • Add last game from Favourites: Last played game will be added from Favourites List.
    • History Menu
      • Turn Favourites Menu On or Off : Favourites Menu will be shown in root menu or not.
      • Delete History: History List will be deleted.
    • Game Filter Menu
      • Show Full or Parents List: Only parents or all bootlegs will shown too
  • Switch to simple menu – All this stuff will be not shown, only shutdown

All the above features can be controlled via file in regamebox.conf as well in the regamebox menu. Some features needs keyboard.
This feature is only accesible via regamebox.conf file.

  • Admin or Gamer mode: Admin mode has all options and themes. Gamer mode has only emulators. This is for hiding all the configuration features from users. Ie for your game party.
  • Turn off or on the automatic refresh of game lists. Parameter REFRESH_GAMELIST=”Y” or “N”. If you want to edit the gamelist with custom modifcations, then put your games, then turn off automatic refresh and edit the list /root/.lemonlauncher/games.conf with your ie nano. Only for users who can use a text editor!
  • opt_cmdshell_res : turns out that 50 khz is best for viewing the cmd shell. Turn it off to hdmi_timing in /boot/config.txt
  • auto_turn_screen : Some arcade cabs have a screen that can be turned by automatically. Let regamebox controls the screen and turn it via gpio pin 26. (http://bencao74.blogspot.com/2019/01/pi2jamma-regamebox-automatically.html)
  • REMAP_FBA : turned off by default. Thus the default fba settings are used now. If you want to use premade remaps, then put this option to Y
  • INIT_REGAMEBOX : some setup scripts can be used at the very first start of regamebox, ie config of wifi, keyboard etc. Not used yet.

Themes

Themes can be selected in the section themes and will be installed on the fly. There is a test theme for adjusting your Arcade TV.

Here are some examples

theme_00
theme_01
theme_02
theme_03
theme_04

Key Settings

For all emulators a common key layout is used

  • Player 1 Start + Player 1 Button 1 = ESC (Quit Game)
  • Player 1 Start + Player 1 COIN = ESC (Quit Game)
  • Player 1 Up = Arrow Up
  • Player 1 Down = Arrow Down
  • Player 1 Left = Arrow Left
  • Player 1 Right = Arrow Right
  • Player 1 Button 1 = LEFT CTRL
  • Player 1 Button 2 = LEFT ALT
  • Player 1 Button 3 = SPACE
  • Player 1 Button 4 = LEFT SHIFT
  • Player 1 Button 5 = Z
  • Player 1 Button 6 = X
  • Player 1 Start = 1
  • Player 1 Coin = 5
  • Player 2 Up = R
  • Player 2 Down = F
  • Player 2 Left = D
  • Player 2 Right = G
  • Player 2 Button 1 = A
  • Player 2 Button 2 = S
  • Player 2 Button 3 = Q
  • Player 2 Button 4 = W
  • Player 2 Button 5 = I
  • Player 2 Button 6 = K
  • Player 2 Start = 2
  • Player 1 Start + Player Start 2 + Player 1 Button 1 = F1 (Service Menu)
  • Player 1 Start + Player Start 2 + Player 1 Button 2 = F2 (Service Menu)
  • Player 1 Start + Player Start 2 + Player 1 Button 3 = TAB (Settings Menu)
  • Player 2 Start + Player 1 Button 1 = F12 (Menu C64, Filter ADVMAME)
  • Player 1 Up + Player 2 Start = 6 (Coin Player 2)
  • Player 2 Up + Player 2 Start = 6 (Coin Player 2)
  • Player 1 Start + Player 1 up = 5 (Coin Player 1)

C64 and similar home computers needs extra settings. To change this settings go to options – edit keys.

I’ve given up to find a good ESC button combination for all users. Just go to Options – Edit Keys and define your own. Or use my settings. There will be no more changes here on this topic.

Background Music

Background Music is played when started. If a USB Stick is used, then check folder USB Stick rpi2jamma/menu-audio
All the items in playlist file arcade.pls are played. Add your music mp3 files in this folder and add them to the playlist file. Player app used is mpg123

Turn Off Background Music in Options – Toggle Music

Splash Screen

A splash screen is loaded on startup. Find this file on /root/splash.png. Just add here a new file if you want a new splash.

Implementation via splash.service file

[Unit]
Description = Splashscreen during boot
DefaultDependencies=no
After=local-fs.target
Before=base.target

[Service]
type=oneshot
ExecStart=/bin/sh -c ‘fbv /root/splash.png’
RemainAfterExit=yes

[Install]
WantedBy=getty.target

This /boot/cmdline.txt is used

root=/dev/mmcblk0p2 rw rootwait console=ttyAMA0,115200 console=tty9 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=ttyAMA0,115200 elevator=noop

Put these files in splash folder on usb stick and use this script splash.sh for installation

#!/bin/bash
#pacman -S fbv
cp /mnt/sda/splash/cmdline.txt /boot
cp /mnt/sda/splash/pleasewait.png /root/
cp splash.service /lib/systemd/system

systemctl enable /lib/systemd/system/splash.service

#Taken from https://natahori.wordpress.com/2013/04/04/silentboot-und-bootsplash-auf-raspberry-pi/

Snaps

Snaps show a little preview image on lemonlauncher and advmenu. The snaps for lemonlauncher are located on the USB Stick folder rpi2jamma/snaps. The snaps for lemonlauncher are not full screen so a resolution of 140x 105 can be used. For the snaps in advmenu the preview is almost fullscreen, so a higher resolution is recommended. For this snaps use folder rpi2jamma/roms_advmame/snap

Find below new 4443 Images for NES, SNES, MegaDrive, Atari2600, Sega32x, GamesGear, Genesis, Master System, PC Engine

Arcade
http://www.progettosnaps.net/snapshots/

NES, 1271 Images
https://mega.nz/…

SNES, 973 Images
https://mega.nz/…

Atari 2600, 349 Images
https://mega.nz/…

Sega 32x, 36 Images
https://mega.nz/…

Mega Drive, Genesis, 948 Images
https://mega.nz/…

GameGear, 293 Images
https://mega.nz/…

MasterSystem, 312 Images
https://mega.nz/…

PC Engine, 261 Images
https://mega.nz/…

Patches

Patches must be copied to USB Stick in folder “rpi2jamma”. Plug in usb stick, start your arcade machine. Patch is executed automatically by ReGamebox. After installation the patch will receive the file name addition “done”.

Creating own patch. Create the folders and file you want to patch. Compress the files to tar and gzip format using 7zip or similar programs. Patch name extension name is .tgz

FAQ

Q: Sound seems distorted somehow…?

A: Goto Options – Set Volume and turn it all the way up. then adjust the volume dial on pcb board to suit. This will eliminate the audio issues you are having.

Q: What the heck about this resolution and pixel perfect display?A: The resolution of an arcade game is different from game to game. Some games don’t display at a true 15khz and therefore won’t display a picture. What the dsr tool does is set the pi output to match the game as close to the original hardware as possible. Arcade hardware also made use of the overscan to increase there horizontal pixel count and tweaked the vertical sync to display more lines. The point of it is to display the games as true to original hardware as possible. Because the pi doesn’t output all the resolutions natively if it’s set to say 320×240 @ 15khz any game with a different resolution displays a blank screen the dsr fixed that issue and also allows the resolution to change without a reboot.

Q: Vertical mode is flipped. How can I change orientation of display ?

A: Goto Options – Screen – Flip

Q: Which fs types will be supported for the USB Sticks

A: fat32, exfat, ntfs

Q: Is ssh possible?

A: Login with use x pass y, change to su pass root

Q: How to wifi?

A: Goto Options – System – Wifi

Q: How to play vertical games on a horizontal monitor in AdvMame?

A: Use Options – Screen – Switch to H/V to configure your screen. Vertical games will be displayed on horizontal screen with no issue.

Q: How is the joystick mapped?
A: Goto Options – Edit Keys -configuration files is in /etc/pikeyd165.conf

Q: Is there a documentation to edit retroarch.config
A: Look here
https://github.com/libretro/RetroArch/blob/master/retroarch.cfg

some nice forum posts
https://retropie.org.uk/forum/topic/3634/core-input-remapping-and-saving-core-retroarch-cfg-files/8
https://retropie.org.uk/forum/post/12587

For core dependent control remapping read this
https://github.com/RetroPie/RetroPie-Setup/wiki/RetroArch-Configuration#core-input-remapping

This may also help (input remapping is outside of the retroarch.cfg files)
https://retropie.org.uk/forum/topic/2199/specific-retroarch-emulator-settings-are-being-over-written-after-i-quit-the-game/24

Q: how to change to USB Joystick for retroarch emulator. A: Start retroarch emulator core like lr-fbaalpha, snes or other. Change to menu with F1. Apply your settings.

Q: Where do I find timings specific information for games?

A: In the Mame dev pages. Ie Ghost’ n Goblines

https://github.com/mamedev/mame/blob/master/src/mame/drivers/gng.cpp