update protobuf + small changes
changes by @diamante0018 from https://github.com/XLabsProject/s1x-client/pull/369
This commit is contained in:
parent
15637abf91
commit
818c49cc02
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -40,7 +40,7 @@
|
|||||||
[submodule "deps/protobuf"]
|
[submodule "deps/protobuf"]
|
||||||
path = deps/protobuf
|
path = deps/protobuf
|
||||||
url = https://github.com/protocolbuffers/protobuf.git
|
url = https://github.com/protocolbuffers/protobuf.git
|
||||||
branch = 3.17.x
|
branch = 3.20.x
|
||||||
[submodule "deps/zlib"]
|
[submodule "deps/zlib"]
|
||||||
path = deps/zlib
|
path = deps/zlib
|
||||||
url = https://github.com/madler/zlib.git
|
url = https://github.com/madler/zlib.git
|
||||||
|
2
deps/protobuf
vendored
2
deps/protobuf
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 5500c72c5b616da9f0125bcfab513987a1226e2b
|
Subproject commit 6e9e60367d8744e86856590d8ea0e793c61deeec
|
@ -60,7 +60,7 @@ namespace bots
|
|||||||
|
|
||||||
if (bot_ent)
|
if (bot_ent)
|
||||||
{
|
{
|
||||||
spawn_bot(bot_ent->s.entityNum);
|
spawn_bot(bot_ent->s.number);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "loader/component_loader.hpp"
|
#include "loader/component_loader.hpp"
|
||||||
|
|
||||||
|
#include "game/game.hpp"
|
||||||
|
#include "game/dvars.hpp"
|
||||||
|
#include "game/scripting/execution.hpp"
|
||||||
|
|
||||||
#include "command.hpp"
|
#include "command.hpp"
|
||||||
#include "console.hpp"
|
#include "console.hpp"
|
||||||
#include "game_console.hpp"
|
#include "game_console.hpp"
|
||||||
@ -8,11 +12,6 @@
|
|||||||
#include "scheduler.hpp"
|
#include "scheduler.hpp"
|
||||||
#include "logfile.hpp"
|
#include "logfile.hpp"
|
||||||
|
|
||||||
#include "game/game.hpp"
|
|
||||||
#include "game/dvars.hpp"
|
|
||||||
|
|
||||||
#include "game/scripting/execution.hpp"
|
|
||||||
|
|
||||||
#include <utils/hook.hpp>
|
#include <utils/hook.hpp>
|
||||||
#include <utils/string.hpp>
|
#include <utils/string.hpp>
|
||||||
#include <utils/memory.hpp>
|
#include <utils/memory.hpp>
|
||||||
@ -39,8 +38,14 @@ namespace command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_command(const int client_num)
|
void client_command(const char client_num)
|
||||||
{
|
{
|
||||||
|
if (game::mp::g_entities[client_num].client == nullptr)
|
||||||
|
{
|
||||||
|
// Client is not fully connected
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!logfile::client_command_stub(client_num))
|
if (!logfile::client_command_stub(client_num))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -539,9 +544,9 @@ namespace command
|
|||||||
static void add_commands_generic()
|
static void add_commands_generic()
|
||||||
{
|
{
|
||||||
add("quit", game::Quit);
|
add("quit", game::Quit);
|
||||||
add("crash", []()
|
add("crash", []
|
||||||
{
|
{
|
||||||
*reinterpret_cast<int*>(1) = 0;
|
*reinterpret_cast<int*>(1) = 0x12345678;
|
||||||
});
|
});
|
||||||
|
|
||||||
add("commandDump", [](const params& argument)
|
add("commandDump", [](const params& argument)
|
||||||
|
@ -32,7 +32,7 @@ namespace logfile
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const scripting::entity player{game::Scr_GetEntityId(ent->s.entityNum, 0)};
|
const scripting::entity player{game::Scr_GetEntityId(ent->s.number, 0)};
|
||||||
return scripting::lua::convert(state, player);
|
return scripting::lua::convert(state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ namespace logfile
|
|||||||
scheduler::once([cmd, message, self, hidden]()
|
scheduler::once([cmd, message, self, hidden]()
|
||||||
{
|
{
|
||||||
const scripting::entity level{*game::levelEntityId};
|
const scripting::entity level{*game::levelEntityId};
|
||||||
const scripting::entity player{game::Scr_GetEntityId(self->s.entityNum, 0)};
|
const scripting::entity player{game::Scr_GetEntityId(self->s.number, 0)};
|
||||||
|
|
||||||
scripting::notify(level, cmd, {player, message, hidden});
|
scripting::notify(level, cmd, {player, message, hidden});
|
||||||
scripting::notify(player, cmd, {message, hidden});
|
scripting::notify(player, cmd, {message, hidden});
|
||||||
|
@ -122,7 +122,7 @@ namespace patches
|
|||||||
|
|
||||||
command::params_sv params{};
|
command::params_sv params{};
|
||||||
const auto menu_id = atoi(params.get(1));
|
const auto menu_id = atoi(params.get(1));
|
||||||
const auto client = &svs_clients[ent->s.entityNum];
|
const auto client = &svs_clients[ent->s.number];
|
||||||
|
|
||||||
// 13 => change class
|
// 13 => change class
|
||||||
if (menu_id == 13 && ent->client->team == game::mp::TEAM_SPECTATOR)
|
if (menu_id == 13 && ent->client->team == game::mp::TEAM_SPECTATOR)
|
||||||
|
@ -1565,7 +1565,7 @@ namespace game
|
|||||||
|
|
||||||
struct EntityState
|
struct EntityState
|
||||||
{
|
{
|
||||||
uint16_t entityNum;
|
uint16_t number;
|
||||||
}; // size = ?
|
}; // size = ?
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
@ -21,7 +21,8 @@ namespace utils::flags
|
|||||||
if (wide_flag[0] == L'-')
|
if (wide_flag[0] == L'-')
|
||||||
{
|
{
|
||||||
wide_flag.erase(wide_flag.begin());
|
wide_flag.erase(wide_flag.begin());
|
||||||
flags.emplace_back(string::convert(wide_flag));
|
const auto flag = string::convert(wide_flag);
|
||||||
|
flags.emplace_back(string::to_lower(flag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,14 +41,7 @@ namespace utils::flags
|
|||||||
parsed = true;
|
parsed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& entry : enabled_flags)
|
return std::ranges::any_of(enabled_flags.cbegin(), enabled_flags.cend(),
|
||||||
{
|
[flag](const auto& elem) { return elem == string::to_lower(flag); });
|
||||||
if (string::to_lower(entry) == string::to_lower(flag))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace utils
|
|||||||
return value->second;
|
return value->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void info_string::parse(std::string buffer)
|
void info_string::parse(std::string buffer)
|
||||||
@ -49,15 +49,15 @@ namespace utils
|
|||||||
{
|
{
|
||||||
//auto first = true;
|
//auto first = true;
|
||||||
std::string info_string;
|
std::string info_string;
|
||||||
for (auto i = this->key_value_pairs_.begin(); i != this->key_value_pairs_.end(); ++i)
|
for (const auto& [key, val] : this->key_value_pairs_)
|
||||||
{
|
{
|
||||||
//if (first) first = false;
|
//if (first) first = false;
|
||||||
/*else*/
|
/*else*/
|
||||||
info_string.append("\\");
|
info_string.append("\\");
|
||||||
|
|
||||||
info_string.append(i->first); // Key
|
info_string.append(key);
|
||||||
info_string.append("\\");
|
info_string.append("\\");
|
||||||
info_string.append(i->second); // Value
|
info_string.append(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
return info_string;
|
return info_string;
|
||||||
|
@ -32,7 +32,7 @@ namespace utils::io
|
|||||||
|
|
||||||
if (stream.is_open())
|
if (stream.is_open())
|
||||||
{
|
{
|
||||||
stream.write(data.data(), data.size());
|
stream.write(data.data(), static_cast<std::streamsize>(data.size()));
|
||||||
stream.close();
|
stream.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ namespace utils
|
|||||||
|
|
||||||
void* memory::allocate(const size_t length)
|
void* memory::allocate(const size_t length)
|
||||||
{
|
{
|
||||||
return calloc(length, 1);
|
return std::calloc(length, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* memory::duplicate_string(const std::string& string)
|
char* memory::duplicate_string(const std::string& string)
|
||||||
@ -86,7 +86,7 @@ namespace utils
|
|||||||
{
|
{
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
::free(data);
|
std::free(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
tools/protoc.exe
BIN
tools/protoc.exe
Binary file not shown.
Loading…
Reference in New Issue
Block a user