mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-04-24 21:05:39 +02: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
DroidFish
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() {
|
public static String internalStockFishName() {
|
||||||
final int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
|
final int sdkVersion = Integer.parseInt(Build.VERSION.SDK);
|
||||||
if (sdkVersion < 4)
|
if (sdkVersion < 4)
|
||||||
return null;
|
return "stockfish15.mygz";
|
||||||
return "stockfish-" + CpuAbi.get();
|
return "stockfish-" + CpuAbi.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import java.io.InputStream;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
@ -73,6 +74,8 @@ public class InternalStockFish extends ExternalEngine {
|
|||||||
InputStream is = null;
|
InputStream is = null;
|
||||||
try {
|
try {
|
||||||
is = context.getAssets().open(sfExe);
|
is = context.getAssets().open(sfExe);
|
||||||
|
if (sfExe.endsWith(".mygz"))
|
||||||
|
is = new GZIPInputStream(is);
|
||||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||||
byte[] buf = new byte[8192];
|
byte[] buf = new byte[8192];
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -112,6 +115,8 @@ public class InternalStockFish extends ExternalEngine {
|
|||||||
to.createNewFile();
|
to.createNewFile();
|
||||||
|
|
||||||
InputStream is = context.getAssets().open(sfExe);
|
InputStream is = context.getAssets().open(sfExe);
|
||||||
|
if (sfExe.endsWith(".mygz"))
|
||||||
|
is = new GZIPInputStream(is);
|
||||||
OutputStream os = new FileOutputStream(to);
|
OutputStream os = new FileOutputStream(to);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user