Skip to content

Commit

Permalink
v12.9 update
Browse files Browse the repository at this point in the history
  • Loading branch information
argonlefou committed Jul 22, 2024
1 parent 1da986e commit b549fa4
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 31 deletions.
87 changes: 60 additions & 27 deletions DemulShooter/Games/Game_Re2Transformers2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Game_Re2Transformers2 : Game
private InjectionStruct _Buttons_InjectionStruct = new InjectionStruct(0x000F787F, 5);
private InjectionStruct _NoCrosshair_InjectionStruct = new InjectionStruct(0x000F6DB0, 5);
private InjectionStruct _FixCrosshair_InjectionStruct = new InjectionStruct(0x000F6DB5, 7);
private InjectionStruct _FixEnnemyTarget_InjectionStruct = new InjectionStruct(0x004EEF9D, 5);
private InjectionStruct _Credits_InjectionStruct = new InjectionStruct(0x00240BCB, 5);
private InjectionStruct _StartLamps_InjectionStruct = new InjectionStruct(0x00067159, 5);
private InjectionStruct _GunLamps_InjectionStruct = new InjectionStruct(0x000FC124, 5);
Expand Down Expand Up @@ -202,6 +203,7 @@ private void SetHack()
SetHack_Buttons();
SetHack_Credits();
SetHack_CorrectReticlePosition();
SetHack_CorrectEnnemyTarget();

Logger.WriteLog("Memory Hack complete !");
Logger.WriteLog("-");
Expand Down Expand Up @@ -288,6 +290,7 @@ private void SetHack_Axis()

/// <summary>
/// Ath the end of the CGun::MainProc we are overwritting buttons values with data read on our custom Databank
/// Looks like putting 1 in the Button_On byte is not necesary for gameplay (autofire still on) and causes repeated inputs on Name entry screen
/// </summary>
private void SetHack_Buttons()
{
Expand All @@ -298,7 +301,7 @@ private void SetHack_Buttons()

//push edi
CaveMemory.Write_StrBytes("57");
//shl ebx, 4
//shl ebx, 2
CaveMemory.Write_StrBytes("C1 E3 02");

//mov eax, _P1_TriggerPress_Address
Expand All @@ -310,17 +313,16 @@ private void SetHack_Buttons()
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+08],edi
CaveMemory.Write_StrBytes("89 7E 08");
//mov [eax], 0
//CaveMemory.Write_StrBytes("C7 00 00 00 00 00");
//mov eax, _P1_TriggerOn_Address
CaveMemory.Write_StrBytes("B8");
CaveMemory.Write_Bytes(BitConverter.GetBytes(_P1_TriggerOn_Address));
//add eax, ebx
CaveMemory.Write_StrBytes("01 D8");
//mov edi, [eax]
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+0C],edi
CaveMemory.Write_StrBytes("89 7E 0C");

////mov eax, _P1_TriggerOn_Address
//CaveMemory.Write_StrBytes("B8");
//CaveMemory.Write_Bytes(BitConverter.GetBytes(_P1_TriggerOn_Address));
////add eax, ebx
//CaveMemory.Write_StrBytes("01 D8");
////mov edi, [eax]
//CaveMemory.Write_StrBytes("8B 38");
////mov [esi+0C],edi
//CaveMemory.Write_StrBytes("89 7E 0C");

//mov eax, _P1_StartPress_Address
CaveMemory.Write_StrBytes("B8");
Expand All @@ -331,17 +333,16 @@ private void SetHack_Buttons()
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+28],edi
CaveMemory.Write_StrBytes("89 7E 28");
//mov [eax], 0
//CaveMemory.Write_StrBytes("C7 00 00 00 00 00");
//mov eax, _P1_StartOn_Address
CaveMemory.Write_StrBytes("B8");
CaveMemory.Write_Bytes(BitConverter.GetBytes(_P1_StartOn_Address));
//add eax, ebx
CaveMemory.Write_StrBytes("01 D8");
//mov edi, [eax]
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+2C],edi
CaveMemory.Write_StrBytes("89 7E 2C");

////mov eax, _P1_StartOn_Address
//CaveMemory.Write_StrBytes("B8");
//CaveMemory.Write_Bytes(BitConverter.GetBytes(_P1_StartOn_Address));
////add eax, ebx
//CaveMemory.Write_StrBytes("01 D8");
////mov edi, [eax]
//CaveMemory.Write_StrBytes("8B 38");
////mov [esi+2C],edi
//CaveMemory.Write_StrBytes("89 7E 2C");

//mov eax, _LeverFrontPress_Address
CaveMemory.Write_StrBytes("B8");
Expand All @@ -350,8 +351,7 @@ private void SetHack_Buttons()
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+30],edi
CaveMemory.Write_StrBytes("89 7E 30");
//mov [eax], 0
//CaveMemory.Write_StrBytes("C7 00 00 00 00 00");

//mov eax, _LeverFrontOn_Address
CaveMemory.Write_StrBytes("B8");
CaveMemory.Write_Bytes(BitConverter.GetBytes(_LeverFrontOn_Address));
Expand All @@ -367,8 +367,7 @@ private void SetHack_Buttons()
CaveMemory.Write_StrBytes("8B 38");
//mov [esi+38],edi
CaveMemory.Write_StrBytes("89 7E 38");
//mov [eax], 0
//CaveMemory.Write_StrBytes("C7 00 00 00 00 00");

//mov eax, _LeverBackOn_Address
CaveMemory.Write_StrBytes("B8");
CaveMemory.Write_Bytes(BitConverter.GetBytes(_LeverBackOn_Address));
Expand Down Expand Up @@ -447,6 +446,40 @@ private void SetHack_CorrectReticlePosition()
CaveMemory.InjectToOffset(_FixCrosshair_InjectionStruct, "FixCrosshair");
}

/// <summary>
/// On a different resolution than 1920x1080, ennemy targets on screen are mislocated
/// The game is measuring window width and window height but even with this, it's buggy
/// Forcing window dimension to 1920p fix the issue (strangely ?)
/// For that, the game calls to get center values
/// Then the game calls for WindowSize
/// = Forcing Center and max values
/// </summary>
private void SetHack_CorrectEnnemyTarget()
{
Codecave CaveMemory = new Codecave(_TargetProcess, _TargetProcess.MainModule.BaseAddress);
CaveMemory.Open();
CaveMemory.Alloc(0x800);
List<Byte> Buffer = new List<Byte>();

//mov [ebp-4], 44700000
CaveMemory.Write_StrBytes("C7 45 FC 00 00 70 44");

//mov [ebp-8], 44070000
CaveMemory.Write_StrBytes("C7 45 F8 00 00 07 44");

//mov [ebp-18], 44870000
CaveMemory.Write_StrBytes("C7 45 E8 00 00 87 44");

//mov [ebp-10], 44f00000
CaveMemory.Write_StrBytes("C7 45 F0 00 00 F0 44");

//movss xmm0,[ebp-18]
CaveMemory.Write_StrBytes("F3 0F 10 45 E8");

//Inject it
CaveMemory.InjectToOffset(_FixEnnemyTarget_InjectionStruct, "FixEnnemyTarget");
}

/// <summary>
///
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion DemulShooter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("12.8.0.0")]
[assembly: AssemblyVersion("12.9.0.0")]
4 changes: 2 additions & 2 deletions DemulShooterX64/Games/Game_UnisElevatorActionInvasion.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using DsCore;
using DsCore.Config;
using DsCore.MameOutput;
using DsCore.MemoryX64;
using DsCore.RawInput;
using DsCore.Win32;
using System.Runtime.InteropServices;
using DsCore.MameOutput;

namespace DemulShooterX64
{
Expand Down
2 changes: 1 addition & 1 deletion DemulShooterX64/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("12.8.0.0")]
[assembly: AssemblyVersion("12.9.0.0")]

0 comments on commit b549fa4

Please sign in to comment.