mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 23:11:25 +12:00
Use g_fxo for cellKb, cellMouse
Use init_mutex
This commit is contained in:
parent
17d764409e
commit
4b19e55fcc
7 changed files with 108 additions and 69 deletions
|
@ -33,15 +33,16 @@ error_code cellKbInit(u32 max_connect)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellKbInit(max_connect=%d)", max_connect);
|
sys_io.warning("cellKbInit(max_connect=%d)", max_connect);
|
||||||
|
|
||||||
auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (handler)
|
const auto init = handler->init.init();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_ALREADY_INITIALIZED;
|
return CELL_KB_ERROR_ALREADY_INITIALIZED;
|
||||||
|
|
||||||
if (max_connect == 0 || max_connect > CELL_KB_MAX_KEYBOARDS)
|
if (max_connect == 0 || max_connect > CELL_KB_MAX_KEYBOARDS)
|
||||||
return CELL_KB_ERROR_INVALID_PARAMETER;
|
return CELL_KB_ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
handler = fxm::import<KeyboardHandlerBase>(Emu.GetCallbacks().get_kb_handler);
|
|
||||||
handler->Init(std::min(max_connect, 7u));
|
handler->Init(std::min(max_connect, 7u));
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -51,9 +52,14 @@ error_code cellKbEnd()
|
||||||
{
|
{
|
||||||
sys_io.notice("cellKbEnd()");
|
sys_io.notice("cellKbEnd()");
|
||||||
|
|
||||||
if (!fxm::remove<KeyboardHandlerBase>())
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
|
const auto init = handler->init.reset();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
// TODO
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +67,11 @@ error_code cellKbClearBuf(u32 port_no)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbClearBuf(port_no=%d)", port_no);
|
sys_io.trace("cellKbClearBuf(port_no=%d)", port_no);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
||||||
|
@ -233,9 +241,11 @@ error_code cellKbGetInfo(vm::ptr<CellKbInfo> info)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbGetInfo(info=*0x%x)", info);
|
sys_io.trace("cellKbGetInfo(info=*0x%x)", info);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
|
@ -260,9 +270,11 @@ error_code cellKbRead(u32 port_no, vm::ptr<CellKbData> data)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbRead(port_no=%d, data=*0x%x)", port_no, data);
|
sys_io.trace("cellKbRead(port_no=%d, data=*0x%x)", port_no, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS || !data)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS || !data)
|
||||||
|
@ -292,9 +304,11 @@ error_code cellKbSetCodeType(u32 port_no, u32 type)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbSetCodeType(port_no=%d, type=%d)", port_no, type);
|
sys_io.trace("cellKbSetCodeType(port_no=%d, type=%d)", port_no, type);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS || type > CELL_KB_CODETYPE_ASCII)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS || type > CELL_KB_CODETYPE_ASCII)
|
||||||
|
@ -317,9 +331,11 @@ error_code cellKbSetLEDStatus(u32 port_no, u8 led)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbSetLEDStatus(port_no=%d, led=%d)", port_no, led);
|
sys_io.trace("cellKbSetLEDStatus(port_no=%d, led=%d)", port_no, led);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
||||||
|
@ -343,9 +359,11 @@ error_code cellKbSetReadMode(u32 port_no, u32 rmode)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbSetReadMode(port_no=%d, rmode=%d)", port_no, rmode);
|
sys_io.trace("cellKbSetReadMode(port_no=%d, rmode=%d)", port_no, rmode);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS || rmode > CELL_KB_RMODE_PACKET)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS || rmode > CELL_KB_RMODE_PACKET)
|
||||||
|
@ -368,9 +386,11 @@ error_code cellKbGetConfiguration(u32 port_no, vm::ptr<CellKbConfig> config)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellKbGetConfiguration(port_no=%d, config=*0x%x)", port_no, config);
|
sys_io.trace("cellKbGetConfiguration(port_no=%d, config=*0x%x)", port_no, config);
|
||||||
|
|
||||||
const auto handler = fxm::get<KeyboardHandlerBase>();
|
const auto handler = g_fxo->get<KeyboardHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
return CELL_KB_ERROR_UNINITIALIZED;
|
return CELL_KB_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
if (port_no >= CELL_KB_MAX_KEYBOARDS)
|
||||||
|
|
|
@ -34,19 +34,18 @@ error_code cellMouseInit(u32 max_connect)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellMouseInit(max_connect=%d)", max_connect);
|
sys_io.warning("cellMouseInit(max_connect=%d)", max_connect);
|
||||||
|
|
||||||
auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (handler)
|
const auto init = handler->init.init();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
|
return CELL_MOUSE_ERROR_ALREADY_INITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (max_connect == 0 || max_connect > CELL_MAX_MICE)
|
if (max_connect == 0 || max_connect > CELL_MAX_MICE)
|
||||||
{
|
{
|
||||||
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
return CELL_MOUSE_ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
handler = fxm::import<MouseHandlerBase>(Emu.GetCallbacks().get_mouse_handler);
|
|
||||||
handler->Init(std::min(max_connect, 7u));
|
handler->Init(std::min(max_connect, 7u));
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -56,12 +55,12 @@ error_code cellMouseClearBuf(u32 port_no)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellMouseClearBuf(port_no=%d)", port_no);
|
sys_io.trace("cellMouseClearBuf(port_no=%d)", port_no);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_MICE)
|
if (port_no >= CELL_MAX_MICE)
|
||||||
{
|
{
|
||||||
|
@ -93,11 +92,14 @@ error_code cellMouseEnd()
|
||||||
{
|
{
|
||||||
sys_io.notice("cellMouseEnd()");
|
sys_io.notice("cellMouseEnd()");
|
||||||
|
|
||||||
if (!fxm::remove<MouseHandlerBase>())
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
{
|
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
const auto init = handler->init.reset();
|
||||||
|
|
||||||
|
if (!init)
|
||||||
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
|
|
||||||
|
// TODO
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,12 +107,12 @@ error_code cellMouseGetInfo(vm::ptr<CellMouseInfo> info)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellMouseGetInfo(info=*0x%x)", info);
|
sys_io.trace("cellMouseGetInfo(info=*0x%x)", info);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (!info)
|
if (!info)
|
||||||
{
|
{
|
||||||
|
@ -132,12 +134,12 @@ error_code cellMouseInfoTabletMode(u32 port_no, vm::ptr<CellMouseInfoTablet> inf
|
||||||
{
|
{
|
||||||
sys_io.trace("cellMouseInfoTabletMode(port_no=%d, info=*0x%x)", port_no, info);
|
sys_io.trace("cellMouseInfoTabletMode(port_no=%d, info=*0x%x)", port_no, info);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
// only check for port_no here. Tests show that valid ports lead to ERROR_FATAL with disconnected devices regardless of info
|
// only check for port_no here. Tests show that valid ports lead to ERROR_FATAL with disconnected devices regardless of info
|
||||||
if (port_no >= CELL_MAX_MICE)
|
if (port_no >= CELL_MAX_MICE)
|
||||||
|
@ -169,12 +171,12 @@ error_code cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data)
|
||||||
{
|
{
|
||||||
sys_io.trace("cellMouseGetData(port_no=%d, data=*0x%x)", port_no, data);
|
sys_io.trace("cellMouseGetData(port_no=%d, data=*0x%x)", port_no, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_MICE || !data)
|
if (port_no >= CELL_MAX_MICE || !data)
|
||||||
{
|
{
|
||||||
|
@ -217,12 +219,12 @@ error_code cellMouseGetDataList(u32 port_no, vm::ptr<CellMouseDataList> data)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellMouseGetDataList(port_no=%d, data=0x%x)", port_no, data);
|
sys_io.warning("cellMouseGetDataList(port_no=%d, data=0x%x)", port_no, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_MICE || !data)
|
if (port_no >= CELL_MAX_MICE || !data)
|
||||||
{
|
{
|
||||||
|
@ -263,12 +265,12 @@ error_code cellMouseSetTabletMode(u32 port_no, u32 mode)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellMouseSetTabletMode(port_no=%d, mode=%d)", port_no, mode);
|
sys_io.warning("cellMouseSetTabletMode(port_no=%d, mode=%d)", port_no, mode);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
// only check for port_no here. Tests show that valid ports lead to ERROR_FATAL with disconnected devices regardless of info
|
// only check for port_no here. Tests show that valid ports lead to ERROR_FATAL with disconnected devices regardless of info
|
||||||
if (port_no >= CELL_MAX_MICE)
|
if (port_no >= CELL_MAX_MICE)
|
||||||
|
@ -299,12 +301,12 @@ error_code cellMouseGetTabletDataList(u32 port_no, vm::ptr<CellMouseTabletDataLi
|
||||||
{
|
{
|
||||||
sys_io.warning("cellMouseGetTabletDataList(port_no=%d, data=0x%x)", port_no, data);
|
sys_io.warning("cellMouseGetTabletDataList(port_no=%d, data=0x%x)", port_no, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_MICE || !data)
|
if (port_no >= CELL_MAX_MICE || !data)
|
||||||
{
|
{
|
||||||
|
@ -344,12 +346,12 @@ error_code cellMouseGetRawData(u32 port_no, vm::ptr<CellMouseRawData> data)
|
||||||
{
|
{
|
||||||
sys_io.warning("cellMouseGetRawData(port_no=%d, data=*0x%x)", port_no, data);
|
sys_io.warning("cellMouseGetRawData(port_no=%d, data=*0x%x)", port_no, data);
|
||||||
|
|
||||||
const auto handler = fxm::get<MouseHandlerBase>();
|
const auto handler = g_fxo->get<MouseHandlerBase>();
|
||||||
|
|
||||||
if (!handler)
|
const auto init = handler->init.access();
|
||||||
{
|
|
||||||
|
if (!init)
|
||||||
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
return CELL_MOUSE_ERROR_UNINITIALIZED;
|
||||||
}
|
|
||||||
|
|
||||||
if (port_no >= CELL_MAX_MICE || !data)
|
if (port_no >= CELL_MAX_MICE || !data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
|
#include "util/init_mutex.hpp"
|
||||||
|
|
||||||
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); // (TODO: Can it be problematic to place SysCalls in middle of nowhere?)
|
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); // (TODO: Can it be problematic to place SysCalls in middle of nowhere?)
|
||||||
|
|
||||||
enum QtKeys
|
enum QtKeys
|
||||||
|
@ -107,4 +109,6 @@ public:
|
||||||
std::vector<KbButton>& GetButtons(const u32 keyboard) { return m_keyboards[keyboard].m_buttons; }
|
std::vector<KbButton>& GetButtons(const u32 keyboard) { return m_keyboards[keyboard].m_buttons; }
|
||||||
KbData& GetData(const u32 keyboard) { return m_keyboards[keyboard].m_data; }
|
KbData& GetData(const u32 keyboard) { return m_keyboards[keyboard].m_data; }
|
||||||
KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
|
KbConfig& GetConfig(const u32 keyboard) { return m_keyboards[keyboard].m_config; }
|
||||||
|
|
||||||
|
stx::init_mutex init;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include "Utilities/mutex.h"
|
#include "Utilities/mutex.h"
|
||||||
|
#include "util/init_mutex.hpp"
|
||||||
|
|
||||||
// TODO: HLE info (constants, structs, etc.) should not be available here
|
// TODO: HLE info (constants, structs, etc.) should not be available here
|
||||||
|
|
||||||
|
@ -255,4 +256,6 @@ public:
|
||||||
MouseDataList& GetDataList(const u32 mouse) { return m_mice[mouse].m_datalist; }
|
MouseDataList& GetDataList(const u32 mouse) { return m_mice[mouse].m_datalist; }
|
||||||
MouseTabletDataList& GetTabletDataList(const u32 mouse) { return m_mice[mouse].m_tablet_datalist; }
|
MouseTabletDataList& GetTabletDataList(const u32 mouse) { return m_mice[mouse].m_tablet_datalist; }
|
||||||
MouseRawData& GetRawData(const u32 mouse) { return m_mice[mouse].m_rawdata; }
|
MouseRawData& GetRawData(const u32 mouse) { return m_mice[mouse].m_rawdata; }
|
||||||
|
|
||||||
|
stx::init_mutex init;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1517,6 +1517,8 @@ void Emulator::Load(const std::string& title_id, bool add_only, bool force_globa
|
||||||
g_fxo->init();
|
g_fxo->init();
|
||||||
fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render); // TODO: must be created in appropriate sys_rsx syscall
|
fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render); // TODO: must be created in appropriate sys_rsx syscall
|
||||||
Emu.GetCallbacks().init_pad_handler(m_title_id);
|
Emu.GetCallbacks().init_pad_handler(m_title_id);
|
||||||
|
Emu.GetCallbacks().init_kb_handler();
|
||||||
|
Emu.GetCallbacks().init_mouse_handler();
|
||||||
network_thread_init();
|
network_thread_init();
|
||||||
}
|
}
|
||||||
else if (ppu_prx.open(elf_file) == elf_error::ok)
|
else if (ppu_prx.open(elf_file) == elf_error::ok)
|
||||||
|
|
|
@ -217,8 +217,8 @@ struct EmuCallbacks
|
||||||
std::function<void(const std::string&)> reset_pads;
|
std::function<void(const std::string&)> reset_pads;
|
||||||
std::function<void(bool)> enable_pads;
|
std::function<void(bool)> enable_pads;
|
||||||
std::function<void(s32, s32)> handle_taskbar_progress; // (type, value) type: 0 for reset, 1 for increment, 2 for set_limit
|
std::function<void(s32, s32)> handle_taskbar_progress; // (type, value) type: 0 for reset, 1 for increment, 2 for set_limit
|
||||||
std::function<std::shared_ptr<class KeyboardHandlerBase>()> get_kb_handler;
|
std::function<void()> init_kb_handler;
|
||||||
std::function<std::shared_ptr<class MouseHandlerBase>()> get_mouse_handler;
|
std::function<void()> init_mouse_handler;
|
||||||
std::function<void(std::string_view title_id)> init_pad_handler;
|
std::function<void(std::string_view title_id)> init_pad_handler;
|
||||||
std::function<std::unique_ptr<class GSFrameBase>()> get_gs_frame;
|
std::function<std::unique_ptr<class GSFrameBase>()> get_gs_frame;
|
||||||
std::function<std::shared_ptr<class GSRender>()> get_gs_render;
|
std::function<std::shared_ptr<class GSRender>()> get_gs_render;
|
||||||
|
|
|
@ -71,33 +71,41 @@ EmuCallbacks main_application::CreateCallbacks()
|
||||||
pad::get_current_handler()->SetEnabled(enable);
|
pad::get_current_handler()->SetEnabled(enable);
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.get_kb_handler = [=]() -> std::shared_ptr<KeyboardHandlerBase>
|
callbacks.init_kb_handler = [=]()
|
||||||
{
|
{
|
||||||
switch (keyboard_handler type = g_cfg.io.keyboard)
|
switch (keyboard_handler type = g_cfg.io.keyboard)
|
||||||
{
|
{
|
||||||
case keyboard_handler::null: return std::make_shared<NullKeyboardHandler>();
|
case keyboard_handler::null:
|
||||||
|
{
|
||||||
|
g_fxo->init<KeyboardHandlerBase, NullKeyboardHandler>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case keyboard_handler::basic:
|
case keyboard_handler::basic:
|
||||||
{
|
{
|
||||||
basic_keyboard_handler* ret = new basic_keyboard_handler();
|
basic_keyboard_handler* ret = g_fxo->init<KeyboardHandlerBase, basic_keyboard_handler>();
|
||||||
ret->moveToThread(get_thread());
|
ret->moveToThread(get_thread());
|
||||||
ret->SetTargetWindow(m_game_window);
|
ret->SetTargetWindow(m_game_window);
|
||||||
return std::shared_ptr<KeyboardHandlerBase>(ret);
|
break;
|
||||||
}
|
}
|
||||||
default: fmt::throw_exception("Invalid keyboard handler: %s", type);
|
default: fmt::throw_exception("Invalid keyboard handler: %s", type);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.get_mouse_handler = [=]() -> std::shared_ptr<MouseHandlerBase>
|
callbacks.init_mouse_handler = [=]()
|
||||||
{
|
{
|
||||||
switch (mouse_handler type = g_cfg.io.mouse)
|
switch (mouse_handler type = g_cfg.io.mouse)
|
||||||
{
|
{
|
||||||
case mouse_handler::null: return std::make_shared<NullMouseHandler>();
|
case mouse_handler::null:
|
||||||
|
{
|
||||||
|
g_fxo->init<MouseHandlerBase, NullMouseHandler>();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case mouse_handler::basic:
|
case mouse_handler::basic:
|
||||||
{
|
{
|
||||||
basic_mouse_handler* ret = new basic_mouse_handler();
|
basic_mouse_handler* ret = g_fxo->init<MouseHandlerBase, basic_mouse_handler>();
|
||||||
ret->moveToThread(get_thread());
|
ret->moveToThread(get_thread());
|
||||||
ret->SetTargetWindow(m_game_window);
|
ret->SetTargetWindow(m_game_window);
|
||||||
return std::shared_ptr<MouseHandlerBase>(ret);
|
break;
|
||||||
}
|
}
|
||||||
default: fmt::throw_exception("Invalid mouse handler: %s", type);
|
default: fmt::throw_exception("Invalid mouse handler: %s", type);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue