From d171c831c320469e9cca90fbda0f7c3057c992a9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 2 Dec 2015 06:28:46 +0100 Subject: [PATCH] (Android) Remove apk-extract --- pkg/android/phoenix/jni/Android.mk | 16 ---- pkg/android/phoenix/jni/Android2.mk | 15 ---- .../phoenix/jni/apk-extract/apk-extract.c | 78 ------------------- .../com_retroarch_browser_NativeInterface.h | 21 ----- .../retroarch/browser/NativeInterface.java | 20 ----- .../browser/mainmenu/MainMenuFragment.java | 1 - 6 files changed, 151 deletions(-) delete mode 100644 pkg/android/phoenix/jni/apk-extract/apk-extract.c delete mode 100644 pkg/android/phoenix/jni/native/com_retroarch_browser_NativeInterface.h delete mode 100644 pkg/android/phoenix/src/com/retroarch/browser/NativeInterface.java diff --git a/pkg/android/phoenix/jni/Android.mk b/pkg/android/phoenix/jni/Android.mk index ad1943cbb1..a220ce9545 100644 --- a/pkg/android/phoenix/jni/Android.mk +++ b/pkg/android/phoenix/jni/Android.mk @@ -1,23 +1,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := retroarch-jni RARCH_DIR := ../../../.. -LOCAL_CFLAGS += -std=gnu99 -Wall -DRARCH_DUMMY_LOG -DHAVE_ZLIB -DHAVE_MMAP -DRARCH_INTERNAL -LOCAL_LDLIBS := -llog -lz -LOCAL_SRC_FILES := apk-extract/apk-extract.c \ - $(RARCH_DIR)/libretro-common/file/file_extract.c \ - $(RARCH_DIR)/libretro-common/file/file_path.c \ - $(RARCH_DIR)/file_ops.c \ - $(RARCH_DIR)/libretro-common/string/string_list.c \ - $(RARCH_DIR)/libretro-common/compat/compat_strl.c \ - $(RARCH_DIR)/libretro-common/file/retro_file.c \ - $(RARCH_DIR)/libretro-common/file/retro_stat.c \ - $(RARCH_DIR)/verbosity.c - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(RARCH_DIR)/libretro-common/include/ - -include $(BUILD_SHARED_LIBRARY) HAVE_NEON := 1 HAVE_LOGGER := 0 diff --git a/pkg/android/phoenix/jni/Android2.mk b/pkg/android/phoenix/jni/Android2.mk index 9e97206c1a..82de5b45f1 100644 --- a/pkg/android/phoenix/jni/Android2.mk +++ b/pkg/android/phoenix/jni/Android2.mk @@ -1,22 +1,7 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := retroarch-jni RARCH_DIR := ../../../.. -LOCAL_CFLAGS += -std=gnu99 -Wall -DRARCH_DUMMY_LOG -DHAVE_ZLIB -DHAVE_MMAP -DRARCH_INTERNAL -LOCAL_LDLIBS := -llog -lz -LOCAL_SRC_FILES := apk-extract/apk-extract.c \ - $(RARCH_DIR)/libretro-common/file/file_extract.c \ - $(RARCH_DIR)/libretro-common/file/file_path.c \ - $(RARCH_DIR)/file_ops.c \ - $(RARCH_DIR)/libretro-common/string/string_list.c \ - $(RARCH_DIR)/libretro-common/compat/compat_strl.c \ - $(RARCH_DIR)/libretro-common/file/retro_file.c \ - $(RARCH_DIR)/libretro-common/file/retro_stat.c - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/$(RARCH_DIR)/libretro-common/include/ - -include $(BUILD_SHARED_LIBRARY) HAVE_NEON := 1 HAVE_LOGGER := 0 diff --git a/pkg/android/phoenix/jni/apk-extract/apk-extract.c b/pkg/android/phoenix/jni/apk-extract/apk-extract.c deleted file mode 100644 index ef49aff309..0000000000 --- a/pkg/android/phoenix/jni/apk-extract/apk-extract.c +++ /dev/null @@ -1,78 +0,0 @@ - -#include -#include - -#include -#include -#include -#include -#include - -#include "../native/com_retroarch_browser_NativeInterface.h" - -struct userdata -{ - const char *subdir; - const char *dest; -}; - -static int zlib_cb(const char *name, const char *valid_exts, - const uint8_t *cdata, - unsigned cmode, uint32_t csize, uint32_t size, - uint32_t crc32, void *userdata) -{ - char path[PATH_MAX]; - char path_dir[PATH_MAX]; - struct userdata *user = userdata; - const char *subdir = user->subdir; - const char *dest = user->dest; - - if (strstr(name, subdir) != name) - return 1; - - name += strlen(subdir) + 1; - - fill_pathname_join(path, dest, name, sizeof(path)); - fill_pathname_basedir(path_dir, path, sizeof(path_dir)); - - if (!path_mkdir(path_dir)) - goto error; - - printf("Extracting %s -> %s ...\n", name, path); - - if (!zlib_perform_mode(path, valid_exts, - cdata, cmode, csize, size, crc32, userdata)) - goto error; - - return 1; - -error: - printf("Failed to deflate to: %s.\n", path); - return 0; -} - -JNIEXPORT jboolean JNICALL Java_com_retroarch_browser_NativeInterface_extractArchiveTo( - JNIEnv *env, jclass cls, jstring archive, jstring subdir, jstring dest) -{ - const char *archive_c = (*env)->GetStringUTFChars(env, archive, NULL); - const char *subdir_c = (*env)->GetStringUTFChars(env, subdir, NULL); - const char *dest_c = (*env)->GetStringUTFChars(env, dest, NULL); - - jboolean ret = JNI_TRUE; - - struct userdata data = { - .subdir = subdir_c, - .dest = dest_c, - }; - - if (!zlib_parse_file(archive_c, NULL, zlib_cb, &data)) - { - printf("Failed to parse APK: %s.\n", archive_c); - ret = JNI_FALSE; - } - - (*env)->ReleaseStringUTFChars(env, archive, archive_c); - (*env)->ReleaseStringUTFChars(env, subdir, subdir_c); - (*env)->ReleaseStringUTFChars(env, dest, dest_c); - return ret; -} diff --git a/pkg/android/phoenix/jni/native/com_retroarch_browser_NativeInterface.h b/pkg/android/phoenix/jni/native/com_retroarch_browser_NativeInterface.h deleted file mode 100644 index 088fc939bc..0000000000 --- a/pkg/android/phoenix/jni/native/com_retroarch_browser_NativeInterface.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class com_retroarch_browser_NativeInterface */ - -#ifndef _Included_com_retroarch_browser_NativeInterface -#define _Included_com_retroarch_browser_NativeInterface -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: com_retroarch_browser_NativeInterface - * Method: extractArchiveTo - * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z - */ -JNIEXPORT jboolean JNICALL Java_com_retroarch_browser_NativeInterface_extractArchiveTo - (JNIEnv *, jclass, jstring, jstring, jstring); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/pkg/android/phoenix/src/com/retroarch/browser/NativeInterface.java b/pkg/android/phoenix/src/com/retroarch/browser/NativeInterface.java deleted file mode 100644 index f266eadca1..0000000000 --- a/pkg/android/phoenix/src/com/retroarch/browser/NativeInterface.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.retroarch.browser; - -/** - * Helper class which calls into JNI for various tasks. - */ -public final class NativeInterface -{ - static - { - System.loadLibrary("retroarch-jni"); - } - - // Disallow explicit instantiation. - private NativeInterface() - { - } - - public static native boolean extractArchiveTo(String archive, - String subDirectory, String destinationFolder); -} diff --git a/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuFragment.java b/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuFragment.java index 1a184abecb..d5ec682a1c 100644 --- a/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuFragment.java +++ b/pkg/android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuFragment.java @@ -25,7 +25,6 @@ import android.os.Environment; import android.content.Context; import com.retroarch.R; -import com.retroarch.browser.NativeInterface; import com.retroarch.browser.preferences.fragments.util.PreferenceListFragment; import com.retroarch.browser.preferences.util.UserPreferences; import com.retroarch.browser.retroactivity.RetroActivityFuture;