diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp index bea0fb4de2..8d6452a201 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.cpp @@ -75,10 +75,7 @@ struct osk_info atomic_t supported_languages = 0; // Used to enable non-default languages in the OSK atomic_t dimmer_enabled = true; - atomic_t base_color_red = 1.0f; - atomic_t base_color_green = 1.0f; - atomic_t base_color_blue = 1.0f; - atomic_t base_color_alpha = 1.0f; + atomic_t base_color = OskDialogBase::color{ 0.2f, 0.2f, 0.2f, 1.0f }; atomic_t pointer_enabled = false; CellOskDialogPoint pointer_pos{0.0f, 0.0f}; @@ -112,10 +109,7 @@ struct osk_info half_byte_kana_enabled = false; supported_languages = 0; dimmer_enabled = true; - base_color_red = 1.0f; - base_color_blue = 1.0f; - base_color_green = 1.0f; - base_color_alpha = 1.0f; + base_color = OskDialogBase::color{ 0.2f, 0.2f, 0.2f, 1.0f }; pointer_enabled = false; pointer_pos = {0.0f, 0.0f}; initial_scale = 1.0f; @@ -511,9 +505,9 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr dia return CELL_OK; } - Emu.CallFromMainThread([=, &result]() + Emu.CallFromMainThread([=, &result, &info]() { - osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel); + osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel, info.base_color.load()); result = true; result.notify_one(); @@ -995,12 +989,7 @@ error_code cellOskDialogExtSetBaseColor(f32 red, f32 green, f32 blue, f32 alpha) } auto& osk = g_fxo->get(); - osk.base_color_red = red; - osk.base_color_green = green; - osk.base_color_blue = blue; - osk.base_color_alpha = alpha; - - // TODO: use osk base color + osk.base_color = OskDialogBase::color{ red, green, blue, alpha }; return CELL_OK; } diff --git a/rpcs3/Emu/Cell/Modules/cellOskDialog.h b/rpcs3/Emu/Cell/Modules/cellOskDialog.h index ca6767bfb7..f26565c7f5 100644 --- a/rpcs3/Emu/Cell/Modules/cellOskDialog.h +++ b/rpcs3/Emu/Cell/Modules/cellOskDialog.h @@ -253,7 +253,15 @@ enum class OskDialogState class OskDialogBase { public: - virtual void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel) = 0; + struct color + { + f32 r = 1.0f; + f32 g = 1.0f; + f32 b = 1.0f; + f32 a = 1.0f; + }; + + virtual void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color) = 0; // Closes the dialog. // Set status to CELL_OSKDIALOG_CLOSE_CONFIRM or CELL_OSKDIALOG_CLOSE_CANCEL for user input. diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp index d3fe9e2b47..31edc1a172 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.cpp @@ -267,10 +267,8 @@ namespace rsx m_background.set_size(1280, 720); m_background.back_color.a = 0.8f; - m_frame.back_color = { 0.2f, 0.2f, 0.2f, 1.f }; - m_title.set_unicode_text(title); - m_title.back_color.a = 0.f; + m_title.back_color.a = 0.7f; // Uses the dimmed color of the frame background m_preview.password_mode = m_password_mode; m_preview.set_placeholder(get_placeholder()); @@ -946,11 +944,15 @@ namespace rsx static constexpr auto thread_name = "OSK Thread"sv; }; - void osk_dialog::Create(const std::string& /*title*/, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel) + void osk_dialog::Create(const std::string& /*title*/, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color) { state = OskDialogState::Open; flags = prohibit_flags; char_limit = charlimit; + m_frame.back_color.r = base_color.r; + m_frame.back_color.g = base_color.g; + m_frame.back_color.b = base_color.b; + m_frame.back_color.a = base_color.a; const callback_t shift_cb = [this](const std::u32string& text){ on_shift(text); }; const callback_t layer_cb = [this](const std::u32string& text){ on_layer(text); }; diff --git a/rpcs3/Emu/RSX/Overlays/overlay_osk.h b/rpcs3/Emu/RSX/Overlays/overlay_osk.h index ea6cc1bb7e..ddf6351d01 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_osk.h +++ b/rpcs3/Emu/RSX/Overlays/overlay_osk.h @@ -82,7 +82,7 @@ namespace rsx osk_dialog(); ~osk_dialog() override = default; - void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel) override; + void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color) override; void Close(s32 status) override; void initialize_layout(const std::u32string& title, const std::u32string& initial_text); diff --git a/rpcs3/rpcs3qt/osk_dialog_frame.cpp b/rpcs3/rpcs3qt/osk_dialog_frame.cpp index cbe1081a48..b5a73cfe83 100644 --- a/rpcs3/rpcs3qt/osk_dialog_frame.cpp +++ b/rpcs3/rpcs3qt/osk_dialog_frame.cpp @@ -22,7 +22,7 @@ osk_dialog_frame::~osk_dialog_frame() } } -void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 /*first_view_panel*/) +void osk_dialog_frame::Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 /*first_view_panel*/, color /*base_color*/) { state = OskDialogState::Open; diff --git a/rpcs3/rpcs3qt/osk_dialog_frame.h b/rpcs3/rpcs3qt/osk_dialog_frame.h index 3beb4c67d1..1003aa030a 100644 --- a/rpcs3/rpcs3qt/osk_dialog_frame.h +++ b/rpcs3/rpcs3qt/osk_dialog_frame.h @@ -16,7 +16,7 @@ class osk_dialog_frame : public QObject, public OskDialogBase public: osk_dialog_frame() = default; ~osk_dialog_frame(); - void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel) override; + void Create(const std::string& title, const std::u16string& message, char16_t* init_text, u32 charlimit, u32 prohibit_flags, u32 panel_flag, u32 first_view_panel, color base_color) override; void Close(s32 status) override; private: