mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2026-06-05 19:56:57 +00:00
erpt: use official name for erpt::IManager cmd 7
This commit is contained in:
parent
6acdc05c89
commit
8a7c2872c3
@ -246,24 +246,24 @@ namespace ams::erpt {
|
|||||||
constexpr inline u32 ErrorCodeSizeMax = 15;
|
constexpr inline u32 ErrorCodeSizeMax = 15;
|
||||||
constexpr inline u32 ProgramIdSizeMax = 17;
|
constexpr inline u32 ProgramIdSizeMax = 17;
|
||||||
|
|
||||||
struct RecentReportEntry {
|
struct NotifiableErrorCodeReportEntry {
|
||||||
char error_code[ErrorCodeSizeMax];
|
char error_code[ErrorCodeSizeMax];
|
||||||
char program_id[ProgramIdSizeMax];
|
char program_id[ProgramIdSizeMax];
|
||||||
u8 is_visible;
|
u8 is_visible;
|
||||||
u8 is_system_abort;
|
u8 is_system_abort;
|
||||||
u8 is_application_abort;
|
u8 is_application_abort;
|
||||||
};
|
};
|
||||||
static_assert(sizeof(RecentReportEntry) == 35);
|
static_assert(sizeof(NotifiableErrorCodeReportEntry) == 35);
|
||||||
|
|
||||||
struct RecentReportSummary : public sf::LargeData, public sf::PrefersAutoSelectTransferMode {
|
struct NotifiableErrorCodesData : public sf::LargeData, public sf::PrefersAutoSelectTransferMode {
|
||||||
u32 entry_count;
|
u32 entry_count;
|
||||||
RecentReportEntry entries[50];
|
NotifiableErrorCodeReportEntry entries[50];
|
||||||
char firmware_display_version[0x18];
|
char firmware_display_version[0x18];
|
||||||
char private_os_version[96];
|
char private_os_version[96];
|
||||||
char product_model[16];
|
char product_model[16];
|
||||||
char region_code[34];
|
char region_code[34];
|
||||||
};
|
};
|
||||||
static_assert(sizeof(RecentReportSummary) == 0x784);
|
static_assert(sizeof(NotifiableErrorCodesData) == 0x784);
|
||||||
|
|
||||||
struct SystemInfo {
|
struct SystemInfo {
|
||||||
char os_version[0x18];
|
char os_version[0x18];
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
AMS_SF_METHOD_INFO(C, H, 4, Result, GetStorageUsageStatistics, (ams::sf::Out<erpt::StorageUsageStatistics> out), (out), hos::Version_5_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 4, Result, GetStorageUsageStatistics, (ams::sf::Out<erpt::StorageUsageStatistics> out), (out), hos::Version_5_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 5, Result, GetAttachmentListDeprecated, (const ams::sf::OutBuffer &out_buf, const erpt::ReportId &report_id), (out_buf, report_id), hos::Version_8_0_0, hos::Version_19_0_1) \
|
AMS_SF_METHOD_INFO(C, H, 5, Result, GetAttachmentListDeprecated, (const ams::sf::OutBuffer &out_buf, const erpt::ReportId &report_id), (out_buf, report_id), hos::Version_8_0_0, hos::Version_19_0_1) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 6, Result, GetAttachmentList, (ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buf, const erpt::ReportId &report_id), (out_count, out_buf, report_id), hos::Version_20_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 6, Result, GetAttachmentList, (ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buf, const erpt::ReportId &report_id), (out_count, out_buf, report_id), hos::Version_20_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 7, Result, GetRecentReportSummary, (ams::sf::Out<erpt::RecentReportSummary> out), (out), hos::Version_22_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 7, Result, PopNotifiableErrorCodes, (ams::sf::Out<erpt::NotifiableErrorCodesData> out), (out), hos::Version_22_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 10, Result, GetReportSizeMax, (ams::sf::Out<u32> out), (out), hos::Version_20_0_0)
|
AMS_SF_METHOD_INFO(C, H, 10, Result, GetReportSizeMax, (ams::sf::Out<u32> out), (out), hos::Version_20_0_0)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
#include "erpt_srv_journal.hpp"
|
#include "erpt_srv_journal.hpp"
|
||||||
#include "erpt_srv_service.hpp"
|
#include "erpt_srv_service.hpp"
|
||||||
#include "erpt_srv_forced_shutdown.hpp"
|
#include "erpt_srv_forced_shutdown.hpp"
|
||||||
#include "erpt_srv_recent_report.hpp"
|
#include "erpt_srv_notifiable_errors.hpp"
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include "erpt_srv_manager_impl.hpp"
|
#include "erpt_srv_manager_impl.hpp"
|
||||||
#include "erpt_srv_journal.hpp"
|
#include "erpt_srv_journal.hpp"
|
||||||
#include "erpt_srv_recent_report.hpp"
|
#include "erpt_srv_notifiable_errors.hpp"
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ namespace ams::erpt::srv {
|
|||||||
Result ManagerImpl::CleanupReports() {
|
Result ManagerImpl::CleanupReports() {
|
||||||
Journal::CleanupReports();
|
Journal::CleanupReports();
|
||||||
Journal::CleanupAttachments();
|
Journal::CleanupAttachments();
|
||||||
RecentReport::Clear();
|
NotifiableErrorCodeReport::Clear();
|
||||||
R_RETURN(Journal::Commit());
|
R_RETURN(Journal::Commit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,8 +106,8 @@ namespace ams::erpt::srv {
|
|||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
Result ManagerImpl::GetRecentReportSummary(ams::sf::Out<RecentReportSummary> out) {
|
Result ManagerImpl::PopNotifiableErrorCodes(ams::sf::Out<NotifiableErrorCodesData> out) {
|
||||||
RecentReport::GetSummary(out.GetPointer());
|
NotifiableErrorCodeReport::PopNotifiableErrorCodes(out.GetPointer());
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace ams::erpt::srv {
|
|||||||
Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out);
|
Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out);
|
||||||
Result GetAttachmentListDeprecated(const ams::sf::OutBuffer &out_buf, const ReportId &report_id);
|
Result GetAttachmentListDeprecated(const ams::sf::OutBuffer &out_buf, const ReportId &report_id);
|
||||||
Result GetAttachmentList(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buf, const ReportId &report_id);
|
Result GetAttachmentList(ams::sf::Out<u32> out_count, const ams::sf::OutBuffer &out_buf, const ReportId &report_id);
|
||||||
Result GetRecentReportSummary(ams::sf::Out<RecentReportSummary> out);
|
Result PopNotifiableErrorCodes(ams::sf::Out<NotifiableErrorCodesData> out);
|
||||||
Result GetReportSizeMax(ams::sf::Out<u32> out);
|
Result GetReportSizeMax(ams::sf::Out<u32> out);
|
||||||
};
|
};
|
||||||
static_assert(erpt::sf::IsIManager<ManagerImpl>);
|
static_assert(erpt::sf::IsIManager<ManagerImpl>);
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include <stratosphere.hpp>
|
#include <stratosphere.hpp>
|
||||||
#include "erpt_srv_recent_report.hpp"
|
#include "erpt_srv_notifiable_errors.hpp"
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
@ -22,14 +22,14 @@ namespace ams::erpt::srv {
|
|||||||
|
|
||||||
constexpr size_t MaxEntriesPerType = 25;
|
constexpr size_t MaxEntriesPerType = 25;
|
||||||
|
|
||||||
struct RecentReportState {
|
struct NotifiableErrorCodeReportState {
|
||||||
u32 report_counts[ReportType_Count];
|
u32 report_counts[ReportType_Count];
|
||||||
RecentReportEntry report_entries[ReportType_Count][MaxEntriesPerType];
|
NotifiableErrorCodeReportEntry report_entries[ReportType_Count][MaxEntriesPerType];
|
||||||
os::Tick last_tick;
|
os::Tick last_tick;
|
||||||
u32 consecutive_count;
|
u32 consecutive_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
constinit RecentReportState g_state = {
|
constinit NotifiableErrorCodeReportState g_state = {
|
||||||
.report_counts = {},
|
.report_counts = {},
|
||||||
.report_entries = {},
|
.report_entries = {},
|
||||||
.last_tick = os::Tick{},
|
.last_tick = os::Tick{},
|
||||||
@ -38,18 +38,18 @@ namespace ams::erpt::srv {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecentReport::PushEntry(const char *error_code, const char *program_id, ReportType type, bool is_system_abort, bool is_application_abort) {
|
void NotifiableErrorCodeReport::PushEntry(const char *error_code, const char *program_id, ReportType type, bool is_system_abort, bool is_application_abort) {
|
||||||
u32 &count = g_state.report_counts[type];
|
u32 &count = g_state.report_counts[type];
|
||||||
RecentReportEntry *entries = g_state.report_entries[type];
|
NotifiableErrorCodeReportEntry *entries = g_state.report_entries[type];
|
||||||
|
|
||||||
/* If we're full, shift the oldest entry out. */
|
/* If we're full, shift the oldest entry out. */
|
||||||
if (count >= MaxEntriesPerType) {
|
if (count >= MaxEntriesPerType) {
|
||||||
std::memmove(entries, entries + 1, sizeof(RecentReportEntry) * (MaxEntriesPerType - 1));
|
std::memmove(entries, entries + 1, sizeof(NotifiableErrorCodeReportEntry) * (MaxEntriesPerType - 1));
|
||||||
count = MaxEntriesPerType - 1;
|
count = MaxEntriesPerType - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill the new entry. */
|
/* Fill the new entry. */
|
||||||
RecentReportEntry &entry = entries[count];
|
NotifiableErrorCodeReportEntry &entry = entries[count];
|
||||||
util::Strlcpy(entry.error_code, error_code, sizeof(entry.error_code));
|
util::Strlcpy(entry.error_code, error_code, sizeof(entry.error_code));
|
||||||
util::Strlcpy(entry.program_id, program_id, sizeof(entry.program_id));
|
util::Strlcpy(entry.program_id, program_id, sizeof(entry.program_id));
|
||||||
entry.is_visible = (type == ReportType_Visible);
|
entry.is_visible = (type == ReportType_Visible);
|
||||||
@ -59,7 +59,7 @@ namespace ams::erpt::srv {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecentReport::GetSummary(RecentReportSummary *out) {
|
void NotifiableErrorCodeReport::PopNotifiableErrorCodes(NotifiableErrorCodesData *out) {
|
||||||
/* Fill basic info from lazily-initialized system info. */
|
/* Fill basic info from lazily-initialized system info. */
|
||||||
const auto &sys_info = srv::GetSystemInfo();
|
const auto &sys_info = srv::GetSystemInfo();
|
||||||
util::Strlcpy(out->firmware_display_version, sys_info.os_version, sizeof(out->firmware_display_version));
|
util::Strlcpy(out->firmware_display_version, sys_info.os_version, sizeof(out->firmware_display_version));
|
||||||
@ -74,7 +74,7 @@ namespace ams::erpt::srv {
|
|||||||
if (g_state.report_counts[i] == 0) {
|
if (g_state.report_counts[i] == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
std::memcpy(out->entries + total_count, g_state.report_entries[i], sizeof(RecentReportEntry) * g_state.report_counts[i]);
|
std::memcpy(out->entries + total_count, g_state.report_entries[i], sizeof(NotifiableErrorCodeReportEntry) * g_state.report_counts[i]);
|
||||||
total_count += g_state.report_counts[i];
|
total_count += g_state.report_counts[i];
|
||||||
|
|
||||||
/* Reset count (destructive read). */
|
/* Reset count (destructive read). */
|
||||||
@ -84,7 +84,7 @@ namespace ams::erpt::srv {
|
|||||||
out->entry_count = total_count;
|
out->entry_count = total_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecentReport::Clear() {
|
void NotifiableErrorCodeReport::Clear() {
|
||||||
for (u32 i = 0; i < ReportType_Count; i++) {
|
for (u32 i = 0; i < ReportType_Count; i++) {
|
||||||
g_state.report_counts[i] = 0;
|
g_state.report_counts[i] = 0;
|
||||||
}
|
}
|
||||||
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
class RecentReport {
|
class NotifiableErrorCodeReport {
|
||||||
public:
|
public:
|
||||||
static void PushEntry(const char *error_code, const char *program_id, ReportType type, bool is_system_abort, bool is_application_abort);
|
static void PushEntry(const char *error_code, const char *program_id, ReportType type, bool is_system_abort, bool is_application_abort);
|
||||||
static void GetSummary(RecentReportSummary *out);
|
static void PopNotifiableErrorCodes(NotifiableErrorCodesData *out);
|
||||||
static void Clear();
|
static void Clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
#include "erpt_srv_context_record.hpp"
|
#include "erpt_srv_context_record.hpp"
|
||||||
#include "erpt_srv_context.hpp"
|
#include "erpt_srv_context.hpp"
|
||||||
#include "erpt_srv_fs_info.hpp"
|
#include "erpt_srv_fs_info.hpp"
|
||||||
#include "erpt_srv_recent_report.hpp"
|
#include "erpt_srv_notifiable_errors.hpp"
|
||||||
|
|
||||||
namespace ams::erpt::srv {
|
namespace ams::erpt::srv {
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ namespace ams::erpt::srv {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RecentReport::PushEntry(error_code, program_id, type, is_system_abort, is_application_abort);
|
NotifiableErrorCodeReport::PushEntry(error_code, program_id, type, is_system_abort, is_application_abort);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generate report id. */
|
/* Generate report id. */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user