From c3583ade01ae3c76677bf97a0d683219cafa3f67 Mon Sep 17 00:00:00 2001 From: xawotihs Date: Fri, 17 Jan 2014 23:25:48 +0100 Subject: [PATCH] Updated resource name and URL for android project --- JGE/src/SDLmain.cpp | 14 +++++++++++++- .../Android/src/org/libsdl/app/SDLActivity.java | 8 +++++--- projects/mtg/build.xml | 4 ++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/JGE/src/SDLmain.cpp b/JGE/src/SDLmain.cpp index d3323890d..69de84a35 100644 --- a/JGE/src/SDLmain.cpp +++ b/JGE/src/SDLmain.cpp @@ -78,7 +78,19 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume( { if (!g_engine) return; - g_engine->Resume(); + g_engine->Resume(); +} + +extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceName( + JNIEnv* env, jclass cls) +{ + return env->NewStringUTF (WAGIC_RESOURCE_NAME); +} + +extern "C" jstring Java_org_libsdl_app_SDLActivity_getResourceUrl( + JNIEnv* env, jclass cls) +{ + return env->NewStringUTF (WAGIC_RESOURCE_URL); } #endif diff --git a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java index 0891808c8..847475a48 100644 --- a/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java +++ b/projects/mtg/Android/src/org/libsdl/app/SDLActivity.java @@ -80,7 +80,6 @@ public class SDLActivity extends Activity implements OnKeyListener public Boolean mErrorHappened = false; public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/"; public static String RES_FILENAME = "core_0184.zip"; - public static final String RES_URL = "http://wagic.googlecode.com/files/"; public String systemFolder = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/"; private String userFolder; @@ -307,7 +306,7 @@ public class SDLActivity extends Activity implements OnKeyListener private void startDownload() { - String url = RES_URL + RES_FILENAME; + String url = getResourceUrl(); if (!checkStorageState()) { Log.e(TAG, "Error in initializing storage space."); @@ -437,7 +436,7 @@ public class SDLActivity extends Activity implements OnKeyListener mContext = this.getApplicationContext(); // get the current version of the app to set the core filename String versionCodeString = getApplicationCode(); - RES_FILENAME = "core_" + versionCodeString + ".zip"; + RES_FILENAME = getResourceName(); StorageOptions.determineStorageOptions(); checkStorageLocationPreference(); @@ -525,6 +524,9 @@ public class SDLActivity extends Activity implements OnKeyListener } // C functions we call + public static native String getResourceUrl(); + public static native String getResourceName(); + public static native void nativeInit(); public static native void nativeQuit(); diff --git a/projects/mtg/build.xml b/projects/mtg/build.xml index c3e140bd3..8100c8ca2 100644 --- a/projects/mtg/build.xml +++ b/projects/mtg/build.xml @@ -90,8 +90,8 @@ Author: Michael Nguyen #define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR) #define WAGIC_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION) #define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) -#define WAGIC_RESOURCE_NAME WAGIC_CORE_VERSION_STRING ".zip" -#define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/${env.RELEASE_NAME}/Wagic-core.zip" +#define WAGIC_RESOURCE_NAME "Wagic-core.zip" +#define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/${env.RELEASE_NAME}/" WAGIC_RESOURCE_NAME #endif