Merge branch 'develop' into fix-dedi
This commit is contained in:
commit
df733bcc9a
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -28,7 +28,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
@ -116,4 +116,4 @@ jobs:
|
||||
# run: rsync -avz ./data/ ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }}:${{ env.XLABS_MASTER_PATH }}/iw4x/data/
|
||||
|
||||
- name: Publish changes
|
||||
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
|
||||
run: ssh ${{ secrets.XLABS_MASTER_SSH_USER }}@${{ secrets.XLABS_MASTER_SSH_ADDRESS }} ${{ secrets.XLABS_MASTER_SSH_CHANGE_PUBLISH_COMMAND }}
|
||||
|
2
deps/libtomcrypt
vendored
2
deps/libtomcrypt
vendored
@ -1 +1 @@
|
||||
Subproject commit 673f5ce29015a9bba3c96792920a10601b5b0718
|
||||
Subproject commit 06a81aeb227424182125363f7554fad5146d6d2a
|
2
deps/libtommath
vendored
2
deps/libtommath
vendored
@ -1 +1 @@
|
||||
Subproject commit 04e9d1e7a0493910b2eb5e757d623870692ada04
|
||||
Subproject commit 5108f12350b6daa4aa5dbc846517ad1db2f8388a
|
2
deps/zlib
vendored
2
deps/zlib
vendored
@ -1 +1 @@
|
||||
Subproject commit 2014a993addbc8f1b9785d97f55fd189792c2f78
|
||||
Subproject commit ec3df00224d4b396e2ac6586ab5d25f673caa4c2
|
@ -494,7 +494,7 @@ namespace Components
|
||||
{
|
||||
this->reallocateEntryPool();
|
||||
|
||||
Dvar::Register<bool>("r_noVoid", false, Game::DVAR_FLAG_SAVED, "Disable void model (red fx)");
|
||||
Dvar::Register<bool>("r_noVoid", false, Game::DVAR_ARCHIVE, "Disable void model (red fx)");
|
||||
|
||||
AssetHandler::ClearTemporaryAssets();
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace Assets
|
||||
glyph.pixelHeight = static_cast<char>(gh);
|
||||
glyph.x0 = static_cast<char>(x0);
|
||||
glyph.y0 = static_cast<char>(y0 + yOffset);
|
||||
glyph.dx = static_cast<char>(roundf(scale * advance));
|
||||
glyph.dx = static_cast<char>(std::roundf(scale * advance));
|
||||
|
||||
// Advance to next col
|
||||
x = x + gw + 1;
|
||||
@ -92,7 +92,7 @@ namespace Assets
|
||||
}
|
||||
}
|
||||
|
||||
void IFont_s::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone*)
|
||||
void IFont_s::load(Game::XAssetHeader* header, const std::string& name, Components::ZoneBuilder::Zone* builder)
|
||||
{
|
||||
Components::FileSystem::File fontDefFile(Utils::String::VA("%s.json", name.data()));
|
||||
Components::FileSystem::File fontFile(Utils::String::VA("%s.ttf", name.data()));
|
||||
@ -105,11 +105,13 @@ namespace Assets
|
||||
if (!errors.empty())
|
||||
{
|
||||
Components::Logger::Error("Font define %s is broken: %s.", name.data(), errors.data());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fontDef.is_object())
|
||||
{
|
||||
Components::Logger::Error("Font define %s is invaild.", name.data(), errors.data());
|
||||
return;
|
||||
}
|
||||
|
||||
int w = fontDef["textureWidth"].int_value();
|
||||
@ -118,22 +120,28 @@ namespace Assets
|
||||
int size = fontDef["size"].int_value();
|
||||
int yOffset = fontDef["yOffset"].int_value();
|
||||
|
||||
uint8_t* pixels = Utils::Memory::AllocateArray<uint8_t>(w * h);
|
||||
auto* pixels = builder->getAllocator()->allocateArray<uint8_t>(w * h);
|
||||
|
||||
// Setup assets
|
||||
auto* texName = Utils::Memory::DuplicateString(Utils::String::VA("if_%s", name.data() + 6 /* skip "fonts/" */));
|
||||
auto* fontName = Utils::Memory::DuplicateString(name.data());
|
||||
auto* glowMaterialName = Utils::Memory::DuplicateString(Utils::String::VA("%s_glow", name.data()));
|
||||
const auto* texName = builder->getAllocator()->duplicateString(Utils::String::VA("if_%s", name.data() + 6 /* skip "fonts/" */));
|
||||
const auto* fontName = builder->getAllocator()->duplicateString(name.data());
|
||||
const auto* glowMaterialName = builder->getAllocator()->duplicateString(Utils::String::VA("%s_glow", name.data()));
|
||||
|
||||
auto* image = builder->getAllocator()->allocate<Game::GfxImage>();
|
||||
std::memcpy(image, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_IMAGE, "gamefonts_pc").image, sizeof(Game::GfxImage));
|
||||
|
||||
auto* image = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_IMAGE, "gamefonts_pc").image);
|
||||
image->name = texName;
|
||||
|
||||
auto* material = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc").material);
|
||||
material->textureTable = Utils::Memory::Duplicate(material->textureTable);
|
||||
|
||||
auto* material = builder->getAllocator()->allocate<Game::Material>();
|
||||
std::memcpy(material, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc").material, sizeof(Game::Material));
|
||||
|
||||
material->textureTable = builder->getAllocator()->allocate<Game::MaterialTextureDef>();
|
||||
material->textureTable->u.image = image;
|
||||
material->info.name = fontName;
|
||||
|
||||
auto* glowMaterial = Utils::Memory::Duplicate(Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc_glow").material);
|
||||
auto* glowMaterial = builder->getAllocator()->allocate<Game::Material>();
|
||||
std::memcpy(glowMaterial, Game::DB_FindXAssetHeader(Game::ASSET_TYPE_MATERIAL, "fonts/gamefonts_pc_glow").material, sizeof(Game::Material));
|
||||
|
||||
glowMaterial->textureTable = material->textureTable;
|
||||
glowMaterial->info.name = glowMaterialName;
|
||||
|
||||
@ -161,14 +169,14 @@ namespace Assets
|
||||
charset.push_back(i);
|
||||
}
|
||||
|
||||
auto* font = Utils::Memory::Allocate<Game::Font_s>();
|
||||
auto* font = builder->getAllocator()->allocate<Game::Font_s>();
|
||||
|
||||
font->fontName = fontName;
|
||||
font->pixelHeight = size;
|
||||
font->material = material;
|
||||
font->glowMaterial = glowMaterial;
|
||||
font->glyphCount = charset.size();
|
||||
font->glyphs = Utils::Memory::AllocateArray<Game::Glyph>(charset.size());
|
||||
font->glyphs = builder->getAllocator()->allocateArray<Game::Glyph>(charset.size());
|
||||
|
||||
// Generate glyph data
|
||||
int result = PackFonts(reinterpret_cast<const uint8_t*>(fontFile.getBuffer().data()), charset, font->glyphs, static_cast<float>(size), pixels, w, h, yOffset);
|
||||
@ -239,7 +247,6 @@ namespace Assets
|
||||
}
|
||||
|
||||
Utils::IO::WriteFile(Utils::String::VA("userraw\\images\\%s.iwi", texName), outIwi);
|
||||
Utils::Memory::Free(pixels);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace Components
|
||||
|
||||
Command::ServerParams params;
|
||||
|
||||
if (params.length() < 3)
|
||||
if (params.size() < 3)
|
||||
{
|
||||
Game::SV_Cmd_EndTokenizedString();
|
||||
Logger::SoftError("Connecting failed: Command parsing error!");
|
||||
@ -170,7 +170,7 @@ namespace Components
|
||||
Command::ServerParams params;
|
||||
|
||||
// Ensure there are enough params
|
||||
if (params.length() < 3)
|
||||
if (params.size() < 3)
|
||||
{
|
||||
Network::Send(address, "error\nInvalid connect string!");
|
||||
return;
|
||||
@ -432,7 +432,7 @@ namespace Components
|
||||
Scheduler::OnFrame(Auth::Frame);
|
||||
|
||||
// Register dvar
|
||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||
Dvar::Register<int>("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_SERVERINFO, "Security level for GUID certificates (POW)");
|
||||
|
||||
// Install registration hook
|
||||
Utils::Hook(0x6265F9, Auth::DirectConnectStub, HOOK_JUMP).install()->quick();
|
||||
@ -455,7 +455,7 @@ namespace Components
|
||||
{
|
||||
Command::Add("securityLevel", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
uint32_t level = Auth::GetZeroBits(Auth::GuidToken, Auth::GuidKey.getPublicKey());
|
||||
Logger::Print("Your current security level is %d\n", level);
|
||||
|
@ -234,17 +234,17 @@ namespace Components
|
||||
{
|
||||
Command::Add("banclient", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string reason = "EXE_ERR_BANNED_PERM";
|
||||
if (params->length() >= 3) reason = params->join(2);
|
||||
if (params->size() >= 3) reason = params->join(2);
|
||||
|
||||
Bans::BanClientNum(atoi(params->get(1)), reason);
|
||||
});
|
||||
|
||||
Command::Add("unbanclient", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string type = params->get(1);
|
||||
|
||||
@ -274,9 +274,4 @@ namespace Components
|
||||
Bans::LoadBans(&list);
|
||||
});
|
||||
}
|
||||
|
||||
Bans::~Bans()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace Components
|
||||
typedef std::pair<SteamID, Game::netIP_t> Entry;
|
||||
|
||||
Bans();
|
||||
~Bans();
|
||||
|
||||
static void BanClientNum(int num, const std::string& reason);
|
||||
static void UnbanClient(SteamID id);
|
||||
|
@ -447,7 +447,7 @@ namespace Components
|
||||
{
|
||||
unsigned int count = 1;
|
||||
|
||||
if (params->length() > 1)
|
||||
if (params->size() > 1)
|
||||
{
|
||||
if (params->get(1) == "all"s) count = static_cast<unsigned int>(-1);
|
||||
else count = atoi(params->get(1));
|
||||
|
@ -192,14 +192,14 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
CardTitles::CustomTitleDvar = Dvar::Register<const char*>("customtitle", "", Game::dvar_flag::DVAR_FLAG_USERINFO | Game::dvar_flag::DVAR_FLAG_SAVED, "Custom card title");
|
||||
CardTitles::CustomTitleDvar = Dvar::Register<const char*>("customtitle", "", Game::dvar_flag::DVAR_USERINFO | Game::dvar_flag::DVAR_ARCHIVE, "Custom card title");
|
||||
});
|
||||
|
||||
ServerCommands::OnCommand(21, [](Command::Params* params)
|
||||
{
|
||||
if (params->get(1) == "customTitles"s && !Dedicated::IsEnabled())
|
||||
{
|
||||
if (params->length() == 3)
|
||||
if (params->size() == 3)
|
||||
{
|
||||
CardTitles::ParseCustomTitles(params->get(2));
|
||||
return true;
|
||||
@ -210,11 +210,6 @@ namespace Components
|
||||
|
||||
});
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(CardTitles::CustomTitles); ++i)
|
||||
{
|
||||
CardTitles::CustomTitles[i].clear();
|
||||
}
|
||||
|
||||
Utils::Hook(0x62EB26, CardTitles::GetPlayerCardClientInfoStub).install()->quick();
|
||||
|
||||
// Table lookup stuff
|
||||
@ -227,12 +222,4 @@ namespace Components
|
||||
AntiCheat::CheckStartupTime();
|
||||
#endif
|
||||
}
|
||||
|
||||
CardTitles::~CardTitles()
|
||||
{
|
||||
for (int i = 0; i < ARRAYSIZE(CardTitles::CustomTitles); ++i)
|
||||
{
|
||||
CardTitles::CustomTitles[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ namespace Components
|
||||
static void ParseCustomTitles(const char * msg);
|
||||
|
||||
CardTitles();
|
||||
~CardTitles();
|
||||
|
||||
private:
|
||||
static CClient * GetClientByIndex(std::uint32_t index);
|
||||
|
@ -60,12 +60,4 @@ namespace Components
|
||||
Scheduler::OnFrameAsync(AntiCheat::QuickCodeScanner1);
|
||||
#endif
|
||||
}
|
||||
|
||||
Changelog::~Changelog()
|
||||
{
|
||||
{
|
||||
std::lock_guard<std::mutex> _(Changelog::Mutex);
|
||||
Changelog::Lines.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Changelog();
|
||||
~Changelog();
|
||||
|
||||
static void LoadChangelog();
|
||||
|
||||
|
@ -263,7 +263,7 @@ namespace Components
|
||||
}
|
||||
|
||||
const auto* cmd = params->get(0);
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
Logger::Print("Usage: %s <client number> : prevent the player from using the chat\n", cmd);
|
||||
return;
|
||||
@ -285,7 +285,7 @@ namespace Components
|
||||
}
|
||||
|
||||
const auto* cmd = params->get(0);
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
Logger::Print("Usage: %s <client number or guid>\n%s all = unmute everyone\n", cmd, cmd);
|
||||
return;
|
||||
@ -299,7 +299,7 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
if (params->get(1) == "all"s)
|
||||
if (std::strcmp(params->get(1), "all") == 0)
|
||||
{
|
||||
Logger::Print("All players were unmuted\n");
|
||||
Chat::UnmuteInternal(0, true);
|
||||
@ -316,7 +316,7 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_FLAG_SAVED, "The normalized maximum width of a chat message");
|
||||
cg_chatWidth = Dvar::Register<int>("cg_chatWidth", 52, 1, std::numeric_limits<int>::max(), Game::DVAR_ARCHIVE, "The normalized maximum width of a chat message");
|
||||
Chat::AddChatCommands();
|
||||
});
|
||||
|
||||
@ -328,9 +328,4 @@ namespace Components
|
||||
// Change logic that does word splitting with new lines for chat messages to support fonticons
|
||||
Utils::Hook(0x592E10, CG_AddToTeamChat_Stub, HOOK_JUMP).install()->quick();
|
||||
}
|
||||
|
||||
Chat::~Chat()
|
||||
{
|
||||
Chat::MuteList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ namespace Components
|
||||
static constexpr auto FONT_ICON_CHAT_WIDTH_CALCULATION_MULTIPLIER = 2.0f;
|
||||
public:
|
||||
Chat();
|
||||
~Chat();
|
||||
|
||||
private:
|
||||
static Game::dvar_t** cg_chatHeight;
|
||||
|
@ -75,7 +75,7 @@ namespace Components
|
||||
// Create clantag dvar
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("clantag", "", Game::dvar_flag::DVAR_FLAG_USERINFO | Game::dvar_flag::DVAR_FLAG_SAVED, "If set, your clantag will be shown on the scoreboard.");
|
||||
Dvar::Register<const char*>("clantag", "", Game::dvar_flag::DVAR_USERINFO | Game::dvar_flag::DVAR_ARCHIVE, "If set, your clantag will be shown on the scoreboard.");
|
||||
});
|
||||
|
||||
// Servercommand hook
|
||||
@ -83,7 +83,7 @@ namespace Components
|
||||
{
|
||||
if (params->get(1) == "clantags"s && !Dedicated::IsEnabled())
|
||||
{
|
||||
if (params->length() == 3)
|
||||
if (params->size() == 3)
|
||||
{
|
||||
ClanTags::ParseClantags(params->get(2));
|
||||
return true;
|
||||
@ -93,20 +93,7 @@ namespace Components
|
||||
return false;
|
||||
});
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(ClanTags::Tags); ++i)
|
||||
{
|
||||
ClanTags::Tags[i].clear();
|
||||
}
|
||||
|
||||
// Draw clantag before playername
|
||||
Utils::Hook(0x591242, ClanTags::DrawPlayerNameOnScoreboard).install()->quick();
|
||||
}
|
||||
|
||||
ClanTags::~ClanTags()
|
||||
{
|
||||
for (int i = 0; i < ARRAYSIZE(ClanTags::Tags); ++i)
|
||||
{
|
||||
ClanTags::Tags[i].clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ namespace Components
|
||||
static const char* GetUserClantag(std::uint32_t clientnum, const char * playername);
|
||||
|
||||
ClanTags();
|
||||
~ClanTags();
|
||||
|
||||
private:
|
||||
static std::string Tags[18];
|
||||
|
@ -147,7 +147,7 @@ namespace Components
|
||||
Command::ServerParams params = {};
|
||||
Game::vec3_t origin, angles{0.f, 0.f, 0.f};
|
||||
|
||||
if (params.length() < 4u || params.length() > 6u)
|
||||
if (params.size() < 4 || params.size() > 6)
|
||||
{
|
||||
Game::SV_GameSendServerCommand(ent->s.number, 0,
|
||||
Utils::String::VA("%c \"GAME_USAGE\x15: setviewpos x y z [yaw] [pitch]\n\"", 0x65));
|
||||
@ -159,12 +159,12 @@ namespace Components
|
||||
origin[i] = std::strtof(params.get(i + 1), nullptr);
|
||||
}
|
||||
|
||||
if (params.length() >= 5u)
|
||||
if (params.size() >= 5)
|
||||
{
|
||||
angles[1] = std::strtof(params.get(4), nullptr); // Yaw
|
||||
}
|
||||
|
||||
if (params.length() == 6u)
|
||||
if (params.size() == 6)
|
||||
{
|
||||
angles[0] = std::strtof(params.get(5), nullptr); // Pitch
|
||||
}
|
||||
@ -309,9 +309,4 @@ namespace Components
|
||||
ClientCommand::AddCheatCommands();
|
||||
ClientCommand::AddScriptFunctions();
|
||||
}
|
||||
|
||||
ClientCommand::~ClientCommand()
|
||||
{
|
||||
ClientCommand::FunctionMap.clear();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ namespace Components
|
||||
typedef void(Callback)(Game::gentity_s* entity);
|
||||
|
||||
ClientCommand();
|
||||
~ClientCommand();
|
||||
|
||||
static void Add(const char* name, Utils::Slot<Callback> callback);
|
||||
static bool CheatsOk(const Game::gentity_s* ent);
|
||||
|
||||
|
@ -5,56 +5,71 @@ namespace Components
|
||||
std::unordered_map<std::string, Utils::Slot<Command::Callback>> Command::FunctionMap;
|
||||
std::unordered_map<std::string, Utils::Slot<Command::Callback>> Command::FunctionMapSV;
|
||||
|
||||
std::string Command::Params::join(size_t startIndex)
|
||||
std::string Command::Params::join(const int index)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
for (size_t i = startIndex; i < this->length(); ++i)
|
||||
for (auto i = index; i < this->size(); i++)
|
||||
{
|
||||
if (i > startIndex) result.append(" ");
|
||||
result.append(this->operator[](i));
|
||||
if (i > index) result.append(" ");
|
||||
result.append(this->get(i));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* Command::Params::operator[](size_t index)
|
||||
Command::ClientParams::ClientParams()
|
||||
: nesting_(Game::cmd_args->nesting)
|
||||
{
|
||||
return this->get(index);
|
||||
assert(Game::cmd_args->nesting < Game::CMD_MAX_NESTING);
|
||||
}
|
||||
|
||||
const char* Command::ClientParams::get(size_t index)
|
||||
int Command::ClientParams::size()
|
||||
{
|
||||
if (index >= this->length()) return "";
|
||||
return Game::cmd_argv[this->commandId][index];
|
||||
return Game::cmd_args->argc[this->nesting_];
|
||||
}
|
||||
|
||||
size_t Command::ClientParams::length()
|
||||
const char* Command::ClientParams::get(const int index)
|
||||
{
|
||||
return Game::cmd_argc[this->commandId];
|
||||
if (index >= this->size())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Game::cmd_args->argv[this->nesting_][index];
|
||||
}
|
||||
|
||||
const char* Command::ServerParams::get(size_t index)
|
||||
Command::ServerParams::ServerParams()
|
||||
: nesting_(Game::sv_cmd_args->nesting)
|
||||
{
|
||||
if (index >= this->length()) return "";
|
||||
return Game::cmd_argv_sv[this->commandId][index];
|
||||
assert(Game::sv_cmd_args->nesting < Game::CMD_MAX_NESTING);
|
||||
}
|
||||
|
||||
size_t Command::ServerParams::length()
|
||||
int Command::ServerParams::size()
|
||||
{
|
||||
return Game::cmd_argc_sv[this->commandId];
|
||||
return Game::sv_cmd_args->argc[this->nesting_];
|
||||
}
|
||||
|
||||
const char* Command::ServerParams::get(const int index)
|
||||
{
|
||||
if (index >= this->size())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Game::sv_cmd_args->argv[this->nesting_][index];
|
||||
}
|
||||
|
||||
void Command::Add(const char* name, Utils::Slot<Command::Callback> callback)
|
||||
{
|
||||
std::string command = Utils::String::ToLower(name);
|
||||
const auto command = Utils::String::ToLower(name);
|
||||
|
||||
if (Command::FunctionMap.find(command) == Command::FunctionMap.end())
|
||||
{
|
||||
Command::AddRaw(name, Command::MainCallback);
|
||||
}
|
||||
|
||||
Command::FunctionMap[command] = callback;
|
||||
Command::FunctionMap[command] = std::move(callback);
|
||||
}
|
||||
|
||||
void Command::AddSV(const char* name, Utils::Slot<Command::Callback> callback)
|
||||
@ -70,7 +85,7 @@ namespace Components
|
||||
return;
|
||||
}
|
||||
|
||||
std::string command = Utils::String::ToLower(name);
|
||||
const auto command = Utils::String::ToLower(name);
|
||||
|
||||
if (Command::FunctionMapSV.find(command) == Command::FunctionMapSV.end())
|
||||
{
|
||||
@ -80,7 +95,7 @@ namespace Components
|
||||
Command::AddRaw(name, Game::Cbuf_AddServerText);
|
||||
}
|
||||
|
||||
Command::FunctionMapSV[command] = callback;
|
||||
FunctionMapSV[command] = std::move(callback);
|
||||
}
|
||||
|
||||
void Command::AddRaw(const char* name, void(*callback)(), bool key)
|
||||
@ -134,25 +149,27 @@ namespace Components
|
||||
|
||||
void Command::MainCallback()
|
||||
{
|
||||
Command::ClientParams params(*Game::cmd_id);
|
||||
Command::ClientParams params;
|
||||
|
||||
std::string command = Utils::String::ToLower(params[0]);
|
||||
const auto command = Utils::String::ToLower(params[0]);
|
||||
const auto got = Command::FunctionMap.find(command);
|
||||
|
||||
if (Command::FunctionMap.find(command) != Command::FunctionMap.end())
|
||||
if (got != Command::FunctionMap.end())
|
||||
{
|
||||
Command::FunctionMap[command](¶ms);
|
||||
got->second(¶ms);
|
||||
}
|
||||
}
|
||||
|
||||
void Command::MainCallbackSV()
|
||||
{
|
||||
Command::ServerParams params(*Game::cmd_id_sv);
|
||||
Command::ServerParams params;
|
||||
|
||||
std::string command = Utils::String::ToLower(params[0]);
|
||||
const auto command = Utils::String::ToLower(params[0]);
|
||||
const auto got = Command::FunctionMapSV.find(command);
|
||||
|
||||
if (Command::FunctionMapSV.find(command) != Command::FunctionMapSV.end())
|
||||
if (got != Command::FunctionMapSV.end())
|
||||
{
|
||||
Command::FunctionMapSV[command](¶ms);
|
||||
got->second(¶ms);
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,16 +179,10 @@ namespace Components
|
||||
|
||||
Command::Add("openLink", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() > 1)
|
||||
if (params->size() > 1)
|
||||
{
|
||||
Utils::OpenUrl(params->get(1));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Command::~Command()
|
||||
{
|
||||
Command::FunctionMap.clear();
|
||||
Command::FunctionMapSV.clear();
|
||||
}
|
||||
}
|
||||
|
@ -9,46 +9,44 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Params() {};
|
||||
virtual ~Params() {};
|
||||
virtual const char* get(size_t index) = 0;
|
||||
virtual size_t length() = 0;
|
||||
|
||||
virtual std::string join(size_t startIndex);
|
||||
virtual const char* operator[](size_t index);
|
||||
virtual int size() = 0;
|
||||
virtual const char* get(int index) = 0;
|
||||
virtual std::string join(int index);
|
||||
|
||||
virtual const char* operator[](const int index)
|
||||
{
|
||||
return this->get(index);
|
||||
}
|
||||
};
|
||||
|
||||
class ClientParams : public Params
|
||||
{
|
||||
public:
|
||||
ClientParams(unsigned int id) : commandId(id) {};
|
||||
ClientParams(const ClientParams &obj) : commandId(obj.commandId) {};
|
||||
ClientParams() : ClientParams(*Game::cmd_id) {};
|
||||
ClientParams();
|
||||
|
||||
const char* get(size_t index) override;
|
||||
size_t length() override;
|
||||
int size() override;
|
||||
const char* get(int index) override;
|
||||
|
||||
private:
|
||||
unsigned int commandId;
|
||||
int nesting_;
|
||||
};
|
||||
|
||||
class ServerParams : public Params
|
||||
{
|
||||
public:
|
||||
ServerParams(unsigned int id) : commandId(id) {};
|
||||
ServerParams(const ServerParams &obj) : commandId(obj.commandId) {};
|
||||
ServerParams() : ServerParams(*Game::cmd_id_sv) {};
|
||||
ServerParams();
|
||||
|
||||
const char* get(size_t index) override;
|
||||
size_t length() override;
|
||||
int size() override;
|
||||
const char* get(int index) override;
|
||||
|
||||
private:
|
||||
unsigned int commandId;
|
||||
int nesting_;
|
||||
};
|
||||
|
||||
typedef void(Callback)(Command::Params* params);
|
||||
|
||||
Command();
|
||||
~Command();
|
||||
|
||||
static Game::cmd_function_t* Allocate();
|
||||
|
||||
|
@ -504,7 +504,8 @@ namespace Components
|
||||
Console::ConsoleThread = std::thread(Console::ConsoleRunner);
|
||||
}
|
||||
|
||||
Game::dvar_t* Console::RegisterConColor(const char* name, float r, float g, float b, float a, float min, float max, int flags, const char* description)
|
||||
Game::dvar_t* Console::RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min,
|
||||
float max, unsigned __int16 flags, const char* description)
|
||||
{
|
||||
static struct
|
||||
{
|
||||
@ -521,7 +522,7 @@ namespace Components
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(patchedColors); ++i)
|
||||
{
|
||||
if (std::string(name) == patchedColors[i].name)
|
||||
if (std::strcmp(dvarName, patchedColors[i].name) == 0)
|
||||
{
|
||||
r = patchedColors[i].color[0];
|
||||
g = patchedColors[i].color[1];
|
||||
@ -531,7 +532,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
return reinterpret_cast<Game::Dvar_RegisterVec4_t>(0x471500)(name, r, g, b, a, min, max, flags, description);
|
||||
return reinterpret_cast<Game::Dvar_RegisterVec4_t>(0x471500)(dvarName, r, g, b, a, min, max, flags, description);
|
||||
}
|
||||
|
||||
Console::Console()
|
||||
|
@ -66,6 +66,6 @@ namespace Components
|
||||
static void ToggleConsole();
|
||||
static char** GetAutoCompleteFileList(const char *path, const char *extension, Game::FsListBehavior_e behavior, int *numfiles, int allocTrackType);
|
||||
|
||||
static Game::dvar_t* RegisterConColor(const char* name, float r, float g, float b, float a, float min, float max, int flags, const char* description);
|
||||
static Game::dvar_t* RegisterConColor(const char* dvarName, float r, float g, float b, float a, float min, float max, unsigned __int16 flags, const char* description);
|
||||
};
|
||||
}
|
||||
|
@ -748,7 +748,7 @@ namespace Components
|
||||
{
|
||||
if (Dedicated::IsEnabled()) return;
|
||||
|
||||
Dvar::Register<bool>("r_useD3D9Ex", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Use extended d3d9 interface!");
|
||||
Dvar::Register<bool>("r_useD3D9Ex", false, Game::dvar_flag::DVAR_ARCHIVE, "Use extended d3d9 interface!");
|
||||
|
||||
// Hook Interface creation
|
||||
Utils::Hook::Set(0x6D74D0, D3D9Ex::Direct3DCreate9Stub);
|
||||
|
@ -275,22 +275,22 @@ namespace Components
|
||||
|
||||
Game::dvar_t* Dedicated::Dvar_RegisterSVNetworkFps(const char* dvarName, int, int min, int, int, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::dvar_flag::DVAR_FLAG_NONE, description);
|
||||
return Game::Dvar_RegisterInt(dvarName, 1000, min, 1000, Game::dvar_flag::DVAR_NONE, description);
|
||||
}
|
||||
|
||||
Dedicated::Dedicated()
|
||||
{
|
||||
// Map rotation
|
||||
Utils::Hook::Set(0x4152E8, Dedicated::MapRotate);
|
||||
Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_FLAG_CHEAT, "");
|
||||
Dvar::Register<bool>("com_logFilter", true, Game::dvar_flag::DVAR_FLAG_LATCHED, "Removes ~95% of unneeded lines from the log");
|
||||
Dvar::Register<bool>("sv_dontrotate", false, Game::dvar_flag::DVAR_CHEAT, "");
|
||||
Dvar::Register<bool>("com_logFilter", true, Game::dvar_flag::DVAR_LATCH, "Removes ~95% of unneeded lines from the log");
|
||||
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled())
|
||||
{
|
||||
// Make sure all callbacks are handled
|
||||
Scheduler::OnFrame(Steam::SteamAPI_RunCallbacks);
|
||||
|
||||
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_FLAG_NONE, "Don't act as node");
|
||||
Dvar::Register<bool>("sv_lanOnly", false, Game::dvar_flag::DVAR_NONE, "Don't act as node");
|
||||
|
||||
Utils::Hook(0x60BE98, Dedicated::InitDedicatedServer, HOOK_CALL).install()->quick();
|
||||
|
||||
@ -391,14 +391,14 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dedicated::SVRandomMapRotation = Dvar::Register<bool>("sv_randomMapRotation", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Randomize map rotation when true");
|
||||
Dvar::Register<const char*>("sv_sayName", "^7Console", Game::dvar_flag::DVAR_FLAG_NONE, "The name to pose as for 'say' commands");
|
||||
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_FLAG_NONE, "A custom message of the day for servers");
|
||||
Dedicated::SVRandomMapRotation = Dvar::Register<bool>("sv_randomMapRotation", false, Game::dvar_flag::DVAR_ARCHIVE, "Randomize map rotation when true");
|
||||
Dvar::Register<const char*>("sv_sayName", "^7Console", Game::dvar_flag::DVAR_NONE, "The name to pose as for 'say' commands");
|
||||
Dvar::Register<const char*>("sv_motd", "", Game::dvar_flag::DVAR_NONE, "A custom message of the day for servers");
|
||||
|
||||
// Say command
|
||||
Command::AddSV("say", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string message = params->join(1);
|
||||
std::string name = Dvar::Var("sv_sayName").get<std::string>();
|
||||
@ -418,7 +418,7 @@ namespace Components
|
||||
// Tell command
|
||||
Command::AddSV("tell", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 3) return;
|
||||
if (params->size() < 3) return;
|
||||
|
||||
int client = atoi(params->get(1));
|
||||
std::string message = params->join(2);
|
||||
@ -439,7 +439,7 @@ namespace Components
|
||||
// Sayraw command
|
||||
Command::AddSV("sayraw", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string message = params->join(1);
|
||||
Game::SV_GameSendServerCommand(-1, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||
@ -449,33 +449,13 @@ namespace Components
|
||||
// Tellraw command
|
||||
Command::AddSV("tellraw", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 3) return;
|
||||
if (params->size() < 3) return;
|
||||
|
||||
int client = atoi(params->get(1));
|
||||
std::string message = params->join(2);
|
||||
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"%s\"", 104, message.data()));
|
||||
Game::Com_Printf(15, "Raw -> %i: %s\n", client, message.data());
|
||||
});
|
||||
|
||||
// ! command
|
||||
Command::AddSV("!", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() != 2) return;
|
||||
|
||||
int client = -1;
|
||||
if (params->get(1) != "all"s)
|
||||
{
|
||||
client = atoi(params->get(1));
|
||||
|
||||
if (client >= *reinterpret_cast<int*>(0x31D938C))
|
||||
{
|
||||
Game::Com_Printf(0, "Invalid player.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Game::SV_GameSendServerCommand(client, 0, Utils::String::VA("%c \"\"", 106));
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -519,9 +499,4 @@ namespace Components
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Dedicated::~Dedicated()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Dedicated();
|
||||
~Dedicated();
|
||||
|
||||
static SteamID PlayerGuids[18][2];
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace Components
|
||||
|
||||
Discovery::Discovery()
|
||||
{
|
||||
Dvar::Register<int>("net_discoveryPortRangeMin", 25000, 0, 65535, Game::dvar_flag::DVAR_FLAG_SAVED, "Minimum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMax", 35000, 1, 65536, Game::dvar_flag::DVAR_FLAG_SAVED, "Maximum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMin", 25000, 0, 65535, Game::dvar_flag::DVAR_ARCHIVE, "Minimum scan range port for local server discovery");
|
||||
Dvar::Register<int>("net_discoveryPortRangeMax", 35000, 1, 65536, Game::dvar_flag::DVAR_ARCHIVE, "Maximum scan range port for local server discovery");
|
||||
|
||||
// An additional thread prevents lags
|
||||
// Not sure if that's the best way though
|
||||
@ -95,11 +95,6 @@ namespace Components
|
||||
#endif
|
||||
}
|
||||
|
||||
Discovery::~Discovery()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Discovery::preDestroy()
|
||||
{
|
||||
Discovery::IsPerforming = false;
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Discovery();
|
||||
~Discovery();
|
||||
|
||||
void preDestroy() override;
|
||||
|
||||
|
@ -902,9 +902,9 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("ui_dl_timeLeft", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_progress", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_transRate", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_timeLeft", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_progress", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_dl_transRate", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
});
|
||||
|
||||
UIScript::Add("mod_download_cancel", [](UIScript::Token)
|
||||
@ -915,13 +915,13 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<bool>("sv_wwwDownload", false, Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to true to enable downloading maps/mods from an external server.");
|
||||
Dvar::Register<const char*>("sv_wwwBaseUrl", "", Game::dvar_flag::DVAR_FLAG_DEDISAVED, "Set to the base url for the external map download.");
|
||||
Dvar::Register<bool>("sv_wwwDownload", false, Game::dvar_flag::DVAR_ARCHIVE, "Set to true to enable downloading maps/mods from an external server.");
|
||||
Dvar::Register<const char*>("sv_wwwBaseUrl", "", Game::dvar_flag::DVAR_ARCHIVE, "Set to the base url for the external map download.");
|
||||
|
||||
// Force users to enable this because we don't want to accidentally turn everyone's pc into a http server into all their files again
|
||||
// not saying we are but ya know... accidents happen
|
||||
// by having it saved we force the user to enable it in config_mp because it only checks the dvar on startup to see if we should init download or not
|
||||
Dvar::Register<bool>("mod_force_download_server", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Set to true to force the client to run the download server for mods (for mods in private matches).");
|
||||
// Force users to enable this because we don't want to accidentally turn everyone's pc into a http server into all their files again
|
||||
// not saying we are but ya know... accidents happen
|
||||
// by having it saved we force the user to enable it in config_mp because it only checks the dvar on startup to see if we should init download or not
|
||||
Dvar::Register<bool>("mod_force_download_server", false, Game::dvar_flag::DVAR_ARCHIVE, "Set to true to force the client to run the download server for mods (for mods in private matches).");
|
||||
});
|
||||
|
||||
Scheduler::OnFrame([]()
|
||||
|
@ -181,24 +181,24 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, bool value, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, bool value, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterBool(name, value, flag.val, description);
|
||||
return Game::Dvar_RegisterBool(dvarName, value, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, const char* value, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, const char* value, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterString(name, value, flag.val, description);
|
||||
return Game::Dvar_RegisterString(dvarName, value, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, int value, int min, int max, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, int value, int min, int max, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterInt(name, value, min, max, flag.val, description);
|
||||
return Game::Dvar_RegisterInt(dvarName, value, min, max, flag.val, description);
|
||||
}
|
||||
|
||||
template<> static Dvar::Var Dvar::Register(const char* name, float value, float min, float max, Dvar::Flag flag, const char* description)
|
||||
template<> Dvar::Var Dvar::Register(const char* dvarName, float value, float min, float max, Dvar::Flag flag, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterFloat(name, value, min, max, flag.val, description);
|
||||
return Game::Dvar_RegisterFloat(dvarName, value, min, max, flag.val, description);
|
||||
}
|
||||
|
||||
void Dvar::OnInit(Utils::Slot<Scheduler::Callback> callback)
|
||||
@ -255,7 +255,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_FLAG_SAVED).val, description).get<Game::dvar_t*>();
|
||||
return Dvar::Register<const char*>(name, username.data(), Dvar::Flag(flag | Game::dvar_flag::DVAR_ARCHIVE).val, description).get<Game::dvar_t*>();
|
||||
}
|
||||
|
||||
void Dvar::SetFromStringByNameSafeExternal(const char* dvarName, const char* string)
|
||||
@ -305,7 +305,7 @@ namespace Components
|
||||
{
|
||||
// Save the dvar original value if it has the archive flag
|
||||
const auto* dvar = Game::Dvar_FindVar(dvarName);
|
||||
if (dvar != nullptr && dvar->flags & Game::dvar_flag::DVAR_FLAG_SAVED)
|
||||
if (dvar != nullptr && dvar->flags & Game::dvar_flag::DVAR_ARCHIVE)
|
||||
{
|
||||
Dvar::SaveArchiveDvar(dvar);
|
||||
}
|
||||
@ -316,49 +316,49 @@ namespace Components
|
||||
Dvar::Dvar()
|
||||
{
|
||||
// set flags of cg_drawFPS to archive
|
||||
Utils::Hook::Or<BYTE>(0x4F8F69, Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Or<BYTE>(0x4F8F69, Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat camera_thirdPersonCrosshairOffset and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x447B41, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x447B41, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_fov and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E35, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E35, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_fovscale and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E68, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8E68, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// un-cheat cg_debugInfoCornerOffset and add archive flags
|
||||
Utils::Hook::Xor<BYTE>(0x4F8FC2, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F8FC2, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// remove archive flags for cg_hudchatposition
|
||||
Utils::Hook::Xor<BYTE>(0x4F9992, Game::dvar_flag::DVAR_FLAG_SAVED);
|
||||
Utils::Hook::Xor<BYTE>(0x4F9992, Game::dvar_flag::DVAR_ARCHIVE);
|
||||
|
||||
// remove write protection from fs_game
|
||||
Utils::Hook::Xor<DWORD>(0x6431EA, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED);
|
||||
Utils::Hook::Xor<DWORD>(0x6431EA, Game::dvar_flag::DVAR_WRITEPROTECTED);
|
||||
|
||||
// set cg_fov max to 90.0
|
||||
// ...120 because of V2
|
||||
static float cgFov90 = 120.0f;
|
||||
Utils::Hook::Set<float*>(0x4F8E28, &cgFov90);
|
||||
// set cg_fov max to 160.0
|
||||
// because that's the max on SP
|
||||
static float cg_Fov = 160.0f;
|
||||
Utils::Hook::Set<float*>(0x4F8E28, &cg_Fov);
|
||||
|
||||
// set max volume to 1
|
||||
static float volume = 1.0f;
|
||||
Utils::Hook::Set<float*>(0x408078, &volume);
|
||||
|
||||
// Uncheat ui_showList
|
||||
Utils::Hook::Xor<BYTE>(0x6310DC, Game::dvar_flag::DVAR_FLAG_CHEAT);
|
||||
Utils::Hook::Xor<BYTE>(0x6310DC, Game::dvar_flag::DVAR_CHEAT);
|
||||
|
||||
// Uncheat ui_debugMode
|
||||
Utils::Hook::Xor<BYTE>(0x6312DE, Game::dvar_flag::DVAR_FLAG_CHEAT);
|
||||
Utils::Hook::Xor<BYTE>(0x6312DE, Game::dvar_flag::DVAR_CHEAT);
|
||||
|
||||
// Hook dvar 'name' registration
|
||||
Utils::Hook(0x40531C, Dvar::RegisterName, HOOK_CALL).install()->quick();
|
||||
|
||||
// un-cheat safeArea_* and add archive flags
|
||||
Utils::Hook::Xor<INT>(0x42E3F5, Game::dvar_flag::DVAR_FLAG_READONLY | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_adjusted_horizontal
|
||||
Utils::Hook::Xor<INT>(0x42E423, Game::dvar_flag::DVAR_FLAG_READONLY | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_adjusted_vertical
|
||||
Utils::Hook::Xor<BYTE>(0x42E398, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_horizontal
|
||||
Utils::Hook::Xor<BYTE>(0x42E3C4, Game::dvar_flag::DVAR_FLAG_CHEAT | Game::dvar_flag::DVAR_FLAG_SAVED); //safeArea_vertical
|
||||
Utils::Hook::Xor<INT>(0x42E3F5, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_horizontal
|
||||
Utils::Hook::Xor<INT>(0x42E423, Game::dvar_flag::DVAR_READONLY | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_adjusted_vertical
|
||||
Utils::Hook::Xor<BYTE>(0x42E398, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_horizontal
|
||||
Utils::Hook::Xor<BYTE>(0x42E3C4, Game::dvar_flag::DVAR_CHEAT | Game::dvar_flag::DVAR_ARCHIVE); //safeArea_vertical
|
||||
|
||||
// Don't allow setting cheat protected dvars via menus
|
||||
Utils::Hook(0x63C897, Dvar::SetFromStringByNameExternal, HOOK_CALL).install()->quick();
|
||||
@ -385,7 +385,6 @@ namespace Components
|
||||
Utils::Hook(0x59386A, Dvar::DvarSetFromStringByNameStub, HOOK_CALL).install()->quick();
|
||||
|
||||
// If the game closed abruptly, the dvars would not have been restored
|
||||
|
||||
Dvar::OnInit([]
|
||||
{
|
||||
Dvar::ResetDvarsValue();
|
||||
|
@ -9,7 +9,7 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Flag(Game::dvar_flag flag) : val(flag) {};
|
||||
Flag(int flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
Flag(unsigned __int16 flag) : Flag(static_cast<Game::dvar_flag>(flag)) {};
|
||||
|
||||
Game::dvar_flag val;
|
||||
};
|
||||
@ -46,8 +46,8 @@ namespace Components
|
||||
static void OnInit(Utils::Slot<Scheduler::Callback> callback);
|
||||
|
||||
// Only strings and bools use this type of declaration
|
||||
template<typename T> static Var Register(const char* name, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* name, T value, T min, T max, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* dvarName, T value, Flag flag, const char* description);
|
||||
template<typename T> static Var Register(const char* dvarName, T value, T min, T max, Flag flag, const char* description);
|
||||
|
||||
static void ResetDvarsValue();
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace Components
|
||||
};
|
||||
|
||||
Elevators::BG_Elevators = Game::Dvar_RegisterEnum("bg_elevators", values,
|
||||
Elevators::ENABLED, Game::DVAR_FLAG_REPLICATED, "Elevators glitch settings");
|
||||
Elevators::ENABLED, Game::DVAR_CODINFO, "Elevators glitch settings");
|
||||
});
|
||||
|
||||
//Replace PM_CorrectAllSolid
|
||||
@ -120,8 +120,4 @@ namespace Components
|
||||
Utils::Hook(0x570E0B, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x570D70, Elevators::PM_Trace_Hk, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Elevators::~Elevators()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Elevators();
|
||||
~Elevators();
|
||||
|
||||
private:
|
||||
enum ElevatorSettings { DISABLED, ENABLED, EASY };
|
||||
|
@ -234,7 +234,7 @@ namespace Components
|
||||
Game::UI_UpdateArenas();
|
||||
|
||||
std::string command;
|
||||
for (auto i = 0; i < (params->length() >= 2 ? atoi(params->get(1)) : *Game::arenaCount); ++i)
|
||||
for (auto i = 0; i < (params->size() >= 2 ? atoi(params->get(1)) : *Game::arenaCount); ++i)
|
||||
{
|
||||
const auto* mapname = ArenaLength::NewArenas[i % *Game::arenaCount].mapName;
|
||||
|
||||
|
@ -495,7 +495,7 @@ namespace Components
|
||||
|
||||
FastFiles::FastFiles()
|
||||
{
|
||||
Dvar::Register<bool>("ui_zoneDebug", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Display current loaded zone.");
|
||||
Dvar::Register<bool>("ui_zoneDebug", false, Game::dvar_flag::DVAR_ARCHIVE, "Display current loaded zone.");
|
||||
|
||||
// Fix XSurface assets
|
||||
Utils::Hook(0x0048E8A5, FastFiles::Load_XSurfaceArray, HOOK_CALL).install()->quick();
|
||||
@ -594,7 +594,7 @@ namespace Components
|
||||
|
||||
Command::Add("loadzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
Game::XZoneInfo info;
|
||||
info.name = params->get(1);
|
||||
@ -622,9 +622,4 @@ namespace Components
|
||||
}, HOOK_CALL).install()/*->quick()*/;
|
||||
#endif
|
||||
}
|
||||
|
||||
FastFiles::~FastFiles()
|
||||
{
|
||||
FastFiles::ZonePaths.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
FastFiles();
|
||||
~FastFiles();
|
||||
|
||||
static void AddZonePath(const std::string& path);
|
||||
static std::string Current();
|
||||
|
@ -6,13 +6,7 @@ namespace Components
|
||||
|
||||
bool Flags::HasFlag(const std::string& flag)
|
||||
{
|
||||
static auto parsed = false;
|
||||
|
||||
if (!parsed)
|
||||
{
|
||||
Flags::ParseFlags();
|
||||
parsed = true;
|
||||
}
|
||||
Flags::ParseFlags();
|
||||
|
||||
for (const auto& entry : Flags::EnabledFlags)
|
||||
{
|
||||
@ -27,11 +21,17 @@ namespace Components
|
||||
|
||||
void Flags::ParseFlags()
|
||||
{
|
||||
static auto flagsParsed = false;
|
||||
if (flagsParsed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Only parse flags once
|
||||
flagsParsed = true;
|
||||
int numArgs;
|
||||
auto* const argv = CommandLineToArgvW(GetCommandLineW(), &numArgs);
|
||||
|
||||
assert(Flags::EnabledFlags.empty());
|
||||
|
||||
if (argv)
|
||||
{
|
||||
for (auto i = 0; i < numArgs; ++i)
|
||||
@ -40,7 +40,7 @@ namespace Components
|
||||
if (wFlag[0] == L'-')
|
||||
{
|
||||
wFlag.erase(wFlag.begin());
|
||||
Flags::EnabledFlags.push_back(Utils::String::Convert(wFlag));
|
||||
Flags::EnabledFlags.emplace_back(Utils::String::Convert(wFlag));
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,11 +50,7 @@ namespace Components
|
||||
// Workaround for wine
|
||||
if (Utils::IsWineEnvironment() && Dedicated::IsEnabled() && !Flags::HasFlag("console") && !Flags::HasFlag("stdout"))
|
||||
{
|
||||
Flags::EnabledFlags.push_back("stdout");
|
||||
Flags::EnabledFlags.emplace_back("stdout");
|
||||
}
|
||||
}
|
||||
|
||||
Flags::Flags()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ namespace Components
|
||||
class Flags : public Component
|
||||
{
|
||||
public:
|
||||
Flags();
|
||||
Flags() = default;
|
||||
|
||||
static bool HasFlag(const std::string& flag);
|
||||
|
||||
|
@ -578,12 +578,12 @@ namespace Components
|
||||
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
||||
|
||||
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_FLAG_SAVED, "Enable invisible mode for Steam");
|
||||
Dvar::Register<bool>("cl_notifyFriendState", true, Game::DVAR_FLAG_SAVED, "Update friends about current game status");
|
||||
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_ARCHIVE, "Enable invisible mode for Steam");
|
||||
Dvar::Register<bool>("cl_notifyFriendState", true, Game::DVAR_ARCHIVE, "Update friends about current game status");
|
||||
|
||||
Command::Add("addFriend", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2u)
|
||||
if (params->size() < 2u)
|
||||
{
|
||||
Logger::Print("Usage: %s <Steam ID in hexadecimal format>\n", params->get(0));
|
||||
return;
|
||||
|
@ -1641,7 +1641,7 @@ namespace Components
|
||||
|
||||
void Gamepad::Axis_Bind_f(Command::Params* params)
|
||||
{
|
||||
if (params->length() < 4)
|
||||
if (params->size() < 4)
|
||||
{
|
||||
Logger::Print("bindaxis <real axis> <virtual axis> <input type>\n");
|
||||
return;
|
||||
@ -1711,32 +1711,32 @@ namespace Components
|
||||
|
||||
void Gamepad::InitDvars()
|
||||
{
|
||||
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_FLAG_SAVED, "Game pad enabled");
|
||||
gpad_debug = Dvar::Register<bool>("gpad_debug", false, Game::DVAR_FLAG_NONE, "Game pad debugging");
|
||||
gpad_present = Dvar::Register<bool>("gpad_present", false, Game::DVAR_FLAG_NONE, "Game pad present");
|
||||
gpad_in_use = Dvar::Register<bool>("gpad_in_use", false, Game::DVAR_FLAG_NONE, "A game pad is in use");
|
||||
gpad_style = Dvar::Register<bool>("gpad_style", false, Game::DVAR_FLAG_SAVED, "Switch between Xbox and PS HUD");
|
||||
gpad_sticksConfig = Dvar::Register<const char*>("gpad_sticksConfig", "", Game::DVAR_FLAG_SAVED, "Game pad stick configuration");
|
||||
gpad_buttonConfig = Dvar::Register<const char*>("gpad_buttonConfig", "", Game::DVAR_FLAG_SAVED, "Game pad button configuration");
|
||||
gpad_menu_scroll_delay_first = Dvar::Register<int>("gpad_menu_scroll_delay_first", 420, 0, 1000, Game::DVAR_FLAG_SAVED, "Menu scroll key-repeat delay, for the first repeat, in milliseconds");
|
||||
gpad_menu_scroll_delay_rest = Dvar::Register<int>("gpad_menu_scroll_delay_rest", 210, 0, 1000, Game::DVAR_FLAG_SAVED,
|
||||
gpad_enabled = Dvar::Register<bool>("gpad_enabled", false, Game::DVAR_ARCHIVE, "Game pad enabled");
|
||||
gpad_debug = Dvar::Register<bool>("gpad_debug", false, Game::DVAR_NONE, "Game pad debugging");
|
||||
gpad_present = Dvar::Register<bool>("gpad_present", false, Game::DVAR_NONE, "Game pad present");
|
||||
gpad_in_use = Dvar::Register<bool>("gpad_in_use", false, Game::DVAR_NONE, "A game pad is in use");
|
||||
gpad_style = Dvar::Register<bool>("gpad_style", false, Game::DVAR_ARCHIVE, "Switch between Xbox and PS HUD");
|
||||
gpad_sticksConfig = Dvar::Register<const char*>("gpad_sticksConfig", "", Game::DVAR_ARCHIVE, "Game pad stick configuration");
|
||||
gpad_buttonConfig = Dvar::Register<const char*>("gpad_buttonConfig", "", Game::DVAR_ARCHIVE, "Game pad button configuration");
|
||||
gpad_menu_scroll_delay_first = Dvar::Register<int>("gpad_menu_scroll_delay_first", 420, 0, 1000, Game::DVAR_ARCHIVE, "Menu scroll key-repeat delay, for the first repeat, in milliseconds");
|
||||
gpad_menu_scroll_delay_rest = Dvar::Register<int>("gpad_menu_scroll_delay_rest", 210, 0, 1000, Game::DVAR_ARCHIVE,
|
||||
"Menu scroll key-repeat delay, for repeats after the first, in milliseconds");
|
||||
gpad_rumble = Dvar::Register<bool>("gpad_rumble", true, Game::DVAR_FLAG_SAVED, "Enable game pad rumble");
|
||||
gpad_stick_pressed_hysteresis = Dvar::Register<float>("gpad_stick_pressed_hysteresis", 0.1f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE,
|
||||
gpad_rumble = Dvar::Register<bool>("gpad_rumble", true, Game::DVAR_ARCHIVE, "Enable game pad rumble");
|
||||
gpad_stick_pressed_hysteresis = Dvar::Register<float>("gpad_stick_pressed_hysteresis", 0.1f, 0.0f, 1.0f, Game::DVAR_NONE,
|
||||
"Game pad stick pressed no-change-zone around gpad_stick_pressed to prevent bouncing");
|
||||
gpad_stick_pressed = Dvar::Register<float>("gpad_stick_pressed", 0.4f, 0.0, 1.0, Game::DVAR_FLAG_NONE, "Game pad stick pressed threshhold");
|
||||
gpad_stick_deadzone_max = Dvar::Register<float>("gpad_stick_deadzone_max", 0.01f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum stick deadzone");
|
||||
gpad_stick_deadzone_min = Dvar::Register<float>("gpad_stick_deadzone_min", 0.2f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad minimum stick deadzone");
|
||||
gpad_button_deadzone = Dvar::Register<float>("gpad_button_deadzone", 0.13f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad button deadzone threshhold");
|
||||
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum pad stick pressed value");
|
||||
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_FLAG_NONE, "Game pad maximum pad stick pressed value");
|
||||
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, std::numeric_limits<int>::max(), Game::DVAR_FLAG_NONE, "Time to hold the 'use' button on gamepads to activate use");
|
||||
gpad_lockon_enabled = Dvar::Register<bool>("gpad_lockon_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad lockon aim assist enabled");
|
||||
gpad_slowdown_enabled = Dvar::Register<bool>("gpad_slowdown_enabled", true, Game::DVAR_FLAG_SAVED, "Game pad slowdown aim assist enabled");
|
||||
gpad_stick_pressed = Dvar::Register<float>("gpad_stick_pressed", 0.4f, 0.0, 1.0, Game::DVAR_NONE, "Game pad stick pressed threshhold");
|
||||
gpad_stick_deadzone_max = Dvar::Register<float>("gpad_stick_deadzone_max", 0.01f, 0.0f, 1.0f, Game::DVAR_NONE, "Game pad maximum stick deadzone");
|
||||
gpad_stick_deadzone_min = Dvar::Register<float>("gpad_stick_deadzone_min", 0.2f, 0.0f, 1.0f, Game::DVAR_NONE, "Game pad minimum stick deadzone");
|
||||
gpad_button_deadzone = Dvar::Register<float>("gpad_button_deadzone", 0.13f, 0.0f, 1.0f, Game::DVAR_NONE, "Game pad button deadzone threshhold");
|
||||
gpad_button_lstick_deflect_max = Dvar::Register<float>("gpad_button_lstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_NONE, "Game pad maximum pad stick pressed value");
|
||||
gpad_button_rstick_deflect_max = Dvar::Register<float>("gpad_button_rstick_deflect_max", 1.0f, 0.0f, 1.0f, Game::DVAR_NONE, "Game pad maximum pad stick pressed value");
|
||||
gpad_use_hold_time = Dvar::Register<int>("gpad_use_hold_time", 250, 0, std::numeric_limits<int>::max(), Game::DVAR_NONE, "Time to hold the 'use' button on gamepads to activate use");
|
||||
gpad_lockon_enabled = Dvar::Register<bool>("gpad_lockon_enabled", true, Game::DVAR_ARCHIVE, "Game pad lockon aim assist enabled");
|
||||
gpad_slowdown_enabled = Dvar::Register<bool>("gpad_slowdown_enabled", true, Game::DVAR_ARCHIVE, "Game pad slowdown aim assist enabled");
|
||||
|
||||
input_viewSensitivity = Dvar::Register<float>("input_viewSensitivity", 1.0f, 0.0001f, 5.0f, Game::DVAR_FLAG_SAVED, "View Sensitivity");
|
||||
input_invertPitch = Dvar::Register<bool>("input_invertPitch", false, Game::DVAR_FLAG_SAVED, "Invert gamepad pitch");
|
||||
sv_allowAimAssist = Dvar::Register<bool>("sv_allowAimAssist", true, Game::DVAR_FLAG_NONE, "Controls whether aim assist features on clients are enabled");
|
||||
input_viewSensitivity = Dvar::Register<float>("input_viewSensitivity", 1.0f, 0.0001f, 5.0f, Game::DVAR_ARCHIVE, "View Sensitivity");
|
||||
input_invertPitch = Dvar::Register<bool>("input_invertPitch", false, Game::DVAR_ARCHIVE, "Invert gamepad pitch");
|
||||
sv_allowAimAssist = Dvar::Register<bool>("sv_allowAimAssist", true, Game::DVAR_NONE, "Controls whether aim assist features on clients are enabled");
|
||||
aim_turnrate_pitch = Dvar::Var("aim_turnrate_pitch");
|
||||
aim_turnrate_pitch_ads = Dvar::Var("aim_turnrate_pitch_ads");
|
||||
aim_turnrate_yaw = Dvar::Var("aim_turnrate_yaw");
|
||||
|
@ -277,7 +277,7 @@ namespace Components
|
||||
// Overwrite SetString
|
||||
Utils::Hook(0x4CE5EE, Localization::SetStringStub, HOOK_CALL).install()->quick();
|
||||
|
||||
Localization::UseLocalization = Dvar::Register<bool>("ui_localize", true, Game::dvar_flag::DVAR_FLAG_NONE, "Use localization strings");
|
||||
Localization::UseLocalization = Dvar::Register<bool>("ui_localize", true, Game::dvar_flag::DVAR_NONE, "Use localization strings");
|
||||
|
||||
// Generate localized entries for custom classes above 10
|
||||
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, const std::string& name, bool* /*restrict*/)
|
||||
|
@ -242,7 +242,7 @@ namespace Components
|
||||
|
||||
Logger::Logger()
|
||||
{
|
||||
Dvar::Register<bool>("iw4x_onelog", false, Game::dvar_flag::DVAR_FLAG_LATCHED | Game::dvar_flag::DVAR_FLAG_SAVED, "Only write the game log to the 'userraw' OS folder");
|
||||
Dvar::Register<bool>("iw4x_onelog", false, Game::dvar_flag::DVAR_LATCH | Game::dvar_flag::DVAR_ARCHIVE, "Only write the game log to the 'userraw' OS folder");
|
||||
Utils::Hook(0x642139, Logger::BuildOSPathStub, HOOK_JUMP).install()->quick();
|
||||
|
||||
Logger::PipeOutput(nullptr);
|
||||
@ -261,7 +261,7 @@ namespace Components
|
||||
{
|
||||
Command::AddSV("log_add", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
Network::Address addr(params->get(1));
|
||||
|
||||
@ -273,7 +273,7 @@ namespace Components
|
||||
|
||||
Command::AddSV("log_del", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
int num = atoi(params->get(1));
|
||||
if (Utils::String::VA("%i", num) == std::string(params->get(1)) && static_cast<unsigned int>(num) < Logger::LoggingAddresses[0].size())
|
||||
@ -312,7 +312,7 @@ namespace Components
|
||||
|
||||
Command::AddSV("g_log_add", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
Network::Address addr(params->get(1));
|
||||
|
||||
@ -324,7 +324,7 @@ namespace Components
|
||||
|
||||
Command::AddSV("g_log_del", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
int num = atoi(params->get(1));
|
||||
if (Utils::String::VA("%i", num) == std::string(params->get(1)) && static_cast<unsigned int>(num) < Logger::LoggingAddresses[1].size())
|
||||
|
@ -544,7 +544,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Dvar::Register<bool>(Utils::String::VA("isDlcInstalled_%d", dlc.index), false, Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<bool>(Utils::String::VA("isDlcInstalled_%d", dlc.index), false, Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, "");
|
||||
|
||||
Maps::DlcPacks.push_back(dlc);
|
||||
Maps::UpdateDlcStatus();
|
||||
@ -690,7 +690,7 @@ namespace Components
|
||||
Game::dvar_t* Maps::GetSpecularDvar()
|
||||
{
|
||||
Game::dvar_t*& r_specular = *reinterpret_cast<Game::dvar_t**>(0x69F0D94);
|
||||
static Game::dvar_t* r_specularCustomMaps = Game::Dvar_RegisterBool("r_specularCustomMaps", false, Game::DVAR_FLAG_SAVED, "Allows shaders to use phong specular lighting on custom maps");
|
||||
static Game::dvar_t* r_specularCustomMaps = Game::Dvar_RegisterBool("r_specularCustomMaps", false, Game::DVAR_ARCHIVE, "Allows shaders to use phong specular lighting on custom maps");
|
||||
|
||||
if (Maps::IsCustomMap())
|
||||
{
|
||||
@ -769,8 +769,8 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<bool>("isDlcInstalled_All", false, Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<bool>("r_listSModels", false, Game::DVAR_FLAG_NONE, "Display a list of visible SModels");
|
||||
Dvar::Register<bool>("isDlcInstalled_All", false, Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, "");
|
||||
Dvar::Register<bool>("r_listSModels", false, Game::DVAR_NONE, "Display a list of visible SModels");
|
||||
|
||||
Maps::AddDlc({ 1, "Stimulus Pack", {"mp_complex", "mp_compact", "mp_storm", "mp_overgrown", "mp_crash"} });
|
||||
Maps::AddDlc({ 2, "Resurgence Pack", {"mp_abandon", "mp_vacant", "mp_trailerpark", "mp_strike", "mp_fuel2"} });
|
||||
|
@ -845,7 +845,7 @@ namespace Components
|
||||
|
||||
Command::Add("openmenu", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() != 2)
|
||||
if (params->size() != 2)
|
||||
{
|
||||
Logger::Print("USAGE: openmenu <menu name>\n");
|
||||
return;
|
||||
@ -913,7 +913,6 @@ namespace Components
|
||||
|
||||
Menus::~Menus()
|
||||
{
|
||||
Menus::CustomMenus.clear();
|
||||
Menus::FreeEverything();
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace Components
|
||||
if (Dedicated::IsEnabled()) return;
|
||||
|
||||
ModList::CurrentMod = 0;
|
||||
Dvar::Register("cl_modVidRestart", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Perform a vid_restart when loading a mod.");
|
||||
Dvar::Register("cl_modVidRestart", true, Game::dvar_flag::DVAR_ARCHIVE, "Perform a vid_restart when loading a mod.");
|
||||
|
||||
UIScript::Add("LoadMods", ModList::UIScript_LoadMods);
|
||||
UIScript::Add("RunMod", ModList::UIScript_RunMod);
|
||||
@ -101,9 +101,4 @@ namespace Components
|
||||
|
||||
UIFeeder::Add(9.0f, ModList::GetItemCount, ModList::GetItemText, ModList::Select);
|
||||
}
|
||||
|
||||
ModList::~ModList()
|
||||
{
|
||||
ModList::Mods.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
ModList();
|
||||
~ModList();
|
||||
|
||||
static void RunMod(const std::string& mod);
|
||||
|
||||
|
@ -260,20 +260,20 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Game::dvar_t* Movement::Dvar_RegisterLastStandSpeedScale(const char* name, float value,
|
||||
float min, float max, int, const char* desc)
|
||||
Game::dvar_t* Movement::Dvar_RegisterLastStandSpeedScale(const char* dvarName, float value,
|
||||
float min, float max, unsigned __int16 /*flags*/, const char* description)
|
||||
{
|
||||
Movement::PlayerLastStandCrawlSpeedScale = Dvar::Register<float>(name, value,
|
||||
min, max, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, desc);
|
||||
Movement::PlayerLastStandCrawlSpeedScale = Dvar::Register<float>(dvarName, value,
|
||||
min, max, Game::DVAR_CHEAT | Game::DVAR_CODINFO, description);
|
||||
|
||||
return Movement::PlayerLastStandCrawlSpeedScale.get<Game::dvar_t*>();
|
||||
}
|
||||
|
||||
Game::dvar_t* Movement::Dvar_RegisterSpectateSpeedScale(const char* name, float value,
|
||||
float min, float max, int, const char* desc)
|
||||
Game::dvar_t* Movement::Dvar_RegisterSpectateSpeedScale(const char* dvarName, float value,
|
||||
float min, float max, unsigned __int16 /*flags*/, const char* description)
|
||||
{
|
||||
Movement::PlayerSpectateSpeedScale = Dvar::Register<float>(name, value,
|
||||
min, max, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED, desc);
|
||||
Movement::PlayerSpectateSpeedScale = Dvar::Register<float>(dvarName, value,
|
||||
min, max, Game::DVAR_CHEAT | Game::DVAR_CODINFO, description);
|
||||
|
||||
return Movement::PlayerSpectateSpeedScale.get<Game::dvar_t*>();
|
||||
}
|
||||
@ -291,36 +291,36 @@ namespace Components
|
||||
};
|
||||
|
||||
Movement::PlayerDuckedSpeedScale = Dvar::Register<float>("player_duckedSpeedScale",
|
||||
0.65f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
|
||||
0.65f, 0.0f, 5.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
||||
"The scale applied to the player speed when ducking");
|
||||
|
||||
Movement::PlayerProneSpeedScale = Dvar::Register<float>("player_proneSpeedScale",
|
||||
0.15f, 0.0f, 5.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
|
||||
0.15f, 0.0f, 5.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
||||
"The scale applied to the player speed when crawling");
|
||||
|
||||
// 3arc naming convention
|
||||
Movement::CGUfoScaler = Dvar::Register<float>("cg_ufo_scaler",
|
||||
6.0f, 0.001f, 1000.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
|
||||
6.0f, 0.001f, 1000.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
||||
"The speed at which ufo camera moves");
|
||||
|
||||
Movement::CGNoclipScaler = Dvar::Register<float>("cg_noclip_scaler",
|
||||
3.0f, 0.001f, 1000.0f, Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_REPLICATED,
|
||||
3.0f, 0.001f, 1000.0f, Game::DVAR_CHEAT | Game::DVAR_CODINFO,
|
||||
"The speed at which noclip camera moves");
|
||||
|
||||
Movement::BGBounces = Game::Dvar_RegisterEnum("bg_bounces",
|
||||
bg_bouncesValues, Movement::DISABLED, Game::DVAR_FLAG_REPLICATED, "Bounce glitch settings");
|
||||
bg_bouncesValues, Movement::DISABLED, Game::DVAR_CODINFO, "Bounce glitch settings");
|
||||
|
||||
Movement::BGBouncesAllAngles = Dvar::Register<bool>("bg_bouncesAllAngles",
|
||||
false, Game::DVAR_FLAG_REPLICATED, "Force bounce from all angles");
|
||||
false, Game::DVAR_CODINFO, "Force bounce from all angles");
|
||||
|
||||
Movement::BGRocketJump = Dvar::Register<bool>("bg_rocketJump",
|
||||
false, Game::DVAR_FLAG_REPLICATED, "Enable CoD4 rocket jumps");
|
||||
false, Game::DVAR_CODINFO, "Enable CoD4 rocket jumps");
|
||||
|
||||
Movement::BGPlayerEjection = Dvar::Register<bool>("bg_playerEjection",
|
||||
true, Game::DVAR_FLAG_REPLICATED, "Push intersecting players away from each other");
|
||||
true, Game::DVAR_CODINFO, "Push intersecting players away from each other");
|
||||
|
||||
Movement::BGPlayerCollision = Dvar::Register<bool>("bg_playerCollision",
|
||||
true, Game::DVAR_FLAG_REPLICATED, "Push intersecting players away from each other");
|
||||
true, Game::DVAR_CODINFO, "Push intersecting players away from each other");
|
||||
});
|
||||
|
||||
// Hook PM_CmdScaleForStance in PM_CmdScale_Walk
|
||||
|
@ -40,7 +40,7 @@ namespace Components
|
||||
static int StuckInClient_Hk(Game::gentity_s* self);
|
||||
static void CM_TransformedCapsuleTrace_Hk(Game::trace_t* results, const float* start, const float* end, const Game::Bounds* bounds, const Game::Bounds* capsule, int contents, const float* origin, const float* angles);
|
||||
|
||||
static Game::dvar_t* Dvar_RegisterLastStandSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc);
|
||||
static Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* name, float value, float min, float max, int flags, const char* desc);
|
||||
static Game::dvar_t* Dvar_RegisterLastStandSpeedScale(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description);
|
||||
static Game::dvar_t* Dvar_RegisterSpectateSpeedScale(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description);
|
||||
};
|
||||
}
|
||||
|
@ -39,9 +39,4 @@ namespace Components
|
||||
|
||||
MusicalTalent::Replace("music_mainmenu_mp", "hz_t_menumusic.mp3");
|
||||
}
|
||||
|
||||
MusicalTalent::~MusicalTalent()
|
||||
{
|
||||
MusicalTalent::SoundAliasList.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
MusicalTalent();
|
||||
~MusicalTalent();
|
||||
|
||||
static void Replace(const std::string& sound, const char* file);
|
||||
|
||||
|
@ -403,11 +403,4 @@ namespace Components
|
||||
Network::SendRaw(address, address.getString());
|
||||
});
|
||||
}
|
||||
|
||||
Network::~Network()
|
||||
{
|
||||
Network::SelectedPacket.clear();
|
||||
Network::PacketHandlers.clear();
|
||||
Network::StartupSignal.clear();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,6 @@ namespace Components
|
||||
typedef void(CallbackRaw)();
|
||||
|
||||
Network();
|
||||
~Network();
|
||||
|
||||
static unsigned short GetPort();
|
||||
|
||||
|
@ -39,9 +39,9 @@ namespace Components
|
||||
{
|
||||
if (ZoneBuilder::IsEnabled() || Dedicated::IsEnabled()) return; // Maybe also dedi?
|
||||
|
||||
Dvar::Register<bool>("g_firstLaunch", true, Game::DVAR_FLAG_SAVED, "");
|
||||
Dvar::Register<bool>("g_firstLaunch", true, Game::DVAR_ARCHIVE, "");
|
||||
|
||||
Dvar::Register<int>("cl_updateoldversion", REVISION, REVISION, REVISION, Game::DVAR_FLAG_WRITEPROTECTED, "Current version number.");
|
||||
Dvar::Register<int>("cl_updateoldversion", REVISION, REVISION, REVISION, Game::DVAR_WRITEPROTECTED, "Current version number.");
|
||||
|
||||
UIScript::Add("checkFirstLaunch", [](UIScript::Token)
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ namespace Components
|
||||
|
||||
Command::Add("addnode", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
Node::Add({ params->get(1) });
|
||||
});
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace Components
|
||||
|
||||
Game::dvar_t* Party::RegisterMinPlayers(const char* name, int /*value*/, int /*min*/, int max, Game::dvar_flag flag, const char* description)
|
||||
{
|
||||
return Dvar::Register<int>(name, 1, 1, max, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED | flag, description).get<Game::dvar_t*>();
|
||||
return Dvar::Register<int>(name, 1, 1, max, Game::dvar_flag::DVAR_WRITEPROTECTED | flag, description).get<Game::dvar_t*>();
|
||||
}
|
||||
|
||||
bool Party::PlaylistAwaiting()
|
||||
@ -150,8 +150,8 @@ namespace Components
|
||||
|
||||
Party::Party()
|
||||
{
|
||||
static Game::dvar_t* partyEnable = Dvar::Register<bool>("party_enable", Dedicated::IsEnabled(), Game::dvar_flag::DVAR_FLAG_NONE, "Enable party system").get<Game::dvar_t*>();
|
||||
Dvar::Register<bool>("xblive_privatematch", true, Game::dvar_flag::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
static Game::dvar_t* partyEnable = Dvar::Register<bool>("party_enable", Dedicated::IsEnabled(), Game::dvar_flag::DVAR_NONE, "Enable party system").get<Game::dvar_t*>();
|
||||
Dvar::Register<bool>("xblive_privatematch", true, Game::dvar_flag::DVAR_WRITEPROTECTED, "");
|
||||
|
||||
// various changes to SV_DirectConnect-y stuff to allow non-party joinees
|
||||
Utils::Hook::Set<WORD>(0x460D96, 0x90E9);
|
||||
@ -249,19 +249,19 @@ namespace Components
|
||||
Utils::Hook::Set<const char*>(0x5E3772, "sv_maxclients");
|
||||
|
||||
// Unlatch maxclient dvars
|
||||
Utils::Hook::Xor<BYTE>(0x426187, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<BYTE>(0x4D374E, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<BYTE>(0x5E376A, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<DWORD>(0x4261A1, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<DWORD>(0x4D376D, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<DWORD>(0x5E3789, Game::dvar_flag::DVAR_FLAG_LATCHED);
|
||||
Utils::Hook::Xor<BYTE>(0x426187, Game::dvar_flag::DVAR_LATCH);
|
||||
Utils::Hook::Xor<BYTE>(0x4D374E, Game::dvar_flag::DVAR_LATCH);
|
||||
Utils::Hook::Xor<BYTE>(0x5E376A, Game::dvar_flag::DVAR_LATCH);
|
||||
Utils::Hook::Xor<DWORD>(0x4261A1, Game::dvar_flag::DVAR_LATCH);
|
||||
Utils::Hook::Xor<DWORD>(0x4D376D, Game::dvar_flag::DVAR_LATCH);
|
||||
Utils::Hook::Xor<DWORD>(0x5E3789, Game::dvar_flag::DVAR_LATCH);
|
||||
|
||||
// Patch Live_PlayerHasLoopbackAddr
|
||||
//Utils::Hook::Set<DWORD>(0x418F30, 0x90C3C033);
|
||||
|
||||
Command::Add("connect", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -513,9 +513,4 @@ namespace Components
|
||||
Friends::UpdateServer(address, info.get("hostname"), info.get("mapname"));
|
||||
});
|
||||
}
|
||||
|
||||
Party::~Party()
|
||||
{
|
||||
Party::LobbyMap.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Party();
|
||||
~Party();
|
||||
|
||||
static Network::Address Target();
|
||||
static void Connect(Network::Address target);
|
||||
|
@ -61,7 +61,7 @@ namespace Components
|
||||
|
||||
PlayerName::PlayerName()
|
||||
{
|
||||
sv_allowColoredNames = Dvar::Register<bool>("sv_allowColoredNames", true, Game::dvar_flag::DVAR_FLAG_NONE, "Allow colored names on the server");
|
||||
sv_allowColoredNames = Dvar::Register<bool>("sv_allowColoredNames", true, Game::dvar_flag::DVAR_NONE, "Allow colored names on the server");
|
||||
|
||||
// Disable SV_UpdateUserinfo_f, to block changing the name ingame
|
||||
Utils::Hook::Set<BYTE>(0x6258D0, 0xC3);
|
||||
|
@ -21,7 +21,7 @@ namespace Components
|
||||
|
||||
Dvar::Var("xblive_privateserver").set(false);
|
||||
|
||||
std::string playlistFilename = Dvar::Var("playlistFilename").get<const char*>();
|
||||
auto playlistFilename = Dvar::Var("playlistFilename").get<std::string>();
|
||||
FileSystem::File playlist(playlistFilename);
|
||||
|
||||
if (playlist.exists())
|
||||
@ -190,11 +190,4 @@ namespace Components
|
||||
Network::Handle("playlistResponse", PlaylistReponse);
|
||||
Network::Handle("playlistInvalidPassword", PlaylistInvalidPassword);
|
||||
}
|
||||
|
||||
Playlist::~Playlist()
|
||||
{
|
||||
Playlist::MapRelocation.clear();
|
||||
Playlist::CurrentPlaylistBuffer.clear();
|
||||
Playlist::ReceivedPlaylistBuffer.clear();
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ namespace Components
|
||||
typedef void(*Callback)();
|
||||
|
||||
Playlist();
|
||||
~Playlist();
|
||||
|
||||
static void LoadPlaylist();
|
||||
|
||||
|
@ -86,17 +86,15 @@ namespace Components
|
||||
|
||||
void QuickPatch::SelectStringTableEntryInDvarStub()
|
||||
{
|
||||
Command::ClientParams args;
|
||||
Command::ClientParams params;
|
||||
|
||||
if (args.length() >= 4)
|
||||
if (params.size() >= 4)
|
||||
{
|
||||
std::string cmd = args[0];
|
||||
std::string table = args[1];
|
||||
std::string col = args[2];
|
||||
std::string dvarName = args[3];
|
||||
Game::dvar_t* dvar = Game::Dvar_FindVar(dvarName.data());
|
||||
const auto* dvarName = params[3];
|
||||
const auto* dvar = Game::Dvar_FindVar(dvarName);
|
||||
|
||||
if (Command::Find(dvarName) || (dvar && (dvar->flags & (Game::DVAR_FLAG_WRITEPROTECTED | Game::DVAR_FLAG_CHEAT | Game::DVAR_FLAG_READONLY))))
|
||||
if (Command::Find(dvarName) ||
|
||||
(dvar != nullptr && dvar->flags & (Game::DVAR_WRITEPROTECTED | Game::DVAR_CHEAT | Game::DVAR_READONLY)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -238,7 +236,7 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
Game::dvar_t* QuickPatch::Dvar_RegisterAspectRatioDvar(const char* name, char**, int defaultVal, int flags, const char* description)
|
||||
Game::dvar_t* QuickPatch::Dvar_RegisterAspectRatioDvar(const char* dvarName, const char** /*valueList*/, int defaultIndex, unsigned __int16 flags, const char* description)
|
||||
{
|
||||
static const char* r_aspectRatioEnum[] =
|
||||
{
|
||||
@ -256,7 +254,7 @@ namespace Components
|
||||
"Screen aspect ratio. Divide the width by the height in order to get the aspect ratio value. For example: 16 / 9 = 1,77");
|
||||
|
||||
// register enumeration dvar
|
||||
return Game::Dvar_RegisterEnum(name, r_aspectRatioEnum, defaultVal, flags, description);
|
||||
return Game::Dvar_RegisterEnum(dvarName, r_aspectRatioEnum, defaultIndex, flags, description);
|
||||
}
|
||||
|
||||
void QuickPatch::SetAspectRatio()
|
||||
@ -353,13 +351,13 @@ namespace Components
|
||||
Game::dvar_t* QuickPatch::Dvar_RegisterUIBuildLocation(const char* dvarName,
|
||||
float /*x*/, float /*y*/, float min, float max, int /*flags*/, const char* description)
|
||||
{
|
||||
return Game::Dvar_RegisterVec2(dvarName, -60.0f, 474.0f, min, max, Game::DVAR_FLAG_READONLY, description);
|
||||
return Game::Dvar_RegisterVec2(dvarName, -60.0f, 474.0f, min, max, Game::DVAR_READONLY, description);
|
||||
}
|
||||
|
||||
QuickPatch::QuickPatch()
|
||||
{
|
||||
// quit_hard
|
||||
Command::Add("quit_hard", [](Command::Params*)
|
||||
// quitHard
|
||||
Command::Add("quitHard", [](Command::Params*)
|
||||
{
|
||||
int data = false;
|
||||
const Utils::Library ntdll("ntdll.dll");
|
||||
@ -374,9 +372,9 @@ namespace Components
|
||||
Utils::Hook(0x4F66A3, CL_KeyEvent_ConsoleEscape_Stub, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Intermission time dvar
|
||||
Game::Dvar_RegisterFloat("scr_intermissionTime", 10, 0, 120, Game::DVAR_FLAG_REPLICATED | Game::DVAR_FLAG_DEDISAVED, "Time in seconds before match server loads the next map");
|
||||
Game::Dvar_RegisterFloat("scr_intermissionTime", 10, 0, 120, Game::dvar_flag::DVAR_NONE, "Time in seconds before match server loads the next map");
|
||||
|
||||
g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_FLAG_REPLICATED, "Perform antilag");
|
||||
g_antilag = Game::Dvar_RegisterBool("g_antilag", true, Game::DVAR_CODINFO, "Perform antilag");
|
||||
Utils::Hook(0x5D6D56, QuickPatch::ClientEventsFireWeaponStub, HOOK_JUMP).install()->quick();
|
||||
Utils::Hook(0x5D6D6A, QuickPatch::ClientEventsFireWeaponMeleeStub, HOOK_JUMP).install()->quick();
|
||||
|
||||
@ -477,7 +475,7 @@ namespace Components
|
||||
|
||||
// Numerical ping (cg_scoreboardPingText 1)
|
||||
Utils::Hook::Set<BYTE>(0x45888E, 1);
|
||||
Utils::Hook::Set<BYTE>(0x45888C, Game::dvar_flag::DVAR_FLAG_CHEAT);
|
||||
Utils::Hook::Set<BYTE>(0x45888C, Game::dvar_flag::DVAR_CHEAT);
|
||||
|
||||
// increase font sizes for chat on higher resolutions
|
||||
static float float13 = 13.0f;
|
||||
@ -633,7 +631,7 @@ namespace Components
|
||||
});
|
||||
|
||||
// Fix mouse pitch adjustments
|
||||
Dvar::Register<bool>("ui_mousePitch", false, Game::DVAR_FLAG_SAVED, "");
|
||||
Dvar::Register<bool>("ui_mousePitch", false, Game::DVAR_ARCHIVE, "");
|
||||
UIScript::Add("updateui_mousePitch", [](UIScript::Token)
|
||||
{
|
||||
if (Dvar::Var("ui_mousePitch").get<bool>())
|
||||
@ -671,7 +669,7 @@ namespace Components
|
||||
|
||||
Command::Add("dumptechsets", [](Command::Params* param)
|
||||
{
|
||||
if (param->length() != 2)
|
||||
if (param->size() != 2)
|
||||
{
|
||||
Logger::Print("usage: dumptechsets <fastfile> | all\n");
|
||||
return;
|
||||
@ -843,6 +841,7 @@ namespace Components
|
||||
}
|
||||
});
|
||||
|
||||
#ifdef DEBUG
|
||||
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, const std::string& /*name*/, bool* /*restrict*/)
|
||||
{
|
||||
if (type == Game::XAssetType::ASSET_TYPE_GFXWORLD)
|
||||
@ -857,9 +856,10 @@ namespace Components
|
||||
Utils::IO::WriteFile("userraw/logs/matlog.txt", buffer);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
// Dvars
|
||||
Dvar::Register<bool>("ui_streamFriendly", false, Game::DVAR_FLAG_SAVED, "Stream friendly UI");
|
||||
Dvar::Register<bool>("ui_streamFriendly", false, Game::DVAR_ARCHIVE, "Stream friendly UI");
|
||||
|
||||
// Debug patches
|
||||
#ifdef DEBUG
|
||||
|
@ -28,7 +28,7 @@ namespace Components
|
||||
static void InvalidNameStub();
|
||||
|
||||
static Dvar::Var r_customAspectRatio;
|
||||
static Game::dvar_t* Dvar_RegisterAspectRatioDvar(const char* name, char** enumValues, int defaultVal, int flags, const char* description);
|
||||
static Game::dvar_t* Dvar_RegisterAspectRatioDvar(const char* dvarName, const char** valueList, int defaultIndex, unsigned __int16 flags, const char* description);
|
||||
static void SetAspectRatioStub();
|
||||
static void SetAspectRatio();
|
||||
|
||||
|
@ -7,19 +7,22 @@ namespace Components
|
||||
|
||||
std::string RCon::Password;
|
||||
|
||||
Dvar::Var RCon::RconPassword;
|
||||
Dvar::Var RCon::RconLogRequests;
|
||||
|
||||
RCon::RCon()
|
||||
{
|
||||
Command::Add("rcon", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string operation = params->get(1);
|
||||
if (operation == "login")
|
||||
const auto* operation = params->get(1);
|
||||
if (std::strcmp(operation, "login") == 0)
|
||||
{
|
||||
if (params->length() < 3) return;
|
||||
if (params->size() < 3) return;
|
||||
RCon::Password = params->get(2);
|
||||
}
|
||||
else if (operation == "logout")
|
||||
else if (std::strcmp(operation, "logout") == 0)
|
||||
{
|
||||
RCon::Password.clear();
|
||||
}
|
||||
@ -75,8 +78,8 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("rcon_password", "", Game::dvar_flag::DVAR_FLAG_NONE, "The password for rcon");
|
||||
Dvar::Register<bool>("log_rcon_requests", false, Game::dvar_flag::DVAR_FLAG_NONE, "Print remote commands in the output log");
|
||||
RCon::RconPassword = Dvar::Register<const char*>("rcon_password", "", Game::dvar_flag::DVAR_NONE, "The password for rcon");
|
||||
RCon::RconLogRequests = Dvar::Register<bool>("rcon_log_requests", false, Game::dvar_flag::DVAR_NONE, "Print remote commands in the output log");
|
||||
});
|
||||
|
||||
Network::Handle("rcon", [](Network::Address address, const std::string& _data)
|
||||
@ -100,7 +103,7 @@ namespace Components
|
||||
password.erase(password.begin());
|
||||
}
|
||||
|
||||
std::string svPassword = Dvar::Var("rcon_password").get<std::string>();
|
||||
const std::string svPassword = RCon::RconPassword.get<std::string>();
|
||||
|
||||
if (svPassword.empty())
|
||||
{
|
||||
@ -114,7 +117,7 @@ namespace Components
|
||||
outputBuffer.clear();
|
||||
|
||||
#ifndef DEBUG
|
||||
if (Dvar::Var("log_rcon_requests").get<bool>())
|
||||
if (RCon::RconLogRequests.get<bool>())
|
||||
#endif
|
||||
{
|
||||
Logger::Print("Executing RCon request from %s: %s\n", address.getCString(), command.data());
|
||||
@ -173,9 +176,4 @@ namespace Components
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
RCon::~RCon()
|
||||
{
|
||||
RCon::Password.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
RCon();
|
||||
~RCon();
|
||||
|
||||
private:
|
||||
class Container
|
||||
@ -25,5 +24,8 @@ namespace Components
|
||||
// For sr0's fucking rcon command
|
||||
// Son of a bitch! Annoying me day and night with that shit...
|
||||
static std::string Password;
|
||||
|
||||
static Dvar::Var RconPassword;
|
||||
static Dvar::Var RconLogRequests;
|
||||
};
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace Components
|
||||
|
||||
Command::Add("dumpraw", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2)
|
||||
if (params->size() < 2)
|
||||
{
|
||||
Logger::Print("Specify a filename!\n");
|
||||
return;
|
||||
|
@ -546,12 +546,12 @@ namespace Components
|
||||
nullptr
|
||||
};
|
||||
|
||||
Renderer::r_drawModelBoundingBoxes = Game::Dvar_RegisterEnum("r_drawModelBoundingBoxes", values, 0, Game::DVAR_FLAG_CHEAT, "Draw scene model bounding boxes");
|
||||
Renderer::r_drawSceneModelCollisions = Game::Dvar_RegisterBool("r_drawSceneModelCollisions", false, Game::DVAR_FLAG_CHEAT, "Draw scene model collisions");
|
||||
Renderer::r_drawTriggers = Game::Dvar_RegisterBool("r_drawTriggers", false, Game::DVAR_FLAG_CHEAT, "Draw triggers");
|
||||
Renderer::r_drawModelNames = Game::Dvar_RegisterEnum("r_drawModelNames", values, 0, Game::DVAR_FLAG_CHEAT, "Draw all model names");
|
||||
Renderer::r_drawAABBTrees = Game::Dvar_RegisterBool("r_drawAabbTrees", false, Game::DVAR_FLAG_CHEAT, "Draw aabb trees");
|
||||
Renderer::r_playerDrawDebugDistance = Game::Dvar_RegisterInt("r_drawDebugDistance", 1000, 0, 50000, Game::DVAR_FLAG_SAVED, "r_draw debug functions draw distance, relative to the player");
|
||||
Renderer::r_drawModelBoundingBoxes = Game::Dvar_RegisterEnum("r_drawModelBoundingBoxes", values, 0, Game::DVAR_CHEAT, "Draw scene model bounding boxes");
|
||||
Renderer::r_drawSceneModelCollisions = Game::Dvar_RegisterBool("r_drawSceneModelCollisions", false, Game::DVAR_CHEAT, "Draw scene model collisions");
|
||||
Renderer::r_drawTriggers = Game::Dvar_RegisterBool("r_drawTriggers", false, Game::DVAR_CHEAT, "Draw triggers");
|
||||
Renderer::r_drawModelNames = Game::Dvar_RegisterEnum("r_drawModelNames", values, 0, Game::DVAR_CHEAT, "Draw all model names");
|
||||
Renderer::r_drawAABBTrees = Game::Dvar_RegisterBool("r_drawAabbTrees", false, Game::DVAR_CHEAT, "Draw aabb trees");
|
||||
Renderer::r_playerDrawDebugDistance = Game::Dvar_RegisterInt("r_drawDebugDistance", 1000, 0, 50000, Game::DVAR_ARCHIVE, "r_draw debug functions draw distance, relative to the player");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -705,14 +705,6 @@ namespace Components
|
||||
|
||||
Script::~Script()
|
||||
{
|
||||
Script::ScriptName.clear();
|
||||
Script::ScriptHandles.clear();
|
||||
Script::ScriptNameStack.clear();
|
||||
Script::ScriptFunctions.clear();
|
||||
Script::ReplacedFunctions.clear();
|
||||
Script::VMShutdownSignal.clear();
|
||||
|
||||
Script::ScriptStorage.clear();
|
||||
Script::ScriptBaseProgramNum.clear();
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ namespace Components
|
||||
|
||||
bool ServerCommands::OnServerCommand()
|
||||
{
|
||||
Command::ClientParams params(*Game::cmd_id);
|
||||
Command::ClientParams params;
|
||||
|
||||
for (auto &serverCommandCB : ServerCommands::Commands)
|
||||
for (const auto& serverCommandCB : ServerCommands::Commands)
|
||||
{
|
||||
if (params.length() >= 1)
|
||||
if (params.size() >= 1)
|
||||
{
|
||||
if (params.get(0)[0] == serverCommandCB.first)
|
||||
{
|
||||
@ -65,9 +65,4 @@ namespace Components
|
||||
// Server command receive hook
|
||||
Utils::Hook(0x59449F, ServerCommands::OnServerCommandStub).install()->quick();
|
||||
}
|
||||
|
||||
ServerCommands::~ServerCommands()
|
||||
{
|
||||
ServerCommands::Commands.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
ServerCommands();
|
||||
~ServerCommands();
|
||||
|
||||
static void OnCommand(std::int32_t cmd, Utils::Slot<bool(Command::Params*)> cb);
|
||||
|
||||
|
@ -734,16 +734,16 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<bool>("ui_serverSelected", false, Game::dvar_flag::DVAR_FLAG_NONE, "Whether a server has been selected in the serverlist");
|
||||
Dvar::Register<const char*>("ui_serverSelectedMap", "mp_afghan", Game::dvar_flag::DVAR_FLAG_NONE, "Map of the selected server");
|
||||
Dvar::Register<bool>("ui_serverSelected", false, Game::dvar_flag::DVAR_NONE, "Whether a server has been selected in the serverlist");
|
||||
Dvar::Register<const char*>("ui_serverSelectedMap", "mp_afghan", Game::dvar_flag::DVAR_NONE, "Map of the selected server");
|
||||
|
||||
Dvar::Register<int>("net_serverQueryLimit", 1, 1, 10, Dedicated::IsEnabled() ? 0 : Game::dvar_flag::DVAR_FLAG_SAVED, "Amount of server queries per frame");
|
||||
Dvar::Register<int>("net_serverFrames", 30, 1, 60, Dedicated::IsEnabled() ? 0 : Game::dvar_flag::DVAR_FLAG_SAVED, "Amount of server query frames per second");
|
||||
Dvar::Register<int>("net_serverQueryLimit", 1, 1, 10, Dedicated::IsEnabled() ? Game::dvar_flag::DVAR_NONE : Game::dvar_flag::DVAR_ARCHIVE, "Amount of server queries per frame");
|
||||
Dvar::Register<int>("net_serverFrames", 30, 1, 60, Dedicated::IsEnabled() ? Game::dvar_flag::DVAR_NONE : Game::dvar_flag::DVAR_ARCHIVE, "Amount of server query frames per second");
|
||||
});
|
||||
|
||||
// Fix ui_netsource dvar
|
||||
Utils::Hook::Nop(0x4CDEEC, 5); // Don't reset the netsource when gametypes aren't loaded
|
||||
Dvar::Register<int>("ui_netSource", 1, 0, 2, Game::DVAR_FLAG_SAVED, reinterpret_cast<const char*>(0x6D9F08));
|
||||
Dvar::Register<int>("ui_netSource", 1, 0, 2, Game::DVAR_ARCHIVE, reinterpret_cast<const char*>(0x6D9F08));
|
||||
|
||||
//Localization::Set("MPUI_SERVERQUERIED", "Sent requests: 0/0");
|
||||
Localization::Set("MPUI_SERVERQUERIED", "Servers: 0\nPlayers: 0 (0)");
|
||||
@ -782,8 +782,8 @@ namespace Components
|
||||
// Set default masterServerName + port and save it
|
||||
#ifdef USE_LEGACY_SERVER_LIST
|
||||
Utils::Hook::Set<char*>(0x60AD92, "127.0.0.1");
|
||||
Utils::Hook::Set<BYTE>(0x60AD90, Game::dvar_flag::DVAR_FLAG_SAVED); // masterServerName
|
||||
Utils::Hook::Set<BYTE>(0x60ADC6, Game::dvar_flag::DVAR_FLAG_SAVED); // masterPort
|
||||
Utils::Hook::Set<BYTE>(0x60AD90, Game::dvar_flag::DVAR_ARCHIVE); // masterServerName
|
||||
Utils::Hook::Set<BYTE>(0x60ADC6, Game::dvar_flag::DVAR_ARCHIVE); // masterPort
|
||||
#endif
|
||||
|
||||
// Add server list feeder
|
||||
@ -880,15 +880,8 @@ namespace Components
|
||||
|
||||
ServerList::~ServerList()
|
||||
{
|
||||
ServerList::OnlineList.clear();
|
||||
ServerList::OfflineList.clear();
|
||||
ServerList::FavouriteList.clear();
|
||||
ServerList::VisibleList.clear();
|
||||
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> _(ServerList::RefreshContainer.mutex);
|
||||
ServerList::RefreshContainer.awatingList = false;
|
||||
ServerList::RefreshContainer.servers.clear();
|
||||
}
|
||||
std::lock_guard<std::recursive_mutex> _(ServerList::RefreshContainer.mutex);
|
||||
ServerList::RefreshContainer.awatingList = false;
|
||||
ServerList::RefreshContainer.servers.clear();
|
||||
}
|
||||
}
|
||||
|
@ -91,4 +91,4 @@ namespace Components
|
||||
Utils::Hook(0x4A54ED, SlowMotion::DrawConnectionInterruptedStub, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x4A54FB, SlowMotion::DrawConnectionInterruptedStub, HOOK_CALL).install()->quick();
|
||||
}
|
||||
}
|
||||
}
|
@ -9,9 +9,9 @@ namespace Components
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("ui_startupMessage", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupMessageTitle", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupNextButtonText", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupMessage", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupMessageTitle", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupNextButtonText", "", Game::DVAR_EXTERNAL | Game::DVAR_WRITEPROTECTED, "");
|
||||
});
|
||||
|
||||
UIScript::Add("nextStartupMessage", [](UIScript::Token)
|
||||
@ -34,11 +34,6 @@ namespace Components
|
||||
});
|
||||
}
|
||||
|
||||
StartupMessages::~StartupMessages()
|
||||
{
|
||||
StartupMessages::MessageList.clear();
|
||||
}
|
||||
|
||||
void StartupMessages::AddMessage(const std::string& message)
|
||||
{
|
||||
StartupMessages::MessageList.push_back(message);
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
StartupMessages();
|
||||
~StartupMessages();
|
||||
|
||||
static void AddMessage(const std::string& message);
|
||||
|
||||
|
@ -107,9 +107,4 @@ namespace Components
|
||||
// Write stats to mod folder if a mod is loaded
|
||||
Utils::Hook(0x682F7B, Stats::SaveStats, HOOK_CALL).install()->quick();
|
||||
}
|
||||
|
||||
Stats::~Stats()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
Stats();
|
||||
~Stats();
|
||||
|
||||
static bool IsMaxLevel();
|
||||
|
||||
|
@ -76,9 +76,4 @@ namespace Components
|
||||
return header;
|
||||
});
|
||||
}
|
||||
|
||||
StringTable::~StringTable()
|
||||
{
|
||||
StringTable::StringTableMap.clear();
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ namespace Components
|
||||
{
|
||||
public:
|
||||
StringTable();
|
||||
~StringTable();
|
||||
|
||||
private:
|
||||
static std::unordered_map<std::string, Game::StringTable*> StringTableMap;
|
||||
|
@ -311,9 +311,4 @@ namespace Components
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
StructuredData::~StructuredData()
|
||||
{
|
||||
StructuredData::MemAllocator.clear();
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ namespace Components
|
||||
};
|
||||
|
||||
StructuredData();
|
||||
~StructuredData();
|
||||
|
||||
private:
|
||||
static bool UpdateVersionOffsets(Game::StructuredDataDefSet *set, Game::StructuredDataBuffer *buffer, Game::StructuredDataDef *oldDef);
|
||||
|
@ -1598,10 +1598,10 @@ namespace Components
|
||||
{
|
||||
currentColorTable = &colorTableDefault;
|
||||
|
||||
cg_newColors = Dvar::Register<bool>("cg_newColors", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Use Warfare 2 color code style.");
|
||||
cg_fontIconAutocomplete = Dvar::Register<bool>("cg_fontIconAutocomplete", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Show autocomplete for fonticons when typing.");
|
||||
cg_fontIconAutocompleteHint = Dvar::Register<bool>("cg_fontIconAutocompleteHint", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Show hint text in autocomplete for fonticons.");
|
||||
sv_customTextColor = Game::Dvar_RegisterColor("sv_customTextColor", 1, 0.7f, 0, 1, Game::dvar_flag::DVAR_FLAG_REPLICATED, "Color for the extended color code.");
|
||||
cg_newColors = Dvar::Register<bool>("cg_newColors", true, Game::dvar_flag::DVAR_ARCHIVE, "Use Warfare 2 color code style.");
|
||||
cg_fontIconAutocomplete = Dvar::Register<bool>("cg_fontIconAutocomplete", true, Game::dvar_flag::DVAR_ARCHIVE, "Show autocomplete for fonticons when typing.");
|
||||
cg_fontIconAutocompleteHint = Dvar::Register<bool>("cg_fontIconAutocompleteHint", true, Game::dvar_flag::DVAR_ARCHIVE, "Show hint text in autocomplete for fonticons.");
|
||||
sv_customTextColor = Game::Dvar_RegisterColor("sv_customTextColor", 1, 0.7f, 0, 1, Game::dvar_flag::DVAR_CODINFO, "Color for the extended color code.");
|
||||
|
||||
// Initialize font icons when initializing UI
|
||||
Utils::Hook(0x4B5422, UI_Init_Hk, HOOK_CALL).install()->quick();
|
||||
@ -1616,11 +1616,11 @@ namespace Components
|
||||
Utils::Hook(0x417770, ColorIndex, HOOK_JUMP).install()->quick();
|
||||
|
||||
// Add a colorblind mode for team colors
|
||||
r_colorBlind = Dvar::Register<bool>("r_colorBlind", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Use color-blindness-friendly colors");
|
||||
r_colorBlind = Dvar::Register<bool>("r_colorBlind", false, Game::dvar_flag::DVAR_ARCHIVE, "Use color-blindness-friendly colors");
|
||||
// A dark red
|
||||
g_ColorBlind_EnemyTeam = Game::Dvar_RegisterColor("g_ColorBlind_EnemyTeam", 0.659f, 0.088f, 0.145f, 1, Game::dvar_flag::DVAR_FLAG_SAVED, "Enemy team color for colorblind mode");
|
||||
g_ColorBlind_EnemyTeam = Game::Dvar_RegisterColor("g_ColorBlind_EnemyTeam", 0.659f, 0.088f, 0.145f, 1, Game::dvar_flag::DVAR_ARCHIVE, "Enemy team color for colorblind mode");
|
||||
// A bright yellow
|
||||
g_ColorBlind_MyTeam = Game::Dvar_RegisterColor("g_ColorBlind_MyTeam", 1, 0.859f, 0.125f, 1, Game::dvar_flag::DVAR_FLAG_SAVED, "Ally team color for colorblind mode");
|
||||
g_ColorBlind_MyTeam = Game::Dvar_RegisterColor("g_ColorBlind_MyTeam", 1, 0.859f, 0.125f, 1, Game::dvar_flag::DVAR_ARCHIVE, "Ally team color for colorblind mode");
|
||||
|
||||
// Replace team colors with colorblind team colors when colorblind is enabled
|
||||
Utils::Hook(0x406530, GetUnpackedColorByNameStub, HOOK_JUMP).install()->quick();
|
||||
|
@ -342,8 +342,8 @@ namespace Components
|
||||
|
||||
Theatre::Theatre()
|
||||
{
|
||||
Dvar::Register<bool>("cl_autoRecord", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Automatically record games.");
|
||||
Dvar::Register<int>("cl_demosKeep", 30, 1, 999, Game::dvar_flag::DVAR_FLAG_SAVED, "How many demos to keep with autorecord.");
|
||||
Dvar::Register<bool>("cl_autoRecord", true, Game::dvar_flag::DVAR_ARCHIVE, "Automatically record games.");
|
||||
Dvar::Register<int>("cl_demosKeep", 30, 1, 999, Game::dvar_flag::DVAR_ARCHIVE, "How many demos to keep with autorecord.");
|
||||
|
||||
Utils::Hook(0x5A8370, Theatre::GamestateWriteStub, HOOK_CALL).install()->quick();
|
||||
Utils::Hook(0x5A85D2, Theatre::RecordGamestateStub, HOOK_CALL).install()->quick();
|
||||
|
@ -383,9 +383,9 @@ namespace Components
|
||||
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("ui_map_long", "Afghan", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_map_name", "mp_afghan", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_map_desc", "", Game::dvar_flag::DVAR_FLAG_NONE, "");
|
||||
Dvar::Register<const char*>("ui_map_long", "Afghan", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_map_name", "mp_afghan", Game::dvar_flag::DVAR_NONE, "");
|
||||
Dvar::Register<const char*>("ui_map_desc", "", Game::dvar_flag::DVAR_NONE, "");
|
||||
});
|
||||
|
||||
// Get feeder item count
|
||||
|
@ -37,7 +37,10 @@ namespace Components
|
||||
int Weapon::ParseWeaponConfigStrings()
|
||||
{
|
||||
Command::ClientParams params;
|
||||
if (params.length() <= 1) return 0;
|
||||
|
||||
if (params.size() <= 1)
|
||||
return 0;
|
||||
|
||||
int index = atoi(params[1]);
|
||||
|
||||
if (index >= 4139)
|
||||
|
@ -144,8 +144,8 @@ namespace Components
|
||||
Window::Window()
|
||||
{
|
||||
// Borderless window
|
||||
Window::NoBorder = Dvar::Register<bool>("r_noborder", true, Game::dvar_flag::DVAR_FLAG_SAVED, "Do not use a border in windowed mode");
|
||||
Window::NativeCursor = Dvar::Register<bool>("ui_nativeCursor", false, Game::dvar_flag::DVAR_FLAG_SAVED, "Display native cursor");
|
||||
Window::NoBorder = Dvar::Register<bool>("r_noborder", true, Game::dvar_flag::DVAR_ARCHIVE, "Do not use a border in windowed mode");
|
||||
Window::NativeCursor = Dvar::Register<bool>("ui_nativeCursor", false, Game::dvar_flag::DVAR_ARCHIVE, "Display native cursor");
|
||||
|
||||
Utils::Hook(0x507643, Window::StyleHookStub, HOOK_CALL).install()->quick();
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ namespace Components
|
||||
|
||||
Command::Add("verifyzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
/*
|
||||
Utils::Hook(0x4AE9C2, [] {
|
||||
Game::WeaponCompleteDef** varPtr = (Game::WeaponCompleteDef**)0x112A9F4;
|
||||
@ -1165,7 +1165,7 @@ namespace Components
|
||||
|
||||
Command::Add("buildzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string zoneName = params->get(1);
|
||||
Logger::Print("Building zone '%s'...\n", zoneName.data());
|
||||
@ -1455,7 +1455,7 @@ namespace Components
|
||||
|
||||
Command::Add("listassets", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
Game::XAssetType type = Game::DB_GetXAssetNameType(params->get(1));
|
||||
|
||||
if (type != Game::XAssetType::ASSET_TYPE_INVALID)
|
||||
@ -1470,7 +1470,7 @@ namespace Components
|
||||
|
||||
Command::Add("loadtempzone", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
if (FastFiles::Exists(params->get(1)))
|
||||
{
|
||||
@ -1502,7 +1502,7 @@ namespace Components
|
||||
|
||||
Command::Add("iwiDump", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() < 2) return;
|
||||
if (params->size() < 2) return;
|
||||
|
||||
std::string path = Utils::String::VA("%s\\mods\\%s\\images", Dvar::Var("fs_basepath").get<const char*>(), params->get(1));
|
||||
std::vector<std::string> images = FileSystem::GetSysFileList(path, "iwi", false);
|
||||
@ -1525,7 +1525,7 @@ namespace Components
|
||||
Logger::Print("------------------- END IWI DUMP -------------------\n");
|
||||
});
|
||||
|
||||
ZoneBuilder::PreferDiskAssetsDvar = Dvar::Register<bool>("zb_prefer_disk_assets", false, Game::DVAR_FLAG_NONE, "Should zonebuilder prefer in-memory assets (requirements) or disk assets, when both are present?");
|
||||
ZoneBuilder::PreferDiskAssetsDvar = Dvar::Register<bool>("zb_prefer_disk_assets", false, Game::DVAR_NONE, "Should zonebuilder prefer in-memory assets (requirements) or disk assets, when both are present?");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3696,10 +3696,5 @@ namespace Components
|
||||
Utils::Hook::Set<WORD>(0x6B9602,0xCCCC);
|
||||
#endif
|
||||
}
|
||||
|
||||
Zones::~Zones()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
#pragma optimize( "", on )
|
@ -18,7 +18,6 @@ namespace Components
|
||||
};
|
||||
|
||||
Zones();
|
||||
~Zones();
|
||||
|
||||
static void SetVersion(int version);
|
||||
|
||||
|
@ -393,13 +393,8 @@ namespace Game
|
||||
XAssetHeader* DB_XAssetPool = reinterpret_cast<XAssetHeader*>(0x7998A8);
|
||||
unsigned int* g_poolSize = reinterpret_cast<unsigned int*>(0x7995E8);
|
||||
|
||||
DWORD* cmd_id = reinterpret_cast<DWORD*>(0x1AAC5D0);
|
||||
DWORD* cmd_argc = reinterpret_cast<DWORD*>(0x1AAC614);
|
||||
char*** cmd_argv = reinterpret_cast<char***>(0x1AAC634);
|
||||
|
||||
DWORD* cmd_id_sv = reinterpret_cast<DWORD*>(0x1ACF8A0);
|
||||
DWORD* cmd_argc_sv = reinterpret_cast<DWORD*>(0x1ACF8E4);
|
||||
char*** cmd_argv_sv = reinterpret_cast<char***>(0x1ACF904);
|
||||
CmdArgs* cmd_args = reinterpret_cast<CmdArgs*>(0x1AAC5D0);
|
||||
CmdArgs* sv_cmd_args = reinterpret_cast<CmdArgs*>(0x1ACF8A0);
|
||||
|
||||
cmd_function_t** cmd_functions = reinterpret_cast<cmd_function_t**>(0x1AAC658);
|
||||
|
||||
|
@ -232,67 +232,67 @@ namespace Game
|
||||
typedef void(__cdecl * DB_XModelSurfsFixup_t)(XModel* model);
|
||||
extern DB_XModelSurfsFixup_t DB_XModelSurfsFixup;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterBool_t)(const char* name, bool defaultVal, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterBool_t)(const char* dvarName, bool value, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterBool_t Dvar_RegisterBool;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterFloat_t)(const char* name, float defaultVal, float min, float max, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterFloat_t)(const char* dvarName, float value, float min, float max, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterFloat_t Dvar_RegisterFloat;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterVec2_t)(const char* name, float defx, float defy, float min, float max, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterVec2_t)(const char* dvarName, float x, float y, float min, float max, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterVec2_t Dvar_RegisterVec2;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterVec3_t)(const char* name, float defx, float defy, float defz, float min, float max, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterVec3_t)(const char* dvarName, float x, float y, float z, float min, float max, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterVec3_t Dvar_RegisterVec3;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterVec4_t)(const char* name, float defx, float defy, float defz, float defw, float min, float max, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterVec4_t)(const char* dvarName, float x, float y, float z, float w, float min, float max, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterVec4_t Dvar_RegisterVec4;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterInt_t)(const char* name, int defaultVal, int min, int max, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterInt_t)(const char* dvarName, int value, int min, int max, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterInt_t Dvar_RegisterInt;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterEnum_t)(const char* name, const char** enumValues, int defaultVal, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterEnum_t)(const char* dvarName, const char** valueList, int defaultIndex, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterEnum_t Dvar_RegisterEnum;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterString_t)(const char* name, const char* defaultVal, int, const char*);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterString_t)(const char* dvarName, const char* value, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterString_t Dvar_RegisterString;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_RegisterColor_t)(const char* name, float r, float g, float b, float a, int flags, const char* description);
|
||||
typedef dvar_t*(__cdecl * Dvar_RegisterColor_t)(const char* dvarName, float r, float g, float b, float a, unsigned __int16 flags, const char* description);
|
||||
extern Dvar_RegisterColor_t Dvar_RegisterColor;
|
||||
|
||||
typedef void(__cdecl * Dvar_SetFromStringByName_t)(const char* dvarName, const char* string);
|
||||
extern Dvar_SetFromStringByName_t Dvar_SetFromStringByName;
|
||||
|
||||
typedef const dvar_t* (__cdecl * Dvar_SetFromStringByNameFromSource_t)(const char* dvarName, const char* string, DvarSetSource source);
|
||||
typedef const dvar_t*(__cdecl * Dvar_SetFromStringByNameFromSource_t)(const char* dvarName, const char* string, DvarSetSource source);
|
||||
extern Dvar_SetFromStringByNameFromSource_t Dvar_SetFromStringByNameFromSource;
|
||||
|
||||
typedef void (__cdecl * Dvar_SetStringByName_t)(const char* cvar, const char* value);
|
||||
typedef void(__cdecl * Dvar_SetStringByName_t)(const char* dvarName, const char* value);
|
||||
extern Dvar_SetStringByName_t Dvar_SetStringByName;
|
||||
|
||||
typedef void (__cdecl * Dvar_SetString_t)(const dvar_t* cvar, const char* value);
|
||||
typedef void(__cdecl * Dvar_SetString_t)(const dvar_t* dvar, const char* value);
|
||||
extern Dvar_SetString_t Dvar_SetString;
|
||||
|
||||
typedef void (__cdecl * Dvar_SetBool_t)(const dvar_t* cvar, bool enabled);
|
||||
typedef void(__cdecl * Dvar_SetBool_t)(const dvar_t* dvar, bool enabled);
|
||||
extern Dvar_SetBool_t Dvar_SetBool;
|
||||
|
||||
typedef void (__cdecl * Dvar_SetFloat_t)(const dvar_t* cvar, float value);
|
||||
typedef void(__cdecl * Dvar_SetFloat_t)(const dvar_t* dvar, float value);
|
||||
extern Dvar_SetFloat_t Dvar_SetFloat;
|
||||
|
||||
typedef void (__cdecl * Dvar_SetInt_t)(const dvar_t* cvar, int integer);
|
||||
typedef void(__cdecl * Dvar_SetInt_t)(const dvar_t* dvar, int integer);
|
||||
extern Dvar_SetInt_t Dvar_SetInt;
|
||||
|
||||
typedef void(__cdecl * Dvar_GetUnpackedColorByName_t)(const char* name, float* color);
|
||||
typedef void(__cdecl * Dvar_GetUnpackedColorByName_t)(const char* dvarName, float* expandedColor);
|
||||
extern Dvar_GetUnpackedColorByName_t Dvar_GetUnpackedColorByName;
|
||||
|
||||
typedef dvar_t* (__cdecl * Dvar_FindVar_t)(const char *dvarName);
|
||||
typedef dvar_t*(__cdecl * Dvar_FindVar_t)(const char* dvarName);
|
||||
extern Dvar_FindVar_t Dvar_FindVar;
|
||||
|
||||
typedef char* (__cdecl * Dvar_InfoString_Big_t)(int bit);
|
||||
typedef char*(__cdecl * Dvar_InfoString_Big_t)(int bit);
|
||||
extern Dvar_InfoString_Big_t Dvar_InfoString_Big;
|
||||
|
||||
typedef void(__cdecl * Dvar_SetCommand_t)(const char* dvarName, const char* string);
|
||||
extern Dvar_SetCommand_t Dvar_SetCommand;
|
||||
|
||||
typedef const char* (__cdecl * Dvar_DisplayableValue_t)(const dvar_t* cvar);
|
||||
typedef const char*(__cdecl * Dvar_DisplayableValue_t)(const dvar_t* dvar);
|
||||
extern Dvar_DisplayableValue_t Dvar_DisplayableValue;
|
||||
|
||||
typedef bool(__cdecl * Encode_Init_t)(const char* );
|
||||
@ -930,13 +930,9 @@ namespace Game
|
||||
extern XAssetHeader* DB_XAssetPool;
|
||||
extern unsigned int* g_poolSize;
|
||||
|
||||
extern DWORD* cmd_id;
|
||||
extern DWORD* cmd_argc;
|
||||
extern char*** cmd_argv;
|
||||
|
||||
extern DWORD* cmd_id_sv;
|
||||
extern DWORD* cmd_argc_sv;
|
||||
extern char*** cmd_argv_sv;
|
||||
constexpr auto CMD_MAX_NESTING = 8;
|
||||
extern CmdArgs* cmd_args;
|
||||
extern CmdArgs* sv_cmd_args;
|
||||
|
||||
extern cmd_function_t** cmd_functions;
|
||||
|
||||
|
@ -74,29 +74,27 @@ namespace Game
|
||||
ASSET_TYPE_INVALID = -1,
|
||||
};
|
||||
|
||||
typedef enum : unsigned int
|
||||
enum dvar_flag : unsigned __int16
|
||||
{
|
||||
DVAR_FLAG_NONE = 0x0, //no flags
|
||||
DVAR_FLAG_SAVED = 0x1, //saves in config_mp.cfg for clients
|
||||
DVAR_FLAG_LATCHED = 0x2, //no changing apart from initial value (although it might apply on a map reload, I think)
|
||||
DVAR_FLAG_CHEAT = 0x4, //cheat
|
||||
DVAR_FLAG_REPLICATED = 0x8, //on change, this is sent to all clients (if you are host)
|
||||
DVAR_FLAG_UNKNOWN10 = 0x10, //unknown
|
||||
DVAR_FLAG_UNKNOWN20 = 0x20, //unknown
|
||||
DVAR_FLAG_UNKNOWN40 = 0x40, //unknown
|
||||
DVAR_FLAG_UNKNOWN80 = 0x80, //unknown
|
||||
DVAR_FLAG_USERCREATED = 0x100, //a 'set' type command created it
|
||||
DVAR_FLAG_USERINFO = 0x200, //userinfo?
|
||||
DVAR_FLAG_SERVERINFO = 0x400, //in the getstatus oob
|
||||
DVAR_FLAG_WRITEPROTECTED = 0x800, //write protected
|
||||
DVAR_FLAG_UNKNOWN1000 = 0x1000, //unknown
|
||||
DVAR_FLAG_READONLY = 0x2000, //read only (same as 0x800?)
|
||||
DVAR_FLAG_UNKNOWN4000 = 0x4000, //unknown
|
||||
DVAR_FLAG_UNKNOWN8000 = 0x8000, //unknown
|
||||
DVAR_FLAG_UNKNOWN10000 = 0x10000, //unknown
|
||||
DVAR_FLAG_DEDISAVED = 0x1000000, //unknown
|
||||
DVAR_FLAG_NONEXISTENT = 0xFFFFFFFF //no such dvar
|
||||
} dvar_flag;
|
||||
DVAR_NONE = 0x0, // No flags
|
||||
DVAR_ARCHIVE = 0x1, // Set to cause it to be saved to config_mp.cfg of the client
|
||||
DVAR_LATCH = 0x2, // Will only change when C code next does a Dvar_Get(), so it can't be changed
|
||||
// without proper initialization. Modified will be set, even though the value hasn't changed yet
|
||||
DVAR_CHEAT = 0x4, // Can not be changed if cheats are disabled
|
||||
DVAR_CODINFO = 0x8, // On change, this is sent to all clients (if you are host)
|
||||
DVAR_SCRIPTINFO = 0x10,
|
||||
DVAR_UNKNOWN20 = 0x20,
|
||||
DVAR_CHANGEABLE_RESET = 0x40,
|
||||
DVAR_UNKNOWN80 = 0x80,
|
||||
DVAR_EXTERNAL = 0x100, // Created by a set command
|
||||
DVAR_USERINFO = 0x200, // Sent to server on connect or change
|
||||
DVAR_SERVERINFO = 0x400, // Sent in response to front end requests
|
||||
DVAR_WRITEPROTECTED = 0x800,
|
||||
DVAR_SYSTEMINFO = 0x1000, // Will be duplicated on all clients
|
||||
DVAR_READONLY = 0x2000, // Read only (same as DVAR_WRITEPROTECTED?)
|
||||
DVAR_SAVED = 0x4000,
|
||||
DVAR_AUTOEXEC = 0x8000,
|
||||
};
|
||||
|
||||
enum ImageCategory : char
|
||||
{
|
||||
@ -170,8 +168,8 @@ namespace Game
|
||||
typedef enum
|
||||
{
|
||||
CS_FREE = 0x0,
|
||||
CS_UNKNOWN1 = 0x1,
|
||||
CS_UNKNOWN2 = 0x2,
|
||||
CS_ZOMBIE = 0x1,
|
||||
CS_RECONNECTING = 0x2,
|
||||
CS_CONNECTED = 0x3,
|
||||
CS_CLIENTLOADING = 0x4,
|
||||
CS_ACTIVE = 0x5,
|
||||
@ -244,6 +242,17 @@ namespace Game
|
||||
struct MenuEventHandlerSet;
|
||||
struct menuDef_t;
|
||||
|
||||
struct CmdArgs
|
||||
{
|
||||
int nesting;
|
||||
int localClientNum[8];
|
||||
int controllerIndex[8];
|
||||
int argc[8];
|
||||
const char** argv[8];
|
||||
};
|
||||
|
||||
static_assert(sizeof(CmdArgs) == 132);
|
||||
|
||||
typedef struct cmd_function_s
|
||||
{
|
||||
cmd_function_s *next;
|
||||
@ -3329,14 +3338,14 @@ namespace Game
|
||||
unsigned int unsignedInt;
|
||||
float value;
|
||||
float vector[4];
|
||||
const char *string;
|
||||
const char* string;
|
||||
unsigned char color[4];
|
||||
};
|
||||
|
||||
struct $BFBB53559BEAC4289F32B924847E59CB
|
||||
{
|
||||
int stringCount;
|
||||
const char **strings;
|
||||
const char** strings;
|
||||
};
|
||||
|
||||
struct $9CA192F9DB66A3CB7E01DE78A0DEA53D
|
||||
@ -3361,8 +3370,8 @@ namespace Game
|
||||
|
||||
struct dvar_t
|
||||
{
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char* name;
|
||||
const char* description;
|
||||
unsigned int flags;
|
||||
dvar_type type;
|
||||
bool modified;
|
||||
@ -3370,26 +3379,26 @@ namespace Game
|
||||
DvarValue latched;
|
||||
DvarValue reset;
|
||||
DvarLimits domain;
|
||||
bool(__cdecl *domainFunc)(dvar_t *, DvarValue);
|
||||
bool(__cdecl * domainFunc)(dvar_t*, DvarValue);
|
||||
dvar_t *hashNext;
|
||||
};
|
||||
|
||||
struct StaticDvar
|
||||
{
|
||||
dvar_t *dvar;
|
||||
char *dvarName;
|
||||
dvar_t* dvar;
|
||||
char* dvarName;
|
||||
};
|
||||
|
||||
struct StaticDvarList
|
||||
{
|
||||
int numStaticDvars;
|
||||
StaticDvar **staticDvars;
|
||||
StaticDvar** staticDvars;
|
||||
};
|
||||
|
||||
struct StringList
|
||||
{
|
||||
int totalStrings;
|
||||
const char **strings;
|
||||
const char** strings;
|
||||
};
|
||||
|
||||
struct ExpressionSupportingData
|
||||
|
@ -54,14 +54,7 @@
|
||||
#include <Xinput.h>
|
||||
#pragma comment (lib, "xinput.lib")
|
||||
|
||||
// Usefull for debugging
|
||||
template <size_t S> class Sizer { };
|
||||
#define BindNum(x, y) Sizer<x> y;
|
||||
#define Size_Of(x, y) BindNum(sizeof(x), y)
|
||||
#define Offset_Of(x, y, z) BindNum(offsetof(x, y), z)
|
||||
|
||||
// Submodules
|
||||
// Ignore the warnings, it's not our code!
|
||||
// Ignore the warnings
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4005)
|
||||
#pragma warning(disable: 4091)
|
||||
@ -79,6 +72,7 @@ template <size_t S> class Sizer { };
|
||||
#pragma warning(disable: 6258)
|
||||
#pragma warning(disable: 6386)
|
||||
#pragma warning(disable: 6387)
|
||||
#pragma warning(disable: 26812)
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
|
@ -19,15 +19,9 @@ namespace Utils
|
||||
return Library(handle);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
Library::Library(const std::string& name, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
{
|
||||
this->_module = LoadLibraryExA(buffer.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer)
|
||||
{
|
||||
this->_module = GetModuleHandleA(buffer.data());
|
||||
this->freeOnDestroy = true;
|
||||
this->_module = LoadLibraryExA(name.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const HMODULE handle)
|
||||
@ -49,7 +43,7 @@ namespace Utils
|
||||
return this->_module != nullptr;
|
||||
}
|
||||
|
||||
HMODULE Library::getModule()
|
||||
HMODULE Library::getModule() const
|
||||
{
|
||||
return this->_module;
|
||||
}
|
||||
|
@ -81,10 +81,12 @@ namespace Utils
|
||||
this->pool.push_back(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
template <typename T> inline T* allocate()
|
||||
{
|
||||
return this->allocateArray<T>(1);
|
||||
}
|
||||
|
||||
template <typename T> inline T* allocateArray(size_t count = 1)
|
||||
{
|
||||
return static_cast<T*>(this->allocate(count * sizeof(T)));
|
||||
|
@ -107,9 +107,9 @@ namespace Utils
|
||||
void SetEnvironment()
|
||||
{
|
||||
wchar_t exeName[512];
|
||||
GetModuleFileNameW(GetModuleHandle(nullptr), exeName, sizeof(exeName) / 2);
|
||||
GetModuleFileNameW(GetModuleHandle(nullptr), exeName, sizeof(exeName) / sizeof(wchar_t));
|
||||
|
||||
wchar_t* exeBaseName = wcsrchr(exeName, L'\\');
|
||||
auto* exeBaseName = wcsrchr(exeName, L'\\');
|
||||
exeBaseName[0] = L'\0';
|
||||
|
||||
SetCurrentDirectoryW(exeName);
|
||||
|
Loading…
x
Reference in New Issue
Block a user