Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/retroarch-clover.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-07 10:15:49 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-10-07 10:15:49 +0300
commitb959a62f6d28b00836efff8057f6aa4c36429eb8 (patch)
tree6c6e740d0cf41387ef6b64f0f2eb805dc1d93462
parentb1174a4a84e22e286ca6214bc3d4b0e4ad358b27 (diff)
SNES Mini support
-rwxr-xr-xretroarch.hmod/bin/retroarch-clover112
-rw-r--r--retroarch.hmod/bin/retroarch-clover-child138
-rw-r--r--retroarch.hmod/etc/preinit.d/pe9af_retroarch2
-rw-r--r--retroarch.hmod/install2
4 files changed, 144 insertions, 110 deletions
diff --git a/retroarch.hmod/bin/retroarch-clover b/retroarch.hmod/bin/retroarch-clover
index bd6d1ce..81e889f 100755
--- a/retroarch.hmod/bin/retroarch-clover
+++ b/retroarch.hmod/bin/retroarch-clover
@@ -1,113 +1,9 @@
#!/bin/sh
-HOME=/etc/libretro
-corename=$1
-core=$HOME/core/$1_libretro.so
-rom=$2
-filename=$(basename "$rom")
-id=${filename%.*}
-extension="${filename##*.}"
-autosave="/var/cache/$id.state.auto"
-rsram="/var/cache/$id.srm"
-rsav="/var/cache/$id.sav"
-t_suffix=_time.txt
-shift 2
-crt=0
-allow_crt=0
-
-while [ $# -gt 0 ]; do
- [ "$1" == "--load-state-file" ] && load=$2
- [ "$1" == "--save-on-quit" ] && save=$2
- [ "$1" == "--save-screenshot-on-quit" ] && screenshot=$2
- [ "$1" == "--save-data-backing-file" ] && sram=$2
- [ "$1" == "--graphic-filter" ] && filter=$2
- [ "$1" == "--enable-crt-scanlines" ] && crt=1
- [ "$1" == "--ra-allow-crt" ] && allow_crt=1
- [ "$1" == "--ra-extra" ] && extra=$2
- [ "$1" == "--ra-nosaves" ] && nosaves=1
- shift
-done
-
-# saves if any
-rm -f /var/cache/*.state /var/cache/*.auto /var/cache/*.srm /var/cache/*.sav
-if [ ! -z "$load" ] && [ -f "$load" ] && [ -z "$nosaves" ]; then
- if [ $(hexdump -n 2 -e '1/1 "%02X"' "$load") == "1F8B" ]; then
- cp -f "$load" "$autosave.gz"
- gunzip -f "$autosave.gz"
- else
- cp -f "$load" "$autosave"
- fi
-fi
-# Nestopia names FDS saves as $id.sav, so here's a quick fix
-if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
- [ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsav"
-else
- [ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsram"
-fi
-
-
-# core provided ratio for CRT mode
-[ "$filter" == "crt720" ] && ratio=21 && smooth=false && crt=1
-# core provided ratio for 4:3 mode
-[ "$filter" == "gpu720" ] && ratio=21 && smooth=false
-# pixel perfect - 1:1 for pixel perfect mode
-[ "$filter" == "ppu" ] && ratio=20 && smooth=false
-
-# Allow scanlines only for simple systems
-[ "$allow_crt" == "1" ] || crt=0
-
-# Set aspect ratio in config only if current ratio is 20 (1:1 PAR) or 21 (core provided)
-current_ratio=$(cat /etc/libretro/retroarch.cfg | grep "aspect_ratio_index" | sed 's/[^0-9]*//g')
-if [ -z "$ratio" ] || [ "$current_ratio" == "21" ] || [ "$current_ratio" == "20" ]; then
- sed -i -e 's/aspect_ratio_index = "[^"]*"/aspect_ratio_index = "'$ratio'"/g' /etc/libretro/retroarch.cfg
-fi
-
-# enable shader scanlines if need
-if [ "$crt" == "1" ]; then
- sed -i -e 's/video_shader = "[^"]*"/video_shader = "~\/shaders\/retroarch\.glslp"/g' /etc/libretro/retroarch.cfg
- rsync -a -c /etc/libretro/shaders/scanline.glslp /etc/libretro/shaders/retroarch.glslp
-else
- sed -i -e 's/video_shader = "[^"]*"/video_shader = ""/g' /etc/libretro/retroarch.cfg
-fi
-
-# Start timestamp
-ts=$(date +"%s")
-tm=0
-[ -f "$load$t_suffix" ] && tm=$(cat "$load$t_suffix")
-
-retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" $extra &
-rpid=$!
-trap "kill $rpid" SIGTERM
-sleep 5
-rm -f /var/cache/*.state /var/cache/*.auto /var/cache/*.srm /var/cache/*.sav
-
-# Playing games until reset pressed
-wait $rpid
-
-# We can't let clover shell load so fast, so killing it
+# Kill it! Kill it with fire!
pkill -KILL clover-mcp
-
-[ ! -z "$save" ] && mkdir -p $(dirname "$save")
-[ ! -z "$sram" ] && mkdir -p $(dirname "$sram")
-[ ! -z "$screenshot" ] && mkdir -p $(dirname "$screenshot")
-
-# Screenshot! It's not so fast...
-[ -z "$screenshot" ] || [ -z "$nosaves" ] && fbgrab -z 0 "$screenshot"
-
-# Saves!
-[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save"
-if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
- [ ! -z "$sram" ] && [ -f "$rsav" ] && mv -f "$rsav" "$sram"
+if [ -f "/bin/remote-exec" ]; then
+ echo retroarch-clover-child $@ > /var/exec.flag
else
- [ ! -z "$sram" ] && [ -f "$rsram" ] && mv -f "$rsram" "$sram"
+ exec retroarch-clover-child $@
fi
-
-# Time
-ts2=$(date +"%s")
-tm=$((tm + ts2 - ts))
-echo $tm > "$save$t_suffix"
-
-# Back to shell
-clover-mcp
-
-return 0
diff --git a/retroarch.hmod/bin/retroarch-clover-child b/retroarch.hmod/bin/retroarch-clover-child
new file mode 100644
index 0000000..cd313e1
--- /dev/null
+++ b/retroarch.hmod/bin/retroarch-clover-child
@@ -0,0 +1,138 @@
+#!/bin/sh
+
+# Kill it! Kill it with fire!
+pkill -KILL clover-mcp
+
+HOME=/etc/libretro
+corename=$1
+core=$HOME/core/$1_libretro.so
+rom=$2
+filename=$(basename "$rom")
+id=${filename%.*}
+extension="${filename##*.}"
+autosave="/var/cache/$id.state.auto"
+rsram="/var/cache/$id.srm"
+rsav="/var/cache/$id.sav"
+t_suffix=_time.txt
+shift 2
+
+crt=0
+allow_crt=0
+
+while [ $# -gt 0 ]; do
+ [ "$1" == "--load-state-file" ] && load=$2
+ [ "$1" == "--save-on-quit" ] && save=$2
+ [ "$1" == "--rollback-input-dir" ] && load=$2/savestate
+ [ "$1" == "--rollback-output-dir" ] && save=$2/savestate
+ [ "$1" == "--save-screenshot-on-quit" ] && screenshot=$2
+ [ "$1" == "--save-data-backing-file" ] && sram=$2
+ [ "$1" == "--graphic-filter" ] && filter=$2
+ [ "$1" == "--enable-crt-scanlines" ] && crt=1
+ [ "$1" == "--video-mode" ] && [ "$2" == "crt-filter" ] && filter=crt720
+ [ "$1" == "--video-mode" ] && [ "$2" == "keep-aspect-ratio" ] && filter=gpu720
+ [ "$1" == "--video-mode" ] && [ "$2" == "pixel-perfect" ] && filter=ppu
+ [ "$1" == "--ra-allow-crt" ] && allow_crt=1
+ [ "$1" == "--ra-extra" ] && extra=$2
+ [ "$1" == "--ra-nosaves" ] && nosaves=1
+ [ "$1" == "--save-time-path" ] && timefile=$2
+ shift
+done
+
+[ -z "$timefile" ] && timefile=$load$t_suffix
+
+# saves if any
+rm -f /var/cache/*.state /var/cache/*.auto /var/cache/*.srm /var/cache/*.sav
+if [ ! -z "$load" ] && [ -f "$load" ] && [ -z "$nosaves" ]; then
+ if [ $(hexdump -n 2 -e '1/1 "%02X"' "$load") == "1F8B" ]; then
+ cp -f "$load" "$autosave.gz"
+ gunzip -f "$autosave.gz"
+ else
+ cp -f "$load" "$autosave"
+ fi
+fi
+# Nestopia names FDS saves as $id.sav, so here's a quick fix
+if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
+ [ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsav"
+else
+ [ ! -z "$sram" ] && [ -f "$sram" ] && cp -f "$sram" "$rsram"
+fi
+
+# core provided ratio for CRT mode
+[ "$filter" == "crt720" ] && ratio=21 && smooth=false && crt=1
+# core provided ratio for 4:3 mode
+[ "$filter" == "gpu720" ] && ratio=21 && smooth=false
+# pixel perfect - 1:1 for pixel perfect mode
+[ "$filter" == "ppu" ] && ratio=20 && smooth=false
+
+# Allow scanlines only for simple systems
+[ "$allow_crt" == "1" ] || crt=0
+
+# Set aspect ratio in config only if current ratio is 20 (1:1 PAR) or 21 (core provided)
+current_ratio=$(cat /etc/libretro/retroarch.cfg | grep "aspect_ratio_index" | sed 's/[^0-9]*//g')
+if [ -z "$ratio" ] || [ "$current_ratio" == "21" ] || [ "$current_ratio" == "20" ]; then
+ sed -i -e 's/aspect_ratio_index = "[^"]*"/aspect_ratio_index = "'$ratio'"/g' /etc/libretro/retroarch.cfg
+fi
+
+# enable shader scanlines if need
+if [ "$crt" == "1" ]; then
+ sed -i -e 's/video_shader = "[^"]*"/video_shader = "~\/shaders\/retroarch\.glslp"/g' /etc/libretro/retroarch.cfg
+ rsync -a -c /etc/libretro/shaders/scanline.glslp /etc/libretro/shaders/retroarch.glslp
+else
+ sed -i -e 's/video_shader = "[^"]*"/video_shader = ""/g' /etc/libretro/retroarch.cfg
+fi
+
+# Start timestamp
+ts=$(date +"%s")
+tm=0
+[ -f "$timefile" ] && tm=$(cat "$timefile")
+
+retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" $extra &
+rpid=$!
+
+# We need last two files
+for i in $(ls /dev/input/event?) ;do
+ power_file=$reset_file
+ reset_file=$i
+done
+
+dd if=$power_file of=/dev/null count=1 2> /dev/null &
+power_pid=$!
+dd if=$reset_file of=/dev/null count=1 2> /dev/null &
+reset_pid=$!
+
+sleep 2
+rm -f /var/cache/*.state /var/cache/*.auto /var/cache/*.srm /var/cache/*.sav
+
+# Playing games until reset pressed
+while [ true ]; do
+ kill -0 $rpid 2> /dev/null || break
+ kill -0 $reset_pid 2> /dev/null || break
+ kill -0 $power_pid 2> /dev/null || break
+done
+
+kill $rpid 2> /dev/null
+kill -KILL $reset_pid 2> /dev/null
+kill -KILL $power_pid 2> /dev/null
+
+[ ! -z "$save" ] && mkdir -p $(dirname "$save")
+[ ! -z "$sram" ] && mkdir -p $(dirname "$sram")
+[ ! -z "$screenshot" ] && mkdir -p $(dirname "$screenshot")
+
+# Screenshot! It's not so fast...
+[ -z "$screenshot" ] || [ -z "$nosaves" ] && fbgrab -z 0 "$screenshot"
+
+# Saves!
+[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save"
+if [ "$corename" == "nestopia" ] && [ "$extension" == "fds" ]; then
+ [ ! -z "$sram" ] && [ -f "$rsav" ] && mv -f "$rsav" "$sram"
+else
+ [ ! -z "$sram" ] && [ -f "$rsram" ] && mv -f "$rsram" "$sram"
+fi
+
+# Time
+ts2=$(date +"%s")
+tm=$((tm + ts2 - ts))
+echo $tm > "$timefile"
+
+# Back to the shell
+/etc/init.d/S81clover-mcp start
diff --git a/retroarch.hmod/etc/preinit.d/pe9af_retroarch b/retroarch.hmod/etc/preinit.d/pe9af_retroarch
index 405020b..96fbe2b 100644
--- a/retroarch.hmod/etc/preinit.d/pe9af_retroarch
+++ b/retroarch.hmod/etc/preinit.d/pe9af_retroarch
@@ -1 +1 @@
-overmount /usr/bin/clover-kachikachi
+[ -f "$mountpoint/usr/bin/clover-kachikachi" ] && overmount /usr/bin/clover-kachikachi
diff --git a/retroarch.hmod/install b/retroarch.hmod/install
index 89f0f81..c19a1d8 100644
--- a/retroarch.hmod/install
+++ b/retroarch.hmod/install
@@ -2,5 +2,5 @@ transfer_default
chmod +x $rootfs/bin/*
chmod +x $rootfs/usr/bin/*
mkdir -p $rootfs/etc/libretro/system
-cp -f /newroot/usr/share/kachikachi/fds_bios.bin $rootfs/etc/libretro/system/disksys.rom
+[ -f "/newroot/usr/share/kachikachi/fds_bios.bin" ] && cp -f /newroot/usr/share/kachikachi/fds_bios.bin $rootfs/etc/libretro/system/disksys.rom
return 1