镜像:KintaroModding/phantombladezero_letsdieagain(2026-11-30,快照)

This commit is contained in:
gitea committed 2026-11-30 00:26:25 +08:00
commit b3a3ee3639
13 files changed
+554

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
* text=auto eol=lf
*.uasset binary
*.uexp binary
*.pak binary
*.utoc binary
*.ucas binary
*.locres binary
+2
View File
@@ -0,0 +1,2 @@
dist/
__pycache__/
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Kintaro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+75
View File
@@ -0,0 +1,75 @@
# Let's Die Again!
The main menu's CONTINUE entry reads LET'S DIE AGAIN! instead (English text).
A mod for Phantom Blade Zero (Unreal Engine 5.7), made with game version `CL-301524_JKS-17219`. This README is
for developers. What the mod does, how to install it and its compatibility are in [openmods.md](openmods.md), the mod
page on [openmods](https://openmods.nexus).
## How it works
The game keeps its texts in one file per language in its `ProjectPBZ-Windows.pak`. The mod replaces the English one,
`ProjectPBZ/Content/Localization/Game/en-US/Game.locres` (locres version 3, namespace `Default`, 11256 entries in patch 1.0304629), with
a copy in which one text changes:
| Namespace | Key | Game | Mod |
|---|---|---|---|
| `Default` | `UI_StartMenu_02` | `CONTINUE` | `LET'S DIE AGAIN!` |
The game's start menu script sets the Continue button's text from this key (`StartMenu.js`, `InitText`). Only this
key changes; its source hash and every other entry stay as they are. The text is in capitals like the other menu
entries (NEW GAME, LOAD GAME, SETTINGS, QUIT GAME). The first commit holds the game's original file; a text dump of
both files (for example with a `.locres` tool) differs in this one line.
The mod replaces whole files. A mod that changes the same files conflicts with this one, and a game update that
changes them needs a new build of the mod from the new files.
## Build
Requirements:
- Windows PowerShell 5.1 (part of Windows).
- [repak](https://github.com/trumank/repak/releases) v0.2.3 and [retoc](https://github.com/trumank/retoc/releases)
v0.1.5. `build.ps1` looks for `_tools\repak\repak.exe` and `_tools\retoc\retoc.exe` in the parent folders of the
project; set `UE5_TOOLS` to a folder that holds both to use another place.
- Optional, for mods with JavaScript: [Node.js](https://nodejs.org/) for the syntax check and the offline test
(`tests\test_mod.js`).
```powershell
powershell -ExecutionPolicy Bypass -File .\build.ps1 # dist\phantombladezero_letsdieagain_P.pak/.utoc/.ucas
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Deploy # build, then copy the files to Paks\~mods
powershell -ExecutionPolicy Bypass -File .\deploy.ps1 -Wait # copy the files when the game is closed
```
The build checks every `.js` in `src` with `node --check` and runs `tests\test_mod.js` when there is one. Then it
packs `src` into a `.pak` (repak, pak version V11, mount point `../../../`), writes an empty IoStore container of the
same name (retoc `to-zen`; an IoStore game can ignore a `.pak` without one), and checks that the pak holds exactly
the files of `src`, byte for byte.
`deploy.ps1` copies the three files to `<game folder>\ProjectPBZ\Content\Paks\~mods`. The game folder comes from `gameDir` in
`_tools\gamedata\phantombladezero\game.json`, else `$env:UE5_GAMES_DIR\PBZ`; `-GameDir` or `-ModsDir` override
it. The running game locks the files, so the script stops (exit code 2) or, with `-Wait`, waits until the game is
closed.
Versioning: every change raises the second number in `mod.json` (1.0 -> 1.1): `python scripts\bump_version.py`.
## Project layout
```
src/ Mod source: the changed game files at their path in the game's .pak
tests/test_mod.js Offline test of the scripts (Node.js; only for mods with JavaScript)
dist/ Build output: the .pak/.utoc/.ucas for Paks\~mods (git-ignored)
docs/ Cover and screenshots for openmods.md
scripts/bump_version.py Raises the version in mod.json
build.ps1 Checks and builds dist\ from src\
deploy.ps1 Copies the build to the game's Paks\~mods folder
mod.json Name, version, game, engine and file names
```
The first commit with a game file holds the original file, so `git diff` against it shows exactly what the mod
changes.
## License
MIT, see [LICENSE](LICENSE). The files in `src` are the game's own files with the changes above; Phantom Blade Zero and
its files belong to their makers.
+161
View File
@@ -0,0 +1,161 @@
<#
.SYNOPSIS
Builds the mod (the src folder) into dist\<pakName>.pak/.utoc/.ucas, the files for the game's Paks\~mods folder.
.DESCRIPTION
The mod changes loose files of the game's classic .pak (for example the game's Puerts JavaScript or its .locres
text files), not .uasset assets. Reads mod.json. Uses repak and retoc from the shared _tools folder of the modding
base folder ($env:UE5_TOOLS overrides it), and Node.js when it is installed:
1. checks the syntax of every src\**\*.js (node --check) and runs the offline test tests\test_mod.js when the
project has one; without Node.js both are skipped with a warning;
2. packs src into dist\<pakName>.pak with repak (pak version V11, mount point ../../../): the files keep their
game path below src, for example src\<Project>\Content\JavaScript\UI\Widget\<script>.js;
3. writes an empty IoStore container dist\<pakName>.utoc/.ucas with retoc to-zen (retoc packs no loose files).
A UE5 IoStore game ignored a .pak without a .utoc/.ucas of the same name (a text mod in Mortal Shell II);
4. checks the result: the pak holds exactly the files of src, each with the bytes of its source.
With -Deploy, deploy.ps1 then copies the three files into the game's Paks\~mods folder. After a good build, dist\
holds only the three mod files.
.EXAMPLE
powershell -ExecutionPolicy Bypass -File .\build.ps1
.EXAMPLE
powershell -ExecutionPolicy Bypass -File .\build.ps1 -Deploy
#>
param(
# Copy the files to the game's Paks\~mods folder after the build (see deploy.ps1).
[switch]$Deploy,
# The game's install folder, passed on to deploy.ps1. Default: see deploy.ps1.
[string]$GameDir
)
$ErrorActionPreference = "Stop"
$root = $PSScriptRoot
$mod = Get-Content (Join-Path $root "mod.json") -Raw | ConvertFrom-Json
$src = Join-Path $root "src"
$dist = Join-Path $root "dist"
$zen = Join-Path $dist "zen"
$verify = Join-Path $dist "verify"
# The shared tools: $env:UE5_TOOLS, else the first _tools folder above the project.
function Find-Tools {
if ($env:UE5_TOOLS) {
return $env:UE5_TOOLS
}
$dir = Split-Path $root -Parent
while ($dir) {
$candidate = Join-Path $dir "_tools"
if (Test-Path $candidate) {
return $candidate
}
$dir = Split-Path $dir -Parent
}
throw "No _tools folder above $root. Put repak and retoc into _tools\repak and _tools\retoc above the project, or set UE5_TOOLS."
}
$tools = Find-Tools
$repak = Join-Path $tools "repak\repak.exe"
$retoc = Join-Path $tools "retoc\retoc.exe"
foreach ($tool in @($repak, $retoc)) {
if (-not (Test-Path $tool)) {
throw "$tool not found. repak: https://github.com/trumank/repak/releases, retoc: https://github.com/trumank/retoc/releases"
}
}
$sources = @(Get-ChildItem $src -Recurse -File)
if ($sources.Count -eq 0) {
throw "No files in $src."
}
# 1. JavaScript: syntax and the offline test.
$scripts = @($sources | Where-Object { $_.Extension -eq ".js" })
$test = Join-Path $root "tests\test_mod.js"
if ($scripts.Count -gt 0 -or (Test-Path $test)) {
$node = Get-Command node -ErrorAction SilentlyContinue
if ($node) {
foreach ($js in $scripts) {
& $node.Source --check $js.FullName
if ($LASTEXITCODE -ne 0) {
throw "JavaScript syntax error in $($js.FullName.Substring($src.Length + 1)). Nothing was built."
}
}
if (Test-Path $test) {
& $node.Source $test
if ($LASTEXITCODE -ne 0) {
throw "tests\test_mod.js failed (see above). Nothing was built."
}
}
} else {
Write-Host "JavaScript check and test skipped: Node.js not found." -ForegroundColor Yellow
}
}
New-Item -ItemType Directory -Force $dist | Out-Null
foreach ($folder in @($zen, $verify)) {
if (Test-Path -LiteralPath $folder) {
Remove-Item -LiteralPath $folder -Recurse -Force
}
}
foreach ($extension in @("pak", "utoc", "ucas")) {
$old = Join-Path $dist "$($mod.pakName).$extension"
if (Test-Path $old) {
Remove-Item $old
}
}
# 2. The pak with the changed files.
$pak = Join-Path $dist "$($mod.pakName).pak"
& $repak pack --version V11 --quiet $src $pak
if ($LASTEXITCODE -ne 0 -or -not (Test-Path $pak)) {
throw "repak pack failed with exit code $LASTEXITCODE"
}
# 3. The empty IoStore container of the same name (retoc also writes a .pak without files; it is not used).
$zenStage = Join-Path $zen "stage"
New-Item -ItemType Directory -Force $zenStage | Out-Null
& $retoc to-zen --version $mod.engine $zenStage (Join-Path $zen "$($mod.pakName).utoc")
if ($LASTEXITCODE -ne 0) {
throw "retoc to-zen failed with exit code $LASTEXITCODE"
}
foreach ($extension in @("utoc", "ucas")) {
$file = Join-Path $zen "$($mod.pakName).$extension"
if (-not (Test-Path $file)) {
throw "retoc did not write $($mod.pakName).$extension"
}
Move-Item $file $dist
}
# 4. The check: unpack the pak and compare every file with its source, byte for byte.
& $repak unpack --quiet --output $verify $pak
if ($LASTEXITCODE -ne 0) {
throw "repak unpack (check) failed with exit code $LASTEXITCODE"
}
$packed = @(Get-ChildItem $verify -Recurse -File | ForEach-Object { $_.FullName.Substring($verify.Length + 1) } | Sort-Object)
$expected = @($sources | ForEach-Object { $_.FullName.Substring($src.Length + 1) } | Sort-Object)
if (Compare-Object $packed $expected) {
throw "The pak holds other files than src: packed $($packed -join ', '); expected $($expected -join ', ')"
}
foreach ($relative in $expected) {
$a = (Get-FileHash -Algorithm SHA256 -LiteralPath (Join-Path $src $relative)).Hash
$b = (Get-FileHash -Algorithm SHA256 -LiteralPath (Join-Path $verify $relative)).Hash
if ($a -ne $b) {
throw "Packed $relative differs from its source. Nothing was deployed."
}
Write-Host "Checked: $relative"
}
foreach ($folder in @($zen, $verify)) {
Remove-Item -LiteralPath $folder -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "Built:"
Get-ChildItem (Join-Path $dist "$($mod.pakName).*") | ForEach-Object { Write-Host " $($_.Name) ($($_.Length) bytes)" }
if ($Deploy) {
$deployArgs = @{}
if ($GameDir) {
$deployArgs.GameDir = $GameDir
}
& (Join-Path $root "deploy.ps1") @deployArgs
exit $LASTEXITCODE
}
+152
View File
@@ -0,0 +1,152 @@
<#
.SYNOPSIS
Copies the built mod (dist\<pakName>.pak/.utoc/.ucas) into the game's Paks\~mods folder and replaces old files
safely.
.DESCRIPTION
The running game locks the package files it loaded, and a file must not change while the game runs. The script
checks all three target files first; with -Wait it waits until the game is closed. Each file is copied under a
temporary name, checked, and then swapped in with one rename, so the game never sees a half-written file.
Exit codes: 0 = deployed or already up to date, 2 = the game is running (without -Wait), 1 = error.
.EXAMPLE
powershell -ExecutionPolicy Bypass -File .\deploy.ps1
.EXAMPLE
powershell -ExecutionPolicy Bypass -File .\deploy.ps1 -Wait
#>
param(
# The game's install folder. Default: gameDir of _tools\gamedata\<game>\game.json, else $env:UE5_GAMES_DIR\<gameFolder of mod.json>.
[string]$GameDir,
# The mods folder. Default: <GameDir>\<paksPath of mod.json>\~mods.
[string]$ModsDir,
# Wait until the game releases the files instead of stopping.
[switch]$Wait,
[int]$WaitMinutes = 360
)
$ErrorActionPreference = "Stop"
# The game folder: "gameDir" of _tools\gamedata\<game>\game.json, for a game outside UE5_GAMES_DIR (for example in a
# Steam library), else $env:UE5_GAMES_DIR\<gameFolder of mod.json>; $null when neither is known. The tools folder is
# $env:UE5_TOOLS, else the first _tools folder above the project (a plain clone has none).
function Get-GameDir {
$toolsDir = $env:UE5_TOOLS
if (-not $toolsDir -and $PSScriptRoot) {
$dir = Split-Path $PSScriptRoot -Parent
while (-not $toolsDir -and $dir) {
if (Test-Path (Join-Path $dir "_tools")) {
$toolsDir = Join-Path $dir "_tools"
}
$dir = Split-Path $dir -Parent
}
}
if ($toolsDir) {
$gameJson = Join-Path $toolsDir "gamedata\$($mod.game)\game.json"
if (Test-Path $gameJson) {
$gameInfo = Get-Content $gameJson -Raw | ConvertFrom-Json
if ($gameInfo.gameDir) {
return $gameInfo.gameDir
}
}
}
if ($env:UE5_GAMES_DIR) {
return Join-Path $env:UE5_GAMES_DIR $mod.gameFolder
}
return $null
}
$mod = Get-Content (Join-Path $PSScriptRoot "mod.json") -Raw | ConvertFrom-Json
if (-not $ModsDir) {
if (-not $GameDir) {
$GameDir = Get-GameDir
}
if (-not $GameDir) {
throw "The game folder is unknown: set UE5_GAMES_DIR (the folder that holds '$($mod.gameFolder)'), give the game a gameDir in _tools\gamedata\$($mod.game)\game.json, or use -GameDir or -ModsDir."
}
$paks = Join-Path $GameDir $mod.paksPath
if (-not (Test-Path $paks)) {
throw "The game's Paks folder is not there: $paks"
}
$ModsDir = Join-Path $paks "~mods"
}
New-Item -ItemType Directory -Force $ModsDir | Out-Null
function Test-Locked([string]$Path) {
if (-not (Test-Path $Path)) {
return $false
}
try {
$stream = [System.IO.File]::Open($Path, 'Open', 'ReadWrite', 'None')
$stream.Close()
return $false
} catch {
return $true
}
}
function Get-Hash([string]$Path) {
try {
return (Get-FileHash $Path -ErrorAction Stop).Hash
} catch {
return $null
}
}
$files = @()
foreach ($extension in @("pak", "utoc", "ucas")) {
$name = "$($mod.pakName).$extension"
$source = Join-Path $PSScriptRoot "dist\$name"
if (-not (Test-Path $source)) {
throw "$source not found. Build it first with build.ps1."
}
$files += [pscustomobject]@{ Source = $source; Target = (Join-Path $ModsDir $name); Hash = (Get-Hash $source) }
}
$changed = @($files | Where-Object { (Get-Hash $_.Target) -ne $_.Hash })
if ($changed.Count -eq 0) {
Write-Host "Already up to date: $ModsDir\$($mod.pakName).*" -ForegroundColor Green
exit 0
}
$locked = @($changed | Where-Object { Test-Locked $_.Target })
if ($locked.Count -gt 0) {
if (-not $Wait) {
Write-Host "The game is running and uses $($locked[0].Target)." -ForegroundColor Yellow
Write-Host "Close the game and run this again, or use the -Wait option." -ForegroundColor Yellow
exit 2
}
Write-Host "The game is running. Waiting until it is closed (checking every 5 seconds)..."
$deadline = (Get-Date).AddMinutes($WaitMinutes)
while (@($changed | Where-Object { Test-Locked $_.Target }).Count -gt 0) {
if ((Get-Date) -gt $deadline) {
throw "The game did not release the mod files within $WaitMinutes minutes."
}
Start-Sleep -Seconds 5
}
}
foreach ($file in $changed) {
$temp = "$($file.Target).tmp"
Copy-Item $file.Source $temp -Force
if ((Get-Hash $temp) -ne $file.Hash) {
Remove-Item $temp -Force
throw "The copy in $temp is damaged. $($file.Target) was not replaced."
}
try {
if (Test-Path $file.Target) {
# [NullString]::Value: Windows PowerShell passes $null as "" to string parameters.
[System.IO.File]::Replace($temp, $file.Target, [NullString]::Value)
} else {
Move-Item $temp $file.Target
}
} catch {
Remove-Item $temp -Force -ErrorAction SilentlyContinue
throw "Could not replace $($file.Target) (did the game start again?): $($_.Exception.Message)"
}
if ((Get-Hash $file.Target) -ne $file.Hash) {
throw "Check failed: $($file.Target) does not match $($file.Source)."
}
}
Write-Host "Deployed $($changed.Count) file(s) to $ModsDir" -ForegroundColor Green
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+14
View File
@@ -0,0 +1,14 @@
{
"name": "Let's Die Again!",
"folder": "phantombladezero_letsdieagain",
"author": "Kintaro",
"version": "1.1",
"description": "The main menu's CONTINUE entry reads LET'S DIE AGAIN! instead (English text).",
"kind": "pakfile",
"game": "phantombladezero",
"gameFolder": "PBZ",
"paksPath": "ProjectPBZ\\Content\\Paks",
"gameVersion": "CL-304629_JKS-17496",
"engine": "UE5_7",
"pakName": "phantombladezero_letsdieagain_P"
}
+10
View File
@@ -0,0 +1,10 @@
{
"$schema": "https://openmods.nexus/openmods.schema.json",
"openmods": 1,
"name": "Let's Die Again!",
"summary": "The main menu's CONTINUE entry reads LET'S DIE AGAIN! instead (English text).",
"games": ["phantom-blade-zero"],
"tags": ["ui"],
"gameVersions": ["Patch 1.0304629 (Steam build 26936481)"],
"cover": "docs/cover.webp"
}
+56
View File
@@ -0,0 +1,56 @@
# Let's Die Again!
The main menu's CONTINUE entry reads LET'S DIE AGAIN! instead (English text).
## What it does
- The main menu's CONTINUE entry says LET'S DIE AGAIN! instead.
- It still does what CONTINUE does: it loads your last save.
- Only the English text changes. Nothing else in the game changes.
## Screenshots
![The main menu with LET'S DIE AGAIN! in place of CONTINUE](docs/screen1.webp)
## How to install
1. Download the zip of the latest release on GitHub (`phantombladezero_letsdieagain_<version>.zip`).
2. Open the game folder `ProjectPBZ\Content\Paks\`. If it has no folder `~mods`, create it.
3. Unpack the three files of the zip (`phantombladezero_letsdieagain_P.pak`, `.utoc` and `.ucas`) into `ProjectPBZ\Content\Paks\~mods\`.
4. Start the game.
To update the mod, replace the three files with the ones of the new release. To remove it, delete the three files.
## How to use
Nothing to do: play the game in English and look at the main menu.
## Compatibility
- Game version: patch 1.0304629 of 2026-11-28 (Steam build 26936481, `CL-304629_JKS-17496`). Version 1.0 was made for the release build and brings back the release's English texts on this patch; use 1.1.
- No UE4SS needed.
- The mod replaces the game's English text file, `ProjectPBZ/Content/Localization/Game/en-US/Game.locres` (every
English text of the game, with one of them changed). A mod that replaces the same file, for example another text
mod or a fix of the English texts, conflicts with this one; only one of them works.
## Known issues
- Only English: in the other 15 languages the entry keeps the game's own text.
- After a game update that changes any English text, this mod brings the old texts back until a new version of the
mod is out. Remove the mod if texts look wrong after an update.
## How to build
Anyone can build this mod from its source code and check that the download matches it.
1. Install the tools: Windows PowerShell 5.1 (part of Windows), [repak](https://github.com/trumank/repak/releases)
v0.2.3 and [retoc](https://github.com/trumank/retoc/releases) v0.1.5 in a folder `_tools\repak\` and `_tools\retoc\`
above the repository (or set `UE5_TOOLS`); optional: [Node.js](https://nodejs.org/) for the check of JavaScript.
`README.md` has the details.
2. Build it: `powershell -ExecutionPolicy Bypass -File .\build.ps1`
3. Find the files: `dist\phantombladezero_letsdieagain_P.pak`, `.utoc` and `.ucas`.
## Credits
Made by Kintaro. MIT license: you may use, change and share this mod. Phantom Blade Zero and its files belong to
their makers; the mod changes only what is listed above.
+56
View File
@@ -0,0 +1,56 @@
"""Raises the version of the mod by one step: the second number (1.0 -> 1.1, 1.9 -> 1.10).
The version is in mod.json ("version": "<major>.<minor>"). A UE4SS mod also writes it into its log line, so the
script also changes the line `local VERSION = "<major>.<minor>"` in src/<folder>/Scripts/main.lua when that file
exists. The rest of both files keeps its layout.
Usage:
python scripts/bump_version.py # 1.0 -> 1.1
python scripts/bump_version.py --major # 1.4 -> 2.0, only when the user says so
python scripts/bump_version.py --show # print the version
"""
import json
import re
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
MOD_JSON = ROOT / "mod.json"
VERSION = re.compile(r"^(\d+)\.(\d+)$")
JSON_VERSION = re.compile(r'("version"\s*:\s*")([^"]*)(")')
LUA_VERSION = re.compile(r'^(local VERSION = ")([^"]*)(")', re.MULTILINE)
def main() -> None:
text = MOD_JSON.read_text(encoding="utf-8")
mod = json.loads(text)
current = mod["version"]
match = VERSION.match(current)
if not match:
sys.exit(f'mod.json: version "{current}" is not <major>.<minor>')
lua = ROOT / "src" / mod["folder"] / "Scripts" / "main.lua"
lua_text = lua.read_text(encoding="utf-8") if lua.is_file() else None
if lua_text is not None:
lua_match = LUA_VERSION.search(lua_text)
if lua_match is None:
sys.exit(f"{lua}: no line 'local VERSION = \"<major>.<minor>\"'")
if lua_match.group(2) != current:
sys.exit(f"Versions differ: mod.json {current}, main.lua {lua_match.group(2)}. Make them equal first.")
if "--show" in sys.argv:
print(current)
return
major, minor = int(match.group(1)), int(match.group(2))
new = f"{major + 1}.0" if "--major" in sys.argv else f"{major}.{minor + 1}"
MOD_JSON.write_text(JSON_VERSION.sub(lambda m: m.group(1) + new + m.group(3), text, count=1),
encoding="utf-8", newline="\n")
if lua_text is not None:
lua.write_text(LUA_VERSION.sub(lambda m: m.group(1) + new + m.group(3), lua_text, count=1),
encoding="utf-8", newline="\n")
print(f"Version {current} -> {new}")
if __name__ == "__main__":
main()