From d45f7819e1e57ae3ed18009c9c3615a86eae0ad5 Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 15 Oct 2025 20:10:04 -0400 Subject: [PATCH] refactor(app): reorganize application structure and update includes - Moved core components such as `Controller` and `Window` from `src/app/core/` to `src/app/` and `src/app/platform/`, respectively, to improve modularity and clarity. - Updated include paths across the codebase to reflect the new locations of these components. - Introduced a new foundational core library in `src/core/` for project management and ROM patching logic, enhancing the separation of concerns. - Adjusted CMake configurations to ensure proper compilation of the new core library and updated dependencies in various modules. Benefits: - Streamlines the application structure, making it easier to navigate and maintain. - Enhances code organization by clearly delineating core functionalities from application-specific logic. - Improves overall architecture by promoting a clearer separation of concerns between different components. --- CMakePresets.json | 129 +++++++++-------- docs/B7-architecture-refactoring-plan.md | 44 ++++-- src/CMakeLists.txt | 7 +- src/app/{core => }/controller.cc | 6 +- src/app/{core => }/controller.h | 4 +- src/app/core/core_library.cmake | 132 +++++++++--------- src/app/editor/agent/agent_chat_widget.cc | 8 +- src/app/editor/agent/agent_chat_widget.h | 6 +- src/app/editor/code/project_file_editor.cc | 3 +- src/app/editor/code/project_file_editor.h | 4 +- .../editor/dungeon/dungeon_object_selector.cc | 2 +- src/app/editor/editor_library.cmake | 4 +- src/app/editor/editor_manager.cc | 24 ++-- src/app/editor/editor_manager.h | 4 +- src/app/editor/graphics/graphics_editor.cc | 2 +- src/app/editor/overworld/overworld_editor.cc | 2 +- .../overworld/overworld_entity_renderer.cc | 2 +- src/app/editor/overworld/scratch_space.cc | 2 +- src/app/editor/session_types.h | 2 +- src/app/editor/system/menu_orchestrator.cc | 2 +- src/app/editor/system/project_manager.cc | 8 +- src/app/editor/system/project_manager.h | 8 +- .../editor/system/shortcut_configurator.cc | 4 +- src/app/editor/ui/ui_coordinator.cc | 4 +- src/app/editor/ui/welcome_screen.cc | 8 +- src/app/emu/audio/spc700.cc | 2 +- src/app/emu/cpu/cpu.cc | 2 +- src/app/emu/emu_library.cmake | 2 +- src/app/emu/emulator.cc | 2 +- src/app/gui/app/feature_flags_menu.h | 2 +- src/app/gui/core/background_renderer.cc | 4 +- .../dungeon_object_emulator_preview.cc | 2 +- src/app/main.cc | 8 +- src/app/platform/app_delegate.mm | 4 +- src/app/platform/file_dialog.mm | 2 +- src/app/{core => platform}/timing.h | 2 - src/app/platform/view_controller.h | 4 +- src/app/{core => platform}/window.cc | 2 +- src/app/{core => platform}/window.h | 0 src/app/rom.cc | 2 +- src/app/rom.h | 6 +- .../service/canvas_automation_service.cc | 2 +- .../service/canvas_automation_service.h | 0 .../service/imgui_test_harness_service.cc | 6 +- .../service/imgui_test_harness_service.h | 4 +- .../{core => }/service/screenshot_utils.cc | 2 +- src/app/{core => }/service/screenshot_utils.h | 0 .../{core => }/service/unified_grpc_server.cc | 6 +- .../{core => }/service/unified_grpc_server.h | 0 .../service/widget_discovery_service.cc | 2 +- .../service/widget_discovery_service.h | 0 src/app/test/test_manager.cc | 4 +- .../{core/testing => test}/test_recorder.cc | 4 +- .../{core/testing => test}/test_recorder.h | 0 .../testing => test}/test_script_parser.cc | 2 +- .../testing => test}/test_script_parser.h | 0 src/cli/agent.cmake | 2 +- src/cli/handlers/agent/conversation_test.cc | 4 +- src/cli/handlers/agent/general_commands.cc | 4 +- src/cli/handlers/rom/mock_rom.cc | 4 +- src/cli/handlers/rom/project_commands.cc | 6 +- .../service/agent/emulator_service_impl.cc | 2 +- src/cli/service/ai/ai_gui_controller.cc | 2 +- src/cli/service/resources/command_context.cc | 4 +- src/core/CMakeLists.txt | 66 +++++++++ src/{app => }/core/features.h | 7 +- src/{app => }/core/project.cc | 6 +- src/{app => }/core/project.h | 15 +- src/ios/main.mm | 6 +- src/util/file_util.cc | 2 +- src/util/log.h | 2 +- src/zelda3/dungeon/dungeon_editor_system.h | 2 +- src/zelda3/dungeon/dungeon_object_editor.cc | 2 +- src/zelda3/dungeon/dungeon_object_editor.h | 2 +- src/zelda3/overworld/overworld.cc | 2 +- src/zelda3/overworld/overworld_map.cc | 2 +- src/zelda3/screen/dungeon_map.cc | 2 +- src/zelda3/screen/inventory.cc | 2 +- test/e2e/canvas_selection_test.cc | 4 +- test/e2e/dungeon_editor_smoke_test.cc | 2 +- .../e2e/dungeon_object_rendering_e2e_tests.cc | 4 +- test/integration/ai/test_gemini_vision.cc | 2 +- .../editor/editor_integration_test.cc | 2 +- .../editor/editor_integration_test.h | 6 +- test/integration/editor/tile16_editor_test.cc | 2 +- test/test_editor.cc | 6 +- test/test_utils.cc | 4 +- test/yaze_test.cc | 6 +- 88 files changed, 393 insertions(+), 290 deletions(-) rename src/app/{core => }/controller.cc (97%) rename src/app/{core => }/controller.h (95%) rename src/app/{core => platform}/timing.h (98%) rename src/app/{core => platform}/window.cc (99%) rename src/app/{core => platform}/window.h (100%) rename src/app/{core => }/service/canvas_automation_service.cc (99%) rename src/app/{core => }/service/canvas_automation_service.h (100%) rename src/app/{core => }/service/imgui_test_harness_service.cc (99%) rename src/app/{core => }/service/imgui_test_harness_service.h (98%) rename src/app/{core => }/service/screenshot_utils.cc (99%) rename src/app/{core => }/service/screenshot_utils.h (100%) rename src/app/{core => }/service/unified_grpc_server.cc (96%) rename src/app/{core => }/service/unified_grpc_server.h (100%) rename src/app/{core => }/service/widget_discovery_service.cc (99%) rename src/app/{core => }/service/widget_discovery_service.h (100%) rename src/app/{core/testing => test}/test_recorder.cc (98%) rename src/app/{core/testing => test}/test_recorder.h (100%) rename src/app/{core/testing => test}/test_script_parser.cc (99%) rename src/app/{core/testing => test}/test_script_parser.h (100%) create mode 100644 src/core/CMakeLists.txt rename src/{app => }/core/features.h (97%) rename src/{app => }/core/project.cc (99%) rename src/{app => }/core/project.h (97%) diff --git a/CMakePresets.json b/CMakePresets.json index b6246892..aac9fca6 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -490,69 +490,64 @@ } ], "testPresets": [ + { + "name": "all", + "configurePreset": "mac-dev", + "displayName": "Run all tests", + "description": "Runs all tests, including ROM-dependent and experimental tests." + }, { "name": "stable", "configurePreset": "ci", - "displayName": "Stable Tests (Release Ready)", - "execution": { - "noTestsAction": "error", - "stopOnFailure": true - }, - "filter": { - "exclude": { - "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" - } - } - }, - { - "name": "dev", - "configurePreset": "mac-dev", - "displayName": "Development Tests (with ROM)", - "execution": { - "noTestsAction": "error", - "stopOnFailure": false - }, - "filter": { - "exclude": { - "name": ".*(E2ERomDependentTest|ZSCustomOverworldUpgradeTest).*" - } - } - }, - { - "name": "ci", - "configurePreset": "ci", - "displayName": "CI Tests (stable only)", - "execution": { - "noTestsAction": "error", - "stopOnFailure": true - }, - "filter": { - "exclude": { - "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" - } - } - }, - { - "name": "unit", - "configurePreset": "ci", - "displayName": "Unit Tests Only", - "filter": { - "exclude": { - "name": ".*(IntegrationTest|E2ERomDependentTest|ZSCustomOverworldUpgradeTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" - } - } - }, - { - "name": "integration", - "configurePreset": "mac-dev", - "displayName": "Integration Tests Only", - "execution": { - "noTestsAction": "error", - "stopOnFailure": false - }, + "displayName": "Stable tests", + "description": "Runs tests marked with the 'stable' label.", "filter": { "include": { - "name": ".*(IntegrationTest|RomIntegrationTest|ComprehensiveIntegrationTest|OverworldIntegrationTest|DungeonIntegrationTest|DungeonEditorIntegrationTest|DungeonEditorSystemIntegrationTest|DungeonObjectRendererIntegrationTest|DungeonObjectRendererMockTest|DungeonObjectRenderingTests|Tile16EditorIntegrationTest).*" + "label": "stable" + } + } + }, + { + "name": "rom-dependent", + "configurePreset": "mac-dev", + "displayName": "ROM-dependent tests", + "description": "Runs tests that require a ROM file.", + "filter": { + "include": { + "label": "rom_dependent" + } + } + }, + { + "name": "gui", + "configurePreset": "mac-dev", + "displayName": "GUI tests", + "description": "Runs GUI-based tests.", + "filter": { + "include": { + "label": "gui" + } + } + }, + { + "name": "experimental", + "configurePreset": "mac-dev", + "displayName": "Experimental tests", + "description": "Runs tests marked as 'experimental'.", + "filter": { + "include": { + "label": "experimental" + } + } + }, + { + "name": "benchmark", + "configurePreset": "mac-rel", + "displayName": "Benchmark tests", + "description": "Runs performance benchmark tests.", + "filter": { + "include": { + "label": "benchmark" } } } @@ -594,7 +589,7 @@ }, { "type": "test", - "name": "dev" + "name": "all" } ] }, @@ -612,7 +607,7 @@ }, { "type": "test", - "name": "ci" + "name": "stable" } ] }, @@ -633,6 +628,20 @@ "name": "mac-uni" } ] + }, + { + "name": "format-check", + "displayName": "Check Code Formatting", + "steps": [ + { + "type": "configure", + "name": "mac-dev" + }, + { + "type": "build", + "name": "mac-dev" + } + ] } ] } \ No newline at end of file diff --git a/docs/B7-architecture-refactoring-plan.md b/docs/B7-architecture-refactoring-plan.md index 6b46aa63..c394dc17 100644 --- a/docs/B7-architecture-refactoring-plan.md +++ b/docs/B7-architecture-refactoring-plan.md @@ -28,7 +28,7 @@ The proposed architecture organizes the codebase into two distinct layers: **Fou │ ├── app/ (REFACTORED) Main GUI Application │ ├── controller.cc (MOVED) Main application controller -│ ├── platform/ (MOVED) 윈도우 Windowing, input, platform abstractions +│ ├── platform/ (MOVED) Windowing, input, platform abstractions │ ├── service/ (MOVED) AI gRPC services for automation │ ├── editor/ (EXISTING) 🎨 Editor implementations │ └── gui/ (EXISTING) Shared ImGui widgets @@ -81,17 +81,37 @@ This architectural refactoring fully supports and complements the ongoing `Edito ## 5. Migration Checklist -1. [ ] **Phase 1**: Create `src/core/` and move `project`, `asar_wrapper`, and `features` files. -2. [ ] **Phase 1**: Create the `yaze_core_lib` CMake target. -3. [ ] **Phase 2**: Move `src/app/gfx/` to `src/gfx/`. -4. [ ] **Phase 2**: Create the `yaze_gfx_lib` CMake target. -5. [ ] **Phase 3**: Move `src/app/core/service/` to `src/app/service/`. -6. [ ] **Phase 3**: Move `window.cc`, `timing.h` to `src/app/platform/`. -7. [ ] **Phase 3**: Move `controller.cc` to `src/app/`. -8. [ ] **Phase 3**: Update the `yaze` executable's CMake target to include the moved sources and link against the new libraries. -9. [ ] **Phase 3**: Delete the now-empty `src/app/core/` directory and its `core_library.cmake` file. -10. [ ] **Verification**: Perform a clean build of all targets (`yaze`, `z3ed`, `yaze_test`) to ensure all dependencies are correctly resolved. -11. [ ] **Cleanup**: Search the codebase for any remaining `#include "app/core/..."` or `#include "app/gfx/..."` directives and update them to their new paths. +1. [x] **Phase 1**: Create `src/core/` and move `project`, `asar_wrapper`, and `features` files. +2. [x] **Phase 1**: Create the `yaze_core_lib` CMake target. +3. [ ] **Phase 2**: Move `src/app/gfx/` to `src/gfx/`. (DEFERRED - app-specific) +4. [ ] **Phase 2**: Create the `yaze_gfx_lib` CMake target. (DEFERRED - app-specific) +5. [x] **Phase 3**: Move `src/app/core/service/` to `src/app/service/`. +6. [x] **Phase 3**: Move `src/app/core/testing/` to `src/app/test/` (merged with existing test/). +7. [x] **Phase 3**: Move `window.cc`, `timing.h` to `src/app/platform/`. +8. [x] **Phase 3**: Move `controller.cc` to `src/app/`. +9. [x] **Phase 3**: Update CMake targets - renamed `yaze_core_lib` to `yaze_app_core_lib` to distinguish from foundational `yaze_core_lib`. +10. [x] **Phase 3**: `src/app/core/` now only contains `core_library.cmake` for app-level functionality. +11. [x] **Cleanup**: All `#include "app/core/..."` directives updated to new paths. + +## 6. Completed Changes (October 15, 2025) + +### Phase 1: Foundational Core Library ✅ +- Created `src/core/` with `project.{h,cc}`, `features.h`, and `asar_wrapper.{h,cc}` +- Changed namespace from `yaze::core` to `yaze::project` for project management types +- Created new `yaze_core_lib` in `src/core/CMakeLists.txt` with minimal dependencies +- Updated all 32+ files to use `#include "core/project.h"` and `#include "core/features.h"` + +### Phase 3: Application Layer Streamlining ✅ +- Moved `src/app/core/service/` → `src/app/service/` (gRPC services) +- Moved `src/app/core/testing/` → `src/app/test/` (merged with existing test infrastructure) +- Moved `src/app/core/window.{cc,h}`, `timing.h` → `src/app/platform/` +- Moved `src/app/core/controller.{cc,h}` → `src/app/` +- Renamed old `yaze_core_lib` to `yaze_app_core_lib` to avoid naming conflict +- Updated all CMake dependencies in editor, emulator, agent, and test libraries +- Removed duplicate source files from `src/app/core/` + +### Deferred (Phase 2) +Graphics refactoring (`src/app/gfx/` → `src/gfx/`) deferred as it's app-specific and requires careful consideration of rendering backends. ## 6. Expected Benefits diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b6cd740..bf4f1597 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,10 +58,15 @@ endforeach() # Include modular libraries include(util/util.cmake) +include(zelda3/zelda3_library.cmake) + +# Add foundational core library (project management, asar wrapper) +add_subdirectory(core) + +# App-specific libraries include(app/gfx/gfx_library.cmake) include(app/net/net_library.cmake) include(app/gui/gui_library.cmake) -include(zelda3/zelda3_library.cmake) include(app/core/core_library.cmake) # Include test support library BEFORE yaze_editor so it can link against it diff --git a/src/app/core/controller.cc b/src/app/controller.cc similarity index 97% rename from src/app/core/controller.cc rename to src/app/controller.cc index a903dfdb..1940253f 100644 --- a/src/app/core/controller.cc +++ b/src/app/controller.cc @@ -5,8 +5,8 @@ #include #include "absl/status/status.h" -#include "app/core/timing.h" -#include "app/core/window.h" +#include "app/platform/timing.h" +#include "app/platform/window.h" #include "app/editor/editor_manager.h" #include "app/gui/core/background_renderer.h" #include "app/gfx/resource/arena.h" // Add include for Arena @@ -18,7 +18,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace core { absl::Status Controller::OnEntry(std::string filename) { // Create renderer FIRST @@ -125,5 +124,4 @@ void Controller::OnExit() { PRINT_IF_ERROR(ShutdownWindow(window_)); } -} // namespace core } // namespace yaze diff --git a/src/app/core/controller.h b/src/app/controller.h similarity index 95% rename from src/app/core/controller.h rename to src/app/controller.h index 2e57c670..e8582b63 100644 --- a/src/app/core/controller.h +++ b/src/app/controller.h @@ -6,7 +6,7 @@ #include #include "absl/status/status.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/rom.h" #include "app/editor/editor_manager.h" #include "app/gfx/backend/irenderer.h" @@ -14,7 +14,6 @@ int main(int argc, char** argv); namespace yaze { -namespace core { /** * @brief Main controller for the application. @@ -52,7 +51,6 @@ class Controller { std::unique_ptr renderer_; }; -} // namespace core } // namespace yaze #endif // YAZE_APP_CORE_CONTROLLER_H diff --git a/src/app/core/core_library.cmake b/src/app/core/core_library.cmake index 15cd1259..93e23f2a 100644 --- a/src/app/core/core_library.cmake +++ b/src/app/core/core_library.cmake @@ -1,11 +1,27 @@ +# ============================================================================== +# Application Core Library (Platform, Controller, Services) +# ============================================================================== +# This file defines the application-level core components that were moved +# from the monolithic app/core structure. This is distinct from the foundational +# yaze_core_lib in src/core/ which handles project management and asar. +# +# Components: +# - ROM management (app/rom.cc) +# - Application controller (app/controller.cc) +# - Window/platform management (app/platform/) +# - gRPC services for AI automation (app/service/) +# - Test harness (app/test/) +# +# Dependencies: yaze_core_lib (foundational), yaze_util, yaze_gfx, SDL2, ImGui +# ============================================================================== + set( YAZE_APP_CORE_SRC - core/asar_wrapper.cc - app/core/controller.cc - app/core/project.cc - app/core/window.cc + app/controller.cc + app/platform/window.cc ) +# Platform-specific sources if (WIN32 OR MINGW OR (UNIX AND NOT APPLE)) list(APPEND YAZE_APP_CORE_SRC app/platform/font_loader.cc @@ -26,26 +42,23 @@ if(APPLE) app/platform/font_loader.mm ) - add_library(yaze_core_objcxx OBJECT ${YAZE_APPLE_OBJCXX_SRC}) - set_target_properties(yaze_core_objcxx PROPERTIES + add_library(yaze_app_objcxx OBJECT ${YAZE_APPLE_OBJCXX_SRC}) + set_target_properties(yaze_app_objcxx PROPERTIES OBJCXX_STANDARD 20 OBJCXX_STANDARD_REQUIRED ON ) - target_include_directories(yaze_core_objcxx PUBLIC + target_include_directories(yaze_app_objcxx PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/app ${CMAKE_SOURCE_DIR}/src/lib ${CMAKE_SOURCE_DIR}/src/lib/imgui - ${CMAKE_SOURCE_DIR}/src/lib/asar/src - ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar - ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c ${CMAKE_SOURCE_DIR}/incl ${SDL2_INCLUDE_DIR} ${PROJECT_BINARY_DIR} ) - target_link_libraries(yaze_core_objcxx PUBLIC ${ABSL_TARGETS} yaze_util) - target_compile_definitions(yaze_core_objcxx PUBLIC MACOS) + target_link_libraries(yaze_app_objcxx PUBLIC ${ABSL_TARGETS} yaze_util) + target_compile_definitions(yaze_app_objcxx PUBLIC MACOS) find_library(COCOA_LIBRARY Cocoa) if(NOT COCOA_LIBRARY) @@ -55,50 +68,39 @@ if(APPLE) endif() # ============================================================================== -# Yaze Core Library +# Application Core Library # ============================================================================== -# This library contains core application functionality: -# - ROM management -# - Project management -# - Controller/Window management -# - Asar wrapper for assembly -# - Platform-specific utilities (file dialogs, fonts, clipboard) -# - Widget state capture for testing -# - Emulator interface -# -# Dependencies: yaze_util, yaze_gfx, asar, SDL2 +# Renamed from old yaze_core_lib to yaze_app_core_lib to distinguish from +# the foundational yaze_core_lib in src/core/ # ============================================================================== -add_library(yaze_core_lib STATIC +add_library(yaze_app_core_lib STATIC app/rom.cc ${YAZE_APP_CORE_SRC} - $<$:$> + $<$:$> ) -target_precompile_headers(yaze_core_lib PRIVATE +target_precompile_headers(yaze_app_core_lib PRIVATE "$<$:${CMAKE_SOURCE_DIR}/src/yaze_pch.h>" ) -target_include_directories(yaze_core_lib PUBLIC +target_include_directories(yaze_app_core_lib PUBLIC ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/app ${CMAKE_SOURCE_DIR}/src/lib ${CMAKE_SOURCE_DIR}/src/lib/imgui - ${CMAKE_SOURCE_DIR}/src/lib/asar/src - ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar - ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c ${CMAKE_SOURCE_DIR}/incl ${SDL2_INCLUDE_DIR} ${PROJECT_BINARY_DIR} ) -target_link_libraries(yaze_core_lib PUBLIC +target_link_libraries(yaze_app_core_lib PUBLIC + yaze_core_lib # NEW foundational core library with project management yaze_util yaze_gfx - yaze_zelda3 # Needed for Zelda3Labels in project.cc + yaze_zelda3 yaze_common ImGui - asar-static ${ABSL_TARGETS} ${SDL_TARGETS} ${CMAKE_DL_LIBS} @@ -107,49 +109,53 @@ target_link_libraries(yaze_core_lib PUBLIC # Link nativefiledialog-extended for Windows/Linux file dialogs if(WIN32 OR (UNIX AND NOT APPLE)) add_subdirectory(${CMAKE_SOURCE_DIR}/src/lib/nativefiledialog-extended ${CMAKE_BINARY_DIR}/nfd EXCLUDE_FROM_ALL) - target_link_libraries(yaze_core_lib PUBLIC nfd) - target_include_directories(yaze_core_lib PUBLIC ${CMAKE_SOURCE_DIR}/src/lib/nativefiledialog-extended/src/include) + target_link_libraries(yaze_app_core_lib PUBLIC nfd) + target_include_directories(yaze_app_core_lib PUBLIC ${CMAKE_SOURCE_DIR}/src/lib/nativefiledialog-extended/src/include) endif() +# ============================================================================== +# gRPC Services and Test Harness (Optional) +# ============================================================================== + if(YAZE_WITH_GRPC) - target_include_directories(yaze_core_lib PRIVATE + target_include_directories(yaze_app_core_lib PRIVATE ${CMAKE_SOURCE_DIR}/third_party/json/include) - target_compile_definitions(yaze_core_lib PRIVATE YAZE_WITH_JSON) + target_compile_definitions(yaze_app_core_lib PRIVATE YAZE_WITH_JSON) # Add proto definitions for test harness, ROM service, and canvas automation - target_add_protobuf(yaze_core_lib + target_add_protobuf(yaze_app_core_lib ${PROJECT_SOURCE_DIR}/src/protos/imgui_test_harness.proto) - target_add_protobuf(yaze_core_lib + target_add_protobuf(yaze_app_core_lib ${PROJECT_SOURCE_DIR}/src/protos/rom_service.proto) - target_add_protobuf(yaze_core_lib + target_add_protobuf(yaze_app_core_lib ${PROJECT_SOURCE_DIR}/src/protos/canvas_automation.proto) - # Add test harness implementation - target_sources(yaze_core_lib PRIVATE - ${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.cc - ${CMAKE_SOURCE_DIR}/src/app/core/service/imgui_test_harness_service.h - ${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.cc - ${CMAKE_SOURCE_DIR}/src/app/core/service/screenshot_utils.h - ${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.cc - ${CMAKE_SOURCE_DIR}/src/app/core/service/widget_discovery_service.h - ${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.cc - ${CMAKE_SOURCE_DIR}/src/app/core/testing/test_recorder.h - ${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.cc - ${CMAKE_SOURCE_DIR}/src/app/core/testing/test_script_parser.h + # Add service and testing implementation (now in app/service/ and app/test/) + target_sources(yaze_app_core_lib PRIVATE + ${CMAKE_SOURCE_DIR}/src/app/service/imgui_test_harness_service.cc + ${CMAKE_SOURCE_DIR}/src/app/service/imgui_test_harness_service.h + ${CMAKE_SOURCE_DIR}/src/app/service/screenshot_utils.cc + ${CMAKE_SOURCE_DIR}/src/app/service/screenshot_utils.h + ${CMAKE_SOURCE_DIR}/src/app/service/widget_discovery_service.cc + ${CMAKE_SOURCE_DIR}/src/app/service/widget_discovery_service.h + ${CMAKE_SOURCE_DIR}/src/app/test/test_recorder.cc + ${CMAKE_SOURCE_DIR}/src/app/test/test_recorder.h + ${CMAKE_SOURCE_DIR}/src/app/test/test_script_parser.cc + ${CMAKE_SOURCE_DIR}/src/app/test/test_script_parser.h # Add unified gRPC server - ${CMAKE_SOURCE_DIR}/src/app/core/service/unified_grpc_server.cc - ${CMAKE_SOURCE_DIR}/src/app/core/service/unified_grpc_server.h + ${CMAKE_SOURCE_DIR}/src/app/service/unified_grpc_server.cc + ${CMAKE_SOURCE_DIR}/src/app/service/unified_grpc_server.h ) - target_link_libraries(yaze_core_lib PUBLIC + target_link_libraries(yaze_app_core_lib PUBLIC grpc++ grpc++_reflection ) if(YAZE_PROTOBUF_TARGETS) - target_link_libraries(yaze_core_lib PUBLIC ${YAZE_PROTOBUF_TARGETS}) + target_link_libraries(yaze_app_core_lib PUBLIC ${YAZE_PROTOBUF_TARGETS}) if(MSVC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS) foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS) - target_link_options(yaze_core_lib PUBLIC /WHOLEARCHIVE:$) + target_link_options(yaze_app_core_lib PUBLIC /WHOLEARCHIVE:$) endforeach() endif() endif() @@ -159,10 +165,10 @@ endif() # Platform-specific libraries if(APPLE) - target_link_libraries(yaze_core_lib PUBLIC ${COCOA_LIBRARY}) + target_link_libraries(yaze_app_core_lib PUBLIC ${COCOA_LIBRARY}) endif() -set_target_properties(yaze_core_lib PROPERTIES +set_target_properties(yaze_app_core_lib PROPERTIES POSITION_INDEPENDENT_CODE ON ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" @@ -170,11 +176,11 @@ set_target_properties(yaze_core_lib PROPERTIES # Platform-specific compile definitions if(UNIX AND NOT APPLE) - target_compile_definitions(yaze_core_lib PRIVATE linux stricmp=strcasecmp) + target_compile_definitions(yaze_app_core_lib PRIVATE linux stricmp=strcasecmp) elseif(APPLE) - target_compile_definitions(yaze_core_lib PRIVATE MACOS) + target_compile_definitions(yaze_app_core_lib PRIVATE MACOS) elseif(WIN32) - target_compile_definitions(yaze_core_lib PRIVATE WINDOWS) + target_compile_definitions(yaze_app_core_lib PRIVATE WINDOWS) endif() -message(STATUS "✓ yaze_core_lib library configured") +message(STATUS "✓ yaze_app_core_lib library configured (application layer)") diff --git a/src/app/editor/agent/agent_chat_widget.cc b/src/app/editor/agent/agent_chat_widget.cc index f7b0120a..b4cf3160 100644 --- a/src/app/editor/agent/agent_chat_widget.cc +++ b/src/app/editor/agent/agent_chat_widget.cc @@ -18,7 +18,7 @@ #include "absl/strings/str_join.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "app/core/project.h" +#include "core/project.h" #include "app/editor/agent/agent_chat_history_codec.h" #include "app/editor/agent/agent_ui_theme.h" #include "app/editor/agent/agent_chat_history_popup.h" @@ -136,7 +136,7 @@ void AgentChatWidget::SetRomContext(Rom* rom) { // Only initialize labels ONCE per ROM instance if (rom && rom->is_loaded() && rom->resource_label() && last_rom_initialized != rom) { - core::YazeProject project; + project::YazeProject project; project.use_embedded_labels = true; auto labels_status = project.InitializeEmbeddedLabels(); @@ -2757,7 +2757,7 @@ void AgentChatWidget::CreateNewFileInEditor(const std::string& filename) { } void AgentChatWidget::LoadAgentSettingsFromProject( - const core::YazeProject& project) { + const project::YazeProject& project) { // Load AI provider settings from project agent_config_.ai_provider = project.agent_settings.ai_provider; agent_config_.ai_model = project.agent_settings.ai_model; @@ -2816,7 +2816,7 @@ void AgentChatWidget::LoadAgentSettingsFromProject( } } -void AgentChatWidget::SaveAgentSettingsToProject(core::YazeProject& project) { +void AgentChatWidget::SaveAgentSettingsToProject(project::YazeProject& project) { // Save AI provider settings to project project.agent_settings.ai_provider = agent_config_.ai_provider; project.agent_settings.ai_model = agent_config_.ai_model; diff --git a/src/app/editor/agent/agent_chat_widget.h b/src/app/editor/agent/agent_chat_widget.h index d925b755..a9094675 100644 --- a/src/app/editor/agent/agent_chat_widget.h +++ b/src/app/editor/agent/agent_chat_widget.h @@ -15,7 +15,7 @@ #include "cli/service/agent/advanced_routing.h" #include "cli/service/agent/agent_pretraining.h" #include "cli/service/agent/prompt_manager.h" -#include "app/core/project.h" +#include "core/project.h" namespace yaze { @@ -254,8 +254,8 @@ public: void UpdateAgentConfig(const AgentConfigState& config); // Load agent settings from project - void LoadAgentSettingsFromProject(const core::YazeProject& project); - void SaveAgentSettingsToProject(core::YazeProject& project); + void LoadAgentSettingsFromProject(const project::YazeProject& project); + void SaveAgentSettingsToProject(project::YazeProject& project); // Collaboration history management (public so EditorManager can call them) void SwitchToSharedHistory(const std::string& session_id); diff --git a/src/app/editor/code/project_file_editor.cc b/src/app/editor/code/project_file_editor.cc index 971d2478..d212012f 100644 --- a/src/app/editor/code/project_file_editor.cc +++ b/src/app/editor/code/project_file_editor.cc @@ -6,6 +6,7 @@ #include "absl/strings/match.h" #include "absl/strings/str_format.h" #include "absl/strings/str_split.h" +#include "core/project.h" #include "util/file_util.h" #include "app/editor/system/toast_manager.h" #include "app/gui/core/icons.h" @@ -170,7 +171,7 @@ absl::Status ProjectFileEditor::SaveFileAs(const std::string& filepath) { modified_ = false; // Add to recent files - auto& recent_mgr = core::RecentFilesManager::GetInstance(); + auto& recent_mgr = project::RecentFilesManager::GetInstance(); recent_mgr.AddFile(filepath_); recent_mgr.Save(); diff --git a/src/app/editor/code/project_file_editor.h b/src/app/editor/code/project_file_editor.h index 640aa63d..d943bf6d 100644 --- a/src/app/editor/code/project_file_editor.h +++ b/src/app/editor/code/project_file_editor.h @@ -4,7 +4,7 @@ #include #include "absl/status/status.h" -#include "app/core/project.h" +#include "core/project.h" #include "app/gui/widgets/text_editor.h" namespace yaze { @@ -20,7 +20,7 @@ class ToastManager; * - Syntax highlighting for INI-style format * - Real-time validation * - Auto-save capability - * - Integration with core::YazeProject + * - Integration with project::YazeProject */ class ProjectFileEditor { public: diff --git a/src/app/editor/dungeon/dungeon_object_selector.cc b/src/app/editor/dungeon/dungeon_object_selector.cc index 078eedab..f24db4f8 100644 --- a/src/app/editor/dungeon/dungeon_object_selector.cc +++ b/src/app/editor/dungeon/dungeon_object_selector.cc @@ -4,7 +4,7 @@ #include #include -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_palette.h" #include "app/gui/canvas/canvas.h" diff --git a/src/app/editor/editor_library.cmake b/src/app/editor/editor_library.cmake index 69fc1c3c..106339b2 100644 --- a/src/app/editor/editor_library.cmake +++ b/src/app/editor/editor_library.cmake @@ -83,7 +83,7 @@ endif() # - System editors (settings, commands, extensions) # - Testing infrastructure # -# Dependencies: yaze_core_lib, yaze_gfx, yaze_gui, yaze_zelda3, ImGui +# Dependencies: yaze_app_core_lib, yaze_gfx, yaze_gui, yaze_zelda3, ImGui # ============================================================================== add_library(yaze_editor STATIC ${YAZE_APP_EDITOR_SRC}) @@ -103,7 +103,7 @@ target_include_directories(yaze_editor PUBLIC ) target_link_libraries(yaze_editor PUBLIC - yaze_core_lib + yaze_app_core_lib yaze_gfx yaze_gui yaze_zelda3 diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index b4cb6b3e..d668ab9a 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -16,9 +16,9 @@ #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include "app/core/features.h" -#include "app/core/project.h" -#include "app/core/timing.h" +#include "core/features.h" +#include "core/project.h" +#include "app/platform/timing.h" #include "app/editor/session_types.h" #include "app/editor/code/assembly_editor.h" #include "app/editor/dungeon/dungeon_editor_v2.h" @@ -65,7 +65,7 @@ #include "app/gfx/debug/performance/performance_dashboard.h" #ifdef YAZE_WITH_GRPC -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #include "app/editor/agent/agent_chat_widget.h" #include "app/test/z3ed_test_suite.h" #include "cli/service/agent/agent_control_server.h" @@ -650,7 +650,7 @@ absl::Status EditorManager::Update() { // Update timing manager for accurate delta time across the application // This fixes animation timing issues that occur when mouse isn't moving - core::TimingManager::Get().Update(); + TimingManager::Get().Update(); // Delegate to PopupManager for modal dialog rendering popup_manager_->DrawPopups(); @@ -1131,7 +1131,7 @@ absl::Status EditorManager::LoadRom() { test::TestManager::Get().SetCurrentRom(GetCurrentRom()); #endif - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); manager.AddFile(file_name); manager.Save(); @@ -1257,7 +1257,7 @@ absl::Status EditorManager::SaveRomAs(const std::string& filename) { sessions_[current_session_idx].filepath = filename; } - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); manager.AddFile(filename); manager.Save(); } @@ -1327,7 +1327,7 @@ absl::Status EditorManager::OpenProject() { return absl::OkStatus(); } - core::YazeProject new_project; + project::YazeProject new_project; RETURN_IF_ERROR(new_project.Open(file_path)); // Validate project @@ -1391,7 +1391,7 @@ absl::Status EditorManager::OpenProject() { ImGui::GetIO().FontGlobalScale = user_settings_.prefs().font_global_scale; // Add to recent files - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); manager.AddFile(current_project_.filepath); manager.Save(); @@ -1422,7 +1422,7 @@ absl::Status EditorManager::SaveProject() { user_settings_.prefs().autosave_interval; // Save recent files - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); current_project_.workspace_settings.recent_files.clear(); for (const auto& file : manager.GetRecentFiles()) { current_project_.workspace_settings.recent_files.push_back(file); @@ -1456,7 +1456,7 @@ absl::Status EditorManager::SaveProjectAs() { auto save_status = current_project_.Save(); if (save_status.ok()) { // Add to recent files - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); manager.AddFile(file_path); manager.Save(); @@ -1474,7 +1474,7 @@ absl::Status EditorManager::SaveProjectAs() { } absl::Status EditorManager::ImportProject(const std::string& project_path) { - core::YazeProject imported_project; + project::YazeProject imported_project; if (project_path.ends_with(".zsproj")) { RETURN_IF_ERROR(imported_project.ImportZScreamProject(project_path)); diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index a5656b5b..fd3318e4 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -16,7 +16,7 @@ #include #include "absl/status/status.h" -#include "app/core/project.h" +#include "core/project.h" #include "app/editor/agent/agent_chat_history_popup.h" #include "app/editor/code/project_file_editor.h" #include "app/editor/system/editor_card_registry.h" @@ -302,7 +302,7 @@ class EditorManager { gfx::IRenderer* renderer_ = nullptr; - core::YazeProject current_project_; + project::YazeProject current_project_; EditorDependencies::SharedClipboard shared_clipboard_; std::unique_ptr popup_manager_; ToastManager toast_manager_; diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index f1fd45f8..c5ce371b 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -8,7 +8,7 @@ #include "absl/strings/str_cat.h" #include "app/gui/core/ui_helpers.h" #include "util/file_util.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/resource/arena.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/util/compression.h" diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 16871520..4662ae49 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -15,7 +15,7 @@ #include "absl/status/status.h" #include "absl/strings/str_format.h" #include "core/asar_wrapper.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/editor/overworld/map_properties.h" #include "app/editor/overworld/entity.h" #include "app/editor/overworld/tile16_editor.h" diff --git a/src/app/editor/overworld/overworld_entity_renderer.cc b/src/app/editor/overworld/overworld_entity_renderer.cc index fe3c71ea..93e1ae81 100644 --- a/src/app/editor/overworld/overworld_entity_renderer.cc +++ b/src/app/editor/overworld/overworld_entity_renderer.cc @@ -1,7 +1,7 @@ #include "overworld_entity_renderer.h" #include "absl/strings/str_format.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/editor/overworld/entity.h" #include "app/gui/canvas/canvas.h" #include "zelda3/common.h" diff --git a/src/app/editor/overworld/scratch_space.cc b/src/app/editor/overworld/scratch_space.cc index 368df2dc..c6f310f0 100644 --- a/src/app/editor/overworld/scratch_space.cc +++ b/src/app/editor/overworld/scratch_space.cc @@ -12,7 +12,7 @@ #include "absl/strings/str_format.h" #include "core/asar_wrapper.h" #include "app/gfx/debug/performance/performance_profiler.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/editor/overworld/entity.h" #include "app/editor/overworld/map_properties.h" #include "app/editor/overworld/tile16_editor.h" diff --git a/src/app/editor/session_types.h b/src/app/editor/session_types.h index 465d280d..3bc2e01e 100644 --- a/src/app/editor/session_types.h +++ b/src/app/editor/session_types.h @@ -1,7 +1,7 @@ #ifndef YAZE_APP_EDITOR_SESSION_TYPES_H_ #define YAZE_APP_EDITOR_SESSION_TYPES_H_ -#include "app/core/features.h" +#include "core/features.h" #include "app/editor/code/assembly_editor.h" #include "app/editor/code/memory_editor.h" #include "app/editor/dungeon/dungeon_editor_v2.h" diff --git a/src/app/editor/system/menu_orchestrator.cc b/src/app/editor/system/menu_orchestrator.cc index fd175930..c83e4b1d 100644 --- a/src/app/editor/system/menu_orchestrator.cc +++ b/src/app/editor/system/menu_orchestrator.cc @@ -1,7 +1,7 @@ #include "menu_orchestrator.h" #include "absl/strings/str_format.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/editor/editor.h" #include "app/editor/editor_manager.h" #include "app/editor/system/editor_registry.h" diff --git a/src/app/editor/system/project_manager.cc b/src/app/editor/system/project_manager.cc index e7cac17d..27c29f41 100644 --- a/src/app/editor/system/project_manager.cc +++ b/src/app/editor/system/project_manager.cc @@ -5,7 +5,7 @@ #include "absl/strings/str_format.h" #include "app/editor/system/toast_manager.h" -#include "app/core/project.h" +#include "core/project.h" namespace yaze { namespace editor { @@ -17,7 +17,7 @@ ProjectManager::ProjectManager(ToastManager* toast_manager) absl::Status ProjectManager::CreateNewProject(const std::string& template_name) { if (template_name.empty()) { // Create default project - current_project_ = core::YazeProject(); + current_project_ = project::YazeProject(); current_project_.name = "New Project"; current_project_.filepath = GenerateProjectFilename("New Project"); @@ -49,7 +49,7 @@ absl::Status ProjectManager::LoadProjectFromFile(const std::string& filename) { // TODO: Implement actual project loading from JSON/YAML // For now, create a basic project structure - current_project_ = core::YazeProject(); + current_project_ = project::YazeProject(); current_project_.filepath = filename; current_project_.name = std::filesystem::path(filename).stem().string(); @@ -223,7 +223,7 @@ absl::Status ProjectManager::CreateFromTemplate(const std::string& template_name // TODO: Implement template-based project creation // This would copy template files and customize them - current_project_ = core::YazeProject(); + current_project_ = project::YazeProject(); current_project_.name = project_name; current_project_.filepath = GenerateProjectFilename(project_name); diff --git a/src/app/editor/system/project_manager.h b/src/app/editor/system/project_manager.h index c5a57ee2..a094c69b 100644 --- a/src/app/editor/system/project_manager.h +++ b/src/app/editor/system/project_manager.h @@ -4,7 +4,7 @@ #include #include "absl/status/status.h" -#include "app/core/project.h" +#include "core/project.h" namespace yaze { namespace editor { @@ -41,8 +41,8 @@ class ProjectManager { absl::Status ValidateProject(); // Project information - core::YazeProject& GetCurrentProject() { return current_project_; } - const core::YazeProject& GetCurrentProject() const { return current_project_; } + project::YazeProject& GetCurrentProject() { return current_project_; } + const project::YazeProject& GetCurrentProject() const { return current_project_; } bool HasActiveProject() const { return !current_project_.filepath.empty(); } std::string GetProjectName() const; std::string GetProjectPath() const; @@ -53,7 +53,7 @@ class ProjectManager { const std::string& project_name); private: - core::YazeProject current_project_; + project::YazeProject current_project_; ToastManager* toast_manager_ = nullptr; // Helper methods diff --git a/src/app/editor/system/shortcut_configurator.cc b/src/app/editor/system/shortcut_configurator.cc index 5afbdae4..b67dbf81 100644 --- a/src/app/editor/system/shortcut_configurator.cc +++ b/src/app/editor/system/shortcut_configurator.cc @@ -12,7 +12,7 @@ #include "app/editor/ui/ui_coordinator.h" #include "app/editor/ui/workspace_manager.h" #include "app/editor/system/popup_manager.h" -#include "app/core/project.h" +#include "core/project.h" namespace yaze::editor { @@ -164,7 +164,7 @@ void ConfigureEditorShortcuts(const ShortcutDependencies& deps, RegisterIfValid(shortcut_manager, "Load Last ROM", {ImGuiMod_Ctrl, ImGuiKey_R}, [editor_manager]() { - auto& recent = core::RecentFilesManager::GetInstance(); + auto& recent = project::RecentFilesManager::GetInstance(); if (!recent.GetRecentFiles().empty() && editor_manager) { editor_manager->OpenRomOrProject( recent.GetRecentFiles().front()); diff --git a/src/app/editor/ui/ui_coordinator.cc b/src/app/editor/ui/ui_coordinator.cc index 119d4a21..7fd648fc 100644 --- a/src/app/editor/ui/ui_coordinator.cc +++ b/src/app/editor/ui/ui_coordinator.cc @@ -7,7 +7,7 @@ #include #include "absl/strings/str_format.h" -#include "app/core/project.h" +#include "core/project.h" #include "app/editor/editor.h" #include "app/editor/editor_manager.h" #include "app/editor/system/editor_registry.h" @@ -706,7 +706,7 @@ void UICoordinator::DrawGlobalSearch() { // Recent Files Tab if (ImGui::BeginTabItem( absl::StrFormat("%s Recent Files", ICON_MD_HISTORY).c_str())) { - auto& manager = core::RecentFilesManager::GetInstance(); + auto& manager = project::RecentFilesManager::GetInstance(); auto recent_files = manager.GetRecentFiles(); if (ImGui::BeginTable("RecentFilesTable", 3, diff --git a/src/app/editor/ui/welcome_screen.cc b/src/app/editor/ui/welcome_screen.cc index 57139aca..e624799c 100644 --- a/src/app/editor/ui/welcome_screen.cc +++ b/src/app/editor/ui/welcome_screen.cc @@ -9,8 +9,8 @@ #include "absl/strings/str_format.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "app/core/project.h" -#include "app/core/timing.h" +#include "core/project.h" +#include "app/platform/timing.h" #include "app/gui/core/icons.h" #include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" @@ -255,7 +255,7 @@ bool WelcomeScreen::Show(bool* p_open) { // Smooth interpolation to target position (faster response) // Use TimingManager for accurate delta time - float lerp_speed = 8.0f * yaze::core::TimingManager::Get().GetDeltaTime(); + float lerp_speed = 8.0f * yaze::TimingManager::Get().GetDeltaTime(); triforce_positions_[i].x += (target_pos.x - triforce_positions_[i].x) * lerp_speed; triforce_positions_[i].y += (target_pos.y - triforce_positions_[i].y) * lerp_speed; @@ -424,7 +424,7 @@ void WelcomeScreen::RefreshRecentProjects() { recent_projects_.clear(); // Use the ProjectManager singleton to get recent files - auto& recent_files = core::RecentFilesManager::GetInstance().GetRecentFiles(); + auto& recent_files = project::RecentFilesManager::GetInstance().GetRecentFiles(); for (const auto& filepath : recent_files) { if (recent_projects_.size() >= kMaxRecentProjects) break; diff --git a/src/app/emu/audio/spc700.cc b/src/app/emu/audio/spc700.cc index 726e952e..9a54bcef 100644 --- a/src/app/emu/audio/spc700.cc +++ b/src/app/emu/audio/spc700.cc @@ -5,7 +5,7 @@ #include #include #include "util/log.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/emu/audio/internal/opcodes.h" #include "app/emu/audio/internal/spc700_accurate_cycles.h" diff --git a/src/app/emu/cpu/cpu.cc b/src/app/emu/cpu/cpu.cc index 3e441bc4..1af1de86 100644 --- a/src/app/emu/cpu/cpu.cc +++ b/src/app/emu/cpu/cpu.cc @@ -7,7 +7,7 @@ #include #include "absl/strings/str_format.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/emu/cpu/internal/opcodes.h" #include "app/emu/debug/disassembly_viewer.h" #include "util/log.h" diff --git a/src/app/emu/emu_library.cmake b/src/app/emu/emu_library.cmake index 7b682b1c..7ae2a6d5 100644 --- a/src/app/emu/emu_library.cmake +++ b/src/app/emu/emu_library.cmake @@ -29,7 +29,7 @@ target_include_directories(yaze_emulator PUBLIC target_link_libraries(yaze_emulator PUBLIC yaze_util yaze_common - yaze_core_lib + yaze_app_core_lib ${ABSL_TARGETS} ${SDL_TARGETS} ) diff --git a/src/app/emu/emulator.cc b/src/app/emu/emulator.cc index 1854d17a..368697ac 100644 --- a/src/app/emu/emulator.cc +++ b/src/app/emu/emulator.cc @@ -5,7 +5,7 @@ #include #include -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/editor/system/editor_card_registry.h" #include "util/log.h" diff --git a/src/app/gui/app/feature_flags_menu.h b/src/app/gui/app/feature_flags_menu.h index d2359046..38305e13 100644 --- a/src/app/gui/app/feature_flags_menu.h +++ b/src/app/gui/app/feature_flags_menu.h @@ -1,7 +1,7 @@ #ifndef YAZE_APP_GUI_FEATURE_FLAGS_MENU_H #define YAZE_APP_GUI_FEATURE_FLAGS_MENU_H -#include "app/core/features.h" +#include "core/features.h" #include "imgui/imgui.h" namespace yaze { diff --git a/src/app/gui/core/background_renderer.cc b/src/app/gui/core/background_renderer.cc index c13640b8..8c948fcf 100644 --- a/src/app/gui/core/background_renderer.cc +++ b/src/app/gui/core/background_renderer.cc @@ -3,7 +3,7 @@ #include #include -#include "app/core/timing.h" +#include "app/platform/timing.h" #include "app/gui/core/theme_manager.h" #include "imgui/imgui.h" @@ -24,7 +24,7 @@ void BackgroundRenderer::RenderDockingBackground(ImDrawList* draw_list, const Im const ImVec2& window_size, const Color& theme_color) { if (!draw_list) return; - UpdateAnimation(core::TimingManager::Get().GetDeltaTime()); + UpdateAnimation(TimingManager::Get().GetDeltaTime()); // Get current theme colors auto& theme_manager = ThemeManager::Get(); diff --git a/src/app/gui/widgets/dungeon_object_emulator_preview.cc b/src/app/gui/widgets/dungeon_object_emulator_preview.cc index 20135bfc..aaf5f891 100644 --- a/src/app/gui/widgets/dungeon_object_emulator_preview.cc +++ b/src/app/gui/widgets/dungeon_object_emulator_preview.cc @@ -4,7 +4,7 @@ #include "zelda3/dungeon/room.h" #include "zelda3/dungeon/room_object.h" #include "app/gui/automation/widget_auto_register.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include namespace yaze { diff --git a/src/app/main.cc b/src/app/main.cc index 56986689..443db9b5 100644 --- a/src/app/main.cc +++ b/src/app/main.cc @@ -5,13 +5,13 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include "absl/debugging/failure_signal_handler.h" #include "absl/debugging/symbolize.h" -#include "app/core/controller.h" -#include "app/core/features.h" +#include "app/controller.h" +#include "core/features.h" #include "util/flag.h" #include "util/log.h" #ifdef YAZE_WITH_GRPC -#include "app/core/service/imgui_test_harness_service.h" +#include "app/service/imgui_test_harness_service.h" #include "app/test/test_manager.h" #endif @@ -129,7 +129,7 @@ int main(int argc, char **argv) { SDL_SetMainReady(); #endif - auto controller = std::make_unique(); + auto controller = std::make_unique(); EXIT_IF_ERROR(controller->OnEntry(rom_filename)) // Set startup editor and cards from flags (after OnEntry initializes editor manager) diff --git a/src/app/platform/app_delegate.mm b/src/app/platform/app_delegate.mm index bba99934..c0be4601 100644 --- a/src/app/platform/app_delegate.mm +++ b/src/app/platform/app_delegate.mm @@ -6,7 +6,7 @@ #endif #import "app/platform/app_delegate.h" -#import "app/core/controller.h" +#import "app/controller.h" #import "util/file_util.h" #import "app/editor/editor.h" #import "app/rom.h" @@ -253,7 +253,7 @@ extern "C" void yaze_initialize_cococa() { extern "C" int yaze_run_cocoa_app_delegate(const char *filename) { yaze_initialize_cococa(); - auto controller = std::make_unique(); + auto controller = std::make_unique(); EXIT_IF_ERROR(controller->OnEntry(filename)); while (controller->IsActive()) { @autoreleasepool { diff --git a/src/app/platform/file_dialog.mm b/src/app/platform/file_dialog.mm index 01e79a95..bf7c7f17 100644 --- a/src/app/platform/file_dialog.mm +++ b/src/app/platform/file_dialog.mm @@ -4,7 +4,7 @@ #include #include -#include "app/core/features.h" +#include "core/features.h" #if defined(YAZE_ENABLE_NFD) && YAZE_ENABLE_NFD #include diff --git a/src/app/core/timing.h b/src/app/platform/timing.h similarity index 98% rename from src/app/core/timing.h rename to src/app/platform/timing.h index 6a0ae3aa..b8889934 100644 --- a/src/app/core/timing.h +++ b/src/app/platform/timing.h @@ -5,7 +5,6 @@ #include namespace yaze { -namespace core { /** * @class TimingManager @@ -112,7 +111,6 @@ class TimingManager { TimingManager& operator=(const TimingManager&) = delete; }; -} // namespace core } // namespace yaze #endif // YAZE_APP_CORE_TIMING_H diff --git a/src/app/platform/view_controller.h b/src/app/platform/view_controller.h index 438454f2..27e76646 100644 --- a/src/app/platform/view_controller.h +++ b/src/app/platform/view_controller.h @@ -7,13 +7,13 @@ #if TARGET_OS_OSX #ifdef __OBJC__ @interface AppViewController : NSViewController -@property(nonatomic) yaze::core::Controller *controller; +@property(nonatomic) yaze::Controller *controller; @end #endif #else #ifdef __OBJC__ @interface AppViewController : UIViewController -@property(nonatomic) yaze::core::Controller *controller; +@property(nonatomic) yaze::Controller *controller; @property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer; @property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer; @property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer; diff --git a/src/app/core/window.cc b/src/app/platform/window.cc similarity index 99% rename from src/app/core/window.cc rename to src/app/platform/window.cc index 8ce9c968..8a349db4 100644 --- a/src/app/core/window.cc +++ b/src/app/platform/window.cc @@ -1,4 +1,4 @@ -#include "app/core/window.h" +#include "app/platform/window.h" #include diff --git a/src/app/core/window.h b/src/app/platform/window.h similarity index 100% rename from src/app/core/window.h rename to src/app/platform/window.h diff --git a/src/app/rom.cc b/src/app/rom.cc index a94ca359..5e1374fd 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -19,7 +19,7 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/gfx/util/compression.h" #include "app/gfx/types/snes_color.h" #include "app/gfx/types/snes_palette.h" diff --git a/src/app/rom.h b/src/app/rom.h index 9b478740..03b1971b 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -19,7 +19,7 @@ #include "absl/status/statusor.h" #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include "app/core/project.h" +#include "core/project.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_color.h" #include "app/gfx/types/snes_palette.h" @@ -220,7 +220,7 @@ class Rom { return palette_groups_.dungeon_main.mutable_palette(i); } - core::ResourceLabelManager* resource_label() { return &resource_label_manager_; } + project::ResourceLabelManager* resource_label() { return &resource_label_manager_; } zelda3_version_pointers version_constants() const { return kVersionConstantsMap.at(version_); } @@ -250,7 +250,7 @@ class Rom { std::vector graphics_buffer_; // Label manager for unique resource names. - core::ResourceLabelManager resource_label_manager_; + project::ResourceLabelManager resource_label_manager_; // All palette groups in the game gfx::PaletteGroupMap palette_groups_; diff --git a/src/app/core/service/canvas_automation_service.cc b/src/app/service/canvas_automation_service.cc similarity index 99% rename from src/app/core/service/canvas_automation_service.cc rename to src/app/service/canvas_automation_service.cc index 02868bda..4f8f26e7 100644 --- a/src/app/core/service/canvas_automation_service.cc +++ b/src/app/service/canvas_automation_service.cc @@ -1,4 +1,4 @@ -#include "app/core/service/canvas_automation_service.h" +#include "app/service/canvas_automation_service.h" #ifdef YAZE_WITH_GRPC diff --git a/src/app/core/service/canvas_automation_service.h b/src/app/service/canvas_automation_service.h similarity index 100% rename from src/app/core/service/canvas_automation_service.h rename to src/app/service/canvas_automation_service.h diff --git a/src/app/core/service/imgui_test_harness_service.cc b/src/app/service/imgui_test_harness_service.cc similarity index 99% rename from src/app/core/service/imgui_test_harness_service.cc rename to src/app/service/imgui_test_harness_service.cc index d6408809..d1ad3fca 100644 --- a/src/app/core/service/imgui_test_harness_service.cc +++ b/src/app/service/imgui_test_harness_service.cc @@ -1,4 +1,4 @@ -#include "app/core/service/imgui_test_harness_service.h" +#include "app/service/imgui_test_harness_service.h" #ifdef YAZE_WITH_GRPC @@ -41,8 +41,8 @@ #include "absl/time/time.h" #include "protos/imgui_test_harness.grpc.pb.h" #include "protos/imgui_test_harness.pb.h" -#include "app/core/service/screenshot_utils.h" -#include "app/core/testing/test_script_parser.h" +#include "app/service/screenshot_utils.h" +#include "app/test/test_script_parser.h" #include "app/test/test_manager.h" #include "yaze.h" // For YAZE_VERSION_STRING diff --git a/src/app/core/service/imgui_test_harness_service.h b/src/app/service/imgui_test_harness_service.h similarity index 98% rename from src/app/core/service/imgui_test_harness_service.h rename to src/app/service/imgui_test_harness_service.h index 0ad11db2..0300b274 100644 --- a/src/app/core/service/imgui_test_harness_service.h +++ b/src/app/service/imgui_test_harness_service.h @@ -8,8 +8,8 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "app/core/service/widget_discovery_service.h" -#include "app/core/testing/test_recorder.h" +#include "app/service/widget_discovery_service.h" +#include "app/test/test_recorder.h" // Undefine Windows macros that conflict with protobuf generated code #ifdef _WIN32 diff --git a/src/app/core/service/screenshot_utils.cc b/src/app/service/screenshot_utils.cc similarity index 99% rename from src/app/core/service/screenshot_utils.cc rename to src/app/service/screenshot_utils.cc index c9bc067f..a14326e0 100644 --- a/src/app/core/service/screenshot_utils.cc +++ b/src/app/service/screenshot_utils.cc @@ -1,4 +1,4 @@ -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #ifdef YAZE_WITH_GRPC diff --git a/src/app/core/service/screenshot_utils.h b/src/app/service/screenshot_utils.h similarity index 100% rename from src/app/core/service/screenshot_utils.h rename to src/app/service/screenshot_utils.h diff --git a/src/app/core/service/unified_grpc_server.cc b/src/app/service/unified_grpc_server.cc similarity index 96% rename from src/app/core/service/unified_grpc_server.cc rename to src/app/service/unified_grpc_server.cc index a7fae2c8..8749ce4c 100644 --- a/src/app/core/service/unified_grpc_server.cc +++ b/src/app/service/unified_grpc_server.cc @@ -1,4 +1,4 @@ -#include "app/core/service/unified_grpc_server.h" +#include "app/service/unified_grpc_server.h" #ifdef YAZE_WITH_GRPC @@ -6,8 +6,8 @@ #include #include "absl/strings/str_format.h" -#include "app/core/service/imgui_test_harness_service.h" -#include "app/core/service/canvas_automation_service.h" +#include "app/service/imgui_test_harness_service.h" +#include "app/service/canvas_automation_service.h" #include "app/net/rom_service_impl.h" #include "app/rom.h" diff --git a/src/app/core/service/unified_grpc_server.h b/src/app/service/unified_grpc_server.h similarity index 100% rename from src/app/core/service/unified_grpc_server.h rename to src/app/service/unified_grpc_server.h diff --git a/src/app/core/service/widget_discovery_service.cc b/src/app/service/widget_discovery_service.cc similarity index 99% rename from src/app/core/service/widget_discovery_service.cc rename to src/app/service/widget_discovery_service.cc index ec9b877e..b9b06877 100644 --- a/src/app/core/service/widget_discovery_service.cc +++ b/src/app/service/widget_discovery_service.cc @@ -1,4 +1,4 @@ -#include "app/core/service/widget_discovery_service.h" +#include "app/service/widget_discovery_service.h" #include #include diff --git a/src/app/core/service/widget_discovery_service.h b/src/app/service/widget_discovery_service.h similarity index 100% rename from src/app/core/service/widget_discovery_service.h rename to src/app/service/widget_discovery_service.h diff --git a/src/app/test/test_manager.cc b/src/app/test/test_manager.cc index 50c20685..692bb895 100644 --- a/src/app/test/test_manager.cc +++ b/src/app/test/test_manager.cc @@ -13,9 +13,9 @@ #include "absl/synchronization/mutex.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #include "app/gui/automation/widget_state_capture.h" -#include "app/core/features.h" +#include "core/features.h" #include "util/file_util.h" #include "app/gfx/resource/arena.h" #include "app/gui/core/icons.h" diff --git a/src/app/core/testing/test_recorder.cc b/src/app/test/test_recorder.cc similarity index 98% rename from src/app/core/testing/test_recorder.cc rename to src/app/test/test_recorder.cc index 062d2f39..c56648ba 100644 --- a/src/app/core/testing/test_recorder.cc +++ b/src/app/test/test_recorder.cc @@ -1,4 +1,4 @@ -#include "app/core/testing/test_recorder.h" +#include "app/test/test_recorder.h" #include @@ -7,7 +7,7 @@ #include "absl/strings/str_format.h" #include "absl/time/clock.h" #include "absl/time/time.h" -#include "app/core/testing/test_script_parser.h" +#include "app/test/test_script_parser.h" #include "app/test/test_manager.h" namespace yaze { diff --git a/src/app/core/testing/test_recorder.h b/src/app/test/test_recorder.h similarity index 100% rename from src/app/core/testing/test_recorder.h rename to src/app/test/test_recorder.h diff --git a/src/app/core/testing/test_script_parser.cc b/src/app/test/test_script_parser.cc similarity index 99% rename from src/app/core/testing/test_script_parser.cc rename to src/app/test/test_script_parser.cc index 2a261833..fb4cbd05 100644 --- a/src/app/core/testing/test_script_parser.cc +++ b/src/app/test/test_script_parser.cc @@ -1,4 +1,4 @@ -#include "app/core/testing/test_script_parser.h" +#include "app/test/test_script_parser.h" #include #include diff --git a/src/app/core/testing/test_script_parser.h b/src/app/test/test_script_parser.h similarity index 100% rename from src/app/core/testing/test_script_parser.h rename to src/app/test/test_script_parser.h diff --git a/src/cli/agent.cmake b/src/cli/agent.cmake index 60959a25..6668fbe6 100644 --- a/src/cli/agent.cmake +++ b/src/cli/agent.cmake @@ -90,7 +90,7 @@ set(_yaze_agent_link_targets yaze_util yaze_gfx yaze_gui - yaze_core_lib + yaze_app_core_lib yaze_zelda3 yaze_emulator ${ABSL_TARGETS} diff --git a/src/cli/handlers/agent/conversation_test.cc b/src/cli/handlers/agent/conversation_test.cc index cde2a982..34b6d3cd 100644 --- a/src/cli/handlers/agent/conversation_test.cc +++ b/src/cli/handlers/agent/conversation_test.cc @@ -1,5 +1,5 @@ #include "app/rom.h" -#include "app/core/project.h" +#include "core/project.h" #include "cli/handlers/rom/mock_rom.h" #include "absl/flags/declare.h" @@ -378,7 +378,7 @@ absl::Status HandleTestConversationCommand( // Load embedded labels for natural language queries std::cout << "🔍 Debug: Initializing embedded labels...\n"; - core::YazeProject project; + project::YazeProject project; auto labels_status = project.InitializeEmbeddedLabels(); if (!labels_status.ok()) { std::cerr << "⚠️ Warning: Could not initialize embedded labels: " diff --git a/src/cli/handlers/agent/general_commands.cc b/src/cli/handlers/agent/general_commands.cc index 13e9998e..a301c959 100644 --- a/src/cli/handlers/agent/general_commands.cc +++ b/src/cli/handlers/agent/general_commands.cc @@ -19,7 +19,7 @@ #include "absl/time/clock.h" #include "absl/time/time.h" #include "absl/strings/string_view.h" -#include "app/core/project.h" +#include "core/project.h" #include "zelda3/dungeon/room.h" #include "cli/handlers/agent/common.h" #include "cli/cli.h" @@ -58,7 +58,7 @@ struct DescribeOptions { // Helper to load project and labels if available absl::Status TryLoadProjectAndLabels(Rom& rom) { // Try to find and load a project file in current directory - core::YazeProject project; + project::YazeProject project; auto project_status = project.Open("."); if (project_status.ok()) { diff --git a/src/cli/handlers/rom/mock_rom.cc b/src/cli/handlers/rom/mock_rom.cc index b678415e..77fd8319 100644 --- a/src/cli/handlers/rom/mock_rom.cc +++ b/src/cli/handlers/rom/mock_rom.cc @@ -5,7 +5,7 @@ #include "absl/flags/declare.h" #include "absl/flags/flag.h" #include "absl/strings/str_format.h" -#include "app/core/project.h" +#include "core/project.h" #include "zelda3/zelda3_labels.h" ABSL_DECLARE_FLAG(bool, mock_rom); @@ -61,7 +61,7 @@ absl::Status InitializeMockRom(Rom& rom) { } // Initialize embedded labels so queries work without actual ROM data - core::YazeProject project; + project::YazeProject project; auto labels_status = project.InitializeEmbeddedLabels(); if (!labels_status.ok()) { return absl::InternalError( diff --git a/src/cli/handlers/rom/project_commands.cc b/src/cli/handlers/rom/project_commands.cc index 8cd91f37..e9ae62ec 100644 --- a/src/cli/handlers/rom/project_commands.cc +++ b/src/cli/handlers/rom/project_commands.cc @@ -1,6 +1,6 @@ #include "cli/handlers/rom/project_commands.h" -#include "app/core/project.h" +#include "core/project.h" #include "util/file_util.h" #include "util/bps.h" #include "util/macro.h" @@ -22,7 +22,7 @@ absl::Status ProjectInitCommandHandler::Execute(Rom* rom, std::string project_name = project_opt.value(); - core::YazeProject project; + project::YazeProject project; auto status = project.Create(project_name, "."); if (!status.ok()) { return status; @@ -38,7 +38,7 @@ absl::Status ProjectInitCommandHandler::Execute(Rom* rom, absl::Status ProjectBuildCommandHandler::Execute(Rom* rom, const resources::ArgumentParser& parser, resources::OutputFormatter& formatter) { - core::YazeProject project; + project::YazeProject project; auto status = project.Open("."); if (!status.ok()) { return status; diff --git a/src/cli/service/agent/emulator_service_impl.cc b/src/cli/service/agent/emulator_service_impl.cc index 767ce435..54c1382a 100644 --- a/src/cli/service/agent/emulator_service_impl.cc +++ b/src/cli/service/agent/emulator_service_impl.cc @@ -1,6 +1,6 @@ #include "cli/service/agent/emulator_service_impl.h" #include "app/emu/emulator.h" -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #include "app/emu/input/input_backend.h" // Required for SnesButton enum #include "app/emu/debug/breakpoint_manager.h" #include "app/emu/debug/watchpoint_manager.h" diff --git a/src/cli/service/ai/ai_gui_controller.cc b/src/cli/service/ai/ai_gui_controller.cc index 2e3ed76a..1807eb4b 100644 --- a/src/cli/service/ai/ai_gui_controller.cc +++ b/src/cli/service/ai/ai_gui_controller.cc @@ -11,7 +11,7 @@ #ifdef YAZE_WITH_GRPC #include "cli/service/gui/gui_automation_client.h" -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #endif namespace yaze { diff --git a/src/cli/service/resources/command_context.cc b/src/cli/service/resources/command_context.cc index 4119f38f..788107b4 100644 --- a/src/cli/service/resources/command_context.cc +++ b/src/cli/service/resources/command_context.cc @@ -9,7 +9,7 @@ #include "absl/strings/numbers.h" #include "absl/strings/str_format.h" #include "absl/strings/str_join.h" -#include "app/core/project.h" +#include "core/project.h" #include "cli/handlers/rom/mock_rom.h" ABSL_DECLARE_FLAG(std::string, rom); @@ -102,7 +102,7 @@ absl::Status CommandContext::EnsureLabelsLoaded(Rom* rom) { if (!rom->resource_label()->labels_loaded_ || rom->resource_label()->labels_.empty()) { - core::YazeProject project; + project::YazeProject project; project.use_embedded_labels = true; auto labels_status = project.InitializeEmbeddedLabels(); if (labels_status.ok()) { diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 00000000..f2475ea6 --- /dev/null +++ b/src/core/CMakeLists.txt @@ -0,0 +1,66 @@ +# ============================================================================== +# YAZE Core Library +# ============================================================================== +# Foundation library for project management and ROM patching logic. +# This library has minimal dependencies and provides application-agnostic +# functionality for managing YAZE projects and applying assembly patches. +# +# Dependencies: yaze_util, yaze_zelda3, asar, absl +# ============================================================================== + +# Core library sources +set(YAZE_CORE_LIB_SOURCES + asar_wrapper.cc + project.cc +) + +# Create the static library +add_library(yaze_core_lib STATIC ${YAZE_CORE_LIB_SOURCES}) + +# Set C++ standard +target_compile_features(yaze_core_lib PUBLIC cxx_std_20) + +# Include directories +target_include_directories(yaze_core_lib PUBLIC + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/app # Needed for app/gui/core/icons.h temporarily + ${CMAKE_SOURCE_DIR}/src/lib/asar/src + ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar + ${CMAKE_SOURCE_DIR}/src/lib/asar/src/asar-dll-bindings/c + ${CMAKE_SOURCE_DIR}/src/lib/imgui # Needed for ImGui in project.cc temporarily + ${CMAKE_SOURCE_DIR}/incl + ${PROJECT_BINARY_DIR} +) + +# Link dependencies - minimal set +target_link_libraries(yaze_core_lib PUBLIC + yaze_util # Logging, file I/O, platform paths + yaze_zelda3 # Zelda3 labels for embedded project labels + asar-static # Assembly patching + ${ABSL_TARGETS} # Abseil for Status/StatusOr + ${CMAKE_DL_LIBS} # Dynamic library loading +) + +# Precompiled headers for faster builds +target_precompile_headers(yaze_core_lib PRIVATE + "$<$:${CMAKE_SOURCE_DIR}/src/yaze_pch.h>" +) + +# Output directory +set_target_properties(yaze_core_lib PROPERTIES + POSITION_INDEPENDENT_CODE ON + ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" +) + +# Platform-specific compile definitions +if(UNIX AND NOT APPLE) + target_compile_definitions(yaze_core_lib PRIVATE linux stricmp=strcasecmp) +elseif(APPLE) + target_compile_definitions(yaze_core_lib PRIVATE MACOS) +elseif(WIN32) + target_compile_definitions(yaze_core_lib PRIVATE WINDOWS) +endif() + +message(STATUS "✓ yaze_core_lib configured (foundational project management)") + diff --git a/src/app/core/features.h b/src/core/features.h similarity index 97% rename from src/app/core/features.h rename to src/core/features.h index 0c4ec020..d8aeb41d 100644 --- a/src/app/core/features.h +++ b/src/core/features.h @@ -1,5 +1,5 @@ -#ifndef YAZE_APP_CORE_FEATURES_H -#define YAZE_APP_CORE_FEATURES_H +#ifndef YAZE_CORE_FEATURES_H +#define YAZE_CORE_FEATURES_H #include @@ -123,4 +123,5 @@ class FeatureFlags { } // namespace core } // namespace yaze -#endif // YAZE_APP_CORE_FEATURES_H \ No newline at end of file +#endif // YAZE_CORE_FEATURES_H + diff --git a/src/app/core/project.cc b/src/core/project.cc similarity index 99% rename from src/app/core/project.cc rename to src/core/project.cc index 7a4978f5..c4e09400 100644 --- a/src/app/core/project.cc +++ b/src/core/project.cc @@ -1,4 +1,4 @@ -#include "project.h" +#include "core/project.h" #include #include @@ -23,7 +23,7 @@ using json = nlohmann::json; #endif namespace yaze { -namespace core { +namespace project { namespace { // Helper functions for parsing key-value pairs @@ -1104,5 +1104,5 @@ void RecentFilesManager::Load() { } } -} // namespace core +} // namespace project } // namespace yaze diff --git a/src/app/core/project.h b/src/core/project.h similarity index 97% rename from src/app/core/project.h rename to src/core/project.h index 99c114b1..71ff247a 100644 --- a/src/app/core/project.h +++ b/src/core/project.h @@ -1,5 +1,5 @@ -#ifndef YAZE_APP_CORE_PROJECT_H -#define YAZE_APP_CORE_PROJECT_H +#ifndef YAZE_CORE_PROJECT_H +#define YAZE_CORE_PROJECT_H #include #include @@ -9,10 +9,10 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "app/core/features.h" +#include "core/features.h" namespace yaze { -namespace core { +namespace project { /** * @enum ProjectFormat @@ -95,7 +95,7 @@ struct YazeProject { std::string symbols_filename; // Consolidated settings (previously scattered across multiple files) - FeatureFlags::Flags feature_flags; + core::FeatureFlags::Flags feature_flags; WorkspaceSettings workspace_settings; std::unordered_map> resource_labels; @@ -287,7 +287,8 @@ class RecentFilesManager { std::vector recent_files_; }; -} // namespace core +} // namespace project } // namespace yaze -#endif // YAZE_APP_CORE_PROJECT_H +#endif // YAZE_CORE_PROJECT_H + diff --git a/src/ios/main.mm b/src/ios/main.mm index c9939c7d..9149f0c2 100644 --- a/src/ios/main.mm +++ b/src/ios/main.mm @@ -31,10 +31,10 @@ #include #include -#include "app/core/controller.h" +#include "app/controller.h" #include "app/platform/app_delegate.h" #include "app/platform/font_loader.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/rom.h" #include @@ -101,7 +101,7 @@ SDL_SetHint(SDL_HINT_IME_SHOW_UI, "1"); // Create and initialize controller with modern API - _controller = new yaze::core::Controller(); + _controller = new yaze::Controller(); auto init_status = _controller->OnEntry(rom_filename); if (!init_status.ok()) { NSLog(@"Failed to initialize controller: %s", init_status.message().data()); diff --git a/src/util/file_util.cc b/src/util/file_util.cc index 945afd7f..1be2b6d1 100644 --- a/src/util/file_util.cc +++ b/src/util/file_util.cc @@ -4,7 +4,7 @@ #include #include -#include "app/core/features.h" +#include "core/features.h" #include "util/platform_paths.h" namespace yaze { diff --git a/src/util/log.h b/src/util/log.h index 8d6f5e99..738cab39 100644 --- a/src/util/log.h +++ b/src/util/log.h @@ -13,7 +13,7 @@ #include "absl/strings/str_format.h" #include "absl/strings/str_cat.h" -#include "app/core/features.h" +#include "core/features.h" #include "absl/strings/string_view.h" namespace yaze { diff --git a/src/zelda3/dungeon/dungeon_editor_system.h b/src/zelda3/dungeon/dungeon_editor_system.h index 334cd848..05f22d22 100644 --- a/src/zelda3/dungeon/dungeon_editor_system.h +++ b/src/zelda3/dungeon/dungeon_editor_system.h @@ -9,7 +9,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/rom.h" diff --git a/src/zelda3/dungeon/dungeon_object_editor.cc b/src/zelda3/dungeon/dungeon_object_editor.cc index cb9c7237..53b62607 100644 --- a/src/zelda3/dungeon/dungeon_object_editor.cc +++ b/src/zelda3/dungeon/dungeon_object_editor.cc @@ -5,7 +5,7 @@ #include #include "absl/strings/str_format.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_palette.h" #include "imgui/imgui.h" diff --git a/src/zelda3/dungeon/dungeon_object_editor.h b/src/zelda3/dungeon/dungeon_object_editor.h index 1e08e18d..06e60119 100644 --- a/src/zelda3/dungeon/dungeon_object_editor.h +++ b/src/zelda3/dungeon/dungeon_object_editor.h @@ -9,7 +9,7 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/types/snes_palette.h" #include "app/rom.h" diff --git a/src/zelda3/overworld/overworld.cc b/src/zelda3/overworld/overworld.cc index 0b75ecad..b43afe27 100644 --- a/src/zelda3/overworld/overworld.cc +++ b/src/zelda3/overworld/overworld.cc @@ -9,7 +9,7 @@ #include #include "absl/status/status.h" -#include "app/core/features.h" +#include "core/features.h" #include "app/gfx/debug/performance/performance_profiler.h" #include "app/gfx/util/compression.h" #include "app/gfx/types/snes_tile.h" diff --git a/src/zelda3/overworld/overworld_map.cc b/src/zelda3/overworld/overworld_map.cc index 2173171e..1ec47e4b 100644 --- a/src/zelda3/overworld/overworld_map.cc +++ b/src/zelda3/overworld/overworld_map.cc @@ -5,7 +5,7 @@ #include #include -#include "app/core/features.h" +#include "core/features.h" #include "app/gfx/types/snes_color.h" #include "app/gfx/types/snes_tile.h" #include "app/rom.h" diff --git a/src/zelda3/screen/dungeon_map.cc b/src/zelda3/screen/dungeon_map.cc index 2bfd4c28..e96d93dd 100644 --- a/src/zelda3/screen/dungeon_map.cc +++ b/src/zelda3/screen/dungeon_map.cc @@ -4,7 +4,7 @@ #include #include "util/file_util.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_tile.h" diff --git a/src/zelda3/screen/inventory.cc b/src/zelda3/screen/inventory.cc index 70ad32a5..6c97a61c 100644 --- a/src/zelda3/screen/inventory.cc +++ b/src/zelda3/screen/inventory.cc @@ -1,7 +1,7 @@ #include "inventory.h" #include "app/gfx/backend/irenderer.h" -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gfx/core/bitmap.h" #include "app/gfx/resource/arena.h" #include "app/gfx/types/snes_tile.h" diff --git a/test/e2e/canvas_selection_test.cc b/test/e2e/canvas_selection_test.cc index a4d370aa..0442a2a6 100644 --- a/test/e2e/canvas_selection_test.cc +++ b/test/e2e/canvas_selection_test.cc @@ -1,12 +1,12 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include "e2e/canvas_selection_test.h" -#include "app/core/controller.h" +#include "app/controller.h" #include "test_utils.h" void E2ETest_CanvasSelectionTest(ImGuiTestContext* ctx) { yaze::test::gui::LoadRomInTest(ctx, "zelda3.sfc"); - yaze::core::Controller* controller = (yaze::core::Controller*)ctx->Test->UserData; + yaze::Controller* controller = (yaze::Controller*)ctx->Test->UserData; yaze::zelda3::Overworld* overworld = controller->overworld(); // 1. Open the Overworld Editor diff --git a/test/e2e/dungeon_editor_smoke_test.cc b/test/e2e/dungeon_editor_smoke_test.cc index 030dea36..25a2437e 100644 --- a/test/e2e/dungeon_editor_smoke_test.cc +++ b/test/e2e/dungeon_editor_smoke_test.cc @@ -1,6 +1,6 @@ #include "e2e/dungeon_editor_smoke_test.h" #include "test_utils.h" -#include "app/core/controller.h" +#include "app/controller.h" #include "imgui_test_engine/imgui_te_context.h" /** diff --git a/test/e2e/dungeon_object_rendering_e2e_tests.cc b/test/e2e/dungeon_object_rendering_e2e_tests.cc index e4eebfa1..3580b59a 100644 --- a/test/e2e/dungeon_object_rendering_e2e_tests.cc +++ b/test/e2e/dungeon_object_rendering_e2e_tests.cc @@ -56,8 +56,8 @@ #include "imgui_test_engine/imgui_te_engine.h" #include "imgui_test_engine/imgui_te_ui.h" -#include "app/core/controller.h" -#include "app/core/window.h" +#include "app/controller.h" +#include "app/platform/window.h" #include "app/editor/dungeon/dungeon_editor_v2.h" #include "app/rom.h" #include "zelda3/dungeon/room.h" diff --git a/test/integration/ai/test_gemini_vision.cc b/test/integration/ai/test_gemini_vision.cc index 8879ad56..d948151f 100644 --- a/test/integration/ai/test_gemini_vision.cc +++ b/test/integration/ai/test_gemini_vision.cc @@ -6,7 +6,7 @@ #include "cli/service/ai/gemini_ai_service.h" #ifdef YAZE_WITH_GRPC -#include "app/core/service/screenshot_utils.h" +#include "app/service/screenshot_utils.h" #endif namespace yaze { diff --git a/test/integration/editor/editor_integration_test.cc b/test/integration/editor/editor_integration_test.cc index 45deab7e..853f6d92 100644 --- a/test/integration/editor/editor_integration_test.cc +++ b/test/integration/editor/editor_integration_test.cc @@ -4,7 +4,7 @@ #include -#include "app/core/window.h" +#include "app/platform/window.h" #include "app/gui/core/style.h" #include "imgui/backends/imgui_impl_sdl2.h" #include "imgui/backends/imgui_impl_sdlrenderer2.h" diff --git a/test/integration/editor/editor_integration_test.h b/test/integration/editor/editor_integration_test.h index 88e1fc3d..4497ce2a 100644 --- a/test/integration/editor/editor_integration_test.h +++ b/test/integration/editor/editor_integration_test.h @@ -6,8 +6,8 @@ #include "imgui/imgui.h" #include "app/editor/editor.h" #include "app/rom.h" -#include "app/core/controller.h" -#include "app/core/window.h" +#include "app/controller.h" +#include "app/platform/window.h" #include "app/gfx/backend/sdl2_renderer.h" #ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE @@ -75,7 +75,7 @@ class EditorIntegrationTest { absl::Status TestEditorClear(editor::Editor* editor); private: - core::Controller controller_; + Controller controller_; #ifdef YAZE_ENABLE_IMGUI_TEST_ENGINE ImGuiTestEngine* engine_; bool show_demo_window_; diff --git a/test/integration/editor/tile16_editor_test.cc b/test/integration/editor/tile16_editor_test.cc index 8e3e810a..a76c5caa 100644 --- a/test/integration/editor/tile16_editor_test.cc +++ b/test/integration/editor/tile16_editor_test.cc @@ -11,7 +11,7 @@ #include "app/gfx/core/bitmap.h" #include "app/gfx/render/tilemap.h" #include "zelda3/overworld/overworld.h" -#include "app/core/window.h" +#include "app/platform/window.h" namespace yaze { namespace editor { diff --git a/test/test_editor.cc b/test/test_editor.cc index 2c426ec3..255b1f2f 100644 --- a/test/test_editor.cc +++ b/test/test_editor.cc @@ -2,8 +2,8 @@ #include -#include "app/core/controller.h" -#include "app/core/window.h" +#include "app/controller.h" +#include "app/platform/window.h" #include "app/gfx/backend/sdl2_renderer.h" #include "app/gui/core/style.h" #include "imgui/backends/imgui_impl_sdl2.h" @@ -55,7 +55,7 @@ void TestEditor::RegisterTests(ImGuiTestEngine* engine) { // TODO: Fix the window/controller management int RunIntegrationTest() { - yaze::core::Controller controller; + yaze::Controller controller; yaze::core::Window window; // Create renderer for test auto test_renderer = std::make_unique(); diff --git a/test/test_utils.cc b/test/test_utils.cc index 77222e08..150bd9e8 100644 --- a/test/test_utils.cc +++ b/test/test_utils.cc @@ -1,12 +1,12 @@ #include "test_utils.h" -#include "app/core/controller.h" +#include "app/controller.h" namespace yaze { namespace test { namespace gui { void LoadRomInTest(ImGuiTestContext* ctx, const std::string& rom_path) { - yaze::core::Controller* controller = (yaze::core::Controller*)ctx->Test->UserData; + yaze::Controller* controller = (yaze::Controller*)ctx->Test->UserData; controller->OnEntry(rom_path); } diff --git a/test/yaze_test.cc b/test/yaze_test.cc index 5c07ee6d..f343a93d 100644 --- a/test/yaze_test.cc +++ b/test/yaze_test.cc @@ -20,8 +20,8 @@ #include "imgui_test_engine/imgui_te_context.h" #include "imgui_test_engine/imgui_te_engine.h" #include "imgui_test_engine/imgui_te_ui.h" -#include "app/core/window.h" -#include "app/core/controller.h" +#include "app/platform/window.h" +#include "app/controller.h" #include "app/gfx/backend/sdl2_renderer.h" #include "e2e/canvas_selection_test.h" #include "e2e/framework_smoke_test.h" @@ -296,7 +296,7 @@ int main(int argc, char* argv[]) { ImGui_ImplSDL2_InitForSDLRenderer(window.window_.get(), sdl_renderer); ImGui_ImplSDLRenderer2_Init(sdl_renderer); - yaze::core::Controller controller; + yaze::Controller controller; // Setup test engine ImGuiTestEngine* engine = ImGuiTestEngine_CreateContext();