Skip to content

Commit

Permalink
修复无法修改非简中存档数据
Browse files Browse the repository at this point in the history
  • Loading branch information
XcantloadX committed Aug 6, 2024
1 parent 052f387 commit cdf0e70
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 4 deletions.
74 changes: 74 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -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)
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

### 导入/导出存档
Expand All @@ -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 项目到本地
Expand Down
2 changes: 1 addition & 1 deletion app/editor/save_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
print()
print('Enter `exit` to exit the REPL.')
print('Use `dir()` to list available methods and attributes.')
print('Use `help(<method>/<attribute>)` to get help (Only Chinese currently).')
# print('Use `help(<method>/<attribute>)` 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.')
Expand Down

0 comments on commit cdf0e70

Please sign in to comment.