VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
T64File.h
1// -----------------------------------------------------------------------------
2// This file is part of VirtualC64
3//
4// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5// This FILE is dual-licensed. You are free to choose between:
6//
7// - The GNU General Public License v3 (or any later version)
8// - The Mozilla Public License v2
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11// -----------------------------------------------------------------------------
12
13#pragma once
14
15#include "AnyCollection.h"
16
17namespace vc64 {
18
19class T64File : public AnyCollection {
20
21public:
22
23 static bool isCompatible(const fs::path &path);
24 static bool isCompatible(std::istream &stream);
25
26
27 //
28 // Initializing
29 //
30
31 T64File() : AnyCollection() { }
32 T64File(isize capacity) : AnyCollection(capacity) { }
33 T64File(const fs::path &path) throws { init(path); }
34 T64File(const u8 *buf, isize len) throws { init(buf, len); }
35 T64File(class FileSystem &fs) throws { init(fs); }
36
37private:
38
39 using AnyFile::init;
40 void init(FileSystem &fs) throws;
41
42
43 //
44 // Methods from CoreObject
45 //
46
47 const char *objectName() const override { return "T64File"; }
48
49
50 //
51 // Methods from AnyFile
52 //
53
54 FileType type() const override { return FILETYPE_T64; }
55 PETName<16> getName() const override;
56 bool isCompatiblePath(const fs::path &path) override { return isCompatible(path); }
57 bool isCompatibleStream(std::istream &stream) override { return isCompatible(stream); }
58 void finalizeRead() override;
59
60 //
61 // Methods from AnyCollection
62 //
63
64 PETName<16> collectionName() override;
65 isize collectionCount() const override;
66 PETName<16> itemName(isize nr) const override;
67 isize itemSize(isize nr) const override;
68 u8 readByte(isize nr, isize pos) const override;
69
70private:
71
72 u16 memStart(isize nr) const;
73 u16 memEnd(isize nr) const;
74
75
76 //
77 // Scanning
78 //
79
80public:
81
82 // Checks if the header contains information at the specified location
83 bool directoryItemIsPresent(isize n);
84};
85
86}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16