예제 #1
0
파일: cartridge.cpp 프로젝트: NewbiZ/gbemu
void Cartridge::dump(std::ostream& stream) const
{
    stream << "Title: " << title() << std::endl;
    stream << "Legit: " << (isLegit() ? "yes" : "no") << std::endl;
    stream << "Type: ";
    std::cout << std::hex;
    switch (type())
    {
#define X(NAME, CODE)                               \
        case CODE:                                  \
            stream << #NAME  << " (0x"              \
                   << CODE << ")" << std::endl;     \
            break;
        GBEMU_CARTRIDGE_TYPES
#undef X
        default:
            stream << "UNKNOWN (0x"
                   << (unsigned int)type() << ")"
                   << std::endl;
            break;
    };
    std::cout << std::dec;
    stream << "ROM size: " << bytesToHuman(ROMSize()) << std::endl;
    stream << "RAM size: " << bytesToHuman(RAMSize()) << std::endl;
    std::cout << std::hex;
    stream << "Header checksum: 0x" << (unsigned int)headerChecksum() << std::endl;
    stream << "Cartridge checksum: 0x" << (unsigned int)cartridgeChecksum() << std::endl;
    std::cout << std::dec;
    stream << "Header checksum valid? " << (isHeaderChecksumValid() ? "yes" : "no") << std::endl;
    stream << "Cartridge checksum valid? " << (isCartridgeChecksumValid() ? "yes" : "no") << std::endl;
}
예제 #2
0
파일: object.cpp 프로젝트: Eltamih/uvudec
void UVDGBObject::debugPrint()
{
	printf_plugin_debug("\n\n");

	uv_addr_t entryPoint = 0;
	UV_DEBUG(getEntryPoint(&entryPoint));
	printf_plugin_debug("entry point: 0x%08X\n", entryPoint);

	/*
	FIXME: this causes a crash
	uvd_bool_t bIsNintendoLogo = false;
	UV_DEBUG(isNintendoLogo(&bIsNintendoLogo));
	printf_plugin_debug("is nintendo logo: %d\n", bIsNintendoLogo);
	*/

	std::string title;
	UV_DEBUG(getTitle(title));
	printf_plugin_debug("title: %s\n", title.c_str());

	uint32_t manufacturerCode = 0;
	UV_DEBUG(getManufacturerCode(&manufacturerCode));
	printf_plugin_debug("manufacturer code: 0x%08X\n", manufacturerCode);

	/*
	UV_DEBUG(getCGBFlags(uint8_t *out));

	UV_DEBUG(getNewLicenseeCode(uint16_t *out));

	UV_DEBUG(getSGBFlags(uint8_t *out));

	UV_DEBUG(isSGBEnabled(uvd_bool_t *out));

	UV_DEBUG(getCartridgeType(uint8_t *out));
	*/

	uint32_t ROMSize = 0;
	UV_DEBUG(getROMSize(&ROMSize));
	printf_plugin_debug("ROM size (bytes): 0x%08X\n", ROMSize);
	uint8_t ROMSizeRaw = 0;
	UV_DEBUG(getROMSizeRaw(&ROMSizeRaw));
	printf_plugin_debug("ROM size (raw): 0x%02X\n", ROMSizeRaw);

	uint32_t saveRAMSize = 0;
	UV_DEBUG(getSaveRAMSize(&saveRAMSize));
	printf_plugin_debug("Save RAM size (bytes): 0x%08X\n", saveRAMSize);
	uint8_t saveRAMSizeRaw = 0;
	UV_DEBUG(getSaveRAMSizeRaw(&saveRAMSizeRaw));
	printf_plugin_debug("save RAM size (raw): 0x%02X\n", saveRAMSizeRaw);

	/*
	UV_DEBUG(getDestinationCode(uint8_t *out));

	UV_DEBUG(getOldLicenseeCode(uint8_t *out));

	UV_DEBUG(getMaskROMVersioNumber(uint8_t *out));
	*/

	uvd_bool_t headerChecksumValid = false;
	uint8_t headerChecksumFromFile = 0;
	uint8_t headerChecksumComputed = 0;
	UV_DEBUG(getHeaderChecksum(&headerChecksumFromFile));
	UV_DEBUG(computeHeaderChecksum(&headerChecksumComputed));
	UV_DEBUG(isHeaderChecksumValid(&headerChecksumValid));
	printf_plugin_debug("header checksum, computed: 0x%02X, from file: 0x%02X, valid: %d\n",
			headerChecksumComputed, headerChecksumFromFile, headerChecksumValid);

	uvd_bool_t globalChecksumValid = false;
	uint16_t globalChecksumFromFile = 0;
	uint16_t globalChecksumComputed = 0;
	UV_DEBUG(getGlobalChecksum(&globalChecksumFromFile));
	UV_DEBUG(computeGlobalChecksum(&globalChecksumComputed));
	UV_DEBUG(isGlobalChecksumValid(&globalChecksumValid));
	printf_plugin_debug("global checksum, computed: 0x%04X, from file: 0x%04X, valid: %d\n",
			globalChecksumComputed, globalChecksumFromFile, globalChecksumValid);

	printf_plugin_debug("\n\n");
}