Skip to content

Commit

Permalink
#2: Update Dakar Desert Rally trainer for game version 2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Aldaviva committed Feb 22, 2024
1 parent 14773a4 commit 24983c9
Show file tree
Hide file tree
Showing 21 changed files with 97 additions and 76 deletions.
4 changes: 2 additions & 2 deletions Dakar18Trainer/Cheats/NoSpeedLimitCheat.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#nullable enable

using System.Windows.Forms;
using Gma.System.MouseKeyHook;
using System.Windows.Forms;
using TrainerCommon.Cheats;
using TrainerCommon.Trainer;

namespace Dakar18Trainer.Cheats;

public class NoSpeedLimitCheat: BaseCheat {

private static readonly int[] SPEED_LIMIT_OFFSETS = { 0x04194850, 0x28, 0x1A0, 0x1B0, 0xA0, 0x20, 0x20, 0x830, 0x3A8 };
private static readonly int[] SPEED_LIMIT_OFFSETS = [0x04194850, 0x28, 0x1A0, 0x1B0, 0xA0, 0x20, 0x20, 0x830, 0x3A8];

public override string name { get; } = "No speed limit";

Expand Down
5 changes: 4 additions & 1 deletion Dakar18Trainer/Dakar18Trainer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<ItemGroup>
<None Include="app.manifest" />
<None Include="App\App.config" />
<None Include="packages.lock.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TrainerCommon\TrainerCommon.csproj">
Expand All @@ -85,7 +86,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ILRepack.Lib.MSBuild.Task">
<Version>2.0.18.2</Version>
<Version>2.0.26</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup />
Expand Down
8 changes: 4 additions & 4 deletions Dakar18Trainer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;

Expand All @@ -7,7 +7,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ben Hutchison")]
[assembly: AssemblyProduct("Dakar 18 v.13 +1 Trainer by Ben")]
[assembly: AssemblyCopyright(2023 Ben Hutchison")]
[assembly: AssemblyCopyright(2024 Ben Hutchison")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -18,5 +18,5 @@
ResourceDictionaryLocation.SourceAssembly
)]

[assembly: AssemblyVersion("1.0.8.0")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
12 changes: 6 additions & 6 deletions Dakar18Trainer/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
".NETFramework,Version=v4.7.2": {
"ILRepack.Lib.MSBuild.Task": {
"type": "Direct",
"requested": "[2.0.18.2, )",
"resolved": "2.0.18.2",
"contentHash": "lreK19MMDA/ekeqjLY4w171cG7+pHwjeTMHMNq6tghuhTOIOfHT+b/LTMj5jpfbJoR7J6AMD3yOYZoyY/2wtJA=="
"requested": "[2.0.26, )",
"resolved": "2.0.26",
"contentHash": "dSvyqVB6qs/PqSWXMRZ5da2Vm1Tz25xcMlA1AdvS9++ORFhBb3nBTOfolf3oUGgAcBH1LPLo948/GWjcVmNdMQ=="
},
"DarkNet": {
"type": "Transitive",
Expand All @@ -20,8 +20,8 @@
},
"McMaster.Extensions.CommandLineUtils": {
"type": "Transitive",
"resolved": "4.1.0",
"contentHash": "NfWFfSV/y5kiau70GDm5eUl6VKF3y2/O5yz//gsV7q+3hreQ8ViB/9VYBC5LykcCYXl5181Vg+OLT/I7fHbxoQ==",
"resolved": "4.1.1",
"contentHash": "zxgDY+G5yVq2q8sVB3Z275Qkxed1jC95nwAfnlSyoG4l5Nicvd4+ke1jXusEZEfyuErlAgXCKS937c13FmZWBg==",
"dependencies": {
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0",
"System.ValueTuple": "4.5.0"
Expand All @@ -47,7 +47,7 @@
"dependencies": {
"DarkNet": "[2.3.0, )",
"KoKo": "[2.2.0, )",
"McMaster.Extensions.CommandLineUtils": "[4.1.0, )",
"McMaster.Extensions.CommandLineUtils": "[4.1.1, )",
"MouseKeyHook": "[5.7.1, )"
}
}
Expand Down
14 changes: 9 additions & 5 deletions DakarDesertRallyTrainer/Cheats/NoDamageCheat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

using DakarDesertRallyTrainer.Games;
using Gma.System.MouseKeyHook;
using System;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TrainerCommon.Cheats;
Expand All @@ -15,21 +15,25 @@ public class NoDamageCheat: BaseCheat {
private const string DISABLED_MEMORY_VALUE = "bBanGetMechDamage"; // defaults to "bCanGetMechDamage"

private static readonly Encoding ENCODING = new ASCIIEncoding();
private static readonly int[] DAMAGE_OFFSETS_1_9_0 = { 0x59a8c40, 0x1edde };
private static readonly int[] DAMAGE_OFFSETS_2_3_0 = [0x5b8f810, 0x19aae];
private static readonly int[] DAMAGE_OFFSETS_1_9_0 = [0x59a8c40, 0x1edde];

public override string name { get; } = "No damage";

public override Combination keyboardShortcut { get; } = Combination.TriggeredBy(Keys.D).Control().Alt();

protected override void apply(ProcessHandle processHandle, string gameVersionCode) {
int[] damageOffsets = gameVersionCode switch {
DakarDesertRally.Versions.V2_3_0 => DAMAGE_OFFSETS_2_3_0,
DakarDesertRally.Versions.V1_9_0 => DAMAGE_OFFSETS_1_9_0,
_ => Array.Empty<int>()
_ => []
};

IndirectMemoryAddress damageAddress = new(processHandle, null, damageOffsets);
if (damageOffsets.Any()) {
IndirectMemoryAddress damageAddress = new(processHandle, null, damageOffsets);

MemoryEditor.writeToProcessMemory(processHandle, damageAddress, DISABLED_MEMORY_VALUE, ENCODING);
MemoryEditor.writeToProcessMemory(processHandle, damageAddress, DISABLED_MEMORY_VALUE, ENCODING);
}
}

}
35 changes: 20 additions & 15 deletions DakarDesertRallyTrainer/Cheats/NoSpeedLimitCheat.cs
Original file line number Diff line number Diff line change
@@ -1,44 +1,49 @@
#nullable enable

using System;
using System.Windows.Forms;
using DakarDesertRallyTrainer.Games;
using Gma.System.MouseKeyHook;
using System.Linq;
using System.Windows.Forms;
using TrainerCommon.Cheats;
using TrainerCommon.Trainer;

namespace DakarDesertRallyTrainer.Cheats;

public class NoSpeedLimitCheat: BaseCheat {

private static readonly int[] SPEED_LIMIT_OFFSETS_1_9_0 = { 0x5589060, 0x10, 0xF0, 0x30C };
private static readonly int[] SPEED_LIMIT_OFFSETS_1_7_0 = { 0x55BECA0, 0x10, 0xF0, 0x30C };
private static readonly int[] SPEED_LIMIT_OFFSETS_1_6_0 = { 0x555A7B0, 0x10, 0xF0, 0x30C };
private static readonly int[] SPEED_LIMIT_OFFSETS_1_5_0 = { 0x57C3550, 0x10, 0xF0, 0x30C };
private static readonly int[] SPEED_LIMIT_OFFSETS_2_3_0 = [0x5854530, 0x10, 0xF0, 0x30C];
private static readonly int[] SPEED_LIMIT_OFFSETS_1_9_0 = [0x5589060, 0x10, 0xF0, 0x30C];
private static readonly int[] SPEED_LIMIT_OFFSETS_1_7_0 = [0x55BECA0, 0x10, 0xF0, 0x30C];
private static readonly int[] SPEED_LIMIT_OFFSETS_1_6_0 = [0x555A7B0, 0x10, 0xF0, 0x30C];
private static readonly int[] SPEED_LIMIT_OFFSETS_1_5_0 = [0x57C3550, 0x10, 0xF0, 0x30C];

private static readonly int[] BANNER_OFFSETS_1_9_0 = { 0x5B200B8, 0x3B0, 0x10, 0x7F0, 0x658, 0x364 };
private static readonly int[] BANNER_OFFSETS_1_7_0 = { 0x5B5DC38, 0x3B0, 0x10, 0x7F0, 0x658, 0x364 };
private static readonly int[] BANNER_OFFSETS_1_6_0 = { 0x5AF6638, 0x3B0, 0x10, 0x7F0, 0x658, 0x364 };
private static readonly int[] BANNER_OFFSETS_1_5_0 = { 0x5C62C80, 0x30, 0x2B0, 0x408, 0x658, 0x364 };
private static readonly int[] BANNER_OFFSETS_2_3_0 = [0x5CEE8E0, 0x30, 0x2B0, 0x3F0, 0x670, 0x364];
private static readonly int[] BANNER_OFFSETS_1_9_0 = [0x5B200B8, 0x3B0, 0x10, 0x7F0, 0x658, 0x364];
private static readonly int[] BANNER_OFFSETS_1_7_0 = [0x5B5DC38, 0x3B0, 0x10, 0x7F0, 0x658, 0x364];
private static readonly int[] BANNER_OFFSETS_1_6_0 = [0x5AF6638, 0x3B0, 0x10, 0x7F0, 0x658, 0x364];
private static readonly int[] BANNER_OFFSETS_1_5_0 = [0x5C62C80, 0x30, 0x2B0, 0x408, 0x658, 0x364];

public override string name { get; } = "No speed limit";

public override Combination keyboardShortcut { get; } = Combination.TriggeredBy(Keys.L).Control().Alt();

protected override void apply(ProcessHandle processHandle, string gameVersionCode) {
(int[] speedLimitOffsets, int[] bannerOffsets) = gameVersionCode switch {
DakarDesertRally.Versions.V2_3_0 => (SPEED_LIMIT_OFFSETS_2_3_0, BANNER_OFFSETS_2_3_0),
DakarDesertRally.Versions.V1_9_0 => (SPEED_LIMIT_OFFSETS_1_9_0, BANNER_OFFSETS_1_9_0),
DakarDesertRally.Versions.V1_7_0 => (SPEED_LIMIT_OFFSETS_1_7_0, BANNER_OFFSETS_1_7_0),
DakarDesertRally.Versions.V1_6_0 => (SPEED_LIMIT_OFFSETS_1_6_0, BANNER_OFFSETS_1_6_0),
DakarDesertRally.Versions.V1_5_0 => (SPEED_LIMIT_OFFSETS_1_5_0, BANNER_OFFSETS_1_5_0),
_ => (Array.Empty<int>(), Array.Empty<int>())
_ => ([], [])
};

IndirectMemoryAddress speedLimitAddress = new(processHandle, null, speedLimitOffsets);
IndirectMemoryAddress bannerAddress = new(processHandle, null, bannerOffsets);
if (speedLimitOffsets.Any()) {
IndirectMemoryAddress speedLimitAddress = new(processHandle, null, speedLimitOffsets);
IndirectMemoryAddress bannerAddress = new(processHandle, null, bannerOffsets);

MemoryEditor.writeToProcessMemory(processHandle, speedLimitAddress, 9999);
MemoryEditor.writeToProcessMemory(processHandle, bannerAddress, 9999);
MemoryEditor.writeToProcessMemory(processHandle, speedLimitAddress, 9999);
MemoryEditor.writeToProcessMemory(processHandle, bannerAddress, 9999);
}
}

}
5 changes: 4 additions & 1 deletion DakarDesertRallyTrainer/DakarDesertRallyTrainer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,13 @@
<ItemGroup>
<None Include="app.manifest" />
<None Include="App\App.config" />
<None Include="packages.lock.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ILRepack.Lib.MSBuild.Task">
<Version>2.0.18.2</Version>
<Version>2.0.26</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
9 changes: 6 additions & 3 deletions DakarDesertRallyTrainer/Games/DakarDesertRally.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ public class DakarDesertRally: BaseGame {

public override string name { get; } = "Dakar Desert Rally";
public override string processName { get; } = "Dakar2Game-Win64-Shipping";
public override string supportedVersion { get; } = "1.5.0\u20131.9.0";
public override string supportedVersion { get; } = "1.5.0\u20132.3.0";

public override ICollection<Cheat> cheats { get; } = new List<Cheat> {
public override ICollection<Cheat> cheats { get; } = [
new NoSpeedLimitCheat(),
new NoDamageCheat()
};
];

public override string? getVersion(string executableSha256Hash) => executableSha256Hash switch {
VersionSha256Hashes.V2_3_0 => Versions.V2_3_0,
VersionSha256Hashes.V1_9_0 => Versions.V1_9_0,
VersionSha256Hashes.V1_7_0 => Versions.V1_7_0,
VersionSha256Hashes.V1_6_0 => Versions.V1_6_0,
Expand All @@ -28,6 +29,7 @@ public class DakarDesertRally: BaseGame {

public static class Versions {

public const string V2_3_0 = "2.3.0";
public const string V1_9_0 = "1.9.0";
public const string V1_7_0 = "1.7.0";
public const string V1_6_0 = "1.6.0";
Expand All @@ -37,6 +39,7 @@ public static class Versions {

private static class VersionSha256Hashes {

public const string V2_3_0 = "b608ec0671207e8883b1bc0221cbbfe25b8a015adc1ddc645d34d6635ef21263";
public const string V1_9_0 = "9781f5d4af4a7ba45b9b5f179589fd06c7ebe84ae5cc8cf05fbd31ab538b5e1d";
public const string V1_7_0 = "b3ebb61fef5dc643f6eb165e409a5c426d861d49bb990b5086b6b599534109b1";
public const string V1_6_0 = "b3e1317208674b47ef4f651c1198057830ad209cf99ba717d74ede333ea10696";
Expand Down
14 changes: 7 additions & 7 deletions DakarDesertRallyTrainer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;

[assembly: AssemblyTitle("Dakar Desert Rally 1.5.0–1.9.0 +2 Trainer by Ben")]
[assembly: AssemblyDescription("Dakar Desert Rally 1.5.0–1.9.0 +2 Trainer by Ben")]
[assembly: AssemblyTitle("Dakar Desert Rally 1.5.0–2.3.0 +2 Trainer by Ben")]
[assembly: AssemblyDescription("Dakar Desert Rally 1.5.0–2.3.0 +2 Trainer by Ben")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ben Hutchison")]
[assembly: AssemblyProduct("Dakar Desert Rally 1.5.0–1.9.0 +2 Trainer by Ben")]
[assembly: AssemblyCopyright(2023 Ben Hutchison")]
[assembly: AssemblyProduct("Dakar Desert Rally 1.5.0–2.3.0 +2 Trainer by Ben")]
[assembly: AssemblyCopyright(2024 Ben Hutchison")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -18,5 +18,5 @@
ResourceDictionaryLocation.SourceAssembly
)]

[assembly: AssemblyVersion("1.0.8.0")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
2 changes: 1 addition & 1 deletion DakarDesertRallyTrainer/app.manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<assemblyIdentity version="1.0.0.0" name="DakarDesertRallyTrainer"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
Expand Down
12 changes: 6 additions & 6 deletions DakarDesertRallyTrainer/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
".NETFramework,Version=v4.7.2": {
"ILRepack.Lib.MSBuild.Task": {
"type": "Direct",
"requested": "[2.0.18.2, )",
"resolved": "2.0.18.2",
"contentHash": "lreK19MMDA/ekeqjLY4w171cG7+pHwjeTMHMNq6tghuhTOIOfHT+b/LTMj5jpfbJoR7J6AMD3yOYZoyY/2wtJA=="
"requested": "[2.0.26, )",
"resolved": "2.0.26",
"contentHash": "dSvyqVB6qs/PqSWXMRZ5da2Vm1Tz25xcMlA1AdvS9++ORFhBb3nBTOfolf3oUGgAcBH1LPLo948/GWjcVmNdMQ=="
},
"DarkNet": {
"type": "Transitive",
Expand All @@ -20,8 +20,8 @@
},
"McMaster.Extensions.CommandLineUtils": {
"type": "Transitive",
"resolved": "4.1.0",
"contentHash": "NfWFfSV/y5kiau70GDm5eUl6VKF3y2/O5yz//gsV7q+3hreQ8ViB/9VYBC5LykcCYXl5181Vg+OLT/I7fHbxoQ==",
"resolved": "4.1.1",
"contentHash": "zxgDY+G5yVq2q8sVB3Z275Qkxed1jC95nwAfnlSyoG4l5Nicvd4+ke1jXusEZEfyuErlAgXCKS937c13FmZWBg==",
"dependencies": {
"System.Runtime.InteropServices.RuntimeInformation": "4.3.0",
"System.ValueTuple": "4.5.0"
Expand All @@ -47,7 +47,7 @@
"dependencies": {
"DarkNet": "[2.3.0, )",
"KoKo": "[2.2.0, )",
"McMaster.Extensions.CommandLineUtils": "[4.1.0, )",
"McMaster.Extensions.CommandLineUtils": "[4.1.1, )",
"MouseKeyHook": "[5.7.1, )"
}
}
Expand Down
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Trainers
#### Supported game versions
- [**2.3.0**](https://store.steampowered.com/news/app/1839940/view/4027975938511238388), released on February 12, 2024, which has build number `13351034`. This version fixed a crash and bike audio. It is a hotfix for the [USA Tour update](https://store.steampowered.com/news/app/1839940/view/6715496576543059671) from January 15, 2024.
- [**1.9.0**](https://store.steampowered.com/news/app/1839940/view/6466647949833257321), released on April 13, 2023, which has build number `10880370`. This version introduced the Classic Vehicle Pack #1 add-on.
- [**1.7.0**](https://store.steampowered.com/news/app/1839940/view/3654145459652107245), released on February 28, 2023, which has build number `10618159`. This version introduced the SnowRunner Truck Pack add-on.
- [**1.6.0**](https://store.steampowered.com/news/app/1839940/view/3644009189553404411), released on January 20, 2023, which has build number `10366290`. This version introduced the Free Roam game mode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#nullable enable

using Gma.System.MouseKeyHook;
using System.Diagnostics;
using System.Windows.Forms;
using Gma.System.MouseKeyHook;
using TrainerCommon.Cheats;
using TrainerCommon.Trainer;

Expand All @@ -12,8 +12,8 @@ public class InfiniteHealthCheat: BaseCheat {

private const string MODULE_NAME = "UnityPlayer.dll";

private static readonly int[] CURRENT_HEARTS_OFFSETS = { 0x01079274, 0x74, 0x40, 0xA8, 0x4, 0xC, 0x10, 0x10, 0x2C };
private static readonly int[] MAX_HEARTS_OFFSETS = { 0x01079274, 0x74, 0x40, 0xA8, 0x4, 0xC, 0x10, 0x10, 0x20 };
private static readonly int[] CURRENT_HEARTS_OFFSETS = [0x01079274, 0x74, 0x40, 0xA8, 0x4, 0xC, 0x10, 0x10, 0x2C];
private static readonly int[] MAX_HEARTS_OFFSETS = [0x01079274, 0x74, 0x40, 0xA8, 0x4, 0xC, 0x10, 0x10, 0x20];

public override string name { get; } = "Infinite health";

Expand Down
8 changes: 4 additions & 4 deletions SuperhotMindControlDeleteTrainer/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;

Expand All @@ -7,7 +7,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ben Hutchison")]
[assembly: AssemblyProduct("Superhot: Mind Control Delete 1.0.0 +1 Trainer by Ben")]
[assembly: AssemblyCopyright(2023 Ben Hutchison")]
[assembly: AssemblyCopyright(2024 Ben Hutchison")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -18,5 +18,5 @@
ResourceDictionaryLocation.SourceAssembly
)]

[assembly: AssemblyVersion("1.0.8.0")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyVersion("1.0.9.0")]
[assembly: AssemblyFileVersion("1.0.9.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,16 @@
<ItemGroup>
<None Include="app.manifest" />
<None Include="App\App.config" />
<None Include="packages.lock.json" />
</ItemGroup>
<ItemGroup>
<Resource Include="App\shmcd.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ILRepack.Lib.MSBuild.Task">
<Version>2.0.18.2</Version>
<Version>2.0.26</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
Loading

0 comments on commit 24983c9

Please sign in to comment.