コード例 #1
0
ファイル: usb.c プロジェクト: hewittc/md380tools
const char *getmfgstr(int speed, long *len){
  //This will be turned off by another thread,
  //but when we call it often the light becomes visible.
  green_led(1);
  
  //Hook the USB DNLOAD handler.
  hookusb();
  
  static long adr=0;
  long val;
  char *usbstring=(char*) 0x2001c080; //2.032
  char buffer[]="@________ : ________";
  
  //Read four bytes from SPI Flash.
  spiflash_read(&val,adr,4);
  
  //Print them into the manufacturer string.
  strhex(buffer+1, adr);
  strhex(buffer+12, val);
  
  //Look forward a bit.
  adr+=4;
  
  //Return the string as our value.
  return loadusbstr(usbstring,buffer,len);
}
コード例 #2
0
ファイル: memory.cpp プロジェクト: ben401/OpenEmu
void MemoryEditor::refresh() {
  if(SNES::cartridge.loaded() == false) {
    editor->setHtml("");
    return;
  }

  editor->setOffset(strhex(addr->text().toUtf8().data()));
  editor->update();
}
コード例 #3
0
void MemoryEditor::sourceChanged(int index) {
  switch(index) { default:
    case 0: memorySource = SNES::Debugger::CPUBus; editor->setSize(16 * 1024 * 1024); break;
    case 1: memorySource = SNES::Debugger::APURAM; editor->setSize(64 * 1024);        break;
    case 2: memorySource = SNES::Debugger::VRAM;   editor->setSize(64 * 1024);        break;
    case 3: memorySource = SNES::Debugger::OAM;    editor->setSize(544);              break;
    case 4: memorySource = SNES::Debugger::CGRAM;  editor->setSize(512);              break;
  }

  editor->setOffset(strhex(addr->text().toUtf8().data()));
  editor->update();
}
コード例 #4
0
ファイル: cheat.cpp プロジェクト: Godzil/quickdev16
bool Cheat::decode(const char *s, unsigned &addr, uint8_t &data, type_t &type) const {
  string t = s;
  strlower(t);

  #define ischr(n) ((n >= '0' && n <= '9') || (n >= 'a' && n <= 'f'))

  if(strlen(t) == 8 || (strlen(t) == 9 && t[6] == ':')) {
    //strip ':'
    if(strlen(t) == 9 && t[6] == ':') t = string() << substr(t, 0, 6) << substr(t, 7);
    //validate input
    for(unsigned i = 0; i < 8; i++) if(!ischr(t[i])) return false;

    type = ProActionReplay;
    unsigned r = strhex((const char*)t);
    addr = r >> 8;
    data = r & 0xff;
    return true;
  } else if(strlen(t) == 9 && t[4] == '-') {
コード例 #5
0
void MemoryEditor::updateOffset() {
  editor->setOffset(strhex(addr->text().toUtf8().data()));
  refresh();
}