19 inline constexpr std::uint32_t
OkayTextId = 933;
49 if (!resources)
return std::unexpected(
"Options save dialog has no resources");
50 const auto language =
resources->language();
51 if (!language || !language->catalog)
52 return std::unexpected(
"Options save dialog has no language catalog");
54 if (!
text)
return std::unexpected(
text.error().detail);
58 [[
nodiscard]] std::expected<data::LegacyBitmapRGBA8, std::string>
63 if (
text.empty())
return result;
65 result,
text,
x,
y, 0x00FFFFFFU);
71 const SaveRuntimeState&
state, std::size_t
slot)
74 state.selectedSlot ==
static_cast<int>(
slot))
81 return state.slots[
slot].metadata.description;
86 std::expected<void, std::string> SavePlayback::ensureTextSurfaces(
90 return std::unexpected(
"Options save dialog font runtime is not ready");
91 for (
auto& surface : slotText_)
93 if (surface)
continue;
102 if (!
text)
return std::unexpected(
text.error());
109 const auto updated =
playback.runtimeBitmaps().update(*okayText_, *
rendered);
110 if (!updated)
return std::unexpected(updated.error());
116 if (!
text)
return std::unexpected(
text.error());
123 const auto updated =
playback.runtimeBitmaps().update(*cancelText_, *
rendered);
124 if (!updated)
return std::unexpected(updated.error());
130 std::expected<void, std::string> SavePlayback::refreshTextSurfaces(
141 if (!
image)
return std::unexpected(
image.error());
142 const auto updated =
playback.runtimeBitmaps().update(
144 if (!updated)
return std::unexpected(updated.error());
156 std::expected<void, std::string> SavePlayback::show(
161 if (!resources)
return std::unexpected(
"Options save dialog has no resources");
172 const bool selected =
state.selectedSlot ==
static_cast<int>(
slot);
175 slotBackgrounds_[
slot] = background;
176 const auto top = 100 +
static_cast<int>(
slot) * 68;
177 const auto started =
playback.startXY(
178 background,
static_cast<std::uint16_t
>(100 +
slot), 100,
top);
179 if (!started)
return std::unexpected(started.error());
183 152, 112 +
static_cast<int>(
slot) * 68);
195 mode_ =
state.dialog;
196 selectedSlot_ =
state.selectedSlot;
197 revision_ =
state.revision;
201 std::expected<void, std::string> SavePlayback::hide(
204 if (!visible_)
return {};
208 if (!stopped)
return std::unexpected(stopped.error());
213 slotBackgrounds_[
slot],
static_cast<std::uint16_t
>(100 +
slot));
225 if (!stopped)
return std::unexpected(stopped.error());
230 if (!stopped)
return std::unexpected(stopped.error());
240 std::expected<void, std::string> SavePlayback::refreshSelection(
241 const SaveRuntimeState&
state, engine::SequencePlayback&
playback)
243 if (
state.selectedSlot == selectedSlot_)
return {};
246 const bool selected =
state.selectedSlot ==
static_cast<int>(
slot);
250 const auto priority =
static_cast<std::uint16_t
>(100 +
slot);
251 const auto top = 100 +
static_cast<int>(
slot) * 68;
257 selectedSlot_ =
state.selectedSlot;
272 return std::unexpected(
"Options save dialog has no font runtime");
274 if (!visible_ || mode_ !=
state.dialog)
285 if (!selection)
return selection;
286 if (revision_ !=
state.revision)
290 revision_ =
state.revision;
302 slotBackgrounds_ = {};
std::expected< void, std::string > sync(const SaveRuntimeState &state, display::Screen2D desiredView, fonts::Runtime *fontRuntime, engine::SequencePlayback &playback)
constexpr DataId packDataId(std::uint16_t group, DataTag tag) noexcept
constexpr std::size_t SaveSlotCount
std::shared_ptr< const data::ResourceSnapshot > resources() noexcept
constexpr data::DataId mainSequence(data::DataTag tag) noexcept