Fix style and slowmoStub
This commit is contained in:
@ -40,23 +40,23 @@ namespace Utils
|
||||
{
|
||||
if (this->freeOnDestroy)
|
||||
{
|
||||
this->Free();
|
||||
this->free();
|
||||
}
|
||||
}
|
||||
|
||||
bool Library::IsValid() const
|
||||
bool Library::isValid() const
|
||||
{
|
||||
return this->_module != nullptr;
|
||||
}
|
||||
|
||||
HMODULE Library::GetModule()
|
||||
HMODULE Library::getModule()
|
||||
{
|
||||
return this->_module;
|
||||
}
|
||||
|
||||
void Library::Free()
|
||||
void Library::free()
|
||||
{
|
||||
if (this->IsValid())
|
||||
if (this->isValid())
|
||||
{
|
||||
FreeLibrary(this->_module);
|
||||
}
|
||||
|
@ -15,48 +15,48 @@ namespace Utils
|
||||
explicit Library(HMODULE handle);
|
||||
~Library();
|
||||
|
||||
bool IsValid() const;
|
||||
HMODULE GetModule();
|
||||
bool isValid() const;
|
||||
HMODULE getModule();
|
||||
|
||||
template <typename T>
|
||||
T GetProc(const std::string& process) const
|
||||
T getProc(const std::string& process) const
|
||||
{
|
||||
if (!this->IsValid()) T{};
|
||||
if (!this->isValid()) T{};
|
||||
return reinterpret_cast<T>(GetProcAddress(this->_module, process.data()));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::function<T> Get(const std::string& process) const
|
||||
std::function<T> get(const std::string& process) const
|
||||
{
|
||||
if (!this->IsValid()) return std::function<T>();
|
||||
return static_cast<T*>(this->GetProc<void*>(process));
|
||||
if (!this->isValid()) return std::function<T>();
|
||||
return static_cast<T*>(this->getProc<void*>(process));
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T Invoke(const std::string& process, Args ... args) const
|
||||
T invoke(const std::string& process, Args ... args) const
|
||||
{
|
||||
auto method = this->Get<T(__cdecl)(Args ...)>(process);
|
||||
auto method = this->get<T(__cdecl)(Args ...)>(process);
|
||||
if (method) return method(args...);
|
||||
return T();
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T InvokePascal(const std::string& process, Args ... args) const
|
||||
T invokePascal(const std::string& process, Args ... args) const
|
||||
{
|
||||
auto method = this->Get<T(__stdcall)(Args ...)>(process);
|
||||
auto method = this->get<T(__stdcall)(Args ...)>(process);
|
||||
if (method) return method(args...);
|
||||
return T();
|
||||
}
|
||||
|
||||
template <typename T, typename... Args>
|
||||
T InvokeThis(const std::string& process, void* this_ptr, Args ... args) const
|
||||
T invokeThis(const std::string& process, void* this_ptr, Args ... args) const
|
||||
{
|
||||
auto method = this->Get<T(__thiscall)(void*, Args ...)>(this_ptr, process);
|
||||
auto method = this->get<T(__thiscall)(void*, Args ...)>(this_ptr, process);
|
||||
if (method) return method(args...);
|
||||
return T();
|
||||
}
|
||||
|
||||
void Free();
|
||||
void free();
|
||||
|
||||
private:
|
||||
HMODULE _module;
|
||||
|
Reference in New Issue
Block a user