mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-05 23:56:33 +00:00
Adds write support.
This commit is contained in:
parent
5598802439
commit
30cef1ee22
@ -31,3 +31,9 @@ std::vector<uint8_t> HFV::get_block(size_t address) {
|
|||||||
file_.seek(file_offset, SEEK_SET);
|
file_.seek(file_offset, SEEK_SET);
|
||||||
return file_.read(get_block_size());
|
return file_.read(get_block_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HFV::set_block(size_t address, const std::vector<uint8_t> &contents) {
|
||||||
|
const long file_offset = long(get_block_size() * address);
|
||||||
|
file_.seek(file_offset, SEEK_SET);
|
||||||
|
file_.write(contents);
|
||||||
|
}
|
||||||
|
@ -29,6 +29,7 @@ class HFV: public MassStorageDevice {
|
|||||||
size_t get_block_size() final;
|
size_t get_block_size() final;
|
||||||
size_t get_number_of_blocks() final;
|
size_t get_number_of_blocks() final;
|
||||||
std::vector<uint8_t> get_block(size_t address) final;
|
std::vector<uint8_t> get_block(size_t address) final;
|
||||||
|
void set_block(size_t address, const std::vector<uint8_t> &) final;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user