summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/service/lm/manager.cpp12
-rw-r--r--src/core/hle/service/lm/manager.h4
-rw-r--r--src/core/reporter.cpp5
-rw-r--r--src/core/reporter.h3
5 files changed, 15 insertions, 11 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index eb2c2e204..bf62085a8 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -250,6 +250,8 @@ struct System::Impl {
250 telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS", 250 telemetry_session->AddField(Telemetry::FieldType::Performance, "Mean_Frametime_MS",
251 perf_stats->GetMeanFrametime()); 251 perf_stats->GetMeanFrametime());
252 252
253 lm_manager.Flush();
254
253 is_powered_on = false; 255 is_powered_on = false;
254 exit_lock = false; 256 exit_lock = false;
255 257
diff --git a/src/core/hle/service/lm/manager.cpp b/src/core/hle/service/lm/manager.cpp
index fd8edaf46..b67081b86 100644
--- a/src/core/hle/service/lm/manager.cpp
+++ b/src/core/hle/service/lm/manager.cpp
@@ -13,7 +13,7 @@ namespace Service::LM {
13std::ostream& operator<<(std::ostream& os, DestinationFlag dest) { 13std::ostream& operator<<(std::ostream& os, DestinationFlag dest) {
14 std::vector<std::string> array; 14 std::vector<std::string> array;
15 const auto check_single_flag = [dest, &array](DestinationFlag check, std::string name) { 15 const auto check_single_flag = [dest, &array](DestinationFlag check, std::string name) {
16 if ((static_cast<u32>(check) & static_cast<u32>(dest)) > 0) { 16 if ((static_cast<u32>(check) & static_cast<u32>(dest)) != 0) {
17 array.emplace_back(std::move(name)); 17 array.emplace_back(std::move(name));
18 } 18 }
19 }; 19 };
@@ -75,7 +75,7 @@ std::string FormatField(Field type, const std::vector<u8>& data) {
75 if (data.size() >= sizeof(u32)) { 75 if (data.size() >= sizeof(u32)) {
76 u32 line; 76 u32 line;
77 std::memcpy(&line, data.data(), sizeof(u32)); 77 std::memcpy(&line, data.data(), sizeof(u32));
78 return fmt::format("{:08X}", line); 78 return fmt::format("{}", line);
79 } 79 }
80 return "[ERROR DECODING LINE NUMBER]"; 80 return "[ERROR DECODING LINE NUMBER]";
81 case Field::Message: 81 case Field::Message:
@@ -114,16 +114,20 @@ void Manager::Log(LogMessage message) {
114 } 114 }
115} 115}
116 116
117void Manager::Flush() {
118 FinalizeLog();
119}
120
117void Manager::InitializeLog() { 121void Manager::InitializeLog() {
118 current_log.clear(); 122 current_log.clear();
119 123
120 LOG_INFO(Service_LM, "Initialized new log session!"); 124 LOG_INFO(Service_LM, "Initialized new log session");
121} 125}
122 126
123void Manager::FinalizeLog() { 127void Manager::FinalizeLog() {
124 reporter.SaveLogReport(static_cast<u32>(destination), std::move(current_log)); 128 reporter.SaveLogReport(static_cast<u32>(destination), std::move(current_log));
125 129
126 LOG_INFO(Service_LM, "Finalized current log session!"); 130 LOG_INFO(Service_LM, "Finalized current log session");
127} 131}
128 132
129} // namespace Service::LM 133} // namespace Service::LM
diff --git a/src/core/hle/service/lm/manager.h b/src/core/hle/service/lm/manager.h
index af0a27257..544e636ba 100644
--- a/src/core/hle/service/lm/manager.h
+++ b/src/core/hle/service/lm/manager.h
@@ -81,7 +81,7 @@ std::string FormatField(Field type, const std::vector<u8>& data);
81 81
82class Manager { 82class Manager {
83public: 83public:
84 Manager(Core::Reporter& reporter); 84 explicit Manager(Core::Reporter& reporter);
85 ~Manager(); 85 ~Manager();
86 86
87 void SetEnabled(bool enabled); 87 void SetEnabled(bool enabled);
@@ -89,6 +89,8 @@ public:
89 89
90 void Log(LogMessage message); 90 void Log(LogMessage message);
91 91
92 void Flush();
93
92private: 94private:
93 void InitializeLog(); 95 void InitializeLog();
94 void FinalizeLog(); 96 void FinalizeLog();
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp
index a465d7421..6f4af77fd 100644
--- a/src/core/reporter.cpp
+++ b/src/core/reporter.cpp
@@ -8,7 +8,6 @@
8#include <fmt/chrono.h> 8#include <fmt/chrono.h>
9#include <fmt/format.h> 9#include <fmt/format.h>
10#include <fmt/ostream.h> 10#include <fmt/ostream.h>
11#include <fmt/time.h>
12#include <json.hpp> 11#include <json.hpp>
13 12
14#include "common/file_util.h" 13#include "common/file_util.h"
@@ -393,11 +392,11 @@ void Reporter::SaveLogReport(u32 destination, std::vector<Service::LM::LogMessag
393 out["type"] = fmt::format("{}", kv.first); 392 out["type"] = fmt::format("{}", kv.first);
394 out["data"] = 393 out["data"] =
395 Service::LM::FormatField(kv.first, kv.second); 394 Service::LM::FormatField(kv.first, kv.second);
396 return std::move(out); 395 return out;
397 }); 396 });
398 397
399 out["fields"] = std::move(fields); 398 out["fields"] = std::move(fields);
400 return std::move(out); 399 return out;
401 }); 400 });
402 401
403 out["log_messages"] = std::move(json_messages); 402 out["log_messages"] = std::move(json_messages);
diff --git a/src/core/reporter.h b/src/core/reporter.h
index 6e51113fd..380941b1b 100644
--- a/src/core/reporter.h
+++ b/src/core/reporter.h
@@ -59,9 +59,6 @@ public:
59 New, 59 New,
60 System, 60 System,
61 }; 61 };
62 // Used by prepo services
63 void SavePlayReport(u64 title_id, u64 process_id, std::vector<std::vector<u8>> data,
64 std::optional<u128> user_id = {}) const;
65 62
66 void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data, 63 void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data,
67 std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const; 64 std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;