add <modpath>/libraries/windows to the dll search path before loading Tolk. This enables nvdaControllerClient64.dll to be loaded in place.
This commit is contained in:
8
stardew-access/ScreenReader/NativeMethods.cs
Normal file
8
stardew-access/ScreenReader/NativeMethods.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
public static class NativeMethods
|
||||
{
|
||||
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern bool SetDllDirectory(string lpPathName);
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
using DavyKager;
|
||||
using System.IO;
|
||||
|
||||
namespace stardew_access.ScreenReader
|
||||
{
|
||||
@@ -15,6 +16,13 @@ namespace stardew_access.ScreenReader
|
||||
|
||||
public void InitializeScreenReader()
|
||||
{
|
||||
if (MainClass.ModHelper is not null)
|
||||
{
|
||||
// Set the path to load Tolk.dll from
|
||||
string dllDirectory = Path.Combine(MainClass.ModHelper.DirectoryPath, "libraries", "windows");;
|
||||
// Call SetDllDirectory to change the DLL search path
|
||||
NativeMethods.SetDllDirectory(dllDirectory);
|
||||
}
|
||||
MainClass.InfoLog("Initializing Tolk...");
|
||||
Tolk.TrySAPI(true);
|
||||
Tolk.Load();
|
||||
|
Reference in New Issue
Block a user