Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master < dev #295

Merged
merged 32 commits into from
Aug 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2d30db8
Implemented ModMessagePopup (#230)
TAImatem Jul 26, 2020
a90b723
fixed selector bug
amazingalek Jul 26, 2020
6dccd91
Merge pull request #261 from amazingalek/master
amazingalek Jul 27, 2020
74e9f2f
added warning when Enabled status of any mod changes (#231)
TAImatem Jul 27, 2020
da25ad4
enoforced having default-config for non-standard settings
TAImatem Jul 27, 2020
8ae8a34
Merge pull request #265 from amazingalek/tai/enforceDefaultConfig
TAImatem Jul 27, 2020
41ae68e
fix events (#253)
amazingalek Jul 27, 2020
49e17d5
Fix socket send error (#271)
misternebula Jul 27, 2020
20ea9b5
allowing duplicate inpus combos (#272)
amazingalek Jul 28, 2020
f26d5b2
Implemented PopupManager (#234)
TAImatem Jul 28, 2020
375a6a7
remove obsolete stuff (#273)
amazingalek Jul 28, 2020
8a44981
shortened some code (#278)
amazingalek Jul 28, 2020
af678bf
mod buttons now disappear in a same way OW buttons do (#277)
TAImatem Jul 28, 2020
6308432
remove output factory (#279)
amazingalek Jul 29, 2020
483ef26
extracted socket class and improved unity logging (#281)
amazingalek Jul 29, 2020
c52cf54
outerwildsmods.com in readme, less nexus links (#284)
Raicuparta Jul 29, 2020
40a9e40
fixed `.Enabled` when getting vrMods
TAImatem Jul 30, 2020
bf3010c
debug mode fix (#283)
amazingalek Jul 30, 2020
adea803
Merge pull request #285 from amazingalek/tai/EnabledFix
TAImatem Jul 30, 2020
e998e67
moved owml menu into mods menu (#288)
amazingalek Jul 30, 2020
d6796a8
remove obsolete console stuff, new logging project (#238)
amazingalek Jul 30, 2020
b7f83cc
Binary patcher generalization (#287)
TAImatem Jul 30, 2020
cedc621
re-remove game path
TAImatem Jul 31, 2020
6404231
Pre-launch version checking (#289)
TAImatem Aug 1, 2020
aba7ea5
Merge pull request #292 from amazingalek/tai/ReRemoveGamePath
TAImatem Aug 1, 2020
76c495c
VR patch improvements (#290)
TAImatem Aug 1, 2020
3d10328
Point to outerwildsmods.com/mods instead of Nexus (#293)
Raicuparta Aug 1, 2020
334903c
removed RequireVR from configs (#266)
TAImatem Aug 1, 2020
17d20c1
0.7.0 (#296)
amazingalek Aug 2, 2020
98b1944
fixed buttons not getting blocked when they should if execution takes…
TAImatem Aug 3, 2020
57e2ea8
Merge pull request #301 from amazingalek/tai/BlockingFix
TAImatem Aug 3, 2020
7ce00e8
readme version thing (#302)
amazingalek Aug 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OWML.Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{
public class Constants
{
public const string OwmlTitle = "OWML";
public const string ConsolePortArgument = "consolePort";
public const string OwmlConfigFileName = "OWML.Config.json";
public const string OwmlDefaultConfigFileName = "OWML.DefaultConfig.json";
Expand Down
3 changes: 3 additions & 0 deletions OWML.Common/IModAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ namespace OWML.Common
{
public interface IModAsset<T>
{
event Action<T> Loaded;

[Obsolete("Use Loaded instead.")]
Action<T> OnLoaded { get; set; }
}
}
5 changes: 1 addition & 4 deletions OWML.Common/IModConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ namespace OWML.Common
public interface IModConfig
{
bool Enabled { get; set; }
[Obsolete("Use ModManifest.RequireVR instead")]
bool RequireVR { get; set; }
Dictionary<string, object> Settings { get; set; }

T GetSettingsValue<T>(string key);
void SetSettingsValue(string key, object value);

[Obsolete("Use GetSettingsValue instead")]
T GetSetting<T>(string key);
IModConfig Copy();
}
}
2 changes: 2 additions & 0 deletions OWML.Common/IModData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ public interface IModData
IModConfig DefaultConfig { get; }
bool Enabled { get; }
bool RequireVR { get; }
bool RequireReload { get; }

void UpdateSnapshot();
void ResetConfigToDefaults();
bool FixConfigs();
}
Expand Down
7 changes: 4 additions & 3 deletions OWML.Common/IModEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ public interface IModEvents
{
IModPlayerEvents Player { get; }
IModSceneEvents Scenes { get; }
IModUnityEvents Unity { get; }

event Action<MonoBehaviour, Events> Event;

[Obsolete("Use Event instead.")]
Action<MonoBehaviour, Events> OnEvent { get; set; }

void Subscribe<T>(Events ev) where T : MonoBehaviour;

[Obsolete("Use Subscribe instead")]
void AddEvent<T>(Events ev) where T : MonoBehaviour;
}
}
2 changes: 2 additions & 0 deletions OWML.Common/IModManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ public interface IModManifest
string[] Dependencies { get; }
bool PriorityLoad { get; }
bool RequireVR { get; }
string MinGameVersion { get; }
string MaxGameVersion { get; }
}
}
7 changes: 7 additions & 0 deletions OWML.Common/IModSocket.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace OWML.Common
{
public interface IModSocket
{
void WriteToSocket(IModSocketMessage message);
}
}
10 changes: 10 additions & 0 deletions OWML.Common/IModSocketMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace OWML.Common
{
public interface IModSocketMessage
{
string SenderName { get; }
string SenderType { get; }
MessageType Type { get; }
string Message { get; }
}
}
14 changes: 14 additions & 0 deletions OWML.Common/IModUnityEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;

namespace OWML.Common
{
public interface IModUnityEvents
{
event Action OnUpdate;
event Action OnFixedUpdate;
event Action OnLateUpdate;

void FireOnNextUpdate(Action action);
void FireInNUpdates(Action action, int n);
}
}
4 changes: 0 additions & 4 deletions OWML.Common/Menus/IModInputCombinationElementMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ public interface IModInputCombinationElementMenu : IModMenu
{
event Action<string> OnConfirm;
event Action OnCancel;

void Initialize(PopupInputMenu menu);
void Open(string value, string comboName, IModInputCombinationMenu combinationMenu = null,
IModInputCombinationElement element = null);
}
}
2 changes: 0 additions & 2 deletions OWML.Common/Menus/IModInputMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ public interface IModInputMenu : IModMenu
{
event Action<string> OnConfirm;
event Action OnCancel;
void Initialize(PopupInputMenu inputMenu);
void Open(InputType inputType, string value);
}
}
8 changes: 2 additions & 6 deletions OWML.Common/Menus/IModMenu.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using UnityEngine.UI;

namespace OWML.Common.Menus
{
Expand All @@ -20,7 +19,9 @@ public interface IModMenu
IModButton GetTitleButton(string title);
IModPromptButton GetPromptButton(string title);

[Obsolete("Use AddButton(IModButtonBase) instead.")]
IModButton AddButton(IModButton button);
[Obsolete("Use AddButton(IModButtonBase, int) instead.")]
IModButton AddButton(IModButton button, int index);
IModButtonBase AddButton(IModButtonBase button);
IModButtonBase AddButton(IModButtonBase button, int index);
Expand Down Expand Up @@ -60,10 +61,5 @@ public interface IModMenu

void SelectFirst();
void UpdateNavigation();

[Obsolete("Use Buttons instead")]
List<Button> GetButtons();
[Obsolete("Use button.Duplicate instead")]
Button AddButton(string title, int index);
}
}
4 changes: 1 addition & 3 deletions OWML.Common/Menus/IModMenus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ public interface IModMenus
IModMainMenu MainMenu { get; }
IModPauseMenu PauseMenu { get; }
IModsMenu ModsMenu { get; }
IModConfigMenuBase OwmlMenu { get; }
IModInputMenu InputMenu { get; }
IModInputCombinationElementMenu InputCombinationElementMenu { get; }
IModInputCombinationMenu InputCombinationMenu { get; }
IModPopupManager PopupManager { get; }
}
}
10 changes: 10 additions & 0 deletions OWML.Common/Menus/IModMessagePopup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace OWML.Common.Menus
{
public interface IModMessagePopup : IModMenu
{
event Action OnConfirm;
event Action OnCancel;
}
}
13 changes: 13 additions & 0 deletions OWML.Common/Menus/IModPopupManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using UnityEngine;

namespace OWML.Common.Menus
{
public interface IModPopupManager
{
void Initialize(GameObject popupCanvas);
IModMessagePopup CreateMessagePopup(string message, bool addCancel = false, string okMessage = "OK", string cancelMessage = "Cancel");
IModInputMenu CreateInputPopup(InputType inputType, string value);
IModInputCombinationElementMenu CreateCombinationInput(string value, string comboName,
IModInputCombinationMenu combinationMenu = null, IModInputCombinationElement element = null);
}
}
8 changes: 5 additions & 3 deletions OWML.Common/Menus/IModPopupMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ namespace OWML.Common.Menus
{
public interface IModPopupMenu : IModMenu
{
event Action OnOpened;
event Action OnClosed;

[Obsolete("Use OnOpened instead.")]
Action OnOpen { get; set; }
[Obsolete("Use OnClosed instead.")]
Action OnClose { get; set; }

bool IsOpen { get; }
Expand All @@ -19,8 +24,5 @@ public interface IModPopupMenu : IModMenu
IModPopupMenu Copy(string title);
void Initialize(Menu menu);
void Initialize(Menu menu, LayoutGroup layoutGroup);

[Obsolete("Use Copy instead")]
IModPopupMenu CreateCopy(string name);
}
}
5 changes: 5 additions & 0 deletions OWML.Common/OWML.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@
<Compile Include="IModInteraction.cs" />
<Compile Include="IModPlayerEvents.cs" />
<Compile Include="IModSceneEvents.cs" />
<Compile Include="IModSocket.cs" />
<Compile Include="IModUnityEvents.cs" />
<Compile Include="IModSocketMessage.cs" />
<Compile Include="Menus\IModPopupManager.cs" />
<Compile Include="Menus\IModSeparator.cs" />
<Compile Include="Menus\IModInputBase.cs" />
<Compile Include="Menus\IModFieldInput.cs" />
<Compile Include="Menus\IModMessagePopup.cs" />
<Compile Include="Menus\IModMenuWithSelectables.cs" />
<Compile Include="Menus\IModLayoutManager.cs" />
<Compile Include="Menus\IModInputCombinationElementMenu.cs" />
Expand Down
40 changes: 39 additions & 1 deletion OWML.Launcher/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public void Run(string[] args)

LocateGamePath();

CheckGameVersion();

CopyGameFiles();

CreateLogsDirectory();
Expand Down Expand Up @@ -70,6 +72,42 @@ private void LocateGamePath()
}
}

private void CheckGameVersion()
{
var versionReader = new GameVersionReader(new BinaryPatcher(_owmlConfig, _writer));
var gameVersionString = versionReader.GetGameVersion();
_writer.WriteLine($"Game version: {gameVersionString}", MessageType.Info);
var isValidFormat = Version.TryParse(gameVersionString, out var gameVersion);
var minVersion = new Version(_owmlManifest.MinGameVersion);
var maxVersion = new Version(_owmlManifest.MaxGameVersion);
if (!isValidFormat)
{
_writer.WriteLine("Warning - non-standard game version formatting found", MessageType.Warning);
}
if (!isValidFormat || gameVersion > maxVersion)
{
PotentiallyUnsupported();
return;
}
if (gameVersion < minVersion)
{
_writer.WriteLine("Unsupported game version found", MessageType.Error);
AnyKeyExitConsole();
}
}

private void AnyKeyExitConsole()
{
_writer.WriteLine("Press any key to exit...", MessageType.Info);
Console.ReadKey();
ExitConsole();
}

private void PotentiallyUnsupported()
{
_writer.WriteLine("Potentially unsupported game version found, continue at your own risk", MessageType.Warning);
}

private void CopyGameFiles()
{
var filesToCopy = new[] { "UnityEngine.CoreModule.dll", "Assembly-CSharp.dll" };
Expand Down Expand Up @@ -112,7 +150,7 @@ private bool IsMadeForSameOwmlMajorVersion(IModManifest manifest)

private bool HasVrMod(List<IModData> mods)
{
var vrMod = mods.FirstOrDefault(x => x.RequireVR && x.Config.Enabled);
var vrMod = mods.FirstOrDefault(x => x.RequireVR && x.Enabled);
var hasVrMod = vrMod != null;
_writer.WriteLine(hasVrMod ? $"{vrMod.Manifest.UniqueName} requires VR." : "No mods require VR.");
return hasVrMod;
Expand Down
4 changes: 4 additions & 0 deletions OWML.Launcher/OWML.Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<Project>{a3d507f5-22a2-4a18-b529-868fe8d59cf3}</Project>
<Name>OWML.GameFinder</Name>
</ProjectReference>
<ProjectReference Include="..\OWML.Logging\OWML.Logging.csproj">
<Project>{6F14D39C-5747-4149-BE4D-365B43918A0A}</Project>
<Name>OWML.Logging</Name>
</ProjectReference>
<ProjectReference Include="..\OWML.ModHelper\OWML.ModHelper.csproj">
<Project>{CB57BAB8-D70E-4FCE-9BF1-328A924173A7}</Project>
<Name>OWML.ModHelper</Name>
Expand Down
6 changes: 4 additions & 2 deletions OWML.Launcher/OWML.Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"author": "Alek",
"name": "OWML",
"uniqueName": "Alek.OWML",
"version": "0.6.1",
"description": "The mod loader and mod framework for Outer Wilds"
"version": "0.7.0",
"description": "The mod loader and mod framework for Outer Wilds",
"minGameVersion": "1.0.7.0",
"maxGameVersion": "1.0.7.481"
}
19 changes: 14 additions & 5 deletions OWML.Launcher/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using OWML.Common;
using OWML.GameFinder;
using OWML.Logging;
using OWML.ModHelper;
using OWML.ModLoader;
using OWML.Patcher;
Expand All @@ -12,11 +13,11 @@ public class Program
static void Main(string[] args)
{
var owmlConfig = GetOwmlConfig() ?? CreateOwmlConfig();
SaveConsolePort(owmlConfig);
var hasConsolePort = CommandLineArguments.HasArgument(Constants.ConsolePortArgument);
SaveConsolePort(owmlConfig, hasConsolePort);
SaveOwmlPath(owmlConfig);
var owmlManifest = GetOwmlManifest();
var writer = OutputFactory.CreateOutput(owmlConfig, null, owmlManifest,
CommandLineArguments.HasArgument(Constants.ConsolePortArgument));
var writer = CreateWriter(owmlConfig, owmlManifest, hasConsolePort);
var modFinder = new ModFinder(owmlConfig, writer);
var pathFinder = new PathFinder(owmlConfig, writer);
var owPatcher = new OWPatcher(owmlConfig, writer);
Expand All @@ -26,9 +27,9 @@ static void Main(string[] args)
app.Run(args);
}

private static void SaveConsolePort(IOwmlConfig owmlConfig)
private static void SaveConsolePort(IOwmlConfig owmlConfig, bool hasConsolePort)
{
if (CommandLineArguments.HasArgument(Constants.ConsolePortArgument))
if (hasConsolePort)
{
var argument = CommandLineArguments.GetArgument(Constants.ConsolePortArgument);
if (!int.TryParse(argument, out var port))
Expand All @@ -37,6 +38,7 @@ private static void SaveConsolePort(IOwmlConfig owmlConfig)
return;
}
owmlConfig.SocketPort = port;
JsonHelper.SaveJsonObject(Constants.OwmlConfigFileName, owmlConfig);
}
else
{
Expand Down Expand Up @@ -67,5 +69,12 @@ private static IModManifest GetOwmlManifest()
return JsonHelper.LoadJsonObject<ModManifest>(Constants.OwmlManifestFileName);
}

private static IModConsole CreateWriter(IOwmlConfig owmlConfig, IModManifest owmlManifest, bool hasConsolePort)
{
return hasConsolePort
? new ModSocketOutput(owmlConfig, null, owmlManifest, new ModSocket(owmlConfig.SocketPort))
: (IModConsole)new OutputWriter();
}

}
}
5 changes: 3 additions & 2 deletions OWML.Launcher/SocketListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using OWML.Logging;

namespace OWML.Launcher
{
Expand Down Expand Up @@ -93,10 +94,10 @@ private void ProcessMessage(byte[] bytes, int count)
{
continue;
}
SocketMessage data;
ModSocketMessage data;
try
{
data = JsonConvert.DeserializeObject<SocketMessage>(json);
data = JsonConvert.DeserializeObject<ModSocketMessage>(json);
}
catch (Exception ex)
{
Expand Down
Loading