Skip to content

Commit f4639dd

Browse files
authored
Add files via upload
Update files
1 parent 426cf9d commit f4639dd

File tree

8 files changed

+79
-72
lines changed

8 files changed

+79
-72
lines changed

README.md

Lines changed: 56 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
# Mages引擎工具集
2-
从头开始写的Go版,算是对以前的工具进行一次整合和完善,进度会很慢,结构会经常大改
3-
目标是完成尽可能通用的Mages工具集,目前仅以脚本为主
1+
# Mages Engine Toolkit
2+
English localization of wetor's MagesTools tool.
43

5-
## 适配游戏
6-
- 理论支持所有Mages引擎的游戏
7-
- 所有的MES(msb)SC3(scx)脚本都可正常导出导入
4+
## Game Compatibility
5+
- Theoretically supports all games powered by the Mages engine
6+
- All MES (msb) and SC3 (scx / scr) scripts can be exported and imported without issues
87

98
## Usage
109
```
@@ -43,64 +42,71 @@
4342
4443
4544
```
46-
### Example
45+
### Examples
4746

4847
```shell
49-
# 导出文件夹所有,使用tbl码表,格式为NpcsP,不跳过码表中相同字符,开启debug模式为2
48+
# Export all files in the folder using the tbl code table in NpcsP format. Do not skip identical characters in the code table. Enable debug mode with value 2.
5049
MagesTools -type=script -export -skip=false -debug=2\
5150
-format=NpcsP \
5251
-tbl=./data/CC/MJPN.txt \
5352
-source=./data/CC/script/mes00 \
5453
-output=./data/CC/txt
5554

5655

57-
# 导出文本,使用tbl码表,格式为NpcsP,跳过码表中相同字符
56+
# Export text using the tbl code table in NpcsP format, skipping identical characters in the code table.
5857
MagesTools -type=script -export -skip=true \
5958
-format=NpcsP \
6059
-tbl=./data/CC/MJPN.txt \
6160
-source=./data/temp/1.msb \
6261
-output=./data/temp/1.msb.txt
6362

6463

65-
# 导入文本,使用tbl码表,格式为NpcsP,跳过码表中相同字符
64+
# Import text using the tbl code table in NpcsP format, skipping identical characters in the code table.
6665
MagesTools -type=script -import -skip=false \
6766
-format=NpcsP \
6867
-tbl=./data/CC/MJPN.txt \
6968
-source=./data/temp/1.msb \
7069
-input=./data/temp/1.msb.txt \
7170
-output=./data/temp/1.msb.txt.msb
7271

73-
# RNE使用以下参数
74-
# 导出文本,使用charset码表,格式为Npcs,不跳过码表中相同字符
72+
# RNE uses the following parameters:
73+
# Export text using the charset character set in Npcs format, without skipping identical characters in the character set.
7574
MagesTools -type=script -export -skip=false \
7675
-format=Npcs \
7776
-charset=./data/RNE/Charset_PSV_JP.utf8 \
7877
-source=./data/temp/1.msb \
7978
-output=./data/temp/1.msb.txt
8079

8180

82-
# 导入文本,使用charset码表,格式为Npcs,不跳过码表中相同字符
81+
# Import text using the charset character set, formatted as Npcs, without skipping identical characters in the character set.
8382
MagesTools -type=script -import -skip=false \
8483
-format=Npcs \
8584
-charset=./data/RNE/Charset_PSV_JP.utf8 \
8685
-source=./data/temp/1.msb \
8786
-input=./data/temp/1.msb.txt \
8887
-output=./data/temp/1.msb.txt.msb
89-
90-
# 对比文件
88+
89+
# 11eyes CrossOver Xbox 360 parameters
90+
# Exporting script (extract to text), no skipping, debug lv 2, format as Npcs
91+
MagesTools -type=script -export -skip=false -debug=2 -charset ./charset/eleveneyes.utf8 -format=Npcs -source ../magesgame/script -output ../magesgame/scrout
92+
# Importing script (replacing in the file), no skipping, debug lv 2, format as Npcs
93+
MagesTools -type=script -import -skip=false -debug=2 -charset=./charset/eleveneyes.utf8 -format=Npcs -source=../magesgame/script/SC000.scr -input=./script-tl/SC000-tl.txt -output=./script-tl/output/SC000-tex.scr
94+
95+
# File comparison
9196
MagesTools -type=diff \
9297
-input=./data/temp/1.msb \
9398
-output=./data/temp/1.msb.txt.msb
9499
```
95100

96101
## Script
97-
### 格式
98-
目前的格式为NPCSManager的优化版
99-
- 删除`name`后的`[1x01][1x02]`,仅用`:[``]:`标记name
100-
- 删除`]:`后的半角空格
101-
- 保留字节数据均采用`0x`开头,如`[0x04A01414]`
102-
- 删除`color`的特殊标记`<#``#>`,仅用字节标记,如`[0x04A01414][0x00]`
103-
- 增加对`EvaluateExpression`表达式的简单字节解析,如`[0x15290AA4B51414008100][0x00]`,可能存在未知bug
102+
### Format
103+
The current format is an optimized version of NPCSManager.
104+
- Delete`name`after`[1x01][1x02]`, using only`:[`value`]:`label name
105+
- Delete`]:`half-width space
106+
- All reserved byte data are implemented using`0x`at the beginning, such as`[0x04A01414]`
107+
- Delete`color`special markings`<#`value`#>`, using only byte markers, such as`[0x04A01414][0x00]`
108+
- Improve support for`EvaluateExpression`simple byte parsing of expressions, such as`[0x15290AA4B51414008100][0x00]`. There may be unknown bugs.
109+
Script sample:
104110
```
105111
[0x0F][0x1100CC][0x04A01414][0x00]『白い光が見えた』[0x15290AA4B51414008100][0x00][0x03][0xFF]
106112
[0x0F][0x110026][0x04A01414][0x00]『耳鳴りのような音が聞こえた』[0x15290AA4B51414008100][0x00][0x08][0xFF]
@@ -119,46 +125,47 @@ MagesTools -type=diff \
119125
:[大谷]:「……よし」[0x03][0xFF]
120126
```
121127

122-
## 计划
123-
- 支持更多格式
128+
## Planned features
129+
- Support more formats
124130

125-
## 更新日志
131+
## Version history / changelog
126132

127133
### 2024.6.5
128-
- 修复表达式结束判断
129-
- 复无文本的脚本解析问题
130-
- 修复windows下导出文件夹无写入问题
131-
- (以上问题由 [Fluchw](https://github.com/wetor/MagesTools/issues/5) 发现)
134+
- - Fixed expression termination detection
135+
- Resolved script parsing issues with empty text
136+
- Fixed folder export write permission issues on Windows
137+
- (Issues identified by discoverer [Fluchw](https://github.com/wetor/MagesTools/issues/5))
132138

133139
### 2022.10.21
134-
- 修复':'字符后为字节数据(`:[0xFF]`)导致Encode错误的问题 ([kurikomoe](https://github.com/kurikomoe)发现)
140+
- Fixed an encoding error caused by byte data (`:[0xFF]`) following the ‘:’ character. Identified by discoverer [kurikomoe](https://github.com/kurikomoe).
135141

136142
### 2022.3.21
137-
- 支持SC3(scx)脚本的文本导入导出
138-
- 支持文件夹导出(暂不支持导入)
139-
- 增加简单的log
140-
- 优化代码细节
143+
- Supports importing and exporting text files for SC3 (scx / scr) scripts
144+
- Supports folder export (import not currently supported)
145+
- Added basic logging functionality
146+
- Optimized code details
141147

142148
### 2022.3.20 2
143-
- 重构代码结构以支持更多导出格式
144-
- 支持NPCSManager格式的导出与导入
145-
- 支持NPCSManager导出文本的导入
146-
- NPCSManager无法导入此程序导出的文本,存在细微差异
147-
- 支持命令行调用
148-
- 增加帮助文档
149+
- Restructured code architecture to support additional export formats
150+
- Added support for exporting and importing NPCSManager formats
151+
- Supports importing NPCSManager export files
152+
- Original NPCSManager cannot import files exported by this program due to minor differences
153+
- Added command-line invocation support
154+
- Enhanced help documentation
149155

150156
### 2022.3.20
151-
- 完成MES(msb)文本导入(简单实现)
152-
- 调整导出格式
157+
- Complete MES (MSB) text import (simple implementation)
158+
- Adjust export format
153159

154160
### 2022.3.19
155-
- 基本框架设计
156-
- 完成MES(msb)的文本导出
161+
- Basic framework design
162+
- Completed text export for MES (msb)
157163
### 2022.3.18
158-
- 开始
164+
- Initial version
159165

160166

161-
## 参考依赖
162-
- [marcussacana](https://github.com/marcussacana)[NPCSManager](https://github.com/marcussacana/NPCSManager)
163-
- [liaowm5](https://github.com/SteiensGate) 的 msb_tool.py
164-
- [CommitteeOfZero](https://github.com/CommitteeOfZero)[sc3ntist](https://github.com/CommitteeOfZero/sc3ntist) 以及 [SciAdv.Net](https://github.com/CommitteeOfZero/SciAdv.Net)
167+
## Credits
168+
This project is made possible due to the efforts of
169+
- [marcussacana](https://github.com/marcussacana)'s [NPCSManager](https://github.com/marcussacana/NPCSManager)
170+
- [liaowm5](https://github.com/SteiensGate)'s msb_tool.py
171+
- [CommitteeOfZero](https://github.com/CommitteeOfZero)'s [sc3ntist](https://github.com/CommitteeOfZero/sc3ntist) and [SciAdv.Net](https://github.com/CommitteeOfZero/SciAdv.Net) projects.

main.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,18 @@ License: GPL-3.0
6060
switch pType {
6161
case "diff":
6262
if len(pInput) == 0 && len(pOutput) == 0 {
63-
panic("Diff需要input和output")
63+
panic("Diff requires input and output")
6464
}
6565
res := utils.FileSameCheck(pInput, pOutput)
6666
if res {
67-
fmt.Println("两文件完全相同")
67+
fmt.Println("The two files are identical")
6868
}
6969
case "script":
7070
if !pExport && !pImport {
71-
panic("必须指定export模式或import模式")
71+
panic("You must specify export mode or import mode")
7272
}
7373
if len(pSource) == 0 {
74-
panic("必须指定source源文件或文件夹")
74+
panic("The source file or folder must be specified")
7575
}
7676

7777
var _format format.Format
@@ -81,7 +81,7 @@ License: GPL-3.0
8181
case "NPCSP":
8282
_format = &format.NpcsP{}
8383
default:
84-
panic("未知脚本导出格式")
84+
panic("Unknown script export format")
8585
}
8686
scr := &script.Script{}
8787

@@ -90,7 +90,7 @@ License: GPL-3.0
9090
} else if len(pTbl) > 0 {
9191
scr.LoadCharset(pTbl, true, pSkipChar)
9292
} else {
93-
panic("必须指定charset文件或tbl文件")
93+
panic("A charset file or a tbl file must be specified")
9494
}
9595

9696
if pExport {
@@ -102,29 +102,29 @@ License: GPL-3.0
102102
}
103103
scr.Open(file, _format)
104104
scr.Read()
105-
// 导出
105+
// Export
106106
scr.SaveStrings(filepath.Join(pOutput, filepath.Base(file)+".txt"))
107107
}
108108
} else if utils.IsFile(pSource) && utils.IsFile(pOutput) {
109109
scr.Open(pSource, _format)
110110
scr.Read()
111111
scr.SaveStrings(pOutput)
112112
} else {
113-
panic("source和output必须同为文件,或同为文件夹")
113+
panic("Source and output must be files or folders.")
114114
}
115115
} else if pImport {
116116
scr.Open(pSource, _format)
117117
scr.Read()
118118
if len(pInput) > 0 {
119119
scr.LoadStrings(pInput)
120120
} else {
121-
panic("必须指定input文件")
121+
panic("An input file must be specified")
122122
}
123123

124124
if len(pOutput) > 0 {
125125
scr.Write(pOutput)
126126
} else {
127-
panic("必须指定output文件")
127+
panic("The output file must be specified")
128128
}
129129
}
130130
}

script/format/NpcsFormat.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (f *Npcs) stringToBytes(str string) []byte {
2323
if index, has := f.encodeCharset[string(char)]; has {
2424
data.Write(utils.Uint16ToBytesBig(index))
2525
} else {
26-
panic("不存在的字符:" + string(char))
26+
panic("Characters that do not exist:" + string(char))
2727
}
2828
}
2929
return data.Bytes()
@@ -165,7 +165,7 @@ func (f *Npcs) DecodeLine(data []byte) string {
165165
}
166166
} else {
167167
if utils.ShowWarning && data[i] > 0x80 {
168-
fmt.Printf("Warning: 字库可能缺少 [%02X %02X] 对应的字符!\n", data[i], data[i+1])
168+
fmt.Printf("Warning: The font may lack the character corresponding to [%02X %02X]!\n", data[i], data[i+1])
169169
}
170170
if inName {
171171
name += utils.FormatBytes(data[i : i+2])
@@ -206,7 +206,7 @@ func (f *Npcs) EncodeLine(str string) []byte {
206206
tempStr = ""
207207
inName = false
208208
} else {
209-
panic("错误的 ]: 结束符号,在:" + str)
209+
panic("Wrong ]: end symbol in:" + str)
210210
}
211211
i += 2
212212
i++ //跳过空格
@@ -230,7 +230,7 @@ func (f *Npcs) EncodeLine(str string) []byte {
230230
} else if inName {
231231

232232
} else {
233-
panic("错误的 ] 结束符号,在:" + str)
233+
panic("Wrong end of ] symbol in:" + str)
234234
}
235235
i++
236236
} else if line[i] == '<' && i+1 < len(line) && line[i+1] == '#' {

script/format/NpcsPFormat.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (f *NpcsP) stringToBytes(str string) []byte {
2323
if index, has := f.encodeCharset[string(char)]; has {
2424
data.Write(utils.Uint16ToBytesBig(index))
2525
} else {
26-
panic("不存在的字符:" + string(char))
26+
panic("Characters that do not exist:" + string(char))
2727
}
2828
}
2929
return data.Bytes()
@@ -155,7 +155,7 @@ func (f *NpcsP) DecodeLine(data []byte) string {
155155
text.WriteString(char)
156156
} else {
157157
if utils.ShowWarning && data[i] >= 0x80 {
158-
fmt.Printf("Warning: 字库可能缺少 [%02X %02X] 对应的字符!\n", data[i], data[i+1])
158+
fmt.Printf("Warning: The font library may lack the character corresponding to [%02X %02X]!\n", data[i], data[i+1])
159159
}
160160
text.WriteString(utils.FormatBytes(data[i : i+2]))
161161
}
@@ -186,7 +186,7 @@ func (f *NpcsP) EncodeLine(str string) []byte {
186186
tempStr = ""
187187
inName = false
188188
} else {
189-
panic("错误的 ]: 结束符号,在:" + str)
189+
panic("Wrong ]: end symbol in:" + str)
190190
}
191191
i += 2
192192
} else if line[i] == '[' && !inName && line[i+1] == '0' && line[i+2] == 'x' {
@@ -202,7 +202,7 @@ func (f *NpcsP) EncodeLine(str string) []byte {
202202
inBytes = false
203203
tempStr = ""
204204
} else {
205-
panic("错误的 ] 结束符号,在:" + str)
205+
panic("Wrong end of ] symbol in:" + str)
206206
}
207207
i++
208208
} else {

script/mes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (m *Mes) GetStrings() []string {
5555

5656
func (m *Mes) SetStrings(strings []string) {
5757
if m.Count != len(strings) {
58-
panic(fmt.Sprintf("导入文本行数不匹配。原脚本:%d,导入:%d", m.Count, len(strings)))
58+
panic(fmt.Sprintf("The number of lines of imported text does not match. Original script: %d, imported: %d", m.Count, len(strings)))
5959
return
6060
}
6161
m.Strings = strings

script/sc3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func (s *Sc3) GetStrings() []string {
6161

6262
func (s *Sc3) SetStrings(strings []string) {
6363
if s.Count != len(strings) {
64-
panic(fmt.Sprintf("导入文本行数不匹配。原脚本:%d,导入:%d", s.Count, len(strings)))
64+
panic(fmt.Sprintf("The number of lines of imported text does not match. Original script: %d, imported: %d", s.Count, len(strings)))
6565
return
6666
}
6767
s.Strings = strings

script/script.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (s *Script) Open(filename string, format format.Format) {
8383
case "SC3":
8484
s.Strings = LoadSc3(data)
8585
default:
86-
panic("不支持的文件类型! " + filename)
86+
panic("Unsupported file type!" + filename)
8787
}
8888
}
8989

@@ -162,7 +162,7 @@ func (s *Script) Read() {
162162
func (s *Script) SaveStrings(filename string) {
163163
strings := s.Strings.GetStrings()
164164
if len(strings) == 0 {
165-
fmt.Printf("文件 %s 无任何文本,跳过\n", s.Name)
165+
fmt.Printf("File %s does not contain any text, skipping\n", s.Name)
166166
return
167167
}
168168
f, _ := os.Create(filename)

script/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func FileSameCheck(file1, file2 string) bool {
6767
data1, _ := os.ReadFile(file1)
6868
data2, _ := os.ReadFile(file2)
6969
if len(data1) != len(data2) {
70-
fmt.Printf("文件大小不一致。file1:%d file2:%d\n", len(data1), len(data2))
70+
fmt.Printf("The file sizes are inconsistent. file1:%d file2:%d\n", len(data1), len(data2))
7171
return false
7272
}
7373
same := true

0 commit comments

Comments
 (0)