yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
lyra_layout_descriptor.h
Go to the documentation of this file.
1#ifndef YAZE_ROM_LYRA_LAYOUT_DESCRIPTOR_H_
2#define YAZE_ROM_LYRA_LAYOUT_DESCRIPTOR_H_
3
4#include <array>
5#include <cstddef>
6#include <cstdint>
7#include <optional>
8#include <span>
9#include <string>
10#include <vector>
11
12namespace yaze::rom {
13
14// This is the proposed overworld ROM format, not the separate SRAM event format.
15// A valid revision-1 image is readable for inspection but has no Yaze writer.
17
19 uint16_t id = 0;
20 uint16_t kind = 0;
21 uint32_t snes_address = 0;
22 uint32_t pc_address = 0;
23 uint16_t count = 0;
24 uint16_t stride = 0;
25 uint32_t crc32 = 0;
26};
27
30 uint16_t revision = 0;
31 uint16_t capacity = 0;
32 uint16_t active_count = 0;
33 bool write_supported = true;
34 std::string error;
35 std::vector<LyraLayoutEntry> entries;
36};
37
38// The input is a headerless ROM image. The caller owns session attribution:
39// an attributed image remains protected even if a later in-memory edit removes
40// its magic bytes. Unrelated ROM data at the locator is not attribution.
41LyraLayoutInspection InspectLyraLayout(const uint8_t* image, size_t size);
42
43// Checked, session-local reads from an already validated descriptor. The
44// descriptor owns table addresses; ordinary ROM settings are not consulted.
45std::optional<std::span<const uint8_t>> LyraLayoutRecord(
46 const LyraLayoutInspection& layout, const uint8_t* image, size_t size,
47 uint16_t table_id, size_t index);
48
49// Reuses the descriptor validator's stream decoder and allocation fences.
50std::optional<std::array<uint16_t, 256>> LyraMapTile32(
51 const LyraLayoutInspection& layout, const uint8_t* image, size_t size,
52 size_t map_index);
53
54} // namespace yaze::rom
55
56#endif // YAZE_ROM_LYRA_LAYOUT_DESCRIPTOR_H_
std::optional< std::span< const uint8_t > > LyraLayoutRecord(const LyraLayoutInspection &layout, const uint8_t *image, size_t size, uint16_t table_id, size_t index)
LyraLayoutInspection InspectLyraLayout(const uint8_t *image, size_t size)
std::optional< std::array< uint16_t, 256 > > LyraMapTile32(const LyraLayoutInspection &layout, const uint8_t *image, size_t size, size_t map_index)
std::vector< LyraLayoutEntry > entries