Refactor quickpatch
This commit is contained in:
parent
045640d460
commit
5e55ba3d1d
@ -356,8 +356,8 @@ namespace Components
|
||||
|
||||
QuickPatch::QuickPatch()
|
||||
{
|
||||
// quit_hard
|
||||
Command::Add("quit_hard", [](Command::Params*)
|
||||
// quitHard
|
||||
Command::Add("quitHard", [](Command::Params*)
|
||||
{
|
||||
int data = false;
|
||||
const Utils::Library ntdll("ntdll.dll");
|
||||
@ -841,6 +841,7 @@ namespace Components
|
||||
}
|
||||
});
|
||||
|
||||
#ifdef DEBUG
|
||||
AssetHandler::OnLoad([](Game::XAssetType type, Game::XAssetHeader asset, const std::string& /*name*/, bool* /*restrict*/)
|
||||
{
|
||||
if (type == Game::XAssetType::ASSET_TYPE_GFXWORLD)
|
||||
@ -855,6 +856,7 @@ namespace Components
|
||||
Utils::IO::WriteFile("userraw/logs/matlog.txt", buffer);
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
||||
// Dvars
|
||||
Dvar::Register<bool>("ui_streamFriendly", false, Game::DVAR_FLAG_SAVED, "Stream friendly UI");
|
||||
|
@ -19,15 +19,9 @@ namespace Utils
|
||||
return Library(handle);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
Library::Library(const std::string& name, bool _freeOnDestroy) : _module(nullptr), freeOnDestroy(_freeOnDestroy)
|
||||
{
|
||||
this->_module = LoadLibraryExA(buffer.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const std::string& buffer)
|
||||
{
|
||||
this->_module = GetModuleHandleA(buffer.data());
|
||||
this->freeOnDestroy = true;
|
||||
this->_module = LoadLibraryExA(name.data(), nullptr, 0);
|
||||
}
|
||||
|
||||
Library::Library(const HMODULE handle)
|
||||
@ -49,7 +43,7 @@ namespace Utils
|
||||
return this->_module != nullptr;
|
||||
}
|
||||
|
||||
HMODULE Library::getModule()
|
||||
HMODULE Library::getModule() const
|
||||
{
|
||||
return this->_module;
|
||||
}
|
||||
|
@ -9,14 +9,14 @@ namespace Utils
|
||||
static Library Load(const std::filesystem::path& path);
|
||||
static Library GetByAddress(void* address);
|
||||
|
||||
Library() : _module(nullptr), freeOnDestroy(false) {};
|
||||
Library(const std::string& buffer, bool freeOnDestroy);
|
||||
explicit Library(const std::string& name);
|
||||
Library() : _module(GetModuleHandleA(nullptr)), freeOnDestroy(false) {};
|
||||
explicit Library(const std::string& name, bool freeOnDestroy);
|
||||
explicit Library(const std::string& name) : _module(GetModuleHandleA(name.data())), freeOnDestroy(true) {};
|
||||
explicit Library(HMODULE handle);
|
||||
~Library();
|
||||
|
||||
bool isValid() const;
|
||||
HMODULE getModule();
|
||||
HMODULE getModule() const;
|
||||
|
||||
template <typename T>
|
||||
T getProc(const std::string& process) const
|
||||
|
Loading…
Reference in New Issue
Block a user