MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / CanPause

Function CanPause

pcsx2/Hotkeys.cpp:120–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120static bool CanPause()
121{
122 static constexpr const float PAUSE_INTERVAL = 3.0f;
123 static Common::Timer::Value s_last_pause_time = 0;
124
125 if (!Achievements::IsHardcoreModeActive() || VMManager::GetState() == VMState::Paused)
126 return true;
127
128 const Common::Timer::Value time = Common::Timer::GetCurrentValue();
129 const float delta = static_cast<float>(Common::Timer::ConvertValueToSeconds(time - s_last_pause_time));
130 if (delta < PAUSE_INTERVAL)
131 {
132 Host::AddIconOSDMessage("PauseCooldown", ICON_FA_CLOCK,
133 TRANSLATE_PLURAL_STR("Hotkeys", "You cannot pause until another %n second(s) have passed.",
134 "", static_cast<int>(std::ceil(PAUSE_INTERVAL - delta))),
135 Host::OSD_QUICK_DURATION);
136 return false;
137 }
138
139 Host::RemoveKeyedOSDMessage("PauseCooldown");
140 s_last_pause_time = time;
141
142 return true;
143}
144
145static bool UseSavestateSelector()
146{

Callers 1

Hotkeys.cppFile · 0.85

Calls 1

ceilFunction · 0.50

Tested by

no test coverage detected