Skip to content

Commit

Permalink
Merge pull request #7 from Immersive-Plugins-Team/1.2
Browse files Browse the repository at this point in the history
1.2
  • Loading branch information
opus49 authored Jan 17, 2022
2 parents 087f38e + 7ef0543 commit fc47042
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 5 deletions.
17 changes: 17 additions & 0 deletions IPT.Common/API/Functions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace IPT.Common.API
{
/// <summary>
/// Common helper functions.
/// </summary>
public static class Functions
{
/// <summary>
/// Checks to see if the game is paused. Caution: This uses a NATIVE.
/// </summary>
/// <returns>True if the game is paused, otherwise false.</returns>
public static bool IsGamePaused()
{
return Rage.Game.IsPaused || Rage.Native.NativeFunction.Natives.IS_PAUSE_MENU_ACTIVE<bool>();
}
}
}
5 changes: 5 additions & 0 deletions IPT.Common/API/Logging.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using IPT.Common.User.Settings;
using Rage;

Expand Down Expand Up @@ -67,6 +68,7 @@ public static SettingInt GetLogLevelSetting(LoggingLevel defaultLevel = LoggingL
/// Send a DEBUG level log messsage.
/// </summary>
/// <param name="message">The message to be sent.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Debug(string message)
{
Log(LoggingLevel.DEBUG, Assembly.GetCallingAssembly(), message);
Expand All @@ -77,6 +79,7 @@ public static void Debug(string message)
/// </summary>
/// <param name="message">The message to be sent.</param>
/// <param name="ex">The Exception raised.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Error(string message, Exception ex)
{
var assembly = Assembly.GetCallingAssembly();
Expand All @@ -89,6 +92,7 @@ public static void Error(string message, Exception ex)
/// Send an INFO level log message.
/// </summary>
/// <param name="message">The message to be sent.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Info(string message)
{
Log(LoggingLevel.INFO, Assembly.GetCallingAssembly(), message);
Expand All @@ -98,6 +102,7 @@ public static void Info(string message)
/// Send a WARNING level log message.
/// </summary>
/// <param name="message">The message to be sent.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Warning(string message)
{
Log(LoggingLevel.WARNING, Assembly.GetCallingAssembly(), message);
Expand Down
2 changes: 1 addition & 1 deletion IPT.Common/Fibers/GenericFiber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public virtual void Start()
return;
}

this.IsRunning = true;
GameFiber.StartNew(this.Run, this.Name);
}

Expand All @@ -66,7 +67,6 @@ public virtual void Stop()
/// </summary>
protected virtual void Run()
{
this.IsRunning = true;
while (this.IsRunning)
{
if (this.Interval == 0)
Expand Down
1 change: 1 addition & 0 deletions IPT.Common/IPT.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="API\Events.cs" />
<Compile Include="API\Functions.cs" />
<Compile Include="API\Logging.cs" />
<Compile Include="API\Math.cs" />
<Compile Include="Callouts.cs" />
Expand Down
5 changes: 3 additions & 2 deletions IPT.Common/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@
// 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("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]

5 changes: 4 additions & 1 deletion IPT.Common/User/Settings/SettingButtonCombo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public override void Load(InitializationFile ini)
public override void Save(InitializationFile ini)
{
ini.Write(this.Section, this.Name, this.Value.PrimaryButton.ToString());
ini.Write(this.Section, $"{this.Name}Modifier", this.Value.SecondaryButton.ToString());
if (this.Value.HasSecondary)
{
ini.Write(this.Section, $"{this.Name}Modifier", this.Value.SecondaryButton.ToString());
}
}
}
}
6 changes: 5 additions & 1 deletion IPT.Common/User/Settings/SettingKeyCombo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ public override void Load(InitializationFile ini)
/// <param name="ini">The INI object used to save the value.</param>
public override void Save(InitializationFile ini)
{
ini.Write(this.Section, this.Name, this.Value);
ini.Write(this.Section, this.Name, this.Value.PrimaryKey.ToString());
if (this.Value.HasSecondary)
{
ini.Write(this.Section, $"{this.Name}Modifier", this.Value.SecondaryKey.ToString());
}
}

private static Keys GetKeysFromString(string keyString, Keys defaultKeys)
Expand Down

0 comments on commit fc47042

Please sign in to comment.