Skip to content

Instantly share code, notes, and snippets.

@Gemba
Last active April 13, 2024 07:23
Show Gist options
  • Save Gemba/9dff49492c3ad1d2d3fbb15bfb3ebc4a to your computer and use it in GitHub Desktop.
Save Gemba/9dff49492c3ad1d2d3fbb15bfb3ebc4a to your computer and use it in GitHub Desktop.
Applewin libretro scriptmodule for RetroPie

INSTALLATION

On RetroPie shell as user pi:

cd RetroPie-Setup
mkdir -p ext/local/scriptmodules/libretrocores/lr-applewin
pushd ext/local/scriptmodules/libretrocores
wget -O lr-applewin.sh https://gist.githubusercontent.com/Gemba/9dff49492c3ad1d2d3fbb15bfb3ebc4a/raw/2d4edce7744be1fb1f610a52441b752a4f6f9931/lr-applewin.sh
popd
# Scriptmodule can be found in the RetroPie-Setup UI in the Manage packages/experimental section 
# for installation, or do run:
sudo ./retropie_packages.sh lr-applewin

By default the core starts any game with libretro game focus input_auto_game_focus: off (0), use (1) for on, (2) for automatic detection.

Important customization after installation:

  1. If you have already a game-focus toggle button defined disable/remove the option input_game_focus_toggle_btn in /opt/retropie/configs/apple2/retroarch.cfg
  2. If you use the toggle button option for this libretro core only, then adjust input_game_focus_toggle_btn in /opt/retropie/configs/apple2/retroarch.cfg to your setup, see: https://retropie.org.uk/docs/RetroArch-Configuration/#determining-button-values
  3. Launch ES and launch an apple2 game, then select emulator lr-applewin in runcommand start screen.
#! /usr/bin/env bash
# This file is part of The RetroPie Project
#
# The RetroPie Project is the legal property of its developers, whose names are
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
#
# See the LICENSE.md file at the top-level directory of this distribution and
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
#
rp_module_id="lr-applewin"
rp_module_desc="Apple2e emulator: AppleWin (current) port for libretro"
rp_module_help="ROM Extension: .po .dsk .nib .PO .DSK .NIB .zip\n\nCopy your roms to $romdir/apple2"
rp_module_licence="GPL2 https://raw.githubusercontent.com/audetto/AppleWin/master/LICENSE"
rp_module_repo="git https://github.com/audetto/AppleWin.git master"
rp_module_section="exp"
rp_module_flags=""
function depends_lr-applewin() {
local depends=(
cmake
libboost-program-options-dev
libevdev-dev
libgles-dev
libminizip-dev
libpcap-dev
libsdl2-dev
libsdl2-image-dev
libyaml-dev
meson
ninja-build
)
getDepends "${depends[@]}"
}
function sources_lr-applewin() {
gitPullOrClone $md_build/../libslirp https://gitlab.freedesktop.org/slirp/libslirp.git
gitPullOrClone
# make sure resources/ will be looked up at /opt/retropie/libretrocores/lr-applewin/
sed -i s,CMAKE_SOURCE_DIR,\"$md_inst\", \
$md_build/source/frontends/common2/gnuframe.cpp
}
function build_lr-applewin() {
# for libslirp
pushd $md_build/../libslirp
meson build
ninja -C build install
popd
# for AppleWin
mkdir target
cd target
cmake -DBUILD_LIBRETRO=ON -DCMAKE_BUILD_TYPE=RELEASE ..
make clean
make
md_ret_require="$md_build/target/source/frontends/libretro/applewin_libretro.so"
}
function install_lr-applewin() {
rm -rf $md_build/../libslirp
md_ret_files=(
'LICENSE'
'resource/'
'target/source/frontends/libretro/applewin_libretro.so'
)
}
function configure_lr-applewin() {
mkRomDir "apple2"
if [[ "$md_mode" == "install" ]] ; then
defaultRAConfig "apple2" "input_auto_game_focus" "0" # 0: off, 1: on, 2: detect
defaultRAConfig "apple2" "load_dummy_on_core_shutdown" "false"
# Disable at all if defined in parent Retroarch configs or
# adjust button number below to your controller setup.
# cf: https://retropie.org.uk/docs/RetroArch-Configuration/#determining-button-values
defaultRAConfig "apple2" "input_game_focus_toggle_btn" "3"
fi
addEmulator 0 "$md_id" "apple2" "$md_inst/applewin_libretro.so"
addSystem "apple2"
}
@diegov-au
Copy link

Hey there - firstly thank you for making this handy scriptmodule! For some reason, after the install, the core fails to start because it can't load libslirp.so.0. I manually added /usr/local/lib/arm-linux-gnueabihf to the ld.so.conf file and all seems to work.

@Gemba
Copy link
Author

Gemba commented Sep 23, 2023

RetroPie by default has this path included in /etc/ld.so.conf.d/arm-linux-gnueabihf.conf.
I can not reproduce the effect on my setup. Maybe file it in the RetroPie forum if others have encountered it.
I you don't run a official RetroPie setup you are on your own.

@Exarkuniv
Copy link

@Gemba yes there is something up with this now. for whatever reason its not seeing libslirp.so.0 anymore

so far 2 other people have reported it, and i also have reproduce on my test build. a pi4 updated with the latest version or retropie 4.8.6

@Gemba
Copy link
Author

Gemba commented Apr 13, 2024

Let's keep this discussion (there)[https://retropie.org.uk/forum/topic/33983/apple2e-applewin-libretro/].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment