diff --git a/DroidFish/res/values/strings.xml b/DroidFish/res/values/strings.xml
index 0beabc6..4626916 100644
--- a/DroidFish/res/values/strings.xml
+++ b/DroidFish/res/values/strings.xml
@@ -364,26 +364,38 @@ you are not actively using the program.\
- 2
- 3
- 4
-
+ - 6
+ - 8
+
- 0
- 1
- 2
- 3
- 4
-
+ - 6
+ - 8
+
- 16 MB
- 32 MB
- 64 MB
- 128 MB
-
+ - 256 MB
+ - 512 MB
+ - 1024 MB
+ - 2048 MB
+
- 16
- 32
- 64
- 128
-
+ - 256
+ - 512
+ - 1024
+ - 2048
+
- Whole Game
- 1 move
diff --git a/DroidFish/src/org/petero/droidfish/DroidFish.java b/DroidFish/src/org/petero/droidfish/DroidFish.java
index 0e0f550..5d44d0d 100644
--- a/DroidFish/src/org/petero/droidfish/DroidFish.java
+++ b/DroidFish/src/org/petero/droidfish/DroidFish.java
@@ -787,7 +787,7 @@ public class DroidFish extends Activity implements GUIInterface {
bookOptions.random = (settings.getInt("bookRandom", 500) - 500) * (3.0 / 500);
setBookOptions();
- engineOptions.hashMB = getHashMB();
+ engineOptions.hashMB = getIntSetting("hashMB", 16);
engineOptions.hints = settings.getBoolean("tbHints", false);
engineOptions.hintsEdit = settings.getBoolean("tbHintsEdit", false);
engineOptions.rootProbe = settings.getBoolean("tbRootProbe", true);
@@ -824,19 +824,6 @@ public class DroidFish extends Activity implements GUIInterface {
ctrl.prefsChanged();
}
- /** Get hash size in MB from settings, but reduce size to an amount that the device can handle. */
- private final int getHashMB() {
- int hashMB = getIntSetting("hashMB", 16);
- if (hashMB > 16) {
- int maxMem = (int)(Runtime.getRuntime().maxMemory() / (1024*1024));
- if (maxMem < 16)
- maxMem = 16;
- if (hashMB > maxMem)
- hashMB = maxMem;
- }
- return hashMB;
- }
-
private void updateButtons() {
boolean largeButtons = settings.getBoolean("largeButtons", false);
Resources r = getResources();
diff --git a/DroidFish/src/org/petero/droidfish/engine/ExternalEngine.java b/DroidFish/src/org/petero/droidfish/engine/ExternalEngine.java
index 42e213a..798080b 100644
--- a/DroidFish/src/org/petero/droidfish/engine/ExternalEngine.java
+++ b/DroidFish/src/org/petero/droidfish/engine/ExternalEngine.java
@@ -171,8 +171,8 @@ public class ExternalEngine extends UCIEngineBase {
@Override
public void initOptions(EngineOptions engineOptions) {
super.initOptions(engineOptions);
- hashMB = engineOptions.hashMB;
- setOption("Hash", engineOptions.hashMB);
+ hashMB = getHashMB(engineOptions.hashMB);
+ setOption("Hash", hashMB);
if (engineOptions.engineProbe) {
gaviotaTbPath = engineOptions.gtbPath;
setOption("GaviotaTbPath", engineOptions.gtbPath);
@@ -181,12 +181,24 @@ public class ExternalEngine extends UCIEngineBase {
optionsInitialized = true;
}
+ /** Reduce too large hash sizes. */
+ private final int getHashMB(int hashMB) {
+ if (hashMB > 16) {
+ int maxMem = (int)(Runtime.getRuntime().maxMemory() / (1024*1024));
+ if (maxMem < 16)
+ maxMem = 16;
+ if (hashMB > maxMem)
+ hashMB = maxMem;
+ }
+ return hashMB;
+ }
+
/** @inheritDoc */
@Override
public boolean optionsOk(EngineOptions engineOptions) {
if (!optionsInitialized)
return true;
- if (hashMB != engineOptions.hashMB)
+ if (hashMB != getHashMB(engineOptions.hashMB))
return false;
if (haveOption("gaviotatbpath") && !gaviotaTbPath.equals(engineOptions.gtbPath))
return false;