2020-12-05 13:08:24 +01:00
|
|
|
#include "stdafx.h"
|
2020-10-04 22:46:28 +02:00
|
|
|
#include "interception.h"
|
|
|
|
|
#include "KeyboardHandler.h"
|
|
|
|
|
#include "MouseHandler.h"
|
|
|
|
|
#include "Input/pad_thread.h"
|
|
|
|
|
#include "Emu/IdManager.h"
|
|
|
|
|
|
|
|
|
|
namespace input
|
|
|
|
|
{
|
2022-04-19 20:27:32 +02:00
|
|
|
atomic_t<bool> g_pads_intercepted{false};
|
|
|
|
|
atomic_t<bool> g_keyboards_intercepted{false};
|
|
|
|
|
atomic_t<bool> g_mice_intercepted{false};
|
2020-10-04 22:46:28 +02:00
|
|
|
|
2022-04-19 20:27:32 +02:00
|
|
|
void SetIntercepted(bool pads_intercepted, bool keyboards_intercepted, bool mice_intercepted)
|
2020-10-04 22:46:28 +02:00
|
|
|
{
|
2022-04-19 20:27:32 +02:00
|
|
|
g_pads_intercepted = pads_intercepted;
|
|
|
|
|
g_keyboards_intercepted = keyboards_intercepted;
|
|
|
|
|
g_mice_intercepted = mice_intercepted;
|
2020-10-04 22:46:28 +02:00
|
|
|
|
2022-04-19 20:27:32 +02:00
|
|
|
pad::SetIntercepted(pads_intercepted);
|
2020-10-04 22:46:28 +02:00
|
|
|
|
2021-02-03 19:14:31 +01:00
|
|
|
if (const auto handler = g_fxo->try_get<KeyboardHandlerBase>())
|
2020-10-04 22:46:28 +02:00
|
|
|
{
|
2022-04-19 20:27:32 +02:00
|
|
|
handler->SetIntercepted(keyboards_intercepted);
|
2020-10-04 22:46:28 +02:00
|
|
|
}
|
|
|
|
|
|
2021-02-03 19:14:31 +01:00
|
|
|
if (const auto handler = g_fxo->try_get<MouseHandlerBase>())
|
2020-10-04 22:46:28 +02:00
|
|
|
{
|
2022-04-19 20:27:32 +02:00
|
|
|
handler->SetIntercepted(mice_intercepted);
|
2020-10-04 22:46:28 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-04-19 20:27:32 +02:00
|
|
|
|
|
|
|
|
void SetIntercepted(bool all_intercepted)
|
|
|
|
|
{
|
|
|
|
|
SetIntercepted(all_intercepted, all_intercepted, all_intercepted);
|
|
|
|
|
}
|
2020-10-04 22:46:28 +02:00
|
|
|
}
|