2022-04-23 03:59:50 -05:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-05-17 20:45:56 -05:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-07-05 16:19:43 -05:00
|
|
|
#include <array>
|
2019-05-17 20:45:56 -05:00
|
|
|
#include <optional>
|
2023-02-02 23:08:45 -06:00
|
|
|
#include <span>
|
2019-07-05 16:19:43 -05:00
|
|
|
#include <string>
|
2019-05-17 20:45:56 -05:00
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
2019-05-26 10:40:41 -05:00
|
|
|
|
2022-06-25 22:44:19 -05:00
|
|
|
union Result;
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2023-02-19 13:42:12 -06:00
|
|
|
namespace Service {
|
2019-05-17 20:45:56 -05:00
|
|
|
class HLERequestContext;
|
2023-02-19 13:42:12 -06:00
|
|
|
} // namespace Service
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
namespace Service::LM {
|
|
|
|
struct LogMessage;
|
|
|
|
} // namespace Service::LM
|
|
|
|
|
2019-05-17 20:45:56 -05:00
|
|
|
namespace Core {
|
|
|
|
|
2019-07-05 16:19:43 -05:00
|
|
|
class System;
|
|
|
|
|
2019-05-17 20:45:56 -05:00
|
|
|
class Reporter {
|
|
|
|
public:
|
2021-05-16 00:46:30 -05:00
|
|
|
explicit Reporter(System& system_);
|
2019-05-17 20:45:56 -05:00
|
|
|
~Reporter();
|
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Used by fatal services
|
2022-06-25 22:44:19 -05:00
|
|
|
void SaveCrashReport(u64 title_id, Result result, u64 set_flags, u64 entry_point, u64 sp,
|
2019-05-17 20:45:56 -05:00
|
|
|
u64 pc, u64 pstate, u64 afsr0, u64 afsr1, u64 esr, u64 far,
|
|
|
|
const std::array<u64, 31>& registers, const std::array<u64, 32>& backtrace,
|
|
|
|
u32 backtrace_size, const std::string& arch, u32 unk10) const;
|
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Used by syscall svcBreak
|
2019-05-17 20:45:56 -05:00
|
|
|
void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
|
2022-12-05 20:42:22 -06:00
|
|
|
const std::optional<std::vector<u8>>& resolved_buffer = {}) const;
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Used by HLE service handler
|
2023-02-19 13:42:12 -06:00
|
|
|
void SaveUnimplementedFunctionReport(Service::HLERequestContext& ctx, u32 command_id,
|
2019-05-17 20:45:56 -05:00
|
|
|
const std::string& name,
|
|
|
|
const std::string& service_name) const;
|
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Used by stub applet implementation
|
2022-12-05 20:42:22 -06:00
|
|
|
void SaveUnimplementedAppletReport(
|
|
|
|
u32 applet_id, u32 common_args_version, u32 library_version, u32 theme_color,
|
|
|
|
bool startup_sound, u64 system_tick, const std::vector<std::vector<u8>>& normal_channel,
|
|
|
|
const std::vector<std::vector<u8>>& interactive_channel) const;
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2019-06-26 17:02:19 -05:00
|
|
|
enum class PlayReportType {
|
|
|
|
Old,
|
2020-04-20 14:18:23 -05:00
|
|
|
Old2,
|
2019-06-26 17:02:19 -05:00
|
|
|
New,
|
|
|
|
System,
|
|
|
|
};
|
|
|
|
|
2023-02-02 23:08:45 -06:00
|
|
|
void SavePlayReport(PlayReportType type, u64 title_id,
|
|
|
|
const std::vector<std::span<const u8>>& data,
|
2019-06-26 17:02:19 -05:00
|
|
|
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Used by error applet
|
2022-06-25 22:44:19 -05:00
|
|
|
void SaveErrorReport(u64 title_id, Result result,
|
2022-12-05 20:26:00 -06:00
|
|
|
const std::optional<std::string>& custom_text_main = {},
|
|
|
|
const std::optional<std::string>& custom_text_detail = {}) const;
|
2019-05-17 20:45:56 -05:00
|
|
|
|
2021-06-13 03:30:54 -05:00
|
|
|
void SaveFSAccessLog(std::string_view log_message) const;
|
2019-06-28 20:02:50 -05:00
|
|
|
|
2019-06-29 16:15:48 -05:00
|
|
|
// Can be used anywhere to generate a backtrace and general info report at any point during
|
|
|
|
// execution. Not intended to be used for anything other than debugging or testing.
|
2019-05-17 20:45:56 -05:00
|
|
|
void SaveUserReport() const;
|
|
|
|
|
|
|
|
private:
|
2021-06-13 03:30:54 -05:00
|
|
|
void ClearFSAccessLog() const;
|
|
|
|
|
2019-05-17 20:45:56 -05:00
|
|
|
bool IsReportingEnabled() const;
|
2019-05-26 10:40:41 -05:00
|
|
|
|
2019-07-05 16:09:24 -05:00
|
|
|
System& system;
|
2019-05-17 20:45:56 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|