Skip to content

Commit

Permalink
fix stuff and add gravity and accel anti protection
Browse files Browse the repository at this point in the history
  • Loading branch information
szaaamerik committed Jan 7, 2024
1 parent a579969 commit 4888cab
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
16 changes: 15 additions & 1 deletion Forza-Mods-AIO/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ private void IsAttached()

const string name = "Forza Motorsport 8";
GvpMaker(name);
ToggleButtons(true);
Dispatcher.Invoke(() =>
{
Self_Vehicle.IsEnabled = true;
Self_Vehicle.Foreground = Brushes.White;
CarSports.Fill = Brushes.White;
});
Attached = true;
}
else
Expand Down Expand Up @@ -513,7 +518,16 @@ private void RevertWrites()
? new byte[] { 0x8B, 0x89, 0x88, 0x00, 0x00, 0x00 }
: new byte[] { 0x8B, 0x89, 0xC0, 0x00, 0x00, 0x00 });
}

if (GravityProtectAddr > (UIntPtr)Gvp.Process.MainModule.BaseAddress)
{
Mw.M.WriteArrayMemory(GravityProtectAddr,new byte[] { 0xF3, 0x0F, 0x11, 0x49, 0x08 });
}

if (AccelProtectAddr > (UIntPtr)Gvp.Process.MainModule.BaseAddress)
{
Mw.M.WriteArrayMemory(AccelProtectAddr,new byte[] { 0xF3, 0x0F, 0x11, 0x41, 0x0C });
}
}
#endregion

Expand Down
4 changes: 2 additions & 2 deletions Forza-Mods-AIO/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
// Minor Version - Default number
// Revision - Last release revision + 1
// Build Number - Number of commits since last release
[assembly: AssemblyVersion("2.0.4.2")]
[assembly: AssemblyFileVersion("2.0.4.2")]
[assembly: AssemblyVersion("2.0.5.8")]
[assembly: AssemblyFileVersion("2.0.5.8")]
9 changes: 9 additions & 0 deletions Forza-Mods-AIO/Tabs/Self-Vehicle/Entities/CarEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ public static async void Hook()

var replace = Mw.Gvp.Name.Contains('8') ? 7 : 8;
BaseDetour.Setup(BaseAddrHook, orig, baseDetourBytes, replace, true, 0, true);

if (!Mw.Gvp.Name.Contains('8'))
{
return;
}

Bypass.AddProtectAddress(GravityProtectAddr);
Mw.M.WriteArrayMemory(GravityProtectAddr, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 });
Mw.M.WriteArrayMemory(AccelProtectAddr, new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90 });
}

var taskCompletionSource = new TaskCompletionSource<bool>();
Expand Down
14 changes: 10 additions & 4 deletions Forza-Mods-AIO/Tabs/Self-Vehicle/Self-Vehicle-Addrs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private static void FM8_Scan()
}

Sv.UiManager.Index = 0;
Sv.UiManager.ScanAmount = 5;
Sv.UiManager.ScanAmount = 2;

const string massProtectSig = "74 ? F3 0F ? ? 0F 29";
var massProtectAddresses = Mw.M.ScanForSig(massProtectSig);
Expand All @@ -97,9 +97,15 @@ private static void FM8_Scan()
const string baseAddrSig = "0F 2F ? ? ? ? ? 72 ? 0F 2F ? ? ? ? ? 72 ? 33 DB";
BaseAddrHook = Mw.M.ScanForSig(baseAddrSig).FirstOrDefault();
Sv.UiManager.AddProgress();

SelfVehicleOption.IsEnabled = true;
Sv.UiManager.ToggleUiElements(true);

Sv.Dispatcher.Invoke(() =>
{
Sv.HandlingButton.IsEnabled = true;
Shp.CarNoclipSwitch.IsEnabled = false;
Shp.WallNoclipSwitch.IsEnabled = false;
Shp.WaterDragSwitch.IsEnabled = false;
Shp.SuperCarSwitch.IsEnabled = false;
});
}

#region FH5 Scan
Expand Down

0 comments on commit 4888cab

Please sign in to comment.