Browse Source

Make game run on Anroid 4.3 and up

pull/2465/head
Anders Jenbo 5 years ago
parent
commit
34c2290bd0
  1. 2
      android-project/app/build.gradle
  2. 15
      android-project/app/src/main/java/org/diasurgical/devilutionx/DevilutionXSDLActivity.java
  3. 2
      android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

2
android-project/app/build.gradle

@ -16,7 +16,7 @@ android {
if (buildAsApplication) {
applicationId "org.diasurgical.devilutionx"
}
minSdkVersion 21
minSdkVersion 18
targetSdkVersion 29 // Upgrade to 30 after november 2021
versionCode 18
versionName "1.2.1"

15
android-project/app/src/main/java/org/diasurgical/devilutionx/DevilutionXSDLActivity.java

@ -72,23 +72,28 @@ public class DevilutionXSDLActivity extends SDLActivity {
private boolean copyFile(File src, File dst) {
try {
try (InputStream in = new FileInputStream(src)) {
try (OutputStream out = new FileOutputStream(dst)) {
InputStream in = new FileInputStream(src);
try {
OutputStream out = new FileOutputStream(dst);
try {
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
return true;
} finally {
out.close();
}
} finally {
in.close();
}
} catch (IOException exception) {
Log.e("copyFile", exception.getMessage());
return false;
}
return false;
return true;
}
private void migrateFile(File file) {

2
android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

@ -104,7 +104,6 @@ public class HIDDeviceManager {
private HIDDeviceManager(final Context context) {
mContext = context;
/*
// Make sure we have the HIDAPI library loaded with the native functions
try {
SDL.loadLibrary("hidapi");
@ -134,7 +133,6 @@ public class HIDDeviceManager {
return;
}
*/
HIDDeviceRegisterCallback();

Loading…
Cancel
Save