Skip to content

Commit

Permalink
2.3.0 (#419)
Browse files Browse the repository at this point in the history
* Use public nuget for game libraries

* net40 -> net48

* Add support for Windows Store build (#417)

* Better game vendor detection (#421)
  • Loading branch information
Raicuparta authored Jan 6, 2022
1 parent 676d21a commit d9fde43
Show file tree
Hide file tree
Showing 28 changed files with 126 additions and 60 deletions.
7 changes: 0 additions & 7 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="github" value="https://nuget.pkg.github.com/amazingalek/index.json" />
</packageSources>
<packageSourceCredentials>
<github>
<add key="Username" value="amazingalek" />
<add key="ClearTextPassword" value="%INTERNAL_PKG_KEY%" />
</github>
</packageSourceCredentials>
</configuration>
2 changes: 1 addition & 1 deletion src/OWML.Abstractions/OWML.Abstractions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
6 changes: 2 additions & 4 deletions src/OWML.Common/OWML.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="OW.Unity.Dlls" Version="1.1.3">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="OuterWildsGameLibs" Version="1.1.12.125" />
</ItemGroup>

</Project>
14 changes: 9 additions & 5 deletions src/OWML.Common/OwmlConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.IO;
using Newtonsoft.Json;

namespace OWML.Common
{
Expand All @@ -14,16 +15,19 @@ public class OwmlConfig : IOwmlConfig
public bool ForceExe { get; set; }

[JsonIgnore]
public string DataPath => $"{GamePath}/OuterWilds_Data";
public bool IsSpaced => Directory.Exists(Path.Combine(GamePath, "Outer Wilds_Data"));

[JsonIgnore]
public string ExePath => $"{GamePath}/OuterWilds.exe";
public string DataPath => Path.Combine(GamePath, IsSpaced ? "Outer Wilds_Data" : "OuterWilds_Data");

[JsonIgnore]
public string ManagedPath => $"{DataPath}/Managed";
public string ExePath => Path.Combine(GamePath, IsSpaced ? "Outer Wilds.exe" : "OuterWilds.exe");

[JsonIgnore]
public string PluginsPath => $"{DataPath}/Plugins";
public string ManagedPath => Path.Combine(DataPath, "Managed");

[JsonIgnore]
public string PluginsPath => Path.Combine(DataPath, "Plugins");

[JsonProperty("owmlPath")]
public string OWMLPath { get; set; }
Expand Down
15 changes: 12 additions & 3 deletions src/OWML.GameFinder/BaseFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ namespace OWML.GameFinder
{
public abstract class BaseFinder
{
private const string ManagedPath = "OuterWilds_Data/Managed";
private readonly string ManagedPath = Path.Combine("OuterWilds_Data", "Managed");
private const string ExePath = "OuterWilds.exe";
private readonly string SpacedManagedPath = Path.Combine("Outer Wilds_Data", "Managed");
private const string SpacedExePath = "Outer Wilds.exe";

protected IOwmlConfig Config;
protected IModConsole Writer;
Expand All @@ -22,7 +24,14 @@ protected BaseFinder(IOwmlConfig config, IModConsole writer)
protected bool IsValidGamePath(string gamePath) =>
!string.IsNullOrEmpty(gamePath) &&
Directory.Exists(gamePath) &&
Directory.Exists($"{gamePath}/{ManagedPath}") &&
File.Exists($"{gamePath}/{ExePath}");
(HasGameFiles(gamePath) || HasSpacedGameFiles(gamePath));

private bool HasGameFiles(string gamePath) =>
Directory.Exists(Path.Combine(gamePath, ManagedPath)) &&
File.Exists(Path.Combine(gamePath, ExePath));

private bool HasSpacedGameFiles(string gamePath) =>
Directory.Exists(Path.Combine(gamePath, SpacedManagedPath)) &&
File.Exists(Path.Combine(gamePath, SpacedExePath));
}
}
1 change: 1 addition & 0 deletions src/OWML.GameFinder/PathFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public string FindGamePath() =>
FindPathWith<CurrentPathFinder>() ??
FindPathWith<SteamGameFinder>() ??
FindPathWith<EpicGameFinder>() ??
FindPathWith<UWPGameFinder>() ??
FindPathWith<DefaultLocationFinder>() ??
FindPathWith<PromptGameFinder>();

Expand Down
42 changes: 42 additions & 0 deletions src/OWML.GameFinder/UWPGameFinder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using Microsoft.Win32;
using OWML.Common;

namespace OWML.GameFinder
{
public class UWPGameFinder : BaseFinder
{
private const string RegistryPath = @"Software\Classes\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages";

public UWPGameFinder(IOwmlConfig config, IModConsole writer)
: base(config, writer)
{
}

public override string FindGamePath()
{
var appPackages = Registry.CurrentUser.OpenSubKey(RegistryPath);

var gamePath = "";
foreach(var appPackageName in appPackages?.GetSubKeyNames())
{
var appPackageKey = appPackages.OpenSubKey(appPackageName);
var packageDisplayName = (string)appPackageKey.GetValue("DisplayName");

if(!String.IsNullOrEmpty(packageDisplayName) && packageDisplayName.Contains("Outer Wilds"))
{
gamePath = (string)appPackageKey.GetValue("PackageRootFolder");
break;
}
}

if (IsValidGamePath(gamePath))
{
return gamePath;
}

Writer.WriteLine("Game not found in UWP.");
return null;
}
}
}
33 changes: 25 additions & 8 deletions src/OWML.Launcher/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using OWML.Common;
using OWML.Utils;

Expand Down Expand Up @@ -167,29 +168,45 @@ private void StartGame()
try
{
void StartGameViaExe()
{
_writer.WriteLine("Starting game via exe...");
_processHelper.Start(_owmlConfig.ExePath, _argumentHelper.Arguments);
}
=> _processHelper.Start(_owmlConfig.ExePath, _argumentHelper.Arguments);

if (_owmlConfig.ForceExe)
{
StartGameViaExe();
return;
}

if (_owmlConfig.GamePath.ToLower().Contains("epic"))
var gameDll = $"{_owmlConfig.ManagedPath}/Assembly-CSharp.dll";
var assembly = Assembly.LoadFrom(gameDll);
var types = assembly.GetTypes();
var isEpic = types.Any(x => x.Name == "EpicEntitlementRetriever");
var isSteam = types.Any(x => x.Name == "SteamEntitlementRetriever");
var isUWP = types.Any(x => x.Name == "MSStoreEntitlementRetriever");

if (isEpic && !isSteam && !isUWP)
{
_writer.WriteLine("Starting game via Epic Launcher...");
_writer.WriteLine("Identified as an Epic install. Launching...");
_processHelper.Start("\"com.epicgames.launcher://apps/starfish%3A601d0668cef146bd8eef75d43c6bbb0b%3AStarfish?action=launch&silent=true\"");
}
else if (_owmlConfig.GamePath.ToLower().Contains("steam"))
else if (!isEpic && isSteam && !isUWP)
{
_writer.WriteLine("Starting game via Steam...");
_writer.WriteLine("Identified as a Steam install. Launching...");
_processHelper.Start("steam://rungameid/753640");
}
else if (!isEpic && !isSteam && isUWP)
{
_writer.WriteLine("Identified as an Xbox Game Pass install. Launching...");
StartGameViaExe();
}
else
{
// This should be impossible to get to?!
_writer.WriteLine("This game isn't from Epic, Steam, or the MSStore...? Wha?\r\n" +
"Either this game is really specifically corrupted, or you're running Outer Wilds from a new exciting vendor.\r\n" +
"In any case, this has a 0% chance of appearing in normal use (right now), so I can make this message as long as I want.\r\n" +
"Suck it, command window! You bend to my will now!\r\n" +
"Though, if you *are* using Steam, Epic, or Game Pass, and you're seeing this... please let us know! Because you aren't meant to see this. :P\r\n" +
"Anyway, back to scheduled programming. Launching...");
StartGameViaExe();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/OWML.Launcher/OWML.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Events\bin\Debug\net40\0Harmony.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Assets\bin\Debug\net40\NAudio-Unity.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.Temp\bin\Debug\net48\Newtonsoft.Json.dll&quot; $(TargetDir)" />
<Exec Command="xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Events\bin\Debug\net48\0Harmony.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.ModHelper.Assets\bin\Debug\net48\NAudio-Unity.dll&quot; $(TargetDir)&#xD;&#xA;xcopy /i /y &quot;$(SolutionDir)src\OWML.Temp\bin\Debug\net48\Newtonsoft.Json.dll&quot; $(TargetDir)" />
</Target>

</Project>
4 changes: 2 additions & 2 deletions src/OWML.Launcher/OWML.Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "Alek",
"name": "OWML",
"uniqueName": "Alek.OWML",
"version": "2.2.0",
"version": "2.3.0",
"minGameVersion": "1.1.10.47",
"maxGameVersion": "1.1.11.72"
"maxGameVersion": "1.1.12.125"
}
2 changes: 1 addition & 1 deletion src/OWML.Logging/OWML.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OWML.ModHelper.Assets/OWML.ModHelper.Assets.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OWML.ModHelper.Events/OWML.ModHelper.Events.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OWML.ModHelper.Menus/OWML.ModHelper.Menus.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/OWML.ModHelper/OWML.ModHelper.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
<Version>1.1.0</Version>
</PropertyGroup>
Expand Down
20 changes: 10 additions & 10 deletions src/OWML.ModHelper/OWML.ModHelper.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
</dependencies>
</metadata>
<files>
<file src="bin\Debug\net40\OWML.ModHelper.Assets.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.ModHelper.Events.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.ModHelper.Menus.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.ModHelper.Input.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.ModHelper.Interaction.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.Common.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.Logging.dll" target="lib\net40" />
<file src="bin\Debug\net40\OWML.Utils.dll" target="lib\net40" />
<file src="bin\Debug\net40\NAudio-Unity.dll" target="lib\net40" />
<file src="bin\Debug\net48\OWML.ModHelper.Assets.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.ModHelper.Events.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.ModHelper.Menus.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.ModHelper.Input.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.ModHelper.Interaction.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.Common.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.Logging.dll" target="lib\net48" />
<file src="bin\Debug\net48\OWML.Utils.dll" target="lib\net48" />
<file src="bin\Debug\net48\NAudio-Unity.dll" target="lib\net48" />
</files>
</package>
</package>
2 changes: 1 addition & 1 deletion src/OWML.ModLoader/OWML.ModLoader.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/OWML.Patcher/OWPatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void CopyFiles(string[] filesToCopy, string pathPrefix, string destinati
{
try
{
File.Copy($"{pathPrefix}{filename}", $"{destination}/{filename}", true);
File.Copy($"{pathPrefix}{filename}", Path.Combine(destination, filename), true);
}
catch
{
Expand All @@ -100,7 +100,7 @@ private void PatchAssembly()
{
_writer.WriteLine("Patching OW assembly...");

var patcher = new dnpatch.Patcher($"{_owmlConfig.ManagedPath}/Assembly-CSharp.dll");
var patcher = new dnpatch.Patcher(Path.Combine(_owmlConfig.ManagedPath, "Assembly-CSharp.dll"));

var target = new Target
{
Expand Down
2 changes: 1 addition & 1 deletion src/OWML.Utils/OWML.Utils.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SampleMods/OWML.EnableDebugMode/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "EnableDebugMode",
"uniqueName": "Alek.EnableDebugMode",
"version": "0.3",
"owmlVersion": "2.2.0",
"owmlVersion": "2.3.0",
"description": "Enables the debug mode in Outer Wilds"
}
2 changes: 1 addition & 1 deletion src/SampleMods/OWML.ExampleAPI/OWML.ExampleAPI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/SampleMods/OWML.ExampleAPI/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"name": "ExampleAPI",
"uniqueName": "_nebula.ExampleAPI",
"version": "0.3",
"owmlVersion": "2.2.0",
"owmlVersion": "2.3.0",
"description": "Example API for testing OWML.Interaction"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net40</TargetFramework>
<TargetFramework>net48</TargetFramework>
<LangVersion>9.0</LangVersion>
</PropertyGroup>

Expand Down
Loading

0 comments on commit d9fde43

Please sign in to comment.