From 3ff2c40f7a018de64a43d477d45a9dcc2c2b6b8a Mon Sep 17 00:00:00 2001 From: momo5502 Date: Mon, 22 Aug 2016 13:29:25 +0200 Subject: [PATCH 1/3] Add devmap to maprotation (credit to @Dasfonia) --- deps/fmt | 2 +- deps/mongoose | 2 +- deps/protobuf | 2 +- src/Components/Modules/AntiCheat.hpp | 5 +++++ src/Components/Modules/Dedicated.cpp | 11 ++++++++++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/deps/fmt b/deps/fmt index f19d8f96..93975c70 160000 --- a/deps/fmt +++ b/deps/fmt @@ -1 +1 @@ -Subproject commit f19d8f9655d550234f19c6c1f5a99c7eda798c0e +Subproject commit 93975c70bb373cd2d31361a1963384424aff0319 diff --git a/deps/mongoose b/deps/mongoose index af6fc64a..fd839f18 160000 --- a/deps/mongoose +++ b/deps/mongoose @@ -1 +1 @@ -Subproject commit af6fc64ab9bec64e91b2bebc16f71d07d5d2e208 +Subproject commit fd839f18275e5fde419497a254c129c6ad764b42 diff --git a/deps/protobuf b/deps/protobuf index 549dde19..ff2a6600 160000 --- a/deps/protobuf +++ b/deps/protobuf @@ -1 +1 @@ -Subproject commit 549dde19282767af6ba875ace06644ab5cfd14e2 +Subproject commit ff2a6600e5df21683b86aca7e30bbb80c0aed848 diff --git a/src/Components/Modules/AntiCheat.hpp b/src/Components/Modules/AntiCheat.hpp index c9308b7c..8936c94b 100644 --- a/src/Components/Modules/AntiCheat.hpp +++ b/src/Components/Modules/AntiCheat.hpp @@ -1,3 +1,8 @@ +#ifndef DEBUG +// Hide AntiCheat in embeded symbol names +#define AntiCheat SubComponent +#endif + namespace Components { class AntiCheat : public Component diff --git a/src/Components/Modules/Dedicated.cpp b/src/Components/Modules/Dedicated.cpp index 329e13d3..4e980637 100644 --- a/src/Components/Modules/Dedicated.cpp +++ b/src/Components/Modules/Dedicated.cpp @@ -136,7 +136,16 @@ namespace Components if (Dvar::Var("sv_mapRotation").Get().empty()) { Logger::Print("No rotation defined, restarting map.\n"); - Command::Execute(fmt::sprintf("map %s", Dvar::Var("mapname").Get()), true); + + if (!Dvar::Var("sv_cheats").Get()) + { + Command::Execute(fmt::sprintf("map %s", Dvar::Var("mapname").Get()), true); + } + else + { + Command::Execute(fmt::sprintf("devmap %s", Dvar::Var("mapname").Get()), true); + } + return; } From 7f951dadbd238126cc16ca3767f431f18bac5993 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Thu, 25 Aug 2016 13:25:23 +0200 Subject: [PATCH 2/3] Update dependencies --- deps/fmt | 2 +- deps/mongoose | 2 +- deps/protobuf | 2 +- src/Utils/String.hpp | 9 +++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/deps/fmt b/deps/fmt index 93975c70..d775a20f 160000 --- a/deps/fmt +++ b/deps/fmt @@ -1 +1 @@ -Subproject commit 93975c70bb373cd2d31361a1963384424aff0319 +Subproject commit d775a20fff0be6e087dd3a160e1b662606b9247e diff --git a/deps/mongoose b/deps/mongoose index fd839f18..2deaf084 160000 --- a/deps/mongoose +++ b/deps/mongoose @@ -1 +1 @@ -Subproject commit fd839f18275e5fde419497a254c129c6ad764b42 +Subproject commit 2deaf084e4dc0214be55b29f964c3d69bbdf6b21 diff --git a/deps/protobuf b/deps/protobuf index ff2a6600..b97a4a53 160000 --- a/deps/protobuf +++ b/deps/protobuf @@ -1 +1 @@ -Subproject commit ff2a6600e5df21683b86aca7e30bbb80c0aed848 +Subproject commit b97a4a53cdd55be74c30badefeb132a091764f53 diff --git a/src/Utils/String.hpp b/src/Utils/String.hpp index be6a283b..0a877ebd 100644 --- a/src/Utils/String.hpp +++ b/src/Utils/String.hpp @@ -12,10 +12,15 @@ namespace Utils static int g_vaNextBufferIndex = 0; char* buffer = g_vaBuffer[g_vaNextBufferIndex]; - std::string str = fmt::sprintf(message, std::forward(args)...); - strncpy_s(g_vaBuffer[g_vaNextBufferIndex], str.data(), VA_BUFFER_SIZE); g_vaNextBufferIndex = (g_vaNextBufferIndex + 1) % VA_BUFFER_COUNT; + std::string str = fmt::sprintf(message, std::forward(args)...); + + if (memmove_s(buffer, VA_BUFFER_SIZE, str.data(), str.size() + 1)) + { + *buffer = 0; // Error + } + return buffer; } From 0fd0f8798182660eaad07ca8efe116a700a7b773 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 26 Aug 2016 12:14:59 +0200 Subject: [PATCH 3/3] Better upload and new dependencies. --- deps/fmt | 2 +- deps/mongoose | 2 +- deps/protobuf | 2 +- premake5.lua | 6 +++++- src/Components/Modules/Exception.cpp | 6 +++--- src/Components/Modules/Exception.hpp | 2 -- src/Utils/WebIO.cpp | 19 ++++++++++--------- src/Utils/WebIO.hpp | 4 ++-- 8 files changed, 23 insertions(+), 20 deletions(-) diff --git a/deps/fmt b/deps/fmt index d775a20f..2ae6bca4 160000 --- a/deps/fmt +++ b/deps/fmt @@ -1 +1 @@ -Subproject commit d775a20fff0be6e087dd3a160e1b662606b9247e +Subproject commit 2ae6bca488795929a0207d109e135751f10c53d9 diff --git a/deps/mongoose b/deps/mongoose index 2deaf084..b3fb21da 160000 --- a/deps/mongoose +++ b/deps/mongoose @@ -1 +1 @@ -Subproject commit 2deaf084e4dc0214be55b29f964c3d69bbdf6b21 +Subproject commit b3fb21dacccfb08b046b73740eec52cd66e944de diff --git a/deps/protobuf b/deps/protobuf index b97a4a53..3d9d1a12 160000 --- a/deps/protobuf +++ b/deps/protobuf @@ -1 +1 @@ -Subproject commit b97a4a53cdd55be74c30badefeb132a091764f53 +Subproject commit 3d9d1a1255583bac550f7bf94f3016e8c238fa5e diff --git a/premake5.lua b/premake5.lua index 49f45a63..67a4739a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -291,7 +291,6 @@ workspace "iw4x" saneCopyToPath = string.gsub(_OPTIONS["copy-to"] .. "\\", "\\\\", "\\") postbuildcommands { "if not exist \"" .. saneCopyToPath .. "\" mkdir \"" .. saneCopyToPath .. "\"", - "copy /y \"$(TargetDir)*.dll\" \"" .. saneCopyToPath .. "\"", } if _OPTIONS["copy-pdb"] then @@ -299,6 +298,11 @@ workspace "iw4x" "copy /y \"$(TargetDir)*.pdb\" \"" .. saneCopyToPath .. "\"", } end + + -- This has to be the last one, as otherwise VisualStudio will succeed building even if copying fails + postbuildcommands { + "copy /y \"$(TargetDir)*.dll\" \"" .. saneCopyToPath .. "\"", + } end -- Specific configurations diff --git a/src/Components/Modules/Exception.cpp b/src/Components/Modules/Exception.cpp index 12aafa65..bab77313 100644 --- a/src/Components/Modules/Exception.cpp +++ b/src/Components/Modules/Exception.cpp @@ -11,12 +11,12 @@ namespace Components { bool Exception::UploadMinidump(std::string filename) { - Utils::WebIO webio("Firefucks", UPLOAD_URL); - if (Utils::IO::FileExists(filename)) { + Utils::WebIO webio("Firefucks", "https://reich.io/upload.php"); + std::string buffer = Utils::IO::ReadFile(filename); - std::string result = webio.PostFile(buffer); + std::string result = webio.PostFile("minidump.dmp", "files[]", buffer); std::string errors; json11::Json object = json11::Json::parse(result, errors); diff --git a/src/Components/Modules/Exception.hpp b/src/Components/Modules/Exception.hpp index 8655432f..8e70ffea 100644 --- a/src/Components/Modules/Exception.hpp +++ b/src/Components/Modules/Exception.hpp @@ -1,5 +1,3 @@ -#define UPLOAD_URL "https://reich.io/upload.php" - namespace Components { class Exception : public Component diff --git a/src/Utils/WebIO.cpp b/src/Utils/WebIO.cpp index 78264bb0..e7e6ca05 100644 --- a/src/Utils/WebIO.cpp +++ b/src/Utils/WebIO.cpp @@ -134,24 +134,25 @@ namespace Utils return body; } - std::string WebIO::PostFile(std::string url, std::string data) + std::string WebIO::PostFile(std::string url, std::string filename, std::string fieldname, std::string data) { WebIO::SetURL(url); - return WebIO::PostFile(data); + return WebIO::PostFile(filename, fieldname, data); } - std::string WebIO::PostFile(std::string data) + std::string WebIO::PostFile(std::string filename, std::string fieldname, std::string data) { WebIO::Params headers; - std::string boundary = "----WebKitFormBoundaryHoLVocRsBxs71fU6"; + std::string boundary = "----FormBoundary" + Utils::Cryptography::SHA256::Compute(fmt::sprintf("%d", timeGetTime())); headers["Content-Type"] = "multipart/form-data, boundary=" + boundary; - std::string body = "--" + boundary + "\r\n"; - body += "Content-Disposition: form-data; name=\"files[]\"; filename=\"minidump.dmp\"\r\n"; - body += "Content-Type: application/octet-stream\r\n\r\n"; - body += data + "\r\n"; - body += "--" + boundary + "--\r\n"; + std::string body; + body.append("--" + boundary + "\r\n"); + body.append("Content-Disposition: form-data; name=\"" + fieldname + "\"; filename=\"" + filename + "\"\r\n"); + body.append("Content-Type: application/octet-stream\r\n\r\n"); + body.append(data + "\r\n"); + body.append("--" + boundary + "--\r\n"); headers["Content-Length"] = fmt::sprintf("%u", body.size()); diff --git a/src/Utils/WebIO.hpp b/src/Utils/WebIO.hpp index a30c9331..f5ee3b1d 100644 --- a/src/Utils/WebIO.hpp +++ b/src/Utils/WebIO.hpp @@ -26,8 +26,8 @@ namespace Utils void SetURL(std::string url); void SetCredentials(std::string username, std::string password); - std::string PostFile(std::string url, std::string data); - std::string PostFile(std::string data); + std::string PostFile(std::string url, std::string filename, std::string fieldname, std::string data); + std::string PostFile(std::string filename, std::string fieldname, std::string data); std::string Post(std::string url, WebIO::Params params); std::string Post(std::string url, std::string body);