mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-02 23:59:49 -04:00
erpt: Add basic (TODO-impl post-prerelease) support for 17.0.0 changes
This commit is contained in:
parent
9d4cb685a7
commit
aa170a72a9
15 changed files with 1487 additions and 747 deletions
|
@ -48,7 +48,7 @@ namespace ams::erpt::srv {
|
|||
ON_SCOPE_EXIT { Deallocate(hdr); };
|
||||
|
||||
hdr->magic = HeaderMagic;
|
||||
hdr->field_type = static_cast<u32>(FieldToTypeMap[field_id]);
|
||||
hdr->field_type = static_cast<u32>(ConvertFieldToType(field_id));
|
||||
hdr->element_count = arr_size;
|
||||
hdr->reserved = 0;
|
||||
|
||||
|
@ -81,7 +81,7 @@ namespace ams::erpt::srv {
|
|||
oaep.Encrypt(cipher, sizeof(cipher), s_key, sizeof(s_key), salt, sizeof(salt));
|
||||
}
|
||||
|
||||
Formatter::AddField(report, FieldId_CipherKey, cipher, sizeof(cipher));
|
||||
Formatter::AddField(report, ERPT_FIELD_ID(CipherKey), cipher, sizeof(cipher));
|
||||
std::memset(s_key, 0, sizeof(s_key));
|
||||
|
||||
R_RETURN(Formatter::End(report));
|
||||
|
@ -97,7 +97,7 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, char *str, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
if (ConvertFieldToFlag(field_id) == FieldFlag_Encrypt) {
|
||||
R_RETURN(EncryptArray<char>(report, field_id, str, len));
|
||||
} else {
|
||||
R_RETURN(Formatter::AddField(report, field_id, str, len));
|
||||
|
@ -105,7 +105,7 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
static Result AddField(Report *report, FieldId field_id, u8 *bin, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
if (ConvertFieldToFlag(field_id) == FieldFlag_Encrypt) {
|
||||
R_RETURN(EncryptArray<u8>(report, field_id, bin, len));
|
||||
} else {
|
||||
R_RETURN(Formatter::AddField(report, field_id, bin, len));
|
||||
|
@ -114,7 +114,7 @@ namespace ams::erpt::srv {
|
|||
|
||||
template<typename T>
|
||||
static Result AddField(Report *report, FieldId field_id, T *arr, u32 len) {
|
||||
if (FieldToFlagMap[field_id] == FieldFlag_Encrypt) {
|
||||
if (ConvertFieldToFlag(field_id) == FieldFlag_Encrypt) {
|
||||
R_RETURN(EncryptArray<T>(report, field_id, arr, len));
|
||||
} else {
|
||||
R_RETURN(Formatter::AddField<T>(report, field_id, arr, len));
|
||||
|
|
|
@ -38,7 +38,7 @@ namespace ams::erpt::srv {
|
|||
R_RETURN(Context::SubmitContext(ctx, data, data_size));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result) {
|
||||
Result ContextImpl::CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result, erpt::CreateReportOptionFlagSet flags) {
|
||||
const ContextEntry *ctx = reinterpret_cast<const ContextEntry *>( ctx_buffer.GetPointer());
|
||||
const u8 *data = reinterpret_cast<const u8 *>(data_buffer.GetPointer());
|
||||
const ReportMetaData *meta = reinterpret_cast<const ReportMetaData *>(meta_buffer.GetPointer());
|
||||
|
@ -50,15 +50,19 @@ namespace ams::erpt::srv {
|
|||
R_UNLESS(ctx_size == sizeof(ContextEntry), erpt::ResultInvalidArgument());
|
||||
R_UNLESS(meta_size == 0 || meta_size == sizeof(ReportMetaData), erpt::ResultInvalidArgument());
|
||||
|
||||
R_TRY(Reporter::CreateReport(report_type, result, ctx, data, data_size, meta_size != 0 ? meta : nullptr, nullptr, 0));
|
||||
R_TRY(Reporter::CreateReport(report_type, result, ctx, data, data_size, meta_size != 0 ? meta : nullptr, nullptr, 0, flags));
|
||||
|
||||
ManagerImpl::NotifyAll();
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportV1(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result) {
|
||||
R_RETURN(this->CreateReport(report_type, ctx_buffer, data_buffer, meta_buffer, result, erpt::srv::MakeNoCreateReportOptionFlags()));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportV0(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer) {
|
||||
R_RETURN(this->CreateReport(report_type, ctx_buffer, data_buffer, meta_buffer, ResultSuccess()));
|
||||
R_RETURN(this->CreateReportV1(report_type, ctx_buffer, data_buffer, meta_buffer, ResultSuccess()));
|
||||
}
|
||||
|
||||
Result ContextImpl::SetInitialLaunchSettingsCompletionTime(const time::SteadyClockTimePoint &time_point) {
|
||||
|
@ -138,7 +142,7 @@ namespace ams::erpt::srv {
|
|||
R_RETURN(JournalForAttachments::SubmitAttachment(out.GetPointer(), name_safe, data, data_size));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result) {
|
||||
Result ContextImpl::CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result, erpt::CreateReportOptionFlagSet flags) {
|
||||
const ContextEntry *ctx = reinterpret_cast<const ContextEntry *>( ctx_buffer.GetPointer());
|
||||
const u8 *data = reinterpret_cast<const u8 *>(data_buffer.GetPointer());
|
||||
const u32 ctx_size = static_cast<u32>(ctx_buffer.GetSize());
|
||||
|
@ -150,15 +154,19 @@ namespace ams::erpt::srv {
|
|||
R_UNLESS(ctx_size == sizeof(ContextEntry), erpt::ResultInvalidArgument());
|
||||
R_UNLESS(num_attachments <= AttachmentsPerReportMax, erpt::ResultInvalidArgument());
|
||||
|
||||
R_TRY(Reporter::CreateReport(report_type, result, ctx, data, data_size, nullptr, attachments, num_attachments));
|
||||
R_TRY(Reporter::CreateReport(report_type, result, ctx, data, data_size, nullptr, attachments, num_attachments, flags));
|
||||
|
||||
ManagerImpl::NotifyAll();
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportWithAttachmentsDeprecated2(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result) {
|
||||
R_RETURN(this->CreateReportWithAttachments(report_type, ctx_buffer, data_buffer, attachment_ids_buffer, result, erpt::srv::MakeNoCreateReportOptionFlags()));
|
||||
}
|
||||
|
||||
Result ContextImpl::CreateReportWithAttachmentsDeprecated(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer) {
|
||||
R_RETURN(this->CreateReportWithAttachments(report_type, ctx_buffer, data_buffer, attachment_ids_buffer, ResultSuccess()));
|
||||
R_RETURN(this->CreateReportWithAttachmentsDeprecated2(report_type, ctx_buffer, data_buffer, attachment_ids_buffer, ResultSuccess()));
|
||||
}
|
||||
|
||||
Result ContextImpl::RegisterRunningApplet(ncm::ProgramId program_id) {
|
||||
|
|
|
@ -31,8 +31,10 @@ namespace ams::erpt::srv {
|
|||
Result ClearApplicationLaunchTime();
|
||||
Result SubmitAttachment(ams::sf::Out<AttachmentId> out, const ams::sf::InBuffer &attachment_name, const ams::sf::InBuffer &attachment_data);
|
||||
Result CreateReportWithAttachmentsDeprecated(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer);
|
||||
Result CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result);
|
||||
Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result);
|
||||
Result CreateReportWithAttachmentsDeprecated2(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result);
|
||||
Result CreateReportWithAttachments(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &attachment_ids_buffer, Result result, erpt::CreateReportOptionFlagSet flags);
|
||||
Result CreateReportV1(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result);
|
||||
Result CreateReport(ReportType report_type, const ams::sf::InBuffer &ctx_buffer, const ams::sf::InBuffer &data_buffer, const ams::sf::InBuffer &meta_buffer, Result result, erpt::CreateReportOptionFlagSet flags);
|
||||
Result RegisterRunningApplet(ncm::ProgramId program_id);
|
||||
Result UnregisterRunningApplet(ncm::ProgramId program_id);
|
||||
Result UpdateAppletSuspendedDuration(ncm::ProgramId program_id, TimeSpanType duration);
|
||||
|
|
|
@ -75,11 +75,11 @@ namespace ams::erpt::srv {
|
|||
for (u32 i = 0; i < m_ctx.field_count; i++) {
|
||||
m_ctx.fields[i] = ctx_ptr->fields[i];
|
||||
|
||||
R_UNLESS(0 <= m_ctx.fields[i].id && m_ctx.fields[i].id < FieldId_Count, erpt::ResultInvalidArgument());
|
||||
R_UNLESS(0 <= m_ctx.fields[i].type && m_ctx.fields[i].type < FieldType_Count, erpt::ResultInvalidArgument());
|
||||
R_UNLESS(0 <= m_ctx.fields[i].id && m_ctx.fields[i].id < ERPT_FIELD_ID(Count), erpt::ResultInvalidArgument());
|
||||
R_UNLESS(0 <= m_ctx.fields[i].type && m_ctx.fields[i].type < FieldType_Count, erpt::ResultInvalidArgument());
|
||||
|
||||
R_UNLESS(m_ctx.fields[i].type == FieldToTypeMap[m_ctx.fields[i].id], erpt::ResultFieldTypeMismatch());
|
||||
R_UNLESS(m_ctx.category == FieldToCategoryMap[m_ctx.fields[i].id], erpt::ResultFieldCategoryMismatch());
|
||||
R_UNLESS(m_ctx.fields[i].type == ConvertFieldToType(m_ctx.fields[i].id), erpt::ResultFieldTypeMismatch());
|
||||
R_UNLESS(m_ctx.category == ConvertFieldToCategory(m_ctx.fields[i].id), erpt::ResultFieldCategoryMismatch());
|
||||
|
||||
if (IsArrayFieldType(m_ctx.fields[i].type)) {
|
||||
const u32 start_idx = m_ctx.fields[i].value_array.start_idx;
|
||||
|
|
|
@ -83,10 +83,10 @@ namespace ams::erpt::srv {
|
|||
err::GetErrorCodeString(error_code_str, sizeof(error_code_str), err::ConvertResultToErrorCode(err::ResultForcedShutdownDetected()));
|
||||
|
||||
/* Add error code to the context. */
|
||||
R_TRY(record->Add(FieldId_ErrorCode, error_code_str, std::strlen(error_code_str)));
|
||||
R_TRY(record->Add(ERPT_FIELD_ID(ErrorCode), error_code_str, std::strlen(error_code_str)));
|
||||
|
||||
/* Create report. */
|
||||
R_TRY(Reporter::CreateReport(ReportType_Invisible, ResultSuccess(), std::move(record), nullptr, nullptr, 0));
|
||||
R_TRY(Reporter::CreateReport(ReportType_Invisible, ResultSuccess(), std::move(record), nullptr, nullptr, 0, erpt::srv::MakeNoCreateReportOptionFlags()));
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
|
|
@ -62,7 +62,11 @@ namespace ams::erpt::srv {
|
|||
static Result AddId(Report *report, FieldId field_id) {
|
||||
static_assert(MaxFieldStringSize < ElementSize_256);
|
||||
|
||||
R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize)));
|
||||
if (hos::GetVersion() >= hos::Version_17_0_0) {
|
||||
R_TRY(AddStringValue(report, FieldString[field_id], strnlen(FieldString[field_id], MaxFieldStringSize)));
|
||||
} else {
|
||||
R_TRY(AddStringValue(report, DeprecatedFieldString[field_id], strnlen(DeprecatedFieldString[field_id], MaxFieldStringSize)));
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ namespace ams::erpt::srv {
|
|||
auto record = std::make_unique<ContextRecord>(CategoryId_ProductModelInfo);
|
||||
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
|
||||
|
||||
R_TRY(record->Add(FieldId_ProductModel, model, model_len));
|
||||
R_TRY(record->Add(ERPT_FIELD_ID(ProductModel), model, model_len));
|
||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||
|
||||
R_SUCCEED();
|
||||
|
@ -146,7 +146,7 @@ namespace ams::erpt::srv {
|
|||
auto record = std::make_unique<ContextRecord>(CategoryId_RegionSettingInfo);
|
||||
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
|
||||
|
||||
R_TRY(record->Add(FieldId_RegionSetting, region, region_len));
|
||||
R_TRY(record->Add(ERPT_FIELD_ID(RegionSetting), region, region_len));
|
||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||
|
||||
R_SUCCEED();
|
||||
|
|
|
@ -123,14 +123,14 @@ namespace ams::erpt::srv {
|
|||
if (error_context_total_size == 0) {
|
||||
return;
|
||||
}
|
||||
record->Add(FieldId_ErrorContextTotalSize, error_context_total_size);
|
||||
record->Add(ERPT_FIELD_ID(ErrorContextTotalSize), error_context_total_size);
|
||||
|
||||
/* Set the context. */
|
||||
if (error_context_size == 0) {
|
||||
return;
|
||||
}
|
||||
record->Add(FieldId_ErrorContextSize, error_context_size);
|
||||
record->Add(FieldId_ErrorContext, error_context, error_context_size);
|
||||
record->Add(ERPT_FIELD_ID(ErrorContextSize), error_context_size);
|
||||
record->Add(ERPT_FIELD_ID(ErrorContext), error_context, error_context_size);
|
||||
}
|
||||
|
||||
constinit os::SdkMutex g_limit_mutex;
|
||||
|
@ -164,7 +164,7 @@ namespace ams::erpt::srv {
|
|||
if (R_FAILED(svc::GetResourceLimitLimitValue(std::addressof(limit_value), handle, svc::LimitableResource_##__RESOURCE__##Max))) { \
|
||||
return; \
|
||||
} \
|
||||
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Limit, limit_value))) { \
|
||||
if (R_FAILED(record->Add(ERPT_FIELD_ID(System##__RESOURCE__##Limit), limit_value))) { \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -203,7 +203,7 @@ namespace ams::erpt::srv {
|
|||
if (R_FAILED(svc::GetResourceLimitPeakValue(std::addressof(peak_value), handle, svc::LimitableResource_##__RESOURCE__##Max))) { \
|
||||
return; \
|
||||
} \
|
||||
if (R_FAILED(record->Add(FieldId_System##__RESOURCE__##Peak, peak_value))) { \
|
||||
if (R_FAILED(record->Add(ERPT_FIELD_ID(System##__RESOURCE__##Peak), peak_value))) { \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
@ -234,7 +234,7 @@ namespace ams::erpt::srv {
|
|||
R_UNLESS(ctx->field_count <= FieldsPerContext, erpt::ResultInvalidArgument());
|
||||
|
||||
const bool found_error_code = util::range::any_of(MakeSpan(ctx->fields, ctx->field_count), [] (const FieldEntry &entry) {
|
||||
return entry.id == FieldId_ErrorCode;
|
||||
return entry.id == ERPT_FIELD_ID(ErrorCode);
|
||||
});
|
||||
R_UNLESS(found_error_code, erpt::ResultRequiredFieldMissing());
|
||||
|
||||
|
@ -249,10 +249,10 @@ namespace ams::erpt::srv {
|
|||
|
||||
bool found_abort_flag = false, found_syslog_flag = false;
|
||||
for (u32 i = 0; i < ctx->field_count; i++) {
|
||||
if (ctx->fields[i].id == FieldId_AbortFlag) {
|
||||
if (ctx->fields[i].id == ERPT_FIELD_ID(AbortFlag)) {
|
||||
found_abort_flag = true;
|
||||
}
|
||||
if (ctx->fields[i].id == FieldId_HasSyslogFlag) {
|
||||
if (ctx->fields[i].id == ERPT_FIELD_ID(HasSyslogFlag)) {
|
||||
found_syslog_flag = true;
|
||||
}
|
||||
if (found_abort_flag && found_syslog_flag) {
|
||||
|
@ -261,11 +261,11 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
if (!found_abort_flag) {
|
||||
record->Add(FieldId_AbortFlag, false);
|
||||
record->Add(ERPT_FIELD_ID(AbortFlag), false);
|
||||
}
|
||||
|
||||
if (!found_syslog_flag) {
|
||||
record->Add(FieldId_HasSyslogFlag, true);
|
||||
record->Add(ERPT_FIELD_ID(HasSyslogFlag), true);
|
||||
}
|
||||
|
||||
R_TRY(Context::SubmitContextRecord(std::move(record)));
|
||||
|
@ -277,7 +277,7 @@ namespace ams::erpt::srv {
|
|||
bool needs_save_syslog = true;
|
||||
for (u32 i = 0; i < ctx->field_count; i++) {
|
||||
static_assert(FieldToTypeMap[FieldId_HasSyslogFlag] == FieldType_Bool);
|
||||
if (ctx->fields[i].id == FieldId_HasSyslogFlag && !ctx->fields[i].value_bool) {
|
||||
if (ctx->fields[i].id == ERPT_FIELD_ID(HasSyslogFlag) && !ctx->fields[i].value_bool) {
|
||||
needs_save_syslog = false;
|
||||
break;
|
||||
}
|
||||
|
@ -299,13 +299,13 @@ namespace ams::erpt::srv {
|
|||
|
||||
/* Find the program id entry. */
|
||||
const auto fields_span = MakeSpan(error_info_ctx->fields, error_info_ctx->field_count);
|
||||
const auto program_id_entry = util::range::find_if(fields_span, [](const FieldEntry &entry) { return entry.id == FieldId_ProgramId; });
|
||||
const auto program_id_entry = util::range::find_if(fields_span, [](const FieldEntry &entry) { return entry.id == ERPT_FIELD_ID(ProgramId); });
|
||||
if (program_id_entry == fields_span.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check that the report has abort flag set. */
|
||||
AMS_ASSERT(util::range::any_of(fields_span, [](const FieldEntry &entry) { return entry.id == FieldId_AbortFlag && entry.value_bool; }));
|
||||
AMS_ASSERT(util::range::any_of(fields_span, [](const FieldEntry &entry) { return entry.id == ERPT_FIELD_ID(AbortFlag) && entry.value_bool; }));
|
||||
|
||||
/* Check that the program id's value is a string. */
|
||||
AMS_ASSERT(program_id_entry->type == FieldType_String);
|
||||
|
@ -334,7 +334,7 @@ namespace ams::erpt::srv {
|
|||
}
|
||||
|
||||
/* Add the active applet time. */
|
||||
const auto result = error_info_auto_record->Add(FieldId_AppletTotalActiveTime, (*active_duration).GetSeconds());
|
||||
const auto result = error_info_auto_record->Add(ERPT_FIELD_ID(AppletTotalActiveTime), (*active_duration).GetSeconds());
|
||||
R_ASSERT(result);
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ namespace ams::erpt::srv {
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
|
||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments, erpt::CreateReportOptionFlagSet flags) {
|
||||
/* Create a context record for the report. */
|
||||
auto record = std::make_unique<ContextRecord>();
|
||||
R_UNLESS(record != nullptr, erpt::ResultOutOfMemory());
|
||||
|
@ -422,10 +422,10 @@ namespace ams::erpt::srv {
|
|||
R_TRY(record->Initialize(ctx, data, data_size));
|
||||
|
||||
/* Create the report. */
|
||||
R_RETURN(CreateReport(type, ctx_result, std::move(record), meta, attachments, num_attachments));
|
||||
R_RETURN(CreateReport(type, ctx_result, std::move(record), meta, attachments, num_attachments, flags));
|
||||
}
|
||||
|
||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments) {
|
||||
Result Reporter::CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments, erpt::CreateReportOptionFlagSet flags) {
|
||||
/* Clear the automatic categories, when we're done with our report. */
|
||||
ON_SCOPE_EXIT {
|
||||
Context::ClearContext(CategoryId_ErrorInfo);
|
||||
|
@ -457,7 +457,7 @@ namespace ams::erpt::srv {
|
|||
SaveSyslogReportIfRequired(ctx, report_id);
|
||||
|
||||
/* Submit report contexts. */
|
||||
R_TRY(SubmitReportContexts(report_id, type, ctx_result, std::move(record), timestamp_user, timestamp_network));
|
||||
R_TRY(SubmitReportContexts(report_id, type, ctx_result, std::move(record), timestamp_user, timestamp_network, flags));
|
||||
|
||||
/* Link attachments to the report. */
|
||||
R_TRY(LinkAttachments(report_id, attachments, num_attachments));
|
||||
|
@ -468,7 +468,7 @@ namespace ams::erpt::srv {
|
|||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result Reporter::SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network) {
|
||||
Result Reporter::SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime ×tamp_user, const time::PosixTime ×tamp_network, erpt::CreateReportOptionFlagSet flags) {
|
||||
/* Create automatic record. */
|
||||
auto auto_record = std::make_unique<ContextRecord>(CategoryId_ErrorInfoAuto, 0x300);
|
||||
R_UNLESS(auto_record != nullptr, erpt::ResultOutOfMemory());
|
||||
|
@ -489,28 +489,28 @@ namespace ams::erpt::srv {
|
|||
R_ABORT_UNLESS(time::GetStandardSteadyClockCurrentTimePoint(std::addressof(steady_clock_current_timepoint)));
|
||||
|
||||
/* Add automatic fields. */
|
||||
auto_record->Add(FieldId_OsVersion, s_os_version, util::Strnlen(s_os_version, sizeof(s_os_version)));
|
||||
auto_record->Add(FieldId_PrivateOsVersion, s_private_os_version, util::Strnlen(s_private_os_version, sizeof(s_private_os_version)));
|
||||
auto_record->Add(FieldId_SerialNumber, s_serial_number, util::Strnlen(s_serial_number, sizeof(s_serial_number)));
|
||||
auto_record->Add(FieldId_ReportIdentifier, identifier_str, util::Strnlen(identifier_str, sizeof(identifier_str)));
|
||||
auto_record->Add(FieldId_OccurrenceTimestamp, timestamp_user.value);
|
||||
auto_record->Add(FieldId_OccurrenceTimestampNet, timestamp_network.value);
|
||||
auto_record->Add(FieldId_ReportVisibilityFlag, type == ReportType_Visible);
|
||||
auto_record->Add(FieldId_OccurrenceTick, occurrence_tick.GetInt64Value());
|
||||
auto_record->Add(FieldId_SteadyClockInternalOffset, steady_clock_internal_offset_seconds);
|
||||
auto_record->Add(FieldId_SteadyClockCurrentTimePointValue, steady_clock_current_timepoint.value);
|
||||
auto_record->Add(FieldId_ElapsedTimeSincePowerOn, (occurrence_tick - *s_power_on_time).ToTimeSpan().GetSeconds());
|
||||
auto_record->Add(FieldId_ElapsedTimeSinceLastAwake, (occurrence_tick - *s_awake_time).ToTimeSpan().GetSeconds());
|
||||
auto_record->Add(ERPT_FIELD_ID(OsVersion), s_os_version, util::Strnlen(s_os_version, sizeof(s_os_version)));
|
||||
auto_record->Add(ERPT_FIELD_ID(PrivateOsVersion), s_private_os_version, util::Strnlen(s_private_os_version, sizeof(s_private_os_version)));
|
||||
auto_record->Add(ERPT_FIELD_ID(SerialNumber), s_serial_number, util::Strnlen(s_serial_number, sizeof(s_serial_number)));
|
||||
auto_record->Add(ERPT_FIELD_ID(ReportIdentifier), identifier_str, util::Strnlen(identifier_str, sizeof(identifier_str)));
|
||||
auto_record->Add(ERPT_FIELD_ID(OccurrenceTimestamp), timestamp_user.value);
|
||||
auto_record->Add(ERPT_FIELD_ID(OccurrenceTimestampNet), timestamp_network.value);
|
||||
auto_record->Add(ERPT_FIELD_ID(ReportVisibilityFlag), type == ReportType_Visible);
|
||||
auto_record->Add(ERPT_FIELD_ID(OccurrenceTick), occurrence_tick.GetInt64Value());
|
||||
auto_record->Add(ERPT_FIELD_ID(SteadyClockInternalOffset), steady_clock_internal_offset_seconds);
|
||||
auto_record->Add(ERPT_FIELD_ID(SteadyClockCurrentTimePointValue), steady_clock_current_timepoint.value);
|
||||
auto_record->Add(ERPT_FIELD_ID(ElapsedTimeSincePowerOn), (occurrence_tick - *s_power_on_time).ToTimeSpan().GetSeconds());
|
||||
auto_record->Add(ERPT_FIELD_ID(ElapsedTimeSinceLastAwake), (occurrence_tick - *s_awake_time).ToTimeSpan().GetSeconds());
|
||||
|
||||
if (s_initial_launch_settings_completion_time) {
|
||||
s64 elapsed_seconds;
|
||||
if (R_SUCCEEDED(time::GetElapsedSecondsBetween(std::addressof(elapsed_seconds), *s_initial_launch_settings_completion_time, steady_clock_current_timepoint))) {
|
||||
auto_record->Add(FieldId_ElapsedTimeSinceInitialLaunch, elapsed_seconds);
|
||||
auto_record->Add(ERPT_FIELD_ID(ElapsedTimeSinceInitialLaunch), elapsed_seconds);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_application_launch_time) {
|
||||
auto_record->Add(FieldId_ApplicationAliveTime, (occurrence_tick - *s_application_launch_time).ToTimeSpan().GetSeconds());
|
||||
auto_record->Add(ERPT_FIELD_ID(ApplicationAliveTime), (occurrence_tick - *s_application_launch_time).ToTimeSpan().GetSeconds());
|
||||
}
|
||||
|
||||
/* Submit applet active duration information. */
|
||||
|
@ -530,6 +530,10 @@ namespace ams::erpt::srv {
|
|||
SubmitResourceLimitContexts();
|
||||
#endif
|
||||
|
||||
if (flags.Test<CreateReportOptionFlag::SubmitFsInfo>()) {
|
||||
/* TODO: 17.0.0 SubmitFsInfo() */
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,10 @@ namespace ams::erpt::srv {
|
|||
|
||||
static void SetRedirectNewReportsToSdCard(bool en) { s_redirect_new_reports = en; }
|
||||
private:
|
||||
static Result SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime &user_timestamp, const time::PosixTime &network_timestamp);
|
||||
static Result SubmitReportContexts(const ReportId &report_id, ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const time::PosixTime &user_timestamp, const time::PosixTime &network_timestamp, erpt::CreateReportOptionFlagSet flags);
|
||||
public:
|
||||
static Result CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments);
|
||||
static Result CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments);
|
||||
static Result CreateReport(ReportType type, Result ctx_result, const ContextEntry *ctx, const u8 *data, u32 data_size, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments, erpt::CreateReportOptionFlagSet flags);
|
||||
static Result CreateReport(ReportType type, Result ctx_result, std::unique_ptr<ContextRecord> record, const ReportMetaData *meta, const AttachmentId *attachments, u32 num_attachments, erpt::CreateReportOptionFlagSet flags);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue