Add random sleep to game main thread on first boot when using LLE modules (#7199)

* Add random delay to app main thread

* Suggestions

* Remove randomness, only delay with lle

* Apply suggestions

* Fix clang format

* Fix compilation (again)

* Remove unused include
This commit is contained in:
PabloMK7 2024-01-12 21:48:00 +01:00 committed by GitHub
parent f346949989
commit a177769c3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 87 additions and 6 deletions

View file

@ -214,10 +214,20 @@ static bool AttemptLLE(const ServiceModuleInfo& service_module) {
/// Initialize ServiceManager
void Init(Core::System& core) {
SM::ServiceManager::InstallInterfaces(core);
core.Kernel().SetAppMainThreadExtendedSleep(false);
bool lle_module_present = false;
for (const auto& service_module : service_module_map) {
if (!AttemptLLE(service_module) && service_module.init_function != nullptr)
const bool has_lle = AttemptLLE(service_module);
if (!has_lle && service_module.init_function != nullptr) {
service_module.init_function(core);
}
lle_module_present |= has_lle;
}
if (lle_module_present) {
// If there is at least one LLE module, tell the kernel to
// add a extended sleep to the app main thread (if option enabled).
core.Kernel().SetAppMainThreadExtendedSleep(true);
}
LOG_DEBUG(Service, "initialized OK");
}