DroidFish: Use a prebuilt stockfish engine for Android 1.5, because the version built by the NDK fails to start.

This commit is contained in:
Peter Osterlund 2012-01-15 01:43:08 +00:00
parent ca1482a80a
commit 97ff270ee5
3 changed files with 6 additions and 1 deletions

BIN
DroidFish/assets/stockfish15.mygz Executable file

Binary file not shown.

View File

@ -37,7 +37,7 @@ public class EngineUtil {
public static String internalStockFishName() {
final int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
if (sdkVersion < 4)
return null;
return "stockfish15.mygz";
return "stockfish-" + CpuAbi.get();
}
}

View File

@ -28,6 +28,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.zip.GZIPInputStream;
import android.content.Context;
@ -73,6 +74,8 @@ public class InternalStockFish extends ExternalEngine {
InputStream is = null;
try {
is = context.getAssets().open(sfExe);
if (sfExe.endsWith(".mygz"))
is = new GZIPInputStream(is);
MessageDigest md = MessageDigest.getInstance("SHA-1");
byte[] buf = new byte[8192];
while (true) {
@ -112,6 +115,8 @@ public class InternalStockFish extends ExternalEngine {
to.createNewFile();
InputStream is = context.getAssets().open(sfExe);
if (sfExe.endsWith(".mygz"))
is = new GZIPInputStream(is);
OutputStream os = new FileOutputStream(to);
try {