VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
G64File.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 "AnyFile.h"
16#include "DriveTypes.h"
17
18namespace vc64 {
19
20class G64File : public AnyFile {
21
22public:
23
24 //
25 // Class methods
26 //
27
28 static bool isCompatible(const fs::path &path);
29 static bool isCompatible(std::istream &stream);
30
31
32 //
33 // Initializing
34 //
35
36 G64File() { };
37 G64File(isize capacity);
38 G64File(const fs::path &path) throws { init(path); }
39 G64File(const u8 *buf, isize len) throws { init(buf, len); }
40 G64File(class Disk &disk) throws { init(disk); }
41
42private:
43
44 using AnyFile::init;
45 void init(class Disk &disk) throws;
46
47
48 //
49 // Methods from CoreObject
50 //
51
52public:
53
54 const char *objectName() const override { return "G64File"; }
55
56
57 //
58 // Methods from AnyFile
59 //
60
61 bool isCompatiblePath(const fs::path &path) override { return isCompatible(path); }
62 bool isCompatibleStream(std::istream &stream) override { return isCompatible(stream); }
63 FileType type() const override { return FILETYPE_G64; }
64
65
66 //
67 // Reading data from a track
68 //
69
70public:
71
72 // Returns the size of a certain haltrack in bytes
73 isize getSizeOfHalftrack(Halftrack ht) const;
74
75 // Copies a certain track into a buffer
76 void copyHalftrack(Halftrack ht, u8 *buf) const;
77
78private:
79
80 isize getStartOfHalftrack(Halftrack ht) const;
81};
82
83}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16