コード例 #1
0
ファイル: Cartridge.cpp プロジェクト: bgK/vba-ttb
u32 read32(const u32 address)
{
	switch (address >> 24)
	{
	case 8:
	case 9:
	case 10:
	case 11:
	case 12:
		return READ32LE(((u32 *)&rom[address&0x1FFFFFC]));
		break;
	case 13:
		if (game.hasEEPROM())
			return eepromRead(address);
		break;
	case 14:
		if (game.hasSRAM())
			return sramRead(address);
		else if (game.hasFlash())
			return flashRead(address);
		break;
	default:
		break;
	}

	return 0;
}
コード例 #2
0
ファイル: BugReport.cpp プロジェクト: Kashkas/vba4iphone
CString BugReport::createReport()
{
  theApp.winCheckFullscreen();

  CString report = "";
  AppendFormat(report, "Emu version  : %s\r\n", VERSION);
  AppendFormat(report, "Emu Type     : %s\r\n",
#ifdef FINAL_VERSION
#ifdef DEV_VERSION
               "Development Version"
#else
               "Normal Version"
#endif
#else
               "Debug Version"
#endif
               );

  if(emulating) {
    AppendFormat(report, "File         : %s\r\n", theApp.szFile);

    char buffer[20];
    if(theApp.cartridgeType == 0) {
      u32 check = 0;
      for(int i = 0; i < 0x4000; i += 4) {
        check += *((u32 *)&bios[i]);
      }
      AppendFormat(report, "BIOS Checksum: %08X\r\n", check);

      strncpy(buffer, (const char *)&rom[0xa0], 12);
      buffer[12] = 0;
      AppendFormat(report, "Internal name: %s\r\n", buffer);
      
      strncpy(buffer, (const char *)&rom[0xac], 4);
      buffer[4] = 0;
      AppendFormat(report, "Game code    : %s\r\n", buffer);

      CString res = "";
      u32 *p = (u32 *)rom;
      u32 *end = (u32 *)((char *)rom+theApp.romSize);
      while(p  < end) {
        u32 d = READ32LE(p);
    
        if(d == 0x52504545) {
          if(memcmp(p, "EEPROM_", 7) == 0) {
            res += (const char *)p;
            res += ' ';
          }
        } else if (d == 0x4D415253) {
          if(memcmp(p, "SRAM_", 5) == 0) {
            res += (const char *)p;
            res += ' ';
          }
        } else if (d == 0x53414C46) {
          if(memcmp(p, "FLASH1M_", 8) == 0) {
            res += (const char *)p;
            res += ' ';
          }
        } else if(memcmp(p, "FLASH", 5) == 0) {
          res += (const char *)p;
          res += ' ';
        } else if (d == 0x52494953) {
          if(memcmp(p, "SIIRTC_V", 8) == 0) {
            res += (const char *)p;
            res += ' ';
          }
        }
        p++;
      }
      if(res.GetLength() > 0)
        AppendFormat(report, "Cart Save    : %s\r\n", res);
    } else if(theApp.cartridgeType == 1) {
      strncpy(buffer, (const char *)&gbRom[0x134], 15);
      buffer[15] = 0;
      AppendFormat(report, "Game title   : %s\r\n", buffer);
    }
  }
  
  AppendFormat(report, "Using BIOS   : %d\r\n", theApp.useBiosFile);
  AppendFormat(report, "Skip BIOS    : %d\r\n", theApp.skipBiosFile);
  AppendFormat(report, "Disable SFX  : %d\r\n", cpuDisableSfx);
  AppendFormat(report, "Skip intro   : %d\r\n", theApp.removeIntros);
  AppendFormat(report, "Throttle     : %d\r\n", theApp.throttle);
  AppendFormat(report, "Rewind       : %d\r\n", theApp.rewindTimer);
  AppendFormat(report, "Auto frame   : %d\r\n", theApp.autoFrameSkip);
  AppendFormat(report, "Video option : %d\r\n", theApp.videoOption);
  AppendFormat(report, "Render type  : %d\r\n", theApp.renderMethod);
  AppendFormat(report, "Color depth  : %d\r\n", systemColorDepth);
  AppendFormat(report, "Red shift    : %08x\r\n", systemRedShift);
  AppendFormat(report, "Green shift  : %08x\r\n", systemGreenShift);
  AppendFormat(report, "Blue shift   : %08x\r\n", systemBlueShift);
  AppendFormat(report, "Layer setting: %04X\r\n", layerSettings);
  AppendFormat(report, "Save type    : %d (%d)\r\n", 
               theApp.winSaveType, cpuSaveType);
  AppendFormat(report, "Flash size   : %08X (%08x)\r\n", 
               theApp.winFlashSize, flashSize);
  AppendFormat(report, "RTC          : %d (%d)\r\n", theApp.winRtcEnable,
               rtcIsEnabled());
  AppendFormat(report, "AGBPrint     : %d\r\n", agbPrintIsEnabled());
  AppendFormat(report, "Speed toggle : %d\r\n", theApp.speedupToggle);
  AppendFormat(report, "Synchronize  : %d\r\n", synchronize);
  AppendFormat(report, "Sound OFF    : %d\r\n", soundOffFlag);
  AppendFormat(report, "Channels     : %04x\r\n", soundGetEnable() & 0x30f);
  AppendFormat(report, "Old Sync     : %d\r\n", theApp.useOldSync);
  AppendFormat(report, "Priority     : %d\r\n", theApp.threadPriority);
  AppendFormat(report, "Filters      : %d (%d)\r\n", theApp.filterType, theApp.ifbType);
  AppendFormat(report, "Cheats       : %d\r\n", cheatsNumber);
  AppendFormat(report, "GB Cheats    : %d\r\n", gbCheatNumber);
  AppendFormat(report, "GB Emu Type  : %d\r\n", gbEmulatorType);

  return report;
}