Fixed data downloading

This commit is contained in:
pelya
2010-08-21 17:21:40 +03:00
parent ac6a031c7d
commit ffec83a679
15 changed files with 75 additions and 51 deletions

View File

@@ -341,6 +341,7 @@ mv -f project/res/values/strings.xml.1 project/res/values/strings.xml
echo Forcing rebuild of specific files
rm -rf project/libs/*
rm -rf project/bin/ndk/local/*/objs/sdl_main/* project/bin/ndk/local/*/libsdl_main.so
if [ "$LibSdlVersionOld" '!=' "$LibSdlVersion" ]; then
# Internal types are different in SDL 1.2 and 1.3, namely SDL_Rect, so all libs using it have to be recompiled
rm -rf project/bin/ndk/local/*/objs/sdl* project/bin/ndk/local/*/libsdl*.so
@@ -349,7 +350,6 @@ fi
# Do not rebuild libraries that do not need that
find project/bin/ndk/local -name "*.[oa]" -exec touch '{}' \;
# Force rebuild of C-Java bindings and updated settings
touch project/jni/sdl_main/*.c
touch project/sdl/sdl-*/src/audio/android/*.c
touch project/sdl/sdl-*/src/video/android/*.c
touch project/sdl/sdl-*/src/video/SDL_video.c

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.googlecode.opentyrian"
android:versionCode="2104"
android:versionName="2.1.04"
package="com.sourceforge.sc2"
android:versionCode="1001"
android:versionName="1.0.01"
>
<application android:label="@string/app_name"
android:icon="@drawable/icon"

View File

@@ -1,6 +1,6 @@
# The namespace in Java file, with dots replaced with underscores
SDL_JAVA_PACKAGE_PATH := com_googlecode_opentyrian
SDL_JAVA_PACKAGE_PATH := com_sourceforge_sc2
# Path to shared libraries - Android 1.6 cannot load them properly, thus we have to specify absolute path here
# SDL_SHARED_LIBRARIES_PATH := /data/data/de.schwardtnet.alienblaster/lib
@@ -10,7 +10,7 @@ SDL_JAVA_PACKAGE_PATH := com_googlecode_opentyrian
# Typically /sdcard/alienblaster
# Or /data/data/de.schwardtnet.alienblaster/files if you're planning to unpack data in application private folder
# Your application will just set current directory there
SDL_CURDIR_PATH := com.googlecode.opentyrian
SDL_CURDIR_PATH := com.sourceforge.sc2
# Android Dev Phone G1 has trackball instead of cursor keys, and
# sends trackball movement events as rapid KeyDown/KeyUp events,
@@ -23,13 +23,13 @@ SDL_TRACKBALL_KEYUP_DELAY := 1
# resized in HW-accelerated way, however it eats a tiny bit of CPU
SDL_VIDEO_RENDER_RESIZE := 1
COMPILED_LIBRARIES := sdl_net
COMPILED_LIBRARIES := sdl_image
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2
APPLICATION_ADDITIONAL_CFLAGS := -finline-functions -O2 -DTHREADLIB_SDL=1 -DTIMELIB=SDL -DOVCODEC_TREMOR=1 -DNETPLAY=1 -DHAVE_GLOB=1 -DHAVE_GETOPT_LONG=1
APPLICATION_ADDITIONAL_LDFLAGS :=
APPLICATION_ADDITIONAL_LDFLAGS := -Lbin/ndk/local/armeabi -ltremor
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=SPACE -DSDL_ANDROID_KEYCODE_1=RETURN -DSDL_ANDROID_KEYCODE_2=LCTRL -DSDL_ANDROID_KEYCODE_3=LALT -DSDL_ANDROID_KEYCODE_4=RETURN
SDL_ADDITIONAL_CFLAGS := -DSDL_ANDROID_KEYCODE_MOUSE=UNKNOWN -DSDL_ANDROID_KEYCODE_0=RETURN -DSDL_ANDROID_KEYCODE_1=RCTRL -DSDL_ANDROID_KEYCODE_2=KP_PLUS -DSDL_ANDROID_KEYCODE_3=KP_MINUS -DSDL_ANDROID_KEYCODE_4=ESCAPE -DSDL_ANDROID_KEYCODE_5=F10
# If SDL_Mixer should link to libMAD
SDL_MIXER_USE_LIBMAD :=

View File

@@ -5,6 +5,6 @@ APP_PROJECT_PATH := $(call my-dir)/..
# sdl_image depends on png and jpeg
# sdl_ttf depends on freetype
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_net
APP_MODULES := application sdl sdl_main stlport tremor png jpeg freetype sdl_image
APP_ABI := armeabi

View File

@@ -3,7 +3,7 @@ LibSdlVersion=1.2
AppName="OpenTyrian"
AppFullName=com.googlecode.opentyrian
ScreenOrientation=h
AppDataDownloadUrl="^Data files size is 10 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"
AppDataDownloadUrl="^Data files size is 11 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0&d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip"
SdlVideoResize=y
NeedDepthBuffer=n
AppUsesMouse=n

View File

@@ -1 +1 @@
opentyrian
sc2

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">OpenTyrian</string>
<string name="app_name">Ur-Quan Masters</string>
</resources>

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;
@@ -150,7 +150,7 @@ class DataDownloader extends Thread
@Override
public void run()
{
String [] downloadFiles = Globals.DataDownloadUrl.split("[^]");
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
for( int i = 0; i < downloadFiles.length; i++ )
{
if( downloadFiles[i].length() > 0 && Globals.OptionalDataDownload.length > i && Globals.OptionalDataDownload[i] )
@@ -258,7 +258,11 @@ class DataDownloader extends Thread
if(DoNotUnzip)
{
path = downloadUrls[downloadUrlIndex].substring(downloadUrls[downloadUrlIndex].lastIndexOf("/")+1, downloadUrls[downloadUrlIndex].indexOf("?"));
path = getOutFilePath(downloadUrls[downloadUrlIndex].substring(
downloadUrls[downloadUrlIndex].lastIndexOf("/")+1,
downloadUrls[downloadUrlIndex].indexOf("?") > 0 ?
downloadUrls[downloadUrlIndex].indexOf("?") :
downloadUrls[downloadUrlIndex].length() ));
OutputStream out = null;
try {
out = new FileOutputStream( path );

View File

@@ -18,7 +18,7 @@
fixed with a hammer and rasp to work with libSDL port */
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import java.io.Writer;
import java.util.ArrayList;

View File

@@ -1,14 +1,14 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount anywhere
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;
class Globals {
public static String ApplicationName = "OpenTyrian";
public static String ApplicationName = "Ur-QuanMasters";
// Should be zip file
public static String DataDownloadUrl = "^Data files size is 10 Mb|http://sites.google.com/site/xpelyax/Home/tyrian21-data.zip?attredirects=0%26d=1|http://sitesproxy.goapk.com/site/xpelyax/Home/tyrian21-data.zip";
public static String DataDownloadUrl = "Main game data is 11 Mb|-http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-content.uqm?download^3DO music (19 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-3domusic.uqm?download^UQM music remix pack 1 (50 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack1.zip?download^UQM music remix pack 2 (60 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack2.zip?download^UQM music remix pack 3 (40 Mb)|-http://prdownloads.sourceforge.net/sc2/uqm-remix-pack3.zip?download^Voice (115 Mb)|http://prdownloads.sourceforge.net/sc2/uqm-0.6.0-voice.uqm?download";
// Set this value to true if you're planning to render 3D using OpenGL - it eats some GFX resources, so disabled for 2D
public static boolean NeedDepthBuffer = false;
@@ -27,7 +27,7 @@ class Globals {
public static boolean AppUsesMultitouch = false;
public static int AppTouchscreenKeyboardKeysAmount = 4;
public static int AppTouchscreenKeyboardKeysAmount = 2;
// Phone-specific config
// It will download app data to /sdcard/alienblaster if set to true,
@@ -45,5 +45,5 @@ class Globals {
}
class LoadLibrary {
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_net"); };
public LoadLibrary() { System.loadLibrary("sdl"); System.loadLibrary("sdl_image"); };
}

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import android.app.Activity;
import android.content.Context;
@@ -154,29 +154,8 @@ class Settings
final CharSequence[] items = {"Phone storage - " + String.valueOf(freePhone) + " Mb free", "SD card - " + String.valueOf(freeSdcard) + " Mb free"};
AlertDialog.Builder builder = new AlertDialog.Builder(p);
String [] downloadFiles = Globals.DataDownloadUrl.split("[^]");
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
builder.setTitle(downloadFiles[0].split("[|]")[0]);
CharSequence[] items2 = null;
if(downloadFiles.length > 1)
{
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
items2 = new CharSequence[ downloadFiles.length - 1 ];
for(int i = 1; i < downloadFiles.length; i++ )
items2[i-1] = new String(downloadFiles[i].split("[|]")[0]);
if( items2 != null )
builder.setMultiChoiceItems(items2,
Globals.OptionalDataDownload.length == items2.length ? Globals.OptionalDataDownload : null,
new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.OptionalDataDownload[item+1] = isChecked;
}
});
}
if( Globals.OptionalDataDownload == null )
Globals.OptionalDataDownload = new boolean[1];
Globals.OptionalDataDownload[0] = true;
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
@@ -184,7 +163,7 @@ class Settings
Globals.DownloadToSdcard = (item == 1);
dialog.dismiss();
showKeyboardConfig(p);
showOptionalDownloadConfig(p);
}
});
AlertDialog alert = builder.create();
@@ -192,6 +171,47 @@ class Settings
alert.show();
};
static void showOptionalDownloadConfig(final MainActivity p) {
String [] downloadFiles = Globals.DataDownloadUrl.split("\\^");
if(downloadFiles.length <= 1)
{
showKeyboardConfig(p);
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(p);
builder.setTitle("Optional packages");
CharSequence[] items = new CharSequence[ downloadFiles.length - 1 ];
for(int i = 1; i < downloadFiles.length; i++ )
items[i-1] = new String(downloadFiles[i].split("[|]")[0]);
if( Globals.OptionalDataDownload == null || Globals.OptionalDataDownload.length != items.length + 1 )
Globals.OptionalDataDownload = new boolean[downloadFiles.length];
Globals.OptionalDataDownload[0] = true;
builder.setMultiChoiceItems(items, null, new DialogInterface.OnMultiChoiceClickListener()
{
public void onClick(DialogInterface dialog, int item, boolean isChecked)
{
Globals.OptionalDataDownload[item+1] = isChecked;
}
});
builder.setPositiveButton("Done", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int item)
{
dialog.dismiss();
showKeyboardConfig(p);
}
});
AlertDialog alert = builder.create();
alert.setOwnerActivity(p);
alert.show();
};
static void showKeyboardConfig(final MainActivity p)
{
if( ! Globals.AppNeedsArrowKeys )

View File

@@ -1,5 +1,5 @@
// This string is autogenerated by ChangeAppSettings.sh, do not change spaces amount
package com.googlecode.opentyrian;
package com.sourceforge.sc2;
import javax.microedition.khronos.opengles.GL10;