Move generic patches into an own module

This commit is contained in:
momo5502 2018-12-28 01:43:53 +01:00
parent 47bc7f562c
commit b9c7e0a08c
3 changed files with 48 additions and 24 deletions

View File

@ -8,11 +8,6 @@ class ceg final : public module
public: public:
void post_load() override void post_load() override
{ {
if (game::is_dedi()) return;
// Remove improper quit check
utils::hook::nop(SELECT_VALUE(0x53444A, 0x5CCDC0, 0), 9);
// Only SP has CEG // Only SP has CEG
// CEG in MP has accidentally been removed due to CVE-2018-10718 // CEG in MP has accidentally been removed due to CVE-2018-10718
if (!game::is_sp()) return; if (!game::is_sp()) return;

48
src/module/patches.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include "game/game.hpp"
class patches final : public module
{
public:
void post_load() override
{
if (!game::is_dedi()) this->patch_clients();
if (game::is_sp()) this->patch_sp();
else if (game::is_mp()) this->patch_mp();
else if (game::is_dedi()) this->patch_dedi();
}
private:
void patch_clients() const
{
// Remove improper quit check
utils::hook::nop(SELECT_VALUE(0x53444A, 0x5CCDC0, 0), 9);
// Ignore sdm files
utils::hook::nop(SELECT_VALUE(0x4438BA, 0x6371EA, 0), 2);
}
void patch_sp() const
{
// SP doesn't initialize WSA
WSADATA wsa_data;
WSAStartup(MAKEWORD(2, 2), &wsa_data);
// Disable remote storage
utils::hook::set<BYTE>(0x663B5A, 0xEB);
utils::hook::set<BYTE>(0x663C54, 0xEB);
}
void patch_mp() const
{
}
void patch_dedi() const
{
}
};
REGISTER_MODULE(patches)

View File

@ -1,19 +0,0 @@
#include <std_include.hpp>
#include "loader/module_loader.hpp"
#include "utils/hook.hpp"
#include "game/game.hpp"
class stats final : public module
{
public:
void post_load() override
{
if (!game::is_sp()) return;
// Disable remote storage
utils::hook::set<BYTE>(0x663B5A, 0xEB);
utils::hook::set<BYTE>(0x663C54, 0xEB);
}
};
REGISTER_MODULE(stats)