Merge branch 'develop' of https://github.com/iw4x/iw4x-client into feature/weapon
# Conflicts: # deps/iw4-open-formats
This commit is contained in:
commit
fcfedf0917
@ -35,6 +35,9 @@
|
||||
| `-nosteam` | Disable friends feature and do not update Steam about the game's current status just like an invisible mode. |
|
||||
| `-unprotect-dvars` | Allow the server to modify saved/archive dvars. |
|
||||
| `-zonebuilder` | Start the interactive zonebuilder tool console instead of starting the game. |
|
||||
| `-disable-notifies` | Disable "Anti-CFG" checks |
|
||||
| `-disable-mongoose` | Disable Mongoose HTTP server |
|
||||
| `-disable-rate-limit-check` | Disable RCon rate limit checks |
|
||||
|
||||
## Disclaimer
|
||||
|
||||
|
2
deps/iw4-open-formats
vendored
2
deps/iw4-open-formats
vendored
@ -1 +1 @@
|
||||
Subproject commit fa074d9ba5f61c200db05878bb9fba5ee37a8994
|
||||
Subproject commit 45405b08ed2afc0929cb332bfe4288b467ab0ed8
|
@ -21,7 +21,8 @@ namespace Components
|
||||
{
|
||||
0xf4d2c30b712ac6e3,
|
||||
0xf7e33c4081337fa3,
|
||||
0x6f5597f103cc50e9
|
||||
0x6f5597f103cc50e9,
|
||||
0xecd542eee54ffccf,
|
||||
};
|
||||
|
||||
bool Auth::HasAccessToReservedSlot;
|
||||
|
@ -435,8 +435,41 @@ namespace Components
|
||||
MongooseLogBuffer.push_back(c);
|
||||
}
|
||||
|
||||
static std::optional<std::string> InfoHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
void Download::ReplyError(mg_connection* connection, int code)
|
||||
{
|
||||
std::string msg{};
|
||||
switch(code)
|
||||
{
|
||||
case 400:
|
||||
msg = "Bad request";
|
||||
break;
|
||||
|
||||
case 403:
|
||||
msg = "Forbidden";
|
||||
break;
|
||||
|
||||
case 404:
|
||||
msg = "Not found";
|
||||
break;
|
||||
}
|
||||
|
||||
mg_http_reply(connection, code, "Content-Type: text/plain\r\n", "%s", msg.c_str());
|
||||
}
|
||||
|
||||
void Download::Reply(mg_connection* connection, const std::string& contentType, const std::string& data)
|
||||
{
|
||||
const auto formatted = std::format("Content-Type: {}\r\n", contentType);
|
||||
mg_http_reply(connection, 200, formatted.c_str(), "%s", data.c_str());
|
||||
}
|
||||
|
||||
std::optional<std::string> Download::InfoHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
{
|
||||
if (!(*Game::com_sv_running)->current.enabled)
|
||||
{
|
||||
// Game is not running ,cannot return info
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
const auto status = ServerInfo::GetInfo();
|
||||
const auto host = ServerInfo::GetHostInfo();
|
||||
|
||||
@ -486,7 +519,7 @@ namespace Components
|
||||
return { out };
|
||||
}
|
||||
|
||||
static std::optional<std::string> ListHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
std::optional<std::string> Download::ListHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
{
|
||||
static nlohmann::json jsonList;
|
||||
static std::filesystem::path fsGamePre;
|
||||
@ -534,7 +567,7 @@ namespace Components
|
||||
return { out };
|
||||
}
|
||||
|
||||
static std::optional<std::string> MapHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
std::optional<std::string> Download::MapHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
{
|
||||
static std::string mapNamePre;
|
||||
static nlohmann::json jsonList;
|
||||
@ -580,12 +613,18 @@ namespace Components
|
||||
return { out };
|
||||
}
|
||||
|
||||
static std::optional<std::string> FileHandler(mg_connection* c, const mg_http_message* hm)
|
||||
std::optional<std::string> Download::FileHandler(mg_connection* c, const mg_http_message* hm)
|
||||
{
|
||||
std::string url(hm->uri.ptr, hm->uri.len);
|
||||
|
||||
Utils::String::Replace(url, "\\", "/");
|
||||
|
||||
if (url.size() <= 5)
|
||||
{
|
||||
ReplyError(c, 400);
|
||||
return {};
|
||||
}
|
||||
|
||||
url = url.substr(6); // Strip /file
|
||||
Utils::String::Replace(url, "%20", " ");
|
||||
|
||||
@ -608,7 +647,7 @@ namespace Components
|
||||
|
||||
if ((!Maps::GetUserMap()->isValid() && !Party::IsInUserMapLobby()) || !isValidFile)
|
||||
{
|
||||
mg_http_reply(c, 403, "Content-Type: text/html\r\n", "%s", "403 - Forbidden");
|
||||
ReplyError(c, 403);
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -618,7 +657,7 @@ namespace Components
|
||||
{
|
||||
if ((!url.ends_with(".iwd") && url != "mod.ff") || url.find("_svr_") != std::string::npos)
|
||||
{
|
||||
mg_http_reply(c, 403, "Content-Type: text/html\r\n", "%s", "403 - Forbidden");
|
||||
ReplyError(c, 403);
|
||||
return {};
|
||||
}
|
||||
}
|
||||
@ -629,7 +668,7 @@ namespace Components
|
||||
std::string file;
|
||||
if ((!isMap && fsGame.empty()) || !Utils::IO::ReadFile(path, &file))
|
||||
{
|
||||
mg_http_reply(c, 404, "Content-Type: text/html\r\n", "404 - Not Found %s", path.data());
|
||||
ReplyError(c, 404);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -644,7 +683,7 @@ namespace Components
|
||||
return {};
|
||||
}
|
||||
|
||||
static std::optional<std::string> ServerListHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
std::optional<std::string> Download::ServerListHandler([[maybe_unused]] mg_connection* c, [[maybe_unused]] const mg_http_message* hm)
|
||||
{
|
||||
std::vector<std::string> servers;
|
||||
|
||||
@ -661,7 +700,7 @@ namespace Components
|
||||
return { out };
|
||||
}
|
||||
|
||||
static void EventHandler(mg_connection* c, const int ev, void* ev_data, [[maybe_unused]] void* fn_data)
|
||||
void Download::EventHandler(mg_connection* c, const int ev, void* ev_data, [[maybe_unused]] void* fn_data)
|
||||
{
|
||||
using callback = std::function<std::optional<std::string>(mg_connection*, const mg_http_message*)>;
|
||||
|
||||
@ -693,7 +732,7 @@ namespace Components
|
||||
{
|
||||
if (const auto reply = i->second(c, hm))
|
||||
{
|
||||
mg_http_reply(c, 200, "Content-Type: application/json\r\n", "%s", reply.value().data());
|
||||
Reply(c, "application/json", reply.value());
|
||||
}
|
||||
|
||||
handled = true;
|
||||
|
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
struct mg_connection;
|
||||
struct mg_http_message;
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class Download : public Component
|
||||
@ -71,6 +75,7 @@ namespace Components
|
||||
this->valid_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class FileDownload
|
||||
@ -100,5 +105,14 @@ namespace Components
|
||||
static bool DownloadFile(ClientDownload* download, unsigned int index);
|
||||
|
||||
static void LogFn(char c, void* param);
|
||||
static void ReplyError(mg_connection* connection, int code);
|
||||
static void Reply(mg_connection* connection, const std::string& contentType, const std::string& data);
|
||||
|
||||
static std::optional<std::string> FileHandler(mg_connection* c, const mg_http_message* hm);
|
||||
static void EventHandler(mg_connection* c, const int ev, void* ev_data, void* fn_data);
|
||||
static std::optional<std::string> ListHandler(mg_connection* c, const mg_http_message* hm);
|
||||
static std::optional<std::string> InfoHandler(mg_connection* c, const mg_http_message* hm);
|
||||
static std::optional<std::string> ServerListHandler(mg_connection* c, const mg_http_message* hm);
|
||||
static std::optional<std::string> MapHandler(mg_connection* c, const mg_http_message* hm);
|
||||
};
|
||||
}
|
||||
|
@ -208,7 +208,6 @@ namespace Components
|
||||
|
||||
nlohmann::json MapRotation::to_json()
|
||||
{
|
||||
assert(!DedicatedRotation.empty());
|
||||
return DedicatedRotation.to_json();
|
||||
}
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
|
||||
namespace Components
|
||||
{
|
||||
bool ServerList::SortAsc = true;
|
||||
int ServerList::SortKey = static_cast<std::underlying_type_t<Column>>(Column::Ping);
|
||||
bool ServerList::SortAsc = false;
|
||||
int ServerList::SortKey = static_cast<std::underlying_type_t<Column>>(Column::Players);
|
||||
|
||||
unsigned int ServerList::CurrentServer = 0;
|
||||
ServerList::Container ServerList::RefreshContainer;
|
||||
|
@ -1930,8 +1930,11 @@ namespace Components
|
||||
AssetHandler::Relocate(buffer + 0x51, buffer + 0x48, 5);
|
||||
AssetHandler::Relocate(buffer + 0x58, buffer + 0x50, 0x10);
|
||||
|
||||
Game::Material* material = reinterpret_cast<Game::Material*>(buffer);
|
||||
// fix statebit
|
||||
reinterpret_cast<Game::Material*>(buffer)->stateBitsEntry[47] = codol_material[0x50];
|
||||
material->stateBitsEntry[47] = codol_material[0x50];
|
||||
//check to fix distortion
|
||||
if (material->info.sortKey == 44) material->info.sortKey = 43;
|
||||
}
|
||||
else if (Zones::ZoneVersion >= 359)
|
||||
{
|
||||
@ -1975,6 +1978,9 @@ namespace Components
|
||||
// yes it was lol
|
||||
memcpy(&material->info.drawSurf.packed, material359.drawSurfBegin, 8);
|
||||
|
||||
//adding this here, situation as with later ff versions
|
||||
if (material->info.sortKey == 44) material->info.sortKey = 43;
|
||||
|
||||
memcpy(&material->info.surfaceTypeBits, &material359.drawSurf[0], 6); // copies both surfaceTypeBits and hashIndex
|
||||
//material->drawSurf[8] = material359.drawSurf[0];
|
||||
//material->drawSurf[9] = material359.drawSurf[1];
|
||||
@ -2025,6 +2031,9 @@ namespace Components
|
||||
int sunDiff = 8; // Stuff that is part of the sunflare we would overwrite
|
||||
std::memmove(buffer + 348 + sunDiff, buffer + 1316 + sunDiff, 280 - sunDiff);
|
||||
AssetHandler::Relocate(buffer + 1316, buffer + 348, 280);
|
||||
|
||||
//all codol zones are like this pretty certain
|
||||
reinterpret_cast<Game::GfxWorld*>(buffer)->sortKeyDistortion = 43;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -130,7 +130,7 @@ namespace Steam
|
||||
}
|
||||
else
|
||||
{
|
||||
Proxy::SetMod("IW4y: Modern Warfare 2");
|
||||
Proxy::SetMod("IW4x: Modern Warfare 2");
|
||||
Proxy::RunGame();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user