PDA

View Full Version : Libcod CoD2 1.0



YuriJurek
12th November 2013, 21:46
Hello there, Kung Foo Man may I ask if you could make libcod version for cod2 1.0? Or is there already a 1.0 version?
Thanks in advice.

kung foo man
12th November 2013, 22:12
Hey, the "base" is working (e.g. accessing MySQL-functions through stack functions), but many version-dependent functions are not implemented (e.g. functions to query +moveright etc.).

I've uploaded the build now: http://killtube.org/downloads/libcod/

YuriJurek
12th November 2013, 22:34
Thank you for quick response, that's what I was looking for.

Btw. I get the following when Running no mysql version of libcod:
> [WARNING] Compiled for: 210
Compiled: Sep 17 2013 23:08:19
> [INFO] value of closer=08111d32
> [PLUGIN LOADED]

And when I try to run libcod with mysql support I get this error:
./cod2_lnxded: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

Any advice on how to fix that? Because Mysql support is what I was really looking for.

Thank you again.

kung foo man
13th November 2013, 10:40
The MySQL-lib is missing, as written under Requirements: https://github.com/kungfooman/libcod



dpkg --add-architecture i386
apt-get update
apt-get install gcc-multilib
apt-get install libmysqlclient-dev:i386

YuriJurek
13th November 2013, 15:40
Thank you for your answer, I'll check it out as soon as I can.

YuriJurek
13th November 2013, 18:08
Well now I get this:
dpkg: unknown option --add-architecture




Type dpkg --help for help about installing and deinstalling packages ;
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;




Options marked produce a lot of output - pipe it through `less' or `more' !

It's Debian 6.0 btw.

I've tried these but with no positive result:
dpkg --configure -a
apt-get update
apt-get upgrade

Any further assistance would be appreciated.

kung foo man
13th November 2013, 18:35
Hey, installing the libraries by hand might be easier:

Download the mysql libs from here: http://dbg.killtube.org/libcod/libs/mysql/

Then write in your start script (fit paths ofc):



export LD_LIBRARY_PATH="/root/helper/game_cod2/libs/mysql"
export LD_PRELOAD="/root/helper/game_cod2/libs/libcod2_1_2.so"

./cod2_lnxded_1.2_patch_va_loc +set g_gametype tdm etc.


This old way should work always, just a bit messy to handle system libs by hand. :)

YuriJurek
13th November 2013, 20:33
Still nothing -.- My Startup Script:
cd /home/cod2/server
export LD_LIBRARY_PATH="/home/cod2/server/libs/mysql"
export LD_PRELOAD="/home/cod2/server/libs/libcod2_1_0.so"
./cod2_lnxded +set dedicated "2" +set net_port "28960" +set fs_game "update" +exec update.cfg

That's the output:

./cod2_lnxded: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory

...

kung foo man
13th November 2013, 22:05
Ah, it's compiled against version .18 now, but you got version .16


ldd bin/libcod2_1_0.so
linux-gate.so.1 => (0xf7779000)
libmysqlclient.so.18 => /usr/lib/i386-linux-gnu/libmysqlclient.so.18 (0xf742c000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf7428000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf740a000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf72a7000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf728e000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7275000)
librt.so.1 => /lib/i386-linux-gnu/i686/cmov/librt.so.1 (0xf726c000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf717f000)
libm.so.6 => /lib/i386-linux-gnu/i686/cmov/libm.so.6 (0xf7159000)
/lib/ld-linux.so.2 (0xf777a000)



I guess you can just rename your .16 to .18

YuriJurek
13th November 2013, 22:23
Thank you finally got it to work. Very appreciate your time.

YuriJurek
15th November 2013, 22:18
Hey, the "base" is working (e.g. accessing MySQL-functions through stack functions), but many version-dependent functions are not implemented (e.g. functions to query +moveright etc.).

Hey again, kung foo man, is it possible to port the rest of the functions from 1.2 libcod to 1.0 libcod? Because I don' quite get what do you mean by "version-dependent" functions, are they dependent on cod version?, if no would it be possible to see those functions ported to 1.0 soon?

kung foo man
16th November 2013, 11:09
E.g. take a look at the function gsc_player_button_right() in gsc_player.cpp:

https://github.com/kungfooman/libcod/blob/master/gsc_player.cpp


#if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FD);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA7);
#else
#warning unsigned char *aim_address = (unsigned char *)(NULL);
unsigned char *aim_address = (unsigned char *)(NULL);
#endif


This will support CoD2 1.2, 1.3 and CoD4 1.7

Since 1.2 and 1.3 got the same address, it might be also the same for 1.0, but I don't do much with 1.0 to check that.

The code is dependent on the CoD version, because every binary is always recompiled, thus changing the hardcoded addresses.

Since the code is open source: you are young and intelligent, add those addresses and make libcod more portable. You only need IDA Pro 5.5 with Decompiler (F5), and the memory viewer http://dbg.killtube.org/libcod/memoryshell.zip :D

Mitch
16th November 2013, 15:50
E.g. take a look at the function gsc_player_button_right() in gsc_player.cpp:

https://github.com/kungfooman/libcod/blob/master/gsc_player.cpp


#if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FD);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA7);
#else
#warning unsigned char *aim_address = (unsigned char *)(NULL);
unsigned char *aim_address = (unsigned char *)(NULL);
#endif


This will support CoD2 1.2, 1.3 and CoD4 1.7

Since 1.2 and 1.3 got the same address, it might be also the same for 1.0, but I don't do much with 1.0 to check that.

The code is dependent on the CoD version, because every binary is always recompiled, thus changing the hardcoded addresses.

Since the code is open source: you are young and intelligent, add those addresses and make libcod more portable. You only need IDA Pro 5.5 with Decompiler (F5), and the memory viewer http://dbg.killtube.org/libcod/memoryshell.zip :D



int __cdecl sub_8106C06(int a1, unsigned int seed, int a3, int a4)
{
char v4; // ST04_1@10
char v5; // ST04_1@20
char v7; // [sp+4h] [bp-834h]@1
char dest; // [sp+20h] [bp-818h]@10
char s; // [sp+420h] [bp-418h]@18
int i; // [sp+828h] [bp-10h]@12
int j; // [sp+82Ch] [bp-Ch]@18

sub_8060B2C("------- Game Initialization -------\n", v7);
sub_8060B2C("gamename: %s\n", (unsigned int)"Call of Duty 2");
sub_8060B2C("gamedate: %s\n", (unsigned int)"Oct 24 2005");
sub_80B537E();
memset(&dword_859B400, 0, 0x3624u);
dword_859B41C = 1;
dword_859B5EC = a1;
*(_DWORD *)dword_859B5F8 = a1;
dword_859EA04 = -1;
srand(seed);
sub_80A8712(seed);
sub_811E8E4();
if ( !a3 || !a4 )
sub_8106014();
sub_81196D0();
dword_865262C = (int)sub_8090534;
dword_8652630 = (int)sub_8106A7C;
dword_8652634 = (int)sub_8062B4C;
dword_8652638 = (int)sub_8106BF2;
dword_8652628 = 1;
if ( **(_BYTE **)(dword_8793DEC + 8) )
{
if ( *(_BYTE *)(dword_8793DF0 + 8) )
sub_80A1200(*(_DWORD *)(dword_8793DEC + 8), (int)&dword_859B418, 3);
else
sub_80A1200(*(_DWORD *)(dword_8793DEC + 8), (int)&dword_859B418, 2);
if ( dword_859B418 )
{
sub_80903BC(&dest, 1024);
sub_8107502("------------------------------------------------------------\n", v4);
sub_8107502("InitGame: %s\n", (unsigned int)&dest);
}
else
{
sub_8060B2C("WARNING: Couldn't open logfile: %s\n", *(_DWORD *)(dword_8793DEC + 8));
}
}
else
{
sub_8060B2C("Not logging to disk.\n", v7);
}
for ( i = 0; i <= 0; ++i )
{
dword_859EA08[i] = -1;
*(&dword_859EA0C + i) = 0;
memset(&dword_859EA10[5 * i], 0, 0x14u);
}
sub_80DB380(sub_8106BF2);
dword_855A4E0 = &unk_859EA40;
if ( !a3 )
{
memset(dword_855A4E0, 0, 0xB3BC8u);
*((_DWORD *)dword_855A4E0 + 184048) = sub_80AA8AA;
*((_DWORD *)dword_855A4E0 + 184049) = sub_811CEFE;
sub_810DF86();
sub_80D9B7E();
sub_8106AAC();
}
sub_8120068();
sub_809107E(22, &s, 1024);
sub_80B5FF6(&s, (unsigned int)"winner", (int)"0");
sub_8090E6C(22, &s);
memset(&unk_8665480, 0, 0x8C000u);
dword_859B404 = (int)&unk_8665480;
dword_859B5E4 = *(_DWORD *)(dword_8793D88 + 8);
memset(&unk_86F1480, 0, 0xA2900u);
dword_859B400 = (int)&unk_86F1480;
for ( j = 0; j < dword_859B5E4; ++j )
dword_86655D8[140 * j] = dword_859B400 + 10404 * j;
*(_DWORD *)dword_859B40C = 72;
dword_859B410 = 0;
dword_859B414 = 0;
sub_8090498(dword_859B404, *(_DWORD *)dword_859B40C, 560, dword_859B400, 10404);
sub_80FEEDA();
sub_81083B2();
sub_81192E0();
sub_80FBD50("0");
sub_811030E();
sub_807E04A();
sub_8060B2C("-----------------------------------\n", v5);
sub_8083E96(1);
sub_807F9F2(1);
sub_807F64C();
sub_811932A();
sub_8115E66();
sub_810DD38();
sub_8115E94();
for ( j = 0; j <= 7; ++j )
dword_879D83C[306 * j] = -1;
dword_855A4E0 = 0;
dword_859B41C = 0;
sub_8104A30();
return sub_8104AEC();
}


I think playerStates for 1.0 is 0x086F1480. (memset(&unk_86F1480, 0, 0xA2900u))

Mitch
17th November 2013, 09:41
I got now this:


int __cdecl sub_810DDEE()
{
int result; // eax@1
char s; // [sp+10h] [bp-48h]@1

sub_80B5932(&s, 0x40u, "maps/mp/gametypes/%s", *(_DWORD *)(dword_8793D80 + 8));
dword_879C788 = sub_810DD70((unsigned int)&s, (unsigned int)"main", 1);
dword_879C78C = sub_810DD70(
(unsigned int)"maps/mp/gametypes/_callbacksetup",
(unsigned int)"CodeCallback_StartGameType",
1);
dword_879C790 = sub_810DD70(
(unsigned int)"maps/mp/gametypes/_callbacksetup",
(unsigned int)"CodeCallback_PlayerConnect",
1);
dword_879C794 = sub_810DD70(
(unsigned int)"maps/mp/gametypes/_callbacksetup",
(unsigned int)"CodeCallback_PlayerDisconnect",
1);
dword_879C798 = sub_810DD70(
(unsigned int)"maps/mp/gametypes/_callbacksetup",
(unsigned int)"CodeCallback_PlayerDamage",
1);
result = sub_810DD70((unsigned int)"maps/mp/gametypes/_callbacksetup", (unsigned int)"CodeCallback_PlayerKilled", 1);
dword_879C79C = result;
return result;
}


gametype_scripts should be 0x0810DDEE and codscript_load_function should be 0x0810DD70.
https://github.com/kungfooman/libcod/blob/master/libcod.cpp (line 554 - 572)

https://github.com/kungfooman/libcod/blob/master/functions.hpp


static int trap_Argc()
return *(int *)0x0819BE80;

static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060074;

static ClientCommand_t ClientCommand = (ClientCommand_t)0x080FE998; // search 'say_team' and see code xref function
static int hook_ClientCommand_call = 0x0808F281;

static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x08118DF4; // search 'badMOD'

static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x08083B8E;




int __cdecl sub_8115F2A(int a1, int a2, int a3, int a4, int a5, unsigned int a6, int a7, int a8, int a9, int a10, int a11)
{
unsigned __int16 v11; // ax@1
char **v12; // eax@1
unsigned __int16 v14; // ST16_2@5

sub_8084B1C(a11);
v11 = sub_81003E6(a10);
sub_8084C8E(v11);
sub_8115AA2(a9);
sub_8115AA2(a8);
v12 = (char **)sub_80E9270(a7);
sub_8084C1A(*v12);
if ( (signed int)a6 < 0 || a6 > 0xE )
sub_8084C1A("badMOD");
else
sub_8084C1A((&off_81677C0)[4 * a6]);
sub_8084B1C(a5);
sub_8084B1C(a4);
sub_8115AC2(a3);
sub_8115AC2(a2);
v14 = sub_8118DF4(a1, dword_879C798, 10);
return sub_8083B8E(v14);
}


My svn diff patches: 537

Mitch
17th November 2013, 20:10
My latest version (includes above all my updates)


Index: doit.sh
================================================== =================
--- doit.sh (revision 7)
+++ doit.sh (working copy)
@@ -49,7 +49,7 @@
echo "##### COMPILE GSC_ASTAR.CPP #####"
$cc $options -c gsc_astar.cpp -o objects_normal/gsc_astar.opp
echo "##### COMPILE GSC_MYSQL.CPP #####"
- $cc $options -c gsc_mysql.cpp -o objects_normal/gsc_mysql.opp -lmysqlclient -L/usr/lib/mysql
+ $cc $options -c gsc_mysql.cpp -o objects_normal/gsc_mysql.opp -lmysqlclient -L./vendors/lib
echo "##### COMPILE SERVER.CPP #####"
$cc $options -c server.c -o objects_normal/server.opp -D SERVER_PORT=8000
echo "##### COMPILE GSC_MEMORY.CPP #####"
@@ -122,13 +122,13 @@

mkdir -p objects_$1
echo "##### COMPILE $1 LIBCOD.CPP #####"
- #$cc $options $constants -o objects_$1/libcod.opp -c libcod.cpp
+ $cc $options $constants -o objects_$1/libcod.opp -c libcod.cpp
echo "##### COMPILE $1 GSC.CPP #####"
$cc $options $constants -o objects_$1/gsc.opp -c gsc.cpp
echo "##### COMPILE $1 GSC_PLAYER.CPP #####"
- #$cc $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
+ $cc $options $constants -o objects_$1/gsc_player.opp -c gsc_player.cpp
echo "##### COMPILE $1 GSC_UTILS.CPP #####"
- #$cc $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp
+ $cc $options $constants -o objects_$1/gsc_utils.opp -c gsc_utils.cpp

echo "##### LINK lib$1.so #####"
objects="$(ls objects_normal/*.opp) $(ls objects_$1/*.opp)"
Index: functions.hpp
================================================== =================
--- functions.hpp (revision 7)
+++ functions.hpp (working copy)
@@ -6,7 +6,9 @@
// CoD2 1.2 = 80601F2
static int trap_Argc()
{
- #if COD2_VERSION == COD2_VERSION_1_2
+ #if COD2_VERSION == COD2_VERSION_1_0
+ return *(int *)0x0819BE80;
+ #elif COD2_VERSION == COD2_VERSION_1_2
return *(int *)0x0819E080;
#elif COD2_VERSION == COD2_VERSION_1_3
return *(int *)0x0819F100;
@@ -17,7 +19,9 @@
}

typedef int (*trap_Argv_t)(unsigned int param, char *buf, int bufLen);
-#if COD2_VERSION == COD2_VERSION_1_2
+#if COD2_VERSION == COD2_VERSION_1_0
+ static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060074;
+#elif COD2_VERSION == COD2_VERSION_1_2
static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060280;
#elif COD2_VERSION == COD2_VERSION_1_3
static trap_Argv_t trap_Argv = (trap_Argv_t)0x08060278;
@@ -28,7 +32,10 @@


typedef int (*ClientCommand_t)(int clientNum);
-#if COD2_VERSION == COD2_VERSION_1_2
+#if COD2_VERSION == COD2_VERSION_1_0
+ static ClientCommand_t ClientCommand = (ClientCommand_t)0x080FE998; // search 'say_team' and see code xref function
+ static int hook_ClientCommand_call = 0x0808F281;
+#elif COD2_VERSION == COD2_VERSION_1_2
static ClientCommand_t ClientCommand = (ClientCommand_t)0x08100D1E;
static int hook_ClientCommand_call = 0x08090B0C;
#elif COD2_VERSION == COD2_VERSION_1_3
@@ -42,7 +49,10 @@
#endif

typedef short (*codscript_call_callback_entity_t)(int self, int callback, int params);
-#if COD2_VERSION == COD2_VERSION_1_2
+#if COD2_VERSION == COD2_VERSION_1_0
+ static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x08118DF4; // search 'badMOD'
+
+#elif COD2_VERSION == COD2_VERSION_1_2
static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x0811B128;
#elif COD2_VERSION == COD2_VERSION_1_3
static codscript_call_callback_entity_t codscript_call_callback_entity = (codscript_call_callback_entity_t)0x0811B284;
@@ -52,7 +62,9 @@
#endif

typedef int (*codscript_callback_finish_t)(short callback_handle);
-#if COD2_VERSION == COD2_VERSION_1_2
+#if COD2_VERSION == COD2_VERSION_1_0
+ static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x08083B8E;
+#elif COD2_VERSION == COD2_VERSION_1_2
static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x0808410A;
#elif COD2_VERSION == COD2_VERSION_1_3
static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)0x080841D6;
@@ -61,4 +73,4 @@
static codscript_callback_finish_t codscript_callback_finish = (codscript_callback_finish_t)NULL;
#endif

-#endif
\ No newline at end of file
+#endif
Index: gsc_player.cpp
================================================== =================
--- gsc_player.cpp (revision 7)
+++ gsc_player.cpp (working copy)
@@ -2,7 +2,10 @@

#if COMPILE_PLAYER == 1

-#if COD2_VERSION == COD2_VERSION_1_2
+#if COD2_VERSION == COD2_VERSION_1_0
+ int playerStates = 0x086F1480; // search 'winner'
+ int sizeOfPlayer = 0x28A4;
+#elif COD2_VERSION == COD2_VERSION_1_2
int playerStates = 0x08705480; // as in game initialisation "------- Game Initializati"
int sizeOfPlayer = 0x28A4;
// memset(&playerStates_8705480, 0, 0xA2900u);
@@ -202,7 +205,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FD);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA7);
@@ -227,7 +230,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FD);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA7);
@@ -253,7 +256,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FC);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA6);
@@ -279,7 +282,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26FC);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FA6);
@@ -305,7 +308,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26E8);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FB4);
@@ -332,7 +335,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26E8);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FB4);
@@ -358,7 +361,7 @@
return stackReturnInt(0);
}

- #if COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
+ #if COD2_VERSION == COD2_VERSION_1_0 || COD2_VERSION == COD2_VERSION_1_2 || COD2_VERSION == COD2_VERSION_1_3
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x26E9);
#elif COD_VERSION == COD4_1_7
unsigned char *aim_address = (unsigned char *)(PLAYERSTATE(playerid) + 0x2FB5);
@@ -546,4 +549,4 @@
int ping = *(unsigned int *)(info_player + info_port_offset);
return stackPushInt(ping);
}
-#endif
\ No newline at end of file
+#endif
Index: libcod.cpp
================================================== =================
--- libcod.cpp (revision 7)
+++ libcod.cpp (working copy)
@@ -552,7 +552,9 @@


typedef void (*gametype_scripts_t)();
-#if COD_VERSION == COD2_1_2
+#if COD_VERSION == COD2_1_0
+ gametype_scripts_t gametype_scripts = (gametype_scripts_t)0x0810DDEE;
+#elif COD_VERSION == COD2_1_2
gametype_scripts_t gametype_scripts = (gametype_scripts_t)0x0811012A;
#elif COD_VERSION == COD2_1_3
gametype_scripts_t gametype_scripts = (gametype_scripts_t)0x08110286;
@@ -562,7 +564,9 @@
#endif

typedef int (*codscript_load_function_t)(char *file, char *function, int isNeeded);
-#if COD_VERSION == COD2_1_2
+#if COD_VERSION == COD2_1_0
+ codscript_load_function_t codscript_load_function = (codscript_load_function_t)0x0810DD70;
+#elif COD_VERSION == COD2_1_2
codscript_load_function_t codscript_load_function = (codscript_load_function_t)0x081100AC;
#elif COD_VERSION == COD2_1_3
codscript_load_function_t codscript_load_function = (codscript_load_function_t)0x08110208;
@@ -1447,7 +1451,9 @@

setbuf(stdout, NULL); // otherwise the printf()'s are printed at crash/end

- #if COD_VERSION == COD2_1_2
+ #if COD_VERSION == COD2_1_0
+ printf("> [INFO] Compiled for: CoD2 1.0\n");
+ #elif COD_VERSION == COD2_1_2
printf("> [INFO] Compiled for: CoD2 1.2\n");
#elif COD_VERSION == COD2_1_3
printf("> [INFO] Compiled for: CoD2 1.3\n");
@@ -2008,8 +2014,6 @@
return rf;
}

-
-
#pragma GCC visibility pop

-#endif
\ No newline at end of file
+#endif


io println, AWSD (left, forward, back, right), lean left/right, mysql and space works.

(Currently available via https://github.com/M-itch/libcod)