And here is the continuation of the previous article to give a youthful boost to my Acer Iconia A500.
RetroArch was the second program on my list for use with the tablet; let’s see what we can do with it.
RetroArch is a multi-emulator (if you allow me the neologism) which allows to download numerous “cores” allowing to emulate many consoles or computers. There are therefore 2 main components:
- The interface
- The cores of different emulators The interface was a pleasant surprise, it works directly on the tablet. It suffices to download the 32 bits apk from retroarch’s site. However unpleasant surprise: the cores crash when launched after downloading them through the interface.
Compiling a retroarch core
The instructions to recompile an android core indicate how to start by downloading the source code:
git clone https://github.com/libretro/libretro-super.git cd libretro-super ./libretro-fetch.sh
These commands download the main source code files and then those for various emulation cores.
The sources generally have a similar structure, containing a subdirectory
libretro-<nameOfCore> which itself contains (possibly within a subdirectory hierarchy) a
libretro-build-android-mk.sh script allows launching the compilation of a core, for example, to recompile the Game Boy core
gambatte (Note that you must have properly defined the paths for the Android SDK and NDK, as these are my environment paths) :
export ANDROID_NDK_ROOT=/Users/gerben/Library/Android/sdk/ndk/21.3.6528147 export ANDROID_SDK_ROOT=/Users/gerben/Library/Android/sdk export PATH=$ANDROID_NDK_ROOT:$PATH ./libretro-build-android-mk.sh gambatte
However, if you try to use the compiled core (found in the path
libretro-gambatte/libgambatte/libretro/libs/armeabi-v7a/libretro.so) on your tablet, even worse : an immediate crash.
Disabling NEON instructions
As in the previous article, the problem lies within the specificities of the Cortex A9 core found on Tegra 2 devices and the use of NEON instructions. These instructions being enabled by default for NDK builds, you need to add configuration instructions to disable them.
In the case of the gambatte core (but it’s similar for other cores), you need to modify the file
Android.mk located in the subdirectory
libretro-gambatte/libgambatte/libretro/jni) and add among the variables
LOCAL_ARM_NEON := false, which results in:
CAL_PATH := $(call my-dir) ROOT_DIR := $(LOCAL_PATH)/../../.. CORE_DIR := $(ROOT_DIR)/libgambatte/src LIBRETRO_DIR := $(ROOT_DIR)/libgambatte/libretro HAVE_NETWORK := 1 include $(ROOT_DIR)/Makefile.common COREFLAGS := -DINLINE=inline -DHAVE_STDINT_H -DHAVE_INTTYPES_H -D__LIBRETRO__ -DVIDEO_RGB565 -Wno-c++11-narrowing ifeq ($(HAVE_NETWORK),1) COREFLAGS += -DHAVE_NETWORK endif include $(CLEAR_VARS) LOCAL_MODULE := retro LOCAL_SRC_FILES := $(SOURCES_CXX) $(SOURCES_C) LOCAL_CXXFLAGS := $(COREFLAGS) $(INCFLAGS) LOCAL_CFLAGS := $(INCFLAGS) LOCAL_LDFLAGS := -Wl,-version-script=$(LIBRETRO_DIR)/link.T LOCAL_ARM_NEON := false include $(BUILD_SHARED_LIBRARY)
(Note the last line containing the modification)
And if everything went well, you now have a new core to install within your RetroArch (in the interface:
Load Core > Install or Restore a Core, enjoy 😊)