From 110bc338d9cfb8af746d6d145ff2736f7b0dd3f0 Mon Sep 17 00:00:00 2001
From: ExMingYan <2264568487@qq.com>
Date: Mon, 5 May 2025 01:58:05 +0800
Subject: [PATCH 1/6] =?UTF-8?q?makefile=E5=A2=9E=E5=8A=A0=E4=BD=BF?=
=?UTF-8?q?=E7=94=A8readelf=E7=94=9F=E6=88=90no$gba=E4=BD=BF=E7=94=A8?=
=?UTF-8?q?=E7=9A=84=E7=AC=A6=E5=8F=B7=E8=A1=A8=E5=91=BD=E4=BB=A4=EF=BC=9A?=
=?UTF-8?q?make=20nosyms?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index f2128cc25d..af7d69d919 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,7 @@ endif
PREFIX := arm-none-eabi-
OBJCOPY := $(PREFIX)objcopy
OBJDUMP := $(PREFIX)objdump
+READELF := $(PREFIX)readelf
AS := $(PREFIX)as
LD := $(PREFIX)ld
@@ -86,6 +87,7 @@ endif
ELF := $(ROM:.gba=.elf)
MAP := $(ROM:.gba=.map)
SYM := $(ROM:.gba=.sym)
+NOCASHSYM := $(ROM.gba=.sym)
# Commonly used directories
C_SUBDIR = src
@@ -294,6 +296,8 @@ endif
syms: $(SYM)
+nosyms: $(NOCASHSYM)
+
clean: tidy clean-tools clean-check-tools clean-generated clean-assets
@$(MAKE) clean -C libagbsyscall
@@ -465,3 +469,7 @@ $(ROM): $(ELF)
# Symbol file (`make syms`)
$(SYM): $(ELF)
$(OBJDUMP) -t $< | sort -u | grep -E "^0[2389]" | $(PERL) -p -e 's/^(\w{8}) (\w).{6} \S+\t(\w{8}) (\S+)$$/\1 \2 \3 \4/g' > $@
+
+# Symbol file (`make nosyms)
+$(NOCASHSYM): $(ELF)
+ $(READELF) -Ws $< | tail -n +4 | awk '$4 !~/(FILE|NOTYPE)/ && $8 !~/^(\$|\.)/ {print $2,$8}' | sort -k 1 | awk '!seen[$1]++' > $@
From 952501992fe4a6f70e49bc905aeabd0b4897e4f3 Mon Sep 17 00:00:00 2001
From: ExMingYan <2264568487@qq.com>
Date: Mon, 5 May 2025 02:06:25 +0800
Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E7=94=9F=E6=88=90no$gba?=
=?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E7=AC=A6=E5=8F=B7=E8=A1=A8=E5=91=BD?=
=?UTF-8?q?=E4=BB=A4=E4=B8=AD=E7=9A=84=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index af7d69d919..aaa8e9db4a 100644
--- a/Makefile
+++ b/Makefile
@@ -87,7 +87,7 @@ endif
ELF := $(ROM:.gba=.elf)
MAP := $(ROM:.gba=.map)
SYM := $(ROM:.gba=.sym)
-NOCASHSYM := $(ROM.gba=.sym)
+NOCASHSYM := $(ROM:.gba=.sym)
# Commonly used directories
C_SUBDIR = src
@@ -472,4 +472,4 @@ $(SYM): $(ELF)
# Symbol file (`make nosyms)
$(NOCASHSYM): $(ELF)
- $(READELF) -Ws $< | tail -n +4 | awk '$4 !~/(FILE|NOTYPE)/ && $8 !~/^(\$|\.)/ {print $2,$8}' | sort -k 1 | awk '!seen[$1]++' > $@
+ $(READELF) -Ws $< | tail -n +4 | awk '$$4 !~/(FILE|NOTYPE)/ && $$8 !~/^(\$$|\.)/ {print $$2,$$8}' | sort -k 1 | awk '!seen[$$1]++' > $@
From 0a4efa9b4598cd0b500661e35ee2a91fea0c0460 Mon Sep 17 00:00:00 2001
From: ExMingYan <2264568487@qq.com>
Date: Mon, 5 May 2025 02:44:56 +0800
Subject: [PATCH 3/6] =?UTF-8?q?WSL=5FZH.md=E5=8A=A0=E5=85=A5=E9=83=A8?=
=?UTF-8?q?=E5=88=86=E9=94=99=E8=AF=AF=E8=A7=A3=E5=86=B3=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/install/windows/WSL_ZH.md | 36 ++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/docs/install/windows/WSL_ZH.md b/docs/install/windows/WSL_ZH.md
index 991de2a25c..8fc5ede07b 100644
--- a/docs/install/windows/WSL_ZH.md
+++ b/docs/install/windows/WSL_ZH.md
@@ -113,4 +113,40 @@ mkdir decomps
```bash
cd ~/decomps
+```
+
+## WSL更新或安装依赖时错误解决
+
+更新WSL或安装依赖项时如果出现以下错误提示
+
+```console
+E: Sub-process /usr/bin/dpkg returned an error code (1)
+```
+
+可先执行以下命令
+
+```bash
+sudo mv /var/lib/dpkg/info /var/lib/dpkg/info_old
+sudo mkdir /var/lib/dpkg/info
+```
+
+等待命令执行完毕后再次运行更新WSL或安装依赖项命令。更新或安装完毕后运行以下命令以恢复pkg信息
+
+```bash
+sudo mv /var/lib/dpkg/info_old/* /var/lib/dpkg/info/
+sudo rmdir /var/lib/dpkg/info_old
+```
+
+如果出现以下提示,并列出可移除的包名(以libllvm17t64为例)
+
+```console
+The following package was automatically installed and is no longer required:
+ libllvm17t64
+```
+
+可执行以下命令解决该提示
+
+```bash
+sudo apt autoremove
+sudo apt install libllvm17t64
```
\ No newline at end of file
From cd2429f4e0469f33d856d5b4cbe7a5457e798f21 Mon Sep 17 00:00:00 2001
From: RoamerX <20692776+RoamerX@users.noreply.github.com>
Date: Mon, 5 May 2025 14:44:01 +0800
Subject: [PATCH 4/6] =?UTF-8?q?NamingScreen=E6=8C=89=E9=92=AE=E9=AB=98?=
=?UTF-8?q?=E5=85=89=E4=BF=AE=E5=A4=8D?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
顺便汉化了遗漏的输入代码相关的一句英文
---
graphics/naming_screen/back_button.png | Bin 3694 -> 2054 bytes
src/naming_screen.c | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/graphics/naming_screen/back_button.png b/graphics/naming_screen/back_button.png
index 68e0acf8d6d58b4b59d3f9c064a26b375659c85d..460cb08ff775c9b9611246495ac2d544d4cac47d 100644
GIT binary patch
literal 2054
zcmb_de{9rL9KQua03nJb%D_nJRHoAFYp=ato1Jj(#&*bUW4mN?&gkpwyIt8`TiR}S
zgG3h)iCGpT8iLDWmT2NXhyzi?xgdYcKa4mdSyVI-%rgF10#Ra&8lA8A%VEZk5S#1u
z_4V_<-_Q5^{e0hhwYjl=#j-Wad_LcbSVOdhJgdpQddVX4f4ZaT7xDnj+Y)s`d1L1xAeHB-g@T*e}3pRZ<9&Vr~LyOfH%bR$e(9Xm}^
zx)!F}#5jmswK%0W?6Ps|uEqq~)s1A0-t;6@lT(O+40a)v%cKoQ$%W~>U4@LjX_lt)
z5Vt!_M?8mAd%T&dHEm2uevUx^07{bmFeC*yRo+PPfah2slOF?s5|ETYh$>z*ac65u
zr6szh=#0FD>6GhQ3d?4*S${U*H|;K#BUxYp&+$;{uoCHL3Ato3SlZ=K0fssQRW(1%~f`BlOfL2-`
zHBpaOS#Nzo<(i3zjeor&N#rGs7nmd`sZ1as1Q{4qB}NQzNaIx`1%qnIT9d7lMuX}3
zRy|f4u_$7sh5}NE5rd+@@S-3xG7RucNC@#s(k!ZkWKYd`fhY~SLrT|I?2lHwvp7oY
zR9+JbM4r~eH1dj!Nj!yVeSv)3mgnO7Yzh;jHz|I>jbkR=EVOZ?i{$Q>;$m+^-hsV0
zr;d^umlS!8!76EcC<}mrDkP=kLP!>ZkW;Z#3VlBHvKV=VlS*Q|6Y9mZpcFK^Fxfd-
z`p$#7JzW-9E*Q-G&iem?VZHsbpfL8o;>&-Vx3`i)=BLPp?G4LE1$ikSHrOC}vdK}h
z@zg`!`FB1RjU=iM4xT%6d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CnqQ@~D=RE4EG;c9E-o%FFE21KFflPPGBPqV
zGcz7mzbECnVFfI
znwp!No1C1Sot>SYo}QndpP-Ll?si~=|s;aB2
ztE{Z7t*x!DuCA}IuduMNv9YnTva++Yv$V9dwY9ajwzjvox45{txqrF2y1Kf%ySu!+
zyuH1>zP`S{zrVo1z`?=6!otGC!^6bH#KpzM#>U3S$H&OX$jQmc%F4>i%gfBn%+1Zs
z&d$!y&(F}%(9zM+($dn?)6>+{)YaA1*4Eb7*VowC*xA|H+S=ON+uPjS+}+*X-rnBd
z-{0Wi;Njun;^N}tuz*=jZ3>=;-O`>FVn0>+9?6?CkCB?e6aG@9*#M
z@bK~R@$&NW^Yioc^z`-h_4fAm_xJbs`1twx`TF|$`}_O+{QUj>{r>*`|NsBoB7Y*Xk%)*KjpPDTo8%Zn
z6HKv*@&E<4?YhRcK_8$exEw_lK-so`f>l*T)ns?z@;w{ZY8&UKS>yKUqib$zY|gR$
zGwr|r%9}Y4uHd|tkbrwog47ToJ%B<(n%#AbLa1Q`{l|EA{b1b8@ihQJlMttgjc`){
P0000
Date: Mon, 5 May 2025 15:33:45 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=A4=E4=B8=AA?=
=?UTF-8?q?=E8=B6=85=E9=93=BE=E6=8E=A5=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/README.md b/.github/README.md
index ad763cf7d4..0f240e88a9 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -64,14 +64,14 @@ pokeemerald-expansion是基于pret的[pokeemerald](https://github.com/pret/pokee
- 检查你的当前版本。
- 你可以在调试菜单的`Utilities -> Expansion Version`选项中检查。
- 如果该选项不可用,你可能拥有的是1.6.2或更早的版本。在那种情况下,请查看[更改日志](docs/CHANGELOG.md)以确定你的版本,基于你仓库中可用的功能。
-- ***重要提示***:如果你落后了几个版本,我们建议你一次更新一个小版本,而不是直接跳到最新的补丁版本(例如,1.5.3 -> 1.6.2 -> 1.7.4等等。查看在线文档网站](https://rh-hideout.github.io/pokeemerald-expansion/CHANGELOG.html)以查看每个步骤的最新版本。)
+- ***重要提示***:如果你落后了几个版本,我们建议你一次更新一个小版本,而不是直接跳到最新的补丁版本(例如,1.5.3 -> 1.6.2 -> 1.7.4等等。[查看在线文档网站](https://rh-hideout.github.io/pokeemerald-expansion/CHANGELOG.html)以查看每个步骤的最新版本。)
- 一旦你设置了远程仓库,请运行命令`git pull RHH expansion/X.Y.Z`,将X、Y和Z替换为你想要更新到的相应版本的数字(例如,要更新到1.11.1,请使用`git pull RHH expansion/1.11.1`)。
- ***重要提示***:如果你落后了几个版本,我们建议你一次更新一个小版本,而不是直接跳到最新的补丁版本(例如,1.5.3 -> 1.6.2 -> 1.7.4等等)
- 另外,你可以更新到扩展的未发布版本。
- ***master(稳定版)***:它包含将在下一个补丁版本中发布的***bug修复***。要合并,请使用`git pull RHH master`。
- ***upcoming(不稳定版,可能存在bug)***:它包含将在下一个小版本中发布的***功能***。要合并,请使用`git pull RHH upcoming`。
-### 请考虑在你的项目中归功于整个贡献者名单](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits),因为他们都为开发这个项目付出了辛勤的努力 :)
+### 请考虑在你的项目中归功于整个[贡献者名单](https://github.com/rh-hideout/pokeemerald-expansion/wiki/Credits),因为他们都为开发这个项目付出了辛勤的努力 :)
## 谁在维护这个项目?
@@ -246,4 +246,4 @@ pokeemerald-expansion是基于pret的[pokeemerald](https://github.com/pret/pokee
- 《黑2/白2》及以后的驱虫喷雾系统,也支持《Let's Go!皮卡丘/伊布》中的香水。
- 第六世代及以后的努力值上限。
- 包含了pret的所有错误修复。
- - 修复了地图上的下雪天气效果。
\ No newline at end of file
+ - 修复了地图上的下雪天气效果。
From 5614d7b87fa5c4c9c36ffcf0a06a9eecba466c96 Mon Sep 17 00:00:00 2001
From: ExMingYan <2264568487@qq.com>
Date: Mon, 5 May 2025 16:37:20 +0800
Subject: [PATCH 6/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9py=E6=96=87=E4=BB=B6?=
=?UTF-8?q?=E4=B8=AD=E8=B7=AF=E5=BE=84=E5=A4=84=E7=90=86=E7=9B=B8=E5=85=B3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
python_tools/test.py | 1 +
python_tools/test_follow.py | 14 ++++++++++++--
python_tools/test_string_extract.py | 12 ++++++++++--
python_tools/translate_battle_message.py | 7 +++++--
python_tools/translate_debug.py | 5 +++--
python_tools/translate_decoration.py | 5 +++--
python_tools/translate_decoration2.py | 6 ++++--
python_tools/translate_items.py | 7 ++++---
python_tools/translate_pokemon.py | 8 ++++----
python_tools/translate_skills.py | 8 ++++----
python_tools/translate_string.py | 9 ++++-----
11 files changed, 54 insertions(+), 28 deletions(-)
diff --git a/python_tools/test.py b/python_tools/test.py
index db53d85da8..3da0158781 100644
--- a/python_tools/test.py
+++ b/python_tools/test.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python python3
# 原始字符串
text = "全副武装的样子。\n即使是极巨化宝可梦的\n攻击也能轻易抵挡。"
diff --git a/python_tools/test_follow.py b/python_tools/test_follow.py
index a37a02974c..07b1f309bd 100644
--- a/python_tools/test_follow.py
+++ b/python_tools/test_follow.py
@@ -1,9 +1,19 @@
+#!/usr/bin/python python3
+import os
import openpyxl
import re
+# 获取py文件所在文件夹绝对路径
+pydir = os.path.dirname(os.path.realpath(__file__))
+
+#获取excel相对py文件路径
+excel_path = os.path.join(pydir, "src", "精灵跟随.xlsx")
+
+# 获取C文件所在文件夹相对py文件路径
+cdir = os.path.join(os.path.dirname(pydir), "src")
+
# 文件路径
-excel_path = r"c:\Users\Nox\Documents\GitHub\pokeemerald-expansion-Chinese\python_tools\src\精灵跟随.xlsx"
-c_file_path = r"c:\Users\Nox\Documents\GitHub\pokeemerald-expansion-Chinese\src\follower_helper.c"
+c_file_path = os.path.join(cdir, "follower_helper.c")
# 读取 Excel 文件
wb = openpyxl.load_workbook(excel_path)
diff --git a/python_tools/test_string_extract.py b/python_tools/test_string_extract.py
index 1d26e42607..8ad841ac67 100644
--- a/python_tools/test_string_extract.py
+++ b/python_tools/test_string_extract.py
@@ -1,8 +1,16 @@
+#!/usr/bin/python python3
+import os
import re
+# 获取py文件所在文件夹绝对路径
+pydir = os.path.dirname(os.path.realpath(__file__))
+
+# 获取C文件所在文件夹相对py文件路径
+cdir = os.path.join(os.path.dirname(pydir), "src")
+
# 文件路径
-input_file = r"c:\Users\Nox\Documents\GitHub\pokeemerald-expansion-Chinese\src\strings.c"
-output_file = r"c:\Users\Nox\Documents\GitHub\pokeemerald-expansion-Chinese\extracted_strings.txt"
+input_file = os.path.join(cdir, "strings.c")
+output_file = os.path.join(os.path.dirname(pydir), "extracted_strings.txt")
# 正则表达式匹配变量名和 _("...") 之间的内容
pattern = re.compile(r'const\s+u8\s+(\w+)\[\]\s*=\s*_\("([^"]*)"\)')
diff --git a/python_tools/translate_battle_message.py b/python_tools/translate_battle_message.py
index 9b895933ba..f41b913609 100644
--- a/python_tools/translate_battle_message.py
+++ b/python_tools/translate_battle_message.py
@@ -1,10 +1,13 @@
+#!/usr/bin/python python3
import re
import os
from openpyxl import load_workbook
+pydir = os.path.dirname(os.path.abspath(__file__))
+
# 文件路径
-c_file_path = os.path.dirname(os.path.abspath(__file__))+"/../src/battle_message.c"
-xlsx_file_path = os.path.dirname(os.path.abspath(__file__))+"/src/战斗文本.xlsx"
+c_file_path = os.path.join(os.path.dirname(pydir), "src", "battle_message.c")
+xlsx_file_path = os.path.join(pydir, "src", "战斗文本.xlsx")
# 读取 xlsx 文件并解析为字典
def load_translations(xlsx_file_path):
diff --git a/python_tools/translate_debug.py b/python_tools/translate_debug.py
index ac685988f8..8e7624d8d9 100644
--- a/python_tools/translate_debug.py
+++ b/python_tools/translate_debug.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python python3
import re
import openpyxl
import os
@@ -45,8 +46,8 @@ def replace_in_c_file(c_file, replacement_dict):
# 主函数
def main():
current_folder = os.path.dirname(os.path.abspath(__file__))
- xlsx_file = current_folder+"/src/debug文本.xlsx" # Excel 文件路径
- c_file = current_folder+"/../src/battle_debug.c" # C 文件路径
+ xlsx_file = os.path.join(current_folder, "src", "debug文本.xlsx") # Excel 文件路径
+ c_file = os.path.join(os.path.dirname(current_folder), "src", "battle_debug.c") # C 文件路径
# 加载替换字典
replacement_dict = load_replacement_dict(xlsx_file)
diff --git a/python_tools/translate_decoration.py b/python_tools/translate_decoration.py
index 282f3ed249..1697847d53 100644
--- a/python_tools/translate_decoration.py
+++ b/python_tools/translate_decoration.py
@@ -1,11 +1,12 @@
+#!/usr/bin/python python3
import openpyxl
import re
import os
# 文件路径
base_dir = os.path.dirname(os.path.abspath(__file__))
-h_file_path = os.path.join(base_dir, "../src/data/decoration/header.h")
-xlsx_path = os.path.join(base_dir, "src/装饰物品.xlsx")
+h_file_path = os.path.join(os.path.dirname(base_dir), "src", "data", "decoration", "header.h")
+xlsx_path = os.path.join(base_dir, "src", "装饰物品.xlsx")
# 加载Excel文件
wb = openpyxl.load_workbook(xlsx_path)
diff --git a/python_tools/translate_decoration2.py b/python_tools/translate_decoration2.py
index 2ea84296fc..906f1c91c6 100644
--- a/python_tools/translate_decoration2.py
+++ b/python_tools/translate_decoration2.py
@@ -1,10 +1,12 @@
+#!/usr/bin/python python3
import openpyxl
import re
import os
# 文件路径
-h_file_path = os.path.dirname(os.path.abspath(__file__))+"/../src/data/decoration/description.h"
-xlsx_path = os.path.dirname(os.path.abspath(__file__))+"/src/装饰物品.xlsx"
+base_dir = os.path.dirname(os.path.abspath(__file__))
+h_file_path = os.path.join(os.path.dirname(base_dir), "src", "data", "decoration", "description.h")
+xlsx_path = os.path.join(base_dir, "src", "装饰物品.xlsx")
# 加载Excel文件
wb = openpyxl.load_workbook(xlsx_path)
diff --git a/python_tools/translate_items.py b/python_tools/translate_items.py
index 32d9f346c0..f7d59b2863 100644
--- a/python_tools/translate_items.py
+++ b/python_tools/translate_items.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python python3
import os
import re
import pandas as pd
@@ -60,13 +61,13 @@ def replace_item_info(content, df):
return content
def log(message):
- with open(current_folder+"\log.txt", "a", encoding="utf-8") as log_file:
+ with open(os.path.join(current_folder, "log.txt"), "a", encoding="utf-8") as log_file:
log_file.write(message + "\n")
print(message)
if __name__ == "__main__":
- work_file = current_folder +"\..\src\data\items.h"
- df = pd.read_excel(current_folder +r'\src\道具.xlsx')
+ work_file = os.path.join(os.path.dirname(current_folder), "src", "data", "items.h")
+ df = pd.read_excel(os.path.join(current_folder, "src", "道具.xlsx"))
df.set_index('道具', inplace=True)
diff --git a/python_tools/translate_pokemon.py b/python_tools/translate_pokemon.py
index 58c98edbe0..f96ad05c85 100644
--- a/python_tools/translate_pokemon.py
+++ b/python_tools/translate_pokemon.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python python3
import os
import re
import pandas as pd
@@ -56,14 +57,13 @@ def replace_species_info(content, df):
return content
def log(message):
- with open(current_folder+"\log.txt", "a", encoding="utf-8") as log_file:
+ with open(os.path.join(current_folder, "log.txt"), "a", encoding="utf-8") as log_file:
log_file.write(message + "\n")
print(message)
if __name__ == "__main__":
-
- work_folder = current_folder +"\..\src\data\pokemon\species_info"
- df = pd.read_excel(current_folder +r'\src\图鉴.xlsx')
+ work_folder = os.path.join(os.path.dirname(current_folder), "src", "data", "pokemon", "species_info")
+ df = pd.read_excel(os.path.join(current_folder, "src", "图鉴.xlsx"))
df.set_index('name', inplace=True)
for filename in os.listdir(work_folder):
diff --git a/python_tools/translate_skills.py b/python_tools/translate_skills.py
index 4e8a215fb5..a3b21ccf25 100644
--- a/python_tools/translate_skills.py
+++ b/python_tools/translate_skills.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python python3
import os
import re
import pandas as pd
@@ -60,14 +61,13 @@ def replace_move_info(content, df):
return content
def log(message):
- with open(current_folder+"\log.txt", "a", encoding="utf-8") as log_file:
+ with open(os.path.join(current_folder, "log.txt"), "a", encoding="utf-8") as log_file:
log_file.write(message + "\n")
print(message)
if __name__ == "__main__":
-
- work_file = current_folder +"\..\src\data\moves_info.h"
- df = pd.read_excel(current_folder +r'\src\招式.xlsx')
+ work_file = os.path.join(os.path.dirname(current_folder), "src", "data", "moves_info.h")
+ df = pd.read_excel(os.path.join(current_folder, "src", "招式.xlsx"))
df.set_index('招式', inplace=True)
diff --git a/python_tools/translate_string.py b/python_tools/translate_string.py
index 1783699a0a..5156ed61c3 100644
--- a/python_tools/translate_string.py
+++ b/python_tools/translate_string.py
@@ -1,4 +1,4 @@
-
+#!/usr/bin/python python3
import os
import re
import pandas as pd
@@ -44,13 +44,12 @@ def replace_move_info(content, df):
return content
def log(message):
- with open(current_folder+"\log.txt", "a", encoding="utf-8") as log_file:
+ with open(os.path.join(current_folder, "log.txt"), "a", encoding="utf-8") as log_file:
log_file.write(message + "\n")
print(message)
if __name__ == "__main__":
-
- work_file = current_folder +"\..\src\strings.c"
- df = pd.read_excel(current_folder + r'\src\文本.xlsx')
+ work_file = os.path.join(os.path.dirname(current_folder), "src", "strings.c")
+ df = pd.read_excel(os.path.join(current_folder, "src", "文本.xlsx"))
# 检查并清理重复的“变量名”
df = df.drop_duplicates(subset='变量名', keep='first')