Converting everything to C++ cause I'm a masochist.

This commit is contained in:
Ben Vanik
2013-01-20 01:13:59 -08:00
parent 8a5dcbc1dd
commit ca2908db32
47 changed files with 3966 additions and 3760 deletions

View File

@@ -9,46 +9,49 @@
#include <xenia/cpu/ppc/instr.h>
#include "cpu/ppc/instr_table.h"
#include "cpu/ppc/instr_tables.h"
xe_ppc_instr_type_t *xe_ppc_get_instr_type(uint32_t code) {
xe_ppc_instr_type_t *slot = NULL;
using namespace xe::cpu::ppc;
InstrType* xe::cpu::ppc::GetInstrType(uint32_t code) {
InstrType* slot = NULL;
switch (code >> 26) {
case 4:
// Opcode = 4, index = bits 5-0 (6)
slot = &xe_ppc_instr_table_4[XESELECTBITS(code, 0, 5)];
slot = &xe::cpu::ppc::tables::instr_table_4[XESELECTBITS(code, 0, 5)];
break;
case 19:
// Opcode = 19, index = bits 10-1 (10)
slot = &xe_ppc_instr_table_19[XESELECTBITS(code, 1, 10)];
slot = &xe::cpu::ppc::tables::instr_table_19[XESELECTBITS(code, 1, 10)];
break;
case 30:
// Opcode = 30, index = bits 5-1 (5)
slot = &xe_ppc_instr_table_30[XESELECTBITS(code, 1, 5)];
slot = &xe::cpu::ppc::tables::instr_table_30[XESELECTBITS(code, 1, 5)];
break;
case 31:
// Opcode = 31, index = bits 10-1 (10)
slot = &xe_ppc_instr_table_31[XESELECTBITS(code, 1, 10)];
slot = &xe::cpu::ppc::tables::instr_table_31[XESELECTBITS(code, 1, 10)];
break;
case 58:
// Opcode = 58, index = bits 1-0 (2)
slot = &xe_ppc_instr_table_58[XESELECTBITS(code, 0, 1)];
slot = &xe::cpu::ppc::tables::instr_table_58[XESELECTBITS(code, 0, 1)];
break;
case 59:
// Opcode = 59, index = bits 5-1 (5)
slot = &xe_ppc_instr_table_59[XESELECTBITS(code, 1, 5)];
slot = &xe::cpu::ppc::tables::instr_table_59[XESELECTBITS(code, 1, 5)];
break;
case 62:
// Opcode = 62, index = bits 1-0 (2)
slot = &xe_ppc_instr_table_62[XESELECTBITS(code, 0, 1)];
slot = &xe::cpu::ppc::tables::instr_table_62[XESELECTBITS(code, 0, 1)];
break;
case 63:
// Opcode = 63, index = bits 10-1 (10)
slot = &xe_ppc_instr_table_63[XESELECTBITS(code, 1, 10)];
slot = &xe::cpu::ppc::tables::instr_table_63[XESELECTBITS(code, 1, 10)];
break;
default:
slot = &xe_ppc_instr_table[XESELECTBITS(code, 26, 31)];
slot = &xe::cpu::ppc::tables::instr_table[XESELECTBITS(code, 26, 31)];
break;
}
if (!slot || !slot->opcode) {
@@ -57,8 +60,8 @@ xe_ppc_instr_type_t *xe_ppc_get_instr_type(uint32_t code) {
return slot;
}
int xe_ppc_register_instr_emit(uint32_t code, xe_ppc_emit_fn emit) {
xe_ppc_instr_type_t *instr_type = xe_ppc_get_instr_type(code);
int xe::cpu::ppc::RegisterInstrEmit(uint32_t code, InstrEmitFn emit) {
InstrType* instr_type = GetInstrType(code);
if (!instr_type) {
return 1;
}