yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
session_types.cc
Go to the documentation of this file.
2
3#include "app/editor/editor.h" // For EditorDependencies, needed by ApplyDependencies
4#include "app/editor/system/user_settings.h" // For UserSettings forward decl in header
5
6namespace yaze::editor {
7
9 UserSettings* user_settings, size_t session_id)
10 : session_id_(session_id), game_data_(game_data) {
11 assembly_editor_ = std::make_unique<AssemblyEditor>(rom);
12 dungeon_editor_ = std::make_unique<DungeonEditorV2>(rom);
13 graphics_editor_ = std::make_unique<GraphicsEditor>(rom);
14 music_editor_ = std::make_unique<MusicEditor>(rom);
15 overworld_editor_ = std::make_unique<OverworldEditor>(rom);
16 palette_editor_ = std::make_unique<PaletteEditor>(rom);
17 screen_editor_ = std::make_unique<ScreenEditor>(rom);
18 sprite_editor_ = std::make_unique<SpriteEditor>(rom);
19 message_editor_ = std::make_unique<MessageEditor>(rom);
20 memory_editor_ = std::make_unique<MemoryEditor>(rom);
21 settings_panel_ = std::make_unique<SettingsPanel>();
22
23 // Propagate game_data to editors that need it
24 if (game_data) {
25 dungeon_editor_->SetGameData(game_data);
26 graphics_editor_->SetGameData(game_data);
27 overworld_editor_->SetGameData(game_data);
28 }
29
33 music_editor_.get(), screen_editor_.get(),
34 assembly_editor_.get()};
35}
36
37EditorSet::~EditorSet() = default;
38
40 settings_panel_->SetUserSettings(settings);
41}
42
44 for (auto* editor : active_editors_) {
45 editor->SetDependencies(dependencies);
46 }
47 memory_editor_->SetRom(dependencies.rom);
48 if (music_editor_) {
49 music_editor_->SetProject(dependencies.project);
50 }
51
52 // MusicEditor needs emulator for audio playback
53 if (dependencies.emulator) {
54 music_editor_->set_emulator(dependencies.emulator);
55 }
56
57 // Configure SettingsPanel
58 if (settings_panel_) {
59 settings_panel_->SetRom(dependencies.rom);
60 settings_panel_->SetUserSettings(dependencies.user_settings);
61 settings_panel_->SetPanelRegistry(dependencies.panel_manager);
62 settings_panel_->SetShortcutManager(dependencies.shortcut_manager);
63 }
64}
65
66RomSession::RomSession(Rom&& r, UserSettings* user_settings, size_t session_id)
67 : rom(std::move(r)),
68 game_data(&rom),
69 editors(&rom, &game_data, user_settings, session_id) {
72}
73
74std::string RomSession::GetDisplayName() const {
75 if (!custom_name.empty()) {
76 return custom_name;
77 }
78 return rom.title().empty() ? "Untitled Session" : rom.title();
79}
80
81} // namespace yaze::editor
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
auto filename() const
Definition rom.h:141
auto title() const
Definition rom.h:133
std::unique_ptr< MessageEditor > message_editor_
std::unique_ptr< AssemblyEditor > assembly_editor_
std::unique_ptr< ScreenEditor > screen_editor_
std::unique_ptr< DungeonEditorV2 > dungeon_editor_
std::unique_ptr< MemoryEditor > memory_editor_
std::unique_ptr< PaletteEditor > palette_editor_
void ApplyDependencies(const EditorDependencies &dependencies)
std::unique_ptr< OverworldEditor > overworld_editor_
std::unique_ptr< SpriteEditor > sprite_editor_
EditorSet(Rom *rom=nullptr, zelda3::GameData *game_data=nullptr, UserSettings *user_settings=nullptr, size_t session_id=0)
std::unique_ptr< MusicEditor > music_editor_
void set_user_settings(UserSettings *settings)
std::unique_ptr< SettingsPanel > settings_panel_
std::unique_ptr< GraphicsEditor > graphics_editor_
std::vector< Editor * > active_editors_
Manages user preferences and settings persistence.
Editors are the view controllers for the application.
Definition agent_chat.cc:23
Unified dependency container for all editor types.
Definition editor.h:111
project::YazeProject * project
Definition editor.h:134
ShortcutManager * shortcut_manager
Definition editor.h:131
core::FeatureFlags::Flags feature_flags
std::string GetDisplayName() const