summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/formats/fsmgr.cpp
blob: 0b30cf0951b8ba4390db771d5d55358e21c3dde4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert

// Filesystem management code for floppy and hd images

// Currently limited to floppies and creation of preformatted images

#include "fsmgr.h"
#include "flopimg.h"

namespace fs {

void manager_t::enumerate_f(floppy_enumerator &fe) const
{
}

void manager_t::enumerate_h(hd_enumerator &he) const
{
}

void manager_t::enumerate_c(cdrom_enumerator &ce) const
{
}

bool manager_t::has_variant(const std::vector<u32> &variants, u32 variant)
{
	for(u32 v : variants)
		if(variant == v)
			return true;
	return false;
}

bool manager_t::has(u32 form_factor, const std::vector<u32> &variants, u32 ff, u32 variant)
{
	if(form_factor == floppy_image::FF_UNKNOWN)
		return true;
	if(form_factor != ff)
		return false;
	for(u32 v : variants)
		if(variant == v)
			return true;
	return false;
}

std::vector<meta_description> manager_t::volume_meta_description() const
{
	std::vector<meta_description> res;
	return res;
}

std::vector<meta_description> manager_t::file_meta_description() const
{
	std::vector<meta_description> res;
	return res;
}

std::vector<meta_description> manager_t::directory_meta_description() const
{
	std::vector<meta_description> res;
	return res;
}

char manager_t::directory_separator() const
{
	return 0; // Subdirectories not supported by default
}

manager_t::floppy_enumerator::floppy_enumerator(u32 form_factor, const std::vector<u32> &variants)
	: m_form_factor(form_factor)
	, m_variants(variants)
{
}

void manager_t::floppy_enumerator::add(const floppy_image_format_t &type, u32 form_factor, u32 variant, u32 image_size, const char *name, const char *description)
{
	if (has(m_form_factor, m_variants, form_factor, variant))
		add_format(type, image_size, name, description);
}

} // namespace fs