Setup for linux

master
shoaib11120 2022-01-26 16:51:13 +05:30
parent 3744929be0
commit c1e1955a4b
2 changed files with 23 additions and 12 deletions

View File

@ -5,6 +5,7 @@ using StardewValley;
using HarmonyLib;
using stardew_access.Patches;
using AutoHotkey.Interop;
using System.Runtime.InteropServices;
namespace stardew_access
{
@ -38,18 +39,8 @@ namespace stardew_access
Game1.options.setGamepadMode("force_on");
// Initialize AutoHotKey
try
{
ahk = AutoHotkeyEngine.Instance;
ahk.ExecRaw("[::\nSend {LButton}");
ahk.ExecRaw("^Enter::\nSend {LButton}");
ahk.ExecRaw("]::\nSend {RButton}");
ahk.ExecRaw("+Enter::\nSend {RButton}");
}
catch (Exception e)
{
monitor.Log($"Unable to initialize AutoHotKey:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
InitializeAutoHotKey();
screenReader = new ScreenReader();
screenReader.InitializeScreenReader();
@ -148,5 +139,21 @@ namespace stardew_access
monitor.Log($"{Game1.player.controller.pathToEndPoint==null}", LogLevel.Debug); // true if path not found
}*/
}
private void InitializeAutoHotKey()
{
try
{
ahk = AutoHotkeyEngine.Instance;
ahk.ExecRaw("[::\nSend {LButton}");
ahk.ExecRaw("^Enter::\nSend {LButton}");
ahk.ExecRaw("]::\nSend {RButton}");
ahk.ExecRaw("+Enter::\nSend {RButton}");
}
catch (Exception e)
{
monitor.Log($"Unable to initialize AutoHotKey:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
}
}
}
}

View File

@ -1,5 +1,6 @@
using AccessibleOutput;
using StardewModdingAPI;
using System.Runtime.InteropServices;
namespace stardew_access
{
@ -11,6 +12,9 @@ namespace stardew_access
/// <summary>Initializes the screen reader.</summary>
public void InitializeScreenReader()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
NvdaOutput? nvdaOutput = null;
JawsOutput? jawsOutput = null;
SapiOutput? sapiOutput = null;