yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_tile_patterns.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_DUNGEON_TILE_PATTERNS_H_
2#define YAZE_ZELDA3_DUNGEON_DUNGEON_TILE_PATTERNS_H_
3
4#include <cstdint>
5#include <map>
6#include <string>
7
8#include "absl/status/statusor.h"
9#include "absl/strings/string_view.h"
10
11namespace yaze::zelda3 {
12
13// Literal tile words for ObjectParser and their exact source tokens. This is
14// deliberately not an assembler or a ROM patch.
16 std::string source_path;
17 std::string source_text;
18 struct Token {
19 size_t offset;
20 size_t length;
21 };
22 std::map<uint32_t, Token> tokens;
23 std::map<uint32_t, uint16_t> words; // Headerless PC offset -> tilemap word.
24};
25
26// Supports comments, labels, optional `lorom`, `org $00xxxx` and literal `dw`
27// lists in the bank-00 object-data range. Literal `assert pc() == $00xxxx`
28// checks the current address, with an optional quoted message. Other directives,
29// expressions, overlapping words and invalid addresses reject the entire source.
30absl::StatusOr<DungeonTilePatterns> ParseDungeonTilePatterns(
31 absl::string_view source);
32absl::StatusOr<DungeonTilePatterns> LoadDungeonTilePatterns(
33 const std::string& path);
34
35// Replace only requested literal words. Requires the exact captured file bytes;
36// publication uses the shared atomic source-artifact transaction.
38 const DungeonTilePatterns& expected,
39 const std::map<uint32_t, uint16_t>& replacements);
40
41} // namespace yaze::zelda3
42
43#endif // YAZE_ZELDA3_DUNGEON_DUNGEON_TILE_PATTERNS_H_
Zelda 3 specific classes and functions.
absl::StatusOr< DungeonTilePatterns > LoadDungeonTilePatterns(const std::string &path)
absl::Status PublishDungeonTilePatterns(const DungeonTilePatterns &expected, const std::map< uint32_t, uint16_t > &replacements)
absl::StatusOr< DungeonTilePatterns > ParseDungeonTilePatterns(absl::string_view source)
std::map< uint32_t, Token > tokens
std::map< uint32_t, uint16_t > words