2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

am: stop emulation when all applets are closed

This commit is contained in:
Liam 2024-01-27 14:39:55 -05:00
parent 68303ed601
commit 8e0a40434c

View file

@ -221,6 +221,7 @@ void AppletManager::InsertApplet(std::shared_ptr<Applet> applet) {
void AppletManager::TerminateAndRemoveApplet(AppletResourceUserId aruid) { void AppletManager::TerminateAndRemoveApplet(AppletResourceUserId aruid) {
std::shared_ptr<Applet> applet; std::shared_ptr<Applet> applet;
bool should_stop = false;
{ {
std::scoped_lock lk{m_lock}; std::scoped_lock lk{m_lock};
@ -231,10 +232,17 @@ void AppletManager::TerminateAndRemoveApplet(AppletResourceUserId aruid) {
applet = it->second; applet = it->second;
m_applets.erase(it); m_applets.erase(it);
should_stop = m_applets.empty();
} }
// Terminate process. // Terminate process.
applet->process->Terminate(); applet->process->Terminate();
// If there were no applets left, stop emulation.
if (should_stop) {
m_system.Exit();
}
} }
void AppletManager::CreateAndInsertByFrontendAppletParameters( void AppletManager::CreateAndInsertByFrontendAppletParameters(