Skip to content

Commit

Permalink
Pack and upload dev versions (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Jul 13, 2024
1 parent c729899 commit 510dd50
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 8 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/pack-randomizer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ jobs:
- uses: actions/checkout@v4
- run: '& "Dolphin scripts/pack-rando.ps1"'
shell: pwsh
# upload-artifact will double zip, so unpack first
# https://github.com/actions/upload-artifact/issues/39
- name: Get pack filename
id: packname
run: |
echo "packname=$(
find -name 'Entrance Randomizer v*.zip' | sed 's/\.zip$//1' | sed 's/^\.\///1'
)" >> $GITHUB_OUTPUT
- name: Extract premade archive
run: |
7z x \
'${{ steps.packname.outputs.packname }}.zip' \
-o'${{ steps.packname.outputs.packname }}'
- uses: actions/upload-artifact@v4
with:
path: "Entrance Randomizer v*.zip"
name: ${{ steps.packname.outputs.packname }}
path: ${{ steps.packname.outputs.packname }}/*
4 changes: 3 additions & 1 deletion Dolphin scripts/Entrance Randomizer/lib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
from dolphin import memory # pyright: ignore[reportMissingModuleSource]
from lib.transition_infos import transition_infos

__version__ = "0.4.0"
__version = "0.4.0"
"""
Major: New major feature or functionality
Minor: Affects seed
Patch: Does't affect seed (assuming same settings)
"""
__dev_version = "local"
__version__ = f"{__version}-{__dev_version}"
print(f"Python version: {sys.version}")
print(f"Rando version: {__version__}")

Expand Down
8 changes: 5 additions & 3 deletions Dolphin scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ Shaman Shop:

1. Use this fork of Dolphin <https://github.com/Felk/dolphin/releases>.
2. Turn on "Scripting" logs and set Verbosity to "Error" or any option below (not "Notice").
3. Download the zip file from Discord or zip it yourself using `pack-rando.ps1`.
3. Download the randomizer zip file, either:
- from Discord;
- zip it yourself using `pack-rando.ps1`;
- download an unreleased [development build](https://github.com/Avasam/ptle-tools/actions/workflows/pack-randomizer.yaml?query=branch%3Amain+is%3Asuccess) (requires a GitHub account);
4. Open this zip file and drop "Scripts" at the root of your Dolphin installation (the location and names are important!).
5. Configurations are found in `Scripts/Entrance Randomizer/CONFIGS.py`.
6. In Dolphin, under "Scripts", click "Add new Scripts" and select `Scripts/Entrance Randomizer/__main__.py`.
Expand All @@ -57,12 +60,11 @@ In order to display the generated map take these steps:
- Some seeds will result in impossible to complete configurations, because you might need some items to progress that you don't have yet.
- When using `LINKED_TRANSITIONS = False` the generated `.graphml` map will become very hard to read, given the extreme amount of connections that will be drawn.
- In rare occasions, a transition might send you to the game-intended level instead of the level decided by the randomizer (this is an issue with the script patching the destination).
- In very rare occasions, a transition might not make you enter a level from the correct entrance, but make you enter from the default entrance instead
- In rare occasions, a transition might not make you enter a level from the correct entrance, but make you enter from the default entrance instead
- The odds of this happening increase dramatically if at any point in the run Harry died or a save file was loaded.
- Some linked transitions are not spawning at the right entrance and use the default entrance instead. Known cases:
- Jungle Canyon from Punchau Shrine
- Bittenbinder's Camp from Mysterious Temple
- With `LINKED_TRANSITIONS = True`, one-way transitions are not randomized at all.

### Developing

Expand Down
12 changes: 9 additions & 3 deletions Dolphin scripts/pack-rando.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
$ScriptsFolder = "$PSScriptRoot\Scripts"
$RandoFolderName = 'Entrance Randomizer'
$VersionLine = Get-Content "$PSScriptRoot\$RandoFolderName/lib/constants.py" | Select-String -Pattern '^__version__\s*=\s*".*"'
$RandoVersion = $VersionLine -replace '^\s*__version__\s*=\s*"', '' -replace '".*$', ''
$VersionFilePath = "$ScriptsFolder\$RandoFolderName/lib/constants.py"
Remove-Item -Path $ScriptsFolder -Recurse -ErrorAction SilentlyContinue
Copy-Item -Path "$PSScriptRoot\$RandoFolderName" -Destination "$ScriptsFolder\$RandoFolderName" -Recurse
Copy-Item -Path "$PSScriptRoot\..\Various technical notes\transition_infos.json" -Destination "$ScriptsFolder\$RandoFolderName\lib"
Compress-Archive -Path $ScriptsFolder -DestinationPath "$RandoFolderName v$RandoVersion.zip" -Force

$VersionFileContent = Get-Content $VersionFilePath
$VersionLine = $VersionFileContent | Select-String -Pattern '^__version\s*=\s*".*"'
$RandoVersion = $VersionLine -replace '^\s*__version\s*=\s*"', '' -replace '".*$', ''
$DevVersion = git rev-parse --short HEAD
$VersionFileContent -replace '^\s*__dev_version.*', "__dev_version = `"$DevVersion`"" | Set-Content $VersionFilePath

Compress-Archive -Path $ScriptsFolder -DestinationPath "$RandoFolderName v$RandoVersion-$DevVersion.zip" -Force
Remove-Item -Path $ScriptsFolder -Recurse

0 comments on commit 510dd50

Please sign in to comment.