mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-03 04:23:39 +00:00
change namespace LL -> ll
This commit is contained in:
parent
d7ee6e94a2
commit
55ab798f36
@ -13,7 +13,7 @@ struct Addon {
|
||||
std::string name;
|
||||
std::string description;
|
||||
Type type;
|
||||
LL::Version version;
|
||||
ll::Version version;
|
||||
std::string uuid;
|
||||
std::string directory;
|
||||
bool enable = false;
|
||||
|
@ -15,7 +15,7 @@ constexpr const char* NoCrashLogger[] = {"AntiCheats"};
|
||||
/////////////////////// LL Configs ///////////////////////
|
||||
#define LITELOADER_CONFIG_FILE "plugins/LiteLoader/LiteLoader.json"
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
struct CommandLineOption {
|
||||
bool noColorOption = false;
|
||||
};
|
||||
@ -77,7 +77,7 @@ void inline from_json(const nlohmann::json& j, LLConfig& conf);
|
||||
bool LoadLLConfig();
|
||||
|
||||
bool SaveLLConfig();
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
||||
/////////////////////// Addon Helper ///////////////////////
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
bool StartCrashLoggerProcess();
|
||||
void InitCrashLogger(bool enableCrashLogger);
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
void LoadMain();
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
struct Plugin;
|
||||
struct Version;
|
||||
|
||||
@ -13,12 +13,12 @@ class PluginManager {
|
||||
|
||||
public:
|
||||
static LIAPI bool registerPlugin(HMODULE handle, std::string name, std::string desc,
|
||||
LL::Version version, std::map<std::string, std::string> others);
|
||||
ll::Version version, std::map<std::string, std::string> others);
|
||||
|
||||
static LIAPI LL::Plugin* getPlugin(HMODULE handle);
|
||||
static LIAPI LL::Plugin* getPlugin(std::string name, bool includeScriptPlugin = true);
|
||||
static LIAPI ll::Plugin* getPlugin(HMODULE handle);
|
||||
static LIAPI ll::Plugin* getPlugin(std::string name, bool includeScriptPlugin = true);
|
||||
static LIAPI bool hasPlugin(std::string name, bool includeScriptPlugin = true);
|
||||
static LIAPI std::unordered_map<std::string, LL::Plugin*> getAllPlugins(bool includeScriptPlugin = true);
|
||||
static LIAPI std::unordered_map<std::string, ll::Plugin*> getAllPlugins(bool includeScriptPlugin = true);
|
||||
|
||||
static bool loadPlugin(std::string pluginFilePath, bool outputStatus = false, bool isHotLoad = false);
|
||||
static bool unloadPlugin(std::string pluginName, bool outputStatus = false);
|
||||
@ -27,7 +27,7 @@ public:
|
||||
|
||||
static LIAPI bool unRegisterPlugin(std::string name);
|
||||
};
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
||||
LIAPI bool RegisterPlugin(HMODULE handle, std::string name, std::string desc, LL::Version version,
|
||||
LIAPI bool RegisterPlugin(HMODULE handle, std::string name, std::string desc, ll::Version version,
|
||||
std::map<std::string, std::string> others);
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#define TARGET_BDS_PROTOCOL_VERSION 408
|
||||
|
||||
#define LITELOADER_VERSION LL::getLoaderVersion()
|
||||
#define LITELOADER_VERSION ll::getLoaderVersion()
|
||||
|
||||
|
||||
#define __TO_VERSION_STRING(ver) #ver
|
||||
|
@ -95,12 +95,12 @@ template <typename EVENT>
|
||||
class EventTemplate {
|
||||
public:
|
||||
static EventListener<EVENT> subscribe(std::function<bool(EVENT)> callback) {
|
||||
auto plugin = LL::getPlugin(GetCurrentModule());
|
||||
auto plugin = ll::getPlugin(GetCurrentModule());
|
||||
return EventListener<EVENT>(EventManager<EVENT>::addEventListener(plugin ? plugin->name : "", callback));
|
||||
}
|
||||
|
||||
static EventListener<EVENT> subscribe_ref(std::function<bool(EVENT&)> callback) {
|
||||
auto plugin = LL::getPlugin(GetCurrentModule());
|
||||
auto plugin = ll::getPlugin(GetCurrentModule());
|
||||
return EventListener<EVENT>(EventManager<EVENT>::addEventListenerRef(plugin ? plugin->name : "", callback));
|
||||
}
|
||||
|
||||
|
@ -338,8 +338,8 @@ inline I18nBase* load(Args&&... args) {
|
||||
* @return I18nBase* The pointer to the I18nBase object in PluginOwnData, null if failed
|
||||
*/
|
||||
inline I18nBase* loadFrom(const std::string& plugin) {
|
||||
if (LL::hasPlugin(plugin)) {
|
||||
auto p = LL::getPlugin(plugin);
|
||||
if (ll::hasPlugin(plugin)) {
|
||||
auto p = ll::getPlugin(plugin);
|
||||
if (p) {
|
||||
return loadFromImpl(GetCurrentModule(), p->handle);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "llapi/utils/PluginOwnData.h"
|
||||
|
||||
// LL types
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
|
||||
struct Version {
|
||||
enum Status {
|
||||
@ -67,23 +67,23 @@ struct Plugin {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace LL
|
||||
inline bool operator<=(LL::Version a, LL::Version b) {
|
||||
} // namespace ll
|
||||
inline bool operator<=(ll::Version a, ll::Version b) {
|
||||
return a < b || a == b;
|
||||
}
|
||||
inline bool operator>(LL::Version a, LL::Version b) {
|
||||
inline bool operator>(ll::Version a, ll::Version b) {
|
||||
return b < a;
|
||||
}
|
||||
inline bool operator>=(LL::Version a, LL::Version b) {
|
||||
inline bool operator>=(ll::Version a, ll::Version b) {
|
||||
return b < a || b == a;
|
||||
}
|
||||
|
||||
// helper
|
||||
LIAPI bool RegisterPlugin(HMODULE hPlugin, std::string name, std::string desc, LL::Version version,
|
||||
LIAPI bool RegisterPlugin(HMODULE hPlugin, std::string name, std::string desc, ll::Version version,
|
||||
std::map<std::string, std::string> others);
|
||||
|
||||
// Loader APIs
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
|
||||
/**
|
||||
* @brief Get the loader version as a string
|
||||
@ -94,7 +94,7 @@ LIAPI std::string getLoaderVersionString();
|
||||
/**
|
||||
* @brief Get the loader version as a Version object
|
||||
*
|
||||
* @return LL::Version The loader version
|
||||
* @return ll::Version The loader version
|
||||
*/
|
||||
LIAPI Version getLoaderVersion();
|
||||
/**
|
||||
@ -117,14 +117,14 @@ LIAPI std::string getDataPath(const std::string& pluginName);
|
||||
*
|
||||
* @param name The name of the plugin
|
||||
* @param desc The description(introduction) of the plugin
|
||||
* @param version The version of the plugin(LL::Version)
|
||||
* @param version The version of the plugin(ll::Version)
|
||||
* @param git The git information of the plugin
|
||||
* @param license The license of the plugin
|
||||
* @param website The website
|
||||
* @return bool True if the plugin is registered successfully
|
||||
* @note The implementation of this function must be in header file(because of `GetCurrentModule`)
|
||||
*/
|
||||
inline bool registerPlugin(std::string name, std::string desc, LL::Version version,
|
||||
inline bool registerPlugin(std::string name, std::string desc, ll::Version version,
|
||||
std::string git = "", std::string license = "", std::string website = "") {
|
||||
std::map<std::string, std::string> others;
|
||||
if (!git.empty())
|
||||
@ -141,17 +141,17 @@ inline bool registerPlugin(std::string name, std::string desc, LL::Version versi
|
||||
*
|
||||
* @param name The name of the plugin
|
||||
* @param desc The descirption(introduction) of the plugin
|
||||
* @param version The version of the plugin(LL::Version)
|
||||
* @param version The version of the plugin(ll::Version)
|
||||
* @param others The other information of the plugin(key-value)
|
||||
* @return bool True if the plugin is registered successfully
|
||||
* @note The implementation of this function must be in header file(because of `GetCurrentModule`)
|
||||
*
|
||||
* @par Example
|
||||
* @code
|
||||
* LL::registerPlugin("Test", "A test plugin", Version(0, 0, 1, Version::Dev), {{"Note","This is Note"}});
|
||||
* ll::registerPlugin("Test", "A test plugin", Version(0, 0, 1, Version::Dev), {{"Note","This is Note"}});
|
||||
* @endcode
|
||||
*/
|
||||
inline bool registerPlugin(std::string name, std::string desc, LL::Version version,
|
||||
inline bool registerPlugin(std::string name, std::string desc, ll::Version version,
|
||||
std::map<std::string, std::string> others) {
|
||||
return ::RegisterPlugin(GetCurrentModule(), name, desc, version, others);
|
||||
}
|
||||
@ -160,16 +160,16 @@ inline bool registerPlugin(std::string name, std::string desc, LL::Version versi
|
||||
* @brief Get a loaded plugin by name
|
||||
*
|
||||
* @param name The name of the plugin
|
||||
* @return LL::Plugin* The plugin(nullptr if not found)
|
||||
* @return ll::Plugin* The plugin(nullptr if not found)
|
||||
*/
|
||||
LIAPI LL::Plugin* getPlugin(std::string name);
|
||||
LIAPI ll::Plugin* getPlugin(std::string name);
|
||||
/**
|
||||
* @brief Get a loaded plugin by HMODULE handle
|
||||
*
|
||||
* @param name The name of the plugin
|
||||
* @return LL::Plugin* The plugin(nullptr if not found)
|
||||
* @return ll::Plugin* The plugin(nullptr if not found)
|
||||
*/
|
||||
LIAPI LL::Plugin* getPlugin(HMODULE handle);
|
||||
LIAPI ll::Plugin* getPlugin(HMODULE handle);
|
||||
|
||||
/**
|
||||
* @brief Get whether the plugin is loaded
|
||||
@ -182,9 +182,9 @@ LIAPI bool hasPlugin(std::string name);
|
||||
/**
|
||||
* @brief Get the All the loaded plugins
|
||||
*
|
||||
* @return std::unordered_map<std::string, LL::Plugin*> The loaded plugins(name-plugin)
|
||||
* @return std::unordered_map<std::string, ll::Plugin*> The loaded plugins(name-plugin)
|
||||
*/
|
||||
LIAPI std::unordered_map<std::string, LL::Plugin*> getAllPlugins();
|
||||
LIAPI std::unordered_map<std::string, ll::Plugin*> getAllPlugins();
|
||||
|
||||
/**
|
||||
* @breif Get the handle of LiteLoader.dll.
|
||||
@ -209,4 +209,4 @@ LIAPI bool isServerStopping();
|
||||
* @return std::string Language(such as: en, zh_CN, ja, ru)
|
||||
*/
|
||||
std::string getLanguage();
|
||||
}; // namespace LL
|
||||
}; // namespace ll
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
|
||||
void inline init(HMODULE hModule = nullptr) {
|
||||
if (!hModule) {
|
||||
auto pPtr = LL::getPlugin("ParticleAPI");
|
||||
auto pPtr = ll::getPlugin("ParticleAPI");
|
||||
if (!pPtr) {
|
||||
throw std::runtime_error("Cannot get ParticleAPI.dll");
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
*/
|
||||
void init(HMODULE hModule = nullptr) {
|
||||
if (!hModule) {
|
||||
auto pPtr = LL::getPlugin("PermissionAPI");
|
||||
auto pPtr = ll::getPlugin("PermissionAPI");
|
||||
if (!pPtr) {
|
||||
throw std::runtime_error("Cannot get the plugin object");
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
#include <string>
|
||||
#include "Global.h"
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
LIAPI std::string getBdsVersion();
|
||||
LIAPI int getServerProtocolVersion();
|
||||
LIAPI bool setServerMotd(const std::string& motd);
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
@ -79,7 +79,7 @@ std::optional<Addon> parseAddonFromPath(std::filesystem::path addonPath) {
|
||||
addon.directory = UTF82String(addonPath.u8string());
|
||||
|
||||
auto ver = header["version"];
|
||||
addon.version = LL::Version(ver[0], ver[1], ver[2]);
|
||||
addon.version = ll::Version(ver[0], ver[1], ver[2]);
|
||||
|
||||
string type = manifest["modules"][0]["type"];
|
||||
if (type == "resources")
|
||||
@ -239,7 +239,7 @@ void FindManifest(vector<string>& result, const string& path) {
|
||||
}
|
||||
|
||||
std::string Addon::getPrintName() const {
|
||||
if (LL::globalConfig.colorLog)
|
||||
if (ll::globalConfig.colorLog)
|
||||
return ColorFormat::convertToConsole(std::string(name));
|
||||
else
|
||||
return ColorFormat::removeColorCode(std::string(name));
|
||||
@ -619,7 +619,7 @@ bool AutoInstallAddons(string path) {
|
||||
std::error_code ec;
|
||||
if (!filesystem::exists(str2wstr(path))) {
|
||||
filesystem::create_directories(str2wstr(path), ec);
|
||||
addonLogger.info(tr("ll.addonsHelper.autoInstall.tip.dirCreated", LL::globalConfig.addonsInstallPath));
|
||||
addonLogger.info(tr("ll.addonsHelper.autoInstall.tip.dirCreated", ll::globalConfig.addonsInstallPath));
|
||||
return false;
|
||||
}
|
||||
std::vector<string> toInstallList;
|
||||
@ -659,13 +659,13 @@ bool AutoInstallAddons(string path) {
|
||||
}
|
||||
|
||||
void InitAddonsHelper() {
|
||||
if (LL::isDebugMode())
|
||||
if (ll::isDebugMode())
|
||||
addonLogger.consoleLevel = addonLogger.debug.level;
|
||||
|
||||
filesystem::remove_all(ADDON_INSTALL_TEMP_DIR);
|
||||
filesystem::create_directories(ADDON_INSTALL_TEMP_DIR);
|
||||
|
||||
AutoInstallAddons(LL::globalConfig.addonsInstallPath);
|
||||
AutoInstallAddons(ll::globalConfig.addonsInstallPath);
|
||||
BuildAddonsList();
|
||||
|
||||
filesystem::remove_all(ADDON_INSTALL_TEMP_DIR);
|
||||
|
@ -225,8 +225,8 @@ nlohmann::json addAdvancedPie(const string& key, const unordered_map<string, int
|
||||
nlohmann::json getCustomCharts() {
|
||||
nlohmann::json pluginsJson;
|
||||
|
||||
pluginsJson.emplace_back(addSimplePie("liteloaderbds_version", LL::getLoaderVersion().toString(false)));
|
||||
pluginsJson.emplace_back(addSimplePie("bds_version", LL::getBdsVersion().substr(1)));
|
||||
pluginsJson.emplace_back(addSimplePie("liteloaderbds_version", ll::getLoaderVersion().toString(false)));
|
||||
pluginsJson.emplace_back(addSimplePie("bds_version", ll::getBdsVersion().substr(1)));
|
||||
pluginsJson.emplace_back(addSimplePie("xbox_auth", isOnlineAuth ? "Required" : "Not required"));
|
||||
pluginsJson.emplace_back(addAdvancedPie("player_platform", playerPlatList));
|
||||
|
||||
@ -322,7 +322,7 @@ void scheduleThread() {
|
||||
Schedule::nextTick(submitTask);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(secondDelay));
|
||||
while (!LL::isServerStopping()) {
|
||||
while (!ll::isServerStopping()) {
|
||||
Schedule::nextTick(submitTask);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(period));
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
//#include <MC/ServerPlayer.hpp>
|
||||
//#include <ScheduleAPI.h>
|
||||
//
|
||||
//using namespace LL;
|
||||
//using namespace ll;
|
||||
//
|
||||
//// Fix bug
|
||||
//TClasslessInstanceHook(bool, "?_read@ClientCacheBlobStatusPacket@@EEAA?AW4StreamReadResult@@AEAVReadOnlyBinaryStream@@@Z",
|
||||
@ -185,7 +185,7 @@
|
||||
//TInstanceHook(void, "?die@ServerPlayer@@UEAAXAEBVActorDamageSource@@@Z", ServerPlayer , ActorDamageSource* ds)
|
||||
//{
|
||||
// original(this, ds);
|
||||
// if (LL::globalConfig.enableFixMcBug)
|
||||
// if (ll::globalConfig.enableFixMcBug)
|
||||
// {
|
||||
// auto name = getRealName();
|
||||
// Schedule::delay([name]() {
|
||||
@ -199,7 +199,7 @@
|
||||
//
|
||||
//// Fix Fishing Hook changeDimension Crash
|
||||
//TInstanceHook(__int64, "?changeDimension@Actor@@UEAAXV?$AutomaticID@VDimension@@H@@@Z", Actor, unsigned int a1) {
|
||||
// if (!LL::globalConfig.enableFixMcBug)
|
||||
// if (!ll::globalConfig.enableFixMcBug)
|
||||
// return original(this, a1);
|
||||
// if ((int)this->getEntityTypeId() == 0x4D)
|
||||
// return 0;
|
||||
@ -207,7 +207,7 @@
|
||||
//}
|
||||
//
|
||||
//TClasslessInstanceHook(__int64, "?teleportEntity@EndGatewayBlockActor@@QEAAXAEAVActor@@@Z", Actor* a1) {
|
||||
// if (!LL::globalConfig.enableFixMcBug)
|
||||
// if (!ll::globalConfig.enableFixMcBug)
|
||||
// return original(this, a1);
|
||||
// if ((int)a1->getEntityTypeId() == 0x4D)
|
||||
// return 0;
|
||||
@ -235,33 +235,33 @@
|
||||
//// Fix command crash when server is stopping
|
||||
//TClasslessInstanceHook(void, "?fireEventPlayerMessage@MinecraftEventing@@AEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@000@Z",
|
||||
// std::string const& a1, std::string const& a2, std::string const& a3, std::string const& a4) {
|
||||
// if (LL::isServerStopping())
|
||||
// if (ll::isServerStopping())
|
||||
// return;
|
||||
// original(this, a1, a2, a3, a4);
|
||||
//}
|
||||
//TClasslessInstanceHook(void, "?fireEventPlayerTransform@MinecraftEventing@@SAXAEAVPlayer@@@Z",
|
||||
// class Player& a1) {
|
||||
// if (LL::isServerStopping())
|
||||
// if (ll::isServerStopping())
|
||||
// return;
|
||||
// original(this, a1);
|
||||
//}
|
||||
//
|
||||
//TClasslessInstanceHook(void, "?fireEventPlayerTravelled@MinecraftEventing@@UEAAXPEAVPlayer@@M@Z",
|
||||
// class Player& a1, float a2) {
|
||||
// if (LL::isServerStopping())
|
||||
// if (ll::isServerStopping())
|
||||
// return;
|
||||
// original(this, a1, a2);
|
||||
//}
|
||||
//TClasslessInstanceHook(void, "?fireEventPlayerTeleported@MinecraftEventing@@SAXPEAVPlayer@@MW4TeleportationCause@1@H@Z",
|
||||
// class Player* a1, float a2, int a3, int a4) {
|
||||
// if (LL::isServerStopping())
|
||||
// if (ll::isServerStopping())
|
||||
// return;
|
||||
// original(this, a1, a2, a3, a4);
|
||||
//}
|
||||
//
|
||||
//// Set stdin mode to text mode if in wine environment
|
||||
//inline bool _tryFixConsoleInputMode() {
|
||||
// if ((LL::globalConfig.enableFixMcBug && IsWineEnvironment()) || LL::globalConfig.enableForceUtf8Input) {
|
||||
// if ((ll::globalConfig.enableFixMcBug && IsWineEnvironment()) || ll::globalConfig.enableForceUtf8Input) {
|
||||
// int result = _setmode(_fileno(stdin), _O_U8TEXT);
|
||||
// if (result == -1) {
|
||||
// logger.error("Cannot set stdin to utf8 text mode");
|
||||
@ -285,14 +285,14 @@
|
||||
//
|
||||
//// Fix server broadcast bug.
|
||||
//TClasslessInstanceHook(bool, "?getLANBroadcast@LevelData@@QEBA_NXZ") {
|
||||
// if (LL::globalConfig.enableFixBroadcastBug) {
|
||||
// if (ll::globalConfig.enableFixBroadcastBug) {
|
||||
// return true;
|
||||
// }
|
||||
// return original(this);
|
||||
//}
|
||||
//
|
||||
//TClasslessInstanceHook(bool, "?getLANBroadcastIntent@LevelData@@QEBA_NXZ") {
|
||||
// if (LL::globalConfig.enableFixBroadcastBug) {
|
||||
// if (ll::globalConfig.enableFixBroadcastBug) {
|
||||
// return true;
|
||||
// }
|
||||
// return original(this);
|
||||
@ -302,7 +302,7 @@
|
||||
//bool pauseBLogging = false;
|
||||
//THook(__int64, "std::_Func_impl_no_alloc<<lambda_bc4a73e92ba7b703b39f322d94bb55f6>,TaskResult>::_Do_call",
|
||||
// __int64 a1, __int64 a2) {
|
||||
// if (LL::globalConfig.disableAutoCompactionLog) {
|
||||
// if (ll::globalConfig.disableAutoCompactionLog) {
|
||||
// pauseBLogging = true;
|
||||
// auto v = original(a1, a2);
|
||||
// pauseBLogging = false;
|
||||
@ -313,7 +313,7 @@
|
||||
//
|
||||
//TClasslessInstanceHook(char, "?log_va@BedrockLog@@YAXW4LogCategory@1@V?$bitset@$02@std@@W4LogRule@1@W4LogAreaID@@IPEBDH4PEAD@Z",
|
||||
// char a2, int a3, int a4, unsigned int a5, __int64 a6, int a7, __int64 a8, __int64 a9) {
|
||||
// if (LL::globalConfig.disableAutoCompactionLog && pauseBLogging) {
|
||||
// if (ll::globalConfig.disableAutoCompactionLog && pauseBLogging) {
|
||||
// return 0;
|
||||
// }
|
||||
// return original(this, a2, a3, a4, a5, a6, a7, a8, a9);
|
||||
@ -325,7 +325,7 @@
|
||||
//
|
||||
//THook(void*, "??0ScopedTimer@ImguiProfiler@@QEAA@PEBD0_N@Z",
|
||||
// void* self, char* a2, char* a3, char a4) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// return nullptr;
|
||||
// }
|
||||
// return original(self, a2, a3, a4);
|
||||
@ -333,7 +333,7 @@
|
||||
//
|
||||
//THook(void, "??1ScopedTimer@ImguiProfiler@@UEAA@XZ",
|
||||
// void* self) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// return;
|
||||
// }
|
||||
// return original(self);
|
||||
@ -342,7 +342,7 @@
|
||||
//SHook2("_tickDimensionTransition", __int64, "40 53 55 41 56 41 57 48 ?? ?? ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ?? 48 33 "
|
||||
// "C4 48 89 ?? ?? ?? 48 8B C2 4C 8B F9 48 8B C8 33 D2 49 8B D9 49 8B E8 E8 ?? ?? ?? ?? 4C 8B F0 48 85 C0",
|
||||
// __int64 a1, ActorOwnerComponent* a2, __int64 a3, void* a4) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// auto ac = Actor::tryGetFromComponent(*a2, 0);
|
||||
// if (ac) {
|
||||
// auto bs = &ac->getRegionConst();
|
||||
@ -355,7 +355,7 @@
|
||||
//
|
||||
//THook(void, "?_trackMovement@GameEventMovementTrackingSystem@@CAXAEAVActor@@AEAVGameEventMovementTrackingComponent@@@Z",
|
||||
// Actor* a1, void* self) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// auto bs = &a1->getRegionConst();
|
||||
// if (bs == nullptr || !bs) {
|
||||
// return;
|
||||
@ -369,7 +369,7 @@
|
||||
//
|
||||
//THook(LevelChunk*, "?getChunk@BlockSource@@QEBAPEAVLevelChunk@@AEBVChunkPos@@@Z",
|
||||
// BlockSource* self, ChunkPos* a2) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// LevelChunk* ptr = nullptr;
|
||||
// try {
|
||||
// ptr = original(self, a2);
|
||||
@ -384,7 +384,7 @@
|
||||
//
|
||||
//THook(__int64, "?getAvailableChunk@ChunkSource@@QEAA?AV?$shared_ptr@VLevelChunk@@@std@@AEBVChunkPos@@@Z",
|
||||
// __int64 a1, __int64 a2) {
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// __int64 ptr = NULL;
|
||||
// try {
|
||||
// ptr = original(a1, a2);
|
||||
@ -400,7 +400,7 @@
|
||||
// Actor) {
|
||||
//
|
||||
// auto bs = original(this);
|
||||
// if (LL::globalConfig.enableFixBDSCrash) {
|
||||
// if (ll::globalConfig.enableFixBDSCrash) {
|
||||
// if (!bs) {
|
||||
// return Level::getBlockSource(getDimensionId());
|
||||
// }
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "ScriptEngine/src/main/Configs.h"
|
||||
|
||||
using namespace RegisterCommandHelper;
|
||||
using namespace LL;
|
||||
using namespace ll;
|
||||
|
||||
//static_assert(sizeof(CommandSelector<Player>) == 200);
|
||||
|
||||
@ -149,7 +149,7 @@ public:
|
||||
};
|
||||
|
||||
void LLListPluginsCommand(CommandOutput& output) {
|
||||
auto plugins = LL::getAllPlugins();
|
||||
auto plugins = ll::getAllPlugins();
|
||||
output.trSuccess("ll.cmd.listPlugin.overview", plugins.size());
|
||||
|
||||
std::ostringstream oss;
|
||||
@ -170,7 +170,7 @@ void LLListPluginsCommand(CommandOutput& output) {
|
||||
}
|
||||
|
||||
void LLPluginInfoCommand(CommandOutput& output, const string& pluginName) {
|
||||
auto plugin = LL::getPlugin(pluginName);
|
||||
auto plugin = ll::getPlugin(pluginName);
|
||||
if (plugin) {
|
||||
std::map<std::string, std::string> outs;
|
||||
std::ostringstream oss;
|
||||
@ -201,7 +201,7 @@ void LLPluginInfoCommand(CommandOutput& output, const string& pluginName) {
|
||||
}
|
||||
|
||||
void LLVersionCommand(CommandOutput& output) {
|
||||
output.trSuccess("ll.cmd.version.msg", LL::getBdsVersion(), LL::getLoaderVersionString(), LL::getServerProtocolVersion());
|
||||
output.trSuccess("ll.cmd.version.msg", ll::getBdsVersion(), ll::getLoaderVersionString(), ll::getServerProtocolVersion());
|
||||
}
|
||||
|
||||
void LLHelpCommand(CommandOutput& output) {
|
||||
@ -209,7 +209,7 @@ void LLHelpCommand(CommandOutput& output) {
|
||||
}
|
||||
|
||||
void LLLoadPluginCommand(CommandOutput& output, const string& path) {
|
||||
// if (!LL::isDebugMode())
|
||||
// if (!ll::isDebugMode())
|
||||
// return;
|
||||
if (PluginManager::loadPlugin(path, true)) {
|
||||
output.trSuccess("ll.cmd.loadPlugin.success", path);
|
||||
@ -219,7 +219,7 @@ void LLLoadPluginCommand(CommandOutput& output, const string& path) {
|
||||
}
|
||||
|
||||
void LLUnloadPluginCommand(CommandOutput& output, const string& pluginName) {
|
||||
// if (!LL::isDebugMode())
|
||||
// if (!ll::isDebugMode())
|
||||
// return;
|
||||
if (PluginManager::unloadPlugin(pluginName, true)) {
|
||||
output.trSuccess("ll.cmd.unloadPlugin.success", pluginName);
|
||||
@ -229,7 +229,7 @@ void LLUnloadPluginCommand(CommandOutput& output, const string& pluginName) {
|
||||
}
|
||||
|
||||
void LLReloadPluginCommand(CommandOutput& output, const string& pluginName, bool reloadAll) {
|
||||
// if (!LL::isDebugMode())
|
||||
// if (!ll::isDebugMode())
|
||||
// return;
|
||||
if (!reloadAll) {
|
||||
if (PluginManager::reloadPlugin(pluginName, true)) {
|
||||
@ -316,7 +316,7 @@ public:
|
||||
|
||||
// Register softenum
|
||||
vector<string> pluginList;
|
||||
for (auto& [name, p] : LL::getAllPlugins()) {
|
||||
for (auto& [name, p] : ll::getAllPlugins()) {
|
||||
pluginList.push_back(name);
|
||||
}
|
||||
registry->addSoftEnum("PluginName", pluginList);
|
||||
@ -381,7 +381,7 @@ void RegisterCommands() {
|
||||
Event::RegCmdEvent::subscribe([](Event::RegCmdEvent ev) { // Register commands
|
||||
LLCommand::setup(ev.mCommandRegistry);
|
||||
VersionCommand::setup(ev.mCommandRegistry);
|
||||
if (LL::globalConfig.enableTpdimCommand) {
|
||||
if (ll::globalConfig.enableTpdimCommand) {
|
||||
TeleportDimensionCommand::setup(ev.mCommandRegistry);
|
||||
}
|
||||
return true;
|
||||
|
@ -19,10 +19,10 @@ TInstanceHook(void, "?registerCommand@CommandRegistry@@QEAAXAEBV?$basic_string@D
|
||||
throw std::runtime_error("There is already a command named " + name);
|
||||
}
|
||||
}
|
||||
if (LL::globalConfig.enableUnlockCmd) {
|
||||
if (ll::globalConfig.enableUnlockCmd) {
|
||||
flag1 |= 0x80;
|
||||
}
|
||||
if (LL::globalConfig.debugMode) {
|
||||
if (ll::globalConfig.debugMode) {
|
||||
LogCommandRegistration(name, description, perm, flag1, flag2);
|
||||
}
|
||||
return original(this, name, description, perm, flag1, flag2);
|
||||
@ -32,7 +32,7 @@ class CommandSelectorBase;
|
||||
class CommandOrigin;
|
||||
//TClasslessInstanceHook(bool, "?isExpansionAllowed@CommandSelectorBase@@AEBA_NAEBVCommandOrigin@@@Z",
|
||||
// CommandOrigin* a2) {
|
||||
// if (LL::globalConfig.enableUnlockCmd) {
|
||||
// if (ll::globalConfig.enableUnlockCmd) {
|
||||
// original(this, a2);
|
||||
// return true;
|
||||
// }
|
||||
@ -87,7 +87,7 @@ class CommandOrigin;
|
||||
}
|
||||
TClasslessInstanceHook(void, "?addEnumValueConstraints@CommandRegistry@@QEAAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@3@W4SemanticConstraint@@@Z",
|
||||
std::string const& enumName, std::vector<std::string> const& enumValues, SemanticConstraint constraint) {
|
||||
if (!LL::globalConfig.enableUnlockCmd)
|
||||
if (!ll::globalConfig.enableUnlockCmd)
|
||||
return original(this, enumName, enumValues, constraint);
|
||||
if (constraint & SemanticConstraint::RequiresCheatsEnabled) {
|
||||
constraint = (SemanticConstraint)(constraint & (~SemanticConstraint::RequiresCheatsEnabled));
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
|
||||
LIAPI LLConfig globalConfig;
|
||||
LIAPI LL::CommandLineOption commandLineOption;
|
||||
LIAPI ll::CommandLineOption commandLineOption;
|
||||
|
||||
void inline to_json(nlohmann::json& j, const LLConfig& conf) {
|
||||
// clang-format off
|
||||
@ -96,7 +96,7 @@ void inline to_json(nlohmann::json& j, const LLConfig& conf) {
|
||||
|
||||
void inline from_json(const nlohmann::json& j, LLConfig& conf) {
|
||||
conf.debugMode = j.value("DebugMode", false);
|
||||
if (LL::commandLineOption.noColorOption)
|
||||
if (ll::commandLineOption.noColorOption)
|
||||
conf.colorLog = false;
|
||||
else
|
||||
conf.colorLog = j.value("ColorLog", true);
|
||||
@ -207,7 +207,7 @@ void inline from_json(const nlohmann::json& j, LLConfig& conf) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
||||
inline bool SaveConfig(nlohmann::json& config) {
|
||||
std::ofstream of(LITELOADER_CONFIG_FILE);
|
||||
@ -240,12 +240,12 @@ void ChooseLanguage() {
|
||||
std::cin >> selected;
|
||||
std::cin.ignore();
|
||||
if (!languages[selected].empty()) {
|
||||
LL::globalConfig.language = languages[selected];
|
||||
ll::globalConfig.language = languages[selected];
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
bool LL::LoadLLConfig() {
|
||||
bool ll::LoadLLConfig() {
|
||||
try {
|
||||
auto content = ReadAllFile(LITELOADER_CONFIG_FILE);
|
||||
|
||||
@ -255,17 +255,17 @@ bool LL::LoadLLConfig() {
|
||||
// ChooseLanguage();
|
||||
// }
|
||||
filesystem::create_directories(filesystem::path(LITELOADER_CONFIG_FILE).remove_filename().u8string());
|
||||
LL::SaveLLConfig();
|
||||
ll::SaveLLConfig();
|
||||
} else {
|
||||
try {
|
||||
auto out = nlohmann::json::parse(*content, nullptr, false, true);
|
||||
LL::globalConfig = out;
|
||||
auto config = nlohmann::json(LL::globalConfig);
|
||||
ll::globalConfig = out;
|
||||
auto config = nlohmann::json(ll::globalConfig);
|
||||
if (out != config) {
|
||||
logger.warn(tr("ll.config.warning.configOutdated", LITELOADER_CONFIG_FILE));
|
||||
logger.warn(tr("ll.config.updating"));
|
||||
LL::globalConfig.language = "system";
|
||||
config = nlohmann::json(LL::globalConfig);
|
||||
ll::globalConfig.language = "system";
|
||||
config = nlohmann::json(ll::globalConfig);
|
||||
return SaveConfig(config);
|
||||
}
|
||||
return true;
|
||||
@ -273,7 +273,7 @@ bool LL::LoadLLConfig() {
|
||||
logger.error("Fail to parse config file <{}> !", LITELOADER_CONFIG_FILE);
|
||||
logger.error("{}", e.what());
|
||||
logger.error("Using default config file...");
|
||||
return LL::SaveLLConfig();
|
||||
return ll::SaveLLConfig();
|
||||
}
|
||||
}
|
||||
} catch (const nlohmann::json::exception& e) {
|
||||
@ -287,7 +287,7 @@ bool LL::LoadLLConfig() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LL::SaveLLConfig() {
|
||||
auto config = nlohmann::json(LL::globalConfig);
|
||||
bool ll::SaveLLConfig() {
|
||||
auto config = nlohmann::json(ll::globalConfig);
|
||||
return SaveConfig(config);
|
||||
}
|
||||
|
@ -7,11 +7,11 @@
|
||||
#include <llapi/mc/Common.hpp>
|
||||
#include <llapi/mc/SharedConstants.hpp>
|
||||
using namespace std;
|
||||
using namespace LL;
|
||||
using namespace ll;
|
||||
|
||||
Logger crashLogger("CrashLogger");
|
||||
|
||||
bool LL::StartCrashLoggerProcess() {
|
||||
bool ll::StartCrashLoggerProcess() {
|
||||
if (IsDebuggerPresent()) {
|
||||
crashLogger.info(tr("ll.crashLogger.existsingDebuggerDetected"));
|
||||
return true;
|
||||
@ -45,7 +45,7 @@ bool LL::StartCrashLoggerProcess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void LL::InitCrashLogger(bool enableCrashLogger) {
|
||||
void ll::InitCrashLogger(bool enableCrashLogger) {
|
||||
// Enable PreLog Module
|
||||
try {
|
||||
LoadLibrary(CL_PRELOG_MODULE);
|
||||
|
@ -80,7 +80,7 @@ void DecompressResourcePacks() {
|
||||
}
|
||||
|
||||
void CheckRunningBDS() {
|
||||
if (!LL::globalConfig.enableCheckRunningBDS)
|
||||
if (!ll::globalConfig.enableCheckRunningBDS)
|
||||
return;
|
||||
std::vector<DWORD> pids;
|
||||
PROCESSENTRY32 pe32{};
|
||||
@ -159,7 +159,7 @@ extern bool InitPlayerDatabase();
|
||||
extern void RegisterSimpleServerLogger();
|
||||
|
||||
void Welcome() {
|
||||
if (!LL::globalConfig.enableWelcomeText)
|
||||
if (!ll::globalConfig.enableWelcomeText)
|
||||
return;
|
||||
|
||||
|
||||
@ -184,19 +184,19 @@ void Welcome() {
|
||||
}
|
||||
|
||||
void CheckDevMode() {
|
||||
if (LL::globalConfig.debugMode)
|
||||
if (ll::globalConfig.debugMode)
|
||||
logger.warn(tr("ll.main.warning.inDevMode"));
|
||||
}
|
||||
|
||||
void CheckBetaVersion() {
|
||||
if (LITELOADER_VERSION_STATUS != LL::Version::Release) {
|
||||
if (LITELOADER_VERSION_STATUS != ll::Version::Release) {
|
||||
logger.warn(tr("ll.main.warning.betaVersion"));
|
||||
logger.warn(tr("ll.main.warning.productionEnv"));
|
||||
}
|
||||
}
|
||||
|
||||
void CheckProtocolVersion() {
|
||||
auto currentProtocol = LL::getServerProtocolVersion();
|
||||
auto currentProtocol = ll::getServerProtocolVersion();
|
||||
if (TARGET_BDS_PROTOCOL_VERSION != currentProtocol) {
|
||||
logger.warn(tr("ll.main.warning.protocolVersionNotMatch.1"), TARGET_BDS_PROTOCOL_VERSION, currentProtocol);
|
||||
logger.warn(tr("ll.main.warning.protocolVersionNotMatch.2"));
|
||||
@ -257,7 +257,7 @@ void LLMain() {
|
||||
auto i18n = Translation::load("plugins/LiteLoader/LangPack/");
|
||||
|
||||
// Load Config
|
||||
LL::LoadLLConfig();
|
||||
ll::LoadLLConfig();
|
||||
|
||||
//Unzip packed Node Modules
|
||||
UnzipNodeModules();
|
||||
@ -266,12 +266,12 @@ void LLMain() {
|
||||
DecompressResourcePacks();
|
||||
|
||||
// If SEH Protection is not enabled (Debug mode), restore old SE translator
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(oldSeTranslator);
|
||||
|
||||
// Update default language
|
||||
if (i18n && LL::globalConfig.language != "system") {
|
||||
i18n->defaultLocaleName = LL::globalConfig.language;
|
||||
if (i18n && ll::globalConfig.language != "system") {
|
||||
i18n->defaultLocaleName = ll::globalConfig.language;
|
||||
}
|
||||
|
||||
// Check Protocol Version
|
||||
@ -291,14 +291,14 @@ void LLMain() {
|
||||
CheckRunningBDS();
|
||||
|
||||
// Builtin CrashLogger
|
||||
LL::InitCrashLogger(LL::globalConfig.enableCrashLogger);
|
||||
ll::InitCrashLogger(ll::globalConfig.enableCrashLogger);
|
||||
|
||||
// Initialize Player Database
|
||||
InitPlayerDatabase();
|
||||
|
||||
// Rename Window
|
||||
HWND hwnd = GetConsoleWindow();
|
||||
std::wstring s = L"Bedrock Dedicated Server " + str2wstr(LL::getBdsVersion().substr(1));
|
||||
std::wstring s = L"Bedrock Dedicated Server " + str2wstr(ll::getBdsVersion().substr(1));
|
||||
SetWindowText(hwnd, s.c_str());
|
||||
|
||||
// Register Exit Event Handler.
|
||||
@ -313,12 +313,12 @@ void LLMain() {
|
||||
CheckDevMode();
|
||||
|
||||
// Addon Helper
|
||||
if (LL::globalConfig.enableAddonsHelper) {
|
||||
if (ll::globalConfig.enableAddonsHelper) {
|
||||
InitAddonsHelper();
|
||||
}
|
||||
|
||||
// Load plugins
|
||||
LL::LoadMain();
|
||||
ll::LoadMain();
|
||||
|
||||
// Register built-in commands
|
||||
RegisterCommands();
|
||||
@ -351,7 +351,7 @@ THook(int, "main", int a, void* b) {
|
||||
char** str = static_cast<char**>(b);
|
||||
for (int i = 0; i < a; ++i) {
|
||||
if (strcmp(str[i], "--noColor") == 0) {
|
||||
LL::commandLineOption.noColorOption = true;
|
||||
ll::commandLineOption.noColorOption = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ void LoadParticleAPI() {
|
||||
}
|
||||
|
||||
|
||||
void LL::LoadMain() {
|
||||
void ll::LoadMain() {
|
||||
logger.info(tr("ll.loader.loadMain.start"));
|
||||
CleanOldScriptEngine();
|
||||
|
||||
@ -263,7 +263,7 @@ void LL::LoadMain() {
|
||||
}
|
||||
|
||||
if (PluginManager::getPlugin(lib) == nullptr) {
|
||||
if (!RegisterPlugin(lib, pluginFileName, pluginFileName, LL::Version(1, 0, 0), {})) {
|
||||
if (!RegisterPlugin(lib, pluginFileName, pluginFileName, ll::Version(1, 0, 0), {})) {
|
||||
logger.error(tr("ll.pluginManager.error.failToRegisterPlugin", UTF82String(path.u8string())));
|
||||
if (getPlugin(pluginFileName)) {
|
||||
logger.error(tr("ll.pluginManager.error.hasBeenRegistered", pluginFileName));
|
||||
@ -283,22 +283,22 @@ void LL::LoadMain() {
|
||||
}
|
||||
|
||||
// Load PermissionAPI
|
||||
if(LL::globalConfig.enablePermissionAPI) {
|
||||
if(ll::globalConfig.enablePermissionAPI) {
|
||||
if (filesystem::exists("plugins/LiteLoader/PermissionAPI.dll")) {
|
||||
LoadPermissionAPI();
|
||||
}
|
||||
}
|
||||
|
||||
if(LL::globalConfig.enableParticleAPI) {
|
||||
if(ll::globalConfig.enableParticleAPI) {
|
||||
if (filesystem::exists("plugins/LiteLoader/ParticleAPI.dll")) {
|
||||
LoadParticleAPI();
|
||||
}
|
||||
}
|
||||
|
||||
// Load ScriptEngine
|
||||
if (LL::globalConfig.enableScriptEngine) {
|
||||
if (ll::globalConfig.enableScriptEngine) {
|
||||
InitNodeJsDirectories();
|
||||
if (LL::globalConfig.alwaysLaunchScriptEngine || IsExistNodeJsPlugin() || IsExistScriptPlugin()) {
|
||||
if (ll::globalConfig.alwaysLaunchScriptEngine || IsExistNodeJsPlugin() || IsExistScriptPlugin()) {
|
||||
LoadScriptEngine();
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ Logger serverLogger("Server");
|
||||
extern void CheckBetaVersion();
|
||||
THook(std::string, "?getServerVersionString@Common@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ") {
|
||||
CheckBetaVersion();
|
||||
return original() + "(ProtocolVersion " + to_string(LL::getServerProtocolVersion()) + ") with " + fmt::format(LL::globalConfig.colorLog ? fg(fmt::color::light_sky_blue) | fmt::emphasis::bold | fmt::emphasis::italic : fmt::text_style(), "LiteLoaderBDS " + LL::getLoaderVersion().toString(true));
|
||||
return original() + "(ProtocolVersion " + to_string(ll::getServerProtocolVersion()) + ") with " + fmt::format(ll::globalConfig.colorLog ? fg(fmt::color::light_sky_blue) | fmt::emphasis::bold | fmt::emphasis::italic : fmt::text_style(), "LiteLoaderBDS " + ll::getLoaderVersion().toString(true));
|
||||
}
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ TClasslessInstanceHook(void*, "?send@CommandOutputSender@@UEAAXAEBVCommandOrigin
|
||||
std::cout.rdbuf(&tmpBuf);
|
||||
auto rv = original(this, origin, output);
|
||||
std::cout.rdbuf(oldBuf);
|
||||
if (LL::isDebugMode() && LL::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
if (ll::isDebugMode() && ll::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
logger.warn("The thread executing the CommandOutputSender::send is not the \"MC_SERVER\" thread");
|
||||
logger.warn("Output: {}", tmpBuf.str());
|
||||
}
|
||||
@ -107,7 +107,7 @@ TClasslessInstanceHook(void*, "?send@CommandOutputSender@@UEAAXAEBVCommandOrigin
|
||||
resultOfOrigin.erase(it);
|
||||
return rv;
|
||||
} catch (...) {
|
||||
if (LL::isDebugMode()) {
|
||||
if (ll::isDebugMode()) {
|
||||
logger.warn("Output: {}", tmpBuf.str());
|
||||
logger.warn("size of resultOfOrigin: {}", resultOfOrigin.size());
|
||||
}
|
||||
@ -120,7 +120,7 @@ TClasslessInstanceHook(void*, "?send@CommandOutputSender@@UEAAXAEBVCommandOrigin
|
||||
std::istringstream iss(tmpBuf.str());
|
||||
string line;
|
||||
while (getline(iss, line)) {
|
||||
if (LL::globalConfig.colorLog)
|
||||
if (ll::globalConfig.colorLog)
|
||||
log << ColorFormat::convertToConsole(line, false) << Logger::endl;
|
||||
else
|
||||
log << ColorFormat::removeColorCode(line) << Logger::endl;
|
||||
|
@ -16,9 +16,9 @@
|
||||
using namespace std;
|
||||
|
||||
extern Logger logger;
|
||||
std::unordered_map<std::string, LL::Plugin> plugins;
|
||||
std::unordered_map<std::string, ll::Plugin> plugins;
|
||||
|
||||
bool LL::PluginManager::registerPlugin(HMODULE handle, std::string name, std::string desc, LL::Version version,
|
||||
bool ll::PluginManager::registerPlugin(HMODULE handle, std::string name, std::string desc, ll::Version version,
|
||||
std::map<std::string, std::string> others) {
|
||||
if (handle != nullptr) // DLL Plugin
|
||||
{
|
||||
@ -31,7 +31,7 @@ bool LL::PluginManager::registerPlugin(HMODULE handle, std::string name, std::st
|
||||
}
|
||||
}
|
||||
|
||||
LL::Plugin plugin{name, desc, version, others};
|
||||
ll::Plugin plugin{name, desc, version, others};
|
||||
plugin.handle = handle;
|
||||
try {
|
||||
plugin.type = others.at("PluginType") == "Script Plugin" ? Plugin::PluginType::ScriptPlugin : Plugin::PluginType::DllPlugin;
|
||||
@ -52,7 +52,7 @@ bool LL::PluginManager::registerPlugin(HMODULE handle, std::string name, std::st
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LL::PluginManager::unRegisterPlugin(std::string name) {
|
||||
bool ll::PluginManager::unRegisterPlugin(std::string name) {
|
||||
auto plugin = getPlugin(name);
|
||||
if (plugin == nullptr) {
|
||||
return false;
|
||||
@ -63,10 +63,10 @@ bool LL::PluginManager::unRegisterPlugin(std::string name) {
|
||||
}
|
||||
|
||||
// Helper
|
||||
LL::Plugin* GetPlugin_Raw(std::string name, bool includeScriptPlugin) {
|
||||
ll::Plugin* GetPlugin_Raw(std::string name, bool includeScriptPlugin) {
|
||||
for (auto& it : plugins) {
|
||||
if (it.second.name == name || UTF82String(filesystem::path(str2wstr(it.second.filePath)).filename().u8string()) == name) {
|
||||
if (!includeScriptPlugin && it.second.type == LL::Plugin::PluginType::ScriptPlugin)
|
||||
if (!includeScriptPlugin && it.second.type == ll::Plugin::PluginType::ScriptPlugin)
|
||||
continue;
|
||||
return &it.second;
|
||||
}
|
||||
@ -74,7 +74,7 @@ LL::Plugin* GetPlugin_Raw(std::string name, bool includeScriptPlugin) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LL::Plugin* LL::PluginManager::getPlugin(std::string name, bool includeScriptPlugin) {
|
||||
ll::Plugin* ll::PluginManager::getPlugin(std::string name, bool includeScriptPlugin) {
|
||||
auto res = GetPlugin_Raw(name, includeScriptPlugin);
|
||||
if (res)
|
||||
return res;
|
||||
@ -90,7 +90,7 @@ LL::Plugin* LL::PluginManager::getPlugin(std::string name, bool includeScriptPlu
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LL::Plugin* LL::PluginManager::getPlugin(HMODULE handle) {
|
||||
ll::Plugin* ll::PluginManager::getPlugin(HMODULE handle) {
|
||||
if (!handle)
|
||||
return nullptr;
|
||||
|
||||
@ -102,12 +102,12 @@ LL::Plugin* LL::PluginManager::getPlugin(HMODULE handle) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool LL::PluginManager::hasPlugin(std::string name, bool includeScriptPlugin) {
|
||||
bool ll::PluginManager::hasPlugin(std::string name, bool includeScriptPlugin) {
|
||||
return getPlugin(name, includeScriptPlugin) != nullptr;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, LL::Plugin*> LL::PluginManager::getAllPlugins(bool includeScriptPlugin) {
|
||||
std::unordered_map<std::string, LL::Plugin*> res;
|
||||
std::unordered_map<std::string, ll::Plugin*> ll::PluginManager::getAllPlugins(bool includeScriptPlugin) {
|
||||
std::unordered_map<std::string, ll::Plugin*> res;
|
||||
for (auto& [k, v] : plugins) {
|
||||
if (!includeScriptPlugin && v.type == Plugin::PluginType::ScriptPlugin)
|
||||
continue;
|
||||
@ -116,8 +116,8 @@ std::unordered_map<std::string, LL::Plugin*> LL::PluginManager::getAllPlugins(bo
|
||||
return res;
|
||||
}
|
||||
|
||||
bool LL::PluginManager::loadPlugin(string pluginFilePath, bool outputResult, bool isHotLoad) {
|
||||
// if (!LL::isDebugMode())
|
||||
bool ll::PluginManager::loadPlugin(string pluginFilePath, bool outputResult, bool isHotLoad) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
try {
|
||||
filesystem::path path(filesystem::path(str2wstr(pluginFilePath)).lexically_normal());
|
||||
@ -179,7 +179,7 @@ bool LL::PluginManager::loadPlugin(string pluginFilePath, bool outputResult, boo
|
||||
auto lib = LoadLibrary(str2wstr(pluginFilePath).c_str());
|
||||
if (lib) {
|
||||
if (getPlugin(lib) == nullptr) {
|
||||
if (!RegisterPlugin(lib, pluginFileName, pluginFileName, LL::Version(1, 0, 0), {})) {
|
||||
if (!RegisterPlugin(lib, pluginFileName, pluginFileName, ll::Version(1, 0, 0), {})) {
|
||||
logger.error(tr("ll.pluginManager.error.failToRegisterPlugin", pluginFilePath));
|
||||
if (getPlugin(pluginFileName)) {
|
||||
logger.error(tr("ll.pluginManager.error.hasBeenRegistered", pluginFileName));
|
||||
@ -240,11 +240,11 @@ bool LL::PluginManager::loadPlugin(string pluginFilePath, bool outputResult, boo
|
||||
}
|
||||
}
|
||||
|
||||
bool LL::PluginManager::unloadPlugin(string pluginName, bool outputResult) {
|
||||
// if (!LL::isDebugMode())
|
||||
bool ll::PluginManager::unloadPlugin(string pluginName, bool outputResult) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
try {
|
||||
LL::Plugin* plugin = getPlugin(pluginName);
|
||||
ll::Plugin* plugin = getPlugin(pluginName);
|
||||
if (!plugin) {
|
||||
if (outputResult) {
|
||||
logger.error(tr("ll.pluginManager.error.pluginNotFound"));
|
||||
@ -284,11 +284,11 @@ bool LL::PluginManager::unloadPlugin(string pluginName, bool outputResult) {
|
||||
}
|
||||
}
|
||||
|
||||
bool LL::PluginManager::reloadPlugin(string pluginName, bool outputResult) {
|
||||
// if (!LL::isDebugMode())
|
||||
bool ll::PluginManager::reloadPlugin(string pluginName, bool outputResult) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
try {
|
||||
LL::Plugin* plugin = getPlugin(pluginName);
|
||||
ll::Plugin* plugin = getPlugin(pluginName);
|
||||
if (!plugin) {
|
||||
if (outputResult) {
|
||||
logger.error(tr("ll.pluginManager.error.pluginNotFound"));
|
||||
@ -327,8 +327,8 @@ bool LL::PluginManager::reloadPlugin(string pluginName, bool outputResult) {
|
||||
}
|
||||
}
|
||||
|
||||
int LL::PluginManager::reloadAllPlugins(bool outputResult) {
|
||||
// if (!LL::isDebugMode())
|
||||
int ll::PluginManager::reloadAllPlugins(bool outputResult) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
try {
|
||||
auto plugins = getAllPlugins(true);
|
||||
@ -367,8 +367,8 @@ int LL::PluginManager::reloadAllPlugins(bool outputResult) {
|
||||
}
|
||||
}
|
||||
|
||||
bool LL::PluginManager::callEventAtHotLoad(std::string pluginName) {
|
||||
// if (!LL::isDebugMode())
|
||||
bool ll::PluginManager::callEventAtHotLoad(std::string pluginName) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
Schedule::nextTick([pluginName]() {
|
||||
Event::ServerStartedEvent().callToPlugin(pluginName); // ServerStartedEvent
|
||||
@ -395,8 +395,8 @@ bool LL::PluginManager::callEventAtHotLoad(std::string pluginName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LL::PluginManager::callEventAtHotUnload(std::string pluginName) {
|
||||
// if (!LL::isDebugMode())
|
||||
bool ll::PluginManager::callEventAtHotUnload(std::string pluginName) {
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
auto players = Level::getAllPlayers();
|
||||
for (auto& pl : players) // PlayerLeftEvent
|
||||
@ -412,9 +412,9 @@ bool LL::PluginManager::callEventAtHotUnload(std::string pluginName) {
|
||||
}
|
||||
|
||||
// Helper
|
||||
LIAPI bool RegisterPlugin(HMODULE handle, std::string name, std::string desc, LL::Version version,
|
||||
LIAPI bool RegisterPlugin(HMODULE handle, std::string name, std::string desc, ll::Version version,
|
||||
std::map<std::string, std::string> others) {
|
||||
others["PluginType"] = "DLL Plugin";
|
||||
others["PluginFilePath"] = handle ? GetModulePath(handle) : name;
|
||||
return LL::PluginManager::registerPlugin(handle, name, desc, version, others);
|
||||
return ll::PluginManager::registerPlugin(handle, name, desc, version, others);
|
||||
}
|
@ -10,7 +10,7 @@ using namespace Event;
|
||||
|
||||
|
||||
void RegisterSimpleServerLogger() {
|
||||
if (LL::globalConfig.enableSimpleServerLogger) {
|
||||
if (ll::globalConfig.enableSimpleServerLogger) {
|
||||
Event::PlayerChatEvent::subscribe([](const Event::PlayerChatEvent& ev) {
|
||||
static Logger logger("Chat");
|
||||
logger.info("<{}> {}", ev.mPlayer->getRealName(), ev.mMessage);
|
||||
@ -28,7 +28,7 @@ void RegisterSimpleServerLogger() {
|
||||
#include <llapi/HookAPI.h>
|
||||
TInstanceHook(void, "?setPermissions@ServerPlayer@@UEAAXW4CommandPermissionLevel@@@Z",
|
||||
Player, CommandPermissionLevel perm) {
|
||||
if (LL::globalConfig.enableSimpleServerLogger) {
|
||||
if (ll::globalConfig.enableSimpleServerLogger) {
|
||||
static Logger logger("Permissions");
|
||||
logger.info("<{}> {}({}) -> {}({})",
|
||||
getRealName(), magic_enum::enum_name(getCommandPermissionLevel()), (int)getCommandPermissionLevel(), magic_enum::enum_name(perm), (int)perm);
|
||||
|
@ -133,7 +133,7 @@ inline void OutputError(std::string errorMsg, int errorCode, std::string errorWh
|
||||
logger.error("Error: Code [{}] {}", errorCode, errorWhat);
|
||||
logger.error("In Event ({})", eventName);
|
||||
if (!pluginName.empty()) {
|
||||
auto plugin = LL::getPlugin(pluginName);
|
||||
auto plugin = ll::getPlugin(pluginName);
|
||||
if (plugin) {
|
||||
logger.error("In Plugin <{} {}>", plugin->name, plugin->version.toString());
|
||||
} else {
|
||||
@ -1071,7 +1071,7 @@ TInstanceHook(bool, "?canOpenContainerScreen@Player@@UEAA_NXZ", Player) {
|
||||
return rtn;
|
||||
}
|
||||
|
||||
if (LL::isDebugMode() && LL::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
if (ll::isDebugMode() && ll::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
logger.warn("The thread executing the command \"{}\" is not the \"MC_SERVER\" thread", cmd);
|
||||
}
|
||||
if (sp) {
|
||||
@ -1996,14 +1996,14 @@ TClasslessInstanceHook(void, "?onScoreChanged@ServerScoreboard@@UEAAXAEBUScorebo
|
||||
// 没有这个符号
|
||||
TClasslessInstanceHook(void, "?onServerThreadStarted@MinecraftServerScriptEngine@@UEAA?AW4EventResult@@AEAVServerInstance@@@Z",
|
||||
class ServerInstance& ins) {
|
||||
if(!LL::isDebugMode())
|
||||
if(!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
|
||||
LL::globalConfig.tickThreadId = std::this_thread::get_id();
|
||||
ll::globalConfig.tickThreadId = std::this_thread::get_id();
|
||||
Global<Level> = Global<Minecraft>->getLevel();
|
||||
Global<ServerLevel> = (ServerLevel*)Global<Minecraft>->getLevel();
|
||||
// Global<ServerNetworkHandler> = Global<Minecraft>->getServerNetworkHandler();
|
||||
LL::globalConfig.serverStatus = LL::LLServerStatus::Running;
|
||||
ll::globalConfig.serverStatus = ll::LLServerStatus::Running;
|
||||
|
||||
IF_LISTENED(ServerStartedEvent) {
|
||||
ServerStartedEvent ev{};
|
||||
@ -2016,7 +2016,7 @@ TClasslessInstanceHook(void, "?onScoreChanged@ServerScoreboard@@UEAAXAEBUScorebo
|
||||
|
||||
////////////// ServerStopped //////////////
|
||||
TClasslessInstanceHook(void, "??1DedicatedServer@@UEAA@XZ") {
|
||||
LL::globalConfig.serverStatus = LL::LLServerStatus::Stopping;
|
||||
ll::globalConfig.serverStatus = ll::LLServerStatus::Stopping;
|
||||
|
||||
IF_LISTENED(ServerStoppedEvent) {
|
||||
ServerStoppedEvent ev{};
|
||||
@ -2027,7 +2027,7 @@ TClasslessInstanceHook(void, "??1DedicatedServer@@UEAA@XZ") {
|
||||
}
|
||||
TClasslessInstanceHook(void, "?execute@StopCommand@@UEBAXAEBVCommandOrigin@@AEAVCommandOutput@@@Z",
|
||||
class CommandOrigin const& origin, class CommandOutput& output) {
|
||||
LL::globalConfig.serverStatus = LL::LLServerStatus::Stopping;
|
||||
ll::globalConfig.serverStatus = ll::LLServerStatus::Stopping;
|
||||
original(this, origin, output);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
std::string LL::getDataPath(const std::string& pluginName) {
|
||||
std::string ll::getDataPath(const std::string& pluginName) {
|
||||
string dataPath = "plugins\\LiteLoader\\" + pluginName;
|
||||
if (!filesystem::exists(str2wstr(dataPath))) {
|
||||
std::error_code ec;
|
||||
@ -19,53 +19,53 @@ std::string LL::getDataPath(const std::string& pluginName) {
|
||||
return dataPath;
|
||||
}
|
||||
|
||||
std::string LL::getLoaderVersionString() {
|
||||
std::string ll::getLoaderVersionString() {
|
||||
return getLoaderVersion().toString();
|
||||
}
|
||||
|
||||
LL::Version LL::getLoaderVersion() {
|
||||
return Version(LITELOADER_VERSION_MAJOR, LITELOADER_VERSION_MINOR, LITELOADER_VERSION_REVISION, (LL::Version::Status)LITELOADER_VERSION_STATUS);
|
||||
ll::Version ll::getLoaderVersion() {
|
||||
return Version(LITELOADER_VERSION_MAJOR, LITELOADER_VERSION_MINOR, LITELOADER_VERSION_REVISION, (ll::Version::Status)LITELOADER_VERSION_STATUS);
|
||||
}
|
||||
|
||||
bool LL::isDebugMode() {
|
||||
return LL::globalConfig.debugMode;
|
||||
bool ll::isDebugMode() {
|
||||
return ll::globalConfig.debugMode;
|
||||
}
|
||||
|
||||
LL::Plugin* LL::getPlugin(std::string name) {
|
||||
ll::Plugin* ll::getPlugin(std::string name) {
|
||||
return PluginManager::getPlugin(name);
|
||||
}
|
||||
|
||||
LL::Plugin* LL::getPlugin(HMODULE handle) {
|
||||
ll::Plugin* ll::getPlugin(HMODULE handle) {
|
||||
return PluginManager::getPlugin(handle);
|
||||
}
|
||||
|
||||
bool LL::hasPlugin(std::string name) {
|
||||
bool ll::hasPlugin(std::string name) {
|
||||
return PluginManager::hasPlugin(name);
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, LL::Plugin*> LL::getAllPlugins() {
|
||||
std::unordered_map<std::string, ll::Plugin*> ll::getAllPlugins() {
|
||||
return PluginManager::getAllPlugins();
|
||||
}
|
||||
|
||||
HMODULE LL::getLoaderHandle() {
|
||||
HMODULE ll::getLoaderHandle() {
|
||||
return GetCurrentModule();
|
||||
}
|
||||
|
||||
// Version
|
||||
LL::Version::Version(int major, int minor, int revision, Status status)
|
||||
ll::Version::Version(int major, int minor, int revision, Status status)
|
||||
: major(major), minor(minor), revision(revision), status(status) {
|
||||
}
|
||||
|
||||
bool LL::Version::operator<(LL::Version b) {
|
||||
bool ll::Version::operator<(ll::Version b) {
|
||||
return major < b.major || (major == b.major && minor < b.minor) ||
|
||||
(major == b.major && minor == b.minor && revision < b.revision);
|
||||
}
|
||||
|
||||
bool LL::Version::operator==(LL::Version b) {
|
||||
bool ll::Version::operator==(ll::Version b) {
|
||||
return major == b.major && minor == b.minor && revision == b.revision;
|
||||
}
|
||||
|
||||
std::string LL::Version::toString(bool needStatus) {
|
||||
std::string ll::Version::toString(bool needStatus) {
|
||||
string res = to_string(major) + "." + to_string(minor) + "." + to_string(revision);
|
||||
if (needStatus) {
|
||||
if (status == Status::Beta)
|
||||
@ -77,7 +77,7 @@ std::string LL::Version::toString(bool needStatus) {
|
||||
}
|
||||
|
||||
|
||||
LL::Version LL::Version::parse(const std::string& str) {
|
||||
ll::Version ll::Version::parse(const std::string& str) {
|
||||
Version ver;
|
||||
std::string a = str;
|
||||
std::string status;
|
||||
@ -106,18 +106,18 @@ LL::Version LL::Version::parse(const std::string& str) {
|
||||
return ver;
|
||||
}
|
||||
|
||||
LL::ServerStatus LL::getServerStatus() {
|
||||
return (LL::ServerStatus)(LL::globalConfig.serverStatus);
|
||||
ll::ServerStatus ll::getServerStatus() {
|
||||
return (ll::ServerStatus)(ll::globalConfig.serverStatus);
|
||||
}
|
||||
|
||||
bool LL::isServerStarting() {
|
||||
return getServerStatus() == LL::ServerStatus::Starting;
|
||||
bool ll::isServerStarting() {
|
||||
return getServerStatus() == ll::ServerStatus::Starting;
|
||||
}
|
||||
|
||||
bool LL::isServerStopping() {
|
||||
return getServerStatus() == LL::ServerStatus::Stopping;
|
||||
bool ll::isServerStopping() {
|
||||
return getServerStatus() == ll::ServerStatus::Stopping;
|
||||
}
|
||||
|
||||
std::string LL::getLanguage() {
|
||||
return LL::globalConfig.language;
|
||||
std::string ll::getLanguage() {
|
||||
return ll::globalConfig.language;
|
||||
}
|
@ -88,13 +88,13 @@ Logger::OutputStream::OutputStream(Logger* logger, int level, std::string&& cons
|
||||
bool checkLogLevel(int level, int outLevel) {
|
||||
if (level >= outLevel)
|
||||
return true;
|
||||
if (level == -1 && LL::globalConfig.logLevel >= outLevel)
|
||||
if (level == -1 && ll::globalConfig.logLevel >= outLevel)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
#define H do_hash
|
||||
fmt::text_style getModeColor(string a1) {
|
||||
if (!LL::globalConfig.colorLog)
|
||||
if (!ll::globalConfig.colorLog)
|
||||
return fmt::text_style();
|
||||
switch (H(a1.c_str())) {
|
||||
case H("INFO"):
|
||||
@ -148,8 +148,8 @@ void Logger::endlImpl(HMODULE hPlugin, OutputStream& o) {
|
||||
auto text = o.os.str();
|
||||
bool filterBanned = false;
|
||||
// Output Filter
|
||||
if (LL::globalConfig.enableOutputFilter)
|
||||
for (auto& regexStr : LL::globalConfig.outputFilterRegex) {
|
||||
if (ll::globalConfig.enableOutputFilter)
|
||||
for (auto& regexStr : ll::globalConfig.outputFilterRegex) {
|
||||
try {
|
||||
std::regex re(regexStr);
|
||||
if (std::regex_search(text, re) || std::regex_search(title, re)) {
|
||||
@ -162,14 +162,14 @@ void Logger::endlImpl(HMODULE hPlugin, OutputStream& o) {
|
||||
if (checkLogLevel(o.logger->consoleLevel, o.level) && !filterBanned) {
|
||||
fmt::print(
|
||||
o.consoleFormat,
|
||||
applyTextStyle(LL::globalConfig.colorLog ? fg(fmt::color::light_blue) : fmt::text_style(),
|
||||
applyTextStyle(ll::globalConfig.colorLog ? fg(fmt::color::light_blue) : fmt::text_style(),
|
||||
fmt::format("{:%H:%M:%S}", fmt::localtime(_time64(nullptr)))),
|
||||
applyTextStyle(getModeColor(o.levelPrefix), o.levelPrefix),
|
||||
applyTextStyle(LL::globalConfig.colorLog ? o.style : fmt::text_style(), title),
|
||||
applyTextStyle(LL::globalConfig.colorLog ? o.style : fmt::text_style(), text));
|
||||
applyTextStyle(ll::globalConfig.colorLog ? o.style : fmt::text_style(), title),
|
||||
applyTextStyle(ll::globalConfig.colorLog ? o.style : fmt::text_style(), text));
|
||||
}
|
||||
|
||||
if (checkLogLevel(o.logger->fileLevel, o.level) && (LL::globalConfig.onlyFilterConsoleOutput || !filterBanned)) {
|
||||
if (checkLogLevel(o.logger->fileLevel, o.level) && (ll::globalConfig.onlyFilterConsoleOutput || !filterBanned)) {
|
||||
if (o.logger->ofs.is_open() || PluginOwnData::hasImpl(hPlugin, LOGGER_CURRENT_FILE)) {
|
||||
auto fileContent = fmt::format(o.fileFormat, fmt::localtime(_time64(nullptr)), o.levelPrefix, title, text);
|
||||
if (o.logger->ofs.is_open())
|
||||
@ -180,7 +180,7 @@ void Logger::endlImpl(HMODULE hPlugin, OutputStream& o) {
|
||||
}
|
||||
}
|
||||
|
||||
if (checkLogLevel(o.logger->playerLevel, o.level) && o.logger->player && Player::isValid(o.logger->player) && (LL::globalConfig.onlyFilterConsoleOutput || !filterBanned)) {
|
||||
if (checkLogLevel(o.logger->playerLevel, o.level) && o.logger->player && Player::isValid(o.logger->player) && (ll::globalConfig.onlyFilterConsoleOutput || !filterBanned)) {
|
||||
o.logger->player->sendTextPacket(
|
||||
fmt::format(o.playerFormat, fmt::localtime(_time64(nullptr)), o.levelPrefix, title, text));
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ bool removeFunc(std::string const& nameSpace, std::string const& funcName) {
|
||||
|
||||
void _onCallError(std::string const& msg, HMODULE handle) {
|
||||
logger.error(msg);
|
||||
auto plugin = LL::getPlugin(handle);
|
||||
auto plugin = ll::getPlugin(handle);
|
||||
if (plugin)
|
||||
logger.error("In plugin <{}>", plugin->name);
|
||||
}
|
||||
|
@ -147,18 +147,18 @@ public:
|
||||
logger.error("SEH exception occurred in ScheduleTask!");
|
||||
logger.error("{}", TextEncoding::toUTF8(e.what()));
|
||||
logger.error("TaskId: {}", t.taskId);
|
||||
if (auto plugin = LL::getPlugin(t.handle))
|
||||
if (auto plugin = ll::getPlugin(t.handle))
|
||||
logger.error("In Plugin: <{} {}>", plugin->name, plugin->version.toString());
|
||||
} catch (const std::exception& e) {
|
||||
logger.error("Exception occurred in ScheduleTask!");
|
||||
logger.error("{}", TextEncoding::toUTF8(e.what()));
|
||||
logger.error("TaskId: {}", t.taskId);
|
||||
if (auto plugin = LL::getPlugin(t.handle))
|
||||
if (auto plugin = ll::getPlugin(t.handle))
|
||||
logger.error("In Plugin: <{} {}>", plugin->name, plugin->version.toString());
|
||||
} catch (...) {
|
||||
logger.error("Exception occurred in ScheduleTask!");
|
||||
logger.error("TaskId: {}", t.taskId);
|
||||
if (auto plugin = LL::getPlugin(t.handle))
|
||||
if (auto plugin = ll::getPlugin(t.handle))
|
||||
logger.error("In Plugin: <{} {}>", plugin->name, plugin->version.toString());
|
||||
}
|
||||
pop();
|
||||
@ -181,7 +181,7 @@ ScheduleTaskQueueType taskQueue;
|
||||
|
||||
namespace Schedule {
|
||||
ScheduleTask delay(std::function<void(void)> task, unsigned long long tickDelay, HMODULE handle) {
|
||||
if (LL::globalConfig.serverStatus >= LL::LLServerStatus::Stopping)
|
||||
if (ll::globalConfig.serverStatus >= ll::LLServerStatus::Stopping)
|
||||
return ScheduleTask((unsigned)-1);
|
||||
ScheduleTaskData sche(ScheduleTaskData::TaskType::Delay, task, tickDelay, -1, -1, handle);
|
||||
locker.lock();
|
||||
@ -191,7 +191,7 @@ ScheduleTask delay(std::function<void(void)> task, unsigned long long tickDelay,
|
||||
}
|
||||
|
||||
ScheduleTask repeat(std::function<void(void)> task, unsigned long long tickRepeat, int maxCount, HMODULE handle) {
|
||||
if (LL::globalConfig.serverStatus >= LL::LLServerStatus::Stopping)
|
||||
if (ll::globalConfig.serverStatus >= ll::LLServerStatus::Stopping)
|
||||
return ScheduleTask((unsigned)-1);
|
||||
ScheduleTaskData::TaskType type = maxCount < 0 ? ScheduleTaskData::TaskType::InfiniteRepeat
|
||||
: ScheduleTaskData::TaskType::Repeat;
|
||||
@ -204,7 +204,7 @@ ScheduleTask repeat(std::function<void(void)> task, unsigned long long tickRepea
|
||||
|
||||
ScheduleTask delayRepeat(std::function<void(void)> task, unsigned long long tickDelay,
|
||||
unsigned long long tickRepeat, int maxCount, HMODULE handle) {
|
||||
if (LL::globalConfig.serverStatus >= LL::LLServerStatus::Stopping)
|
||||
if (ll::globalConfig.serverStatus >= ll::LLServerStatus::Stopping)
|
||||
return ScheduleTask((unsigned)-1);
|
||||
ScheduleTaskData::TaskType type = maxCount < 0 ? ScheduleTaskData::TaskType::InfiniteRepeat
|
||||
: ScheduleTaskData::TaskType::Repeat;
|
||||
@ -216,7 +216,7 @@ ScheduleTask delayRepeat(std::function<void(void)> task, unsigned long long tick
|
||||
}
|
||||
|
||||
ScheduleTask nextTick(std::function<void(void)> task, HMODULE handle) {
|
||||
if (LL::globalConfig.serverStatus >= LL::LLServerStatus::Stopping)
|
||||
if (ll::globalConfig.serverStatus >= ll::LLServerStatus::Stopping)
|
||||
return ScheduleTask((unsigned)-1);
|
||||
ScheduleTaskData sche(ScheduleTaskData::TaskType::Delay, task, 1, -1, -1, handle);
|
||||
locker.lock();
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
class UserEntityIdentifierComponent;
|
||||
|
||||
namespace LL {
|
||||
namespace ll {
|
||||
std::string getBdsVersion() {
|
||||
return Common::getGameVersionString();
|
||||
}
|
||||
@ -22,4 +22,4 @@ bool setServerMotd(const std::string& motd) {
|
||||
Global<ServerNetworkHandler>->allowIncomingConnections(motd, true);
|
||||
return true;
|
||||
}
|
||||
} // namespace LL
|
||||
} // namespace ll
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
#include <liteloader/Config.h>
|
||||
bool CommandRegistry::unregisterCommand(std::string const& name) {
|
||||
if (!LL::globalConfig.debugMode) {
|
||||
if (!ll::globalConfig.debugMode) {
|
||||
logger.error("unregister command is only enabled in debug mode");
|
||||
return false;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@
|
||||
logger.error(errorMsg);
|
||||
logger.error("Error: Code [{}] {}", errorCode, errorWhat);
|
||||
logger.error("In Function ({})", func);
|
||||
if (auto plugin = LL::getPlugin(handle))
|
||||
if (auto plugin = ll::getPlugin(handle))
|
||||
logger.error("In Plugin <{}>", plugin->name);
|
||||
}
|
||||
|
||||
@ -537,7 +537,7 @@
|
||||
std::string name = command->getCommandName();
|
||||
auto handle = command->handle;
|
||||
try {
|
||||
if (!LL::getPlugin(handle) && handle != GetCurrentModule())
|
||||
if (!ll::getPlugin(handle) && handle != GetCurrentModule())
|
||||
throw std::runtime_error("Plugin that registered command \"" + name + "\" not found");
|
||||
auto res = DynamicCommand::_setup(std::move(command));
|
||||
if (!res)
|
||||
@ -698,7 +698,7 @@
|
||||
}
|
||||
|
||||
inline std::unique_ptr<DynamicCommandInstance> DynamicCommandInstance::create(std::string const& name, std::string const& description, CommandPermissionLevel permission, CommandFlag flag, HMODULE handle) {
|
||||
if (LL::globalConfig.serverStatus != LL::LLServerStatus::Running) {
|
||||
if (ll::globalConfig.serverStatus != ll::LLServerStatus::Running) {
|
||||
for (auto& cmd : delaySetupCommandInstances) {
|
||||
if (cmd->name == name) {
|
||||
logger.error("Command \"{}\" already exists", name);
|
||||
@ -1279,7 +1279,7 @@
|
||||
|
||||
TClasslessInstanceHook(void, "?compile@BaseCommandBlock@@AEAAXAEBVCommandOrigin@@AEAVLevel@@@Z",
|
||||
class CommandOrigin const& origin, class Level& level) {
|
||||
if (LL::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
if (ll::globalConfig.tickThreadId != std::this_thread::get_id()) {
|
||||
SRWLockSharedHolder locker(delaySetupLock);
|
||||
return original(this, origin, level);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ wstring MapModuleFromAddr(HANDLE hProcess, void* address) {
|
||||
|
||||
bool PrintCurrentStackTraceback(PEXCEPTION_POINTERS e, Logger* l) {
|
||||
Logger& debugLogger = l ? *l : logger;
|
||||
if (!LL::globalConfig.enableErrorStackTraceback) {
|
||||
if (!ll::globalConfig.enableErrorStackTraceback) {
|
||||
logger.error("* Stack traceback is disabled by config file.");
|
||||
return true;
|
||||
}
|
||||
@ -113,7 +113,7 @@ bool PrintCurrentStackTraceback(PEXCEPTION_POINTERS e, Logger* l) {
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
HANDLE hThread = GetCurrentThread();
|
||||
DWORD threadId = GetCurrentThreadId();
|
||||
bool cacheSymbol = LL::globalConfig.cacheErrorStackTracebackSymbol;
|
||||
bool cacheSymbol = ll::globalConfig.cacheErrorStackTracebackSymbol;
|
||||
bool res = false;
|
||||
|
||||
std::thread printThread([e, hProcess, hThread, threadId, cacheSymbol, &res, &debugLogger]() {
|
||||
|
@ -111,7 +111,7 @@ TInstanceHook(Scoreboard*, "??0ServerScoreboard@@QEAA@VCommandSoftEnumRegistry@@
|
||||
#include <llapi/mc/PropertiesSettings.hpp>
|
||||
TInstanceHook(size_t, "??0PropertiesSettings@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z", PropertiesSettings, const std::string& file) {
|
||||
auto out = original(this, file);
|
||||
// if (LL::globalConfig.enableUnoccupyPort19132) {
|
||||
// if (ll::globalConfig.enableUnoccupyPort19132) {
|
||||
// // logger.warn("If you turn on this feature, your server will not be displayed on the LAN");
|
||||
// DWORD v4Flag, v6Flag;
|
||||
// VirtualProtect((void*)&SharedConstants::NetworkDefaultGamePort, 4, PAGE_READWRITE, &v4Flag);
|
||||
|
@ -40,7 +40,7 @@ bool HttpGet(const string& url, const httplib::Headers& headers, const function<
|
||||
cli->set_connection_timeout(timeout, 0);
|
||||
|
||||
std::thread([cli, headers, callback, path{std::move(path)}]() {
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
try {
|
||||
auto response = cli->Get(path.c_str(), headers);
|
||||
@ -86,7 +86,7 @@ bool HttpPost(const string& url, const httplib::Headers& headers, const string&
|
||||
cli->set_connection_timeout(timeout, 0);
|
||||
|
||||
std::thread([cli, headers, data, type, callback, path{std::move(path)}]() {
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
try {
|
||||
auto response = cli->Post(path.c_str(), headers, data, type.c_str());
|
||||
|
@ -73,7 +73,7 @@ bool NewProcess(const std::string& process, std::function<void(int, std::string)
|
||||
|
||||
std::thread([hRead{hRead}, hProcess{pi.hProcess},
|
||||
callback{std::move(callback)}, timeLimit{timeLimit}, wCmd{wCmd}]() {
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
if (timeLimit == -1)
|
||||
WaitForSingleObject(hProcess, INFINITE);
|
||||
|
@ -244,14 +244,14 @@ Local<Value> McClass::newFloatPos(const Arguments& args) {
|
||||
|
||||
Local<Value> McClass::getBDSVersion(const Arguments& args) {
|
||||
try {
|
||||
return String::newString(LL::getBdsVersion());
|
||||
return String::newString(ll::getBdsVersion());
|
||||
}
|
||||
CATCH("Fail in GetBDSVersion!")
|
||||
}
|
||||
|
||||
Local<Value> McClass::getServerProtocolVersion(const Arguments& args) {
|
||||
try {
|
||||
return Number::newNumber(LL::getServerProtocolVersion());
|
||||
return Number::newNumber(ll::getServerProtocolVersion());
|
||||
}
|
||||
CATCH("Fail in GetServerProtocolVersion!")
|
||||
}
|
@ -1141,7 +1141,7 @@ void InitBasicEventListeners() {
|
||||
|
||||
// Plugin Hot Management
|
||||
Event::ScriptPluginManagerEvent::subscribe_ref([](ScriptPluginManagerEvent& ev) {
|
||||
// if (!LL::isDebugMode())
|
||||
// if (!ll::isDebugMode())
|
||||
// return false;
|
||||
|
||||
switch (ev.operation) {
|
||||
|
@ -233,7 +233,7 @@ Local<Value> FileClass::read(const Arguments& args) {
|
||||
|
||||
pool.enqueue([cnt, fp{&file}, isBinary{isBinary}, lock{&lock},
|
||||
callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -267,7 +267,7 @@ Local<Value> FileClass::readLine(const Arguments& args) {
|
||||
|
||||
pool.enqueue([fp{&file}, lock{&lock},
|
||||
callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -297,7 +297,7 @@ Local<Value> FileClass::readAll(const Arguments& args) {
|
||||
|
||||
pool.enqueue([fp{&file}, isBinary{isBinary}, lock{&lock},
|
||||
callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -342,7 +342,7 @@ Local<Value> FileClass::write(const Arguments& args) {
|
||||
|
||||
pool.enqueue([fp{&file}, lock{&lock}, data{std::move(data)}, isString,
|
||||
callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -383,7 +383,7 @@ Local<Value> FileClass::writeLine(const Arguments& args) {
|
||||
|
||||
pool.enqueue([fp{&file}, lock{&lock}, data{std::move(data)},
|
||||
callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
|
@ -58,7 +58,7 @@ bool SimpleFormClass::sendForm(Form::SimpleForm* form, Player* player, script::L
|
||||
|
||||
return form->sendTo(player,
|
||||
[engine{EngineScope::currentEngine()}, callback{std::move(callbackFunc)}](Player* pl, int chosen) {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -140,7 +140,7 @@ bool CustomFormClass::sendForm(Form::CustomForm* form, Player* player, script::L
|
||||
|
||||
return form->sendToForRawJson(player,
|
||||
[engine{EngineScope::currentEngine()}, callback{std::move(callbackFunc)}](Player* pl, string data) {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
|
@ -54,7 +54,7 @@ Local<Value> LlClass::registerPlugin(const Arguments& args) {
|
||||
string name = args[0].toStr();
|
||||
string desc = args.size() >= 2 ? args[1].toStr() : "";
|
||||
|
||||
LL::Version ver = LL::Version(1, 0, 0);
|
||||
ll::Version ver = ll::Version(1, 0, 0);
|
||||
if (args.size() >= 3) {
|
||||
if (args[2].isArray()) {
|
||||
Local<Array> verInfo = args[2].asArray();
|
||||
@ -118,7 +118,7 @@ Local<Value> LlClass::getPluginInfo(const Arguments& args) {
|
||||
|
||||
try {
|
||||
std::string name = args[0].toStr();
|
||||
auto plugin = LL::getPlugin(name);
|
||||
auto plugin = ll::getPlugin(name);
|
||||
if (plugin) {
|
||||
auto result = Object::newObject();
|
||||
|
||||
@ -150,11 +150,11 @@ Local<Value> LlClass::getVersionStatus(const Arguments& args) {
|
||||
try {
|
||||
int versionStatusValue;
|
||||
|
||||
if (LITELOADER_VERSION_STATUS == LL::Version::Status::Release) {
|
||||
if (LITELOADER_VERSION_STATUS == ll::Version::Status::Release) {
|
||||
versionStatusValue = 0;
|
||||
} else if (LITELOADER_VERSION_STATUS == LL::Version::Status::Beta) {
|
||||
} else if (LITELOADER_VERSION_STATUS == ll::Version::Status::Beta) {
|
||||
versionStatusValue = 1;
|
||||
} else if (LITELOADER_VERSION_STATUS == LL::Version::Status::Dev) {
|
||||
} else if (LITELOADER_VERSION_STATUS == ll::Version::Status::Dev) {
|
||||
versionStatusValue = 2;
|
||||
}
|
||||
|
||||
@ -169,9 +169,9 @@ Local<Value> LlClass::version(const Arguments& args) {
|
||||
ver.set("major", LITELOADER_VERSION_MAJOR);
|
||||
ver.set("minor", LITELOADER_VERSION_MINOR);
|
||||
ver.set("revision", LITELOADER_VERSION_REVISION);
|
||||
ver.set("isBeta", LITELOADER_VERSION_STATUS == LL::Version::Status::Beta);
|
||||
ver.set("isRelease", LITELOADER_VERSION_STATUS == LL::Version::Status::Release);
|
||||
ver.set("isDev", LITELOADER_VERSION_STATUS == LL::Version::Status::Dev);
|
||||
ver.set("isBeta", LITELOADER_VERSION_STATUS == ll::Version::Status::Beta);
|
||||
ver.set("isRelease", LITELOADER_VERSION_STATUS == ll::Version::Status::Release);
|
||||
ver.set("isDev", LITELOADER_VERSION_STATUS == ll::Version::Status::Dev);
|
||||
return ver;
|
||||
}
|
||||
CATCH("Fail in LLSEGetVersion!")
|
||||
@ -179,21 +179,21 @@ Local<Value> LlClass::version(const Arguments& args) {
|
||||
|
||||
Local<Value> LlClass::getLanguage() {
|
||||
try {
|
||||
return String::newString(PluginOwnData::getImpl<I18nBase>(LL::getLoaderHandle(), I18nBase::POD_KEY).defaultLocaleName);
|
||||
return String::newString(PluginOwnData::getImpl<I18nBase>(ll::getLoaderHandle(), I18nBase::POD_KEY).defaultLocaleName);
|
||||
}
|
||||
CATCH("Fail in LLSEGetLanguage")
|
||||
}
|
||||
|
||||
Local<Value> LlClass::isDebugMode(const Arguments& args) {
|
||||
try {
|
||||
return Boolean::newBoolean(LL::isDebugMode());
|
||||
return Boolean::newBoolean(ll::isDebugMode());
|
||||
}
|
||||
CATCH("Fail in LLSEGetIsDebugMode")
|
||||
}
|
||||
|
||||
Local<Value> LlClass::versionString(const Arguments& args) {
|
||||
try {
|
||||
return String::newString(LL::getLoaderVersionString());
|
||||
return String::newString(ll::getLoaderVersionString());
|
||||
}
|
||||
CATCH("Fail in LLSEGetVersionString!")
|
||||
}
|
||||
|
@ -153,10 +153,10 @@ void WSClientClass::initListeners() {
|
||||
|
||||
void WSClientClass::initListeners_s() {
|
||||
ws->OnTextReceived([nowList{&listeners[int(WSClientEvents::onTextReceived)]}, engine = EngineScope::currentEngine()](WebSocketClient& client, string msg) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
Schedule::nextTick([nowList, engine, msg = std::move(msg)]() {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
if (!nowList->empty())
|
||||
@ -167,10 +167,10 @@ void WSClientClass::initListeners_s() {
|
||||
});
|
||||
|
||||
ws->OnBinaryReceived([nowList{&listeners[int(WSClientEvents::onBinaryReceived)]}, engine = EngineScope::currentEngine()](WebSocketClient& client, vector<uint8_t> data) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
Schedule::nextTick([nowList, engine, data = std::move(data)]() mutable {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
if (!nowList->empty())
|
||||
@ -181,10 +181,10 @@ void WSClientClass::initListeners_s() {
|
||||
});
|
||||
|
||||
ws->OnError([nowList{&listeners[int(WSClientEvents::onError)]}, engine = EngineScope::currentEngine()](WebSocketClient& client, string msg) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
Schedule::nextTick([nowList, engine, msg = std::move(msg)]() {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
if (!nowList->empty())
|
||||
@ -195,10 +195,10 @@ void WSClientClass::initListeners_s() {
|
||||
});
|
||||
|
||||
ws->OnLostConnection([nowList{&listeners[int(WSClientEvents::onLostConnection)]}, engine = EngineScope::currentEngine()](WebSocketClient& client, int code) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
Schedule::nextTick([nowList, engine, code]() {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
if (!nowList->empty())
|
||||
@ -277,7 +277,7 @@ Local<Value> WSClientClass::connectAsync(const Arguments& args) {
|
||||
#ifdef DEBUG
|
||||
SetThreadDescription(GetCurrentThread(), L"LLSE Connect WebSocket");
|
||||
#endif // DEBUG
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
try {
|
||||
bool result = false;
|
||||
@ -287,7 +287,7 @@ Local<Value> WSClientClass::connectAsync(const Arguments& args) {
|
||||
} catch (const std::runtime_error& e) {
|
||||
result = false;
|
||||
}
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
// fix get on empty Global
|
||||
@ -381,10 +381,10 @@ using namespace httplib;
|
||||
#define ADD_CALLBACK(method, path, func) \
|
||||
callbacks.emplace(make_pair(path, HttpServerCallback{EngineScope::currentEngine(), script::Global<Function>{func}, HttpRequestType::method, path})); \
|
||||
svr->##method##(path.c_str(), [this, engine = EngineScope::currentEngine()](const Request& req, Response& resp) { \
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying()) \
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying()) \
|
||||
return; \
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp] { \
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying()) \
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying()) \
|
||||
return; \
|
||||
EngineScope enter(engine); \
|
||||
for (auto& [k, v] : this->callbacks) { \
|
||||
@ -436,10 +436,10 @@ Local<Value> HttpServerClass::onGet(const Arguments& args) {
|
||||
/* for debug
|
||||
callbacks.emplace(make_pair(path, HttpServerCallback{EngineScope::currentEngine(), script::Global<Function>{func}, HttpRequestType::Get, path}));
|
||||
svr->Get(path.c_str(), [this, engine = EngineScope::currentEngine()](const Request& req, Response& resp) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp] {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
for (auto& [k, v] : this->callbacks)
|
||||
@ -547,11 +547,11 @@ Local<Value> HttpServerClass::onPreRouting(const Arguments& args) {
|
||||
try {
|
||||
preRoutingCallback = {EngineScope::currentEngine(), script::Global{args[0].asFunction()}};
|
||||
svr->set_pre_routing_handler([this, engine = EngineScope::currentEngine()](const Request& req, Response& resp) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return Server::HandlerResponse::Unhandled;
|
||||
bool handled = false;
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp, &handled] {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
auto reqObj = new HttpRequestClass(req);
|
||||
@ -578,10 +578,10 @@ Local<Value> HttpServerClass::onPostRouting(const Arguments& args) {
|
||||
try {
|
||||
postRoutingCallback = {EngineScope::currentEngine(), script::Global{args[0].asFunction()}};
|
||||
svr->set_post_routing_handler([this, engine = EngineScope::currentEngine()](const Request& req, Response& resp) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp] {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
auto reqObj = new HttpRequestClass(req);
|
||||
@ -604,10 +604,10 @@ Local<Value> HttpServerClass::onError(const Arguments& args) {
|
||||
try {
|
||||
errorCallback = {EngineScope::currentEngine(), script::Global{args[0].asFunction()}};
|
||||
svr->set_error_handler([this, engine = EngineScope::currentEngine()](const Request& req, Response& resp) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp] {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
auto reqObj = new HttpRequestClass(req);
|
||||
@ -630,10 +630,10 @@ Local<Value> HttpServerClass::onException(const Arguments& args) {
|
||||
try {
|
||||
exceptionCallback = {EngineScope::currentEngine(), script::Global{args[0].asFunction()}};
|
||||
svr->set_exception_handler([this, engine = EngineScope::currentEngine()](const Request& req, Response& resp, std::exception_ptr e) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
auto task = Schedule::nextTick([this, engine, req, &resp, e] {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
EngineScope enter(engine);
|
||||
auto reqObj = new HttpRequestClass(req);
|
||||
@ -1009,7 +1009,7 @@ Local<Value> NetworkClass::httpGet(const Arguments& args) {
|
||||
script::Global<Function> callbackFunc{args[args.size() - 1].asFunction()};
|
||||
|
||||
auto lambda = [callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}](int status, string body) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
|
||||
EngineScope scope(engine);
|
||||
@ -1055,7 +1055,7 @@ Local<Value> NetworkClass::httpPost(const Arguments& args) {
|
||||
script::Global<Function> callbackFunc{args[args.size() - 1].asFunction()};
|
||||
|
||||
auto lambda = [callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}](int status, string body) {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return;
|
||||
|
||||
EngineScope scope(engine);
|
||||
|
@ -1752,7 +1752,7 @@ Local<Value> PlayerClass::sendSimpleForm(const Arguments& args) {
|
||||
player->sendSimpleFormPacket(args[0].toStr(), args[1].toStr(), texts, images,
|
||||
[id{player->getUniqueID()}, engine{EngineScope::currentEngine()},
|
||||
callback{script::Global(args[4].asFunction())}](int chosen) {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -1790,7 +1790,7 @@ Local<Value> PlayerClass::sendModalForm(const Arguments& args) {
|
||||
player->sendModalFormPacket(args[0].toStr(), args[1].toStr(), args[2].toStr(), args[3].toStr(),
|
||||
[id{player->getUniqueID()}, engine{EngineScope::currentEngine()},
|
||||
callback{script::Global(args[4].asFunction())}](bool chosen) {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -1827,7 +1827,7 @@ Local<Value> PlayerClass::sendCustomForm(const Arguments& args) {
|
||||
player->sendCustomFormPacket(data,
|
||||
[id{player->getUniqueID()}, engine{EngineScope::currentEngine()},
|
||||
callback{script::Global(args[1].asFunction())}](string result) {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
|
@ -233,7 +233,7 @@ bool LLSEExportFunc(ScriptEngine* engine, const Local<Function>& func, const str
|
||||
// script::Global<Function> callback = script::Global<Function>(func);
|
||||
std::string identifier = nameSpace + "::" + funcName;
|
||||
RemoteCall::CallbackFn cb = [engine, identifier /*, scriptCallback = std::move(callback)*/](std::vector<RemoteCall::ValueType> params) -> RemoteCall::ValueType {
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return "";
|
||||
EngineScope enter(engine);
|
||||
try {
|
||||
|
@ -85,7 +85,7 @@ Local<Value> ColorLog(const Arguments& args) {
|
||||
LOG_ERROR_WITH_SCRIPT_INFO("Invalid color!");
|
||||
break;
|
||||
}
|
||||
// if (!LL::globalConfig.colorLog)
|
||||
// if (!ll::globalConfig.colorLog)
|
||||
// prefix = "";
|
||||
auto& infoOut = ENGINE_OWN_DATA()->logger.info;
|
||||
infoOut << prefix;
|
||||
|
@ -11,14 +11,14 @@ Local<Value> McClass::setMotd(const Arguments& args) {
|
||||
CHECK_ARG_TYPE(args[0], ValueKind::kString)
|
||||
|
||||
try {
|
||||
return Boolean::newBoolean(LL::setServerMotd(args[0].asString().toString()));
|
||||
return Boolean::newBoolean(ll::setServerMotd(args[0].asString().toString()));
|
||||
}
|
||||
CATCH("Fail in SetServerMotd!")
|
||||
}
|
||||
|
||||
Local<Value> McClass::crashBDS(const Arguments& args) //===========???
|
||||
{
|
||||
if (LL::isDebugMode()) {
|
||||
if (ll::isDebugMode()) {
|
||||
RecordOperation(ENGINE_OWN_DATA()->pluginName, "Crash Server", "Execute mc.crash() to crash server.");
|
||||
throw;
|
||||
return Boolean::newBoolean(true);
|
||||
|
@ -40,7 +40,7 @@ Local<Value> SystemClass::cmd(const Arguments& args) {
|
||||
[callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}](int exitCode, string output) {
|
||||
Schedule::nextTick(
|
||||
[engine, callback = std::move(callback), exitCode, output = std::move(output)]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -75,7 +75,7 @@ Local<Value> SystemClass::newProcess(const Arguments& args) {
|
||||
[callback{std::move(callbackFunc)}, engine{EngineScope::currentEngine()}](int exitCode, string output) {
|
||||
Schedule::nextTick(
|
||||
[engine, callback = std::move(callback), exitCode, output = std::move(output)]() {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
|
@ -315,16 +315,16 @@ void InitMessageSystem() {
|
||||
SetThreadDescription(GetCurrentThread(), L"LLSE MessageSystem " _CRT_WIDE(LLSE_MODULE_TYPE));
|
||||
#endif // DEBUG
|
||||
// Set global SEH-Exception handler
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
|
||||
globalShareData->messageThreads[LLSE_BACKEND_TYPE] = GetCurrentThread();
|
||||
while (true) {
|
||||
MessageSystemLoopOnce();
|
||||
if (LL::getServerStatus() >= LL::ServerStatus::Stopping)
|
||||
if (ll::getServerStatus() >= ll::ServerStatus::Stopping)
|
||||
return;
|
||||
SleepEx(5, true);
|
||||
if (LL::getServerStatus() >= LL::ServerStatus::Stopping)
|
||||
if (ll::getServerStatus() >= ll::ServerStatus::Stopping)
|
||||
return;
|
||||
}
|
||||
}).detach();
|
||||
|
@ -129,7 +129,7 @@ bool LLSEExportFunc(ScriptEngine *engine, const Local<Function> &func, const str
|
||||
return "";
|
||||
}
|
||||
auto engine = data->second.engine;
|
||||
if (LL::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
if (ll::isServerStopping() || !EngineManager::isValid(engine) || engine->isDestroying())
|
||||
return "";
|
||||
EngineScope enter(data->second.engine);
|
||||
std::vector<script::Local<Value>> scriptParams;
|
||||
|
@ -65,7 +65,7 @@ std::unordered_map<int, TimeTaskData> timeTaskMap;
|
||||
// }
|
||||
// Schedule::delay(
|
||||
// [engine, func = std::move(func), paras = std::move(tmp)]() {
|
||||
// if (LL::isServerStopping())
|
||||
// if (ll::isServerStopping())
|
||||
// return;
|
||||
// if (!EngineManager::isValid(engine))
|
||||
// return;
|
||||
@ -100,7 +100,7 @@ int NewTimeout(Local<Function> func, vector<Local<Value>> paras, int timeout) {
|
||||
data.task = Schedule::delay(
|
||||
[engine{EngineScope::currentEngine()}, id{tid}]() {
|
||||
try {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -150,7 +150,7 @@ int NewTimeout(Local<String> func, int timeout) {
|
||||
data.task = Schedule::delay(
|
||||
[engine{EngineScope::currentEngine()}, id{tid}]() {
|
||||
try {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine))
|
||||
return;
|
||||
@ -192,7 +192,7 @@ int NewInterval(Local<Function> func, vector<Local<Value>> paras, int timeout) {
|
||||
data.task = Schedule::repeat(
|
||||
[engine{EngineScope::currentEngine()}, id{tid}]() {
|
||||
try {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine)) {
|
||||
ClearTimeTask(id);
|
||||
@ -248,7 +248,7 @@ int NewInterval(Local<String> func, int timeout) {
|
||||
data.task = Schedule::repeat(
|
||||
[engine{EngineScope::currentEngine()}, id{tid}]() {
|
||||
try {
|
||||
if (LL::isServerStopping())
|
||||
if (ll::isServerStopping())
|
||||
return;
|
||||
if (!EngineManager::isValid(engine)) {
|
||||
ClearTimeTask(id);
|
||||
|
@ -39,7 +39,7 @@ struct dynamicSymbolsMap_type
|
||||
|
||||
bool EconomySystem::init()
|
||||
{
|
||||
auto llmoney = LL::getPlugin("LLMoney");
|
||||
auto llmoney = ll::getPlugin("LLMoney");
|
||||
if (!llmoney)
|
||||
{
|
||||
if (localShareData->isFirstInstance) {
|
||||
|
@ -150,11 +150,11 @@ bool loadPluginCode(script::ScriptEngine* engine, std::string entryScriptPath, s
|
||||
|
||||
// Start libuv event loop
|
||||
uvLoopTask[env] = Schedule::repeat([engine, env, isRunningMap{&isRunning}, eventLoop{it->second->event_loop()}]() {
|
||||
if (!LL::isServerStopping() && (*isRunningMap)[env]) {
|
||||
if (!ll::isServerStopping() && (*isRunningMap)[env]) {
|
||||
EngineScope enter(engine);
|
||||
uv_run(eventLoop, UV_RUN_NOWAIT);
|
||||
}
|
||||
if (LL::isServerStopping()) {
|
||||
if (ll::isServerStopping()) {
|
||||
uv_stop(eventLoop);
|
||||
logger.debug("Destroy ServerStopping");
|
||||
}
|
||||
@ -288,7 +288,7 @@ bool loadNodeJsPlugin(std::string dirPath, const std::string& packagePath, bool
|
||||
if (!PluginManager::getPlugin(pluginName)) {
|
||||
// Plugin did't register itself. Help to register it
|
||||
string description = pluginName;
|
||||
LL::Version ver(1, 0, 0);
|
||||
ll::Version ver(1, 0, 0);
|
||||
std::map<string, string> others = {};
|
||||
|
||||
// Read information from package.json
|
||||
@ -305,7 +305,7 @@ bool loadNodeJsPlugin(std::string dirPath, const std::string& packagePath, bool
|
||||
}
|
||||
// version
|
||||
if (j.contains("version") && j["version"].is_string()) {
|
||||
ver = LL::Version::parse(j["version"].get<std::string>());
|
||||
ver = ll::Version::parse(j["version"].get<std::string>());
|
||||
}
|
||||
// license
|
||||
if (j.contains("license") && j["license"].is_string()) {
|
||||
|
@ -152,7 +152,7 @@ bool PluginManager::loadPlugin(const std::string& fileOrDirPath, bool isHotLoad,
|
||||
|
||||
// If plugin itself doesn't register, help it to do so
|
||||
if (!PluginManager::getPlugin(pluginName))
|
||||
PluginManager::registerPlugin(realPath, pluginName, pluginName, LL::Version(1, 0, 0), {});
|
||||
PluginManager::registerPlugin(realPath, pluginName, pluginName, ll::Version(1, 0, 0), {});
|
||||
|
||||
// Call necessary events when at hot load
|
||||
if (isHotLoad)
|
||||
@ -274,19 +274,19 @@ bool PluginManager::reloadAllPlugins() {
|
||||
return true;
|
||||
}
|
||||
|
||||
LL::Plugin* PluginManager::getPlugin(std::string name) {
|
||||
return LL::PluginManager::getPlugin(name, true);
|
||||
ll::Plugin* PluginManager::getPlugin(std::string name) {
|
||||
return ll::PluginManager::getPlugin(name, true);
|
||||
}
|
||||
|
||||
// Get all plugins of current language
|
||||
std::unordered_map<std::string, LL::Plugin*> PluginManager::getLocalPlugins() {
|
||||
std::unordered_map<std::string, LL::Plugin*> res;
|
||||
std::unordered_map<std::string, ll::Plugin*> PluginManager::getLocalPlugins() {
|
||||
std::unordered_map<std::string, ll::Plugin*> res;
|
||||
|
||||
auto engines = EngineManager::getLocalEngines();
|
||||
for (auto& engine : engines) {
|
||||
string name = ENGINE_GET_DATA(engine)->pluginName;
|
||||
if (name != LLSE_DEBUG_ENGINE_NAME) {
|
||||
LL::Plugin* plugin = PluginManager::getPlugin(name);
|
||||
ll::Plugin* plugin = PluginManager::getPlugin(name);
|
||||
if (plugin)
|
||||
res[plugin->name] = plugin;
|
||||
}
|
||||
@ -294,28 +294,28 @@ std::unordered_map<std::string, LL::Plugin*> PluginManager::getLocalPlugins() {
|
||||
return res;
|
||||
}
|
||||
|
||||
std::unordered_map<std::string, LL::Plugin*> PluginManager::getAllScriptPlugins() {
|
||||
std::unordered_map<std::string, ll::Plugin*> PluginManager::getAllScriptPlugins() {
|
||||
auto res = getAllPlugins();
|
||||
erase_if(res, [](auto& item) {
|
||||
return item.second->type != LL::Plugin::PluginType::ScriptPlugin;
|
||||
return item.second->type != ll::Plugin::PluginType::ScriptPlugin;
|
||||
});
|
||||
return res;
|
||||
}
|
||||
|
||||
// Get all plugins
|
||||
std::unordered_map<std::string, LL::Plugin*> PluginManager::getAllPlugins() {
|
||||
return LL::PluginManager::getAllPlugins();
|
||||
std::unordered_map<std::string, ll::Plugin*> PluginManager::getAllPlugins() {
|
||||
return ll::PluginManager::getAllPlugins();
|
||||
}
|
||||
|
||||
bool PluginManager::registerPlugin(std::string filePath, std::string name, std::string desc,
|
||||
LL::Version version, std::map<std::string, std::string> others) {
|
||||
ll::Version version, std::map<std::string, std::string> others) {
|
||||
others["PluginType"] = "Script Plugin";
|
||||
others["PluginFilePath"] = filePath;
|
||||
return LL::PluginManager::registerPlugin(NULL, name, desc, version, others);
|
||||
return ll::PluginManager::registerPlugin(NULL, name, desc, version, others);
|
||||
}
|
||||
|
||||
bool PluginManager::unRegisterPlugin(std::string name) {
|
||||
return LL::PluginManager::unRegisterPlugin(name);
|
||||
return ll::PluginManager::unRegisterPlugin(name);
|
||||
}
|
||||
|
||||
// Get plugin backend type from its file path (single file plugin)
|
||||
|
@ -16,13 +16,13 @@ public:
|
||||
static bool reloadPlugin(const std::string& name);
|
||||
static bool reloadAllPlugins();
|
||||
|
||||
static LL::Plugin* getPlugin(std::string name);
|
||||
static std::unordered_map<std::string, LL::Plugin*> getLocalPlugins();
|
||||
static std::unordered_map<std::string, LL::Plugin*> getAllScriptPlugins();
|
||||
static std::unordered_map<std::string, LL::Plugin*> getAllPlugins();
|
||||
static ll::Plugin* getPlugin(std::string name);
|
||||
static std::unordered_map<std::string, ll::Plugin*> getLocalPlugins();
|
||||
static std::unordered_map<std::string, ll::Plugin*> getAllScriptPlugins();
|
||||
static std::unordered_map<std::string, ll::Plugin*> getAllPlugins();
|
||||
|
||||
static std::string getPluginBackendType(const std::string &path);
|
||||
|
||||
static bool registerPlugin(std::string filePath, std::string name, std::string desc,
|
||||
LL::Version version, std::map<std::string, std::string> others);
|
||||
ll::Version version, std::map<std::string, std::string> others);
|
||||
};
|
@ -34,15 +34,15 @@ extern void LoadDebugEngine();
|
||||
|
||||
void entry() {
|
||||
// Enable thread SEH protection
|
||||
if (!LL::isDebugMode())
|
||||
if (!ll::isDebugMode())
|
||||
_set_se_translator(seh_exception::TranslateSEHtoCE);
|
||||
|
||||
// Register myself
|
||||
LL::registerPlugin(LLSE_LOADER_NAME, LLSE_LOADER_DESCRIPTION, LITELOADER_VERSION,
|
||||
ll::registerPlugin(LLSE_LOADER_NAME, LLSE_LOADER_DESCRIPTION, LITELOADER_VERSION,
|
||||
{{"GitHub", "github.com/LiteLDev/LiteLoaderBDS"}});
|
||||
|
||||
// Load i18n files
|
||||
Translation::loadFromImpl(GetCurrentModule(), LL::getLoaderHandle());
|
||||
Translation::loadFromImpl(GetCurrentModule(), ll::getLoaderHandle());
|
||||
|
||||
// Init global share data
|
||||
InitLocalShareData();
|
||||
@ -55,7 +55,7 @@ void entry() {
|
||||
}
|
||||
|
||||
// Init builtin economy system
|
||||
if (LL::globalConfig.enableEconomyCore) {
|
||||
if (ll::globalConfig.enableEconomyCore) {
|
||||
EconomySystem::init();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user