From e05e7c35db1035c6f4c8a520438a5b22a2bd812d Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 28 Dec 2024 21:28:51 -0500 Subject: [PATCH] remove app namespace --- incl/overworld.h | 2 +- incl/system/extension.h | 91 ------------- incl/yaze.h | 126 +++++++++++------- src/app/core/common.cc | 3 +- src/app/core/common.h | 5 +- src/app/core/controller.cc | 3 +- src/app/core/controller.h | 3 +- src/app/core/platform/app_delegate.mm | 6 +- src/app/core/platform/clipboard.cc | 2 - src/app/core/platform/clipboard.h | 2 - src/app/core/platform/clipboard.mm | 4 +- src/app/core/platform/file_dialog.cc | 6 +- src/app/core/platform/file_dialog.h | 2 - src/app/core/platform/file_dialog.mm | 20 ++- src/app/core/platform/file_path.h | 2 - src/app/core/platform/file_path.mm | 4 +- src/app/core/platform/font_loader.cc | 2 - src/app/core/platform/font_loader.h | 2 - src/app/core/platform/font_loader.mm | 4 +- src/app/core/platform/renderer.h | 2 - src/app/core/platform/view_controller.h | 2 +- src/app/core/project.cc | 3 +- src/app/core/project.h | 3 +- src/app/core/utils/file_util.cc | 2 - src/app/core/utils/file_util.h | 8 +- src/app/core/utils/sdl_deleter.h | 10 +- src/app/editor/code/assembly_editor.cc | 2 - src/app/editor/code/assembly_editor.h | 2 - src/app/editor/code/memory_editor.h | 2 - src/app/editor/dungeon/dungeon_editor.cc | 65 +++++---- src/app/editor/dungeon/dungeon_editor.h | 2 - src/app/editor/editor.cc | 3 +- src/app/editor/editor.h | 4 +- src/app/editor/editor_manager.cc | 2 - src/app/editor/editor_manager.h | 2 - src/app/editor/graphics/gfx_group_editor.cc | 2 - src/app/editor/graphics/gfx_group_editor.h | 2 - src/app/editor/graphics/graphics_editor.cc | 2 - src/app/editor/graphics/graphics_editor.h | 2 - src/app/editor/graphics/palette_editor.cc | 2 - src/app/editor/graphics/palette_editor.h | 2 - src/app/editor/graphics/screen_editor.cc | 24 +++- src/app/editor/graphics/screen_editor.h | 16 +-- src/app/editor/graphics/tile16_editor.cc | 4 +- src/app/editor/graphics/tile16_editor.h | 2 - src/app/editor/message/message_data.cc | 4 +- src/app/editor/message/message_data.h | 4 +- src/app/editor/message/message_editor.cc | 2 - src/app/editor/message/message_editor.h | 2 - src/app/editor/music/music_editor.cc | 2 - src/app/editor/music/music_editor.h | 2 - src/app/editor/overworld/entity.cc | 2 - src/app/editor/overworld/entity.h | 2 - src/app/editor/overworld/overworld_editor.cc | 2 - src/app/editor/overworld/overworld_editor.h | 2 - src/app/editor/sprite/sprite_editor.cc | 2 - src/app/editor/sprite/sprite_editor.h | 2 - src/app/editor/sprite/zsprite.h | 2 - src/app/editor/system/command_manager.cc | 2 - src/app/editor/system/command_manager.h | 20 ++- src/app/editor/system/constant_manager.h | 2 - src/app/editor/system/extension_manager.cc | 4 +- src/app/editor/system/extension_manager.h | 10 +- src/app/editor/system/flags.h | 2 - src/app/editor/system/history_manager.h | 2 - src/app/editor/system/popup_manager.cc | 3 +- src/app/editor/system/popup_manager.h | 3 +- src/app/editor/system/resource_manager.h | 3 +- src/app/editor/system/settings_editor.cc | 2 - src/app/editor/system/settings_editor.h | 2 - src/app/emu/audio/apu.cc | 3 +- src/app/emu/audio/apu.h | 3 +- src/app/emu/audio/dsp.cc | 3 +- src/app/emu/audio/dsp.h | 3 +- src/app/emu/audio/internal/addressing.cc | 3 +- src/app/emu/audio/internal/instructions.cc | 3 +- src/app/emu/audio/spc700.cc | 3 +- src/app/emu/audio/spc700.h | 3 +- src/app/emu/cpu/clock.h | 3 +- src/app/emu/cpu/cpu.cc | 3 +- src/app/emu/cpu/cpu.h | 3 +- src/app/emu/cpu/internal/addressing.cc | 3 +- src/app/emu/cpu/internal/instructions.cc | 3 +- src/app/emu/emu.cc | 4 +- src/app/emu/emulator.cc | 3 +- src/app/emu/emulator.h | 5 +- src/app/emu/memory/asm_parser.h | 3 +- src/app/emu/memory/dma.cc | 3 +- src/app/emu/memory/dma.h | 3 +- src/app/emu/memory/dma_channel.h | 3 +- src/app/emu/memory/memory.cc | 3 +- src/app/emu/memory/memory.h | 3 +- src/app/emu/snes.cc | 3 +- src/app/emu/snes.h | 3 +- src/app/emu/video/ppu.cc | 3 +- src/app/emu/video/ppu.h | 3 +- src/app/emu/video/ppu_registers.h | 3 +- src/app/gfx/bitmap.cc | 3 +- src/app/gfx/bitmap.h | 5 +- src/app/gfx/compression.cc | 3 +- src/app/gfx/compression.h | 5 +- src/app/gfx/scad_format.cc | 3 +- src/app/gfx/scad_format.h | 5 +- src/app/gfx/snes_color.cc | 3 +- src/app/gfx/snes_color.h | 3 +- src/app/gfx/snes_palette.cc | 5 +- src/app/gfx/snes_palette.h | 7 +- src/app/gfx/snes_tile.cc | 7 +- src/app/gfx/snes_tile.h | 3 +- src/app/gfx/tilesheet.cc | 5 +- src/app/gfx/tilesheet.h | 6 +- src/app/gui/canvas.cc | 3 +- src/app/gui/canvas.h | 9 +- src/app/gui/color.cc | 5 +- src/app/gui/color.h | 5 +- src/app/gui/input.cc | 3 +- src/app/gui/input.h | 3 +- src/app/gui/modules/asset_browser.cc | 3 +- src/app/gui/modules/asset_browser.h | 3 +- src/app/gui/style.cc | 3 +- src/app/gui/style.h | 3 +- src/app/gui/zeml.cc | 3 +- src/app/gui/zeml.h | 5 +- src/app/main.cc | 6 +- src/app/rom.cc | 19 +-- src/app/rom.h | 3 - src/app/zelda3/common.h | 5 +- src/app/zelda3/dungeon/object_names.h | 3 +- src/app/zelda3/dungeon/object_renderer.cc | 3 +- src/app/zelda3/dungeon/object_renderer.h | 3 +- src/app/zelda3/dungeon/room.cc | 3 +- src/app/zelda3/dungeon/room.h | 13 +- src/app/zelda3/dungeon/room_entrance.h | 3 +- src/app/zelda3/dungeon/room_object.cc | 3 +- src/app/zelda3/dungeon/room_object.h | 8 +- src/app/zelda3/dungeon/room_tag.h | 3 +- src/app/zelda3/music/tracker.cc | 3 +- src/app/zelda3/music/tracker.h | 5 +- src/app/zelda3/overworld/overworld.cc | 8 +- src/app/zelda3/overworld/overworld.h | 5 +- src/app/zelda3/overworld/overworld_entrance.h | 3 +- src/app/zelda3/overworld/overworld_exit.h | 3 +- src/app/zelda3/overworld/overworld_item.h | 3 +- src/app/zelda3/overworld/overworld_map.cc | 3 +- src/app/zelda3/overworld/overworld_map.h | 3 +- src/app/zelda3/screen/dungeon_map.cc | 53 ++++++++ src/app/zelda3/screen/dungeon_map.h | 19 ++- src/app/zelda3/screen/inventory.cc | 3 +- src/app/zelda3/screen/inventory.h | 3 +- src/app/zelda3/screen/title_screen.cc | 3 +- src/app/zelda3/screen/title_screen.h | 3 +- src/app/zelda3/sprite/overlord.h | 3 +- src/app/zelda3/sprite/sprite.cc | 3 +- src/app/zelda3/sprite/sprite.h | 3 +- src/app/zelda3/sprite/sprite_builder.cc | 3 +- src/app/zelda3/sprite/sprite_builder.h | 3 +- src/cli/command.h | 6 +- src/cli/handlers/patch.cc | 4 +- src/ios/main.mm | 4 +- src/test/emu/cpu_test.cc | 10 +- src/test/emu/ppu_test.cc | 16 +-- src/test/emu/spc700_test.cc | 6 +- src/test/gfx/compression_test.cc | 32 ++--- src/test/gfx/snes_palette_test.cc | 14 +- src/test/integration/test_editor.cc | 9 +- src/test/integration/test_editor.h | 2 +- src/test/mocks/mock_memory.h | 2 - src/test/rom_test.cc | 20 +-- src/test/yaze_test.cc | 4 +- src/test/zelda3/dungeon_room_test.cc | 17 ++- src/test/zelda3/message_test.cc | 6 +- src/test/zelda3/overworld_test.cc | 10 +- src/test/zelda3/sprite_builder_test.cc | 4 +- src/yaze.cc | 16 +-- 174 files changed, 475 insertions(+), 658 deletions(-) delete mode 100644 incl/system/extension.h create mode 100644 src/app/zelda3/screen/dungeon_map.cc diff --git a/incl/overworld.h b/incl/overworld.h index 086857db..6934e7bd 100644 --- a/incl/overworld.h +++ b/incl/overworld.h @@ -31,7 +31,7 @@ typedef struct z3_overworld_map { * @brief Primitive of the overworld. */ typedef struct z3_overworld { - void *impl; // yaze::app::Overworld* + void *impl; // yaze::Overworld* uint8_t *tile32_data; /**< Pointer to the 32x32 tile data. */ uint8_t *tile16_data; /**< Pointer to the 16x16 tile data. */ diff --git a/incl/system/extension.h b/incl/system/extension.h deleted file mode 100644 index 7c9e2f60..00000000 --- a/incl/system/extension.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef EXTENSION_INTERFACE_H -#define EXTENSION_INTERFACE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "yaze.h" - -typedef void (*yaze_initialize_func)(yaze_editor_context* context); -typedef void (*yaze_cleanup_func)(void); -typedef void (*yaze_extend_ui_func)(yaze_editor_context* context); -typedef void (*yaze_manipulate_rom_func)(z3_rom* rom); -typedef void (*yaze_command_func)(void); -typedef void (*yaze_event_hook_func)(void); - -typedef enum { - YAZE_EVENT_ROM_LOADED, - YAZE_EVENT_ROM_SAVED, - YAZE_EVENT_SPRITE_MODIFIED, - YAZE_EVENT_PALETTE_CHANGED, -} yaze_event_type; - -/** - * @brief Extension interface for Yaze. - * - * @details Yaze extensions can be written in C or Python. - */ -typedef struct yaze_extension { - const char* name; - const char* version; - - /** - * @brief Function to initialize the extension. - * - * @details This function is called when the extension is loaded. It can be - * used to set up any resources or state needed by the extension. - */ - yaze_initialize_func initialize; - - /** - * @brief Function to clean up the extension. - * - * @details This function is called when the extension is unloaded. It can be - * used to clean up any resources or state used by the extension. - */ - yaze_cleanup_func cleanup; - - /** - * @brief Function to manipulate the ROM. - * - * @param rom The ROM to manipulate. - * - */ - yaze_manipulate_rom_func manipulate_rom; - - /** - * @brief Function to extend the UI. - * - * @param context The editor context. - * - * @details This function is called when the extension is loaded. It can be - * used to add custom UI elements to the editor. The context parameter - * provides access to the project, command registry, event dispatcher, and - * ImGui context. - */ - yaze_extend_ui_func extend_ui; - - /** - * @brief Register commands in the yaze_command_registry. - */ - yaze_command_func register_commands; - - /** - * @brief Register custom tools in the yaze_command_registry. - */ - yaze_command_func register_custom_tools; - - /** - * @brief Register event hooks in the yaze_event_dispatcher. - */ - void (*register_event_hooks)(yaze_event_type event, - yaze_event_hook_func hook); - -} yaze_extension; - -#ifdef __cplusplus -} -#endif - -#endif // EXTENSION_INTERFACE_H diff --git a/incl/yaze.h b/incl/yaze.h index a0a9a0a9..68f0ce61 100644 --- a/incl/yaze.h +++ b/incl/yaze.h @@ -19,9 +19,6 @@ typedef struct yaze_project yaze_project; typedef struct yaze_command_registry yaze_command_registry; typedef struct yaze_event_dispatcher yaze_event_dispatcher; -/** - * @brief Extension editor context. - */ typedef struct yaze_editor_context { z3_rom* rom; yaze_project* project; @@ -30,19 +27,10 @@ typedef struct yaze_editor_context { yaze_event_dispatcher* event_dispatcher; } yaze_editor_context; -/** - * @brief Initialize the Yaze library. - */ +void yaze_check_version(const char* version); int yaze_init(yaze_editor_context*); - -/** - * @brief Clean up the Yaze library. - */ void yaze_cleanup(yaze_editor_context*); -/** - * @brief Primitive of a Yaze project. - */ struct yaze_project { const char* name; const char* filepath; @@ -53,29 +41,16 @@ struct yaze_project { yaze_project yaze_load_project(const char* filename); -/** - * @brief Primitive of a Zelda3 ROM. - */ struct z3_rom { const char* filename; const uint8_t* data; size_t size; - void* impl; // yaze::app::Rom* + void* impl; // yaze::Rom* }; -/** - * @brief Load a Zelda3 ROM from a file. - */ z3_rom* yaze_load_rom(const char* filename); - -/** - * @brief Unload a Zelda3 ROM. - */ void yaze_unload_rom(z3_rom* rom); -/** - * @brief Primitive of a Bitmap - */ typedef struct yaze_bitmap { int width; int height; @@ -83,41 +58,98 @@ typedef struct yaze_bitmap { uint8_t* data; } yaze_bitmap; -/** - * @brief Load a bitmap from a file. - */ yaze_bitmap yaze_load_bitmap(const char* filename); -/** - * @brief Get a color from a palette set. - */ snes_color yaze_get_color_from_paletteset(const z3_rom* rom, int palette_set, int palette, int color); -/** - * @brief Load the overworld from a Zelda3 ROM. - */ z3_overworld* yaze_load_overworld(const z3_rom* rom); -/** - * @brief Check the version of the Yaze library. - */ -void yaze_check_version(const char* version); - -/** - * @brief Command registry. - */ struct yaze_command_registry { void (*register_command)(const char* name, void (*command)(void)); }; -/** - * @brief Event dispatcher. - */ struct yaze_event_dispatcher { void (*register_event_hook)(void (*event_hook)(void)); }; +typedef void (*yaze_initialize_func)(yaze_editor_context* context); +typedef void (*yaze_cleanup_func)(void); +typedef void (*yaze_extend_ui_func)(yaze_editor_context* context); +typedef void (*yaze_manipulate_rom_func)(z3_rom* rom); +typedef void (*yaze_command_func)(void); +typedef void (*yaze_event_hook_func)(void); + +typedef enum { + YAZE_EVENT_ROM_LOADED, + YAZE_EVENT_ROM_SAVED, + YAZE_EVENT_SPRITE_MODIFIED, + YAZE_EVENT_PALETTE_CHANGED, +} yaze_event_type; + +/** + * @brief Extension interface for Yaze. + * + * @details Yaze extensions can be written in C or Python. + */ +typedef struct yaze_extension { + const char* name; + const char* version; + + /** + * @brief Function to initialize the extension. + * + * @details This function is called when the extension is loaded. It can be + * used to set up any resources or state needed by the extension. + */ + yaze_initialize_func initialize; + + /** + * @brief Function to clean up the extension. + * + * @details This function is called when the extension is unloaded. It can be + * used to clean up any resources or state used by the extension. + */ + yaze_cleanup_func cleanup; + + /** + * @brief Function to manipulate the ROM. + * + * @param rom The ROM to manipulate. + * + */ + yaze_manipulate_rom_func manipulate_rom; + + /** + * @brief Function to extend the UI. + * + * @param context The editor context. + * + * @details This function is called when the extension is loaded. It can be + * used to add custom UI elements to the editor. The context parameter + * provides access to the project, command registry, event dispatcher, and + * ImGui context. + */ + yaze_extend_ui_func extend_ui; + + /** + * @brief Register commands in the yaze_command_registry. + */ + yaze_command_func register_commands; + + /** + * @brief Register custom tools in the yaze_command_registry. + */ + yaze_command_func register_custom_tools; + + /** + * @brief Register event hooks in the yaze_event_dispatcher. + */ + void (*register_event_hooks)(yaze_event_type event, + yaze_event_hook_func hook); + +} yaze_extension; + #ifdef __cplusplus } #endif diff --git a/src/app/core/common.cc b/src/app/core/common.cc index 4cfe1919..962a4e17 100644 --- a/src/app/core/common.cc +++ b/src/app/core/common.cc @@ -13,7 +13,6 @@ #include "absl/strings/string_view.h" namespace yaze { -namespace app { namespace core { namespace { @@ -329,5 +328,5 @@ absl::StatusOr CheckVersion(const char *version) { } } // namespace core -} // namespace app + } // namespace yaze diff --git a/src/app/core/common.h b/src/app/core/common.h index defe8209..83411e8d 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -12,10 +12,9 @@ #include "absl/container/flat_hash_map.h" namespace yaze { -namespace app { /** - * @namespace yaze::app::core + * @namespace yaze::core * @brief Core application logic and utilities. */ namespace core { @@ -313,7 +312,7 @@ constexpr std::string_view kYazeVersion = "0.2.1"; absl::StatusOr CheckVersion(const char *version); } // namespace core -} // namespace app + } // namespace yaze #endif diff --git a/src/app/core/controller.cc b/src/app/core/controller.cc index 7da81fa3..c2e81b84 100644 --- a/src/app/core/controller.cc +++ b/src/app/core/controller.cc @@ -16,7 +16,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace core { namespace { @@ -278,5 +277,5 @@ absl::Status Controller::LoadConfigFiles() { } } // namespace core -} // namespace app + } // namespace yaze diff --git a/src/app/core/controller.h b/src/app/core/controller.h index 4f3a5d03..d3a4de5e 100644 --- a/src/app/core/controller.h +++ b/src/app/core/controller.h @@ -18,7 +18,6 @@ int main(int argc, char **argv); namespace yaze { -namespace app { namespace core { /** @@ -71,7 +70,7 @@ class Controller : public ExperimentFlags { }; } // namespace core -} // namespace app + } // namespace yaze #endif // YAZE_APP_CORE_CONTROLLER_H diff --git a/src/app/core/platform/app_delegate.mm b/src/app/core/platform/app_delegate.mm index e03dec3c..7c0237ac 100644 --- a/src/app/core/platform/app_delegate.mm +++ b/src/app/core/platform/app_delegate.mm @@ -206,8 +206,8 @@ } - (void)openFileAction:(id)sender { - if (!yaze::app::SharedRom::shared_rom_ - ->LoadFromFile(yaze::app::core::FileDialogWrapper::ShowOpenFileDialog()) + if (!yaze::SharedRom::shared_rom_ + ->LoadFromFile(yaze::core::FileDialogWrapper::ShowOpenFileDialog()) .ok()) { NSAlert *alert = [[NSAlert alloc] init]; [alert setMessageText:@"Error"]; @@ -238,7 +238,7 @@ extern "C" void yaze_initialize_cococa() { extern "C" void yaze_run_cocoa_app_delegate(const char *filename) { yaze_initialize_cococa(); - yaze::app::core::Controller controller; + yaze::core::Controller controller; RETURN_VOID_IF_ERROR(controller.OnEntry(filename)); while (controller.IsActive()) { @autoreleasepool { diff --git a/src/app/core/platform/clipboard.cc b/src/app/core/platform/clipboard.cc index 5607bd0c..99264cb8 100644 --- a/src/app/core/platform/clipboard.cc +++ b/src/app/core/platform/clipboard.cc @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace core { void CopyImageToClipboard(const std::vector& data) {} @@ -12,5 +11,4 @@ void GetImageFromClipboard(std::vector& data, int& width, int& height) {} } // namespace core -} // namespace app } // namespace yaze \ No newline at end of file diff --git a/src/app/core/platform/clipboard.h b/src/app/core/platform/clipboard.h index 325808ba..ab693926 100644 --- a/src/app/core/platform/clipboard.h +++ b/src/app/core/platform/clipboard.h @@ -5,14 +5,12 @@ #include namespace yaze { -namespace app { namespace core { void CopyImageToClipboard(const std::vector &data); void GetImageFromClipboard(std::vector &data, int &width, int &height); } // namespace core -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_PLATFORM_CLIPBOARD_H \ No newline at end of file diff --git a/src/app/core/platform/clipboard.mm b/src/app/core/platform/clipboard.mm index e756b29e..cb0967d8 100644 --- a/src/app/core/platform/clipboard.mm +++ b/src/app/core/platform/clipboard.mm @@ -6,7 +6,7 @@ #ifdef TARGET_OS_MAC #import -void yaze::app::core::CopyImageToClipboard(const std::vector& pngData) { +void yaze::core::CopyImageToClipboard(const std::vector& pngData) { NSData* data = [NSData dataWithBytes:pngData.data() length:pngData.size()]; NSImage* image = [[NSImage alloc] initWithData:data]; @@ -15,7 +15,7 @@ void yaze::app::core::CopyImageToClipboard(const std::vector& pngData) [pasteboard writeObjects:@[ image ]]; } -void yaze::app::core::GetImageFromClipboard(std::vector& pixel_data, int& width, int& height) { +void yaze::core::GetImageFromClipboard(std::vector& pixel_data, int& width, int& height) { NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; NSArray* classArray = [NSArray arrayWithObject:[NSImage class]]; NSDictionary* options = [NSDictionary dictionary]; diff --git a/src/app/core/platform/file_dialog.cc b/src/app/core/platform/file_dialog.cc index 1643d1dd..6b552e71 100644 --- a/src/app/core/platform/file_dialog.cc +++ b/src/app/core/platform/file_dialog.cc @@ -7,12 +7,11 @@ #endif // _WIN32 namespace yaze { -namespace app { namespace core { #ifdef _WIN32 - std::string FileDialogWrapper::ShowOpenFileDialog() { +std::string FileDialogWrapper::ShowOpenFileDialog() { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); IFileDialog *pfd = NULL; @@ -44,7 +43,7 @@ namespace core { return file_path_windows; } - std::string FileDialogWrapper::ShowOpenFolderDialog() { +std::string FileDialogWrapper::ShowOpenFolderDialog() { CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); IFileDialog *pfd = NULL; @@ -141,5 +140,4 @@ std::vector FileDialogWrapper::GetFilesInFolder( #endif } // namespace core -} // namespace app } // namespace yaze \ No newline at end of file diff --git a/src/app/core/platform/file_dialog.h b/src/app/core/platform/file_dialog.h index 6276f86e..3e405aa6 100644 --- a/src/app/core/platform/file_dialog.h +++ b/src/app/core/platform/file_dialog.h @@ -5,7 +5,6 @@ #include namespace yaze { -namespace app { namespace core { class FileDialogWrapper { @@ -28,7 +27,6 @@ class FileDialogWrapper { }; } // namespace core -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_PLATFORM_FILE_DIALOG_H diff --git a/src/app/core/platform/file_dialog.mm b/src/app/core/platform/file_dialog.mm index 8b11a3d6..3709b44f 100644 --- a/src/app/core/platform/file_dialog.mm +++ b/src/app/core/platform/file_dialog.mm @@ -37,20 +37,18 @@ std::string ShowOpenFileDialogSync() { return result; } -} +} // namespace -std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() { - return ShowOpenFileDialogSync(); -} +std::string yaze::core::FileDialogWrapper::ShowOpenFileDialog() { return ShowOpenFileDialogSync(); } -std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() { return ""; } +std::string yaze::core::FileDialogWrapper::ShowOpenFolderDialog() { return ""; } -std::vector yaze::app::core::FileDialogWrapper::GetFilesInFolder( +std::vector yaze::core::FileDialogWrapper::GetFilesInFolder( const std::string &folder) { return {}; } -std::vector yaze::app::core::FileDialogWrapper::GetSubdirectoriesInFolder( +std::vector yaze::core::FileDialogWrapper::GetSubdirectoriesInFolder( const std::string &folder) { return {}; } @@ -60,7 +58,7 @@ std::vector yaze::app::core::FileDialogWrapper::GetSubdirectoriesIn #import -std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() { +std::string yaze::core::FileDialogWrapper::ShowOpenFileDialog() { NSOpenPanel* openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseFiles:YES]; [openPanel setCanChooseDirectories:NO]; @@ -75,7 +73,7 @@ std::string yaze::app::core::FileDialogWrapper::ShowOpenFileDialog() { return ""; } -std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() { +std::string yaze::core::FileDialogWrapper::ShowOpenFolderDialog() { NSOpenPanel* openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseFiles:NO]; [openPanel setCanChooseDirectories:YES]; @@ -90,7 +88,7 @@ std::string yaze::app::core::FileDialogWrapper::ShowOpenFolderDialog() { return ""; } -std::vector yaze::app::core::FileDialogWrapper::GetFilesInFolder( +std::vector yaze::core::FileDialogWrapper::GetFilesInFolder( const std::string& folder) { std::vector filenames; NSFileManager* fileManager = [NSFileManager defaultManager]; @@ -106,7 +104,7 @@ std::vector yaze::app::core::FileDialogWrapper::GetFilesInFolder( return filenames; } -std::vector yaze::app::core::FileDialogWrapper::GetSubdirectoriesInFolder( +std::vector yaze::core::FileDialogWrapper::GetSubdirectoriesInFolder( const std::string& folder) { std::vector subdirectories; NSFileManager* fileManager = [NSFileManager defaultManager]; diff --git a/src/app/core/platform/file_path.h b/src/app/core/platform/file_path.h index c06ef3e3..b5bbf87d 100644 --- a/src/app/core/platform/file_path.h +++ b/src/app/core/platform/file_path.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace core { /** @@ -14,7 +13,6 @@ namespace core { std::string GetBundleResourcePath(); } // namespace core -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_PLATFORM_FILE_PATH_H diff --git a/src/app/core/platform/file_path.mm b/src/app/core/platform/file_path.mm index 617e80cf..0f3dc248 100644 --- a/src/app/core/platform/file_path.mm +++ b/src/app/core/platform/file_path.mm @@ -8,14 +8,14 @@ #include #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1 -std::string yaze::app::core::GetBundleResourcePath() { +std::string yaze::core::GetBundleResourcePath() { NSBundle* bundle = [NSBundle mainBundle]; NSString* resourceDirectoryPath = [bundle bundlePath]; NSString* path = [resourceDirectoryPath stringByAppendingString:@"/"]; return [path UTF8String]; } #elif TARGET_OS_MAC == 1 -std::string yaze::app::core::GetBundleResourcePath() { +std::string yaze::core::GetBundleResourcePath() { NSBundle* bundle = [NSBundle mainBundle]; NSString* resourceDirectoryPath = [bundle bundlePath]; NSString* path = [resourceDirectoryPath stringByAppendingString:@"/"]; diff --git a/src/app/core/platform/font_loader.cc b/src/app/core/platform/font_loader.cc index b892677a..1561e530 100644 --- a/src/app/core/platform/font_loader.cc +++ b/src/app/core/platform/font_loader.cc @@ -13,7 +13,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace core { absl::Status LoadPackageFonts() { @@ -240,5 +239,4 @@ void LoadSystemFonts() { #endif } // namespace core -} // namespace app } // namespace yaze diff --git a/src/app/core/platform/font_loader.h b/src/app/core/platform/font_loader.h index 685dcc2b..bac2cfe5 100644 --- a/src/app/core/platform/font_loader.h +++ b/src/app/core/platform/font_loader.h @@ -4,14 +4,12 @@ #include "absl/status/status.h" namespace yaze { -namespace app { namespace core { void LoadSystemFonts(); absl::Status LoadPackageFonts(); } // namespace core -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_PLATFORM_FONTLOADER_H diff --git a/src/app/core/platform/font_loader.mm b/src/app/core/platform/font_loader.mm index 48e0a258..04e63efc 100644 --- a/src/app/core/platform/font_loader.mm +++ b/src/app/core/platform/font_loader.mm @@ -8,13 +8,13 @@ #if TARGET_OS_IPHONE == 1 || TARGET_IPHONE_SIMULATOR == 1 /* iOS */ -void yaze::app::core::LoadSystemFonts() {} +void yaze::core::LoadSystemFonts() {} #elif TARGET_OS_MAC == 1 /* macOS */ #import -void yaze::app::core::LoadSystemFonts() { +void yaze::core::LoadSystemFonts() { NSArray *fontNames = @[ @"Helvetica", @"Times New Roman", @"Courier", @"Arial", @"Verdana" ]; for (NSString *fontName in fontNames) { diff --git a/src/app/core/platform/renderer.h b/src/app/core/platform/renderer.h index 1f173fa9..c39f3c39 100644 --- a/src/app/core/platform/renderer.h +++ b/src/app/core/platform/renderer.h @@ -11,7 +11,6 @@ #include "app/gfx/bitmap.h" namespace yaze { -namespace app { namespace core { /** @@ -77,7 +76,6 @@ class Renderer { }; } // namespace core -} // namespace app } // namespace yaze #endif diff --git a/src/app/core/platform/view_controller.h b/src/app/core/platform/view_controller.h index 7c4318a3..c83c652c 100644 --- a/src/app/core/platform/view_controller.h +++ b/src/app/core/platform/view_controller.h @@ -10,7 +10,7 @@ @end #else @interface AppViewController : UIViewController -@property(nonatomic) yaze::app::core::Controller *controller; +@property(nonatomic) yaze::core::Controller *controller; @property(nonatomic) UIHoverGestureRecognizer *hoverGestureRecognizer; @property(nonatomic) UIPinchGestureRecognizer *pinchRecognizer; @property(nonatomic) UISwipeGestureRecognizer *swipeRecognizer; diff --git a/src/app/core/project.cc b/src/app/core/project.cc index 98051bf2..9eed5206 100644 --- a/src/app/core/project.cc +++ b/src/app/core/project.cc @@ -9,7 +9,6 @@ #include "imgui/misc/cpp/imgui_stdlib.h" namespace yaze { -namespace app { absl::Status Project::Open(const std::string& project_path) { filepath = project_path; @@ -185,5 +184,5 @@ std::string ResourceLabelManager::CreateOrGetLabel( return labels_[type][key]; } -} // namespace app + } // namespace yaze diff --git a/src/app/core/project.h b/src/app/core/project.h index cfe21019..8d844ee4 100644 --- a/src/app/core/project.h +++ b/src/app/core/project.h @@ -11,7 +11,6 @@ #include "app/core/utils/file_util.h" namespace yaze { -namespace app { const std::string kRecentFilesFilename = "recent_files.txt"; constexpr char kEndOfProjectFile[] = "EndOfProjectFile"; @@ -130,7 +129,7 @@ class RecentFilesManager { std::vector recent_files_; }; -} // namespace app + } // namespace yaze #endif // YAZE_APP_CORE_PROJECT_H diff --git a/src/app/core/utils/file_util.cc b/src/app/core/utils/file_util.cc index 1b332a9a..a4dd0132 100644 --- a/src/app/core/utils/file_util.cc +++ b/src/app/core/utils/file_util.cc @@ -11,7 +11,6 @@ #include namespace yaze { -namespace app { namespace core { std::string GetFileExtension(const std::string &filename) { @@ -70,5 +69,4 @@ std::string GetConfigDirectory(Platform platform) { } } // namespace core -} // namespace app } // namespace yaze diff --git a/src/app/core/utils/file_util.h b/src/app/core/utils/file_util.h index 67dd7ff1..f7977e6a 100644 --- a/src/app/core/utils/file_util.h +++ b/src/app/core/utils/file_util.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace core { enum class Platform { kUnknown, kMacOS, kiOS, kWindows, kLinux }; @@ -17,8 +16,7 @@ std::string GetConfigDirectory(Platform platform); void SaveFile(const std::string &filename, const std::string &data, Platform platform); -} // namespace core -} // namespace app -} // namespace yaze +} // namespace core +} // namespace yaze -#endif // YAZE_APP_CORE_UTILS_FILE_UTIL_H +#endif // YAZE_APP_CORE_UTILS_FILE_UTIL_H diff --git a/src/app/core/utils/sdl_deleter.h b/src/app/core/utils/sdl_deleter.h index 8fd4100d..fb0f7383 100644 --- a/src/app/core/utils/sdl_deleter.h +++ b/src/app/core/utils/sdl_deleter.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace core { /** @@ -19,22 +18,17 @@ struct SDL_Deleter { * @brief Deleter for SDL_Texture. */ struct SDL_Texture_Deleter { - void operator()(SDL_Texture *p) const { - SDL_DestroyTexture(p); - } + void operator()(SDL_Texture *p) const { SDL_DestroyTexture(p); } }; /** * @brief Deleter for SDL_Surface. */ struct SDL_Surface_Deleter { - void operator()(SDL_Surface *p) const { - SDL_FreeSurface(p); - } + void operator()(SDL_Surface *p) const { SDL_FreeSurface(p); } }; } // namespace core -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_UTILS_SDL_DELETER_H_ diff --git a/src/app/editor/code/assembly_editor.cc b/src/app/editor/code/assembly_editor.cc index d833ce05..42374f93 100644 --- a/src/app/editor/code/assembly_editor.cc +++ b/src/app/editor/code/assembly_editor.cc @@ -7,7 +7,6 @@ #include "app/gui/icons.h" namespace yaze { -namespace app { namespace editor { using core::FileDialogWrapper; @@ -364,5 +363,4 @@ absl::Status AssemblyEditor::Redo() { absl::Status AssemblyEditor::Update() { return absl::OkStatus(); } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/code/assembly_editor.h b/src/app/editor/code/assembly_editor.h index 192f9327..29869722 100644 --- a/src/app/editor/code/assembly_editor.h +++ b/src/app/editor/code/assembly_editor.h @@ -9,7 +9,6 @@ #include "app/gui/style.h" namespace yaze { -namespace app { namespace editor { /** @@ -69,7 +68,6 @@ class AssemblyEditor : public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif diff --git a/src/app/editor/code/memory_editor.h b/src/app/editor/code/memory_editor.h index 01ecc981..ea5290bc 100644 --- a/src/app/editor/code/memory_editor.h +++ b/src/app/editor/code/memory_editor.h @@ -28,7 +28,6 @@ #include "imgui_memory_editor.h" namespace yaze { -namespace app { namespace editor { using ImGui::SameLine; @@ -78,7 +77,6 @@ struct MemoryEditorWithDiffChecker : public SharedRom { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_CODE_MEMORY_EDITOR_H diff --git a/src/app/editor/dungeon/dungeon_editor.cc b/src/app/editor/dungeon/dungeon_editor.cc index b6b42d3d..d5e595fe 100644 --- a/src/app/editor/dungeon/dungeon_editor.cc +++ b/src/app/editor/dungeon/dungeon_editor.cc @@ -13,7 +13,6 @@ #include "zelda3/dungeon/room.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -72,6 +71,7 @@ absl::Status DungeonEditor::Update() { absl::Status DungeonEditor::Initialize() { auto dungeon_man_pal_group = rom()->palette_group().dungeon_main; + for (int i = 0; i < 0x100 + 40; i++) { rooms_.emplace_back(zelda3::dungeon::Room(/*room_id=*/i)); rooms_[i].LoadHeader(); @@ -123,7 +123,24 @@ absl::Status DungeonEditor::RefreshGraphics() { current_palette_group_[current_palette_id_], 0)); Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]); } + std::for_each_n(rooms_[current_room_id_].blocks().begin(), 8, + [this](int block) -> absl::Status { + RETURN_IF_ERROR( + graphics_bin_[block].ApplyPaletteWithTransparent( + current_palette_group_[current_palette_id_], 0)); + Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]); + return absl::OkStatus(); + }); + auto sprites_aux1_pal_group = rom()->palette_group().sprites_aux1; + std::for_each_n(rooms_[current_room_id_].blocks().begin() + 8, 8, + [this, &sprites_aux1_pal_group](int block) -> absl::Status { + RETURN_IF_ERROR( + graphics_bin_[block].ApplyPaletteWithTransparent( + sprites_aux1_pal_group[current_palette_id_], 0)); + Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]); + return absl::OkStatus(); + }); for (int i = 9; i < 16; i++) { int block = rooms_[current_room_id_].blocks()[i]; RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent( @@ -135,13 +152,13 @@ absl::Status DungeonEditor::RefreshGraphics() { void DungeonEditor::LoadDungeonRoomSize() { std::map> rooms_by_bank; - for (const auto& room : room_size_addresses_) { + for (const auto &room : room_size_addresses_) { int bank = room.second >> 16; rooms_by_bank[bank].push_back(room.second); } // Process and calculate room sizes within each bank - for (auto& bank_rooms : rooms_by_bank) { + for (auto &bank_rooms : rooms_by_bank) { // Sort the rooms within this bank std::sort(bank_rooms.second.begin(), bank_rooms.second.end()); @@ -151,7 +168,7 @@ void DungeonEditor::LoadDungeonRoomSize() { // Identify the room ID for the current room pointer int room_id = std::find_if(room_size_addresses_.begin(), room_size_addresses_.end(), - [room_ptr](const auto& entry) { + [room_ptr](const auto &entry) { return entry.second == room_ptr; }) ->first; @@ -315,7 +332,7 @@ void DungeonEditor::DrawRoomSelector() { gui::InputHexWord("Room ID", ¤t_room_id_); gui::InputHex("Palette ID", ¤t_palette_id_); - if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)9); + if (ImGuiID child_id = ImGui::GetID((void *)(intptr_t)9); BeginChild(child_id, ImGui::GetContentRegionAvail(), true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) { int i = 0; @@ -421,7 +438,7 @@ void DungeonEditor::DrawDungeonTabView() { // Room is already open next_tab_id++; } - active_rooms_.push_back(next_tab_id++); // Add new tab + active_rooms_.push_back(next_tab_id++); // Add new tab } // Submit our regular tabs @@ -514,7 +531,7 @@ void DungeonEditor::DrawRoomGraphics() { void DungeonEditor::DrawTileSelector() { if (BeginTabBar("##TabBar", ImGuiTabBarFlags_FittingPolicyScroll)) { if (BeginTabItem("Room Graphics")) { - if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)3); + if (ImGuiID child_id = ImGui::GetID((void *)(intptr_t)3); BeginChild(child_id, ImGui::GetContentRegionAvail(), true, ImGuiWindowFlags_AlwaysVerticalScrollbar)) { DrawRoomGraphics(); @@ -577,7 +594,7 @@ void DungeonEditor::DrawObjectRenderer() { if (object_loaded_) { ImGui::Begin("Memory Viewer", &object_loaded_, 0); static MemoryEditor mem_edit; - mem_edit.DrawContents((void*)object_renderer_.mutable_memory(), + mem_edit.DrawContents((void *)object_renderer_.mutable_memory(), object_renderer_.mutable_memory()->size()); ImGui::End(); } @@ -586,7 +603,7 @@ void DungeonEditor::DrawObjectRenderer() { // ============================================================================ void DungeonEditor::CalculateUsageStats() { - for (const auto& room : rooms_) { + for (const auto &room : rooms_) { if (blockset_usage_.find(room.blockset) == blockset_usage_.end()) { blockset_usage_[room.blockset] = 1; } else { @@ -608,15 +625,15 @@ void DungeonEditor::CalculateUsageStats() { } void DungeonEditor::RenderSetUsage( - const absl::flat_hash_map& usage_map, uint16_t& selected_set, + const absl::flat_hash_map &usage_map, uint16_t &selected_set, int spriteset_offset) { // Sort the usage map by set number std::vector> sorted_usage(usage_map.begin(), usage_map.end()); std::sort(sorted_usage.begin(), sorted_usage.end(), - [](const auto& a, const auto& b) { return a.first < b.first; }); + [](const auto &a, const auto &b) { return a.first < b.first; }); - for (const auto& [set, count] : sorted_usage) { + for (const auto &[set, count] : sorted_usage) { std::string display_str; if (spriteset_offset != 0x00) { display_str = absl::StrFormat("%#02x, %#02x: %d", set, @@ -626,7 +643,7 @@ void DungeonEditor::RenderSetUsage( absl::StrFormat("%#02x: %d", (set + spriteset_offset), count); } if (ImGui::Selectable(display_str.c_str(), selected_set == set)) { - selected_set = set; // Update the selected set when clicked + selected_set = set; // Update the selected set when clicked } } } @@ -637,7 +654,7 @@ namespace { // Range for spritesets 0-0x8F // Range for palettes 0-0x47 template -void RenderUnusedSets(const absl::flat_hash_map& usage_map, int max_set, +void RenderUnusedSets(const absl::flat_hash_map &usage_map, int max_set, int spriteset_offset = 0x00) { std::vector unused_sets; for (int i = 0; i < max_set; i++) { @@ -645,7 +662,7 @@ void RenderUnusedSets(const absl::flat_hash_map& usage_map, int max_set, unused_sets.push_back(i); } } - for (const auto& set : unused_sets) { + for (const auto &set : unused_sets) { if (spriteset_offset != 0x00) { Text("%#02x, %#02x", set, (set + spriteset_offset)); } else { @@ -653,7 +670,7 @@ void RenderUnusedSets(const absl::flat_hash_map& usage_map, int max_set, } } } -} // namespace +} // namespace void DungeonEditor::DrawUsageStats() { if (Button("Refresh")) { @@ -744,7 +761,7 @@ void DungeonEditor::DrawUsageGrid() { int totalSquares = 296; int squaresWide = 16; int squaresTall = (totalSquares + squaresWide - 1) / - squaresWide; // Ceiling of totalSquares/squaresWide + squaresWide; // Ceiling of totalSquares/squaresWide for (int row = 0; row < squaresTall; ++row) { ImGui::NewLine(); @@ -755,7 +772,7 @@ void DungeonEditor::DrawUsageGrid() { break; } // Determine if this square should be highlighted - const auto& room = rooms_[row * squaresWide + col]; + const auto &room = rooms_[row * squaresWide + col]; // Create a button or selectable for each square ImGui::BeginGroup(); @@ -765,10 +782,10 @@ void DungeonEditor::DrawUsageGrid() { color.z = color.z / 255; color.w = 1.0f; if (rooms_[row * squaresWide + col].room_size() > 0xFFFF) { - color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); // Or any highlight color + color = ImVec4(1.0f, 0.0f, 0.0f, 1.0f); // Or any highlight color } if (rooms_[row * squaresWide + col].room_size() == 0) { - color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Or any highlight color + color = ImVec4(0.0f, 0.0f, 0.0f, 1.0f); // Or any highlight color } ImGui::PushStyleColor(ImGuiCol_Button, color); // Make the button text darker @@ -782,7 +799,7 @@ void DungeonEditor::DrawUsageGrid() { if (highlight) { ImGui::PushStyleColor( ImGuiCol_Button, - ImVec4(1.0f, 0.5f, 0.0f, 1.0f)); // Or any highlight color + ImVec4(1.0f, 0.5f, 0.0f, 1.0f)); // Or any highlight color } if (Button(absl::StrFormat("%#x", rooms_[row * squaresWide + col].room_size()) @@ -827,6 +844,6 @@ void DungeonEditor::DrawUsageGrid() { } } -} // namespace editor -} // namespace app -} // namespace yaze +} // namespace editor + +} // namespace yaze diff --git a/src/app/editor/dungeon/dungeon_editor.h b/src/app/editor/dungeon/dungeon_editor.h index 4a8aea3d..6675da8d 100644 --- a/src/app/editor/dungeon/dungeon_editor.h +++ b/src/app/editor/dungeon/dungeon_editor.h @@ -14,7 +14,6 @@ #include "zelda3/dungeon/room_object.h" namespace yaze { -namespace app { namespace editor { constexpr ImGuiTabItemFlags kDungeonTabFlags = @@ -143,7 +142,6 @@ class DungeonEditor : public Editor, }; } // namespace editor -} // namespace app } // namespace yaze #endif diff --git a/src/app/editor/editor.cc b/src/app/editor/editor.cc index 44055a1b..649e5f77 100644 --- a/src/app/editor/editor.cc +++ b/src/app/editor/editor.cc @@ -4,7 +4,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { absl::Status DrawEditor(EditorLayoutParams *params) { @@ -48,5 +47,5 @@ absl::Status DrawEditor(EditorLayoutParams *params) { } } // namespace editor -} // namespace app + } // namespace yaze diff --git a/src/app/editor/editor.h b/src/app/editor/editor.h index 685b487b..86e44af9 100644 --- a/src/app/editor/editor.h +++ b/src/app/editor/editor.h @@ -11,10 +11,9 @@ #include "app/editor/system/resource_manager.h" namespace yaze { -namespace app { /** - * @namespace yaze::app::editor + * @namespace yaze::editor * @brief Editors are the view controllers for the application. */ namespace editor { @@ -99,7 +98,6 @@ typedef struct EditorLayoutParams { absl::Status DrawEditor(EditorLayoutParams *params); } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_CORE_EDITOR_H diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index c1e0eb80..403250ea 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -24,7 +24,6 @@ #include "imgui/misc/cpp/imgui_stdlib.h" namespace yaze { -namespace app { namespace editor { using namespace ImGui; @@ -816,5 +815,4 @@ absl::Status EditorManager::OpenProject() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index cdb23019..42f9434e 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -21,7 +21,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace editor { /** @@ -110,7 +109,6 @@ class EditorManager : public SharedRom, public core::ExperimentFlags { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_EDITOR_MANAGER_H diff --git a/src/app/editor/graphics/gfx_group_editor.cc b/src/app/editor/graphics/gfx_group_editor.cc index b3bd3c75..7d984dac 100644 --- a/src/app/editor/graphics/gfx_group_editor.cc +++ b/src/app/editor/graphics/gfx_group_editor.cc @@ -11,7 +11,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using ImGui::BeginChild; @@ -297,5 +296,4 @@ void GfxGroupEditor::DrawPaletteViewer() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/graphics/gfx_group_editor.h b/src/app/editor/graphics/gfx_group_editor.h index 14cd4c0c..56a5c4d7 100644 --- a/src/app/editor/graphics/gfx_group_editor.h +++ b/src/app/editor/graphics/gfx_group_editor.h @@ -7,7 +7,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace editor { /** @@ -43,6 +42,5 @@ class GfxGroupEditor : public SharedRom { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_GFX_GROUP_EDITOR_H diff --git a/src/app/editor/graphics/graphics_editor.cc b/src/app/editor/graphics/graphics_editor.cc index d43a751b..d81ba478 100644 --- a/src/app/editor/graphics/graphics_editor.cc +++ b/src/app/editor/graphics/graphics_editor.cc @@ -23,7 +23,6 @@ #include "imgui_memory_editor.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -844,5 +843,4 @@ absl::Status GraphicsEditor::DecompressSuperDonkey() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/graphics/graphics_editor.h b/src/app/editor/graphics/graphics_editor.h index 2d6d7a52..3171f130 100644 --- a/src/app/editor/graphics/graphics_editor.h +++ b/src/app/editor/graphics/graphics_editor.h @@ -16,7 +16,6 @@ #include "imgui_memory_editor.h" namespace yaze { -namespace app { namespace editor { // "99973","A3D80", @@ -196,7 +195,6 @@ class GraphicsEditor : public SharedRom, public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_GRAPHICS_EDITOR_H diff --git a/src/app/editor/graphics/palette_editor.cc b/src/app/editor/graphics/palette_editor.cc index b62b17e7..5669825c 100644 --- a/src/app/editor/graphics/palette_editor.cc +++ b/src/app/editor/graphics/palette_editor.cc @@ -8,7 +8,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using ImGui::AcceptDragDropPayload; @@ -472,5 +471,4 @@ absl::Status PaletteEditor::ResetColorToOriginal( } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/graphics/palette_editor.h b/src/app/editor/graphics/palette_editor.h index 6f32df6c..775b033a 100644 --- a/src/app/editor/graphics/palette_editor.h +++ b/src/app/editor/graphics/palette_editor.h @@ -14,7 +14,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { namespace palette_internal { @@ -120,7 +119,6 @@ class PaletteEditor : public SharedRom, public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif diff --git a/src/app/editor/graphics/screen_editor.cc b/src/app/editor/graphics/screen_editor.cc index a8c55329..0ba2ca3d 100644 --- a/src/app/editor/graphics/screen_editor.cc +++ b/src/app/editor/graphics/screen_editor.cc @@ -18,7 +18,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -392,6 +391,22 @@ void ScreenEditor::DrawDungeonMapsEditor() { sheets_.emplace(1, rom()->gfx_sheets()[213]); sheets_.emplace(2, rom()->gfx_sheets()[214]); sheets_.emplace(3, rom()->gfx_sheets()[215]); + int current_tile8 = 0; + int tile_data_offset = 0; + for (int i = 0; i < 4; ++i) { + for (int j = 0; j < 32; j++) { + std::vector tile_data(64, 0); // 8x8 tile (64 bytes + int tile_index = current_tile8 + j; + int x = (j % 8) * 8; + int y = (j / 8) * 8; + sheets_[i].Get8x8Tile(tile_index, 0, 0, tile_data, tile_data_offset); + tile8_individual_.emplace_back(gfx::Bitmap(8, 8, 4, tile_data)); + RETURN_VOID_IF_ERROR(tile8_individual_.back().ApplyPalette( + *rom()->mutable_dungeon_palette(3))); + Renderer::GetInstance().RenderBitmap(&tile8_individual_.back()); + } + tile_data_offset = 0; + } dungeon_maps_loaded_ = true; } else { ImGui::Text("Failed to load dungeon map tile16"); @@ -470,8 +485,12 @@ void ScreenEditor::DrawDungeonMapsEditor() { } ImGui::Separator(); - current_tile_canvas_.DrawBackground(ImVec2(64 * 2 + 2, 64 * 2 + 4)); + current_tile_canvas_.DrawBackground(); // ImVec2(64 * 2 + 2, 64 * 2 + 4)); current_tile_canvas_.DrawContextMenu(); + if (current_tile_canvas_.DrawTilePainter( + tile8_individual_[selected_tile8_], 16)) { + // Modify the tile16 based on the selected tile and current_tile16_info + } current_tile_canvas_.DrawBitmap(tile16_individual_[selected_tile16_], 2, 4.0f); current_tile_canvas_.DrawGrid(16.f); @@ -589,5 +608,4 @@ void ScreenEditor::DrawToolset() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/graphics/screen_editor.h b/src/app/editor/graphics/screen_editor.h index 324c9a6b..2299aec9 100644 --- a/src/app/editor/graphics/screen_editor.h +++ b/src/app/editor/graphics/screen_editor.h @@ -15,7 +15,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { /** @@ -86,12 +85,13 @@ private: bool copy_button_pressed = false; bool paste_button_pressed = false; - std::vector all_gfx_; + std::array current_tile16_data_; std::unordered_map tile16_individual_; + std::vector tile8_individual_; + std::vector all_gfx_; + std::vector gfx_bin_data_; std::vector dungeon_maps_; std::vector>> dungeon_map_labels_; - std::array current_tile16_data_; - std::vector gfx_bin_data_; absl::Status status_; @@ -100,18 +100,18 @@ private: gfx::Tilesheet tile16_sheet_; gfx::InternalTile16 current_tile16_info; - gui::Canvas current_tile_canvas_{"##CurrentTileCanvas"}; + gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32), + gui::CanvasGridSize::k16x16, 2.0f}; gui::Canvas screen_canvas_; gui::Canvas tilesheet_canvas_; - gui::Canvas tilemap_canvas_{"##TilemapCanvas", - ImVec2(128 + 2, (192) + 4), + gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4), gui::CanvasGridSize::k8x8, 2.f}; zelda3::screen::Inventory inventory_; }; } // namespace editor -} // namespace app + } // namespace yaze #endif diff --git a/src/app/editor/graphics/tile16_editor.cc b/src/app/editor/graphics/tile16_editor.cc index 4b25faf0..71ec7e57 100644 --- a/src/app/editor/graphics/tile16_editor.cc +++ b/src/app/editor/graphics/tile16_editor.cc @@ -21,7 +21,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -251,7 +250,7 @@ absl::Status Tile16Editor::DrawTileEditControls() { gui::InputHexByte("Palette", ¬ify_palette.mutable_get()); notify_palette.apply_changes(); if (notify_palette.modified()) { - auto palette = palettesets_[current_palette_].main; + auto palette = palettesets_[current_palette_].main_; auto value = notify_palette.get(); if (notify_palette.get() > 0x04 && notify_palette.get() < 0x06) { palette = palettesets_[current_palette_].aux1; @@ -400,5 +399,4 @@ absl::Status Tile16Editor::UpdateTransferTileCanvas() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/graphics/tile16_editor.h b/src/app/editor/graphics/tile16_editor.h index 9889ec61..083ad2a2 100644 --- a/src/app/editor/graphics/tile16_editor.h +++ b/src/app/editor/graphics/tile16_editor.h @@ -13,7 +13,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { /** @@ -100,6 +99,5 @@ class Tile16Editor : public GfxContext, public SharedRom { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_TILE16EDITOR_H diff --git a/src/app/editor/message/message_data.cc b/src/app/editor/message/message_data.cc index 4e00286d..a3931912 100644 --- a/src/app/editor/message/message_data.cc +++ b/src/app/editor/message/message_data.cc @@ -3,7 +3,6 @@ #include "app/core/common.h" namespace yaze { -namespace app { namespace editor { uint8_t FindMatchingCharacter(char value) { @@ -145,7 +144,7 @@ std::vector ParseMessageToData(std::string str) { return bytes; } -std::vector BuildDictionaryEntries(app::Rom* rom) { +std::vector BuildDictionaryEntries(Rom* rom) { std::vector AllDictionaries; for (int i = 0; i < kNumDictionaryEntries; i++) { std::vector bytes; @@ -178,5 +177,4 @@ std::vector BuildDictionaryEntries(app::Rom* rom) { } } // namespace editor -} // namespace app } // namespace yaze \ No newline at end of file diff --git a/src/app/editor/message/message_data.h b/src/app/editor/message/message_data.h index 4934d057..d8bf05f0 100644 --- a/src/app/editor/message/message_data.h +++ b/src/app/editor/message/message_data.h @@ -11,7 +11,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace editor { const uint8_t kMessageTerminator = 0x7F; @@ -78,7 +77,7 @@ constexpr int kTextDataEnd = 0xE7FFF; constexpr int kNumDictionaryEntries = 97; constexpr int kPointersDictionaries = 0x74703; -std::vector BuildDictionaryEntries(app::Rom* rom); +std::vector BuildDictionaryEntries(Rom* rom); std::string ReplaceAllDictionaryWords(std::string str, std::vector dictionary); @@ -278,7 +277,6 @@ ParsedElement FindMatchingElement(const std::string& str); std::string ParseTextDataByte(uint8_t value); } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_MESSAGE_MESSAGE_DATA_H diff --git a/src/app/editor/message/message_editor.cc b/src/app/editor/message/message_editor.cc index 72001bef..80b44ee0 100644 --- a/src/app/editor/message/message_editor.cc +++ b/src/app/editor/message/message_editor.cc @@ -18,7 +18,6 @@ #include "imgui/misc/cpp/imgui_stdlib.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -700,5 +699,4 @@ void MessageEditor::SelectAll() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/message/message_editor.h b/src/app/editor/message/message_editor.h index b75e471b..93c8c294 100644 --- a/src/app/editor/message/message_editor.h +++ b/src/app/editor/message/message_editor.h @@ -12,7 +12,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace editor { constexpr int kGfxFont = 0x70000; // 2bpp format @@ -163,7 +162,6 @@ class MessageEditor : public Editor, public SharedRom { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_MESSAGE_EDITOR_H diff --git a/src/app/editor/music/music_editor.cc b/src/app/editor/music/music_editor.cc index 47001c94..f78aeefd 100644 --- a/src/app/editor/music/music_editor.cc +++ b/src/app/editor/music/music_editor.cc @@ -9,7 +9,6 @@ #include "app/gui/input.h" namespace yaze { -namespace app { namespace editor { absl::Status MusicEditor::Update() { @@ -218,5 +217,4 @@ void MusicEditor::DrawToolset() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/music/music_editor.h b/src/app/editor/music/music_editor.h index b82af24a..d1ee9260 100644 --- a/src/app/editor/music/music_editor.h +++ b/src/app/editor/music/music_editor.h @@ -12,7 +12,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { static const char* kGameSongs[] = {"Title", @@ -85,7 +84,6 @@ class MusicEditor : public SharedRom, public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif diff --git a/src/app/editor/overworld/entity.cc b/src/app/editor/overworld/entity.cc index 785a9012..43d7af7d 100644 --- a/src/app/editor/overworld/entity.cc +++ b/src/app/editor/overworld/entity.cc @@ -5,7 +5,6 @@ #include "app/gui/style.h" namespace yaze { -namespace app { namespace editor { using ImGui::BeginChild; @@ -489,5 +488,4 @@ bool DrawSpriteEditorPopup(zelda3::Sprite &sprite) { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/overworld/entity.h b/src/app/editor/overworld/entity.h index 7a2904a3..2bb5eeb4 100644 --- a/src/app/editor/overworld/entity.h +++ b/src/app/editor/overworld/entity.h @@ -7,7 +7,6 @@ #include "app/zelda3/overworld/overworld.h" namespace yaze { -namespace app { namespace editor { bool IsMouseHoveringOverEntity(const zelda3::GameEntity &entity, @@ -81,7 +80,6 @@ void DrawSpriteInserterPopup(); bool DrawSpriteEditorPopup(zelda3::Sprite &sprite); } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_OVERWORLD_ENTITY_H diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index fdc7a64e..493de8e3 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -24,7 +24,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using core::Renderer; @@ -1530,5 +1529,4 @@ void OverworldEditor::InitializeZeml() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/overworld/overworld_editor.h b/src/app/editor/overworld/overworld_editor.h index a101fbb9..2c24caa2 100644 --- a/src/app/editor/overworld/overworld_editor.h +++ b/src/app/editor/overworld/overworld_editor.h @@ -15,7 +15,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { constexpr uint k4BPP = 4; @@ -309,7 +308,6 @@ class OverworldEditor : public Editor, absl::Status status_; }; } // namespace editor -} // namespace app } // namespace yaze #endif diff --git a/src/app/editor/sprite/sprite_editor.cc b/src/app/editor/sprite/sprite_editor.cc index 5c0cd211..32b414bd 100644 --- a/src/app/editor/sprite/sprite_editor.cc +++ b/src/app/editor/sprite/sprite_editor.cc @@ -7,7 +7,6 @@ #include "app/zelda3/sprite/sprite.h" namespace yaze { -namespace app { namespace editor { using ImGui::BeginTable; @@ -275,5 +274,4 @@ void SpriteEditor::DrawCustomSpritesMetadata() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/sprite/sprite_editor.h b/src/app/editor/sprite/sprite_editor.h index 2504a62f..6a01bf71 100644 --- a/src/app/editor/sprite/sprite_editor.h +++ b/src/app/editor/sprite/sprite_editor.h @@ -8,7 +8,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace editor { constexpr ImGuiTabItemFlags kSpriteTabFlags = @@ -111,7 +110,6 @@ class SpriteEditor : public SharedRom, public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_SPRITE_EDITOR_H \ No newline at end of file diff --git a/src/app/editor/sprite/zsprite.h b/src/app/editor/sprite/zsprite.h index 5cedb73a..ac8494b5 100644 --- a/src/app/editor/sprite/zsprite.h +++ b/src/app/editor/sprite/zsprite.h @@ -13,7 +13,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { /** * @brief Namespace for the ZSprite format from Zarby's ZSpriteMaker. @@ -390,7 +389,6 @@ struct ZSprite { } // namespace zsprite } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_SPRITE_ZSPRITE_H diff --git a/src/app/editor/system/command_manager.cc b/src/app/editor/system/command_manager.cc index bcb3995c..99047c15 100644 --- a/src/app/editor/system/command_manager.cc +++ b/src/app/editor/system/command_manager.cc @@ -5,7 +5,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { ImGuiKey MapKeyToImGuiKey(char key) { @@ -139,5 +138,4 @@ void CommandManager::LoadKeybindings(const std::string &filepath) { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/system/command_manager.h b/src/app/editor/system/command_manager.h index c6dd7036..9787b35a 100644 --- a/src/app/editor/system/command_manager.h +++ b/src/app/editor/system/command_manager.h @@ -7,17 +7,15 @@ #include "imgui/imgui.h" -namespace yaze { -namespace app { -namespace editor { +namespace yaze {namespace editor { ImGuiKey MapKeyToImGuiKey(char key); class CommandManager { -public: + public: CommandManager() = default; ~CommandManager() = default; - + using Command = std::function; struct CommandInfo { @@ -27,7 +25,9 @@ public: std::string desc; CommandInfo(Command command, char mnemonic, const std::string &name, const std::string &desc) - : command(std::move(command)), mnemonic(mnemonic), name(name), + : command(std::move(command)), + mnemonic(mnemonic), + name(name), desc(desc) {} CommandInfo() = default; }; @@ -72,12 +72,10 @@ public: void SaveKeybindings(const std::string &filepath); void LoadKeybindings(const std::string &filepath); -private: + private: std::unordered_map commands_; }; -} // namespace editor -} // namespace app -} // namespace yaze +} // namespace editor} // namespace yaze -#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H +#endif // YAZE_APP_EDITOR_SYSTEM_COMMAND_MANAGER_H diff --git a/src/app/editor/system/constant_manager.h b/src/app/editor/system/constant_manager.h index 4909e4a7..4b3498d8 100644 --- a/src/app/editor/system/constant_manager.h +++ b/src/app/editor/system/constant_manager.h @@ -7,7 +7,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { class ConstantManager { @@ -71,7 +70,6 @@ class ConstantManager { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_SYSTEM_CONSTANT_MANAGER_H diff --git a/src/app/editor/system/extension_manager.cc b/src/app/editor/system/extension_manager.cc index 12e8bc67..e0e42407 100644 --- a/src/app/editor/system/extension_manager.cc +++ b/src/app/editor/system/extension_manager.cc @@ -5,13 +5,12 @@ #include #endif -#include +#include #include #include namespace yaze { -namespace app { namespace editor { void ExtensionManager::LoadExtension(const std::string& filename, @@ -81,5 +80,4 @@ void ExtensionManager::ExecuteExtensionUI(yaze_editor_context* context) { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/system/extension_manager.h b/src/app/editor/system/extension_manager.h index eb471e92..7de341e2 100644 --- a/src/app/editor/system/extension_manager.h +++ b/src/app/editor/system/extension_manager.h @@ -1,14 +1,12 @@ #ifndef YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H #define YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H -#include +#include #include #include -namespace yaze { -namespace app { -namespace editor { +namespace yaze {namespace editor { class ExtensionManager { public: @@ -22,8 +20,6 @@ class ExtensionManager { std::vector extensions_; }; -} // namespace editor -} // namespace app -} // namespace yaze +} // namespace editor} // namespace yaze #endif // YAZE_APP_EDITOR_SYSTEM_EXTENSION_MANAGER_H diff --git a/src/app/editor/system/flags.h b/src/app/editor/system/flags.h index 1b0035d2..dc6ea6f4 100644 --- a/src/app/editor/system/flags.h +++ b/src/app/editor/system/flags.h @@ -5,7 +5,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using ImGui::BeginMenu; @@ -58,7 +57,6 @@ struct FlagsMenu : public core::ExperimentFlags { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_UTILS_FLAGS_H_ diff --git a/src/app/editor/system/history_manager.h b/src/app/editor/system/history_manager.h index f059e6e8..fa7a87a4 100644 --- a/src/app/editor/system/history_manager.h +++ b/src/app/editor/system/history_manager.h @@ -6,7 +6,6 @@ #include namespace yaze { -namespace app { namespace editor { // System history manager, undo and redo. @@ -26,7 +25,6 @@ class HistoryManager { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_SYSTEM_HISTORY_MANAGER_H diff --git a/src/app/editor/system/popup_manager.cc b/src/app/editor/system/popup_manager.cc index fb5b3538..1667e86b 100644 --- a/src/app/editor/system/popup_manager.cc +++ b/src/app/editor/system/popup_manager.cc @@ -3,7 +3,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { PopupManager::PopupManager() { @@ -15,5 +14,5 @@ PopupManager::~PopupManager() { } // namespace editor -} // namespace app + } // namespace yaze diff --git a/src/app/editor/system/popup_manager.h b/src/app/editor/system/popup_manager.h index 056cc8c7..2e296ea9 100644 --- a/src/app/editor/system/popup_manager.h +++ b/src/app/editor/system/popup_manager.h @@ -2,7 +2,6 @@ #define YAZE_APP_EDITOR_POPUP_MANAGER_H namespace yaze { -namespace app { namespace editor { // ImGui popup manager. @@ -15,7 +14,7 @@ class PopupManager { }; } // namespace editor -} // namespace app + } // namespace yaze #endif // YAZE_APP_EDITOR_POPUP_MANAGER_H diff --git a/src/app/editor/system/resource_manager.h b/src/app/editor/system/resource_manager.h index 116ef9e4..75702160 100644 --- a/src/app/editor/system/resource_manager.h +++ b/src/app/editor/system/resource_manager.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace editor { // System resource manager. @@ -24,7 +23,7 @@ class ResourceManager { }; } // namespace editor -} // namespace app + } // namespace yaze #endif // YAZE_APP_EDITOR_SYSTEM_RESOURCE_MANAGER_H diff --git a/src/app/editor/system/settings_editor.cc b/src/app/editor/system/settings_editor.cc index 2be90b39..89157d72 100644 --- a/src/app/editor/system/settings_editor.cc +++ b/src/app/editor/system/settings_editor.cc @@ -6,7 +6,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace editor { using ImGui::BeginChild; @@ -79,5 +78,4 @@ absl::Status SettingsEditor::DrawKeyboardShortcuts() { } } // namespace editor -} // namespace app } // namespace yaze diff --git a/src/app/editor/system/settings_editor.h b/src/app/editor/system/settings_editor.h index 3c2c0a07..ca13e09f 100644 --- a/src/app/editor/system/settings_editor.h +++ b/src/app/editor/system/settings_editor.h @@ -7,7 +7,6 @@ #include "app/editor/editor.h" namespace yaze { -namespace app { namespace editor { // Simple representation for a tree @@ -226,7 +225,6 @@ class SettingsEditor : public Editor { }; } // namespace editor -} // namespace app } // namespace yaze #endif // YAZE_APP_EDITOR_SETTINGS_EDITOR_H_ diff --git a/src/app/emu/audio/apu.cc b/src/app/emu/audio/apu.cc index 080fa422..b8adb0ff 100644 --- a/src/app/emu/audio/apu.cc +++ b/src/app/emu/audio/apu.cc @@ -13,7 +13,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -203,5 +202,5 @@ void Apu::SpcIdle(bool waiting) { Cycle(); } } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/audio/apu.h b/src/app/emu/audio/apu.h index b52c6ada..35260e0a 100644 --- a/src/app/emu/audio/apu.h +++ b/src/app/emu/audio/apu.h @@ -11,7 +11,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -95,7 +94,7 @@ class Apu { } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze #endif \ No newline at end of file diff --git a/src/app/emu/audio/dsp.cc b/src/app/emu/audio/dsp.cc index 2bef50d5..610ddb21 100644 --- a/src/app/emu/audio/dsp.cc +++ b/src/app/emu/audio/dsp.cc @@ -5,7 +5,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -633,5 +632,5 @@ void Dsp::GetSamples(int16_t* sample_data, int samples_per_frame, } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/audio/dsp.h b/src/app/emu/audio/dsp.h index 762692c9..93071b9b 100644 --- a/src/app/emu/audio/dsp.h +++ b/src/app/emu/audio/dsp.h @@ -9,7 +9,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -157,7 +156,7 @@ class Dsp { } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_AUDIO_S_DSP_H \ No newline at end of file diff --git a/src/app/emu/audio/internal/addressing.cc b/src/app/emu/audio/internal/addressing.cc index 447d3fd6..8c3154ef 100644 --- a/src/app/emu/audio/internal/addressing.cc +++ b/src/app/emu/audio/internal/addressing.cc @@ -1,7 +1,6 @@ #include "app/emu/audio/spc700.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -148,5 +147,5 @@ uint16_t Spc700::addr_plus_i_indexed() { } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/audio/internal/instructions.cc b/src/app/emu/audio/internal/instructions.cc index ee207e9e..e358ea2a 100644 --- a/src/app/emu/audio/internal/instructions.cc +++ b/src/app/emu/audio/internal/instructions.cc @@ -1,7 +1,6 @@ #include "app/emu/audio/spc700.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -483,5 +482,5 @@ void Spc700::STOP() {} } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/audio/spc700.cc b/src/app/emu/audio/spc700.cc index c2626305..38bd67e3 100644 --- a/src/app/emu/audio/spc700.cc +++ b/src/app/emu/audio/spc700.cc @@ -9,7 +9,6 @@ #include "app/emu/audio/internal/opcodes.h" namespace yaze { -namespace app { namespace emu { namespace audio { @@ -1326,5 +1325,5 @@ void Spc700::LogInstruction(uint16_t initial_pc, uint8_t opcode) { } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze diff --git a/src/app/emu/audio/spc700.h b/src/app/emu/audio/spc700.h index 07128599..9717c7d9 100644 --- a/src/app/emu/audio/spc700.h +++ b/src/app/emu/audio/spc700.h @@ -8,7 +8,6 @@ #include namespace yaze { -namespace app { namespace emu { namespace audio { @@ -339,6 +338,6 @@ class Spc700 { } // namespace audio } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_SPC700_H \ No newline at end of file diff --git a/src/app/emu/cpu/clock.h b/src/app/emu/cpu/clock.h index 17a7a42c..f1df3ec1 100644 --- a/src/app/emu/cpu/clock.h +++ b/src/app/emu/cpu/clock.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace emu { class Clock { @@ -57,7 +56,7 @@ class ClockImpl : public Clock { }; } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_CLOCK_H_ \ No newline at end of file diff --git a/src/app/emu/cpu/cpu.cc b/src/app/emu/cpu/cpu.cc index 163e1a6c..5e291d8a 100644 --- a/src/app/emu/cpu/cpu.cc +++ b/src/app/emu/cpu/cpu.cc @@ -9,7 +9,6 @@ #include "app/emu/cpu/internal/opcodes.h" namespace yaze { -namespace app { namespace emu { void Cpu::Reset(bool hard) { @@ -2260,5 +2259,5 @@ uint8_t Cpu::GetInstructionLength(uint8_t opcode) { */ } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/cpu/cpu.h b/src/app/emu/cpu/cpu.h index 7623283b..a9b5a885 100644 --- a/src/app/emu/cpu/cpu.h +++ b/src/app/emu/cpu/cpu.h @@ -13,7 +13,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { class InstructionEntry { @@ -799,7 +798,7 @@ class Cpu : public core::ExperimentFlags { }; } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_CPU_H_ \ No newline at end of file diff --git a/src/app/emu/cpu/internal/addressing.cc b/src/app/emu/cpu/internal/addressing.cc index 7086cfd4..16a763a6 100644 --- a/src/app/emu/cpu/internal/addressing.cc +++ b/src/app/emu/cpu/internal/addressing.cc @@ -1,7 +1,6 @@ #include "app/emu/cpu/cpu.h" namespace yaze { -namespace app { namespace emu { void Cpu::AdrImp() { @@ -186,5 +185,5 @@ uint16_t Cpu::StackRelative() { } } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/cpu/internal/instructions.cc b/src/app/emu/cpu/internal/instructions.cc index c00d1f25..77121173 100644 --- a/src/app/emu/cpu/internal/instructions.cc +++ b/src/app/emu/cpu/internal/instructions.cc @@ -5,7 +5,6 @@ #include "app/emu/cpu/cpu.h" namespace yaze { -namespace app { namespace emu { /** @@ -398,5 +397,5 @@ void Cpu::ORA(uint32_t low, uint32_t high) { } } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/emu.cc b/src/app/emu/emu.cc index 394dbf7a..c9ca0ac3 100644 --- a/src/app/emu/emu.cc +++ b/src/app/emu/emu.cc @@ -27,8 +27,8 @@ #include "imgui/imgui.h" #include "imgui_memory_editor.h" -using namespace yaze::app; -using yaze::app::core::SDL_Deleter; +using namespace yaze; +using yaze::core::SDL_Deleter; int main(int argc, char **argv) { absl::InitializeSymbolizer(argv[0]); diff --git a/src/app/emu/emulator.cc b/src/app/emu/emulator.cc index ac912ac3..f99f10a9 100644 --- a/src/app/emu/emulator.cc +++ b/src/app/emu/emulator.cc @@ -15,7 +15,6 @@ #include "imgui_memory_editor.h" namespace yaze { -namespace app { namespace emu { namespace { @@ -540,5 +539,5 @@ void Emulator::RenderCpuInstructionLog( } } // namespace emu -} // namespace app + } // namespace yaze diff --git a/src/app/emu/emulator.h b/src/app/emu/emulator.h index 2b7d844d..a75bc80c 100644 --- a/src/app/emu/emulator.h +++ b/src/app/emu/emulator.h @@ -10,10 +10,9 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { /** - * @namespace yaze::app::emu + * @namespace yaze::emu * @brief SNES Emulation and debugging tools. */ namespace emu { @@ -190,7 +189,7 @@ class Emulator : public SharedRom { }; } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_CORE_EMULATOR_H \ No newline at end of file diff --git a/src/app/emu/memory/asm_parser.h b/src/app/emu/memory/asm_parser.h index f8b107aa..3f71a457 100644 --- a/src/app/emu/memory/asm_parser.h +++ b/src/app/emu/memory/asm_parser.h @@ -13,7 +13,6 @@ #include "app/emu/cpu/internal/opcodes.h" namespace yaze { -namespace app { namespace emu { enum class AddressingMode { @@ -444,5 +443,5 @@ class AsmParser { }; } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/memory/dma.cc b/src/app/emu/memory/dma.cc index 935b04c8..abdda5ff 100644 --- a/src/app/emu/memory/dma.cc +++ b/src/app/emu/memory/dma.cc @@ -3,7 +3,6 @@ #include namespace yaze { -namespace app { namespace emu { namespace memory { namespace dma { @@ -372,5 +371,5 @@ void StartDma(MemoryImpl* memory, uint8_t val, bool hdma) { } // namespace dma } // namespace memory } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/memory/dma.h b/src/app/emu/memory/dma.h index 4cbd148e..9cf09621 100644 --- a/src/app/emu/memory/dma.h +++ b/src/app/emu/memory/dma.h @@ -7,7 +7,6 @@ #include "app/emu/snes.h" namespace yaze { -namespace app { namespace emu { namespace memory { namespace dma { @@ -31,7 +30,7 @@ void DoDma(SNES* snes, MemoryImpl* memory, int cycles); } // namespace dma } // namespace memory } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_MEMORY_DMA_H \ No newline at end of file diff --git a/src/app/emu/memory/dma_channel.h b/src/app/emu/memory/dma_channel.h index 385ab472..3d782678 100644 --- a/src/app/emu/memory/dma_channel.h +++ b/src/app/emu/memory/dma_channel.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace emu { namespace memory { @@ -31,7 +30,7 @@ typedef struct DmaChannel { } // namespace memory } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_MEMORY_DMA_CHANNEL_H \ No newline at end of file diff --git a/src/app/emu/memory/memory.cc b/src/app/emu/memory/memory.cc index f890c789..b34b31f5 100644 --- a/src/app/emu/memory/memory.cc +++ b/src/app/emu/memory/memory.cc @@ -8,7 +8,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace emu { namespace memory { @@ -167,5 +166,5 @@ uint32_t MemoryImpl::GetMappedAddress(uint32_t address) const { } // namespace memory } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/memory/memory.h b/src/app/emu/memory/memory.h index 6485a147..1537122b 100644 --- a/src/app/emu/memory/memory.h +++ b/src/app/emu/memory/memory.h @@ -27,7 +27,6 @@ // 7F 0000-FFFF System RAM namespace yaze { -namespace app { namespace emu { namespace memory { @@ -309,7 +308,7 @@ class MemoryImpl : public Memory { } // namespace memory } // namespace emu -} // namespace app + } // namespace yaze #endif // MEM_H \ No newline at end of file diff --git a/src/app/emu/snes.cc b/src/app/emu/snes.cc index e152e03b..19ea3c20 100644 --- a/src/app/emu/snes.cc +++ b/src/app/emu/snes.cc @@ -15,7 +15,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace emu { namespace { @@ -574,5 +573,5 @@ void SNES::InitAccessTime(bool recalc) { } } // namespace emu -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/emu/snes.h b/src/app/emu/snes.h index 6b01c671..2ca4690f 100644 --- a/src/app/emu/snes.h +++ b/src/app/emu/snes.h @@ -10,7 +10,6 @@ #include "app/emu/video/ppu.h" namespace yaze { -namespace app { namespace emu { struct Input { @@ -131,7 +130,7 @@ class SNES { }; } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_SNES_H diff --git a/src/app/emu/video/ppu.cc b/src/app/emu/video/ppu.cc index f7fa8c32..27a3dc69 100644 --- a/src/app/emu/video/ppu.cc +++ b/src/app/emu/video/ppu.cc @@ -7,7 +7,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace video { @@ -1056,5 +1055,5 @@ void Ppu::PutPixels(uint8_t* pixels) { } // namespace video } // namespace emu -} // namespace app + } // namespace yaze diff --git a/src/app/emu/video/ppu.h b/src/app/emu/video/ppu.h index 65418001..33db8c0e 100644 --- a/src/app/emu/video/ppu.h +++ b/src/app/emu/video/ppu.h @@ -11,7 +11,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace emu { namespace video { @@ -458,7 +457,7 @@ class Ppu : public SharedRom { } // namespace video } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_PPU_H \ No newline at end of file diff --git a/src/app/emu/video/ppu_registers.h b/src/app/emu/video/ppu_registers.h index 5a9d8bc0..d60fcebb 100644 --- a/src/app/emu/video/ppu_registers.h +++ b/src/app/emu/video/ppu_registers.h @@ -6,7 +6,6 @@ #include namespace yaze { -namespace app { namespace emu { namespace video { namespace PpuRegisters { @@ -416,7 +415,7 @@ struct STAT78 { } // namespace PpuRegisters } // namespace video } // namespace emu -} // namespace app + } // namespace yaze #endif // YAZE_APP_EMU_VIDEO_PPU_REGISTERS_H \ No newline at end of file diff --git a/src/app/gfx/bitmap.cc b/src/app/gfx/bitmap.cc index 3f357bae..78be9d45 100644 --- a/src/app/gfx/bitmap.cc +++ b/src/app/gfx/bitmap.cc @@ -18,7 +18,6 @@ } namespace yaze { -namespace app { namespace gfx { using core::SDL_Surface_Deleter; @@ -483,5 +482,5 @@ void Bitmap::WriteColor(int position, const ImVec4 &color) { } } // namespace gfx -} // namespace app + } // namespace yaze diff --git a/src/app/gfx/bitmap.h b/src/app/gfx/bitmap.h index 48a97312..7ea9a144 100644 --- a/src/app/gfx/bitmap.h +++ b/src/app/gfx/bitmap.h @@ -12,10 +12,9 @@ #include "app/gfx/snes_palette.h" namespace yaze { -namespace app { /** - * @namespace yaze::app::gfx + * @namespace yaze::gfx * @brief Contains classes for handling graphical data. */ namespace gfx { @@ -214,7 +213,7 @@ class Bitmap { using BitmapTable = std::unordered_map; } // namespace gfx -} // namespace app + } // namespace yaze #endif // YAZE_APP_GFX_BITMAP_H diff --git a/src/app/gfx/compression.cc b/src/app/gfx/compression.cc index fcb5cfab..dfe09557 100644 --- a/src/app/gfx/compression.cc +++ b/src/app/gfx/compression.cc @@ -13,7 +13,6 @@ #define DEBUG_LOG(msg) std::cout << msg << std::endl namespace yaze { -namespace app { namespace gfx { namespace lc_lz2 { @@ -1473,5 +1472,5 @@ absl::StatusOr> DecompressOverworld( } // namespace lc_lz2 } // namespace gfx -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/gfx/compression.h b/src/app/gfx/compression.h index d2a0aa92..ec5b2f5e 100644 --- a/src/app/gfx/compression.h +++ b/src/app/gfx/compression.h @@ -11,11 +11,10 @@ #define BUILD_HEADER(command, length) (command << 5) + (length - 1) namespace yaze { -namespace app { namespace gfx { /** - * @namespace yaze::app::gfx::lc_lz2 + * @namespace yaze::gfx::lc_lz2 * @brief Contains the LC_LZ2 compression algorithm. */ namespace lc_lz2 { @@ -245,7 +244,7 @@ absl::StatusOr> DecompressOverworld(const std::vector GetColFileData(uint8_t* data) { } } // namespace gfx -} // namespace app + } // namespace yaze diff --git a/src/app/gfx/snes_color.h b/src/app/gfx/snes_color.h index 8045c1e8..5c6e1145 100644 --- a/src/app/gfx/snes_color.h +++ b/src/app/gfx/snes_color.h @@ -9,7 +9,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace gfx { constexpr int NumberOfColors = 3143; @@ -108,7 +107,7 @@ SnesColor GetCgxColor(uint16_t color); std::vector GetColFileData(uint8_t* data); } // namespace gfx -} // namespace app + } // namespace yaze #endif // YAZE_APP_GFX_SNES_COLOR_H_ diff --git a/src/app/gfx/snes_palette.cc b/src/app/gfx/snes_palette.cc index a8005ae7..1d4f2d82 100644 --- a/src/app/gfx/snes_palette.cc +++ b/src/app/gfx/snes_palette.cc @@ -17,11 +17,10 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace gfx { /** - * @namespace yaze::app::gfx::palette_group_internal + * @namespace yaze::gfx::palette_group_internal * @brief Internal functions for loading palettes by group. */ namespace palette_group_internal { @@ -352,5 +351,5 @@ absl::Status LoadAllPalettes(const std::vector &rom_data, } // namespace gfx std::unordered_map GfxContext::palettesets_; -} // namespace app + } // namespace yaze diff --git a/src/app/gfx/snes_palette.h b/src/app/gfx/snes_palette.h index bbe7bf57..c0fc781d 100644 --- a/src/app/gfx/snes_palette.h +++ b/src/app/gfx/snes_palette.h @@ -15,7 +15,6 @@ #include "snes_color.h" namespace yaze { -namespace app { namespace gfx { constexpr int kNumPalettes = 14; @@ -384,7 +383,7 @@ struct Paletteset { gfx::SnesPalette aux1, gfx::SnesPalette aux2, gfx::SnesColor background, gfx::SnesPalette hud, gfx::SnesPalette spr, gfx::SnesPalette spr2, gfx::SnesPalette comp) - : main(main), + : main_(main), animated(animated), aux1(aux1), aux2(aux2), @@ -394,7 +393,7 @@ struct Paletteset { spr2(spr2), composite(comp) {} - gfx::SnesPalette main; /**< The main palette. */ + gfx::SnesPalette main_; /**< The main palette. */ gfx::SnesPalette animated; /**< The animated palette. */ gfx::SnesPalette aux1; /**< The first auxiliary palette. */ gfx::SnesPalette aux2; /**< The second auxiliary palette. */ @@ -416,7 +415,7 @@ protected: }; -} // namespace app + } // namespace yaze #endif // YAZE_APP_GFX_PALETTE_H diff --git a/src/app/gfx/snes_tile.cc b/src/app/gfx/snes_tile.cc index 940fd6c5..86fc13c7 100644 --- a/src/app/gfx/snes_tile.cc +++ b/src/app/gfx/snes_tile.cc @@ -8,7 +8,6 @@ #include "app/core/constants.h" namespace yaze { -namespace app { namespace gfx { // Bit set for object priority @@ -23,8 +22,8 @@ constexpr ushort TileVFlipBit = 0x8000; // Bits used for tile name constexpr ushort TileNameMask = 0x03FF; -snes_tile8 UnpackBppTile(const std::vector& data, const uint32_t offset, - const uint32_t bpp) { +snes_tile8 UnpackBppTile(const std::vector& data, + const uint32_t offset, const uint32_t bpp) { snes_tile8 tile; assert(bpp >= 1 && bpp <= 8); unsigned int bpp_pos[8]; // More for conveniance and readibility @@ -400,5 +399,5 @@ void CopyTile8bpp16(int x, int y, int tile, std::vector& bitmap, } } // namespace gfx -} // namespace app + } // namespace yaze diff --git a/src/app/gfx/snes_tile.h b/src/app/gfx/snes_tile.h index 46ab72b3..1d78cece 100644 --- a/src/app/gfx/snes_tile.h +++ b/src/app/gfx/snes_tile.h @@ -10,7 +10,6 @@ #include namespace yaze { -namespace app { namespace gfx { constexpr int kTilesheetWidth = 128; @@ -222,7 +221,7 @@ class GraphicsBuffer { }; } // namespace gfx -} // namespace app + } // namespace yaze #endif // YAZE_APP_GFX_SNES_TILE_H diff --git a/src/app/gfx/tilesheet.cc b/src/app/gfx/tilesheet.cc index 5d4d3527..7f4990f9 100644 --- a/src/app/gfx/tilesheet.cc +++ b/src/app/gfx/tilesheet.cc @@ -4,12 +4,9 @@ #include #include "app/gfx/bitmap.h" -#include "app/gfx/snes_color.h" -#include "app/gfx/snes_palette.h" #include "app/gfx/snes_tile.h" namespace yaze { -namespace app { namespace gfx { absl::StatusOr CreateTilesheetFromGraphicsBuffer( @@ -210,5 +207,5 @@ void Tilesheet::MirrorTileData(std::vector& tile_data, bool mirrorX, } } // namespace gfx -} // namespace app + } // namespace yaze diff --git a/src/app/gfx/tilesheet.h b/src/app/gfx/tilesheet.h index 3107b3ad..25e92fde 100644 --- a/src/app/gfx/tilesheet.h +++ b/src/app/gfx/tilesheet.h @@ -5,12 +5,10 @@ #include #include "app/gfx/bitmap.h" -#include "app/gfx/snes_color.h" #include "app/gfx/snes_palette.h" #include "app/gfx/snes_tile.h" namespace yaze { -namespace app { namespace gfx { enum class TileType { Tile8, Tile16 }; @@ -134,7 +132,7 @@ absl::StatusOr CreateTilesheetFromGraphicsBuffer( int sheet_id); } // namespace gfx -} // namespace app + } // namespace yaze -#endif // YAZE_APP_GFX_TILESHEET_H \ No newline at end of file +#endif // YAZE_APP_GFX_TILESHEET_H diff --git a/src/app/gui/canvas.cc b/src/app/gui/canvas.cc index 7e0a8a3b..9c379b11 100644 --- a/src/app/gui/canvas.cc +++ b/src/app/gui/canvas.cc @@ -12,7 +12,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace gui { using core::Renderer; @@ -856,5 +855,5 @@ void BitmapCanvasPipeline(gui::Canvas &canvas, const gfx::Bitmap &bitmap, } } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/canvas.h b/src/app/gui/canvas.h index 5bc77ec5..42451c32 100644 --- a/src/app/gui/canvas.h +++ b/src/app/gui/canvas.h @@ -8,16 +8,15 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { /** - * @namespace yaze::app::gui + * @namespace yaze::gui * @brief Graphical User Interface (GUI) components for the application. */ namespace gui { -using app::gfx::Bitmap; -using app::gfx::BitmapTable; +using gfx::Bitmap; +using gfx::BitmapTable; enum class CanvasType { kTile, kBlock, kMap }; enum class CanvasMode { kPaint, kSelect }; @@ -245,7 +244,7 @@ void BitmapCanvasPipeline(gui::Canvas &canvas, const gfx::Bitmap &bitmap, bool scrollbar, int canvas_id); } // namespace gui -} // namespace app + } // namespace yaze #endif diff --git a/src/app/gui/color.cc b/src/app/gui/color.cc index 9e8ea108..0b356e36 100644 --- a/src/app/gui/color.cc +++ b/src/app/gui/color.cc @@ -10,7 +10,6 @@ #include "app/gfx/snes_color.h" namespace yaze { -namespace app { namespace gui { ImVec4 ConvertSnesColorToImVec4(const SnesColor& color) { @@ -53,7 +52,7 @@ IMGUI_API bool SnesColorEdit4(absl::string_view label, SnesColor* color, return pressed; } -absl::Status DisplayPalette(app::gfx::SnesPalette& palette, bool loaded) { +absl::Status DisplayPalette(gfx::SnesPalette& palette, bool loaded) { static ImVec4 color = ImVec4(0, 0, 0, 255.f); ImGuiColorEditFlags misc_flags = ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_NoDragDrop | @@ -170,5 +169,5 @@ void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics, } } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/color.h b/src/app/gui/color.h index 8d5134de..9c915a19 100644 --- a/src/app/gui/color.h +++ b/src/app/gui/color.h @@ -11,7 +11,6 @@ #include "app/gfx/snes_palette.h" namespace yaze { -namespace app { namespace gui { using gfx::SnesColor; @@ -28,13 +27,13 @@ IMGUI_API bool SnesColorButton(absl::string_view id, SnesColor& color, IMGUI_API bool SnesColorEdit4(absl::string_view label, SnesColor* color, ImGuiColorEditFlags flags = 0); -absl::Status DisplayPalette(app::gfx::SnesPalette& palette, bool loaded); +absl::Status DisplayPalette(gfx::SnesPalette& palette, bool loaded); void SelectablePalettePipeline(uint64_t& palette_id, bool& refresh_graphics, gfx::SnesPalette& palette); } // namespace gui -} // namespace app + } // namespace yaze #endif diff --git a/src/app/gui/input.cc b/src/app/gui/input.cc index f3e74bce..53be057c 100644 --- a/src/app/gui/input.cc +++ b/src/app/gui/input.cc @@ -133,7 +133,6 @@ bool InputScalarLeft(const char* label, ImGuiDataType data_type, void* p_data, } // namespace ImGui namespace yaze { -namespace app { namespace gui { const int kStepOneHex = 0x01; @@ -282,5 +281,5 @@ void FileDialogPipeline(absl::string_view display_key, } } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/input.h b/src/app/gui/input.h index caa4d9bb..e04aa3bf 100644 --- a/src/app/gui/input.h +++ b/src/app/gui/input.h @@ -21,7 +21,6 @@ #include "imgui_memory_editor.h" namespace yaze { -namespace app { namespace gui { constexpr ImVec2 kDefaultModalSize = ImVec2(200, 0); @@ -64,7 +63,7 @@ void FileDialogPipeline(absl::string_view display_key, std::function callback); } // namespace gui -} // namespace app + } // namespace yaze #endif diff --git a/src/app/gui/modules/asset_browser.cc b/src/app/gui/modules/asset_browser.cc index a584d648..9f36665f 100644 --- a/src/app/gui/modules/asset_browser.cc +++ b/src/app/gui/modules/asset_browser.cc @@ -3,7 +3,6 @@ #include "absl/strings/str_format.h" namespace yaze { -namespace app { namespace gui { using namespace ImGui; @@ -342,5 +341,5 @@ void GfxSheetAssetBrowser::Draw( } } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/modules/asset_browser.h b/src/app/gui/modules/asset_browser.h index 46f57c58..432e896d 100644 --- a/src/app/gui/modules/asset_browser.h +++ b/src/app/gui/modules/asset_browser.h @@ -13,7 +13,6 @@ #define IM_CLAMP(V, MN, MX) ((V) < (MN) ? (MN) : (V) > (MX) ? (MX) : (V)) namespace yaze { -namespace app { namespace gui { // Extra functions to add deletion support to ImGuiSelectionBasicStorage @@ -243,7 +242,7 @@ struct GfxSheetAssetBrowser { }; } // namespace gui -} // namespace app + } // namespace yaze #endif // YAZE_APP_GUI_ASSET_BROWSER_H \ No newline at end of file diff --git a/src/app/gui/style.cc b/src/app/gui/style.cc index 0726dff5..a87b92eb 100644 --- a/src/app/gui/style.cc +++ b/src/app/gui/style.cc @@ -4,7 +4,6 @@ #include "imgui/imgui_internal.h" namespace yaze { -namespace app { namespace gui { // TODO: Add more display settings to popup windows. @@ -649,5 +648,5 @@ TextEditor::LanguageDefinition GetAssemblyLanguageDef() { } } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/style.h b/src/app/gui/style.h index 30e5d609..f275317e 100644 --- a/src/app/gui/style.h +++ b/src/app/gui/style.h @@ -9,7 +9,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace gui { void BeginWindowWithDisplaySettings(const char *id, bool *active, @@ -92,7 +91,7 @@ struct MultiSelectWithClipper { }; } // namespace gui -} // namespace app + } // namespace yaze #endif diff --git a/src/app/gui/zeml.cc b/src/app/gui/zeml.cc index 5e94e097..a83210a4 100644 --- a/src/app/gui/zeml.cc +++ b/src/app/gui/zeml.cc @@ -15,7 +15,6 @@ #include "imgui/imgui.h" namespace yaze { -namespace app { namespace gui { namespace zeml { @@ -618,5 +617,5 @@ std::string LoadFile(const std::string& filename) { } // namespace zeml } // namespace gui -} // namespace app + } // namespace yaze diff --git a/src/app/gui/zeml.h b/src/app/gui/zeml.h index 2ba4f594..1ddbaac1 100644 --- a/src/app/gui/zeml.h +++ b/src/app/gui/zeml.h @@ -11,11 +11,10 @@ #include namespace yaze { -namespace app { namespace gui { /** - * @namespace yaze::app::gui::zeml + * @namespace yaze::gui::zeml * @brief Zelda Editor Markup Language Functions */ namespace zeml { @@ -207,7 +206,7 @@ std::string LoadFile(const std::string& filename); } // namespace zeml } // namespace gui -} // namespace app + } // namespace yaze #endif // YAZE_APP_GUI_YAZON_H_ diff --git a/src/app/main.cc b/src/app/main.cc index 80f827f5..37bd7cd1 100644 --- a/src/app/main.cc +++ b/src/app/main.cc @@ -9,10 +9,10 @@ #include "app/core/controller.h" /** - * @namespace yaze::app - * @brief Main namespace for the ImGui application. + * @namespace yaze + * @brief Main namespace for the application. */ -using namespace yaze::app; +using namespace yaze; /** * @brief Main entry point for the application. diff --git a/src/app/rom.cc b/src/app/rom.cc index 220b65ce..196be684 100644 --- a/src/app/rom.cc +++ b/src/app/rom.cc @@ -23,8 +23,6 @@ #include "app/gfx/snes_tile.h" namespace yaze { -namespace app { - using core::Renderer; constexpr int Uncompressed3BPPSize = 0x0600; @@ -136,23 +134,27 @@ absl::Status Rom::LoadAllGraphicsData(bool defer_render) { absl::Status Rom::SaveAllGraphicsData() { for (int i = 0; i < kNumGfxSheets; i++) { if (graphics_sheets_[i].is_active()) { - int from_bpp = 8; int to_bpp = 3; std::vector final_data; bool compressed = true; if (i >= 115 && i <= 126) { - to_bpp = 3; compressed = false; } else if (i == 113 || i == 114 || i >= 218) { to_bpp = 2; + continue; } + std::cout << "Sheet ID " << i << " BPP: " << to_bpp << std::endl; auto sheet_data = graphics_sheets_[i].vector(); - final_data = gfx::ConvertBpp(sheet_data, from_bpp, to_bpp); + std::cout << "Sheet data size: " << sheet_data.size() << std::endl; + final_data = gfx::Bpp8SnesToIndexed(sheet_data, 8); + int size = 0; if (compressed) { - ASSIGN_OR_RETURN( - final_data, - gfx::lc_lz2::CompressV2(final_data.data(), 0, final_data.size())); + auto compressed_data = gfx::lc_lz2::Compress( + final_data.data(), final_data.size(), &size, 1); + for (int j = 0; j < size; j++) { + sheet_data[j] = compressed_data[j]; + } } auto offset = GetGraphicsAddress(data(), i, version_constants().kOverworldGfxPtr1, @@ -464,5 +466,4 @@ absl::Status Rom::SaveGroupsToRom() { std::shared_ptr SharedRom::shared_rom_ = nullptr; -} // namespace app } // namespace yaze diff --git a/src/app/rom.h b/src/app/rom.h index c99ebd92..7dcfc13a 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -27,8 +27,6 @@ #include "app/gfx/snes_tile.h" namespace yaze { -namespace app { - /** * @brief Different versions of the game supported by the Rom class. */ @@ -597,7 +595,6 @@ class SharedRom { static std::shared_ptr shared_rom_; }; -} // namespace app } // namespace yaze #endif diff --git a/src/app/zelda3/common.h b/src/app/zelda3/common.h index 152d9369..3f532428 100644 --- a/src/app/zelda3/common.h +++ b/src/app/zelda3/common.h @@ -6,9 +6,8 @@ #include namespace yaze { -namespace app { /** - * @namespace yaze::app::zelda3 + * @namespace yaze::zelda3 * @brief Zelda 3 specific classes and functions. */ namespace zelda3 { @@ -319,7 +318,7 @@ static const std::string TileTypeNames[] = { "$FF Door X top? (unused?)"}; } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_COMMON_H diff --git a/src/app/zelda3/dungeon/object_names.h b/src/app/zelda3/dungeon/object_names.h index cc24aeea..2ee5b3c6 100644 --- a/src/app/zelda3/dungeon/object_names.h +++ b/src/app/zelda3/dungeon/object_names.h @@ -4,7 +4,6 @@ #include "absl/strings/string_view.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -459,7 +458,7 @@ constexpr static inline absl::string_view Type3RoomObjectNames[] = { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_DUNGEON_OBJECT_NAMES_H \ No newline at end of file diff --git a/src/app/zelda3/dungeon/object_renderer.cc b/src/app/zelda3/dungeon/object_renderer.cc index fd88b6af..fe00f1b3 100644 --- a/src/app/zelda3/dungeon/object_renderer.cc +++ b/src/app/zelda3/dungeon/object_renderer.cc @@ -1,7 +1,6 @@ #include "app/zelda3/dungeon/object_renderer.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -114,5 +113,5 @@ void DungeonObjectRenderer::UpdateObjectBitmap() { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/dungeon/object_renderer.h b/src/app/zelda3/dungeon/object_renderer.h index ef74c3c5..5acaf0cb 100644 --- a/src/app/zelda3/dungeon/object_renderer.h +++ b/src/app/zelda3/dungeon/object_renderer.h @@ -14,7 +14,6 @@ #include "app/zelda3/dungeon/object_names.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -53,5 +52,5 @@ class DungeonObjectRenderer : public SharedRom { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/zelda3/dungeon/room.cc b/src/app/zelda3/dungeon/room.cc index 71a2f92b..da3d60f1 100644 --- a/src/app/zelda3/dungeon/room.cc +++ b/src/app/zelda3/dungeon/room.cc @@ -16,7 +16,6 @@ #include "app/zelda3/sprite/sprite.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -488,5 +487,5 @@ void Room::LoadChests() { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/dungeon/room.h b/src/app/zelda3/dungeon/room.h index 533aa57d..8a72ff0a 100644 --- a/src/app/zelda3/dungeon/room.h +++ b/src/app/zelda3/dungeon/room.h @@ -4,22 +4,16 @@ #include #include -#include -#include #include #include #include "app/core/constants.h" #include "app/gfx/bitmap.h" -#include "app/gfx/snes_palette.h" -#include "app/gfx/snes_tile.h" -#include "app/gui/canvas.h" #include "app/rom.h" #include "app/zelda3/dungeon/room_object.h" #include "app/zelda3/sprite/sprite.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -113,11 +107,6 @@ class Room : public SharedRom { auto room_size_ptr() const { return room_size_pointer_; } auto set_room_size(uint64_t size) { room_size_ = size; } - RoomObject AddObject(short oid, uint8_t x, uint8_t y, uint8_t size, - uint8_t layer) { - return RoomObject(oid, x, y, size, layer); - } - uint8_t blockset = 0; uint8_t spriteset = 0; uint8_t palette = 0; @@ -613,7 +602,7 @@ constexpr std::string_view kEntranceNames[] = { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/dungeon/room_entrance.h b/src/app/zelda3/dungeon/room_entrance.h index 074d9c42..bb2482d9 100644 --- a/src/app/zelda3/dungeon/room_entrance.h +++ b/src/app/zelda3/dungeon/room_entrance.h @@ -6,7 +6,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -352,7 +351,7 @@ class RoomEntrance { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_DUNGEON_ROOM_ENTRANCE_H diff --git a/src/app/zelda3/dungeon/room_object.cc b/src/app/zelda3/dungeon/room_object.cc index 8aeb6e71..1258b304 100644 --- a/src/app/zelda3/dungeon/room_object.cc +++ b/src/app/zelda3/dungeon/room_object.cc @@ -1,7 +1,6 @@ #include "room_object.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -133,5 +132,5 @@ void RoomObject::DrawTile(gfx::Tile16 t, int xx, int yy, } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/dungeon/room_object.h b/src/app/zelda3/dungeon/room_object.h index 497bbe4e..8ba70c68 100644 --- a/src/app/zelda3/dungeon/room_object.h +++ b/src/app/zelda3/dungeon/room_object.h @@ -5,17 +5,11 @@ #include #include -#include "app/emu/cpu/cpu.h" -#include "app/emu/memory/memory.h" -#include "app/emu/video/ppu.h" -#include "app/gfx/snes_palette.h" #include "app/gfx/snes_tile.h" #include "app/rom.h" -#include "app/zelda3/dungeon/object_names.h" #include "app/zelda3/dungeon/object_renderer.h" namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -209,7 +203,7 @@ class Subtype3 : public RoomObject { } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_DUNGEON_ROOM_OBJECT_H diff --git a/src/app/zelda3/dungeon/room_tag.h b/src/app/zelda3/dungeon/room_tag.h index a6f5a331..7a2f4cd6 100644 --- a/src/app/zelda3/dungeon/room_tag.h +++ b/src/app/zelda3/dungeon/room_tag.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace zelda3 { namespace dungeon { @@ -88,7 +87,7 @@ static const std::string RoomTag[] = {"Nothing", } // namespace dungeon } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_DUNGEON_ROOM_TAG_H \ No newline at end of file diff --git a/src/app/zelda3/music/tracker.cc b/src/app/zelda3/music/tracker.cc index 5753051f..093aec28 100644 --- a/src/app/zelda3/music/tracker.cc +++ b/src/app/zelda3/music/tracker.cc @@ -17,7 +17,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace { @@ -1337,5 +1336,5 @@ void Tracker::NewSR(Rom &rom, int bank) { } // namespace music } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/music/tracker.h b/src/app/zelda3/music/tracker.h index 65048b2a..61e01e5d 100644 --- a/src/app/zelda3/music/tracker.h +++ b/src/app/zelda3/music/tracker.h @@ -7,11 +7,10 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { /** - * @namespace yaze::app::zelda3::music + * @namespace yaze::zelda3::music * @brief Contains classes and functions for handling music data in Zelda 3. * * Based off of the HyruleMagic tracker code. @@ -254,7 +253,7 @@ class Tracker { } // namespace music } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/overworld/overworld.cc b/src/app/zelda3/overworld/overworld.cc index aee8dc06..5219cc1a 100644 --- a/src/app/zelda3/overworld/overworld.cc +++ b/src/app/zelda3/overworld/overworld.cc @@ -1,23 +1,17 @@ #include "overworld.h" #include -#include #include -#include #include #include #include "absl/status/status.h" #include "app/core/constants.h" -#include "app/gfx/bitmap.h" #include "app/gfx/compression.h" #include "app/gfx/snes_tile.h" #include "app/rom.h" -#include "app/zelda3/overworld/overworld_map.h" -#include "app/zelda3/sprite/sprite.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -1594,5 +1588,5 @@ absl::Status Overworld::SaveMapProperties() { } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/overworld/overworld.h b/src/app/zelda3/overworld/overworld.h index 054485ba..a733969a 100644 --- a/src/app/zelda3/overworld/overworld.h +++ b/src/app/zelda3/overworld/overworld.h @@ -17,11 +17,10 @@ #include "app/zelda3/sprite/sprite.h" namespace yaze { -namespace app { namespace zelda3 { /** - * @namespace yaze::app::zelda3::overworld + * @namespace yaze::zelda3::overworld * @brief Represents the Overworld data. */ namespace overworld { @@ -277,7 +276,7 @@ private: } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/overworld/overworld_entrance.h b/src/app/zelda3/overworld/overworld_entrance.h index ecef16ff..a86f9d11 100644 --- a/src/app/zelda3/overworld/overworld_entrance.h +++ b/src/app/zelda3/overworld/overworld_entrance.h @@ -7,7 +7,6 @@ #include "app/zelda3/common.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -84,7 +83,7 @@ public: } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/overworld/overworld_exit.h b/src/app/zelda3/overworld/overworld_exit.h index 926dead9..2ada0071 100644 --- a/src/app/zelda3/overworld/overworld_exit.h +++ b/src/app/zelda3/overworld/overworld_exit.h @@ -8,7 +8,6 @@ #include "app/zelda3/common.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -204,7 +203,7 @@ class OverworldExit : public GameEntity { } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_OVERWORLD_EXIT_H_ diff --git a/src/app/zelda3/overworld/overworld_item.h b/src/app/zelda3/overworld/overworld_item.h index 62b0a0e9..7f3ba13a 100644 --- a/src/app/zelda3/overworld/overworld_item.h +++ b/src/app/zelda3/overworld/overworld_item.h @@ -10,7 +10,6 @@ #include "app/zelda3/common.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -102,7 +101,7 @@ public: } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_OVERWORLD_ITEM_H_ diff --git a/src/app/zelda3/overworld/overworld_map.cc b/src/app/zelda3/overworld/overworld_map.cc index 3ff96b98..3b200377 100644 --- a/src/app/zelda3/overworld/overworld_map.cc +++ b/src/app/zelda3/overworld/overworld_map.cc @@ -10,7 +10,6 @@ #include "app/zelda3/overworld/overworld.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -745,5 +744,5 @@ absl::Status OverworldMap::BuildBitmap(OWBlockset& world_blockset) { } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/overworld/overworld_map.h b/src/app/zelda3/overworld/overworld_map.h index f4158a04..eef35e6a 100644 --- a/src/app/zelda3/overworld/overworld_map.h +++ b/src/app/zelda3/overworld/overworld_map.h @@ -12,7 +12,6 @@ #include "app/zelda3/common.h" namespace yaze { -namespace app { namespace zelda3 { namespace overworld { @@ -187,7 +186,7 @@ class OverworldMap : public GfxContext { } // namespace overworld } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/screen/dungeon_map.cc b/src/app/zelda3/screen/dungeon_map.cc new file mode 100644 index 00000000..b2cac1ff --- /dev/null +++ b/src/app/zelda3/screen/dungeon_map.cc @@ -0,0 +1,53 @@ +#include "dungeon_map.h" + +#include +#include + +#include "app/core/platform/file_dialog.h" +#include "app/core/platform/renderer.h" +#include "app/gfx/bitmap.h" +#include "app/gfx/snes_tile.h" + +namespace yaze { +namespace zelda3 { +namespace screen { + +absl::Status LoadDungeonMapGfxFromBinary(Rom &rom, + std::array &sheets, + gfx::Tilesheet &tile16_sheet, + std::vector &gfx_bin_data) { + std::string bin_file = core::FileDialogWrapper::ShowOpenFileDialog(); + if (bin_file.empty()) { + return absl::InternalError("No file selected"); + } + + std::ifstream file(bin_file, std::ios::binary); + if (file.is_open()) { + // Read the gfx data into a buffer + std::vector bin_data((std::istreambuf_iterator(file)), + std::istreambuf_iterator()); + auto converted_bin = gfx::SnesTo8bppSheet(bin_data, 4, 4); + gfx_bin_data = converted_bin; + tile16_sheet.clear(); + if (LoadDungeonMapTile16(converted_bin, true).ok()) { + std::vector> gfx_sheets; + for (int i = 0; i < 4; i++) { + gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000), + converted_bin.begin() + ((i + 1) * 0x1000)); + sheets[i] = gfx::Bitmap(128, 32, 8, gfx_sheets[i]); + sheets[i].ApplyPalette(*rom.mutable_dungeon_palette(3)); + core::Renderer::GetInstance().RenderBitmap(&sheets[i]); + } + } else { + return absl::InternalError("Failed to load dungeon map tile16"); + } + file.close(); + } + + return absl::OkStatus(); +} + +} // namespace screen +} // namespace zelda3 + +} // namespace yaze diff --git a/src/app/zelda3/screen/dungeon_map.h b/src/app/zelda3/screen/dungeon_map.h index eb4f19f8..f8a73f38 100644 --- a/src/app/zelda3/screen/dungeon_map.h +++ b/src/app/zelda3/screen/dungeon_map.h @@ -4,8 +4,11 @@ #include #include +#include "absl/status/status.h" +#include "app/gfx/tilesheet.h" +#include "app/rom.h" + namespace yaze { -namespace app { namespace zelda3 { namespace screen { @@ -38,8 +41,8 @@ struct DungeonMap { DungeonMap(unsigned short boss_room, unsigned char nbr_of_floor, unsigned char nbr_of_basement, - const std::vector>& floor_rooms, - const std::vector>& floor_gfx) + const std::vector> &floor_rooms, + const std::vector> &floor_gfx) : boss_room(boss_room), nbr_of_floor(nbr_of_floor), nbr_of_basement(nbr_of_basement), @@ -47,9 +50,17 @@ struct DungeonMap { floor_gfx(floor_gfx) {} }; +absl::Status LoadDungeonMapTile16(const std::vector &gfx_data, + bool bin_mode); + +absl::Status LoadDungeonMapGfxFromBinary(Rom &rom, + std::array &sheets, + gfx::Tilesheet &tile16_sheet, + std::vector &gfx_bin_data); + } // namespace screen } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H diff --git a/src/app/zelda3/screen/inventory.cc b/src/app/zelda3/screen/inventory.cc index d494daaa..e037f85c 100644 --- a/src/app/zelda3/screen/inventory.cc +++ b/src/app/zelda3/screen/inventory.cc @@ -7,7 +7,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace screen { @@ -93,5 +92,5 @@ absl::Status Inventory::BuildTileset() { } // namespace screen } // namespace zelda3 -} // namespace app + } // namespace yaze \ No newline at end of file diff --git a/src/app/zelda3/screen/inventory.h b/src/app/zelda3/screen/inventory.h index 4cae3a47..9ca0ff0d 100644 --- a/src/app/zelda3/screen/inventory.h +++ b/src/app/zelda3/screen/inventory.h @@ -8,7 +8,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace screen { @@ -40,7 +39,7 @@ class Inventory : public SharedRom { } // namespace screen } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_INVENTORY_H diff --git a/src/app/zelda3/screen/title_screen.cc b/src/app/zelda3/screen/title_screen.cc index db2f4b3c..f0a06dee 100644 --- a/src/app/zelda3/screen/title_screen.cc +++ b/src/app/zelda3/screen/title_screen.cc @@ -7,7 +7,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace screen { @@ -124,5 +123,5 @@ void TitleScreen::LoadTitleScreen() { } // namespace screen } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/screen/title_screen.h b/src/app/zelda3/screen/title_screen.h index 49befd5f..7b08d332 100644 --- a/src/app/zelda3/screen/title_screen.h +++ b/src/app/zelda3/screen/title_screen.h @@ -9,7 +9,6 @@ #include "app/rom.h" namespace yaze { -namespace app { namespace zelda3 { namespace screen { @@ -77,7 +76,7 @@ class TitleScreen { } // namespace screen } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_SCREEN_H diff --git a/src/app/zelda3/sprite/overlord.h b/src/app/zelda3/sprite/overlord.h index 44314104..cdab38f6 100644 --- a/src/app/zelda3/sprite/overlord.h +++ b/src/app/zelda3/sprite/overlord.h @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace zelda3 { static const std::string kOverlordNames[] = { @@ -37,7 +36,7 @@ static const std::string kOverlordNames[] = { }; } -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_SPRITE_OVERLORD_H diff --git a/src/app/zelda3/sprite/sprite.cc b/src/app/zelda3/sprite/sprite.cc index a9f1d940..139769a7 100644 --- a/src/app/zelda3/sprite/sprite.cc +++ b/src/app/zelda3/sprite/sprite.cc @@ -3,7 +3,6 @@ #include "app/zelda3/overworld/overworld.h" namespace yaze { -namespace app { namespace zelda3 { void Sprite::UpdateMapProperties(uint16_t map_id) { @@ -911,5 +910,5 @@ void Sprite::DrawSpriteTile(int x, int y, int srcx, int srcy, int pal, } } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/sprite/sprite.h b/src/app/zelda3/sprite/sprite.h index 02fcc39b..bf906aa8 100644 --- a/src/app/zelda3/sprite/sprite.h +++ b/src/app/zelda3/sprite/sprite.h @@ -11,7 +11,6 @@ #include "app/zelda3/sprite/overlord.h" namespace yaze { -namespace app { namespace zelda3 { static const std::string kSpriteDefaultNames[]{ @@ -391,7 +390,7 @@ class Sprite : public GameEntity { }; } // namespace zelda3 -} // namespace app + } // namespace yaze #endif diff --git a/src/app/zelda3/sprite/sprite_builder.cc b/src/app/zelda3/sprite/sprite_builder.cc index 8b069411..fe808b4b 100644 --- a/src/app/zelda3/sprite/sprite_builder.cc +++ b/src/app/zelda3/sprite/sprite_builder.cc @@ -4,7 +4,6 @@ #include namespace yaze { -namespace app { namespace zelda3 { SpriteBuilder SpriteBuilder::Create(const std::string& spriteName) { @@ -149,5 +148,5 @@ SpriteInstruction SpriteInstruction::JumpToFunction( } } // namespace zelda3 -} // namespace app + } // namespace yaze diff --git a/src/app/zelda3/sprite/sprite_builder.h b/src/app/zelda3/sprite/sprite_builder.h index 313c2eee..2d7bcef5 100644 --- a/src/app/zelda3/sprite/sprite_builder.h +++ b/src/app/zelda3/sprite/sprite_builder.h @@ -6,7 +6,6 @@ #include namespace yaze { -namespace app { namespace zelda3 { class SpriteInstruction { @@ -125,7 +124,7 @@ class SpriteBuilder { }; } // namespace zelda3 -} // namespace app + } // namespace yaze #endif // YAZE_APP_ZELDA3_SPRITE_SPRITE_BUILDER_H_ \ No newline at end of file diff --git a/src/cli/command.h b/src/cli/command.h index 941d25f0..c8ee1495 100644 --- a/src/cli/command.h +++ b/src/cli/command.h @@ -48,7 +48,7 @@ class CommandHandler { virtual ~CommandHandler() = default; virtual absl::Status handle(const std::vector& arg_vec) = 0; - app::Rom rom_; + Rom rom_; }; class ApplyPatch : public CommandHandler { @@ -130,7 +130,7 @@ class SnesToPc : public CommandHandler { std::stringstream ss(arg.data()); uint32_t snes_address; ss >> std::hex >> snes_address; - uint32_t pc_address = app::core::SnesToPc(snes_address); + uint32_t pc_address = core::SnesToPc(snes_address); std::cout << std::hex << pc_address << std::endl; return absl::OkStatus(); } @@ -149,7 +149,7 @@ class PcToSnes : public CommandHandler { std::stringstream ss(arg.data()); uint32_t pc_address; ss >> std::hex >> pc_address; - uint32_t snes_address = app::core::PcToSnes(pc_address); + uint32_t snes_address = core::PcToSnes(pc_address); ColorModifier blue(ColorCode::FG_BLUE); std::cout << "SNES LoROM Address: "; std::cout << blue << "$" << std::uppercase << std::hex << snes_address diff --git a/src/cli/handlers/patch.cc b/src/cli/handlers/patch.cc index 4aedf52e..12ff2fd1 100644 --- a/src/cli/handlers/patch.cc +++ b/src/cli/handlers/patch.cc @@ -15,7 +15,7 @@ absl::Status ApplyPatch::handle(const std::vector& arg_vec) { // Apply patch std::vector patched; - app::core::ApplyBpsPatch(source, patch, patched); + core::ApplyBpsPatch(source, patch, patched); // Save patched file std::ofstream patched_rom("patched.sfc", std::ios::binary); @@ -48,7 +48,7 @@ absl::Status CreatePatch::handle(const std::vector& arg_vec) { std::vector target; std::vector patch; // Create patch - app::core::CreateBpsPatch(source, target, patch); + core::CreateBpsPatch(source, target, patch); // Save patch to file // std::ofstream patchFile("patch.bps", ios::binary); diff --git a/src/ios/main.mm b/src/ios/main.mm index dcf7e85d..46d39aa0 100644 --- a/src/ios/main.mm +++ b/src/ios/main.mm @@ -352,9 +352,9 @@ // Size of the data size_t size = [data length]; - PRINT_IF_ERROR(yaze::app::SharedRom::shared_rom_->LoadFromPointer(bytes, size)); + PRINT_IF_ERROR(yaze::SharedRom::shared_rom_->LoadFromPointer(bytes, size)); std::string filename = std::string([selectedFileURL.path UTF8String]); - yaze::app::SharedRom::shared_rom_->set_filename(filename); + yaze::SharedRom::shared_rom_->set_filename(filename); [selectedFileURL stopAccessingSecurityScopedResource]; } else { diff --git a/src/test/emu/cpu_test.cc b/src/test/emu/cpu_test.cc index 296443bc..cb28bf1e 100644 --- a/src/test/emu/cpu_test.cc +++ b/src/test/emu/cpu_test.cc @@ -13,11 +13,11 @@ namespace yaze { namespace test { namespace emu { -using yaze::app::emu::AsmParser; -using yaze::app::emu::Cpu; -using yaze::app::emu::memory::CpuCallbacks; -using yaze::app::emu::memory::MockClock; -using yaze::app::emu::memory::MockMemory; +using yaze::emu::AsmParser; +using yaze::emu::Cpu; +using yaze::emu::memory::CpuCallbacks; +using yaze::emu::memory::MockClock; +using yaze::emu::memory::MockMemory; /** * \test Test fixture for CPU unit tests diff --git a/src/test/emu/ppu_test.cc b/src/test/emu/ppu_test.cc index 3099f801..02520efc 100644 --- a/src/test/emu/ppu_test.cc +++ b/src/test/emu/ppu_test.cc @@ -10,14 +10,14 @@ namespace yaze { namespace test { namespace emu { -using yaze::app::emu::Clock; -using yaze::app::emu::memory::MockClock; -using yaze::app::emu::memory::MockMemory; -using yaze::app::emu::video::BackgroundMode; -using yaze::app::emu::video::PpuInterface; -using yaze::app::emu::video::SpriteAttributes; -using yaze::app::emu::video::Tilemap; -using yaze::app::gfx::Bitmap; +using yaze::emu::Clock; +using yaze::emu::memory::MockClock; +using yaze::emu::memory::MockMemory; +using yaze::emu::video::BackgroundMode; +using yaze::emu::video::PpuInterface; +using yaze::emu::video::SpriteAttributes; +using yaze::emu::video::Tilemap; +using yaze::gfx::Bitmap; /** * @brief Mock Ppu class for testing diff --git a/src/test/emu/spc700_test.cc b/src/test/emu/spc700_test.cc index 16625fae..882cd22d 100644 --- a/src/test/emu/spc700_test.cc +++ b/src/test/emu/spc700_test.cc @@ -10,9 +10,9 @@ namespace emu { using testing::_; using testing::Return; -using yaze::app::emu::audio::ApuCallbacks; -using yaze::app::emu::audio::AudioRam; -using yaze::app::emu::audio::Spc700; +using yaze::emu::audio::ApuCallbacks; +using yaze::emu::audio::AudioRam; +using yaze::emu::audio::Spc700; /** * @brief MockAudioRam is a mock class for the AudioRam class. diff --git a/src/test/gfx/compression_test.cc b/src/test/gfx/compression_test.cc index f7875f1d..f4822837 100644 --- a/src/test/gfx/compression_test.cc +++ b/src/test/gfx/compression_test.cc @@ -14,18 +14,18 @@ namespace yaze { namespace test { namespace gfx { -using yaze::app::Rom; -using yaze::app::gfx::lc_lz2::CompressionContext; -using yaze::app::gfx::lc_lz2::CompressionPiece; -using yaze::app::gfx::lc_lz2::CompressV2; -using yaze::app::gfx::lc_lz2::CompressV3; -using yaze::app::gfx::lc_lz2::DecompressV2; -using yaze::app::gfx::lc_lz2::kCommandByteFill; -using yaze::app::gfx::lc_lz2::kCommandDirectCopy; -using yaze::app::gfx::lc_lz2::kCommandIncreasingFill; -using yaze::app::gfx::lc_lz2::kCommandLongLength; -using yaze::app::gfx::lc_lz2::kCommandRepeatingBytes; -using yaze::app::gfx::lc_lz2::kCommandWordFill; +using yaze::Rom; +using yaze::gfx::lc_lz2::CompressionContext; +using yaze::gfx::lc_lz2::CompressionPiece; +using yaze::gfx::lc_lz2::CompressV2; +using yaze::gfx::lc_lz2::CompressV3; +using yaze::gfx::lc_lz2::DecompressV2; +using yaze::gfx::lc_lz2::kCommandByteFill; +using yaze::gfx::lc_lz2::kCommandDirectCopy; +using yaze::gfx::lc_lz2::kCommandIncreasingFill; +using yaze::gfx::lc_lz2::kCommandLongLength; +using yaze::gfx::lc_lz2::kCommandRepeatingBytes; +using yaze::gfx::lc_lz2::kCommandWordFill; using ::testing::ElementsAre; using ::testing::ElementsAreArray; @@ -81,8 +81,9 @@ void AssertCompressionQuality( EXPECT_THAT(compressed_data, ElementsAreArray(expected_compressed_data)); } -std::vector ExpectCompressV3Ok(const std::vector& uncompressed_data, - const std::vector& expected_compressed_data) { +std::vector ExpectCompressV3Ok( + const std::vector& uncompressed_data, + const std::vector& expected_compressed_data) { absl::StatusOr> result = CompressV3(uncompressed_data, 0, uncompressed_data.size(), 0, false); EXPECT_TRUE(result.ok()); @@ -397,7 +398,8 @@ TEST(CheckIncByteV3Test, NotAnIncreasingSequence) { TEST(LC_LZ2_CompressionTest, DecompressionValidCommand) { Rom rom; - std::vector simple_copy_input = {BUILD_HEADER(0x00, 0x02), 0x2A, 0x45, 0xFF}; + std::vector simple_copy_input = {BUILD_HEADER(0x00, 0x02), 0x2A, + 0x45, 0xFF}; uchar simple_copy_output[2] = {0x2A, 0x45}; auto decomp_result = ExpectDecompressBytesOk(rom, simple_copy_input); EXPECT_THAT(simple_copy_output, ElementsAreArray(decomp_result.data(), 2)); diff --git a/src/test/gfx/snes_palette_test.cc b/src/test/gfx/snes_palette_test.cc index 2e962290..4e9be997 100644 --- a/src/test/gfx/snes_palette_test.cc +++ b/src/test/gfx/snes_palette_test.cc @@ -10,10 +10,10 @@ namespace test { namespace gfx { using ::testing::ElementsAreArray; -using yaze::app::gfx::ConvertRgbToSnes; -using yaze::app::gfx::ConvertSnestoRGB; -using yaze::app::gfx::Extract; -using yaze::app::gfx::SnesPalette; +using yaze::gfx::ConvertRgbToSnes; +using yaze::gfx::ConvertSnestoRGB; +using yaze::gfx::Extract; +using yaze::gfx::SnesPalette; namespace { unsigned int test_convert(snes_color col) { @@ -26,8 +26,8 @@ unsigned int test_convert(snes_color col) { } // namespace TEST(SnesPaletteTest, AddColor) { - yaze::app::gfx::SnesPalette palette; - yaze::app::gfx::SnesColor color; + yaze::gfx::SnesPalette palette; + yaze::gfx::SnesColor color; palette.AddColor(color); ASSERT_EQ(palette.size(), 1); } @@ -88,7 +88,7 @@ TEST(SnesColorTest, Convert) { static_cast(0xFF), 0x1F}; auto pal = Extract(data, 0, 5); - auto snes_string = yaze::app::gfx::Convert(pal); + auto snes_string = yaze::gfx::Convert(pal); EXPECT_EQ(10, snes_string.size()); EXPECT_THAT(data, ElementsAreArray(snes_string.data(), 10)); } diff --git a/src/test/integration/test_editor.cc b/src/test/integration/test_editor.cc index 53411800..45cfbba3 100644 --- a/src/test/integration/test_editor.cc +++ b/src/test/integration/test_editor.cc @@ -45,7 +45,7 @@ void TestEditor::RegisterTests(ImGuiTestEngine* engine) { int RunIntegrationTest() { yaze::test::integration::TestEditor test_editor; - yaze::app::core::Controller controller; + yaze::core::Controller controller; controller.init_test_editor(&test_editor); if (!controller.CreateWindow().ok()) { @@ -68,16 +68,15 @@ int RunIntegrationTest() { // Initialize ImGui for SDL ImGui_ImplSDL2_InitForSDLRenderer( - controller.window(), yaze::app::core::Renderer::GetInstance().renderer()); - ImGui_ImplSDLRenderer2_Init( - yaze::app::core::Renderer::GetInstance().renderer()); + controller.window(), yaze::core::Renderer::GetInstance().renderer()); + ImGui_ImplSDLRenderer2_Init(yaze::core::Renderer::GetInstance().renderer()); test_editor.RegisterTests(engine); ImGuiTestEngine_Start(engine, ImGui::GetCurrentContext()); controller.set_active(true); // Set the default style - yaze::app::gui::ColorsYaze(); + yaze::gui::ColorsYaze(); // Build a new ImGui frame ImGui_ImplSDLRenderer2_NewFrame(); diff --git a/src/test/integration/test_editor.h b/src/test/integration/test_editor.h index c555bd32..87c92f6d 100644 --- a/src/test/integration/test_editor.h +++ b/src/test/integration/test_editor.h @@ -10,7 +10,7 @@ namespace yaze { namespace test { namespace integration { -class TestEditor : public yaze::app::editor::Editor { +class TestEditor : public yaze::editor::Editor { public: TestEditor() = default; ~TestEditor() = default; diff --git a/src/test/mocks/mock_memory.h b/src/test/mocks/mock_memory.h index 44e8ac5e..0c90430d 100644 --- a/src/test/mocks/mock_memory.h +++ b/src/test/mocks/mock_memory.h @@ -9,7 +9,6 @@ #include "app/emu/memory/memory.h" namespace yaze { -namespace app { namespace emu { namespace memory { @@ -223,7 +222,6 @@ class MockMemory : public Memory { } // namespace memory } // namespace emu -} // namespace app } // namespace yaze #endif // YAZE_TEST_MOCK_MOCK_MEMORY_H \ No newline at end of file diff --git a/src/test/rom_test.cc b/src/test/rom_test.cc index 99de8782..382d02e5 100644 --- a/src/test/rom_test.cc +++ b/src/test/rom_test.cc @@ -5,8 +5,8 @@ #include "absl/status/status.h" #include "absl/status/statusor.h" -#include "test/core/testing.h" #include "app/gfx/snes_color.h" +#include "test/core/testing.h" namespace yaze { namespace test { @@ -21,7 +21,7 @@ const static std::vector kMockRomData = { 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, }; -class MockRom : public app::Rom { +class MockRom : public Rom { public: MOCK_METHOD(absl::Status, WriteHelper, (const WriteAction&), (override)); @@ -36,7 +36,7 @@ class MockRom : public app::Rom { class RomTest : public ::testing::Test { protected: - app::Rom rom_; + Rom rom_; }; TEST_F(RomTest, Uninitialized) { @@ -202,9 +202,9 @@ TEST_F(RomTest, WriteTransactionSuccess) { .WillRepeatedly(Return(absl::OkStatus())); EXPECT_OK(mock_rom.WriteTransaction( - app::Rom::WriteAction{0x1000, uint8_t{0xFF}}, - app::Rom::WriteAction{0x1001, uint16_t{0xABCD}}, - app::Rom::WriteAction{0x1002, std::vector{0x12, 0x34}})); + Rom::WriteAction{0x1000, uint8_t{0xFF}}, + Rom::WriteAction{0x1001, uint16_t{0xABCD}}, + Rom::WriteAction{0x1002, std::vector{0x12, 0x34}})); } TEST_F(RomTest, WriteTransactionFailure) { @@ -215,10 +215,10 @@ TEST_F(RomTest, WriteTransactionFailure) { .WillOnce(Return(absl::OkStatus())) .WillOnce(Return(absl::InternalError("Write failed"))); - EXPECT_EQ(mock_rom.WriteTransaction( - app::Rom::WriteAction{0x1000, uint8_t{0xFF}}, - app::Rom::WriteAction{0x1001, uint16_t{0xABCD}}), - absl::InternalError("Write failed")); + EXPECT_EQ( + mock_rom.WriteTransaction(Rom::WriteAction{0x1000, uint8_t{0xFF}}, + Rom::WriteAction{0x1001, uint16_t{0xABCD}}), + absl::InternalError("Write failed")); } TEST_F(RomTest, ReadTransactionSuccess) { diff --git a/src/test/yaze_test.cc b/src/test/yaze_test.cc index f80414ac..dae578e7 100644 --- a/src/test/yaze_test.cc +++ b/src/test/yaze_test.cc @@ -9,9 +9,7 @@ #include "test/integration/test_editor.h" namespace yaze { -namespace test { - -} // namespace test +namespace test {} // namespace test } // namespace yaze int main(int argc, char* argv[]) { diff --git a/src/test/zelda3/dungeon_room_test.cc b/src/test/zelda3/dungeon_room_test.cc index c2211997..0bccce7f 100644 --- a/src/test/zelda3/dungeon_room_test.cc +++ b/src/test/zelda3/dungeon_room_test.cc @@ -1,17 +1,16 @@ -#include "app/zelda3/dungeon/room.h" - -#include "gtest/gtest.h" #include #include #include "app/rom.h" +#include "app/zelda3/dungeon/room.h" +#include "gtest/gtest.h" namespace yaze { namespace test { namespace zelda3 { -class DungeonRoomTest : public ::testing::Test, public app::SharedRom { -protected: +class DungeonRoomTest : public ::testing::Test, public SharedRom { + protected: void SetUp() override { // Skip tests on Linux for automated github builds #if defined(__linux__) @@ -26,12 +25,12 @@ protected: }; TEST_F(DungeonRoomTest, SingleRoomLoadOk) { - app::zelda3::dungeon::Room test_room(/*room_id=*/0); + zelda3::dungeon::Room test_room(/*room_id=*/0); test_room.LoadHeader(); // Do some assertions based on the output in ZS test_room.LoadRoomFromROM(); } -} // namespace zelda3 -} // namespace test -} // namespace yaze +} // namespace zelda3 +} // namespace test +} // namespace yaze diff --git a/src/test/zelda3/message_test.cc b/src/test/zelda3/message_test.cc index c593d187..187ef164 100644 --- a/src/test/zelda3/message_test.cc +++ b/src/test/zelda3/message_test.cc @@ -8,7 +8,7 @@ namespace yaze { namespace test { namespace zelda3 { -class MessageTest : public ::testing::Test, public app::SharedRom { +class MessageTest : public ::testing::Test, public SharedRom { protected: void SetUp() override { #if defined(__linux__) @@ -17,8 +17,8 @@ class MessageTest : public ::testing::Test, public app::SharedRom { } void TearDown() override {} - app::editor::MessageEditor message_editor_; - std::vector dictionary_; + editor::MessageEditor message_editor_; + std::vector dictionary_; }; TEST_F(MessageTest, LoadMessagesFromRomOk) { diff --git a/src/test/zelda3/overworld_test.cc b/src/test/zelda3/overworld_test.cc index fac567c2..5dcd4ac2 100644 --- a/src/test/zelda3/overworld_test.cc +++ b/src/test/zelda3/overworld_test.cc @@ -12,7 +12,7 @@ namespace yaze { namespace test { namespace zelda3 { -class OverworldTest : public ::testing::Test, public app::SharedRom { +class OverworldTest : public ::testing::Test, public SharedRom { protected: void SetUp() override { // Skip tests on Linux for automated github builds @@ -22,12 +22,12 @@ class OverworldTest : public ::testing::Test, public app::SharedRom { } void TearDown() override {} - app::zelda3::overworld::Overworld overworld_; + zelda3::overworld::Overworld overworld_; }; TEST_F(OverworldTest, OverworldLoadNoRomDataError) { // Arrange - app::Rom rom; + Rom rom; // Act auto status = overworld_.Load(rom); @@ -48,9 +48,9 @@ TEST_F(OverworldTest, OverworldLoadRomDataOk) { // Assert EXPECT_TRUE(status.ok()); EXPECT_EQ(overworld_.overworld_maps().size(), - app::zelda3::overworld::kNumOverworldMaps); + zelda3::overworld::kNumOverworldMaps); EXPECT_EQ(overworld_.tiles16().size(), - app::zelda3::overworld::kNumTile16Individual); + zelda3::overworld::kNumTile16Individual); } } // namespace zelda3 diff --git a/src/test/zelda3/sprite_builder_test.cc b/src/test/zelda3/sprite_builder_test.cc index f97ad8c2..271e610b 100644 --- a/src/test/zelda3/sprite_builder_test.cc +++ b/src/test/zelda3/sprite_builder_test.cc @@ -7,7 +7,7 @@ namespace yaze { namespace test { namespace zelda3 { -using namespace yaze::app::zelda3; +using namespace yaze::zelda3; class SpriteBuilderTest : public ::testing::Test { protected: @@ -61,6 +61,6 @@ TEST_F(SpriteBuilderTest, BuildSpritePropertiesOk) { )")); } -} // namespace zelda3_test +} // namespace zelda3 } // namespace test } // namespace yaze \ No newline at end of file diff --git a/src/yaze.cc b/src/yaze.cc index 5af7e32a..8a6137e5 100644 --- a/src/yaze.cc +++ b/src/yaze.cc @@ -7,7 +7,7 @@ void yaze_check_version(const char* version) { printf("Yaze version: %s\n", version); - auto version_check = yaze::app::core::CheckVersion(version); + auto version_check = yaze::core::CheckVersion(version); if (!version_check.ok()) { printf("%s\n", version_check.status().message().data()); exit(1); @@ -41,8 +41,8 @@ yaze_project yaze_load_project(const char* filename) { } z3_rom* yaze_load_rom(const char* filename) { - yaze::app::Rom* internal_rom; - internal_rom = new yaze::app::Rom(); + yaze::Rom* internal_rom; + internal_rom = new yaze::Rom(); if (!internal_rom->LoadFromFile(filename).ok()) { delete internal_rom; return nullptr; @@ -58,7 +58,7 @@ z3_rom* yaze_load_rom(const char* filename) { void yaze_unload_rom(z3_rom* rom) { if (rom->impl) { - delete static_cast(rom->impl); + delete static_cast(rom->impl); } if (rom) { @@ -83,10 +83,10 @@ snes_color yaze_get_color_from_paletteset(const z3_rom* rom, int palette_set, color_struct.blue = 0; if (rom->impl) { - yaze::app::Rom* internal_rom = static_cast(rom->impl); + yaze::Rom* internal_rom = static_cast(rom->impl); auto get_color = internal_rom->palette_group() - .get_group(yaze::app::gfx::kPaletteGroupAddressesKeys[palette_set]) + .get_group(yaze::gfx::kPaletteGroupAddressesKeys[palette_set]) ->palette(palette) .GetColor(color); if (!get_color.ok()) { @@ -105,8 +105,8 @@ z3_overworld* yaze_load_overworld(const z3_rom* rom) { return nullptr; } - yaze::app::Rom* internal_rom = static_cast(rom->impl); - auto internal_overworld = new yaze::app::zelda3::overworld::Overworld(); + yaze::Rom* internal_rom = static_cast(rom->impl); + auto internal_overworld = new yaze::zelda3::overworld::Overworld(); if (!internal_overworld->Load(*internal_rom).ok()) { return nullptr; }