From 303fcf241897ecbf8e0ec1a2612f92d179c1dce1 Mon Sep 17 00:00:00 2001 From: Rutherther Date: Sat, 31 Dec 2022 17:19:56 +0100 Subject: [PATCH] chore: update dependencies --- .../Extensions/MemoryExtensions.cs | 6 ++-- .../NosBindingManager.cs | 2 +- .../NosBrowserManager.cs | 2 +- .../NosSmooth.LocalBinding.csproj | 4 +-- .../Objects/NetworkBinding.cs | 28 +++++++++---------- .../Objects/NostaleStringA.cs | 14 ++++------ .../Objects/PetManagerBinding.cs | 4 +-- .../Objects/PlayerManagerBinding.cs | 26 ++++++++--------- .../Objects/UnitManagerBinding.cs | 17 ++++++----- .../Structs/ControlManager.cs | 2 +- .../Structs/MapBaseObj.cs | 2 +- .../Structs/MapNpcObj.cs | 2 +- .../Structs/MapPlayerObj.cs | 6 ++-- .../Structs/NostaleList.cs | 8 +++--- .../Structs/NostaleObject.cs | 4 +-- .../Structs/PetManager.cs | 6 ++-- .../Structs/PetManagerList.cs | 3 +- .../Structs/PlayerManager.cs | 8 +++--- .../Structs/SceneManager.cs | 12 ++++---- .../NosSmooth.LocalClient.csproj | 6 ++-- .../NosSmooth.Injector.CLI.csproj | 2 +- .../ManagedMemoryAllocation.cs | 8 +++--- src/Inject/NosSmooth.Injector/NosInjector.cs | 4 +-- .../NosSmooth.Injector.csproj | 4 +-- .../ExternalBrowser/ExternalBrowser.csproj | 2 +- .../InterceptNameChanger.csproj | 4 +-- .../LowLevel/SimpleChat/SimpleChat.csproj | 4 +-- .../LowLevel/WalkCommands/WalkCommands.csproj | 6 ++-- 28 files changed, 96 insertions(+), 100 deletions(-) diff --git a/src/Core/NosSmooth.LocalBinding/Extensions/MemoryExtensions.cs b/src/Core/NosSmooth.LocalBinding/Extensions/MemoryExtensions.cs index c367ed2..2ed08df 100644 --- a/src/Core/NosSmooth.LocalBinding/Extensions/MemoryExtensions.cs +++ b/src/Core/NosSmooth.LocalBinding/Extensions/MemoryExtensions.cs @@ -20,14 +20,14 @@ public static class MemoryExtensions /// The static address to follow offsets from. /// The offsets, first offset is the 0-th element. /// A final address. - public static IntPtr FollowStaticAddressOffsets(this IMemory memory, int staticAddress, int[] offsets) + public static nuint FollowStaticAddressOffsets(this IMemory memory, int staticAddress, int[] offsets) { int address = staticAddress; foreach (var offset in offsets) { - memory.SafeRead((IntPtr)(address + offset), out address); + memory.SafeRead((nuint)(address + offset), out address); } - return (IntPtr)address; + return (nuint)address; } } \ No newline at end of file diff --git a/src/Core/NosSmooth.LocalBinding/NosBindingManager.cs b/src/Core/NosSmooth.LocalBinding/NosBindingManager.cs index 2519158..22123bb 100644 --- a/src/Core/NosSmooth.LocalBinding/NosBindingManager.cs +++ b/src/Core/NosSmooth.LocalBinding/NosBindingManager.cs @@ -350,7 +350,7 @@ public class NosBindingManager : IDisposable bool enableHook = true ) { - var walkFunctionAddress = Scanner.CompiledFindPattern(pattern); + var walkFunctionAddress = Scanner.FindPattern(pattern); if (!walkFunctionAddress.Found) { return new BindingNotFoundError(pattern, "PetManagerBinding.PetWalk"); diff --git a/src/Core/NosSmooth.LocalBinding/NosBrowserManager.cs b/src/Core/NosSmooth.LocalBinding/NosBrowserManager.cs index c11050a..d925178 100644 --- a/src/Core/NosSmooth.LocalBinding/NosBrowserManager.cs +++ b/src/Core/NosSmooth.LocalBinding/NosBrowserManager.cs @@ -136,7 +136,7 @@ public class NosBrowserManager get { var player = PlayerManager.Player; - return player.Address != IntPtr.Zero; + return player.Address != nuint.Zero; } } diff --git a/src/Core/NosSmooth.LocalBinding/NosSmooth.LocalBinding.csproj b/src/Core/NosSmooth.LocalBinding/NosSmooth.LocalBinding.csproj index d1e5528..7cd9e70 100644 --- a/src/Core/NosSmooth.LocalBinding/NosSmooth.LocalBinding.csproj +++ b/src/Core/NosSmooth.LocalBinding/NosSmooth.LocalBinding.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/Core/NosSmooth.LocalBinding/Objects/NetworkBinding.cs b/src/Core/NosSmooth.LocalBinding/Objects/NetworkBinding.cs index 5c4ecf4..60755be 100644 --- a/src/Core/NosSmooth.LocalBinding/Objects/NetworkBinding.cs +++ b/src/Core/NosSmooth.LocalBinding/Objects/NetworkBinding.cs @@ -25,7 +25,7 @@ public class NetworkBinding FunctionAttribute.Register.eax, FunctionAttribute.StackCleanup.Callee )] - private delegate void PacketSendDelegate(IntPtr packetObject, IntPtr packetString); + private delegate void PacketSendDelegate(nuint packetObject, nuint packetString); [Function ( @@ -33,7 +33,7 @@ public class NetworkBinding FunctionAttribute.Register.eax, FunctionAttribute.StackCleanup.Callee )] - private delegate void PacketReceiveDelegate(IntPtr packetObject, IntPtr packetString); + private delegate void PacketReceiveDelegate(nuint packetObject, nuint packetString); /// /// Create the network binding with finding the network object and functions. @@ -44,19 +44,19 @@ public class NetworkBinding public static Result Create(NosBindingManager bindingManager, NetworkBindingOptions options) { var process = Process.GetCurrentProcess(); - var networkObjectAddress = bindingManager.Scanner.CompiledFindPattern(options.NetworkObjectPattern); + var networkObjectAddress = bindingManager.Scanner.FindPattern(options.NetworkObjectPattern); if (!networkObjectAddress.Found) { return new BindingNotFoundError(options.NetworkObjectPattern, "NetworkBinding"); } - var packetSendAddress = bindingManager.Scanner.CompiledFindPattern(options.SendFunctionPattern); + var packetSendAddress = bindingManager.Scanner.FindPattern(options.SendFunctionPattern); if (!packetSendAddress.Found) { return new BindingNotFoundError(options.SendFunctionPattern, "NetworkBinding.SendPacket"); } - var packetReceiveAddress = bindingManager.Scanner.CompiledFindPattern(options.ReceiveFunctionPattern); + var packetReceiveAddress = bindingManager.Scanner.FindPattern(options.ReceiveFunctionPattern); if (!packetReceiveAddress.Found) { return new BindingNotFoundError(options.ReceiveFunctionPattern, "NetworkBinding.ReceivePacket"); @@ -73,7 +73,7 @@ public class NetworkBinding var binding = new NetworkBinding ( bindingManager, - (IntPtr)(networkObjectAddress.Offset + (int)process.MainModule!.BaseAddress + 0x01), + (nuint)(networkObjectAddress.Offset + (int)process.MainModule!.BaseAddress + 0x01), sendWrapper, receiveWrapper ); @@ -98,7 +98,7 @@ public class NetworkBinding } private readonly NosBindingManager _bindingManager; - private readonly IntPtr _networkManagerAddress; + private readonly nuint _networkManagerAddress; private IHook? _sendHook; private IHook? _receiveHook; private PacketSendDelegate _originalSend; @@ -107,7 +107,7 @@ public class NetworkBinding private NetworkBinding ( NosBindingManager bindingManager, - IntPtr networkManagerAddress, + nuint networkManagerAddress, PacketSendDelegate originalSend, PacketReceiveDelegate originalReceive ) @@ -185,9 +185,9 @@ public class NetworkBinding return Result.FromSuccess(); } - private IntPtr GetManagerAddress(bool third) + private nuint GetManagerAddress(bool third) { - IntPtr networkManager = _networkManagerAddress; + nuint networkManager = _networkManagerAddress; _bindingManager.Memory.Read(networkManager, out networkManager); _bindingManager.Memory.Read(networkManager, out networkManager); _bindingManager.Memory.Read(networkManager, out networkManager); @@ -200,9 +200,9 @@ public class NetworkBinding return networkManager; } - private void SendPacketDetour(IntPtr packetObject, IntPtr packetString) + private void SendPacketDetour(nuint packetObject, nuint packetString) { - var packet = Marshal.PtrToStringAnsi(packetString); + var packet = Marshal.PtrToStringAnsi((IntPtr)packetString); if (packet is null) { // ? _originalSend(packetObject, packetString); @@ -219,9 +219,9 @@ public class NetworkBinding private bool _receivedCancel = false; - private void ReceivePacketDetour(IntPtr packetObject, IntPtr packetString) + private void ReceivePacketDetour(nuint packetObject, nuint packetString) { - var packet = Marshal.PtrToStringAnsi(packetString); + var packet = Marshal.PtrToStringAnsi((IntPtr)packetString); if (packet is null) { // ? _originalReceive(packetObject, packetString); diff --git a/src/Core/NosSmooth.LocalBinding/Objects/NostaleStringA.cs b/src/Core/NosSmooth.LocalBinding/Objects/NostaleStringA.cs index 9744f04..3b6f1e1 100644 --- a/src/Core/NosSmooth.LocalBinding/Objects/NostaleStringA.cs +++ b/src/Core/NosSmooth.LocalBinding/Objects/NostaleStringA.cs @@ -15,7 +15,7 @@ namespace NosSmooth.LocalBinding.Objects; public class NostaleStringA : IDisposable { private readonly IMemory _memory; - private IntPtr _pointer; + private nuint _pointer; /// /// Create an instance of . @@ -30,16 +30,14 @@ public class NostaleStringA : IDisposable memory.SafeWrite(allocated, 1); memory.SafeWrite(allocated + 4, data.Length); memory.SafeWriteRaw(allocated + 8, bytes); - memory.SafeWrite(allocated + 8 + data.Length, 0); - + memory.SafeWrite(allocated + 8 + (nuint)data.Length, 0); return new NostaleStringA(memory, allocated); } - private NostaleStringA(IMemory memory, IntPtr pointer) + private NostaleStringA(IMemory memory, nuint pointer) { _memory = memory; _pointer = pointer; - } /// @@ -53,13 +51,13 @@ public class NostaleStringA : IDisposable /// /// Gets whether the string is still allocated. /// - public bool Allocated => _pointer != IntPtr.Zero; + public bool Allocated => _pointer != nuint.Zero; /// /// Get the pointer to the string. /// /// A pointer to the string to pass to NosTale. - public IntPtr Get() + public nuint Get() { return _pointer + 0x08; } @@ -72,7 +70,7 @@ public class NostaleStringA : IDisposable if (Allocated) { _memory.Free(_pointer); - _pointer = IntPtr.Zero; + _pointer = nuint.Zero; } } diff --git a/src/Core/NosSmooth.LocalBinding/Objects/PetManagerBinding.cs b/src/Core/NosSmooth.LocalBinding/Objects/PetManagerBinding.cs index 510cf00..804b1d4 100644 --- a/src/Core/NosSmooth.LocalBinding/Objects/PetManagerBinding.cs +++ b/src/Core/NosSmooth.LocalBinding/Objects/PetManagerBinding.cs @@ -56,7 +56,7 @@ public class PetManagerBinding )] private delegate bool PetWalkDelegate ( - IntPtr petManagerPtr, + nuint petManagerPtr, uint position, short unknown0 = 0, int unknown1 = 1, @@ -122,7 +122,7 @@ public class PetManagerBinding private bool PetWalkDetour ( - IntPtr petManagerPtr, + nuint petManagerPtr, uint position, short unknown0 = 0, int unknown1 = 1, diff --git a/src/Core/NosSmooth.LocalBinding/Objects/PlayerManagerBinding.cs b/src/Core/NosSmooth.LocalBinding/Objects/PlayerManagerBinding.cs index e343bf3..e73875d 100644 --- a/src/Core/NosSmooth.LocalBinding/Objects/PlayerManagerBinding.cs +++ b/src/Core/NosSmooth.LocalBinding/Objects/PlayerManagerBinding.cs @@ -25,7 +25,7 @@ public class PlayerManagerBinding FunctionAttribute.Register.eax, FunctionAttribute.StackCleanup.Callee )] - private delegate bool WalkDelegate(IntPtr playerManagerPtr, int position, short unknown0 = 0, int unknown1 = 1); + private delegate bool WalkDelegate(nuint playerManagerPtr, int position, short unknown0 = 0, int unknown1 = 1); [Function ( @@ -35,8 +35,8 @@ public class PlayerManagerBinding )] private delegate bool FollowEntityDelegate ( - IntPtr playerManagerPtr, - IntPtr entityPtr, + nuint playerManagerPtr, + nuint entityPtr, int unknown1 = 0, int unknown2 = 1 ); @@ -47,7 +47,7 @@ public class PlayerManagerBinding FunctionAttribute.Register.eax, FunctionAttribute.StackCleanup.Callee )] - private delegate void UnfollowEntityDelegate(IntPtr playerManagerPtr, int unknown = 0); + private delegate void UnfollowEntityDelegate(nuint playerManagerPtr, int unknown = 0); /// /// Create the network binding with finding the network object and functions. @@ -60,19 +60,19 @@ public class PlayerManagerBinding { var process = Process.GetCurrentProcess(); - var walkFunctionAddress = bindingManager.Scanner.CompiledFindPattern(options.WalkFunctionPattern); + var walkFunctionAddress = bindingManager.Scanner.FindPattern(options.WalkFunctionPattern); if (!walkFunctionAddress.Found) { return new BindingNotFoundError(options.WalkFunctionPattern, "CharacterBinding.Walk"); } - var followEntityAddress = bindingManager.Scanner.CompiledFindPattern(options.FollowEntityPattern); + var followEntityAddress = bindingManager.Scanner.FindPattern(options.FollowEntityPattern); if (!followEntityAddress.Found) { return new BindingNotFoundError(options.FollowEntityPattern, "CharacterBinding.FollowEntity"); } - var unfollowEntityAddress = bindingManager.Scanner.CompiledFindPattern(options.UnfollowEntityPattern); + var unfollowEntityAddress = bindingManager.Scanner.FindPattern(options.UnfollowEntityPattern); if (!unfollowEntityAddress.Found) { return new BindingNotFoundError(options.UnfollowEntityPattern, "CharacterBinding.UnfollowEntity"); @@ -200,7 +200,7 @@ public class PlayerManagerBinding } } - private bool WalkDetour(IntPtr characterObject, int position, short unknown0, int unknown1) + private bool WalkDetour(nuint characterObject, int position, short unknown0, int unknown1) { var result = WalkCall?.Invoke((ushort)(position & 0xFFFF), (ushort)((position >> 16) & 0xFFFF)); if (result ?? true) @@ -217,14 +217,14 @@ public class PlayerManagerBinding /// The entity. /// A result that may or may not have succeeded. public Result FollowEntity(MapBaseObj? entity) - => FollowEntity(entity?.Address ?? IntPtr.Zero); + => FollowEntity(entity?.Address ?? nuint.Zero); /// /// Follow the entity. /// /// The entity address. /// A result that may or may not have succeeded. - public Result FollowEntity(IntPtr entityAddress) + public Result FollowEntity(nuint entityAddress) { try { @@ -258,8 +258,8 @@ public class PlayerManagerBinding private bool FollowEntityDetour ( - IntPtr playerManagerPtr, - IntPtr entityPtr, + nuint playerManagerPtr, + nuint entityPtr, int unknown1, int unknown2 ) @@ -273,7 +273,7 @@ public class PlayerManagerBinding return false; } - private void UnfollowEntityDetour(IntPtr playerManagerPtr, int unknown) + private void UnfollowEntityDetour(nuint playerManagerPtr, int unknown) { var result = FollowEntityCall?.Invoke(null); if (result ?? true) diff --git a/src/Core/NosSmooth.LocalBinding/Objects/UnitManagerBinding.cs b/src/Core/NosSmooth.LocalBinding/Objects/UnitManagerBinding.cs index 4773b2c..450be5d 100644 --- a/src/Core/NosSmooth.LocalBinding/Objects/UnitManagerBinding.cs +++ b/src/Core/NosSmooth.LocalBinding/Objects/UnitManagerBinding.cs @@ -14,7 +14,6 @@ using Reloaded.Hooks.Definitions; using Reloaded.Hooks.Definitions.X86; using Reloaded.Memory.Buffers.Internal.Kernel32; using Remora.Results; -using SharpDisasm.Udis86; namespace NosSmooth.LocalBinding.Objects; @@ -32,7 +31,7 @@ public class UnitManagerBinding FunctionAttribute.Register.eax, FunctionAttribute.StackCleanup.Callee )] - private delegate int FocusEntityDelegate(IntPtr unitManagerPtr, IntPtr entityPtr); + private delegate int FocusEntityDelegate(nuint unitManagerPtr, nuint entityPtr); /// /// Create the scene manager binding. @@ -45,13 +44,13 @@ public class UnitManagerBinding { var process = Process.GetCurrentProcess(); - var unitManagerStaticAddress = bindingManager.Scanner.CompiledFindPattern(bindingOptions.UnitManagerPattern); + var unitManagerStaticAddress = bindingManager.Scanner.FindPattern(bindingOptions.UnitManagerPattern); if (!unitManagerStaticAddress.Found) { return new BindingNotFoundError(bindingOptions.UnitManagerPattern, "UnitManagerBinding.UnitManager"); } - var focusEntityAddress = bindingManager.Scanner.CompiledFindPattern(bindingOptions.FocusEntityPattern); + var focusEntityAddress = bindingManager.Scanner.FindPattern(bindingOptions.FocusEntityPattern); if (!focusEntityAddress.Found) { return new BindingNotFoundError(bindingOptions.FocusEntityPattern, "UnitManagerBinding.FocusEntity"); @@ -104,7 +103,7 @@ public class UnitManagerBinding /// /// Gets the address of unit manager. /// - public IntPtr Address => _bindingManager.Memory.FollowStaticAddressOffsets + public nuint Address => _bindingManager.Memory.FollowStaticAddressOffsets (_staticUnitManagerAddress, _unitManagerOffsets); /// @@ -121,14 +120,14 @@ public class UnitManagerBinding /// The entity. /// A result that may or may not have succeeded. public Result FocusEntity(MapBaseObj? entity) - => FocusEntity(entity?.Address ?? IntPtr.Zero); + => FocusEntity(entity?.Address ?? nuint.Zero); /// /// Focus the entity. /// /// The entity address. /// A result that may or may not have succeeded. - public Result FocusEntity(IntPtr entityAddress) + public Result FocusEntity(nuint entityAddress) { try { @@ -142,10 +141,10 @@ public class UnitManagerBinding return Result.FromSuccess(); } - private int FocusEntityDetour(IntPtr unitManagerPtr, IntPtr entityId) + private int FocusEntityDetour(nuint unitManagerPtr, nuint entityId) { MapBaseObj? obj = null; - if (entityId != IntPtr.Zero) + if (entityId != nuint.Zero) { obj = new MapBaseObj(_bindingManager.Memory, entityId); } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/ControlManager.cs b/src/Core/NosSmooth.LocalBinding/Structs/ControlManager.cs index 12ff79b..017e018 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/ControlManager.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/ControlManager.cs @@ -18,7 +18,7 @@ public abstract class ControlManager : NostaleObject /// /// The memory. /// The address of the manager. - protected ControlManager(IMemory memory, IntPtr address) + protected ControlManager(IMemory memory, nuint address) : base(memory, address) { } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/MapBaseObj.cs b/src/Core/NosSmooth.LocalBinding/Structs/MapBaseObj.cs index 38ba7c8..308c965 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/MapBaseObj.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/MapBaseObj.cs @@ -25,7 +25,7 @@ public class MapBaseObj : NostaleObject /// /// The memory. /// The map object pointer. - public MapBaseObj(IMemory memory, IntPtr mapObjPointer) + public MapBaseObj(IMemory memory, nuint mapObjPointer) : base(memory, mapObjPointer) { } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/MapNpcObj.cs b/src/Core/NosSmooth.LocalBinding/Structs/MapNpcObj.cs index 80dd847..eeaccd8 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/MapNpcObj.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/MapNpcObj.cs @@ -18,7 +18,7 @@ public class MapNpcObj : MapBaseObj /// /// The memory. /// The pointer to the object. - public MapNpcObj(IMemory memory, IntPtr mapObjPointer) + public MapNpcObj(IMemory memory, nuint mapObjPointer) : base(memory, mapObjPointer) { } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/MapPlayerObj.cs b/src/Core/NosSmooth.LocalBinding/Structs/MapPlayerObj.cs index c4284a5..92e833a 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/MapPlayerObj.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/MapPlayerObj.cs @@ -22,7 +22,7 @@ public class MapPlayerObj : MapBaseObj /// /// The memory. /// The player object pointer. - public MapPlayerObj(IMemory memory, IntPtr mapObjPointer) + public MapPlayerObj(IMemory memory, nuint mapObjPointer) : base(memory, mapObjPointer) { _memory = memory; @@ -36,9 +36,9 @@ public class MapPlayerObj : MapBaseObj get { _memory.SafeRead(Address + 0x1EC, out int nameAddress); - _memory.SafeRead((IntPtr)nameAddress - 4, out int nameLength); + _memory.SafeRead((nuint)nameAddress - 4, out int nameLength); byte[] data = new byte[nameLength]; - _memory.SafeReadRaw((IntPtr)nameAddress, out data, nameLength); + _memory.SafeReadRaw((nuint)nameAddress, out data, nameLength); return Encoding.ASCII.GetString(data); } } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/NostaleList.cs b/src/Core/NosSmooth.LocalBinding/Structs/NostaleList.cs index 4e914f8..5da64df 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/NostaleList.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/NostaleList.cs @@ -24,7 +24,7 @@ public class NostaleList : IEnumerable /// /// The memory. /// The object list pointer. - public NostaleList(IMemory memory, IntPtr objListPointer) + public NostaleList(IMemory memory, nuint objListPointer) { _memory = memory; Address = objListPointer; @@ -33,7 +33,7 @@ public class NostaleList : IEnumerable /// /// Gets the address. /// - protected IntPtr Address { get; } + protected nuint Address { get; } /// /// Gets the element at the given index. @@ -50,12 +50,12 @@ public class NostaleList : IEnumerable } _memory.SafeRead(Address + 0x04, out int arrayAddress); - _memory.SafeRead((IntPtr)arrayAddress + (0x04 * index), out int objectAddress); + _memory.SafeRead((nuint)arrayAddress + (nuint)(0x04 * index), out int objectAddress); return new T { Memory = _memory, - Address = (IntPtr)objectAddress + Address = (nuint)objectAddress }; } } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/NostaleObject.cs b/src/Core/NosSmooth.LocalBinding/Structs/NostaleObject.cs index 6f53b8d..7a5821d 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/NostaleObject.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/NostaleObject.cs @@ -25,7 +25,7 @@ public abstract class NostaleObject /// /// The memory. /// The address in the memory. - protected NostaleObject(IMemory memory, IntPtr address) + protected NostaleObject(IMemory memory, nuint address) { Memory = memory; Address = address; @@ -39,5 +39,5 @@ public abstract class NostaleObject /// /// Gets the address of the object. /// - public virtual IntPtr Address { get; internal set; } = IntPtr.Zero; + public virtual nuint Address { get; internal set; } = nuint.Zero; } \ No newline at end of file diff --git a/src/Core/NosSmooth.LocalBinding/Structs/PetManager.cs b/src/Core/NosSmooth.LocalBinding/Structs/PetManager.cs index cd14b01..513a2ac 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/PetManager.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/PetManager.cs @@ -20,7 +20,7 @@ public class PetManager : ControlManager /// Initializes a new instance of the class. /// public PetManager() - : base(null!, IntPtr.Zero) + : base(null!, nuint.Zero) { } @@ -29,7 +29,7 @@ public class PetManager : ControlManager /// /// The memory. /// The pet manager address. - public PetManager(IMemory memory, IntPtr petManagerAddress) + public PetManager(IMemory memory, nuint petManagerAddress) : base(memory, petManagerAddress) { } @@ -42,7 +42,7 @@ public class PetManager : ControlManager get { Memory.SafeRead(Address + 0x7C, out int playerAddress); - return new MapNpcObj(Memory, (IntPtr)playerAddress); + return new MapNpcObj(Memory, (nuint)playerAddress); } } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/PetManagerList.cs b/src/Core/NosSmooth.LocalBinding/Structs/PetManagerList.cs index 37e99f3..5ac8c8b 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/PetManagerList.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/PetManagerList.cs @@ -9,7 +9,6 @@ using NosSmooth.LocalBinding.Extensions; using NosSmooth.LocalBinding.Options; using Reloaded.Memory.Sources; using Remora.Results; -using SharpDisasm.Udis86; namespace NosSmooth.LocalBinding.Structs; @@ -26,7 +25,7 @@ public class PetManagerList : NostaleList /// The player manager or an error. public static Result Create(NosBrowserManager nosBrowserManager, PetManagerOptions options) { - var characterObjectAddress = nosBrowserManager.Scanner.CompiledFindPattern(options.PetManagerListPattern); + var characterObjectAddress = nosBrowserManager.Scanner.FindPattern(options.PetManagerListPattern); if (!characterObjectAddress.Found) { return new BindingNotFoundError(options.PetManagerListPattern, "PetManagerList"); diff --git a/src/Core/NosSmooth.LocalBinding/Structs/PlayerManager.cs b/src/Core/NosSmooth.LocalBinding/Structs/PlayerManager.cs index 900bf54..e551d7b 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/PlayerManager.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/PlayerManager.cs @@ -26,7 +26,7 @@ public class PlayerManager : ControlManager /// The player manager or an error. public static Result Create(NosBrowserManager nosBrowserManager, PlayerManagerOptions options) { - var characterObjectAddress = nosBrowserManager.Scanner.CompiledFindPattern(options.PlayerManagerPattern); + var characterObjectAddress = nosBrowserManager.Scanner.FindPattern(options.PlayerManagerPattern); if (!characterObjectAddress.Found) { return new BindingNotFoundError(options.PlayerManagerPattern, "PlayerManager"); @@ -52,7 +52,7 @@ public class PlayerManager : ControlManager /// The pointer to the beginning of the player manager structure. /// The offsets to get the player manager address from the static one. public PlayerManager(IMemory memory, int staticPlayerManagerAddress, int[] playerManagerOffsets) - : base(memory, IntPtr.Zero) + : base(memory, nuint.Zero) { _memory = memory; _staticPlayerManagerAddress = staticPlayerManagerAddress; @@ -62,7 +62,7 @@ public class PlayerManager : ControlManager /// /// Gets the address to the player manager. /// - public override IntPtr Address => _memory.FollowStaticAddressOffsets + public override nuint Address => _memory.FollowStaticAddressOffsets (_staticPlayerManagerAddress, _playerManagerOffsets); /// @@ -73,7 +73,7 @@ public class PlayerManager : ControlManager get { _memory.SafeRead(Address + 0x20, out int playerAddress); - return new MapPlayerObj(_memory, (IntPtr)playerAddress); + return new MapPlayerObj(_memory, (nuint)playerAddress); } } diff --git a/src/Core/NosSmooth.LocalBinding/Structs/SceneManager.cs b/src/Core/NosSmooth.LocalBinding/Structs/SceneManager.cs index a5f04f8..c894a43 100644 --- a/src/Core/NosSmooth.LocalBinding/Structs/SceneManager.cs +++ b/src/Core/NosSmooth.LocalBinding/Structs/SceneManager.cs @@ -25,7 +25,7 @@ public class SceneManager /// The player manager or an error. public static Result Create(NosBrowserManager nosBrowserManager, SceneManagerOptions options) { - var characterObjectAddress = nosBrowserManager.Scanner.CompiledFindPattern(options.SceneManagerObjectPattern); + var characterObjectAddress = nosBrowserManager.Scanner.FindPattern(options.SceneManagerObjectPattern); if (!characterObjectAddress.Found) { return new BindingNotFoundError(options.SceneManagerObjectPattern, "SceneManager"); @@ -60,7 +60,7 @@ public class SceneManager /// /// Gets the address of the scene manager. /// - public IntPtr Address => _memory.FollowStaticAddressOffsets(_staticSceneManagerAddress, _sceneManagerOffsets); + public nuint Address => _memory.FollowStaticAddressOffsets(_staticSceneManagerAddress, _sceneManagerOffsets); /// /// Gets the player list. @@ -90,7 +90,7 @@ public class SceneManager get { var ptr = ReadPtr(Address + 0x48); - if (ptr == IntPtr.Zero) + if (ptr == nuint.Zero) { return null; } @@ -102,7 +102,7 @@ public class SceneManager /// /// Gets the lock on target marked address. /// - public IntPtr LockOnTargetMarkedAddress + public nuint LockOnTargetMarkedAddress { get { @@ -113,10 +113,10 @@ public class SceneManager } } - private IntPtr ReadPtr(IntPtr ptr) + private nuint ReadPtr(nuint ptr) { _memory.Read(ptr, out int read); - return (IntPtr)read; + return (nuint)read; } /// diff --git a/src/Core/NosSmooth.LocalClient/NosSmooth.LocalClient.csproj b/src/Core/NosSmooth.LocalClient/NosSmooth.LocalClient.csproj index 56b23e0..4d1f29c 100644 --- a/src/Core/NosSmooth.LocalClient/NosSmooth.LocalClient.csproj +++ b/src/Core/NosSmooth.LocalClient/NosSmooth.LocalClient.csproj @@ -12,10 +12,10 @@ - + - - + + diff --git a/src/Inject/NosSmooth.Injector.CLI/NosSmooth.Injector.CLI.csproj b/src/Inject/NosSmooth.Injector.CLI/NosSmooth.Injector.CLI.csproj index 1fd90b7..6056355 100644 --- a/src/Inject/NosSmooth.Injector.CLI/NosSmooth.Injector.CLI.csproj +++ b/src/Inject/NosSmooth.Injector.CLI/NosSmooth.Injector.CLI.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/Inject/NosSmooth.Injector/ManagedMemoryAllocation.cs b/src/Inject/NosSmooth.Injector/ManagedMemoryAllocation.cs index 8d7308e..7d8726a 100644 --- a/src/Inject/NosSmooth.Injector/ManagedMemoryAllocation.cs +++ b/src/Inject/NosSmooth.Injector/ManagedMemoryAllocation.cs @@ -21,7 +21,7 @@ internal class ManagedMemoryAllocation : IDisposable /// /// The memory with allocation. /// The pointer to allocated memory. - public ManagedMemoryAllocation(IMemory memory, IntPtr pointer) + public ManagedMemoryAllocation(IMemory memory, nuint pointer) { Pointer = pointer; _memory = memory; @@ -31,17 +31,17 @@ internal class ManagedMemoryAllocation : IDisposable /// /// The allocated pointer number. /// - public IntPtr Pointer { get; private set; } + public nuint Pointer { get; private set; } /// /// Whether the memory is currently allocated. /// - public bool Allocated => Pointer != IntPtr.Zero; + public bool Allocated => Pointer != nuint.Zero; /// public void Dispose() { _memory.Free(Pointer); - Pointer = IntPtr.Zero; + Pointer = nuint.Zero; } } \ No newline at end of file diff --git a/src/Inject/NosSmooth.Injector/NosInjector.cs b/src/Inject/NosSmooth.Injector/NosInjector.cs index 5d87c59..108b1b7 100644 --- a/src/Inject/NosSmooth.Injector/NosInjector.cs +++ b/src/Inject/NosSmooth.Injector/NosInjector.cs @@ -164,12 +164,12 @@ public class NosInjector { var bytes = Encoding.Unicode.GetBytes(str); var allocated = memory.Allocate(bytes.Length + 1); - if (allocated == IntPtr.Zero) + if (allocated == nuint.Zero) { return new ManagedMemoryAllocation(memory, allocated); } - memory.SafeWriteRaw(allocated + bytes.Length, new byte[] { 0 }); + memory.SafeWriteRaw(allocated + (nuint)bytes.Length, new byte[] { 0 }); memory.SafeWriteRaw(allocated, bytes); return new ManagedMemoryAllocation(memory, allocated); } diff --git a/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj b/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj index 437ce66..cdbb261 100644 --- a/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj +++ b/src/Inject/NosSmooth.Injector/NosSmooth.Injector.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/src/Samples/External/ExternalBrowser/ExternalBrowser.csproj b/src/Samples/External/ExternalBrowser/ExternalBrowser.csproj index 17d6c29..083ebb0 100644 --- a/src/Samples/External/ExternalBrowser/ExternalBrowser.csproj +++ b/src/Samples/External/ExternalBrowser/ExternalBrowser.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/Samples/LowLevel/InterceptNameChanger/InterceptNameChanger.csproj b/src/Samples/LowLevel/InterceptNameChanger/InterceptNameChanger.csproj index e05510d..a5c4f0f 100644 --- a/src/Samples/LowLevel/InterceptNameChanger/InterceptNameChanger.csproj +++ b/src/Samples/LowLevel/InterceptNameChanger/InterceptNameChanger.csproj @@ -10,14 +10,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Samples/LowLevel/SimpleChat/SimpleChat.csproj b/src/Samples/LowLevel/SimpleChat/SimpleChat.csproj index 10ed637..b161e8d 100644 --- a/src/Samples/LowLevel/SimpleChat/SimpleChat.csproj +++ b/src/Samples/LowLevel/SimpleChat/SimpleChat.csproj @@ -11,14 +11,14 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/Samples/LowLevel/WalkCommands/WalkCommands.csproj b/src/Samples/LowLevel/WalkCommands/WalkCommands.csproj index 15b404b..2635733 100644 --- a/src/Samples/LowLevel/WalkCommands/WalkCommands.csproj +++ b/src/Samples/LowLevel/WalkCommands/WalkCommands.csproj @@ -18,7 +18,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - 6.6.0 + 6.6.4 all @@ -34,10 +34,10 @@ 2.0.0 - 2.0.1 + 2.0.2 - 1.0.0 + 1.1.0 7.2.3 -- 2.48.1