[Deps]: Downgrade Mongoose (#874)

This commit is contained in:
Edo 2023-03-24 14:47:00 +00:00 committed by GitHub
parent 0585b5b028
commit 703f3338aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 6 deletions

2
.gitmodules vendored
View File

@ -17,7 +17,7 @@
[submodule "deps/mongoose"] [submodule "deps/mongoose"]
path = deps/mongoose path = deps/mongoose
url = https://github.com/cesanta/mongoose.git url = https://github.com/cesanta/mongoose.git
branch = 7.9 branch = 7.8
[submodule "deps/protobuf"] [submodule "deps/protobuf"]
path = deps/protobuf path = deps/protobuf
url = https://github.com/google/protobuf.git url = https://github.com/google/protobuf.git

2
deps/mongoose vendored

@ -1 +1 @@
Subproject commit 4236405b90e051310aadda818e21c811e404b4d8 Subproject commit 0a265e79a67d7bfcdca27f2ccb98ccb474677ec6

View File

@ -14,6 +14,8 @@ namespace Components
Dvar::Var Dedicated::SVMOTD; Dvar::Var Dedicated::SVMOTD;
Dvar::Var Dedicated::COMLogFilter; Dvar::Var Dedicated::COMLogFilter;
const Game::dvar_t* Dedicated::com_dedicated;
bool Dedicated::IsEnabled() bool Dedicated::IsEnabled()
{ {
static std::optional<bool> flag; static std::optional<bool> flag;
@ -184,8 +186,6 @@ namespace Components
// Make sure all callbacks are handled // Make sure all callbacks are handled
Scheduler::Loop(Steam::SteamAPI_RunCallbacks, Scheduler::Pipeline::SERVER); Scheduler::Loop(Steam::SteamAPI_RunCallbacks, Scheduler::Pipeline::SERVER);
SVLanOnly = Dvar::Register<bool>("sv_lanOnly", false, Game::DVAR_NONE, "Don't act as node");
Utils::Hook(0x60BE98, InitDedicatedServer, HOOK_CALL).install()->quick(); Utils::Hook(0x60BE98, InitDedicatedServer, HOOK_CALL).install()->quick();
Utils::Hook::Set<BYTE>(0x683370, 0xC3); // steam sometimes doesn't like the server Utils::Hook::Set<BYTE>(0x683370, 0xC3); // steam sometimes doesn't like the server
@ -249,6 +249,26 @@ namespace Components
Events::OnDvarInit([] Events::OnDvarInit([]
{ {
SVMOTD = Dvar::Register<const char*>("sv_motd", "", Game::DVAR_NONE, "A custom message of the day for servers"); SVMOTD = Dvar::Register<const char*>("sv_motd", "", Game::DVAR_NONE, "A custom message of the day for servers");
SVLanOnly = Dvar::Register<bool>("sv_lanOnly", false, Game::DVAR_NONE, "Don't act as node");
static const char* g_dedicatedEnumNames[] =
{
"listen server",
"dedicated LAN server",
"dedicated internet server",
nullptr,
};
// IW5MP Dedicated Server adds another flag. That flag should not exist on this version of IW4
com_dedicated = Game::Dvar_RegisterEnum("dedicated", g_dedicatedEnumNames, 2, Game::DVAR_ROM, "True if this is a dedicated server");
// Dedicated only behaviour from IW5MP Dedicated Server.
if (com_dedicated->current.integer != 1 && com_dedicated->current.integer != 2)
{
Game::DvarValue val;
val.integer = 0;
Game::Dvar_SetVariant(const_cast<Game::dvar_t*>(com_dedicated), val, Game::DVAR_SOURCE_INTERNAL);
}
}); });
// Post initialization point // Post initialization point

View File

@ -12,6 +12,8 @@ namespace Components
static Dvar::Var SVMOTD; static Dvar::Var SVMOTD;
static Dvar::Var COMLogFilter; static Dvar::Var COMLogFilter;
static const Game::dvar_t* com_dedicated;
static bool IsEnabled(); static bool IsEnabled();
static bool IsRunning(); static bool IsRunning();

View File

@ -425,6 +425,7 @@ namespace Components
info["status"] = status.to_json(); info["status"] = status.to_json();
info["host"] = host.to_json(); info["host"] = host.to_json();
info["map_rotation"] = MapRotation::to_json(); info["map_rotation"] = MapRotation::to_json();
info["dedicated"] = Dedicated::com_dedicated->current.value;
std::vector<nlohmann::json> players; std::vector<nlohmann::json> players;

View File

@ -97,7 +97,7 @@ namespace Game
const dvar_t** ip = reinterpret_cast<const dvar_t**>(0x64A1DF8); const dvar_t** ip = reinterpret_cast<const dvar_t**>(0x64A1DF8);
const dvar_t** port = reinterpret_cast<const dvar_t**>(0x64A3004); const dvar_t** port = reinterpret_cast<const dvar_t**>(0x64A3004);
__declspec(naked) void Dvar_SetVariant(dvar_t*, DvarValue, DvarSetSource) __declspec(naked) void Dvar_SetVariant(dvar_t* /*dvar*/, DvarValue /*value*/, DvarSetSource /*source*/)
{ {
static DWORD Dvar_SetVariant_t = 0x647400; static DWORD Dvar_SetVariant_t = 0x647400;

View File

@ -149,6 +149,6 @@ namespace Game
extern const dvar_t** ip; extern const dvar_t** ip;
extern const dvar_t** port; extern const dvar_t** port;
extern void Dvar_SetVariant(dvar_t* var, DvarValue value, DvarSetSource source); extern void Dvar_SetVariant(dvar_t* dvar, DvarValue value, DvarSetSource source);
extern void Dvar_SetFromStringFromSource(const dvar_t* dvar, const char* string, DvarSetSource source); extern void Dvar_SetFromStringFromSource(const dvar_t* dvar, const char* string, DvarSetSource source);
} }