Skip to content

HardDriveAPI ​

cpp
#include <VAmiga.h>
cpp
class HardDriveAPI

Defined in VAmiga.h:1347

API of a hard drive.

Public Attributes ​

ReturnNameDescription
HdControllerAPIcontrollerThe hard drive controller (Zorro board).

controller ​

cpp
HdControllerAPI controller

Type: HdControllerAPI

Defined in VAmiga.h:1356

The hard drive controller (Zorro board).

Public Methods ​

ReturnNameDescription
class HardDrive &getDriveGetter for the raw disk object.
const HardDriveConfig &getConfig constReturns the component's current configuration.
const HardDriveInfo &getInfo constReturns the component's current state.
const HardDriveInfo &getCachedInfo constReturns the most recent state snapshot recorded by the emulator thread (see getInfo()).
const HardDriveTraits &getTraits constProvides details about the hard drive and its partitions.
const PartitionTraits &getPartitionTraits constReturns the traits of a partition (see getTraits()).
boolgetFlagQueries a disk flag.
voidsetFlagSets or clears one or more disk flags.
std::vector< std::tuple< isize, isize, isize > >geometries constReturns possible drive geometries for a given capacity. The function takes a number of blocks and returns all common cyclinder/heads/sectors combinations that match the given size.
voidchangeGeometryChanges the drives geometry.
voidformatFormats the hard drive.
voidattachAttaches a hard drive provided by an URL to a media file.
voidattachAttaches a hard drive provided by a media file and makes it part of the workspace of an SVM.
voidattachAttaches a hard drive with a particular geometry.
voidattachAsyncAttaches a hard drive asynchronously and makes it part of the workspace of an SVM (see the version of attach() above).
voidcreateCreates a new hard drive in the workspace of an SVM.
voiddetachTakes the disk out of the drive.
voidimportFolderImports files from a folder.
voidimportFolderAsyncImports files from a folder asynchronously.
std::filesystem::pathpath constReturns the file the disk lives in.
voidloadIntoMemoryLoads the disk into memory and lets go of its image file.
voidsaveAsWrites the disk to a file and continues on top of it.
voidpersistWrites all changes back to the file the disk lives in.
voidwriteToFileExports the hard drive to an HDF file on disk.

getDrive ​

cpp
class HardDrive & getDrive()

Defined in VAmiga.h:1360

Getter for the raw disk object.


getConfig ​

const

cpp
const HardDriveConfig & getConfig() const

Defined in VAmiga.h:1364

Returns the component's current configuration.


getInfo ​

const

cpp
const HardDriveInfo & getInfo() const

Defined in VAmiga.h:1375

Returns the component's current state.

getInfo() reads the live state on the calling thread. The result is only consistent if the emulator is paused or suspended. getCachedInfo() returns the snapshot the emulator thread has recorded most recently, which is the one to use while the emulator runs. Both return references that can be overwritten by a later call or by the emulator thread, so copy the data if you need to keep it.


getCachedInfo ​

const

cpp
const HardDriveInfo & getCachedInfo() const

Defined in VAmiga.h:1377

Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).


getTraits ​

const

cpp
const HardDriveTraits & getTraits() const

Defined in VAmiga.h:1381

Provides details about the hard drive and its partitions.


getPartitionTraits ​

const

cpp
const PartitionTraits & getPartitionTraits(isize nr) const

Defined in VAmiga.h:1383

Returns the traits of a partition (see getTraits()).


getFlag ​

cpp
bool getFlag(DiskFlags mask)

Defined in VAmiga.h:1387

Queries a disk flag.


setFlag ​

cpp
void setFlag(DiskFlags mask, bool value)

Defined in VAmiga.h:1391

Sets or clears one or more disk flags.


geometries ​

const

cpp
std::vector< std::tuple< isize, isize, isize > > geometries(isize numBlocks) const

Defined in VAmiga.h:1397

Returns possible drive geometries for a given capacity. The function takes a number of blocks and returns all common cyclinder/heads/sectors combinations that match the given size.


changeGeometry ​

cpp
void changeGeometry(isize c, isize h, isize s, isize b = 512)

Defined in VAmiga.h:1405

Changes the drives geometry.

Parameters ​

ParameterTypeDescription
cisizeCylinders
hisizeHeads
sisizeSectors
bisizeBlock size

format ​

cpp
void format(retro::vault::amiga::FSFormat fs, const string & name)

Defined in VAmiga.h:1409

Formats the hard drive.


attach ​

cpp
void attach(const std::filesystem::path & path)

Defined in VAmiga.h:1417

Attaches a hard drive provided by an URL to a media file.

NOTE

The disk stays on top of the file (see loadIntoMemory()).

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path to the media file.

Exceptions ​

ExceptionDescription
Errorif the file cannot be read or does not contain valid data.

attach ​

cpp
void attach(const std::filesystem::path & path, retro::vault::SVMFile & svm)

Defined in VAmiga.h:1435

Attaches a hard drive provided by a media file and makes it part of the workspace of an SVM.

The file is copied into the workspace folder of the SVM, under the name of the drive (hd0.hdf for drive 0, and so on), and the drive is attached to the copy. A compressed file (.hdz) is uncompressed on the way. A folder is imported as it is.

NOTE

Saving the workspace afterwards makes the drive part of its configuration.

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path to the media file.
svmretro::vault::SVMFile &The SVM whose workspace takes the file

Exceptions ​

ExceptionDescription
Errorif the SVM file cannot be read or written, or if its content is invalid (synchronous versions).

attach ​

cpp
void attach(isize c, isize h, isize s, isize b = 512)

Defined in VAmiga.h:1475

Attaches a hard drive with a particular geometry.

Parameters ​

ParameterTypeDescription
cisizeNumber of cylinders
hisizeNumber of heads
sisizeNumber of sectors
bisizeBytes per sector

attachAsync ​

cpp
void attachAsync(const std::filesystem::path & path, retro::vault::SVMFile & svm)

Defined in VAmiga.h:1450

Attaches a hard drive asynchronously and makes it part of the workspace of an SVM (see the version of attach() above).

The request is handed to the emulator thread, which carries it out when it processes its command queue. The function returns immediately. The GUI is informed by an HDR_ATTACH message, which carries the number of the drive and, if the operation failed, the exception. The SVM is used on the emulator thread: it must stay alive, and untouched, until the message has arrived.

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path to the media file.
svmretro::vault::SVMFile &The SVM whose workspace takes the file

create ​

cpp
void create(retro::vault::SVMFile & svm, isize megabytes, retro::vault::amiga::FSFormat fs, const string & name)

Defined in VAmiga.h:1466

Creates a new hard drive in the workspace of an SVM.

An empty image of the given size is created as hdN.hdf, attached, and formatted. This is quick, even for a large drive. Use importFolder() to fill it.

Parameters ​

ParameterTypeDescription
svmretro::vault::SVMFile &The SVM whose workspace takes the image
megabytesisizeSize of the drive
fsretro::vault::amiga::FSFormatFile system to install (NODOS leaves the drive blank)
nameconst string &Name of the volume

Exceptions ​

ExceptionDescription
Errorif the SVM file cannot be read or written, or if its content is invalid (synchronous versions).

detach ​

cpp
void detach()

Defined in VAmiga.h:1481

Takes the disk out of the drive.

NOTE

The counterpart of attach(). The drive is left as it was before anything was attached.


importFolder ​

cpp
void importFolder(const std::filesystem::path & path)

Defined in VAmiga.h:1488

Imports files from a folder.

NOTE

All existing files are deleted prior to importing the folder.

Exceptions ​

ExceptionDescription
Errorif the file cannot be read or does not contain valid data.

importFolderAsync ​

cpp
void importFolderAsync(const std::filesystem::path & path)

Defined in VAmiga.h:1498

Imports files from a folder asynchronously.

The request is handed to the emulator thread, which carries it out when it processes its command queue. The function returns immediately. The GUI is informed by an HDR_IMPORTED message, which carries the number of the drive and, if the operation failed, the exception. When it succeeds, the changes have been written to the image file.


path ​

const

cpp
std::filesystem::path path() const

Defined in VAmiga.h:1503

Returns the file the disk lives in.

NOTE

The path is empty for a drive that was built in memory.


loadIntoMemory ​

cpp
void loadIntoMemory()

Defined in VAmiga.h:1510

Loads the disk into memory and lets go of its image file.

NOTE

A disk in memory becomes part of every snapshot, so the call throws for a drive larger than Opt::HDR_MEM_LIMIT allows. A drive that is in memory already is left alone.


saveAs ​

cpp
void saveAs(const std::filesystem::path & path)

Defined in VAmiga.h:1521

Writes the disk to a file and continues on top of it.

NOTE

Unlike writeToFile(), which exports a copy and leaves the drive where it is. A compressed file name (.hdz) is refused, because the drive cannot live in a compressed file; use writeToFile() to export one.

Parameters ​

ParameterTypeDescription
pathconst std::filesystem::path &Path of the file to create

Exceptions ​

ExceptionDescription
Errorif the file cannot be written.

persist ​

cpp
void persist()

Defined in VAmiga.h:1528

Writes all changes back to the file the disk lives in.

NOTE

Only what has changed is written. For a drive that was built in memory, the call has no effect. Opt::HDR_WRITE_THROUGH performs this call on its own (see WriteThroughMode).


writeToFile ​

cpp
void writeToFile(const std::filesystem::path & path)

Defined in VAmiga.h:1532

Exports the hard drive to an HDF file on disk.