3#include "absl/strings/str_format.h"
8#include "imgui/imgui.h"
16 "Vanilla ROM Hack",
"ZSCustomOverworld v2",
17 "ZSCustomOverworld v3 (Recommended)",
"Randomizer Compatible"};
20 "Standard ROM editing without custom ASM. Limited to vanilla features.",
21 "Basic overworld expansion: custom BG colors, main palettes, parent "
23 "Full overworld expansion: wide/tall areas, animated GFX, overlays, all "
25 "Compatible with ALttP Randomizer. Minimal custom features."};
52 Open(rom, rom_filename,
false);
56 bool suggest_project_creation) {
82 std::string base_name;
83 if (last_slash != std::string::npos) {
88 if (last_dot != std::string::npos && last_dot > last_slash) {
89 base_name = base_name.substr(0, base_name.find_last_of(
'.'));
119 ImGui::SetNextWindowSize(ImVec2(600, 500), ImGuiCond_FirstUseEver);
120 ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(),
121 ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
123 ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse;
170 const char* version_name =
173 ImVec4 version_color;
176 version_color = ImVec4(0.8f, 0.8f, 0.2f, 1.0f);
181 ImVec4(0.2f, 0.6f, 0.8f, 1.0f);
184 version_color = ImVec4(0.2f, 0.8f, 0.4f, 1.0f);
187 version_color = ImVec4(0.5f, 0.5f, 0.5f, 1.0f);
195 ImGui::TextColored(ImVec4(1.0f, 0.6f, 0.2f, 1.0f),
196 "%s This ROM can be upgraded for expanded features",
208 ImGui::Checkbox(
"Upgrade ROM to ZSCustomOverworld",
214 ImGui::Text(
"Target Version:");
226 ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
227 "v2: BG colors, main palettes, parent system");
228 ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
229 "v3: + wide/tall areas, animated GFX, overlays");
234 ImGui::TextColored(ImVec4(1.0f, 0.8f, 0.2f, 1.0f),
"Experimental:");
235 ImGui::Checkbox(
"Enable special world tail (0xA0-0xBF)",
237 if (ImGui::IsItemHovered()) {
239 "Enables access to unused special world map slots.\n"
240 "REQUIRES additional ASM patch for pointer table expansion.\n"
241 "Without the patch, maps will show blank tiles (safe).");
249 ImVec4(0.5f, 0.8f, 0.5f, 1.0f),
256 ImGui::Checkbox(
"Enable custom overworld features in editor",
259 if (ImGui::IsItemHovered()) {
261 "Enables ZSCustomOverworld-specific UI elements.\n"
262 "Auto-enabled if ASM is detected in ROM.");
271 if (ImGui::BeginCombo(
"##PresetCombo",
280 if (ImGui::IsItemHovered()) {
285 ImGui::SetItemDefaultFocus();
292 ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
"%s",
298 :
"Show Advanced Options")) {
308 if (ImGui::TreeNodeEx(
"Overworld", ImGuiTreeNodeFlags_DefaultOpen)) {
317 if (ImGui::TreeNodeEx(
"Dungeon")) {
323 if (ImGui::TreeNodeEx(
"Graphics")) {
339 ImGui::Text(
"Project Name:");
340 ImGui::SetNextItemWidth(-1);
346 ImVec4(0.6f, 0.6f, 0.6f, 1.0f),
347 "Project file stores settings, labels, and preferences.");
354 const float button_width = 120.0f;
355 const float spacing = 10.0f;
356 float total_width = button_width * 2 + spacing;
359 float avail = ImGui::GetContentRegionAvail().x;
360 ImGui::SetCursorPosX((avail - total_width) * 0.5f + ImGui::GetCursorPosX());
363 if (ImGui::Button(
"Cancel", ImVec2(button_width, 0))) {
368 ImGui::SameLine(0, spacing);
376 {{ImGuiCol_Button, accent},
377 {ImGuiCol_ButtonHovered,
378 ImVec4(accent.x * 1.1f, accent.y * 1.1f, accent.z * 1.1f, accent.w)},
379 {ImGuiCol_ButtonActive, ImVec4(accent.x * 0.9f, accent.y * 0.9f,
380 accent.z * 0.9f, accent.w)}});
382 if (ImGui::Button(absl::StrFormat(
"%s Continue",
ICON_MD_CHECK).c_str(),
383 ImVec2(button_width, 0))) {
405 if (preset_name ==
"Vanilla ROM Hack") {
415 }
else if (preset_name ==
"ZSCustomOverworld v2") {
427 }
else if (preset_name ==
"ZSCustomOverworld v3 (Recommended)") {
439 }
else if (preset_name ==
"Randomizer Compatible") {
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
std::function< void(const LoadOptions &) confirm_callback_)
void ApplyPreset(const std::string &preset_name)
void Open(Rom *rom, const std::string &rom_filename)
Open the dialog after ROM detection.
int selected_preset_index_
static const char * kPresetNames[kNumPresets]
zelda3::OverworldVersion detected_version_
char project_name_buffer_[256]
std::function< absl::Status(int version)> upgrade_callback_
void DrawFeatureFlagDetails()
bool Show(bool *p_open)
Show the dialog.
void DrawUpgradeOptions()
void DrawFeatureFlagPresets()
void DrawProjectOptions()
static const char * kPresetDescriptions[kNumPresets]
std::string rom_filename_
static constexpr int kNumPresets
bool ShouldPromptUpgrade() const
Check if ROM needs upgrade prompt.
void ApplyOptionsToFeatureFlags()
void Draw(bool *p_open)
Draw the dialog (wrapper around Show)
RAII guard for ImGui style colors.
const Theme & GetCurrentTheme() const
static ThemeManager & Get()
static OverworldVersion GetVersion(const Rom &rom)
Detect ROM version from ASM marker byte.
static const char * GetVersionName(OverworldVersion version)
Get human-readable version name for display/logging.
#define ICON_MD_AUTO_FIX_HIGH
#define ICON_MD_CHECK_CIRCLE
ImVec4 ConvertColorToImVec4(const Color &color)
@ kZSCustomV2
Parent system, BG colors, main palettes.
@ kZSCustomV1
Basic features, expanded pointers.
@ kVanilla
0xFF in ROM, no ZScream ASM applied
@ kZSCustomV3
Area enum, wide/tall areas, all features.
bool enable_tail_expansion
bool save_overworld_items
std::string selected_preset
bool save_overworld_exits
bool enable_custom_overworld
bool save_overworld_entrances