From ccceabc5410814ef6a6ad5413ae55211d6e40b31 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 16:43:28 +0100
Subject: [PATCH 01/14] Added Makefile.classic_armv7_a7

---
 Makefile.classic_armv7_a7 | 74 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Makefile.classic_armv7_a7

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
new file mode 100644
index 0000000000..c635df8929
--- /dev/null
+++ b/Makefile.classic_armv7_a7
@@ -0,0 +1,74 @@
+# Make sure you have patchelf installed (sudo apt-get install patchelf) to patch the binary for Hakchi.
+# Might not be needed for your build but it's a useful tool and for safety it should be run anyway to 
+# ensure the SDL2 link isn't broken...
+
+# Classic Readme Variables ############
+
+CLASSIC_MODS_VER := CLASSIC_MODS_Retroarch_Neo_v1_7_5b
+CLASSIC_MODS_NAME := CLASSIC_MODS RetroArch 'Neo' v1.7.5b
+MOD_CREATOR := TheOtherGuys
+MOD_CATEGORY := RetroArch
+GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
+
+# Platform dependant Variables ########
+HAKCHI_DIR := RA_Platform-Hakchi
+HAKCHI_GIT := https://github.com/Classicmods/RA_Platform-Hakchi
+
+# General Shared Variables ############
+TARGET := retroarch
+CC_V = arm-linux-gnueabihf-gcc-8
+CXX_V = arm-linux-gnueabihf-g++-8
+AS_V = arm-linux-gnueabihf-as
+CC_AS_V = arm-linux-gnueabihf-gcc-8
+
+all: $(TARGET)
+
+retroarch:
+	#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
+	patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
+	./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
+	make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 -j #Cook it
+	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
+
+	#HAKCHI BUILD (NESC, SNESC)
+	@echo "** BUILDING CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+	rm -fr /tmp/$(HAKCHI_DIR)
+	cd /tmp/; git clone $(HAKCHI_GIT)
+	cp retroarch /tmp/$(HAKCHI_DIR)/bin/retroarch
+	echo $$(echo "Built by: " $$USER @ $$(date) \\\\\\ Git Commit: $(GIT_COMMIT)) > /tmp/$(HAKCHI_DIR)/etc/libretro/retroarch_version
+	cp /tmp/$(HAKCHI_DIR)/readme.md /tmp/$(HAKCHI_DIR)/readme_COPY.md
+	printf "%s\n" \
+	"---" \
+	"Name: $(CLASSIC_MODS_NAME)" \
+	"Creator: $(MOD_CREATOR)" \
+	"Category: $(MOD_CATEGORY)" \
+	"Version: $(CLASSIC_MODS_VER)" \
+	"Built on: $(shell date)" \
+	"Git commit: $(GIT_COMMIT)" \
+	"---" > /tmp/$(HAKCHI_DIR)/readme.md
+	cat /tmp/$(HAKCHI_DIR)/readme_COPY.md >> /tmp/$(HAKCHI_DIR)/readme.md
+	rm /tmp/$(HAKCHI_DIR)/readme_COPY.md
+	@echo "** BUILDING CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+	cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" *
+	mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod .
+	@echo "** BUILT CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+clean:
+	rm -rf obj-unix
+	rm -f *.d
+	rm -f *.o
+	rm -f audio/*.o
+	rm -f conf/*.o
+	rm -f gfx/*.o
+	rm -f gfx/drivers_font/*.o
+	rm -f gfx/drivers_font_renderer/*.o
+	rm -f gfx/drivers_context/*.o
+	rm -f gfx/py_state/*.o
+	rm -f compat/*.o
+	rm -f record/*.o
+	rm -f input/*.o
+	rm -f tools/*.o
+	rm -f $(BINDIR)/retroarch
+	rm -f $(BINDIR)/retroarch-joyconfig
+	rm -f $(PNDDIR)/readme.html
+	rm -f retroarch
+	rm -f $(CLASSIC_MODS_VER).hmod

From 8d883bda4b5470ba9af34235f218bf4a84a8d954 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 16:49:11 +0100
Subject: [PATCH 02/14] Removed old hakchi platform

---
 Makefile.nintendoc                            |  62 ----
 hakchi/bin/retroarch-clover                   |  16 -
 hakchi/bin/retroarch-clover-child             | 322 ------------------
 hakchi/bin/retroarch-mini                     |  13 -
 hakchi/etc/libretro/core/CORES_GO_HERE.md     |   0
 .../libretro/info/CORE_INFO_FILES_GO_HERE.md  |   0
 .../etc/libretro/system/BIOS_FILES_GO_HERE.md |   0
 hakchi/etc/preinit.d/be9af_retroarch          |  18 -
 hakchi/etc/preinit.d/pe9af_retroarch          |   1 -
 hakchi/install                                |  55 ---
 hakchi/readme.md                              |  49 ---
 11 files changed, 536 deletions(-)
 delete mode 100644 Makefile.nintendoc
 delete mode 100644 hakchi/bin/retroarch-clover
 delete mode 100644 hakchi/bin/retroarch-clover-child
 delete mode 100644 hakchi/bin/retroarch-mini
 delete mode 100644 hakchi/etc/libretro/core/CORES_GO_HERE.md
 delete mode 100644 hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md
 delete mode 100644 hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md
 delete mode 100644 hakchi/etc/preinit.d/be9af_retroarch
 delete mode 100644 hakchi/etc/preinit.d/pe9af_retroarch
 delete mode 100644 hakchi/install
 delete mode 100644 hakchi/readme.md

diff --git a/Makefile.nintendoc b/Makefile.nintendoc
deleted file mode 100644
index 4f971984a4..0000000000
--- a/Makefile.nintendoc
+++ /dev/null
@@ -1,62 +0,0 @@
-# Hakchi version added to ease confusion amongst Hakchi community due to messy past...
-#
-# Make sure you have readelf installed (sudo apt-get install readelf) to patch the binary
-# Might not be needed for your build but it's a useful tool and for safety it should be
-# run anyway to ensure the SDL2 link isn't broken...
-
-HAKCHI_VER := Hakchi_Retroarch_Neo_v1_7_3b
-HAKCHI_NAME := "Hakchi RetroArch 'Neo' v1.7.3b
-MOD_CREATOR := TheOtherGuys
-MOD_CATEGORY := RetroArch
-
-HAKCHI_DIR := hakchi
-TARGET := retroarch
-GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
-
-all: $(TARGET)
-
-retroarch:
-	readelf -v #Check if you have readelf installed... (sudo apt-get install readelf)
-	./configure --host=arm-linux-gnueabihf --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
-	make -f Makefile -j HAVE_HAKCHI=1
-	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
-	#/usr/bin/arm-linux-gnueabihf-strip retroarch
-	rm -f $(HAKCHI_DIR)/bin/retroarch
-	cp retroarch $(HAKCHI_DIR)/bin/retroarch
-	echo $$(echo "Built by: " $$USER @ $$(date) \\\\\\ Git Commit: $(GIT_COMMIT)) > $(HAKCHI_DIR)/etc/libretro/retroarch_version
-	cp $(HAKCHI_DIR)/readme.md $(HAKCHI_DIR)/readme_COPY.md
-	printf "%s\n" \
-	"---" \
-	"Name: $(HAKCHI_VER)" \
-	"Creator: $(MOD_CREATOR)" \
-	"Category: $(MOD_CATEGORY)" \
-	"Version: $(HAKCHI_VER)" \
-	"Built on: $(shell date)" \
-	"Git commit: $(GIT_COMMIT)" \
-	"---" > $(HAKCHI_DIR)/readme.md
-	cat $(HAKCHI_DIR)/readme_COPY.md >> $(HAKCHI_DIR)/readme.md
-	rm $(HAKCHI_DIR)/readme_COPY.md
-	@echo "** BUILDING HAKCHI $(HAKCHI_VER) HMOD PACKAGE **"
-	cd $(HAKCHI_DIR)/; tar -czvf "$(HAKCHI_VER).hmod" *
-	mv $(HAKCHI_DIR)/$(HAKCHI_VER).hmod .
-	@echo "** BUILT HAKCHI $(HAKCHI_VER) HMOD PACKAGE **"
-clean:
-	rm -f *.o
-	rm -f audio/*.o
-	rm -f conf/*.o
-	rm -f gfx/*.o
-	rm -f gfx/drivers_font/*.o
-	rm -f gfx/drivers_font_renderer/*.o
-	rm -f gfx/drivers_context/*.o
-	rm -f gfx/py_state/*.o
-	rm -f compat/*.o
-	rm -f record/*.o
-	rm -f input/*.o
-	rm -f tools/*.o
-	rm -f $(BINDIR)/retroarch
-	rm -f $(BINDIR)/retroarch-joyconfig
-	rm -f $(PNDDIR)/readme.html
-	rm -f retroarch
-	rm -f $(HAKCHI_DIR)/bin/retroarch
-	rm -f $(HAKCHI_VER).hmod
-	rm -f $(HAKCHI_DIR)/etc/libretro/retroarch_version
diff --git a/hakchi/bin/retroarch-clover b/hakchi/bin/retroarch-clover
deleted file mode 100644
index 4143555d4c..0000000000
--- a/hakchi/bin/retroarch-clover
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-source /etc/preinit
-script_init
-
-uistop
-
-core="$1"
-rom="$2"
-shift 2
-
-if [ -f "/bin/remote-exec" ]; then
-  echo retroarch-clover-child "$core" "\"$rom\"" ${1+"$@"} > /var/exec.flag
-else
-  exec retroarch-clover-child "$core" "\"$rom\"" ${1+"$@"}
-fi
diff --git a/hakchi/bin/retroarch-clover-child b/hakchi/bin/retroarch-clover-child
deleted file mode 100644
index f078f6ccfa..0000000000
--- a/hakchi/bin/retroarch-clover-child
+++ /dev/null
@@ -1,322 +0,0 @@
-#!/bin/sh
-
-source /etc/preinit
-script_init
-
-#### Variable Definitions ##################################################
-
-HOME=/etc/libretro
-corename="$1"
-noprefix="${corename#km_}"
-core="$HOME/core/${1}_libretro.so"
-rom="$2"
-filename="$(basename "$rom")"
-id="${filename%.*}"
-extension="${filename##*.}"
-newrsram=/var/saves/retroarch
-autosave="/var/cache/retroarch/$id.state.auto"
-t_suffix=_time.txt
-debug=0
-bezel_mode=0
-clovercon_file=/dev/clovercon1
-shift 2
-
-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 && crt=1
-  [ "$1" == "--video-mode" ] && [ "$2" == "keep-aspect-ratio" ] && filter=gpu720
-  [ "$1" == "--video-mode" ] && [ "$2" == "pixel-perfect" ] && filter=ppu
-  [ "$1" == "--smooth43" ] && smooth43=1
-  [ "$1" == "--no-smooth" ] && no_smooth=1
-  [ "$1" == "--no-scanlines" ] && no_scanlines=1
-  [ "$1" == "--bezel-mode" ] && bezel_mode=1
-  [ "$1" == "--title-code" ] && title_code="$2"
-  [ "$1" == "--ra-extra" ] && extra="$2"
-  [ "$1" == "--ra-nosaves" ] && nosaves=1
-  [ "$1" == "--load-time-path" ] && timefile_load="$2"
-  [ "$1" == "--save-time-path" ] && timefile_save="$2"
-  [ "$1" == "--replay-inputs" ] && demo=1
-  [ "$1" == "--decorative-frame-path" ] && frame="$2"
-  [ "$1" == "--debug-usb" ] && debug=1
-  [ "$1" == "--debug-nand" ] && debug=2
-  [ "$1" == "--custom-loadscreen" ] && custom_loadscreen="$2"
-  shift
-done
-
-#### Visuals ###############################################################
-
-#Retrospective fix for hakchi port splashes
-if ! echo $corename | grep "prboom\|tyrquake\|cannonball"; then
-  umount "$rootfs/share/retroarch/assets/RAloading-min.png"
-fi
-
-# Display Splash Screen
-if [ ! -z "$custom_loadscreen" ]; then
-  decodepng "$rootfs/share/retroarch/assets/$custom_loadscreen" > /dev/fb0;
-else
-  if [ -f "$mountpoint/media/hakchi/RA_loading_screens/$noprefix.png" ] && [ -f "$rootfs/share/retroarch/assets/RAloading-min.png" ]; then
-	  decodepng "$mountpoint/media/hakchi/RA_loading_screens/$noprefix.png"  > /dev/fb0;
-  else
-    if [ -f "$rootfs/share/retroarch/assets/core_loading_screens/$noprefix.png" ] && [ -f "$rootfs/share/retroarch/assets/RAloading-min.png" ]; then
-      decodepng "$rootfs/share/retroarch/assets/core_loading_screens/$noprefix.png"  > /dev/fb0;
-    else
-      decodepng "$rootfs/share/retroarch/assets/RAloading-min.png" > /dev/fb0;
-    fi
-  fi
-fi
-
-#### Network Mounting ######################################################
-
-if [ -f "/media/hakchi/retroarch-mounted.cfg" ]; then
-  mv -f /media/hakchi/retroarch-mounted.cfg /etc/libretro/
-fi
-
-source /etc/libretro/retroarch-mounted.cfg
-if [ "$ra_mount_enable" == "true" ] && [ ! -z "${ra_mount_address// }" ] && [ ! -d /var/mount ]; then
-  mkdir -p /var/mount
-  if [ ! -z "${ra_mount_user// }" ] && [ ! -z "${ra_mount_pass// }" ]; then
-    mount -t cifs -o user=$ra_mount_user,pass=$ra_mount_pass $ra_mount_address /var/mount
-  elif [ ! -z "${ra_mount_user// }" ] && [ -z "${ra_mount_pass// }" ]; then
-    mount -t cifs -o user=$ra_mount_user $ra_mount_address /var/mount
-  else
-    mount -t cifs $ra_mount_address /var/mount
-  fi
-fi
-
-#### Saves and Configs #####################################################
-
-[ ! -z "$demo" ] && load="$(dirname "$load")/savestate"
-
-# Create cache and /var/saves/retroarch directories
-mkdir -p /var/cache/retroarch
-mkdir -p "$newrsram"
-
-# Create a "cartridge.sram" file of 21B to avoid hakchi2 save-state manager from removing the folder
-# Just in case we're going the "/var/saves/CLV-Z-RETROARCH" way
-# if [ -f "/var/saves/CLV-Z-RETROARCH/cartridge.sram" ]; then
-  # [ "$(wc -c </var/saves/CLV-Z-RETROARCH/cartridge.sram)" -lt 21 ] && rm /var/saves/CLV-Z-RETROARCH/cartridge.sram && dd if=/dev/zero of=/var/saves/CLV-Z-RETROARCH/cartridge.sram bs=21 count=1
-# else
-  # dd if=/dev/zero of=/var/saves/CLV-Z-RETROARCH/cartridge.sram bs=21 count=1
-# fi
-
-# Moving RetroArch saves from "/var/saves/" to "/var/saves/retroarch/" if the ID is known (if the .desktop is on the console atm)
-if [ -z "$(ls -A "$newrsram")" ]; then # so this whole part only executes at the 1st launch
-  if [ -d "/media/hakchi" ]; then
-    desktop_search="/media/hakchi/games"
-  else
-    desktop_search="/var/lib/hakchi/games"
-  fi
-  for rasaves in /var/saves/CLV-*; do
-    fdsgame=0
-    canoecheck=0
-    gameid="$(basename "$rasaves")"
-	# [ "$gameid" = "CLV-Z-RETROARCH" ] && continue
-    if [ -f "$rasaves/cartridge.sram" ] && [ -f "$rasaves/cartridge.sram.hash" ]; then
-      [ "$(tail -c 20 "$rasaves/cartridge.sram")" = "$(cat "$rasaves/cartridge.sram.hash")" ] && canoecheck=1 # check if thats a Canoe save
-    fi
-    if [ "$canoecheck" = 0 ] && [ -f "$rasaves/cartridge.sram" ]; then
-      if [ ! -z "$(find "$desktop_search" -name "$gameid.desktop")" ]; then # search for .desktop file
-	    filename2="$(cat `find "$desktop_search" -name "$gameid.desktop"` | grep "^Exec=" | basename `awk '{print $2}'`)"
-		[ "${filename2##*.}" = "fds" ] && fdsgame=1
-		filename2="${filename2%.*}"
-		if [ ! -z "$(cat `find "$desktop_search" -name "$gameid.desktop"` | grep "/bin/gpsp")" ]; then
-		  mv "$rasaves/cartridge.sram" "$newrsram/$filename2.sav" # rename the file to .sav if its a gpSP save
-		elif [ ! -z "$(cat `find "$desktop_search" -name "$gameid.desktop"` | grep "/bin/nes\|/bin/nestopia")" ] && [ "$fdsgame" = 1 ]; then
-		  mv "$rasaves/cartridge.sram" "$newrsram/$filename2.sav" # rename the file to .sav if its a FDS Nestopia save
-		else
-		  mv "$rasaves/cartridge.sram" "$newrsram/$filename2.srm" # rename the file to .srm
-		fi
-	  fi
-    fi
-    if ls "$rasaves" | grep -w "brm$"; then
-      mv "$rasaves/"*.brm "$newrsram" # no need to rename those, just move
-    fi
-  done
-fi
-
-# Copy savestates from USB if any
-if [ -d "/media/data/ra_savestates" ] && ls "/media/data/ra_savestates/$title_code/$id.state"*; then
-  cp "/media/data/ra_savestates/$title_code/$id.state"* /var/cache/retroarch
-fi
-
-# Move mame config files to "/var/saves/retroarch"
-if [ -d "/etc/libretro/.config/retroarch/config/arcade" ]; then
-  if [ ! -z "$(ls -A /etc/libretro/.config/retroarch/config/arcade)" ]; then
-    mv /etc/libretro/.config/retroarch/config/arcade/* "$newrsram"
-	[ -z "$(ls -A /etc/libretro/.config/retroarch/config/arcade)" ] && rmdir /etc/libretro/.config/retroarch/config/arcade
-  fi
-fi
-
-# saves if any
-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
-
-# Moving and renaming save from "/var/saves/CLV-*/cartridge.*" to "/var/saves/retroarch/$id.*" that were previously unknown
-if [ "$noprefix" == "nestopia" ] && [ "$extension" == "fds" ]; then
-  [ ! -z "$sram" ] && [ -f "$sram" ] && mv "$sram" "$newrsram/$id.sav"
-elif [ "$noprefix" == "gpsp" ]; then
-  [ ! -z "$sram" ] && [ -f "$sram" ] && mv "$sram" "$newrsram/$id.sav"
-elif [ "$noprefix" == "genesis_plus_gx" ]; then
-  [ -f "/var/saves/$title_code/$id.brm" ] && mv "/var/saves/$title_code/$id.brm" "$newrsram"
-else
-  [ ! -z "$sram" ] && [ -f "$sram" ] && mv "$sram" "$newrsram/$id.srm"
-fi
-
-#### General ###############################################################
-
-#Overcommit this. (Should solve dumb crashes due to memory limits)
-echo "1" > "/proc/sys/vm/overcommit_memory"
-
-[ -z "$timefile_save" ] && timefile_save="$load$t_suffix"
-[ -z "$timefile_load" ] && timefile_load="$load$t_suffix"
-
-# Hold L button while starting a game to toggle bezel-mode for this game
-if [ -e "$clovercon_file" ] && [ "$(cat $clovercon_file)" == "0004" ]; then
-  if [ "$bezel_mode" == "0" ]; then
-    sed -i "s/^Exec.*/& --bezel-mode/" "$gamepath/$title_code/$title_code.desktop" && bezel_mode=1
-  else
-    sed -i "s/ --bezel-mode//g" "$gamepath/$title_code/$title_code.desktop" && bezel_mode=0
-  fi
-fi
-# Hold R button while starting a game to toggle bezel-mode for this core
-if [ -e "$clovercon_file" ] && [ "$(cat $clovercon_file)" == "0008" ]; then
-  [ ! -f "$HOME/bezel-core" ] && touch "$HOME/bezel-core"
-  if grep "^$corename$" "$HOME/bezel-core"; then
-    sed -i "/^$corename$/d" "$HOME/bezel-core"
-  else
-    echo "$corename" >> "$HOME/bezel-core"
-  fi
-fi
-[ -f "$HOME/bezel-core" ] && grep "^$corename$" "$HOME/bezel-core" && bezel_mode=1
-
-# Smooth, border and scanlines
-if [ "$bezel_mode" == "1" ]; then
-  [ "$filter" == "crt720" ] && overlay1=scanlines.png && overlay2="$frame.png"
-else
-  [ "$filter" == "crt720" ] && overlay1=scanlines.png
-fi
-[ "$filter" == "crt720" ] && [ ! -z "$no_scanlines" ] || [ ! "$filter" == "crt720" ] && overlay1="$frame.png"
-retroarch_watchdog --configEdit /etc/libretro/.config/retroarch/overlay/default.cfg overlay0_overlay "$overlay1" overlay0_desc0_overlay "$overlay2"
-retroarch_watchdog --configEdit /etc/libretro/.config/retroarch/overlay/default_scanlines.cfg overlay0_desc0_overlay "$frame.png"
-
-ra_config_args=""
-# Functions to make the rest easier
-smooth(){ ra_config_args="$ra_config_args video_smooth $1"; }
-overlay(){ ra_config_args="$ra_config_args input_overlay_enable $1"; }
-overlay_file(){ ra_config_args="$ra_config_args input_overlay ~/.config/retroarch/overlay/$1"; }
-int_scale(){ ra_config_args="$ra_config_args video_scale_integer $1"; }
-ratio(){ ra_config_args="$ra_config_args aspect_ratio_index $1"; }
-width(){ ra_config_args="$ra_config_args custom_viewport_width $1"; }
-height(){ ra_config_args="$ra_config_args custom_viewport_height $1"; }
-posx(){ ra_config_args="$ra_config_args custom_viewport_x $1"; }
-posy(){ ra_config_args="$ra_config_args custom_viewport_y $1"; }
-
-# Smooth and bezel-mode
-if [ "$bezel_mode" == "1" ]; then
-  [ "$filter" == "crt720" ] && width 877 && posx 201
-  [ "$filter" == "gpu720" ] && smooth false && width 877 && posx 201
-  [ "$filter" == "ppu" ] && smooth false && width 768 && posx 256
-  ratio 22 && overlay true && overlay_file default.cfg && height 672 && posy 24 && int_scale true
-fi
-[ "$filter" == "crt720" ] && overlay true
-[ "$filter" == "crt720" ] && [ -z "$no_smooth" ] && smooth true
-[ "$filter" == "crt720" ] && [ ! -z "$no_smooth" ] && smooth false
-[ "$filter" == "gpu720" ] && [ ! -z "$smooth43" ] && smooth true
-
-# Set config for standalone launch mode
-if [ -z "${corename// }" ]; then
-    ra_config_args="$ra_config_args savefile_directory /var/saves/CLV-Z-RETROARCH"
-    ra_config_args="$ra_config_args savestate_directory /var/saves/CLV-Z-RASAVESTATES"
-    ra_config_args="$ra_config_args savestate_auto_save false"
-    ra_config_args="$ra_config_args savestate_auto_load false"
-    ra_config_args="$ra_config_args autosave_interval 0"
-fi
-
-[ ! -z "$ra_config_args" ] && retroarch_watchdog --configEdit /etc/libretro/retroarch.cfg $ra_config_args
-
-#### Runtime ###############################################################
-
-if [ -f "/media/hakchi/RA_DEV_MODE" ]; then #Devmode Active (Record current session)
-  if [ -z "${corename// }" ]; then
-    rm -f /media/Development_RetroArch.log
-    echo "Pre RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log
-    retroarch -c "$HOME/retroarch.cfg" -vf > /media/Development_RetroArch.log 2>&1 &
-  else
-    rm -f /media/Development_RetroArch.log
-    echo "Pre RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log
-    retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > /media/Development_RetroArch.log 2>&1 &
-  fi
-else
-  if [ -z "${corename// }" ]; then
-    retroarch -c "$HOME/retroarch.cfg" -vf &
-  fi
-  if [ "$debug" == "0" ]; then #Default
-    retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" &
-  fi
-  if [ "$debug" == "1" ]; then #Verbose USB mode
-    retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > "/media/${filename}_RetroArch.log" 2>&1 &
-  fi
-  if [ "$debug" == "2" ]; then #Verbose NAND mode
-    retroarch -c "$HOME/retroarch.cfg" -vfL "$core" "$rom" "$extra" > "/tmp/${filename}_RetroArch.log" 2>&1 &
-  fi
-fi
-
-#### Watchdog ##############################################################
-
-# Set Watchdog Arguments
-watchdog_args="$!"
-# Demo mode enabled
-[ ! -z "$demo" ] && watchdog_args="$watchdog_args --demo"
-# Set Screenshot Args
-[ ! -z "$screenshot" ] && [ -z "$nosaves" ] && watchdog_args="$watchdog_args --screenshot $screenshot"
-# Load Time Played
-[ -f "$timefile_load" ] && watchdog_args="$watchdog_args --time $(cat "$timefile_load")"
-[ -z "$demo" ] && watchdog_args="$watchdog_args --timePath $timefile_save"
-
-# Create output folders
-[ ! -z "$save" ] && mkdir -p "$(dirname "$save")"
-[ ! -z "$sram" ] && mkdir -p "$(dirname "$sram")"
-[ ! -z "$screenshot" ] && mkdir -p "$(dirname "$screenshot")"
-
-# Run retroarch watchdog
-retroarch_watchdog $watchdog_args
-
-#### Cleanup ###############################################################
-
-# Saves!
-[ ! -z "$save" ] && [ -f "$autosave" ] && [ -z "$nosaves" ] && gzip -f "$autosave" && mv -f "$autosave.gz" "$save"
-
-# Restore Retroarch Config
-retroarch_watchdog --configRestore /etc/libretro/retroarch.cfg
-
-# Copy savestates to USB if any and delete cache folder
-if [ -d "/media/hakchi" ] && ls "/var/cache/retroarch/$id".*[^auto]; then
-  [ ! -d "/media/data/ra_savestates/$title_code" ] && mkdir -p "/media/data/ra_savestates/$title_code"
-  cp "/var/cache/retroarch/$id".*[^auto] "/media/data/ra_savestates/$title_code"
-fi
-rm -rf /var/cache/retroarch/
-
-#Remove network drive mount if Hakchi Mount mod is enabled
-if [ ! -f "$rootfs/etc/hakchi_mount_mod" ]; then
-  umount "/var/mount" && rm -rf "/var/mount"
-fi
-
-if [ -f "/media/hakchi/RA_DEV_MODE" ]; then #Devmode Active (Record current session)
-  echo "Post RA load Core Temp: $(more /sys/devices/virtual/thermal/thermal_zone0/temp)" >> /media/Development_RA_temp.log
-fi
-
-# Back to the shell
-uistart
diff --git a/hakchi/bin/retroarch-mini b/hakchi/bin/retroarch-mini
deleted file mode 100644
index a00ab31434..0000000000
--- a/hakchi/bin/retroarch-mini
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-source /etc/preinit
-script_init
-
-uistop
-
-exec retroarch-clover-child
-if [ -f "/bin/remote-exec" ]; then
-  echo retroarch-clover-child > /var/exec.flag
-else
-  exec retroarch-clover-child
-fi
diff --git a/hakchi/etc/libretro/core/CORES_GO_HERE.md b/hakchi/etc/libretro/core/CORES_GO_HERE.md
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md b/hakchi/etc/libretro/info/CORE_INFO_FILES_GO_HERE.md
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md b/hakchi/etc/libretro/system/BIOS_FILES_GO_HERE.md
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/hakchi/etc/preinit.d/be9af_retroarch b/hakchi/etc/preinit.d/be9af_retroarch
deleted file mode 100644
index 871d348329..0000000000
--- a/hakchi/etc/preinit.d/be9af_retroarch
+++ /dev/null
@@ -1,18 +0,0 @@
-Hakchi_Libretro_Initialise(){
-  if [ -z "$(mount | grep "/etc/libretro ")" ] && [ -d "$mountpoint/media/$modname" ] && [ "$cfg_usb_rw" == "y" ]; then
-    local externalPath="$mountpoint/media/data/ra_data"
-    local localPath="$rootfs/etc/libretro/.config/retroarch"
-    for ra_folders in database thumbnails playlists downloads; do
-      if [ ! -d "$externalPath/$ra_folders" ]; then
-        mkdir -p "$externalPath/$ra_folders"
-        copy "$localPath/$ra_folders" "$externalPath"
-        rm -rf "$localPath/$ra_folders/"*
-      fi
-      mount_bind "$externalPath/$ra_folders" "$localPath/$ra_folders"
-      overmount "${localPath#$rootfs}/$ra_folders"
-    done
-    unset ra_folders
-  fi
-  [ -f "$mountpoint/usr/bin/clover-kachikachi" ] && overmount /usr/bin/clover-kachikachi
-  [ -f "$mountpoint/usr/bin/clover-canoe-shvc" ] && overmount /usr/bin/clover-canoe-shvc
-}
diff --git a/hakchi/etc/preinit.d/pe9af_retroarch b/hakchi/etc/preinit.d/pe9af_retroarch
deleted file mode 100644
index a05a2a8094..0000000000
--- a/hakchi/etc/preinit.d/pe9af_retroarch
+++ /dev/null
@@ -1 +0,0 @@
-Hakchi_Libretro_Initialise
diff --git a/hakchi/install b/hakchi/install
deleted file mode 100644
index a36083ccf8..0000000000
--- a/hakchi/install
+++ /dev/null
@@ -1,55 +0,0 @@
-echo "Grabbing old config variables..."
-cheevos_username=$(grep -i "cheevos_username*" $rootfs/etc/libretro/retroarch.cfg)
-cheevos_password=$(grep -i "cheevos_password*" $rootfs/etc/libretro/retroarch.cfg)
-cheevos_token=$(grep -i "cheevos_token*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_nickname=$(grep -i "netplay_nickname*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_mitm_server=$(grep -i "netplay_mitm_server*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_ip_port=$(grep -i "netplay_ip_port*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_ip_address=$(grep -i "netplay_ip_address*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_password=$(grep -i "netplay_password*" $rootfs/etc/libretro/retroarch.cfg)
-netplay_spectate_password=$(grep -i "netplay_spectate_password*" $rootfs/etc/libretro/retroarch.cfg)
-
-echo "Uninstalling old version of Hakchi RetroArch neo..."
-var=$(hakchi pack_list | grep "Hakchi_Retroarch_Neo_") && hakchi pack_uninstall $var
-echo "Uninstalled $var, Installing new version now..."
-
-transfer_default
-chmod +x $rootfs/bin/*
-chmod +x $rootfs/usr/bin/*
-mkdir -p $rootfs/etc/libretro/system
-[ -f "/newroot/usr/share/kachikachi/fds_bios.bin" ] && cp -f /newroot/usr/share/kachikachi/fds_bios.bin $rootfs/etc/libretro/system/disksys.rom
-mkdir -p $rootfs/etc/options_menu/retroarch/default_files
-copy $rootfs/etc/libretro/retroarch.cfg $rootfs/etc/options_menu/retroarch/default_files/
-copy $rootfs/etc/libretro/retroarch-core-options.cfg $rootfs/etc/options_menu/retroarch/default_files/
-loadscr_path=$rootfs/share/retroarch/assets/core_loading_screens
-for arcade_loadscr in "$loadscr_path/fbalpha2012.png" "$loadscr_path/fbalpha2012_cps1.png" "$loadscr_path/fbalpha2012_cps2.png" "$loadscr_path/fbalpha2012_cps3.png" "$loadscr_path/fbalpha2012_neogeo.png" "$loadscr_path/fb_alpha.png" "$loadscr_path/mame2003.png" "$loadscr_path/mame2003_xtreme.png" "$loadscr_path/mame2010.png" "$loadscr_path/mame2014.png"; do
-  if [ ! -e "$arcade_loadscr" ]; then
-    ln -s "${loadscr_path#/newroot}/mame2000.png" "$arcade_loadscr"
-  fi
-done
-for snes_loadscr in "$loadscr_path/snes9x2002.png" "$loadscr_path/snes9x2005.png" "$loadscr_path/snes9x2010.png"; do
-  if [ ! -e "$snes_loadscr" ]; then
-    ln -s "${loadscr_path#/newroot}/snes9x.png" "$snes_loadscr"
-  fi
-done
-[ ! -e "$loadscr_path/fceumm.png" ] && ln -s ${loadscr_path#/newroot}/nestopia.png $loadscr_path/fceumm.png
-[ ! -e "$loadscr_path/mupen64plus.png" ] && ln -s ${loadscr_path#/newroot}/glupen64.png $loadscr_path/mupen64plus.png
-[ ! -e "$loadscr_path/genesis_plus_gx.png" ] && ln -s ${loadscr_path#/newroot}/picodrive.png $loadscr_path/genesis_plus_gx.png
-
-
-echo "Reloading built in config..."
-sed -i -e 's/cheevos_username = "[^"]*"/cheevos_username = "'$cheevos_username'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/cheevos_password = "[^"]*"/cheevos_password = "'$cheevos_password'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/cheevos_token = "[^"]*"/cheevos_token = "'$cheevos_token'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/netplay_mitm_server = "[^"]*"/netplay_mitm_server = "'$netplay_mitm_server'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/netplay_ip_port = "[^"]*"/netplay_ip_port = "'$netplay_ip_port'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/netplay_ip_address = "[^"]*"/netplay_ip_address = "'$netplay_ip_address'"/g' $rootfs/etc/libretro/retroarch.cfg
-sed -i -e 's/netplay_spectate_password = "[^"]*"/netplay_spectate_password = "'$netplay_spectate_password'"/g' $rootfs/etc/libretro/retroarch.cfg
-
-if [ "$cheevos_username" == "hakchiresources" ]; then
-  sed -i -e 's/cheevos_enable = "[^"]*"/cheevos_enable = "false"/g' $rootfs/etc/libretro/retroarch.cfg
-fi
-
-
-echo "Install complete!"
-return 1
diff --git a/hakchi/readme.md b/hakchi/readme.md
deleted file mode 100644
index 180962dd62..0000000000
--- a/hakchi/readme.md
+++ /dev/null
@@ -1,49 +0,0 @@
-
-## New Release Overview video
-
-## Changelog
-
-### 1.7.3b - July 2018
-
-**Please note: NES cores are no longer bundled with RA. You will need to download them seperately**
-
-**Please note: Standalone RetroArch Saves will be located in your saves under CLV-RETROARCH** 
-
-- Huge amount of optimisation and streamlining reduced deployed package size by over half! (Complete RA now only ~5mb compared to ~12mb)
-- RA Saves and savestates fully functional and working for all cores (that support them!)
-- Launching RetroArch standalone now fully functional and working. Saves also supported. 
-- Switching roms within RetroArch standalone now supports saving.
-- Stability fixes for intensive cores (N64, PSX) reducing the risk of C8 crashing.
-- Added ability to now download and update cores directly from the RA menu via HakchiCloud!
-- Added network storage support. You can now play entire rom sets and media directly from your networked drives!
-- Playlist support now implemented. Add thousands of roms to your RetroArch GUI with boxart and thumbnails and launch the roms directly from the GUI (No GUI limit!)
-- New layout look
-- Saving mechanism reworked, better functionality and Hakchi Save Manager support.
-- Loading and shutting down of RetroArch times reduced via optimisation.
-- Fixed occasional C8 errors when launching RetroArch directly 
-- Holding R now enables bezel mode per core instead of individual games
-- Numerous bug fixes
-
-### 1.7.3a - May 2018
-
-- Built with preconfigured network and achievement support. (As soon as network connection is available, network and achievements are enabled.)
-- New RetroArch binary 1.7.3 (completely overhauled audio mixer)
-- Few RA bug fixes
-- Default GUI is now changed to XMB with the purpose of using network and achievements.
-- A few mapping issues Fixed for keyboard to gamepad
-- Saves mame config properly (dip switches, etc.)
-- Optimizations to avoid to many writes on NAND
-- Boot sequence optimised
-- Doom and Quake splash screen bug fixed.
-
-RetroArch and Retroarch Cores by libretro
-
-Hakchi RetroArch Neo main development by Swingflip, Bslenul and CompCom
-
-Hakchi by MadMonkey 
-
-Special thanks to Team Hakchi Resources, Team Shinkansen and MadMonkey
-
-https://hakchiresources.com
-
-(c) 2016-2018

From 93ac62012d0dec0a3ad60e5425a895799f90ded9 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 16:55:23 +0100
Subject: [PATCH 03/14] Cleaned up ARMV7A7

---
 Makefile.classic_armv7_a7 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index c635df8929..0413cdb45b 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -4,9 +4,9 @@
 
 # Classic Readme Variables ############
 
-CLASSIC_MODS_VER := CLASSIC_MODS_Retroarch_Neo_v1_7_5b
-CLASSIC_MODS_NAME := CLASSIC_MODS RetroArch 'Neo' v1.7.5b
-MOD_CREATOR := TheOtherGuys
+CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO
+CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised)
+MOD_CREATOR := Libretro + ClassicMods
 MOD_CATEGORY := RetroArch
 GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
 
@@ -48,10 +48,10 @@ retroarch:
 	"---" > /tmp/$(HAKCHI_DIR)/readme.md
 	cat /tmp/$(HAKCHI_DIR)/readme_COPY.md >> /tmp/$(HAKCHI_DIR)/readme.md
 	rm /tmp/$(HAKCHI_DIR)/readme_COPY.md
-	@echo "** BUILDING CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+	@echo "** COMPRESSING $(CLASSIC_MODS_VER) HMOD PACKAGE **"
 	cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" *
 	mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod .
-	@echo "** BUILT CLASSIC_MODS $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+	@echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **"
 clean:
 	rm -rf obj-unix
 	rm -f *.d

From a8cb30b9c5f91b85a18651c74163a5b4bcdcfeb5 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 17:16:15 +0100
Subject: [PATCH 04/14] Static compiling of ARMv7 CortexA7

---
 Makefile.classic_armv7_a7 | 12 +++++++++++-
 Makefile.common           |  5 +++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 0413cdb45b..eb04fde2f5 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -3,7 +3,6 @@
 # ensure the SDL2 link isn't broken...
 
 # Classic Readme Variables ############
-
 CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO
 CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised)
 MOD_CREATOR := Libretro + ClassicMods
@@ -21,6 +20,10 @@ CXX_V = arm-linux-gnueabihf-g++-8
 AS_V = arm-linux-gnueabihf-as
 CC_AS_V = arm-linux-gnueabihf-gcc-8
 
+# Libretro Defines ####################
+HAVE_CLASSIC = 1 
+
+
 all: $(TARGET)
 
 retroarch:
@@ -52,6 +55,13 @@ retroarch:
 	cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" *
 	mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod .
 	@echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+
+	#COMMODORE 64 MINI BUILD (WIP)
+
+	@echo "*********************************************************************"
+	@echo "*** Classic ARM7 Cortex A7 build and packages built successfully! ***"
+	@echo "****************** Winner, Winner, Chicken Dinner! ******************"
+	@echo "*********************************************************************"
 clean:
 	rm -rf obj-unix
 	rm -f *.d
diff --git a/Makefile.common b/Makefile.common
index 361de1abb5..67d0c6845e 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -7,8 +7,9 @@ ifeq ($(HAVE_STACK_USAGE), 1)
 CFLAGS += -fstack-usage
 endif
 
-ifeq ($(HAVE_HAKCHI), 1)
-CFLAGS += -DHAVE_HAKCHI
+ifeq ($(HAVE_CLASSIC), 1)
+  LDFLAGS += -static-libgcc -static-libstdc++
+  CFLAGS += -DHAVE_CLASSIC
 endif
 
 ifeq ($(HAVE_GL_CONTEXT),)

From 63d44c0ebcffb455cacf3f5a8aa8b6db3b4775f8 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 17:17:07 +0100
Subject: [PATCH 05/14] Added cleanup to A7A7

---
 Makefile.classic_armv7_a7 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index eb04fde2f5..3c2b540fcf 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -55,6 +55,7 @@ retroarch:
 	cd /tmp/$(HAKCHI_DIR)/; tar -czvf "$(CLASSIC_MODS_VER).hmod" *
 	mv /tmp/$(HAKCHI_DIR)/$(CLASSIC_MODS_VER).hmod .
 	@echo "** BUILT CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **"
+	rm -fr /tmp/$(HAKCHI_DIR) #clean up tmp
 
 	#COMMODORE 64 MINI BUILD (WIP)
 

From eff5914fa24258d70fc71dc5ad1ca7ea87e5aa04 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Tue, 23 Oct 2018 17:28:23 +0100
Subject: [PATCH 06/14] Forgot the new brand name lol.

---
 Makefile.classic_armv7_a7 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 3c2b540fcf..90c920fcdb 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -3,9 +3,9 @@
 # ensure the SDL2 link isn't broken...
 
 # Classic Readme Variables ############
-CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_CMO
-CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official CM Optimised)
-MOD_CREATOR := Libretro + ClassicMods
+CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_MMCO
+CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official MMC Optimised)
+MOD_CREATOR := Libretro + ModMyClassic
 MOD_CATEGORY := RetroArch
 GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
 

From 75008d0a229e78ab56e7650a0b8999c124af6be1 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 13:11:55 +0100
Subject: [PATCH 07/14] Added Optimisation for A7A7 and fixed Classic platform

---
 Makefile.classic_armv7_a7 |  7 ++++---
 Makefile.common           | 40 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 39 insertions(+), 8 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 90c920fcdb..2058163cff 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -21,8 +21,9 @@ AS_V = arm-linux-gnueabihf-as
 CC_AS_V = arm-linux-gnueabihf-gcc-8
 
 # Libretro Defines ####################
-HAVE_CLASSIC = 1 
-
+#HAVE_CLASSIC = Classic Hook, disable some features
+#HAVE_C_A7A7 = Classic Armv7 Cortex A7 optimisation override
+#HAVE_HAKCHI = Hakchi Hook, change default configurations etc (TODO)
 
 all: $(TARGET)
 
@@ -30,7 +31,7 @@ retroarch:
 	#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
 	patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
 	./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
-	make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 -j #Cook it
+	make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it
 	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
 
 	#HAKCHI BUILD (NESC, SNESC)
diff --git a/Makefile.common b/Makefile.common
index 67d0c6845e..e59dfa94e8 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -7,11 +7,6 @@ ifeq ($(HAVE_STACK_USAGE), 1)
 CFLAGS += -fstack-usage
 endif
 
-ifeq ($(HAVE_CLASSIC), 1)
-  LDFLAGS += -static-libgcc -static-libstdc++
-  CFLAGS += -DHAVE_CLASSIC
-endif
-
 ifeq ($(HAVE_GL_CONTEXT),)
    HAVE_GL_CONTEXT=0
 
@@ -1840,3 +1835,38 @@ endif
 ifeq ($(HAVE_RPILED), 1)
    OBJ += led/drivers/led_rpi.o
 endif
+
+##################################
+### Classic Platform specifics ###
+###############WIP################
+# Help at https://modmyclassic.com/comp
+
+ifeq ($(HAVE_CLASSIC), 1)
+  CFLAGS += -DHAVE_CLASSIC
+endif
+
+ifeq ($(HAVE_C_A7A7), 1)
+  C_A7A7_OPT = -Ofast \
+	-fno-lto \
+	-fdata-sections -ffunction-sections -Wl,--gc-sections \
+	-fno-stack-protector -fno-ident -fomit-frame-pointer \
+	-falign-functions=1 -falign-jumps=1 -falign-loops=1 \
+	-fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \
+	-fmerge-all-constants -fno-math-errno \
+  -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
+  CFLAGS += $(C_A7A7_OPT)
+  CXXFLAGS += $(C_A7A7_OPT)
+	ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1)
+		CFLAGS += -march=armv7-a
+	else
+		CFLAGS += -march=armv7ve
+		# If gcc is 5.0 or later
+		ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
+			LDFLAGS += -static-libgcc -static-libstdc++
+		endif
+endif
+
+ifeq ($(HAVE_HAKCHI), 1)
+  CFLAGS += -DHAVE_HAKCHI
+endif
+##################################
\ No newline at end of file

From 5da7494bfc1cfaa4cce732ace73cb238e70b456b Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 13:15:41 +0100
Subject: [PATCH 08/14] whoops

---
 Makefile.common | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile.common b/Makefile.common
index e59dfa94e8..ff6ff02411 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1864,6 +1864,7 @@ ifeq ($(HAVE_C_A7A7), 1)
 		ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1)
 			LDFLAGS += -static-libgcc -static-libstdc++
 		endif
+  endif
 endif
 
 ifeq ($(HAVE_HAKCHI), 1)

From c3bfab9285feb119af18cf9d685cebee187339b5 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 13:47:22 +0100
Subject: [PATCH 09/14] Finished up Classic Platform (hopefully)

---
 Makefile.classic_armv7_a7 | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 2058163cff..8967b4b501 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -1,10 +1,15 @@
-# Make sure you have patchelf installed (sudo apt-get install patchelf) to patch the binary for Hakchi.
-# Might not be needed for your build but it's a useful tool and for safety it should be run anyway to 
-# ensure the SDL2 link isn't broken...
+# Building Prerequisites ##############
+# arm-linux-gnueabihf-gcc-8
+# arm-linux-gnueabihf-g++-8
+# arm-linux-gnueabihf-as
+# arm-linux-gnueabihf-strip
+# patchelf
+# bc
 
 # Classic Readme Variables ############
-CLASSIC_MODS_VER := Official_Retroarch_v1_7_5b_MMCO
-CLASSIC_MODS_NAME := RetroArch v1.7.5b (Official MMC Optimised)
+CLASSIC_MODS_VER := Official_Retroarch_v1_7_5c_COptimised
+CLASSIC_MODS_NAME := RetroArch v1.7.5c (Official Classic Optimised)
+CLASSIC_VERSION := 1.7.5c (Classic Optimised)
 MOD_CREATOR := Libretro + ModMyClassic
 MOD_CATEGORY := RetroArch
 GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
@@ -28,10 +33,15 @@ CC_AS_V = arm-linux-gnueabihf-gcc-8
 all: $(TARGET)
 
 retroarch:
+	#Backup vanilla version files + ammend version
+	cp version.all version_BACKUP.all && cp version.dtd version_BACKUP.dtd
+	sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="'$(CLASSIC_VERSION)'"/g' version.all
+	sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "'$(CLASSIC_VERSION)'"/g' version.dtd
 	#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
 	patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
 	./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
 	make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it
+	arm-linux-gnueabihf-strip -v retroarch
 	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
 
 	#HAKCHI BUILD (NESC, SNESC)
@@ -59,7 +69,10 @@ retroarch:
 	rm -fr /tmp/$(HAKCHI_DIR) #clean up tmp
 
 	#COMMODORE 64 MINI BUILD (WIP)
-
+	
+	#Clean down dirty files
+	rm -f version.all version.dtd
+	mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd
 	@echo "*********************************************************************"
 	@echo "*** Classic ARM7 Cortex A7 build and packages built successfully! ***"
 	@echo "****************** Winner, Winner, Chicken Dinner! ******************"

From e83ccbafe27e729eba1320399c7cf74e08ff94d3 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 14:20:20 +0100
Subject: [PATCH 10/14] Updated version and updated clean for A7A7

---
 Makefile.classic_armv7_a7 | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 8967b4b501..9a94a26ec5 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -9,7 +9,7 @@
 # Classic Readme Variables ############
 CLASSIC_MODS_VER := Official_Retroarch_v1_7_5c_COptimised
 CLASSIC_MODS_NAME := RetroArch v1.7.5c (Official Classic Optimised)
-CLASSIC_VERSION := 1.7.5c (Classic Optimised)
+CLASSIC_VERSION := 1.7.5c \(Classic+\)
 MOD_CREATOR := Libretro + ModMyClassic
 MOD_CATEGORY := RetroArch
 GIT_COMMIT := $(shell echo "`git rev-parse --short HEAD``git diff-index --quiet HEAD -- || echo '-dirty'`")
@@ -35,11 +35,12 @@ all: $(TARGET)
 retroarch:
 	#Backup vanilla version files + ammend version
 	cp version.all version_BACKUP.all && cp version.dtd version_BACKUP.dtd
-	sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="'$(CLASSIC_VERSION)'"/g' version.all
-	sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "'$(CLASSIC_VERSION)'"/g' version.dtd
+	sed -i -e 's/RARCH_VERSION="[^"]*"/RARCH_VERSION="$(CLASSIC_VERSION)"/g' version.all
+	sed -i -e 's/PACKAGE_VERSION "[^"]*"/PACKAGE_VERSION "$(CLASSIC_VERSION)"/g' version.all
+	sed -i -e 's/ENTITY version "[^"]*"/ENTITY version "$(CLASSIC_VERSION)"/g' version.dtd
 	#Build the RetroArch Binary for cross platform classics (ARMv7 Cortex A7)
 	patchelf --version #Check if you have patchelf installed... (sudo apt-get install patchelf)
-	./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard
+	./configure --host=arm-linux-gnueabihf --enable-mali_fbdev --disable-freetype --enable-opengles --enable-udev --enable-alsa --enable-neon --enable-floathard --disable-discord
 	make CC=$(CC_V) CXX=$(CXX_V) AS=$(AS_V) CC_AS=$(CC_AS_V) LDFLAGS_SDL=-lSDL2 HAVE_CLASSIC=1 HAVE_C_A7A7=1 HAVE_HAKCHI=1 -j #Cook it
 	arm-linux-gnueabihf-strip -v retroarch
 	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
@@ -97,3 +98,6 @@ clean:
 	rm -f $(PNDDIR)/readme.html
 	rm -f retroarch
 	rm -f $(CLASSIC_MODS_VER).hmod
+	rm -f version.all version.dtd
+	mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd
+	rm -f *_BACKUP*

From a45f3a2d5949edce7ef537ee5415f76abd35e68f Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 16:30:07 +0100
Subject: [PATCH 11/14] Added MadMonkey's compression (and the fixes)

---
 libretro-common/dynamic/dylib.c | 278 +++++++++++++++++++++++++++++++-
 1 file changed, 276 insertions(+), 2 deletions(-)

diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c
index bc6be9fc40..e57ef62678 100644
--- a/libretro-common/dynamic/dylib.c
+++ b/libretro-common/dynamic/dylib.c
@@ -34,6 +34,270 @@
 #include <dlfcn.h>
 #endif
 
+#if defined(__linux__) && !defined(ANDROID)
+#define soramLoader
+#endif
+
+#ifdef soramLoader
+// stolen from here: https://x-c3ll.github.io/posts/fileless-memfd_create/
+
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/utsname.h>
+#include <unistd.h>
+#include <stdint.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <link.h>
+#include <pthread.h>
+
+#define debug_printf(...) //printf(__VA_ARGS__)
+
+typedef struct _soramHandle
+{
+   dylib_t handle;
+   char*soname;
+   int32_t ref;
+} soramHandle_t;
+
+#define VECTOR_LIST_TYPE soramHandle_t
+#define VECTOR_LIST_NAME soram
+#include <../lists/vector_list.c>
+typedef struct TYPE_NAME() soramList_t;
+#undef VECTOR_LIST_TYPE
+#undef VECTOR_LIST_NAME
+
+static soramList_t *soramList = 0;
+static pthread_mutex_t soramMutex = PTHREAD_MUTEX_INITIALIZER;
+
+static soramHandle_t*soramFindName(const char*soname)
+{
+   size_t i;
+   if (soramList == 0)
+      return 0;
+   for (i = 0; i < soramList->count; ++i)
+      if (strcmp(soname, soramList->data[i].soname) == 0)
+         return &soramList->data[i];
+   return 0;
+}
+
+static soramHandle_t*soramFindHandle(dylib_t handle)
+{
+   size_t i;
+   if (soramList == 0)
+      return 0;
+   for (i = 0; i < soramList->count; ++i)
+      if (handle == soramList->data[i].handle)
+         return &soramList->data[i];
+   return 0;
+}
+
+static void soramAdd(const char*soname,dylib_t handle)
+{
+   soramHandle_t *so, _so;
+   if (soramList == 0)
+      soramList = soram_vector_list_new();
+   so = soramFindHandle(0);
+   if (so == 0)
+      so = &_so;
+   so->handle = handle;
+   so->soname = strdup(soname);
+   so->ref = 1;
+   soram_vector_list_append(soramList, *so);
+}
+
+static bool soramRemove(dylib_t handle)
+{
+   size_t i,count;
+   soramHandle_t *so = soramFindHandle(handle);
+   if (so == 0)
+      return 0;
+   if (--so->ref > 0)
+      return 1;
+#ifndef NO_DLCLOSE
+   dlclose(so->handle);
+   free(so->soname);
+   so->handle = 0;
+   so->soname = 0;
+   count = 0;
+   for (i = 0; i < soramList->count; ++i)
+      if (soramList->data[i].ref > 0)
+         ++count;
+   if (count)
+      return 1;
+   soram_vector_list_free(soramList);
+   soramList = 0;
+#endif
+   return 1;
+}
+
+static void soramLock()
+{
+   pthread_mutex_lock(&soramMutex);
+}
+
+static void soramUnlock()
+{
+   pthread_mutex_unlock(&soramMutex);
+}
+
+// Wrapper to call memfd_create_cust syscall
+static inline int memfd_create_cust(const char *pathname, int flags)
+{
+   return syscall(319, pathname, flags);
+}
+
+// Returns a file descriptor where we can write our shared object
+static int open_ramfs(const char *bname)
+{
+   int fd = memfd_create_cust(bname, 1);
+   if (fd < 0)
+      fd = shm_open(bname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
+   return fd;
+}
+
+static int is_xz(const char *pathname)
+{
+   uint32_t buffer[2];
+   FILE*hf=fopen(pathname, "rb");
+   buffer[0] = 0;
+   if (hf)
+   {
+      if (fread(buffer, 1, 4, hf) != 4)
+      {
+         buffer[0] = 0;
+      }
+      fclose(hf);
+   }
+   return (ntohl(buffer[0]) == 0xfd377a58) ? 0 : -1;
+}
+
+static int open_xz(const char *pathname,const char *bname)
+{
+   int status = -1;
+   size_t size = 0x1000, rchunk = 0, wchunk = 0;
+   char *buffer;
+   FILE *fp;
+   int fd;
+
+   fd = open_ramfs(bname);
+   if (fd < 0)
+      return fd;
+
+   buffer = (char*)malloc(size+8);
+   if (buffer)
+   {
+      snprintf(buffer, size, "xz -cd '%s'", pathname);
+      fp = popen(buffer, "re");
+      if (fp != 0)
+      {
+         while (!feof(fp) && !ferror(fp))
+         {
+            rchunk=TEMP_FAILURE_RETRY(fread(buffer, 1, size, fp));
+            if (rchunk > 0)
+            {
+               wchunk=TEMP_FAILURE_RETRY(write(fd, buffer, rchunk));
+               if (wchunk != rchunk)
+                  break;
+            }
+         }
+         status = pclose(fp);
+      }
+
+      free(buffer);
+      if ((status == 0) && (wchunk == rchunk))
+         return fd;
+   }
+
+   close(fd);
+   return -1;
+}
+
+static int dlcallback(struct dl_phdr_info *info, size_t size, void *data)
+{
+   if (info && info->dlpi_name)
+      debug_printf("\t[+] %s\n", info->dlpi_name);
+   return 0;
+}
+
+// Load the shared object
+static dylib_t soramLoad(const char *pathname, int flag)
+{
+   char path[1024];
+   char shmp[1024];
+   void *handle;
+   ssize_t size;
+   char *dname, *bname;
+   soramHandle_t *so;
+
+   if (is_xz(pathname) < 0)
+      return 0;
+
+   dname = strdup(pathname);
+   if (dname == 0)
+      return 0;
+   bname = basename(dname);
+
+   soramLock();
+   so = soramFindName(bname);
+   if (so)
+   {
+      ++so->ref;
+      soramUnlock();
+      free(dname);
+      return so->handle;
+   }
+
+   debug_printf("[INFO] [dylib] soramLoad(%s)\n", pathname);
+   int fd = open_xz(pathname, bname);
+   if (fd < 0)
+   {
+      soramUnlock();
+      free(dname);
+      return 0;
+   }
+
+   snprintf(path, 1024, "/proc/self/fd/%d", fd);
+   handle = dlopen(path, flag);
+   size = readlink(path, shmp, 1024);
+   close(fd);
+   dl_iterate_phdr(dlcallback, 0);
+   if ((size > 9) && (memcmp(shmp, "/dev/shm/", 9) == 0))
+   {
+      debug_printf("\t\tshm_unlink(%s) - ", bname);
+      errno = 0;
+      flag = shm_unlink(bname);
+      debug_printf("%d\n", errno);
+      if (flag < 0)
+      {
+         debug_printf("\t\t unlink(%s) - ", shmp);
+         errno = 0;
+         unlink(shmp);
+         debug_printf("%d\n", errno);
+      }
+   }
+   soramAdd(bname, handle);
+   soramUnlock();
+   free(dname);
+   debug_printf("[INFO] [dylib] soramLoad(%s) - %s\n", pathname, handle?"ok":"fail");
+   return handle;
+}
+
+static bool soramUnload(dylib_t handle)
+{
+   bool ret;
+   soramLock();
+   ret = soramRemove(handle);
+   soramUnlock();
+   return ret;
+}
+#endif //soramLoader
+
 /* Assume W-functions do not work below Win2K and Xbox platforms */
 #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX)
 
@@ -93,7 +357,12 @@ dylib_t dylib_load(const char *path)
    }
    last_dyn_error[0] = 0;
 #else
-   dylib_t lib = dlopen(path, RTLD_LAZY);
+   dylib_t lib;
+#ifdef soramLoader
+   lib = soramLoad(path, RTLD_LAZY);
+   if (!lib)
+#endif
+   lib = dlopen(path, RTLD_LAZY);
 #endif
    return lib;
 }
@@ -158,8 +427,13 @@ void dylib_close(dylib_t lib)
       set_dl_error();
    last_dyn_error[0] = 0;
 #else
+#ifdef soramLoader
+   if (soramUnload(lib) == 0)
+#endif
 #ifndef NO_DLCLOSE
-   dlclose(lib);
+      dlclose(lib);
+#else
+      ;
 #endif
 #endif
 }

From 2a4f42aba0f673904a8cbe09bfec9399160150aa Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 16:45:15 +0100
Subject: [PATCH 12/14] Updated wording included link to support page
 incase/when help is required.

---
 Makefile.classic_armv7_a7 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 9a94a26ec5..599c7cb8c2 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -1,3 +1,8 @@
+# This build was put together and is maintained by ModMyClassic.com for Libretro.
+# The purpose is to have Libretro have a proper official build platform for classic consoles.
+# If you need any help in building for the classics or have any questions then please visit
+# https://modmyclassic.com/comp and we will help in any way possible! 
+
 # Building Prerequisites ##############
 # arm-linux-gnueabihf-gcc-8
 # arm-linux-gnueabihf-g++-8
@@ -46,6 +51,7 @@ retroarch:
 	patchelf --replace-needed libSDL2-2.0.so.0 libSDL2.so retroarch #libSDL2-2.0.so.0 sym link doesn't exist on native build. Just patch the binary...
 
 	#HAKCHI BUILD (NESC, SNESC)
+	#FYI this build was originally known as RetroArch 'Neo' for Hakchi.
 	@echo "** BUILDING CLASSIC_MODS HAKCHI - $(CLASSIC_MODS_VER) HMOD PACKAGE **"
 	rm -fr /tmp/$(HAKCHI_DIR)
 	cd /tmp/; git clone $(HAKCHI_GIT)
@@ -99,5 +105,6 @@ clean:
 	rm -f retroarch
 	rm -f $(CLASSIC_MODS_VER).hmod
 	rm -f version.all version.dtd
-	mv version_BACKUP.all version.all && mv version_BACKUP.dtd version.dtd
+    mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..."
+    mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..."
 	rm -f *_BACKUP*

From cff8c7741cfe1092edfa876ec891b3b33c5a5bfc Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 16:47:46 +0100
Subject: [PATCH 13/14] Fixed tabbing and grammar on Makefile for A7A7

---
 Makefile.classic_armv7_a7 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Makefile.classic_armv7_a7 b/Makefile.classic_armv7_a7
index 599c7cb8c2..34dc715cb5 100644
--- a/Makefile.classic_armv7_a7
+++ b/Makefile.classic_armv7_a7
@@ -1,5 +1,5 @@
 # This build was put together and is maintained by ModMyClassic.com for Libretro.
-# The purpose is to have Libretro have a proper official build platform for classic consoles.
+# The purpose is to give Libretro a proper "official" build platform for classic consoles.
 # If you need any help in building for the classics or have any questions then please visit
 # https://modmyclassic.com/comp and we will help in any way possible! 
 
@@ -105,6 +105,6 @@ clean:
 	rm -f retroarch
 	rm -f $(CLASSIC_MODS_VER).hmod
 	rm -f version.all version.dtd
-    mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..."
-    mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..."
+	mv -f version_BACKUP.all version.all || echo "Backup Doesn't Exist - Ignoring..."
+	mv -f version_BACKUP.dtd version.dtd || echo "Backup Doesn't Exist - Ignoring..."
 	rm -f *_BACKUP*

From 4a4d7f5e2f7c3a03faf8cef8a099b4c5fa2fa883 Mon Sep 17 00:00:00 2001
From: Ryan 'Swingflip' Hamlin <ryan@ryanhamlin.co.uk>
Date: Thu, 25 Oct 2018 18:48:10 +0100
Subject: [PATCH 14/14] Revert MM dynamic code for seperate PR and rework

---
 libretro-common/dynamic/dylib.c | 278 +-------------------------------
 1 file changed, 2 insertions(+), 276 deletions(-)

diff --git a/libretro-common/dynamic/dylib.c b/libretro-common/dynamic/dylib.c
index e57ef62678..bc6be9fc40 100644
--- a/libretro-common/dynamic/dylib.c
+++ b/libretro-common/dynamic/dylib.c
@@ -34,270 +34,6 @@
 #include <dlfcn.h>
 #endif
 
-#if defined(__linux__) && !defined(ANDROID)
-#define soramLoader
-#endif
-
-#ifdef soramLoader
-// stolen from here: https://x-c3ll.github.io/posts/fileless-memfd_create/
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <sys/syscall.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <link.h>
-#include <pthread.h>
-
-#define debug_printf(...) //printf(__VA_ARGS__)
-
-typedef struct _soramHandle
-{
-   dylib_t handle;
-   char*soname;
-   int32_t ref;
-} soramHandle_t;
-
-#define VECTOR_LIST_TYPE soramHandle_t
-#define VECTOR_LIST_NAME soram
-#include <../lists/vector_list.c>
-typedef struct TYPE_NAME() soramList_t;
-#undef VECTOR_LIST_TYPE
-#undef VECTOR_LIST_NAME
-
-static soramList_t *soramList = 0;
-static pthread_mutex_t soramMutex = PTHREAD_MUTEX_INITIALIZER;
-
-static soramHandle_t*soramFindName(const char*soname)
-{
-   size_t i;
-   if (soramList == 0)
-      return 0;
-   for (i = 0; i < soramList->count; ++i)
-      if (strcmp(soname, soramList->data[i].soname) == 0)
-         return &soramList->data[i];
-   return 0;
-}
-
-static soramHandle_t*soramFindHandle(dylib_t handle)
-{
-   size_t i;
-   if (soramList == 0)
-      return 0;
-   for (i = 0; i < soramList->count; ++i)
-      if (handle == soramList->data[i].handle)
-         return &soramList->data[i];
-   return 0;
-}
-
-static void soramAdd(const char*soname,dylib_t handle)
-{
-   soramHandle_t *so, _so;
-   if (soramList == 0)
-      soramList = soram_vector_list_new();
-   so = soramFindHandle(0);
-   if (so == 0)
-      so = &_so;
-   so->handle = handle;
-   so->soname = strdup(soname);
-   so->ref = 1;
-   soram_vector_list_append(soramList, *so);
-}
-
-static bool soramRemove(dylib_t handle)
-{
-   size_t i,count;
-   soramHandle_t *so = soramFindHandle(handle);
-   if (so == 0)
-      return 0;
-   if (--so->ref > 0)
-      return 1;
-#ifndef NO_DLCLOSE
-   dlclose(so->handle);
-   free(so->soname);
-   so->handle = 0;
-   so->soname = 0;
-   count = 0;
-   for (i = 0; i < soramList->count; ++i)
-      if (soramList->data[i].ref > 0)
-         ++count;
-   if (count)
-      return 1;
-   soram_vector_list_free(soramList);
-   soramList = 0;
-#endif
-   return 1;
-}
-
-static void soramLock()
-{
-   pthread_mutex_lock(&soramMutex);
-}
-
-static void soramUnlock()
-{
-   pthread_mutex_unlock(&soramMutex);
-}
-
-// Wrapper to call memfd_create_cust syscall
-static inline int memfd_create_cust(const char *pathname, int flags)
-{
-   return syscall(319, pathname, flags);
-}
-
-// Returns a file descriptor where we can write our shared object
-static int open_ramfs(const char *bname)
-{
-   int fd = memfd_create_cust(bname, 1);
-   if (fd < 0)
-      fd = shm_open(bname, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
-   return fd;
-}
-
-static int is_xz(const char *pathname)
-{
-   uint32_t buffer[2];
-   FILE*hf=fopen(pathname, "rb");
-   buffer[0] = 0;
-   if (hf)
-   {
-      if (fread(buffer, 1, 4, hf) != 4)
-      {
-         buffer[0] = 0;
-      }
-      fclose(hf);
-   }
-   return (ntohl(buffer[0]) == 0xfd377a58) ? 0 : -1;
-}
-
-static int open_xz(const char *pathname,const char *bname)
-{
-   int status = -1;
-   size_t size = 0x1000, rchunk = 0, wchunk = 0;
-   char *buffer;
-   FILE *fp;
-   int fd;
-
-   fd = open_ramfs(bname);
-   if (fd < 0)
-      return fd;
-
-   buffer = (char*)malloc(size+8);
-   if (buffer)
-   {
-      snprintf(buffer, size, "xz -cd '%s'", pathname);
-      fp = popen(buffer, "re");
-      if (fp != 0)
-      {
-         while (!feof(fp) && !ferror(fp))
-         {
-            rchunk=TEMP_FAILURE_RETRY(fread(buffer, 1, size, fp));
-            if (rchunk > 0)
-            {
-               wchunk=TEMP_FAILURE_RETRY(write(fd, buffer, rchunk));
-               if (wchunk != rchunk)
-                  break;
-            }
-         }
-         status = pclose(fp);
-      }
-
-      free(buffer);
-      if ((status == 0) && (wchunk == rchunk))
-         return fd;
-   }
-
-   close(fd);
-   return -1;
-}
-
-static int dlcallback(struct dl_phdr_info *info, size_t size, void *data)
-{
-   if (info && info->dlpi_name)
-      debug_printf("\t[+] %s\n", info->dlpi_name);
-   return 0;
-}
-
-// Load the shared object
-static dylib_t soramLoad(const char *pathname, int flag)
-{
-   char path[1024];
-   char shmp[1024];
-   void *handle;
-   ssize_t size;
-   char *dname, *bname;
-   soramHandle_t *so;
-
-   if (is_xz(pathname) < 0)
-      return 0;
-
-   dname = strdup(pathname);
-   if (dname == 0)
-      return 0;
-   bname = basename(dname);
-
-   soramLock();
-   so = soramFindName(bname);
-   if (so)
-   {
-      ++so->ref;
-      soramUnlock();
-      free(dname);
-      return so->handle;
-   }
-
-   debug_printf("[INFO] [dylib] soramLoad(%s)\n", pathname);
-   int fd = open_xz(pathname, bname);
-   if (fd < 0)
-   {
-      soramUnlock();
-      free(dname);
-      return 0;
-   }
-
-   snprintf(path, 1024, "/proc/self/fd/%d", fd);
-   handle = dlopen(path, flag);
-   size = readlink(path, shmp, 1024);
-   close(fd);
-   dl_iterate_phdr(dlcallback, 0);
-   if ((size > 9) && (memcmp(shmp, "/dev/shm/", 9) == 0))
-   {
-      debug_printf("\t\tshm_unlink(%s) - ", bname);
-      errno = 0;
-      flag = shm_unlink(bname);
-      debug_printf("%d\n", errno);
-      if (flag < 0)
-      {
-         debug_printf("\t\t unlink(%s) - ", shmp);
-         errno = 0;
-         unlink(shmp);
-         debug_printf("%d\n", errno);
-      }
-   }
-   soramAdd(bname, handle);
-   soramUnlock();
-   free(dname);
-   debug_printf("[INFO] [dylib] soramLoad(%s) - %s\n", pathname, handle?"ok":"fail");
-   return handle;
-}
-
-static bool soramUnload(dylib_t handle)
-{
-   bool ret;
-   soramLock();
-   ret = soramRemove(handle);
-   soramUnlock();
-   return ret;
-}
-#endif //soramLoader
-
 /* Assume W-functions do not work below Win2K and Xbox platforms */
 #if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0500 || defined(_XBOX)
 
@@ -357,12 +93,7 @@ dylib_t dylib_load(const char *path)
    }
    last_dyn_error[0] = 0;
 #else
-   dylib_t lib;
-#ifdef soramLoader
-   lib = soramLoad(path, RTLD_LAZY);
-   if (!lib)
-#endif
-   lib = dlopen(path, RTLD_LAZY);
+   dylib_t lib = dlopen(path, RTLD_LAZY);
 #endif
    return lib;
 }
@@ -427,13 +158,8 @@ void dylib_close(dylib_t lib)
       set_dl_error();
    last_dyn_error[0] = 0;
 #else
-#ifdef soramLoader
-   if (soramUnload(lib) == 0)
-#endif
 #ifndef NO_DLCLOSE
-      dlclose(lib);
-#else
-      ;
+   dlclose(lib);
 #endif
 #endif
 }