-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add versions with Japanese Pokémon names
- Loading branch information
Showing
3 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
$PCTRTools = "tools/PCTRTools/bin/Release/net8.0/publish/PCTRTools.exe" | ||
|
||
python scripts/merge_messages_for_japanese_names.py | ||
|
||
& "$PCTRTools" "text-import" -c "files/CharTable.txt" -i "original_files/DP/data/msgdata/msg.narc" -t "temp/DP/messages_J.txt" -o "out/DP_J/data/msgdata/msg.narc" | ||
& "$PCTRTools" "text-import" -c "files/CharTable.txt" -i "original_files/Pt/data/msgdata/pl_msg.narc" -t "temp/Pt/messages_J.txt" -o "out/Pt_J/data/msgdata/pl_msg.narc" | ||
& "$PCTRTools" "text-import" -c "files/CharTable.txt" -i "original_files/HGSS/data/a/0/2/7" -t "temp/HGSS/messages_J.txt" -o "out/HGSS_J/data/a/0/2/7" | ||
|
||
dotnet script scripts/pad_text.csx "original_files/DP/data/msgdata/msg.narc" "out/DP_J/data/msgdata/msg.narc" | ||
dotnet script scripts/pad_text.csx "original_files/Pt/data/msgdata/pl_msg.narc" "out/Pt/data/msgdata/pl_msg.narc" | ||
dotnet script scripts/pad_text.csx "original_files/HGSS/data/a/0/2/7" "out/HGSS_J/data/a/0/2/7" | ||
|
||
Compress-Archive -Path "out/DP_J/*" -DestinationPath "out/Patch-DP_J.zip" -Force | ||
Move-Item out/Patch-DP_J.zip out/Patch-DP_J.xzp -Force | ||
Compress-Archive -Path "out/Pt_J/*" -DestinationPath "out/Patch-Pt_J.zip" -Force | ||
Move-Item out/Patch-Pt_J.zip out/Patch-Pt_J.xzp -Force | ||
Compress-Archive -Path "out/HGSS_J/*" -DestinationPath "out/Patch-HGSS_J.zip" -Force | ||
Move-Item out/Patch-HGSS_J.zip out/Patch-HGSS_J.xzp -Force | ||
Compress-Archive -Path "out/Patch-*_J.xzp" -DestinationPath "out/Patches-J.zip" -Force | ||
Remove-Item -Path "out/Patch-*_J.xzp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import os | ||
|
||
from helper import DIR_TEMP, DIR_TEXTS, GAMES, GameInfo, load_game_data | ||
|
||
|
||
def merge_messages_for_japanese_names(games: list[GameInfo], texts_root: str, output_root: str): | ||
version = os.environ.get("XZ_PATCH_VERSION", "UNKNOWN")[:7] | ||
|
||
for game_info in games: | ||
game = game_info["game"] | ||
file_name = game_info["file_name"].replace(".txt", "_J.txt") | ||
languages = game_info["languages"] | ||
game_data = load_game_data(game_info, texts_root) | ||
|
||
file_ids = sorted(game_data[languages[0]].keys()) | ||
os.makedirs(f"{output_root}/{game}", exist_ok=True) | ||
with open(f"{output_root}/{game}/{file_name}", "w", -1, "utf8", None, "\n") as writer: | ||
writer.write("#4\n") | ||
for lang_i, language in enumerate(languages): | ||
for file_id in file_ids: | ||
if f"{game}-{file_id}" in {"DP-324", "DP-356", "Pt-369", "Pt-408", "HGSS-198", "HGSS-232"}: | ||
continue | ||
lines = game_data[language].get(file_id, game_data[languages[0]][file_id]) | ||
if len(lines) == 0: | ||
continue | ||
|
||
if len(languages) == 1: | ||
writer.write(f"{file_id}\n") | ||
else: | ||
writer.write(f"{file_id}-{lang_i}\n") | ||
|
||
for i, line in lines.items(): | ||
line = ( | ||
line.replace("\\f\n", "\\f").replace("\\r\n", "\\r").replace("\n", "\\n").replace("${VERSION}", f"{version}+J") | ||
) | ||
if f"{game}-{file_id}" in {"DP-13", "DP-23", "Pt-17"} and line.startswith("盒子"): | ||
continue | ||
writer.write(f"{i}\t{line}\n") | ||
|
||
print(f"Merged: {game}/{file_name}") | ||
|
||
|
||
if __name__ == "__main__": | ||
merge_messages_for_japanese_names(GAMES, DIR_TEXTS, DIR_TEMP) |