RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    [Howto] Press Play on Yape: Making the most out of C16/Plus4 Emulation

    Scheduled Pinned Locked Moved Help and Support
    plus4yapesdlhowto
    1 Posts 1 Posters 1.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • LolonoisL
      Lolonois
      last edited by Lolonois

      Motivation: Albeit the VICE team has done (and does!) decent work with the emulator xplus4 and many games run perfect on it, some games do not run at all or have sound glitches. Especially the more recent homebrew games do not run flawless with xplus4. However, these games run perfectly with YAPE and also max out what Dave Haynie and his colleagues at Commodore have baked into the TED chip. So I gave yapesdl integration a shot, and it turned out well. As a secondary goal I don't want to "bury" the C16/plus4 gems in the much larger C64 gamelist/system section, so I put the C16 ROMs into a separate system and folder.

      Ready to start the journey? -- This will be your travel destination:

      Zeichnung.svg.png

      Outline

      1. Install lr-vice-xplus4 and yape-sdl
      2. Add C16/Plus4 system to es_systems and create folders
      3. Create emulators.cfg
      4. Create theme for C16
      5. Xboxdrv config
      6. Scraping game data

      Before you start:

      • Overall complexity of setup/configuration: medium
      • Prerequisites: C64 system configured, Skyscraper configured, familiar with command line and Linux file editing.
      • The challenging "bossfights" are in Level 5 and 6.
      • This guide uses the carbon theme from EmulationStation but most likely can be easily adapted to other themes.
      • Tested on a Rpi4 but should also work on a Rpi3 without restrictions.

      Level 1: Install lr-vice-xplus4 and yape-sdl

      Libretro Core:

      [old description]

      Update: since 2020-04-24 RetroPie-Setup provides the (vice_xplus4_libretro.so) out-of-the-box.

      YAPE-SDL:

      • cd ..
      • Checkout yape for SDL: git clone https://github.com/calmopyrin/yapesdl.git
      • cd yapesdl; make -j$(nproc)
      • Copy binary yapesdl, e.g to /home/pi/yapesdl/yapesdl (make folder yapesdl beforehand). Remember this location, it will be used in Level 3.

      Level 2: Add to es_systems and create folders

      Edit /home/pi/.emulationstation/es_systems.cfg, add after <system> C64 XML:

        <system>
          <name>c16</name>
          <fullname>Commodore C16 and Plus/4</fullname>
          <path>/home/pi/RetroPie/roms/c16</path>
          <extension>.crt .d64 .g64 .prg .t64 .tap .x64 .zip .vsf .CRT .D64 .G64 .PRG .T64 .TAP .X64 .ZIP .VSF .D71 .D81 .D82 .ZIP</extension>
          <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ c16 %ROM%</command>
          <platform>c16</platform>
          <theme>c16</theme>
        </system>
      

      Create folder for ROMs: mkdir /home/pi/RetroPie/roms/c16

      Level 3: Create emulators.cfg

      These operations have to be done with elevated privileges: sudo <command_here>. Create emulators.cfg in the directory /opt/retropie/configs/c16 (make c16 folder first) and add:

      yape  = "/home/pi/yapesdl/yapesdl %ROM%"
      lr-vice_xplus4 = "/opt/retropie/emulators/retroarch/bin/retroarch -L /opt/retropie/libretrocores/lr-vice/vice_xplus4_libretro.so --config /opt/retropie/configs/plus4/retroarch.cfg %ROM%"
      default = "yape"
      

      If you have put the yapesdl into a different folder than /home/pi/yapesdl adapt the path accordingly (see line 1 above).

      Level 4: Create Theme for C16

      Make a copy of C64 theme settings:

      cd ~/.emulationstation/themes/carbon
      mkdir c16
      cd c16
      rsync -avr ../c64/* .
      rm art/system*
      

      Copy SVG files from here (Update: Anonfiles is down. Use this link for the artwork instead.) and unpack to ~/.emulationstation/themes/carbon/c16/art folder.

      For verification SHA256 sum: 6e43e7237dd107f7ffacbfddaf79e2b9613f439ab7584d41b250a7d282f4721d C16-EmuStation-SVG-Logos.7z

      Edit theme.xml and change the <image name="logo"> <path> entries for <view> "system" and "basic, detailed, video" respectively, note the different filenames for the views. So it looks like:

      <theme>
          <formatVersion>3</formatVersion>
          <include>./../carbon.xml</include>
      
              <view name="system">
      
                      <image name="ControllerOverlay" extra="true">
                              <tile>false</tile>
                              <pos>0.5 0.2</pos>
                              <origin>0.5 0.5</origin>
                              <size>0.3 0</size>
                              <path>./art/controller.svg</path>
                      </image>
      
                      <image name="logo">
                              <path>./art/c16--detail-view.svg</path>
                      </image>
              </view>
      
              <view name="basic, detailed, video">
      
                      <image name="logo">
                              <path>./art/c16--detail-view.svg</path>
                              <pos>0.266 0.074</pos>
                              <maxSize>0.460 0.126</maxSize>
                              <origin>0.5 0.5</origin>
                      </image>
      
                      <image name="logo2" extra="true">
                              <path>./art/controller.svg</path>
                              <pos>0.874 0.074</pos>
                              <maxSize>0.460 0.126</maxSize>
                              <origin>0.5 0.5</origin>
                              <color>bbbbbb</color>
                      </image>
      
              </view>
      
              <view name="basic">
              </view>
      
              <view name="detailed">
              </view>
      
      </theme>
      

      Update: From commit c6bbd38 (ES 2.9.4+) onwards you can use the c16--detail-view.svg for system and detail view.

      Bonus Level: Install Games/ROMs

      Pick your ROMs and put into /home/pi/RetroPie/roms/c16/.

      Note that while es_systems.cfg lists a all accepted fileformats for lr-vice and yapesdl, the latter currently accepts only these: .PRG, .P00, .T64, .TAP, .D64, .ZIP. Source

      Level 5: Xboxdrv Config

      Background: By default yapesdl does use a keyboard numpad digits as joystick emulation, in contrast some games provide only keyboard control (e.g. cursor keys for movement and space for fire), so the following has to be done for each game you want to use with YAPE-SDL.

      Make sure to have xboxdrv installed: Check with retropie_setup.sh. Then select Configuration / tools -> xboxdrv

      Additional keys (for special actions like toggle in games music aso. should also be configured to be able to run games without a physical keyboard). Yapesdl has some extra keys you want to map to one of your spare buttons (especially these) for ease of use. (The solution is left as an excerise to the reader).

      The following two configs can be used as a cookbook. However, you most likely have to adapt the event-ids to your hardware controller (see line evdev = /dev/input/<your eventid here> below).
      Use xboxdrv --evdev-debug --silent --evdev /dev/input/<your controller's eventid> (eventid can be found via ls -la /dev/input/by-id/<human readable device name with 'event'>) for output of the events of your connected controller.

      Two main configurations have emerged during my setup. Shortly you will know where to put these configs.

      First config

      Directions with Numpad, Numpad 0 as fire. Config e.g useful for Pets Rescue,

      #
      # GPIO 2
      #
      [xboxdrv]
      evdev = /dev/input/event1
      device-name = "Plus4 - Pets Rescue - GPIO 2"
      silent = true
      detach-kernel-driver = true
      
      # Evdev inputs on the left map to the xboxcontroller equivalent on the right
      
      [axismap]
      -Y1 = Y1
      -Y2 = Y2
      
      [evdev-absmap]
      ABS_X  = X1
      ABS_Y  = Y1
      
      [evdev-keymap]
      BTN_SOUTH = B
      BTN_EAST = A
      BTN_WEST = Y
      BTN_NORTH = X
      BTN_TL = LT
      BTN_TR = RT
      BTN_MODE = GUIDE
      BTN_START = START
      BTN_SELECT = BACK
      
      # Map xboxdrv buttons/movements to keyboard
      
      [ui-axismap]
      # joystick to numpad
      x1 = KEY_KP4:KEY_KP6
      y1 = KEY_KP8:KEY_KP2
      
      [ui-buttonmap]
      A = KEY_ENTER
      # Fire
      B = KEY_KP0
      # Switch Joy Port
      GUIDE+B = KEY_LEFTALT+KEY_I
      # Mimic libretro HK+Start = Quit (F12 in yapesdl)
      GUIDE+START = KEY_F12
      # Emulator Menu (as in retroarch configs)
      GUIDE+X = KEY_ESC
      

      Second config

      Directions via cursor keys, space as fire. Config e.g. for Pac-Pac

      #
      # GPIO 2
      #
      [xboxdrv]
      evdev = /dev/input/event1
      device-name = "Plus4 - Pac-Pac - GPIO 2"
      silent = true
      detach-kernel-driver = true
      
      [axismap]
      -Y1 = Y1
      -Y2 = Y2
      
      [evdev-absmap]
      ABS_X  = X1
      ABS_Y  = Y1
      
      [evdev-keymap]
      BTN_SOUTH = B
      BTN_EAST = A
      BTN_WEST = Y
      BTN_NORTH = X
      BTN_TL=LT
      BTN_TR=RT
      BTN_MODE = GUIDE
      BTN_START = START
      BTN_SELECT = BACK
      
      [ui-axismap]
      # map to cursor keys
      x1 = KEY_LEFT:KEY_RIGHT
      y1 = KEY_UP:KEY_DOWN
      
      [ui-buttonmap]
      A = KEY_ENTER
      # Fire
      B = KEY_SPACE
      # No switch joyport since game is only controlled by keyboard
      # Mimic libretro HK+Start = Quit (F12 in yapesdl)
      GUIDE+START = KEY_F12
      # Emulator Menu (as in retroarch configs)
      GUIDE+X = KEY_ESC
      

      Put such a config for each game to be run with yapesdl into /home/pi/xboxdrv-config/c16/<game_basename>.xboxdrv (again: make missing folders beforehand).
      Example: If your rom is named Pets_Rescue.prg name the xboxdrv config file Pets_Rescue.xboxdrv. Do not change the cAsinG of the base name.

      If you can reuse exactly the same config/mapping for more than one game you may use softlinks (ln -s) to avoid redundant copies.

      To get this applied on a per game basis: Launch xboxdrv before start in runcommand-onstart.sh and terminate it on end runcommand-onend.sh (see also section close to page end at Retropie's wiki https://retropie.org.uk/docs/Runcommand/)

      Add to /opt/retropie/configs/all/runcommand-onstart.sh:

      #! /bin/sh
      folder=$(basename "${3%/*}")
      rom="${3##*/}"
      base="${rom%.*}"
      
      emu=$2
      
      # yape: mapping
      if [ "$emu" = "yape" ] && [ "$folder" = "c16" ] ; then
        echo "Found: $rom, using config: ${folder}/${base}.xboxdrv" \
          >> /dev/shm/runcommand.log
        sudo /opt/retropie/supplementary/xboxdrv/bin/xboxdrv \
          >> /dev/shm/runcommand.log 2>&1 \
          -c "/home/pi/xboxdrv-config/$folder/${base}.xboxdrv" &
      fi
      

      The emulator name "yape" must match with the emulator name in emulators.cfg (emulator name is the left part of the = assignment in that file).

      Add to /opt/retropie/configs/all/runcommand-onend.sh:

      #!/bin/sh
      
      # kill any in game xboxdrv emulation
      sudo killall xboxdrv > /dev/null 2>&1
      

      Level 6: Scraping with Skyscraper

      You may be able to do automatic scraping depending on your ROMs. However, I realized many homebrew titles are not listed in the usual databases thus I took the following approach.

      This procedure uses the XML import feature of Skyscraper

      • Create import folders for c16 as user pi: mkdir -p ~/.skyscraper/import/c16/{textual,screenshots}
      • Copy your ROMs from c16 folder to textual import folder: cp -r ~/RetroPie/roms/c16/* ~/.skyscraper/import/c16/textual
      • Change to to folder: cd ~/.skyscraper/import/c16/textual
      • Rename rom extension: rename 's/\..+$/.xml/' * (Note: sudo apt install rename if Perl based rename command is not present.)
      • Flush content: truncate -s 0 *.xml
      • Create default XML-Skeleton: for f in *.xml; do cat ../../definitions.dat > $f ; done

      Collect scraping data from internet, do collect screenshots and put them into screenshots folder, name them like the corresponding xml file without extension and store in png or jpg format and .jpg/.png extension. E.g. Pets_Rescue.xml will have a PNG screenshot name Pets_Rescue.png.

      When collected all information into files do: Skyscraper -p c16 -s import and Skyscraper -p c16.

      Restart EmulationStation.

      Finally: Press Play On Yape

      Congrats. You made it. Revel in your success. Enjoy your new C16/C116/Plus4 system collection. (:

      Changelog

      2023-08-27: Moved Artwork Files to SaberCat; Manual lr-vice for xplus4 installation no longer mandatory; Scaling in ES carousel fixed, thus no longer need to have two logos for artwork.

      1 Reply Last reply Reply Quote 3
      • LolonoisL Lolonois referenced this topic on
      • First post
        Last post

      Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

      Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.