From 374eebfac44fbac013a217956bcbecd3f3ee71da Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 7 Sep 2024 09:55:01 -0400 Subject: [PATCH] header include cleanup --- src/app/core/project.h | 1 + src/app/editor/code/assembly_editor.cc | 5 ++-- src/app/editor/code/assembly_editor.h | 3 --- src/app/editor/editor_manager.cc | 11 --------- src/app/editor/editor_manager.h | 11 --------- src/app/editor/message/message_data.h | 3 +-- src/app/editor/message/message_editor.cc | 14 ++++------- src/app/editor/message/message_editor.h | 25 ++++++++------------ src/app/editor/overworld/overworld_editor.cc | 5 +--- 9 files changed, 20 insertions(+), 58 deletions(-) diff --git a/src/app/core/project.h b/src/app/core/project.h index cd342751..b5a3ecfc 100644 --- a/src/app/core/project.h +++ b/src/app/core/project.h @@ -10,6 +10,7 @@ #include "absl/status/status.h" #include "absl/strings/match.h" #include "app/core/common.h" +#include "app/core/constants.h" namespace yaze { namespace app { diff --git a/src/app/editor/code/assembly_editor.cc b/src/app/editor/code/assembly_editor.cc index fb78f06e..99b95596 100644 --- a/src/app/editor/code/assembly_editor.cc +++ b/src/app/editor/code/assembly_editor.cc @@ -1,10 +1,9 @@ #include "assembly_editor.h" +#include "ImGuiFileDialog/ImGuiFileDialog.h" #include "ImGuiColorTextEdit/TextEditor.h" #include "app/core/platform/file_dialog.h" #include "app/gui/icons.h" -#include "app/gui/input.h" -#include "core/constants.h" namespace yaze { namespace app { @@ -13,7 +12,7 @@ namespace editor { using core::FileDialogWrapper; namespace { - + std::vector RemoveIgnoredFiles( const std::vector& files, const std::vector& ignored_files) { diff --git a/src/app/editor/code/assembly_editor.h b/src/app/editor/code/assembly_editor.h index b362efa3..7e3cb86a 100644 --- a/src/app/editor/code/assembly_editor.h +++ b/src/app/editor/code/assembly_editor.h @@ -1,12 +1,9 @@ #ifndef YAZE_APP_EDITOR_ASSEMBLY_EDITOR_H #define YAZE_APP_EDITOR_ASSEMBLY_EDITOR_H -#include -#include #include #include "ImGuiColorTextEdit/TextEditor.h" -#include "ImGuiFileDialog/ImGuiFileDialog.h" #include "app/core/common.h" #include "app/editor/utils/editor.h" #include "app/gui/style.h" diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index 64fbfeb7..d1eba76b 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -1,12 +1,9 @@ #include "editor_manager.h" -#include "ImGuiColorTextEdit/TextEditor.h" -#include "ImGuiFileDialog/ImGuiFileDialog.h" #include "absl/status/status.h" #include "absl/strings/match.h" #include "app/core/constants.h" #include "app/core/platform/file_dialog.h" -#include "app/core/platform/renderer.h" #include "app/editor/code/assembly_editor.h" #include "app/editor/dungeon/dungeon_editor.h" #include "app/editor/graphics/graphics_editor.h" @@ -18,20 +15,12 @@ #include "app/editor/utils/flags.h" #include "app/editor/utils/recent_files.h" #include "app/emu/emulator.h" -#include "app/gfx/snes_palette.h" -#include "app/gfx/snes_tile.h" -#include "app/gui/canvas.h" #include "app/gui/icons.h" #include "app/gui/input.h" #include "app/gui/style.h" #include "app/rom.h" -#include "incl/extension.h" -#include "imgui/backends/imgui_impl_sdl2.h" -#include "imgui/backends/imgui_impl_sdlrenderer2.h" #include "imgui/imgui.h" #include "imgui/misc/cpp/imgui_stdlib.h" -#include "imgui_internal.h" -#include "imgui_memory_editor.h" namespace yaze { namespace app { diff --git a/src/app/editor/editor_manager.h b/src/app/editor/editor_manager.h index 11838de3..5e5d7cb6 100644 --- a/src/app/editor/editor_manager.h +++ b/src/app/editor/editor_manager.h @@ -3,10 +3,7 @@ #define IMGUI_DEFINE_MATH_OPERATORS -#include "ImGuiColorTextEdit/TextEditor.h" -#include "ImGuiFileDialog/ImGuiFileDialog.h" #include "absl/status/status.h" -#include "app/core/constants.h" #include "app/core/message.h" #include "app/core/project.h" #include "app/editor/code/assembly_editor.h" @@ -22,18 +19,10 @@ #include "app/editor/system/constant_manager.h" #include "app/editor/system/extension_manager.h" #include "app/editor/system/settings_editor.h" -#include "app/editor/utils/gfx_context.h" #include "app/emu/emulator.h" -#include "app/gfx/snes_palette.h" -#include "app/gfx/snes_tile.h" -#include "app/gui/canvas.h" -#include "app/gui/icons.h" #include "app/gui/input.h" #include "app/rom.h" -#include "incl/extension.h" #include "imgui/imgui.h" -#include "imgui/misc/cpp/imgui_stdlib.h" -#include "imgui_memory_editor.h" #include "yaze.h" namespace yaze { diff --git a/src/app/editor/message/message_data.h b/src/app/editor/message/message_data.h index 922cb545..f6f80c5e 100644 --- a/src/app/editor/message/message_data.h +++ b/src/app/editor/message/message_data.h @@ -1,7 +1,6 @@ #ifndef YAZE_APP_EDITOR_MESSAGE_MESSAGE_DATA_H #define YAZE_APP_EDITOR_MESSAGE_MESSAGE_DATA_H -#include #include #include #include @@ -240,4 +239,4 @@ std::vector ParseMessageToData(std::string str); } // namespace app } // namespace yaze -#endif // YAZE_APP_EDITOR_MESSAGE_MESSAGE_DATA_H \ No newline at end of file +#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 da31d0c3..3093ba15 100644 --- a/src/app/editor/message/message_editor.cc +++ b/src/app/editor/message/message_editor.cc @@ -28,11 +28,9 @@ namespace editor { using core::Renderer; -using ImGui::Begin; using ImGui::BeginChild; using ImGui::BeginTable; using ImGui::Button; -using ImGui::End; using ImGui::EndChild; using ImGui::EndTable; using ImGui::InputText; @@ -41,14 +39,12 @@ using ImGui::SameLine; using ImGui::Separator; using ImGui::TableHeadersRow; using ImGui::TableNextColumn; -using ImGui::TableNextRow; using ImGui::TableSetupColumn; using ImGui::Text; using ImGui::TextWrapped; -using ImGui::TreeNode; absl::Status MessageEditor::Initialize() { - for (int i = 0; i < 100; i++) { + for (int i = 0; i < kWidthArraySize; i++) { width_array[i] = rom()->data()[kCharactersWidth + i]; } @@ -70,15 +66,15 @@ absl::Status MessageEditor::Initialize() { RETURN_IF_ERROR(Renderer::GetInstance().CreateAndRenderBitmap( 128, 128, 8, font_gfx16_data_, font_gfx_bitmap_, font_preview_colors_)) - current_font_gfx16_data_.reserve(172 * 4096); - for (int i = 0; i < 172 * 4096; i++) { + current_font_gfx16_data_.reserve(kCurrentMessageWidth * kCurrentMessageHeight); + for (int i = 0; i < kCurrentMessageWidth * kCurrentMessageHeight; i++) { current_font_gfx16_data_.push_back(0); } // 8bpp RETURN_IF_ERROR(Renderer::GetInstance().CreateAndRenderBitmap( - 172, 4096, 64, current_font_gfx16_data_, current_font_gfx16_bitmap_, - font_preview_colors_)) + kCurrentMessageWidth, kCurrentMessageHeight, 64, current_font_gfx16_data_, + current_font_gfx16_bitmap_, font_preview_colors_)) gfx::SnesPalette color_palette = font_gfx_bitmap_.palette(); for (int i = 0; i < font_preview_colors_.size(); i++) { diff --git a/src/app/editor/message/message_editor.h b/src/app/editor/message/message_editor.h index ab210f72..0e12f2be 100644 --- a/src/app/editor/message/message_editor.h +++ b/src/app/editor/message/message_editor.h @@ -1,22 +1,15 @@ #ifndef YAZE_APP_EDITOR_MESSAGE_EDITOR_H #define YAZE_APP_EDITOR_MESSAGE_EDITOR_H -#include -#include -#include #include -#include #include #include "absl/status/status.h" #include "absl/strings/str_format.h" -#include "absl/strings/str_replace.h" -#include "absl/strings/str_split.h" #include "app/editor/message/message_data.h" #include "app/editor/utils/editor.h" #include "app/gfx/bitmap.h" #include "app/gui/canvas.h" -#include "app/gui/icons.h" #include "app/rom.h" namespace yaze { @@ -32,9 +25,12 @@ constexpr int kPointersDictionaries = 0x74703; constexpr int kCharactersWidth = 0x74ADF; constexpr int kNumDictionaryEntries = 97; constexpr int kNumMessages = 396; +constexpr int kCurrentMessageWidth = 172; +constexpr int kCurrentMessageHeight = 4096; +constexpr uint8_t kWidthArraySize = 100; constexpr uint8_t kBlockTerminator = 0x80; -constexpr uint8_t BANKID = 0x80; +constexpr uint8_t kMessageBankChangeId = 0x80; constexpr uint8_t kScrollVertical = 0x73; constexpr uint8_t kLine1 = 0x74; constexpr uint8_t kLine2 = 0x75; @@ -117,27 +113,26 @@ class MessageEditor : public Editor, public SharedRom { int text_position_ = 0; int shown_lines_ = 0; - uint8_t width_array[100]; + uint8_t width_array[kWidthArraySize]; std::string search_text_ = ""; - std::vector list_of_texts_; + std::vector font_gfx16_data_; + std::vector current_font_gfx16_data_; std::vector parsed_messages_; + std::vector list_of_texts_; + MessageData current_message_; - std::vector font_gfx16_data_; - std::vector current_font_gfx16_data_; - gfx::Bitmap font_gfx_bitmap_; gfx::Bitmap current_font_gfx16_bitmap_; + gfx::SnesPalette font_preview_colors_; gui::Canvas font_gfx_canvas_{"##FontGfxCanvas", ImVec2(128, 128)}; gui::Canvas current_font_gfx16_canvas_{"##CurrentMessageGfx", ImVec2(172, 4096)}; - gfx::SnesPalette font_preview_colors_; - struct TextBox { std::string text; std::string buffer; diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 5ce06099..7ef21b18 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -2,11 +2,9 @@ #include #include +#include -#include "ImGuiFileDialog/ImGuiFileDialog.h" -#include "absl/container/flat_hash_map.h" #include "absl/status/status.h" -#include "absl/status/statusor.h" #include "absl/strings/str_format.h" #include "app/core/constants.h" #include "app/core/platform/clipboard.h" @@ -15,7 +13,6 @@ #include "app/editor/overworld/entity.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/gui/icons.h" #include "app/gui/input.h"