Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to toggle photos taken by ingame camera to be saved in documents folder (fixes #3542) #3667

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Client/core/CScreenShot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
tederis marked this conversation as resolved.
Show resolved Hide resolved

void CScreenShot::InitiateScreenShot(bool bIsCameraShot)
{
if (ms_bScreenShot || ms_bIsSaving || IsRateLimited(bIsCameraShot))
Expand All @@ -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");
}
ffsPLASMA marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -205,3 +218,8 @@ void CScreenShot::ClearBuffer()
{
ms_ScreenShotBuffer.Clear();
}

void CScreenShot::SetPhotoSavingInsideDocuments(bool savePhoto) noexcept
{
savePhotoInDocuments = savePhoto;
}
1 change: 1 addition & 0 deletions Client/core/CScreenShot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 15 additions & 0 deletions Client/core/CSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CGUICheckBox*>(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<CGUILabel*>(pManager->CreateLabel(pTabAdvanced, _("Auto updater")));
m_pAdvancedUpdaterLabel->SetPosition(CVector2D(vecTemp.fX - 10.0f, vecTemp.fY));
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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())
{
Expand Down
1 change: 1 addition & 0 deletions Client/core/CSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading