Skip to content

Commit 0532aad

Browse files
author
CapitaineToinon
committed
Introduced variable thread refresh intervals
Now only check once per second when trying to hook to games.
1 parent cf48c47 commit 0532aad

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Gadgetlemage/MainWindow.xaml.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public MainWindow()
4545
{
4646
InitializeComponent();
4747

48-
49-
5048
// display version
5149
this.Title = $"Gadgetlemage ({getRunningVersion()})";
5250

@@ -157,10 +155,7 @@ private void MainWindow_Loaded(object sender, RoutedEventArgs e)
157155
/**
158156
* Keyboard hook and Model
159157
*/
160-
Model = new Model()
161-
{
162-
RefreshInterval = THREAD_REFRESH_RATE,
163-
};
158+
Model = new Model();
164159
keyboardHook = new GlobalKeyboardHook();
165160

166161
/**

Gadgetlemage/Model.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ public class Model : PHook
1313
/// </summary>
1414
private const string PTDE_NAME = "DARKSOULS";
1515
private const string REMASTERED_NAME = "DARK SOULS™: REMASTERED";
16-
private const int REFRESH_INTERVAL = 1000;
16+
private const int UNHOOKED_INTERVAL = 1000;
17+
private const int HOOKED_INTERVAL = 33;
1718
private const int MIN_LIFE_SPAN = 5000;
1819

1920
/// <summary>
@@ -67,6 +68,14 @@ public BlackKnightWeapon BlackKnightShield
6768
}
6869
}
6970

71+
new public int RefreshInterval
72+
{
73+
get
74+
{
75+
return (Hooked) ? HOOKED_INTERVAL : UNHOOKED_INTERVAL;
76+
}
77+
}
78+
7079
/// <summary>
7180
/// If the process is ready (Hook and Dark Souls is not null)
7281
/// </summary>
@@ -114,7 +123,7 @@ public GameVersion Version
114123
/// <summary>
115124
/// Constructor
116125
/// </summary>
117-
public Model() : base(REFRESH_INTERVAL, MIN_LIFE_SPAN, processSelector)
126+
public Model() : base(0, MIN_LIFE_SPAN, processSelector) // RefreshInterval at 0 because manually refreshed from the outside
118127
{
119128
Weapons = new List<BlackKnightWeapon>()
120129
{

Gadgetlemage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
5252
// en utilisant '*', comme indiqué ci-dessous :
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("2.0.0.0")]
55-
[assembly: AssemblyFileVersion("2.0.0.0")]
54+
[assembly: AssemblyVersion("3.0.0.0")]
55+
[assembly: AssemblyFileVersion("3.0.0.0")]

0 commit comments

Comments
 (0)