VCMI loads main menu on a device, but crashes right after click on any botton. Megadebug patch attached.
This commit is contained in:
@@ -230,7 +230,9 @@ class DataDownloader extends Thread
|
||||
// Create output directory (not necessary for phone storage)
|
||||
System.out.println("Downloading data to: '" + outFilesDir + "'");
|
||||
try {
|
||||
(new File( outFilesDir )).mkdirs();
|
||||
File outDir = new File( outFilesDir );
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
OutputStream out = new FileOutputStream( getOutFilePath(".nomedia") );
|
||||
out.flush();
|
||||
out.close();
|
||||
@@ -340,7 +342,9 @@ class DataDownloader extends Thread
|
||||
OutputStream out = null;
|
||||
try {
|
||||
try {
|
||||
(new File( path.substring(0, path.lastIndexOf("/") ))).mkdirs();
|
||||
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
} catch( SecurityException e ) { };
|
||||
|
||||
out = new FileOutputStream( path );
|
||||
@@ -405,7 +409,9 @@ class DataDownloader extends Thread
|
||||
{
|
||||
System.out.println("Creating dir '" + getOutFilePath(entry.getName()) + "'");
|
||||
try {
|
||||
(new File( getOutFilePath(entry.getName()) )).mkdirs();
|
||||
File outDir = new File( getOutFilePath(entry.getName()) );
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
} catch( SecurityException e ) { };
|
||||
continue;
|
||||
}
|
||||
@@ -416,7 +422,9 @@ class DataDownloader extends Thread
|
||||
System.out.println("Saving file '" + path + "'");
|
||||
|
||||
try {
|
||||
(new File( path.substring(0, path.lastIndexOf("/") ))).mkdirs();
|
||||
File outDir = new File( path.substring(0, path.lastIndexOf("/") ));
|
||||
if( !(outDir.exists() && outDir.isDirectory()) )
|
||||
outDir.mkdirs();
|
||||
} catch( SecurityException e ) { };
|
||||
|
||||
try {
|
||||
@@ -431,9 +439,7 @@ class DataDownloader extends Thread
|
||||
}
|
||||
System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it");
|
||||
continue;
|
||||
} catch( Exception e )
|
||||
{
|
||||
}
|
||||
} catch( Exception e ) { }
|
||||
|
||||
try {
|
||||
out = new FileOutputStream( path );
|
||||
|
||||
@@ -67,7 +67,7 @@ class Globals {
|
||||
public static int MoveMouseWithJoystickSpeed = 0;
|
||||
public static int MoveMouseWithJoystickAccel = 0;
|
||||
public static boolean ClickMouseWithDpad = false;
|
||||
public static boolean RelativeMouseMovement = AppNeedsTwoButtonMouse; // Laptop touchpad mode
|
||||
public static boolean RelativeMouseMovement = false; // Laptop touchpad mode
|
||||
public static int RelativeMouseMovementSpeed = 2;
|
||||
public static int RelativeMouseMovementAccel = 0;
|
||||
public static boolean ShowScreenUnderFinger = false;
|
||||
|
||||
@@ -43,6 +43,8 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.util.zip.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
import android.text.SpannedString;
|
||||
@@ -584,6 +586,20 @@ public class MainActivity extends Activity {
|
||||
OutputStream out = null;
|
||||
String path = cacheDir.getAbsolutePath() + "/" + entry.getName();
|
||||
|
||||
try {
|
||||
CheckedInputStream check = new CheckedInputStream( new FileInputStream(path), new CRC32() );
|
||||
while( check.read(buf, 0, buf.length) > 0 ) {};
|
||||
check.close();
|
||||
if( check.getChecksum().getValue() != entry.getCrc() )
|
||||
{
|
||||
File ff = new File(path);
|
||||
ff.delete();
|
||||
throw new Exception();
|
||||
}
|
||||
System.out.println("File '" + path + "' exists and passed CRC check - not overwriting it");
|
||||
continue;
|
||||
} catch( Exception e ) { }
|
||||
|
||||
System.out.println("Saving to file '" + path + "'");
|
||||
|
||||
out = new FileOutputStream( path );
|
||||
@@ -597,7 +613,12 @@ public class MainActivity extends Activity {
|
||||
|
||||
out.flush();
|
||||
out.close();
|
||||
(new ProcessBuilder().command("/system/bin/chmod", "0755", path).start()).waitFor();
|
||||
try {
|
||||
(new ProcessBuilder().command("/system/bin/chmod", "0755", path).start()).waitFor();
|
||||
} catch ( Exception eeee ) {}
|
||||
try {
|
||||
(new ProcessBuilder().command("/system/xbin/chmod", "0755", path).start()).waitFor();
|
||||
} catch ( Exception eeeee ) {}
|
||||
}
|
||||
}
|
||||
catch ( Exception eee )
|
||||
|
||||
@@ -265,18 +265,6 @@ class DemoRenderer extends GLSurfaceView_SDL.Renderer
|
||||
|
||||
mGlContextLost = false;
|
||||
|
||||
// ----- VCMI hack -----
|
||||
try
|
||||
{
|
||||
File libpath = new File(context.getFilesDir(), "libvcmi.so");
|
||||
System.load(libpath.getPath());
|
||||
}
|
||||
catch ( UnsatisfiedLinkError eee )
|
||||
{
|
||||
//System.out.println("libSDL: error loading lib: " + eee.toString());
|
||||
}
|
||||
// ----- VCMI hack -----
|
||||
|
||||
String libs[] = { "application", "sdl_main" };
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user