diff --git a/stardew-access/CustomCommands.cs b/stardew-access/CustomCommands.cs
index a7951b8..f145cba 100644
--- a/stardew-access/CustomCommands.cs
+++ b/stardew-access/CustomCommands.cs
@@ -4,8 +4,9 @@ namespace stardew_access
{
internal class CustomCommands
{
- internal static void Initialize(IModHelper helper)
+ internal static void Initialize()
{
+ IModHelper helper = MainClass.ModHelper;
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) =>
{
diff --git a/stardew-access/CustomSoundEffects.cs b/stardew-access/CustomSoundEffects.cs
index 61c04f9..20f6a8d 100644
--- a/stardew-access/CustomSoundEffects.cs
+++ b/stardew-access/CustomSoundEffects.cs
@@ -11,7 +11,7 @@ namespace stardew_access
Footstep
}
- internal static void Initialize(IModHelper helper)
+ internal static void Initialize()
{
try
{
@@ -54,7 +54,7 @@ namespace stardew_access
}
SoundEffect effect;
- string filePath = Path.Combine(helper.DirectoryPath, $"sounds/{soundEffect.Key}.wav");
+ string filePath = Path.Combine(MainClass.ModHelper.DirectoryPath,"sounds" , $"{soundEffect.Key}.wav");
using (FileStream stream = new(filePath, FileMode.Open))
{
effect = SoundEffect.FromStream(stream);
diff --git a/stardew-access/LinuxSpeech/_test.py b/stardew-access/LinuxSpeech/_test.py
index 2e1d26c..fc5d88b 100644
--- a/stardew-access/LinuxSpeech/_test.py
+++ b/stardew-access/LinuxSpeech/_test.py
@@ -1,6 +1,6 @@
-import libspeechd
+import wrapper
-speech = libspeechd.Speech
+speech = wrapper.Speech
speech.Initialize(self=speech)
diff --git a/stardew-access/LinuxSpeech/_test_interrupt.py b/stardew-access/LinuxSpeech/_test_interrupt.py
index 420cfb5..2c1de01 100644
--- a/stardew-access/LinuxSpeech/_test_interrupt.py
+++ b/stardew-access/LinuxSpeech/_test_interrupt.py
@@ -1,7 +1,7 @@
-import libspeechd
+import wrapper
import time
-speech = libspeechd.Speech
+speech = wrapper.Speech
speech.Initialize(self=speech)
diff --git a/stardew-access/LinuxSpeech/libspeechd.py b/stardew-access/LinuxSpeech/wrapper.py
similarity index 100%
rename from stardew-access/LinuxSpeech/libspeechd.py
rename to stardew-access/LinuxSpeech/wrapper.py
diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs
index 224fcf6..150d7cc 100644
--- a/stardew-access/ModEntry.cs
+++ b/stardew-access/ModEntry.cs
@@ -25,6 +25,12 @@ namespace stardew_access
public static Radar radarFeature;
public static ScreenReader screenReader;
+ private static IModHelper _modHelper;
+ public static IModHelper ModHelper
+ {
+ get{return _modHelper;}
+ }
+
/*********
** Public methods
*********/
@@ -35,6 +41,7 @@ namespace stardew_access
#region Initializations
monitor = Monitor; // Inititalize monitor
+ _modHelper = helper;
Game1.options.setGamepadMode("force_on");
@@ -45,9 +52,9 @@ namespace stardew_access
screenReader = new ScreenReader();
screenReader.InitializeScreenReader();
- CustomSoundEffects.Initialize(helper);
+ CustomSoundEffects.Initialize();
- CustomCommands.Initialize(helper);
+ CustomCommands.Initialize();
radarFeature = new Radar();
diff --git a/stardew-access/ScreenReader.cs b/stardew-access/ScreenReader.cs
index c5f351d..bdd4fca 100644
--- a/stardew-access/ScreenReader.cs
+++ b/stardew-access/ScreenReader.cs
@@ -1,17 +1,40 @@
using AccessibleOutput;
using StardewModdingAPI;
using System.Runtime.InteropServices;
+using IronPython.Hosting;
namespace stardew_access
{
public class ScreenReader
{
public IAccessibleOutput? screenReader = null;
+ public dynamic wrapperInstance = null;
public string prevText = "", prevTextTile = " ", prevChatText = "", prevMenuText = "";
/// Initializes the screen reader.
public void InitializeScreenReader()
{
+ MainClass.monitor.Log($"here! {RuntimeInformation.OSDescription}", LogLevel.Debug);
+ if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ MainClass.monitor.Log($"here!", LogLevel.Debug);
+ //instance of python engine
+ var engine = Python.CreateEngine();
+ //reading code from file
+ var source = engine.CreateScriptSourceFromFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "LinuxSpeech", "wrapper.py"));
+ var scope = engine.CreateScope();
+ //executing script in scope
+ source.Execute(scope);
+ var wrapper = scope.GetVariable("Speech");
+ //initializing class
+ wrapperInstance = engine.Operations.CreateInstance(wrapper);
+ wrapperInstance.Initialize();
+
+ MainClass.monitor.Log($"here!", LogLevel.Debug);
+
+ return;
+ }
+
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
return;
@@ -55,6 +78,12 @@ namespace stardew_access
/// Whether to skip the currently speaking text or not.
public void Say(string text, bool interrupt)
{
+ if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+ {
+ wrapperInstance.Say(text, interrupt);
+ return;
+ }
+
if (screenReader == null)
return;
@@ -73,7 +102,7 @@ namespace stardew_access
if (prevText != text)
{
prevText = text;
- screenReader.Speak(text, interrupt);
+ Say(text, interrupt);
}
}
@@ -90,7 +119,7 @@ namespace stardew_access
if (prevMenuText != text)
{
prevMenuText = text;
- screenReader.Speak(text, interrupt);
+ Say(text, interrupt);
}
}
@@ -107,7 +136,7 @@ namespace stardew_access
if (prevChatText != text)
{
prevChatText = text;
- screenReader.Speak(text, interrupt);
+ Say(text, interrupt);
}
}
@@ -128,7 +157,7 @@ namespace stardew_access
if (prevTextTile != query)
{
prevTextTile = query;
- screenReader.Speak(text, interrupt);
+ Say(text, interrupt);
}
}
}
diff --git a/stardew-access/stardew-access.csproj b/stardew-access/stardew-access.csproj
index 219531e..45a9d76 100644
--- a/stardew-access/stardew-access.csproj
+++ b/stardew-access/stardew-access.csproj
@@ -5,9 +5,10 @@
stardew_access
enable
enable
- preview
- AnyCPU
- true
+ preview
+ AnyCPU
+ true
+ PackageReference