Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
v0.3.3 update
Browse files Browse the repository at this point in the history
  • Loading branch information
fr-Pursuit committed Jun 22, 2019
1 parent 4396166 commit c9079c7
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
14 changes: 12 additions & 2 deletions AsiSupport/ASI/AsiInterface.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using AsiSupport.Managers;
Expand Down Expand Up @@ -228,7 +229,16 @@ private static IntPtr NativeCall()

argumentsIndex = 0;

*(NativeRetVal*)returnedValue = (NativeRetVal)NativeFunction.Call(nativeHash, typeof(NativeRetVal), args);
try
{
*(NativeRetVal*) returnedValue = (NativeRetVal) NativeFunction.Call(nativeHash, typeof(NativeRetVal), args);
}
catch(Exception e)
{
if(Support.Instance.Config.IgnoreUnknownNatives)
*(NativeRetVal*)returnedValue = new NativeRetVal(); //== 0
else throw e;
}
return returnedValue;
}

Expand Down Expand Up @@ -326,7 +336,7 @@ private static IntPtr GetScriptHandleBaseAddress(uint handle)

private static int GetGameVersion()
{
return Support.Instance.GameVersion;
return Support.Instance.Config.ConsiderVersionUnknown ? -1 : Support.Instance.GameVersion;
}
}
}
4 changes: 4 additions & 0 deletions AsiSupport/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class Config : ConfigFile
{
public bool LoadAllPluginsOnStartup { get; set; } = true;

public bool ConsiderVersionUnknown { get; set; } = false;

public bool IgnoreUnknownNatives { get; set; } = false;

public Config() : base(Support.Instance.ConfigFile, true) {}
}
}
6 changes: 6 additions & 0 deletions AsiSupport/ConsoleCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ public static void UnloadAllAsiPlugins()
{
Support.Instance.Loader.UnloadAllPlugins();
}

[ConsoleCommand(Description = "Reload AsiSupport's configuration")]
public static void ReloadAsiConfig()
{
Support.Instance.Config = new Config();
}
}
}
7 changes: 3 additions & 4 deletions AsiSupport/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
Expand All @@ -10,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Pursuit")]
[assembly: AssemblyProduct("ASI Support")]
[assembly: AssemblyCopyright("Copyright © Pursuit 2018")]
[assembly: AssemblyCopyright("Copyright © Pursuit 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: Rage.Attributes.Plugin("ASI Support For RAGE Plugin Hook", Description = "Adds support for ASI plugins to RAGE Plugin Hook.", Author = "Pursuit")]
Expand All @@ -33,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.2")]
[assembly: AssemblyFileVersion("0.3.2")]
[assembly: AssemblyVersion("0.3.3")]
[assembly: AssemblyFileVersion("0.3.3")]
2 changes: 1 addition & 1 deletion AsiSupport/Support.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Support : RPHPlugin
{
public static Support Instance { get; private set; }

public Config Config { get; private set; }
public Config Config { get; set; }
public int GameVersion { get; private set; } = -1;
public AsiLoader Loader { get; private set; }
public TextureManager TextureManager { get; private set; }
Expand Down
5 changes: 5 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
__0.3.3__
* The plugin can now optionally consider the current game version as unknown (getGameVersion() then always returns -1)
* The plugin can now optionally ignore calls to unknown natives. This could prevent some plugins from crashing. If a plugin tries to call an unknown native, 0 will be returned.
* Added the ReloadAsiConfig command

__0.3.2__
* The plugin should no longer crash if it failed to load or convert an ASI file
* The plugin now detects non ScriptHookV scripts instead of trying to convert them
Expand Down

0 comments on commit c9079c7

Please sign in to comment.