From cdf0e70a35f40200fc496f3ea474a6654ad03c1d Mon Sep 17 00:00:00 2001 From: XcantloadX <3188996979@qq.com> Date: Tue, 6 Aug 2024 20:11:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A0=E6=B3=95=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E9=9D=9E=E7=AE=80=E4=B8=AD=E5=AD=98=E6=A1=A3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.en.md | 74 +++++++++++++++++++++++++++++++++++++++ README.md | 30 ++++++++++++++-- app/editor/save_editor.py | 2 +- app/repl.py | 2 +- 4 files changed, 104 insertions(+), 4 deletions(-) diff --git a/README.en.md b/README.en.md index e69de29..9faccab 100644 --- a/README.en.md +++ b/README.en.md @@ -0,0 +1,74 @@ +# PWAAT-Save-Editor + +## Features +* Import and export save files +* Convert save files between Steam and Xbox +* Unlock chapters +* Modify health in court +* Edit dialogue-box-related data + +## Todo +- [ ] Save slot management, including delete, copy, import/export, and sort save slots +- [ ] Forcefully convert save file language +- [ ] Support version on other platforms (Android, iOS, cracked Switch, etc.) +- [ ] Support for pirated PC copy +- [ ] Automatically detect and convert save file types upon import +- [ ] Tool for quick saves management + +## Basic Usage +### Download +1. Download the latest version of the editor from the [Release page](https://github.com/XcantloadX/PWAAT-Save-Editor/releases) + (Both versions with and without `REPL` will work) +2. Extract the files and run `PWAAT Save Editor.exe` + +### Import/Export Save Files +**Steam to Xbox:** Menu → Convert → "Xbox ← Steam" + +**Xbox to Steam:** Menu → Convert → "Xbox → Steam" + +**Import Steam Save:** Menu → Convert → "Steam ← File..." + +**Export Steam Save:** Menu → Convert → "Steam → File..." + +### Unlock Chapters +1. Close the game +2. Open any save file from the "File" menu +3. Adjust the settings in the "Unlock Chapters" group box as needed +4. "File" → "Save" +5. Re-launch the game + +### Modify Health +1. Open any save file from the "File" menu +2. Check if the automatically selected save file under "Select Save" is the one you want to edit; if not, change it to the desired save file +3. Adjust the health +4. "File" → "Save" +5. Reload the save file in the game + +## Advanced Usage +The GUI editor cannot cover all aspects of the save data. If you want to modify parts not available in the GUI editor, you can use the interactive shell based on PtPython to manually make changes. + +You can refer to the structure of the entire save data in the source files `app\structs\steam.py` and `app\structs\xbox.py`. Some fields have documentation comments, but most do not. + +1. Download the version with `REPL` +2. Open any save file, then "File" → "Run REPL" +3. Switch to the CMD window and read the prompts + +> [!IMPORTANT] +> The GUI and REPL operate separately, and unsaved changes are not synced between them. +> It's recommended to save before running and exiting the REPL. + +> [!TIP] +> It's recommended to run REPL in Windows Terminal. + +## Translation +1. Install [gettext](https://mlocati.github.io/articles/gettext-iconv-windows.html) +2. Clone the project +3. Determine the language code and country code for the target language, which can be found [here](https://www.gnu.org/software/gettext/manual/gettext.html#Language-Codes) and [here](https://www.gnu.org/software/gettext/manual/gettext.html#Country-Codes). +4. Create the folder `.\locales\{language_code}_{country_code}\LC_MESSAGES` +5. Copy `.\locales\base.pot` to `.\locales\{language_code}_{country_code}\LC_MESSAGES\base.po` +6. Translate the copied `.po` file +7. Run `.\translation compile` using PowerShell + +## References +* [Phoenix Wright Trilogy Save Data Research](https://gist.github.com/emiyl/1435ce18a6b1e0a5c2a74e15c19f4884) +* [emiyl / PWAATeditor](https://github.com/emiyl/PWAATeditor/tree/v0.3.0) \ No newline at end of file diff --git a/README.md b/README.md index a6ae035..bc81c37 100644 --- a/README.md +++ b/README.md @@ -5,10 +5,20 @@ * Steam 与 Xbox 存档互相转换 * 解锁章节 * 修改法庭内血量 +* 修改对话框相关数据 -## 使用教程 +## Todo +- [ ] 存档槽位管理,包括删除、复制、导入导出、排序存档槽位 +- [ ] 强制转换存档语言 +- [ ] 支持其他平台的重制版(Android、iOS、破解 Switch 等) +- [ ] 支持 PC 盗版 +- [ ] 导入存档自动检测类型并转换 +- [ ] 用于快速备份管理存档工具 + +## 基础用法 ### 下载 -1. 在 [Release 页](https://github.com/XcantloadX/PWAAT-Save-Editor/releases)下载最新版本的编辑器 +1. 在 [Release 页](https://github.com/XcantloadX/PWAAT-Save-Editor/releases)下载最新版本的编辑器 +(带 `REPL` 与不带 `REPL` 的两个版本均可) 2. 解压后运行 `PWAAT Save Editor.exe` ### 导入/导出存档 @@ -34,6 +44,22 @@ Xbox 转 Steam:菜单栏 → 转换 → “Xbox → Steam” 4. “文件” → “保存” 5. 在游戏内重新读取该存档 +## 高级用法 +由于精力限制,GUI 中无法涵括存档数据中的方方面面。如果你想要修改 GUI 中没有的部分,可以使用基于 PtPython 的交互式 Shell,自己手动敲代码修改。 + +整个存档数据的结构可以在源代码 `app\structs\steam.py` 与 `app\structs\xbox.py` 文件中查阅。部分字段已经有文档注释,但是大部分没有。 + +1. 下载带 `REPL` 的版本 +2. 打开任意存档,然后 “文件” → “运行 REPL” +3. 切换到 CMD 窗口,阅读提示 + +> [!IMPORTANT] +> GUI 与 REPL 是分隔运行的,两者的未保存修改不会同步。 +> 因此打开与关闭 REPL 前均建议保存。 + +> [!TIP] +> 建议使用 Windows Terminal 运行 REPL。 + ## 翻译 1. 安装 [gettext](https://mlocati.github.io/articles/gettext-iconv-windows.html) 2. Clone 项目到本地 diff --git a/app/editor/save_editor.py b/app/editor/save_editor.py index 296b26a..6eb93b8 100644 --- a/app/editor/save_editor.py +++ b/app/editor/save_editor.py @@ -452,7 +452,7 @@ def real_slot_number(self, slot_number: int) -> int: 获取实际存档槽位号 """ assert self.__check_save_loaded(self.__preside_data) - return slot_number + 50 + return slot_number + self.preside_data.system_data_.option_work_.language_type * 10 if __name__ == '__main__': from pprint import pprint diff --git a/app/repl.py b/app/repl.py index a4f860d..5f74089 100644 --- a/app/repl.py +++ b/app/repl.py @@ -37,7 +37,7 @@ print() print('Enter `exit` to exit the REPL.') print('Use `dir()` to list available methods and attributes.') -print('Use `help(/)` to get help (Only Chinese currently).') +# print('Use `help(/)` to get help (Only Chinese currently).') print() print('The GUI will freeze when the REPL is running.') print('Changes made in the REPL will not be reflected in the GUI. So make sure to call `save()` to save changes before exiting.')