3#include "../IBaseApi.h"
4#include "../PluginManager/PluginManager.h"
10 char buffer[MAX_PATH];
11 GetModuleFileNameA(
nullptr, buffer, MAX_PATH);
13 const std::string::size_type pos = std::string(buffer).find_last_of(
"\\/");
15 return std::string(buffer).substr(0, pos);
18 [[
deprecated]] std::wstring ConvertToWideStr(
const std::string& text)
20 const size_t size = text.size();
27 size_t converted_chars;
28 mbstowcs_s(&converted_chars, wstr.data(), size + 1, text.c_str(), _TRUNCATE);
34 [[
deprecated]] std::string ConvertToAnsiStr(
const std::wstring& text)
36 const size_t length = text.size();
38 std::string str(length,
'\0');
39 std::use_facet<std::ctype<
wchar_t>>(std::locale()).narrow(text.c_str(), text.c_str() + length,
'?', str.data());
44 std::string Utf8Encode(
const std::wstring& wstr)
46 std::string converted_string;
49 return converted_string;
51 const auto size_needed = WideCharToMultiByte(CP_UTF8, 0, wstr.data(),
static_cast<
int>(wstr.size()),
nullptr, 0,
55 converted_string.resize(size_needed);
57 WideCharToMultiByte(CP_UTF8, 0, wstr.data(),
static_cast<
int>(wstr.size()), converted_string.data(),
58 size_needed,
nullptr,
nullptr);
61 return converted_string;
64 std::wstring Utf8Decode(
const std::string& str)
66 std::wstring converted_string;
70 return converted_string;
73 const auto size_needed = MultiByteToWideChar(CP_UTF8, 0, str.data(),
static_cast<
int>(str.size()),
nullptr, 0);
76 converted_string.resize(size_needed);
78 MultiByteToWideChar(CP_UTF8, 0, str.data(),
static_cast<
int>(str.size()), converted_string.data(),
82 return converted_string;
85 bool IsPluginLoaded(
const std::string& plugin_name)
87 return API::PluginManager::Get().IsPluginLoaded(plugin_name);
92 return API::game_api->GetVersion();