core/telemetry_session: Remove usages of the global system accessor

Makes the dependency explicit in the TelemetrySession's interface
instead of making it a hidden dependency.

This also revealed a hidden issue with the way the telemetry session was
being initialized. It was attempting to retrieve the app loader and log
out title-specific information. However, this isn't always guaranteed to
be possible.

During the initialization phase, everything is being constructed. It
doesn't mean an actual title has been selected. This is what the Load()
function is for. This potentially results in dead code paths involving
the app loader. Instead, we explicitly add this information when we know
the app loader instance is available.
This commit is contained in:
Lioncash 2019-05-28 21:12:23 -04:00 committed by fearlessTobi
parent 55ec0f5850
commit 0a82b00e35
3 changed files with 49 additions and 26 deletions

View file

@ -94,7 +94,6 @@ System::ResultStatus System::SingleStep() {
System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
app_loader = Loader::GetLoader(filepath);
if (!app_loader) {
LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath);
return ResultStatus::ErrorGetLoader;
@ -125,6 +124,7 @@ System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::st
return init_result;
}
telemetry_session->AddInitialInfo(*app_loader);
std::shared_ptr<Kernel::Process> process;
const Loader::ResultStatus load_result{app_loader->Load(process)};
kernel->SetCurrentProcess(process);