Merge pull request #42 from ExMingYan/master

makefile增加使用readelf生成no$gba使用的符号表命令:make nosyms
This commit is contained in:
RoamerX 2025-05-05 16:48:06 +08:00 committed by GitHub
commit 5b5fc0702b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 101 additions and 31 deletions

6
.github/README.md vendored
View File

@ -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的所有错误修复。
- 修复了地图上的下雪天气效果。
- 修复了地图上的下雪天气效果。

View File

@ -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]++' > $@

View File

@ -113,4 +113,40 @@ mkdir decomps
```bash
cd ~/decomps
```
## WSL更新或安装依赖时错误解决
<b>更新WSL</b><b>安装依赖项</b>时如果出现以下错误提示
```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
```
<b>等待命令执行完毕</b>后再次运行<b>更新WSL</b><b>安装依赖项</b>命令。<b>更新或安装完毕后</b>运行以下命令以恢复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
```

View File

@ -1,3 +1,4 @@
#!/usr/bin/python python3
# 原始字符串
text = "全副武装的样子。\n即使是极巨化宝可梦的\n攻击也能轻易抵挡。"

View File

@ -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)

View File

@ -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*_\("([^"]*)"\)')

View File

@ -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):

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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):

View File

@ -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)

View File

@ -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')