Code: Select all
typedef void (x86Lib::x86CPU::*opcode)();
//x86Lib is a namespace. x86CPU is a class. opcode is a function pointer type
//x86CPU::Opcodes is an array of the opcode type.
void x86CPU::Cycle(){
....
*(uint32_t*)&op_cache=ReadDword(cCS,eip);
(this->*Opcodes[op_cache[0]])();
//operate on the this class with the opcode functions in this class
eip=(uint16_t)eip+1;
...
}
//you had to use a full function declaration...
InstallOp(0xF4,&x86CPU::op16_hlt);
Anyone else discovered hacks like these that somehow are just amazing and work?