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