summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/reporter.cpp27
-rw-r--r--src/core/reporter.h12
2 files changed, 20 insertions, 19 deletions
diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp
index 543b91d9a..77821e047 100644
--- a/src/core/reporter.cpp
+++ b/src/core/reporter.cpp
@@ -38,7 +38,7 @@ std::string GetTimestamp() {
38 38
39using namespace nlohmann; 39using namespace nlohmann;
40 40
41void SaveToFile(json json, const std::filesystem::path& filename) { 41void SaveToFile(const json& json, const std::filesystem::path& filename) {
42 if (!Common::FS::CreateParentDirs(filename)) { 42 if (!Common::FS::CreateParentDirs(filename)) {
43 LOG_ERROR(Core, "Failed to create path for '{}' to save report!", 43 LOG_ERROR(Core, "Failed to create path for '{}' to save report!",
44 Common::FS::PathToUTF8String(filename)); 44 Common::FS::PathToUTF8String(filename));
@@ -81,8 +81,8 @@ json GetReportCommonData(u64 title_id, Result result, const std::string& timesta
81} 81}
82 82
83json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64 sp, u64 pc, 83json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64 sp, u64 pc,
84 u64 pstate, std::array<u64, 31> registers, 84 u64 pstate, const std::array<u64, 31>& registers,
85 std::optional<std::array<u64, 32>> backtrace = {}) { 85 const std::optional<std::array<u64, 32>>& backtrace = {}) {
86 auto out = json{ 86 auto out = json{
87 {"entry_point", fmt::format("{:016X}", entry_point)}, 87 {"entry_point", fmt::format("{:016X}", entry_point)},
88 {"sp", fmt::format("{:016X}", sp)}, 88 {"sp", fmt::format("{:016X}", sp)},
@@ -224,11 +224,11 @@ void Reporter::SaveCrashReport(u64 title_id, Result result, u64 set_flags, u64 e
224 224
225 out["processor_state"] = std::move(proc_out); 225 out["processor_state"] = std::move(proc_out);
226 226
227 SaveToFile(std::move(out), GetPath("crash_report", title_id, timestamp)); 227 SaveToFile(out, GetPath("crash_report", title_id, timestamp));
228} 228}
229 229
230void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2, 230void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
231 std::optional<std::vector<u8>> resolved_buffer) const { 231 const std::optional<std::vector<u8>>& resolved_buffer) const {
232 if (!IsReportingEnabled()) { 232 if (!IsReportingEnabled()) {
233 return; 233 return;
234 } 234 }
@@ -250,7 +250,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64
250 250
251 out["svc_break"] = std::move(break_out); 251 out["svc_break"] = std::move(break_out);
252 252
253 SaveToFile(std::move(out), GetPath("svc_break_report", title_id, timestamp)); 253 SaveToFile(out, GetPath("svc_break_report", title_id, timestamp));
254} 254}
255 255
256void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, 256void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id,
@@ -271,13 +271,13 @@ void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u
271 271
272 out["function"] = std::move(function_out); 272 out["function"] = std::move(function_out);
273 273
274 SaveToFile(std::move(out), GetPath("unimpl_func_report", title_id, timestamp)); 274 SaveToFile(out, GetPath("unimpl_func_report", title_id, timestamp));
275} 275}
276 276
277void Reporter::SaveUnimplementedAppletReport( 277void Reporter::SaveUnimplementedAppletReport(
278 u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color, 278 u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color,
279 bool startup_sound, u64 system_tick, std::vector<std::vector<u8>> normal_channel, 279 bool startup_sound, u64 system_tick, const std::vector<std::vector<u8>>& normal_channel,
280 std::vector<std::vector<u8>> interactive_channel) const { 280 const std::vector<std::vector<u8>>& interactive_channel) const {
281 if (!IsReportingEnabled()) { 281 if (!IsReportingEnabled()) {
282 return; 282 return;
283 } 283 }
@@ -308,10 +308,11 @@ void Reporter::SaveUnimplementedAppletReport(
308 out["applet_normal_data"] = std::move(normal_out); 308 out["applet_normal_data"] = std::move(normal_out);
309 out["applet_interactive_data"] = std::move(interactive_out); 309 out["applet_interactive_data"] = std::move(interactive_out);
310 310
311 SaveToFile(std::move(out), GetPath("unimpl_applet_report", title_id, timestamp)); 311 SaveToFile(out, GetPath("unimpl_applet_report", title_id, timestamp));
312} 312}
313 313
314void Reporter::SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data, 314void Reporter::SavePlayReport(PlayReportType type, u64 title_id,
315 const std::vector<std::vector<u8>>& data,
315 std::optional<u64> process_id, std::optional<u128> user_id) const { 316 std::optional<u64> process_id, std::optional<u128> user_id) const {
316 if (!IsReportingEnabled()) { 317 if (!IsReportingEnabled()) {
317 return; 318 return;
@@ -335,7 +336,7 @@ void Reporter::SavePlayReport(PlayReportType type, u64 title_id, std::vector<std
335 out["play_report_type"] = fmt::format("{:02}", static_cast<u8>(type)); 336 out["play_report_type"] = fmt::format("{:02}", static_cast<u8>(type));
336 out["play_report_data"] = std::move(data_out); 337 out["play_report_data"] = std::move(data_out);
337 338
338 SaveToFile(std::move(out), GetPath("play_report", title_id, timestamp)); 339 SaveToFile(out, GetPath("play_report", title_id, timestamp));
339} 340}
340 341
341void Reporter::SaveErrorReport(u64 title_id, Result result, 342void Reporter::SaveErrorReport(u64 title_id, Result result,
@@ -358,7 +359,7 @@ void Reporter::SaveErrorReport(u64 title_id, Result result,
358 {"detail", custom_text_detail.value_or("")}, 359 {"detail", custom_text_detail.value_or("")},
359 }; 360 };
360 361
361 SaveToFile(std::move(out), GetPath("error_report", title_id, timestamp)); 362 SaveToFile(out, GetPath("error_report", title_id, timestamp));
362} 363}
363 364
364void Reporter::SaveFSAccessLog(std::string_view log_message) const { 365void Reporter::SaveFSAccessLog(std::string_view log_message) const {
diff --git a/src/core/reporter.h b/src/core/reporter.h
index 983a9545a..9fdb9d6c1 100644
--- a/src/core/reporter.h
+++ b/src/core/reporter.h
@@ -36,7 +36,7 @@ public:
36 36
37 // Used by syscall svcBreak 37 // Used by syscall svcBreak
38 void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2, 38 void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
39 std::optional<std::vector<u8>> resolved_buffer = {}) const; 39 const std::optional<std::vector<u8>>& resolved_buffer = {}) const;
40 40
41 // Used by HLE service handler 41 // Used by HLE service handler
42 void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id, 42 void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id,
@@ -44,10 +44,10 @@ public:
44 const std::string& service_name) const; 44 const std::string& service_name) const;
45 45
46 // Used by stub applet implementation 46 // Used by stub applet implementation
47 void SaveUnimplementedAppletReport(u32 applet_id, u32 common_args_version, u32 library_version, 47 void SaveUnimplementedAppletReport(
48 u32 theme_color, bool startup_sound, u64 system_tick, 48 u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color,
49 std::vector<std::vector<u8>> normal_channel, 49 bool startup_sound, u64 system_tick, const std::vector<std::vector<u8>>& normal_channel,
50 std::vector<std::vector<u8>> interactive_channel) const; 50 const std::vector<std::vector<u8>>& interactive_channel) const;
51 51
52 enum class PlayReportType { 52 enum class PlayReportType {
53 Old, 53 Old,
@@ -56,7 +56,7 @@ public:
56 System, 56 System,
57 }; 57 };
58 58
59 void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data, 59 void SavePlayReport(PlayReportType type, u64 title_id, const std::vector<std::vector<u8>>& data,
60 std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const; 60 std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
61 61
62 // Used by error applet 62 // Used by error applet