mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
overlays/osk: implement first osk pointer
This commit is contained in:
parent
4a82d81efe
commit
f659338e5e
5 changed files with 48 additions and 11 deletions
|
@ -51,6 +51,10 @@ void fmt_class_string<CellOskDialogContinuousMode>::format(std::string& out, u64
|
|||
});
|
||||
}
|
||||
|
||||
atomic_t<bool> g_osk_pointer_enabled = false;
|
||||
atomic_t<f32> g_osk_pointer_x = 0.0f;
|
||||
atomic_t<f32> g_osk_pointer_y = 0.0f;
|
||||
|
||||
OskDialogBase::~OskDialogBase()
|
||||
{
|
||||
}
|
||||
|
@ -535,6 +539,11 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
|||
|
||||
Emu.BlockingCallFromMainThread([=, &info]()
|
||||
{
|
||||
// Make sure to always have the latest pointer params
|
||||
g_osk_pointer_enabled = info.pointer_enabled.load();
|
||||
g_osk_pointer_x = info.pointer_pos.x;
|
||||
g_osk_pointer_y = info.pointer_pos.y;
|
||||
|
||||
osk->Create({
|
||||
.title = get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE),
|
||||
.message = message,
|
||||
|
@ -802,7 +811,7 @@ error_code cellOskDialogSetInitialInputDevice(u32 inputDevice)
|
|||
|
||||
error_code cellOskDialogSetInitialKeyLayout(u32 initialKeyLayout)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogSetInitialKeyLayout(initialKeyLayout=%d)", initialKeyLayout);
|
||||
cellOskDialog.warning("cellOskDialogSetInitialKeyLayout(initialKeyLayout=%d)", initialKeyLayout);
|
||||
|
||||
if (initialKeyLayout > CELL_OSKDIALOG_INITIAL_PANEL_LAYOUT_FULLKEY)
|
||||
{
|
||||
|
@ -830,7 +839,7 @@ error_code cellOskDialogDisableDimmer()
|
|||
|
||||
error_code cellOskDialogSetKeyLayoutOption(u32 option)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogSetKeyLayoutOption(option=0x%x)", option);
|
||||
cellOskDialog.warning("cellOskDialogSetKeyLayoutOption(option=0x%x)", option);
|
||||
|
||||
if (option == 0 || option > 3) // CELL_OSKDIALOG_10KEY_PANEL OR CELL_OSKDIALOG_FULLKEY_PANEL
|
||||
{
|
||||
|
@ -844,7 +853,7 @@ error_code cellOskDialogSetKeyLayoutOption(u32 option)
|
|||
|
||||
error_code cellOskDialogAddSupportLanguage(u32 supportLanguage)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogAddSupportLanguage(supportLanguage=0x%x)", supportLanguage);
|
||||
cellOskDialog.warning("cellOskDialogAddSupportLanguage(supportLanguage=0x%x)", supportLanguage);
|
||||
|
||||
// TODO: error checks
|
||||
|
||||
|
@ -855,7 +864,7 @@ error_code cellOskDialogAddSupportLanguage(u32 supportLanguage)
|
|||
|
||||
error_code cellOskDialogSetLayoutMode(s32 layoutMode)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogSetLayoutMode(layoutMode=0x%x)", layoutMode);
|
||||
cellOskDialog.warning("cellOskDialogSetLayoutMode(layoutMode=0x%x)", layoutMode);
|
||||
|
||||
// TODO: error checks
|
||||
|
||||
|
@ -985,7 +994,7 @@ error_code cellOskDialogExtAddOptionDictionary(vm::cptr<CellOskDialogImeDictiona
|
|||
|
||||
error_code cellOskDialogExtSetInitialScale(f32 initialScale)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogExtSetInitialScale(initialScale=%f)", initialScale);
|
||||
cellOskDialog.warning("cellOskDialogExtSetInitialScale(initialScale=%f)", initialScale);
|
||||
|
||||
if (initialScale < CELL_OSKDIALOG_SCALE_MIN || initialScale > CELL_OSKDIALOG_SCALE_MAX)
|
||||
{
|
||||
|
@ -1087,30 +1096,29 @@ error_code cellOskDialogExtUpdateInputText()
|
|||
|
||||
error_code cellOskDialogExtSetPointerEnable(b8 enable)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogExtSetPointerEnable(enable=%d)", enable);
|
||||
cellOskDialog.warning("cellOskDialogExtSetPointerEnable(enable=%d)", enable);
|
||||
|
||||
// TODO: error checks
|
||||
|
||||
g_fxo->get<osk_info>().pointer_enabled = enable;
|
||||
|
||||
// TODO: Show/hide pointer at the specified position in the OSK overlay.
|
||||
g_osk_pointer_enabled = enable;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellOskDialogExtUpdatePointerDisplayPos(vm::cptr<CellOskDialogPoint> pos)
|
||||
{
|
||||
cellOskDialog.todo("cellOskDialogExtUpdatePointerDisplayPos(pos=0x%x, posX=%f, posY=%f)", pos->x, pos->y);
|
||||
cellOskDialog.warning("cellOskDialogExtUpdatePointerDisplayPos(pos=0x%x, posX=%f, posY=%f)", pos->x, pos->y);
|
||||
|
||||
// TODO: error checks
|
||||
|
||||
if (pos)
|
||||
{
|
||||
g_fxo->get<osk_info>().pointer_pos = *pos;
|
||||
g_osk_pointer_x = pos->x;
|
||||
g_osk_pointer_y = pos->y;
|
||||
}
|
||||
|
||||
// TODO: Update pointer position in the OSK overlay.
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,11 @@ namespace rsx
|
|||
return m_visible;
|
||||
}
|
||||
|
||||
bool cursor_item::visible() const
|
||||
{
|
||||
return m_visible;
|
||||
}
|
||||
|
||||
compiled_resource cursor_item::get_compiled()
|
||||
{
|
||||
if (!m_visible)
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace rsx
|
|||
bool set_color(color4f color);
|
||||
|
||||
bool update_visibility(u64 time);
|
||||
bool visible() const;
|
||||
|
||||
compiled_resource get_compiled();
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
|
||||
LOG_CHANNEL(osk, "OSK");
|
||||
|
||||
extern atomic_t<bool> g_osk_pointer_enabled;
|
||||
extern atomic_t<f32> g_osk_pointer_x;
|
||||
extern atomic_t<f32> g_osk_pointer_y;
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
namespace overlays
|
||||
|
@ -304,6 +308,8 @@ namespace rsx
|
|||
}
|
||||
};
|
||||
|
||||
m_pointer.set_color(color4f{ 1.f, 1.f, 1.f, 1.f });
|
||||
|
||||
m_background.set_size(virtual_width, virtual_height);
|
||||
|
||||
m_title.set_unicode_text(title);
|
||||
|
@ -876,6 +882,18 @@ namespace rsx
|
|||
fade_animation.update(rsx::get_current_renderer()->vblank_count);
|
||||
m_update = true;
|
||||
}
|
||||
|
||||
if (g_osk_pointer_enabled != m_pointer.visible())
|
||||
{
|
||||
m_pointer.set_expiration(g_osk_pointer_enabled ? u64{umax} : 0);
|
||||
m_pointer.update_visibility(get_system_time());
|
||||
m_update = true;
|
||||
}
|
||||
|
||||
if (m_pointer.visible() && m_pointer.set_position(static_cast<u16>(g_osk_pointer_x), static_cast<u16>(g_osk_pointer_y)))
|
||||
{
|
||||
m_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
compiled_resource osk_dialog::get_compiled()
|
||||
|
@ -995,6 +1013,7 @@ namespace rsx
|
|||
}
|
||||
}
|
||||
|
||||
m_cached_resource.add(m_pointer.get_compiled());
|
||||
m_reset_pulse = false;
|
||||
m_update = false;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "overlays.h"
|
||||
#include "overlay_edit_text.hpp"
|
||||
#include "overlay_cursor.h"
|
||||
#include "overlay_osk_panel.h"
|
||||
#include "Emu/Cell/Modules/cellOskDialog.h"
|
||||
|
||||
|
@ -51,6 +52,9 @@ namespace rsx
|
|||
image_button m_btn_space;
|
||||
image_button m_btn_delete;
|
||||
|
||||
// Pointer
|
||||
cursor_item m_pointer{};
|
||||
|
||||
// Grid
|
||||
u16 cell_size_x = 0;
|
||||
u16 cell_size_y = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue