From 5a35718070d2247e254fd574ab84cfc7814c9498 Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 5 Oct 2025 00:31:46 -0400 Subject: [PATCH] refactor: Update Doxyfile and resource paths for improved organization - Changed the paths for project logo and icon in Doxyfile to point to the new assets directory. - Updated CMake configurations to reflect the new locations of resource files, enhancing clarity and maintainability. - Replaced instances of core utility functions with util functions across various files for consistency in file handling. - Added new resource files for Windows platform support and removed obsolete resource files, streamlining the build process. --- Doxyfile | 4 ++-- {src/win32 => assets}/yaze.ico | Bin src/CMakeLists.txt | 8 +++----- src/app/editor/agent/agent_chat_widget.cc | 14 +++++++------- src/app/editor/editor_manager.cc | 10 +++++----- src/app/gui/theme_manager.cc | 8 ++++---- src/{ => app/platform}/win32/yaze.rc | 0 src/cli/handlers/project.cc | 2 +- src/cli/tui.cc | 4 ++-- src/win32/yaze.res | Bin 606 -> 0 bytes 10 files changed, 24 insertions(+), 26 deletions(-) rename {src/win32 => assets}/yaze.ico (100%) rename src/{ => app/platform}/win32/yaze.rc (100%) delete mode 100644 src/win32/yaze.res diff --git a/Doxyfile b/Doxyfile index e94bb487..bd524088 100644 --- a/Doxyfile +++ b/Doxyfile @@ -61,13 +61,13 @@ PROJECT_BRIEF = Link to the Past ROM Editor # pixels and the maximum width should not exceed 200 pixels. Doxygen will copy # the logo to the output directory. -PROJECT_LOGO = "src/win32/yaze.ico" +PROJECT_LOGO = "assets/yaze.ico" # With the PROJECT_ICON tag one can specify an icon that is included in the tabs # when the HTML document is shown. Doxygen will copy the logo to the output # directory. -PROJECT_ICON = "src/win32/yaze.ico" +PROJECT_ICON = "assets/yaze.ico" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path # into which the generated documentation will be written. If a relative path is diff --git a/src/win32/yaze.ico b/assets/yaze.ico similarity index 100% rename from src/win32/yaze.ico rename to assets/yaze.ico diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6d2c712..fbddec98 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -456,8 +456,8 @@ else() # Only use resource file for x64 Windows builds if(WIN32 AND CMAKE_SIZEOF_VOID_P EQUAL 8) # Generate yaze.res from yaze.rc and yaze.ico for Windows x64 builds - set(YAZE_RC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/win32/yaze.rc") - set(YAZE_ICO_FILE "${CMAKE_CURRENT_SOURCE_DIR}/win32/yaze.ico") + set(YAZE_RC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/app/platform/win32/yaze.rc") + set(YAZE_ICO_FILE "${CMAKE_SOURCE_DIR}/assets/yaze.ico") set(YAZE_RES_FILE "${CMAKE_CURRENT_BINARY_DIR}/yaze.res") # Add a custom command to generate the .res file from the .rc and .ico @@ -1076,9 +1076,7 @@ source_group("API\\Python" FILES # Platform-specific Resources source_group("Platform\\Windows" FILES - win32/yaze.ico - win32/yaze.rc - win32/yaze.res + app/platform/win32/yaze.rc ) source_group("Platform\\iOS" FILES diff --git a/src/app/editor/agent/agent_chat_widget.cc b/src/app/editor/agent/agent_chat_widget.cc index 71375cc6..4e5c35fb 100644 --- a/src/app/editor/agent/agent_chat_widget.cc +++ b/src/app/editor/agent/agent_chat_widget.cc @@ -1649,7 +1649,7 @@ void AgentChatWidget::RenderSystemPromptEditor() { // Toolbar if (ImGui::Button(ICON_MD_FOLDER_OPEN " Load V1")) { // Load embedded system_prompt.txt (v1) - std::string prompt_v1 = core::LoadFile("assets/agent/system_prompt.txt"); + std::string prompt_v1 = util::LoadFile("assets/agent/system_prompt.txt"); if (!prompt_v1.empty()) { // Find or create system prompt tab bool found = false; @@ -1685,7 +1685,7 @@ void AgentChatWidget::RenderSystemPromptEditor() { ImGui::SameLine(); if (ImGui::Button(ICON_MD_FOLDER_OPEN " Load V2")) { // Load embedded system_prompt_v2.txt - std::string prompt_v2 = core::LoadFile("assets/agent/system_prompt_v2.txt"); + std::string prompt_v2 = util::LoadFile("assets/agent/system_prompt_v2.txt"); if (!prompt_v2.empty()) { // Find or create system prompt tab bool found = false; @@ -1730,7 +1730,7 @@ void AgentChatWidget::RenderSystemPromptEditor() { if (file.is_open()) { file << tab.editor.GetText(); tab.filepath = save_path; - tab.filename = core::GetFileName(save_path); + tab.filename = util::GetFileName(save_path); tab.modified = false; if (toast_manager_) { toast_manager_->Show(absl::StrFormat("System prompt saved to %s", save_path), @@ -1771,7 +1771,7 @@ void AgentChatWidget::RenderSystemPromptEditor() { buffer << file.rdbuf(); tab.editor.SetText(buffer.str()); tab.filepath = filepath; - tab.filename = core::GetFileName(filepath); + tab.filename = util::GetFileName(filepath); tab.modified = false; found = true; break; @@ -1780,7 +1780,7 @@ void AgentChatWidget::RenderSystemPromptEditor() { if (!found) { FileEditorTab tab; - tab.filename = core::GetFileName(filepath); + tab.filename = util::GetFileName(filepath); tab.filepath = filepath; tab.is_system_prompt = true; tab.editor.SetLanguageDefinition(TextEditor::LanguageDefinition::CPlusPlus()); @@ -2042,7 +2042,7 @@ void AgentChatWidget::LoadAgentSettingsFromProject(const core::YazeProject& proj buffer << file.rdbuf(); tab.editor.SetText(buffer.str()); tab.filepath = prompt_path; - tab.filename = core::GetFileName(prompt_path); + tab.filename = util::GetFileName(prompt_path); found = true; break; } @@ -2050,7 +2050,7 @@ void AgentChatWidget::LoadAgentSettingsFromProject(const core::YazeProject& proj if (!found) { FileEditorTab tab; - tab.filename = core::GetFileName(prompt_path); + tab.filename = util::GetFileName(prompt_path); tab.filepath = prompt_path; tab.is_system_prompt = true; tab.editor.SetLanguageDefinition(TextEditor::LanguageDefinition::CPlusPlus()); diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index bd513e43..be08a6be 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -76,7 +76,7 @@ std::string GetEditorName(EditorType type) { // Settings + preset helpers void EditorManager::LoadUserSettings() { try { - auto data = core::LoadConfigFile(settings_filename_); + auto data = util::LoadConfigFile(settings_filename_); if (!data.empty()) { std::istringstream ss(data); std::string line; @@ -103,7 +103,7 @@ void EditorManager::SaveUserSettings() { ss << "font_global_scale=" << font_global_scale_ << "\n"; ss << "autosave_enabled=" << (autosave_enabled_ ? 1 : 0) << "\n"; ss << "autosave_interval_secs=" << autosave_interval_secs_ << "\n"; - core::SaveFile(settings_filename_, ss.str()); + util::SaveFile(settings_filename_, ss.str()); } void EditorManager::RefreshWorkspacePresets() { @@ -114,7 +114,7 @@ void EditorManager::RefreshWorkspacePresets() { // Try to read a simple index file of presets try { - auto data = core::LoadConfigFile("workspace_presets.txt"); + auto data = util::LoadConfigFile("workspace_presets.txt"); if (!data.empty()) { std::istringstream ss(data); std::string name; @@ -164,7 +164,7 @@ void EditorManager::SaveWorkspacePreset(const std::string& name) { std::ostringstream ss; for (const auto& n : workspace_presets_) ss << n << "\n"; - core::SaveFile("workspace_presets.txt", ss.str()); + util::SaveFile("workspace_presets.txt", ss.str()); } catch (const std::exception& e) { LOG_WARN("EditorManager", "Failed to save workspace presets: %s", e.what()); } @@ -1454,7 +1454,7 @@ void EditorManager::DrawMenuBar() { ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::Text("%s", core::GetFileName(file).c_str()); + ImGui::Text("%s", util::GetFileName(file).c_str()); ImGui::TableNextColumn(); std::string ext = core::GetFileExtension(file); diff --git a/src/app/gui/theme_manager.cc b/src/app/gui/theme_manager.cc index 979aa4d1..77960a40 100644 --- a/src/app/gui/theme_manager.cc +++ b/src/app/gui/theme_manager.cc @@ -263,7 +263,7 @@ absl::Status ThemeManager::LoadThemeFromFile(const std::string& filepath) { filepath, // Absolute path "assets/themes/" + filepath, // Relative from build dir "../assets/themes/" + filepath, // Relative from bin dir - core::GetResourcePath("assets/themes/" + filepath), // Platform-specific resource path + util::GetResourcePath("assets/themes/" + filepath), // Platform-specific resource path }; std::ifstream file; @@ -1898,13 +1898,13 @@ std::vector ThemeManager::GetThemeSearchPaths() const { // Platform-specific resource paths #ifdef __APPLE__ // macOS bundle resource path (this should be the primary path for bundled apps) - std::string bundle_themes = core::GetResourcePath("assets/themes/"); + std::string bundle_themes = util::GetResourcePath("assets/themes/"); if (!bundle_themes.empty()) { search_paths.push_back(bundle_themes); } // Alternative bundle locations - std::string bundle_root = core::GetBundleResourcePath(); + std::string bundle_root = util::GetBundleResourcePath(); search_paths.push_back(bundle_root + "Contents/Resources/themes/"); search_paths.push_back(bundle_root + "Contents/Resources/assets/themes/"); @@ -1917,7 +1917,7 @@ std::vector ThemeManager::GetThemeSearchPaths() const { #endif // User config directory - std::string config_themes = core::GetConfigDirectory() + "/themes/"; + std::string config_themes = util::GetConfigDirectory() + "/themes/"; search_paths.push_back(config_themes); return search_paths; diff --git a/src/win32/yaze.rc b/src/app/platform/win32/yaze.rc similarity index 100% rename from src/win32/yaze.rc rename to src/app/platform/win32/yaze.rc diff --git a/src/cli/handlers/project.cc b/src/cli/handlers/project.cc index 73d51706..b038fbb8 100644 --- a/src/cli/handlers/project.cc +++ b/src/cli/handlers/project.cc @@ -52,7 +52,7 @@ absl::Status ProjectBuild::Run(const std::vector& arg_vec) { for (unsigned int i = 0; i < glob_result.gl_pathc; ++i) { std::string patch_file = glob_result.gl_pathv[i]; std::vector patch_data; - auto patch_contents = core::LoadFile(patch_file); + auto patch_contents = util::LoadFile(patch_file); std::copy(patch_contents.begin(), patch_contents.end(), std::back_inserter(patch_data)); std::vector patched_rom; diff --git a/src/cli/tui.cc b/src/cli/tui.cc index f8a7cf65..ec24d79b 100644 --- a/src/cli/tui.cc +++ b/src/cli/tui.cc @@ -64,11 +64,11 @@ void ApplyBpsPatchComponent(ftxui::ScreenInteractive &screen) { // Button to apply the patch. auto apply_button = Button("Apply Patch", [&] { std::vector source = app_context.rom.vector(); - // auto source_contents = core::LoadFile(base_file); + // auto source_contents = util::LoadFile(base_file); // std::copy(source_contents.begin(), source_contents.end(), // std::back_inserter(source)); std::vector patch; - auto patch_contents = core::LoadFile(patch_file); + auto patch_contents = util::LoadFile(patch_file); std::copy(patch_contents.begin(), patch_contents.end(), std::back_inserter(patch)); std::vector patched; diff --git a/src/win32/yaze.res b/src/win32/yaze.res deleted file mode 100644 index cc3b7e34a35da5aefd7f2598c9548560641a5289..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 606 zcmah{Jxjzu6r6m3T%!@h)^qVBm8em$5IkZEZB!zAt%W97pMM~g_!BIzw6wHL=})lC zPe{3?^WJiJisF!YGyC@KCc7_pj{yW{A>dt%o$15$RLJr9Qd^yo*^g-qX?tMl&@0~-Mrg(ko@GpL z+LH4lsu&S#MMng+E^W#2q^>kSS*=w!v-RqF-