From a794b0c72c7f4d1a3c69a0f963c9abeaf387513b Mon Sep 17 00:00:00 2001 From: Ankush Dutt Date: Thu, 10 Aug 2023 02:53:50 +0530 Subject: [PATCH] DLC: Remove Playstore code --- backends/dlc/android/playstore.cpp | 55 ----------------- backends/dlc/android/playstore.h | 60 ------------------- backends/dlc/scummvmcloud.h | 12 ---- backends/dlc/store.h | 12 ---- backends/module.mk | 4 -- backends/platform/android/android.cpp | 12 ---- backends/platform/android/jni-android.cpp | 21 ------- backends/platform/android/jni-android.h | 3 - .../android/org/scummvm/scummvm/ScummVM.java | 3 - .../org/scummvm/scummvm/ScummVMActivity.java | 8 --- dists/android/build.gradle | 1 - 11 files changed, 191 deletions(-) delete mode 100644 backends/dlc/android/playstore.cpp delete mode 100644 backends/dlc/android/playstore.h diff --git a/backends/dlc/android/playstore.cpp b/backends/dlc/android/playstore.cpp deleted file mode 100644 index 8a4cd7644b01..000000000000 --- a/backends/dlc/android/playstore.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#if defined(__ANDROID__) - -#include "backends/dlc/android/playstore.h" - -namespace DLC { -namespace PlayStore { - -PlayStore::PlayStore() { - _playStoreObject = JNI::getPlayStoreDLCManager(); -} - -void PlayStore::init() { - -} - -void PlayStore::requestInfo() { - JNIEnv *env = JNI::getEnv(); - jclass playStoreClass = env->GetObjectClass(_playStoreObject); - - jmethodID getPackLocationMethod = env->GetMethodID(playStoreClass, "getPackLocation", "(Ljava/lang/String;)Lcom/google/android/play/core/assetpacks/AssetPackLocation;"); - - jstring packName = env->NewStringUTF("beneath_a_steel_sky"); - jobject packLocationObject = env->CallObjectMethod(_playStoreObject, getPackLocationMethod, packName); - - env->DeleteLocalRef(packName); - env->DeleteLocalRef(packLocationObject); - - // TODO: return a string/struct for the location and add a function parameter i.e. packName -} - -} // End of namespace PlayStore -} // End of namespace DLC - -#endif diff --git a/backends/dlc/android/playstore.h b/backends/dlc/android/playstore.h deleted file mode 100644 index a800a3450f1a..000000000000 --- a/backends/dlc/android/playstore.h +++ /dev/null @@ -1,60 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#if defined(__ANDROID__) - -#ifndef BACKENDS_DLC_PLAYSTORE_PLAYSTORE_H -#define BACKENDS_DLC_PLAYSTORE_PLAYSTORE_H - -#include "backends/dlc/store.h" -#include "backends/platform/android/jni-android.h" - -namespace DLC { -namespace PlayStore { - -class PlayStore: public DLC::Store { - -public: - PlayStore(); - virtual ~PlayStore() {} - - virtual void init() override; - - virtual void requestInfo() override; - - virtual void getDownloadState() override {} - - virtual void requestDownload() override {} - - virtual void getBytesDownloaded() override {} - - virtual void cancelDownload() override {} - -private: - jobject _playStoreObject; - -}; - -} // End of namespace PlayStore -} // End of namespace DLC - -#endif -#endif diff --git a/backends/dlc/scummvmcloud.h b/backends/dlc/scummvmcloud.h index f15da9dd6638..f7dd28c1e10e 100644 --- a/backends/dlc/scummvmcloud.h +++ b/backends/dlc/scummvmcloud.h @@ -43,18 +43,6 @@ class ScummVMCloud : public DLC::Store { ScummVMCloud() {} virtual ~ScummVMCloud() {} - virtual void init() override {} - - virtual void requestInfo() override {} - - virtual void getDownloadState() override {} - - virtual void requestDownload() override {} - - virtual void getBytesDownloaded() override {} - - virtual void cancelDownload() override {} - virtual void getAllDLCs() override; virtual void startDownloadAsync(const Common::String &id, const Common::String &url) override; diff --git a/backends/dlc/store.h b/backends/dlc/store.h index 610db92b944a..a12b360a4e9e 100644 --- a/backends/dlc/store.h +++ b/backends/dlc/store.h @@ -35,18 +35,6 @@ class Store { Store() {} virtual ~Store() {} - virtual void init() = 0; - - virtual void requestInfo() = 0; - - virtual void getDownloadState() = 0; - - virtual void requestDownload() = 0; - - virtual void getBytesDownloaded() = 0; - - virtual void cancelDownload() = 0; - virtual void getAllDLCs() = 0; virtual void startDownloadAsync(const Common::String &id, const Common::String &url) = 0; diff --git a/backends/module.mk b/backends/module.mk index cc3b202865ce..6b2367e4a662 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -77,10 +77,6 @@ endif ifdef USE_DLC MODULE_OBJS += \ dlc/dlcmanager.o -ifeq ($(BACKEND),android) -MODULE_OBJS += \ - dlc/android/playstore.o -endif endif ifdef USE_LIBCURL diff --git a/backends/platform/android/android.cpp b/backends/platform/android/android.cpp index 7764a33e32ff..4fd7c1a031e4 100644 --- a/backends/platform/android/android.cpp +++ b/backends/platform/android/android.cpp @@ -72,8 +72,6 @@ #include "backends/keymapper/keymapper-defaults.h" #include "backends/keymapper/standard-actions.h" -#include "backends/dlc/android/playstore.h" - #include "common/util.h" #include "common/textconsole.h" #include "common/rect.h" @@ -219,10 +217,6 @@ OSystem_Android::OSystem_Android(int audio_sample_rate, int audio_buffer_size) : fsFactory.initSAF(); } _fsFactory = &fsFactory; - -#if defined(USE_DLC) - _dlcStore = new DLC::PlayStore::PlayStore(); -#endif } OSystem_Android::~OSystem_Android() { @@ -257,9 +251,6 @@ OSystem_Android::~OSystem_Android() { delete _logger; _logger = nullptr; - - delete _dlcStore; - _dlcStore = nullptr; } void *OSystem_Android::timerThreadFunc(void *arg) { @@ -641,9 +632,6 @@ bool OSystem_Android::hasFeature(Feature f) { f == kFeatureJoystickDeadzone) { return true; } -#if defined(USE_DLC) - if (f == kFeatureDLC) return true; -#endif /* Even if we are using the 2D graphics manager, * we are at one initGraphics3d call of supporting GLES2 */ if (f == kFeatureOpenGLForGame) return true; diff --git a/backends/platform/android/jni-android.cpp b/backends/platform/android/jni-android.cpp index 1778ca5db2a5..7b8120d7a372 100644 --- a/backends/platform/android/jni-android.cpp +++ b/backends/platform/android/jni-android.cpp @@ -107,8 +107,6 @@ jmethodID JNI::_MID_getNewSAFTree = 0; jmethodID JNI::_MID_getSAFTrees = 0; jmethodID JNI::_MID_findSAFTree = 0; -jmethodID JNI::_MID_getPlayStoreDLCManager = 0; - jmethodID JNI::_MID_EGL10_eglSwapBuffers = 0; jmethodID JNI::_MID_AudioTrack_flush = 0; @@ -802,8 +800,6 @@ void JNI::create(JNIEnv *env, jobject self, jobject asset_manager, FIND_METHOD(, getSAFTrees, "()[Lorg/scummvm/scummvm/SAFFSTree;"); FIND_METHOD(, findSAFTree, "(Ljava/lang/String;)Lorg/scummvm/scummvm/SAFFSTree;"); - FIND_METHOD(, getPlayStoreDLCManager, "()Lcom/google/android/play/core/assetpacks/AssetPackManager;"); - _jobj_egl = env->NewGlobalRef(egl); _jobj_egl_display = env->NewGlobalRef(egl_display); _egl_version = 0; @@ -1153,21 +1149,4 @@ jobject JNI::findSAFTree(const Common::String &name) { return tree; } -jobject JNI::getPlayStoreDLCManager() { - JNIEnv *env = JNI::getEnv(); - - jobject store = env->CallObjectMethod(_jobj, _MID_getPlayStoreDLCManager); - - if (env->ExceptionCheck()) { - LOGE("getPlayStoreDLCManager: error"); - - env->ExceptionDescribe(); - env->ExceptionClear(); - - return nullptr; - } - - return store; -} - #endif diff --git a/backends/platform/android/jni-android.h b/backends/platform/android/jni-android.h index 6127990be558..3f21dbeba7a8 100644 --- a/backends/platform/android/jni-android.h +++ b/backends/platform/android/jni-android.h @@ -119,7 +119,6 @@ class JNI { static jobject getNewSAFTree(bool folder, bool writable, const Common::String &initURI, const Common::String &prompt); static Common::Array getSAFTrees(); static jobject findSAFTree(const Common::String &name); - static jobject getPlayStoreDLCManager(); private: static pthread_key_t _env_tls; @@ -165,8 +164,6 @@ class JNI { static jmethodID _MID_getSAFTrees; static jmethodID _MID_findSAFTree; - static jmethodID _MID_getPlayStoreDLCManager; - static jmethodID _MID_EGL10_eglSwapBuffers; static jmethodID _MID_AudioTrack_flush; diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVM.java b/backends/platform/android/org/scummvm/scummvm/ScummVM.java index 37a3e0d091dd..7e29a1a55d43 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVM.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVM.java @@ -12,8 +12,6 @@ import android.util.Log; import android.view.SurfaceHolder; -import com.google.android.play.core.assetpacks.AssetPackManager; - import java.util.LinkedHashMap; import java.util.Locale; import java.util.Scanner; @@ -92,7 +90,6 @@ final public native void pushEvent(int type, int arg1, int arg2, int arg3, abstract protected SAFFSTree getNewSAFTree(boolean folder, boolean write, String initialURI, String prompt); abstract protected SAFFSTree[] getSAFTrees(); abstract protected SAFFSTree findSAFTree(String name); - abstract protected AssetPackManager getPlayStoreDLCManager(); public ScummVM(AssetManager asset_manager, SurfaceHolder holder, final MyScummVMDestroyedCallback scummVMDestroyedCallback) { _asset_manager = asset_manager; diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java index 1e74c24c6940..85d56a421dd0 100644 --- a/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java +++ b/backends/platform/android/org/scummvm/scummvm/ScummVMActivity.java @@ -48,9 +48,6 @@ import androidx.annotation.NonNull; import androidx.annotation.RequiresApi; -import com.google.android.play.core.assetpacks.AssetPackManager; -import com.google.android.play.core.assetpacks.AssetPackManagerFactory; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -880,11 +877,6 @@ protected SAFFSTree[] getSAFTrees() { protected SAFFSTree findSAFTree(String name) { return SAFFSTree.findTree(ScummVMActivity.this, name); } - - @Override - protected AssetPackManager getPlayStoreDLCManager() { - return AssetPackManagerFactory.getInstance(getApplicationContext()); - } } private MyScummVM _scummvm; diff --git a/dists/android/build.gradle b/dists/android/build.gradle index daef8e9b70a3..230004802874 100644 --- a/dists/android/build.gradle +++ b/dists/android/build.gradle @@ -108,5 +108,4 @@ android { dependencies { implementation "androidx.annotation:annotation:1.5.0" implementation "androidx.appcompat:appcompat:1.6.1" - implementation "com.google.android.play:asset-delivery:2.1.0" }