-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a crash on Windows in certain cases.
For the Blue Shift and Gunman Chronicles autostop, I decided to hook the CMultiManager::ManagerUse function (it's exported so I don't need to find any patterns and it servers its purpose well allowing me to check the stuff that I need). The way that the Detours hooking works is storing the first couple of instructions from the target function and replacing them with a jump to the hook, after which the hook can call a trampoline function that contains those stored instructions as well as a jump to the rest of the game code. Here is a screenshot of the beginning of ManagerUse:  It just turns out that the first 3 instructions aren't quite enough for a jump, so Detours grabbed the fourth one as well, which happens to be a first instruction of a loop (actually that loop is an optimized tail call). What happens then is on certain condition the jump back to that instruction happens in the function, which effectively jumps into the middle of the Detours' jump instruction thus causing the crash. The conditions for the crash are: - Either the game is in multiplayer, - Or the multi_manager has the SF_MULTIMAN_CLONE flag set.
- Loading branch information
Showing
3 changed files
with
24 additions
and
30 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
4579f96
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.
Since pomf is dead, here's a screenshot reupload: http://i.imgur.com/CR6idYo.png