Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/Exports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ static void HandleLoginResponse(int nResult, const char* sErrorMessage, rc_clien
if (bHardcore)
vmMessage->SetDescription(ra::util::String::Printf(L"%u points", pUser->score));
else
vmMessage->SetDescription(ra::util::String::Printf(L"%u points (softcore)", pUser->score_softcore));
vmMessage->SetDescription(ra::util::String::Printf(L"%u points (casual mode)", pUser->score_casual));

vmMessage->SetDetail((pUser->num_unread_messages == 1)
? L"You have 1 new message"
Expand Down
6 changes: 3 additions & 3 deletions src/data/context/GameContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void GameContext::FinishLoadGame(int nResult, const char* sErrorMessage, bool bW
EndLoadGame(nResult, bWasPaused, true);
}

void GameContext::EndLoadGame(int nResult, bool bWasPaused, bool bShowSoftcoreWarning)
void GameContext::EndLoadGame(int nResult, bool bWasPaused, bool bShowCasualWarning)
{
{
ra::data::models::RichPresenceModel* pRichPresence = nullptr;
Expand Down Expand Up @@ -374,13 +374,13 @@ void GameContext::EndLoadGame(int nResult, bool bWasPaused, bool bShowSoftcoreWa
if (vmWarning.ShowModal() == ra::ui::DialogResult::Yes)
ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().EnableHardcoreMode(false);
}
else if (bShowSoftcoreWarning)
else if (bShowCasualWarning)
{
const bool bLeaderboardsEnabled = pConfiguration.IsFeatureEnabled(ra::services::Feature::Leaderboards);

ra::services::ServiceLocator::Get<ra::services::IAudioSystem>().PlayAudioFile(L"Overlay\\info.wav");
ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::OverlayManager>().QueueMessage(
L"Playing in Softcore Mode",
L"Playing in Casual Mode",
bLeaderboardsEnabled ? L"Leaderboard entries will not be submitted." : L"");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/data/context/GameContext.hh
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private:

friend class ra::services::AchievementRuntimeExports;
bool BeginLoadGame(unsigned int nGameId, Mode nMode, bool& bWasPaused);
void EndLoadGame(int nResult, bool bWasPaused, bool bShowSoftcoreWarning);
void EndLoadGame(int nResult, bool bWasPaused, bool bShowCasualWarning);

protected:
void OnBeforeActiveGameChanged();
Expand Down
2 changes: 1 addition & 1 deletion src/devkit/context/impl/RcClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ RcClient::RcClient() noexcept
if (ra::services::ServiceLocator::Exists<ra::services::ILogger>())
rc_client_enable_logging(m_pClient.get(), RC_CLIENT_LOG_LEVEL_VERBOSE, RcClient::LogMessage);

m_pClient->state.allow_leaderboards_in_softcore = true;
m_pClient->state.allow_leaderboards_in_casual = true;

rc_client_set_unpromoted_enabled(m_pClient.get(), 1);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/viewmodels/OverlayViewModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ void OverlayViewModel::CreateRenderImage()
const auto bHardcore = pConfiguration.IsFeatureEnabled(ra::services::Feature::Hardcore);
const auto* pClient = ra::services::ServiceLocator::Get<ra::context::IRcClient>().GetClient();
const auto* pUser = rc_client_get_user_info(pClient);
const auto sPoints = ra::util::String::Printf(L"%u Points", !pUser ? 0 : bHardcore ? pUser->score : pUser->score_softcore);
const auto sPoints = ra::util::String::Printf(L"%u Points", !pUser ? 0 : bHardcore ? pUser->score : pUser->score_casual);
const auto szPoints = m_pSurface->MeasureText(nSubFont, sPoints);

const auto sHardcore = bHardcore ? std::wstring(L"HARDCORE") : std::wstring(L"SOFTCORE");
const auto sHardcore = bHardcore ? std::wstring(L"HARDCORE") : std::wstring(L"CASUAL MODE");
const auto szHardcore = m_pSurface->MeasureText(nDetailFont, sHardcore);

constexpr auto nImageSize = 64;
Expand Down
4 changes: 2 additions & 2 deletions tests/Exports_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ TEST_CLASS(Exports_Tests)
Assert::IsTrue(bWasMenuRebuilt);
}

TEST_METHOD(TestAttemptLoginSuccessWithPreviousSessionDataSoftcore)
TEST_METHOD(TestAttemptLoginSuccessWithPreviousSessionDataCasual)
{
AttemptLoginHarness harness;

Expand All @@ -322,7 +322,7 @@ TEST_CLASS(Exports_Tests)
Assert::IsNotNull(pPopup);
Ensures(pPopup != nullptr);
Assert::AreEqual(std::wstring(L"Welcome back User"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L"123 points (softcore)"), pPopup->GetDescription());
Assert::AreEqual(std::wstring(L"123 points (casual mode)"), pPopup->GetDescription());
Assert::AreEqual(std::wstring(L"You have 0 new messages"), pPopup->GetDetail());
Assert::AreEqual(ra::ui::ImageType::UserPic, pPopup->GetImage().Type());
Assert::AreEqual(std::string("User"), pPopup->GetImage().Name());
Expand Down
8 changes: 4 additions & 4 deletions tests/data/context/EmulatorContext_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ TEST_CLASS(EmulatorContext_Tests)
Assert::IsTrue(emulator.ValidateClientVersion());
Assert::IsTrue(emulator.mockDesktop.WasDialogShown());
Assert::AreEqual(std::string(), emulator.mockDesktop.LastOpenedUrl());
// successful downgrade to softcore
// successful downgrade to casual
Assert::IsFalse(emulator.mockConfiguration.IsFeatureEnabled(ra::services::Feature::Hardcore));
Assert::IsTrue(emulator.mockLoginService.IsLoggedIn());

Expand Down Expand Up @@ -660,7 +660,7 @@ TEST_CLASS(EmulatorContext_Tests)
emulator.mockAchievementRuntime.MockLeaderboardWithLboard(32U);
emulator.mockAchievementRuntime.MockAchievementWithTrigger(44U);
auto* pAchievement45 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(45U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_CASUAL);
auto* pAchievement46 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(46U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement46, RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH);
emulator.mockGameContext.InitializeFromAchievementRuntime();
Expand Down Expand Up @@ -746,7 +746,7 @@ TEST_CLASS(EmulatorContext_Tests)
emulator.mockAchievementRuntime.MockLeaderboardWithLboard(32U);
emulator.mockAchievementRuntime.MockAchievementWithTrigger(44U);
auto* pAchievement45 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(45U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_CASUAL);
auto* pAchievement46 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(46U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement46, RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH);
emulator.mockGameContext.InitializeFromAchievementRuntime();
Expand Down Expand Up @@ -918,7 +918,7 @@ TEST_CLASS(EmulatorContext_Tests)
emulator.mockAchievementRuntime.MockLeaderboardWithLboard(32U);
emulator.mockAchievementRuntime.MockAchievementWithTrigger(44U);
auto* pAchievement45 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(45U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement45, RC_CLIENT_ACHIEVEMENT_UNLOCKED_CASUAL);
auto* pAchievement46 = emulator.mockAchievementRuntime.MockAchievementWithTrigger(46U);
emulator.mockAchievementRuntime.UnlockAchievement(pAchievement46, RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH);
emulator.mockGameContext.InitializeFromAchievementRuntime();
Expand Down
12 changes: 6 additions & 6 deletions tests/data/context/GameContext_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1431,13 +1431,13 @@ TEST_CLASS(GameContext_Tests)
game.mockConfiguration.SetFeatureEnabled(ra::services::Feature::Leaderboards, true);
game.LoadGame(1U, "0123456789abcdeffedcba987654321");

// should get popup message indicating leaderboards not supported in softcore
// should get popup message indicating leaderboards not supported in casual mode
game.mockFrameEventQueue.DoFrame(); // hardcore warning gets queued for the UI thread
Assert::IsFalse(game.mockDesktop.WasDialogShown());

const auto* pPopup = game.mockOverlayManager.GetMessage(2U);
Expects(pPopup != nullptr);
Assert::AreEqual(std::wstring(L"Playing in Softcore Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L"Playing in Casual Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L"Leaderboard entries will not be submitted."), pPopup->GetDescription());
}

Expand All @@ -1458,13 +1458,13 @@ TEST_CLASS(GameContext_Tests)
game.mockConfiguration.SetFeatureEnabled(ra::services::Feature::Leaderboards, false);
game.LoadGame(1U, "0123456789abcdeffedcba987654321");

// should get popup message indicating playing in softcore
// should get popup message indicating playing in casual mode
game.mockFrameEventQueue.DoFrame(); // hardcore warning gets queued for the UI thread
Assert::IsFalse(game.mockDesktop.WasDialogShown());

const auto* pPopup = game.mockOverlayManager.GetMessage(2U);
Expects(pPopup != nullptr);
Assert::AreEqual(std::wstring(L"Playing in Softcore Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L"Playing in Casual Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L""), pPopup->GetDescription());
}

Expand Down Expand Up @@ -1552,13 +1552,13 @@ TEST_CLASS(GameContext_Tests)

game.LoadGame(1U, "0123456789abcdeffedcba987654321");

// should only get softcore popup
// should only get casual mode popup
game.mockFrameEventQueue.DoFrame(); // hardcore warning gets queued for the UI thread
Assert::IsFalse(game.mockDesktop.WasDialogShown());

const auto* pPopup = game.mockOverlayManager.GetMessage(2U);
Expects(pPopup != nullptr);
Assert::AreEqual(std::wstring(L"Playing in Softcore Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L"Playing in Casual Mode"), pPopup->GetTitle());
Assert::AreEqual(std::wstring(L""), pPopup->GetDescription());

// hardcore should remain disabled
Expand Down
6 changes: 3 additions & 3 deletions tests/mocks/MockAchievementRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ void MockAchievementRuntime::UnlockAchievement(rc_client_achievement_info_t* pAc
{
pAchievement->public_.unlocked |= nMode;

if (pAchievement->unlock_time_softcore == 0)
pAchievement->unlock_time_softcore = time(nullptr);
if (pAchievement->unlock_time_casual == 0)
pAchievement->unlock_time_casual = time(nullptr);

if (nMode == RC_CLIENT_ACHIEVEMENT_UNLOCKED_BOTH)
{
Expand All @@ -203,7 +203,7 @@ void MockAchievementRuntime::UnlockAchievement(rc_client_achievement_info_t* pAc
if (pAchievement->trigger)
pAchievement->trigger->state = RC_TRIGGER_STATE_TRIGGERED;
}
else if (nMode == RC_CLIENT_ACHIEVEMENT_UNLOCKED_SOFTCORE &&
else if (nMode == RC_CLIENT_ACHIEVEMENT_UNLOCKED_CASUAL &&
!rc_client_get_hardcore_enabled(GetClient()))
{
pAchievement->public_.state = RC_CLIENT_ACHIEVEMENT_STATE_UNLOCKED;
Expand Down
8 changes: 4 additions & 4 deletions tests/services/AchievementRuntime_Tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ TEST_CLASS(AchievementRuntime_Tests)
Assert::IsTrue(runtime.mockAudioSystem.WasAudioFilePlayed(L"Overlay\\acherror.wav"));
}

TEST_METHOD(TestHandleAchievementTriggeredEventMemoryInsecureSoftcore)
TEST_METHOD(TestHandleAchievementTriggeredEventMemoryInsecureCasual)
{
AchievementRuntimeHarness runtime;
auto* pAch6 = runtime.MockAchievement(6U, "0xH0000=1");
Expand Down Expand Up @@ -2351,7 +2351,7 @@ TEST_CLASS(AchievementRuntime_Tests)
Assert::IsTrue(runtime.mockAudioSystem.WasAudioFilePlayed(L"Overlay\\unlock.wav"));
}

TEST_METHOD(TestHandleGameCompletedEventSoftcore)
TEST_METHOD(TestHandleGameCompletedEventCasual)
{
AchievementRuntimeHarness runtime;
runtime.mockConfiguration.SetFeatureEnabled(ra::services::Feature::Hardcore, false);
Expand Down Expand Up @@ -2420,7 +2420,7 @@ TEST_CLASS(AchievementRuntime_Tests)
Assert::IsTrue(runtime.mockAudioSystem.WasAudioFilePlayed(L"Overlay\\unlock.wav"));
}

TEST_METHOD(TestHandleSubsetCompletedEventSoftcore)
TEST_METHOD(TestHandleSubsetCompletedEventCasual)
{
AchievementRuntimeHarness runtime;
runtime.mockConfiguration.SetFeatureEnabled(ra::services::Feature::Hardcore, false);
Expand Down Expand Up @@ -2781,7 +2781,7 @@ TEST_CLASS(AchievementRuntime_Tests)
AssertSimpleScoreboard(runtime, 4U);
}

TEST_METHOD(TestHandleLeaderboardSubmittedEventSoftcore)
TEST_METHOD(TestHandleLeaderboardSubmittedEventCasual)
{
AchievementRuntimeHarness runtime;
runtime.mockConfiguration.SetFeatureEnabled(ra::services::Feature::Hardcore, false);
Expand Down
Loading