mirror of
https://github.com/rvtr/unlaunch-installer_dev.git
synced 2026-01-26 13:43:08 -05:00
Swap the backgrounds after vblank and properly handle "cancel" and "default" bg options
This commit is contained in:
parent
e88dc13af8
commit
0ad0dc18bc
@ -46,7 +46,7 @@ static const auto& getBackgroundList()
|
|||||||
return bgs;
|
return bgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<uint8_t> backgroundMenu()
|
std::optional<std::span<uint8_t>> backgroundMenu()
|
||||||
{
|
{
|
||||||
//top screen
|
//top screen
|
||||||
clearScreen(&topScreen);
|
clearScreen(&topScreen);
|
||||||
@ -88,15 +88,24 @@ std::span<uint8_t> backgroundMenu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(programEnd)
|
||||||
|
return std::nullopt;
|
||||||
|
|
||||||
auto selection = static_cast<size_t>(m->cursor);
|
auto selection = static_cast<size_t>(m->cursor);
|
||||||
|
|
||||||
if(selection > bgs.size())
|
if(selection == bgs.size())
|
||||||
return {};
|
return {};
|
||||||
|
else if (selection > bgs.size())
|
||||||
|
{
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const auto res = parseGif(bgs[selection].second.data(), currentlyLoadedGif, bgGetGfxPtr(bgGifTop));
|
const auto res = parseGif(bgs[selection].second.data(), currentlyLoadedGif, bgGetGfxPtr(bgGifTop));
|
||||||
|
swiWaitForVBlank();
|
||||||
bgHide(topScreen.bgId);
|
bgHide(topScreen.bgId);
|
||||||
bgShow(bgGifTop);
|
bgShow(bgGifTop);
|
||||||
auto confirmed = (choiceBox("Confirm this background?") == YES);
|
auto confirmed = (choiceBox("Confirm this background?") == YES);
|
||||||
|
swiWaitForVBlank();
|
||||||
bgShow(topScreen.bgId);
|
bgShow(topScreen.bgId);
|
||||||
bgHide(bgGifTop);
|
bgHide(bgGifTop);
|
||||||
if(confirmed)
|
if(confirmed)
|
||||||
|
|||||||
@ -2,8 +2,9 @@
|
|||||||
#define BGMENU_H
|
#define BGMENU_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <optional>
|
||||||
#include <span>
|
#include <span>
|
||||||
|
|
||||||
std::span<uint8_t> backgroundMenu();
|
std::optional<std::span<uint8_t>> backgroundMenu();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -620,7 +620,8 @@ void customBg() {
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
customBgSpan = backgroundMenu();
|
if(auto newBg = backgroundMenu(); newBg.has_value())
|
||||||
|
customBgSpan = *newBg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void doMainMenu(consoleInfo& info) {
|
void doMainMenu(consoleInfo& info) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user