19 , syncDirAsDSKSetting(
20 reactor.getCommandController(),
"DirAsDSKmode",
21 "type of synchronisation between host directory and dir-as-dsk disk image",
26 reactor.getCommandController(),
"bootsector",
27 "boot sector type for dir-as-dsk",
29 {
"DOS1", DirAsDSK::BOOT_SECTOR_DOS1},
30 {
"DOS2", DirAsDSK::BOOT_SECTOR_DOS2}})
34std::unique_ptr<Disk> DiskFactory::createDisk(
35 const std::string& diskImage,
DiskChanger& diskChanger)
37 if (diskImage ==
"ramdsk") {
38 return std::make_unique<RamDSKDiskImage>();
44 return std::make_unique<DirAsDSK>(
48 syncDirAsDSKSetting.getEnum(),
49 bootSectorSetting.getEnum());
54 auto file = std::make_shared<File>(filename, File::PRE_CACHE);
57 return std::make_unique<XSADiskImage>(filename, *file);
64 return std::make_unique<DMKDiskImage>(filename, file);
69 return std::make_unique<DSKDiskImage>(filename, std::move(file));
79 auto pos = diskImage.find_last_of(
':');
80 if (pos == std::string::npos) {
84 std::shared_ptr<SectorAccessibleDisk> wholeDisk;
86 Filename filename2(diskImage.substr(0, pos));
87 wholeDisk = std::make_shared<DSKDiskImage>(filename2);
95 auto n = StringOp::stringToBase<10, unsigned>(std::string_view(diskImage).
substr(pos + 1));
103 return std::make_unique<DiskPartition>(disk, num, std::move(wholeDisk));
DiskFactory(Reactor &reactor)
This class represents a filename.
Contains the main loop of openMSX.
This file implemented 3 utility functions:
FileContext userFileContext(string_view savePath)
std::string_view substr(std::string_view utf8, std::string_view::size_type first=0, std::string_view::size_type len=std::string_view::npos)