[nostalgia/core] Add valid and repair functions for PaletteV3
This commit is contained in:
parent
a2cec10cb6
commit
3cb3bc122b
@ -74,6 +74,18 @@ constexpr bool valid(Palette const&p) noexcept {
|
||||
});
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr bool repair(Palette &p) noexcept {
|
||||
auto const colors = p.colorInfo.size();
|
||||
if (p.pages.size() == 0) {
|
||||
p.pages.emplace_back();
|
||||
}
|
||||
for (auto &page : p.pages) {
|
||||
page.resize(colors);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
constexpr Color16 color(Palette const&pal, size_t page, size_t idx) noexcept {
|
||||
if (page < pal.pages.size() && idx < pal.pages[page].size()) [[likely]] {
|
||||
|
Loading…
Reference in New Issue
Block a user