diff --git a/.github/workflows/rewrite.yml b/.github/workflows/rewrite.yml index 4169b56..1caa8e0 100644 --- a/.github/workflows/rewrite.yml +++ b/.github/workflows/rewrite.yml @@ -1,4 +1,4 @@ -name: Build nxdumptool-rewrite binaries +name: Build nxdumptool-rewrite binary on: push: @@ -70,7 +70,7 @@ jobs: cd libntfs-3g; su -s /bin/bash nobody -c "dkp-makepkg -c -C -f" > /dev/null; sudo -n dkp-pacman -U --needed --noconfirm *.pkg.tar.* > /dev/null; cd .. cd liblwext4; su -s /bin/bash nobody -c "dkp-makepkg -c -C -f" > /dev/null; sudo -n dkp-pacman -U --needed --noconfirm *.pkg.tar.* > /dev/null; cd .. - - name: Build nxdumptool-rewrite PoC binaries + - name: Build nxdumptool-rewrite PoC binary run: | cd "$GITHUB_WORKSPACE/nxdumptool" echo "nxdt_commit=$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -83,14 +83,14 @@ jobs: - uses: actions/upload-artifact@v3 with: - name: nxdumptool-rewrite_poc_${{ env.nxdt_commit }}.7z - path: nxdumptool/nxdumptool-rewrite_poc_${{ env.nxdt_commit }}.7z + name: nxdt_rw_poc-${{ env.nxdt_commit }}.nro + path: nxdumptool/code_templates/tmp/nxdt_rw_poc.nro if-no-files-found: error - uses: actions/upload-artifact@v3 with: - name: nxdumptool-rewrite_poc_${{ env.nxdt_commit }}-Debug_ELFs.7z - path: nxdumptool/nxdumptool-rewrite_poc_${{ env.nxdt_commit }}-Debug_ELFs.7z + name: nxdt_rw_poc-${{ env.nxdt_commit }}.elf + path: nxdumptool/code_templates/tmp/nxdt_rw_poc.elf if-no-files-found: error #- uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index 61e2b77..29aa6c1 100644 --- a/.gitignore +++ b/.gitignore @@ -12,8 +12,6 @@ host/nxdumptool *.map *.pfs0 *.lst -*.tar.bz2 -*.7z *.log *.spec *.exe diff --git a/build.sh b/build.sh index 8425574..2600c7f 100644 --- a/build.sh +++ b/build.sh @@ -1,11 +1,7 @@ #!/bin/bash cd "$(dirname "${BASH_SOURCE[0]}")" -archive_filename="nxdumptool-rewrite_poc_$(git rev-parse --short HEAD)" - # Clean-up from last build -rm -f ./*.7z - rm -rf ./code_templates/tmp mkdir ./code_templates/tmp @@ -13,43 +9,25 @@ mv ./source/main.cpp ./main.cpp make clean_all -# Build loop -for f in ./code_templates/*.c; do - basename="$(basename "$f")" - filename="${basename%.*}" +# Build PoC +poc_name="nxdt_rw_poc" +poc_path="./code_templates/$poc_name.c" - if [[ $filename == "dump_title_infos" ]]; then - continue - fi +rm -f ./source/main.c +cp $poc_path ./source/main.c - echo $filename +cp ./romfs/icon/nxdumptool.jpg ./romfs/icon/$poc_name.jpg - rm -f ./source/main.c - cp $f ./source/main.c +make BUILD_TYPE="$poc_name" -j$(nproc) - cp ./romfs/icon/nxdumptool.jpg ./romfs/icon/$filename.jpg +rm -f ./romfs/icon/$poc_name.jpg - make BUILD_TYPE="$filename" -j$(nproc) - - rm -f ./romfs/icon/$filename.jpg - - mkdir ./code_templates/tmp/$filename - cp ./$filename.nro ./code_templates/tmp/$filename/$filename.nro - cp ./$filename.elf ./code_templates/tmp/$filename/$filename.elf - - make BUILD_TYPE="$filename" clean -done +mv -f ./$poc_name.nro ./code_templates/tmp/$poc_name.nro +mv -f ./$poc_name.elf ./code_templates/tmp/$poc_name.elf # Post build clean-up +make BUILD_TYPE="$poc_name" clean make clean_all -# Package resulting binaries -cd ./code_templates/tmp -7z a ../../"$archive_filename.7z" */*.nro -7z a ../../"$archive_filename-Debug_ELFs.7z" */*.elf - -# Final clean-up -cd ../.. rm -f ./source/main.c -rm -rf ./code_templates/tmp -mv ./main.cpp ./source/main.cpp +mv -f ./main.cpp ./source/main.cpp