diff options
Diffstat (limited to 'csgo-loader/csgo-client/Client.cpp')
| -rw-r--r-- | csgo-loader/csgo-client/Client.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/csgo-loader/csgo-client/Client.cpp b/csgo-loader/csgo-client/Client.cpp new file mode 100644 index 0000000..077b14b --- /dev/null +++ b/csgo-loader/csgo-client/Client.cpp @@ -0,0 +1,55 @@ +#include <Networking/TCPClient.hpp>
+#include <Login/RemoteLogin.hpp>
+#include <Security/SyscallManager.hpp>
+#include <Security/FnvHash.hpp>
+#include <UserExperience/UserInterface.hpp>
+
+#define LOCAL_IP 0x0100007F // '127.0.0.1'
+#define SERVER_IP 0xE53CA523 // Hexadecimal representation of the server IP, obtained by inet_addr()
+#define SERVER_PORT 0xF2C // Hexadecimal representation of the server port.
+
+int __stdcall WinMain(HINSTANCE inst, HINSTANCE prev, char* str, int cmdshow) {
+ if(!Syscalls->Start())
+ ERROR_ASSERT("[000F:00001A00] Failed to initialize. Please contact an administrator.");
+
+ UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_WAITING;
+
+ std::thread WindowThread([] {
+ if(!UserInterface->Start())
+ ERROR_ASSERT("[000F:00001B00] Failed to initialize. Please contact an administrator.");
+
+ UserInterface->RunUiFrame();
+ }); WindowThread.detach();
+
+ // Allow the window to start, etc.
+ Sleep(2000);
+
+ Networking::TCPClient Client;
+
+ if(!Client.Start(LOCAL_IP, SERVER_PORT))
+ ERROR_ASSERT("[000F:0002A000] Server did not accept the connection.");
+
+ UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_LOG_IN;
+
+ while(UserInterface->m_Data.m_ExecutionState != UserExperience::EXECUTION_WAITING) {
+ Sleep(1);
+ }
+
+ Login::RemoteLoginTransaction Transaction;
+ Transaction.Start(UserInterface->m_Data.m_Username, UserInterface->m_Data.m_Password);
+
+ ByteArray RawLoginHeader = Transaction.GetHeader();
+ Client.SendBytes(RawLoginHeader);
+
+ ByteArray RawServerResponse = Client.ReceiveBytes();
+ if(!Transaction.TranslateResponse(RawServerResponse)) {
+ UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_ERROR;
+ }
+ else {
+ UserInterface->m_Data.m_ExecutionState = UserExperience::EXECUTION_CHOOSE;
+ }
+
+ // TODO: Add game selection.
+
+ while(1) { if(GetAsyncKeyState(VK_END) & 0x8000) break; Sleep(1); }
+}
\ No newline at end of file |
