Skip to content

Commit

Permalink
Buf fix for new patch
Browse files Browse the repository at this point in the history
(cherry picked from commit e7b4398)
  • Loading branch information
gabrielefilipp authored and acelan committed Feb 21, 2020
1 parent e51f589 commit 05278e8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion SmartHunter/Game/Config/MemoryConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class MemoryConfig

public BytePatternConfig LobbyStatusPattern = new BytePatternConfig(
"LobbyStatusPattern",
"48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 84 C0 75 14 33 D2 48 8B CD E8 ?? ?? ?? ?? 84 C0"
"48 8B 0D ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 4E ?? F3 0F 10 86 ?? ?? ?? ?? F3 0F 58 86 ?? ?? ?? ?? F3 0F 11 86 ?? ?? ?? ?? E8 ?? ?? ?? ?? 48 8B 4E ??"
);
}
}
2 changes: 2 additions & 0 deletions SmartHunter/Game/Data/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public enum WeaponType
}
public class Game : Bindable
{
public bool IsValid = false;

string m_SessionHostPlayerName = "";
public string SessionHostPlayerName
{
Expand Down
2 changes: 1 addition & 1 deletion SmartHunter/Game/Data/WidgetContexts/DebugWidgetContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace SmartHunter.Game.Data.WidgetContexts
public class DebugWidgetContext : WidgetContext
{
public Game CurrentGame { get; set; }
public string TEST { get { return "Peppaaaaaaaaaaaaaaaaa"; } }

public void UpdateCurrentGame(string playerName, string weaponString, string sessionID, string sessionHostName, string lobbyID, string lobbyHostName)
{
Expand All @@ -18,6 +17,7 @@ public void UpdateCurrentGame(string playerName, string weaponString, string ses
CurrentGame.SessionHostPlayerName = sessionHostName;
CurrentGame.LobbyID = lobbyID;
CurrentGame.LobbyHostPlayerName = lobbyHostName;
CurrentGame.IsValid = true;
}
public DebugWidgetContext()
{
Expand Down
10 changes: 7 additions & 3 deletions SmartHunter/Game/Helpers/MhwHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ public static void UpdatePlayerWidget(Process process, ulong baseAddress, ulong
}
if (statusEffectConfig.Source != (uint)StatusEffectConfig.MemorySource.Base && statusEffectConfig.Source != (uint)StatusEffectConfig.MemorySource.Equipment)
{
if (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid)
{
continue;
}
if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.CurrentEquippedWeaponType() != (WeaponType)statusEffectConfig.Source)
{
allConditionsPassed = false;
Expand Down Expand Up @@ -414,7 +418,7 @@ private static Monster UpdateAndGetMonster(Process process, ulong monsterAddress

if (ConfigHelper.MonsterData.Values.Monsters.ContainsKey(id) && ConfigHelper.MonsterData.Values.Monsters[id].Parts.Count() > 0)
{
if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsCurrentPlayerLobbyHost() || !OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline())
if (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid || OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsCurrentPlayerLobbyHost() || !OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline())
{
UpdateMonsterParts(process, monster);
if (ConfigHelper.MonsterData.Values.Monsters[id].Parts.Where(p => p.IsRemovable).Count() > 0) // In case you are testing add "|| true"
Expand All @@ -423,14 +427,14 @@ private static Monster UpdateAndGetMonster(Process process, ulong monsterAddress
}
//UpdateMonsterStatusEffects(process, monster);

if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline() && !OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerAlone())
if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid && OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline() && !OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerAlone())
{
// Upload DATA to central server
}
}
else
{
if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline())
if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid && OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline())
{
// Downlaod DATA from central server
}
Expand Down
6 changes: 3 additions & 3 deletions SmartHunter/Game/MhwMemoryUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected override void UpdateMemory()
//Log.WriteLine($"Found {matches.Count()} matches...");
ulong[] lookingFor = new ulong[1] { 0x144DED900 };
ulong[] lookingFor = new ulong[1] { 0x144DF2890 };
var res = new System.Collections.Generic.List<ulong>();
Expand Down Expand Up @@ -124,7 +124,7 @@ protected override void UpdateMemory()
MhwHelper.UpdateCurrentGame(Process, playerNamesAddress, currentPlayerNameAddress, currentWeaponAddress, lobbyStatusAddress);
}

if (OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerInLobby())
if (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid || OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerInLobby())
{
if (ConfigHelper.Main.Values.Overlay.MonsterWidget.IsVisible && m_MonsterPattern.MatchedAddresses.Any())
{
Expand All @@ -144,7 +144,7 @@ protected override void UpdateMemory()
OverlayViewModel.Instance.MonsterWidget.Context.Monsters.Clear();
}

if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible && m_PlayerDamagePattern.MatchedAddresses.Any() && m_PlayerNamePattern.MatchedAddresses.Any() && OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline())
if (ConfigHelper.Main.Values.Overlay.TeamWidget.IsVisible && m_PlayerDamagePattern.MatchedAddresses.Any() && m_PlayerNamePattern.MatchedAddresses.Any() && (!OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsValid || OverlayViewModel.Instance.DebugWidget.Context.CurrentGame.IsPlayerOnline()))
{
ulong playerNamesPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerNamePattern.MatchedAddresses.First());
ulong playerDamageRootPtr = MemoryHelper.LoadEffectiveAddressRelative(Process, m_PlayerDamagePattern.MatchedAddresses.First());
Expand Down

0 comments on commit 05278e8

Please sign in to comment.