From 2b7011acfede9bb4824ea818e68580af3c577f9e Mon Sep 17 00:00:00 2001 From: Peter Osterlund Date: Mon, 7 Jul 2014 22:23:18 +0000 Subject: [PATCH] DroidFish: Use different RTB path for network engines and local engines. --- DroidFish/res/values/strings.xml | 2 ++ DroidFish/res/xml/preferences.xml | 6 ++++++ DroidFish/src/org/petero/droidfish/DroidFish.java | 2 ++ DroidFish/src/org/petero/droidfish/EngineOptions.java | 4 ++++ .../src/org/petero/droidfish/engine/NetworkEngine.java | 6 +++--- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml index 06b0b12..f8846de 100644 --- a/DroidFish/res/values/strings.xml +++ b/DroidFish/res/values/strings.xml @@ -409,6 +409,8 @@ you are not actively using the program.\ Directory for network engines where Gaviota tablebases are installed. Syzygy Directory Directory where Syzygy tablebases are installed. Leave blank to use default directory + Syzygy Network Directory + Directory for network engines where Syzygy tablebases are installed. @string/prefs_custom_button_1 @string/prefs_custom_button_2 @string/prefs_custom_button_3 diff --git a/DroidFish/res/xml/preferences.xml b/DroidFish/res/xml/preferences.xml index 60c6c22..e303293 100644 --- a/DroidFish/res/xml/preferences.xml +++ b/DroidFish/res/xml/preferences.xml @@ -699,6 +699,12 @@ android:summary="@string/prefs_rtbPath_summary" android:defaultValue=""> + + diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java index 13c1b37..f3a0148 100644 --- a/DroidFish/src/org/petero/droidfish/DroidFish.java +++ b/DroidFish/src/org/petero/droidfish/DroidFish.java @@ -979,6 +979,8 @@ public class DroidFish extends Activity implements GUIInterface { rtbPath = extDir.getAbsolutePath() + sep + rtbDefaultDir; } engineOptions.rtbPath = rtbPath; + String rtbPathNet = settings.getString("rtbPathNet", "").trim(); + engineOptions.rtbPathNet = rtbPathNet; setEngineOptions(false); setEgtbHints(cb.getSelectedSquare()); diff --git a/DroidFish/src/org/petero/droidfish/EngineOptions.java b/DroidFish/src/org/petero/droidfish/EngineOptions.java index ee28a08..73a0588 100644 --- a/DroidFish/src/org/petero/droidfish/EngineOptions.java +++ b/DroidFish/src/org/petero/droidfish/EngineOptions.java @@ -28,6 +28,7 @@ public final class EngineOptions { public String gtbPath; // GTB directory path public String gtbPathNet; // GTB directory path for network engines public String rtbPath; // Syzygy directory path + public String rtbPathNet; // Syzygy directory path for network engines public String networkID; // host+port network settings public EngineOptions() { @@ -39,6 +40,7 @@ public final class EngineOptions { gtbPath = ""; gtbPathNet = ""; rtbPath = ""; + rtbPathNet = ""; networkID = ""; } @@ -51,6 +53,7 @@ public final class EngineOptions { gtbPath = other.gtbPath; gtbPathNet = other.gtbPathNet; rtbPath = other.rtbPath; + rtbPathNet = other.rtbPathNet; networkID = other.networkID; } @@ -68,6 +71,7 @@ public final class EngineOptions { gtbPath.equals(other.gtbPath) && gtbPathNet.equals(other.gtbPathNet) && rtbPath.equals(other.rtbPath) && + rtbPathNet.equals(other.rtbPathNet) && networkID.equals(other.networkID)); } diff --git a/DroidFish/src/org/petero/droidfish/engine/NetworkEngine.java b/DroidFish/src/org/petero/droidfish/engine/NetworkEngine.java index f09c4ab..d9dbb14 100644 --- a/DroidFish/src/org/petero/droidfish/engine/NetworkEngine.java +++ b/DroidFish/src/org/petero/droidfish/engine/NetworkEngine.java @@ -209,8 +209,8 @@ public class NetworkEngine extends UCIEngineBase { gaviotaTbPath = engineOptions.gtbPathNet; setOption("GaviotaTbPath", engineOptions.gtbPathNet); setOption("GaviotaTbCache", 8); - syzygyPath = engineOptions.rtbPath; - setOption("SyzygyPath", engineOptions.rtbPath); + syzygyPath = engineOptions.rtbPathNet; + setOption("SyzygyPath", engineOptions.rtbPathNet); } optionsInitialized = true; } @@ -228,7 +228,7 @@ public class NetworkEngine extends UCIEngineBase { return false; if (hasOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPathNet)) return false; - if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.rtbPath)) + if (hasOption("syzygypath") && !syzygyPath.equals(engineOptions.rtbPathNet)) return false; return true; }