System: Use new OSD message variants

This commit is contained in:
Stenzek
2025-11-01 01:44:25 +10:00
parent b483d2f61f
commit 529da22ef5
7 changed files with 211 additions and 230 deletions

View File

@@ -1101,10 +1101,10 @@ void Cheats::UpdateActiveCodes(bool reload_enabled_list, bool verbose, bool verb
if (s_locals.active_cheat_count > 0)
{
System::SetTaint(System::Taint::Cheats);
Host::AddIconOSDMessage("LoadCheats", ICON_EMOJI_WARNING,
TRANSLATE_PLURAL_STR("Cheats", "%n cheats are enabled. This may crash games.",
"OSD Message", s_locals.active_cheat_count),
Host::OSD_WARNING_DURATION);
Host::AddIconOSDMessage(
"LoadCheats", ICON_EMOJI_WARNING,
TRANSLATE_PLURAL_STR("Cheats", "%n cheats are enabled.", "OSD Message", s_locals.active_cheat_count),
TRANSLATE_STR("Cheats", "This may crash games."), Host::OSD_WARNING_DURATION);
}
else if (s_locals.active_patch_count == 0)
{

View File

@@ -514,24 +514,22 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
INFO_LOG("GameDB: CPU overclock set to {}.", cpu_overclock.value());
}
SmallStackString<512> messages;
#define APPEND_MESSAGE(msg) \
do \
{ \
messages.append("\n \u2022 "); \
messages.append(msg); \
} while (0)
#define APPEND_MESSAGE_FMT(...) \
do \
{ \
messages.append("\n \u2022 "); \
messages.append_format(__VA_ARGS__); \
} while (0)
LargeString messages;
const auto append_message = [&messages](std::string_view msg) {
messages.append(" \u2022 ");
messages.append(msg);
messages.append('\n');
};
const auto append_message_fmt = [&messages]<typename... T>(fmt::format_string<T...> fmt, T&&... args) {
messages.append(" \u2022 ");
messages.append_vformat(fmt, fmt::make_format_args(args...));
messages.append('\n');
};
if (HasTrait(Trait::ForceInterpreter))
{
if (display_osd_messages && settings.cpu_execution_mode != CPUExecutionMode::Interpreter)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "CPU recompiler disabled."));
append_message(TRANSLATE_SV("GameDatabase", "CPU recompiler disabled."));
settings.cpu_execution_mode = CPUExecutionMode::Interpreter;
}
@@ -539,7 +537,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::ForceFullBoot))
{
if (display_osd_messages && settings.bios_patch_fast_boot)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Fast boot disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Fast boot disabled."));
settings.bios_patch_fast_boot = false;
}
@@ -547,7 +545,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisableMultitap))
{
if (display_osd_messages && settings.multitap_mode != MultitapMode::Disabled)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Multitap disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Multitap disabled."));
settings.multitap_mode = MultitapMode::Disabled;
}
@@ -555,7 +553,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisableFastForwardMemoryCardAccess) && g_settings.memory_card_fast_forward_access)
{
if (display_osd_messages)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Fast forward memory card access disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Fast forward memory card access disabled."));
settings.memory_card_fast_forward_access = false;
}
@@ -563,7 +561,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisableCDROMReadSpeedup))
{
if (settings.cdrom_read_speedup != 1)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "CD-ROM read speedup disabled."));
append_message(TRANSLATE_SV("GameDatabase", "CD-ROM read speedup disabled."));
settings.cdrom_read_speedup = 1;
}
@@ -571,7 +569,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisableCDROMSeekSpeedup))
{
if (settings.cdrom_seek_speedup != 1)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "CD-ROM seek speedup disabled."));
append_message(TRANSLATE_SV("GameDatabase", "CD-ROM seek speedup disabled."));
settings.cdrom_seek_speedup = 1;
}
@@ -593,7 +591,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
if (display_osd_messages && settings.display_crop_mode != display_crop_mode.value())
{
APPEND_MESSAGE_FMT(TRANSLATE_FS("GameDatabase", "Display cropping set to {}."),
append_message_fmt(TRANSLATE_FS("GameDatabase", "Display cropping set to {}."),
Settings::GetDisplayCropModeDisplayName(display_crop_mode.value()));
}
@@ -603,7 +601,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::ForceSoftwareRenderer))
{
if (display_osd_messages && settings.gpu_renderer != GPURenderer::Software)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Hardware rendering disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Hardware rendering disabled."));
settings.gpu_renderer = GPURenderer::Software;
}
@@ -611,7 +609,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::ForceSoftwareRendererForReadbacks))
{
if (display_osd_messages && settings.gpu_renderer != GPURenderer::Software)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Software renderer readbacks enabled."));
append_message(TRANSLATE_SV("GameDatabase", "Software renderer readbacks enabled."));
settings.gpu_use_software_renderer_for_readbacks = true;
}
@@ -630,7 +628,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
DEFAULT_DEINTERLACING_MODE);
if (display_osd_messages && settings.display_deinterlacing_mode != new_mode)
{
APPEND_MESSAGE_FMT(TRANSLATE_FS("GameDatabase", "Deinterlacing set to {}."),
append_message_fmt(TRANSLATE_FS("GameDatabase", "Deinterlacing set to {}."),
Settings::GetDisplayDeinterlacingModeDisplayName(new_mode));
}
@@ -643,7 +641,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
if (display_osd_messages && settings.display_deinterlacing_mode != display_deinterlacing_mode.value())
{
APPEND_MESSAGE_FMT(TRANSLATE_FS("GameDatabase", "Deinterlacing set to {}."),
append_message_fmt(TRANSLATE_FS("GameDatabase", "Deinterlacing set to {}."),
Settings::GetDisplayDeinterlacingModeDisplayName(display_deinterlacing_mode.value()));
}
@@ -683,7 +681,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_dithering_mode != old_mode)
{
APPEND_MESSAGE_FMT(TRANSLATE_FS("GameDatabase", "Dithering set to {}."),
append_message_fmt(TRANSLATE_FS("GameDatabase", "Dithering set to {}."),
Settings::GetGPUDitheringModeDisplayName(settings.gpu_dithering_mode));
}
}
@@ -693,9 +691,9 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages)
{
if (settings.gpu_resolution_scale != 1)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Upscaling disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Upscaling disabled."));
if (settings.gpu_multisamples != 1)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "MSAA disabled."));
append_message(TRANSLATE_SV("GameDatabase", "MSAA disabled."));
}
settings.gpu_resolution_scale = 1;
@@ -708,7 +706,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && (settings.gpu_texture_filter != GPUTextureFilter::Nearest ||
g_settings.gpu_sprite_texture_filter != GPUTextureFilter::Nearest))
{
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Texture filtering disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Texture filtering disabled."));
}
settings.gpu_texture_filter = GPUTextureFilter::Nearest;
@@ -719,7 +717,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
{
if (display_osd_messages && g_settings.gpu_sprite_texture_filter != GPUTextureFilter::Nearest)
{
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Sprite texture filtering disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Sprite texture filtering disabled."));
}
settings.gpu_sprite_texture_filter = GPUTextureFilter::Nearest;
@@ -730,7 +728,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_scaled_interlacing &&
settings.display_deinterlacing_mode != DisplayDeinterlacingMode::Progressive)
{
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Scaled interlacing disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Scaled interlacing disabled."));
}
settings.gpu_scaled_interlacing = false;
@@ -739,7 +737,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisableWidescreen))
{
if (display_osd_messages && settings.gpu_widescreen_rendering)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "Widescreen rendering disabled."));
append_message(TRANSLATE_SV("GameDatabase", "Widescreen rendering disabled."));
settings.gpu_widescreen_rendering = false;
settings.gpu_widescreen_hack = false;
@@ -748,7 +746,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisablePGXP))
{
if (display_osd_messages && settings.gpu_pgxp_enable)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP geometry correction disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP geometry correction disabled."));
settings.gpu_pgxp_enable = false;
}
@@ -756,7 +754,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisablePGXPCulling))
{
if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_culling)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP culling correction disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP culling correction disabled."));
settings.gpu_pgxp_culling = false;
}
@@ -764,7 +762,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisablePGXPTextureCorrection))
{
if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_texture_correction)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP perspective correct textures disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP perspective correct textures disabled."));
settings.gpu_pgxp_texture_correction = false;
}
@@ -774,7 +772,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_texture_correction &&
settings.gpu_pgxp_color_correction)
{
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP perspective correct colors disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP perspective correct colors disabled."));
}
settings.gpu_pgxp_color_correction = false;
@@ -783,7 +781,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::ForcePGXPVertexCache))
{
if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_vertex_cache)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP vertex cache enabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP vertex cache enabled."));
settings.gpu_pgxp_vertex_cache = settings.gpu_pgxp_enable;
}
@@ -802,7 +800,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_cpu)
{
#ifndef __ANDROID__
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP CPU mode enabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP CPU mode enabled."));
#else
Host::AddIconOSDWarning("gamedb_force_pgxp_cpu", ICON_EMOJI_WARNING,
"This game requires PGXP CPU mode, which increases system requirements.\n"
@@ -825,7 +823,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisablePGXPDepthBuffer))
{
if (display_osd_messages && settings.gpu_pgxp_enable && settings.gpu_pgxp_depth_buffer)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP depth buffer disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP depth buffer disabled."));
settings.gpu_pgxp_depth_buffer = false;
}
@@ -833,7 +831,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (HasTrait(Trait::DisablePGXPOn2DPolygons))
{
if (display_osd_messages && settings.gpu_pgxp_enable && !settings.gpu_pgxp_disable_2d)
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP disabled on 2D polygons."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP disabled on 2D polygons."));
g_settings.gpu_pgxp_disable_2d = true;
}
@@ -846,7 +844,7 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
gpu_pgxp_preserve_proj_fp.value() ? "true" : "false");
if (settings.gpu_pgxp_enable && settings.gpu_pgxp_preserve_proj_fp && !gpu_pgxp_preserve_proj_fp.value())
APPEND_MESSAGE(TRANSLATE_SV("GameDatabase", "PGXP preserve projection precision disabled."));
append_message(TRANSLATE_SV("GameDatabase", "PGXP preserve projection precision disabled."));
}
settings.gpu_pgxp_preserve_proj_fp = gpu_pgxp_preserve_proj_fp.value();
@@ -866,15 +864,13 @@ void GameDatabase::Entry::ApplySettings(Settings& settings, bool display_osd_mes
if (!messages.empty())
{
Host::AddIconOSDMessage(
"GameDBCompatibility", ICON_EMOJI_INFORMATION,
fmt::format("{}{}", TRANSLATE_SV("GameDatabase", "Compatibility settings for this game have been applied."),
messages.view()),
Host::OSD_INFO_DURATION);
}
if (messages.back() == '\n')
messages.pop_back();
#undef APPEND_MESSAGE_FMT
#undef APPEND_MESSAGE
Host::AddIconOSDMessage("GameDBCompatibility", ICON_EMOJI_INFORMATION,
TRANSLATE_STR("GameDatabase", "Compatibility settings for this game have been applied."),
std::string(messages.view()), Host::OSD_INFO_DURATION);
}
#define BIT_FOR(ctype) (static_cast<u16>(1) << static_cast<u32>(ctype))

View File

@@ -694,8 +694,8 @@ void GPU_HW::CheckSettings()
// m_allow_shader_blend/m_prefer_shader_blend will be cleared in pipeline compile.
Host::AddIconOSDMessage(
"AccurateBlendingUnsupported", ICON_EMOJI_WARNING,
TRANSLATE_STR("GPU_HW", "Shader blending is not supported by your current GPU.\nIt requires framebuffer fetch, "
"feedback loops, or rasterizer order views."),
TRANSLATE_STR("GPU_HW", "Shader blending is not supported by your current GPU."),
TRANSLATE_STR("GPU_HW", "It requires framebuffer fetch, feedback loops, or rasterizer order views."),
Host::OSD_WARNING_DURATION);
}
else if (IsUsingMultisampling() && !features.framebuffer_fetch &&
@@ -713,8 +713,8 @@ void GPU_HW::CheckSettings()
{
Host::AddIconOSDMessage(
"AccurateBlendingUnsupported", ICON_EMOJI_WARNING,
TRANSLATE_STR("GPU_HW", "PGXP depth buffer is not supported by your current GPU or renderer.\nIt requires "
"framebuffer fetch, feedback loops, or rasterizer order views."),
TRANSLATE_STR("GPU_HW", "PGXP depth buffer is not supported by your current GPU or renderer."),
TRANSLATE_STR("GPU_HW", "It requires framebuffer fetch, feedback loops, or rasterizer order views."),
Host::OSD_WARNING_DURATION);
m_pgxp_depth_buffer = false;
}

View File

@@ -215,13 +215,12 @@ bool Pad::DoStateController(StateWrapper& sw, u32 i)
static_cast<unsigned>(controller_type_in_state), Controller::GetControllerInfo(controller_type).name,
static_cast<unsigned>(controller_type));
Host::AddIconOSDWarning(
fmt::format("PadTypeMismatch{}", i), ICON_EMOJI_WARNING,
fmt::format(TRANSLATE_FS("OSDMessage",
"Save state contains controller type {0} in port {1}.\n Leaving {2} connected."),
state_cinfo.GetDisplayName(), i + 1u,
Controller::GetControllerInfo(controller_type).GetDisplayName()),
Host::OSD_WARNING_DURATION);
Host::AddIconOSDWarning(fmt::format("PadTypeMismatch{}", i), ICON_EMOJI_WARNING,
fmt::format(TRANSLATE_FS("Pad", "Save state contains controller type {0} in Port {1}."),
state_cinfo.GetDisplayName(), i + 1u),
fmt::format(TRANSLATE_FS("Pad", "Leaving {0} connected."),
Controller::GetControllerInfo(controller_type).GetDisplayName()),
Host::OSD_WARNING_DURATION);
if (s_state.controllers[i])
s_state.controllers[i]->Reset();
@@ -251,10 +250,8 @@ bool Pad::DoStateMemcard(StateWrapper& sw, u32 i, bool is_memory_state)
{
Host::AddIconOSDMessage(
fmt::format("CardLoadWarning{}", i), ICON_PF_MEMORY_CARD,
fmt::format(
TRANSLATE_FS("OSDMessage", "Memory card {} present in save state but not in system. Creating temporary card."),
i + 1u),
Host::OSD_ERROR_DURATION);
fmt::format(TRANSLATE_FS("Pad", "Memory card {} present in save state but not in system."), i + 1u),
TRANSLATE_STR("Pad", "Creating temporary card."), Host::OSD_ERROR_DURATION);
s_state.memory_cards[i] = MemoryCard::Create();
}
@@ -289,10 +286,8 @@ bool Pad::DoStateMemcard(StateWrapper& sw, u32 i, bool is_memory_state)
{
Host::AddIconOSDMessage(
fmt::format("CardLoadWarning{}", i), ICON_PF_MEMORY_CARD,
fmt::format(
TRANSLATE_FS("OSDMessage",
"Memory card {} from save state does not match current card data. Simulating replugging."),
i + 1u),
fmt::format(TRANSLATE_FS("Pad", "Memory card {} from save state does not match current card data."), i + 1u),
TRANSLATE_STR("Pad", "Simulating replugging. The game may not be able to handle this."),
Host::OSD_WARNING_DURATION);
WARNING_LOG("Memory card {} data mismatch. Using current data via instant-replugging.", i + 1u);
@@ -303,9 +298,8 @@ bool Pad::DoStateMemcard(StateWrapper& sw, u32 i, bool is_memory_state)
{
Host::AddIconOSDMessage(
fmt::format("CardLoadWarning{}", i), ICON_PF_MEMORY_CARD,
fmt::format(
TRANSLATE_FS("OSDMessage", "Memory card {} present in save state but not in system. Ignoring card."), i + 1u),
Host::OSD_ERROR_DURATION);
fmt::format(TRANSLATE_FS("Pad", "Memory card {} present in save state but not in system."), i + 1u),
TRANSLATE_STR("Pad", "Ignoring card."), Host::OSD_ERROR_DURATION);
}
return true;
@@ -317,19 +311,16 @@ bool Pad::DoStateMemcard(StateWrapper& sw, u32 i, bool is_memory_state)
{
Host::AddIconOSDMessage(
fmt::format("CardLoadWarning{}", i), ICON_PF_MEMORY_CARD,
fmt::format(
TRANSLATE_FS("OSDMessage", "Memory card {} present in system but not in save state. Removing card."), i + 1u),
Host::OSD_ERROR_DURATION);
fmt::format(TRANSLATE_FS("Pad", "Memory card {} present in system but not in save state."), i + 1u),
TRANSLATE_STR("Pad", "Removing card."), Host::OSD_ERROR_DURATION);
s_state.memory_cards[i].reset();
}
else
{
Host::AddIconOSDMessage(
fmt::format("CardLoadWarning{}", i), ICON_PF_MEMORY_CARD,
fmt::format(
TRANSLATE_FS("OSDMessage", "Memory card {} present in system but not in save state. Replugging card."),
i + 1u),
Host::OSD_WARNING_DURATION);
fmt::format(TRANSLATE_FS("Pad", "Memory card {} present in system but not in save state."), i + 1u),
TRANSLATE_STR("Pad", "Replugging card."), Host::OSD_WARNING_DURATION);
s_state.memory_cards[i]->Reset();
}
}

View File

@@ -2565,12 +2565,14 @@ bool System::DoState(StateWrapper& sw, bool update_display)
g_settings.cpu_overclock_denominator != cpu_overclock_denominator))))
{
Host::AddIconOSDMessage(
"StateOverclockDifference", ICON_FA_TRIANGLE_EXCLAMATION,
fmt::format(TRANSLATE_FS("System", "WARNING: CPU overclock ({}%) was different in save state ({}%)."),
g_settings.cpu_overclock_enable ? g_settings.GetCPUOverclockPercent() : 100u,
cpu_overclock_active ?
Settings::CPUOverclockFractionToPercent(cpu_overclock_numerator, cpu_overclock_denominator) :
100u),
"StateOverclockDifference", ICON_EMOJI_WARNING, TRANSLATE_STR("System", "CPU Overclock Changed"),
fmt::format(
TRANSLATE_FS("System",
"The save state does not match the current configuration.\nSave State: {0}%\nConfiguration: {1}%"),
g_settings.cpu_overclock_enable ? g_settings.GetCPUOverclockPercent() : 100u,
cpu_overclock_active ?
Settings::CPUOverclockFractionToPercent(cpu_overclock_numerator, cpu_overclock_denominator) :
100u),
Host::OSD_WARNING_DURATION);
UpdateOverclock();
}
@@ -3010,11 +3012,12 @@ bool System::LoadStateFromBuffer(const SaveStateBuffer& buffer, Error* error, bo
{
if (CDROM::HasMedia())
{
Host::AddOSDMessage(
fmt::format(TRANSLATE_FS("OSDMessage", "Failed to open CD image from save state '{}': {}.\nUsing "
"existing image '{}', this may result in instability."),
buffer.media_path, error ? error->GetDescription() : local_error.GetDescription(),
Path::GetFileName(CDROM::GetMediaPath())),
Host::AddIconOSDMessage(
"UsingExistingCDImage", ICON_EMOJI_WARNING,
TRANSLATE_STR("System", "Failed to open CD image from save state."),
fmt::format(
TRANSLATE_FS("System", "Path: {0}\nError: {1}\nUsing current CD image, this may result in instability."),
buffer.media_path, error ? error->GetDescription() : local_error.GetDescription()),
Host::OSD_CRITICAL_ERROR_DURATION);
}
else
@@ -4742,30 +4745,31 @@ void System::WarnAboutStateTaints(u32 state_taints)
if (!(taints_active_in_file & (1u << i)))
continue;
if (messages.empty())
{
messages.append_format(
"{} {}\n", ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "This save state was created with the following tainted options, and may\n"
" be unstable. You will need to reset the system to clear any effects."));
}
messages.append(" \u2022 ");
messages.append(" \u2022 ");
messages.append(GetTaintDisplayName(static_cast<Taint>(i)));
messages.append('\n');
}
Host::AddKeyedOSDWarning("SystemTaintsFromState", std::string(messages.view()), Host::OSD_WARNING_DURATION);
if (messages.empty())
return;
Host::AddIconOSDWarning(
"SystemTaintsFromState", ICON_EMOJI_WARNING,
TRANSLATE_STR("System", "This save state was created with the following tainted options, and may be unstable. You "
"will need to reset the system to clear any effects."),
std::string(messages.view()), Host::OSD_ERROR_DURATION);
}
void System::WarnAboutUnsafeSettings()
{
LargeString messages;
const auto append = [&messages](const char* icon, std::string_view msg) {
messages.append_format("{} {}\n", icon, msg);
const auto append = [&messages](std::string_view msg) {
messages.append(" \u2022 ");
messages.append(msg);
messages.append('\n');
};
const auto append_format = [&messages]<typename... T>(const char* icon, fmt::format_string<T...> fmt, T&&... args) {
messages.append_format("{} ", icon);
const auto append_format = [&messages]<typename... T>(fmt::format_string<T...> fmt, T&&... args) {
messages.append(" \u2022 ");
messages.append_vformat(fmt, fmt::make_format_args(args...));
messages.append('\n');
};
@@ -4774,139 +4778,125 @@ void System::WarnAboutUnsafeSettings()
s_state.running_game_entry->HasTrait(trait));
};
// Force the message, but use a reduced duration if they have OSD messages disabled.
const float osd_duration = g_settings.display_show_messages ? Host::OSD_INFO_DURATION : Host::OSD_QUICK_DURATION;
static constexpr std::string_view safe_mode_osd_key = "SafeModeWarn";
if (g_settings.disable_all_enhancements)
{
if (g_settings.cpu_overclock_active)
append(TRANSLATE_SV("System", "Overclock disabled."));
if (g_settings.cpu_enable_8mb_ram)
append(TRANSLATE_SV("System", "8MB RAM disabled."));
if (g_settings.gpu_resolution_scale != 1)
append(TRANSLATE_SV("System", "Resolution scale set to 1x."));
if (g_settings.gpu_multisamples != 1)
append(TRANSLATE_SV("System", "Multisample anti-aliasing disabled."));
if (g_settings.gpu_dithering_mode != GPUDitheringMode::Unscaled)
append(TRANSLATE_SV("System", "Dithering set to unscaled."));
if (g_settings.gpu_texture_filter != GPUTextureFilter::Nearest ||
g_settings.gpu_sprite_texture_filter != GPUTextureFilter::Nearest)
{
append(TRANSLATE_SV("System", "Texture filtering disabled."));
}
if (g_settings.display_deinterlacing_mode == DisplayDeinterlacingMode::Progressive)
append(TRANSLATE_SV("System", "Interlaced rendering enabled."));
if (g_settings.gpu_force_video_timing != ForceVideoTimingMode::Disabled)
append(TRANSLATE_SV("System", "Video timings set to default."));
if (g_settings.gpu_widescreen_hack)
append(TRANSLATE_SV("System", "Widescreen rendering disabled."));
if (g_settings.gpu_pgxp_enable)
append(TRANSLATE_SV("System", "PGXP disabled."));
if (g_settings.gpu_texture_cache)
append(TRANSLATE_SV("System", "GPU texture cache disabled."));
if (g_settings.display_24bit_chroma_smoothing)
append(TRANSLATE_SV("System", "FMV chroma smoothing disabled."));
if (g_settings.cdrom_read_speedup != 1)
append(TRANSLATE_SV("System", "CD-ROM read speedup disabled."));
if (g_settings.cdrom_seek_speedup != 1)
append(TRANSLATE_SV("System", "CD-ROM seek speedup disabled."));
if (g_settings.cdrom_mute_cd_audio)
append(TRANSLATE_SV("System", "Mute CD-ROM audio disabled."));
if (g_settings.texture_replacements.enable_vram_write_replacements)
append(TRANSLATE_SV("System", "VRAM write texture replacements disabled."));
if (g_settings.mdec_use_old_routines)
append(TRANSLATE_SV("System", "Use old MDEC routines disabled."));
if (g_settings.pio_device_type != PIODeviceType::None)
append(TRANSLATE_SV("System", "PIO device removed."));
if (g_settings.pcdrv_enable)
append(TRANSLATE_SV("System", "PCDrv disabled."));
if (g_settings.bios_patch_fast_boot)
append(TRANSLATE_SV("System", "Fast boot disabled."));
Host::AddIconOSDWarning(std::string(safe_mode_osd_key), ICON_EMOJI_WARNING,
TRANSLATE_STR("System", "Safe mode is enabled."), std::string(messages.view()),
osd_duration);
messages.clear();
}
else
{
Host::RemoveKeyedOSDWarning(std::string(safe_mode_osd_key));
}
if (!g_settings.disable_all_enhancements)
{
if (g_settings.cpu_overclock_active)
{
append_format(
ICON_EMOJI_WARNING, TRANSLATE_FS("System", "CPU clock speed is set to {}% ({} / {}). This may crash games."),
g_settings.GetCPUOverclockPercent(), g_settings.cpu_overclock_numerator, g_settings.cpu_overclock_denominator);
append_format(TRANSLATE_FS("System", "CPU clock speed is set to {}% ({} / {}). This may crash games."),
g_settings.GetCPUOverclockPercent(), g_settings.cpu_overclock_numerator,
g_settings.cpu_overclock_denominator);
}
if ((g_settings.cdrom_read_speedup != 1 && !has_trait(GameDatabase::Trait::DisableCDROMReadSpeedup)) ||
(g_settings.cdrom_seek_speedup != 1 && !has_trait(GameDatabase::Trait::DisableCDROMSeekSpeedup)))
{
append(ICON_EMOJI_WARNING, TRANSLATE_SV("System", "CD-ROM read/seek speedup is enabled. This may crash games."));
append(TRANSLATE_SV("System", "CD-ROM read/seek speedup is enabled. This may crash games."));
}
if (g_settings.gpu_force_video_timing != ForceVideoTimingMode::Disabled)
append(ICON_FA_TV,
TRANSLATE_SV("System", "Frame rate is not set to automatic. Games may run at incorrect speeds."));
append(TRANSLATE_SV("System", "Frame rate is not set to automatic. Games may run at incorrect speeds."));
if (!g_settings.IsUsingSoftwareRenderer())
{
if (g_settings.gpu_multisamples != 1)
{
append(ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "Multisample anti-aliasing is enabled, some games may not render correctly."));
append(TRANSLATE_SV("System", "Multisample anti-aliasing is enabled, some games may not render correctly."));
}
if (g_settings.gpu_resolution_scale > 1 && g_settings.gpu_force_round_texcoords)
{
append(
ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "Round upscaled texture coordinates is enabled. This may cause rendering errors."));
}
if (g_settings.gpu_pgxp_tolerance >= 0.0f)
{
append(
ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "PGXP Geometry Tolerance is not set to default. This may cause rendering errors."));
}
}
if (g_settings.cpu_enable_8mb_ram)
{
append(ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "8MB RAM is enabled, this may be incompatible with some games."));
}
append(TRANSLATE_SV("System", "8MB RAM is enabled, this may be incompatible with some games."));
if (g_settings.cpu_execution_mode == CPUExecutionMode::CachedInterpreter)
{
append(ICON_EMOJI_WARNING,
TRANSLATE_SV("System", "Cached interpreter is being used, this may be incompatible with some games."));
}
append(TRANSLATE_SV("System", "Cached interpreter is being used, this may be incompatible with some games."));
// Always display TC warning.
if (g_settings.gpu_texture_cache)
{
append(
ICON_FA_PAINT_ROLLER,
TRANSLATE_SV("System",
"Texture cache is enabled. This feature is experimental, some games may not render correctly."));
append(TRANSLATE_SV(
"System", "Texture cache is enabled. This feature is experimental, some games may not render correctly."));
}
// Potential performance issues.
if (g_settings.cpu_fastmem_mode != Settings::DEFAULT_CPU_FASTMEM_MODE)
{
append_format(ICON_EMOJI_WARNING,
TRANSLATE_FS("System", "Fastmem mode is set to {}, this will reduce performance."),
append_format(TRANSLATE_FS("System", "Fastmem mode is set to {}, this will reduce performance."),
Settings::GetCPUFastmemModeName(g_settings.cpu_fastmem_mode));
}
}
if (g_settings.disable_all_enhancements)
{
append(ICON_EMOJI_WARNING, TRANSLATE_SV("System", "Safe mode is enabled."));
#define APPEND_SUBMESSAGE(msg) \
do \
{ \
messages.append(" \u2022 "); \
messages.append(msg); \
messages.append('\n'); \
} while (0)
if (g_settings.cpu_overclock_active)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Overclock disabled."));
if (g_settings.cpu_enable_8mb_ram)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "8MB RAM disabled."));
if (g_settings.gpu_resolution_scale != 1)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Resolution scale set to 1x."));
if (g_settings.gpu_multisamples != 1)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Multisample anti-aliasing disabled."));
if (g_settings.gpu_dithering_mode != GPUDitheringMode::Unscaled)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Dithering set to unscaled."));
if (g_settings.gpu_texture_filter != GPUTextureFilter::Nearest ||
g_settings.gpu_sprite_texture_filter != GPUTextureFilter::Nearest)
{
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Texture filtering disabled."));
}
if (g_settings.display_deinterlacing_mode == DisplayDeinterlacingMode::Progressive)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Interlaced rendering enabled."));
if (g_settings.gpu_force_video_timing != ForceVideoTimingMode::Disabled)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Video timings set to default."));
if (g_settings.gpu_widescreen_hack)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Widescreen rendering disabled."));
if (g_settings.gpu_pgxp_enable)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "PGXP disabled."));
if (g_settings.gpu_texture_cache)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "GPU texture cache disabled."));
if (g_settings.display_24bit_chroma_smoothing)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "FMV chroma smoothing disabled."));
if (g_settings.cdrom_read_speedup != 1)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "CD-ROM read speedup disabled."));
if (g_settings.cdrom_seek_speedup != 1)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "CD-ROM seek speedup disabled."));
if (g_settings.cdrom_mute_cd_audio)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Mute CD-ROM audio disabled."));
if (g_settings.texture_replacements.enable_vram_write_replacements)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "VRAM write texture replacements disabled."));
if (g_settings.mdec_use_old_routines)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Use old MDEC routines disabled."));
if (g_settings.pio_device_type != PIODeviceType::None)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "PIO device removed."));
if (g_settings.pcdrv_enable)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "PCDrv disabled."));
if (g_settings.bios_patch_fast_boot)
APPEND_SUBMESSAGE(TRANSLATE_SV("System", "Fast boot disabled."));
#undef APPEND_SUBMESSAGE
}
if (!g_settings.apply_compatibility_settings)
{
append(ICON_EMOJI_WARNING,
TRANSLATE_STR("System", "Compatibility settings are not enabled. Some games may not function correctly."));
}
append(TRANSLATE_STR("System", "Compatibility settings are not enabled. Some games may not function correctly."));
if (g_settings.cdrom_subq_skew)
append(ICON_EMOJI_WARNING, TRANSLATE_SV("System", "CD-ROM SubQ Skew is enabled. This will break games."));
append(TRANSLATE_SV("System", "CD-ROM SubQ Skew is enabled. This will break games."));
static constexpr std::string_view osd_key = "UnsafeCfgWarn";
if (!messages.empty())
{
if (messages.back() == '\n')
@@ -4914,13 +4904,13 @@ void System::WarnAboutUnsafeSettings()
LogUnsafeSettingsToConsole(messages);
// Force the message, but use a reduced duration if they have OSD messages disabled.
Host::AddKeyedOSDWarning("performance_settings_warning", std::string(messages.view()),
g_settings.display_show_messages ? Host::OSD_INFO_DURATION : Host::OSD_QUICK_DURATION);
Host::AddIconOSDWarning(std::string(osd_key), ICON_EMOJI_WARNING,
TRANSLATE_STR("System", "One or more unsafe settings is enabled."),
std::string(messages.view()), osd_duration);
}
else
{
Host::RemoveKeyedOSDWarning("performance_settings_warning");
Host::RemoveKeyedOSDWarning(std::string(osd_key));
}
}

View File

@@ -4,8 +4,8 @@
<context>
<name>AchievementSettingsWidget</name>
<message numerus="yes">
<location filename="../achievementsettingswidget.cpp" line="198"/>
<location filename="../achievementsettingswidget.cpp" line="205"/>
<location filename="../achievementsettingswidget.cpp" line="197"/>
<location filename="../achievementsettingswidget.cpp" line="204"/>
<source>%n seconds</source>
<translation>
<numerusform>%n second</numerusform>
@@ -16,7 +16,7 @@
<context>
<name>Achievements</name>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="1384"/>
<location filename="../../core/achievements.cpp" line="1240"/>
<source>You have unlocked {} of %n achievements</source>
<comment>Achievement popup</comment>
<translation>
@@ -25,7 +25,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="1387"/>
<location filename="../../core/achievements.cpp" line="1243"/>
<source>and earned {} of %n points</source>
<comment>Achievement popup</comment>
<translation>
@@ -34,7 +34,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="1417"/>
<location filename="../../core/achievements.cpp" line="1273"/>
<source>%n achievements are not supported by DuckStation.</source>
<comment>Achievement popup</comment>
<translation>
@@ -43,8 +43,8 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="1477"/>
<location filename="../../core/achievements.cpp" line="1507"/>
<location filename="../../core/achievements.cpp" line="1336"/>
<location filename="../../core/achievements.cpp" line="1367"/>
<source>%n achievements</source>
<comment>Mastery popup</comment>
<translation>
@@ -53,9 +53,9 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="1479"/>
<location filename="../../core/achievements.cpp" line="1509"/>
<location filename="../../core/achievements.cpp" line="3092"/>
<location filename="../../core/achievements.cpp" line="1338"/>
<location filename="../../core/achievements.cpp" line="1369"/>
<location filename="../../core/fullscreenui_achievements.cpp" line="889"/>
<source>%n points</source>
<comment>Achievement points</comment>
<translation>
@@ -64,7 +64,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="2545"/>
<location filename="../../core/fullscreenui_achievements.cpp" line="311"/>
<source>%n unlocks have not been confirmed by the server.</source>
<comment>Pause Menu</comment>
<translation>
@@ -73,7 +73,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="2853"/>
<location filename="../../core/fullscreenui_achievements.cpp" line="652"/>
<source>You have unlocked all achievements and earned %n points!</source>
<comment>Point count</comment>
<translation>
@@ -82,7 +82,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="2880"/>
<location filename="../../core/fullscreenui_achievements.cpp" line="678"/>
<source>%n achievements are not supported by DuckStation and cannot be unlocked.</source>
<comment>Unsupported achievement count</comment>
<translation>
@@ -91,7 +91,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/achievements.cpp" line="3340"/>
<location filename="../../core/fullscreenui_achievements.cpp" line="1160"/>
<source>This game has %n leaderboards.</source>
<comment>Leaderboard count</comment>
<translation>
@@ -112,12 +112,12 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/cheats.cpp" line="1105"/>
<source>%n cheats are enabled. This may crash games.</source>
<location filename="../../core/cheats.cpp" line="1106"/>
<source>%n cheats are enabled.</source>
<comment>OSD Message</comment>
<translation>
<numerusform>%n cheat is enabled. This may crash games.</numerusform>
<numerusform>%n cheats are enabled. This may crash games.</numerusform>
<translation type="unfinished">
<numerusform>%n cheat is enabled.</numerusform>
<numerusform>%n cheats are enabled.</numerusform>
</translation>
</message>
<message numerus="yes">
@@ -142,7 +142,7 @@
<context>
<name>EmulationSettingsWidget</name>
<message numerus="yes">
<location filename="../emulationsettingswidget.cpp" line="261"/>
<location filename="../emulationsettingswidget.cpp" line="260"/>
<source>Rewind for %n frame(s), lasting %1 second(s) will require up to %2MB of RAM and %3MB of VRAM.</source>
<translation>
<numerusform>Rewind for %n frame, lasting %1 second(s) will require up to %2MB of RAM and %3MB of VRAM.</numerusform>
@@ -153,7 +153,7 @@
<context>
<name>FullscreenUI</name>
<message numerus="yes">
<location filename="../../core/fullscreenui_widgets.cpp" line="4414"/>
<location filename="../../core/fullscreenui_widgets.cpp" line="4427"/>
<source>%n seconds remaining</source>
<comment>Loading time</comment>
<translation>
@@ -162,7 +162,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/fullscreenui_widgets.cpp" line="4419"/>
<location filename="../../core/fullscreenui_widgets.cpp" line="4432"/>
<source>%n minutes remaining</source>
<comment>Loading time</comment>
<translation>
@@ -186,7 +186,7 @@
<context>
<name>GameList</name>
<message numerus="yes">
<location filename="../../core/game_list.cpp" line="1639"/>
<location filename="../../core/game_list.cpp" line="1640"/>
<source>%n seconds</source>
<translation>
<numerusform>%n second</numerusform>
@@ -194,7 +194,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/game_list.cpp" line="1635"/>
<location filename="../../core/game_list.cpp" line="1636"/>
<source>%n hours</source>
<translation>
<numerusform>%n hour</numerusform>
@@ -202,7 +202,7 @@
</translation>
</message>
<message numerus="yes">
<location filename="../../core/game_list.cpp" line="1637"/>
<location filename="../../core/game_list.cpp" line="1638"/>
<source>%n minutes</source>
<translation>
<numerusform>%n minute</numerusform>
@@ -224,7 +224,7 @@
<context>
<name>MemoryCardEditorWindow</name>
<message numerus="yes">
<location filename="../memorycardeditorwindow.cpp" line="471"/>
<location filename="../memorycardeditorwindow.cpp" line="470"/>
<source>%n block(s) free%1</source>
<translation>
<numerusform>%n block free%1</numerusform>

View File

@@ -464,11 +464,9 @@ bool GPUDevice::Create(std::string_view adapter, CreateFlags create_flags, std::
{
#define FLAG_MSG(flag, text) \
if (HasCreateFlag(create_flags, flag)) \
{ \
message += "\n \u2022 " text; \
}
message += " \u2022 " text "\n";
std::string message = "One or more non-standard GPU device flags are set:";
std::string message;
FLAG_MSG(CreateFlags::EnableDebugDevice, "Use Debug Device");
FLAG_MSG(CreateFlags::EnableGPUValidation, "Enable GPU Validation");
FLAG_MSG(CreateFlags::PreferGLESContext, "Prefer OpenGL ES context");
@@ -484,8 +482,14 @@ bool GPUDevice::Create(std::string_view adapter, CreateFlags create_flags, std::
FLAG_MSG(CreateFlags::DisableRasterOrderViews, "Disable Raster Order Views");
FLAG_MSG(CreateFlags::DisableCompressedTextures, "Disable Compressed Textures");
Host::AddIconOSDMessage("GPUDeviceNonStandardFlags", ICON_EMOJI_WARNING, std::move(message),
Host::OSD_WARNING_DURATION);
if (!message.empty())
{
message.pop_back(); // Remove last newline.
Host::AddIconOSDMessage("GPUDeviceNonStandardFlags", ICON_EMOJI_WARNING,
"One or more non-standard GPU device flags are enabled.", std::move(message),
Host::OSD_WARNING_DURATION);
}
#undef FLAG_MSG
}