Refactor GitHub Actions workflow and Tile16Editor for improved functionality
- Updated the concurrency group in the release workflow to use a more consistent reference for tags. - Enhanced the release notes generation logic for clarity and consistency. - Improved logging in Tile16Editor to provide better insights during bitmap updates and error handling. - Refactored the UpdateBlocksetBitmap method to ensure proper handling of active bitmaps and pixel copying, enhancing the editor's responsiveness.
This commit is contained in:
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
@@ -14,7 +14,7 @@ on:
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.event_name }}-${{ github.ref_name || github.event.inputs.tag || github.run_id }}
|
||||
group: release-${{ github.ref || github.event.inputs.tag || github.run_id }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
@@ -78,24 +78,25 @@ jobs:
|
||||
if [[ -f scripts/extract_changelog.py ]]; then
|
||||
if python3 scripts/extract_changelog.py "${VERSION}" > release_notes.md; then
|
||||
echo "Changelog extracted for ${VERSION}"
|
||||
else
|
||||
echo "# yaze Release Notes" > release_notes.md
|
||||
echo "" >> release_notes.md
|
||||
echo "See docs/C1-changelog.md for full history." >> release_notes.md
|
||||
fi
|
||||
else
|
||||
echo "# yaze Release Notes" > release_notes.md
|
||||
echo "" >> release_notes.md
|
||||
echo "See docs/C1-changelog.md for full history." >> release_notes.md
|
||||
fi
|
||||
echo "---- RELEASE NOTES START ----"
|
||||
cat release_notes.md
|
||||
echo "---- RELEASE NOTES END ----"
|
||||
fi
|
||||
else
|
||||
echo "# yaze Release Notes" > release_notes.md
|
||||
echo "" >> release_notes.md
|
||||
echo "See docs/C1-changelog.md for full history." >> release_notes.md
|
||||
fi
|
||||
echo "---- RELEASE NOTES START ----"
|
||||
cat release_notes.md
|
||||
echo "---- RELEASE NOTES END ----"
|
||||
|
||||
- name: Store release notes output
|
||||
id: notes
|
||||
shell: bash
|
||||
run: |
|
||||
- name: Store release notes output
|
||||
id: notes
|
||||
shell: bash
|
||||
run: |
|
||||
{
|
||||
echo 'content<<EOF'
|
||||
cat release_notes.md
|
||||
@@ -182,7 +183,7 @@ jobs:
|
||||
if: runner.os == 'Windows'
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
# Registry tag 2025.09.17 full commit SHA
|
||||
# vcpkg registry baseline (full 40-char commit SHA)
|
||||
vcpkgGitCommitId: '4334d8b4c8916018600212ab4dd4bbdc343065d1'
|
||||
runVcpkgInstall: true
|
||||
vcpkgJsonGlob: '**/vcpkg.json'
|
||||
@@ -338,7 +339,7 @@ jobs:
|
||||
fi
|
||||
;;
|
||||
macOS)
|
||||
ver="${{ needs.validate-and-prepare.outputs.tag_name }}"
|
||||
ver="${{ needs['validate-and-prepare'].outputs.tag_name }}"
|
||||
ver="${ver#v}"
|
||||
chmod +x ./scripts/create-macos-bundle.sh
|
||||
./scripts/create-macos-bundle.sh "${ver}" "${ART}"
|
||||
@@ -385,11 +386,11 @@ jobs:
|
||||
- name: Create/Update Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ needs.validate-and-prepare.outputs.tag_name }}
|
||||
name: yaze ${{ needs.validate-and-prepare.outputs.tag_name }}
|
||||
body: ${{ needs.validate-and-prepare.outputs.release_notes }}
|
||||
tag_name: ${{ needs['validate-and-prepare'].outputs.tag_name }}
|
||||
name: yaze ${{ needs['validate-and-prepare'].outputs.tag_name }}
|
||||
body: ${{ needs['validate-and-prepare'].outputs.release_notes }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(needs.validate-and-prepare.outputs.tag_name, 'beta') || contains(needs.validate-and-prepare.outputs.tag_name, 'alpha') || contains(needs.validate-and-prepare.outputs.tag_name, 'rc') }}
|
||||
prerelease: ${{ contains(needs['validate-and-prepare'].outputs.tag_name, 'beta') || contains(needs['validate-and-prepare'].outputs.tag_name, 'alpha') || contains(needs['validate-and-prepare'].outputs.tag_name, 'rc') }}
|
||||
files: |
|
||||
dist/**/*
|
||||
env:
|
||||
@@ -402,6 +403,6 @@ jobs:
|
||||
steps:
|
||||
- name: Announce release
|
||||
run: |
|
||||
echo "🎉 yaze ${{ needs.validate-and-prepare.outputs.tag_name }} has been released!"
|
||||
echo "🎉 yaze ${{ needs['validate-and-prepare'].outputs.tag_name }} has been released!"
|
||||
echo "📦 Packages are now available for download"
|
||||
echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs.validate-and-prepare.outputs.tag_name }}"
|
||||
echo "🔗 Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ needs['validate-and-prepare'].outputs.tag_name }}"
|
||||
@@ -353,22 +353,33 @@ absl::Status Tile16Editor::RefreshTile16Blockset() {
|
||||
}
|
||||
|
||||
absl::Status Tile16Editor::UpdateBlocksetBitmap() {
|
||||
util::logf("UpdateBlocksetBitmap called for tile %d", current_tile16_);
|
||||
|
||||
if (!tile16_blockset_) {
|
||||
util::logf("ERROR: Tile16 blockset not initialized");
|
||||
return absl::FailedPreconditionError("Tile16 blockset not initialized");
|
||||
}
|
||||
|
||||
if (current_tile16_ < 0 || current_tile16_ >= zelda3::kNumTile16Individual) {
|
||||
util::logf("ERROR: Current tile16 ID %d out of range", current_tile16_);
|
||||
return absl::OutOfRangeError("Current tile16 ID out of range");
|
||||
}
|
||||
|
||||
// Update the blockset bitmap that's displayed in the editor
|
||||
if (tile16_blockset_bmp_.is_active()) {
|
||||
// Update the blockset bitmap directly from the current tile16 bitmap
|
||||
if (tile16_blockset_bmp_.is_active() && current_tile16_bmp_.is_active()) {
|
||||
util::logf("Updating blockset bitmap directly from current tile16...");
|
||||
|
||||
// Calculate the position of this tile in the blockset bitmap
|
||||
constexpr int kTilesPerRow = 8; // Standard SNES tile16 layout is 8 tiles per row
|
||||
int tile_x = (current_tile16_ % kTilesPerRow) * kTile16Size;
|
||||
int tile_y = (current_tile16_ / kTilesPerRow) * kTile16Size;
|
||||
|
||||
util::logf("Tile position: (%d, %d), blockset size: %dx%d, tile16 size: %dx%d",
|
||||
tile_x, tile_y, tile16_blockset_bmp_.width(), tile16_blockset_bmp_.height(),
|
||||
current_tile16_bmp_.width(), current_tile16_bmp_.height());
|
||||
|
||||
// Copy pixel data from current tile to blockset bitmap
|
||||
int pixels_copied = 0;
|
||||
for (int tile_y_offset = 0; tile_y_offset < kTile16Size; ++tile_y_offset) {
|
||||
for (int tile_x_offset = 0; tile_x_offset < kTile16Size; ++tile_x_offset) {
|
||||
int src_index = tile_y_offset * kTile16Size + tile_x_offset;
|
||||
@@ -377,17 +388,24 @@ absl::Status Tile16Editor::UpdateBlocksetBitmap() {
|
||||
|
||||
if (src_index < static_cast<int>(current_tile16_bmp_.size()) &&
|
||||
dst_index < static_cast<int>(tile16_blockset_bmp_.size())) {
|
||||
tile16_blockset_bmp_.WriteToPixel(dst_index, current_tile16_bmp_.data()[src_index]);
|
||||
uint8_t pixel_value = current_tile16_bmp_.data()[src_index];
|
||||
tile16_blockset_bmp_.WriteToPixel(dst_index, pixel_value);
|
||||
pixels_copied++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
util::logf("Copied %d pixels to blockset bitmap", pixels_copied);
|
||||
|
||||
// Mark the blockset bitmap as modified and update the renderer
|
||||
tile16_blockset_bmp_.set_modified(true);
|
||||
core::Renderer::Get().UpdateBitmap(&tile16_blockset_bmp_);
|
||||
util::logf("Blockset bitmap updated and renderer notified");
|
||||
} else {
|
||||
util::logf("ERROR: Blockset bitmap or current tile16 bitmap not active");
|
||||
}
|
||||
|
||||
util::logf("Updated blockset bitmap for tile %d", current_tile16_);
|
||||
util::logf("UpdateBlocksetBitmap completed for tile %d", current_tile16_);
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
@@ -565,17 +583,9 @@ absl::Status Tile16Editor::DrawToCurrentTile16(ImVec2 pos,
|
||||
}
|
||||
}
|
||||
|
||||
// Recreate the bitmap since we modified pixel data
|
||||
auto tile16_data = current_tile16_bmp_.vector();
|
||||
current_tile16_bmp_.Create(kTile16Size, kTile16Size, 8, tile16_data);
|
||||
|
||||
// Re-apply the correct palette to the tile16 bitmap after pixel updates
|
||||
const auto& ow_main_pal_group = rom()->palette_group().overworld_main;
|
||||
if (ow_main_pal_group.size() > 0) {
|
||||
current_tile16_bmp_.SetPalette(ow_main_pal_group[0]);
|
||||
}
|
||||
|
||||
core::Renderer::Get().RenderBitmap(¤t_tile16_bmp_);
|
||||
// Mark the bitmap as modified and update the renderer
|
||||
current_tile16_bmp_.set_modified(true);
|
||||
core::Renderer::Get().UpdateBitmap(¤t_tile16_bmp_);
|
||||
|
||||
// Update ROM data when painting to tile16
|
||||
auto* tile_data = GetCurrentTile16Data();
|
||||
@@ -765,20 +775,23 @@ absl::Status Tile16Editor::UpdateTile16Edit() {
|
||||
// Always use the flipped tile for consistency between preview and actual drawing
|
||||
if (tile16_edit_canvas_.DrawTilePainter(*tile_to_paint, 8, 4.0F)) {
|
||||
ImVec2 click_pos = tile16_edit_canvas_.drawn_tile_position();
|
||||
// Convert from display coordinates to tile16 bitmap coordinates
|
||||
// The canvas shows 16x16 pixels at 4x scale (64x64 display), so divide by 4 to get actual pixel coordinates
|
||||
click_pos.x =
|
||||
(click_pos.x - 2) / 4.0F; // Account for padding and 4x scale
|
||||
click_pos.y = (click_pos.y - 2) / 4.0F;
|
||||
|
||||
// Ensure coordinates are within the 16x16 tile bounds
|
||||
click_pos.x = std::max(0.0F, std::min(15.0F, click_pos.x));
|
||||
click_pos.y = std::max(0.0F, std::min(15.0F, click_pos.y));
|
||||
|
||||
// Convert canvas coordinates to tile16 coordinates (0-15 range)
|
||||
// The canvas is 64x64 display pixels showing a 16x16 tile at 4x scale
|
||||
int tile_x = static_cast<int>(click_pos.x / 4.0F);
|
||||
int tile_y = static_cast<int>(click_pos.y / 4.0F);
|
||||
|
||||
// Clamp to valid range
|
||||
tile_x = std::max(0, std::min(15, tile_x));
|
||||
tile_y = std::max(0, std::min(15, tile_y));
|
||||
|
||||
util::logf("Canvas click: (%.2f, %.2f) -> Tile16: (%d, %d)",
|
||||
click_pos.x, click_pos.y, tile_x, tile_y);
|
||||
|
||||
// Pass the flipped tile if we created one, otherwise pass nullptr to use original with flips
|
||||
const gfx::Bitmap* tile_to_draw =
|
||||
(x_flip || y_flip) ? tile_to_paint : nullptr;
|
||||
RETURN_IF_ERROR(DrawToCurrentTile16(click_pos, tile_to_draw));
|
||||
RETURN_IF_ERROR(DrawToCurrentTile16(ImVec2(tile_x, tile_y), tile_to_draw));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user