From 0399d753f4d0dceffbca43de9f5050b34fa47875 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Tue, 25 Apr 2023 00:47:44 +0200 Subject: [PATCH] Properly toggle cvars in sdk launcher Toggle them on or off instead of just on. Else disabling the toggle wouldn't disable then in the runtime as the default value of these cvars is '1'. --- r5dev/sdklauncher/basepanel.cpp | 29 ++++++++++++----------------- r5dev/sdklauncher/basepanel.h | 2 +- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/r5dev/sdklauncher/basepanel.cpp b/r5dev/sdklauncher/basepanel.cpp index 0334b48d..8708b628 100644 --- a/r5dev/sdklauncher/basepanel.cpp +++ b/r5dev/sdklauncher/basepanel.cpp @@ -347,13 +347,13 @@ void CSurface::Init() this->m_NetRandomKeyToggle->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); this->m_EngineNetworkGroup->AddControl(this->m_NetRandomKeyToggle); - this->m_NoQueuedPacketThread = new UIX::UIXCheckBox(); - this->m_NoQueuedPacketThread->SetSize({ 125, 18 }); - this->m_NoQueuedPacketThread->SetLocation({ 15, 30 }); - this->m_NoQueuedPacketThread->SetTabIndex(2); - this->m_NoQueuedPacketThread->SetText("No queued packets"); - this->m_NoQueuedPacketThread->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); - this->m_EngineNetworkGroup->AddControl(this->m_NoQueuedPacketThread); + this->m_QueuedPacketThread = new UIX::UIXCheckBox(); + this->m_QueuedPacketThread->SetSize({ 125, 18 }); + this->m_QueuedPacketThread->SetLocation({ 15, 30 }); + this->m_QueuedPacketThread->SetTabIndex(2); + this->m_QueuedPacketThread->SetText("Queued packets"); + this->m_QueuedPacketThread->SetAnchor(Forms::AnchorStyles::Top | Forms::AnchorStyles::Left); + this->m_EngineNetworkGroup->AddControl(this->m_QueuedPacketThread); this->m_NoTimeOutToggle = new UIX::UIXCheckBox(); this->m_NoTimeOutToggle->SetSize({ 125, 18 }); @@ -566,7 +566,7 @@ void CSurface::LoadSettings() this->m_NetRandomKeyToggle->SetChecked(attributeView != "0"); attributeView = vRoot.attribs["noQueuedPackets"]; - this->m_NoQueuedPacketThread->SetChecked(attributeView != "0"); + this->m_QueuedPacketThread->SetChecked(attributeView != "0"); attributeView = vRoot.attribs["noTimeOut"]; this->m_NoTimeOutToggle->SetChecked(attributeView != "0"); @@ -635,7 +635,7 @@ void CSurface::SaveSettings() // Network. vRoot.add_attribute("encryptionEnable", GetControlValue(this->m_NetEncryptionToggle)); vRoot.add_attribute("randomNetKey", GetControlValue(this->m_NetRandomKeyToggle)); - vRoot.add_attribute("noQueuedPackets", GetControlValue(this->m_NoQueuedPacketThread)); + vRoot.add_attribute("noQueuedPackets", GetControlValue(this->m_QueuedPacketThread)); vRoot.add_attribute("noTimeOut", GetControlValue(this->m_NoTimeOutToggle)); // Video. @@ -1031,14 +1031,9 @@ void CSurface::AppendHostParameters(string& svParameters) //----------------------------------------------------------------------------- void CSurface::AppendNetParameters(string& svParameters) { - if (this->m_NetEncryptionToggle->Checked()) - AppendParameterInternal(svParameters, "+net_encryptionEnable", "1"); - - if (this->m_NetRandomKeyToggle->Checked()) - AppendParameterInternal(svParameters, "+net_useRandomKey", "1"); - - if (this->m_NoQueuedPacketThread->Checked()) - AppendParameterInternal(svParameters, "+net_queued_packet_thread", "0"); + AppendParameterInternal(svParameters, "+net_encryptionEnable", this->m_NetEncryptionToggle->Checked() ? "1" : "0"); + AppendParameterInternal(svParameters, "+net_useRandomKey", this->m_NetRandomKeyToggle->Checked() ? "1" : "0"); + AppendParameterInternal(svParameters, "+net_queued_packet_thread", this->m_QueuedPacketThread->Checked() ? "1" : "0"); if (this->m_NoTimeOutToggle->Checked()) AppendParameterInternal(svParameters, "-notimeout"); diff --git a/r5dev/sdklauncher/basepanel.h b/r5dev/sdklauncher/basepanel.h index 3b26405b..1d6b7616 100644 --- a/r5dev/sdklauncher/basepanel.h +++ b/r5dev/sdklauncher/basepanel.h @@ -106,7 +106,7 @@ private: UIX::UIXCheckBox* m_NoAsyncJobsToggle; UIX::UIXCheckBox* m_NetEncryptionToggle; UIX::UIXCheckBox* m_NetRandomKeyToggle; - UIX::UIXCheckBox* m_NoQueuedPacketThread; + UIX::UIXCheckBox* m_QueuedPacketThread; UIX::UIXCheckBox* m_NoTimeOutToggle; UIX::UIXCheckBox* m_WindowedToggle; UIX::UIXCheckBox* m_NoBorderToggle;