diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..b85b5269 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,20 @@ +{ + "name": "devkitPPC", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "settings": { + "workbench.colorTheme": "Default Dark+", + "files.exclude": { + "Dockerfile": true + } + }, + "onCreateCommand": "bash .devcontainer/on-create.sh", + "containerEnv": { + "DEVKITPRO": "/opt/devkitpro", + "DEVKITPPC": "/opt/devkitpro/devkitPPC", + "PATH": "${localEnv:PATH}:/opt/devkitpro/devkitPPC/bin" + }, + "remoteUser": "root", + "extensions": [ + "ms-vscode.cpptools-extension-pack" + ] +} diff --git a/.devcontainer/on-create.sh b/.devcontainer/on-create.sh new file mode 100644 index 00000000..d91b42be --- /dev/null +++ b/.devcontainer/on-create.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Install some essentials +apt-get update && apt-get install make xz-utils -y + +# Download and extract +cd /opt +wget "https://wii.leseratte10.de/devkitPro/file.php/devkitPPC-r39-2-linux_x86_64.pkg.tar.xz" +wget "https://wii.leseratte10.de/devkitPro/file.php/devkitppc-rules-1.1.1-1-any.pkg.tar.xz" +wget "https://wii.leseratte10.de/devkitPro/file.php/libogc-2.3.1-1-any.pkg.tar.xz" +wget "https://wii.leseratte10.de/devkitPro/file.php/general-tools-1.2.0-2-linux_x86_64.pkg.tar.xz" +wget "https://wii.leseratte10.de/devkitPro/file.php/gamecube-tools-1.0.3-1-linux_x86_64.pkg.tar.xz" +for f in *.pkg.tar.xz; do tar xf "$f" --strip-components=1; done + +# Clean up +rm *.pkg.tar.xz + +# Set environment variables +export DEVKITPRO=/opt/devkitpro +export DEVKITPPC=/opt/devkitpro/devkitPPC diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66a4aae5..6b044990 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,22 +2,36 @@ name: Build binaries on: push: + branches: + - "**" paths-ignore: + - '**.md' + - '.devcontainer/**' + - '.github/ISSUE_TEMPLATE/**' + - '.github/FUNDING.yml' + - '.github/**/*.md' + - '.vscode/**' - 'HBC/**' - 'Languages/**' pull_request: paths-ignore: + - '**.md' + - '.devcontainer/**' + - '.github/ISSUE_TEMPLATE/**' + - '.github/FUNDING.yml' + - '.github/**/*.md' + - '.vscode/**' - 'HBC/**' - 'Languages/**' jobs: download-build-tools: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 20 steps: - name: Restore cache id: cache-1 - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: cache key: ${{ runner.os }}-cache-1 @@ -45,14 +59,14 @@ jobs: EOF build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest needs: download-build-tools steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Restore cache id: cache-1 - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: cache key: ${{ runner.os }}-cache-1 @@ -74,81 +88,21 @@ jobs: PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make - name: Package - id: pack run: | mkdir -p upload/apps/usbloader_gx cp boot.dol upload/apps/usbloader_gx cp HBC/icon.png upload/apps/usbloader_gx cp HBC/meta.xml upload/apps/usbloader_gx - echo "::set-output name=sha::$(echo ${GITHUB_SHA} | head -c 7)" + echo "sha=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV - name: Upload binary - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: usbloadergx_${{ steps.pack.outputs.sha }} + name: usbloadergx_${{ env.sha }} path: upload - name: Upload debug binary - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: usbloadergx_${{ steps.pack.outputs.sha }}_debug - path: boot.elf - - build-latest-libogc: - runs-on: ubuntu-20.04 - needs: download-build-tools - steps: - - uses: actions/checkout@v2 - - - name: Restore cache - id: cache-1 - uses: actions/cache@v2 - with: - path: cache - key: ${{ runner.os }}-cache-1 - - - name: Check cache - if: steps.cache-1.outputs.cache-hit != 'true' - run: exit 1 - - - name: Extract downloaded files - run: | - tar -xf cache/devkitPPC-r39-2-linux_x86_64.pkg.tar.xz --strip-components=1 - tar -xf cache/devkitppc-rules-1.1.1-1-any.pkg.tar.xz --strip-components=1 - tar -xf cache/general-tools-1.2.0-2-linux_x86_64.pkg.tar.xz --strip-components=1 - tar -xf cache/gamecube-tools-1.0.3-1-linux_x86_64.pkg.tar.xz --strip-components=1 - - - name: Checkout libogc - uses: actions/checkout@v2 - with: - repository: devkitPro/libogc - path: libogc - - - name: Compile and install libogc - run: PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make install -C libogc - - - name: Compile USB Loader GX - run: | - rm -r libogc - PATH=$(pwd)/devkitpro/devkitPPC/bin:$PATH DEVKITPPC=$(pwd)/devkitpro/devkitPPC DEVKITPRO=$(pwd)/devkitpro make - - - name: Package - id: pack - run: | - mkdir -p upload/apps/usbloader_gx - cp boot.dol upload/apps/usbloader_gx - cp HBC/icon.png upload/apps/usbloader_gx - cp HBC/meta.xml upload/apps/usbloader_gx - echo "::set-output name=sha::$(echo ${GITHUB_SHA} | head -c 7)" - - - name: Upload binary - uses: actions/upload-artifact@v2 - with: - name: usbloadergx_libogc_${{ steps.pack.outputs.sha }} - path: upload - - - name: Upload debug binary - uses: actions/upload-artifact@v2 - with: - name: usbloadergx_libogc_${{ steps.pack.outputs.sha }}_debug + name: usbloadergx_${{ env.sha }}_debug path: boot.elf diff --git a/.gitignore b/.gitignore index 17b65d25..24350756 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,13 @@ *.dol *.elf -/build +*.exe +*.bat +.vscode/ +build/ +usbloader_gx/ /HBC/meta.xml /source/themes/filelist.h /source/gitver.c /source/svnrev.c +/usbloader_gx.zip +/wiiload diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 00000000..a14b7cda --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,50 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**", + "C:/devkitPro/libogc/include/**" + ], + "defines": [ + "HW_RVL", + "GEKKO" + ], + "compilerPath": "C:/devkitPro/devkitPPC/bin/powerpc-eabi-gcc.exe", + "cStandard": "gnu17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-x86" + }, + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "${env:DEVKITPRO}/libogc/include/**" + ], + "defines": [ + "HW_RVL", + "GEKKO" + ], + "compilerPath": "${env:DEVKITPRO}/devkitPPC/bin/powerpc-eabi-gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-x86" + }, + { + "name": "Mac", + "includePath": [ + "${workspaceFolder}/**", + "${env:DEVKITPRO}/libogc/include/**" + ], + "defines": [ + "HW_RVL", + "GEKKO" + ], + "compilerPath": "${env:DEVKITPRO}/devkitPPC/bin/powerpc-eabi-gcc", + "cStandard": "gnu17", + "cppStandard": "gnu++17", + "intelliSenseMode": "linux-gcc-x86" + } + ], + "version": 4 +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..cad702ac --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,32 @@ +{ + "version": "2.0.0", + "options": { + "env": { + "WIILOAD": "tcp:192.168.1.5" + } + }, + "tasks": [ + { + "label": "make", + "type": "shell", + "command": "make", + "problemMatcher": [], + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "clean", + "type": "shell", + "command": "make clean", + "problemMatcher": [] + }, + { + "label": "deploy", + "type": "shell", + "command": "make deploy", + "problemMatcher": [] + } + ] +} diff --git a/Makefile b/Makefile index f4ed3221..73e3ac6b 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ INCLUDES := source #--------------------------------------------------------------------------------- # options for code generation #--------------------------------------------------------------------------------- -CFLAGS = -g -ggdb -O3 -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE +CFLAGS = -g -ggdb -O2 -Wall -Wno-multichar -Wno-unused-parameter -Wextra $(MACHDEP) $(INCLUDE) -D_GNU_SOURCE CXXFLAGS = $(CFLAGS) LDFLAGS = -g -ggdb $(MACHDEP) -Wl,-Map,$(notdir $@).map,--section-start,.init=0x80B00000,-wrap,malloc,-wrap,free,-wrap,memalign,-wrap,calloc,-wrap,realloc,-wrap,malloc_usable_size,-wrap,time @@ -172,15 +172,19 @@ all: #--------------------------------------------------------------------------------- clean: - @echo clean ... - @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol -#--------------------------------------------------------------------------------- -run: - $(MAKE) - @echo Done building ... - @echo Now Run That Shit ... + @echo Cleaning... + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).dol usbloader_gx.zip usbloader_gx - wiiload $(OUTPUT).dol +#--------------------------------------------------------------------------------- +deploy: + $(MAKE) + @echo Deploying... + @[ -d usbloader_gx ] || mkdir -p usbloader_gx + @cp $(TARGET).dol usbloader_gx/ + @cp HBC/icon.png usbloader_gx/ + @cp HBC/meta.xml usbloader_gx/ + @zip usbloader_gx.zip usbloader_gx/* + wiiload usbloader_gx.zip #--------------------------------------------------------------------------------- reload: @@ -191,7 +195,6 @@ release: $(MAKE) cp boot.dol ./hbc/boot.dol - #--------------------------------------------------------------------------------- else