Repository: RetroAchievements/RAIntegration
Pull request #975 (2023-02-04 23:01:45)

change wording on modified achievement unlock popup
implements #968 

Local achievements just say "Local Achievement Unlocked" or "Modified Local Achievement Unlocked".
![image](https://user-images.githubusercontent.com/32680403/216793114-6155d280-d17e-4ee3-a7b2-06672c38f651.png)

Modified published achievements say "Modified Achievement Unlocked LOCALLY".
![image](https://user-images.githubusercontent.com/32680403/216792270-cfd7a9dc-f841-4f42-8cbb-94fd16c6e77b.png)



Patch:
diff --git a/src/data/context/GameContext.cpp b/src/data/context/GameContext.cpp
index 7bee3813..77e81a95 100644
--- a/src/data/context/GameContext.cpp
+++ b/src/data/context/GameContext.cpp
@@ -516,7 +516,8 @@ void GameContext::AwardAchievement(ra::AchievementID nAchievementId)
     {
         auto sHeader = vmPopup->GetTitle();
         sHeader.insert(0, L"Modified ");
-        sHeader.insert(sHeader.length() - 8, L"NOT ");
+        if (pAchievement->GetCategory() != ra::data::models::AssetCategory::Local)
+            sHeader.append(L" LOCALLY");
         vmPopup->SetTitle(sHeader);
 
         RA_LOG_INFO("Achievement %u not unlocked - %s", pAchievement->GetID(), pAchievement->IsModified() ? "modified" : "unpublished");
@@ -528,7 +529,7 @@ void GameContext::AwardAchievement(ra::AchievementID nAchievementId)
     const auto& pEmulatorContext = ra::services::ServiceLocator::Get<ra::data::context::EmulatorContext>();
     if (bSubmit && pEmulatorContext.WasMemoryModified())
     {
-        vmPopup->SetTitle(L"Achievement NOT Unlocked");
+        vmPopup->SetTitle(L"Achievement Unlocked LOCALLY");
         vmPopup->SetErrorDetail(L"Error: RAM tampered with");
 
         RA_LOG_INFO("Achievement %u not unlocked - %s", pAchievement->GetID(), "RAM tampered with");
@@ -538,7 +539,7 @@ void GameContext::AwardAchievement(ra::AchievementID nAchievementId)
 
     if (bSubmit && _RA_HardcoreModeIsActive() && pEmulatorContext.IsMemoryInsecure())
     {
-        vmPopup->SetTitle(L"Achievement NOT Unlocked");
+        vmPopup->SetTitle(L"Achievement Unlocked LOCALLY");
         vmPopup->SetErrorDetail(L"Error: RAM insecure");
 
         RA_LOG_INFO("Achievement %u not unlocked - %s", pAchievement->GetID(), "RAM insecure");
@@ -601,7 +602,7 @@ void GameContext::AwardAchievement(ra::AchievementID nAchievementId)
             auto pPopup = pOverlayManager.GetMessage(nPopupId);
             if (pPopup != nullptr)
             {
-                pPopup->SetTitle(L"Achievement NOT Unlocked");
+                pPopup->SetTitle(L"Achievement Unlock FAILED");
                 pPopup->SetErrorDetail(response.ErrorMessage.empty() ?
                     L"Error submitting unlock" : ra::Widen(response.ErrorMessage));
                 pPopup->RebuildRenderImage();
@@ -609,7 +610,7 @@ void GameContext::AwardAchievement(ra::AchievementID nAchievementId)
             else
             {
                 std::unique_ptr<ra::ui::viewmodels::PopupMessageViewModel> vmPopup(new ra::ui::viewmodels::PopupMessageViewModel);
-                vmPopup->SetTitle(L"Achievement NOT Unlocked");
+                vmPopup->SetTitle(L"Achievement Unlock FAILED");
                 vmPopup->SetErrorDetail(response.ErrorMessage.empty() ?
                     L"Error submitting unlock" : ra::Widen(response.ErrorMessage));
                 vmPopup->SetPopupType(ra::ui::viewmodels::Popup::AchievementTriggered);


Test patch:
diff --git a/tests/data/context/GameContext_Tests.cpp b/tests/data/context/GameContext_Tests.cpp
index a417b7d9..cd8fa36e 100644
--- a/tests/data/context/GameContext_Tests.cpp
+++ b/tests/data/context/GameContext_Tests.cpp
@@ -1636,7 +1636,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Modified Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Modified Achievement Unlocked LOCALLY"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (99)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"AchievementDescription"), pPopup->GetDetail());
         Assert::AreEqual(std::string("12345"), pPopup->GetImage().Name());
@@ -1661,7 +1661,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Modified Local Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Modified Local Achievement Unlocked"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (99)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"AchievementDescription"), pPopup->GetDetail());
         Assert::AreEqual(std::string("12345"), pPopup->GetImage().Name());
@@ -1686,7 +1686,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Modified Unofficial Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Modified Unofficial Achievement Unlocked LOCALLY"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (99)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"AchievementDescription"), pPopup->GetDetail());
         Assert::AreEqual(std::string("12345"), pPopup->GetImage().Name());
@@ -1712,7 +1712,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Modified Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Modified Achievement Unlocked LOCALLY"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (99)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"AchievementDescription"), pPopup->GetDetail());
         Assert::AreEqual(std::string("12345"), pPopup->GetImage().Name());
@@ -1735,7 +1735,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Achievement Unlocked LOCALLY"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (5)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"Error: RAM tampered with"), pPopup->GetDetail());
         Assert::IsTrue(pPopup->IsDetailError());
@@ -1760,7 +1760,7 @@ public:
         const auto* pPopup = game.mockOverlayManager.GetMessage(1);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Achievement Unlocked LOCALLY"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (5)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"Error: RAM insecure"), pPopup->GetDetail());
         Assert::IsTrue(pPopup->IsDetailError());
@@ -1919,7 +1919,7 @@ public:
         game.mockThreadPool.ExecuteNextTask();
 
         // error message should be reported
-        Assert::AreEqual(std::wstring(L"Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Achievement Unlock FAILED"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (5)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"Achievement data cannot be found for 1"), pPopup->GetDetail());
         Assert::IsTrue(pPopup->IsDetailError());
@@ -1959,7 +1959,7 @@ public:
         pPopup = game.mockOverlayManager.GetMessage(2);
         Expects(pPopup != nullptr);
         Assert::IsNotNull(pPopup);
-        Assert::AreEqual(std::wstring(L"Achievement NOT Unlocked"), pPopup->GetTitle());
+        Assert::AreEqual(std::wstring(L"Achievement Unlock FAILED"), pPopup->GetTitle());
         Assert::AreEqual(std::wstring(L"AchievementTitle (5)"), pPopup->GetDescription());
         Assert::AreEqual(std::wstring(L"Achievement data cannot be found for 1"), pPopup->GetDetail());
         Assert::AreEqual(std::string("12345"), pPopup->GetImage().Name());