Skip to content

Commit

Permalink
Merge pull request #650 from psiberx/master
Browse files Browse the repository at this point in the history
Skip start screen patch
  • Loading branch information
Yamashi authored Feb 16, 2022
2 parents cb6bea7 + bd6e5a5 commit 7f01134
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ida/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down
13 changes: 8 additions & 5 deletions src/patches/SkipStartScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@ void StartScreenPatch(const Image* apImage)
RED4ext::RelocPtr<uint8_t> 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");
Expand Down
2 changes: 1 addition & 1 deletion src/reverse/Addresses.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 7f01134

Please sign in to comment.