You are not logged in.

#1 2013-09-30 09:08:47

Mitch
Member
Registered: 2013-09-30
Posts: 1

Unable to read stack element of the CoD2 script engine in C

Hi,

I am trying to get extensions for Call of Duty 2 binary working for Arch Linux. I am running x86-64 arch (3.11.2-1-ARCH) and CoD2 is 32bit. That is why i am using the multilib. It gets preloaded with LD_PRELOAD.
But on Arch it doesn't read the stack element of the CoD2 script engine:

// My COD_VERSION is COD2_1_3
int getStack()
{
	#if COD_VERSION == COD2_1_2
		return 0x83D7A10; // diff to 1.3: 1080
	#elif COD_VERSION == COD2_1_3
		return 0x83D8A90;
	#elif COD_VERSION == COD1_1_5
		return 0x0830AE88;
	#elif COD_VERSION == COD4_1_7
		return 0x08c055b0;
	#else
		#warning int getStack() return NULL;
		return NULL;
	#endif
}

int stackGetParamInt(int param, int *value)
{
	//printf("stackGetParamInt() start...");
	aStackElement *scriptStack = *(aStackElement**)getStack();
	aStackElement *arg = scriptStack - param;
        printf("scriptengine> test value=%.8x scriptStack=%.8x arg=%.8x\n", value, scriptStack, arg);
	if (arg->type != STACK_INT)
		return 0;
	*value = (int)arg->offsetData;
	//printf("... end\n");
	return 1;
}

It prints: scriptengine> test value=ff805778 scriptStack=00000000 arg=00000000

Source: https://github.com/kungfooman/libcod/
My thread on the support forum for these extensions for CoD2: http://killtube.org/showthread.php?1583 … Arch-Linux

Offline

Board footer

Powered by FluxBB