mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-27 06:10:28 +01:00
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:
parent
ca1482a80a
commit
97ff270ee5
BIN
DroidFish/assets/stockfish15.mygz
Executable file
BIN
DroidFish/assets/stockfish15.mygz
Executable file
Binary file not shown.
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user