mirror of
https://github.com/uberhalit/SekiroFpsUnlockAndMore.git
synced 2026-06-13 01:47:54 +00:00
added legacy support for death penalties
This commit is contained in:
parent
2344e280d4
commit
d6312c6b0a
2 changed files with 64 additions and 17 deletions
|
|
@ -8,7 +8,7 @@ namespace SekiroFpsUnlockAndMore
|
||||||
internal const string PROCESS_TITLE = "Sekiro";
|
internal const string PROCESS_TITLE = "Sekiro";
|
||||||
internal const string PROCESS_DESCRIPTION = "Shadows Die Twice";
|
internal const string PROCESS_DESCRIPTION = "Shadows Die Twice";
|
||||||
internal const string PROCESS_EXE_VERSION = "1.5.0.0";
|
internal const string PROCESS_EXE_VERSION = "1.5.0.0";
|
||||||
internal static readonly string[] PROCESS_EXE_VERSION_SUPPORTED = new string[3]
|
internal static readonly string[] PROCESS_EXE_VERSION_SUPPORTED_LEGACY = new string[3]
|
||||||
{
|
{
|
||||||
"1.4.0.0",
|
"1.4.0.0",
|
||||||
"1.3.0.0",
|
"1.3.0.0",
|
||||||
|
|
@ -358,6 +358,15 @@ namespace SekiroFpsUnlockAndMore
|
||||||
00000001411D33EB | 48:8B0D 562BB802 | mov rcx,qword ptr ds:[143D55F48] |
|
00000001411D33EB | 48:8B0D 562BB802 | mov rcx,qword ptr ds:[143D55F48] |
|
||||||
00000001411D33F2 | 48:85C9 | test rcx,rcx |
|
00000001411D33F2 | 48:85C9 | test rcx,rcx |
|
||||||
|
|
||||||
|
LEGACY
|
||||||
|
0000000141189C68 | 8B00 | mov eax,dword ptr ds:[rax] |
|
||||||
|
0000000141189C6A | 8983 60010000 | mov dword ptr ds:[rbx+160],eax | OnDeath() ability points (AP) decrease
|
||||||
|
0000000141189C70 | 45:2BFD | sub r15d,r13d |
|
||||||
|
0000000141189C73 | 44:89BC24 90000000 | mov dword ptr ss:[rsp+90],r15d | virtual Sen decrease - shows how many Sen got lost after death
|
||||||
|
0000000141189C7B | 2BE9 | sub ebp,ecx |
|
||||||
|
0000000141189C7D | 89AC24 94000000 | mov dword ptr ss:[rsp+94],ebp | virtual AP decrease - shows how many APs got lost after death
|
||||||
|
0000000141189C84 | E8 071673FF | call sekiro.1408BB290 |
|
||||||
|
|
||||||
000000014118913A (Version 1.2.0.0)
|
000000014118913A (Version 1.2.0.0)
|
||||||
*/
|
*/
|
||||||
internal const string PATTERN_DEATHPENALTIES2 = "E8 ?? ?? ?? ?? 45 ?? ?? 44 89 ?? 24 ?? ?? 00 00 8B ?? 24 ?? ?? 00 00 2B ?? 89 ?? 24 ?? ?? 00 00 E8 ?? ?? ?? ?? 48 ?? ?? 24 ?? ?? 00 00 48 ?? ?? 48";
|
internal const string PATTERN_DEATHPENALTIES2 = "E8 ?? ?? ?? ?? 45 ?? ?? 44 89 ?? 24 ?? ?? 00 00 8B ?? 24 ?? ?? 00 00 2B ?? 89 ?? 24 ?? ?? 00 00 E8 ?? ?? ?? ?? 48 ?? ?? 24 ?? ?? 00 00 48 ?? ?? 48";
|
||||||
|
|
@ -376,6 +385,16 @@ namespace SekiroFpsUnlockAndMore
|
||||||
{
|
{
|
||||||
0x90, 0x90, 0x90
|
0x90, 0x90, 0x90
|
||||||
};
|
};
|
||||||
|
internal const string PATTERN_DEATHPENALTIES2_LEGACY = "8B ?? 89 83 ?? ?? ?? ?? 45 ?? ?? 44 89 ?? 24 ?? ?? 00 00 2B ?? 89 ?? 24 ?? ?? 00 00 E8";
|
||||||
|
internal const int PATTERN_DEATHPENALTIES2_OFFSET_LEGACY = 2;
|
||||||
|
internal const int PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH_LEGACY = 26;
|
||||||
|
internal static readonly byte[] PATCH_DEATHPENALTIES2_DISABLE_LEGACY = new byte[26] // nop
|
||||||
|
{
|
||||||
|
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||||
|
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||||
|
0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
|
||||||
|
0x90, 0x90
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ namespace SekiroFpsUnlockAndMore
|
||||||
internal string _path_killsLog;
|
internal string _path_killsLog;
|
||||||
internal RECT _windowRect;
|
internal RECT _windowRect;
|
||||||
internal Size _screenSize;
|
internal Size _screenSize;
|
||||||
|
internal bool _isLegacyVersion = false;
|
||||||
|
|
||||||
internal const string _DATACAVE_SPEEDFIX_POINTER = "speedfixPointer";
|
internal const string _DATACAVE_SPEEDFIX_POINTER = "speedfixPointer";
|
||||||
internal const string _DATACAVE_FOV_POINTER = "fovPointer";
|
internal const string _DATACAVE_FOV_POINTER = "fovPointer";
|
||||||
|
|
@ -361,12 +362,24 @@ namespace SekiroFpsUnlockAndMore
|
||||||
}
|
}
|
||||||
|
|
||||||
string gameFileVersion = FileVersionInfo.GetVersionInfo(procList[0].MainModule.FileName).FileVersion;
|
string gameFileVersion = FileVersionInfo.GetVersionInfo(procList[0].MainModule.FileName).FileVersion;
|
||||||
if (gameFileVersion != GameData.PROCESS_EXE_VERSION && Array.IndexOf(GameData.PROCESS_EXE_VERSION_SUPPORTED, gameFileVersion) < 0 && !_settingsService.ApplicationSettings.gameVersionNotify)
|
if (gameFileVersion != GameData.PROCESS_EXE_VERSION)
|
||||||
{
|
{
|
||||||
MessageBox.Show(string.Format("Unknown game version '{0}'.\nSome functions might not work properly or even crash the game. " +
|
if (Array.IndexOf(GameData.PROCESS_EXE_VERSION_SUPPORTED_LEGACY, gameFileVersion) < 0)
|
||||||
"Check for updates on this utility regularly following the link at the bottom.", gameFileVersion), "Sekiro FPS Unlocker and more", MessageBoxButton.OK, MessageBoxImage.Warning);
|
{
|
||||||
ClearConfiguration();
|
if (!_settingsService.ApplicationSettings.gameVersionNotify)
|
||||||
_settingsService.ApplicationSettings.gameVersionNotify = true;
|
{
|
||||||
|
MessageBox.Show(string.Format("Unknown game version '{0}'.\nSome functions might not work properly or even crash the game. " +
|
||||||
|
"Check for updates on this utility regularly following the link at the bottom.", gameFileVersion), "Sekiro FPS Unlocker and more", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
ClearConfiguration();
|
||||||
|
_settingsService.ApplicationSettings.gameVersionNotify = true;
|
||||||
|
SaveConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isLegacyVersion = true;
|
||||||
|
_settingsService.ApplicationSettings.gameVersionNotify = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_settingsService.ApplicationSettings.gameVersionNotify = false;
|
_settingsService.ApplicationSettings.gameVersionNotify = false;
|
||||||
|
|
@ -523,22 +536,35 @@ namespace SekiroFpsUnlockAndMore
|
||||||
Debug.WriteLine("deathPenalties1 original instruction set: " + BitConverter.ToString(_patch_deathpenalties1_enable).Replace('-', ' '));
|
Debug.WriteLine("deathPenalties1 original instruction set: " + BitConverter.ToString(_patch_deathpenalties1_enable).Replace('-', ' '));
|
||||||
if (_patch_deathpenalties1_enable != null)
|
if (_patch_deathpenalties1_enable != null)
|
||||||
{
|
{
|
||||||
_offset_deathpenalties2 = patternScan.FindPattern(GameData.PATTERN_DEATHPENALTIES2) + GameData.PATTERN_DEATHPENALTIES2_OFFSET;
|
if (!_isLegacyVersion)
|
||||||
|
_offset_deathpenalties2 = patternScan.FindPattern(GameData.PATTERN_DEATHPENALTIES2) + GameData.PATTERN_DEATHPENALTIES2_OFFSET;
|
||||||
|
else
|
||||||
|
_offset_deathpenalties2 = patternScan.FindPattern(GameData.PATTERN_DEATHPENALTIES2_LEGACY) + GameData.PATTERN_DEATHPENALTIES2_OFFSET_LEGACY;
|
||||||
Debug.WriteLine("lpDeathPenalties2 found at: 0x" + _offset_deathpenalties2.ToString("X"));
|
Debug.WriteLine("lpDeathPenalties2 found at: 0x" + _offset_deathpenalties2.ToString("X"));
|
||||||
if (IsValidAddress(_offset_deathpenalties2))
|
if (IsValidAddress(_offset_deathpenalties2))
|
||||||
{
|
{
|
||||||
_patch_deathpenalties2_enable = new byte[GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH];
|
ulong instrLength = (ulong)GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH;
|
||||||
if (!ReadProcessMemory(_gameAccessHwnd, _offset_deathpenalties2, _patch_deathpenalties2_enable, (ulong) GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH, out lpNumberOfBytesRead) || lpNumberOfBytesRead.ToInt32() != GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH)
|
if (!_isLegacyVersion)
|
||||||
|
_patch_deathpenalties2_enable = new byte[GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_patch_deathpenalties2_enable = new byte[GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH_LEGACY];
|
||||||
|
instrLength = (ulong)GameData.PATCH_DEATHPENALTIES2_INSTRUCTION_LENGTH_LEGACY;
|
||||||
|
}
|
||||||
|
if (!ReadProcessMemory(_gameAccessHwnd, _offset_deathpenalties2, _patch_deathpenalties2_enable, instrLength, out lpNumberOfBytesRead) || lpNumberOfBytesRead.ToInt32() != (long)instrLength)
|
||||||
_patch_deathpenalties2_enable = null;
|
_patch_deathpenalties2_enable = null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.WriteLine("deathPenalties2 original instruction set: " + BitConverter.ToString(_patch_deathpenalties2_enable).Replace('-', ' '));
|
Debug.WriteLine("deathPenalties2 original instruction set: " + BitConverter.ToString(_patch_deathpenalties2_enable).Replace('-', ' '));
|
||||||
_offset_deathpenalties3 = _offset_deathpenalties2 + GameData.PATTERN_DEATHPENALTIES3_OFFSET;
|
if (!_isLegacyVersion)
|
||||||
_patch_deathpenalties3_enable = new byte[GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH];
|
{
|
||||||
if (!ReadProcessMemory(_gameAccessHwnd, _offset_deathpenalties3, _patch_deathpenalties3_enable, (ulong)GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH, out lpNumberOfBytesRead) || lpNumberOfBytesRead.ToInt32() != GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH)
|
_offset_deathpenalties3 = _offset_deathpenalties2 + GameData.PATTERN_DEATHPENALTIES3_OFFSET;
|
||||||
_patch_deathpenalties2_enable = null;
|
_patch_deathpenalties3_enable = new byte[GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH];
|
||||||
else
|
if (!ReadProcessMemory(_gameAccessHwnd, _offset_deathpenalties3, _patch_deathpenalties3_enable, (ulong)GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH, out lpNumberOfBytesRead) || lpNumberOfBytesRead.ToInt32() != GameData.PATCH_DEATHPENALTIES3_INSTRUCTION_LENGTH)
|
||||||
Debug.WriteLine("deathPenalties3 original instruction set: " + BitConverter.ToString(_patch_deathpenalties3_enable).Replace('-', ' '));
|
_patch_deathpenalties2_enable = null;
|
||||||
|
else
|
||||||
|
Debug.WriteLine("deathPenalties3 original instruction set: " + BitConverter.ToString(_patch_deathpenalties3_enable).Replace('-', ' '));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1098,7 +1124,8 @@ namespace SekiroFpsUnlockAndMore
|
||||||
{
|
{
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties1, GameData.PATCH_DEATHPENALTIES1_DISABLE);
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties1, GameData.PATCH_DEATHPENALTIES1_DISABLE);
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties2, GameData.PATCH_DEATHPENALTIES2_DISABLE);
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties2, GameData.PATCH_DEATHPENALTIES2_DISABLE);
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties3, GameData.PATCH_DEATHPENALTIES3_DISABLE);
|
if (!_isLegacyVersion && _offset_deathpenalties3 != 0x0)
|
||||||
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties3, GameData.PATCH_DEATHPENALTIES3_DISABLE);
|
||||||
}
|
}
|
||||||
else if (this.cbDeathPenalty.IsChecked == false)
|
else if (this.cbDeathPenalty.IsChecked == false)
|
||||||
{
|
{
|
||||||
|
|
@ -1106,7 +1133,8 @@ namespace SekiroFpsUnlockAndMore
|
||||||
{
|
{
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties1, _patch_deathpenalties1_enable);
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties1, _patch_deathpenalties1_enable);
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties2, _patch_deathpenalties2_enable);
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties2, _patch_deathpenalties2_enable);
|
||||||
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties3, _patch_deathpenalties3_enable);
|
if (!_isLegacyVersion && _offset_deathpenalties3 != 0x0)
|
||||||
|
WriteBytes(_gameAccessHwndStatic, _offset_deathpenalties3, _patch_deathpenalties3_enable);
|
||||||
}
|
}
|
||||||
if (showStatus) UpdateStatus(DateTime.Now.ToString("HH:mm:ss") + " Game unpatched!", Brushes.White);
|
if (showStatus) UpdateStatus(DateTime.Now.ToString("HH:mm:ss") + " Game unpatched!", Brushes.White);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue