Merge pull request #2761 from alula/22_support

22.0.0 support part 3
This commit is contained in:
hexkyz
2026-04-02 01:17:19 +01:00
committed by GitHub
8 changed files with 28 additions and 28 deletions

View File

@@ -246,24 +246,24 @@ namespace ams::erpt {
constexpr inline u32 ErrorCodeSizeMax = 15;
constexpr inline u32 ProgramIdSizeMax = 17;
struct RecentReportEntry {
struct NotifiableErrorCodeReportEntry {
char error_code[ErrorCodeSizeMax];
char program_id[ProgramIdSizeMax];
u8 is_visible;
u8 is_system_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;
RecentReportEntry entries[50];
NotifiableErrorCodeReportEntry entries[50];
char firmware_display_version[0x18];
char private_os_version[96];
char product_model[16];
char region_code[34];
};
static_assert(sizeof(RecentReportSummary) == 0x784);
static_assert(sizeof(NotifiableErrorCodesData) == 0x784);
struct SystemInfo {
char os_version[0x18];

View File

@@ -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, 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, 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)

View File

@@ -21,7 +21,7 @@
#include "erpt_srv_journal.hpp"
#include "erpt_srv_service.hpp"
#include "erpt_srv_forced_shutdown.hpp"
#include "erpt_srv_recent_report.hpp"
#include "erpt_srv_notifiable_errors.hpp"
namespace ams::erpt::srv {

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "erpt_srv_manager_impl.hpp"
#include "erpt_srv_journal.hpp"
#include "erpt_srv_recent_report.hpp"
#include "erpt_srv_notifiable_errors.hpp"
namespace ams::erpt::srv {
@@ -60,7 +60,7 @@ namespace ams::erpt::srv {
Result ManagerImpl::CleanupReports() {
Journal::CleanupReports();
Journal::CleanupAttachments();
RecentReport::Clear();
NotifiableErrorCodeReport::Clear();
R_RETURN(Journal::Commit());
}
@@ -101,13 +101,13 @@ namespace ams::erpt::srv {
Result ManagerImpl::GetReportSizeMax(ams::sf::Out<u32> out) {
/* TODO: Where is this size defined? */
constexpr size_t ReportSizeMax = 0x35D3D;
constexpr size_t ReportSizeMax = 0x3FF4F;
*out = ReportSizeMax;
R_SUCCEED();
}
Result ManagerImpl::GetRecentReportSummary(ams::sf::Out<RecentReportSummary> out) {
RecentReport::GetSummary(out.GetPointer());
Result ManagerImpl::PopNotifiableErrorCodes(ams::sf::Out<NotifiableErrorCodesData> out) {
NotifiableErrorCodeReport::PopNotifiableErrorCodes(out.GetPointer());
R_SUCCEED();
}

View File

@@ -36,7 +36,7 @@ namespace ams::erpt::srv {
Result GetStorageUsageStatistics(ams::sf::Out<StorageUsageStatistics> out);
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 GetRecentReportSummary(ams::sf::Out<RecentReportSummary> out);
Result PopNotifiableErrorCodes(ams::sf::Out<NotifiableErrorCodesData> out);
Result GetReportSizeMax(ams::sf::Out<u32> out);
};
static_assert(erpt::sf::IsIManager<ManagerImpl>);

View File

@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "erpt_srv_recent_report.hpp"
#include "erpt_srv_notifiable_errors.hpp"
namespace ams::erpt::srv {
@@ -22,14 +22,14 @@ namespace ams::erpt::srv {
constexpr size_t MaxEntriesPerType = 25;
struct RecentReportState {
struct NotifiableErrorCodeReportState {
u32 report_counts[ReportType_Count];
RecentReportEntry report_entries[ReportType_Count][MaxEntriesPerType];
NotifiableErrorCodeReportEntry report_entries[ReportType_Count][MaxEntriesPerType];
os::Tick last_tick;
u32 consecutive_count;
};
constinit RecentReportState g_state = {
constinit NotifiableErrorCodeReportState g_state = {
.report_counts = {},
.report_entries = {},
.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];
RecentReportEntry *entries = g_state.report_entries[type];
NotifiableErrorCodeReportEntry *entries = g_state.report_entries[type];
/* If we're full, shift the oldest entry out. */
if (count >= MaxEntriesPerType) {
std::memmove(entries, entries + 1, sizeof(RecentReportEntry) * (MaxEntriesPerType - 1));
std::memmove(entries, entries + 1, sizeof(NotifiableErrorCodeReportEntry) * (MaxEntriesPerType - 1));
count = MaxEntriesPerType - 1;
}
/* 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.program_id, program_id, sizeof(entry.program_id));
entry.is_visible = (type == ReportType_Visible);
@@ -59,7 +59,7 @@ namespace ams::erpt::srv {
count++;
}
void RecentReport::GetSummary(RecentReportSummary *out) {
void NotifiableErrorCodeReport::PopNotifiableErrorCodes(NotifiableErrorCodesData *out) {
/* Fill basic info from lazily-initialized system info. */
const auto &sys_info = srv::GetSystemInfo();
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) {
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];
/* Reset count (destructive read). */
@@ -84,7 +84,7 @@ namespace ams::erpt::srv {
out->entry_count = total_count;
}
void RecentReport::Clear() {
void NotifiableErrorCodeReport::Clear() {
for (u32 i = 0; i < ReportType_Count; i++) {
g_state.report_counts[i] = 0;
}

View File

@@ -18,10 +18,10 @@
namespace ams::erpt::srv {
class RecentReport {
class NotifiableErrorCodeReport {
public:
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();
};

View File

@@ -20,7 +20,7 @@
#include "erpt_srv_context_record.hpp"
#include "erpt_srv_context.hpp"
#include "erpt_srv_fs_info.hpp"
#include "erpt_srv_recent_report.hpp"
#include "erpt_srv_notifiable_errors.hpp"
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. */