From 4eaba9f5a2bdf6d6869829905b2ef9d2d3e9fcd0 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 25 May 2022 12:07:08 +0200 Subject: [PATCH] Gui launcher work Improved theme Implemented dedicated server and client logic (gui side only) --- r5dev/engine/host_state.cpp | 2 +- r5dev/mathlib/vector.h | 2 - r5dev/sdklauncher/basepanel.cpp | 189 ++++++++++++++++-- r5dev/thirdparty/cppnet/cppkore/KoreTheme.cpp | 4 +- r5dev/tier0/basetypes.h | 121 +++++++++++ 5 files changed, 298 insertions(+), 20 deletions(-) diff --git a/r5dev/engine/host_state.cpp b/r5dev/engine/host_state.cpp index 4f560944..4b6528b2 100644 --- a/r5dev/engine/host_state.cpp +++ b/r5dev/engine/host_state.cpp @@ -252,7 +252,7 @@ FORCEINLINE void CHostState::Think(void) const //----------------------------------------------------------------------------- FORCEINLINE void CHostState::LoadConfig(void) const { - if (CommandLine()->ParmValue("-launcher", 0) < 1) // Launcher level 1 indicates everything is set from the sdk launcher. + if (CommandLine()->ParmValue("-launcher", 0) < 1) // Launcher level 1 indicates everything is handled from the commandline/launcher. { if (!CommandLine()->CheckParm("-devsdk")) { diff --git a/r5dev/mathlib/vector.h b/r5dev/mathlib/vector.h index 60dc75d0..4c9595de 100644 --- a/r5dev/mathlib/vector.h +++ b/r5dev/mathlib/vector.h @@ -2,8 +2,6 @@ class Vector3; class QAngle; -typedef float vec_t; -typedef float vec3_t[3]; /*----------------------------------------------------------------------------- * _vector.h diff --git a/r5dev/sdklauncher/basepanel.cpp b/r5dev/sdklauncher/basepanel.cpp index 88739f61..47aef8e6 100644 --- a/r5dev/sdklauncher/basepanel.cpp +++ b/r5dev/sdklauncher/basepanel.cpp @@ -447,7 +447,7 @@ void CUIBasePanel::Init() // // ################################################################################################# this->m_ConsoleGroup = new UIX::UIXGroupBox(); - this->m_ConsoleGroup->SetSize({ 429, 182 }); + this->m_ConsoleGroup->SetSize({ 429, 181 }); this->m_ConsoleGroup->SetLocation({ 359, 158 }); this->m_ConsoleGroup->SetTabIndex(0); this->m_ConsoleGroup->SetText("Console"); @@ -455,7 +455,7 @@ void CUIBasePanel::Init() this->AddControl(this->m_ConsoleGroup); this->m_ConsoleListView = new UIX::UIXListView(); - this->m_ConsoleListView->SetSize({ 427, 166 }); + this->m_ConsoleListView->SetSize({ 427, 165 }); this->m_ConsoleListView->SetLocation({ 1, 15 }); this->m_ConsoleListView->SetTabIndex(0); this->m_ConsoleListView->SetText("0"); @@ -472,7 +472,7 @@ void CUIBasePanel::Init() void CUIBasePanel::LaunchGame(Forms::Control* pSender) { - string svParameter = "-launcher \"1\" -dev "; + string svParameter = "-launcher -dev "; eLaunchMode launchMode = eLaunchMode::LM_NULL; launchMode = g_pLauncher->GetMainSurface()->BuildParameter(svParameter); @@ -503,22 +503,11 @@ eLaunchMode CUIBasePanel::BuildParameter(string& svParameter) } if (this->m_DevelopmentToggle->Checked()) { - svParameter.append("+exec \"autoexec_server_dev.cfg\" "); - svParameter.append("+exec \"autoexec_client_dev.cfg\" "); - svParameter.append("+exec \"autoexec_dev.cfg\" "); - svParameter.append("+exec \"rcon_server_dev.cfg\" "); - svParameter.append("+exec \"rcon_client_dev.cfg\" "); + svParameter.append("-devsdk "); results = eLaunchMode::LM_HOST_DEBUG; } else - { - svParameter.append("+exec \"autoexec_server.cfg\" "); - svParameter.append("+exec \"autoexec_client.cfg\" "); - svParameter.append("+exec \"autoexec.cfg\" "); - svParameter.append("+exec \"rcon_server.cfg\" "); - svParameter.append("+exec \"rcon_client.cfg\" "); results = eLaunchMode::LM_HOST; - } if (this->m_CheatsToggle->Checked()) svParameter.append("+sv_cheats \"1\" "); @@ -552,6 +541,7 @@ eLaunchMode CUIBasePanel::BuildParameter(string& svParameter) svParameter.append("+sv_asyncAIInit \"0\" "); svParameter.append("+sv_asyncSendSnapshot \"0\" "); svParameter.append("+sv_scriptCompileAsync \"0\" "); + svParameter.append("+cl_scriptCompileAsync \"0\" "); svParameter.append("+cl_async_bone_setup \"0\" "); svParameter.append("+cl_updatedirty_async \"0\" "); svParameter.append("+mat_syncGPU \"1\" "); @@ -620,11 +610,180 @@ eLaunchMode CUIBasePanel::BuildParameter(string& svParameter) } case eMode::SERVER: { + // GAME ############################################################################################ + if (!String::IsNullOrEmpty(this->m_MapCombo->Text())) + { + svParameter.append("+map \"" + this->m_MapCombo->Text() + "\" "); + } + if (!String::IsNullOrEmpty(this->m_PlaylistCombo->Text())) + { + svParameter.append("+launchplaylist \"" + this->m_PlaylistCombo->Text() + "\" "); + } + if (this->m_DevelopmentToggle->Checked()) + { + svParameter.append("-devsdk "); + results = eLaunchMode::LM_SERVER_DEBUG; + } + else + results = eLaunchMode::LM_SERVER; + if (this->m_CheatsToggle->Checked()) + svParameter.append("+sv_cheats \"1\" "); + + if (this->m_ConsoleToggle->Checked()) + svParameter.append("-wconsole "); + + if (this->m_ColorConsoleToggle->Checked()) + svParameter.append("-ansiclr "); + + if (!String::IsNullOrEmpty(this->m_PlaylistFileTextBox->Text())) + svParameter.append("-playlistfile \"" + this->m_PlaylistFileTextBox->Text() + "\" "); + + // ENGINE ########################################################################################## + if (StringIsDigit(this->m_ReservedCoresTextBox->Text().ToCString())) + svParameter.append("-numreservedcores \"" + this->m_ReservedCoresTextBox->Text() + "\" "); + //else error; + + if (StringIsDigit(this->m_WorkerThreadsTextBox->Text().ToCString())) + svParameter.append("-numworkerthreads \"" + this->m_WorkerThreadsTextBox->Text() + "\" "); + //else error; + + if (this->m_SingleCoreDediToggle->Checked()) + svParameter.append("+sv_single_core_dedi \"1\" "); + + if (this->m_NoAsyncJobsToggle->Checked()) + { + svParameter.append("-noasync "); + svParameter.append("+async_serialize \"0\" "); + svParameter.append("+sv_asyncAIInit \"0\" "); + svParameter.append("+sv_asyncSendSnapshot \"0\" "); + svParameter.append("+sv_scriptCompileAsync \"0\" "); + svParameter.append("+physics_async_sv \"0\" "); + } + + if (this->m_NetEncryptionToggle->Checked()) + svParameter.append("+net_encryptionEnable \"1\" "); + + if (this->m_NetRandomKeyToggle->Checked()) + svParameter.append("+net_useRandomKey \"1\" "); + + if (this->m_NoQueuedPacketThread->Checked()) + svParameter.append("+net_queued_packet_thread \"0\" "); + + if (this->m_NoTimeOutToggle->Checked()) + svParameter.append("-notimeout "); + + // MAIN ############################################################################################ + if (!String::IsNullOrEmpty(this->m_HostNameTextBox->Text())) + { + svParameter.append("+sv_pylonHostName \"" + this->m_HostNameTextBox->Text() + "\" "); + + switch (static_cast(this->m_VisibilityCombo->SelectedIndex())) + { + case eVisibility::PUBLIC: + { + svParameter.append("+sv_pylonVisibility \"2\" "); + break; + } + case eVisibility::HIDDEN: + { + svParameter.append("+sv_pylonVisibility \"1\" "); + break; + } + default: + { + svParameter.append("+sv_pylonVisibility \"0\" "); + break; + } + } + } + if (!String::IsNullOrEmpty(this->m_LaunchArgsTextBox->Text())) + svParameter.append(this->m_LaunchArgsTextBox->Text()); + + return results; } case eMode::CLIENT: { + // GAME ############################################################################################ + if (this->m_DevelopmentToggle->Checked()) + { + svParameter.append("-devsdk "); + results = eLaunchMode::LM_CLIENT_DEBUG; + } + else + results = eLaunchMode::LM_CLIENT; + if (this->m_CheatsToggle->Checked()) + svParameter.append("+sv_cheats \"1\" "); + + if (this->m_ConsoleToggle->Checked()) + svParameter.append("-wconsole "); + + if (this->m_ColorConsoleToggle->Checked()) + svParameter.append("-ansiclr "); + + if (!String::IsNullOrEmpty(this->m_PlaylistFileTextBox->Text())) + svParameter.append("-playlistfile \"" + this->m_PlaylistFileTextBox->Text() + "\" "); + + // ENGINE ########################################################################################## + if (StringIsDigit(this->m_ReservedCoresTextBox->Text().ToCString())) + svParameter.append("-numreservedcores \"" + this->m_ReservedCoresTextBox->Text() + "\" "); + //else error; + + if (StringIsDigit(this->m_WorkerThreadsTextBox->Text().ToCString())) + svParameter.append("-numworkerthreads \"" + this->m_WorkerThreadsTextBox->Text() + "\" "); + //else error; + + if (this->m_SingleCoreDediToggle->Checked()) + svParameter.append("+sv_single_core_dedi \"1\" "); + + if (this->m_NoAsyncJobsToggle->Checked()) + { + svParameter.append("-noasync "); + svParameter.append("+async_serialize \"0\" "); + svParameter.append("+buildcubemaps_async \"0\" "); + svParameter.append("+cl_scriptCompileAsync \"0\" "); + svParameter.append("+cl_async_bone_setup \"0\" "); + svParameter.append("+cl_updatedirty_async \"0\" "); + svParameter.append("+mat_syncGPU \"1\" "); + svParameter.append("+mat_sync_rt \"1\" "); + svParameter.append("+mat_sync_rt_flushes_gpu \"1\" "); + svParameter.append("+net_async_sendto \"0\" "); + svParameter.append("+physics_async_cl \"0\" "); + } + + if (this->m_NetEncryptionToggle->Checked()) + svParameter.append("+net_encryptionEnable \"1\" "); + + if (this->m_NetRandomKeyToggle->Checked()) + svParameter.append("+net_useRandomKey \"1\" "); + + if (this->m_NoQueuedPacketThread->Checked()) + svParameter.append("+net_queued_packet_thread \"0\" "); + + if (this->m_NoTimeOutToggle->Checked()) + svParameter.append("-notimeout "); + + if (this->m_WindowedToggle->Checked()) + svParameter.append("-windowed "); + + if (this->m_NoBorderToggle->Checked()) + svParameter.append("-noborder "); + + if (StringIsDigit(this->m_FpsTextBox->Text().ToCString())) + svParameter.append("+fps_max \"" + this->m_FpsTextBox->Text() + "\" "); + + if (!String::IsNullOrEmpty(this->m_WidthTextBox->Text())) + svParameter.append("-w \"" + this->m_WidthTextBox->Text() + "\" "); + + if (!String::IsNullOrEmpty(this->m_HeightTextBox->Text())) + svParameter.append("-h \"" + this->m_HeightTextBox->Text() + "\" "); + + // MAIN ############################################################################################ + if (!String::IsNullOrEmpty(this->m_LaunchArgsTextBox->Text())) + svParameter.append(this->m_LaunchArgsTextBox->Text()); + + return results; } default: return results; diff --git a/r5dev/thirdparty/cppnet/cppkore/KoreTheme.cpp b/r5dev/thirdparty/cppnet/cppkore/KoreTheme.cpp index e6892628..977ccd0a 100644 --- a/r5dev/thirdparty/cppnet/cppkore/KoreTheme.cpp +++ b/r5dev/thirdparty/cppnet/cppkore/KoreTheme.cpp @@ -49,8 +49,8 @@ namespace Themes const static auto TextEnabledBrush = Drawing::Color(Drawing::Color::White); const static auto TextDisabledBrush = Drawing::Color(Drawing::Color::Gray); - const static auto ProgressGrad1 = Drawing::Color(113, 156, 235); - const static auto ProgressGrad2 = Drawing::Color(113, 156, 235); + const static auto ProgressGrad1 = Drawing::Color(0, 120, 215); + const static auto ProgressGrad2 = Drawing::Color(0, 120, 215); const static auto HeaderBrush = Drawing::Color(54, 54, 54); diff --git a/r5dev/tier0/basetypes.h b/r5dev/tier0/basetypes.h index f17e7520..ed044e58 100644 --- a/r5dev/tier0/basetypes.h +++ b/r5dev/tier0/basetypes.h @@ -11,6 +11,117 @@ //#define GAMEDLL_S4 /*[i]*/ //#define GAMEDLL_S7 /*[i]*/ +//----------------------------------------------------------------------------- +// Set up platform defines. +//----------------------------------------------------------------------------- +#ifdef _WIN32 +#define IsPlatformLinux() 0 +#define IsPlatformPosix() 0 +#define IsPlatformOSX() 0 +#define IsOSXOpenGL() 0 +#define IsPlatformPS3() 0 +#define IsPlatformPS3_PPU() 0 +#define IsPlatformPS3_SPU() 0 +#define PLATFORM_WINDOWS 1 +#define PLATFORM_OPENGL 0 + +#ifndef _X360 +#define IsPlatformX360() 0 +#define IsPlatformWindowsPC() 1 +#define PLATFORM_WINDOWS_PC 1 + +#ifdef _WIN64 +#define IsPlatformWindowsPC64() 1 +#define IsPlatformWindowsPC32() 0 +#define PLATFORM_WINDOWS_PC64 1 +#else +#define IsPlatformWindowsPC64() 0 +#define IsPlatformWindowsPC32() 1 +#define PLATFORM_WINDOWS_PC32 1 +#endif + +#else // _X360 + +#define IsPlatformWindowsPC() 0 +#define IsPlatformWindowsPC64() 0 +#define IsPlatformWindowsPC32() 0 +#define IsPlatformX360() 1 +#define PLATFORM_X360 1 + +#endif // _X360 +#elif defined(_PS3) + +// Adding IsPlatformOpenGL() to help fix a bunch of code that was using IsPosix() to infer if the DX->GL translation layer was being used. +#if defined( DX_TO_GL_ABSTRACTION ) +#define IsPlatformOpenGL() true +#else +#define IsPlatformOpenGL() false +#endif + +#define IsPlatformX360() 0 +#define IsPlatformPS3() 1 +#ifdef SPU +#define IsPlatformPS3_PPU() 0 +#define IsPlatformPS3_SPU() 1 +#else +#define IsPlatformPS3_PPU() 1 +#define IsPlatformPS3_SPU() 0 +#endif +#define IsPlatformWindowsPC() 0 +#define IsPlatformWindowsPC64() 0 +#define IsPlatformWindowsPC32() 0 +#define IsPlatformPosix() 1 +#define PLATFORM_POSIX 1 +#define PLATFORM_OPENGL 0 + +#define IsPlatformLinux() 0 +#define IsPlatformOSX() 0 +#define IsOSXOpenGL() 0 + + +#elif defined(POSIX) +#define IsPlatformX360() 0 +#define IsPlatformPS3() 0 +#define IsPlatformPS3_PPU() 0 +#define IsPlatformPS3_SPU() 0 +#define IsPlatformWindowsPC() 0 +#define IsPlatformWindowsPC64() 0 +#define IsPlatformWindowsPC32() 0 +#define IsPlatformPosix() 1 +#define PLATFORM_POSIX 1 + +#if defined( LINUX ) && !defined( OSX ) // for havok we define both symbols, so don't let the osx build wander down here +#define IsPlatformLinux() 1 +#define IsPlatformOSX() 0 +#define IsOSXOpenGL() 0 +#define PLATFORM_OPENGL 0 +#define PLATFORM_LINUX 1 +#elif defined ( OSX ) +#define IsPlatformLinux() 0 +#define IsPlatformOSX() 1 +#define IsOSXOpenGL() 1 +#define PLATFORM_OSX 1 +#define PLATFORM_OPENGL 1 +#else +#define IsPlatformLinux() 0 +#define IsPlatformOSX() 0 +#define IsOSXOpenGL() 0 +#define PLATFORM_OPENGL 0 +#endif + +#else +#error +#endif + +//----------------------------------------------------------------------------- +// Old-school defines we're going to support since much code uses them +//----------------------------------------------------------------------------- +#define IsLinux() IsPlatformLinux() +#define IsOSX() IsPlatformOSX() +#define IsPosix() IsPlatformPosix() +#define IsX360() IsPlatformX360() +#define IsPS3() IsPlatformPS3() + #define MAX_SPLITSCREEN_CLIENT_BITS 2 // Max 2 player splitscreen in portal (don't merge this back), saves a bunch of memory [8/31/2010 tom] #define MAX_SPLITSCREEN_CLIENTS ( 1 << MAX_SPLITSCREEN_CLIENT_BITS ) // 4 // this should == MAX_JOYSTICKS in InputEnums.h @@ -44,6 +155,16 @@ #define FORWARD_DECLARE_HANDLE(name) typedef struct name##__ *name +#ifndef NOTE_UNUSED +#define NOTE_UNUSED(x) (void)(x) // for pesky compiler / lint warnings +#endif + +typedef float vec_t; +typedef float vec3_t[3]; + +typedef float float32; +typedef double float64; + struct vrect_t { int x, y, width, height;