Ejemplo n.º 1
0
bool
ROMFile::isVC1541RomFile(const char *filename)
{
    if (!checkFileSize(filename, 0x4000, 0x4000)) return false;
    return
    checkFileHeader(filename, magicVC1541RomBytes1) ||
    checkFileHeader(filename, magicVC1541RomBytes2) ||
    checkFileHeader(filename, magicVC1541RomBytes3) ||
    checkFileHeader(filename, magicVC1541RomBytes4);
}
Ejemplo n.º 2
0
bool
Snapshot::isSnapshot(const char *filename)
{
    int magic_bytes[] = { 'V', 'C', '6', '4', EOF };

    assert(filename != NULL);

    if (!checkFileHeader(filename, magic_bytes))
        return false;

    return true;
}
Ejemplo n.º 3
0
AllMaps::AllMaps()
{
	//y = 2 x = 3
	    checkFileHeader("data/map33.dat");
		loadMapfromFile(0,0);
		loadMapfromFile(0,1);
		loadMapfromFile(0,2);
		loadMapfromFile(1,0);
		loadMapfromFile(1,1);
		loadMapfromFile(1,2);


}
Ejemplo n.º 4
0
int PackTos::canUnpack()
{
    if (!readFileHeader())
        return false;
    if (!readPackHeader(768))
        return false;
    // check header as set by packer
    if ((ih.fh_text & 3) != 0 || (ih.fh_data & 3) != 0 || (ih.fh_bss & 3) != 0
        || ih.fh_sym != 0 || ih.fh_reserved != 0 || ih.fh_reloc > 1)
        throwCantUnpack("program header damaged");
    // generic check
    if (!checkFileHeader())
        throwCantUnpack("unsupported header flags");
    return true;
}
Ejemplo n.º 5
0
bool PackTos::canPack()
{
    if (!readFileHeader())
        return false;

    unsigned char buf[768];
    fi->readx(buf, sizeof(buf));
    checkAlreadyPacked(buf, sizeof(buf));

    if (!checkFileHeader())
        throwCantPack("unsupported header flags");
    if (file_size < 1024)
        throwCantPack("program is too small");

    return true;
}
Ejemplo n.º 6
0
bool
TAPFile::isTAPFile(const char *filename)
{
    assert (filename != NULL);
    
    if (!checkFileSuffix(filename, ".TAP") && !checkFileSuffix(filename, ".tap") &&
        !checkFileSuffix(filename, ".T64") && !checkFileSuffix(filename, ".t64"))
        return false;
    
    if (!checkFileSize(filename, 0x15, -1))
        return false;
    
    if (!checkFileHeader(filename, magicBytes))
        return false;
    
    return true;
}
Ejemplo n.º 7
0
bool
Cartridge::isCRTFile(const char *filename)
{
    int magic_bytes[] = { 'C','6','4',' ','C','A','R','T','R','I','D','G','E',' ',' ',' ',EOF };
    
    assert(filename != NULL);
    
    if (!checkFileSuffix(filename, ".CRT") && !checkFileSuffix(filename, ".crt"))
        return false;
    
    if (!checkFileSize(filename, 0x40, -1))
        return false;
    
    if (!checkFileHeader(filename, magic_bytes))
        return false;
    
    return true;
}
Ejemplo n.º 8
0
bool
T64File::isT64File(const char *path)
{
    assert(path != NULL);
    
    if (!checkFileSuffix(path, ".T64") && !checkFileSuffix(path, ".t64"))
        return false;
    
    if (TAPFile::isTAPFile(path)) // Note: TAP files have a very similar header
        return false;
    
    if (!checkFileSize(path, 0x40, -1))
        return false;
    
    if (!checkFileHeader(path, magicBytes))
        return false;
    
    return true;
}
Ejemplo n.º 9
0
bool 
G64Archive::isG64File(const char *filename)
{
    /* "GCR-1541" + Version number (0x00) */
	int magic_bytes[] = { 0x47, 0x43, 0x52, 0x2D, 0x31, 0x35, 0x34, 0x31, 0x00, EOF };
	
	assert(filename != NULL);
	
	if (!checkFileSuffix(filename, ".G64") && !checkFileSuffix(filename, ".g64"))
		return false;
	
	if (!checkFileSize(filename, 0x02AC, -1))
		return false;
	
	if (!checkFileHeader(filename, magic_bytes))
		return false;
	
	return true;
}
Ejemplo n.º 10
0
bool 
T64Archive::isT64File(const char *filename)
{
    /* "Anmerkung: Der String muß nicht wortwörtlich so vorhanden sein. Man sollte nach den Substrings "C64" und "tape" suchen. Vorsicht: TAP Images verwenden den String: C64-TAPE-RAW der ebenfalls die Substrings "C64" und "TAPE" enthält." [Power64 doc] 
        TODO: Make sure that the archive is not a TAP file. */
	int magic_bytes[] = { 0x43, 0x36, 0x34, EOF };
	
	assert(filename != NULL);
	
	if (!checkFileSuffix(filename, ".T64") && !checkFileSuffix(filename, ".t64"))
		return false;
	
	if (!checkFileSize(filename, 0x40, -1))
		return false;
	
	if (!checkFileHeader(filename, magic_bytes))
		return false;
	
	return true;
}
Ejemplo n.º 11
0
bool
ROMFile::isKernalRomFile(const char *filename)
{
    if (!checkFileSize(filename, 0x2000, 0x2000)) return false;
    return checkFileHeader(filename, magicKernalRomBytes);
}