From 4d025055212593ecb1a76634d58e6da406ccc2db Mon Sep 17 00:00:00 2001 From: Silent Date: Fri, 28 Jun 2019 23:14:32 +0200 Subject: [PATCH] Moved shared stuff to a submodule --- .gitmodules | 3 + DDraw/DDraw.vcxproj | 6 +- DDraw/DDraw.vcxproj.filters | 24 +- DDraw/dllmain.cpp | 4 +- SilentPatch/Common.cpp | 4 +- SilentPatch/Common_ddraw.cpp | 4 +- SilentPatch/DelimStringReader.h | 56 --- SilentPatch/MemoryMgr.GTA.h | 432 ------------------ SilentPatch/MemoryMgr.h | 429 ----------------- SilentPatch/ModuleList.hpp | 212 --------- SilentPatch/Patterns.cpp | 274 ----------- SilentPatch/Patterns.h | 181 -------- SilentPatch/StdAfx.h | 4 +- SilentPatch/StoredCar.cpp | 2 +- SilentPatch/TheFLAUtils.cpp | 2 +- SilentPatch/Timer.cpp | 2 +- SilentPatch/Utils | 1 + SilentPatchIII/SilentPatchIII.cpp | 2 +- SilentPatchIII/SilentPatchIII.vcxproj | 16 +- SilentPatchIII/SilentPatchIII.vcxproj.filters | 28 +- SilentPatchSA/SilentPatchSA.cpp | 6 +- SilentPatchSA/SilentPatchSA.vcxproj | 19 +- SilentPatchSA/SilentPatchSA.vcxproj.filters | 39 +- SilentPatchSA/StdAfxSA.h | 4 +- SilentPatchSA/VehicleSA.cpp | 2 +- SilentPatchVC/SilentPatchVC.cpp | 2 +- SilentPatchVC/SilentPatchVC.vcxproj | 16 +- SilentPatchVC/SilentPatchVC.vcxproj.filters | 28 +- 28 files changed, 121 insertions(+), 1681 deletions(-) create mode 100644 .gitmodules delete mode 100644 SilentPatch/DelimStringReader.h delete mode 100644 SilentPatch/MemoryMgr.GTA.h delete mode 100644 SilentPatch/MemoryMgr.h delete mode 100644 SilentPatch/ModuleList.hpp delete mode 100644 SilentPatch/Patterns.cpp delete mode 100644 SilentPatch/Patterns.h create mode 160000 SilentPatch/Utils diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..fbc90ca --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "SilentPatch/Utils"] + path = SilentPatch/Utils + url = https://github.com/CookiePLMonster/ModUtils.git diff --git a/DDraw/DDraw.vcxproj b/DDraw/DDraw.vcxproj index b72a403..48fbe8e 100644 --- a/DDraw/DDraw.vcxproj +++ b/DDraw/DDraw.vcxproj @@ -168,7 +168,7 @@ copy /y "$(TargetPath)" "D:\Steam\steamapps\common\Grand Theft Auto Vice City\dd - + @@ -176,8 +176,8 @@ copy /y "$(TargetPath)" "D:\Steam\steamapps\common\Grand Theft Auto Vice City\dd - - + + diff --git a/DDraw/DDraw.vcxproj.filters b/DDraw/DDraw.vcxproj.filters index 3c214fe..2e1bfcf 100644 --- a/DDraw/DDraw.vcxproj.filters +++ b/DDraw/DDraw.vcxproj.filters @@ -13,28 +13,34 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {e6db2444-bfd1-4eb2-a878-7de676789c09} + + + {53c8e8e5-df13-4831-aa9b-a14b0d0fec04} + Source Files - - Source Files - Source Files + + Source Files\Utils + - - Header Files - - - Header Files - Header Files + + Header Files\Utils + + + Header Files\Utils + diff --git a/DDraw/dllmain.cpp b/DDraw/dllmain.cpp index b5be8d6..5aac924 100644 --- a/DDraw/dllmain.cpp +++ b/DDraw/dllmain.cpp @@ -6,8 +6,8 @@ #include #include #include -#include "MemoryMgr.h" -#include "Patterns.h" +#include "Utils/MemoryMgr.h" +#include "Utils/Patterns.h" #include "Common_ddraw.h" diff --git a/SilentPatch/Common.cpp b/SilentPatch/Common.cpp index af7fd80..118af34 100644 --- a/SilentPatch/Common.cpp +++ b/SilentPatch/Common.cpp @@ -1,7 +1,7 @@ #include "Common.h" -#include "MemoryMgr.h" -#include "Patterns.h" +#include "Utils/MemoryMgr.h" +#include "Utils/Patterns.h" #include "StoredCar.h" diff --git a/SilentPatch/Common_ddraw.cpp b/SilentPatch/Common_ddraw.cpp index 61a8d80..59c1e82 100644 --- a/SilentPatch/Common_ddraw.cpp +++ b/SilentPatch/Common_ddraw.cpp @@ -2,8 +2,8 @@ #include #include -#include "MemoryMgr.h" -#include "Patterns.h" +#include "Utils/MemoryMgr.h" +#include "Utils/Patterns.h" #pragma comment(lib, "shlwapi.lib") diff --git a/SilentPatch/DelimStringReader.h b/SilentPatch/DelimStringReader.h deleted file mode 100644 index fe1eee5..0000000 --- a/SilentPatch/DelimStringReader.h +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -template -class BasicDelimStringReader -{ -public: - BasicDelimStringReader( size_t size ) - : m_buffer( new T[size] ), m_size( size ) - { - Reset(); - } - - ~BasicDelimStringReader() - { - delete[] m_buffer; - } - - inline T* GetBuffer() const - { - return m_buffer; - } - - inline size_t GetSize() const - { - return m_size; - } - - const T* GetString( size_t* size = nullptr ) - { - if ( *m_cursor == '\0' ) - { - if ( size != nullptr ) *size = 0; - return nullptr; - } - const T* curString = m_cursor; - size_t len = 0; - - while ( *m_cursor++ != '\0' ) len++; - - if ( size != nullptr ) *size = len; - return curString; - } - - inline void Reset() - { - m_cursor = m_buffer; - } - -private: - T* const m_buffer; - const T* m_cursor; - const size_t m_size; -}; - -typedef BasicDelimStringReader DelimStringReader; -typedef BasicDelimStringReader WideDelimStringReader; \ No newline at end of file diff --git a/SilentPatch/MemoryMgr.GTA.h b/SilentPatch/MemoryMgr.GTA.h deleted file mode 100644 index c5ca8f1..0000000 --- a/SilentPatch/MemoryMgr.GTA.h +++ /dev/null @@ -1,432 +0,0 @@ -#pragma once - -#include "MemoryMgr.h" - -#include -#include "Patterns.h" - -namespace Memory -{ - struct PatternAndOffset - { - PatternAndOffset( std::string_view pattern, ptrdiff_t offset = 0 ) - : pattern(std::move(pattern)), offset(offset) - { - } - - std::string_view pattern; - ptrdiff_t offset; - }; - - using AddrVariant = std::variant; - - namespace internal - { - inline signed char* GetVer() - { - static signed char bVer = -1; - return &bVer; - } - - inline bool* GetEuropean() - { - static bool bEuropean; - return &bEuropean; - } - - inline uintptr_t GetDummy() - { - static uintptr_t dwDummy; - return reinterpret_cast(&dwDummy); - } - } -} - -namespace Memory -{ - namespace internal - { - inline uintptr_t HandlePattern( const PatternAndOffset& pattern ) - { - void* addr = hook::get_pattern( pattern.pattern, pattern.offset ); - return reinterpret_cast(addr); - } - -#if defined _GTA_III - inline void InitializeVersions() - { - signed char* bVer = GetVer(); - - if ( *bVer == -1 ) - { - if (*(uint32_t*)0x5C1E75 == 0xB85548EC) *bVer = 0; - else if (*(uint32_t*)0x5C2135 == 0xB85548EC) *bVer = 1; - else if (*(uint32_t*)0x5C6FD5 == 0xB85548EC) *bVer = 2; - } - } - -#elif defined _GTA_VC - - inline void InitializeVersions() - { - signed char* bVer = GetVer(); - - if ( *bVer == -1 ) - { - if (*(uint32_t*)0x667BF5 == 0xB85548EC) *bVer = 0; - else if (*(uint32_t*)0x667C45 == 0xB85548EC) *bVer = 1; - else if (*(uint32_t*)0x666BA5 == 0xB85548EC) *bVer = 2; - } - } - -#elif defined _GTA_SA - - inline bool TryMatch_10() - { - if ( *(uint32_t*)DynBaseAddress(0x82457C) == 0x94BF ) - { - // 1.0 US - *GetVer() = 0; - *GetEuropean() = false; - return true; - } - if ( *(uint32_t*)DynBaseAddress(0x8245BC) == 0x94BF ) - { - // 1.0 EU - *GetVer() = 0; - *GetEuropean() = true; - return true; - } - return false; - } - - inline bool TryMatch_11() - { - if ( *(uint32_t*)DynBaseAddress(0x8252FC) == 0x94BF ) - { - // 1.01 US - *GetVer() = 1; - *GetEuropean() = false; - return true; - } - if ( *(uint32_t*)DynBaseAddress(0x82533C) == 0x94BF ) - { - // 1.01 EU - *GetVer() = 1; - *GetEuropean() = true; - return true; - } - return false; - } - - inline bool TryMatch_30() - { - if (*(uint32_t*)DynBaseAddress(0x85EC4A) == 0x94BF ) - { - // 3.0 - *GetVer() = 2; - *GetEuropean() = false; - return true; - } - return false; - } - - inline bool TryMatch_newsteam_r1() - { - if ( *(uint32_t*)DynBaseAddress(0x858D21) == 0x3539F633 ) - { - // newsteam r1 - *GetVer() = 3; - *GetEuropean() = false; - return true; - } - return false; - } - - inline bool TryMatch_newsteam_r2() - { - if ( *(uint32_t*)DynBaseAddress(0x858D51) == 0x3539F633 ) - { - // newsteam r2 - *GetVer() = 4; - *GetEuropean() = false; - return true; - } - return false; - } - - inline bool TryMatch_newsteam_r2_lv() - { - if ( *(uint32_t*)DynBaseAddress(0x858C61) == 0x3539F633 ) - { - // newsteam r2 lv - *GetVer() = 5; - *GetEuropean() = false; - return true; - } - return false; - } - - inline void InitializeVersions() - { - if ( *GetVer() == -1 ) - { - if ( TryMatch_10() ) return; - if ( TryMatch_11() ) return; - if ( TryMatch_30() ) return; - if ( TryMatch_newsteam_r1() ) return; - if ( TryMatch_newsteam_r2() ) return; - if ( TryMatch_newsteam_r2_lv() ) return; - } - } - - inline void InitializeRegion_10() - { - signed char* bVer = GetVer(); - - if ( *bVer == -1 ) - { - if ( !TryMatch_10() ) - { - #ifdef assert - assert(!"AddressByRegion_10 on non-1.0 EXE!"); - #endif - } - } - } - - inline void InitializeRegion_11() - { - signed char* bVer = GetVer(); - - if ( *bVer == -1 ) - { - if ( !TryMatch_11() ) - { - #ifdef assert - assert(!"AddressByRegion_11 on non-1.01 EXE!"); - #endif - } - } - } - - inline uintptr_t AdjustAddress_10(uintptr_t address10) - { - if ( *GetEuropean() ) - { - if ( address10 >= 0x746720 && address10 < 0x857000 ) - { - if ( address10 >= 0x7BA940 ) - address10 += 0x40; - else - address10 += 0x50; - } - } - return address10; - } - - inline uintptr_t AdjustAddress_11(uintptr_t address11) - { - if ( !(*GetEuropean()) && address11 > 0x746FA0 ) - { - if ( address11 < 0x7BB240 ) - address11 -= 0x50; - else - address11 -= 0x40; - } - return address11; - } - - inline uintptr_t AddressByVersion(AddrVariant address10, AddrVariant address11, AddrVariant addressSteam, AddrVariant addressNewsteamR2, AddrVariant addressNewsteamR2_LV) - { - InitializeVersions(); - - signed char bVer = *GetVer(); - - switch ( bVer ) - { - case 1: - if ( auto pao = std::get_if(&address11) ) return HandlePattern( *pao ); - else - { - const uintptr_t addr = *std::get_if(&address11); - #ifdef assert - assert(addr); - #endif - - // Safety measures - if null, return dummy var pointer to prevent a crash - if ( addr == 0 ) - return GetDummy(); - - // Adjust to US if needed - return AdjustAddress_11(addr); - } - case 2: - if ( auto pao = std::get_if(&addressSteam) ) return HandlePattern( *pao ); - else - { - const uintptr_t addr = *std::get_if(&addressSteam); - #ifdef assert - assert(addr); - #endif - // Safety measures - if null, return dummy var pointer to prevent a crash - if ( addr == 0 ) - return GetDummy(); - - return addr; - } - case 3: - return GetDummy(); - case 4: - if ( auto pao = std::get_if(&addressNewsteamR2) ) return HandlePattern( *pao ); - else - { - const uintptr_t addr = *std::get_if(&addressNewsteamR2); - #ifdef assert - assert(addr); - #endif - if ( addr == 0 ) - return GetDummy(); - - return DynBaseAddress(addr); - } - case 5: - if ( auto pao = std::get_if(&addressNewsteamR2) ) return HandlePattern( *pao ); - else - { - const uintptr_t addr = *std::get_if(&addressNewsteamR2_LV); - #ifdef assert - assert(addr); - #endif - if ( addr == 0 ) - return GetDummy(); - - return DynBaseAddress(addr); - } - default: - if ( auto pao = std::get_if(&address10) ) return HandlePattern( *pao ); - else - { - const uintptr_t addr = *std::get_if(&address10); - #ifdef assert - assert(addr); - #endif - // Adjust to EU if needed - return AdjustAddress_10(addr); - } - } - } - - inline uintptr_t AddressByRegion_10(uintptr_t address10) - { - InitializeRegion_10(); - - // Adjust to EU if needed - return AdjustAddress_10(address10); - } - - inline uintptr_t AddressByRegion_11(uintptr_t address11) - { - InitializeRegion_11(); - - // Adjust to US if needed - return AdjustAddress_11(address11); - } - -#else - - inline void InitializeVersions() - { - } - -#endif - -#if defined _GTA_III || defined _GTA_VC - - inline uintptr_t AddressByVersion(uintptr_t address10, uintptr_t address11, uintptr_t addressSteam) - { - InitializeVersions(); - - signed char bVer = *GetVer(); - - switch ( bVer ) - { - case 1: -#ifdef assert - assert(address11); -#endif - return address11; - case 2: -#ifdef assert - assert(addressSteam); -#endif - return addressSteam; - default: -#ifdef assert - assert(address10); -#endif - return address10; - } - } - -#endif - - } -} - -#if defined _GTA_III || defined _GTA_VC - -template -inline T AddressByVersion(uintptr_t address10, uintptr_t address11, uintptr_t addressSteam) -{ - return T(Memory::internal::AddressByVersion( address10, address11, addressSteam )); -} - -#elif defined _GTA_SA - -template -inline T AddressByVersion(Memory::AddrVariant address10, Memory::AddrVariant address11, Memory::AddrVariant addressSteam) -{ - return T(Memory::internal::AddressByVersion( std::move(address10), std::move(address11), std::move(addressSteam), 0, 0 )); -} - -template -inline T AddressByVersion(Memory::AddrVariant address10, Memory::AddrVariant address11, Memory::AddrVariant addressSteam, Memory::AddrVariant addressNewsteamR2, Memory::AddrVariant addressNewsteamR2_LV) -{ - return T(Memory::internal::AddressByVersion( std::move(address10), std::move(address11), std::move(addressSteam), std::move(addressNewsteamR2), std::move(addressNewsteamR2_LV) )); -} - -template -inline T AddressByVersion(Memory::AddrVariant address10, Memory::AddrVariant addressNewsteam) -{ - return T(Memory::internal::AddressByVersion( std::move(address10), 0, 0, addressNewsteam, addressNewsteam )); -} - -template -inline T AddressByRegion_10(uintptr_t address10) -{ - return T(Memory::internal::AddressByRegion_10(address10)); -} - -template -inline T AddressByRegion_11(uintptr_t address11) -{ - return T(Memory::internal::AddressByRegion_11(address11)); -} - -#endif - -namespace Memory -{ - struct VersionInfo - { - int8_t version; - bool european; - }; - - inline VersionInfo GetVersion() - { - Memory::internal::InitializeVersions(); - return { *Memory::internal::GetVer(), *Memory::internal::GetEuropean() }; - } -}; diff --git a/SilentPatch/MemoryMgr.h b/SilentPatch/MemoryMgr.h deleted file mode 100644 index 71c2dc6..0000000 --- a/SilentPatch/MemoryMgr.h +++ /dev/null @@ -1,429 +0,0 @@ -#ifndef __MEMORYMGR -#define __MEMORYMGR - -// Switches: -// _MEMORY_NO_CRT - don't include anything "complex" like ScopedUnprotect or memset -// _MEMORY_DECLS_ONLY - don't include anything but macroes - -#define WRAPPER __declspec(naked) -#define DEPRECATED __declspec(deprecated) -#define EAXJMP(a) { _asm mov eax, a _asm jmp eax } -#define VARJMP(a) { _asm jmp a } -#define WRAPARG(a) ((int)a) - -#define NOVMT __declspec(novtable) -#define SETVMT(a) *((uintptr_t*)this) = (uintptr_t)a - -#ifndef _MEMORY_DECLS_ONLY - -#define WIN32_LEAN_AND_MEAN -#include - -#include -#include - -#ifndef _MEMORY_NO_CRT -#include -#include -#endif - -enum -{ - PATCH_CALL, - PATCH_JUMP -}; - -template -inline AT DynBaseAddress(AT address) -{ - return (ptrdiff_t)GetModuleHandle(nullptr) - 0x400000 + address; -} - -namespace Memory -{ - template - inline void Patch(AT address, T value) - {*(T*)address = value; } - -#ifndef _MEMORY_NO_CRT - template - inline void Patch(AT address, std::initializer_list list ) - { - uint8_t* addr = reinterpret_cast(address); - std::copy( list.begin(), list.end(), stdext::make_checked_array_iterator(addr, list.size()) ); - } -#endif - - template - inline void Nop(AT address, size_t count) -#ifndef _MEMORY_NO_CRT - { memset((void*)address, 0x90, count); } -#else - { do { - *(uint8_t*)address++ = 0x90; - } while ( --count != 0 ); } -#endif - - template - inline void InjectHook(AT address, Func hook) - { - union member_cast - { - intptr_t addr; - Func funcPtr; - } cast; - static_assert( sizeof(cast.addr) == sizeof(cast.funcPtr), "member_cast failure!" ); - cast.funcPtr = hook; - - *(int32_t*)((intptr_t)address + 1) = static_cast(cast.addr - (intptr_t)address - 5); - } - - template - inline void InjectHook(AT address, Func hook, unsigned int nType) - { - *(uint8_t*)address = nType == PATCH_JUMP ? 0xE9 : 0xE8; - InjectHook(address, hook); - } - - template - inline void ReadCall(AT address, Func& func) - { - union member_cast - { - intptr_t addr; - Func funcPtr; - } cast; - static_assert( sizeof(cast.addr) == sizeof(cast.funcPtr), "member_cast failure!" ); - - cast.addr = (intptr_t)address + 5 + *(int32_t*)((intptr_t)address+1); - func = cast.funcPtr; - } - - template - inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0) - { - uintptr_t addr; - ReadCall( address, addr ); - return reinterpret_cast( addr + offset ); - } - -#ifndef _MEMORY_NO_CRT - inline bool MemEquals(uintptr_t address, std::initializer_list val) - { - const uint8_t* mem = reinterpret_cast(address); - return std::equal( val.begin(), val.end(), stdext::make_checked_array_iterator(mem, val.size()) ); - } -#endif - - template - inline AT Verify(AT address, uintptr_t expected) - { - assert( uintptr_t(address) == expected ); - return address; - } - - namespace DynBase - { - template - inline void Patch(AT address, T value) - { - Memory::Patch(DynBaseAddress(address), value); - } - -#ifndef _MEMORY_NO_CRT - template - inline void Patch(AT address, std::initializer_list list ) - { - Memory::Patch(DynBaseAddress(address), std::move(list)); - } -#endif - - template - inline void Nop(AT address, size_t count) - { - Memory::Nop(DynBaseAddress(address), count); - } - - template - inline void InjectHook(AT address, HT hook) - { - Memory::InjectHook(DynBaseAddress(address), hook); - } - - template - inline void InjectHook(AT address, HT hook, unsigned int nType) - { - Memory::InjectHook(DynBaseAddress(address), hook, nType); - } - - template - inline void ReadCall(AT address, Func& func) - { - Memory::ReadCall(DynBaseAddress(address), func); - } - - template - inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0) - { - return Memory::ReadCallFrom(DynBaseAddress(address), offset); - } - -#ifndef _MEMORY_NO_CRT - inline bool MemEquals(uintptr_t address, std::initializer_list val) - { - return Memory::MemEquals(DynBaseAddress(address), std::move(val)); - } - - template - inline AT Verify(AT address, uintptr_t expected) - { - return Memory::Verify(address, DynBaseAddress(expected)); - } -#endif - }; - - namespace VP - { - template - inline void Patch(AT address, T value) - { - DWORD dwProtect[2]; - VirtualProtect((void*)address, sizeof(T), PAGE_EXECUTE_READWRITE, &dwProtect[0]); - Memory::Patch( address, value ); - VirtualProtect((void*)address, sizeof(T), dwProtect[0], &dwProtect[1]); - } - -#ifndef _MEMORY_NO_CRT - template - inline void Patch(AT address, std::initializer_list list ) - { - DWORD dwProtect[2]; - VirtualProtect((void*)address, list.size(), PAGE_EXECUTE_READWRITE, &dwProtect[0]); - Memory::Patch(address, std::move(list)); - VirtualProtect((void*)address, list.size(), dwProtect[0], &dwProtect[1]); - } -#endif - - template - inline void Nop(AT address, size_t count) - { - DWORD dwProtect[2]; - VirtualProtect((void*)address, count, PAGE_EXECUTE_READWRITE, &dwProtect[0]); - Memory::Nop( address, count ); - VirtualProtect((void*)address, count, dwProtect[0], &dwProtect[1]); - } - - template - inline void InjectHook(AT address, HT hook) - { - DWORD dwProtect[2]; - - VirtualProtect((void*)((DWORD_PTR)address + 1), 4, PAGE_EXECUTE_READWRITE, &dwProtect[0]); - Memory::InjectHook( address, hook ); - VirtualProtect((void*)((DWORD_PTR)address + 1), 4, dwProtect[0], &dwProtect[1]); - } - - template - inline void InjectHook(AT address, HT hook, unsigned int nType) - { - DWORD dwProtect[2]; - - VirtualProtect((void*)address, 5, PAGE_EXECUTE_READWRITE, &dwProtect[0]); - Memory::InjectHook( address, hook, nType ); - VirtualProtect((void*)address, 5, dwProtect[0], &dwProtect[1]); - } - - template - inline void ReadCall(AT address, Func& func) - { - Memory::ReadCall(address, func); - } - - template - inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0) - { - return Memory::ReadCallFrom(address, offset); - } - -#ifndef _MEMORY_NO_CRT - inline bool MemEquals(uintptr_t address, std::initializer_list val) - { - return Memory::MemEquals(address, std::move(val)); - } -#endif - - template - inline AT Verify(AT address, uintptr_t expected) - { - return Memory::Verify(address, expected); - } - - namespace DynBase - { - template - inline void Patch(AT address, T value) - { - VP::Patch(DynBaseAddress(address), value); - } - -#ifndef _MEMORY_NO_CRT - template - inline void Patch(AT address, std::initializer_list list ) - { - VP::Patch(DynBaseAddress(address), std::move(list)); - } -#endif - - template - inline void Nop(AT address, size_t count) - { - VP::Nop(DynBaseAddress(address), count); - } - - template - inline void InjectHook(AT address, HT hook) - { - VP::InjectHook(DynBaseAddress(address), hook); - } - - template - inline void InjectHook(AT address, HT hook, unsigned int nType) - { - VP::InjectHook(DynBaseAddress(address), hook, nType); - } - - template - inline void ReadCall(AT address, Func& func) - { - Memory::ReadCall(DynBaseAddress(address), func); - } - - template - inline void* ReadCallFrom(AT address, ptrdiff_t offset = 0) - { - Memory::ReadCallFrom(DynBaseAddress(address), offset); - } - -#ifndef _MEMORY_NO_CRT - inline bool MemEquals(uintptr_t address, std::initializer_list val) - { - return Memory::MemEquals(DynBaseAddress(address), std::move(val)); - } -#endif - - template - inline AT Verify(AT address, uintptr_t expected) - { - return Memory::Verify(address, DynBaseAddress(expected)); - } - - }; - }; -}; - -#ifndef _MEMORY_NO_CRT - -#include -#include -#include - -namespace ScopedUnprotect -{ - class Unprotect - { - public: - ~Unprotect() - { - for ( auto& it : m_queriedProtects ) - { - DWORD dwOldProtect; - VirtualProtect( std::get<0>(it), std::get<1>(it), std::get<2>(it), &dwOldProtect ); - } - } - - protected: - Unprotect() = default; - - void UnprotectRange( DWORD_PTR BaseAddress, SIZE_T Size ) - { - SIZE_T QueriedSize = 0; - while ( QueriedSize < Size ) - { - MEMORY_BASIC_INFORMATION MemoryInf; - DWORD dwOldProtect; - - VirtualQuery( (LPCVOID)(BaseAddress + QueriedSize), &MemoryInf, sizeof(MemoryInf) ); - if ( MemoryInf.State == MEM_COMMIT && (MemoryInf.Type & MEM_IMAGE) != 0 && - (MemoryInf.Protect & (PAGE_EXECUTE_READWRITE|PAGE_EXECUTE_WRITECOPY|PAGE_READWRITE|PAGE_WRITECOPY)) == 0 ) - { - const bool wasExecutable = (MemoryInf.Protect & (PAGE_EXECUTE|PAGE_EXECUTE_READ)) != 0; - VirtualProtect( MemoryInf.BaseAddress, MemoryInf.RegionSize, wasExecutable ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE, &dwOldProtect ); - m_queriedProtects.emplace_front( MemoryInf.BaseAddress, MemoryInf.RegionSize, MemoryInf.Protect ); - } - QueriedSize += MemoryInf.RegionSize; - } - } - - private: - std::forward_list< std::tuple< LPVOID, SIZE_T, DWORD > > m_queriedProtects; - }; - - class Section : public Unprotect - { - public: - Section( HINSTANCE hInstance, const char* name ) - { - PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)hInstance + ((PIMAGE_DOS_HEADER)hInstance)->e_lfanew); - PIMAGE_SECTION_HEADER pSection = IMAGE_FIRST_SECTION(ntHeader); - - DWORD_PTR VirtualAddress = DWORD_PTR(-1); - SIZE_T VirtualSize = SIZE_T(-1); - for ( SIZE_T i = 0, j = ntHeader->FileHeader.NumberOfSections; i < j; ++i, ++pSection ) - { - if ( strncmp( (const char*)pSection->Name, name, IMAGE_SIZEOF_SHORT_NAME ) == 0 ) - { - VirtualAddress = (DWORD_PTR)hInstance + pSection->VirtualAddress; - VirtualSize = pSection->Misc.VirtualSize; - m_locatedSection = true; - break; - } - } - - if ( VirtualAddress == DWORD_PTR(-1) ) - return; - - UnprotectRange( VirtualAddress, VirtualSize ); - }; - - bool SectionLocated() const { return m_locatedSection; } - - private: - bool m_locatedSection = false; - }; - - class FullModule : public Unprotect - { - public: - FullModule( HINSTANCE hInstance ) - { - PIMAGE_NT_HEADERS ntHeader = (PIMAGE_NT_HEADERS)((DWORD_PTR)hInstance + ((PIMAGE_DOS_HEADER)hInstance)->e_lfanew); - UnprotectRange( (DWORD_PTR)hInstance, ntHeader->OptionalHeader.SizeOfImage ); - } - }; - - inline std::unique_ptr UnprotectSectionOrFullModule( HINSTANCE hInstance, const char* name ) - { - std::unique_ptr
section = std::make_unique
( hInstance, name ); - if ( !section->SectionLocated() ) - { - return std::make_unique( hInstance ); - } - return section; - } -}; - -#endif - -#endif - -#endif \ No newline at end of file diff --git a/SilentPatch/ModuleList.hpp b/SilentPatch/ModuleList.hpp deleted file mode 100644 index 34773e8..0000000 --- a/SilentPatch/ModuleList.hpp +++ /dev/null @@ -1,212 +0,0 @@ -#pragma once - -#include -#include -#include - -// Stores a list of loaded modules with their names, WITHOUT extension -class ModuleList -{ -public: - struct LazyEnumerateTag {}; - - ModuleList() - { - Enumerate(); - } - - explicit ModuleList( LazyEnumerateTag ) - { - } - - // Initializes module list - // Needs to be called before any calls to Get or GetAll - void Enumerate() - { - // Cannot enumerate twice without cleaing - assert( m_moduleList.size() == 0 ); - - constexpr size_t INITIAL_SIZE = sizeof(HMODULE) * 256; - HMODULE* modules = static_cast(malloc( INITIAL_SIZE )); - if ( modules != nullptr ) - { - typedef BOOL (WINAPI * Func)(HANDLE hProcess, HMODULE *lphModule, DWORD cb, LPDWORD lpcbNeeded); - - HMODULE hLib = LoadLibrary( TEXT("kernel32") ); - assert( hLib != nullptr ); // If this fails then everything is probably broken anyway - - Func pEnumProcessModules = reinterpret_cast(GetProcAddress( hLib, "K32EnumProcessModules" )); - if ( pEnumProcessModules == nullptr ) - { - // Try psapi - FreeLibrary( hLib ); - hLib = LoadLibrary( TEXT("psapi") ); - if ( hLib != nullptr ) - { - pEnumProcessModules = reinterpret_cast(GetProcAddress( hLib, "EnumProcessModules" )); - } - } - - if ( pEnumProcessModules != nullptr ) - { - const HANDLE currentProcess = GetCurrentProcess(); - DWORD cbNeeded = 0; - if ( pEnumProcessModules( currentProcess, modules, INITIAL_SIZE, &cbNeeded ) != 0 ) - { - if ( cbNeeded > INITIAL_SIZE ) - { - HMODULE* newModules = static_cast(realloc( modules, cbNeeded )); - if ( newModules != nullptr ) - { - modules = newModules; - - if ( pEnumProcessModules( currentProcess, modules, cbNeeded, &cbNeeded ) != 0 ) - { - EnumerateInternal( modules, cbNeeded / sizeof(HMODULE) ); - } - } - else - { - EnumerateInternal( modules, INITIAL_SIZE / sizeof(HMODULE) ); - } - } - else - { - EnumerateInternal( modules, cbNeeded / sizeof(HMODULE) ); - } - } - } - - if ( hLib != nullptr ) - { - FreeLibrary( hLib ); - } - - free( modules ); - } - } - - // Recreates module list - void ReEnumerate() - { - Clear(); - Enumerate(); - } - - // Clears module list - void Clear() - { - m_moduleList.clear(); - } - - // Gets handle of a loaded module with given name, NULL otherwise - HMODULE Get( const wchar_t* moduleName ) const - { - // If vector is empty then we're trying to call it without calling Enumerate first - assert( m_moduleList.size() != 0 ); - - auto it = std::find_if( m_moduleList.begin(), m_moduleList.end(), [&]( const auto& e ) { - return _wcsicmp( moduleName, e.second.c_str() ) == 0; - } ); - return it != m_moduleList.end() ? it->first : nullptr; - } - - // Gets handles to all loaded modules with given name - std::vector GetAll( const wchar_t* moduleName ) const - { - // If vector is empty then we're trying to call it without calling Enumerate first - assert( m_moduleList.size() != 0 ); - - std::vector results; - for ( auto& e : m_moduleList ) - { - if ( _wcsicmp( moduleName, e.second.c_str() ) == 0 ) - { - results.push_back( e.first ); - } - } - - return results; - } - - // Gets handle of a loaded module with given prefix, NULL otherwise - HMODULE GetByPrefix( const wchar_t* modulePrefix ) const - { - // If vector is empty then we're trying to call it without calling Enumerate first - assert( m_moduleList.size() != 0 ); - - const size_t len = wcslen( modulePrefix ); - auto it = std::find_if( m_moduleList.begin(), m_moduleList.end(), [&]( const auto& e ) { - return _wcsnicmp( modulePrefix, e.second.c_str(), len ) == 0; - } ); - return it != m_moduleList.end() ? it->first : nullptr; - } - - // Gets handles to all loaded modules with given prefix - std::vector GetAllByPrefix( const wchar_t* modulePrefix ) const - { - // If vector is empty then we're trying to call it without calling Enumerate first - assert( m_moduleList.size() != 0 ); - - const size_t len = wcslen( modulePrefix ); - std::vector results; - for ( auto& e : m_moduleList ) - { - if ( _wcsnicmp( modulePrefix, e.second.c_str(), len ) == 0 ) - { - results.push_back( e.first ); - } - } - - return results; - } - -private: - void EnumerateInternal( HMODULE* modules, size_t numModules ) - { - size_t moduleNameLength = MAX_PATH; - wchar_t* moduleName = static_cast( malloc( moduleNameLength * sizeof(moduleName[0]) ) ); - if ( moduleName != nullptr ) - { - m_moduleList.reserve( numModules ); - for ( size_t i = 0; i < numModules; i++ ) - { - // Obtain module name, with resizing if necessary - DWORD size; - while ( size = GetModuleFileNameW( *modules, moduleName, moduleNameLength ), size == moduleNameLength ) - { - wchar_t* newName = static_cast( realloc( moduleName, 2 * moduleNameLength * sizeof(moduleName[0]) ) ); - if ( newName != nullptr ) - { - moduleName = newName; - moduleNameLength *= 2; - } - else - { - size = 0; - break; - } - } - - if ( size != 0 ) - { - const wchar_t* nameBegin = wcsrchr( moduleName, '\\' ) + 1; - const wchar_t* dotPos = wcsrchr( nameBegin, '.' ); - if ( dotPos != nullptr ) - { - m_moduleList.emplace_back( *modules, std::wstring( nameBegin, dotPos ) ); - } - else - { - m_moduleList.emplace_back( *modules, nameBegin ); - } - } - modules++; - } - - free( moduleName ); - } - } - - std::vector< std::pair > m_moduleList; -}; \ No newline at end of file diff --git a/SilentPatch/Patterns.cpp b/SilentPatch/Patterns.cpp deleted file mode 100644 index f1c2215..0000000 --- a/SilentPatch/Patterns.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/* - * This file is part of the CitizenFX project - http://citizen.re/ - * - * See LICENSE and MENTIONS in the root of the source tree for information - * regarding licensing. - */ - -#include "Patterns.h" - -#define WIN32_LEAN_AND_MEAN -#define NOMINMAX -#include -#include - -#if PATTERNS_USE_HINTS -#include -#endif - - -#if PATTERNS_USE_HINTS - -// from boost someplace -template -struct basic_fnv_1 -{ - std::uint64_t operator()(std::string_view text) const - { - std::uint64_t hash = OffsetBasis; - for (auto it : text) - { - hash *= FnvPrime; - hash ^= it; - } - - return hash; - } -}; - -static constexpr std::uint64_t fnv_prime = 1099511628211u; -static constexpr std::uint64_t fnv_offset_basis = 14695981039346656037u; - -typedef basic_fnv_1 fnv_1; - -#endif - -namespace hook -{ - ptrdiff_t pattern::get_process_base() - { - return ptrdiff_t(GetModuleHandle(nullptr)); - } - - -#if PATTERNS_USE_HINTS -static auto& getHints() -{ - static std::multimap hints; - return hints; -} -#endif - -static void TransformPattern(std::string_view pattern, std::basic_string& data, std::basic_string& mask) -{ - uint8_t tempDigit = 0; - bool tempFlag = false; - - auto tol = [] (char ch) -> uint8_t - { - if (ch >= 'A' && ch <= 'F') return uint8_t(ch - 'A' + 10); - if (ch >= 'a' && ch <= 'f') return uint8_t(ch - 'a' + 10); - return uint8_t(ch - '0'); - }; - - for (auto ch : pattern) - { - if (ch == ' ') - { - continue; - } - else if (ch == '?') - { - data.push_back(0); - mask.push_back(0); - } - else if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) - { - uint8_t thisDigit = tol(ch); - - if (!tempFlag) - { - tempDigit = thisDigit << 4; - tempFlag = true; - } - else - { - tempDigit |= thisDigit; - tempFlag = false; - - data.push_back(tempDigit); - mask.push_back(0xFF); - } - } - } -} - -class executable_meta -{ -private: - uintptr_t m_begin; - uintptr_t m_end; - - template - TReturn* getRVA(TOffset rva) - { - return (TReturn*)(m_begin + rva); - } - -public: - explicit executable_meta(uintptr_t module) - : m_begin(module) - { - PIMAGE_DOS_HEADER dosHeader = getRVA(0); - PIMAGE_NT_HEADERS ntHeader = getRVA(dosHeader->e_lfanew); - - m_end = m_begin + ntHeader->OptionalHeader.SizeOfImage; - } - - executable_meta(uintptr_t begin, uintptr_t end) - : m_begin(begin), m_end(end) - { - } - - inline uintptr_t begin() const { return m_begin; } - inline uintptr_t end() const { return m_end; } -}; - -void pattern::Initialize(std::string_view pattern) -{ - // get the hash for the base pattern -#if PATTERNS_USE_HINTS - m_hash = fnv_1()(pattern); -#endif - - // transform the base pattern from IDA format to canonical format - TransformPattern(pattern, m_bytes, m_mask); - -#if PATTERNS_USE_HINTS - // if there's hints, try those first -#if PATTERNS_CAN_SERIALIZE_HINTS - if (m_rangeStart == reinterpret_cast(GetModuleHandle(nullptr))) -#endif - { - auto range = getHints().equal_range(m_hash); - - if (range.first != range.second) - { - std::for_each(range.first, range.second, [&] (const auto& hint) - { - ConsiderHint(hint.second); - }); - - // if the hints succeeded, we don't need to do anything more - if (!m_matches.empty()) - { - m_matched = true; - return; - } - } - } -#endif -} - -void pattern::EnsureMatches(uint32_t maxCount) -{ - if (m_matched) - { - return; - } - - // scan the executable for code - executable_meta executable = m_rangeStart != 0 && m_rangeEnd != 0 ? executable_meta(m_rangeStart, m_rangeEnd) : executable_meta(m_rangeStart); - - auto matchSuccess = [&] (uintptr_t address) - { -#if PATTERNS_USE_HINTS - getHints().emplace(m_hash, address); -#else - (void)address; -#endif - - return (m_matches.size() == maxCount); - }; - - const uint8_t* pattern = m_bytes.data(); - const uint8_t* mask = m_mask.data(); - const size_t maskSize = m_mask.size(); - const size_t lastWild = m_mask.find_last_not_of(uint8_t(0xFF)); - - ptrdiff_t Last[256]; - - std::fill(std::begin(Last), std::end(Last), lastWild == std::string::npos ? -1 : static_cast(lastWild) ); - - for ( ptrdiff_t i = 0; i < static_cast(maskSize); ++i ) - { - if ( Last[ pattern[i] ] < i ) - { - Last[ pattern[i] ] = i; - } - } - - for (uintptr_t i = executable.begin(), end = executable.end() - maskSize; i <= end;) - { - uint8_t* ptr = reinterpret_cast(i); - ptrdiff_t j = maskSize - 1; - - while((j >= 0) && pattern[j] == (ptr[j] & mask[j])) j--; - - if(j < 0) - { - m_matches.emplace_back(ptr); - - if (matchSuccess(i)) - { - break; - } - i++; - } - else i += std::max(ptrdiff_t(1), j - Last[ ptr[j] ]); - } - - m_matched = true; -} - -bool pattern::ConsiderHint(uintptr_t offset) -{ - uint8_t* ptr = reinterpret_cast(offset); - -#if PATTERNS_CAN_SERIALIZE_HINTS - const uint8_t* pattern = m_bytes.data(); - const uint8_t* mask = m_mask.data(); - - for (size_t i = 0, j = m_mask.size(); i < j; i++) - { - if (pattern[i] != (ptr[i] & mask[i])) - { - return false; - } - } -#endif - - m_matches.emplace_back(ptr); - - return true; -} - -#if PATTERNS_USE_HINTS && PATTERNS_CAN_SERIALIZE_HINTS -void pattern::hint(uint64_t hash, uintptr_t address) -{ - auto& hints = getHints(); - - auto range = hints.equal_range(hash); - - for (auto it = range.first; it != range.second; ++it) - { - if (it->second == address) - { - return; - } - } - - hints.emplace(hash, address); -} -#endif -} \ No newline at end of file diff --git a/SilentPatch/Patterns.h b/SilentPatch/Patterns.h deleted file mode 100644 index 7410707..0000000 --- a/SilentPatch/Patterns.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * This file is part of the CitizenFX project - http://citizen.re/ - * - * See LICENSE and MENTIONS in the root of the source tree for information - * regarding licensing. - */ - -#pragma once - -#include -#include -#include - -#pragma warning(push) -#pragma warning(disable:4201) - -namespace hook -{ - class pattern_match - { - private: - void* m_pointer; - - public: - inline pattern_match(void* pointer) - : m_pointer(pointer) - { - } - - template - T* get(ptrdiff_t offset = 0) const - { - char* ptr = reinterpret_cast(m_pointer); - return reinterpret_cast(ptr + offset); - } - }; - - class pattern - { - private: - std::basic_string m_bytes; - std::basic_string m_mask; - -#if PATTERNS_USE_HINTS - uint64_t m_hash; -#endif - - std::vector m_matches; - - bool m_matched = false; - - uintptr_t m_rangeStart; - uintptr_t m_rangeEnd; - - private: - static ptrdiff_t get_process_base(); - - void Initialize(std::string_view pattern); - - bool ConsiderHint(uintptr_t offset); - - void EnsureMatches(uint32_t maxCount); - - inline pattern_match _get_internal(size_t index) const - { - return m_matches[index]; - } - - inline pattern(uintptr_t module) - : pattern( module, 0 ) - { - } - - inline pattern(uintptr_t begin, uintptr_t end) - : m_rangeStart(begin), m_rangeEnd(end) - { - } - - public: - pattern(std::string_view pattern) - : pattern(get_process_base()) - { - Initialize(std::move(pattern)); - } - - inline pattern(void* module, std::string_view pattern) - : pattern(reinterpret_cast(module)) - { - Initialize(std::move(pattern)); - } - - inline pattern(uintptr_t begin, uintptr_t end, std::string_view pattern) - : m_rangeStart(begin), m_rangeEnd(end) - { - Initialize(std::move(pattern)); - } - - inline pattern&& count(uint32_t expected) - { - EnsureMatches(expected); - assert(m_matches.size() == expected); - return std::forward(*this); - } - - inline pattern&& count_hint(uint32_t expected) - { - EnsureMatches(expected); - return std::forward(*this); - } - - inline pattern&& clear() - { - m_matches.clear(); - m_matched = false; - return std::forward(*this); - } - - inline size_t size() - { - EnsureMatches(UINT32_MAX); - return m_matches.size(); - } - - inline bool empty() - { - return size() == 0; - } - - inline pattern_match get(size_t index) - { - EnsureMatches(UINT32_MAX); - return _get_internal(index); - } - - inline pattern_match get_one() - { - return std::forward(*this).count(1)._get_internal(0); - } - - template - inline auto get_first(ptrdiff_t offset = 0) - { - return get_one().get(offset); - } - - template - inline Pred for_each_result(Pred&& pred) - { - EnsureMatches(UINT32_MAX); - for ( auto it : m_matches ) - { - std::forward(pred)(it); - } - return std::forward(pred); - } - - public: -#if PATTERNS_USE_HINTS && PATTERNS_CAN_SERIALIZE_HINTS - // define a hint - static void hint(uint64_t hash, uintptr_t address); -#endif - }; - - inline pattern make_module_pattern(void* module, std::string_view bytes) - { - return pattern(module, std::move(bytes)); - } - - inline pattern make_range_pattern(uintptr_t begin, uintptr_t end, std::string_view bytes) - { - return pattern(begin, end, std::move(bytes)); - } - - template - inline auto get_pattern(std::string_view pattern_string, ptrdiff_t offset = 0) - { - return pattern(std::move(pattern_string)).get_first(offset); - } -} - -#pragma warning(pop) \ No newline at end of file diff --git a/SilentPatch/StdAfx.h b/SilentPatch/StdAfx.h index c107ae4..dd987aa 100644 --- a/SilentPatch/StdAfx.h +++ b/SilentPatch/StdAfx.h @@ -8,7 +8,7 @@ #include #include -#include "MemoryMgr.h" -#include "MemoryMgr.GTA.h" +#include "Utils/MemoryMgr.h" +#include "Utils/MemoryMgr.GTA.h" #define DISABLE_FLA_DONATION_WINDOW 0 diff --git a/SilentPatch/StoredCar.cpp b/SilentPatch/StoredCar.cpp index 78159d4..bf5c376 100644 --- a/SilentPatch/StoredCar.cpp +++ b/SilentPatch/StoredCar.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "StoredCar.h" -#include "Patterns.h" +#include "Utils/Patterns.h" #if _GTA_III static auto FindPlayerPed = hook::get_pattern( "6B C0 4F 8B 04 85 ? ? ? ? C3", -7 ); diff --git a/SilentPatch/TheFLAUtils.cpp b/SilentPatch/TheFLAUtils.cpp index 61b5038..685280c 100644 --- a/SilentPatch/TheFLAUtils.cpp +++ b/SilentPatch/TheFLAUtils.cpp @@ -3,7 +3,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include "ModuleList.hpp" +#include "Utils/ModuleList.hpp" int32_t (*FLAUtils::GetExtendedID8Func)(const uint8_t* ptr) = FLAUtils::GetExtendedID8_Stock; int32_t (*FLAUtils::GetExtendedID16Func)(const uint16_t* ptr) = FLAUtils::GetExtendedID16_Stock; diff --git a/SilentPatch/Timer.cpp b/SilentPatch/Timer.cpp index 1d0b6bb..7a3f9a4 100644 --- a/SilentPatch/Timer.cpp +++ b/SilentPatch/Timer.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "Timer.h" -#include "Patterns.h" +#include "Utils/Patterns.h" int& CTimer::m_snTimeInMilliseconds = **hook::get_pattern( "83 E4 F8 89 44 24 08 C7 44 24 0C 00 00 00 00 DF 6C 24 08", -20 + 1 ); diff --git a/SilentPatch/Utils b/SilentPatch/Utils new file mode 160000 index 0000000..43e545d --- /dev/null +++ b/SilentPatch/Utils @@ -0,0 +1 @@ +Subproject commit 43e545d9fe2caa609579dd3936702a4566b71258 diff --git a/SilentPatchIII/SilentPatchIII.cpp b/SilentPatchIII/SilentPatchIII.cpp index f7702e5..3c30ab9 100644 --- a/SilentPatchIII/SilentPatchIII.cpp +++ b/SilentPatchIII/SilentPatchIII.cpp @@ -2,7 +2,7 @@ #include "General.h" #include "Timer.h" -#include "Patterns.h" +#include "Utils/Patterns.h" #include "Common.h" #include "Common_ddraw.h" diff --git a/SilentPatchIII/SilentPatchIII.vcxproj b/SilentPatchIII/SilentPatchIII.vcxproj index 36d2a27..cf3a4a4 100644 --- a/SilentPatchIII/SilentPatchIII.vcxproj +++ b/SilentPatchIII/SilentPatchIII.vcxproj @@ -25,13 +25,13 @@ NotUsing NotUsing - - NotUsing - NotUsing - NotUsing - + + NotUsing + NotUsing + NotUsing + Create @@ -43,12 +43,12 @@ - - - + + + diff --git a/SilentPatchIII/SilentPatchIII.vcxproj.filters b/SilentPatchIII/SilentPatchIII.vcxproj.filters index 10bea4f..3358c79 100644 --- a/SilentPatchIII/SilentPatchIII.vcxproj.filters +++ b/SilentPatchIII/SilentPatchIII.vcxproj.filters @@ -13,6 +13,12 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {6f7b5bc0-8528-4f8e-a767-183d8c1abb17} + + + {66df9142-3ab6-4f22-aca5-69b4c3d9b475} + @@ -24,9 +30,6 @@ Source Files - - Source Files - Source Files @@ -36,11 +39,11 @@ Source Files + + Source Files\Utils + - - Header Files - Header Files @@ -50,9 +53,6 @@ Header Files - - Header Files - Header Files @@ -65,8 +65,14 @@ Header Files - - Header Files + + Header Files\Utils + + + Header Files\Utils + + + Header Files\Utils diff --git a/SilentPatchSA/SilentPatchSA.cpp b/SilentPatchSA/SilentPatchSA.cpp index fdcda30..9031242 100644 --- a/SilentPatchSA/SilentPatchSA.cpp +++ b/SilentPatchSA/SilentPatchSA.cpp @@ -21,9 +21,9 @@ #include "WaveDecoderSA.h" #include "FLACDecoderSA.h" -#include "Patterns.h" -#include "DelimStringReader.h" -#include "ModuleList.hpp" +#include "Utils/Patterns.h" +#include "Utils/DelimStringReader.h" +#include "Utils/ModuleList.hpp" #include "debugmenu_public.h" #include "resource.h" diff --git a/SilentPatchSA/SilentPatchSA.vcxproj b/SilentPatchSA/SilentPatchSA.vcxproj index ba235bb..918a980 100644 --- a/SilentPatchSA/SilentPatchSA.vcxproj +++ b/SilentPatchSA/SilentPatchSA.vcxproj @@ -186,16 +186,16 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio - - NotUsing - NotUsing - NotUsing - NotUsing NotUsing NotUsing + + NotUsing + NotUsing + NotUsing + @@ -218,19 +218,18 @@ copy /y "$(TargetPath)" "D:\gry\GTA San Andreas clean\scripts\newsteam_r2_lowvio - - - - - + + + + diff --git a/SilentPatchSA/SilentPatchSA.vcxproj.filters b/SilentPatchSA/SilentPatchSA.vcxproj.filters index efabe92..c8e965c 100644 --- a/SilentPatchSA/SilentPatchSA.vcxproj.filters +++ b/SilentPatchSA/SilentPatchSA.vcxproj.filters @@ -19,6 +19,12 @@ {f4ecbe23-228b-461b-b37f-d718e7ca92ae} + + {d46aa122-7a45-44f2-a031-ad8e9b946ed2} + + + {09c5ceab-2ac8-4111-b2d1-d2c7379cb5c1} + @@ -57,9 +63,6 @@ Source Files\decoders - - Source Files - Source Files @@ -72,11 +75,11 @@ Source Files + + Source Files\Utils + - - Header Files - Header Files\FLAC @@ -137,15 +140,9 @@ Source Files\decoders - - Header Files - Header Files - - Header Files - Header Files @@ -155,21 +152,27 @@ Header Files - - Header Files - Header Files Header Files - - Header Files - Header Files + + Header Files\Utils + + + Header Files\Utils + + + Header Files\Utils + + + Header Files\Utils + diff --git a/SilentPatchSA/StdAfxSA.h b/SilentPatchSA/StdAfxSA.h index 4c5d8d0..e15ad29 100644 --- a/SilentPatchSA/StdAfxSA.h +++ b/SilentPatchSA/StdAfxSA.h @@ -17,8 +17,8 @@ #include #include -#include "MemoryMgr.h" -#include "MemoryMgr.GTA.h" +#include "Utils/MemoryMgr.h" +#include "Utils/MemoryMgr.GTA.h" #include "Maths.h" #include "rwutils.hpp" diff --git a/SilentPatchSA/VehicleSA.cpp b/SilentPatchSA/VehicleSA.cpp index 6ad3acd..a10ebc4 100644 --- a/SilentPatchSA/VehicleSA.cpp +++ b/SilentPatchSA/VehicleSA.cpp @@ -6,7 +6,7 @@ #include "VehicleSA.h" #include "TimerSA.h" #include "PedSA.h" -#include "DelimStringReader.h" +#include "Utils/DelimStringReader.h" #include "PlayerInfoSA.h" static constexpr float PHOENIX_FLUTTER_PERIOD = 70.0f; diff --git a/SilentPatchVC/SilentPatchVC.cpp b/SilentPatchVC/SilentPatchVC.cpp index b9bd144..f57abf0 100644 --- a/SilentPatchVC/SilentPatchVC.cpp +++ b/SilentPatchVC/SilentPatchVC.cpp @@ -1,7 +1,7 @@ #include "StdAfx.h" #include "Timer.h" -#include "Patterns.h" +#include "Utils/Patterns.h" #include "Common.h" #include "Common_ddraw.h" #include "General.h" diff --git a/SilentPatchVC/SilentPatchVC.vcxproj b/SilentPatchVC/SilentPatchVC.vcxproj index dace558..18b3770 100644 --- a/SilentPatchVC/SilentPatchVC.vcxproj +++ b/SilentPatchVC/SilentPatchVC.vcxproj @@ -173,12 +173,12 @@ - - - + + + @@ -193,13 +193,13 @@ NotUsing NotUsing - - NotUsing - NotUsing - NotUsing - + + NotUsing + NotUsing + NotUsing + diff --git a/SilentPatchVC/SilentPatchVC.vcxproj.filters b/SilentPatchVC/SilentPatchVC.vcxproj.filters index f650a7f..a7419f1 100644 --- a/SilentPatchVC/SilentPatchVC.vcxproj.filters +++ b/SilentPatchVC/SilentPatchVC.vcxproj.filters @@ -13,11 +13,14 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + {e3c269eb-37ad-4a59-a26c-cb1547484475} + + + {42382fee-b609-4a36-9bef-fa812755d623} + - - Header Files - Header Files @@ -27,9 +30,6 @@ Header Files - - Header Files - Header Files @@ -42,8 +42,14 @@ Header Files - - Header Files + + Header Files\Utils + + + Header Files\Utils + + + Header Files\Utils @@ -56,9 +62,6 @@ Source Files - - Source Files - Source Files @@ -71,6 +74,9 @@ Source Files + + Source Files\Utils +