6#include "absl/status/status.h"
7#include "absl/strings/str_format.h"
8#include "absl/strings/str_join.h"
23 if ((range.start & 0xFFFFu) < 0x8000u) {
24 return absl::InvalidArgumentError(absl::StrFormat(
25 "Graphics allocation start $%06X is not a mapped LoROM address",
28 const uint32_t begin =
SnesToPc(range.start);
30 const uint32_t end =
SnesToPc(range.end);
32 return absl::InvalidArgumentError(absl::StrFormat(
33 "Graphics allocation range [$%06X, $%06X) is empty in PC space",
34 range.start, range.end));
43 uint32_t end) -> absl::Status {
45 if (conflicts.empty()) {
46 return absl::OkStatus();
48 std::vector<std::string> parts;
50 parts.push_back(absl::StrFormat(
51 "$%06X (%s%s%s)", conflict.address,
53 conflict.module.empty() ?
"" :
": ", conflict.module));
55 return absl::FailedPreconditionError(absl::StrFormat(
56 "Graphics write [0x%06X, 0x%06X) touches ASM-owned bytes: %s", begin,
57 end, absl::StrJoin(parts,
", ")));
68 settings.reserved_sheets.end());
69 for (
const auto& [sheet, blocks] : settings.reserved_blocks) {
71 merged.insert(merged.end(), blocks.begin(), blocks.end());
79 if (project ==
nullptr) {
84 settings.reserved_sheets.end());
86 settings.flagged_sheets.end());
88 const auto& manifest_reserved =
91 manifest_reserved.end());
Loads and queries the hack manifest JSON for yaze-ASM integration.
const GraphicsSheetLayout & graphics_sheet_layout() const
Graphics-sheet free space and reserved sheets. Empty when the optional graphics_sheet_regions section...
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.
bool loaded() const
Check if the manifest has been loaded.
#define ASSIGN_OR_RETURN(type_variable_name, expression)
absl::StatusOr< zelda3::GfxSheetWritePolicy > BuildGfxSheetWritePolicy(const HackManifest &manifest)
std::string AddressOwnershipToString(AddressOwnership ownership)
zelda3::GfxSheetInventoryOptions BuildGfxSheetInventoryOptions(const project::YazeProject *project)
uint32_t SnesToPc(uint32_t addr) noexcept
Graphics-sheet storage rules declared by the hack (graphics_sheet_regions).
std::vector< uint16_t > reserved_sheets
std::vector< SnesAddressRange > allocation_regions
A half-open [start, end) range of canonical LoROM SNES addresses.
A conflict detected when yaze wants to write to an ASM-owned address.
Modern project structure with comprehensive settings consolidation.
core::HackManifest hack_manifest
GraphicsSheetSettings graphics_sheets
std::set< uint16_t > flagged_sheets
std::map< uint16_t, std::vector< uint16_t > > reserved_blocks
std::set< uint16_t > reserved_sheets
Rules a sheet write must follow.
std::set< uint16_t > reserved_sheets
std::vector< GfxSheetPcRange > allocation_regions
std::function< absl::Status(uint32_t begin, uint32_t end)> check_write
std::map< uint16_t, std::vector< uint16_t > > reserved_blocks