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) --- Makefile | 18 +++++++++- libretro/hakchi/bin/snes | 38 +++++++++++++++++++++ libretro/hakchi/bin/snes02 | 38 +++++++++++++++++++++ libretro/hakchi/etc/preinit.d/pe9b0_retroarch_snes | 1 + libretro/hakchi/readme.md | 23 +++++++++++++ snes9x2002_libretro.so | Bin 0 -> 742284 bytes 6 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 libretro/hakchi/bin/snes create mode 100644 libretro/hakchi/bin/snes02 create mode 100644 libretro/hakchi/etc/preinit.d/pe9b0_retroarch_snes create mode 100644 libretro/hakchi/readme.md create mode 100644 snes9x2002_libretro.so diff --git a/Makefile b/Makefile index 82023cc..ea489fa 100644 --- a/Makefile +++ b/Makefile @@ -103,6 +103,13 @@ else ifeq ($(platform), wiiu) CFLAGS += -U__INT32_TYPE__ -U __UINT32_TYPE__ -D__INT32_TYPE__=int STATIC_LINKING := 1 +#Nintendo Classics (Hakchi) +else ifeq ($(platform), nintendoc) + TARGET := $(TARGET_NAME)_libretro.so + fpic := -fPIC + SHARED := -shared -Wl,--version-script=libretro/link.T -Wl,--no-undefined + CFLAGS += -fno-builtin -fno-exceptions -DARM -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard + # Vita else ifeq ($(platform), vita) TARGET := $(TARGET_NAME)_libretro_$(platform).a @@ -191,6 +198,15 @@ else $(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJS) -lm endif +ifeq ($(platform),nintendoc) + @echo "** BUILDING HAKCHI HMOD PACKAGE **" + mkdir -p libretro/hakchi/etc/libretro/core/ libretro/hakchi/etc/libretro/info/ libretro/hakchi/etc/preinit.d/ + rm -f libretro/hakchi/etc/libretro/info/* + cp $(TARGET_NAME)_libretro.so libretro/hakchi/etc/libretro/core/ + cd libretro/hakchi/etc/libretro/info/; wget https://buildbot.libretro.com/assets/frontend/info/$(TARGET_NAME)_libretro.info + cd libretro/hakchi/; tar -czvf "CORE_$(TARGET_NAME).hmod" * +endif + %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< @@ -198,7 +214,7 @@ endif $(CC) $(CFLAGS) -Wa,-I./src/ -c -o $@ $< clean: - rm -f $(OBJS) $(TARGET) + rm -f $(OBJS) $(TARGET) hakchi/CORE_$(TARGET_NAME).hmod .PHONY: clean 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" "$@" diff --git a/libretro/hakchi/bin/snes02 b/libretro/hakchi/bin/snes02 new file mode 100644 index 0000000..032fbe7 --- /dev/null +++ b/libretro/hakchi/bin/snes02 @@ -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" "$@" diff --git a/libretro/hakchi/etc/preinit.d/pe9b0_retroarch_snes b/libretro/hakchi/etc/preinit.d/pe9b0_retroarch_snes new file mode 100644 index 0000000..82b9be4 --- /dev/null +++ b/libretro/hakchi/etc/preinit.d/pe9b0_retroarch_snes @@ -0,0 +1 @@ +[ -f "$mountpoint/usr/bin/clover-canoe-shvc" ] && overmount /usr/bin/clover-canoe-shvc diff --git a/libretro/hakchi/readme.md b/libretro/hakchi/readme.md new file mode 100644 index 0000000..5a9c826 --- /dev/null +++ b/libretro/hakchi/readme.md @@ -0,0 +1,23 @@ +----------------------- +Name: SNES9x2002 +Creator: Libretro +Category: RetroArch Cores +----------------------- +=== SNES9x2002 Core for RetroArch === + +Module adds support for Super Famicom / Super Nintendo + +Available executables and arguments to run Core: +- /bin/snes +- /bin/snes02 + +Core by libretro + +Built and assembled by HakchiCloud - [Website](https://hakchiresources.com) + +Hakchi module system by madmonkey + +NES/SNES Mini shell integration by Cluster + +(c) 2016-2018 + diff --git a/snes9x2002_libretro.so b/snes9x2002_libretro.so new file mode 100644 index 0000000..c874720 Binary files /dev/null and b/snes9x2002_libretro.so differ -- cgit v1.2.3