Giter Site home page Giter Site logo

Comments (12)

Shkarlatov avatar Shkarlatov commented on June 12, 2024 1

Заменил функцию const char *Game::getRunningModName на такое

String Game::GetCurrentWorkingDirectory()
{
   auto getDirPath = [&] (String &args) {
      size_t slash = args.findLastOf ("\\/");

      if (slash != String::InvalidIndex) {
         args = args.substr (0, slash + 1);
      }
      // args = args.trim (" \\/");
      return args;
   };

   String dir;
   #ifdef _WIN32
      char baseDirBuf[255];
      char moduleDirBuf[255];
   	HMODULE hModule = nullptr;

      GetModuleFileName(hModule, baseDirBuf, sizeof baseDirBuf);

      GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCTSTR)product.name.chars(), &hModule);
   	GetModuleFileName(hModule, moduleDirBuf, sizeof moduleDirBuf);

      String baseDir (baseDirBuf);
      baseDir=getDirPath(baseDir.lowercase());

      String moduleDir (moduleDirBuf);
      moduleDir=getDirPath(moduleDir.lowercase());
      
      logger.error("baseDir %s", baseDir.chars());
      logger.error("moduleDir %s", moduleDir.chars());

      dir.assign((moduleDir.substr(baseDir.length())));
      dir=dir.substr(0,dir.findFirstOf("\\/"));
      logger.error("CWD %s", dir.chars());

   #else
   ... тут  __linux__ версия ...
   #endif

   return dir;
}

Боты установлены как cstrike_addon\yapb\bin\yapb.dll
Теперь при запуске CS создаются файлы в cstrike_addon\addon\yapb\{data,conf} что не совсем правильно :( Тут файлы должны создаваться относительно ..\bin\yapb.dll Буду думать дальше.
Так же игра не может запуститься тк не может найти cstrike_addon\dlls\mp.dll

В общем патч должен быть более глубоким, необходим класс который будет проверять запрашиваемые файлы в cstrike_addon и делать fallback на cstrike.

Тк файлы запрашиваются через Game::getRunningModName а далее join, exists и прочее, то переделывать почти все запросы к файлам.

from yapb.

Vladislav4KZ avatar Vladislav4KZ commented on June 12, 2024 1

On Android the library is stored in this path:

/data/app/package.name/lib/cpu_arch/libyapb.so

Where package.name is the package name of Android app.
And cpu_arch is a folder with the name of CPU architecture (arm, arm64, x86 etc.)

And after this commit, the YaPB compiled for Android in the CS16Client launcher cannot load configs, download or save graphs.
It's trying to download or save autogenerated graphs to lib folder which is read-only.

from yapb.

Shkarlatov avatar Shkarlatov commented on June 12, 2024

Сейчас если установить в Half-Life\cstrike_addon\addons\yapb то боты принудительно создают как минимум Half-Life\cstrike\addons\yapb\{conf,data}

from yapb.

jeefo avatar jeefo commented on June 12, 2024

Should work with latest commit.

from yapb.

jeefo avatar jeefo commented on June 12, 2024

Bot is almost unusable when in symlinks on linux, needs a better way...

from yapb.

jeefo avatar jeefo commented on June 12, 2024

.. and loading configs and other things works just fine ?

from yapb.

Vladislav4KZ avatar Vladislav4KZ commented on June 12, 2024

.. and loading configs and other things works just fine ?

Нет, я же написал что конфиги тоже не грузятся.

Меню только на английском языке, и в консоли пишется что не удалось загрузить конфиги, используются стандартные захардкоденные значения.

Из-за этого бот вообще не пригоден к игре, ничего толком не работает нормально.

from yapb.

Vladislav4KZ avatar Vladislav4KZ commented on June 12, 2024

Для андроида может надо вернуть загрузку кофигов и графов с папки gamedir/addons/yapb? Т.к. там саму библиотеку бота всё равно никуда невозможно переставить.

Она может хранится только в одном конкретном недоступном для пользователя месте (различие только в названиях папок под разные архитектуры процессора), в отличие от винды или линукса, где пользователь может сам переименовать папку где находится .dll/.so библиотека бота.

from yapb.

Vladislav4KZ avatar Vladislav4KZ commented on June 12, 2024

И да, я это проверял на своём кастомном билде CS16Client, где я обновил YaPB.

В репозитории от Velaron пока ещё находится CS16Client со старым билдом бота.

from yapb.

jeefo avatar jeefo commented on June 12, 2024

да, для андройда realtive-location не подходит.

from yapb.

jeefo avatar jeefo commented on June 12, 2024

можешь проверить на последнем коммите ? честно-гвооря не тестировал.

from yapb.

Vladislav4KZ avatar Vladislav4KZ commented on June 12, 2024

можешь проверить на последнем коммите ? честно-гвооря не тестировал.

Всё работает. Конфиги и графы грузятся успешно, боты присоедняются к игре.

from yapb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.