Android: Rodent IV as a second opponent, with its characters and famous players
The play sheet chooses Maia or Rodent IV, and Rodent's character in a full-screen list (docs/design/android-rodent.md, docs/decisions.md «Rodent IV на телефоне»). The engine is built from its authors' sources by androidApp/scripts/rodent4.sh (patches: no wordexp.h on bionic; the search thread took its parameter by reference, which clang builds read after it was gone) and ships in both APKs; the opening books are one checked download. Rodent's tables, its book manifest and its opponent loop move from the desktop into crates/play, shared by both apps; uci's EngineConfig takes an environment (RODENT4HOME). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3dac4a185b
commit
b3774d1651
42 changed files with 4098 additions and 951 deletions
41
packaging/rodent-iv/android.patch
Normal file
41
packaging/rodent-iv/android.patch
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
Android (NDK, bionic): no wordexp.h. The authors' sources leave out the wordexp code only
|
||||
when ANDROID is defined, which also selects their /sdcard/Rodent4 home folder; NDK clang
|
||||
defines __ANDROID__, so leave it out for that too and keep the RODENT4HOME home folder.
|
||||
Only the RODENT4BOOKS/RODENT4PERSONALITIES overrides go (ChDirEnv is false), as in the
|
||||
authors' Android build.
|
||||
|
||||
diff --git a/sources/src/rodent.h b/sources/src/rodent.h
|
||||
index 30ccf22..8580d86 100755
|
||||
--- a/sources/src/rodent.h
|
||||
+++ b/sources/src/rodent.h
|
||||
@@ -1078,7 +1078,7 @@ extern const int ph_value[7];
|
||||
#endif
|
||||
void PrintOverrides();
|
||||
// change dir and return true on success
|
||||
- #ifndef ANDROID
|
||||
+ #if !defined(ANDROID) && !defined(__ANDROID__)
|
||||
bool ChDirEnv(const char *env_name);
|
||||
#else
|
||||
#define ChDirEnv(dummy) false
|
||||
diff --git a/sources/src/util.cpp b/sources/src/util.cpp
|
||||
index b0a028b..e32be00 100644
|
||||
--- a/sources/src/util.cpp
|
||||
+++ b/sources/src/util.cpp
|
||||
@@ -28,7 +28,7 @@ If not, see <http://www.gnu.org/licenses/>.
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
- #ifndef ANDROID
|
||||
+ #if !defined(ANDROID) && !defined(__ANDROID__) // bionic has no wordexp
|
||||
#include <wordexp.h>
|
||||
#endif
|
||||
#endif
|
||||
@@ -330,7 +330,7 @@ void PrintOverrides() {
|
||||
if (char *ptr = getenv("RODENT4PERSONALITIES"))
|
||||
printfUciOut("info string override for personalities path: '%s'\n", ptr);
|
||||
}
|
||||
-#ifndef ANDROID
|
||||
+#if !defined(ANDROID) && !defined(__ANDROID__)
|
||||
bool ChDirEnv(const char *env_name) {
|
||||
char *env_path;
|
||||
env_path = getenv(env_name);
|
||||
18
packaging/rodent-iv/think-thread.patch
Normal file
18
packaging/rodent-iv/think-thread.patch
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
The search thread's lambda took the parameter p by reference, and StartThinkThread
|
||||
returns at once: the thread then read p from a dead stack frame. GCC builds happened
|
||||
to work; clang builds (the NDK's, AddressSanitizer: stack-use-after-return) searched
|
||||
garbage and answered illegal moves (bestmove a1b1 from the start). Take p by value.
|
||||
|
||||
diff --git a/sources/src/rodent.h b/sources/src/rodent.h
|
||||
index 30ccf22..3e100a0 100755
|
||||
--- a/sources/src/rodent.h
|
||||
+++ b/sources/src/rodent.h
|
||||
@@ -981,7 +981,7 @@ class cEngine {
|
||||
std::thread mWorker;
|
||||
void StartThinkThread(POS *p) {
|
||||
mDpCompleted = 0;
|
||||
- mWorker = std::thread([&] { Think(p); });
|
||||
+ mWorker = std::thread([this, p] { Think(p); });
|
||||
}
|
||||
|
||||
~cEngine() { WaitThinkThread(); }; // should fix crash on windows on console closing
|
||||
Loading…
Add table
Add a link
Reference in a new issue