Greetings! I'm Auston, author of the Macifom NES emulator and an enthusiastic supporter of C.H.I.P.! For some reason I decided to forego sleep this evening and break in my new Pocket C.H.I.P. by building RetroArch and a few cores from scratch. I thought I might share the recipe as it's an attractive alternative to Mednafen. C.H.I.P. OS being Debian-based, it was straightforward enough, though I stumbled upon some issues when configuring keyboard input and video.
EDIT: I've updated this to build both the SDL v1.2 and v2 drivers, as the former, while it has aspect ratio issues, is much quicker.
EDIT 2: Figured out a workaround for aspect ratio issues with the SDL v1.2 driver and updated my recommended settings for performant, scaled Game Boy video.
EDIT 3: Updated my screenshot to reflect the new recommended settings.
First, you'll want to open Terminal and pull down the necessary tools and libraries:
sudo apt-get install build-essential git pkg-config libsdl2-dev libsdl1.2-dev
Next, clone the latest RetroArch sources from GitHub and build them. I've disabled a number of non-essential features to cut down the dependencies and build time.
git clone https://github.com/libretro/RetroArch.git
./configure --enable-sdl --disable--sdl2 --enable-floathard --enable-neon --disable-opengl --disable-gles --disable-vg --disable-fbo --disable-egl --disable-pulse --disable-oss --disable-x11 --disable-wayland --disable-ffmpeg --disable-7zip --disable-libxml2 --disable-freetype
sudo make install
Note: You can instead use --enable-sdl2 --disable-sdl to use SDL v2 and get automatic aspect ratio preservation at the cost of performance. RetroArch does't seem to be able to support both versions in the same binary.
Once you're built RetroArch, you can run it from Terminal simply by typing
retroarch. Do that to ensure that it works and writes out a default config to ~/.config/retroarch/retroarch.cfg. Depending on which drivers you selected, you may notice that the screen is zoomed in and clipped and the menu doesn't respond to keyboard input. If so, tap the Home button, select Terminal and hit Ctrl-C to kill RetroArch and continue.
The visual issues can be addressed by adjusting settings in ~/.config/retroarch/retroarch.cfg. I recommend the following for full-screen Game Boy emulation:
video_driver = "sdl"
input_driver = "sdl"
input_joypad_driver = "sdl"
video_scale = "1.000000"
video_fullscreen_x = "302"
video_fullscreen_y = "272"
video_fullscreen = "true"
video_windowed_fullscreen = "false"
video_scale_integer = "false"
video_smooth = "false"
input_keyboard_layout = "us"
audio_latency = "128"
Note: If you built with --enable-sdl2, use 'sdl2' in place of 'sdl' in the above lines and the specify the full '480' for video_fullscreen_x. The SDL v2 renderer will preserve the proper aspect ratio for each emulated system, though performance suffers. Also, if you're using SDL v2, you'll need to set an environment variable to prevent it from rendering with OpenGL, which currently results in atrocious performance:
With all of that behind us we're ready to build and install the many emulation cores available in the libretro repository: https://github.com/libretro/
I chose the excellent Gambatte core supplying Game Boy and Game Boy Color emulation for my testing. To try it out, you need only do the following:
First, clone the gambatte-libretro repository and compile the module:
git clone https://github.com/libretro/gambatte-libretro.git
make -f Makefile.libretro
This will produce a shared object file that you can reference when invoking RetroArch like so:
retroarch -L "/path/to/gambatte_libretro.so" my_rom_file.gbc
By default the arrow keys are used for the directional pad, Z and X act as action buttons and Return as Start.
Here's The Legend of Zelda: Oracle of Seasons running smoothly on my Pocket C.H.I.P. using SDL v1.2 and the above settings.