From b549fa4f652d7c0c3d0999ebd1322d19f729de79 Mon Sep 17 00:00:00 2001 From: argonlefou Date: Mon, 22 Jul 2024 19:01:44 +0200 Subject: [PATCH] v12.9 update --- DemulShooter/Games/Game_Re2Transformers2.cs | 87 +++++++++++++------ DemulShooter/Properties/AssemblyInfo.cs | 2 +- .../Games/Game_UnisElevatorActionInvasion.cs | 4 +- DemulShooterX64/Properties/AssemblyInfo.cs | 2 +- 4 files changed, 64 insertions(+), 31 deletions(-) diff --git a/DemulShooter/Games/Game_Re2Transformers2.cs b/DemulShooter/Games/Game_Re2Transformers2.cs index ecf5806..e6f8e43 100644 --- a/DemulShooter/Games/Game_Re2Transformers2.cs +++ b/DemulShooter/Games/Game_Re2Transformers2.cs @@ -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); @@ -202,6 +203,7 @@ private void SetHack() SetHack_Buttons(); SetHack_Credits(); SetHack_CorrectReticlePosition(); + SetHack_CorrectEnnemyTarget(); Logger.WriteLog("Memory Hack complete !"); Logger.WriteLog("-"); @@ -288,6 +290,7 @@ private void SetHack_Axis() /// /// 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 /// private void SetHack_Buttons() { @@ -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 @@ -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"); @@ -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"); @@ -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)); @@ -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)); @@ -447,6 +446,40 @@ private void SetHack_CorrectReticlePosition() CaveMemory.InjectToOffset(_FixCrosshair_InjectionStruct, "FixCrosshair"); } + /// + /// 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 + /// + private void SetHack_CorrectEnnemyTarget() + { + Codecave CaveMemory = new Codecave(_TargetProcess, _TargetProcess.MainModule.BaseAddress); + CaveMemory.Open(); + CaveMemory.Alloc(0x800); + List Buffer = new List(); + + //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"); + } + /// /// /// diff --git a/DemulShooter/Properties/AssemblyInfo.cs b/DemulShooter/Properties/AssemblyInfo.cs index 385d2a8..a818f3a 100644 --- a/DemulShooter/Properties/AssemblyInfo.cs +++ b/DemulShooter/Properties/AssemblyInfo.cs @@ -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")] diff --git a/DemulShooterX64/Games/Game_UnisElevatorActionInvasion.cs b/DemulShooterX64/Games/Game_UnisElevatorActionInvasion.cs index 88e2e07..862c754 100644 --- a/DemulShooterX64/Games/Game_UnisElevatorActionInvasion.cs +++ b/DemulShooterX64/Games/Game_UnisElevatorActionInvasion.cs @@ -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 { diff --git a/DemulShooterX64/Properties/AssemblyInfo.cs b/DemulShooterX64/Properties/AssemblyInfo.cs index 6d171dd..ea7b4a6 100644 --- a/DemulShooterX64/Properties/AssemblyInfo.cs +++ b/DemulShooterX64/Properties/AssemblyInfo.cs @@ -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")]