Skip to content

Commit

Permalink
Bump version to 0.2.0 and change the calling signature for the payloa…
Browse files Browse the repository at this point in the history
…d: We now expect to be called with a profile path that is _not_ the framework path
  • Loading branch information
MeFisto94 committed Feb 28, 2024
1 parent 739652f commit d9226bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Andraste.Payload.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<PropertyGroup>
<!-- NuGet Metadata -->
<PackageId>Andraste.Payload</PackageId>
<PackageVersion>0.1.4</PackageVersion>
<PackageVersion>0.2.0</PackageVersion>
<Title>Andraste Payload</Title>
<Authors>MeFisto94</Authors>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<!-- <icon>icon.png</icon> -->
<PackageProjectUrl>https://AndrasteFramework.github.io</PackageProjectUrl>
<Description>The Payload is what is injected into the Application to provide all the modding functionality</Description>
<Copyright>Copyright 2023</Copyright>
<Copyright>Copyright 2023-2024 The AndrasteFramework Team</Copyright>
<PackageTags>Andraste ModdingFramework</PackageTags>
<RepositoryUrl>https://github.com/AndrasteFramework/Payload</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down Expand Up @@ -43,7 +43,7 @@

<ItemGroup>
<PackageReference Include="Andraste.EasyHook" Version="1.0.2" />
<PackageReference Include="Andraste.Shared" Version="0.1.3" />
<PackageReference Include="Andraste.Shared" Version="0.2.0" />
<PackageReference Include="Iced" Version="1.11.3" />
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="SharpDX.Direct3D9" Version="4.2.0" />
Expand Down
23 changes: 13 additions & 10 deletions EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public abstract class EntryPoint : IEntryPoint
/// This can be different from the Working Directory, which is the
/// folder where the Launcher/Host Application resides.
/// </summary>
public static string ModFolder;
public static string FrameworkFolder;

public static string ProfileFolder;

public static string HostFolder =>
throw new NotImplementedException("TODO: NLog can somehow determine the path of the Host Application.");
Expand All @@ -53,15 +55,16 @@ public abstract class EntryPoint : IEntryPoint
public readonly ManagerContainer Container;
private readonly ModLoader _modLoader;

protected EntryPoint(RemoteHooking.IContext context)
protected EntryPoint(RemoteHooking.IContext context, string profileFolder)
{
GameFolder = Directory.GetCurrentDirectory();
ModFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
FrameworkFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
ProfileFolder = profileFolder;
Container = new ManagerContainer();
_modLoader = new ModLoader(this);
}

public virtual void Run(RemoteHooking.IContext context)
public virtual void Run(RemoteHooking.IContext context, string profileFolder)
{
if (ShouldSetupExceptionHandlers)
{
Expand All @@ -76,7 +79,7 @@ public virtual void Run(RemoteHooking.IContext context)
Thread.CurrentThread.Name = "Andraste Main-Thread";

Logger.Info($"Game Directory: {GameFolder}");
Logger.Info($"Mod Directory: {ModFolder}");
Logger.Info($"Mod Directory: {ProfileFolder}");
//logger.Info($"Host Directory: {Process.GetCurrentProcess().StartInfo.WorkingDirectory}");
Logger.Info($".NET Plattform: {RuntimeInformation.FrameworkDescription}"); // .net 4.7.1+

Expand Down Expand Up @@ -180,7 +183,7 @@ protected virtual void ParseModFeatures()

protected virtual void DiscoverMods()
{
_modLoader.EnabledMods = _modLoader.DiscoverMods(ModFolder);
_modLoader.EnabledMods = _modLoader.DiscoverMods(ProfileFolder);
}

protected virtual void LoadFeatureParsers()
Expand Down Expand Up @@ -230,14 +233,14 @@ protected virtual void SetupLogging()
{
// Workaround: For some reason, NLog is only flushing/deleting the file, once you log something to it,
// so we're going to force-delete the files for now.
if (File.Exists(Path.Combine(ModFolder, "output.log")))
if (File.Exists(Path.Combine(ProfileFolder, "output.log")))
{
File.Delete(Path.Combine(ModFolder, "output.log"));
File.Delete(Path.Combine(ProfileFolder, "output.log"));
}

if (File.Exists(Path.Combine(ModFolder, "error.log")))
if (File.Exists(Path.Combine(ProfileFolder, "error.log")))
{
File.Delete(Path.Combine(ModFolder, "error.log"));
File.Delete(Path.Combine(ProfileFolder, "error.log"));
}

var cfg = new LoggingConfiguration();
Expand Down

0 comments on commit d9226bd

Please sign in to comment.