diff --git a/Client/core/CScreenShot.cpp b/Client/core/CScreenShot.cpp index fa7ba37aad..59e387b1f6 100644 --- a/Client/core/CScreenShot.cpp +++ b/Client/core/CScreenShot.cpp @@ -35,6 +35,9 @@ static bool ms_bIsSaving = false; static uint ms_uiWidth = 0; static uint ms_uiHeight = 0; +// whether we want to actually save photo in documents folder +static bool savePhotoInDocuments = false; + void CScreenShot::InitiateScreenShot(bool bIsCameraShot) { if (ms_bScreenShot || ms_bIsSaving || IsRateLimited(bIsCameraShot)) @@ -48,8 +51,11 @@ void CScreenShot::InitiateScreenShot(bool bIsCameraShot) if (bIsCameraShot) { - // Set the screenshot path to camera gallery path - ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery"); + if (savePhotoInDocuments) + { + // Set the screenshot path to camera gallery path + ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery"); + } } else { @@ -82,6 +88,13 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI) // Update last time of taken screenshot of given type ms_lLastSaveTime[ms_bIsCameraShot] = GetTickCount64_(); + if (ms_bIsCameraShot && !savePhotoInDocuments) + { + ClearBuffer(); + ms_bScreenShot = false; + return; + } + ms_strScreenShotPath = GetScreenshotPath(); ms_uiWidth = CDirect3DData::GetSingleton().GetViewportWidth(); ms_uiHeight = CDirect3DData::GetSingleton().GetViewportHeight(); @@ -205,3 +218,8 @@ void CScreenShot::ClearBuffer() { ms_ScreenShotBuffer.Clear(); } + +void CScreenShot::SetPhotoSavingInsideDocuments(bool savePhoto) noexcept +{ + savePhotoInDocuments = savePhoto; +} diff --git a/Client/core/CScreenShot.h b/Client/core/CScreenShot.h index 07f5594ccf..e83545385a 100644 --- a/Client/core/CScreenShot.h +++ b/Client/core/CScreenShot.h @@ -19,6 +19,7 @@ class CScreenShot public: static void InitiateScreenShot(bool bIsCameraShot); static void CheckForScreenShot(bool bBeforeGUI); + static void SetPhotoSavingInsideDocuments(bool bSavePhoto) noexcept; protected: static void StartSaveThread(); diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 847735a891..14080ce393 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -1183,6 +1183,12 @@ void CSettings::CreateGUI() m_pCachePathValue->AutoSize(); vecTemp.fY += fLineHeight; + // Enable camera photos getting saved to documents folder + m_pPhotoSavingCheckbox = reinterpret_cast(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true)); + m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY)); + m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f); + vecTemp.fY += fLineHeight; + // Auto updater section label m_pAdvancedUpdaterLabel = reinterpret_cast(pManager->CreateLabel(pTabAdvanced, _("Auto updater"))); m_pAdvancedUpdaterLabel->SetPosition(CVector2D(vecTemp.fX - 10.0f, vecTemp.fY)); @@ -3193,6 +3199,10 @@ void CSettings::LoadData() iVar = GetApplicationSettingInt("Win8MouseFix"); m_pWin8MouseCheckBox->SetSelected(iVar != 0); + // Save camera photos inside user documents folder + CVARS_GET("photosaving", bVar); + m_pPhotoSavingCheckbox->SetSelected(bVar); + // Update build type CVARS_GET("update_build_type", iVar); if (iVar == 0 || iVar == 1) @@ -3582,6 +3592,11 @@ void CSettings::SaveData() // Windows 8 mouse fix SetApplicationSettingInt("Win8MouseFix", m_pWin8MouseCheckBox->GetSelected()); + // Save photos in documents folder + bool photoSaving = m_pPhotoSavingCheckbox->GetSelected(); + CVARS_SET("photosaving", photoSaving); + CScreenShot::SetPhotoSavingInsideDocuments(photoSaving); + // Debug setting if (CGUIListItem* pSelected = m_pDebugSettingCombo->GetSelectedItem()) { diff --git a/Client/core/CSettings.h b/Client/core/CSettings.h index bfeec87c44..6e6bde42d9 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -213,6 +213,7 @@ class CSettings CGUILabel* m_pWin8Label; CGUICheckBox* m_pWin8ColorCheckBox; CGUICheckBox* m_pWin8MouseCheckBox; + CGUICheckBox* m_pPhotoSavingCheckbox; CGUILabel* m_pUpdateBuildTypeLabel; CGUIComboBox* m_pUpdateBuildTypeCombo; CGUILabel* m_pUpdateAutoInstallLabel;