only disable audio in applet mode if an app is suspended, bump version.

This commit is contained in:
ITotalJustice
2025-01-17 03:52:32 +00:00
parent 0aaf460dbf
commit e002aa9ec2
3 changed files with 20 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.13)
set(sphaira_VERSION 0.6.1)
set(sphaira_VERSION 0.6.2)
project(sphaira
VERSION ${sphaira_VERSION}

View File

@@ -119,6 +119,21 @@ public:
return type == AppletType_Application || type == AppletType_SystemApplication;
}
static auto IsApplet() -> bool {
return !IsApplication();
}
// returns true if launched in applet mode with a title suspended in the background.
static auto IsAppletWithSuspendedApp() -> bool {
R_UNLESS(IsApplet(), false);
R_TRY_RESULT(pmdmntInitialize(), false);
ON_SCOPE_EXIT(pmdmntExit());
u64 pid;
return R_SUCCEEDED(pmdmntGetApplicationProcessId(&pid));
}
// private:
static constexpr inline auto CONFIG_PATH = "/config/sphaira/config.ini";
static constexpr inline auto PLAYLOG_PATH = "/config/sphaira/playlog.ini";

View File

@@ -1282,9 +1282,11 @@ App::App(const char* argv0) {
}
}
// only enable audio in non-applet mode due to audren fatal.
// disable audio in applet mode with a suspended application due to audren fatal.
// see: https://github.com/ITotalJustice/sphaira/issues/92
if (IsApplication()) {
if (IsAppletWithSuspendedApp()) {
App::Notify("Audio disabled due to suspended game"_i18n);
} else {
plsrPlayerInit();
}