-
-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add main menu skip (default) and pedestrian removal
- Loading branch information
Showing
8 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "Pattern.h" | ||
#include <spdlog/spdlog.h> | ||
|
||
bool CompareByteArray(uint8_t* Data, const std::vector<uint8_t>& aSignature) | ||
{ | ||
uint8_t* pData = Data; | ||
|
||
for (auto i : aSignature) | ||
{ | ||
auto current = *pData; | ||
pData++; | ||
|
||
if (i == 0xCC) | ||
{ | ||
continue; | ||
} | ||
|
||
if (current != i) | ||
{ | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
uint8_t* FindSignature(uint8_t* apStart, uint8_t* apEnd, std::vector<uint8_t> aSignature) noexcept | ||
{ | ||
const uint8_t first = aSignature[0]; | ||
const uint8_t* pEnd = apEnd - aSignature.size(); | ||
|
||
for (; apStart < pEnd; ++apStart) | ||
{ | ||
if (*apStart != first) | ||
{ | ||
continue; | ||
} | ||
if (CompareByteArray(apStart, aSignature)) | ||
{ | ||
return apStart; | ||
} | ||
} | ||
|
||
return nullptr; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <vector> | ||
|
||
uint8_t* FindSignature(uint8_t* apStart, uint8_t* apEnd, std::vector<uint8_t> apSignature) noexcept; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <windows.h> | ||
|
||
#include "Image.h" | ||
#include <spdlog/spdlog.h> | ||
#include "Pattern.h" | ||
|
||
void RemovePedsPatch(Image* apImage) | ||
{ | ||
auto pLocation = FindSignature(apImage->pTextStart, apImage->pTextEnd, { 0x3B, 0xD8, 0x0F, 0x4E, 0xC3, 0x8B, 0xD8, 0x85, 0xDB, 0x0F, 0x8E }); | ||
if(pLocation == nullptr) | ||
{ | ||
spdlog::info("\tRemove peds patch: failed, could not be found"); | ||
return; | ||
} | ||
|
||
DWORD oldProtect = 0; | ||
VirtualProtect(pLocation, 32, PAGE_EXECUTE_WRITECOPY, &oldProtect); | ||
pLocation[9] = 0x90; | ||
pLocation[10] = 0xE9; | ||
VirtualProtect(pLocation, 32, oldProtect, nullptr); | ||
|
||
spdlog::info("\tRemove peds patch: success"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <windows.h> | ||
|
||
#include "Image.h" | ||
#include <spdlog/spdlog.h> | ||
#include "Pattern.h" | ||
|
||
void StartScreenPatch(Image* apImage) | ||
{ | ||
auto pLocation = FindSignature(apImage->pTextStart, apImage->pTextEnd, { 0x48, 0xBB , 0xE6 , 0xF8 , 0xA5, 0xA3, 0x36, 0x56, 0x4E, 0xA7, 0xC6 , 0x85, 0xB0, 0xCC, 0xCC, 0xCC, 0x01 }); | ||
if(pLocation == nullptr) | ||
{ | ||
spdlog::info("\tStart 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; | ||
VirtualProtect(pLocation, 32, oldProtect, nullptr); | ||
|
||
spdlog::info("\tStart screen patch: success"); | ||
} |
5a469e5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That pedestrian removal, in my case helped framerate, and there is no frame stuttering like before. My graphics card is below minimum requirements, it is playable but not the best experience it could be. Keep it up. I hope that dev's patches and yours combined altogether will make it right.