Skip to content

Commit

Permalink
fix(fh5): after update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
szaaamerik committed Mar 28, 2024
1 parent c5cf2d2 commit e430305
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public async Task DisableCrcChecks()
_crcFuncAddress = 0;
CrcFuncDetourAddress = 0;

const string sig = "E8 ? ? ? ? 48 83 C4 ? 5F 5B C3 CC CC CC 48 89";
const string sig = "E8 ? ? ? ? 48 83 C4 ? 5F 5B C3 CC CC CC ? ? ? ? ? ? ? 74 ? ? ? ? ? ? 48";
_crcFuncAddress = await SmartAobScan(sig);

BypassDebug.DebugInfoReports.Add(new DebugInfoReport($"Address: {_crcFuncAddress:X}"));
Expand Down
12 changes: 6 additions & 6 deletions Forza-Mods-AIO/Forza-Mods-AIO/Cheats/ForzaHorizon5/CarCheats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,24 @@ public async Task CheatLocalPlayer()
0xF3, 0x0F, 0x7F, 0x54, 0x24, 0x20, 0xF3, 0x0F, 0x10, 0x4F, 0x20, 0xF3, 0x0F, 0x10, 0x57, 0x28, 0xF3,
0x0F, 0x59, 0xC9, 0xF3, 0x0F, 0x59, 0xD2, 0xF3, 0x0F, 0x58, 0xCA, 0xF3, 0x0F, 0x51, 0xC1, 0xF3, 0x0F,
0x10, 0xC8, 0x68, 0x06, 0x2A, 0x0F, 0x40, 0xF3, 0x0F, 0x59, 0x0C, 0x24, 0x48, 0x83, 0xC4, 0x08, 0x80,
0x3D, 0xC9, 0x01, 0x00, 0x00, 0x01, 0x75, 0x39, 0x81, 0xBF, 0xF8, 0x19, 0x00, 0x00, 0xCD, 0xCC, 0xCC,
0x3D, 0xC9, 0x01, 0x00, 0x00, 0x01, 0x75, 0x39, 0x81, 0xBF, 0xA8, 0x1F, 0x00, 0x00, 0xCD, 0xCC, 0xCC,
0x3D, 0x72, 0x2D, 0x0F, 0x2F, 0x0D, 0xB9, 0x01, 0x00, 0x00, 0x77, 0x24, 0xF3, 0x0F, 0x10, 0x47, 0x20,
0xF3, 0x0F, 0x10, 0x57, 0x28, 0xF3, 0x0F, 0x59, 0x05, 0xA1, 0x01, 0x00, 0x00, 0xF3, 0x0F, 0x59, 0x15,
0x99, 0x01, 0x00, 0x00, 0xF3, 0x0F, 0x11, 0x47, 0x20, 0xF3, 0x0F, 0x11, 0x57, 0x28, 0x80, 0x3D, 0x90,
0x01, 0x00, 0x00, 0x01, 0x75, 0x4C, 0x80, 0xBF, 0x74, 0x12, 0x00, 0x00, 0x00, 0x74, 0x43, 0xC7, 0x05,
0x01, 0x00, 0x00, 0x01, 0x75, 0x4C, 0x80, 0xBF, 0xCC, 0x10, 0x00, 0x00, 0x00, 0x74, 0x43, 0xC7, 0x05,
0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x20, 0x41, 0x0F, 0x2F, 0x0D, 0x79, 0x01, 0x00, 0x00, 0x72, 0x30,
0x81, 0xBF, 0xFC, 0x19, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72, 0x24, 0xF3, 0x0F, 0x10, 0x47, 0x20,
0x81, 0xBF, 0xAC, 0x1F, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72, 0x24, 0xF3, 0x0F, 0x10, 0x47, 0x20,
0xF3, 0x0F, 0x10, 0x57, 0x28, 0xF3, 0x0F, 0x59, 0x05, 0x55, 0x01, 0x00, 0x00, 0xF3, 0x0F, 0x59, 0x15,
0x4D, 0x01, 0x00, 0x00, 0xF3, 0x0F, 0x11, 0x47, 0x20, 0xF3, 0x0F, 0x11, 0x57, 0x28, 0x80, 0x3D, 0x4F,
0x01, 0x00, 0x00, 0x01, 0x75, 0x49, 0x80, 0xBF, 0x74, 0x12, 0x00, 0x00, 0x00, 0x74, 0x40, 0x81, 0xBF,
0xFC, 0x19, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72, 0x34, 0xC7, 0x05, 0x1F, 0x01, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x01, 0x75, 0x49, 0x80, 0xBF, 0xCC, 0x10, 0x00, 0x00, 0x00, 0x74, 0x40, 0x81, 0xBF,
0xAC, 0x1F, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72, 0x34, 0xC7, 0x05, 0x1F, 0x01, 0x00, 0x00, 0x00,
0x00, 0x70, 0x41, 0x0F, 0x2F, 0x0D, 0x18, 0x01, 0x00, 0x00, 0x76, 0x21, 0x48, 0x31, 0xC0, 0x48, 0x31,
0xF6, 0x48, 0x69, 0xC6, 0xC0, 0x0A, 0x00, 0x00, 0xC7, 0x84, 0x38, 0xC0, 0x26, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x48, 0xFF, 0xC6, 0x48, 0x83, 0xFE, 0x03, 0x76, 0xE5, 0x80, 0x3D, 0xF2, 0x00, 0x00, 0x00,
0x01, 0x75, 0x19, 0xF3, 0x0F, 0x10, 0x4F, 0x24, 0xF3, 0x0F, 0x58, 0x0D, 0xE4, 0x00, 0x00, 0x00, 0xF3,
0x0F, 0x11, 0x4F, 0x24, 0xC6, 0x05, 0xD7, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3D, 0xD5, 0x00, 0x00, 0x00,
0x01, 0x0F, 0x85, 0x90, 0x00, 0x00, 0x00, 0x81, 0xBF, 0xC0, 0x26, 0x00, 0x00, 0x00, 0x40, 0x9C, 0x44,
0x0F, 0x87, 0x80, 0x00, 0x00, 0x00, 0x81, 0xBF, 0xF8, 0x19, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72,
0x0F, 0x87, 0x80, 0x00, 0x00, 0x00, 0x81, 0xBF, 0xA8, 0x1F, 0x00, 0x00, 0xCD, 0xCC, 0xCC, 0x3D, 0x72,
0x74, 0xF3, 0x0F, 0x10, 0x05, 0xAD, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x20, 0x41, 0xF3, 0x0F, 0x5E,
0x04, 0x24, 0x48, 0x83, 0xC4, 0x08, 0xF3, 0x0F, 0x10, 0x8F, 0xC0, 0x26, 0x00, 0x00, 0x80, 0x3D, 0x8F,
0x00, 0x00, 0x00, 0x00, 0x75, 0x06, 0xF3, 0x0F, 0x58, 0xC8, 0xEB, 0x28, 0x68, 0x00, 0x00, 0xC8, 0x42,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public async Task CheatRemoveBuildCap()
return;
}

ShowError("Unbreakable skill score", sig);
ShowError("Remove build cap", sig);
}

public void Cleanup()
Expand Down
19 changes: 12 additions & 7 deletions Forza-Mods-AIO/Forza-Mods-AIO/Cheats/ForzaHorizon5/Sql.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Forza_Mods_AIO.Resources;
using Memory.Types;
using static Forza_Mods_AIO.Resources.Memory;

namespace Forza_Mods_AIO.Cheats.ForzaHorizon5;

Expand All @@ -19,9 +20,9 @@ public async Task SqlExecAobScan()
if (CDatabaseAddress > 0)
{
var relativeAddress = CDatabaseAddress + 0x6 + 0x3;
var relative = Resources.Memory.GetInstance().ReadMemory<int>(relativeAddress);
var relative = GetInstance().ReadMemory<int>(relativeAddress);
var pCDataBaseAddress = CDatabaseAddress + (nuint)relative + 0x6 + 0x7;
_ptr = Resources.Memory.GetInstance().ReadMemory<nuint>(pCDataBaseAddress);
_ptr = GetInstance().ReadMemory<nuint>(pCDataBaseAddress);
return;
}

Expand All @@ -31,7 +32,7 @@ public async Task SqlExecAobScan()
private static nuint GetVirtualFunctionPtr(nuint ptr, int index)
{
var pVtableBytes = new byte[8];
var procHandle = Resources.Memory.GetInstance().MProc.Handle;
var procHandle = GetInstance().MProc.Handle;
Imps.ReadProcessMemory(procHandle, ptr, pVtableBytes, (nuint)pVtableBytes.Length, nint.Zero);

var pVtable = (nuint)BitConverter.ToInt64(pVtableBytes, 0);
Expand All @@ -43,7 +44,8 @@ private static nuint GetVirtualFunctionPtr(nuint ptr, int index)

public Task Query(string command)
{
var procHandle = Resources.Memory.GetInstance().MProc.Handle;
var memory = GetInstance();
var procHandle = memory.MProc.Handle;

var rcx = _ptr;
const int virtualFunctionIndex = 9;
Expand All @@ -62,11 +64,14 @@ public Task Query(string command)
r8Bytes[7], 0xFF, 0x25, 0x00, 0x00, 0x00, 0x00, callBytes[0], callBytes[1], callBytes[2], callBytes[3],
callBytes[4], callBytes[5], callBytes[6], callBytes[7]
];

Resources.Memory.GetInstance().WriteStringMemory(r8, command + "\0");
Resources.Memory.GetInstance().WriteArrayMemory(shellCodeAddress, shellCode);

memory.WriteStringMemory(r8, command + "\0");
memory.WriteArrayMemory(shellCodeAddress, shellCode);
memory.WriteArrayMemory(callFunction + 41, new byte[] { 0xE9, 0xB6, 0x00, 0x00, 0x00, 0x90 });
var thread = Imports.CreateRemoteThread(procHandle, 0, 0, shellCodeAddress, rcx, 0, out _);
_ = Imports.WaitForSingleObject(thread, int.MaxValue);
Imports.CloseHandle(thread);
memory.WriteArrayMemory(callFunction + 41, new byte[] { 0x0F, 0x85, 0xB5, 0x00, 0x00, 0x00 });
Free(shellCodeAddress);
Free(r8);
Free(rdx);
Expand Down
90 changes: 45 additions & 45 deletions Forza-Mods-AIO/Forza-Mods-AIO/Forza-Mods-AIO.csproj
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Forza_Mods_AIO</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<Company>WPF-Mockup</Company>
<Product>WPF-Mockup</Product>
<AssemblyTitle>WPF-Mockup</AssemblyTitle>
<IsPackable>false</IsPackable>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>AIO.snk</AssemblyOriginatorKeyFile>
<PublicSign>true</PublicSign>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="Memory">
<HintPath>Resources\External\Memory.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<RootNamespace>Forza_Mods_AIO</RootNamespace>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<Company>05f4b3f8-c3a5-4e39-8053-b3e9b8dea19e</Company>
<Product>3e9b38ef-ff4a-40cc-8fcb-17e5f57be01b</Product>
<AssemblyTitle>c4b6aec6-f89e-4586-948a-4da13e37426c</AssemblyTitle>
<IsPackable>false</IsPackable>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>AIO.snk</AssemblyOriginatorKeyFile>
<PublicSign>true</PublicSign>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>portable</DebugType>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="Memory">
<HintPath>Resources\External\Memory.dll</HintPath>
</Reference>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Forza_Mods_AIO.Cheats.ForzaHorizon5;
using static Forza_Mods_AIO.Resources.Cheats;

namespace Forza_Mods_AIO.ViewModels.Pages;

Expand All @@ -9,7 +10,7 @@ public partial class AutoshowViewModel : ObservableObject
[ObservableProperty]
private bool _uiElementsEnabled = true;

private static Sql SqlFh5 => Resources.Cheats.GetClass<Sql>();
private static Sql SqlFh5 => GetClass<Sql>();


[RelayCommand]
Expand All @@ -21,6 +22,16 @@ private async Task ExecuteSql(object parameter)
}

UiElementsEnabled = false;
if (GetClass<Bypass>().CrcFuncDetourAddress == 0)
{
await GetClass<Bypass>().DisableCrcChecks();
}

if (GetClass<Bypass>().CrcFuncDetourAddress == 0)
{
goto SkipQuerying;
}

if (SqlFh5.CDatabaseAddress == 0)
{
await SqlFh5.SqlExecAobScan();
Expand Down

0 comments on commit e430305

Please sign in to comment.