mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-02-17 09:37:50 +01:00
DroidFish: Renamed NativePipedProcess to StockFishJNI.
This commit is contained in:
parent
4f4d1d95d7
commit
04a0b68f1a
|
@ -2,8 +2,8 @@ LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
LOCAL_MODULE := jni
|
LOCAL_MODULE := stockfishjni
|
||||||
LOCAL_SRC_FILES := jni.cpp
|
LOCAL_SRC_FILES := stockfishjni.cpp
|
||||||
|
|
||||||
LOCAL_CFLAGS := \
|
LOCAL_CFLAGS := \
|
||||||
-mandroid \
|
-mandroid \
|
||||||
|
|
|
@ -34,11 +34,11 @@ static int fdToChild = -1;
|
||||||
static int childpid = -1;
|
static int childpid = -1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_petero_droidfish_engine_NativePipedProcess
|
* Class: org_petero_droidfish_engine_StockFishJNI
|
||||||
* Method: startProcess
|
* Method: startProcess
|
||||||
* Signature: ()V
|
* Signature: ()V
|
||||||
*/
|
*/
|
||||||
extern "C" JNIEXPORT void JNICALL Java_org_petero_droidfish_engine_NativePipedProcess_startProcess
|
extern "C" JNIEXPORT void JNICALL Java_org_petero_droidfish_engine_StockFishJNI_startProcess
|
||||||
(JNIEnv* env, jobject obj)
|
(JNIEnv* env, jobject obj)
|
||||||
{
|
{
|
||||||
if (childpid != -1)
|
if (childpid != -1)
|
||||||
|
@ -110,11 +110,11 @@ static bool getNextChar(int& c, int timeoutMillis) {
|
||||||
|
|
||||||
static std::vector<char> lineBuf;
|
static std::vector<char> lineBuf;
|
||||||
/*
|
/*
|
||||||
* Class: org_petero_droidfish_engine_NativePipedProcess
|
* Class: org_petero_droidfish_engine_StockFishJNI
|
||||||
* Method: readFromProcess
|
* Method: readFromProcess
|
||||||
* Signature: (I)Ljava/lang/String;
|
* Signature: (I)Ljava/lang/String;
|
||||||
*/
|
*/
|
||||||
extern "C" JNIEXPORT jstring JNICALL Java_org_petero_droidfish_engine_NativePipedProcess_readFromProcess
|
extern "C" JNIEXPORT jstring JNICALL Java_org_petero_droidfish_engine_StockFishJNI_readFromProcess
|
||||||
(JNIEnv* env, jobject obj, jint timeoutMillis)
|
(JNIEnv* env, jobject obj, jint timeoutMillis)
|
||||||
{
|
{
|
||||||
struct timeval tv0, tv1;
|
struct timeval tv0, tv1;
|
||||||
|
@ -147,11 +147,11 @@ extern "C" JNIEXPORT jstring JNICALL Java_org_petero_droidfish_engine_NativePipe
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_petero_droidfish_engine_NativePipedProcess
|
* Class: org_petero_droidfish_engine_StockFishJNI
|
||||||
* Method: writeToProcess
|
* Method: writeToProcess
|
||||||
* Signature: (Ljava/lang/String;)V
|
* Signature: (Ljava/lang/String;)V
|
||||||
*/
|
*/
|
||||||
extern "C" JNIEXPORT void JNICALL Java_org_petero_droidfish_engine_NativePipedProcess_writeToProcess
|
extern "C" JNIEXPORT void JNICALL Java_org_petero_droidfish_engine_StockFishJNI_writeToProcess
|
||||||
(JNIEnv* env, jobject obj, jstring msg)
|
(JNIEnv* env, jobject obj, jstring msg)
|
||||||
{
|
{
|
||||||
const char* str = (*env).GetStringUTFChars(msg, NULL);
|
const char* str = (*env).GetStringUTFChars(msg, NULL);
|
||||||
|
@ -169,11 +169,11 @@ extern "C" JNIEXPORT void JNICALL Java_org_petero_droidfish_engine_NativePipedPr
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Class: org_petero_droidfish_engine_NativePipedProcess
|
* Class: org_petero_droidfish_engine_StockFishJNI
|
||||||
* Method: getNPhysicalProcessors
|
* Method: getNPhysicalProcessors
|
||||||
* Signature: ()I
|
* Signature: ()I
|
||||||
*/
|
*/
|
||||||
extern "C" JNIEXPORT jint JNICALL Java_org_petero_droidfish_engine_NativePipedProcess_getNPhysicalProcessors
|
extern "C" JNIEXPORT jint JNICALL Java_org_petero_droidfish_engine_StockFishJNI_getNPhysicalProcessors
|
||||||
(JNIEnv *, jclass)
|
(JNIEnv *, jclass)
|
||||||
{
|
{
|
||||||
return sysconf(_SC_NPROCESSORS_ONLN);
|
return sysconf(_SC_NPROCESSORS_ONLN);
|
|
@ -546,7 +546,7 @@ public class DroidComputerPlayer {
|
||||||
if ("cuckoochess".equals(searchRequest.engine))
|
if ("cuckoochess".equals(searchRequest.engine))
|
||||||
uciEngine = new CuckooChessEngine();
|
uciEngine = new CuckooChessEngine();
|
||||||
else
|
else
|
||||||
uciEngine = new NativePipedProcess();
|
uciEngine = new StockFishJNI();
|
||||||
uciEngine.initialize();
|
uciEngine.initialize();
|
||||||
|
|
||||||
engineMonitor = new Thread(new Runnable() {
|
engineMonitor = new Thread(new Runnable() {
|
||||||
|
@ -911,7 +911,7 @@ public class DroidComputerPlayer {
|
||||||
nCPUsFromProc = nCPUs;
|
nCPUsFromProc = nCPUs;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
int nCPUsFromOS = NativePipedProcess.getNPhysicalProcessors();
|
int nCPUsFromOS = StockFishJNI.getNPhysicalProcessors();
|
||||||
return Math.max(nCPUsFromProc, nCPUsFromOS);
|
return Math.max(nCPUsFromProc, nCPUsFromOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
|
|
||||||
package org.petero.droidfish.engine;
|
package org.petero.droidfish.engine;
|
||||||
|
|
||||||
public class NativePipedProcess extends UCIEngineBase {
|
public class StockFishJNI extends UCIEngineBase {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("jni");
|
System.loadLibrary("stockfishjni");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in New Issue
Block a user