rsx/overlays: Add a name to the input thread context

This commit is contained in:
kd-11 2023-02-14 02:41:26 +03:00 committed by kd-11
parent aabd388070
commit d320867569
6 changed files with 10 additions and 6 deletions

View File

@ -165,7 +165,7 @@ namespace rsx
auto& overlayman = g_fxo->get<display_manager>(); auto& overlayman = g_fxo->get<display_manager>();
overlayman.attach_thread_input( overlayman.attach_thread_input(
uid, uid, "Home menu",
[&notify]() { *notify = true; notify->notify_one(); } [&notify]() { *notify = true; notify->notify_one(); }
); );

View File

@ -151,6 +151,7 @@ namespace rsx
void display_manager::attach_thread_input( void display_manager::attach_thread_input(
u32 uid, u32 uid,
const std::string_view& name,
std::function<void()> on_input_loop_enter, std::function<void()> on_input_loop_enter,
std::function<void(s32)> on_input_loop_exit, std::function<void(s32)> on_input_loop_exit,
std::function<s32()> input_loop_override) std::function<s32()> input_loop_override)
@ -158,6 +159,7 @@ namespace rsx
if (auto iface = std::dynamic_pointer_cast<user_interface>(get(uid))) if (auto iface = std::dynamic_pointer_cast<user_interface>(get(uid)))
{ {
m_input_token_stack.push( m_input_token_stack.push(
name,
std::move(iface), std::move(iface),
on_input_loop_enter, on_input_loop_enter,
on_input_loop_exit, on_input_loop_exit,
@ -209,7 +211,7 @@ namespace rsx
} }
else if (result && result != user_interface::selection_code::canceled) else if (result && result != user_interface::selection_code::canceled)
{ {
rsx_log.error("Input loop exited with error code=%d", result); rsx_log.error("%s exited with error code=%d", input_context.name, result);
} }
} }

View File

@ -157,6 +157,7 @@ namespace rsx
// Enable input thread attach to the specified interface // Enable input thread attach to the specified interface
void attach_thread_input( void attach_thread_input(
u32 uid, // The input target u32 uid, // The input target
const std::string_view& name, // The name of the target
std::function<void()> on_input_loop_enter = nullptr, // [optional] What to do before running the input routine std::function<void()> on_input_loop_enter = nullptr, // [optional] What to do before running the input routine
std::function<void(s32)> on_input_loop_exit = nullptr, // [optional] What to do with the result if any std::function<void(s32)> on_input_loop_exit = nullptr, // [optional] What to do with the result if any
std::function<s32()> input_loop_override = nullptr); // [optional] What to do during the input loop. By default calls user_interface::run_input_loop std::function<s32()> input_loop_override = nullptr); // [optional] What to do during the input loop. By default calls user_interface::run_input_loop
@ -169,6 +170,7 @@ namespace rsx
struct input_thread_context_t struct input_thread_context_t
{ {
std::string_view name;
std::shared_ptr<user_interface> target; std::shared_ptr<user_interface> target;
std::function<void()> input_loop_prologue = nullptr; std::function<void()> input_loop_prologue = nullptr;
std::function<void(s32)> input_loop_epilogue = nullptr; std::function<void(s32)> input_loop_epilogue = nullptr;

View File

@ -303,14 +303,14 @@ namespace rsx
if (interactive) if (interactive)
{ {
overlayman.attach_thread_input( overlayman.attach_thread_input(
uid, uid, "Message dialog",
[&notify]() { *notify = true; notify->notify_one(); } [&notify]() { *notify = true; notify->notify_one(); }
); );
} }
else else
{ {
overlayman.attach_thread_input( overlayman.attach_thread_input(
uid, uid, "Message dialog",
[&notify]() { *notify = true; notify->notify_one(); }, [&notify]() { *notify = true; notify->notify_one(); },
nullptr, nullptr,
[&]() [&]()

View File

@ -1624,7 +1624,7 @@ namespace rsx
auto& overlayman = g_fxo->get<display_manager>(); auto& overlayman = g_fxo->get<display_manager>();
overlayman.attach_thread_input( overlayman.attach_thread_input(
uid, uid, "OSK",
[&notify]() { *notify = true; notify->notify_one(); } [&notify]() { *notify = true; notify->notify_one(); }
); );

View File

@ -243,7 +243,7 @@ namespace rsx
auto& overlayman = g_fxo->get<display_manager>(); auto& overlayman = g_fxo->get<display_manager>();
overlayman.attach_thread_input( overlayman.attach_thread_input(
uid, uid, "User list dialog",
[&notify]() { *notify = true; notify->notify_one(); } [&notify]() { *notify = true; notify->notify_one(); }
); );