Пример #1
0
bool FUNCPOSITIONCELL::execute(void)
{
	bool result= false;
	VMREGTYPE stackpointer= 0;
	struct{TES3COORDINATE coord; TES3FLOAT zAngle; VMREGTYPE pString;} stackparams;
	TES3ROTATION angle= {0,0,0};
	const char* string= "null";
	
	if(machine.GetRegister(SP,stackpointer)
		&& machine.ReadMem((VPVOID)stackpointer,&stackparams,sizeof(stackparams))
		&& (string=machine.GetString((VPVOID)stackparams.pString))!=0)
	{
		angle.z= stackparams.zAngle;
		VMLONG strlength= strlen((const char*)string);
		stackpointer+= sizeof(stackparams);

		result= (machine.SetRegister(SP,stackpointer)
			&& machine.WriteMem((VPVOID)reltolinear(DESTINATION_IMAGE),&stackparams.coord,sizeof(stackparams.coord))
			&& machine.WriteMem((VPVOID)reltolinear(TARGETROT_IMAGE),&angle,sizeof(angle))
			&& machine.WriteMem((VPVOID)reltolinear(TARGETCELL_IMAGE),(void*)string,strlength+1)
			&& CallOriginalFunction(machine,ORIG_POSITIONCELL));
	}

	return false; // required to make virtualmachine stop running
}
Пример #2
0
bool FUNCSTARTCOMBAT::execute(void)
{
	VMREGTYPE target= 0;
	
	bool result= (machine.pop(target)
		&& machine.WriteMem((VPVOID)reltolinear(SECONDOBJECT_IMAGE),&target,sizeof(target))
		&& CallOriginalFunction(machine,ORIG_STARTCOMBAT));


			
	return result;
}
Пример #3
0
bool FUNCAITRAVEL::execute(void)
{
	bool result= false;
	VMREGTYPE stackpointer= 0;
	TES3COORDINATE coord;
	result= (machine.GetRegister(SP,stackpointer)
			&& machine.SetRegister(SP,stackpointer+sizeof(coord))
			&& machine.ReadMem((VPVOID)stackpointer,&coord,sizeof(coord))
			&& machine.WriteMem((VPVOID)reltolinear(DESTINATION_IMAGE),&coord,sizeof(coord))
			&& CallOriginalFunction(machine,ORIG_AITRAVEL));
		
	return false; // required to make virtualmachine stop running
}
Пример #4
0
bool FUNCSTARTCOMBAT::execute(void)
{
	VMREGTYPE target= 0;
	
	bool result= (machine.pop(target)
		&& machine.WriteMem((VPVOID)reltolinear(SECONDOBJECT_IMAGE),&target,sizeof(target))
		&& CallOriginalFunction(machine,ORIG_STARTCOMBAT));


#ifdef DEBUGGING
	cLog::mLogMessage("FUNCSTARTCOMBAT(%lx) %s\n",target,result?"succeeded":"failed");
#endif	
			
	return result;
}
Пример #5
0
bool FUNCPOSITION::execute(void)
{
	bool result= false;
	VMREGTYPE stackpointer= 0;
	struct{TES3COORDINATE coord; TES3FLOAT zAngle;} stackparams;
	TES3ROTATION angle= {0,0,0};
	if(machine.GetRegister(SP,stackpointer)
		&& machine.ReadMem((VPVOID)stackpointer,&stackparams,sizeof(stackparams)))
	{
		angle.z= stackparams.zAngle;
		stackpointer+= sizeof(stackparams);

		result= (machine.SetRegister(SP,stackpointer)
			&& machine.WriteMem((VPVOID)reltolinear(DESTINATION_IMAGE),&stackparams.coord,sizeof(stackparams.coord))
			&& machine.WriteMem((VPVOID)reltolinear(TARGETROT_IMAGE),&angle,sizeof(angle))
			&& CallOriginalFunction(machine,ORIG_POSITION));
	}

	return false; // required to make virtualmachine stop running
}
Пример #6
0
bool FUNCPLACEAT::breakpoint()
{
	bool result= false;
	
	Context flow= machine.GetFlow();
	machine.SetFlow(parent);
	VMREGTYPE templ= flow.Eax;
	if(templ)
	{
		VMREGTYPE count= 1;
		TES3COORDINATE relpos= { 256,1,0 };
		result=(machine.WriteMem((VPVOID)reltolinear(SECONDOBJECT_IMAGE),&templ,sizeof(templ))
			&& machine.WriteMem((VPVOID)reltolinear(VARINDEX_IMAGE),(void*)&count,sizeof(count))
			&& machine.WriteMem((VPVOID)reltolinear(DESTINATIONX_IMAGE),(void*)&relpos,sizeof(relpos))
			&& machine.SetVMDebuggerBreakpoint(&part2)
			&& CallOriginalFunction(machine,ORIG_PLACEATPC));
		
	}
	else
		result= machine.push(templ);
	
	return result;
}