示例#1
0
void SuperFamicomCartridge::read_hash(const netnode & node)
{
  char buf[MAXSTR];
  ssize_t len;

  rom_size = node.hashval_long("rom_size");
  ram_size = node.hashval_long("ram_size");
  firmware_appended = node.hashval_long("firmware_appended") != 0;

  header_offset = node.hashval_long("header_offset");

  len = node.hashstr("type", buf, sizeof(buf));
  if(len >= 0) type = string_to_type(buf);
  len = node.hashstr("region", buf, sizeof(buf));
  if(len >= 0) region = string_to_region(buf);
  len = node.hashstr("mapper", buf, sizeof(buf));
  if(len >= 0) mapper = string_to_mapper(buf);
  len = node.hashstr("dsp1_mapper", buf, sizeof(buf));
  if(len >= 0) dsp1_mapper = string_to_dsp1_mapper(buf);

  has_bsx_slot = node.hashval_long("has_bsx_slot") != 0;
  has_superfx = node.hashval_long("has_superfx") != 0;
  has_sa1 = node.hashval_long("has_sa1") != 0;
  has_sharprtc = node.hashval_long("has_sharprtc") != 0;
  has_epsonrtc = node.hashval_long("has_epsonrtc") != 0;
  has_sdd1 = node.hashval_long("has_sdd1") != 0;
  has_spc7110 = node.hashval_long("has_spc7110") != 0;
  has_cx4 = node.hashval_long("has_cx4") != 0;
  has_dsp1 = node.hashval_long("has_dsp1") != 0;
  has_dsp2 = node.hashval_long("has_dsp2") != 0;
  has_dsp3 = node.hashval_long("has_dsp3") != 0;
  has_dsp4 = node.hashval_long("has_dsp4") != 0;
  has_obc1 = node.hashval_long("has_obc1") != 0;
  has_st010 = node.hashval_long("has_st010") != 0;
  has_st011 = node.hashval_long("has_st011") != 0;
  has_st018 = node.hashval_long("has_st018") != 0;
}
示例#2
0
//----------------------------------------------------------------------
static int idaapi notify(processor_t::idp_notify msgid, ...) // Various messages:
{
  va_list va;
  va_start(va, msgid);

// A well behaved processor module should call invoke_callbacks()
// in his notify() function. If this function returns 0, then
// the processor module should process the notification itself
// Otherwise the code should be returned to the caller:

  int code = invoke_callbacks(HT_IDP, msgid, va);
  if ( code ) return code;

  int retcode = 1;
  switch ( msgid )
  {
    case processor_t::init:
      helper.create("$ spc700");
      break;
    case processor_t::term:
      free_ioports(ports, numports);
      break;
    case processor_t::oldfile:
    case processor_t::newfile:
      {
        char buf[MAXSTR];
        const char *device_ptr = buf;
        ssize_t len = helper.hashstr("device", buf, sizeof(buf));
        if ( len <= 0 )
          device_ptr = "spc700";

        if ( msgid == processor_t::newfile )
        {
          set_device_name(device_ptr, IORESP_ALL);
          set_dsp_regs_enum();

          set_default_segreg_value(NULL, rDs, 0);
          set_default_segreg_value(NULL, rFp, 0);
        }
      }
      break;

    case processor_t::may_be_func:
      retcode = 0;
      ea_t cref_addr;
      for( cref_addr = get_first_cref_to(cmd.ea);
           cref_addr != BADADDR;
           cref_addr = get_next_cref_to(cmd.ea, cref_addr) )
      {
        uint8 opcode = get_byte(cref_addr);
        const struct opcode_info_t &opinfo = get_opcode_info(opcode);
        if ( opinfo.itype == SPC_call
          || opinfo.itype == SPC_jmp )
        {
          retcode = 100;
          break;
        }
      }
      break;

    case processor_t::is_call_insn:
      {
        const struct opcode_info_t &opinfo = get_opcode_info(get_byte(va_arg(va, ea_t)));
        if ( opinfo.itype == SPC_call )
          retcode = 2;
        else
          retcode = 0;
      }
      break;

    case processor_t::is_ret_insn:
      {
        const struct opcode_info_t &opinfo = get_opcode_info(get_byte(va_arg(va, ea_t)));
        if ( opinfo.itype == SPC_ret
          || opinfo.itype == SPC_reti )
          retcode = 2;
        else
          retcode = 0;
      }
      break;

    case processor_t::is_indirect_jump:
      {
        const struct opcode_info_t &opinfo = get_opcode_info(get_byte(va_arg(va, ea_t)));
        if ( opinfo.itype == SPC_jmp )
        {
          if ( opinfo.addr == ABS_IX_INDIR )
            retcode = 3;
          else
            retcode = 2;
        }
        else
          retcode = 1;
      }
      break;

    default:
      break;
  }
  va_end(va);

  return retcode;
}