Appearance
HardDriveAPI
cpp
#include <VAmiga.h>cpp
class HardDriveAPIDefined in VAmiga.h:1347
API of a hard drive.
Public Attributes
| Return | Name | Description |
|---|---|---|
HdControllerAPI | controller | The hard drive controller (Zorro board). |
controller
cpp
HdControllerAPI controllerType: HdControllerAPI
Defined in VAmiga.h:1356
The hard drive controller (Zorro board).
Public Methods
| Return | Name | Description |
|---|---|---|
class HardDrive & | getDrive | Getter for the raw disk object. |
const HardDriveConfig & | getConfig const | Returns the component's current configuration. |
const HardDriveInfo & | getInfo const | Returns the component's current state. |
const HardDriveInfo & | getCachedInfo const | Returns the most recent state snapshot recorded by the emulator thread (see getInfo()). |
const HardDriveTraits & | getTraits const | Provides details about the hard drive and its partitions. |
const PartitionTraits & | getPartitionTraits const | Returns the traits of a partition (see getTraits()). |
bool | getFlag | Queries a disk flag. |
void | setFlag | Sets or clears one or more disk flags. |
std::vector< std::tuple< isize, isize, isize > > | geometries const | 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. |
void | changeGeometry | Changes the drives geometry. |
void | format | Formats the hard drive. |
void | attach | Attaches a hard drive provided by an URL to a media file. |
void | attach | Attaches a hard drive provided by a media file and makes it part of the workspace of an SVM. |
void | attach | Attaches a hard drive with a particular geometry. |
void | attachAsync | Attaches a hard drive asynchronously and makes it part of the workspace of an SVM (see the version of attach() above). |
void | create | Creates a new hard drive in the workspace of an SVM. |
void | detach | Takes the disk out of the drive. |
void | importFolder | Imports files from a folder. |
void | importFolderAsync | Imports files from a folder asynchronously. |
std::filesystem::path | path const | Returns the file the disk lives in. |
void | loadIntoMemory | Loads the disk into memory and lets go of its image file. |
void | saveAs | Writes the disk to a file and continues on top of it. |
void | persist | Writes all changes back to the file the disk lives in. |
void | writeToFile | Exports 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() constDefined in VAmiga.h:1364
Returns the component's current configuration.
getInfo
const
cpp
const HardDriveInfo & getInfo() constDefined 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() constDefined in VAmiga.h:1377
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).
getTraits
const
cpp
const HardDriveTraits & getTraits() constDefined in VAmiga.h:1381
Provides details about the hard drive and its partitions.
getPartitionTraits
const
cpp
const PartitionTraits & getPartitionTraits(isize nr) constDefined 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) constDefined 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
| Parameter | Type | Description |
|---|---|---|
c | isize | Cylinders |
h | isize | Heads |
s | isize | Sectors |
b | isize | Block 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path to the media file. |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path to the media file. |
svm | retro::vault::SVMFile & | The SVM whose workspace takes the file |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Parameter | Type | Description |
|---|---|---|
c | isize | Number of cylinders |
h | isize | Number of heads |
s | isize | Number of sectors |
b | isize | Bytes 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path to the media file. |
svm | retro::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
| Parameter | Type | Description |
|---|---|---|
svm | retro::vault::SVMFile & | The SVM whose workspace takes the image |
megabytes | isize | Size of the drive |
fs | retro::vault::amiga::FSFormat | File system to install (NODOS leaves the drive blank) |
name | const string & | Name of the volume |
Exceptions
| Exception | Description |
|---|---|
Error | if 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
| Exception | Description |
|---|---|
Error | if 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() constDefined 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
| Parameter | Type | Description |
|---|---|---|
path | const std::filesystem::path & | Path of the file to create |
Exceptions
| Exception | Description |
|---|---|
Error | if 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.