Skip to content

Commit

Permalink
Flight simulator patches
Browse files Browse the repository at this point in the history
  • Loading branch information
illusion0001 committed Jul 1, 2024
1 parent 321f735 commit 90bda7e
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Windows-Game-Patches-x64.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpiderMan.MilesMorales.Patc
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RDR3.Patches", "source\RDR3.Patches\RDR3.Patches.vcxproj", "{B16DFB29-6876-41F5-961F-E67E1C2E9764}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KittyHawk.Patches", "source\KittyHawk.Patches\KittyHawk.Patches.vcxproj", "{0E5D915F-4905-4496-8024-648E215FC947}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Expand Down Expand Up @@ -307,6 +309,18 @@ Global
{B16DFB29-6876-41F5-961F-E67E1C2E9764}.Release|x64.Build.0 = Release|x64
{B16DFB29-6876-41F5-961F-E67E1C2E9764}.Release|x86.ActiveCfg = Release|x64
{B16DFB29-6876-41F5-961F-E67E1C2E9764}.Release|x86.Build.0 = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|Win32.ActiveCfg = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|Win32.Build.0 = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|x64.ActiveCfg = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|x64.Build.0 = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|x86.ActiveCfg = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Debug|x86.Build.0 = Debug|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|Win32.ActiveCfg = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|Win32.Build.0 = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|x64.ActiveCfg = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|x64.Build.0 = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|x86.ActiveCfg = Release|x64
{0E5D915F-4905-4496-8024-648E215FC947}.Release|x86.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
121 changes: 121 additions & 0 deletions source/KittyHawk.Patches/KittyHawk.Patches.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<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>{0E5D915F-4905-4496-8024-648E215FC947}</ProjectGuid>
<RootNamespace>KittyHawkPatches</RootNamespace>
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
<ProjectName>KittyHawk.Patches</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>ClangCL</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</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|x64'">
<IncludePath>\..\include\;$(IncludePath)</IncludePath>
<TargetExt>.asi</TargetExt>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\$(ProjectName)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<IncludePath>\..\include\;$(IncludePath)</IncludePath>
<TargetExt>.asi</TargetExt>
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\$(ProjectName)\</OutDir>
<IntDir>$(Configuration)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>UNICODE;_UNICODE;_USRDLL</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard_C>Default</LanguageStandard_C>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
</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>false</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>UNICODE;_UNICODE;_USRDLL</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\..\include\;..\..\external\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard_C>Default</LanguageStandard_C>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
<Optimization>Disabled</Optimization>
<EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
</Link>
<PreBuildEvent>
<Command>call $(MSBuildStartupDirectory)\set_git_ver.cmd</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Shared\helper.cpp" />
<ClCompile Include="..\Shared\memory.cpp" />
<ClCompile Include="..\Shared\stdafx.cpp" />
<ClCompile Include="dllmain.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\helper.hpp" />
<ClInclude Include="..\..\include\memory.hpp" />
<ClInclude Include="..\..\include\stdafx.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
38 changes: 38 additions & 0 deletions source/KittyHawk.Patches/KittyHawk.Patches.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?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>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Shared\stdafx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Shared\helper.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Shared\memory.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\include\helper.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\..\include\memory.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
105 changes: 105 additions & 0 deletions source/KittyHawk.Patches/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include "stdafx.h"
#include "helper.hpp"
#include "memory.hpp"
#include "git_ver.h"

HMODULE baseModule{};

#define wstr(s) L#s
#define wxstr(s) wstr(s)
#define PROJECT_NAME "KittyHawk.Patches"

// INI Variables
uint32_t injection_delay{};

void ReadConfig(void)
{
inipp::Ini<wchar_t> ini;
// Initialize config
std::wstring config_path = L"" PROJECT_NAME ".ini";
std::wifstream iniFile(config_path);
if (!iniFile)
{
// no ini, lets generate one.
std::wstring ini_defaults = L"[Settings]\n"
wstr(injection_delay)" = 200\n";
std::wofstream iniFile(config_path);
iniFile << ini_defaults;
injection_delay = 200;
}
else
{
ini.parse(iniFile);
inipp::get_value(ini.sections[L"Settings"], wstr(injection_delay), injection_delay);
}
}

bool CreateConsoleHook2(HWND ConsoleWindow)
{
ShowWindow(ConsoleWindow, 1);
return 1;
}

void __attribute__((naked)) CreateConsoleHookAsm()
{
__asm
{
MOV RCX, qword ptr[RBX + 0xa5d0];
CALL CreateConsoleHook2;
MOV byte ptr[RBX + 0xa4e4], 0x4;
MOV byte ptr[RBX + 0xa6d8], 0x0;
ADD RSP, 0x30;
POP RBX;
RET;
}
}

#define TYPEDEF_FUNCTION_PTR(ret_type, func_name, ...) \
typedef ret_type (*func_name##_ptr)(__VA_ARGS__); \
extern func_name##_ptr func_name;

#define INIT_FUNCTION_PTR(func_name) \
func_name##_ptr func_name = nullptr

void RegisterCustomCmd()
{
}

void DoPatches()
{
WritePatchPattern_Hook(L"c6 83 d8 a6 00 00 00", 14, L"CreateConsoleHook", 0, (void*)&CreateConsoleHookAsm, nullptr);
}

DWORD __stdcall Main(void*)
{
baseModule = GetModuleHandle(NULL);
ReadConfig();
// this isn't particularly reliable
// due to arxan unpacking
// only matters for patch that does its thing during startup
if (injection_delay)
{
Sleep(injection_delay);
}
DoPatches();
return true;
}

BOOL APIENTRY DllMain(HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
CreateThread(NULL, 0, Main, 0, NULL, 0);
}
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

0 comments on commit 90bda7e

Please sign in to comment.