- Added a new Music tab in the Map Properties panel for editing music tracks associated with different game states. - Implemented functionality to save music data for both Light and Dark World maps. - Updated feature flags to enable custom overworld features based on ASM version, improving flexibility for ROM modifications. - Enhanced UI elements with tooltips and popups for better user guidance on custom overworld settings.
176 lines
6.0 KiB
C++
176 lines
6.0 KiB
C++
#ifndef YAZE_APP_CORE_FEATURES_H
|
|
#define YAZE_APP_CORE_FEATURES_H
|
|
|
|
#include <string>
|
|
|
|
#include "imgui/imgui.h"
|
|
|
|
namespace yaze {
|
|
namespace core {
|
|
|
|
/**
|
|
* @class FeatureFlags
|
|
* @brief A class to manage experimental feature flags.
|
|
*/
|
|
class FeatureFlags {
|
|
public:
|
|
struct Flags {
|
|
// Log instructions to the GUI debugger.
|
|
bool kLogInstructions = true;
|
|
|
|
// Flag to enable the saving of all palettes to the Rom.
|
|
bool kSaveAllPalettes = false;
|
|
|
|
// Flag to enable the saving of gfx groups to the rom.
|
|
bool kSaveGfxGroups = false;
|
|
|
|
// Flag to enable the change queue, which could have any anonymous
|
|
// save routine for the Rom. In practice, just the overworld tilemap
|
|
// and tile32 save.
|
|
bool kSaveWithChangeQueue = false;
|
|
|
|
// Save dungeon map edits to the Rom.
|
|
bool kSaveDungeonMaps = false;
|
|
|
|
// Save graphics sheet to the Rom.
|
|
bool kSaveGraphicsSheet = false;
|
|
|
|
// Log to the console.
|
|
bool kLogToConsole = false;
|
|
|
|
// Use NFD (Native File Dialog) instead of bespoke file dialog implementation.
|
|
#if defined(YAZE_ENABLE_NFD) && YAZE_ENABLE_NFD
|
|
bool kUseNativeFileDialog = true;
|
|
#else
|
|
bool kUseNativeFileDialog = false;
|
|
#endif
|
|
|
|
// Overworld flags
|
|
struct Overworld {
|
|
// Load and render overworld sprites to the screen. Unstable.
|
|
bool kDrawOverworldSprites = false;
|
|
|
|
// Save overworld map edits to the Rom.
|
|
bool kSaveOverworldMaps = true;
|
|
|
|
// Save overworld entrances to the Rom.
|
|
bool kSaveOverworldEntrances = true;
|
|
|
|
// Save overworld exits to the Rom.
|
|
bool kSaveOverworldExits = true;
|
|
|
|
// Save overworld items to the Rom.
|
|
bool kSaveOverworldItems = true;
|
|
|
|
// Save overworld properties to the Rom.
|
|
bool kSaveOverworldProperties = true;
|
|
|
|
// Enable custom overworld features for vanilla ROMs or override detection.
|
|
// If ZSCustomOverworld ASM is already applied, features are auto-enabled.
|
|
bool kLoadCustomOverworld = false;
|
|
|
|
// Apply ZSCustomOverworld ASM patches when upgrading ROM versions.
|
|
bool kApplyZSCustomOverworldASM = false;
|
|
} overworld;
|
|
};
|
|
|
|
static Flags &get() {
|
|
static Flags instance;
|
|
return instance;
|
|
}
|
|
|
|
std::string Serialize() const {
|
|
std::string result;
|
|
result +=
|
|
"kLogInstructions: " + std::to_string(get().kLogInstructions) + "\n";
|
|
result +=
|
|
"kSaveAllPalettes: " + std::to_string(get().kSaveAllPalettes) + "\n";
|
|
result += "kSaveGfxGroups: " + std::to_string(get().kSaveGfxGroups) + "\n";
|
|
result +=
|
|
"kSaveWithChangeQueue: " + std::to_string(get().kSaveWithChangeQueue) +
|
|
"\n";
|
|
result +=
|
|
"kSaveDungeonMaps: " + std::to_string(get().kSaveDungeonMaps) + "\n";
|
|
result += "kLogToConsole: " + std::to_string(get().kLogToConsole) + "\n";
|
|
result += "kDrawOverworldSprites: " +
|
|
std::to_string(get().overworld.kDrawOverworldSprites) + "\n";
|
|
result += "kSaveOverworldMaps: " +
|
|
std::to_string(get().overworld.kSaveOverworldMaps) + "\n";
|
|
result += "kSaveOverworldEntrances: " +
|
|
std::to_string(get().overworld.kSaveOverworldEntrances) + "\n";
|
|
result += "kSaveOverworldExits: " +
|
|
std::to_string(get().overworld.kSaveOverworldExits) + "\n";
|
|
result += "kSaveOverworldItems: " +
|
|
std::to_string(get().overworld.kSaveOverworldItems) + "\n";
|
|
result += "kSaveOverworldProperties: " +
|
|
std::to_string(get().overworld.kSaveOverworldProperties) + "\n";
|
|
result += "kLoadCustomOverworld: " +
|
|
std::to_string(get().overworld.kLoadCustomOverworld) + "\n";
|
|
result += "kApplyZSCustomOverworldASM: " +
|
|
std::to_string(get().overworld.kApplyZSCustomOverworldASM) + "\n";
|
|
result += "kUseNativeFileDialog: " +
|
|
std::to_string(get().kUseNativeFileDialog) + "\n";
|
|
return result;
|
|
}
|
|
};
|
|
|
|
using ImGui::BeginMenu;
|
|
using ImGui::Checkbox;
|
|
using ImGui::EndMenu;
|
|
using ImGui::MenuItem;
|
|
using ImGui::Separator;
|
|
|
|
struct FlagsMenu {
|
|
void DrawOverworldFlags() {
|
|
Checkbox("Enable Overworld Sprites",
|
|
&FeatureFlags::get().overworld.kDrawOverworldSprites);
|
|
Separator();
|
|
Checkbox("Save Overworld Maps",
|
|
&FeatureFlags::get().overworld.kSaveOverworldMaps);
|
|
Checkbox("Save Overworld Entrances",
|
|
&FeatureFlags::get().overworld.kSaveOverworldEntrances);
|
|
Checkbox("Save Overworld Exits",
|
|
&FeatureFlags::get().overworld.kSaveOverworldExits);
|
|
Checkbox("Save Overworld Items",
|
|
&FeatureFlags::get().overworld.kSaveOverworldItems);
|
|
Checkbox("Save Overworld Properties",
|
|
&FeatureFlags::get().overworld.kSaveOverworldProperties);
|
|
Checkbox("Enable Custom Overworld Features",
|
|
&FeatureFlags::get().overworld.kLoadCustomOverworld);
|
|
ImGui::SameLine();
|
|
if (ImGui::Button("?")) {
|
|
ImGui::OpenPopup("CustomOverworldHelp");
|
|
}
|
|
if (ImGui::BeginPopup("CustomOverworldHelp")) {
|
|
ImGui::Text("This flag enables ZSCustomOverworld features.");
|
|
ImGui::Text("If ZSCustomOverworld ASM is already applied to the ROM,");
|
|
ImGui::Text("features are auto-enabled regardless of this flag.");
|
|
ImGui::Text("For vanilla ROMs, enable this to use custom features.");
|
|
ImGui::EndPopup();
|
|
}
|
|
Checkbox("Apply ZSCustomOverworld ASM",
|
|
&FeatureFlags::get().overworld.kApplyZSCustomOverworldASM);
|
|
}
|
|
|
|
void DrawDungeonFlags() {
|
|
Checkbox("Save Dungeon Maps", &FeatureFlags::get().kSaveDungeonMaps);
|
|
}
|
|
|
|
void DrawResourceFlags() {
|
|
Checkbox("Save All Palettes", &FeatureFlags::get().kSaveAllPalettes);
|
|
Checkbox("Save Gfx Groups", &FeatureFlags::get().kSaveGfxGroups);
|
|
Checkbox("Save Graphics Sheets", &FeatureFlags::get().kSaveGraphicsSheet);
|
|
}
|
|
|
|
void DrawSystemFlags() {
|
|
Checkbox("Enable Console Logging", &FeatureFlags::get().kLogToConsole);
|
|
Checkbox("Log Instructions to Emulator Debugger",
|
|
&FeatureFlags::get().kLogInstructions);
|
|
Checkbox("Use Native File Dialog (NFD)", &FeatureFlags::get().kUseNativeFileDialog);
|
|
}
|
|
};
|
|
|
|
} // namespace core
|
|
} // namespace yaze
|
|
|
|
#endif // YAZE_APP_CORE_FEATURES_H
|