Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sysutil_send_system_cmd at Emu.Stop() #9950

Merged
merged 1 commit into from Mar 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions rpcs3/Emu/Cell/Modules/cellSysutil.cpp
Expand Up @@ -57,13 +57,13 @@ extern void sysutil_register_cb(std::function<s32(ppu_thread&)>&& cb)

extern void sysutil_send_system_cmd(u64 status, u64 param)
{
if (auto& cbm = g_fxo->get<sysutil_cb_manager>(); g_fxo->is_init<sysutil_cb_manager>() && !Emu.IsStopped())
if (auto cbm = g_fxo->try_get<sysutil_cb_manager>())
{
for (sysutil_cb_manager::registered_cb cb : cbm.callbacks)
for (sysutil_cb_manager::registered_cb cb : cbm->callbacks)
{
if (cb.first)
{
cbm.registered.push([=](ppu_thread& ppu) -> s32
cbm->registered.push([=](ppu_thread& ppu) -> s32
{
// TODO: check it and find the source of the return value (void isn't equal to CELL_OK)
cb.first(ppu, status, param, cb.second);
Expand Down
15 changes: 12 additions & 3 deletions rpcs3/rpcs3qt/main_window.cpp
Expand Up @@ -1373,6 +1373,11 @@ void main_window::OnEmuStop()
}
ui->actionManage_Users->setEnabled(true);

if (std::exchange(m_sys_menu_opened, false))
{
ui->sysSendOpenMenuAct->setText(tr("Send open system menu cmd"));
Megamouse marked this conversation as resolved.
Show resolved Hide resolved
}

// Refresh game list in order to update time played
if (m_game_list_frame)
{
Expand Down Expand Up @@ -1781,15 +1786,19 @@ void main_window::CreateConnects()
connect(ui->sysStopAct, &QAction::triggered, [this]() { Emu.Stop(); });
connect(ui->sysRebootAct, &QAction::triggered, [this]() { Emu.Restart(); });

connect(ui->sysSendOpenMenuAct, &QAction::triggered, [this]()
connect(ui->sysSendOpenMenuAct, &QAction::triggered, this, [this]()
{
if (Emu.IsStopped()) return;

sysutil_send_system_cmd(m_sys_menu_opened ? 0x0132 /* CELL_SYSUTIL_SYSTEM_MENU_CLOSE */ : 0x0131 /* CELL_SYSUTIL_SYSTEM_MENU_OPEN */, 0);
m_sys_menu_opened = !m_sys_menu_opened;
m_sys_menu_opened ^= true;
ui->sysSendOpenMenuAct->setText(tr("Send &%0 system menu cmd").arg(m_sys_menu_opened ? tr("close") : tr("open")));
});

connect(ui->sysSendExitAct, &QAction::triggered, [this]()
connect(ui->sysSendExitAct, &QAction::triggered, this, []()
{
if (Emu.IsStopped()) return;

sysutil_send_system_cmd(0x0101 /* CELL_SYSUTIL_REQUEST_EXITGAME */, 0);
});

Expand Down