overlays: show latching message for fatal errors
This commit is contained in:
@@ -431,25 +431,25 @@ namespace rsx
|
|||||||
m_is_compiled = false;
|
m_is_compiled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlay_element::set_text(const std::string& text)
|
void overlay_element::set_text(std::string_view text)
|
||||||
{
|
{
|
||||||
std::u32string new_text = utf8_to_u32string(text);
|
std::u32string new_text = utf8_to_u32string(text);
|
||||||
const bool is_dirty = this->text != new_text;
|
const bool is_dirty = this->text != new_text;
|
||||||
this->text = std::move(new_text);
|
|
||||||
|
|
||||||
if (is_dirty)
|
if (is_dirty)
|
||||||
{
|
{
|
||||||
|
this->text = std::move(new_text);
|
||||||
m_is_compiled = false;
|
m_is_compiled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void overlay_element::set_unicode_text(const std::u32string& text)
|
void overlay_element::set_unicode_text(std::u32string_view text)
|
||||||
{
|
{
|
||||||
const bool is_dirty = this->text != text;
|
const bool is_dirty = this->text != text;
|
||||||
this->text = text;
|
|
||||||
|
|
||||||
if (is_dirty)
|
if (is_dirty)
|
||||||
{
|
{
|
||||||
|
this->text = text;
|
||||||
m_is_compiled = false;
|
m_is_compiled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ namespace rsx
|
|||||||
// NOTE: Functions as a simple position offset. Top left corner is the anchor.
|
// NOTE: Functions as a simple position offset. Top left corner is the anchor.
|
||||||
virtual void set_margin(u16 left, u16 top);
|
virtual void set_margin(u16 left, u16 top);
|
||||||
virtual void set_margin(u16 margin);
|
virtual void set_margin(u16 margin);
|
||||||
virtual void set_text(const std::string& text);
|
virtual void set_text(std::string_view text);
|
||||||
virtual void set_unicode_text(const std::u32string& text);
|
virtual void set_unicode_text(std::u32string_view text);
|
||||||
void set_text(localized_string_id id);
|
void set_text(localized_string_id id);
|
||||||
void set_text(const localized_string& container);
|
void set_text(const localized_string& container);
|
||||||
virtual void set_font(const char* font_name, u16 font_size);
|
virtual void set_font(const char* font_name, u16 font_size);
|
||||||
|
|||||||
@@ -95,12 +95,12 @@ namespace rsx
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_text::set_text(const std::string& text)
|
void edit_text::set_text(std::string_view text)
|
||||||
{
|
{
|
||||||
set_unicode_text(utf8_to_u32string(text));
|
set_unicode_text(utf8_to_u32string(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_text::set_unicode_text(const std::u32string& text)
|
void edit_text::set_unicode_text(std::u32string_view text)
|
||||||
{
|
{
|
||||||
value = text;
|
value = text;
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ namespace rsx
|
|||||||
|
|
||||||
using label::label;
|
using label::label;
|
||||||
|
|
||||||
void set_text(const std::string& text) override;
|
void set_text(std::string_view text) override;
|
||||||
void set_unicode_text(const std::u32string& text) override;
|
void set_unicode_text(std::u32string_view text) override;
|
||||||
|
|
||||||
void set_placeholder(const std::u32string& placeholder_text);
|
void set_placeholder(const std::u32string& placeholder_text);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace rsx
|
|||||||
return m_loc_id == id;
|
return m_loc_id == id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool message_item::text_matches(const std::u32string& text) const
|
bool message_item::text_matches(std::u32string_view text) const
|
||||||
{
|
{
|
||||||
return m_text.text == text;
|
return m_text.text == text;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace rsx
|
|||||||
compiled_resource& get_compiled() override;
|
compiled_resource& get_compiled() override;
|
||||||
|
|
||||||
bool id_matches(localized_string_id id) const;
|
bool id_matches(localized_string_id id) const;
|
||||||
bool text_matches(const std::u32string& text) const;
|
bool text_matches(std::u32string_view text) const;
|
||||||
|
|
||||||
void set_label_text(const std::string& text);
|
void set_label_text(const std::string& text);
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace rsx
|
|||||||
set_pos(x + dx, y + dy);
|
set_pos(x + dx, y + dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void progress_bar::set_text(const std::string& str)
|
void progress_bar::set_text(std::string_view str)
|
||||||
{
|
{
|
||||||
text_view.set_text(str);
|
text_view.set_text(str);
|
||||||
text_view.align_text(text_align::center);
|
text_view.align_text(text_align::center);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace rsx
|
|||||||
void set_pos(s16 _x, s16 _y) override;
|
void set_pos(s16 _x, s16 _y) override;
|
||||||
void set_size(u16 _w, u16 _h) override;
|
void set_size(u16 _w, u16 _h) override;
|
||||||
void translate(s16 dx, s16 dy) override;
|
void translate(s16 dx, s16 dy) override;
|
||||||
void set_text(const std::string& str) override;
|
void set_text(std::string_view str) override;
|
||||||
|
|
||||||
compiled_resource& get_compiled() override;
|
compiled_resource& get_compiled() override;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static auto s_ascii_lowering_map = []()
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
template<typename F>
|
template<typename F>
|
||||||
void process_multibyte(const std::string& s, F&& func)
|
void process_multibyte(std::string_view s, F&& func)
|
||||||
{
|
{
|
||||||
const usz end = s.length();
|
const usz end = s.length();
|
||||||
for (usz index = 0; index < end; ++index)
|
for (usz index = 0; index < end; ++index)
|
||||||
@@ -110,7 +110,7 @@ void process_multibyte(const std::string& s, F&& func)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string utf8_to_ascii8(const std::string& utf8_string)
|
std::string utf8_to_ascii8(std::string_view utf8_string)
|
||||||
{
|
{
|
||||||
std::string out;
|
std::string out;
|
||||||
out.reserve(utf8_string.length());
|
out.reserve(utf8_string.length());
|
||||||
@@ -135,7 +135,7 @@ std::string utf8_to_ascii8(const std::string& utf8_string)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string utf16_to_ascii8(const std::u16string& utf16_string)
|
std::string utf16_to_ascii8(std::u16string_view utf16_string)
|
||||||
{
|
{
|
||||||
// Strip extended codes, map to '#' instead (placeholder)
|
// Strip extended codes, map to '#' instead (placeholder)
|
||||||
std::string out;
|
std::string out;
|
||||||
@@ -152,7 +152,7 @@ std::string utf16_to_ascii8(const std::u16string& utf16_string)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string ascii8_to_utf16(const std::string& ascii_string)
|
std::u16string ascii8_to_utf16(std::string_view ascii_string)
|
||||||
{
|
{
|
||||||
std::u16string out;
|
std::u16string out;
|
||||||
out.reserve(ascii_string.length());
|
out.reserve(ascii_string.length());
|
||||||
@@ -168,7 +168,7 @@ std::u16string ascii8_to_utf16(const std::string& ascii_string)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u32string utf8_to_u32string(const std::string& utf8_string)
|
std::u32string utf8_to_u32string(std::string_view utf8_string)
|
||||||
{
|
{
|
||||||
std::u32string result;
|
std::u32string result;
|
||||||
result.reserve(utf8_string.size());
|
result.reserve(utf8_string.size());
|
||||||
@@ -181,7 +181,7 @@ std::u32string utf8_to_u32string(const std::string& utf8_string)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u16string u32string_to_utf16(const std::u32string& utf32_string)
|
std::u16string u32string_to_utf16(std::u32string_view utf32_string)
|
||||||
{
|
{
|
||||||
std::u16string result;
|
std::u16string result;
|
||||||
result.reserve(utf32_string.size());
|
result.reserve(utf32_string.size());
|
||||||
@@ -194,7 +194,7 @@ std::u16string u32string_to_utf16(const std::u32string& utf32_string)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::u32string utf16_to_u32string(const std::u16string& utf16_string)
|
std::u32string utf16_to_u32string(std::u16string_view utf16_string)
|
||||||
{
|
{
|
||||||
std::u32string result;
|
std::u32string result;
|
||||||
result.reserve(utf16_string.size());
|
result.reserve(utf16_string.size());
|
||||||
|
|||||||
@@ -218,9 +218,9 @@ void operator < (const vector3_base<T>& lhs, T rhs)
|
|||||||
using vector3i = vector3_base<int>;
|
using vector3i = vector3_base<int>;
|
||||||
using vector3f = vector3_base<float>;
|
using vector3f = vector3_base<float>;
|
||||||
|
|
||||||
std::string utf8_to_ascii8(const std::string& utf8_string);
|
std::string utf8_to_ascii8(std::string_view utf8_string);
|
||||||
std::string utf16_to_ascii8(const std::u16string& utf16_string);
|
std::string utf16_to_ascii8(std::u16string_view utf16_string);
|
||||||
std::u16string ascii8_to_utf16(const std::string& ascii_string);
|
std::u16string ascii8_to_utf16(std::string_view ascii_string);
|
||||||
std::u32string utf8_to_u32string(const std::string& utf8_string);
|
std::u32string utf8_to_u32string(std::string_view utf8_string);
|
||||||
std::u16string u32string_to_utf16(const std::u32string& utf32_string);
|
std::u16string u32string_to_utf16(std::u32string_view utf32_string);
|
||||||
std::u32string utf16_to_u32string(const std::u16string& utf16_string);
|
std::u32string utf16_to_u32string(std::u16string_view utf16_string);
|
||||||
|
|||||||
@@ -2837,7 +2837,7 @@ bool Emulator::Pause(bool freeze_emulation, bool show_resume_message)
|
|||||||
auto msg_ref = std::make_shared<atomic_t<u32>>(1);
|
auto msg_ref = std::make_shared<atomic_t<u32>>(1);
|
||||||
|
|
||||||
// No timeout
|
// No timeout
|
||||||
rsx::overlays::queue_message(status == system_state::paused ? localized_string_id::EMULATION_PAUSED_RESUME_WITH_START : localized_string_id::EMULATION_FROZEN, -1, msg_ref);
|
rsx::overlays::queue_message(status == system_state::paused ? localized_string_id::EMULATION_PAUSED_RESUME_WITH_START : localized_string_id::EMULATION_FROZEN, umax, msg_ref);
|
||||||
m_pause_msgs_refs.emplace_back(msg_ref);
|
m_pause_msgs_refs.emplace_back(msg_ref);
|
||||||
|
|
||||||
auto refresh_l = [this, msg_ref, status]()
|
auto refresh_l = [this, msg_ref, status]()
|
||||||
|
|||||||
+7
-1
@@ -69,6 +69,7 @@ DYNAMIC_IMPORT("ntdll.dll", NtSetTimerResolution, NTSTATUS(ULONG DesiredResoluti
|
|||||||
#include "rpcs3_version.h"
|
#include "rpcs3_version.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/system_utils.hpp"
|
#include "Emu/system_utils.hpp"
|
||||||
|
#include "Emu/RSX/Overlays/overlay_message.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <charconv>
|
#include <charconv>
|
||||||
|
|
||||||
@@ -312,7 +313,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (msg == logs::level::fatal || (msg == logs::level::always && m_log_always))
|
if (msg == logs::level::fatal || (msg == logs::level::always && m_log_always))
|
||||||
{
|
{
|
||||||
std::string _msg = "RPCS3: ";
|
static const std::string rpcs3_prefix = "RPCS3: ";
|
||||||
|
std::string _msg = rpcs3_prefix;
|
||||||
|
|
||||||
if (!prefix.empty())
|
if (!prefix.empty())
|
||||||
{
|
{
|
||||||
@@ -351,7 +353,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
if (msg == logs::level::fatal)
|
if (msg == logs::level::fatal)
|
||||||
{
|
{
|
||||||
|
std::string overlay_msg = "Fatal error: " + _msg.substr(rpcs3_prefix.size());
|
||||||
|
fmt::trim_back(overlay_msg, " \t\n");
|
||||||
|
|
||||||
// Pause emulation if fatal error encountered
|
// Pause emulation if fatal error encountered
|
||||||
|
rsx::overlays::queue_message(overlay_msg, umax);
|
||||||
Emu.Pause(true);
|
Emu.Pause(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user