Updated resource name and URL for android project

This commit is contained in:
xawotihs
2014-01-17 23:25:48 +01:00
parent f97d9805dd
commit c3583ade01
3 changed files with 20 additions and 6 deletions

View File

@@ -78,7 +78,19 @@ extern "C" void Java_org_libsdl_app_SDLActivity_nativeResume(
{ {
if (!g_engine) if (!g_engine)
return; 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 #endif

View File

@@ -80,7 +80,6 @@ public class SDLActivity extends Activity implements OnKeyListener
public Boolean mErrorHappened = false; public Boolean mErrorHappened = false;
public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/"; public final static String RES_FOLDER = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
public static String RES_FILENAME = "core_0184.zip"; 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/"; public String systemFolder = Environment.getExternalStorageDirectory().getPath() + "/Wagic/Res/";
private String userFolder; private String userFolder;
@@ -307,7 +306,7 @@ public class SDLActivity extends Activity implements OnKeyListener
private void startDownload() private void startDownload()
{ {
String url = RES_URL + RES_FILENAME; String url = getResourceUrl();
if (!checkStorageState()) if (!checkStorageState())
{ {
Log.e(TAG, "Error in initializing storage space."); Log.e(TAG, "Error in initializing storage space.");
@@ -437,7 +436,7 @@ public class SDLActivity extends Activity implements OnKeyListener
mContext = this.getApplicationContext(); mContext = this.getApplicationContext();
// get the current version of the app to set the core filename // get the current version of the app to set the core filename
String versionCodeString = getApplicationCode(); String versionCodeString = getApplicationCode();
RES_FILENAME = "core_" + versionCodeString + ".zip"; RES_FILENAME = getResourceName();
StorageOptions.determineStorageOptions(); StorageOptions.determineStorageOptions();
checkStorageLocationPreference(); checkStorageLocationPreference();
@@ -525,6 +524,9 @@ public class SDLActivity extends Activity implements OnKeyListener
} }
// C functions we call // C functions we call
public static native String getResourceUrl();
public static native String getResourceName();
public static native void nativeInit(); public static native void nativeInit();
public static native void nativeQuit(); public static native void nativeQuit();

View File

@@ -90,8 +90,8 @@ Author: Michael Nguyen
#define WAGIC_RESOURCE_VERSION VERSION_FILE(WAGIC_VERSION_MAJOR, WAGIC_VERSION_MEDIUM, WAGIC_VERSION_MINOR) #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_VERSION_STRING VERSION_STRINGIFY(WAGIC_VERSION)
#define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION) #define WAGIC_CORE_VERSION_STRING "core_" VERSION_STRINGIFY(WAGIC_RESOURCE_VERSION)
#define WAGIC_RESOURCE_NAME WAGIC_CORE_VERSION_STRING ".zip" #define WAGIC_RESOURCE_NAME "Wagic-core.zip"
#define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/${env.RELEASE_NAME}/Wagic-core.zip" #define WAGIC_RESOURCE_URL "https://github.com/WagicProject/wagic/releases/download/${env.RELEASE_NAME}/" WAGIC_RESOURCE_NAME
#endif #endif