-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/deepsource-transform-18fb2fbc'
- Loading branch information
Showing
20 changed files
with
12,745 additions
and
12,590 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,61 @@ | ||
#pragma once | ||
#include <iostream> | ||
|
||
#include "speed.h" | ||
#include "detours.h" | ||
#include "functions.h" | ||
#include "globals.h" | ||
#include "imguiextensions.h" | ||
#include "speed.h" | ||
|
||
typedef void (WINAPI* OutputDebugStringAFunc)(LPCSTR lpOutputString); | ||
typedef void(WINAPI *OutputDebugStringAFunc)(LPCSTR lpOutputString); | ||
OutputDebugStringAFunc OriginalOutputDebugStringA; | ||
|
||
bool initReady = false; | ||
|
||
inline void WINAPI HookedOutputDebugStringA(const LPCSTR lpOutputString) | ||
{ | ||
//Only initialize after Client is connected (probably should do this smarter than checking debug strings.) | ||
if (!initReady && strcmp(lpOutputString, "DIALOGUEINTERFACE INSTANTIATED\n - This debug line is to double check that it's not being created more than once.") == 0) initReady = true; | ||
|
||
logs.AddLog(lpOutputString); | ||
inline void WINAPI HookedOutputDebugStringA(const LPCSTR lpOutputString) { | ||
// Only initialize after Client is connected (probably should do this smarter | ||
// than checking debug strings.) | ||
if (!initReady && | ||
strcmp(lpOutputString, | ||
"DIALOGUEINTERFACE INSTANTIATED\n - This debug line is to double " | ||
"check that it's not being created more than once.") == 0) | ||
initReady = true; | ||
|
||
logs.AddLog(lpOutputString); | ||
|
||
OriginalOutputDebugStringA(lpOutputString); | ||
OriginalOutputDebugStringA(lpOutputString); | ||
} | ||
|
||
void InitHooks() | ||
{ | ||
HMODULE kernel32 = GetModuleHandleA("kernel32.dll"); | ||
HMODULE winmm = GetModuleHandleA("winmm.dll"); | ||
|
||
OriginalOutputDebugStringA = reinterpret_cast<OutputDebugStringAFunc>(GetProcAddress(kernel32, "OutputDebugStringA")); | ||
g_GetTickCountOriginal = (GetTickCountType)GetProcAddress(kernel32, "GetTickCount"); | ||
g_TimeGetTimeOriginal = (GetTickCountType)GetProcAddress(winmm, "timeGetTime"); | ||
g_QueryPerformanceCounterOriginal = (QueryPerformanceCounterType)GetProcAddress(kernel32, "QueryPerformanceCounter"); | ||
|
||
// Setup the speed hack object for the Performance Counter | ||
LARGE_INTEGER performanceCounter; | ||
g_QueryPerformanceCounterOriginal(&performanceCounter); | ||
|
||
g_speedHackLL = SpeedHack<LONGLONG>(performanceCounter.QuadPart, kInitialSpeed); | ||
|
||
DetourTransactionBegin(); | ||
DetourUpdateThread(GetCurrentThread()); | ||
DetourAttach(reinterpret_cast<PVOID*>(&OriginalOutputDebugStringA), HookedOutputDebugStringA); | ||
DetourAttach(reinterpret_cast<PVOID*>(&g_GetTickCountOriginal), GetTickCountHacked); | ||
DetourAttach(reinterpret_cast<PVOID*>(&g_TimeGetTimeOriginal), GetTickCountHacked); | ||
DetourAttach(reinterpret_cast<PVOID*>(&g_QueryPerformanceCounterOriginal), QueryPerformanceCounterHacked); | ||
DetourTransactionCommit(); | ||
void InitHooks() { | ||
HMODULE kernel32 = GetModuleHandleA("kernel32.dll"); | ||
HMODULE winmm = GetModuleHandleA("winmm.dll"); | ||
|
||
OriginalOutputDebugStringA = reinterpret_cast<OutputDebugStringAFunc>( | ||
GetProcAddress(kernel32, "OutputDebugStringA")); | ||
g_GetTickCountOriginal = | ||
(GetTickCountType)GetProcAddress(kernel32, "GetTickCount"); | ||
g_TimeGetTimeOriginal = | ||
(GetTickCountType)GetProcAddress(winmm, "timeGetTime"); | ||
g_QueryPerformanceCounterOriginal = | ||
(QueryPerformanceCounterType)GetProcAddress(kernel32, | ||
"QueryPerformanceCounter"); | ||
|
||
// Setup the speed hack object for the Performance Counter | ||
LARGE_INTEGER performanceCounter; | ||
g_QueryPerformanceCounterOriginal(&performanceCounter); | ||
|
||
g_speedHackLL = | ||
SpeedHack<LONGLONG>(performanceCounter.QuadPart, kInitialSpeed); | ||
|
||
DetourTransactionBegin(); | ||
DetourUpdateThread(GetCurrentThread()); | ||
DetourAttach(reinterpret_cast<PVOID *>(&OriginalOutputDebugStringA), | ||
HookedOutputDebugStringA); | ||
DetourAttach(reinterpret_cast<PVOID *>(&g_GetTickCountOriginal), | ||
GetTickCountHacked); | ||
DetourAttach(reinterpret_cast<PVOID *>(&g_TimeGetTimeOriginal), | ||
GetTickCountHacked); | ||
DetourAttach(reinterpret_cast<PVOID *>(&g_QueryPerformanceCounterOriginal), | ||
QueryPerformanceCounterHacked); | ||
DetourTransactionCommit(); | ||
} |
Oops, something went wrong.