Compare commits

...

6 Commits

Author SHA1 Message Date
b9ffae0269 [nostalgia/gfx] Cleanup
All checks were successful
Build / build (push) Successful in 1m18s
2025-06-23 00:47:46 -05:00
003f3e01c6 [nostalgia] Update release notes 2025-06-22 01:01:09 -05:00
9028e74af0 [nostalgia/gfx/studio/tilesheet] Disable paste when nothing is selected 2025-06-22 01:00:56 -05:00
f5ccab5f2c [studio] Cleanup 2025-06-21 19:19:39 -05:00
37cfa927d1 [nostalgia/gfx] Address a couple of implicit conversions
All checks were successful
Build / build (push) Successful in 1m19s
2025-06-21 14:16:17 -05:00
0efed70b57 [studio] Fix Studio to clear editor pointers when opening a new project
All checks were successful
Build / build (push) Successful in 1m20s
2025-06-21 14:12:45 -05:00
5 changed files with 27 additions and 25 deletions

View File

@@ -5,6 +5,7 @@
* Fix file deletion to close file even if not active
* Fix file copy to work when creating a copy with the name of a previously
deleted file
* Fix crash that could occur after switching projects
* Make file picker popup accept on double click of a file
* TileSheetEditor: Fix copy/cut/paste enablement when there is no selection
* TileSheetEditor: Fix manual redo of draw actions, fix drawing to pixel 0, 0
@@ -13,8 +14,6 @@
subsheets
* PaletteEditor: Add RGB key shortcuts for focusing color channels
* PaletteEditor: Add color preview to color editor
* PaletteEditor: Make RGB key shortcuts work when color channel inputs are
focused
# d2025.05.1

View File

@@ -31,12 +31,12 @@ class Context {
explicit Context(turbine::Context &tctx) noexcept: turbineCtx{tctx} {}
Context(Context &other) noexcept = delete;
Context(Context const&other) noexcept = delete;
Context(Context const&&other) noexcept = delete;
Context(Context const &other) noexcept = delete;
Context(Context const &&other) noexcept = delete;
virtual ~Context() noexcept = default;
[[nodiscard]]
ox::MemFS const&rom() const noexcept {
ox::MemFS const &rom() const noexcept {
return static_cast<ox::MemFS const&>(*turbine::rom(turbineCtx));
}
@@ -76,7 +76,7 @@ ox::Result<ox::UPtr<Context>> init(turbine::Context &tctx, InitParams const&) no
ox::Error loadBgPalette(
Context&,
size_t const palBank,
CompactPalette const&palette,
CompactPalette const &palette,
size_t const page) noexcept {
if (palette.pages.empty()) {
return {};
@@ -90,7 +90,7 @@ ox::Error loadBgPalette(
ox::Error loadSpritePalette(
Context&,
CompactPalette const&palette,
CompactPalette const &palette,
size_t const page) noexcept {
if (palette.pages.empty()) {
return {};
@@ -118,15 +118,15 @@ void clearCbbs(Context &ctx) noexcept {
static ox::Error loadTileSheetSet(
Context &ctx,
ox::Span<uint16_t> tileMapTargetMem,
TileSheetSet const&set) noexcept {
TileSheetSet const &set) noexcept {
size_t tileWriteIdx = 0;
size_t const bppMod = set.bpp == 4;
for (auto const&entry : set.entries) {
for (auto const &entry : set.entries) {
OX_REQUIRE(ts, keel::readObj<CompactTileSheet>(keelCtx(ctx), entry.tilesheet));
if (set.bpp != ts->bpp && ts->bpp == 8) {
return ox::Error(1, "cannot load an 8 BPP tilesheet into a 4 BPP CBB");
}
for (auto const&s : entry.sections) {
for (auto const &s : entry.sections) {
auto const cnt = (static_cast<size_t>(s.tiles) * PixelsPerTile) >> bppMod;
for (size_t i = 0; i < cnt; ++i) {
auto const begin = static_cast<size_t>(s.begin) * (PixelsPerTile >> bppMod);
@@ -145,7 +145,7 @@ static ox::Error loadTileSheetSet(
ox::Error loadBgTileSheet(
Context &ctx,
unsigned const cbb,
CompactTileSheet const&ts,
CompactTileSheet const &ts,
size_t const dstTileIdx,
size_t const srcTileIdx,
size_t const tileCnt) noexcept {
@@ -173,8 +173,8 @@ ox::Error loadBgTileSheet(
ox::Error loadBgTileSheet(
Context &ctx,
unsigned const cbb,
CompactTileSheet const&ts,
ox::Optional<unsigned> const&paletteBank) noexcept {
CompactTileSheet const &ts,
ox::Optional<unsigned> const &paletteBank) noexcept {
auto const cnt = (ts.pixels.size() * PixelsPerTile) / (1 + (ts.bpp == 4));
for (size_t i = 0; i < cnt; ++i) {
auto const srcIdx = i * 2;
@@ -198,7 +198,7 @@ ox::Error loadBgTileSheet(
ox::Error loadBgTileSheet(
Context &ctx,
unsigned const cbb,
TileSheetSet const&set) noexcept {
TileSheetSet const &set) noexcept {
auto const bpp = static_cast<unsigned>(set.bpp);
OX_RETURN_ERROR(loadTileSheetSet(ctx, MEM_BG_TILES[cbb], set));
// update bpp of all bgs with the updated cbb
@@ -222,7 +222,7 @@ static void setSpritesBpp(unsigned const bpp) noexcept {
ox::Error loadSpriteTileSheet(
Context &ctx,
CompactTileSheet const&ts,
CompactTileSheet const &ts,
bool const loadDefaultPalette) noexcept {
for (size_t i = 0; i < ts.pixels.size(); i += 2) {
uint16_t v = ts.pixels[i];
@@ -238,7 +238,7 @@ ox::Error loadSpriteTileSheet(
ox::Error loadSpriteTileSheet(
Context &ctx,
TileSheetSet const&set) noexcept {
TileSheetSet const &set) noexcept {
auto const bpp = static_cast<unsigned>(set.bpp);
OX_RETURN_ERROR(loadTileSheetSet(ctx, {MEM_SPRITE_TILES, 32 * ox::units::KB}, set));
setSpritesBpp(bpp);
@@ -246,7 +246,7 @@ ox::Error loadSpriteTileSheet(
}
void setBgTile(
Context &ctx, uint_t const bgIdx, int const column, int const row, BgTile const&tile) noexcept {
Context &ctx, uint_t const bgIdx, int const column, int const row, BgTile const &tile) noexcept {
auto const tileIdx = static_cast<std::size_t>(row * tileColumns(ctx) + column);
// see Tonc 9.3
MEM_BG_MAP[bgIdx][tileIdx] =
@@ -275,7 +275,7 @@ bool bgStatus(Context&, unsigned const bg) noexcept {
void setBgStatus(Context&, unsigned const bg, bool const status) noexcept {
constexpr auto Bg0Status = 8;
const auto mask = static_cast<uint32_t>(status) << (Bg0Status + bg);
auto const mask = static_cast<uint32_t>(status) << (Bg0Status + bg);
REG_DISPCTL = REG_DISPCTL | ((REG_DISPCTL & ~mask) | mask);
}
@@ -312,7 +312,7 @@ void showSprite(Context&, unsigned const idx) noexcept {
});
}
void setSprite(Context&, uint_t const idx, Sprite const&s) noexcept {
void setSprite(Context&, uint_t const idx, Sprite const &s) noexcept {
//oxAssert(g_spriteUpdates < config::GbaSpriteBufferLen, "Sprite update buffer overflow");
uint16_t const eightBpp = s.bpp == 8;
teagba::addSpriteUpdate({
@@ -333,7 +333,7 @@ void setSprite(Context&, uint_t const idx, Sprite const&s) noexcept {
});
}
uint_t spriteCount(Context const&) noexcept {
uint_t spriteCount(Context const &) noexcept {
return SpriteCount;
}
@@ -341,7 +341,7 @@ uint_t spriteCount(Context const&) noexcept {
namespace ox {
void panic(const char *file, int line, const char *panicMsg, ox::Error const&err) noexcept {
void panic(const char *file, int line, const char *panicMsg, ox::Error const &err) noexcept {
using namespace nostalgia::gfx;
// reset heap to make sure we have enough memory to allocate context data
OX_ALLOW_UNSAFE_BUFFERS_BEGIN

View File

@@ -13,7 +13,7 @@ AddSubSheetCommand::AddSubSheetCommand(
auto &parent = getSubSheet(m_img, m_parentIdx);
if (!parent.subsheets.empty()) {
auto idx = m_parentIdx;
idx.emplace_back(parent.subsheets.size());
idx.emplace_back(static_cast<uint32_t>(parent.subsheets.size()));
m_addedSheets.push_back(idx);
} else {
auto idx = m_parentIdx;

View File

@@ -194,6 +194,7 @@ void TileSheetEditorImGui::keyStateChanged(turbine::Key const key, bool const do
void TileSheetEditorImGui::draw(studio::Context&) noexcept {
setCopyEnabled(m_model.hasSelection());
setCutEnabled(m_model.hasSelection());
setPasteEnabled(m_model.hasSelection());
if (ig::mainWinHasFocus() && m_tool == TileSheetTool::Select) {
if (ImGui::IsKeyDown(ImGuiKey_ModCtrl) && !m_palPathFocused) {
if (ImGui::IsKeyPressed(ImGuiKey_A)) {
@@ -278,7 +279,7 @@ void TileSheetEditorImGui::draw(studio::Context&) noexcept {
auto insertOnIdx = m_model.activeSubSheetIdx();
auto const &parent = m_model.activeSubSheet();
m_model.addSubsheet(insertOnIdx);
insertOnIdx.emplace_back(parent.subsheets.size() - 1);
insertOnIdx.emplace_back(static_cast<uint32_t>(parent.subsheets.size() - 1));
setActiveSubsheet(insertOnIdx);
}
ImGui::SameLine();

View File

@@ -635,8 +635,7 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
keel::DuplicateSet ds;
OX_RETURN_ERROR(keel::setRomFs(keelCtx(m_tctx), std::move(fs), ds));
if (ds.size()) {
ox::String msg;
msg += "Multiple files have the same UUID:\n";
ox::String msg{"Multiple files have the same UUID:\n"};
for (auto const &k : ds.keys()) {
msg += ox::sfmt("\n\t{}:\n", k.toString());
for (auto const &v : ds[k]) {
@@ -649,6 +648,9 @@ ox::Error StudioUI::openProjectPath(ox::StringParam path) noexcept {
ox::make_unique_catch<Project>(keelCtx(m_tctx), std::move(path), m_projectDataDir)
.moveTo(m_project));
m_sctx.project = m_project.get();
m_activeEditor = nullptr;
m_activeEditorOnLastDraw = nullptr;
m_activeEditorUpdatePending = nullptr;
turbine::setWindowTitle(
m_tctx, ox::sfmt("{} - {}", keelCtx(m_tctx).appName, m_project->projectPath()));
m_deleteConfirmation.deleteFile.connect(m_sctx.project, &Project::deleteItem);