VirtualC64 v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
FSDirEntry.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 "FSTypes.h"
16#include "PETName.h"
17#include <filesystem>
18
19namespace vc64 {
20
21namespace fs = ::std::filesystem;
22
23struct FSDirEntry
24{
25 u8 nextDirTrack; // $00
26 u8 nextDirSector; // $01
27 u8 fileType; // $02
28 u8 firstDataTrack; // $03
29 u8 firstDataSector; // $04
30 u8 fileName[16]; // $05 - $14
31 u8 sideSecBlkTrack; // $15 REL files only
32 u8 sideSrcBlkSector; // $16 REL files only
33 u8 recLength; // $17 REL files only
34 u8 unused[6]; // $18 - $1D Geos only
35 u8 fileSizeLo; // $1E
36 u8 fileSizeHi; // $1F
37
38 // Initializes this entry
39 void init(PETName<16> name, TSLink ref, isize numBlocks);
40 void init(const string &name, TSLink ref, isize numBlocks);
41
42 // Checks whether this entry if empty
43 bool isEmpty() const;
44
45 // Returns the name of this file
46 PETName<16> getName() const { return PETName<16>(fileName); }
47
48 // Return the name of this file with certain symbols escaped
49 fs::path getFileSystemRepresentation() const;
50
51 // Returns the file type of this file
52 FSFileType getFileType() const;
53
54 // Returns the file type as a string
55 const string typeString() const;
56
57 // Returns true if this file does not appear in a regular directory listing
58 bool isHidden() const;
59
60 // Returns the link to the first data block
61 TSLink firstBlock() const { return TSLink{firstDataTrack,firstDataSector}; }
62};
63
64}
VirtualC64 project namespace.
Definition CmdQueue.cpp:16