2019-05-18 04:45:56 +03:00
|
|
|
// Copyright 2019 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2019-07-06 00:19:43 +03:00
|
|
|
#include <array>
|
2019-05-18 04:45:56 +03:00
|
|
|
#include <optional>
|
2019-07-06 00:19:43 +03:00
|
|
|
#include <string>
|
2019-05-18 04:45:56 +03:00
|
|
|
#include <vector>
|
|
|
|
#include "common/common_types.h"
|
2019-05-26 18:40:41 +03:00
|
|
|
|
|
|
|
union ResultCode;
|
2019-05-18 04:45:56 +03:00
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
class HLERequestContext;
|
|
|
|
} // namespace Kernel
|
|
|
|
|
2019-06-29 04:02:50 +03:00
|
|
|
namespace Service::FileSystem {
|
|
|
|
enum class LogMode : u32;
|
|
|
|
}
|
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
namespace Service::LM {
|
|
|
|
struct LogMessage;
|
|
|
|
} // namespace Service::LM
|
|
|
|
|
2019-05-18 04:45:56 +03:00
|
|
|
namespace Core {
|
|
|
|
|
2019-07-06 00:19:43 +03:00
|
|
|
class System;
|
|
|
|
|
2019-05-18 04:45:56 +03:00
|
|
|
class Reporter {
|
|
|
|
public:
|
2019-07-06 00:09:24 +03:00
|
|
|
explicit Reporter(System& system);
|
2019-05-18 04:45:56 +03:00
|
|
|
~Reporter();
|
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
// Used by fatal services
|
2019-05-18 04:45:56 +03:00
|
|
|
void SaveCrashReport(u64 title_id, ResultCode result, u64 set_flags, u64 entry_point, u64 sp,
|
|
|
|
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-30 00:15:48 +03:00
|
|
|
// Used by syscall svcBreak
|
2019-05-18 04:45:56 +03:00
|
|
|
void SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 info2,
|
|
|
|
std::optional<std::vector<u8>> resolved_buffer = {}) const;
|
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
// Used by HLE service handler
|
2019-05-18 04:45:56 +03:00
|
|
|
void SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u32 command_id,
|
|
|
|
const std::string& name,
|
|
|
|
const std::string& service_name) const;
|
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
// Used by stub applet implementation
|
2019-05-18 04:45:56 +03:00
|
|
|
void SaveUnimplementedAppletReport(u32 applet_id, u32 common_args_version, u32 library_version,
|
|
|
|
u32 theme_color, bool startup_sound, u64 system_tick,
|
|
|
|
std::vector<std::vector<u8>> normal_channel,
|
|
|
|
std::vector<std::vector<u8>> interactive_channel) const;
|
|
|
|
|
2019-06-27 01:02:19 +03:00
|
|
|
enum class PlayReportType {
|
|
|
|
Old,
|
2020-04-20 22:18:23 +03:00
|
|
|
Old2,
|
2019-06-27 01:02:19 +03:00
|
|
|
New,
|
|
|
|
System,
|
|
|
|
};
|
|
|
|
|
|
|
|
void SavePlayReport(PlayReportType type, u64 title_id, std::vector<std::vector<u8>> data,
|
|
|
|
std::optional<u64> process_id = {}, std::optional<u128> user_id = {}) const;
|
2019-05-18 04:45:56 +03:00
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
// Used by error applet
|
2019-05-18 04:45:56 +03:00
|
|
|
void SaveErrorReport(u64 title_id, ResultCode result,
|
|
|
|
std::optional<std::string> custom_text_main = {},
|
|
|
|
std::optional<std::string> custom_text_detail = {}) const;
|
|
|
|
|
2019-06-29 04:02:50 +03:00
|
|
|
void SaveFilesystemAccessReport(Service::FileSystem::LogMode log_mode,
|
|
|
|
std::string log_message) const;
|
|
|
|
|
2019-06-30 00:15:48 +03:00
|
|
|
// Used by lm services
|
|
|
|
void SaveLogReport(u32 destination, std::vector<Service::LM::LogMessage> messages) const;
|
|
|
|
|
|
|
|
// 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-18 04:45:56 +03:00
|
|
|
void SaveUserReport() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
bool IsReportingEnabled() const;
|
2019-05-26 18:40:41 +03:00
|
|
|
|
2019-07-06 00:09:24 +03:00
|
|
|
System& system;
|
2019-05-18 04:45:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Core
|