18 ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
19 ImGui::InputTextWithHint(
"##SongFilter",
ICON_MD_SEARCH " Search songs...",
28 ImGui::TextColored(ImVec4(0.4f, 0.8f, 0.4f, 1.0f),
31 ImGui::TextDisabled(
"Expanded bank at $%06X, Aux at $%06X",
32 info.main_rom_offset, info.aux_rom_offset);
37 static const char* bank_names[] = {
"Overworld",
"Dungeon",
"Credits",
38 "Expanded",
"Auxiliary"};
46 for (
int i = 0; i < num_banks; ++i) {
48 if (space.total_bytes == 0)
continue;
52 if (space.is_critical) {
53 bar_color = ImVec4(0.9f, 0.2f, 0.2f, 1.0f);
54 }
else if (space.is_warning) {
55 bar_color = ImVec4(0.9f, 0.7f, 0.2f, 1.0f);
57 bar_color = ImVec4(0.3f, 0.7f, 0.3f, 1.0f);
60 ImGui::Text(
"%s:", bank_names[i]);
64 ImGui::PushStyleColor(ImGuiCol_PlotHistogram, bar_color);
65 float fraction = space.usage_percent / 100.0f;
66 std::string overlay = absl::StrFormat(
67 "%d / %d bytes (%.1f%%)", space.used_bytes, space.total_bytes,
69 ImGui::ProgressBar(fraction, ImVec2(-1, 0), overlay.c_str());
70 ImGui::PopStyleColor();
73 if (space.is_critical) {
74 ImGui::TextColored(ImVec4(0.9f, 0.3f, 0.3f, 1.0f),
76 }
else if (space.is_warning) {
77 ImGui::TextColored(ImVec4(0.9f, 0.7f, 0.2f, 1.0f),
85 ImGui::TextColored(ImVec4(0.9f, 0.3f, 0.3f, 1.0f),
87 ImGui::TextDisabled(
"Songs won't fit in ROM. Remove or shorten songs.");
89 ImGui::TextColored(ImVec4(0.4f, 0.8f, 0.4f, 1.0f),
93 ImGui::Unindent(8.0f);
114 ImGui::BeginChild(
"SongList", ImVec2(0, 0),
true);
118 ImGuiTreeNodeFlags_DefaultOpen)) {
120 const auto* song = bank.
GetSong(
static_cast<int>(i));
121 if (!song || !bank.
IsVanilla(
static_cast<int>(i)))
continue;
124 std::string display_name = absl::StrFormat(
"%02X: %s", i + 1, song->name);
131 if (ImGui::Selectable(label.c_str(), is_selected)) {
139 if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
146 if (ImGui::BeginPopupContextItem()) {
168 if (ImGui::CollapsingHeader(
ICON_MD_EDIT " Custom Songs",
169 ImGuiTreeNodeFlags_DefaultOpen)) {
170 bool has_custom =
false;
172 const auto* song = bank.
GetSong(
static_cast<int>(i));
173 if (!song || bank.
IsVanilla(
static_cast<int>(i)))
continue;
178 std::string display_name = absl::StrFormat(
"%02X: %s", i + 1, song->name);
187 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.6f, 0.9f, 0.6f, 1.0f));
188 if (ImGui::Selectable(label.c_str(), is_selected)) {
194 ImGui::PopStyleColor();
197 if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) {
204 if (ImGui::BeginPopupContextItem()) {
240 ImGui::TextDisabled(
"No custom songs yet");
241 ImGui::TextDisabled(
"Click 'New Song' or duplicate a vanilla song");
252 std::string lower_name = name;
254 std::transform(lower_name.begin(), lower_name.end(), lower_name.begin(),
256 std::transform(lower_search.begin(), lower_search.end(), lower_search.begin(),
259 return lower_name.find(lower_search) != std::string::npos;