From 28d3c2e065cf0083a78cc351e57b517d7af13976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sat, 17 Aug 2024 10:20:37 +0800 Subject: [PATCH] info --- .../LunaTranslator/gui/selecthook.py | 49 +++++++++++++++++-- .../LunaTranslator/gui/usefulwidget.py | 23 ++------- .../files/defaultconfig/static_data.json | 1 - 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/selecthook.py b/LunaTranslator/LunaTranslator/gui/selecthook.py index bef14f76..28ef0204 100644 --- a/LunaTranslator/LunaTranslator/gui/selecthook.py +++ b/LunaTranslator/LunaTranslator/gui/selecthook.py @@ -5,11 +5,11 @@ from traceback import print_exc import qtawesome, windows, winsharedutils, gobject from myutils.config import savehook_new_data, static_data, globalconfig, _TR from myutils.utils import checkchaos, get_time_stamp, dynamiclink +from myutils.wrapper import Singleton_close from gui.dialog_savedgame import dialog_setting_game from gui.usefulwidget import ( closeashidewindow, getQMessageBox, - dialog_showinfo, getsimplecombobox, MySwitch, getsimpleswitch, @@ -118,6 +118,49 @@ def listprocessm(): return ret +hookcodehelp = r""" +1、内存读取 +R{S|Q|V|U}[codepage#]@addr +R是内存读取码标志 +S是默认ascii字符串,Q是UTF16,U是UTF32,V是UTF8 +2、HOOK +{H|B}{A|B|W|I|S|Q|U|V}[F][N][codepage#][padding+]data_offset[*deref_offset][:split_offset[*deref_offset]]@addr[:module[:func]] +H是inlineHook,B是vehhook +单字符:A/B是小端/大端的mbcs,W是UTF16,I是UTF32 +字符串:S是默认ascii字符串,Q是UTF16,U是UTF32,V是UTF8。 +F:每次读取字符串后添加换行符 +N:无视上下文 +-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI +-C for RAX, -14 for RBX, -1C for RCX, -24 for RDX, and so on for RSP, RBP, RSI, RDI, R8-R15 +3、JIT +{H|B}{A|B|W|I|S|Q|M|U|V}[F][N][codepage#][padding+]arg_index[*deref_offset][:split_offset[*deref_offset]]@{info}:JIT:{UNITY|YUZU|PPSSPP|VITA3K|RPCS3} +arg_index是JIT函数的参数index。M为C#字符串,仅UNITY可用。 +UNITY的info为:[程序集]:[命名空间]:类名:函数名:参数量 +YUZU/PPSSPP/VITA3K/RPCS3的info为模拟地址 +4、内嵌 +E[D][S][N|O]HOOKCODE +E是使用内嵌的标注,HOOKCODE是JIT特殊码或HOOK特殊码。 +D:写入时转换中文字符为日语字符集 +S:提取时使用HOOKCODE指定的文本提取方式 +N:写入时创建新的字符串并交换字符串指针 +O:写入时在原字符串上覆写 +""" + + +@Singleton_close +class dialog_showinfo(QDialog): + + def __init__(self, parent) -> None: + super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) + self.setWindowTitle("HOOKCODE") + l = QLabel(hookcodehelp) + l.setWordWrap(True) + layout = QHBoxLayout() + layout.addWidget(l) + self.setLayout(layout) + self.show() + + class searchhookparam(LDialog): def safehex(self, string, default): try: @@ -596,9 +639,7 @@ class hookselect(closeashidewindow): self.userhooklayout.addWidget(self.userhookinsert) self.userhookinsert = QPushButton(icon=qtawesome.icon("fa.question")) - self.userhookinsert.clicked.connect( - lambda: dialog_showinfo(self, "CODE", static_data["hcodeintroduction"]) - ) + self.userhookinsert.clicked.connect(lambda: dialog_showinfo(self)) self.userhooklayout.addWidget(self.userhookinsert) self.userhookfind = LPushButton("搜索特殊码") diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 921e253f..5c0cd405 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -279,19 +279,6 @@ class TableViewW(QTableView): self.model().itemFromIndex(self.currentIndex()).setText(string) -@Singleton_close -class dialog_showinfo(QDialog): - - def __init__(self, parent, title, info) -> None: - super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) - self.setWindowTitle(title) - l = QLabel(info) - layout = QHBoxLayout() - layout.addWidget(l) - self.setLayout(layout) - self.show() - - def getQMessageBox( parent=None, title="", @@ -306,17 +293,17 @@ def getQMessageBox( msgBox.setText((text)) btn = 0 if useok: - btn |= QMessageBox.Ok + btn |= QMessageBox.StandardButton.Ok if usecancel: - btn |= QMessageBox.Cancel + btn |= QMessageBox.StandardButton.Cancel msgBox.setStandardButtons(btn) - msgBox.setDefaultButton(QMessageBox.Ok) + msgBox.setDefaultButton(QMessageBox.StandardButton.Ok) ret = msgBox.exec() - if ret == QMessageBox.Ok and okcallback: + if ret == QMessageBox.StandardButton.Ok and okcallback: okcallback() - elif ret == QMessageBox.Cancel and cancelcallback: + elif ret == QMessageBox.StandardButton.Cancel and cancelcallback: cancelcallback() diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index deec83cd..1bc10985 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -809,7 +809,6 @@ "北欧", "西里尔" ], - "hcodeintroduction": "Enter read code\nR{S|Q|V|M}[null_length<][codepage#]@addr\nOR\nEnter hook code\nH{A|B|W|H|S|Q|V|M}[F][null_length<][N][codepage#][padding+]data_offset[*deref_offset][:split_offset[*deref_offset]]@addr[:module[:func]]\nAll numbers except codepage/null_length in hexadecimal\nDefault codepage is 932 (Shift-JIS) but this can be changed in settings\nA/B: codepage char little/big endian\nW: UTF-16 char\nH: Two hex bytes\nS/Q/V/M: codepage/UTF-16/UTF-8/hex string\nF: treat strings as full lines of text\nN: don't use context\nnull_length: length of null terminator used for string\npadding: length of padding data before string (C struct { int64_t size; char string[500]; } needs padding = 8)\nNegatives for data_offset/split_offset refer to registers\n-4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI\n-C for RAX, -14 for RBX, -1C for RCX, -24 for RDX, and so on for RSP, RBP, RSI, RDI, R8-R15\n* means dereference pointer+deref_offset", "aboutsource": [ { "name": "离线翻译",