mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 21:32:50 +00:00
Use g_fxo for pad_handler
This commit is contained in:
parent
3092914527
commit
4bba1e3337
@ -583,9 +583,9 @@ bool Emulator::BootRsxCapture(const std::string& path)
|
|||||||
GetCallbacks().on_ready();
|
GetCallbacks().on_ready();
|
||||||
|
|
||||||
auto gsrender = fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render);
|
auto gsrender = fxm::import<GSRender>(Emu.GetCallbacks().get_gs_render);
|
||||||
auto padhandler = fxm::import<pad_thread>(Emu.GetCallbacks().get_pad_handler, "");
|
Emu.GetCallbacks().init_pad_handler("");
|
||||||
|
|
||||||
if (gsrender.get() == nullptr || padhandler.get() == nullptr)
|
if (gsrender.get() == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GetCallbacks().on_run();
|
GetCallbacks().on_run();
|
||||||
@ -1516,7 +1516,7 @@ 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
|
||||||
fxm::import<pad_thread>(Emu.GetCallbacks().get_pad_handler, m_title_id);
|
Emu.GetCallbacks().init_pad_handler(m_title_id);
|
||||||
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)
|
||||||
|
@ -219,7 +219,7 @@ struct EmuCallbacks
|
|||||||
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<std::shared_ptr<class KeyboardHandlerBase>()> get_kb_handler;
|
||||||
std::function<std::shared_ptr<class MouseHandlerBase>()> get_mouse_handler;
|
std::function<std::shared_ptr<class MouseHandlerBase>()> get_mouse_handler;
|
||||||
std::function<std::shared_ptr<class pad_thread>(const std::string&)> get_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;
|
||||||
std::function<std::shared_ptr<class AudioBackend>()> get_audio;
|
std::function<std::shared_ptr<class AudioBackend>()> get_audio;
|
||||||
|
@ -103,9 +103,9 @@ EmuCallbacks main_application::CreateCallbacks()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.get_pad_handler = [this](const std::string& title_id) -> std::shared_ptr<pad_thread>
|
callbacks.init_pad_handler = [this](std::string_view title_id)
|
||||||
{
|
{
|
||||||
return std::make_shared<pad_thread>(get_thread(), m_game_window, title_id);
|
g_fxo->init<pad_thread>(get_thread(), m_game_window, title_id);
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.get_gs_render = []() -> std::shared_ptr<GSRender>
|
callbacks.get_gs_render = []() -> std::shared_ptr<GSRender>
|
||||||
|
@ -24,7 +24,7 @@ struct pad_setting
|
|||||||
u32 device_type;
|
u32 device_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
pad_thread::pad_thread(void *_curthread, void *_curwindow, const std::string& title_id) : curthread(_curthread), curwindow(_curwindow)
|
pad_thread::pad_thread(void *_curthread, void *_curwindow, std::string_view title_id) : curthread(_curthread), curwindow(_curwindow)
|
||||||
{
|
{
|
||||||
pad::g_title_id = title_id;
|
pad::g_title_id = title_id;
|
||||||
Init();
|
Init();
|
||||||
@ -144,7 +144,7 @@ void pad_thread::SetRumble(const u32 pad, u8 largeMotor, bool smallMotor)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pad_thread::Reset(const std::string& title_id)
|
void pad_thread::Reset(std::string_view title_id)
|
||||||
{
|
{
|
||||||
pad::g_title_id = title_id;
|
pad::g_title_id = title_id;
|
||||||
reset = active.load();
|
reset = active.load();
|
||||||
|
@ -16,14 +16,14 @@ struct PadInfo
|
|||||||
class pad_thread
|
class pad_thread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
pad_thread(void* _curthread, void* _curwindow, const std::string& title_id = ""); // void * instead of QThread * and QWindow * because of include in emucore
|
pad_thread(void* _curthread, void* _curwindow, std::string_view title_id); // void * instead of QThread * and QWindow * because of include in emucore
|
||||||
~pad_thread();
|
~pad_thread();
|
||||||
|
|
||||||
PadInfo& GetInfo() { return m_info; }
|
PadInfo& GetInfo() { return m_info; }
|
||||||
auto& GetPads() { return m_pads; }
|
auto& GetPads() { return m_pads; }
|
||||||
void SetRumble(const u32 pad, u8 largeMotor, bool smallMotor);
|
void SetRumble(const u32 pad, u8 largeMotor, bool smallMotor);
|
||||||
void Init();
|
void Init();
|
||||||
void Reset(const std::string& title_id = "");
|
void Reset(std::string_view title_id);
|
||||||
void SetEnabled(bool enabled);
|
void SetEnabled(bool enabled);
|
||||||
void SetIntercepted(bool intercepted);
|
void SetIntercepted(bool intercepted);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user