Пример #1
0
//Generates code.if user_data is non zero , user_data_size bytes are allocated after the executable code
//and user_data is set to the first byte of em.Allways 16 byte alligned
void* ppc_block::Generate()
{
	if (do_realloc)
	{
		u8* final_buffer=0;

		final_buffer=(u8*)allocfin(ppc_buff,ppc_size,ppc_indx);

		if (final_buffer==0)
			return 0;

		ppc_buff=final_buffer;
	}
	
	ApplyPatches(ppc_buff);

	memicbi(ppc_buff,ppc_indx);
	
	bool force=false;
	
//	force=true;
//	force=(u32)ppc_buff>=0x8054f510;
	
	if(do_disasm || force) printf("Gen %p %04x %04x\n",ppc_buff,ppc_size,ppc_indx);
	
	if (do_disasm || force) for(u32 i=0;i<ppc_indx;i+=4) disassemble((u32)&ppc_buff[i],*(u32*)&ppc_buff[i]);
	do_disasm=false;
	
	return &ppc_buff[0];
}
Пример #2
0
//Generates code.if user_data is non zero , user_data_size bytes are allocated after the executable code
//and user_data is set to the first byte of em.Allways 16 byte aligned
void* x86_block::Generate()
{
	if (do_realloc)
	{
		u8* final_buffer=0;

		final_buffer=(u8*)allocfin(x86_buff,x86_size,x86_indx);

		if (final_buffer==0)
			return 0;

		x86_buff=final_buffer;
	}
	ApplyPatches(x86_buff);

	return &x86_buff[0];
}