From bd6e5a51b0ace61c27b11404825e69e64574d85f Mon Sep 17 00:00:00 2001
From: pv
Date: Wed, 16 Feb 2022 15:19:56 +0300
Subject: [PATCH] Skip start screen patch
---
ida/patterns.py | 2 +-
src/patches/SkipStartScreen.cpp | 13 ++++++++-----
src/reverse/Addresses.h | 2 +-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/ida/patterns.py b/ida/patterns.py
index 7d473364..1fa2a0a8 100644
--- a/ida/patterns.py
+++ b/ida/patterns.py
@@ -68,7 +68,7 @@ def get_groups() -> List[Group]:
Item(name='MinimapFlicker', pattern='83 79 2C 00 48 8B F2 4C', expected=1),
Item(name='OptionsInit', pattern='40 53 48 83 EC 40 48 8B D9 48 8D 4C 24 20 E8 ? ? ? ? E8 ? ? ? ? 4C 8B 43 08', expected=1),
#Item(name='RemovePedestrians', pattern='44 3B E0 41 0F 4E C4 44 8B E0 89 45 67 45 85 E4 0F 8E', expected=1), # not needed anymore?
- Item(name='SkipStartScreen', pattern='80 3D ? ? ? ? 00 48 BB E6 F8 A5 A3 36 56 4E A7 C6 85 A0 00 00 00 01', expected=1),
+ Item(name='SkipStartScreen', pattern='74 5F E8 ? ? ? ? 48 8D 4C 24 20 8B D8 E8 ? ? ? ? 48 8B C8 8B D3 E8', expected=2, index=1),
Item(name='AmdSMT', pattern='75 2D 33 C9 B8 01 00 00 00 0F A2 8B C8 C1 F9 08', expected=1)
]),
Group(name='CGame', functions=[
diff --git a/src/patches/SkipStartScreen.cpp b/src/patches/SkipStartScreen.cpp
index 9c61b0dc..b9ff4e04 100644
--- a/src/patches/SkipStartScreen.cpp
+++ b/src/patches/SkipStartScreen.cpp
@@ -7,18 +7,21 @@ void StartScreenPatch(const Image* apImage)
RED4ext::RelocPtr func(CyberEngineTweaks::Addresses::CPatches_SkipStartScreen);
uint8_t* pLocation = func.GetAddr();
- if(pLocation == nullptr)
+ if (pLocation == nullptr)
{
Log::Warn("Start screen patch: failed, could not be found");
return;
}
- pLocation -= 9;
-
DWORD oldProtect = 0;
VirtualProtect(pLocation, 32, PAGE_EXECUTE_WRITECOPY, &oldProtect);
- pLocation[0] = 0x90;
- pLocation[1] = 0x90;
+ pLocation[0] = 0xE9;
+ pLocation[1] = 0x08;
+ pLocation[2] = 0x01;
+ pLocation[3] = 0x00;
+ pLocation[4] = 0x00;
+ pLocation[5] = 0x00;
+ pLocation[6] = 0x00;
VirtualProtect(pLocation, 32, oldProtect, nullptr);
Log::Info("Start screen patch: success");
diff --git a/src/reverse/Addresses.h b/src/reverse/Addresses.h
index 8ab0c6a4..ea15e0f2 100644
--- a/src/reverse/Addresses.h
+++ b/src/reverse/Addresses.h
@@ -23,7 +23,7 @@ constexpr uintptr_t CPatches_IntroMovie = 0x1401FA530 - ImageBase; // 48 89 5C 2
constexpr uintptr_t CPatches_Vignette = 0x1411664F0 - ImageBase; // 48 8B 41 30 48 83 78 68 00 74, expected: 1, index: 0
constexpr uintptr_t CPatches_MinimapFlicker = 0x14256793D - ImageBase; // 83 79 2C 00 48 8B F2 4C, expected: 1, index: 0
constexpr uintptr_t CPatches_OptionsInit = 0x142B95870 - ImageBase; // 40 53 48 83 EC 40 48 8B D9 48 8D 4C 24 20 E8 ? ? ? ? E8 ? ? ? ? 4C 8B 43 08, expected: 1, index: 0
-constexpr uintptr_t CPatches_SkipStartScreen = 0x1429C8252 - ImageBase; // 80 3D ? ? ? ? 00 48 BB E6 F8 A5 A3 36 56 4E A7 C6 85 A0 00 00 00 01, expected: 1, index: 0
+constexpr uintptr_t CPatches_SkipStartScreen = 0x1429C8140 - ImageBase; // 74 5F E8 ? ? ? ? 48 8D 4C 24 20 8B D8 E8 ? ? ? ? 48 8B C8 8B D3 E8, expected: 2, index: 1
constexpr uintptr_t CPatches_AmdSMT = 0x142B3E4FB - ImageBase; // 75 2D 33 C9 B8 01 00 00 00 0F A2 8B C8 C1 F9 08, expected: 1, index: 0
#pragma endregion