17 files changed, 0 insertions(+), 1061 deletions(-)
D Local/NosSmooth.LocalCore/Character.cpp
D Local/NosSmooth.LocalCore/Character.h
D Local/NosSmooth.LocalCore/CharacterUnmanaged.cpp
D Local/NosSmooth.LocalCore/CharacterUnmanaged.h
D Local/NosSmooth.LocalCore/ModuleHook.cpp
D Local/NosSmooth.LocalCore/ModuleHook.h
D Local/NosSmooth.LocalCore/ModuleHook.ixx
D Local/NosSmooth.LocalCore/Network.cpp
D Local/NosSmooth.LocalCore/Network.h
D Local/NosSmooth.LocalCore/NetworkUnmanaged.cpp
D Local/NosSmooth.LocalCore/NetworkUnmanaged.h
D Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj
D Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj.filters
D Local/NosSmooth.LocalCore/NosSmoothCore.cpp
D Local/NosSmooth.LocalCore/NosSmoothCore.h
D Local/NosSmooth.LocalCore/NostaleString.h
D Local/NosSmooth.LocalCore/packages.config
D Local/NosSmooth.LocalCore/Character.cpp => Local/NosSmooth.LocalCore/Character.cpp +0 -28
@@ 1,28 0,0 @@
-#include "Character.h"
-#include <windows.h>
-using namespace NosSmoothCore;
-using namespace System;
-using namespace System::Runtime::InteropServices;
-
-Character::Character(ModuleHook moduleHook)
-{
- CharacterUnmanaged::GetInstance()->Setup(moduleHook);
-}
-
-void Character::Walk(int x, int y)
-{
- DWORD position = (y << 16) | x;
- CharacterUnmanaged::GetInstance()->Walk(position);
-}
-
-void Character::SetWalkCallback(WalkCallback^ walkCallback)
-{
- _walkCallback = walkCallback;
- IntPtr functionPointer = Marshal::GetFunctionPointerForDelegate(walkCallback);
- CharacterUnmanaged::GetInstance()->SetWalkCallback(static_cast<NativeWalkCallback>(functionPointer.ToPointer()));
-}
-
-void NosSmoothCore::Character::ResetHooks()
-{
- CharacterUnmanaged::GetInstance()->ResetHooks();
-}
D Local/NosSmooth.LocalCore/Character.h => Local/NosSmooth.LocalCore/Character.h +0 -37
@@ 1,37 0,0 @@
-#pragma once
-#include "ModuleHook.h"
-#include "CharacterUnmanaged.h"
-
-namespace NosSmoothCore
-{
- public ref class Character
- {
- public:
- /// <summary>
- /// Creates new instance of Character.
- /// </summary>
- /// <param name="moduleHook">The hooking module holding the information about NostaleX.dat</param>
- Character(NosSmoothCore::ModuleHook moduleHook);
-
- /// <summary>
- /// Starts walking to the specified x, y position
- /// </summary>
- /// <param name="x">The x coordinate to walk to.</param>
- /// <param name="y">The y coordinate to walk to.</param>
- void Walk(int x, int y);
-
- /// <summary>
- /// Registers the callback for walk function.
- /// </summary>
- /// <param name="walkCallback">The callback to call.</param>
- void SetWalkCallback(WalkCallback^ walkCallback);
-
- /// <summary>
- /// Reset the registered hooks.
- /// </summary>
- void ResetHooks();
- private:
- WalkCallback^ _walkCallback;
- };
-}
-
D Local/NosSmooth.LocalCore/CharacterUnmanaged.cpp => Local/NosSmooth.LocalCore/CharacterUnmanaged.cpp +0 -119
@@ 1,119 0,0 @@
-#include "CharacterUnmanaged.h"
-#include <detours.h>
-
-using namespace NosSmoothCore;
-
-const BYTE WALK_OBJECT_PATTERN[] = { 0x33, 0xC9, 0x8B, 0x55, 0xFC, 0xA1, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00 };
-const BYTE WALK_FUNCTION_PATTERN[] = { 0x55, 0x8B, 0xEC, 0x83, 0xC4, 0xEC, 0x53, 0x56, 0x57, 0x66, 0x89, 0x4D, 0xFA };
-
-LPCSTR WALK_OBJECT_MASK = "xxxxxx????x????";
-LPCSTR WALK_FUNCTION_MASK = "xxxxxxxxxxxxx";
-
-void CharacterWalkDetourIn()
-{
- DWORD position = 0;
-
- __asm
- {
- pushad
- pushfd
-
- mov position, edx
- }
-
- bool isAccepted = CharacterUnmanaged::GetInstance()->ExecuteWalkCallback(position);
-
- __asm
- {
- popfd
- popad
- }
-
- if (isAccepted) {
- CharacterUnmanaged::GetInstance()->Walk(position);
- }
-}
-
-// Detour entrypoint
-// declspec naked to not mess up the stack
-void __declspec(naked) CharacterWalkDetour()
-{
- unsigned int returnPush;
- __asm {
- pop eax
- pop ebx
- mov returnPush, eax // we have to push this value on the stack before returning
- }
-
- CharacterWalkDetourIn();
-
- __asm {
- push returnPush
- ret
- }
-}
-
-CharacterUnmanaged::CharacterUnmanaged()
-{
-}
-
-void CharacterUnmanaged::Setup(ModuleHook moduleHook)
-{
- auto walkFunction = moduleHook.FindPattern(WALK_FUNCTION_PATTERN, WALK_FUNCTION_MASK);
- auto walkObject = *(unsigned int*)(moduleHook.FindPattern(WALK_OBJECT_PATTERN, WALK_OBJECT_MASK) + 0x6);
-
- if (walkFunction == 0)
- {
- throw "Could not find walk function.";
- }
-
- if (walkObject == 0)
- {
- throw "Could not find player object.";
- }
-
- _walkFunctionAddress = walkFunction;
- _characterObjectAddress = walkObject;
-}
-
-void CharacterUnmanaged::SetWalkCallback(NativeWalkCallback walkCallback)
-{
- _walkCallback = walkCallback;
- DetourTransactionBegin();
- DetourUpdateThread(GetCurrentThread());
- DetourAttach(&(PVOID&)_walkFunctionAddress, CharacterWalkDetour);
- DetourTransactionCommit();
-}
-
-void CharacterUnmanaged::Walk(DWORD position)
-{
- unsigned int walkFunction = _walkFunctionAddress;
- unsigned int characterObject = _characterObjectAddress;
-
- __asm
- {
- push 1
- xor ecx, ecx
- mov edx, position
- mov eax, dword ptr ds : [characterObject]
- mov eax, dword ptr ds : [eax]
- call walkFunction
- }
-}
-
-void CharacterUnmanaged::ResetHooks()
-{
- DetourTransactionBegin();
- DetourUpdateThread(GetCurrentThread());
- DetourDetach(&(PVOID&)_walkFunctionAddress, CharacterWalkDetour);
- DetourTransactionCommit();
-}
-
-bool CharacterUnmanaged::ExecuteWalkCallback(const DWORD position)
-{
- if (_walkCallback != nullptr) {
- return _walkCallback(position);
- }
-
- return true;
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/CharacterUnmanaged.h => Local/NosSmooth.LocalCore/CharacterUnmanaged.h +0 -56
@@ 1,56 0,0 @@
-#pragma once
-#include "ModuleHook.h"
-
-namespace NosSmoothCore
-{
- public delegate bool WalkCallback(int position);
- typedef bool(__stdcall* NativeWalkCallback)(int position);
-
- class CharacterUnmanaged
- {
- public:
- /// <summary>
- /// Set ups the addresses of objects.
- /// </summary>
- /// <param name="moduleHook">The hooking module holding the information about NostaleX.dat</param>
- void Setup(NosSmoothCore::ModuleHook moduleHook);
-
- /// <summary>
- /// Starts walking to the specified x, y position
- /// </summary>
- /// <param name="x">The coordinate to walk to.</param>
- void Walk(DWORD position);
-
- /// <summary>
- /// Registers the callback for walk function.
- /// </summary>
- /// <param name="walkCallback">The callback to call.</param>
- void SetWalkCallback(NativeWalkCallback walkCallback);
-
- /// <summary>
- /// Reset the registered hooks.
- /// </summary>
- void ResetHooks();
-
- /// <summary>
- /// Executes the walk callback.
- /// </summary>
- /// <param name="position">The coordinate the user wants to walk to.</param>
- /// <returns>Whether to accept the walk.</returns>
- bool ExecuteWalkCallback(const DWORD position);
-
- static CharacterUnmanaged* GetInstance()
- {
- static CharacterUnmanaged instance;
- return reinterpret_cast<CharacterUnmanaged*>(&instance);
- }
- unsigned int _walkFunctionAddress;
- unsigned int _characterObjectAddress;
- private:
- CharacterUnmanaged();
-
-
- NativeWalkCallback _walkCallback;
- };
-}
-
D Local/NosSmooth.LocalCore/ModuleHook.cpp => Local/NosSmooth.LocalCore/ModuleHook.cpp +0 -49
@@ 1,49 0,0 @@
-#include "ModuleHook.h"
-#include <psapi.h>
-using namespace NosSmoothCore;
-
-ModuleHook ModuleHook::CreateNostaleXDatModule()
-{
- auto moduleHandle = GetModuleHandleA(nullptr);
- if (moduleHandle == nullptr)
- {
- throw "Could not obtain NostaleX.dat module handle";
- }
-
- MODULEINFO moduleInfo = {};
- if (!GetModuleInformation(GetCurrentProcess(), moduleHandle, &moduleInfo, sizeof(moduleInfo)))
- {
- throw "Could not get module handle information";
- }
- unsigned int moduleBase = reinterpret_cast<unsigned int>(moduleInfo.lpBaseOfDll);
- unsigned int moduleSize = moduleInfo.SizeOfImage;
-
- return ModuleHook(moduleBase, moduleSize);
-}
-
-ModuleHook::ModuleHook(unsigned int baseAddress, unsigned int moduleSize)
- : _baseAddress(baseAddress), _moduleSize(moduleSize)
-{
-}
-
-unsigned int ModuleHook::FindPattern(const BYTE* lpPattern, LPCSTR szMask)
-{
- DWORD dwLength = strlen(szMask);
- DWORD dwImageEnd = _baseAddress + _moduleSize - dwLength;
- DWORD_PTR i, j;
-
- // Scan the whole image for the pattern
- for (j = _baseAddress; j < dwImageEnd; ++j)
- {
- // If the pattern is found, return the address at which it begins
- for (i = 0; i < dwLength && (szMask[i] == '?' || *(BYTE*)(j + i) == lpPattern[i]); ++i);
- if (i == dwLength) return j;
- }
-
- return NULL;
-}
-
-unsigned int ModuleHook::GetModuleBaseAddress()
-{
- return _baseAddress;
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/ModuleHook.h => Local/NosSmooth.LocalCore/ModuleHook.h +0 -19
@@ 1,19 0,0 @@
-#pragma once
-#include <windows.h>
-
-namespace NosSmoothCore
-{
- class ModuleHook
- {
- public:
- static ModuleHook CreateNostaleXDatModule();
- ModuleHook(unsigned int baseAddress, unsigned int moduleSize);
-
- unsigned int GetModuleBaseAddress();
- unsigned int FindPattern(const BYTE* lpPattern, LPCSTR szMask);
- private:
- unsigned int _baseAddress;
- unsigned int _moduleSize;
- };
-}
-
D Local/NosSmooth.LocalCore/ModuleHook.ixx => Local/NosSmooth.LocalCore/ModuleHook.ixx +0 -3
@@ 1,3 0,0 @@
-export module ModuleHook;
-
-export void MyFunc();>
\ No newline at end of file
D Local/NosSmooth.LocalCore/Network.cpp => Local/NosSmooth.LocalCore/Network.cpp +0 -43
@@ 1,43 0,0 @@
-#include "Network.h"
-#include "NostaleString.h"
-
-using namespace NosSmoothCore;
-using namespace System::Runtime::InteropServices;
-using namespace System;
-
-Network::Network(ModuleHook moduleHook)
-{
- _networkUnmanaged = NetworkUnmanaged::GetInstance();
- _networkUnmanaged->Setup(moduleHook);
-}
-
-void Network::ResetHooks()
-{
- NetworkUnmanaged::GetInstance()->ResetHooks();
-}
-
-void Network::SendPacket(System::String^ packet)
-{
- char* str = (char*)(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(packet)).ToPointer();
- NetworkUnmanaged::GetInstance()->SendPacket(NostaleStringA(str).get());
-}
-
-void Network::ReceivePacket(System::String^ packet)
-{
- char* str = (char*)(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(packet)).ToPointer();
- NetworkUnmanaged::GetInstance()->ReceivePacket(NostaleStringA(str).get());
-}
-
-void Network::SetReceiveCallback(NetworkCallback^ callback)
-{
- IntPtr functionPointer = Marshal::GetFunctionPointerForDelegate(callback);
- _receiveCallback = callback;
- NetworkUnmanaged::GetInstance()->SetReceiveCallback(static_cast<PacketCallback>(functionPointer.ToPointer()));
-}
-
-void Network::SetSendCallback(NetworkCallback^ callback)
-{
- IntPtr functionPointer = Marshal::GetFunctionPointerForDelegate(callback);
- _sendCallback = callback;
- NetworkUnmanaged::GetInstance()->SetSendCallback(static_cast<PacketCallback>(functionPointer.ToPointer()));
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/Network.h => Local/NosSmooth.LocalCore/Network.h +0 -46
@@ 1,46 0,0 @@
-#pragma once
-#include "ModuleHook.h"
-#include "NetworkUnmanaged.h"
-
-namespace NosSmoothCore
-{
- public ref class Network
- {
- public:
- Network(NosSmoothCore::ModuleHook moduleHook);
-
- /// <summary>
- /// Send the given packet to the server.
- /// </summary>
- /// <param name="packet">The packed to send.</param>
- void SendPacket(System::String^ packet);
-
- /// <summary>
- /// Receive the given packet on the client.
- /// </summary>
- /// <param name="packet">The packet to receive.</param>
- void ReceivePacket(System::String^ packet);
-
- /// <summary>
- /// Sets the receive callback delegate to be called when packet is received.
- /// </summary>
- /// <param name="callback"></param>
- void SetReceiveCallback(NetworkCallback^ callback);
-
- /// <summary>
- /// Sets the send callback delegate to be called when the packet is sent.
- /// </summary>
- /// <param name="callback"></param>
- void SetSendCallback(NetworkCallback^ callback);
-
- /// <summary>
- /// Resets all the function hooks.
- /// </summary>
- void ResetHooks();
- private:
- NetworkUnmanaged* _networkUnmanaged;
- NetworkCallback^ _sendCallback;
- NetworkCallback^ _receiveCallback;
- };
-}
-
D Local/NosSmooth.LocalCore/NetworkUnmanaged.cpp => Local/NosSmooth.LocalCore/NetworkUnmanaged.cpp +0 -171
@@ 1,171 0,0 @@
-#include "NetworkUnmanaged.h"
-#include <detours.h>
-#include <windows.h>
-#include <chrono>
-#include <iostream>
-
-using namespace NosSmoothCore;
-
-const BYTE SEND_PATTERN[] = { 0x53, 0x56, 0x8B, 0xF2, 0x8B, 0xD8, 0xEB, 0x04 };
-const BYTE RECV_PATTERN[] = { 0x55, 0x8B, 0xEC, 0x83, 0xC4, 0xF4, 0x53, 0x56, 0x57, 0x33, 0xC9, 0x89, 0x4D, 0xF4, 0x89, 0x55, 0xFC, 0x8B, 0xD8, 0x8B, 0x45, 0xFC };
-const BYTE PACKET_CALLER_PATTERN[] = { 0xA1, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0xBA, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x8B, 0x00, 0x8B, 0x40, 0x40 };
-
-LPCSTR SEND_MASK = "xxxxxxxx";
-LPCSTR RECV_MASK = "xxxxxxxxxxxxxxxxxxxxxx";
-LPCSTR PACKET_CALLER_MASK = "x????xxx????x????x????x????xxxxx";
-
-NetworkUnmanaged::NetworkUnmanaged()
-{
-}
-
-void PacketSendDetour()
-{
- const char* packet = nullptr;
-
- __asm
- {
- pushad
- pushfd
-
- mov packet, edx
- }
-
- bool isAccepted = NetworkUnmanaged::GetInstance()->ExecuteSendCallback(packet);
-
- __asm
- {
- popfd
- popad
- }
-
- if (isAccepted) {
- NetworkUnmanaged::GetInstance()->SendPacket(packet);
- }
-}
-
-void PacketReceiveDetour()
-{
- const char* packet = nullptr;
-
- __asm
- {
- pushad
- pushfd
-
- mov packet, edx
- }
-
- bool isAccepted = NetworkUnmanaged::GetInstance()->ExecuteReceiveCallback(packet);
-
- __asm
- {
- popfd
- popad
- }
-
- if (isAccepted) {
- NetworkUnmanaged::GetInstance()->ReceivePacket(packet);
- }
-}
-
-void NetworkUnmanaged::Setup(ModuleHook moduleHook)
-{
- auto sendFunction = moduleHook.FindPattern(SEND_PATTERN, SEND_MASK);
- auto receiveFunction = moduleHook.FindPattern(RECV_PATTERN, RECV_MASK);
- auto callerObject = *reinterpret_cast<unsigned int*>((DWORD_PTR)moduleHook.FindPattern(PACKET_CALLER_PATTERN, PACKET_CALLER_MASK) + 1);
-
- if (sendFunction == 0)
- {
- throw "Could not find send packet function.";
- }
-
- if (receiveFunction == 0)
- {
- throw "Could not find receive packet function.";
- }
-
- if (callerObject == 0)
- {
- throw "Could not find packet caller object.";
- }
-
- _sendPacketAddress = sendFunction;
- _receivePacketAddress = receiveFunction;
- _callerObject = callerObject;
-
- DetourTransactionBegin();
- DetourUpdateThread(GetCurrentThread());
- DetourAttach(&(PVOID&)_receivePacketAddress, PacketReceiveDetour);
- DetourAttach(&reinterpret_cast<void*&>(_sendPacketAddress), PacketSendDetour);
- DetourTransactionCommit();
-}
-
-void NetworkUnmanaged::SendPacket(const char *packet)
-{
- __asm
- {
- mov esi, this
- mov eax, dword ptr ds : [esi]._callerObject
- mov eax, dword ptr ds : [eax]
- mov eax, dword ptr ds : [eax]
- mov edx, packet
- call[esi]._sendPacketAddress
- }
-}
-
-void NetworkUnmanaged::ReceivePacket(const char* packet)
-{
- __asm
- {
- mov esi, this
- mov eax, dword ptr ds : [esi]._callerObject
- mov eax, dword ptr ds : [eax]
- mov eax, dword ptr ds : [eax]
- mov eax, dword ptr ds : [eax + 0x34]
- mov edx, packet
- call[esi]._receivePacketAddress
- }
-}
-
-void NetworkUnmanaged::ResetHooks()
-{
- DetourTransactionBegin();
- DetourUpdateThread(GetCurrentThread());
- if (_sendCallback != nullptr) {
- DetourDetach(&reinterpret_cast<void*&>(_sendPacketAddress), PacketSendDetour);
- }
-
- if (_receiveCallback != nullptr) {
- DetourDetach(&(PVOID&)_receivePacketAddress, PacketReceiveDetour);
- }
-
- DetourTransactionCommit();
-}
-
-void NetworkUnmanaged::SetReceiveCallback(PacketCallback callback)
-{
- _receiveCallback = callback;
-}
-
-void NetworkUnmanaged::SetSendCallback(PacketCallback callback)
-{
- _sendCallback = callback;
-}
-
-bool NetworkUnmanaged::ExecuteReceiveCallback(const char *packet)
-{
- if (_receiveCallback != nullptr) {
- return _receiveCallback(packet);
- }
-
- return true;
-}
-
-bool NetworkUnmanaged::ExecuteSendCallback(const char* packet)
-{
- if (_sendCallback != nullptr) {
- return _sendCallback(packet);
- }
-
- return true;
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/NetworkUnmanaged.h => Local/NosSmooth.LocalCore/NetworkUnmanaged.h +0 -62
@@ 1,62 0,0 @@
-#pragma once
-#include "ModuleHook.h"
-
-namespace NosSmoothCore
-{
- public delegate bool NetworkCallback(System::String^ packet);
- typedef bool(__stdcall* PacketCallback)(const char* packet);
-
- class NetworkUnmanaged
- {
- public:
- void Setup(NosSmoothCore::ModuleHook moduleHook);
-
- /// <summary>
- /// Send the given packet to the server.
- /// </summary>
- /// <param name="packet">The packed to send.</param>
- void SendPacket(const char * packet);
-
- /// <summary>
- /// Receive the given packet on the client.
- /// </summary>
- /// <param name="packet">The packet to receive.</param>
- void ReceivePacket(const char * packet);
-
- /// <summary>
- /// Sets the receive callback delegate to be called when packet is received.
- /// </summary>
- /// <param name="callback"></param>
- void SetReceiveCallback(PacketCallback callback);
-
- /// <summary>
- /// Sets the send callback delegate to be called when the packet is sent.
- /// </summary>
- /// <param name="callback"></param>
- void SetSendCallback(PacketCallback callback);
-
- /// <summary>
- /// Resets all the function hooks.
- /// </summary>
- void ResetHooks();
-
- bool ExecuteSendCallback(const char *packet);
-
- bool ExecuteReceiveCallback(const char *packet);
-
- static NetworkUnmanaged* GetInstance()
- {
- static NetworkUnmanaged instance;
- return reinterpret_cast<NetworkUnmanaged*>(&instance);
- }
- private:
- NetworkUnmanaged();
- unsigned int _callerObject;
- unsigned int _receivePacketAddress;
- unsigned int _sendPacketAddress;
-
- PacketCallback _sendCallback;
- PacketCallback _receiveCallback;
- };
-}
-
D Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj => Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj +0 -198
@@ 1,198 0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <Keyword>Win32Proj</Keyword>
- <ProjectGuid>{63e97ff3-7e40-44de-9e91-f5dee79af95f}</ProjectGuid>
- <RootNamespace>NosSmoothLocalCore</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- <TargetFramework>
- </TargetFramework>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- <CLRSupport>true</CLRSupport>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- <CLRSupport>true</CLRSupport>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- <ManagedAssembly>true</ManagedAssembly>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v143</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- <ManagedAssembly>true</ManagedAssembly>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;_DEBUG;NOSSMOOTHLOCALCORE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- <AdditionalDependencies>detours.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;NDEBUG;NOSSMOOTHLOCALCORE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- <AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>_DEBUG;NOSSMOOTHLOCALCORE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>NDEBUG;NOSSMOOTHLOCALCORE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <PrecompiledHeader>Use</PrecompiledHeader>
- <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableUAC>false</EnableUAC>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <Content Include="NosSmoothCore.cpp" />
- <Content Include="NosSmoothCore.h" />
- <Content Include="NostaleString.h" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="Character.h" />
- <ClInclude Include="CharacterUnmanaged.h" />
- <ClInclude Include="ModuleHook.h" />
- <ClInclude Include="Network.h" />
- <ClInclude Include="NetworkUnmanaged.h" />
- <ClInclude Include="NosSmoothCore.h" />
- <ClInclude Include="NostaleString.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="Character.cpp" />
- <ClCompile Include="CharacterUnmanaged.cpp" />
- <ClCompile Include="ModuleHook.cpp" />
- <ClCompile Include="Network.cpp" />
- <ClCompile Include="NetworkUnmanaged.cpp" />
- <ClCompile Include="NosSmoothCore.cpp" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\stylecop.json" />
- <None Include="packages.config" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- <Import Project="..\..\packages\Detours.4.0.1\build\native\Detours.targets" Condition="Exists('..\..\packages\Detours.4.0.1\build\native\Detours.targets')" />
- </ImportGroup>
- <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
- <PropertyGroup>
- <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
- </PropertyGroup>
- <Error Condition="!Exists('..\..\packages\Detours.4.0.1\build\native\Detours.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Detours.4.0.1\build\native\Detours.targets'))" />
- </Target>
-</Project>>
\ No newline at end of file
D Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj.filters => Local/NosSmooth.LocalCore/NosSmooth.LocalCore.vcxproj.filters +0 -64
@@ 1,64 0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="NosSmoothCore.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="NostaleString.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Network.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="ModuleHook.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="Character.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="NetworkUnmanaged.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="CharacterUnmanaged.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="NosSmoothCore.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Network.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="ModuleHook.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="Character.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="NetworkUnmanaged.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="CharacterUnmanaged.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- <None Include="..\..\stylecop.json" />
- </ItemGroup>
-</Project>>
\ No newline at end of file
D Local/NosSmooth.LocalCore/NosSmoothCore.cpp => Local/NosSmooth.LocalCore/NosSmoothCore.cpp +0 -34
@@ 1,34 0,0 @@
-#include "NosSmoothCore.h"
-using namespace NosSmoothCore;
-
-NosClient::NosClient()
-{
- ModuleHook _moduleHook = ModuleHook::CreateNostaleXDatModule();
- _character = gcnew Character(_moduleHook);
- _network = gcnew Network(_moduleHook);
-}
-
-NosClient::~NosClient()
-{
- delete _network;
- delete _character;
-
- _network = nullptr;
- _character = nullptr;
-}
-
-Character^ NosClient::GetCharacter()
-{
- return _character;
-}
-
-Network^ NosClient::GetNetwork()
-{
- return _network;
-}
-
-void NosClient::ResetHooks()
-{
- _network->ResetHooks();
- _character->ResetHooks();
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/NosSmoothCore.h => Local/NosSmooth.LocalCore/NosSmoothCore.h +0 -24
@@ 1,24 0,0 @@
-#pragma once
-#using <mscorlib.dll> // to use Console::WriteLine
-
-#include "Character.h"
-#include "ModuleHook.h"
-#include "Network.h"
-#include "NostaleString.h"
-#include <stdio.h> // to printf()
-
-namespace NosSmoothCore
-{
- public ref class NosClient
- {
- public:
- NosClient();
- ~NosClient();
- Character^ GetCharacter();
- Network^ GetNetwork();
- void ResetHooks();
- private:
- Network^ _network;
- Character^ _character;
- };
-}>
\ No newline at end of file
D Local/NosSmooth.LocalCore/NostaleString.h => Local/NosSmooth.LocalCore/NostaleString.h +0 -104
@@ 1,104 0,0 @@
-// Thanks to atom0s
-// https://atom0s.com/forums/viewtopic.php?f=21&t=151&sid=d2fd50008534f41bbc3ab1a8b1ef6a6e
-
-#pragma once
-
-struct NostaleStringA
-{
- char* m_Buffer;
- size_t m_Length;
-
- NostaleStringA(void)
- : m_Buffer(nullptr)
- , m_Length(0)
- { }
- NostaleStringA(const char* str)
- : m_Buffer(nullptr)
- , m_Length(0)
- {
- this->set(str);
- }
- ~NostaleStringA(void)
- {
- if (this->m_Buffer != nullptr)
- delete[] this->m_Buffer;
- this->m_Buffer = nullptr;
- }
-
- // Returns the size of the string.
- size_t len(void)
- {
- return (this->m_Buffer != nullptr) ? this->m_Length : 0;
- }
-
- // Returns the string within the buffer.
- char* get(void)
- {
- return (this->m_Buffer != nullptr) ? (char*)(this->m_Buffer + 0x08) : nullptr;
- }
-
- // Sets the string buffer.
- void set(const char* str)
- {
- if (this->m_Buffer != nullptr)
- delete[] this->m_Buffer;
-
- this->m_Length = strlen(str);
- this->m_Buffer = new char[this->m_Length + 8 + 1];
-
- *(unsigned int*)(this->m_Buffer + 0x00) = 1; // Reference Count
- *(unsigned int*)(this->m_Buffer + 0x04) = this->m_Length; // Length
- memcpy(this->m_Buffer + 0x08, str, this->m_Length);
- this->m_Buffer[this->m_Length + 0x08] = '\0';
- }
-};
-
-struct NostaleStringW
-{
- wchar_t* m_Buffer;
- size_t m_Length;
-
- NostaleStringW(void)
- : m_Buffer(nullptr)
- , m_Length(0)
- { }
- NostaleStringW(const wchar_t* str)
- : m_Buffer(nullptr)
- , m_Length(0)
- {
- this->set(str);
- }
- ~NostaleStringW(void)
- {
- if (this->m_Buffer != nullptr)
- delete[] this->m_Buffer;
- this->m_Buffer = nullptr;
- }
-
- // Returns the size of the string.
- size_t len(void)
- {
- return (this->m_Buffer != nullptr) ? this->m_Length : 0;
- }
-
- // Returns the string within the buffer.
- wchar_t* get(void)
- {
- return (this->m_Buffer != nullptr) ? (wchar_t*)((char*)this->m_Buffer + 0x08) : nullptr;
- }
-
- // Sets the string buffer.
- void set(const wchar_t* str)
- {
- if (this->m_Buffer != nullptr)
- delete[] this->m_Buffer;
-
- this->m_Length = wcslen(str) * 2;
- this->m_Buffer = new wchar_t[this->m_Length + 8 + 1];
-
- *(unsigned int*)((char*)this->m_Buffer + 0x00) = 1; // Reference Count
- *(unsigned int*)((char*)this->m_Buffer + 0x04) = this->m_Length; // Length
- memcpy((char*)this->m_Buffer + 0x08, str, this->m_Length);
- *(wchar_t*)((char*)this->m_Buffer + this->m_Length + 0x08) = L'\0';
- }
-};>
\ No newline at end of file
D Local/NosSmooth.LocalCore/packages.config => Local/NosSmooth.LocalCore/packages.config +0 -4
@@ 1,4 0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Detours" version="4.0.1" targetFramework="native" developmentDependency="true" />
-</packages>>
\ No newline at end of file