From bda0b3ba05423f7b0d4ecce7f5ecc9d891276004 Mon Sep 17 00:00:00 2001 From: Ryan 'Swingflip' Hamlin Date: Sun, 24 Jun 2018 19:44:02 +0100 Subject: Added Hakchi Platform (Nintendo Classics) --- libretro/hakchi/bin/snes | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 libretro/hakchi/bin/snes (limited to 'libretro/hakchi/bin/snes') diff --git a/libretro/hakchi/bin/snes b/libretro/hakchi/bin/snes new file mode 100644 index 0000000..032fbe7 --- /dev/null +++ b/libretro/hakchi/bin/snes @@ -0,0 +1,38 @@ +#!/bin/sh + +setFileName(){ + filename="$(readlink -f "$1")" + filebase="$(basename "$filename")" + extension="${filebase##*.}" +} + +getSfrom(){ + local rom="$(hexdump -e '1/4 "%u"' -s8 -n4 "$1")" + local footer="$(hexdump -e '1/4 "%u"' -s20 -n4 "$1")" + local size="$(hexdump -e '1/4 "%u"' -s$((footer+1)) -n4 "$1")" + dd "status=none" "if=$1" "iflag=skip_bytes" "skip=$rom" "bs=$size" "count=1" +} + +setFileName "$1" +shift + +tmppath="/tmp/rom" +rm -rf "$tmppath" +mkdir -p "$tmppath" +cd "$tmppath" + +if [ "$extension" = "7z" ]; then + tiny7zx x "$filename" + filename="$tmppath/$(ls | head -n1)" + filename_str="${filename// /_}" + mv "$filename" "$filename_str" + setFileName "$filename_str" +fi + +if [ "$extension" = "sfrom" ]; then + filename_str="$filebase.sfc" + getSfrom "$filename" > "$filename_str" + setFileName "$filename_str" +fi + +exec retroarch-clover snes9x2002 "$filename" "$@" -- cgit v1.2.3