Skip to content

Commit

Permalink
Added custom function support for CoD4
Browse files Browse the repository at this point in the history
  • Loading branch information
M-itch committed Apr 18, 2014
1 parent 4f0a346 commit b5b6353
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
15 changes: 9 additions & 6 deletions gsc.cpp
Expand Up @@ -6,14 +6,17 @@
*/

#if COD_VERSION == COD2_1_0
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x8115824;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x811595C;
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x08115824;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x0811595C;
#elif COD_VERSION == COD2_1_2
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x8117B56;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x8117C8E;
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x08117B56;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x08117C8E;
#elif COD_VERSION == COD2_1_3
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x8117CB2;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x8117DEA;
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x08117CB2;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x08117DEA;
#elif COD_VERSION == COD4_1_7
Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)0x080BD238;
Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)0x080BFEF4;
#else
#warning Scr_GetFunction_t Scr_GetFunction = (Scr_GetFunction_t)NULL;
#warning Scr_GetMethod_t Scr_GetMethod = (Scr_GetMethod_t)NULL;
Expand Down
15 changes: 10 additions & 5 deletions libcod.cpp
Expand Up @@ -1801,9 +1801,11 @@ class cCallOfDuty2Pro
int *addressToDownloadPointer = NULL;
#endif

printf_hide("> [INFO] value of download=%.8x\n", *addressToDownloadPointer);
SV_BeginDownload_f = (SV_BeginDownload_f_t)*addressToDownloadPointer;
*addressToDownloadPointer = (int)hook_SV_BeginDownload_f;
#if COD_VERSION == COD2_1_0 || COD_VERSION == COD2_1_2 || COD_VERSION == COD2_1_3
printf_hide("> [INFO] value of download=%.8x\n", *addressToDownloadPointer);
SV_BeginDownload_f = (SV_BeginDownload_f_t)*addressToDownloadPointer;
*addressToDownloadPointer = (int)hook_SV_BeginDownload_f;
#endif

#if COD_VERSION == COD4_1_7
cracking_hook_function(0x0804AB6C, (int)hook_recvfrom);
Expand Down Expand Up @@ -2009,8 +2011,11 @@ class cCallOfDuty2Pro
cracking_hook_function(0x08094750, (int)SV_AddServerCommand);
if (0)
cracking_hook_function(0x080AC5D8, (int)SV_SendServerCommand);
cracking_hook_call(0x8070BE7, (int)Scr_GetCustomFunction);
cracking_hook_call(0x8070E0B, (int)Scr_GetCustomMethod);
cracking_hook_call(0x08070BE7, (int)Scr_GetCustomFunction);
cracking_hook_call(0x08070E0B, (int)Scr_GetCustomMethod);
#elif COD_VERSION == COD4_1_7
cracking_hook_call(0x08147664, (int)Scr_GetCustomFunction);
cracking_hook_call(0x081467D1, (int)Scr_GetCustomMethod);
#endif

#if COD_VERSION == COD2_1_0 || COD_VERSION == COD2_1_2 || COD_VERSION == COD2_1_3
Expand Down

0 comments on commit b5b6353

Please sign in to comment.