Host: Make OSD message timing consistent

It was all over the place previously.
This commit is contained in:
Connor McLaughlin 2022-11-23 00:49:45 +10:00 committed by refractionpcsx2
parent 5026dda9ca
commit bd22d29d58
15 changed files with 75 additions and 54 deletions

View File

@ -2225,11 +2225,11 @@ void MainWindow::setDisplayFullscreen(const std::string& fullscreen_mode)
{
if (g_host_display->SetFullscreen(true, width, height, refresh_rate))
{
Host::AddOSDMessage("Acquired exclusive fullscreen.", 10.0f);
Host::AddOSDMessage("Acquired exclusive fullscreen.", Host::OSD_INFO_DURATION);
}
else
{
Host::AddOSDMessage("Failed to acquire exclusive fullscreen.", 10.0f);
Host::AddOSDMessage("Failed to acquire exclusive fullscreen.", Host::OSD_WARNING_DURATION);
}
}
}

View File

@ -413,7 +413,7 @@ bool DoCDVDopen()
CDVD->getTD(0, &td);
#ifdef PCSX2_CORE
Host::AddKeyedOSDMessage("BlockDumpCreate", fmt::format("Saving CDVD block dump to '{}'.", temp), 10.0f);
Host::AddKeyedOSDMessage("BlockDumpCreate", fmt::format("Saving CDVD block dump to '{}'.", temp), Host::OSD_INFO_DURATION);
#endif
blockDumpFile.Create(std::move(temp), 2);

View File

@ -1468,7 +1468,7 @@ void Achievements::GameChanged(u32 crc)
if (crc != 0)
{
Host::AddKeyedOSDMessage(
"retroachievements_disc_read_failed", "Failed to read executable from disc. Achievements disabled.", 10.0f);
"retroachievements_disc_read_failed", "Failed to read executable from disc. Achievements disabled.", Host::OSD_CRITICAL_ERROR_DURATION);
}
s_last_game_crc = 0;

View File

@ -48,7 +48,7 @@ static void HotkeyAdjustTargetSpeed(double delta)
gsUpdateFrequency(EmuConfig);
GetMTGS().UpdateVSyncMode();
Host::AddIconOSDMessage("SpeedChanged", ICON_FA_CLOCK,
fmt::format("Target speed set to {:.0f}%.", std::round(EmuConfig.Framerate.NominalScalar * 100.0)), 5.0f);
fmt::format("Target speed set to {:.0f}%.", std::round(EmuConfig.Framerate.NominalScalar * 100.0)), Host::OSD_QUICK_DURATION);
}
static constexpr s32 CYCLE_SAVE_STATE_SLOTS = 10;
@ -80,13 +80,13 @@ static void HotkeyCycleSaveSlot(s32 delta)
if (len > 0 && date_buf[len - 1] == '\n')
date_buf[len - 1] = 0;
Host::AddIconOSDMessage(
"CycleSaveSlot", ICON_FA_SEARCH, fmt::format("Save slot {} selected (last save: {}).", s_current_save_slot, date_buf), 5.0f);
Host::AddIconOSDMessage("CycleSaveSlot", ICON_FA_SEARCH,
fmt::format("Save slot {} selected (last save: {}).", s_current_save_slot, date_buf), Host::OSD_QUICK_DURATION);
}
else
{
Host::AddIconOSDMessage(
"CycleSaveSlot", ICON_FA_SEARCH, fmt::format("Save slot {} selected (no save yet).", s_current_save_slot), 5.0f);
Host::AddIconOSDMessage("CycleSaveSlot", ICON_FA_SEARCH, fmt::format("Save slot {} selected (no save yet).", s_current_save_slot),
Host::OSD_QUICK_DURATION);
}
}
@ -95,15 +95,16 @@ static void HotkeyLoadStateSlot(s32 slot)
const u32 crc = VMManager::GetGameCRC();
if (crc == 0)
{
Host::AddIconOSDMessage(
"LoadStateFromSlot", ICON_FA_EXCLAMATION_TRIANGLE, "Cannot load state from a slot without a game running.", 10.0f);
Host::AddIconOSDMessage("LoadStateFromSlot", ICON_FA_EXCLAMATION_TRIANGLE, "Cannot load state from a slot without a game running.",
Host::OSD_INFO_DURATION);
return;
}
const std::string serial(VMManager::GetGameSerial());
if (!VMManager::HasSaveStateInSlot(serial.c_str(), crc, slot))
{
Host::AddIconOSDMessage("LoadStateFromSlot", ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("No save state found in slot {}.", slot));
Host::AddIconOSDMessage("LoadStateFromSlot", ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("No save state found in slot {}.", slot),
Host::OSD_INFO_DURATION);
return;
}
@ -114,8 +115,8 @@ static void HotkeySaveStateSlot(s32 slot)
{
if (VMManager::GetGameCRC() == 0)
{
Host::AddIconOSDMessage(
"SaveStateToSlot", ICON_FA_EXCLAMATION_TRIANGLE, "Cannot save state to a slot without a game running.", 10.0f);
Host::AddIconOSDMessage("SaveStateToSlot", ICON_FA_EXCLAMATION_TRIANGLE, "Cannot save state to a slot without a game running.",
Host::OSD_INFO_DURATION);
return;
}

View File

@ -338,7 +338,7 @@ bool GSreopen(bool recreate_display, const Pcsx2Config::GSOptions& old_config)
Host::AddKeyedOSDMessage("GSReopenFailed", fmt::format("Failed to open {} display, switching back to {}.",
HostDisplay::RenderAPIToString(GetAPIForRenderer(GSConfig.Renderer)),
HostDisplay::RenderAPIToString(GetAPIForRenderer(old_config.Renderer)), 10.0f));
HostDisplay::RenderAPIToString(GetAPIForRenderer(old_config.Renderer)), Host::OSD_CRITICAL_ERROR_DURATION));
GSConfig = old_config;
}
}
@ -358,7 +358,7 @@ bool GSreopen(bool recreate_display, const Pcsx2Config::GSOptions& old_config)
}
}
Host::AddKeyedOSDMessage("GSReopenFailed","Failed to reopen, restoring old configuration.", 10.0f);
Host::AddKeyedOSDMessage("GSReopenFailed","Failed to reopen, restoring old configuration.", Host::OSD_CRITICAL_ERROR_DURATION);
GSConfig = old_config;
if (!DoGSOpen(GSConfig.Renderer, basemem))
{
@ -1679,7 +1679,7 @@ void GSApp::SetConfig(const char* entry, int value)
static void HotkeyAdjustUpscaleMultiplier(s32 delta)
{
const u32 new_multiplier = static_cast<u32>(std::clamp(static_cast<s32>(EmuConfig.GS.UpscaleMultiplier) + delta, 1, 8));
Host::AddKeyedFormattedOSDMessage("UpscaleMultiplierChanged", 10.0f, "Upscale multiplier set to %ux.", new_multiplier);
Host::AddKeyedFormattedOSDMessage("UpscaleMultiplierChanged", Host::OSD_QUICK_DURATION, "Upscale multiplier set to %ux.", new_multiplier);
EmuConfig.GS.UpscaleMultiplier = new_multiplier;
// this is pretty slow. we only really need to flush the TC and recompile shaders.
@ -1690,7 +1690,7 @@ static void HotkeyAdjustUpscaleMultiplier(s32 delta)
static void HotkeyAdjustZoom(double delta)
{
const double new_zoom = std::clamp(EmuConfig.GS.Zoom + delta, 1.0, 200.0);
Host::AddKeyedFormattedOSDMessage("ZoomChanged", 10.0f, "Zoom set to %.1f%%.", new_zoom);
Host::AddKeyedFormattedOSDMessage("ZoomChanged", Host::OSD_QUICK_DURATION, "Zoom set to %.1f%%.", new_zoom);
EmuConfig.GS.Zoom = new_zoom;
// no need to go through the full settings update for this
@ -1740,7 +1740,7 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
// technically this races, but the worst that'll happen is one frame uses the old AR.
EmuConfig.CurrentAspectRatio = static_cast<AspectRatioType>((static_cast<int>(EmuConfig.CurrentAspectRatio) + 1) % static_cast<int>(AspectRatioType::MaxCount));
Host::AddKeyedFormattedOSDMessage("CycleAspectRatio", 10.0f, "Aspect ratio set to '%s'.", Pcsx2Config::GSOptions::AspectRatioNames[static_cast<int>(EmuConfig.CurrentAspectRatio)]);
Host::AddKeyedFormattedOSDMessage("CycleAspectRatio", Host::OSD_QUICK_DURATION, "Aspect ratio set to '%s'.", Pcsx2Config::GSOptions::AspectRatioNames[static_cast<int>(EmuConfig.CurrentAspectRatio)]);
}},
{"CycleMipmapMode", "Graphics", "Cycle Hardware Mipmapping", [](s32 pressed) {
if (pressed)
@ -1750,7 +1750,7 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
static constexpr std::array<const char*, CYCLE_COUNT> option_names = {{"Automatic", "Off", "Basic (Generated)", "Full (PS2)"}};
const HWMipmapLevel new_level = static_cast<HWMipmapLevel>(((static_cast<s32>(EmuConfig.GS.HWMipmap) + 2) % CYCLE_COUNT) - 1);
Host::AddKeyedFormattedOSDMessage("CycleMipmapMode", 10.0f, "Hardware mipmapping set to '%s'.", option_names[static_cast<s32>(new_level) + 1]);
Host::AddKeyedFormattedOSDMessage("CycleMipmapMode", Host::OSD_QUICK_DURATION, "Hardware mipmapping set to '%s'.", option_names[static_cast<s32>(new_level) + 1]);
EmuConfig.GS.HWMipmap = new_level;
GetMTGS().RunOnGSThread([new_level]() {
@ -1777,7 +1777,7 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
}};
const GSInterlaceMode new_mode = static_cast<GSInterlaceMode>((static_cast<s32>(EmuConfig.GS.InterlaceMode) + 1) % static_cast<s32>(GSInterlaceMode::Count));
Host::AddKeyedFormattedOSDMessage("CycleInterlaceMode", 10.0f, "Deinterlace mode set to '%s'.", option_names[static_cast<s32>(new_mode)]);
Host::AddKeyedFormattedOSDMessage("CycleInterlaceMode", Host::OSD_QUICK_DURATION, "Deinterlace mode set to '%s'.", option_names[static_cast<s32>(new_mode)]);
EmuConfig.GS.InterlaceMode = new_mode;
GetMTGS().RunOnGSThread([new_mode]() { GSConfig.InterlaceMode = new_mode; });
@ -1794,7 +1794,9 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
if (!pressed)
{
EmuConfig.GS.DumpReplaceableTextures = !EmuConfig.GS.DumpReplaceableTextures;
Host::AddKeyedOSDMessage("ToggleTextureReplacements", EmuConfig.GS.DumpReplaceableTextures ? "Texture dumping is now enabled." : "Texture dumping is now disabled.", 10.0f);
Host::AddKeyedOSDMessage("ToggleTextureReplacements",
EmuConfig.GS.DumpReplaceableTextures ? "Texture dumping is now enabled." : "Texture dumping is now disabled.",
Host::OSD_INFO_DURATION);
GetMTGS().ApplySettings();
}
}},
@ -1802,7 +1804,9 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
if (!pressed)
{
EmuConfig.GS.LoadTextureReplacements = !EmuConfig.GS.LoadTextureReplacements;
Host::AddKeyedOSDMessage("ToggleTextureReplacements", EmuConfig.GS.LoadTextureReplacements ? "Texture replacements are now enabled." : "Texture replacements are now disabled.", 10.0f);
Host::AddKeyedOSDMessage("ToggleTextureReplacements",
EmuConfig.GS.LoadTextureReplacements ? "Texture replacements are now enabled." : "Texture replacements are now disabled.",
Host::OSD_INFO_DURATION);
GetMTGS().ApplySettings();
}
}},
@ -1811,11 +1815,11 @@ BEGIN_HOTKEY_LIST(g_gs_hotkeys)
{
if (!EmuConfig.GS.LoadTextureReplacements)
{
Host::AddKeyedOSDMessage("ReloadTextureReplacements", "Texture replacements are not enabled.", 10.0f);
Host::AddKeyedOSDMessage("ReloadTextureReplacements", "Texture replacements are not enabled.", Host::OSD_INFO_DURATION);
}
else
{
Host::AddKeyedOSDMessage("ReloadTextureReplacements", "Reloading texture replacements...", 10.0f);
Host::AddKeyedOSDMessage("ReloadTextureReplacements", "Reloading texture replacements...", Host::OSD_INFO_DURATION);
GetMTGS().RunOnGSThread([]() {
GSTextureReplacements::ReloadReplacementMap();
});

View File

@ -694,7 +694,7 @@ void GSRenderer::VSync(u32 field, bool registers_written)
Host::AddKeyedOSDMessage("GSDump", fmt::format("Saving {0} GS dump {1} to '{2}'",
(m_dump_frames == 1) ? "single frame" : "multi-frame", compression_str,
Path::GetFileName(m_dump->GetPath())), 10.0f);
Path::GetFileName(m_dump->GetPath())), Host::OSD_INFO_DURATION);
}
if (GSTexture* t = g_gs_device->GetCurrent())
@ -703,11 +703,11 @@ void GSRenderer::VSync(u32 field, bool registers_written)
if (t->Save(path))
{
Host::AddKeyedOSDMessage("GSScreenshot",
fmt::format("Screenshot saved to '{}'.", Path::GetFileName(path)), 10.0f);
fmt::format("Screenshot saved to '{}'.", Path::GetFileName(path)), Host::OSD_INFO_DURATION);
}
else
{
Host::AddFormattedOSDMessage(10.0f, "Failed to save screenshot to '%s'.", path.c_str());
Host::AddFormattedOSDMessage(Host::OSD_ERROR_DURATION, "Failed to save screenshot to '%s'.", path.c_str());
}
}
@ -718,7 +718,7 @@ void GSRenderer::VSync(u32 field, bool registers_written)
const bool last = (m_dump_frames == 0);
if (m_dump->VSync(field, last, m_regs))
{
Host::AddKeyedOSDMessage("GSDump", fmt::format("Saved GS dump to '{}'.", Path::GetFileName(m_dump->GetPath())), 10.0f);
Host::AddKeyedOSDMessage("GSDump", fmt::format("Saved GS dump to '{}'.", Path::GetFileName(m_dump->GetPath())), Host::OSD_INFO_DURATION);
m_dump.reset();
}
else if (!last)

View File

@ -214,7 +214,7 @@ void GSRendererHW::VSync(u32 field, bool registers_written)
if (m_tc->GetHashCacheMemoryUsage() > 1024 * 1024 * 1024)
{
Host::AddKeyedFormattedOSDMessage("HashCacheOverflow", 15.0f, "Hash cache has used %.2f MB of VRAM, disabling.",
Host::AddKeyedFormattedOSDMessage("HashCacheOverflow", Host::OSD_ERROR_DURATION, "Hash cache has used %.2f MB of VRAM, disabling.",
static_cast<float>(m_tc->GetHashCacheMemoryUsage()) / 1048576.0f);
m_tc->RemoveAll();
g_gs_device->PurgePool();

View File

@ -295,7 +295,8 @@ bool GSDeviceVK::CheckFeatures()
if (!m_features.texture_barrier && !m_features.stencil_buffer)
{
Host::AddKeyedOSDMessage("GSDeviceVK_NoTextureBarrierOrStencilBuffer",
"Stencil buffers and texture barriers are both unavailable, this will break some graphical effects.", 10.0f);
"Stencil buffers and texture barriers are both unavailable, this will break some graphical effects.",
Host::OSD_WARNING_DURATION);
}
return true;
@ -469,7 +470,8 @@ bool GSDeviceVK::DownloadTexture(GSTexture* src, const GSVector4i& rect, GSTextu
{
m_warned_slow_spin = true;
Host::AddKeyedOSDMessage("GSDeviceVK_NoCalibratedTimestamps",
"Spin GPU During Readbacks is enabled, but calibrated timestamps are unavailable. This might be really slow.", 10.0f);
"Spin GPU During Readbacks is enabled, but calibrated timestamps are unavailable. This might be really slow.",
Host::OSD_WARNING_DURATION);
}
}

View File

@ -677,7 +677,7 @@ u32 GameDatabaseSchema::GameEntry::applyGSHardwareFixes(Pcsx2Config::GSOptions&
Host::AddKeyedOSDMessage("HWFixesWarning",
fmt::format("Manual GS hardware renderer fixes are enabled, automatic fixes were not applied:\n{}",
disabled_fixes),
10.0f);
Host::OSD_ERROR_DURATION);
}
else
{

View File

@ -46,6 +46,13 @@ struct HostKeyEvent
namespace Host
{
/// Typical durations for OSD messages.
static constexpr float OSD_CRITICAL_ERROR_DURATION = 20.0f;
static constexpr float OSD_ERROR_DURATION = 15.0f;
static constexpr float OSD_WARNING_DURATION = 10.0f;
static constexpr float OSD_INFO_DURATION = 5.0f;
static constexpr float OSD_QUICK_DURATION = 2.5f;
/// Reads a file from the resources directory of the application.
/// This may be outside of the "normal" filesystem on platforms such as Mac.
std::optional<std::vector<u8>> ReadResourceFile(const char* filename);

View File

@ -28,6 +28,7 @@
#include "Host.h"
#include "HostDisplay.h"
#include "IconsFontAwesome5.h"
#ifndef PCSX2_CORE
#include "gui/Dialogs/ModalPopups.h"
@ -986,8 +987,8 @@ void SysMtgsThread::SwitchRenderer(GSRendererType renderer, bool display_message
if (display_message)
{
Host::AddKeyedFormattedOSDMessage("SwitchRenderer", 10.0f, "Switching to %s renderer...",
Pcsx2Config::GSOptions::GetRendererName(renderer));
Host::AddIconOSDMessage("SwitchRenderer", ICON_FA_MAGIC, fmt::format("Switching to {} renderer...",
Pcsx2Config::GSOptions::GetRendererName(renderer)), Host::OSD_INFO_DURATION);
}
RunOnGSThread([renderer]() {

View File

@ -537,7 +537,8 @@ s32 FileMemoryCard::Save(uint slot, const u8* src, u32 adr, int size)
if (elapsed > std::chrono::seconds(5))
{
Host::AddIconOSDMessage(fmt::format("MemoryCardSave{}", slot), ICON_FA_SD_CARD,
fmt::format("Memory card '{}' was saved to storage.", Path::GetFileName(m_filenames[slot])), 10.0f);
fmt::format("Memory card '{}' was saved to storage.", Path::GetFileName(m_filenames[slot])),
Host::OSD_INFO_DURATION);
last = std::chrono::system_clock::now();
}
return 1;

View File

@ -1728,7 +1728,7 @@ void FolderMemoryCard::SetTimeLastReadToNow()
void FolderMemoryCard::SetTimeLastWrittenToNow()
{
// CHANGE: this was local time milliseconds, which might be problematic...
m_timeLastWritten = std::time(nullptr);// wxGetLocalTimeMillis().GetValue();
m_timeLastWritten = std::time(nullptr); // wxGetLocalTimeMillis().GetValue();
m_framesUntilFlush = FramesAfterWriteUntilFlush;
}
@ -2080,7 +2080,7 @@ void FileAccessHelper::WriteIndex(const std::string& baseFolderName, MemoryCardF
}
else
{
Console.Warning(fmt::format("(FileAccesHelper::WriteIndex()) '{}' has null parent",Path::Combine(baseFolderName,(const char*)entry->entry.data.name)));
Console.Warning(fmt::format("(FileAccesHelper::WriteIndex()) '{}' has null parent", Path::Combine(baseFolderName, (const char*)entry->entry.data.name)));
}
char cleanName[sizeof(entry->entry.data.name)];
@ -2352,7 +2352,7 @@ s32 FolderMemoryCardAggregator::Save(uint slot, const u8* src, u32 adr, int size
{
const std::string_view filename = Path::GetFileName(m_cards[slot].GetFolderName());
Host::AddIconOSDMessage(fmt::format("MemoryCardSave{}", slot), ICON_FA_SD_CARD,
fmt::format("Memory card '{}' was saved to storage.", filename), 10.0f);
fmt::format("Memory card '{}' was saved to storage.", filename), Host::OSD_INFO_DURATION);
}
return saveResult;

View File

@ -27,6 +27,7 @@
#include "common/Timer.h"
#include "Recording/InputRecording.h"
#include "IconsFontAwesome5.h"
#define SIO0LOG_ENABLE 0
#define SIO2LOG_ENABLE 0
@ -954,7 +955,7 @@ void AutoEject::Clear(size_t port, size_t slot)
void AutoEject::SetAll()
{
Host::AddKeyedFormattedOSDMessage("AutoEjectAllSet", 10.0f, "Force ejecting all memory cards");
Host::AddIconOSDMessage("AutoEjectAllSet", ICON_FA_SD_CARD, "Force ejecting all memory cards.", Host::OSD_INFO_DURATION);
for (size_t port = 0; port < SIO::PORTS; port++)
{

View File

@ -622,11 +622,11 @@ void VMManager::LoadPatches(const std::string& serial, u32 crc, bool show_messag
if (cheat_count > 0 || s_active_widescreen_patches > 0 || s_active_no_interlacing_patches > 0)
{
message += " are active.";
Host::AddIconOSDMessage("LoadPatches", ICON_FA_FILE_CODE, message, 5.0f);
Host::AddIconOSDMessage("LoadPatches", ICON_FA_FILE_CODE, message, Host::OSD_INFO_DURATION);
}
else if (show_messages_when_disabled)
{
Host::AddIconOSDMessage("LoadPatches", ICON_FA_FILE_CODE, "No cheats or patches (widescreen, compatibility or others) are found / enabled.", 8.0f);
Host::AddIconOSDMessage("LoadPatches", ICON_FA_FILE_CODE, "No cheats or patches (widescreen, compatibility or others) are found / enabled.", Host::OSD_INFO_DURATION);
}
}
}
@ -1203,7 +1203,7 @@ bool VMManager::DoSaveState(const char* filename, s32 slot_for_message, bool zip
if (!FileSystem::RenamePath(filename, backup_filename.c_str()))
{
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_EXCLAMATION_TRIANGLE,
fmt::format("Failed to back up old save state {}.", Path::GetFileName(filename)));
fmt::format("Failed to back up old save state {}.", Path::GetFileName(filename)), Host::OSD_ERROR_DURATION);
}
}
@ -1225,7 +1225,8 @@ bool VMManager::DoSaveState(const char* filename, s32 slot_for_message, bool zip
}
catch (Exception::BaseException& e)
{
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("Failed to save save state: {}.", e.DiagMsg()), 15.0f);
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("Failed to save save state: {}.", e.DiagMsg()),
Host::OSD_ERROR_DURATION);
return false;
}
}
@ -1239,11 +1240,13 @@ void VMManager::ZipSaveState(std::unique_ptr<ArchiveEntryList> elist,
if (SaveState_ZipToDisk(std::move(elist), std::move(screenshot), filename))
{
if (slot_for_message >= 0 && VMManager::HasValidVM())
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_SAVE, fmt::format("State saved to slot {}.", slot_for_message), 10.0f);
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_SAVE, fmt::format("State saved to slot {}.", slot_for_message),
Host::OSD_QUICK_DURATION);
}
else
{
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("Failed to save save state to slot {}.", slot_for_message), 15.0f);
Host::AddIconOSDMessage(std::move(osd_key), ICON_FA_EXCLAMATION_TRIANGLE, fmt::format("Failed to save save state to slot {}.", slot_for_message),
Host::OSD_ERROR_DURATION);
}
DevCon.WriteLn("Zipping save state to '%s' took %.2f ms", filename, timer.GetTimeMilliseconds());
@ -1342,7 +1345,7 @@ bool VMManager::LoadStateFromSlot(s32 slot)
}
#endif
Host::AddIconOSDMessage("LoadStateFromSlot", ICON_FA_FOLDER_OPEN, fmt::format("Loading state from slot {}...", slot), 5.0f);
Host::AddIconOSDMessage("LoadStateFromSlot", ICON_FA_FOLDER_OPEN, fmt::format("Loading state from slot {}...", slot), Host::OSD_QUICK_DURATION);
return DoLoadState(filename.c_str());
}
@ -1405,19 +1408,20 @@ bool VMManager::ChangeDisc(CDVD_SourceType source, std::string path)
if (result)
{
if (source == CDVD_SourceType::NoDisc)
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, "Disc removed.", 5.0f);
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, "Disc removed.", Host::OSD_INFO_DURATION);
else
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, fmt::format("Disc changed to '{}'.", display_name), 5.0f);
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, fmt::format("Disc changed to '{}'.", display_name), Host::OSD_INFO_DURATION);
}
else
{
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, fmt::format("Failed to open new disc image '{}'. Reverting to old image.", display_name), 20.0f);
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, fmt::format("Failed to open new disc image '{}'. Reverting to old image.", display_name),
Host::OSD_ERROR_DURATION);
CDVDsys_ChangeSource(old_type);
if (!old_path.empty())
CDVDsys_SetFile(old_type, std::move(old_path));
if (!DoCDVDopen())
{
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, "Failed to switch back to old disc image. Removing disc.", 20.0f);
Host::AddIconOSDMessage("ChangeDisc", ICON_FA_COMPACT_DISC, "Failed to switch back to old disc image. Removing disc.", Host::OSD_CRITICAL_ERROR_DURATION);
CDVDsys_ChangeSource(CDVD_SourceType::NoDisc);
DoCDVDopen();
}
@ -1803,7 +1807,7 @@ void VMManager::EnforceAchievementsChallengeModeSettings()
// Can't use cheats.
if (EmuConfig.EnableCheats)
{
Host::AddKeyedOSDMessage("ChallengeDisableCheats", "Cheats have been disabled due to achievements hardcore mode.", 10.0f);
Host::AddKeyedOSDMessage("ChallengeDisableCheats", "Cheats have been disabled due to achievements hardcore mode.", Host::OSD_WARNING_DURATION);
EmuConfig.EnableCheats = false;
}
@ -1863,7 +1867,7 @@ void VMManager::WarnAboutUnsafeSettings()
{
if (messages.back() == '\n')
messages.pop_back();
Host::AddKeyedOSDMessage("unsafe_settings_warning", std::move(messages), 10.0f);
Host::AddKeyedOSDMessage("unsafe_settings_warning", std::move(messages), Host::OSD_WARNING_DURATION);
}
else
{
@ -1898,7 +1902,7 @@ void VMManager::WarnAboutUnsafeSettings()
{
if (messages.back() == '\n')
messages.pop_back();
Host::AddKeyedOSDMessage("performance_settings_warning", std::move(messages), 10.0f);
Host::AddKeyedOSDMessage("performance_settings_warning", std::move(messages), Host::OSD_WARNING_DURATION);
}
else
{