diff --git a/src/app/core/common.cc b/src/app/core/common.cc index 133b916b..d3f4dcb8 100644 --- a/src/app/core/common.cc +++ b/src/app/core/common.cc @@ -1,6 +1,12 @@ #include "common.h" +#include + +#include #include +#include +#include +#include #include namespace yaze { @@ -139,6 +145,9 @@ uint16_t ldle16b_i(uint8_t const *const p_arr, size_t const p_index) { return ldle16b(p_arr + (2 * p_index)); } +// Initialize the static member +std::stack ImGuiIdIssuer::idStack; + } // namespace core } // namespace app } // namespace yaze diff --git a/src/app/core/common.h b/src/app/core/common.h index 9477f0a1..0a99b54a 100644 --- a/src/app/core/common.h +++ b/src/app/core/common.h @@ -1,10 +1,13 @@ #ifndef YAZE_CORE_COMMON_H #define YAZE_CORE_COMMON_H +#include + #include #include #include #include +#include #include namespace yaze { @@ -38,6 +41,9 @@ class ExperimentFlags { // Attempt to run the dungeon room draw routine when opening a room. bool kDrawDungeonRoomGraphics = true; + + // Use the new platform specific file dialog wrappers. + bool kNewFileDialogWrapper = true; }; ExperimentFlags() = default; @@ -164,6 +170,27 @@ class TaskManager { } }; +class ImGuiIdIssuer { + private: + static std::stack idStack; + + public: + // Generate and push a new ID onto the stack + static ImGuiID GetNewID() { + static int counter = 1; // Start from 1 to ensure uniqueness + ImGuiID child_id = ImGui::GetID((void *)(intptr_t)counter++); + idStack.push(child_id); + return child_id; + } + + // Pop all IDs from the stack (can be called explicitly or upon program exit) + static void Cleanup() { + while (!idStack.empty()) { + idStack.pop(); + } + } +}; + uint32_t SnesToPc(uint32_t addr); uint32_t PcToSnes(uint32_t addr);