Skip to content

Commit

Permalink
Emulation: Make stopping emulation not pause or crash UI
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 16, 2023
1 parent a6d8c43 commit 461de4c
Show file tree
Hide file tree
Showing 7 changed files with 350 additions and 238 deletions.
40 changes: 22 additions & 18 deletions rpcs3/Emu/Cell/lv2/sys_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,6 @@ void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<

std::string path = vfs::get(argv[0]);
std::string hdd1 = vfs::get("/dev_hdd1/");
std::string old_config = Emu.GetUsedConfig();

const u128 klic = g_fxo->get<loaded_npdrm_keys>().last_key();

Expand Down Expand Up @@ -457,27 +456,32 @@ void lv2_exitspawn(ppu_thread& ppu, std::vector<std::string>& argv, std::vector<
g_fxo->init<lv2_memory_container>(std::min(old_size - total_size, sdk_suggested_mem) + total_size);
};

Emu.Kill(false);
Emu.argv = std::move(argv);
Emu.envp = std::move(envp);
Emu.data = std::move(data);
Emu.disc = std::move(disc);
Emu.hdd1 = std::move(hdd1);
Emu.init_mem_containers = std::move(func);

if (klic)
Emu.after_kill_callback = [func = std::move(func), argv = std::move(argv), envp = std::move(envp), data = std::move(data),
disc = std::move(disc), path = std::move(path), hdd1 = std::move(hdd1), old_config = Emu.GetUsedConfig(), klic]() mutable
{
Emu.klic.emplace_back(klic);
}
Emu.argv = std::move(argv);
Emu.envp = std::move(envp);
Emu.data = std::move(data);
Emu.disc = std::move(disc);
Emu.hdd1 = std::move(hdd1);
Emu.init_mem_containers = std::move(func);

if (klic)
{
Emu.klic.emplace_back(klic);
}

Emu.SetForceBoot(true);
Emu.SetForceBoot(true);

auto res = Emu.BootGame(path, "", true, cfg_mode::continuous, old_config);
auto res = Emu.BootGame(path, "", true, cfg_mode::continuous, old_config);

if (res != game_boot_result::no_errors)
{
sys_process.fatal("Failed to boot from exitspawn! (path=\"%s\", error=%s)", path, res);
}
if (res != game_boot_result::no_errors)
{
sys_process.fatal("Failed to boot from exitspawn! (path=\"%s\", error=%s)", path, res);
}
};

Emu.Kill(false);
});

// Wait for GUI thread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ namespace rsx

Emu.CallFromMainThread([suspend_mode]()
{
Emu.Kill(false, true);

if (!suspend_mode)
Emu.after_kill_callback = [suspend_mode]()
{
Emu.Restart();
}
};

Emu.Kill(false, true);
});

return page_navigation::exit;
Expand Down
Loading

0 comments on commit 461de4c

Please sign in to comment.