Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions .github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,38 @@ on:
pull_request:

jobs:
# format:
# name: Verify Formatting
# runs-on: ubuntu-latest

# steps:
# - name: Checkout Project
# uses: actions/checkout@v4

# - name: Format Project
# uses: DoozyX/clang-format-lint-action@v0.15
# with:
# source: "./code ./source"
# extensions: 'c,h,cpp,hpp'
# clangFormatVersion: 14

build:
name: Confirm Compilable
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: ghcr.io/z3dr/randotools:next
options: --user 1001


steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
uses: actions/checkout@v6.0.2
with:
submodules: true


- name: Set Env Vars
shell: bash
run: |
pr_number=$(echo ${{ github.ref }} | cut -d / -f 3)
echo pr_number="$pr_number" | tee -a $GITHUB_ENV
short_sha=${GITHUB_SHA::6}
echo short_sha="$short_sha" | tee -a $GITHUB_ENV
echo artifact_name=MM3D_Randomizer_PR"$pr_number"_"$short_sha" | tee -a $GITHUB_ENV

- name: Compile Project
run: |
make -j
make -j
mv -v MM3D_Randomizer.3dsx ${{ env.artifact_name }}.3dsx

- name: Upload Artifact
uses: actions/upload-artifact@v6
with:
name: ${{ env.artifact_name }}
path: ${{ env.artifact_name }}.3dsx
93 changes: 49 additions & 44 deletions .github/workflows/create-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
name: MM3DR Build Script

env:
# These are used automatically by git
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_AUTHOR_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
GIT_COMMITTER_NAME: GitHub Actions
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com

on:
workflow_dispatch:
inputs:
Expand All @@ -20,21 +27,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Get Last Nightly Commit and Private Key
id: nightly-version
run: |
if [[ ${{ github.event.inputs.build_type == 'Nightly' }} == true ]]; then
echo "last_nightly=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
else
echo "last_nightly=$(git describe --tags --match="v[0-9]*" HEAD --abbrev=0)" >> $GITHUB_ENV
fi

echo "last_nightly=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Generate changelog
id: changelog
uses: metcalfc/changelog-generator@v4.3.1
uses: metcalfc/changelog-generator@v4.7.0
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
base-ref: ${{ env.last_nightly }}
Expand All @@ -46,77 +48,73 @@ jobs:
needs: get-changelog
name: Build CIA and 3DSX Files
runs-on: ubuntu-latest
permissions:
contents: write
container:
image: ghcr.io/z3dr/randotools:next
image: ghcr.io/z3dr/randotools:latest
options: --user 1001

steps:
- name: Checkout Project
uses: actions/checkout@v4.1.7
uses: actions/checkout@v6.0.2
with:
submodules: true

- if: ${{ github.event.inputs.build_type == 'Nightly' }}
name: Run Build Script Nightly
run: |
chmod +x linux_build_rando.sh
./linux_build_rando.sh

- if: ${{ github.event.inputs.build_type == 'Release' }}
name: Run Build Script Release
- name: Run Build Script
env:
url_tag: v${{ github.event.inputs.version }}
GITHUB_BUILD_TYPE: ${{ github.event.inputs.build_type }}
GITHUB_INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
chmod +x linux_build_rando.sh
./linux_build_rando.sh

- name: Create QR codes
run: |
qrencode -ocia.png https://github.com/$GITHUB_REPOSITORY/releases/download/${{ env.tag_name }}/MM3D_Randomizer.cia
qrencode -o3dsx.png https://github.com/$GITHUB_REPOSITORY/releases/download/${{ env.tag_name }}/MM3D_Randomizer.3dsx

- name: Get shorthand commit.
id: vars
run: echo "sha_short=$(echo ${{ github.sha }} | cut -c1-6)" >> $GITHUB_ENV

- if: ${{ github.event.inputs.build_type == 'Nightly' }}
name: Create Pre-release
uses: ncipollo/release-action@v1.14.0
uses: ncipollo/release-action@v1.21.0
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "MM3D_Randomizer.cia,MM3D_Randomizer.3dsx,cia.png,3dsx.png"
prerelease: true
commit: "${{ github.sha }}"
tag: "Nightly-${{ env.sha_short }}"
name: "Nightly-${{ env.sha_short }}"
tag: "${{ env.tag_name }}"
name: "${{ env.tag_name }}"
body: |
Please note that these are DEVELOPMENT builds and may not be entirely stable.
When reporting issues, please mention the six character commit listed in the randomizer menu.
You can use the FBI homebrew application to install the randomizer using either of these QR codes.
CIA QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/cia.png)
![CIA Download](https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/cia.png)
3DSX QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/Nightly-${{ env.sha_short }}/3dsx.png)
![3DSX Download](https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/3dsx.png)

Changes Since [${{ needs.get-changelog.outputs.last-nightly }}](https://github.com/${{ github.repository }}/releases/tag/${{ needs.get-changelog.outputs.last-nightly }}) 🛠:
Changes Since [${{ needs.get-changelog.outputs.last-nightly }}](https://github.com/${{ github.repository }}/releases/tag/${{ needs.get-changelog.outputs.last-nightly }}) 🛠:
${{ needs.get-changelog.outputs.changelog }}


- if: ${{ github.event.inputs.build_type == 'Release' }}
name: Create Release
uses: ncipollo/release-action@v1.14.0
uses: ncipollo/release-action@v1.21.0
with:
token: "${{ secrets.GITHUB_TOKEN }}"
artifacts: "MM3D_Randomizer.cia,MM3D_Randomizer.3dsx,cia.png,3dsx.png"
prerelease: false
commit: "${{ github.sha }}"
tag: "v${{ github.event.inputs.version }}"
name: "v${{ github.event.inputs.version }}"
tag: "${{ env.tag_name }}"
name: "${{ env.tag_name }}"
body: |
${{ github.event.inputs.version }} Changes 🛠:
${{ needs.get-changelog.outputs.changelog }}
${{ github.event.inputs.version }} Changes:
- Please check back later for a full list of changes.

When reporting issues, please mention the six character commit listed in the randomizer menu.
You can use the FBI homebrew application to install the randomizer using either of these QR codes.
CIA QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/cia.png)
![CIA Download](https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/cia.png)
3DSX QR Code:
![CIA Download](https://github.com/${{ github.repository }}/releases/download/v${{ github.event.inputs.version }}/3dsx.png)
![3DSX Download](https://github.com/${{ github.repository }}/releases/download/${{ env.tag_name }}/3dsx.png)

deploy-gist:
needs: build-cia-3dsx
Expand Down Expand Up @@ -449,9 +447,16 @@ jobs:
done

- name: Deploy to Gist
uses: exuanbo/actions-deploy-gist@v1.1.4
with:
token: ${{ secrets.TOKEN }}
gist_id: a0bb911772800a7071eddf6298ff6e9f
gist_file_name: MM3DR.unistore
file_path: ./MM3DR.unistore
env:
GIST_ID: a0bb911772800a7071eddf6298ff6e9f
GIST_FILE_NAME: MM3DR.unistore
GIST_ACCESS_TOKEN: ${{ secrets.TOKEN }}
run: |
git clone https://$GIST_ACCESS_TOKEN@gist.github.com/$GIST_ID.git gist
cp ./$GIST_FILE_NAME ./gist/
cd gist
git add --all
if ! git diff --cached --quiet; then
git commit -m "Update UniStore"
git push
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ oldcode/loader/build
*.pyc
*.ips
*.zar
source/version.hpp
source/include/patch_symbols.hpp
.DS_Store
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ all: $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
$(BUILD):
@git submodule update --init
$(MAKE) -C Z3DR/code/
@$(TOPDIR)/write_version.sh
@mv Z3DR/code/basecode.ips $(ROMFS)/basecode.ips
@mv Z3DR/code/basecode1.1.ips $(ROMFS)/basecode1.1.ips
@mv Z3DR/source/patch_symbols.hpp $(CURDIR)/source/include/
Expand Down
2 changes: 1 addition & 1 deletion Z3DR
Submodule Z3DR updated 87 files
+3 −3 .github/workflows/clang-format.yml
+1 −4 code/include/advance.h
+1 −3 code/include/common/advanced_context.h
+1 −4 code/include/common/debug.h
+1 −3 code/include/common/flags.h
+1 −4 code/include/common/printf.h
+1 −4 code/include/common/types.h
+1 −4 code/include/common/utils.h
+1 −4 code/include/game/actor.h
+1 −4 code/include/game/actorresource.h
+9 −3 code/include/game/actors/boss/twinmold.h
+1 −4 code/include/game/actors/chest.h
+1 −4 code/include/game/actors/great_fairy.h
+1 −4 code/include/game/actors/obj_elegy_statue.h
+1 −4 code/include/game/as.h
+1 −4 code/include/game/camera.h
+1 −4 code/include/game/collision.h
+1 −4 code/include/game/common_data.h
+1 −4 code/include/game/context.h
+1 −4 code/include/game/items.h
+1 −4 code/include/game/message.h
+1 −4 code/include/game/objectbankarchive.h
+1 −4 code/include/game/pad.h
+9 −12 code/include/game/player.h
+1 −4 code/include/game/resarchiveheader.h
+1 −4 code/include/game/scene.h
+1 −4 code/include/game/skelanime.h
+1 −4 code/include/game/sound.h
+1 −4 code/include/game/states/state.h
+1 −4 code/include/game/static_context.h
+1 −4 code/include/game/ui.h
+1 −4 code/include/game/ui/layouts/play_hud.h
+10 −5 code/include/game/ui/screens/gearscreen.h
+1 −4 code/include/game/ui/screens/screen.h
+1 −4 code/include/game/weekeventreg.h
+1 −5 code/include/hid.h
+6 −5 code/include/newcodeinfo.h
+1 −3 code/include/rnd/actors/dm_char03.h
+1 −3 code/include/rnd/actors/dm_char05.h
+1 −3 code/include/rnd/actors/dm_hina.h
+1 −3 code/include/rnd/actors/en_elforg.h
+2 −3 code/include/rnd/actors/en_giant.h
+2 −4 code/include/rnd/actors/en_js.h
+1 −4 code/include/rnd/actors/en_mag.h
+1 −3 code/include/rnd/actors/en_si.h
+1 −3 code/include/rnd/actors/fish_heart.h
+1 −3 code/include/rnd/actors/item00.h
+1 −3 code/include/rnd/actors/item_b_heart.h
+1 −3 code/include/rnd/actors/obj_moon_stone.h
+42 −0 code/include/rnd/actors/obj_warpstone.h
+1 −3 code/include/rnd/blastmask.h
+1 −4 code/include/rnd/boss.h
+1 −3 code/include/rnd/chest.h
+1 −4 code/include/rnd/custom_entrances.h
+4 −5 code/include/rnd/custom_models.h
+1 −4 code/include/rnd/custom_screen.h
+1 −4 code/include/rnd/dungeon.h
+4 −5 code/include/rnd/entrance.h
+1 −4 code/include/rnd/extdata.h
+1 −4 code/include/rnd/gfx.h
+1 −4 code/include/rnd/icetrap.h
+1 −3 code/include/rnd/icons.h
+1 −3 code/include/rnd/input.h
+1 −4 code/include/rnd/item_effect.h
+1 −5 code/include/rnd/item_override.h
+1 −4 code/include/rnd/item_table.h
+2 −4 code/include/rnd/item_upgrade.h
+1 −4 code/include/rnd/link.h
+2 −3 code/include/rnd/models.h
+2 −3 code/include/rnd/objects.h
+1 −4 code/include/rnd/rheap.h
+1 −4 code/include/rnd/savefile.h
+3 −4 code/include/rnd/settings.h
+1 −4 code/include/rnd/spoiler_data.h
+1 −4 code/include/z3d/z3DVec.h
+18 −15 code/mm.ld
+11 −0 code/source/asm/actors/obj_warpstone_hooks.s
+6 −0 code/source/asm/actors/obj_warpstone_patches.s
+11 −11 code/source/asm/item_override_hooks.s
+4 −4 code/source/asm/item_override_patches.s
+1 −2 code/source/rnd/actors/en_giant.cpp
+1 −3 code/source/rnd/actors/en_js.cpp
+18 −0 code/source/rnd/actors/obj_warpstone.cpp
+1 −3 code/source/rnd/custom_entrances.cpp
+75 −74 code/source/rnd/custom_models.cpp
+40 −109 code/source/rnd/item_override.cpp
+11 −0 code/source/rnd/settings.cpp
22 changes: 1 addition & 21 deletions linux_build_rando.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
#!/bin/bash

set -e
compile() {
# If building manually just replace SHA with your own text.
APP_NAME=$(basename "$PWD")
BANNERTOOLAPP=bannertool
IS_GH_ACTIONS=true
if [ -n "$GITHUB_SHA" ]; then
echo "Building on Github Actions..."
else
echo "GITHUB_SHA is empty, building locally."
IS_GH_ACTIONS=false
GITHUB_SHA=$(echo $(git rev-parse --short HEAD))
fi
if ! command -v bannertoolexec &> /dev/null; then
if ! command -v bannertool &> /dev/null; then
echo "Bannertool not found in PATH. Please ensure it is in your path before continuing."
Expand All @@ -34,23 +26,11 @@ compile() {
exit 1
fi

export commitHashShort=$(echo ${GITHUB_SHA::6})
sed -i "s/develop/${commitHashShort:-develop}/" ./source/include/version.hpp
make -j
sed -i "s/${commitHashShort}/develop/" ./source/include/version.hpp
$BANNERTOOLAPP makebanner -i ./banner.png -a ./audio.wav -o ./banner.bnr
$BANNERTOOLAPP makesmdh -s "Majora's Mask 3D Randomizer" -l "A Randomized Majoras Mask Experience" -p "Z3DR Team" -i icon.png -o ./icon.icn
3dstool -cvtf romfs ./romfs.bin --romfs-dir ./romfs
makerom -f cia -o ${APP_NAME}.cia -DAPP_ENCRYPTED=false -target t -exefslogo -elf ./${APP_NAME}.elf -icon ./icon.icn -banner ./banner.bnr -rsf ./mmrando.rsf -romfs ./romfs.bin -major 1 -minor 0 -micro 0
if $IS_GH_ACTIONS; then
if [[ ${url_tag+x} ]]; then
qrencode -ocia.png https://github.com/$GITHUB_REPOSITORY/releases/download/$url_tag/${APP_NAME}.cia
qrencode -o3dsx.png https://github.com/$GITHUB_REPOSITORY/releases/download/$url_tag/${APP_NAME}.3dsx
else
qrencode -ocia.png https://github.com/$GITHUB_REPOSITORY/releases/download/Nightly-$commitHashShort/${APP_NAME}.cia
qrencode -o3dsx.png https://github.com/$GITHUB_REPOSITORY/releases/download/Nightly-$commitHashShort/${APP_NAME}.3dsx
fi
fi
}

clean_up() {
Expand Down
4 changes: 0 additions & 4 deletions source/include/version.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion source/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void PrintTopScreen()
consoleSelect(&topScreen);
consoleClear();
printf("\x1b[2;11H%sMajoras Mask 3D Randomizer%s", MEGANTA, RESET);
printf("\x1b[3;18H%s%s-%s%s",MEGANTA, RANDOMIZER_VERSION, COMMIT_NUMBER, RESET);
printf("\x1b[3;18H%s%s%s",MEGANTA, RANDOMIZER_VERSION, RESET);
printf("\x1b[4;10HA/B/D-pad: Navigate Menu\n");
printf(" Select: Exit to Homebrew Menu\n");
printf(" Y: New Random Seed\n");
Expand Down
2 changes: 1 addition & 1 deletion source/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ using namespace game::pad;

namespace Settings {
std::string seed;
std::string version = RANDOMIZER_VERSION "-" COMMIT_NUMBER;
std::string version = RANDOMIZER_VERSION;
std::array<u8, 5> hashIconIndexes;


Expand Down
38 changes: 38 additions & 0 deletions write_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# This script creates the name for the release git tag and the version string to show in the randomizer menu.
# It generates a header file with a macro for the version string.

VERSION_FILE="source/version.hpp"

if [[ -n $GITHUB_ENV ]]
then
# Building from GitHub Actions
# GITHUB_BUILD_TYPE and GITHUB_INPUT_VERSION are defined in `create_build.yml`

if [[ "$GITHUB_BUILD_TYPE" = "Release" ]]
then
VERSION="v$GITHUB_INPUT_VERSION"
else
VERSION="$GITHUB_BUILD_TYPE-${GITHUB_SHA::6}"
fi
echo "tag_name=$VERSION" >> $GITHUB_ENV
else
# Building locally
VERSION=dev-$(git show --no-patch --format=format:"%h" --abbrev=6)

# If there are uncommitted changes, add a `*` to the version.
if [[ -n $(git status --porcelain) ]]
then
VERSION="${VERSION}*"
fi
fi

# If the version string doesn't change, don't rewrite the file to avoid useless rebuilds.
NEW_CONTENT="#define RANDOMIZER_VERSION \"$VERSION\""
OLD_CONTENT="$(cat "$VERSION_FILE" 2> /dev/null || true)"
if [[ "$NEW_CONTENT" != "$OLD_CONTENT" ]]
then
echo "$NEW_CONTENT" > "$VERSION_FILE"
echo "Wrote version string: $VERSION"
fi