yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
session_types.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SESSION_TYPES_H_
2#define YAZE_APP_EDITOR_SESSION_TYPES_H_
3
4#include <array>
5#include <cstdint>
6#include <memory>
7#include <string>
8#include <string_view>
9#include <unordered_map>
10#include <utility>
11#include <vector>
12
13#include "app/editor/editor.h"
14#include "core/features.h"
15#include "rom/rom.h"
16#include "zelda3/game_data.h"
17
18namespace yaze::core {
19class AsarWrapper;
20}
21
22namespace yaze::zelda3 {
23class Overworld;
24}
25
26namespace yaze::editor {
27
28class EditorDependencies;
29class EditorRegistry;
30class UserSettings;
31
32// Forward declarations for legacy accessors
33class AssemblyEditor;
34class MemoryEditor;
35class DungeonEditorV2;
36class GraphicsEditor;
37class ScreenEditor;
38class MessageEditor;
39class MusicEditor;
40class OverworldEditor;
41class PaletteEditor;
42class SpriteEditor;
43class SettingsPanel;
44
49class EditorSet {
50 public:
51 explicit EditorSet(Rom* rom = nullptr, zelda3::GameData* game_data = nullptr,
52 UserSettings* user_settings = nullptr,
53 size_t session_id = 0,
54 EditorRegistry* editor_registry = nullptr);
56
57 void set_user_settings(UserSettings* settings);
58
59 void ApplyDependencies(const EditorDependencies& dependencies);
60
61 size_t session_id() const { return session_id_; }
62
63 // Generic accessors
64 Editor* GetEditor(EditorType type) const;
65
66 template <typename T>
67 T* GetEditorAs(EditorType type) const {
68 return static_cast<T*>(GetEditor(type));
69 }
70
71 // Convenience helpers that avoid requiring concrete editor headers.
72 // Prefer these from higher-level systems (EditorManager, UI) to keep compile
73 // dependencies minimal.
74 void OpenAssemblyFolder(const std::string& folder_path) const;
75 void ChangeActiveAssemblyFile(std::string_view path) const;
77 int LoadedDungeonRoomCount() const;
78 int TotalDungeonRoomCount() const;
79 std::vector<std::pair<uint32_t, uint32_t>> CollectDungeonWriteRanges() const;
81
82 // Deprecated named accessors (legacy compatibility)
83 [[deprecated("Use GetEditorAs<AssemblyEditor>(EditorType::kAssembly)")]]
85 [[deprecated("Use GetEditorAs<DungeonEditorV2>(EditorType::kDungeon)")]]
87 [[deprecated("Use GetEditorAs<GraphicsEditor>(EditorType::kGraphics)")]]
89 [[deprecated("Use GetEditorAs<MusicEditor>(EditorType::kMusic)")]]
91 [[deprecated("Use GetEditorAs<OverworldEditor>(EditorType::kOverworld)")]]
93 [[deprecated("Use GetEditorAs<PaletteEditor>(EditorType::kPalette)")]]
95 [[deprecated("Use GetEditorAs<ScreenEditor>(EditorType::kScreen)")]]
97 [[deprecated("Use GetEditorAs<SpriteEditor>(EditorType::kSprite)")]]
99 [[deprecated("Use GetEditorAs<SettingsPanel>(EditorType::kSettings)")]]
101 [[deprecated("Use GetEditorAs<MessageEditor>(EditorType::kMessage)")]]
103 [[deprecated("Use GetEditorAs<MemoryEditor>(EditorType::kHex)")]]
105
106 std::vector<Editor*> active_editors_;
107
108 private:
109 size_t session_id_ = 0;
111
112 std::unordered_map<EditorType, std::unique_ptr<Editor>> editors_;
113};
114
124 std::string custom_name; // User-defined session name
125 std::string filepath; // ROM filepath for duplicate detection
126 core::FeatureFlags::Flags feature_flags; // Per-session feature flags
127 bool game_data_loaded = false;
128 std::array<bool, kEditorTypeCount> editor_initialized{};
129 std::array<bool, kEditorTypeCount> editor_assets_loaded{};
130
131 RomSession() = default;
132 explicit RomSession(Rom&& r, UserSettings* user_settings = nullptr,
133 size_t session_id = 0,
134 EditorRegistry* editor_registry = nullptr);
135
136 // Get display name (custom name or ROM title)
137 std::string GetDisplayName() const;
138};
139
140} // namespace yaze::editor
141
142#endif // YAZE_APP_EDITOR_SESSION_TYPES_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
Modern C++ wrapper for Asar 65816 assembler integration.
Text editor for modifying assembly code.
DungeonEditorV2 - Simplified dungeon editor using component delegation.
Manages editor types, categories, and lifecycle.
Contains a complete set of editors for a single ROM instance.
MemoryEditor * GetMemoryEditor() const
T * GetEditorAs(EditorType type) const
std::unordered_map< EditorType, std::unique_ptr< Editor > > editors_
DungeonEditorV2 * GetDungeonEditor() const
void OpenAssemblyFolder(const std::string &folder_path) const
MusicEditor * GetMusicEditor() const
ScreenEditor * GetScreenEditor() const
core::AsarWrapper * GetAsarWrapper() const
void ChangeActiveAssemblyFile(std::string_view path) const
size_t session_id() const
void ApplyDependencies(const EditorDependencies &dependencies)
EditorSet(Rom *rom=nullptr, zelda3::GameData *game_data=nullptr, UserSettings *user_settings=nullptr, size_t session_id=0, EditorRegistry *editor_registry=nullptr)
SpriteEditor * GetSpriteEditor() const
Editor * GetEditor(EditorType type) const
GraphicsEditor * GetGraphicsEditor() const
int LoadedDungeonRoomCount() const
PaletteEditor * GetPaletteEditor() const
void set_user_settings(UserSettings *settings)
zelda3::Overworld * GetOverworldData() const
MessageEditor * GetMessageEditor() const
int TotalDungeonRoomCount() const
SettingsPanel * GetSettingsPanel() const
std::vector< Editor * > active_editors_
zelda3::GameData * game_data_
OverworldEditor * GetOverworldEditor() const
AssemblyEditor * GetAssemblyEditor() const
std::vector< std::pair< uint32_t, uint32_t > > CollectDungeonWriteRanges() const
Interface for editor classes.
Definition editor.h:236
Allows the user to edit graphics sheets from the game or view prototype graphics.
A class for editing music data in a Rom.
Main UI class for editing overworld maps in A Link to the Past.
Allows the user to view and edit in game palettes.
The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom me...
Manages the settings UI displayed in the right sidebar.
Allows the user to edit sprites.
Manages user preferences and settings persistence.
Represents the full Overworld data, light and dark world.
Definition overworld.h:261
Editors are the view controllers for the application.
Zelda 3 specific classes and functions.
Unified dependency container for all editor types.
Definition editor.h:163
Represents a single session, containing a ROM and its associated editors.
core::FeatureFlags::Flags feature_flags
std::array< bool, kEditorTypeCount > editor_initialized
zelda3::GameData game_data
std::array< bool, kEditorTypeCount > editor_assets_loaded
std::string GetDisplayName() const