mirror of
https://github.com/diamante0018/BlackOpsPlugin.git
synced 2025-04-19 18:12:54 +00:00
maint: cleanup
This commit is contained in:
parent
7f2683ebea
commit
940752950e
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
- Release
|
||||
steps:
|
||||
- name: Check out files
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
@ -44,7 +44,7 @@ jobs:
|
||||
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=Win32 build/black-ops-plugin.sln
|
||||
|
||||
- name: Upload ${{matrix.configuration}} binaries
|
||||
uses: actions/upload-artifact@v3.1.2
|
||||
uses: actions/upload-artifact@v3.1.3
|
||||
with:
|
||||
name: ${{matrix.configuration}} binaries
|
||||
path: |
|
||||
|
@ -92,8 +92,6 @@ targetname "black-ops-plugin"
|
||||
pchheader "std_include.hpp"
|
||||
pchsource "src/client/std_include.cpp"
|
||||
|
||||
linkoptions {"/IGNORE:4254", "/PDBCompress"}
|
||||
|
||||
files {"./src/client/**.hpp", "./src/client/**.cpp"}
|
||||
|
||||
includedirs {"./src/client", "./src/common", "%{prj.location}/src"}
|
||||
|
@ -44,10 +44,10 @@ public:
|
||||
game::select(0x355E69C, 0x243FB1C));
|
||||
cmd_vstr_f_var->function = cmd_vstr_f;
|
||||
|
||||
if (game::environment::is_sp()) {
|
||||
if (game::environment::is_sp()) {
|
||||
// Fix (client) crash from SV_DropClient (server side)
|
||||
utils::hook::set<std::uint8_t>(0x634C1D, 0xEB);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace command_additions
|
||||
|
@ -2,11 +2,11 @@
|
||||
#include "cryptography.hpp"
|
||||
|
||||
namespace jenkins_one_at_a_time {
|
||||
unsigned int jenkins_one_at_a_time::compute(const std::string& data) {
|
||||
unsigned int compute(const std::string& data) {
|
||||
return compute(data.data(), data.size());
|
||||
}
|
||||
|
||||
unsigned int jenkins_one_at_a_time::compute(const char* key, const size_t len) {
|
||||
unsigned int compute(const char* key, const size_t len) {
|
||||
unsigned int hash, i;
|
||||
for (hash = i = 0; i < len; ++i) {
|
||||
hash += key[i];
|
||||
|
@ -11,8 +11,8 @@ public:
|
||||
info_string(const std::string_view& buffer);
|
||||
|
||||
void set(const std::string& key, const std::string& value);
|
||||
std::string get(const std::string& key) const;
|
||||
std::string build() const;
|
||||
[[nodiscard]] std::string get(const std::string& key) const;
|
||||
[[nodiscard]] std::string build() const;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::string> key_value_pairs_{};
|
||||
|
@ -55,7 +55,7 @@ bool read_file(const std::string& file, std::string* data) {
|
||||
stream.seekg(0, std::ios::beg);
|
||||
|
||||
if (size > -1) {
|
||||
data->resize(static_cast<uint32_t>(size));
|
||||
data->resize(static_cast<std::size_t>(size));
|
||||
stream.read(data->data(), size);
|
||||
stream.close();
|
||||
return true;
|
||||
|
@ -6,7 +6,7 @@ library library::load(const std::string& name) {
|
||||
}
|
||||
|
||||
library library::load(const std::filesystem::path& path) {
|
||||
return library::load(path.generic_string());
|
||||
return load(path.generic_string());
|
||||
}
|
||||
|
||||
library library::get_by_address(void* address) {
|
||||
@ -98,7 +98,7 @@ bool library::is_valid() const {
|
||||
|
||||
std::string library::get_name() const {
|
||||
if (!this->is_valid())
|
||||
return "";
|
||||
return {};
|
||||
|
||||
auto path = this->get_path();
|
||||
const auto pos = path.find_last_of("/\\");
|
||||
@ -110,9 +110,9 @@ std::string library::get_name() const {
|
||||
|
||||
std::string library::get_path() const {
|
||||
if (!this->is_valid())
|
||||
return "";
|
||||
return {};
|
||||
|
||||
char name[MAX_PATH] = {0};
|
||||
char name[MAX_PATH]{};
|
||||
GetModuleFileNameA(this->module_, name, sizeof name);
|
||||
|
||||
return name;
|
||||
@ -120,7 +120,7 @@ std::string library::get_path() const {
|
||||
|
||||
std::string library::get_folder() const {
|
||||
if (!this->is_valid())
|
||||
return "";
|
||||
return {};
|
||||
|
||||
const auto path = std::filesystem::path(this->get_path());
|
||||
return path.parent_path().generic_string();
|
||||
@ -221,7 +221,7 @@ void relaunch_self() {
|
||||
ZeroMemory(&process_info, sizeof(process_info));
|
||||
startup_info.cb = sizeof(startup_info);
|
||||
|
||||
char current_dir[MAX_PATH];
|
||||
char current_dir[MAX_PATH]{};
|
||||
GetCurrentDirectoryA(sizeof(current_dir), current_dir);
|
||||
auto* const command_line = GetCommandLineA();
|
||||
|
||||
|
@ -32,21 +32,21 @@ public:
|
||||
bool operator!=(const library& obj) const { return !(*this == obj); };
|
||||
bool operator==(const library& obj) const;
|
||||
|
||||
operator bool() const;
|
||||
operator HMODULE() const;
|
||||
[[nodiscard]] operator bool() const;
|
||||
[[nodiscard]] operator HMODULE() const;
|
||||
|
||||
void unprotect() const;
|
||||
void* get_entry_point() const;
|
||||
size_t get_relative_entry_point() const;
|
||||
[[nodiscard]] void* get_entry_point() const;
|
||||
[[nodiscard]] size_t get_relative_entry_point() const;
|
||||
|
||||
bool is_valid() const;
|
||||
std::string get_name() const;
|
||||
std::string get_path() const;
|
||||
std::string get_folder() const;
|
||||
std::uint8_t* get_ptr() const;
|
||||
[[nodiscard]] bool is_valid() const;
|
||||
[[nodiscard]] std::string get_name() const;
|
||||
[[nodiscard]] std::string get_path() const;
|
||||
[[nodiscard]] std::string get_folder() const;
|
||||
[[nodiscard]] std::uint8_t* get_ptr() const;
|
||||
void free();
|
||||
|
||||
HMODULE get_handle() const;
|
||||
[[nodiscard]] HMODULE get_handle() const;
|
||||
|
||||
template <typename T> T get_proc(const std::string& process) const {
|
||||
if (!this->is_valid())
|
||||
@ -85,14 +85,14 @@ public:
|
||||
return T();
|
||||
}
|
||||
|
||||
std::vector<PIMAGE_SECTION_HEADER> get_section_headers() const;
|
||||
[[nodiscard]] std::vector<PIMAGE_SECTION_HEADER> get_section_headers() const;
|
||||
|
||||
PIMAGE_NT_HEADERS get_nt_headers() const;
|
||||
PIMAGE_DOS_HEADER get_dos_header() const;
|
||||
PIMAGE_OPTIONAL_HEADER get_optional_header() const;
|
||||
[[nodiscard]] PIMAGE_NT_HEADERS get_nt_headers() const;
|
||||
[[nodiscard]] PIMAGE_DOS_HEADER get_dos_header() const;
|
||||
[[nodiscard]] PIMAGE_OPTIONAL_HEADER get_optional_header() const;
|
||||
|
||||
void** get_iat_entry(const std::string& module_name,
|
||||
const std::string& proc_name) const;
|
||||
[[nodiscard]] void** get_iat_entry(const std::string& module_name,
|
||||
const std::string& proc_name) const;
|
||||
|
||||
private:
|
||||
HMODULE module_;
|
||||
|
@ -93,51 +93,6 @@ std::string get_clipboard_data() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void strip(const char* in, char* out, size_t max) {
|
||||
if (!in || !out)
|
||||
return;
|
||||
|
||||
max--;
|
||||
size_t current = 0;
|
||||
while (*in != 0 && current < max) {
|
||||
const auto color_index = (*(in + 1) - 48) >= 0xC ? 7 : (*(in + 1) - 48);
|
||||
|
||||
if (*in == '^' && (color_index != 7 || *(in + 1) == '7')) {
|
||||
++in;
|
||||
} else {
|
||||
*out = *in;
|
||||
++out;
|
||||
++current;
|
||||
}
|
||||
|
||||
++in;
|
||||
}
|
||||
|
||||
*out = '\0';
|
||||
}
|
||||
|
||||
std::string convert(const std::wstring& wstr) {
|
||||
std::string result;
|
||||
result.reserve(wstr.size());
|
||||
|
||||
for (const auto& chr : wstr) {
|
||||
result.push_back(static_cast<char>(chr));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::wstring convert(const std::string& str) {
|
||||
std::wstring result;
|
||||
result.reserve(str.size());
|
||||
|
||||
for (const auto& chr : str) {
|
||||
result.push_back(static_cast<wchar_t>(chr));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string replace(std::string str, const std::string& from,
|
||||
const std::string& to) {
|
||||
if (from.empty()) {
|
||||
|
@ -87,11 +87,6 @@ std::string dump_hex(const std::string& data,
|
||||
|
||||
std::string get_clipboard_data();
|
||||
|
||||
void strip(const char* in, char* out, size_t max);
|
||||
|
||||
std::string convert(const std::wstring& wstr);
|
||||
std::wstring convert(const std::string& str);
|
||||
|
||||
std::string replace(std::string str, const std::string& from,
|
||||
const std::string& to);
|
||||
} // namespace utils::string
|
||||
|
Loading…
x
Reference in New Issue
Block a user