From 1f330cb1a8436f252b0d0119ea7d27b886b009bc Mon Sep 17 00:00:00 2001 From: mittorn Date: Tue, 8 Sep 2015 00:59:55 +0700 Subject: [PATCH 1/4] Revert recent changes, do not unpack assets, disable path check --- src/com/beloko/touchcontrols/Settings.java | 2 -- .../touchcontrols/TouchControlsEditing.java | 16 +++------ src/org/libsdl/app/SDLActivity.java | 35 ++----------------- 3 files changed, 7 insertions(+), 46 deletions(-) diff --git a/src/com/beloko/touchcontrols/Settings.java b/src/com/beloko/touchcontrols/Settings.java index 0514afe7..08e317d2 100644 --- a/src/com/beloko/touchcontrols/Settings.java +++ b/src/com/beloko/touchcontrols/Settings.java @@ -113,8 +113,6 @@ public class Settings { File d = new File(dir); if (!d.exists()) d.mkdirs(); - else - return; // Note: if you move it back to /files, disable this as it may exist AssetManager assetManager = ctx.getAssets(); String[] files = null; diff --git a/src/com/beloko/touchcontrols/TouchControlsEditing.java b/src/com/beloko/touchcontrols/TouchControlsEditing.java index 19acbf06..0c19bce5 100644 --- a/src/com/beloko/touchcontrols/TouchControlsEditing.java +++ b/src/com/beloko/touchcontrols/TouchControlsEditing.java @@ -4,7 +4,6 @@ import in.celest.xash3d.hl.R; import android.app.Activity; import android.app.Dialog; import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -132,16 +131,11 @@ public class TouchControlsEditing { } }); - //String png = activity.getFilesDir() + "/" + ci.image + ".png"; - //Log.d(TAG,"png = " + png); - //BitmapDrawable bm = new BitmapDrawable(png); - try - { - image.setImageDrawable(Drawable.createFromStream(context.getAssets().open(ci.image + ".png"), null)); - } - catch(Exception e) - { - } + String png = activity.getFilesDir() + "/" + ci.image + ".png"; + Log.d(TAG,"png = " + png); + BitmapDrawable bm = new BitmapDrawable(png); + + image.setImageDrawable(bm); return convertView; } diff --git a/src/org/libsdl/app/SDLActivity.java b/src/org/libsdl/app/SDLActivity.java index a4c6185f..b2384c1b 100644 --- a/src/org/libsdl/app/SDLActivity.java +++ b/src/org/libsdl/app/SDLActivity.java @@ -222,41 +222,10 @@ public class SDLActivity extends Activity { String basedir = intent.getStringExtra("basedir"); if(basedir == null) basedir = mPref.getString("basedir","/sdcard/xash/"); - try - { - int i = Arrays.asList(mArgv).indexOf("-game"); - if(i != -1) - mControlsDir = basedir + "/" + mArgv[i+1] + "/controls/"; - } - catch(Exception e) - { - mControlsDir = null; - } - if(mControlsDir == null) - mControlsDir = basedir + "/" + gamedir + "/controls/"; + mControlsDir = basedir + "/" + gamedir + "/controls/"; File d = new File(mControlsDir); if(!d.exists()) - mControlsDir = basedir + "/controls/"; - d = new File(basedir+"/"+gamedir+"/"); - if(!d.exists()) - { - AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this); - dlgAlert.setMessage("Game path \""+basedir+"/"+gamedir+"/"+"\" not exist!\n" - + "Please check mod name and game path in launcher or place game resourses to \""+basedir+"\"."); - dlgAlert.setTitle("Xash Error"); - dlgAlert.setPositiveButton("Exit", - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog,int id) { - // if this button is clicked, close current activity - SDLActivity.mSingleton.finish(); - } - }); - dlgAlert.setCancelable(false); - dlgAlert.create().show(); - - return; - } + mControlsDir = getFilesDir() + "/"; setenv("XASH3D_BASEDIR", basedir, true); setenv("XASH3D_ENGLIBDIR", getFilesDir().getParentFile().getPath() + "/lib", true); setenv("XASH3D_GAMELIBDIR", gamelibdir, true); From 19b5ac81a344d28fd3cd998ef5b7b9e577c6c564 Mon Sep 17 00:00:00 2001 From: mittorn Date: Thu, 10 Sep 2015 08:30:17 +0700 Subject: [PATCH 2/4] Add volume keys switch, fix recent bugs --- jni/Application.mk | 2 +- res/layout/activity_launcher.xml | 7 +++++++ res/values-ru/strings.xml | 1 + res/values/strings.xml | 1 + src/com/beloko/touchcontrols/Settings.java | 2 ++ src/in/celest/xash3d/LauncherActivity.java | 4 ++++ src/org/libsdl/app/SDLActivity.java | 9 +++++++-- 7 files changed, 23 insertions(+), 3 deletions(-) diff --git a/jni/Application.mk b/jni/Application.mk index 27f13f28..ce6e2e5f 100644 --- a/jni/Application.mk +++ b/jni/Application.mk @@ -14,7 +14,7 @@ endif CFLAGS_OPT := -O3 -fomit-frame-pointer -ggdb -funsafe-math-optimizations -ftree-vectorize -fgraphite-identity -floop-interchange -funsafe-loop-optimizations -finline-limit=1024 CFLAGS_OPT_ARM := -mthumb -mfpu=neon -mcpu=cortex-a9 -pipe -mvectorize-with-neon-quad -DVECTORIZE_SINCOS -CFLAGS_OPT_ARMv5 :=-mcpu=arm1136j-s -mfpu=vfp -marm -pipe +CFLAGS_OPT_ARMv5 :=-march=armv6 -mfpu=vfp -marm -pipe CFLAGS_OPT_X86 := -mtune=atom -march=atom -mssse3 -mfpmath=sse -funroll-loops -pipe -DVECTORIZE_SINCOS CFLAGS_HARDFP := -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -mfloat-abi=hard -DLOAD_HARDFP -DSOFTFP_LINK APPLICATIONMK_PATH = $(call my-dir) diff --git a/res/layout/activity_launcher.xml b/res/layout/activity_launcher.xml index 22d7c0e1..41f7d210 100644 --- a/res/layout/activity_launcher.xml +++ b/res/layout/activity_launcher.xml @@ -51,6 +51,13 @@ android:text="@string/use_controls" android:id="@+id/useControls"/> + +