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;
|
||||
}
|
||||
|
||||
std::span<uint8_t> backgroundMenu()
|
||||
std::optional<std::span<uint8_t>> backgroundMenu()
|
||||
{
|
||||
//top screen
|
||||
clearScreen(&topScreen);
|
||||
@ -88,15 +88,24 @@ std::span<uint8_t> backgroundMenu()
|
||||
}
|
||||
}
|
||||
|
||||
if(programEnd)
|
||||
return std::nullopt;
|
||||
|
||||
auto selection = static_cast<size_t>(m->cursor);
|
||||
|
||||
if(selection > bgs.size())
|
||||
if(selection == bgs.size())
|
||||
return {};
|
||||
else if (selection > bgs.size())
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
try {
|
||||
const auto res = parseGif(bgs[selection].second.data(), currentlyLoadedGif, bgGetGfxPtr(bgGifTop));
|
||||
swiWaitForVBlank();
|
||||
bgHide(topScreen.bgId);
|
||||
bgShow(bgGifTop);
|
||||
auto confirmed = (choiceBox("Confirm this background?") == YES);
|
||||
swiWaitForVBlank();
|
||||
bgShow(topScreen.bgId);
|
||||
bgHide(bgGifTop);
|
||||
if(confirmed)
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
#define BGMENU_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
|
||||
std::span<uint8_t> backgroundMenu();
|
||||
std::optional<std::span<uint8_t>> backgroundMenu();
|
||||
|
||||
#endif
|
||||
@ -620,7 +620,8 @@ void customBg() {
|
||||
{
|
||||
return;
|
||||
}
|
||||
customBgSpan = backgroundMenu();
|
||||
if(auto newBg = backgroundMenu(); newBg.has_value())
|
||||
customBgSpan = *newBg;
|
||||
}
|
||||
|
||||
void doMainMenu(consoleInfo& info) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user