summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorboris <wzn@moneybot.cc>2018-12-25 18:06:51 +1300
committerboris <wzn@moneybot.cc>2018-12-25 18:06:51 +1300
commitc48c13417c198194b0d2f508a33431b27f5605b8 (patch)
tree05f1ca5eea35288ce77731b81df2acac65507721
parent8be3f19c8ace79135a593ac697751579fa1a0998 (diff)
e
-rw-r--r--csgo-loader/csgo-client/Client.cpp28
1 files changed, 24 insertions, 4 deletions
diff --git a/csgo-loader/csgo-client/Client.cpp b/csgo-loader/csgo-client/Client.cpp
index 69920bb..3fc15fd 100644
--- a/csgo-loader/csgo-client/Client.cpp
+++ b/csgo-loader/csgo-client/Client.cpp
@@ -43,24 +43,44 @@ void hhahahaha()
}
#endif
-int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow)
+void OpenConsole()
{
-#ifdef DEBUG
AllocConsole();
FILE *file;
freopen_s(&file, "CONOUT$", "w", stdout);
-#endif
+}
+
+int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow)
+{
+ OpenConsole();
+
Networking::TCPClient Client;
// Initialize the syscall manager.
if(!Syscalls->Start())
ERROR_ASSERT("[000F:00001A00] Failed to initialize. Please contact an administrator.");
-
+
+ // Wait for connection.
UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_WAITING;
+ // Create a thread to handle UI.
+ std::thread WindowThread([]
+ {
+ // Create a window, initialise DirectX context.
+ if(!UserInterface->Start())
+ ERROR_ASSERT("[000F:00001B00] Failed to initialize. Please contact an administrator.");
+
+ // Create a loop to draw our UI.
+ UserInterface->RunUiFrame();
+ }); WindowThread.detach();
+
+ // Attempt to connect to the remote server.
if(!Client.Start(LOCAL_IP, SERVER_PORT))
ERROR_ASSERT("[000F:0002A000] Server did not accept the connection.");
+ // Allow the user to input their log-in data.
+ UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_LOG_IN;
+
// TODO: Add game selection.
while(1) { if(GetAsyncKeyState(VK_END) & 0x8000) break; Sleep(1); }