yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
message_source_sync.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MESSAGE_MESSAGE_SOURCE_SYNC_H_
2#define YAZE_APP_EDITOR_MESSAGE_MESSAGE_SOURCE_SYNC_H_
3
4#include <cstddef>
5#include <filesystem>
6#include <string>
7#include <string_view>
8#include <vector>
9
10#include "absl/status/statusor.h"
12#include "core/project.h"
13
14namespace yaze::editor {
15
16// A validated, complete source bank read without touching ROM bytes or generated
17// output. IDs in messages remain bank-local; first_expanded_id is the display base.
19 std::filesystem::path canonical_bundle_path;
20 std::string source_sha256;
22 std::vector<MessageData> messages;
23};
24
25absl::StatusOr<MessageSourceSnapshot> LoadMessageSource(
26 const project::YazeProject& project);
27
29 // Source synchronization is a dry-run unless this is explicitly enabled.
30 bool write = false;
31
32 // Required in write mode. This is compared with the SHA-256 of the exact
33 // canonical bundle bytes immediately before publication.
35};
36
38 std::filesystem::path canonical_bundle_path;
39 std::filesystem::path generated_asm_include_path;
40
45 size_t encoded_size = 0;
46 size_t capacity = 0;
47
50 bool changed = false;
51 bool wrote = false;
52};
53
54// Compute the lowercase SHA-256 used by canonical source/include provenance.
55std::string ComputeMessageSourceSha256(std::string_view content);
56
57// ROM writes of the expanded bank stay refused. The durable copy is the
58// canonical bundle; the generated include is produced by source sync.
59inline constexpr char kOracleExpandedRomWriteRefusal[] =
60 "Oracle of Secrets expanded messages are owned by ASM. No message "
61 "bytes were written. Publish Data/dialogue/expanded_messages.json through "
62 "Yaze source sync, which regenerates Core/Generated/expanded_messages.asm, "
63 "then rebuild Oracle of Secrets and reopen the rebuilt ROM.";
64
65// Merge a validated expanded-message subset into the complete canonical
66// project bundle and render its deterministic, no-org Asar include.
67//
68// Both publication targets come from messages.source in the project's loaded
69// hack manifest. The paths must remain within the project root after symlink
70// resolution. No ROM is opened or mutated by this service.
71absl::StatusOr<MessageSourceSyncResult> SyncMessageSource(
72 const project::YazeProject& project,
73 const std::filesystem::path& incoming_bundle_path,
74 const MessageSourceSyncOptions& options = {});
75
76} // namespace yaze::editor
77
78#endif // YAZE_APP_EDITOR_MESSAGE_MESSAGE_SOURCE_SYNC_H_
Editors are the view controllers for the application.
absl::StatusOr< MessageSourceSnapshot > LoadMessageSource(const project::YazeProject &project)
std::string ComputeMessageSourceSha256(std::string_view content)
constexpr char kOracleExpandedRomWriteRefusal[]
absl::StatusOr< MessageSourceSyncResult > SyncMessageSource(const project::YazeProject &project, const fs::path &incoming_bundle_path, const MessageSourceSyncOptions &options)
std::vector< MessageData > messages
Modern project structure with comprehensive settings consolidation.
Definition project.h:287