core: Config plg_ldr after its creation

* Also use service manager to retrieve the service
This commit is contained in:
GPUCode
2024-01-05 23:50:10 +02:00
parent f2ee9baec7
commit 12880e9170
2 changed files with 7 additions and 8 deletions

View File

@ -449,6 +449,12 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window,
gpu->SetInterruptHandler(
[gsp](Service::GSP::InterruptId interrupt_id) { gsp->SignalInterrupt(interrupt_id); });
auto plg_ldr = Service::PLGLDR::GetService(*this);
if (plg_ldr) {
plg_ldr->SetEnabled(Settings::values.plugin_loader_enabled.GetValue());
plg_ldr->SetAllowGameChangeState(Settings::values.allow_plugin_loader.GetValue());
}
LOG_DEBUG(Core, "Initialized OK");
is_powered_on = true;

View File

@ -26,12 +26,10 @@
#include "common/settings.h"
#include "core/core.h"
#include "core/file_sys/plugin_3gx.h"
#include "core/hle/ipc.h"
#include "core/hle/ipc_helpers.h"
#include "core/hle/kernel/event.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/shared_memory.h"
#include "core/hle/service/plgldr/plgldr.h"
#include "core/loader/loader.h"
@ -290,12 +288,7 @@ void PLG_LDR::GetPluginPath(Kernel::HLERequestContext& ctx) {
}
std::shared_ptr<PLG_LDR> GetService(Core::System& system) {
if (!system.KernelRunning())
return nullptr;
auto it = system.Kernel().named_ports.find("plg:ldr");
if (it != system.Kernel().named_ports.end())
return std::static_pointer_cast<PLG_LDR>(it->second->GetServerPort()->hle_handler);
return nullptr;
return system.ServiceManager().GetService<PLG_LDR>("plg:ldr");
}
void InstallInterfaces(Core::System& system) {