diff --git a/src/platform/android/app/src/main/res/raw/level2.psx b/bin/level/LEVEL1.PSX similarity index 53% rename from src/platform/android/app/src/main/res/raw/level2.psx rename to bin/level/LEVEL1.PSX index 79e9e86..d598b09 100644 Binary files a/src/platform/android/app/src/main/res/raw/level2.psx and b/bin/level/LEVEL1.PSX differ diff --git a/src/platform/android/app/build.gradle b/src/platform/android/app/build.gradle index b75219d..95dabc5 100644 --- a/src/platform/android/app/build.gradle +++ b/src/platform/android/app/build.gradle @@ -6,7 +6,7 @@ android { defaultConfig { applicationId "com.xproger.openlara" minSdkVersion 18 - targetSdkVersion 25 + targetSdkVersion 18 versionCode 1 versionName "0.1" ndk { @@ -35,5 +35,5 @@ android { } dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) + compile fileTree(include: ['*.jar'], dir: 'libs') } diff --git a/src/platform/android/app/src/main/cpp/main.cpp b/src/platform/android/app/src/main/cpp/main.cpp index 0fd37ec..64b0cc5 100644 --- a/src/platform/android/app/src/main/cpp/main.cpp +++ b/src/platform/android/app/src/main/cpp/main.cpp @@ -35,10 +35,11 @@ JNI_METHOD(void, nativeInit)(JNIEnv* env, jobject obj, jstring contentDir, jstri Stream::contentDir[0] = Stream::cacheDir[0] = 0; str = env->GetStringUTFChars(packName, NULL); +/* Stream *level = new Stream(str); env->ReleaseStringUTFChars(packName, str); level->seek(levelOffset); - +*/ str = env->GetStringUTFChars(contentDir, NULL); strcat(Stream::contentDir, str); env->ReleaseStringUTFChars(contentDir, str); @@ -47,7 +48,7 @@ JNI_METHOD(void, nativeInit)(JNIEnv* env, jobject obj, jstring contentDir, jstri strcat(Stream::cacheDir, str); env->ReleaseStringUTFChars(cacheDir, str); - Game::init(level); + Game::init(); lastTime = getTime(); } diff --git a/src/platform/android/app/src/main/java/org/xproger/openlara/MainActivity.java b/src/platform/android/app/src/main/java/org/xproger/openlara/MainActivity.java index 40efbf7..9d5fbab 100644 --- a/src/platform/android/app/src/main/java/org/xproger/openlara/MainActivity.java +++ b/src/platform/android/app/src/main/java/org/xproger/openlara/MainActivity.java @@ -16,6 +16,7 @@ import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; +import android.os.Environment; import android.view.InputDevice; import android.view.KeyEvent; import android.view.MotionEvent; @@ -65,9 +66,10 @@ public class MainActivity extends Activity implements OnTouchListener, OnKeyList try { String packName = getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES).applicationInfo.sourceDir; // hardcoded demo level and music - AssetFileDescriptor fLevel = this.getResources().openRawResourceFd(R.raw.level2); + //AssetFileDescriptor fLevel = this.getResources().openRawResourceFd(R.raw.title); - wrapper.onCreate(System.getenv("EXTERNAL_STORAGE") + "/OpenLara/", getCacheDir().getAbsolutePath() + "/", packName, (int)fLevel.getStartOffset()); + String content = Environment.getExternalStorageDirectory().getAbsolutePath(); // System.getenv("EXTERNAL_STORAGE") + wrapper.onCreate(content + "/OpenLara/", getCacheDir().getAbsolutePath() + "/", packName, 0);//(int)fLevel.getStartOffset()); } catch (Exception e) { e.printStackTrace(); finish(); @@ -168,7 +170,10 @@ public class MainActivity extends Activity implements OnTouchListener, OnKeyList case KeyEvent.KEYCODE_BUTTON_THUMBR : btn = -9; break; case KeyEvent.KEYCODE_BUTTON_L2 : btn = -10; break; case KeyEvent.KEYCODE_BUTTON_R2 : btn = -11; break; - case KeyEvent.KEYCODE_BACK : btn = KeyEvent.KEYCODE_ESCAPE; break; + case KeyEvent.KEYCODE_BACK : btn = KeyEvent.KEYCODE_TAB; break; + case KeyEvent.KEYCODE_VOLUME_UP : + case KeyEvent.KEYCODE_VOLUME_DOWN : + case KeyEvent.KEYCODE_VOLUME_MUTE : return false; default : btn = keyCode; }