diff --git a/.gitignore b/.gitignore
index 6fa5f59..cb49e6f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,3 +59,6 @@ bin/*
gen/*
.idea/*
.gradle/*
+app/build/*
+build/intermediates/*
+app/libs/libs.jar
diff --git a/app/app.iml b/app/app.iml
index 540250c..10e7d05 100644
--- a/app/app.iml
+++ b/app/app.iml
@@ -84,9 +84,11 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/assets/commandline.txt b/app/src/main/assets/commandline.txt
index e69de29..ae88cd1 100644
--- a/app/src/main/assets/commandline.txt
+++ b/app/src/main/assets/commandline.txt
@@ -0,0 +1 @@
+quake
\ No newline at end of file
diff --git a/app/src/main/assets/config.cfg b/app/src/main/assets/config.cfg
index b72b6d5..b4369cd 100644
--- a/app/src/main/assets/config.cfg
+++ b/app/src/main/assets/config.cfg
@@ -1,6 +1,5 @@
bind TAB "+showscores"
bind ENTER "+jump"
-bind ESCAPE "togglemenu"
bind SPACE "+jump"
bind + "sizeup"
bind , "+moveleft"
diff --git a/app/src/main/assets/source/QVRSource.zip b/app/src/main/assets/source/QVRSource.zip
index 517671e..978152a 100644
Binary files a/app/src/main/assets/source/QVRSource.zip and b/app/src/main/assets/source/QVRSource.zip differ
diff --git a/app/src/main/java/com/drbeef/qvr/DownloadTask.java b/app/src/main/java/com/drbeef/qvr/DownloadTask.java
index 400b53c..1c1929f 100644
--- a/app/src/main/java/com/drbeef/qvr/DownloadTask.java
+++ b/app/src/main/java/com/drbeef/qvr/DownloadTask.java
@@ -31,11 +31,9 @@ class DownloadTask extends AsyncTask {
public boolean please_abort = false;
- private String sdcard = Environment.getExternalStorageDirectory().getPath();
-
private String url = "https://www.dropbox.com/s/cgd8ynsvp8aen5v/quake106.zip?dl=1";
- private String demofile = sdcard + "/QVR/quake106.zip";
- private String pakfile = sdcard + "/QVR/id1/pak0.pak";
+ private String demofile = QVRConfig.GetFullWorkingFolder() + "quake106.zip";
+ private String pakfile = QVRConfig.GetFullWorkingFolder() + "id1/pak0.pak";
public DownloadTask set_context(Context context){
this.context = context;
@@ -102,7 +100,7 @@ class DownloadTask extends AsyncTask {
}
/// setup output directory
- new File(sdcard + "/QVR/id1").mkdirs();
+ new File(QVRConfig.GetFullWorkingFolder() + "id1").mkdirs();
InputStream is = null;
FileOutputStream fos = null;
@@ -124,8 +122,7 @@ class DownloadTask extends AsyncTask {
int count = is.read (buffer);
- //Log.i( "DownloadTask.java", "received " + count + " bytes");
-
+
if ( count<=0 ) break;
fos.write (buffer, 0, count);
@@ -287,7 +284,7 @@ class DownloadTask extends AsyncTask {
@Override
protected void onPostExecute(Void unused) {
- File f = new File(sdcard + "/QVR/id1/pak0.pak");
+ File f = new File(QVRConfig.GetFullWorkingFolder() + "id1/pak0.pak");
if (f.exists()) {
QVRJNILib.setDownloadStatus(1);
} else
diff --git a/app/src/main/java/com/drbeef/qvr/MainActivity.java b/app/src/main/java/com/drbeef/qvr/MainActivity.java
index 438f6b9..72a9625 100644
--- a/app/src/main/java/com/drbeef/qvr/MainActivity.java
+++ b/app/src/main/java/com/drbeef/qvr/MainActivity.java
@@ -168,8 +168,6 @@ public class MainActivity
//Shader Program
public static int sp_Image;
- private String sdcard = Environment.getExternalStorageDirectory().getPath();
-
private DownloadTask mDownloadTask = null;
public static boolean mQVRInitialised = false;
@@ -198,14 +196,11 @@ public class MainActivity
}
public void copy_asset(String name, String folder) {
- File f = new File(sdcard + folder + name);
- if (!f.exists() ||
- //If file was somehow corrupted, copy the back-up
- f.length() < 500) {
-
+ File f = new File(folder + name);
+ if (!f.exists()) {
//Ensure we have an appropriate folder
- new File(sdcard + folder).mkdirs();
- _copy_asset(name, sdcard + folder + name);
+ new File(folder).mkdirs();
+ _copy_asset(name, folder + name);
}
}
@@ -315,13 +310,13 @@ public class MainActivity
vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
//At the very least ensure we have a directory containing a config file
- copy_asset("config.cfg", "/QVR/id1/");
- copy_asset("commandline.txt", "/QVR/");
+ copy_asset("config.cfg", QVRConfig.GetFullWorkingFolder() + "id1/");
+ copy_asset("commandline.txt", QVRConfig.GetFullWorkingFolder());
//See if user is trying to use command line params
BufferedReader br;
try {
- br = new BufferedReader(new FileReader(sdcard + "/QVR/commandline.txt"));
+ br = new BufferedReader(new FileReader(QVRConfig.GetFullWorkingFolder() + "commandline.txt"));
String s;
StringBuilder sb=new StringBuilder(0);
while ((s=br.readLine())!=null)
@@ -343,7 +338,7 @@ public class MainActivity
}
else
{
- File f = new File(sdcard + "/QVR/id1/pak0.pak");
+ File f = new File(QVRConfig.GetFullWorkingFolder() + "id1/pak0.pak");
if (!f.exists()) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
this);
@@ -569,7 +564,7 @@ public class MainActivity
if (!mQVRInitialised && !mShowingSpashScreen)
{
- QVRJNILib.initialise(sdcard + "/QVR", commandLineParams);
+ QVRJNILib.initialise(QVRConfig.GetFullWorkingFolder(), commandLineParams);
//Now calculate the auto lens centre correction
CardboardDeviceParams device = cardboardView.getHeadMountedDisplay().getCardboardDeviceParams();
@@ -786,7 +781,9 @@ public class MainActivity
if (System.currentTimeMillis() - triggerTimeout > 200) {
- QVRJNILib.onKeyEvent(K_ENTER, KeyEvent.ACTION_DOWN, 0);
+ if (mQVRInitialised) {
+ QVRJNILib.onKeyEvent(K_ENTER, KeyEvent.ACTION_DOWN, 0);
+ }
cardboardView.resetHeadTracker();
@@ -873,7 +870,10 @@ public class MainActivity
if (keyCode == K_ESCAPE)
cardboardView.resetHeadTracker();
- QVRJNILib.onKeyEvent( keyCode, action, character );
+ if (mQVRInitialised) {
+ QVRJNILib.onKeyEvent(keyCode, action, character);
+ }
+
return true;
}
diff --git a/app/src/main/java/com/drbeef/qvr/QVRConfig.java b/app/src/main/java/com/drbeef/qvr/QVRConfig.java
new file mode 100644
index 0000000..b81b8b9
--- /dev/null
+++ b/app/src/main/java/com/drbeef/qvr/QVRConfig.java
@@ -0,0 +1,32 @@
+package com.drbeef.qvr;
+
+
+import android.os.Environment;
+
+import java.io.File;
+
+public class QVRConfig {
+
+ static public String GetSDCARD()
+ {
+ return Environment.getExternalStorageDirectory().getPath();
+ }
+
+ static public String GetWorkingFolder()
+ {
+ //Do we use old folder name?
+ if (new File(GetSDCARD() + "/Q4C").exists())
+ {
+ return "Q4C/";
+ }
+ else
+ {
+ return "QVR/";
+ }
+ }
+
+ static public String GetFullWorkingFolder()
+ {
+ return GetSDCARD() + "/" + GetWorkingFolder();
+ }
+}
diff --git a/local.properties b/local.properties
index 127c9a7..ca78b77 100644
--- a/local.properties
+++ b/local.properties
@@ -7,5 +7,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Fri Jan 29 22:26:37 GMT 2016
+#Sat Jan 30 19:15:49 GMT 2016
sdk.dir=C\:\\Users\\Simon\\AppData\\Local\\Android\\sdk