Enable Quake to be configured for pre-loaded, internal-flash-based data files.
diff --git a/README b/README
index fc5761e..bd11a05 100644
--- a/README
+++ b/README
@@ -2,10 +2,24 @@
In order to run Quake on the simulator and/or device, you must:
- 1) Build
- 2) Install
- 3) Run
- 4) Uninstalling Quake (this step is optional)
+ 1) Configure the Sources
+ 2) Build
+ 3) Install
+ 4) Run
+ 5) Uninstall Quake (this step is optional)
+
+Configure the Sources
+---------------------
+
+Edit src/com/android/quake/QuakeActivity.java to configure where and how Quake will obtain its data files. The
+configuration variables are:
+
+ private final static boolean USE_INTERNAL_FLASH = true;
+ private final static boolean USE_DOWNLOADER = false;
+
+If you set them to these values, then Quake will look for its files on the internal device flash, and will not
+attempt to download the files from an external web server. (Use the ./setupdevice.sh script, described below, to
+copy the data files from the Android source tree onto the device's internal flash.)
Building Quake
--------------
@@ -40,10 +54,14 @@
Select "SD card & phone storage
Make sure "Use for USB storage" is unchecked.
-Then install the Quake data files:
+Then install the Quake data files by executing this script:
+
+ ./setupdevice.sh
+
+(Or if you've set QuakeActivity.USE_INTERNAL_FLASH to false, then use this script instead:)
./setupdevicesdcard.sh
-
+
Using the emulator:
You can use Quake with the emulator, but you have to create and mount an sdcard image.
@@ -182,4 +200,4 @@
Then run this script to delete the Quake files on the sdcard:
cd $TOP/apps/Quake
- ./cleanupdevicesdcard.sh
\ No newline at end of file
+ ./cleanupdevicesdcard.sh
diff --git a/src/com/android/quake/QuakeActivity.java b/src/com/android/quake/QuakeActivity.java
index 2388dac..084a6c3 100644
--- a/src/com/android/quake/QuakeActivity.java
+++ b/src/com/android/quake/QuakeActivity.java
@@ -35,10 +35,12 @@
@Override protected void onCreate(Bundle icicle) {
Log.i("QuakeActivity", "onCreate");
super.onCreate(icicle);
- if (! DownloaderActivity.ensureDownloaded(this,
- getString(R.string.quake_customDownloadText), FILE_CONFIG_URL,
- CONFIG_VERSION, DATA_PATH, USER_AGENT)) {
- return;
+ if (USE_DOWNLOADER) {
+ if (! DownloaderActivity.ensureDownloaded(this,
+ getString(R.string.quake_customDownloadText), FILE_CONFIG_URL,
+ CONFIG_VERSION, DATA_PATH, USER_AGENT)) {
+ return;
+ }
}
if (foundQuakeData()) {
@@ -94,7 +96,7 @@
}
private boolean foundQuakeData() {
- return fileExists("/sdcard/data/quake/id1/pak0.pak");
+ return fileExists(DATA_PATH + "/id1/pak0.pak");
}
private boolean fileExists(String s) {
@@ -102,10 +104,14 @@
return f.exists();
}
+ private final static boolean USE_INTERNAL_FLASH = true;
+ private final static boolean USE_DOWNLOADER = false;
+
private final static String FILE_CONFIG_URL =
"http://sunnyvale.frotz.net/android/quake/quake11.config";
private final static String CONFIG_VERSION = "1.1";
- private final static String DATA_PATH = "/sdcard/data/quake";
+ private final static String DATA_PATH = USE_INTERNAL_FLASH ?
+ "/data/quake" : "/sdcard/data/quake";
private final static String USER_AGENT = "Android Quake Downloader";
}