mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-11 06:40:39 +00:00
cellOskDialog: add event_hook_callback logging
And refactor the callback a bit
This commit is contained in:
parent
5fad7e1b87
commit
a1abc79f28
@ -342,6 +342,17 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||
{
|
||||
const auto osk = wptr.lock();
|
||||
auto& info = g_fxo->get<osk_info>();
|
||||
std::lock_guard lock(info.text_mtx);
|
||||
auto event_hook_callback = info.osk_hardware_keyboard_event_hook_callback.load();
|
||||
|
||||
cellOskDialog.notice("on_osk_key_input_entered: led=%d, mkey=%d, keycode=%d, hook_event_mode=%d, event_hook_callback=*0x%x", key_message.led, key_message.mkey, key_message.keycode, info.hook_event_mode.load(), event_hook_callback);
|
||||
|
||||
if (!event_hook_callback)
|
||||
{
|
||||
// Nothing to do here
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_kook_key = false;
|
||||
|
||||
switch (key_message.keycode)
|
||||
@ -402,10 +413,11 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||
}
|
||||
|
||||
if (!is_kook_key)
|
||||
return;
|
||||
|
||||
if (auto ccb = info.osk_hardware_keyboard_event_hook_callback.load())
|
||||
{
|
||||
cellOskDialog.notice("on_osk_key_input_entered: not a hook key: led=%d, mkey=%d, keycode=%d, hook_event_mode=%d", key_message.led, key_message.mkey, key_message.keycode, info.hook_event_mode.load());
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr u32 max_size = 101;
|
||||
std::vector<u16> string_to_send(max_size, 0);
|
||||
atomic_t<bool> done = false;
|
||||
@ -422,14 +434,29 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||
vm::var<u32> action(CELL_OSKDIALOG_CHANGE_NO_EVENT);
|
||||
vm::var<u16[], vm::page_allocator<>> pActionInfo(max_size, string_to_send.data());
|
||||
|
||||
const bool return_value = ccb(cb_ppu, keyMessage, action, pActionInfo.begin());
|
||||
cellOskDialog.warning("osk_hardware_keyboard_event_hook_callback: return_value=%d, action=%d)", return_value, action.get_ptr() ? static_cast<u32>(*action) : 0);
|
||||
std::u16string utf16_string;
|
||||
utf16_string.insert(0, reinterpret_cast<char16_t*>(string_to_send.data()), string_to_send.size());
|
||||
std::string action_info = utf16_to_ascii8(utf16_string);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback(led=%d, mkey=%d, keycode=%d, action=%d, pActionInfo='%s')", keyMessage->led, keyMessage->mkey, keyMessage->keycode, *action, action_info);
|
||||
|
||||
const bool return_value = event_hook_callback(cb_ppu, keyMessage, action, pActionInfo.begin());
|
||||
ensure(action);
|
||||
ensure(pActionInfo);
|
||||
|
||||
utf16_string.clear();
|
||||
for (u32 i = 0; i < max_size; i++)
|
||||
{
|
||||
const u16 code = pActionInfo[i];
|
||||
if (!code) break;
|
||||
utf16_string.push_back(code);
|
||||
}
|
||||
action_info = utf16_to_ascii8(utf16_string);
|
||||
|
||||
cellOskDialog.notice("osk_hardware_keyboard_event_hook_callback: return_value=%d, action=%d, pActionInfo='%s'", return_value, *action, action_info);
|
||||
|
||||
if (return_value)
|
||||
{
|
||||
switch (*action)
|
||||
{
|
||||
case CELL_OSKDIALOG_CHANGE_NO_EVENT:
|
||||
@ -484,7 +511,6 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||
{
|
||||
std::this_thread::yield();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Set device mask and event lock
|
||||
|
Loading…
x
Reference in New Issue
Block a user