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
4 changes: 3 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ jobs:
uses: actions/checkout@v4.1.3

- name: Compile Project
run: make -j
run: |
chmod +x write_version.sh
make -j
31 changes: 15 additions & 16 deletions .github/workflows/create_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,13 @@ jobs:
uses: actions/checkout@v4.1.3

- name: Run Build Script
env:
GITHUB_BUILD_TYPE: ${{ github.event.inputs.build_type }}
GITHUB_INPUT_VERSION: ${{ github.event.inputs.version }}
run: |
chmod +x linux_build_rando.sh
chmod +x linux_build_rando.sh write_version.sh
./linux_build_rando.sh

- 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
Expand All @@ -65,18 +64,18 @@ jobs:
artifacts: "OoT3D_Randomizer.cia,OoT3D_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 }}


Expand All @@ -88,18 +87,18 @@ jobs:
artifacts: "OoT3D_Randomizer.cia,OoT3D_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:
- 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/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)

deploy-gist:
needs: build-cia-3dsx
Expand Down Expand Up @@ -407,7 +406,7 @@ jobs:
sed -i "s#<REV_NUMBER>#$REVISION#g" OoT3DR.unistore
LINES=$(cat ciaDownloads.txt)
LINENUM=1
IFS=$'\n'
IFS=$'\n'
for LINE in $LINES
do
LINE=`sed -e 's/^"//' -e 's/"$//' <<<"$LINE"`
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ build/*
*.ips
*.zar
source/patch_symbols*
version.hpp
.DS_Store
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ endif

#---------------------------------------------------------------------------------
app: create_basecode $(BUILD) $(GFXBUILD) $(DEPSDIR) $(ROMFS_T3XFILES) $(T3XHFILES)
@$(TOPDIR)/write_version.sh
@rm -fr $(TARGET).3dsx
@$(PYTHON) generate_patch_symbols.py
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
Expand Down
11 changes: 5 additions & 6 deletions linux_build_rando.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/bin/bash

set -e

compile() {
# If building manually just replace SHA with your own text.
export commitHashShort=$(echo ${GITHUB_SHA::6})
sed -i "s/develop/${commitHashShort:-develop}/" ./source/randomizer.hpp
make -j
bannertoolexec makebanner -i ./banner.png -a ./audio.wav -o ./banner.bnr
bannertoolexec makesmdh -s "Ocarina of Time 3D Randomizer" -l "A different Ocarina of Time experience" -p "Gamestabled & Gymnast86" -i icon.png -o ./icon.icn
3dstool -cvtf romfs ./romfs.bin --romfs-dir ./romfs
makerom -f cia -o OoT3D_Randomizer.cia -DAPP_ENCRYPTED=false -target t -exefslogo -elf ./OoT3D_Randomizer.elf -icon ./icon.icn -banner ./banner.bnr -rsf ./ootrando.rsf -romfs ./romfs.bin -major 1 -minor 1 -micro 1
qrencode -ocia.png https://github.com/$GITHUB_REPOSITORY/releases/download/Nightly-$commitHashShort/OoT3D_Randomizer.cia
qrencode -o3dsx.png https://github.com/$GITHUB_REPOSITORY/releases/download/Nightly-$commitHashShort/OoT3D_Randomizer.3dsx
qrencode -ocia.png https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG_NAME/OoT3D_Randomizer.cia
qrencode -o3dsx.png https://github.com/$GITHUB_REPOSITORY/releases/download/$TAG_NAME/OoT3D_Randomizer.3dsx
ls -la
}

Expand All @@ -19,4 +18,4 @@ clean_up() {
}

compile
clean_up
clean_up
4 changes: 4 additions & 0 deletions source/globals.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include <string>
#include "version.hpp"

std::string RandomizerVersion = RANDOMIZER_VERSION;
3 changes: 3 additions & 0 deletions source/globals.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <string>

extern std::string RandomizerVersion;
5 changes: 2 additions & 3 deletions source/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include "menu.hpp"
#include "patch.hpp"
#include "preset.hpp"
#include "randomizer.hpp"
#include "settings.hpp"
#include "globals.hpp"
#include "spoiler_log.hpp"
#include "location_access.hpp"
#include "debug.hpp"
Expand All @@ -34,7 +33,7 @@ void PrintTopScreen() {
consoleSelect(&topScreen);
consoleClear();
printf("\x1b[2;11H%sOcarina of Time 3D Randomizer%s", CYAN, RESET);
printf("\x1b[3;18H%s%s-%s%s", CYAN, RANDOMIZER_VERSION, COMMIT_NUMBER, RESET);
printf("\x1b[3;18H%s%s%s", CYAN, RandomizerVersion.c_str(), 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
4 changes: 0 additions & 4 deletions source/randomizer.hpp

This file was deleted.

3 changes: 1 addition & 2 deletions source/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include "music.hpp"
#include "sound_effects.hpp"
#include "random.hpp"
#include "randomizer.hpp"
#include "globals.hpp"
#include "descriptions.hpp"
#include "trial.hpp"
#include "keys.hpp"
Expand All @@ -27,7 +27,6 @@ using namespace SFX;

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

std::vector<std::string> NumOpts(int min, int max, int step = 1, std::string textBefore = {},
Expand Down
1 change: 0 additions & 1 deletion source/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ bool ValidateSettings();
std::string TitleId();

extern std::string seed;
extern std::string version;
extern std::array<u8, 5> hashIconIndexes;

extern Option OpenForest;
Expand Down
5 changes: 3 additions & 2 deletions source/spoiler_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "gold_skulltulas.hpp"
#include "enemizer.hpp"
#include "ocarina_notes.hpp"
#include "globals.hpp"

#include <3ds.h>
#include <cstdio>
Expand Down Expand Up @@ -848,7 +849,7 @@ bool SpoilerLog_Write() {
auto rootNode = spoilerLog.NewElement("spoiler-log");
spoilerLog.InsertEndChild(rootNode);

rootNode->SetAttribute("version", Settings::version.c_str());
rootNode->SetAttribute("version", RandomizerVersion.c_str());
rootNode->SetAttribute("seed", Settings::seed.c_str());
rootNode->SetAttribute("hash", GetRandomizerHashAsString().c_str());
rootNode->SetAttribute("xmlns:h", "http://www.w3.org/1999/xhtml");
Expand Down Expand Up @@ -901,7 +902,7 @@ bool PlacementLog_Write() {
auto rootNode = placementLog.NewElement("placement-log");
placementLog.InsertEndChild(rootNode);

rootNode->SetAttribute("version", Settings::version.c_str());
rootNode->SetAttribute("version", RandomizerVersion.c_str());
rootNode->SetAttribute("seed", Settings::seed.c_str());
rootNode->SetAttribute("hash", GetRandomizerHashAsString().c_str());

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
Loading