yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
rom_lifecycle_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SYSTEM_ROM_LIFECYCLE_MANAGER_H_
2#define YAZE_APP_EDITOR_SYSTEM_ROM_LIFECYCLE_MANAGER_H_
3
4#include <string>
5#include <vector>
6
7#include "absl/status/status.h"
10#include "core/project.h"
11#include "rom/rom.h"
12
13namespace yaze::editor {
14
15class SessionCoordinator;
16class ToastManager;
17class PopupManager;
18
32 public:
38
46
48 explicit RomLifecycleManager(Dependencies deps);
50
53 void Initialize(Dependencies deps);
54
55 // =========================================================================
56 // ROM Hash & Write Policy
57 // =========================================================================
58
60 void UpdateCurrentRomHash(Rom* rom);
61
63 const std::string& current_rom_hash() const { return current_rom_hash_; }
64
66 bool IsRomHashMismatch() const;
67
69 absl::Status CheckRomOpenPolicy(Rom* rom);
70
72 absl::Status CheckRomWritePolicy(Rom* rom);
73
75 absl::Status CheckOracleRomSafetyPreSave(Rom* rom);
76
77 // =========================================================================
78 // ROM Write Confirmation State Machine
79 // =========================================================================
80
82 void ConfirmRomWrite();
85
86 // =========================================================================
87 // Write Conflict Management (ASM-owned address protection)
88 // =========================================================================
89
90 const std::vector<core::WriteConflict>& pending_write_conflicts() const {
92 }
96 void SetPendingWriteConflicts(std::vector<core::WriteConflict> conflicts) {
97 pending_write_conflicts_ = std::move(conflicts);
98 }
103
104 // =========================================================================
105 // Pot Item Save Confirmation
106 // =========================================================================
107
117
119 void SetPotItemConfirmPending(int unloaded_rooms, int total_rooms);
120
125 PotItemSaveDecision decision);
126
137
138 // =========================================================================
139 // Backup Management (delegates to RomFileManager)
140 // =========================================================================
141
142 std::vector<RomFileManager::BackupEntry> GetRomBackups(Rom* rom) const;
143 absl::Status PruneRomBackups(Rom* rom);
144
146 void ApplyDefaultBackupPolicy(bool enabled, const std::string& folder,
147 int retention_count, bool keep_daily,
148 int keep_daily_days);
149
150 private:
151 // Dependencies (non-owning pointers)
157
158 // ROM hash state
159 std::string current_rom_hash_;
160 std::string current_rom_path_;
161
162 // Write confirmation state machine
166
167 // Pot item save confirmation state
173
174 // Write conflict state (ASM-owned address protection)
175 std::vector<core::WriteConflict> pending_write_conflicts_;
177};
178
179} // namespace yaze::editor
180
181#endif // YAZE_APP_EDITOR_SYSTEM_ROM_LIFECYCLE_MANAGER_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Handles all ROM file I/O operations.
Manages ROM and project persistence state.
void UpdateCurrentRomHash(Rom *rom)
Recompute the hash of the current ROM.
std::vector< RomFileManager::BackupEntry > GetRomBackups(Rom *rom) const
void SetPotItemConfirmPending(int unloaded_rooms, int total_rooms)
Set pot-item confirmation pending (called by SaveRom when needed).
bool IsRomHashMismatch() const
Check whether the ROM hash mismatches the project's expected hash.
absl::Status CheckRomOpenPolicy(Rom *rom)
Validate that the loaded ROM is a safe project target to open/edit.
PotItemSaveDecision ResolvePotItemSaveConfirmation(PotItemSaveDecision decision)
const std::string & current_rom_hash() const
Get the cached ROM hash string.
std::vector< core::WriteConflict > pending_write_conflicts_
const std::vector< core::WriteConflict > & pending_write_conflicts() const
void SetPendingWriteConflicts(std::vector< core::WriteConflict > conflicts)
absl::Status CheckRomWritePolicy(Rom *rom)
Enforce project write policy; may set pending_rom_write_confirm.
absl::Status CheckOracleRomSafetyPreSave(Rom *rom)
Run Oracle-specific ROM safety preflight before saving.
void ApplyDefaultBackupPolicy(bool enabled, const std::string &folder, int retention_count, bool keep_daily, int keep_daily_days)
Apply default backup policy from user settings.
High-level orchestrator for multi-session UI.
Editors are the view controllers for the application.
Modern project structure with comprehensive settings consolidation.
Definition project.h:164