5#include "absl/strings/str_cat.h"
6#include "absl/strings/str_format.h"
13 const std::vector<std::pair<uint32_t, uint32_t>>& ranges,
14 absl::string_view save_scope,
const char* log_tag,
17 if (conflicts.empty()) {
18 return absl::OkStatus();
21 std::string error_msg = absl::StrFormat(
22 "Hack manifest write conflicts while saving %s:\n\n", save_scope);
23 for (
const auto& conflict : conflicts) {
26 absl::StrFormat(
"- Address 0x%06X is %s", conflict.address,
28 if (!conflict.module.empty()) {
29 absl::StrAppend(&error_msg,
" (Module: ", conflict.module,
")");
31 absl::StrAppend(&error_msg,
"\n");
35 LOG_DEBUG(log_tag,
"%s", error_msg.c_str());
37 LOG_WARN(log_tag,
"%s", error_msg.c_str());
42 "Save warning: write conflict with hack manifest (see log)",
49 "Save blocked: write conflict with hack manifest (see log)",
52 return absl::PermissionDeniedError(
"Write conflict with Hack Manifest");
55 return absl::OkStatus();
Loads and queries the hack manifest JSON for yaze-ASM integration.
std::vector< WriteConflict > AnalyzePcWriteRanges(const std::vector< std::pair< uint32_t, uint32_t > > &pc_ranges) const
Analyze a set of PC-offset ranges for write conflicts.
void Show(const std::string &message, ToastType type=ToastType::kInfo, float ttl_seconds=3.0f)
#define LOG_DEBUG(category, format,...)
#define LOG_WARN(category, format,...)
std::string AddressOwnershipToString(AddressOwnership ownership)
Editors are the view controllers for the application.
absl::Status ValidateHackManifestSaveConflicts(const core::HackManifest &manifest, project::RomWritePolicy write_policy, const std::vector< std::pair< uint32_t, uint32_t > > &ranges, absl::string_view save_scope, const char *log_tag, ToastManager *toast_manager)