@@ -411,6 +411,11 @@ void CSettings::CreateGUI()
411411 m_pPhotoSavingCheckbox->GetPosition (vecTemp, false );
412412 m_pPhotoSavingCheckbox->AutoSize (NULL , 20 .0f );
413413
414+ m_pCheckBoxAskBeforeDisconnect = reinterpret_cast <CGUICheckBox*>(pManager->CreateCheckBox (pTabMultiplayer, _ (" Ask before disconnecting from server using main menu" ), true ));
415+ m_pCheckBoxAskBeforeDisconnect->SetPosition (CVector2D (vecTemp.fX , vecTemp.fY + 20 .0f ));
416+ m_pCheckBoxAskBeforeDisconnect->GetPosition (vecTemp, false );
417+ m_pCheckBoxAskBeforeDisconnect->AutoSize (NULL , 20 .0f );
418+
414419 m_pCheckBoxCustomizedSAFiles = reinterpret_cast <CGUICheckBox*>(pManager->CreateCheckBox (pTabMultiplayer, _ (" Use customized GTA:SA files" ), true ));
415420 m_pCheckBoxCustomizedSAFiles->SetPosition (CVector2D (vecTemp.fX , vecTemp.fY + 20 .0f ));
416421 m_pCheckBoxCustomizedSAFiles->GetPosition (vecTemp, false );
@@ -3080,6 +3085,10 @@ void CSettings::LoadData()
30803085 CVARS_GET (" allow_discord_rpc" , bAllowDiscordRPC);
30813086 m_pCheckBoxAllowDiscordRPC->SetSelected (bAllowDiscordRPC);
30823087
3088+ bool bAskBeforeDisconnect;
3089+ CVARS_GET (" ask_before_disconnect" , bAskBeforeDisconnect);
3090+ m_pCheckBoxAskBeforeDisconnect->SetSelected (bAskBeforeDisconnect);
3091+
30833092 // Customized sa files
30843093 m_pCheckBoxCustomizedSAFiles->SetSelected (GetApplicationSettingInt (" customized-sa-files-request" ) != 0 );
30853094 m_pCheckBoxCustomizedSAFiles->SetVisible (GetApplicationSettingInt (" customized-sa-files-show" ) != 0 );
@@ -3557,6 +3566,9 @@ void CSettings::SaveData()
35573566 }
35583567 }
35593568
3569+ bool bAskBeforeDisconnect = m_pCheckBoxAskBeforeDisconnect->GetSelected ();
3570+ CVARS_SET (" ask_before_disconnect" , bAskBeforeDisconnect);
3571+
35603572 // Grass
35613573 bool bGrassEnabled = m_pCheckBoxGrass->GetSelected ();
35623574 CVARS_SET (" grass" , bGrassEnabled);
@@ -4765,34 +4777,39 @@ static void CPUAffinityQuestionCallBack(void* userdata, unsigned int button)
47654777{
47664778 CCore::GetSingleton ().GetLocalGUI ()->GetMainMenu ()->GetQuestionWindow ()->Reset ();
47674779
4768- if (button == 0 )
4769- {
4770- auto const checkBox = reinterpret_cast <CGUICheckBox*>(userdata);
4771- checkBox->SetSelected (false );
4772- }
4780+ auto * checkbox = static_cast <CGUICheckBox*>(userdata);
4781+
4782+ if (!checkbox)
4783+ return ;
4784+
4785+ if (button != 0 )
4786+ return ;
4787+
4788+ checkbox->SetSelected (true );
47734789}
47744790
47754791bool CSettings::OnAffinityClick (CGUIElement* pElement)
47764792{
4777- static bool shownWarning = false ;
4793+ static bool shown = false ;
47784794
4779- if (m_pProcessAffinityCheckbox->GetSelected () && !shownWarning)
4780- {
4781- shownWarning = true ;
4795+ if (m_pProcessAffinityCheckbox->GetSelected () || shown)
4796+ return true ;
47824797
4783- std::string message = std::string (
4784- _ (" This option should only be changed if you experience performance issues.\n "
4785- " \n Are you sure you want to enable this option?" ));
4798+ shown = true ;
47864799
4787- CQuestionBox* pQuestionBox = CCore::GetSingleton ().GetLocalGUI ()->GetMainMenu ()->GetQuestionWindow ();
4788- pQuestionBox->Reset ();
4789- pQuestionBox->SetTitle (_ (" EXPERIMENTAL FEATURE" ));
4790- pQuestionBox->SetMessage (message);
4791- pQuestionBox->SetButton (0 , _ (" No" ));
4792- pQuestionBox->SetButton (1 , _ (" Yes" ));
4793- pQuestionBox->SetCallback (CPUAffinityQuestionCallBack, m_pProcessAffinityCheckbox);
4794- pQuestionBox->Show ();
4795- }
4800+ std::string title = _ (" EXPERIMENTAL FEATURE" );
4801+ std::string message =
4802+ std::string (_ (" Disabling this option is not recommended unless you are experiencing performance issues.\n\n "
4803+ " Are you sure you want to disable it?" ));
4804+
4805+ CQuestionBox* pQuestionBox = CCore::GetSingleton ().GetLocalGUI ()->GetMainMenu ()->GetQuestionWindow ();
4806+ pQuestionBox->Reset ();
4807+ pQuestionBox->SetTitle (title);
4808+ pQuestionBox->SetMessage (message);
4809+ pQuestionBox->SetButton (0 , _ (" No" ));
4810+ pQuestionBox->SetButton (1 , _ (" Yes" ));
4811+ pQuestionBox->SetCallback (CPUAffinityQuestionCallBack, m_pProcessAffinityCheckbox);
4812+ pQuestionBox->Show ();
47964813
47974814 return true ;
47984815}
@@ -4961,7 +4978,7 @@ bool CSettings::OnShowAdvancedSettingDescription(CGUIElement* pElement)
49614978 else if (pCheckBox && pCheckBox == m_pWin8MouseCheckBox)
49624979 strText = std::string (_ (" Mouse fix:" )) + " " + std::string (_ (" Mouse movement fix - May need PC restart" ));
49634980 else if (pCheckBox && pCheckBox == m_pProcessAffinityCheckbox)
4964- strText = std::string (_ (" CPU affinity:" )) + " " + std::string (_ (" Experimental feature - Change only if you experience performance issues" ));
4981+ strText = std::string (_ (" CPU affinity:" )) + " " + std::string (_ (" Only change if you're having stability issues. " ));
49654982
49664983 if (strText != " " )
49674984 m_pAdvancedSettingDescriptionLabel->SetText (strText.c_str ());
0 commit comments