hanmin0822 / MisakaTranslator

御坂翻译器—Galgame/文字游戏/漫画多语种实时机翻工具
GNU General Public License v3.0
4.96k stars 435 forks source link

X86 hook方式添加游戏,选择获取文本后,确认方法报错 #302

Open wswdatao opened 1 year ago

wswdatao commented 1 year ago

还有个问题是,电脑是64位,我选择X64注入后无法获取文本,所以才选择86

==============System Info================ System:Microsoft Windows NT 10.0.19045.0 CurrentTime:2023/6/25 19:23 dotNetVersion:4.0.30319.42000 MisakaTranslatorVersion:2.12.2.0 ==============Exception Info================ ExceptionType:UI Thread ExceptionName:System.ArgumentOutOfRangeException ExceptionSource:mscorlib ExceptionMessage:索引超出范围。必须为非负值并小于集合大小。 参数名: index ExceptionStackTrace: 在 System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) 在 System.Collections.Generic.List`1.get_Item(Int32 index) 在 TextHookLibrary.TextHookHandle.d37.MoveNext() 位置 D:\a\MisakaTranslator\MisakaTranslator\TextHookLibrary\TextHookHandle.cs:行号 350 --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b6_0(Object state) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

==============System Info================ System:Microsoft Windows NT 10.0.19045.0 CurrentTime:2023/6/25 19:23 dotNetVersion:4.0.30319.42000 MisakaTranslatorVersion:2.12.2.0 ==============Exception Info================ ExceptionType:Non UI Thread ExceptionName:System.ArgumentOutOfRangeException ExceptionSource:mscorlib ExceptionMessage:索引超出范围。必须为非负值并小于集合大小。 参数名: index ExceptionStackTrace: 在 System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource) 在 System.Collections.Generic.List`1.get_Item(Int32 index) 在 TextHookLibrary.TextHookHandle.d37.MoveNext() 位置 D:\a\MisakaTranslator\MisakaTranslator\TextHookLibrary\TextHookHandle.cs:行号 350 --- 引发异常的上一位置中堆栈跟踪的末尾 --- 在 System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.b6_0(Object state) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在 System.Windows.Threading.DispatcherOperation.InvokeImpl() 在 System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state) 在 MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 在 MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state) 在 System.Windows.Threading.DispatcherOperation.Invoke() 在 System.Windows.Threading.Dispatcher.ProcessQueue() 在 System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled) 在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) 在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs) 在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) 在 System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs) 在 MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) 在 MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg) 在 System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) 在 System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) 在 System.Windows.Application.RunDispatcher(Object ignore) 在 System.Windows.Application.RunInternal(Window window) 在 System.Windows.Application.Run(Window window) 在 System.Windows.Application.Run() 在 MisakaTranslator_WPF.App.Main()

imba-tjd commented 1 year ago

看不出原因。TextHookHandle.cs:行号 350 啥也没有

wswdatao commented 1 year ago

那问题就不确定了,然后刚刚试了下,先使用ocr的方式添加 再切换到hook就正常了