make all threads preemptive. workaround file based emummc hanging due to fs r/w hanging the system.

the fix for file based emummc is to simply sleep between fs r/w to the sd card.
the performance impact is minimal, even with the reduced buffer size.

the above *only* applies for when using file based emummc. not affecting using partition or sysmmc.
This commit is contained in:
ITotalJustice
2025-05-28 14:37:56 +01:00
parent b0ff2eb4b7
commit 6b56b7f7c2
14 changed files with 139 additions and 66 deletions

View File

@@ -630,7 +630,7 @@ auto App::GetReplaceHbmenuEnable() -> bool {
}
auto App::GetInstallEnable() -> bool {
if (IsEmunand()) {
if (IsEmummc()) {
return GetInstallEmummcEnable();
} else {
return GetInstallSysmmcEnable();
@@ -930,6 +930,21 @@ auto App::Install(ui::ProgressBox* pbox, OwoConfig& config) -> Result {
return rc;
}
auto App::IsEmummc() -> bool {
const auto& paths = g_app->m_emummc_paths;
return (paths.file_based_path[0] != '\0') || (paths.nintendo[0] != '\0');
}
auto App::IsParitionBaseEmummc() -> bool {
const auto& paths = g_app->m_emummc_paths;
return (paths.file_based_path[0] == '\0') && (paths.nintendo[0] != '\0');
}
auto App::IsFileBaseEmummc() -> bool {
const auto& paths = g_app->m_emummc_paths;
return (paths.file_based_path[0] != '\0') && (paths.nintendo[0] != '\0');
}
void App::Exit() {
g_app->m_quit = true;
}
@@ -1288,6 +1303,21 @@ App::App(const char* argv0) {
__nx_applet_exit_mode = 1;
}
// get emummc config.
alignas(0x1000) AmsEmummcPaths paths{};
SecmonArgs args{};
args.X[0] = 0xF0000404; /* smcAmsGetEmunandConfig */
args.X[1] = 0; /* EXO_EMUMMC_MMC_NAND*/
args.X[2] = (u64)&paths; /* out path */
svcCallSecureMonitor(&args);
m_emummc_paths = paths;
log_write("emummc : %u\n", App::IsEmummc());
if (App::IsEmummc()) {
log_write("[emummc] file based path: %s\n", m_emummc_paths.file_based_path);
log_write("[emummc] nintendo path: %s\n", m_emummc_paths.nintendo);
}
fs::FsNativeSd fs;
fs.CreateDirectoryRecursively("/config/sphaira");
fs.CreateDirectory("/config/sphaira/assoc");
@@ -1350,7 +1380,7 @@ App::App(const char* argv0) {
}
if (App::GetMtpEnable()) {
hazeInitialize(haze_callback, 0x2C, 2);
hazeInitialize(haze_callback, PRIO_PREEMPTIVE, 2);
}
if (App::GetFtpEnable()) {