/
main.cpp
128 lines (93 loc) · 2.76 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#define NOMINMAX
#include <Windows.h>
#include "valve_sdk/sdk.hpp"
#include "helpers/utils.hpp"
#include "helpers/input.hpp"
#include "helpers/Config.h"
#include "hooks.hpp"
#include "menu.hpp"
#include "options.hpp"
#include "Seq.h"
#include "imgui/imgui.h"
#include "NetVarHooks.h"
#include <wininet.h>
#include <string.h>
# include <ctime>
#pragma comment(lib, "wininet")
DWORD WINAPI OnDllAttach( LPVOID base )
{
if (Utils::WaitForModules(10000, { L"client_panorama.dll", L"engine.dll", L"shaderapidx9.dll" }) == WAIT_TIMEOUT) {
// waiting for shit to load nigga
return FALSE;
}
#ifdef _DEBUG
Utils::AttachConsole( );
#endif
try {
Utils::ConsolePrint( "Initializing...\n" );
SHGetFolderPathA( NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, ( LPSTR ) ConfigSys::Get( ).my_documents_folder );
CreateDirectoryA( std::string( ConfigSys::Get( ).my_documents_folder + std::string( "\\Euphoria\\" ) ).c_str( ), NULL );
Interfaces::Initialize( );
NetvarSys::Get( ).Initialize( );
InputSys::Get( ).Initialize( );
Menu::Get( ).Initialize( );
Hooks::Initialize( );
NetvarHook( );
InputSys::Get( ).RegisterHotkey( VK_F9, [base] ( ) {
if ( Menu::Get( ).IsVisible( ) )
Menu::Get( ).Toggle( );
g_Unload = true;
} );
// Menu Toggle
InputSys::Get( ).RegisterHotkey( VK_END, [base] ( ) {
Menu::Get( ).Toggle( );
} );
Utils::ConsolePrint( "Finished.\n" );
while ( !g_Unload )
Sleep( 1000 );
#ifdef _DEBUG
Utils::DetachConsole( );
#endif
Hooks::Shutdown( );
Menu::Get( ).Shutdown( );
UnloadProxy( );
FreeLibraryAndExitThread( static_cast< HMODULE >( base ), 1 );
}
catch ( const std::exception& ex ) {
Utils::ConsolePrint( "An error occured during initialization:\n" );
Utils::ConsolePrint( "%s\n", ex.what( ) );
Utils::ConsolePrint( "Press any key to exit.\n" );
Utils::ConsoleReadKey( );
Utils::DetachConsole( );
FreeLibraryAndExitThread( static_cast< HMODULE >( base ), 1 );
}
}
BOOL WINAPI OnDllDetach()
{
#ifdef _DEBUG
Utils::DetachConsole();
#endif
Hooks::Shutdown();
Menu::Get().Shutdown();
UnloadProxy(); //is this for the skinchanger animnation meme? yes show me
return TRUE;
}
BOOL WINAPI DllMain(
_In_ HINSTANCE hinstDll,
_In_ DWORD fdwReason,
_In_opt_ LPVOID lpvReserved
)
{
switch(fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hinstDll);
CreateThread(nullptr, 0, OnDllAttach, hinstDll, 0, nullptr);
return TRUE;
case DLL_PROCESS_DETACH:
if (lpvReserved == nullptr)
return OnDllDetach();
return TRUE;
default:
return TRUE;
}
}