Merge branch 'master' of https://github.com/SDLash3D/xash3d-android-project
This commit is contained in:
commit
6c1f867b55
10 changed files with 38 additions and 57 deletions
|
@ -41,7 +41,6 @@
|
||||||
<activity android:name="org.libsdl.app.SDLActivity"
|
<activity android:name="org.libsdl.app.SDLActivity"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:windowSoftInputMode="adjustResize"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:taskAffinity="org.libsdl.app.SDLActivity"
|
android:taskAffinity="org.libsdl.app.SDLActivity"
|
||||||
>
|
>
|
||||||
|
|
|
@ -12,9 +12,9 @@ APP_PLATFORM := android-8
|
||||||
endif
|
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 := -O3 -fomit-frame-pointer -ggdb -funsafe-math-optimizations -ftree-vectorize -fgraphite-identity -floop-interchange -floop-block -funsafe-loop-optimizations -finline-limit=1024
|
||||||
CFLAGS_OPT_ARM := -mthumb -mfpu=neon -mcpu=cortex-a9 -pipe -mvectorize-with-neon-quad -DVECTORIZE_SINCOS
|
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_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
|
CFLAGS_HARDFP := -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -mfloat-abi=hard -DLOAD_HARDFP -DSOFTFP_LINK
|
||||||
APPLICATIONMK_PATH = $(call my-dir)
|
APPLICATIONMK_PATH = $(call my-dir)
|
||||||
|
|
|
@ -51,6 +51,13 @@
|
||||||
android:text="@string/use_controls"
|
android:text="@string/use_controls"
|
||||||
android:id="@+id/useControls"/>
|
android:id="@+id/useControls"/>
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||||
|
android:text="@string/use_volume"
|
||||||
|
android:id="@+id/useVolume"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<string name="cmd_args_text">Аргументы командной строки(только для экспертов)</string>
|
<string name="cmd_args_text">Аргументы командной строки(только для экспертов)</string>
|
||||||
<string name="launch_button">Запустить Xash3D</string>
|
<string name="launch_button">Запустить Xash3D</string>
|
||||||
<string name="use_controls">Включить экранное управление</string>
|
<string name="use_controls">Включить экранное управление</string>
|
||||||
|
<string name="use_volume">Использовать кнопки громкости</string>
|
||||||
<string name="text_res_path">Путь к ресурсам игры</string>
|
<string name="text_res_path">Путь к ресурсам игры</string>
|
||||||
<string name="touch_set">Настройки управления</string>
|
<string name="touch_set">Настройки управления</string>
|
||||||
<string name="text_shortcut">Ярлык Xash3D</string>
|
<string name="text_shortcut">Ярлык Xash3D</string>
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="cmd_args_text">Command line arguments(experts only)</string>
|
<string name="cmd_args_text">Command line arguments(experts only)</string>
|
||||||
<string name="use_controls">Enable touch controls</string>
|
<string name="use_controls">Enable touch controls</string>
|
||||||
|
<string name="use_volume">Use volume keys</string>
|
||||||
<string name="text_res_path">Path to game resources</string>
|
<string name="text_res_path">Path to game resources</string>
|
||||||
<string name="touch_set">Controls settings</string>
|
<string name="touch_set">Controls settings</string>
|
||||||
<string name="text_shortcut">Xash3D shortcut</string>
|
<string name="text_shortcut">Xash3D shortcut</string>
|
||||||
|
@ -26,7 +27,7 @@
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
<string name="about_main" translatable="false">Xash3D Android</string>
|
<string name="about_main" translatable="false">Xash3D Android</string>
|
||||||
<string name="about_copyright">SDLash3D is not affiliated with Valve or any of their partners. All copyrights reserved to their respective owners.</string>
|
<string name="about_copyright">SDLash3D is not affiliated with Valve or any of their partners. All copyrights reserved to their respective owners.</string>
|
||||||
<string name="version_string" translatable="false">v0.15</string>
|
<string name="version_string" translatable="false">v0.16</string>
|
||||||
<string name="about_authors">Port to Android by SDLash3D team: \n
|
<string name="about_authors">Port to Android by SDLash3D team: \n
|
||||||
• a1batross\n
|
• a1batross\n
|
||||||
• mittorn \n
|
• mittorn \n
|
||||||
|
|
|
@ -111,10 +111,10 @@ public class Settings {
|
||||||
prefix = "";
|
prefix = "";
|
||||||
|
|
||||||
File d = new File(dir);
|
File d = new File(dir);
|
||||||
|
File f = new File(dir + "use.png");
|
||||||
|
if(f.exists()) return;
|
||||||
if (!d.exists())
|
if (!d.exists())
|
||||||
d.mkdirs();
|
d.mkdirs();
|
||||||
else
|
|
||||||
return; // Note: if you move it back to <datadir>/files, disable this as it may exist
|
|
||||||
|
|
||||||
AssetManager assetManager = ctx.getAssets();
|
AssetManager assetManager = ctx.getAssets();
|
||||||
String[] files = null;
|
String[] files = null;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import in.celest.xash3d.hl.R;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -132,16 +131,11 @@ public class TouchControlsEditing {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//String png = activity.getFilesDir() + "/" + ci.image + ".png";
|
String png = activity.getFilesDir() + "/" + ci.image + ".png";
|
||||||
//Log.d(TAG,"png = " + png);
|
Log.d(TAG,"png = " + png);
|
||||||
//BitmapDrawable bm = new BitmapDrawable(png);
|
BitmapDrawable bm = new BitmapDrawable(png);
|
||||||
try
|
|
||||||
{
|
image.setImageDrawable(bm);
|
||||||
image.setImageDrawable(Drawable.createFromStream(context.getAssets().open(ci.image + ".png"), null));
|
|
||||||
}
|
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ public class LauncherActivity extends Activity {
|
||||||
static TouchControlsSettings mSettings;
|
static TouchControlsSettings mSettings;
|
||||||
static EditText cmdArgs;
|
static EditText cmdArgs;
|
||||||
static CheckBox useControls;
|
static CheckBox useControls;
|
||||||
|
static CheckBox useVolume;
|
||||||
static EditText resPath;
|
static EditText resPath;
|
||||||
static SharedPreferences mPref;
|
static SharedPreferences mPref;
|
||||||
@Override
|
@Override
|
||||||
|
@ -38,6 +39,8 @@ public class LauncherActivity extends Activity {
|
||||||
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
|
cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
|
||||||
useControls = ( CheckBox ) findViewById( R.id.useControls );
|
useControls = ( CheckBox ) findViewById( R.id.useControls );
|
||||||
useControls.setChecked(mPref.getBoolean("controls",true));
|
useControls.setChecked(mPref.getBoolean("controls",true));
|
||||||
|
useVolume = ( CheckBox ) findViewById( R.id.useVolume );
|
||||||
|
useVolume.setChecked(mPref.getBoolean("usevolume",true));
|
||||||
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
resPath = ( EditText ) findViewById( R.id.cmdPath );
|
||||||
resPath.setText(mPref.getString("basedir","/sdcard/xash/"));
|
resPath.setText(mPref.getString("basedir","/sdcard/xash/"));
|
||||||
}
|
}
|
||||||
|
@ -50,6 +53,7 @@ public class LauncherActivity extends Activity {
|
||||||
SharedPreferences.Editor editor = mPref.edit();
|
SharedPreferences.Editor editor = mPref.edit();
|
||||||
editor.putString("argv", cmdArgs.getText().toString());
|
editor.putString("argv", cmdArgs.getText().toString());
|
||||||
editor.putBoolean("controls",useControls.isChecked());
|
editor.putBoolean("controls",useControls.isChecked());
|
||||||
|
editor.putBoolean("usevolume",useVolume.isChecked());
|
||||||
editor.putString("basedir", resPath.getText().toString());
|
editor.putString("basedir", resPath.getText().toString());
|
||||||
editor.commit();
|
editor.commit();
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class SDLActivity extends Activity {
|
||||||
private static final String TAG = "SDL";
|
private static final String TAG = "SDL";
|
||||||
|
|
||||||
// Keep track of the paused state
|
// Keep track of the paused state
|
||||||
public static boolean mIsPaused, mIsSurfaceReady, mHasFocus, mUseControls;
|
public static boolean mIsPaused, mIsSurfaceReady, mHasFocus, mUseControls, mUseVolume;
|
||||||
public static boolean mExitCalledFromJava;
|
public static boolean mExitCalledFromJava;
|
||||||
|
|
||||||
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
/** If shared libraries (e.g. SDL or the native application) could not be loaded. */
|
||||||
|
@ -148,6 +148,7 @@ public class SDLActivity extends Activity {
|
||||||
mIsSurfaceReady = false;
|
mIsSurfaceReady = false;
|
||||||
mHasFocus = true;
|
mHasFocus = true;
|
||||||
mControlsDir = null;
|
mControlsDir = null;
|
||||||
|
mUseVolume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
|
@ -160,8 +161,10 @@ public class SDLActivity extends Activity {
|
||||||
|
|
||||||
// fullscreen
|
// fullscreen
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
if(Build.VERSION.SDK_INT >= 12) {
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
|
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
|
}
|
||||||
|
|
||||||
// keep screen on
|
// keep screen on
|
||||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
|
||||||
|
@ -172,6 +175,7 @@ public class SDLActivity extends Activity {
|
||||||
mSingleton = this;
|
mSingleton = this;
|
||||||
mPref = this.getSharedPreferences("engine", 0);
|
mPref = this.getSharedPreferences("engine", 0);
|
||||||
mUseControls = mPref.getBoolean("controls", false);
|
mUseControls = mPref.getBoolean("controls", false);
|
||||||
|
mUseVolume = mPref.getBoolean("usevolume", false);
|
||||||
// Load shared libraries
|
// Load shared libraries
|
||||||
String errorMsgBrokenLib = "";
|
String errorMsgBrokenLib = "";
|
||||||
try {
|
try {
|
||||||
|
@ -210,7 +214,7 @@ public class SDLActivity extends Activity {
|
||||||
|
|
||||||
Intent intent=getIntent();
|
Intent intent=getIntent();
|
||||||
String argv = intent.getStringExtra("argv");
|
String argv = intent.getStringExtra("argv");
|
||||||
if(argv == null) argv = mPref.getString(argv, "-dev 3 -log");
|
if(argv == null) argv = mPref.getString("argv", "-dev 3 -log");
|
||||||
if(argv == null) argv = "-dev 3 -log";
|
if(argv == null) argv = "-dev 3 -log";
|
||||||
mArgv= argv.split(" ");
|
mArgv= argv.split(" ");
|
||||||
String gamelibdir = intent.getStringExtra("gamelibdir");
|
String gamelibdir = intent.getStringExtra("gamelibdir");
|
||||||
|
@ -222,41 +226,10 @@ public class SDLActivity extends Activity {
|
||||||
String basedir = intent.getStringExtra("basedir");
|
String basedir = intent.getStringExtra("basedir");
|
||||||
if(basedir == null)
|
if(basedir == null)
|
||||||
basedir = mPref.getString("basedir","/sdcard/xash/");
|
basedir = mPref.getString("basedir","/sdcard/xash/");
|
||||||
try
|
mControlsDir = basedir + "/" + gamedir + "/controls/";
|
||||||
{
|
|
||||||
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/";
|
|
||||||
File d = new File(mControlsDir);
|
File d = new File(mControlsDir);
|
||||||
if(!d.exists())
|
if(!d.exists())
|
||||||
mControlsDir = basedir + "/controls/";
|
mControlsDir = getFilesDir() + "/";
|
||||||
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;
|
|
||||||
}
|
|
||||||
setenv("XASH3D_BASEDIR", basedir, true);
|
setenv("XASH3D_BASEDIR", basedir, true);
|
||||||
setenv("XASH3D_ENGLIBDIR", getFilesDir().getParentFile().getPath() + "/lib", true);
|
setenv("XASH3D_ENGLIBDIR", getFilesDir().getParentFile().getPath() + "/lib", true);
|
||||||
setenv("XASH3D_GAMELIBDIR", gamelibdir, true);
|
setenv("XASH3D_GAMELIBDIR", gamelibdir, true);
|
||||||
|
@ -372,6 +345,9 @@ public class SDLActivity extends Activity {
|
||||||
|
|
||||||
int keyCode = event.getKeyCode();
|
int keyCode = event.getKeyCode();
|
||||||
// Ignore certain special keys so they're handled by Android
|
// Ignore certain special keys so they're handled by Android
|
||||||
|
if ( mUseVolume && (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN ||
|
||||||
|
keyCode == KeyEvent.KEYCODE_VOLUME_UP)
|
||||||
|
) return false;
|
||||||
return super.dispatchKeyEvent(event);
|
return super.dispatchKeyEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
-->
|
-->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="in.celest.xash3d.hl.test"
|
package="in.celest.xash3d.hl.test"
|
||||||
android:versionCode="0"
|
android:versionCode="1"
|
||||||
android:versionName="0.15pre"
|
android:versionName="0.16pre"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
<!-- Create a Java class extending SDLActivity and place it in a
|
<!-- Create a Java class extending SDLActivity and place it in a
|
||||||
|
@ -41,7 +41,6 @@
|
||||||
<activity android:name="org.libsdl.app.SDLActivity"
|
<activity android:name="org.libsdl.app.SDLActivity"
|
||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:configChanges="orientation|screenSize"
|
android:configChanges="orientation|screenSize"
|
||||||
android:windowSoftInputMode="adjustResize"
|
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:taskAffinity="org.libsdl.app.SDLActivity"
|
android:taskAffinity="org.libsdl.app.SDLActivity"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Add table
Reference in a new issue