diff --git a/GOGWrapper.sln b/GOGWrapper.sln
index 06a3774..a7b3f87 100644
--- a/GOGWrapper.sln
+++ b/GOGWrapper.sln
@@ -7,18 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GOGWrapper", "GOGWrapper\GO
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {9A18280C-D97E-4753-9ED9-690091A7355F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {9A18280C-D97E-4753-9ED9-690091A7355F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9A18280C-D97E-4753-9ED9-690091A7355F}.Debug|x86.ActiveCfg = Debug|x86
{9A18280C-D97E-4753-9ED9-690091A7355F}.Debug|x86.Build.0 = Debug|x86
- {9A18280C-D97E-4753-9ED9-690091A7355F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {9A18280C-D97E-4753-9ED9-690091A7355F}.Release|Any CPU.Build.0 = Release|Any CPU
{9A18280C-D97E-4753-9ED9-690091A7355F}.Release|x86.ActiveCfg = Release|x86
{9A18280C-D97E-4753-9ED9-690091A7355F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
diff --git a/GOGWrapper/GOG/GOGGalaxy.cs b/GOGWrapper/GOG/GOGGalaxy.cs
index ea328b2..77a2a18 100644
--- a/GOGWrapper/GOG/GOGGalaxy.cs
+++ b/GOGWrapper/GOG/GOGGalaxy.cs
@@ -33,22 +33,10 @@ public static void open(string id)
public static void launch(string id, Action callback = null)
{
- GOGGalaxy.open(id);
-
- IntPtr hwnd = WinAPI.FindWindow("GalaxyClientClass", null);
-
- bool windowExists = WinAPI.IsWindow(hwnd);
-
- Thread.Sleep(500);
-
- if (!windowExists)
- {
- hwnd = WinAPI.WaitForWindow("GalaxyClientClass", null);
- Thread.Sleep(5000);
- }
-
- WinAPI.SetForegroundWindow(hwnd);
- WinAPI.Click(hwnd, new System.Drawing.Point(_x, _y));
+ // GOGGalaxy.launchWinapi(id); // old hacky way
+
+ Process.Start(GOGRegistry.ClientExecutable, $@"/gameid {id} /command runGame");
+ GOGGalaxy.waitForStartup();
GOGGame game = GOGRegistry.Game(id);
@@ -84,6 +72,33 @@ public static void launch(string id, Action callback = null)
callback?.Invoke();
}
+ private static void launchWinapi(string id)
+ {
+ GOGGalaxy.open(id);
+
+ IntPtr hwnd = GOGGalaxy.waitForStartup();
+
+ WinAPI.SetForegroundWindow(hwnd);
+ WinAPI.Click(hwnd, new System.Drawing.Point(_x, _y));
+ }
+
+ private static IntPtr waitForStartup()
+ {
+ IntPtr hwnd = WinAPI.FindWindow("GalaxyClientClass", null);
+
+ bool windowExists = WinAPI.IsWindow(hwnd);
+
+ Thread.Sleep(500);
+
+ if (!windowExists)
+ {
+ hwnd = WinAPI.WaitForWindow("GalaxyClientClass", null);
+ Thread.Sleep(5000);
+ }
+
+ return hwnd;
+ }
+
private static string normalize(string path)
{
return Path.GetFullPath(new Uri(path).LocalPath).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
diff --git a/GOGWrapper/GOGWrapper.csproj b/GOGWrapper/GOGWrapper.csproj
index f5069e6..83cb721 100644
--- a/GOGWrapper/GOGWrapper.csproj
+++ b/GOGWrapper/GOGWrapper.csproj
@@ -27,27 +27,6 @@
false
true
-
- AnyCPU
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- AnyCPU
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
true
bin\x86\Debug\