mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 15:01:28 +12:00
Rename CallAfter to CallFromMainThread
This commit is contained in:
parent
2d9f21a2ea
commit
d172b9add6
22 changed files with 63 additions and 63 deletions
|
@ -1629,7 +1629,7 @@ void camera_context::operator()()
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
send_frame_update_event = handler ? on_handler_state(handler->get_state()) : true;
|
send_frame_update_event = handler ? on_handler_state(handler->get_state()) : true;
|
||||||
wake_up = true;
|
wake_up = true;
|
||||||
|
@ -1706,7 +1706,7 @@ bool camera_context::open_camera()
|
||||||
bool result = true;
|
bool result = true;
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&wake_up, &result, this]()
|
Emu.CallFromMainThread([&wake_up, &result, this]()
|
||||||
{
|
{
|
||||||
handler.reset();
|
handler.reset();
|
||||||
handler = Emu.GetCallbacks().get_camera_handler();
|
handler = Emu.GetCallbacks().get_camera_handler();
|
||||||
|
@ -1740,7 +1740,7 @@ bool camera_context::start_camera()
|
||||||
|
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&wake_up, &result, this]()
|
Emu.CallFromMainThread([&wake_up, &result, this]()
|
||||||
{
|
{
|
||||||
handler->start_camera();
|
handler->start_camera();
|
||||||
result = on_handler_state(handler->get_state());
|
result = on_handler_state(handler->get_state());
|
||||||
|
@ -1765,7 +1765,7 @@ bool camera_context::get_camera_frame(u8* dst, u32& width, u32& height, u64& fra
|
||||||
{
|
{
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
result = on_handler_state(handler->get_image(dst, info.bytesize, width, height, frame_number, bytes_read));
|
result = on_handler_state(handler->get_image(dst, info.bytesize, width, height, frame_number, bytes_read));
|
||||||
wake_up = true;
|
wake_up = true;
|
||||||
|
@ -1787,7 +1787,7 @@ void camera_context::stop_camera()
|
||||||
{
|
{
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&wake_up, this]()
|
Emu.CallFromMainThread([&wake_up, this]()
|
||||||
{
|
{
|
||||||
handler->stop_camera();
|
handler->stop_camera();
|
||||||
wake_up = true;
|
wake_up = true;
|
||||||
|
@ -1807,7 +1807,7 @@ void camera_context::close_camera()
|
||||||
{
|
{
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&wake_up, this]()
|
Emu.CallFromMainThread([&wake_up, this]()
|
||||||
{
|
{
|
||||||
handler->close_camera();
|
handler->close_camera();
|
||||||
wake_up = true;
|
wake_up = true;
|
||||||
|
|
|
@ -209,7 +209,7 @@ error_code open_msg_dialog(bool is_blocking, u32 type, vm::cptr<char> msgString,
|
||||||
lv2_obj::sleep(ppu);
|
lv2_obj::sleep(ppu);
|
||||||
|
|
||||||
// Run asynchronously in GUI thread
|
// Run asynchronously in GUI thread
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
g_last_user_response = CELL_MSGDIALOG_BUTTON_NONE;
|
g_last_user_response = CELL_MSGDIALOG_BUTTON_NONE;
|
||||||
dlg->Create(msgString.get_ptr());
|
dlg->Create(msgString.get_ptr());
|
||||||
|
@ -533,7 +533,7 @@ error_code cellMsgDialogProgressBarSetMsg(u32 progressBarIndex, vm::cptr<char> m
|
||||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.CallAfter([=, msg = std::string{ msgString.get_ptr() }]
|
Emu.CallFromMainThread([=, msg = std::string{ msgString.get_ptr() }]
|
||||||
{
|
{
|
||||||
dlg->ProgressBarSetMsg(progressBarIndex, msg);
|
dlg->ProgressBarSetMsg(progressBarIndex, msg);
|
||||||
});
|
});
|
||||||
|
@ -565,7 +565,7 @@ error_code cellMsgDialogProgressBarReset(u32 progressBarIndex)
|
||||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.CallAfter([=]
|
Emu.CallFromMainThread([=]
|
||||||
{
|
{
|
||||||
dlg->ProgressBarReset(progressBarIndex);
|
dlg->ProgressBarReset(progressBarIndex);
|
||||||
});
|
});
|
||||||
|
@ -597,7 +597,7 @@ error_code cellMsgDialogProgressBarInc(u32 progressBarIndex, u32 delta)
|
||||||
return CELL_MSGDIALOG_ERROR_PARAM;
|
return CELL_MSGDIALOG_ERROR_PARAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.CallAfter([=]
|
Emu.CallFromMainThread([=]
|
||||||
{
|
{
|
||||||
dlg->ProgressBarInc(progressBarIndex, delta);
|
dlg->ProgressBarInc(progressBarIndex, delta);
|
||||||
});
|
});
|
||||||
|
|
|
@ -345,7 +345,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
|
||||||
|
|
||||||
input::SetIntercepted(true);
|
input::SetIntercepted(true);
|
||||||
|
|
||||||
Emu.CallAfter([=, &result]()
|
Emu.CallFromMainThread([=, &result]()
|
||||||
{
|
{
|
||||||
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel);
|
osk->Create(get_localized_string(localized_string_id::CELL_OSK_DIALOG_TITLE), message, osk->osk_text, maxLength, prohibitFlgs, allowOskPanelFlg, firstViewPanel);
|
||||||
result = true;
|
result = true;
|
||||||
|
|
|
@ -925,7 +925,7 @@ error_code sceNpBasicSendMessageGui(vm::cptr<SceNpBasicMessageDetails> msg, sys_
|
||||||
|
|
||||||
input::SetIntercepted(true);
|
input::SetIntercepted(true);
|
||||||
|
|
||||||
Emu.CallAfter([=, &wake_up, &result, msg_data = std::move(msg_data), npids = std::move(npids)]() mutable
|
Emu.CallFromMainThread([=, &wake_up, &result, msg_data = std::move(msg_data), npids = std::move(npids)]() mutable
|
||||||
{
|
{
|
||||||
auto send_dlg = Emu.GetCallbacks().get_sendmessage_dialog();
|
auto send_dlg = Emu.GetCallbacks().get_sendmessage_dialog();
|
||||||
result = send_dlg->Exec(msg_data, npids);
|
result = send_dlg->Exec(msg_data, npids);
|
||||||
|
@ -1099,7 +1099,7 @@ error_code sceNpBasicRecvMessageCustom(u16 mainType, u32 recvOptions, sys_memory
|
||||||
SceNpBasicMessageRecvAction recv_result;
|
SceNpBasicMessageRecvAction recv_result;
|
||||||
u64 chosen_msg_id;
|
u64 chosen_msg_id;
|
||||||
|
|
||||||
Emu.CallAfter([=, &wake_up, &result, &recv_result, &chosen_msg_id]()
|
Emu.CallFromMainThread([=, &wake_up, &result, &recv_result, &chosen_msg_id]()
|
||||||
{
|
{
|
||||||
auto recv_dlg = Emu.GetCallbacks().get_recvmessage_dialog();
|
auto recv_dlg = Emu.GetCallbacks().get_recvmessage_dialog();
|
||||||
result = recv_dlg->Exec(static_cast<SceNpBasicMessageMainType>(mainType), static_cast<SceNpBasicMessageRecvOptions>(recvOptions), recv_result, chosen_msg_id);
|
result = recv_dlg->Exec(static_cast<SceNpBasicMessageMainType>(mainType), static_cast<SceNpBasicMessageRecvOptions>(recvOptions), recv_result, chosen_msg_id);
|
||||||
|
|
|
@ -704,7 +704,7 @@ static void ppu_break(ppu_thread& ppu, ppu_opcode_t, be_t<u32>* this_op, ppu_int
|
||||||
if (pause_all)
|
if (pause_all)
|
||||||
{
|
{
|
||||||
// Pause all other threads
|
// Pause all other threads
|
||||||
Emu.CallAfter([]() { Emu.Pause(); });
|
Emu.CallFromMainThread([]() { Emu.Pause(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ppu.check_state() || old_cia != atomic_storage<u32>::load(ppu.cia))
|
if (ppu.check_state() || old_cia != atomic_storage<u32>::load(ppu.cia))
|
||||||
|
@ -3405,7 +3405,7 @@ static void ppu_initialize2(jit_compiler& jit, const ppu_module& module_part, co
|
||||||
{
|
{
|
||||||
out.flush();
|
out.flush();
|
||||||
ppu_log.error("LLVM: Verification failed for %s:\n%s", obj_name, result);
|
ppu_log.error("LLVM: Verification failed for %s:\n%s", obj_name, result);
|
||||||
Emu.CallAfter([]{ Emu.GracefulShutdown(false, true); });
|
Emu.CallFromMainThread([]{ Emu.GracefulShutdown(false, true); });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -346,7 +346,7 @@ void _sys_process_exit(ppu_thread& ppu, s32 status, u32 arg2, u32 arg3)
|
||||||
|
|
||||||
sys_process.warning("_sys_process_exit(status=%d, arg2=0x%x, arg3=0x%x)", status, arg2, arg3);
|
sys_process.warning("_sys_process_exit(status=%d, arg2=0x%x, arg3=0x%x)", status, arg2, arg3);
|
||||||
|
|
||||||
Emu.CallAfter([]()
|
Emu.CallFromMainThread([]()
|
||||||
{
|
{
|
||||||
sys_process.success("Process finished");
|
sys_process.success("Process finished");
|
||||||
Emu.Kill();
|
Emu.Kill();
|
||||||
|
@ -411,7 +411,7 @@ void _sys_process_exit2(ppu_thread& ppu, s32 status, vm::ptr<sys_exit2_param> ar
|
||||||
if (disc.empty() && !Emu.GetTitleID().empty())
|
if (disc.empty() && !Emu.GetTitleID().empty())
|
||||||
disc = vfs::get(Emu.GetDir());
|
disc = vfs::get(Emu.GetDir());
|
||||||
|
|
||||||
Emu.CallAfter([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc)
|
Emu.CallFromMainThread([path = std::move(path), argv = std::move(argv), envp = std::move(envp), data = std::move(data), disc = std::move(disc)
|
||||||
, hdd1 = std::move(hdd1), klic = g_fxo->get<loaded_npdrm_keys>().last_key(), old_config = Emu.GetUsedConfig()]() mutable
|
, hdd1 = std::move(hdd1), klic = g_fxo->get<loaded_npdrm_keys>().last_key(), old_config = Emu.GetUsedConfig()]() mutable
|
||||||
{
|
{
|
||||||
sys_process.success("Process finished -> %s", argv[0]);
|
sys_process.success("Process finished -> %s", argv[0]);
|
||||||
|
|
|
@ -719,7 +719,7 @@ bool gdb_thread::cmd_attached_to_what(gdb_cmd&)
|
||||||
bool gdb_thread::cmd_kill(gdb_cmd&)
|
bool gdb_thread::cmd_kill(gdb_cmd&)
|
||||||
{
|
{
|
||||||
GDB.notice("Kill command issued");
|
GDB.notice("Kill command issued");
|
||||||
Emu.CallAfter([](){ Emu.GracefulShutdown(); });
|
Emu.CallFromMainThread([](){ Emu.GracefulShutdown(); });
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace rsx
|
||||||
dlg->ProgressBarSetTaskbarIndex(-1); // -1 to combine all progressbars in the taskbar progress
|
dlg->ProgressBarSetTaskbarIndex(-1); // -1 to combine all progressbars in the taskbar progress
|
||||||
dlg->on_close = [](s32 /*status*/)
|
dlg->on_close = [](s32 /*status*/)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([]()
|
Emu.CallFromMainThread([]()
|
||||||
{
|
{
|
||||||
rsx_log.notice("Aborted shader loading dialog");
|
rsx_log.notice("Aborted shader loading dialog");
|
||||||
Emu.Kill(false);
|
Emu.Kill(false);
|
||||||
|
@ -27,7 +27,7 @@ namespace rsx
|
||||||
|
|
||||||
ref_cnt++;
|
ref_cnt++;
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
dlg->Create(msg, title);
|
dlg->Create(msg, title);
|
||||||
ref_cnt--;
|
ref_cnt--;
|
||||||
|
@ -49,7 +49,7 @@ namespace rsx
|
||||||
|
|
||||||
ref_cnt++;
|
ref_cnt++;
|
||||||
|
|
||||||
Emu.CallAfter([&, index, msg]()
|
Emu.CallFromMainThread([&, index, msg]()
|
||||||
{
|
{
|
||||||
dlg->ProgressBarSetMsg(index, msg);
|
dlg->ProgressBarSetMsg(index, msg);
|
||||||
ref_cnt--;
|
ref_cnt--;
|
||||||
|
@ -65,7 +65,7 @@ namespace rsx
|
||||||
|
|
||||||
ref_cnt++;
|
ref_cnt++;
|
||||||
|
|
||||||
Emu.CallAfter([&, index, value]()
|
Emu.CallFromMainThread([&, index, value]()
|
||||||
{
|
{
|
||||||
dlg->ProgressBarInc(index, value);
|
dlg->ProgressBarInc(index, value);
|
||||||
ref_cnt--;
|
ref_cnt--;
|
||||||
|
@ -81,7 +81,7 @@ namespace rsx
|
||||||
|
|
||||||
ref_cnt++;
|
ref_cnt++;
|
||||||
|
|
||||||
Emu.CallAfter([&, index, value]()
|
Emu.CallFromMainThread([&, index, value]()
|
||||||
{
|
{
|
||||||
dlg->ProgressBarSetValue(index, value);
|
dlg->ProgressBarSetValue(index, value);
|
||||||
ref_cnt--;
|
ref_cnt--;
|
||||||
|
@ -97,7 +97,7 @@ namespace rsx
|
||||||
|
|
||||||
ref_cnt++;
|
ref_cnt++;
|
||||||
|
|
||||||
Emu.CallAfter([&, index, limit]()
|
Emu.CallFromMainThread([&, index, limit]()
|
||||||
{
|
{
|
||||||
dlg->ProgressBarSetLimit(index, limit);
|
dlg->ProgressBarSetLimit(index, limit);
|
||||||
ref_cnt--;
|
ref_cnt--;
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace rsx
|
||||||
{
|
{
|
||||||
if (on_osk_close)
|
if (on_osk_close)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([this, status]()
|
Emu.CallFromMainThread([this, status]()
|
||||||
{
|
{
|
||||||
on_osk_close(status);
|
on_osk_close(status);
|
||||||
});
|
});
|
||||||
|
|
|
@ -884,7 +884,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||||
ppu_precompile(dir_queue, nullptr);
|
ppu_precompile(dir_queue, nullptr);
|
||||||
|
|
||||||
// Exit "process"
|
// Exit "process"
|
||||||
CallAfter([]
|
CallFromMainThread([]
|
||||||
{
|
{
|
||||||
Emu.Kill(false);
|
Emu.Kill(false);
|
||||||
});
|
});
|
||||||
|
@ -1457,7 +1457,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
||||||
{
|
{
|
||||||
Kill(false);
|
Kill(false);
|
||||||
|
|
||||||
CallAfter([this]()
|
CallFromMainThread([this]()
|
||||||
{
|
{
|
||||||
GetCallbacks().on_missing_fw();
|
GetCallbacks().on_missing_fw();
|
||||||
});
|
});
|
||||||
|
@ -1696,7 +1696,7 @@ void Emulator::GracefulShutdown(bool allow_autoexit, bool async_op)
|
||||||
}
|
}
|
||||||
|
|
||||||
// An inevitable attempt to terminate the *current* emulation course will be issued after 5s
|
// An inevitable attempt to terminate the *current* emulation course will be issued after 5s
|
||||||
CallAfter([allow_autoexit, this]()
|
CallFromMainThread([allow_autoexit, this]()
|
||||||
{
|
{
|
||||||
Kill(allow_autoexit);
|
Kill(allow_autoexit);
|
||||||
}, info);
|
}, info);
|
||||||
|
|
|
@ -56,7 +56,7 @@ enum class cfg_mode
|
||||||
|
|
||||||
struct EmuCallbacks
|
struct EmuCallbacks
|
||||||
{
|
{
|
||||||
std::function<void(std::function<void()>)> call_after;
|
std::function<void(std::function<void()>)> call_from_main_thread;
|
||||||
std::function<void(bool)> on_run; // (start_playtime) continuing or going ingame, so start the clock
|
std::function<void(bool)> on_run; // (start_playtime) continuing or going ingame, so start the clock
|
||||||
std::function<void()> on_pause;
|
std::function<void()> on_pause;
|
||||||
std::function<void()> on_resume;
|
std::function<void()> on_resume;
|
||||||
|
@ -132,11 +132,11 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call from the GUI thread
|
// Call from the GUI thread
|
||||||
void CallAfter(std::function<void()>&& func, bool track_emu_state = true, u64 stop_ctr = umax) const
|
void CallFromMainThread(std::function<void()>&& func, bool track_emu_state = true, u64 stop_ctr = umax) const
|
||||||
{
|
{
|
||||||
if (!track_emu_state)
|
if (!track_emu_state)
|
||||||
{
|
{
|
||||||
return m_cb.call_after(std::move(func));
|
return m_cb.call_from_main_thread(std::move(func));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::function<void()> final_func = [this, before = IsStopped(), count = (stop_ctr == umax ? +m_stop_ctr : stop_ctr), func = std::move(func)]
|
std::function<void()> final_func = [this, before = IsStopped(), count = (stop_ctr == umax ? +m_stop_ctr : stop_ctr), func = std::move(func)]
|
||||||
|
@ -147,7 +147,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return m_cb.call_after(std::move(final_func));
|
return m_cb.call_from_main_thread(std::move(final_func));
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class stop_counter_t : u64{};
|
enum class stop_counter_t : u64{};
|
||||||
|
@ -157,9 +157,9 @@ public:
|
||||||
return stop_counter_t{+m_stop_ctr};
|
return stop_counter_t{+m_stop_ctr};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallAfter(std::function<void()>&& func, stop_counter_t counter) const
|
void CallFromMainThread(std::function<void()>&& func, stop_counter_t counter) const
|
||||||
{
|
{
|
||||||
CallAfter(std::move(func), true, static_cast<u64>(counter));
|
CallFromMainThread(std::move(func), true, static_cast<u64>(counter));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set emulator mode to running unconditionnaly.
|
/** Set emulator mode to running unconditionnaly.
|
||||||
|
|
|
@ -89,7 +89,7 @@ void progress_dialog_server::operator()()
|
||||||
dlg->type.progress_bar_count = 1;
|
dlg->type.progress_bar_count = 1;
|
||||||
dlg->on_close = [](s32 /*status*/)
|
dlg->on_close = [](s32 /*status*/)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([]()
|
Emu.CallFromMainThread([]()
|
||||||
{
|
{
|
||||||
// Abort everything
|
// Abort everything
|
||||||
sys_log.notice("Aborted progress dialog");
|
sys_log.notice("Aborted progress dialog");
|
||||||
|
@ -99,7 +99,7 @@ void progress_dialog_server::operator()()
|
||||||
g_system_progress_canceled = true;
|
g_system_progress_canceled = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Emu.CallAfter([dlg, text0]()
|
Emu.CallFromMainThread([dlg, text0]()
|
||||||
{
|
{
|
||||||
dlg->Create(text0, text0);
|
dlg->Create(text0, text0);
|
||||||
});
|
});
|
||||||
|
@ -164,7 +164,7 @@ void progress_dialog_server::operator()()
|
||||||
}
|
}
|
||||||
else if (dlg)
|
else if (dlg)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([=]()
|
Emu.CallFromMainThread([=]()
|
||||||
{
|
{
|
||||||
dlg->SetMsg(text_new);
|
dlg->SetMsg(text_new);
|
||||||
dlg->ProgressBarSetMsg(0, progr);
|
dlg->ProgressBarSetMsg(0, progr);
|
||||||
|
@ -191,7 +191,7 @@ void progress_dialog_server::operator()()
|
||||||
}
|
}
|
||||||
else if (dlg)
|
else if (dlg)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([=]()
|
Emu.CallFromMainThread([=]()
|
||||||
{
|
{
|
||||||
dlg->Close(true);
|
dlg->Close(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -34,7 +34,7 @@ bool headless_application::Init()
|
||||||
void headless_application::InitializeConnects() const
|
void headless_application::InitializeConnects() const
|
||||||
{
|
{
|
||||||
qRegisterMetaType<std::function<void()>>("std::function<void()>");
|
qRegisterMetaType<std::function<void()>>("std::function<void()>");
|
||||||
connect(this, &headless_application::RequestCallAfter, this, &headless_application::HandleCallAfter);
|
connect(this, &headless_application::RequestCallFromMainThread, this, &headless_application::CallFromMainThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** RPCS3 emulator has functions it desires to call from the GUI at times. Initialize them in here. */
|
/** RPCS3 emulator has functions it desires to call from the GUI at times. Initialize them in here. */
|
||||||
|
@ -57,9 +57,9 @@ void headless_application::InitializeCallbacks()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
callbacks.call_after = [this](std::function<void()> func)
|
callbacks.call_from_main_thread = [this](std::function<void()> func)
|
||||||
{
|
{
|
||||||
RequestCallAfter(std::move(func));
|
RequestCallFromMainThread(std::move(func));
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.init_gs_render = []()
|
callbacks.init_gs_render = []()
|
||||||
|
@ -140,7 +140,7 @@ void headless_application::InitializeCallbacks()
|
||||||
/**
|
/**
|
||||||
* Using connects avoids timers being unable to be used in a non-qt thread. So, even if this looks stupid to just call func, it's succinct.
|
* Using connects avoids timers being unable to be used in a non-qt thread. So, even if this looks stupid to just call func, it's succinct.
|
||||||
*/
|
*/
|
||||||
void headless_application::HandleCallAfter(const std::function<void()>& func)
|
void headless_application::CallFromMainThread(const std::function<void()>& func)
|
||||||
{
|
{
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void RequestCallAfter(std::function<void()> func);
|
void RequestCallFromMainThread(std::function<void()> func);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
static void HandleCallAfter(const std::function<void()>& func);
|
static void CallFromMainThread(const std::function<void()>& func);
|
||||||
};
|
};
|
||||||
|
|
|
@ -981,7 +981,7 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Postpone startup to main event loop
|
// Postpone startup to main event loop
|
||||||
Emu.CallAfter([path = sstr(QFileInfo(args.at(0)).absoluteFilePath()), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable
|
Emu.CallFromMainThread([path = sstr(QFileInfo(args.at(0)).absoluteFilePath()), rpcs3_argv = std::move(rpcs3_argv), config_path = std::move(config_path)]() mutable
|
||||||
{
|
{
|
||||||
Emu.argv = std::move(rpcs3_argv);
|
Emu.argv = std::move(rpcs3_argv);
|
||||||
Emu.SetForceBoot(true);
|
Emu.SetForceBoot(true);
|
||||||
|
|
|
@ -279,7 +279,7 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
|
||||||
|
|
||||||
void gs_frame::toggle_fullscreen()
|
void gs_frame::toggle_fullscreen()
|
||||||
{
|
{
|
||||||
Emu.CallAfter([this]()
|
Emu.CallFromMainThread([this]()
|
||||||
{
|
{
|
||||||
if (visibility() == FullScreen)
|
if (visibility() == FullScreen)
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,7 @@ void gs_frame::close()
|
||||||
{
|
{
|
||||||
gui_log.notice("Closing game window");
|
gui_log.notice("Closing game window");
|
||||||
|
|
||||||
Emu.CallAfter([this]()
|
Emu.CallFromMainThread([this]()
|
||||||
{
|
{
|
||||||
if (!(+g_progr))
|
if (!(+g_progr))
|
||||||
{
|
{
|
||||||
|
@ -377,12 +377,12 @@ bool gs_frame::shown()
|
||||||
|
|
||||||
void gs_frame::hide()
|
void gs_frame::hide()
|
||||||
{
|
{
|
||||||
Emu.CallAfter([this]() { QWindow::hide(); });
|
Emu.CallFromMainThread([this]() { QWindow::hide(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void gs_frame::show()
|
void gs_frame::show()
|
||||||
{
|
{
|
||||||
Emu.CallAfter([this]()
|
Emu.CallFromMainThread([this]()
|
||||||
{
|
{
|
||||||
QWindow::show();
|
QWindow::show();
|
||||||
if (g_cfg.misc.start_fullscreen)
|
if (g_cfg.misc.start_fullscreen)
|
||||||
|
@ -498,7 +498,7 @@ void gs_frame::flip(draw_context_t, bool /*skip_frame*/)
|
||||||
{
|
{
|
||||||
m_window_title = new_title;
|
m_window_title = new_title;
|
||||||
|
|
||||||
Emu.CallAfter([this, title = std::move(new_title)]()
|
Emu.CallFromMainThread([this, title = std::move(new_title)]()
|
||||||
{
|
{
|
||||||
setTitle(qstr(title));
|
setTitle(qstr(title));
|
||||||
});
|
});
|
||||||
|
@ -736,7 +736,7 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
|
||||||
}
|
}
|
||||||
|
|
||||||
// Play a sound
|
// Play a sound
|
||||||
Emu.CallAfter([]()
|
Emu.CallFromMainThread([]()
|
||||||
{
|
{
|
||||||
if (const std::string sound_path = fs::get_config_dir() + "sounds/snd_screenshot.wav"; fs::is_file(sound_path))
|
if (const std::string sound_path = fs::get_config_dir() + "sounds/snd_screenshot.wav"; fs::is_file(sound_path))
|
||||||
{
|
{
|
||||||
|
@ -810,7 +810,7 @@ bool gs_frame::event(QEvent* ev)
|
||||||
int result = QMessageBox::Yes;
|
int result = QMessageBox::Yes;
|
||||||
atomic_t<bool> called = false;
|
atomic_t<bool> called = false;
|
||||||
|
|
||||||
Emu.CallAfter([this, &result, &called]()
|
Emu.CallFromMainThread([this, &result, &called]()
|
||||||
{
|
{
|
||||||
m_gui_settings->ShowConfirmationBox(tr("Exit Game?"),
|
m_gui_settings->ShowConfirmationBox(tr("Exit Game?"),
|
||||||
tr("Do you really want to exit the game?<br><br>Any unsaved progress will be lost!<br>"),
|
tr("Do you really want to exit the game?<br><br>Any unsaved progress will be lost!<br>"),
|
||||||
|
|
|
@ -262,7 +262,7 @@ void gui_application::InitializeConnects()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qRegisterMetaType<std::function<void()>>("std::function<void()>");
|
qRegisterMetaType<std::function<void()>>("std::function<void()>");
|
||||||
connect(this, &gui_application::RequestCallAfter, this, &gui_application::HandleCallAfter);
|
connect(this, &gui_application::RequestCallFromMainThread, this, &gui_application::CallFromMainThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
std::unique_ptr<gs_frame> gui_application::get_gs_frame()
|
||||||
|
@ -330,9 +330,9 @@ void gui_application::InitializeCallbacks()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
callbacks.call_after = [this](std::function<void()> func)
|
callbacks.call_from_main_thread = [this](std::function<void()> func)
|
||||||
{
|
{
|
||||||
RequestCallAfter(std::move(func));
|
RequestCallFromMainThread(std::move(func));
|
||||||
};
|
};
|
||||||
|
|
||||||
callbacks.init_gs_render = []()
|
callbacks.init_gs_render = []()
|
||||||
|
@ -424,7 +424,7 @@ void gui_application::InitializeCallbacks()
|
||||||
|
|
||||||
callbacks.play_sound = [](const std::string& path)
|
callbacks.play_sound = [](const std::string& path)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([path]()
|
Emu.CallFromMainThread([path]()
|
||||||
{
|
{
|
||||||
if (fs::is_file(path))
|
if (fs::is_file(path))
|
||||||
{
|
{
|
||||||
|
@ -614,7 +614,7 @@ void gui_application::OnEmuSettingsChange()
|
||||||
/**
|
/**
|
||||||
* Using connects avoids timers being unable to be used in a non-qt thread. So, even if this looks stupid to just call func, it's succinct.
|
* Using connects avoids timers being unable to be used in a non-qt thread. So, even if this looks stupid to just call func, it's succinct.
|
||||||
*/
|
*/
|
||||||
void gui_application::HandleCallAfter(const std::function<void()>& func)
|
void gui_application::CallFromMainThread(const std::function<void()>& func)
|
||||||
{
|
{
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,8 +93,8 @@ Q_SIGNALS:
|
||||||
void OnEmulatorStop();
|
void OnEmulatorStop();
|
||||||
void OnEmulatorReady();
|
void OnEmulatorReady();
|
||||||
|
|
||||||
void RequestCallAfter(const std::function<void()>& func);
|
void RequestCallFromMainThread(const std::function<void()>& func);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
static void HandleCallAfter(const std::function<void()>& func);
|
static void CallFromMainThread(const std::function<void()>& func);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1008,7 +1008,7 @@ void main_window::HandlePupInstallation(const QString& file_path, const QString&
|
||||||
{
|
{
|
||||||
const auto critical = [this](QString str)
|
const auto critical = [this](QString str)
|
||||||
{
|
{
|
||||||
Emu.CallAfter([this, str = std::move(str)]()
|
Emu.CallFromMainThread([this, str = std::move(str)]()
|
||||||
{
|
{
|
||||||
QMessageBox::critical(this, tr("Firmware Installation Failed"), str);
|
QMessageBox::critical(this, tr("Firmware Installation Failed"), str);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
|
@ -25,7 +25,7 @@ qt_camera_handler::~qt_camera_handler()
|
||||||
{
|
{
|
||||||
atomic_t<bool> wake_up = false;
|
atomic_t<bool> wake_up = false;
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
close_camera();
|
close_camera();
|
||||||
m_surface.reset();
|
m_surface.reset();
|
||||||
|
|
|
@ -29,7 +29,7 @@ s32 save_data_dialog::ShowSaveDataList(std::vector<SaveDataEntry>& save_entries,
|
||||||
|
|
||||||
input::SetIntercepted(true);
|
input::SetIntercepted(true);
|
||||||
|
|
||||||
Emu.CallAfter([&]()
|
Emu.CallFromMainThread([&]()
|
||||||
{
|
{
|
||||||
save_data_list_dialog sdid(save_entries, focused, op, listSet);
|
save_data_list_dialog sdid(save_entries, focused, op, listSet);
|
||||||
sdid.exec();
|
sdid.exec();
|
||||||
|
|
|
@ -21,7 +21,7 @@ s32 trophy_notification_helper::ShowTrophyNotification(const SceNpTrophyDetails&
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Emu.CallAfter([=, this]
|
Emu.CallFromMainThread([=, this]
|
||||||
{
|
{
|
||||||
trophy_notification_frame* trophy_notification = new trophy_notification_frame(trophy_icon_buffer, trophy, m_game_window->frameGeometry().height() / 10);
|
trophy_notification_frame* trophy_notification = new trophy_notification_frame(trophy_icon_buffer, trophy, m_game_window->frameGeometry().height() / 10);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue