cellOskDialog: implement dimmer_enabled

This commit is contained in:
Megamouse 2022-04-20 18:42:32 +02:00
parent 918984ee64
commit 8864f944e2
6 changed files with 15 additions and 17 deletions

View File

@ -507,7 +507,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
Emu.CallFromMainThread([=, &result, &info]()
{
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel, info.base_color.load());
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel, info.base_color.load(), info.dimmer_enabled.load());
result = true;
result.notify_one();
@ -698,7 +698,7 @@ error_code cellOskDialogAbort()
error_code cellOskDialogSetDeviceMask(u32 deviceMask)
{
cellOskDialog.todo("cellOskDialogSetDeviceMask(deviceMask=0x%x)", deviceMask);
cellOskDialog.warning("cellOskDialogSetDeviceMask(deviceMask=0x%x)", deviceMask);
// TODO: It might also return an error if use_separate_windows is not enabled
if (deviceMask > CELL_OSKDIALOG_DEVICE_MASK_PAD)
@ -782,12 +782,10 @@ error_code cellOskDialogSetInitialKeyLayout(u32 initialKeyLayout)
error_code cellOskDialogDisableDimmer()
{
cellOskDialog.todo("cellOskDialogDisableDimmer()");
cellOskDialog.warning("cellOskDialogDisableDimmer()");
g_fxo->get<osk_info>().dimmer_enabled = false;
// TODO: use value
return CELL_OK;
}
@ -852,7 +850,7 @@ error_code cellOskDialogGetInputText(vm::ptr<CellOskDialogCallbackReturnParam> O
error_code register_keyboard_event_hook_callback(u16 hookEventMode, vm::ptr<cellOskDialogHardwareKeyboardEventHookCallback> pCallback)
{
cellOskDialog.todo("register_keyboard_event_hook_callback(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
cellOskDialog.warning("register_keyboard_event_hook_callback(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
if (!pCallback)
{
@ -867,7 +865,7 @@ error_code register_keyboard_event_hook_callback(u16 hookEventMode, vm::ptr<cell
error_code cellOskDialogExtRegisterKeyboardEventHookCallback(u16 hookEventMode, vm::ptr<cellOskDialogHardwareKeyboardEventHookCallback> pCallback)
{
cellOskDialog.todo("cellOskDialogExtRegisterKeyboardEventHookCallback(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
cellOskDialog.warning("cellOskDialogExtRegisterKeyboardEventHookCallback(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
if (hookEventMode == 0 || hookEventMode > (CELL_OSKDIALOG_EVENT_HOOK_TYPE_FUNCTION_KEY | CELL_OSKDIALOG_EVENT_HOOK_TYPE_ASCII_KEY))
{
@ -879,7 +877,7 @@ error_code cellOskDialogExtRegisterKeyboardEventHookCallback(u16 hookEventMode,
error_code cellOskDialogExtRegisterKeyboardEventHookCallbackEx(u16 hookEventMode, vm::ptr<cellOskDialogHardwareKeyboardEventHookCallback> pCallback)
{
cellOskDialog.todo("cellOskDialogExtRegisterKeyboardEventHookCallbackEx(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
cellOskDialog.warning("cellOskDialogExtRegisterKeyboardEventHookCallbackEx(hookEventMode=%u, pCallback=*0x%x)", hookEventMode, pCallback);
if (hookEventMode == 0 || hookEventMode > (CELL_OSKDIALOG_EVENT_HOOK_TYPE_FUNCTION_KEY | CELL_OSKDIALOG_EVENT_HOOK_TYPE_ASCII_KEY | CELL_OSKDIALOG_EVENT_HOOK_TYPE_ONLY_MODIFIER))
{
@ -949,7 +947,7 @@ error_code cellOskDialogExtSetInitialScale(f32 initialScale)
error_code cellOskDialogExtInputDeviceLock()
{
cellOskDialog.todo("cellOskDialogExtInputDeviceLock()");
cellOskDialog.warning("cellOskDialogExtInputDeviceLock()");
// TODO: error checks
@ -965,7 +963,7 @@ error_code cellOskDialogExtInputDeviceLock()
error_code cellOskDialogExtInputDeviceUnlock()
{
cellOskDialog.todo("cellOskDialogExtInputDeviceUnlock()");
cellOskDialog.warning("cellOskDialogExtInputDeviceUnlock()");
// TODO: error checks
@ -981,7 +979,7 @@ error_code cellOskDialogExtInputDeviceUnlock()
error_code cellOskDialogExtSetBaseColor(f32 red, f32 green, f32 blue, f32 alpha)
{
cellOskDialog.todo("cellOskDialogExtSetBaseColor(red=%f, blue=%f, green=%f, alpha=%f)", red, blue, green, alpha);
cellOskDialog.warning("cellOskDialogExtSetBaseColor(red=%f, blue=%f, green=%f, alpha=%f)", red, blue, green, alpha);
if (red < 0.0f || red > 1.0f || green < 0.0f || green > 1.0f || blue < 0.0f || blue > 1.0f || alpha < 0.0f || alpha > 1.0f)
{

View File

@ -261,7 +261,7 @@ public:
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;
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, bool dimmer_enabled) = 0;
// Closes the dialog.
// Set status to CELL_OSKDIALOG_CLOSE_CONFIRM or CELL_OSKDIALOG_CLOSE_CANCEL for user input.

View File

@ -265,7 +265,6 @@ namespace rsx
void osk_dialog::initialize_layout(const std::u32string& title, const std::u32string& initial_text)
{
m_background.set_size(1280, 720);
m_background.back_color.a = 0.8f;
m_title.set_unicode_text(title);
m_title.back_color.a = 0.7f; // Uses the dimmed color of the frame background
@ -944,7 +943,7 @@ 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, color base_color)
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, bool dimmer_enabled)
{
state = OskDialogState::Open;
flags = prohibit_flags;
@ -953,6 +952,7 @@ namespace rsx
m_frame.back_color.g = base_color.g;
m_frame.back_color.b = base_color.b;
m_frame.back_color.a = base_color.a;
m_background.back_color.a = dimmer_enabled ? 0.8f : 0.0f;
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); };

View File

@ -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, color base_color) 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, bool dimmer_enabled) override;
void Close(s32 status) override;
void initialize_layout(const std::u32string& title, const std::u32string& initial_text);

View File

@ -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*/, color /*base_color*/)
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*/, bool /*dimmer_enabled*/)
{
state = OskDialogState::Open;

View File

@ -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, color base_color) 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, bool dimmer_enabled) override;
void Close(s32 status) override;
private: