mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Loginserver] Automatifc Opcode File Creation (#4521)
* Loginserver will auto create the opcodes file if it doesn't exist on load. * Use path manager in login opcodes. --------- Co-authored-by: KimLS <KimLS@peqtgc.com>
This commit is contained in:
parent
9583099ace
commit
e6469878ce
@ -171,6 +171,7 @@ void EQEmuConfig::parse_config()
|
|||||||
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
PluginDir = _root["server"]["directories"].get("plugins", "plugins/").asString();
|
||||||
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
LuaModuleDir = _root["server"]["directories"].get("lua_modules", "lua_modules/").asString();
|
||||||
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
PatchDir = _root["server"]["directories"].get("patches", "./").asString();
|
||||||
|
OpcodeDir = _root["server"]["directories"].get("opcodes", "./").asString();
|
||||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||||
|
|
||||||
|
|||||||
@ -95,6 +95,7 @@ class EQEmuConfig
|
|||||||
std::string PluginDir;
|
std::string PluginDir;
|
||||||
std::string LuaModuleDir;
|
std::string LuaModuleDir;
|
||||||
std::string PatchDir;
|
std::string PatchDir;
|
||||||
|
std::string OpcodeDir;
|
||||||
std::string SharedMemDir;
|
std::string SharedMemDir;
|
||||||
std::string LogDir;
|
std::string LogDir;
|
||||||
|
|
||||||
|
|||||||
@ -74,6 +74,11 @@ void PathManager::LoadPaths()
|
|||||||
m_patch_path = fs::relative(fs::path{m_server_path + "/" + c->PatchDir}).string();
|
m_patch_path = fs::relative(fs::path{m_server_path + "/" + c->PatchDir}).string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// patches
|
||||||
|
if (File::Exists(fs::path{ m_server_path + "/" + c->OpcodeDir }.string())) {
|
||||||
|
m_opcode_path = fs::relative(fs::path{ m_server_path + "/" + c->OpcodeDir }).string();
|
||||||
|
}
|
||||||
|
|
||||||
// shared_memory_path
|
// shared_memory_path
|
||||||
if (File::Exists(fs::path{m_server_path + "/" + c->SharedMemDir}.string())) {
|
if (File::Exists(fs::path{m_server_path + "/" + c->SharedMemDir}.string())) {
|
||||||
m_shared_memory_path = fs::relative(fs::path{ m_server_path + "/" + c->SharedMemDir }).string();
|
m_shared_memory_path = fs::relative(fs::path{ m_server_path + "/" + c->SharedMemDir }).string();
|
||||||
@ -89,6 +94,7 @@ void PathManager::LoadPaths()
|
|||||||
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
||||||
LogInfo("maps path [{}]", m_maps_path);
|
LogInfo("maps path [{}]", m_maps_path);
|
||||||
LogInfo("patches path [{}]", m_patch_path);
|
LogInfo("patches path [{}]", m_patch_path);
|
||||||
|
LogInfo("opcode path [{}]", m_opcode_path);
|
||||||
LogInfo("plugins path [{}]", m_plugins_path);
|
LogInfo("plugins path [{}]", m_plugins_path);
|
||||||
LogInfo("quests path [{}]", m_quests_path);
|
LogInfo("quests path [{}]", m_quests_path);
|
||||||
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
||||||
@ -129,6 +135,11 @@ const std::string &PathManager::GetPatchPath() const
|
|||||||
return m_patch_path;
|
return m_patch_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &PathManager::GetOpcodePath() const
|
||||||
|
{
|
||||||
|
return m_opcode_path;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &PathManager::GetLuaModulesPath() const
|
const std::string &PathManager::GetLuaModulesPath() const
|
||||||
{
|
{
|
||||||
return m_lua_modules_path;
|
return m_lua_modules_path;
|
||||||
|
|||||||
@ -13,6 +13,7 @@ public:
|
|||||||
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
[[nodiscard]] const std::string &GetLuaModulesPath() const;
|
||||||
[[nodiscard]] const std::string &GetMapsPath() const;
|
[[nodiscard]] const std::string &GetMapsPath() const;
|
||||||
[[nodiscard]] const std::string &GetPatchPath() const;
|
[[nodiscard]] const std::string &GetPatchPath() const;
|
||||||
|
[[nodiscard]] const std::string &GetOpcodePath() const;
|
||||||
[[nodiscard]] const std::string &GetPluginsPath() const;
|
[[nodiscard]] const std::string &GetPluginsPath() const;
|
||||||
[[nodiscard]] const std::string &GetQuestsPath() const;
|
[[nodiscard]] const std::string &GetQuestsPath() const;
|
||||||
[[nodiscard]] const std::string &GetServerPath() const;
|
[[nodiscard]] const std::string &GetServerPath() const;
|
||||||
@ -24,6 +25,7 @@ private:
|
|||||||
std::string m_lua_modules_path;
|
std::string m_lua_modules_path;
|
||||||
std::string m_maps_path;
|
std::string m_maps_path;
|
||||||
std::string m_patch_path;
|
std::string m_patch_path;
|
||||||
|
std::string m_opcode_path;
|
||||||
std::string m_plugins_path;
|
std::string m_plugins_path;
|
||||||
std::string m_quests_path;
|
std::string m_quests_path;
|
||||||
std::string m_server_path;
|
std::string m_server_path;
|
||||||
|
|||||||
@ -7,6 +7,79 @@ extern bool run_server;
|
|||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/misc.h"
|
#include "../common/misc.h"
|
||||||
#include "../common/path_manager.h"
|
#include "../common/path_manager.h"
|
||||||
|
#include "../common/file.h"
|
||||||
|
|
||||||
|
void CheckTitaniumOpcodeFile(const std::string &path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0021\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0016\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0017\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0018\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckSoDOpcodeFile(const std::string& path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0017\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_LoginExpansionPacketData=0x0031\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckLarionOpcodeFile(const std::string& path) {
|
||||||
|
if (File::Exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto f = fopen(path.c_str(), "w");
|
||||||
|
if (f) {
|
||||||
|
fprintf(f, "#EQEmu Public Login Server OPCodes\n");
|
||||||
|
fprintf(f, "OP_SessionReady=0x0001\n");
|
||||||
|
fprintf(f, "OP_Login=0x0002\n");
|
||||||
|
fprintf(f, "OP_ServerListRequest=0x0004\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestRequest=0x000d\n");
|
||||||
|
fprintf(f, "OP_PlayEverquestResponse=0x0022\n");
|
||||||
|
fprintf(f, "OP_ChatMessage=0x0017\n");
|
||||||
|
fprintf(f, "OP_LoginAccepted=0x0018\n");
|
||||||
|
fprintf(f, "OP_ServerListResponse=0x0019\n");
|
||||||
|
fprintf(f, "OP_Poll=0x0029\n");
|
||||||
|
fprintf(f, "OP_EnterChat=0x000f\n");
|
||||||
|
fprintf(f, "OP_PollResponse=0x0011\n");
|
||||||
|
fprintf(f, "OP_SystemFingerprint=0x0016\n");
|
||||||
|
fprintf(f, "OP_ExpansionList=0x0030\n");
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ClientManager::ClientManager()
|
ClientManager::ClientManager()
|
||||||
{
|
{
|
||||||
@ -19,14 +92,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
std::string opcodes_path = fmt::format(
|
std::string opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
"login_opcodes.conf"
|
||||||
"client_configuration",
|
|
||||||
"titanium_opcodes",
|
|
||||||
"login_opcodes.conf"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckTitaniumOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!titanium_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Titanium file [{0}]",
|
||||||
@ -58,14 +129,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
"login_opcodes_sod.conf"
|
||||||
"client_configuration",
|
|
||||||
"sod_opcodes",
|
|
||||||
"login_opcodes.conf"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckSoDOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!sod_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
"ClientManager fatal error: couldn't load opcodes for SoD file {0}",
|
||||||
@ -98,14 +167,12 @@ ClientManager::ClientManager()
|
|||||||
|
|
||||||
opcodes_path = fmt::format(
|
opcodes_path = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
path.GetServerPath(),
|
path.GetOpcodePath(),
|
||||||
server.config.GetVariableString(
|
"login_opcodes_larion.conf"
|
||||||
"client_configuration",
|
|
||||||
"larion_opcodes",
|
|
||||||
"login_opcodes.conf"
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CheckLarionOpcodeFile(opcodes_path);
|
||||||
|
|
||||||
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
if (!larion_ops->LoadOpcodes(opcodes_path.c_str())) {
|
||||||
LogError(
|
LogError(
|
||||||
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
"ClientManager fatal error: couldn't load opcodes for Larion file [{0}]",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user