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 CheckRomWritePolicy(Rom* rom);
70
72 absl::Status CheckOracleRomSafetyPreSave(Rom* rom);
73
74 // =========================================================================
75 // ROM Write Confirmation State Machine
76 // =========================================================================
77
79 void ConfirmRomWrite();
81
82 // =========================================================================
83 // Write Conflict Management (ASM-owned address protection)
84 // =========================================================================
85
86 const std::vector<core::WriteConflict>& pending_write_conflicts() const {
88 }
92 void SetPendingWriteConflicts(std::vector<core::WriteConflict> conflicts) {
93 pending_write_conflicts_ = std::move(conflicts);
94 }
99
100 // =========================================================================
101 // Pot Item Save Confirmation
102 // =========================================================================
103
113
115 void SetPotItemConfirmPending(int unloaded_rooms, int total_rooms);
116
121 PotItemSaveDecision decision);
122
133
134 // =========================================================================
135 // Backup Management (delegates to RomFileManager)
136 // =========================================================================
137
138 std::vector<RomFileManager::BackupEntry> GetRomBackups(Rom* rom) const;
139 absl::Status PruneRomBackups(Rom* rom);
140
143 bool enabled, const std::string& folder, int retention_count,
144 bool keep_daily, int keep_daily_days);
145
146 private:
147 // Dependencies (non-owning pointers)
153
154 // ROM hash state
155 std::string current_rom_hash_;
156
157 // Write confirmation state machine
160
161 // Pot item save confirmation state
167
168 // Write conflict state (ASM-owned address protection)
169 std::vector<core::WriteConflict> pending_write_conflicts_;
171};
172
173} // namespace yaze::editor
174
175#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.
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:120