From eff7ed1bb6b6d60978a1c6d5dc9bcd7c1de1bec5 Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Sun, 21 Jul 2024 09:57:46 +0200 Subject: [PATCH 1/7] Make frame graph scale accordingly to resolution. --- Client/core/CGraphStats.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Client/core/CGraphStats.cpp b/Client/core/CGraphStats.cpp index eb6284ff15c..cc8d6011632 100644 --- a/Client/core/CGraphStats.cpp +++ b/Client/core/CGraphStats.cpp @@ -12,8 +12,6 @@ namespace { - #define GRAPHSTAT_HISTORY_SIZE 256 - struct SGraphStatLine { TIMEUS prevData; @@ -113,6 +111,11 @@ void CGraphStats::AddTimingPoint(const char* szName) if (!IsEnabled()) return; + CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); + + uint uiViewportWidth = pGraphics->GetViewportWidth(); + uint uiSizeX = uiViewportWidth / 4; + // Start of next frame? if (szName[0] == 0) { @@ -133,7 +136,7 @@ void CGraphStats::AddTimingPoint(const char* szName) for (int i = 0; i < Dups; i++) { pLine->iDataPos++; - if (pLine->iDataPos > GRAPHSTAT_HISTORY_SIZE - 1) + if (pLine->iDataPos > uiSizeX - 1) pLine->iDataPos = 0; pLine->dataHistory[pLine->iDataPos] = Data; } @@ -153,7 +156,7 @@ void CGraphStats::AddTimingPoint(const char* szName) // Add new line MapSet(m_LineList, szName, SGraphStatLine()); pLine = MapFind(m_LineList, szName); - pLine->dataHistory.resize(GRAPHSTAT_HISTORY_SIZE); + pLine->dataHistory.resize(uiSizeX); memset(&pLine->dataHistory[0], 0, pLine->dataHistory.size()); pLine->iDataPos = 0; pLine->prevData = 0; @@ -179,7 +182,7 @@ void CGraphStats::AddTimingPoint(const char* szName) // Inc position pLine->iDataPos++; - if (pLine->iDataPos > GRAPHSTAT_HISTORY_SIZE - 1) + if (pLine->iDataPos > uiSizeX - 1) pLine->iDataPos = 0; // Insert data point @@ -200,11 +203,12 @@ void CGraphStats::Draw() CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); + uint uiViewportWidth = pGraphics->GetViewportWidth(); uint uiViewportHeight = pGraphics->GetViewportHeight(); uint uiOriginX = 10; - uint uiOriginY = std::min(500, uiViewportHeight - 10); - uint uiSizeX = GRAPHSTAT_HISTORY_SIZE; - uint uiSizeY = 150; + uint uiOriginY = uiViewportHeight / 2; + uint uiSizeX = uiViewportWidth / 4; + uint uiSizeY = uiViewportHeight / 4; uint uiRangeY = 100; // 100ms float fLineScale = 1 / 1000.f / uiRangeY * uiSizeY; float fLineHeight = pGraphics->GetDXFontHeight(); @@ -229,7 +233,7 @@ void CGraphStats::Draw() iDataPosPrev = iDataPos; iDataPos--; if (iDataPos == -1) - iDataPos = GRAPHSTAT_HISTORY_SIZE - 1; + iDataPos = uiSizeX - 1; pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, uiOriginX + i, uiOriginY - fY1, 1, line.color, true); From a0f5d20745abbc1bcc00a6a035403e2887de8c58 Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Sun, 21 Jul 2024 10:20:55 +0200 Subject: [PATCH 2/7] addendum to previous commit --- Client/core/CGraphStats.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/core/CGraphStats.cpp b/Client/core/CGraphStats.cpp index cc8d6011632..4879be7b3b1 100644 --- a/Client/core/CGraphStats.cpp +++ b/Client/core/CGraphStats.cpp @@ -113,8 +113,8 @@ void CGraphStats::AddTimingPoint(const char* szName) CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); - uint uiViewportWidth = pGraphics->GetViewportWidth(); - uint uiSizeX = uiViewportWidth / 4; + std::uint32_t viewportWidth = pGraphics->GetViewportWidth(); + std::uint32_t sizeX = viewportWidth / 4; // Start of next frame? if (szName[0] == 0) @@ -136,7 +136,7 @@ void CGraphStats::AddTimingPoint(const char* szName) for (int i = 0; i < Dups; i++) { pLine->iDataPos++; - if (pLine->iDataPos > uiSizeX - 1) + if (pLine->iDataPos > sizeX - 1) pLine->iDataPos = 0; pLine->dataHistory[pLine->iDataPos] = Data; } @@ -156,7 +156,7 @@ void CGraphStats::AddTimingPoint(const char* szName) // Add new line MapSet(m_LineList, szName, SGraphStatLine()); pLine = MapFind(m_LineList, szName); - pLine->dataHistory.resize(uiSizeX); + pLine->dataHistory.resize(sizeX); memset(&pLine->dataHistory[0], 0, pLine->dataHistory.size()); pLine->iDataPos = 0; pLine->prevData = 0; @@ -182,7 +182,7 @@ void CGraphStats::AddTimingPoint(const char* szName) // Inc position pLine->iDataPos++; - if (pLine->iDataPos > uiSizeX - 1) + if (pLine->iDataPos > sizeX - 1) pLine->iDataPos = 0; // Insert data point From 47f786964c8055b76e3beb6e6ecc6a5a3e2ac595 Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Thu, 15 Aug 2024 20:07:18 +0200 Subject: [PATCH 3/7] make framegraph appear right under chat with small gap and comment vars --- Client/core/CChat.cpp | 5 +++++ Client/core/CChat.h | 2 ++ Client/core/CGUI.cpp | 5 +++++ Client/core/CGUI.h | 1 + Client/core/CGraphStats.cpp | 20 ++++++++++++-------- 5 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Client/core/CChat.cpp b/Client/core/CChat.cpp index 4a66d2907bf..70ad6777655 100644 --- a/Client/core/CChat.cpp +++ b/Client/core/CChat.cpp @@ -1117,6 +1117,11 @@ void CChat::SetCharacterLimit(int charLimit) m_iCharacterLimit = charLimit; } +float CChat::GetChatBottomPosition() +{ + return m_vecBackgroundSize.fY; +} + CChatLine::CChatLine() { m_bActive = false; diff --git a/Client/core/CChat.h b/Client/core/CChat.h index 53160861700..0c042d161d6 100644 --- a/Client/core/CChat.h +++ b/Client/core/CChat.h @@ -207,6 +207,8 @@ class CChat constexpr int GetDefaultCharacterLimit() const { return m_iDefaultCharacterLimit; } constexpr int GetMaxCharacterLimit() const { return m_iMaxCharacterLimit; } + float GetChatBottomPosition(); + private: void LoadCVars(); diff --git a/Client/core/CGUI.cpp b/Client/core/CGUI.cpp index a64955ac79d..4f08061226b 100644 --- a/Client/core/CGUI.cpp +++ b/Client/core/CGUI.cpp @@ -449,6 +449,11 @@ CChat* CLocalGUI::GetChat() return m_pChat; } +float CLocalGUI::GetChatBottomPosition() +{ + return m_pChat->GetChatBottomPosition(); +} + CDebugView* CLocalGUI::GetDebugView() { return m_pDebugView; diff --git a/Client/core/CGUI.h b/Client/core/CGUI.h index 39d7921bba7..0faff5fb58f 100644 --- a/Client/core/CGUI.h +++ b/Client/core/CGUI.h @@ -68,6 +68,7 @@ class CLocalGUI : public CSingleton bool IsMainMenuVisible(); CChat* GetChat(); + float GetChatBottomPosition(); void SetChatBoxVisible(bool bVisible, bool bInputBlocked = true); bool IsChatBoxVisible(); bool IsChatBoxInputBlocked(); diff --git a/Client/core/CGraphStats.cpp b/Client/core/CGraphStats.cpp index 4879be7b3b1..1ca0c41f50c 100644 --- a/Client/core/CGraphStats.cpp +++ b/Client/core/CGraphStats.cpp @@ -114,7 +114,7 @@ void CGraphStats::AddTimingPoint(const char* szName) CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); std::uint32_t viewportWidth = pGraphics->GetViewportWidth(); - std::uint32_t sizeX = viewportWidth / 4; + std::uint32_t sizeX = viewportWidth / 4; // one quarter of screen width // Start of next frame? if (szName[0] == 0) @@ -202,14 +202,18 @@ void CGraphStats::Draw() return; CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); + CLocalGUI* pLocalGUI = g_pCore->GetLocalGUI(); + + uint uiViewportWidth = pGraphics->GetViewportWidth(); // get width of current resolution + uint uiViewportHeight = pGraphics->GetViewportHeight(); // get height of current resolution + uint uiOriginX = 10; // offset the graph by 10 pixels from left side of screen + uint uiOriginY = pLocalGUI->GetChatBottomPosition(); // get chat bottom screen position + uint uiSizeX = uiViewportWidth / 4; // set the width of graph to 1/4 of current resolution + uint uiSizeY = uiViewportHeight / 4; // set the height of graph to 1/4 of current resolution + uint uiRangeY = 100; // 100ms + + uiOriginY = uiOriginY + uiSizeY + 30; // add graph height plus a little gap to the overall Y position - uint uiViewportWidth = pGraphics->GetViewportWidth(); - uint uiViewportHeight = pGraphics->GetViewportHeight(); - uint uiOriginX = 10; - uint uiOriginY = uiViewportHeight / 2; - uint uiSizeX = uiViewportWidth / 4; - uint uiSizeY = uiViewportHeight / 4; - uint uiRangeY = 100; // 100ms float fLineScale = 1 / 1000.f / uiRangeY * uiSizeY; float fLineHeight = pGraphics->GetDXFontHeight(); From 97d93ddbac9baf884932f35d1f63b9978e5358cd Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Wed, 21 Aug 2024 19:50:34 +0200 Subject: [PATCH 4/7] fixes to previous comments --- Client/core/CChat.cpp | 2 +- Client/core/CChat.h | 2 +- Client/core/CGUI.cpp | 2 +- Client/core/CGUI.h | 2 +- Client/core/CGraphStats.cpp | 34 +++++++++++++++++----------------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Client/core/CChat.cpp b/Client/core/CChat.cpp index 70ad6777655..438ea577fea 100644 --- a/Client/core/CChat.cpp +++ b/Client/core/CChat.cpp @@ -1117,7 +1117,7 @@ void CChat::SetCharacterLimit(int charLimit) m_iCharacterLimit = charLimit; } -float CChat::GetChatBottomPosition() +float CChat::GetChatBottomPosition() const noexcept { return m_vecBackgroundSize.fY; } diff --git a/Client/core/CChat.h b/Client/core/CChat.h index 0c042d161d6..e9671270750 100644 --- a/Client/core/CChat.h +++ b/Client/core/CChat.h @@ -207,7 +207,7 @@ class CChat constexpr int GetDefaultCharacterLimit() const { return m_iDefaultCharacterLimit; } constexpr int GetMaxCharacterLimit() const { return m_iMaxCharacterLimit; } - float GetChatBottomPosition(); + float GetChatBottomPosition() const noexcept; private: void LoadCVars(); diff --git a/Client/core/CGUI.cpp b/Client/core/CGUI.cpp index 4f08061226b..c4a2729d7a0 100644 --- a/Client/core/CGUI.cpp +++ b/Client/core/CGUI.cpp @@ -449,7 +449,7 @@ CChat* CLocalGUI::GetChat() return m_pChat; } -float CLocalGUI::GetChatBottomPosition() +float CLocalGUI::GetChatBottomPosition() const noexcept { return m_pChat->GetChatBottomPosition(); } diff --git a/Client/core/CGUI.h b/Client/core/CGUI.h index 0faff5fb58f..f6670828441 100644 --- a/Client/core/CGUI.h +++ b/Client/core/CGUI.h @@ -68,7 +68,7 @@ class CLocalGUI : public CSingleton bool IsMainMenuVisible(); CChat* GetChat(); - float GetChatBottomPosition(); + float GetChatBottomPosition() const noexcept; void SetChatBoxVisible(bool bVisible, bool bInputBlocked = true); bool IsChatBoxVisible(); bool IsChatBoxInputBlocked(); diff --git a/Client/core/CGraphStats.cpp b/Client/core/CGraphStats.cpp index 1ca0c41f50c..3a5a25cc2ef 100644 --- a/Client/core/CGraphStats.cpp +++ b/Client/core/CGraphStats.cpp @@ -204,32 +204,32 @@ void CGraphStats::Draw() CGraphicsInterface* pGraphics = g_pCore->GetGraphics(); CLocalGUI* pLocalGUI = g_pCore->GetLocalGUI(); - uint uiViewportWidth = pGraphics->GetViewportWidth(); // get width of current resolution - uint uiViewportHeight = pGraphics->GetViewportHeight(); // get height of current resolution - uint uiOriginX = 10; // offset the graph by 10 pixels from left side of screen - uint uiOriginY = pLocalGUI->GetChatBottomPosition(); // get chat bottom screen position - uint uiSizeX = uiViewportWidth / 4; // set the width of graph to 1/4 of current resolution - uint uiSizeY = uiViewportHeight / 4; // set the height of graph to 1/4 of current resolution - uint uiRangeY = 100; // 100ms + std::uint32_t viewportWidth = pGraphics->GetViewportWidth(); // get width of current resolution + std::uint32_t viewportHeight = pGraphics->GetViewportHeight(); // get height of current resolution + std::uint32_t originX = 10; // offset the graph by 10 pixels from left side of screen + std::uint32_t originY = pLocalGUI->GetChatBottomPosition(); // get chat bottom screen position + std::uint32_t sizeX = viewportWidth / 4; // set the width of graph to 1/4 of current resolution + std::uint32_t sizeY = viewportHeight / 4; // set the height of graph to 1/4 of current resolution + std::uint32_t rangeY = 100; // 100ms - uiOriginY = uiOriginY + uiSizeY + 30; // add graph height plus a little gap to the overall Y position + originY = originY + sizeY + 30; // add graph height plus a little gap to the overall Y position - float fLineScale = 1 / 1000.f / uiRangeY * uiSizeY; + float fLineScale = 1 / 1000.f / rangeY * sizeY; float fLineHeight = pGraphics->GetDXFontHeight(); // Backgroung box - pGraphics->DrawRectQueued(uiOriginX, uiOriginY - uiSizeY, uiSizeX, uiSizeY, SColorRGBA(0, 0, 0, 128), true); + pGraphics->DrawRectQueued(originX, originY - sizeY, sizeX, sizeY, SColorRGBA(0, 0, 0, 128), true); // Draw data lines - float fLabelX = uiOriginX + uiSizeX + 22; - float fLabelY = uiOriginY - m_LineList.size() * fLineHeight; + float fLabelX = originX + sizeX + 22; + float fLabelY = originY - m_LineList.size() * fLineHeight; for (const auto& dataLine : m_LineList) { const SGraphStatLine& line = dataLine.second; int iDataPos = line.iDataPos; int iDataPosPrev = iDataPos; - for (int i = uiSizeX - 1; i > 0; i--) + for (int i = sizeX - 1; i > 0; i--) { float fY0 = line.dataHistory[iDataPos] * fLineScale; float fY1 = line.dataHistory[iDataPosPrev] * fLineScale; @@ -237,14 +237,14 @@ void CGraphStats::Draw() iDataPosPrev = iDataPos; iDataPos--; if (iDataPos == -1) - iDataPos = uiSizeX - 1; + iDataPos = sizeX - 1; - pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, uiOriginX + i, uiOriginY - fY1, 1, line.color, true); + pGraphics->DrawLineQueued(originX + i - 1, originY - fY0, originX + i, originY - fY1, 1, line.color, true); - if (i == uiSizeX - 1) + if (i == sizeX - 1) { // Line from graph to label - pGraphics->DrawLineQueued(uiOriginX + i - 1, uiOriginY - fY0, fLabelX - 2, fLabelY + fLineHeight / 2, 1, line.color, true); + pGraphics->DrawLineQueued(originX + i - 1, originY - fY0, fLabelX - 2, fLabelY + fLineHeight / 2, 1, line.color, true); } } From 1219fe29a7530125a3e20123c2dbef7161cccbe9 Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Wed, 21 Aug 2024 21:57:16 +0200 Subject: [PATCH 5/7] add setting to toggle photos getting saved inside documents folder --- Client/core/CScreenShot.cpp | 25 +++++++++++++++++++++++-- Client/core/CScreenShot.h | 1 + Client/core/CSettings.cpp | 15 +++++++++++++++ Client/core/CSettings.h | 1 + 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/Client/core/CScreenShot.cpp b/Client/core/CScreenShot.cpp index fa7ba37aadb..175997f81a0 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 ms_bSavePhotoInDocuments = 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 (ms_bSavePhotoInDocuments) + { + // Set the screenshot path to camera gallery path + ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery"); + } } else { @@ -82,6 +88,16 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI) // Update last time of taken screenshot of given type ms_lLastSaveTime[ms_bIsCameraShot] = GetTickCount64_(); + if (ms_bIsCameraShot) + { + if (!ms_bSavePhotoInDocuments) + { + ClearBuffer(); + ms_bScreenShot = false; + return; + } + } + ms_strScreenShotPath = GetScreenshotPath(); ms_uiWidth = CDirect3DData::GetSingleton().GetViewportWidth(); ms_uiHeight = CDirect3DData::GetSingleton().GetViewportHeight(); @@ -205,3 +221,8 @@ void CScreenShot::ClearBuffer() { ms_ScreenShotBuffer.Clear(); } + +void CScreenShot::SetPhotoSavingInsideDocuments(bool bSavePhoto) +{ + ms_bSavePhotoInDocuments = bSavePhoto ? 1 : 0; +} diff --git a/Client/core/CScreenShot.h b/Client/core/CScreenShot.h index 07f5594ccfd..3504ae8e241 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); protected: static void StartSaveThread(); diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 847735a8912..abb2ebef89b 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -882,6 +882,10 @@ void CSettings::CreateGUI() m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 130.0f)); m_pCheckBoxCoronaReflections->AutoSize(NULL, 20.0f); + m_pCheckBoxPhotoSaving = reinterpret_cast(pManager->CreateCheckBox(pTabVideo, _("Save photos inside documents folder"), true)); + m_pCheckBoxPhotoSaving->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 150.0f)); + m_pCheckBoxPhotoSaving->AutoSize(NULL, 20.0f); + vecTemp.fY += 10; m_pTabs->GetSize(vecTemp); @@ -1593,6 +1597,11 @@ void CSettings::UpdateVideoTab() CVARS_GET("blur", bBlur); m_pCheckBoxBlur->SetSelected(bBlur); + // Save photos in documents folder + bool bPhotoSave; + CVARS_GET("photosaving", bPhotoSave); + m_pCheckBoxPhotoSaving->SetSelected(bPhotoSave); + // Corona rain reflections bool bCoronaReflections; CVARS_GET("corona_reflections", bCoronaReflections); @@ -1831,6 +1840,7 @@ bool CSettings::OnVideoDefaultClick(CGUIElement* pElement) CVARS_SET("high_detail_vehicles", false); CVARS_SET("high_detail_peds", false); CVARS_SET("blur", true); + CVARS_SET("photosaving", true); CVARS_SET("corona_reflections", false); CVARS_SET("dynamic_ped_shadows", false); gameSettings->UpdateFieldOfViewFromSettings(); @@ -3520,6 +3530,11 @@ void CSettings::SaveData() CVARS_SET("blur", bBlur); gameSettings->ResetBlurEnabled(); + // Save photos in documents folder + bool bPhotoSave = m_pCheckBoxPhotoSaving->GetSelected(); + CVARS_SET("photosaving", bPhotoSave); + CScreenShot::SetPhotoSavingInsideDocuments(bPhotoSave); + // Corona rain reflections bool bCoronaReflections = m_pCheckBoxCoronaReflections->GetSelected(); CVARS_SET("corona_reflections", bCoronaReflections); diff --git a/Client/core/CSettings.h b/Client/core/CSettings.h index bfeec87c44f..52770a8eb47 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -165,6 +165,7 @@ class CSettings CGUICheckBox* m_pCheckBoxHighDetailVehicles; CGUICheckBox* m_pCheckBoxHighDetailPeds; CGUICheckBox* m_pCheckBoxBlur; + CGUICheckBox* m_pCheckBoxPhotoSaving; CGUICheckBox* m_pCheckBoxCoronaReflections; CGUICheckBox* m_pCheckBoxDynamicPedShadows; CGUILabel* m_pFieldOfViewLabel; From 00244d35925338e1f053bcd2565159563f986e04 Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:25:12 +0200 Subject: [PATCH 6/7] remove hungarian notion and put setting in advance tab with more fitting description --- Client/core/CScreenShot.cpp | 19 ++++++++----------- Client/core/CScreenShot.h | 2 +- Client/core/CSettings.cpp | 22 ++++++++++++---------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/Client/core/CScreenShot.cpp b/Client/core/CScreenShot.cpp index 175997f81a0..59e387b1f66 100644 --- a/Client/core/CScreenShot.cpp +++ b/Client/core/CScreenShot.cpp @@ -36,7 +36,7 @@ static uint ms_uiWidth = 0; static uint ms_uiHeight = 0; // whether we want to actually save photo in documents folder -static bool ms_bSavePhotoInDocuments = false; +static bool savePhotoInDocuments = false; void CScreenShot::InitiateScreenShot(bool bIsCameraShot) { @@ -51,7 +51,7 @@ void CScreenShot::InitiateScreenShot(bool bIsCameraShot) if (bIsCameraShot) { - if (ms_bSavePhotoInDocuments) + if (savePhotoInDocuments) { // Set the screenshot path to camera gallery path ms_strScreenDirectoryPath = PathJoin(GetSystemPersonalPath(), "GTA San Andreas User Files", "Gallery"); @@ -88,14 +88,11 @@ void CScreenShot::CheckForScreenShot(bool bBeforeGUI) // Update last time of taken screenshot of given type ms_lLastSaveTime[ms_bIsCameraShot] = GetTickCount64_(); - if (ms_bIsCameraShot) + if (ms_bIsCameraShot && !savePhotoInDocuments) { - if (!ms_bSavePhotoInDocuments) - { - ClearBuffer(); - ms_bScreenShot = false; - return; - } + ClearBuffer(); + ms_bScreenShot = false; + return; } ms_strScreenShotPath = GetScreenshotPath(); @@ -222,7 +219,7 @@ void CScreenShot::ClearBuffer() ms_ScreenShotBuffer.Clear(); } -void CScreenShot::SetPhotoSavingInsideDocuments(bool bSavePhoto) +void CScreenShot::SetPhotoSavingInsideDocuments(bool savePhoto) noexcept { - ms_bSavePhotoInDocuments = bSavePhoto ? 1 : 0; + savePhotoInDocuments = savePhoto; } diff --git a/Client/core/CScreenShot.h b/Client/core/CScreenShot.h index 3504ae8e241..e83545385a4 100644 --- a/Client/core/CScreenShot.h +++ b/Client/core/CScreenShot.h @@ -19,7 +19,7 @@ class CScreenShot public: static void InitiateScreenShot(bool bIsCameraShot); static void CheckForScreenShot(bool bBeforeGUI); - static void SetPhotoSavingInsideDocuments(bool bSavePhoto); + static void SetPhotoSavingInsideDocuments(bool bSavePhoto) noexcept; protected: static void StartSaveThread(); diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index abb2ebef89b..82ca7a9a2ec 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -882,10 +882,6 @@ void CSettings::CreateGUI() m_pCheckBoxCoronaReflections->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 130.0f)); m_pCheckBoxCoronaReflections->AutoSize(NULL, 20.0f); - m_pCheckBoxPhotoSaving = reinterpret_cast(pManager->CreateCheckBox(pTabVideo, _("Save photos inside documents folder"), true)); - m_pCheckBoxPhotoSaving->SetPosition(CVector2D(vecTemp.fX + 245.0f, fPosY + 150.0f)); - m_pCheckBoxPhotoSaving->AutoSize(NULL, 20.0f); - vecTemp.fY += 10; m_pTabs->GetSize(vecTemp); @@ -1187,6 +1183,12 @@ void CSettings::CreateGUI() m_pCachePathValue->AutoSize(); vecTemp.fY += fLineHeight; + // Enable camera photos getting saved to documents folder + m_pCheckBoxPhotoSaving = reinterpret_cast(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true)); + m_pCheckBoxPhotoSaving->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY)); + m_pCheckBoxPhotoSaving->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)); @@ -1598,9 +1600,9 @@ void CSettings::UpdateVideoTab() m_pCheckBoxBlur->SetSelected(bBlur); // Save photos in documents folder - bool bPhotoSave; - CVARS_GET("photosaving", bPhotoSave); - m_pCheckBoxPhotoSaving->SetSelected(bPhotoSave); + bool photoSaving; + CVARS_GET("photosaving", photoSaving); + m_pCheckBoxPhotoSaving->SetSelected(photoSaving); // Corona rain reflections bool bCoronaReflections; @@ -3531,9 +3533,9 @@ void CSettings::SaveData() gameSettings->ResetBlurEnabled(); // Save photos in documents folder - bool bPhotoSave = m_pCheckBoxPhotoSaving->GetSelected(); - CVARS_SET("photosaving", bPhotoSave); - CScreenShot::SetPhotoSavingInsideDocuments(bPhotoSave); + bool photoSaving = m_pCheckBoxPhotoSaving->GetSelected(); + CVARS_SET("photosaving", photoSaving); + CScreenShot::SetPhotoSavingInsideDocuments(photoSaving); // Corona rain reflections bool bCoronaReflections = m_pCheckBoxCoronaReflections->GetSelected(); From 89e60044881de56e5afbb3916255a5768499f3ce Mon Sep 17 00:00:00 2001 From: -ffs-PLASMA <33094646+ffsPLASMA@users.noreply.github.com> Date: Sun, 25 Aug 2024 10:26:13 +0200 Subject: [PATCH 7/7] update vars to locations --- Client/core/CSettings.cpp | 26 ++++++++++++-------------- Client/core/CSettings.h | 2 +- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Client/core/CSettings.cpp b/Client/core/CSettings.cpp index 82ca7a9a2ec..14080ce393e 100644 --- a/Client/core/CSettings.cpp +++ b/Client/core/CSettings.cpp @@ -1184,9 +1184,9 @@ void CSettings::CreateGUI() vecTemp.fY += fLineHeight; // Enable camera photos getting saved to documents folder - m_pCheckBoxPhotoSaving = reinterpret_cast(pManager->CreateCheckBox(pTabAdvanced, _("Save photos taken by camera weapon to GTA San Andreas User Files folder"), true)); - m_pCheckBoxPhotoSaving->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY)); - m_pCheckBoxPhotoSaving->AutoSize(NULL, 20.0f); + 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 @@ -1599,11 +1599,6 @@ void CSettings::UpdateVideoTab() CVARS_GET("blur", bBlur); m_pCheckBoxBlur->SetSelected(bBlur); - // Save photos in documents folder - bool photoSaving; - CVARS_GET("photosaving", photoSaving); - m_pCheckBoxPhotoSaving->SetSelected(photoSaving); - // Corona rain reflections bool bCoronaReflections; CVARS_GET("corona_reflections", bCoronaReflections); @@ -1842,7 +1837,6 @@ bool CSettings::OnVideoDefaultClick(CGUIElement* pElement) CVARS_SET("high_detail_vehicles", false); CVARS_SET("high_detail_peds", false); CVARS_SET("blur", true); - CVARS_SET("photosaving", true); CVARS_SET("corona_reflections", false); CVARS_SET("dynamic_ped_shadows", false); gameSettings->UpdateFieldOfViewFromSettings(); @@ -3205,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) @@ -3532,11 +3530,6 @@ void CSettings::SaveData() CVARS_SET("blur", bBlur); gameSettings->ResetBlurEnabled(); - // Save photos in documents folder - bool photoSaving = m_pCheckBoxPhotoSaving->GetSelected(); - CVARS_SET("photosaving", photoSaving); - CScreenShot::SetPhotoSavingInsideDocuments(photoSaving); - // Corona rain reflections bool bCoronaReflections = m_pCheckBoxCoronaReflections->GetSelected(); CVARS_SET("corona_reflections", bCoronaReflections); @@ -3599,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 52770a8eb47..6e6bde42d9f 100644 --- a/Client/core/CSettings.h +++ b/Client/core/CSettings.h @@ -165,7 +165,6 @@ class CSettings CGUICheckBox* m_pCheckBoxHighDetailVehicles; CGUICheckBox* m_pCheckBoxHighDetailPeds; CGUICheckBox* m_pCheckBoxBlur; - CGUICheckBox* m_pCheckBoxPhotoSaving; CGUICheckBox* m_pCheckBoxCoronaReflections; CGUICheckBox* m_pCheckBoxDynamicPedShadows; CGUILabel* m_pFieldOfViewLabel; @@ -214,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;