From b3458b56db1e8834f73ae79e152cba30d907d178 Mon Sep 17 00:00:00 2001 From: Justin Scofield <47263509+scawful@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:04:02 -0400 Subject: [PATCH] Update params for InputHex and InputHexShort From int to uint64_t and uint32_t respectively --- src/app/editor/graphics_editor.cc | 6 ++---- src/app/editor/graphics_editor.h | 16 +++++++++------- src/app/editor/screen_editor.cc | 2 -- src/app/gui/input.cc | 4 ++-- src/app/gui/input.h | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/app/editor/graphics_editor.cc b/src/app/editor/graphics_editor.cc index 73a3f61c..bb705e74 100644 --- a/src/app/editor/graphics_editor.cc +++ b/src/app/editor/graphics_editor.cc @@ -122,8 +122,6 @@ absl::Status GraphicsEditor::DrawCgxImport() { } absl::Status GraphicsEditor::DrawFileImport() { - static int size = 0; - gui::TextWithSeparators("BIN Import"); ImGui::InputText("##ROMFile", file_path_, sizeof(file_path_)); @@ -142,11 +140,11 @@ absl::Status GraphicsEditor::DrawFileImport() { [&]() -> auto { ImGui::SetClipboardText(file_path_); }); gui::InputHex("BIN Offset", ¤t_offset_); - gui::InputHex("BIN Size", &size); + gui::InputHex("BIN Size", &bin_size_); if (ImGui::Button("Decompress BIN")) { if (strlen(file_path_) > 0) { - RETURN_IF_ERROR(DecompressImportData(size)) + RETURN_IF_ERROR(DecompressImportData(bin_size_)) } else { return absl::InvalidArgumentError( "Please select a file before importing."); diff --git a/src/app/editor/graphics_editor.h b/src/app/editor/graphics_editor.h index efc3fec7..fb501175 100644 --- a/src/app/editor/graphics_editor.h +++ b/src/app/editor/graphics_editor.h @@ -80,15 +80,17 @@ class GraphicsEditor { absl::Status DecompressSuperDonkey(); - int current_offset_ = 0; - int current_size_ = 0; + uint64_t current_offset_ = 0; + uint64_t current_size_ = 0; int current_palette_ = 0; - int current_palette_index_ = 0; - - int num_sheets_to_load_ = 1; + uint64_t current_palette_index_ = 0; - int clipboard_offset_ = 0; - int clipboard_size_ = 0; + uint64_t num_sheets_to_load_ = 1; + + uint64_t bin_size_ = 0; + + uint64_t clipboard_offset_ = 0; + uint64_t clipboard_size_ = 0; bool open_memory_editor_ = false; bool gfx_loaded_ = false; diff --git a/src/app/editor/screen_editor.cc b/src/app/editor/screen_editor.cc index 37a01f68..119a6055 100644 --- a/src/app/editor/screen_editor.cc +++ b/src/app/editor/screen_editor.cc @@ -138,8 +138,6 @@ void ScreenEditor::DrawMosaicEditor() { ImGui::EndTable(); } - gui::InputHex("Routine Location", &overworldCustomMosaicASM); - END_TAB_ITEM() } diff --git a/src/app/gui/input.cc b/src/app/gui/input.cc index add939c9..e5c52c3d 100644 --- a/src/app/gui/input.cc +++ b/src/app/gui/input.cc @@ -11,13 +11,13 @@ namespace gui { const int kStepOneHex = 0x01; const int kStepFastHex = 0x0F; -bool InputHex(const char* label, int* data) { +bool InputHex(const char* label, uint64_t* data) { return ImGui::InputScalar(label, ImGuiDataType_U64, data, &kStepOneHex, &kStepFastHex, "%06X", ImGuiInputTextFlags_CharsHexadecimal); } -bool InputHexShort(const char* label, int* data) { +bool InputHexShort(const char* label, uint32_t* data) { return ImGui::InputScalar(label, ImGuiDataType_U32, data, &kStepOneHex, &kStepFastHex, "%06X", ImGuiInputTextFlags_CharsHexadecimal); diff --git a/src/app/gui/input.h b/src/app/gui/input.h index fc3a147b..e7555f02 100644 --- a/src/app/gui/input.h +++ b/src/app/gui/input.h @@ -15,8 +15,8 @@ namespace gui { constexpr ImVec2 kDefaultModalSize = ImVec2(200, 0); constexpr ImVec2 kZeroPos = ImVec2(0, 0); -IMGUI_API bool InputHex(const char* label, int* data); -IMGUI_API bool InputHexShort(const char* label, int* data); +IMGUI_API bool InputHex(const char* label, uint64_t* data); +IMGUI_API bool InputHexShort(const char* label, uint32_t* data); using ItemLabelFlags = enum ItemLabelFlag { Left = 1u << 0u,