11 if (!ImGui::CollapsingHeader(
"Import graphics pack",
12 ImGuiTreeNodeFlags_DefaultOpen))
18 if (ImGui::Button(
"Browse pack")) {
26 if (ImGui::Button(
"Load pack")) {
34 asset->width * asset->height;
35 for (
size_t i = 0; i < asset->palettes.size(); ++i)
37 {asset->palettes[i].id, static_cast<int>(5 + i), -1,
38 static_cast<int>(asset->palettes[i].characters.size() / 32 + 32)});
49 binding.resource_first_character = -1;
50 for (
const auto& slice : resource->slices)
52 slice.source_offset == 0 &&
53 slice.byte_count == resource->pending_bytes.size())
54 binding.resource_first_character = slice.first_character();
58 "Choose destination ranges you own. Unreferenced characters and tiles "
59 "are not automatically allocated.");
60 for (
auto& palette : binding.palettes) {
61 ImGui::PushID(palette.palette.c_str());
62 ImGui::Text(
"%s", palette.palette.c_str());
63 changed |= ImGui::InputInt(
"BG palette row", &palette.bg_row);
64 changed |= ImGui::InputScalar(
"First BG character (hex)", ImGuiDataType_S32,
65 &palette.first_character,
nullptr,
nullptr,
66 "%03X", ImGuiInputTextFlags_CharsHexadecimal);
67 changed |= ImGui::InputInt(
"Owned character count",
68 &palette.owned_character_count);
71 changed |= ImGui::InputScalar(
"First Tile16 (hex)", ImGuiDataType_S32,
72 &binding.first_tile16,
nullptr,
nullptr,
"%03X",
73 ImGuiInputTextFlags_CharsHexadecimal);
74 changed |= ImGui::InputInt(
"Owned Tile16 count", &binding.owned_tile16_count);
75 changed |= ImGui::InputInt(
"Area anchor X (Tile16)", &binding.anchor_x);
76 changed |= ImGui::InputInt(
"Area anchor Y (Tile16)", &binding.anchor_y);
81 if (ImGui::Button(
"Preview import")) {
90 ImGui::Text(
"%zu characters, %zu Tile16 definitions, %zu palette colors",
91 plan.replacements.size(), plan.definitions.size(),
92 plan.palette_changes.size());
93 for (
const auto& note : plan.notes)
94 ImGui::TextWrapped(
"%s", note.c_str());
95 if (ImGui::TreeNode(
"Palette records to replace")) {
96 for (
const auto& color : plan.palette_changes)
97 ImGui::Text(
"%s[%d][%d]: $%04X -> $%04X", color.group_name.c_str(),
98 color.palette_index, color.color_index,
99 color.original_color.snes(), color.new_color.snes());
103 "I reviewed the destination ranges and shared palette records",
106 if (ImGui::Button(
"Import graphics and Tile16"))
109 ImGui::EndDisabled();
112 if (ImGui::Button(
"Place at area anchor")) {
115 (parent % 8) * 32 + binding.anchor_x,
116 ((parent % 64) / 8) * 32 + binding.anchor_y);
119 "Use the main Undo/Redo for imported graphics and placement. Publish "
120 "graphics before Save ROM.");