diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..363bc26 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -0,0 +1,58 @@ +name: Build and Test + +on: [push, pull_request] + +jobs: + Windows: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + submodules: recursive + + - name: Configure + run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + + - name: Build + run: cmake --build build --config Release + + - name: Test + run: build\liblsdj\test\Release\test.exe + + macOS: + runs-on: macos-latest + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + submodules: recursive + + - name: Configure + run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + + - name: Build + run: cmake --build build --config Release + + - name: Test + run: ./build/liblsdj/test/test + + Ubuntu: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + submodules: recursive + + - name: Configure + run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + + - name: Build + run: cmake --build build --config Release + + - name: Test + run: ./build/liblsdj/test/test diff --git a/.github/workflows/deploy_tools.yml b/.github/workflows/deploy_tools.yml new file mode 100644 index 0000000..9886d70 --- /dev/null +++ b/.github/workflows/deploy_tools.yml @@ -0,0 +1,75 @@ +name: Deploy Tools + +on: + release: + types: [created] + +jobs: + Windows: + runs-on: windows-latest + env: + ARCHIVE: liblsdj_windows_${{ github.event.release.tag_name }}.zip + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + submodules: recursive + + - name: Configure + run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + + - name: Build + run: cmake --build build --config Release + + - name: Zip + run: | + 7z a ${{ env.ARCHIVE }} -tzip .\build\lsdsng_export\Release\lsdsng-export.exe + 7z a ${{ env.ARCHIVE }} -tzip .\build\lsdsng_import\Release\lsdsng-import.exe + 7z a ${{ env.ARCHIVE }} -tzip .\build\lsdj_mono\Release\lsdj-mono.exe + 7z a ${{ env.ARCHIVE }} -tzip .\build\lsdj_wavetable_import\Release\lsdj-wavetable-import.exe + + - name: Upload + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: .\${{ env.ARCHIVE }} + asset_name: ${{ env.ARCHIVE }} + asset_content_type: binary/octet-stream + + macOS: + runs-on: macos-latest + env: + ARCHIVE: liblsdj_macos_${{ github.event.release.tag_name }}.zip + + steps: + - uses: actions/checkout@v2 + with: + lfs: true + submodules: recursive + + - name: Configure + run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release .. + + - name: Build + run: cmake --build build --config Release + + - name: Zip + run: | + zip -j ${{ env.ARCHIVE }} \ + ./build/lsdsng_export/lsdsng-export \ + ./build/lsdsng_import/lsdsng-import \ + ./build/lsdj_mono/lsdj-mono \ + ./build/lsdj_wavetable_import/lsdj-wavetable-import + + - name: Upload + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ env.ARCHIVE }} + asset_name: ${{ env.ARCHIVE }} + asset_content_type: binary/octet-stream diff --git a/README.md b/README.md index 150302a..de85861 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![libLSDJ logo](https://4ntler.com/liblsdj_banner_github.png) -![Continuous Integration](https://github.com/stijnfrishert/libLSDJ/workflows/Continuous%20Integration/badge.svg) +![Passing Tests](https://github.com/stijnfrishert/libLSDJ/workflows/Build%20and%20Test/badge.svg) [Little Sound DJ](http://littlesounddj.com) is a wonderful tool that transforms your old gameboy into a music making machine. It has a thriving community of users that pushes their old hardware to its limits, in pursuit of new musical endeavours. It can however be cumbersome to manage songs and sounds outside of the gameboy. diff --git a/common/common.cpp b/common/common.cpp index 4318d1b..1c5764e 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include "common.hpp" diff --git a/liblsdj/src/sav.c b/liblsdj/src/sav.c index 71819dd..f399f10 100644 --- a/liblsdj/src/sav.c +++ b/liblsdj/src/sav.c @@ -494,7 +494,7 @@ lsdj_error_t compress_projects(lsdj_project_t* const* projects, uint8_t* blocks, lsdj_vio_t wvio = lsdj_create_memory_vio(&state); - unsigned int current_block = 1; + unsigned int currentBlock = 1; for (int i = 0; i < LSDJ_SAV_PROJECT_COUNT; i++) { // See if there's a project in this slot @@ -507,14 +507,17 @@ lsdj_error_t compress_projects(lsdj_project_t* const* projects, uint8_t* blocks, // Compress and store success + how many bytes were written size_t compressionSize = 0; - const lsdj_error_t result = lsdj_compress(song->bytes, &wvio, current_block, &compressionSize); + const lsdj_error_t result = lsdj_compress(song->bytes, &wvio, currentBlock, &compressionSize); // Bail out if this failed if (result != LSDJ_SUCCESS) return result; // Set the block allocation table - memset(blockAllocTable, i, compressionSize / LSDJ_BLOCK_SIZE); + const unsigned int blockCount = (unsigned int)(compressionSize / LSDJ_BLOCK_SIZE); + memset(blockAllocTable + currentBlock - 1, i, blockCount); + + currentBlock += blockCount; } return LSDJ_SUCCESS; diff --git a/liblsdj/test/project.cpp b/liblsdj/test/project.cpp index a0f0c4d..16a299d 100644 --- a/liblsdj/test/project.cpp +++ b/liblsdj/test/project.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "file.hpp" diff --git a/liblsdj/test/sav.cpp b/liblsdj/test/sav.cpp index 29a9c78..098cf01 100644 --- a/liblsdj/test/sav.cpp +++ b/liblsdj/test/sav.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include "file.hpp" diff --git a/liblsdj/test/song.cpp b/liblsdj/test/song.cpp index 5a89c11..519da94 100644 --- a/liblsdj/test/song.cpp +++ b/liblsdj/test/song.cpp @@ -2,6 +2,8 @@ #include #include +#include + #include #include #include