Fix style and slowmoStub
This commit is contained in:
parent
4ab20ae8f5
commit
fc73f4cd65
@ -421,8 +421,8 @@ namespace Components
|
|||||||
{
|
{
|
||||||
int data = false;
|
int data = false;
|
||||||
const Utils::Library ntdll("ntdll.dll");
|
const Utils::Library ntdll("ntdll.dll");
|
||||||
ntdll.InvokePascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
|
ntdll.invokePascal<void>("RtlAdjustPrivilege", 19, true, false, &data);
|
||||||
ntdll.InvokePascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
|
ntdll.invokePascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filtering any mapents that is intended for Spec:Ops gamemode (CODO) and prevent them from spawning
|
// Filtering any mapents that is intended for Spec:Ops gamemode (CODO) and prevent them from spawning
|
||||||
|
@ -21,11 +21,11 @@ namespace Components
|
|||||||
__asm
|
__asm
|
||||||
{
|
{
|
||||||
pushad
|
pushad
|
||||||
push[esp + 18h]
|
|
||||||
|
|
||||||
|
push[esp + 24h]
|
||||||
call SlowMotion::ApplySlowMotion
|
call SlowMotion::ApplySlowMotion
|
||||||
|
add esp, 4h
|
||||||
|
|
||||||
add esp, 4
|
|
||||||
popad
|
popad
|
||||||
|
|
||||||
retn
|
retn
|
||||||
|
@ -22,11 +22,11 @@ namespace Components
|
|||||||
// team switch and intermission.
|
// team switch and intermission.
|
||||||
//
|
//
|
||||||
|
|
||||||
std::mutex SoundMutexFix::snd_mutex;
|
std::mutex SoundMutexFix::SNDMutex;
|
||||||
|
|
||||||
void __stdcall SoundMutexFix::LockSoundMutex(int unk)
|
void __stdcall SoundMutexFix::LockSoundMutex(int unk)
|
||||||
{
|
{
|
||||||
std::lock_guard lock(SoundMutexFix::snd_mutex);
|
std::lock_guard lock(SoundMutexFix::SNDMutex);
|
||||||
|
|
||||||
DWORD funcPtr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
|
DWORD funcPtr = *reinterpret_cast<DWORD*>(0x6D7554); // AIL_close_stream
|
||||||
Utils::Hook::Call<void __stdcall(int)>(funcPtr)(unk);
|
Utils::Hook::Call<void __stdcall(int)>(funcPtr)(unk);
|
||||||
|
@ -9,7 +9,7 @@ namespace Components
|
|||||||
SoundMutexFix();
|
SoundMutexFix();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::mutex snd_mutex;
|
static std::mutex SNDMutex;
|
||||||
static void _stdcall LockSoundMutex(int unk);
|
static void _stdcall LockSoundMutex(int unk);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -384,25 +384,25 @@ namespace Steam
|
|||||||
Proxy::LaunchWatchGuard();
|
Proxy::LaunchWatchGuard();
|
||||||
|
|
||||||
Proxy::Overlay = ::Utils::Library(GAMEOVERLAY_LIB, false);
|
Proxy::Overlay = ::Utils::Library(GAMEOVERLAY_LIB, false);
|
||||||
if (!Proxy::Overlay.IsValid()) return false;
|
if (!Proxy::Overlay.isValid()) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Proxy::Client = ::Utils::Library(STEAMCLIENT_LIB, false);
|
Proxy::Client = ::Utils::Library(STEAMCLIENT_LIB, false);
|
||||||
if (!Proxy::Client.IsValid()) return false;
|
if (!Proxy::Client.isValid()) return false;
|
||||||
|
|
||||||
Proxy::SteamClient = Proxy::Client.Get<ISteamClient008*(const char*, int*)>("CreateInterface")("SteamClient008", nullptr);
|
Proxy::SteamClient = Proxy::Client.get<ISteamClient008*(const char*, int*)>("CreateInterface")("SteamClient008", nullptr);
|
||||||
if(!Proxy::SteamClient) return false;
|
if(!Proxy::SteamClient) return false;
|
||||||
|
|
||||||
Proxy::SteamBGetCallback = Proxy::Client.Get<Proxy::SteamBGetCallbackFn>("Steam_BGetCallback");
|
Proxy::SteamBGetCallback = Proxy::Client.get<Proxy::SteamBGetCallbackFn>("Steam_BGetCallback");
|
||||||
if (!Proxy::SteamBGetCallback) return false;
|
if (!Proxy::SteamBGetCallback) return false;
|
||||||
|
|
||||||
Proxy::SteamFreeLastCallback = Proxy::Client.Get<Proxy::SteamFreeLastCallbackFn>("Steam_FreeLastCallback");
|
Proxy::SteamFreeLastCallback = Proxy::Client.get<Proxy::SteamFreeLastCallbackFn>("Steam_FreeLastCallback");
|
||||||
if (!Proxy::SteamFreeLastCallback) return false;
|
if (!Proxy::SteamFreeLastCallback) return false;
|
||||||
|
|
||||||
Proxy::SteamGetAPICallResult = Proxy::Client.Get<Proxy::SteamGetAPICallResultFn>("Steam_GetAPICallResult");
|
Proxy::SteamGetAPICallResult = Proxy::Client.get<Proxy::SteamGetAPICallResultFn>("Steam_GetAPICallResult");
|
||||||
if (!Proxy::SteamGetAPICallResult) return false;
|
if (!Proxy::SteamGetAPICallResult) return false;
|
||||||
|
|
||||||
Proxy::SteamClient = Proxy::Client.Get<ISteamClient008*(const char*, int*)>("CreateInterface")("SteamClient008", nullptr);
|
Proxy::SteamClient = Proxy::Client.get<ISteamClient008*(const char*, int*)>("CreateInterface")("SteamClient008", nullptr);
|
||||||
if (!Proxy::SteamClient) return false;
|
if (!Proxy::SteamClient) return false;
|
||||||
|
|
||||||
Proxy::SteamPipe = Proxy::SteamClient->CreateSteamPipe();
|
Proxy::SteamPipe = Proxy::SteamClient->CreateSteamPipe();
|
||||||
@ -411,7 +411,7 @@ namespace Steam
|
|||||||
Proxy::SteamUser = Proxy::SteamClient->ConnectToGlobalUser(Proxy::SteamPipe);
|
Proxy::SteamUser = Proxy::SteamClient->ConnectToGlobalUser(Proxy::SteamPipe);
|
||||||
if (!Proxy::SteamUser) return false;
|
if (!Proxy::SteamUser) return false;
|
||||||
|
|
||||||
Proxy::ClientEngine = Proxy::Client.Get<IClientEngine*(const char*, int*)>("CreateInterface")("CLIENTENGINE_INTERFACE_VERSION005", nullptr);
|
Proxy::ClientEngine = Proxy::Client.get<IClientEngine*(const char*, int*)>("CreateInterface")("CLIENTENGINE_INTERFACE_VERSION005", nullptr);
|
||||||
if (!Proxy::ClientEngine) return false;
|
if (!Proxy::ClientEngine) return false;
|
||||||
|
|
||||||
Proxy::ClientUser = Proxy::ClientEngine->GetIClientUser(Proxy::SteamUser, Proxy::SteamPipe);
|
Proxy::ClientUser = Proxy::ClientEngine->GetIClientUser(Proxy::SteamUser, Proxy::SteamPipe);
|
||||||
@ -526,17 +526,17 @@ namespace Steam
|
|||||||
|
|
||||||
void Proxy::SetOverlayNotificationPosition(uint32_t eNotificationPosition)
|
void Proxy::SetOverlayNotificationPosition(uint32_t eNotificationPosition)
|
||||||
{
|
{
|
||||||
if (Proxy::Overlay.IsValid())
|
if (Proxy::Overlay.isValid())
|
||||||
{
|
{
|
||||||
Proxy::Overlay.Get<void(uint32_t)>("SetNotificationPosition")(eNotificationPosition);
|
Proxy::Overlay.get<void(uint32_t)>("SetNotificationPosition")(eNotificationPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Proxy::IsOverlayEnabled()
|
bool Proxy::IsOverlayEnabled()
|
||||||
{
|
{
|
||||||
if (Proxy::Overlay.IsValid())
|
if (Proxy::Overlay.isValid())
|
||||||
{
|
{
|
||||||
return Proxy::Overlay.Get<bool()>("IsOverlayEnabled")();
|
return Proxy::Overlay.get<bool()>("IsOverlayEnabled")();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -544,9 +544,9 @@ namespace Steam
|
|||||||
|
|
||||||
bool Proxy::BOverlayNeedsPresent()
|
bool Proxy::BOverlayNeedsPresent()
|
||||||
{
|
{
|
||||||
if (Proxy::Overlay.IsValid())
|
if (Proxy::Overlay.isValid())
|
||||||
{
|
{
|
||||||
return Proxy::Overlay.Get<bool()>("BOverlayNeedsPresent")();
|
return Proxy::Overlay.get<bool()>("BOverlayNeedsPresent")();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -40,23 +40,23 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
if (this->freeOnDestroy)
|
if (this->freeOnDestroy)
|
||||||
{
|
{
|
||||||
this->Free();
|
this->free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Library::IsValid() const
|
bool Library::isValid() const
|
||||||
{
|
{
|
||||||
return this->_module != nullptr;
|
return this->_module != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
HMODULE Library::GetModule()
|
HMODULE Library::getModule()
|
||||||
{
|
{
|
||||||
return this->_module;
|
return this->_module;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Library::Free()
|
void Library::free()
|
||||||
{
|
{
|
||||||
if (this->IsValid())
|
if (this->isValid())
|
||||||
{
|
{
|
||||||
FreeLibrary(this->_module);
|
FreeLibrary(this->_module);
|
||||||
}
|
}
|
||||||
|
@ -15,48 +15,48 @@ namespace Utils
|
|||||||
explicit Library(HMODULE handle);
|
explicit Library(HMODULE handle);
|
||||||
~Library();
|
~Library();
|
||||||
|
|
||||||
bool IsValid() const;
|
bool isValid() const;
|
||||||
HMODULE GetModule();
|
HMODULE getModule();
|
||||||
|
|
||||||
template <typename T>
|
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()));
|
return reinterpret_cast<T>(GetProcAddress(this->_module, process.data()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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>();
|
if (!this->isValid()) return std::function<T>();
|
||||||
return static_cast<T*>(this->GetProc<void*>(process));
|
return static_cast<T*>(this->getProc<void*>(process));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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...);
|
if (method) return method(args...);
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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...);
|
if (method) return method(args...);
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, typename... Args>
|
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...);
|
if (method) return method(args...);
|
||||||
return T();
|
return T();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Free();
|
void free();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HMODULE _module;
|
HMODULE _module;
|
||||||
|
Loading…
Reference in New Issue
Block a user