All pastes #179120 Raw Edit

Mine

public text v1 · immutable
#179120 ·published 2006-09-21 23:05 UTC
rendered paste body
vm_t * vmcg;

intptr_t QDECL Syscall( intptr_t arg, ... ) {
  return vmcg->systemCall( &arg );
}
//a call of Syscall(CG_PRINT, "Test\n"); doesnt work at all - gives weird errors

//vm_create works just fine
vm_t *(*pVM_Create)( const char *module, intptr_t (*systemCalls)(intptr_t *), 
				vmInterpret_t interpret );
vm_t *VM_Create( const char *module, intptr_t (*systemCalls)(intptr_t *), 
				vmInterpret_t interpret ) 
{
	vm_t * result;
	if(strstr(module, "cgame"))
	{
		pCL_CgameSystemCalls = systemCalls;
		result = pVM_Create(module, CL_CgameSystemCalls, interpret);
	}
	else
	{
		result = pVM_Create(module, systemCalls, interpret);
	}
	if(result && strstr(module, "cgame"))
	{
		vmcg = result;
	}

	return result;
}