From 215fd827384904f1cb7fa689ff8cd3f61dbbd007 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 28 May 2019 21:12:23 -0400 Subject: 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. --- src/core/core.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/core.cpp') diff --git a/src/core/core.cpp b/src/core/core.cpp index 7106151bd..9f9356f53 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -144,7 +144,6 @@ struct System::Impl { ResultStatus Load(System& system, Frontend::EmuWindow& emu_window, const std::string& filepath) { app_loader = Loader::GetLoader(GetGameFileFromPath(virtual_filesystem, filepath)); - if (!app_loader) { LOG_CRITICAL(Core, "Failed to obtain loader for {}!", filepath); return ResultStatus::ErrorGetLoader; @@ -167,6 +166,7 @@ struct System::Impl { return init_result; } + telemetry_session->AddInitialInfo(*app_loader); auto main_process = Kernel::Process::Create(system, "main"); const auto [load_result, load_parameters] = app_loader->Load(*main_process); if (load_result != Loader::ResultStatus::Success) { -- cgit v1.2.3