diff --git a/ext/crlib b/ext/crlib index 89cfcf7..b5f7ccc 160000 --- a/ext/crlib +++ b/ext/crlib @@ -1 +1 @@ -Subproject commit 89cfcf74cc870844d6e5029c296f6c4a6b2b6070 +Subproject commit b5f7ccc23dec2d018048b40085f78255cc232e52 diff --git a/inc/product.h b/inc/product.h index f8b299f..3151375 100644 --- a/inc/product.h +++ b/inc/product.h @@ -67,7 +67,7 @@ public: CTS_BUILD_STR train { "train" }; CTS_BUILD_STR graph { "graph" }; CTS_BUILD_STR podbot { "pwf" }; - CTS_BUILD_STR ebot { "ewp" }; + CTS_BUILD_STR bin { "bin" }; } folders {}; #undef CTS_BUILD_STR diff --git a/inc/storage.h b/inc/storage.h index c21618a..3cfff02 100644 --- a/inc/storage.h +++ b/inc/storage.h @@ -40,8 +40,7 @@ CR_DECLARE_SCOPED_ENUM_TYPE (BotFile, uint32_t, Practice = 2, Graph = 3, Pathmatrix = 4, - PodbotPWF = 5, - EbotEWP = 6 + PodbotPWF = 5 ) class BotStorage final : public Singleton { @@ -58,6 +57,7 @@ private: private: int m_retries {}; ULZ *m_ulz {}; + bool m_useNonRelativePaths {}; public: BotStorage () = default; @@ -91,6 +91,9 @@ public: // remove all bot related files from disk void unlinkFromDisk (bool onlyTrainingData, bool silenceMessages); + // is correctly installed and running from correct folder? + void checkInstallLocation (); + public: // loading the graph may attempt to recurse loading, with converting or download, reset retry counter void resetRetries () { diff --git a/src/engine.cpp b/src/engine.cpp index 3fde67f..730753c 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -959,6 +959,7 @@ bool Game::loadCSBinary () { } bool Game::postload () { + bstor.checkInstallLocation (); // check if installed just as in manual // register logger logger.initialize (bstor.buildPath (BotFile::LogFile), [] (const char *msg) { diff --git a/src/graph.cpp b/src/graph.cpp index 31650b7..3cff8e2 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -1702,9 +1702,7 @@ bool BotGraph::convertOldFormat () { MemFile fp (bstor.buildPath (BotFile::PodbotPWF, true)); if (!fp) { - if (!fp.open (bstor.buildPath (BotFile::EbotEWP, true))) { - return false; - } + return false; } PODGraphHeader header {}; diff --git a/src/storage.cpp b/src/storage.cpp index e983a37..30a2f89 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -6,6 +6,7 @@ // #include +#include "storage.h" #if defined(BOT_STORAGE_EXPLICIT_INSTANTIATIONS) @@ -347,8 +348,7 @@ String BotStorage::buildPath (int32_t file, bool isMemoryLoad, bool withoutMapNa { BotFile::Pathmatrix, FilePath (folders.train, "pmx")}, { BotFile::LogFile, FilePath (folders.logs, "txt")}, { BotFile::Graph, FilePath (folders.graph, "graph")}, - { BotFile::PodbotPWF, FilePath (folders.podbot, "pwf")}, - { BotFile::EbotEWP, FilePath (folders.ebot, "ewp")}, + { BotFile::PodbotPWF, FilePath (folders.podbot, "pwf")} }; static StringArray path {}; @@ -447,8 +447,8 @@ StringRef BotStorage::getRunningPath () { static String path {}; - // we're do not do relative (against bot's library) paths on android - if (plat.android || plat.emscripten) { + // we're do not do relative (against bot's library) paths on specific cases + if (m_useNonRelativePaths) { if (path.empty ()) { path = strings.joinPath (game.getRunningModName (), folders.addons, folders.bot); } @@ -459,7 +459,7 @@ StringRef BotStorage::getRunningPath () { if (path.empty ()) { path = SharedLibrary::path (&bstor); - if (path.startsWith ("