Skip to content

Commit

Permalink
In the ServerCommand replace 'fs_restrict' with 'sv_cracked'. (1.3 only)
Browse files Browse the repository at this point in the history
  • Loading branch information
M-itch committed Jan 9, 2014
1 parent 2439283 commit 6eb982c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,24 @@ typedef int (*ClientCommand_t)(int clientNum);
#if COD2_VERSION == COD2_VERSION_1_0
static int hook_ServerCommand_call = 0x080941F2;
static int hook_ConnectionlessPacket = 0x08093F1E;
#warning static int fsrestrict_ServerCommand = NULL;
static int fsrestrict_ServerCommand = (int)NULL;
#elif COD2_VERSION == COD2_VERSION_1_2
static int hook_ServerCommand_call = 0x0809606C;
static int hook_ConnectionlessPacket = 0x08095894;
#warning static int fsrestrict_ServerCommand = NULL;
static int fsrestrict_ServerCommand = (int)NULL;
#elif COD2_VERSION == COD2_VERSION_1_3
static int hook_ServerCommand_call = 0x08096126;
static int hook_ConnectionlessPacket = 0x0809594E;
static int fsrestrict_ServerCommand = 0x0808DB6F;
#else
#warning static int hook_ServerCommand_call = NULL;
#warning static int hook_ConnectionlessPacket = NULL;
#warning static int fsrestrict_ServerCommand = NULL;
static int hook_ServerCommand_call = (int)NULL;
static int hook_ConnectionlessPacket = (int)NULL;
static int fsrestrict_ServerCommand = (int)NULL;
#endif

typedef short (*codscript_call_callback_entity_t)(int self, int callback, int params);
Expand Down
8 changes: 7 additions & 1 deletion libcod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
#include "gsc.hpp" /* cdecl_injected_closer() cdecl_cod2_player_damage_new() */
#include "server.hpp" /* startServerAsThread() */

#define Swap4Bytes(val) \
( (((val) >> 24) & 0x000000FF) | (((val) >> 8) & 0x0000FF00) | \
(((val) << 8) & 0x00FF0000) | (((val) << 24) & 0xFF000000) )


#pragma GCC visibility push(hidden)

/*
Expand Down Expand Up @@ -1492,7 +1497,6 @@ void hook_ServerCommand( netadr_t from, msg_t *msg )
return SV_ConnectionlessPacket(from, msg);
}


#define TOSTRING2(str) #str
#define TOSTRING1(str) TOSTRING2(str) // else there is written "__LINE__"
class cCallOfDuty2Pro
Expand Down Expand Up @@ -1809,6 +1813,8 @@ class cCallOfDuty2Pro
cracking_hook_function((int)gametype_scripts, (int)hook_codscript_gametype_scripts);
cracking_hook_call(hook_ClientCommand_call, (int)hook_ClientCommand);
cracking_hook_call(hook_ServerCommand_call, (int)hook_ServerCommand);
char * cracked = (char *)"sv_cracked"; // to do clean up on unload
memcpy((void *)(fsrestrict_ServerCommand+3), &cracked, 4);
#endif

printf_hide("> [PLUGIN LOADED]\n");
Expand Down

0 comments on commit 6eb982c

Please sign in to comment.