Skip to content

Commit 00e02f7

Browse files
Synchronize changes from 1.6 master branch [ci skip]
3419b9b Add setting to save camera photos in documents folder (PR #3667, Fixes #3542)
2 parents 97b5de3 + 3419b9b commit 00e02f7

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

Client/core/CScreenShot.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ static bool ms_bIsSaving = false;
3535
static uint ms_uiWidth = 0;
3636
static uint ms_uiHeight = 0;
3737

38+
// whether we want to actually save photo in documents folder
39+
static bool savePhotoInDocuments = false;
40+
3841
void CScreenShot::InitiateScreenShot(bool bIsCameraShot)
3942
{
4043
if (ms_bScreenShot || ms_bIsSaving || IsRateLimited(bIsCameraShot))
@@ -48,8 +51,11 @@ void CScreenShot::InitiateScreenShot(bool bIsCameraShot)
4851

4952
if (bIsCameraShot)
5053
{
51-
// Set the screenshot path to camera gallery path
52-
ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery");
54+
if (savePhotoInDocuments)
55+
{
56+
// Set the screenshot path to camera gallery path
57+
ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery");
58+
}
5359
}
5460
else
5561
{
@@ -82,6 +88,13 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI)
8288
// Update last time of taken screenshot of given type
8389
ms_lLastSaveTime[ms_bIsCameraShot] = GetTickCount64_();
8490

91+
if (ms_bIsCameraShot && !savePhotoInDocuments)
92+
{
93+
ClearBuffer();
94+
ms_bScreenShot = false;
95+
return;
96+
}
97+
8598
ms_strScreenShotPath = GetScreenshotPath();
8699
ms_uiWidth = CDirect3DData::GetSingleton().GetViewportWidth();
87100
ms_uiHeight = CDirect3DData::GetSingleton().GetViewportHeight();
@@ -205,3 +218,8 @@ void CScreenShot::ClearBuffer()
205218
{
206219
ms_ScreenShotBuffer.Clear();
207220
}
221+
222+
void CScreenShot::SetPhotoSavingInsideDocuments(bool savePhoto) noexcept
223+
{
224+
savePhotoInDocuments = savePhoto;
225+
}

Client/core/CScreenShot.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class CScreenShot
1919
public:
2020
static void InitiateScreenShot(bool bIsCameraShot);
2121
static void CheckForScreenShot(bool bBeforeGUI);
22+
static void SetPhotoSavingInsideDocuments(bool bSavePhoto) noexcept;
2223

2324
protected:
2425
static void StartSaveThread();

Client/core/CSettings.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,12 @@ void CSettings::CreateGUI()
12011201
m_pCachePathValue->AutoSize();
12021202
vecTemp.fY += fLineHeight;
12031203

1204+
// Enable camera photos getting saved to documents folder
1205+
m_pPhotoSavingCheckbox = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true));
1206+
m_pPhotoSavingCheckbox->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY));
1207+
m_pPhotoSavingCheckbox->AutoSize(NULL, 20.0f);
1208+
vecTemp.fY += fLineHeight;
1209+
12041210
// Auto updater section label
12051211
m_pAdvancedUpdaterLabel = reinterpret_cast<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Auto updater")));
12061212
m_pAdvancedUpdaterLabel->SetPosition(CVector2D(vecTemp.fX - 10.0f, vecTemp.fY));
@@ -3218,6 +3224,10 @@ void CSettings::LoadData()
32183224
iVar = GetApplicationSettingInt("Win8MouseFix");
32193225
m_pWin8MouseCheckBox->SetSelected(iVar != 0);
32203226

3227+
// Save camera photos inside user documents folder
3228+
CVARS_GET("photosaving", bVar);
3229+
m_pPhotoSavingCheckbox->SetSelected(bVar);
3230+
32213231
// Update build type
32223232
CVARS_GET("update_build_type", iVar);
32233233
if (iVar == 0 || iVar == 1)
@@ -3609,6 +3619,11 @@ void CSettings::SaveData()
36093619
// Windows 8 mouse fix
36103620
SetApplicationSettingInt("Win8MouseFix", m_pWin8MouseCheckBox->GetSelected());
36113621

3622+
// Save photos in documents folder
3623+
bool photoSaving = m_pPhotoSavingCheckbox->GetSelected();
3624+
CVARS_SET("photosaving", photoSaving);
3625+
CScreenShot::SetPhotoSavingInsideDocuments(photoSaving);
3626+
36123627
// Debug setting
36133628
if (CGUIListItem* pSelected = m_pDebugSettingCombo->GetSelectedItem())
36143629
{

Client/core/CSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ class CSettings
215215
CGUILabel* m_pWin8Label;
216216
CGUICheckBox* m_pWin8ColorCheckBox;
217217
CGUICheckBox* m_pWin8MouseCheckBox;
218+
CGUICheckBox* m_pPhotoSavingCheckbox;
218219
CGUILabel* m_pUpdateBuildTypeLabel;
219220
CGUIComboBox* m_pUpdateBuildTypeCombo;
220221
CGUILabel* m_pUpdateAutoInstallLabel;

0 commit comments

Comments
 (0)