-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add 'James Bond 007: Nightfire' support
- Loading branch information
Showing
3 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// game_bond.h | ||
|
||
#ifndef __GAME_BOND_H | ||
#define __GAME_BOND_H | ||
|
||
#include "include/global.h" | ||
#include "iathook/iathook.h" | ||
|
||
int __stdcall hk_bind(SOCKET s, struct sockaddr* addr, int namelen); | ||
LPHOSTENT __stdcall hk_gethostbyname(const char* name); | ||
|
||
__forceinline static void bond_hook_gs() { | ||
HMODULE engine = GetModuleHandleA("engine.dll"); | ||
if (!engine) | ||
engine = LoadLibraryA("engine.dll"); | ||
if (engine) { | ||
if (ogethostbyname) | ||
detour_iat_func(engine, "gethostbyname", (void*)hk_gethostbyname, "wsock32.dll", 52, TRUE); | ||
else | ||
ogethostbyname = (gethostbyname_fn)detour_iat_func(engine, "gethostbyname", (void*)hk_gethostbyname, "wsock32.dll", 52, TRUE); | ||
|
||
if (obind) | ||
detour_iat_func(engine, "bind", (void*)hk_bind, "wsock32.dll", 2, TRUE); | ||
else | ||
obind = (bind_fn)detour_iat_func(engine, "bind", (void*)hk_bind, "wsock32.dll", 2, TRUE); | ||
} | ||
} | ||
|
||
static void patch_bond() { | ||
bond_hook_gs(); | ||
} | ||
|
||
#endif // __GAME_BOND_H |