mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-19 10:29:08 +00:00
Further minor style improvements.
This commit is contained in:
parent
4d9e897cc3
commit
2d83eeb9c4
@ -43,38 +43,33 @@ std::shared_ptr<Track> G64::get_track_at_position(Track::Address address) {
|
|||||||
file_.seek(static_cast<long>((address.position.as_half() * 4) + 0xc), SEEK_SET);
|
file_.seek(static_cast<long>((address.position.as_half() * 4) + 0xc), SEEK_SET);
|
||||||
|
|
||||||
// read the track offset
|
// read the track offset
|
||||||
uint32_t track_offset;
|
const uint32_t track_offset = file_.get32le();
|
||||||
track_offset = file_.get32le();
|
|
||||||
|
|
||||||
// if the track offset is zero, this track doesn't exist, so...
|
// if the track offset is zero, this track doesn't exist, so...
|
||||||
if(!track_offset) return resulting_track;
|
if(!track_offset) return nullptr;
|
||||||
|
|
||||||
// seek to the track start
|
// seek to the track start
|
||||||
file_.seek(static_cast<long>(track_offset), SEEK_SET);
|
file_.seek(static_cast<long>(track_offset), SEEK_SET);
|
||||||
|
|
||||||
// get the real track length
|
// get the real track length
|
||||||
uint16_t track_length;
|
const uint16_t track_length = file_.get16le();
|
||||||
track_length = file_.get16le();
|
|
||||||
|
|
||||||
// grab the byte contents of this track
|
// grab the byte contents of this track
|
||||||
std::vector<uint8_t> track_contents(track_length);
|
const std::vector<uint8_t> track_contents = file_.read(track_length);
|
||||||
file_.read(&track_contents[0], track_length);
|
|
||||||
|
|
||||||
// seek to this track's entry in the speed zone table
|
// seek to this track's entry in the speed zone table
|
||||||
file_.seek(static_cast<long>((address.position.as_half() * 4) + 0x15c), SEEK_SET);
|
file_.seek(static_cast<long>((address.position.as_half() * 4) + 0x15c), SEEK_SET);
|
||||||
|
|
||||||
// read the speed zone offsrt
|
// read the speed zone offsrt
|
||||||
uint32_t speed_zone_offset;
|
const uint32_t speed_zone_offset = file_.get32le();
|
||||||
speed_zone_offset = file_.get32le();
|
|
||||||
|
|
||||||
// if the speed zone is not constant, create a track based on the whole table; otherwise create one that's constant
|
// if the speed zone is not constant, create a track based on the whole table; otherwise create one that's constant
|
||||||
if(speed_zone_offset > 3) {
|
if(speed_zone_offset > 3) {
|
||||||
// seek to start of speed zone
|
// seek to start of speed zone
|
||||||
file_.seek(static_cast<long>(speed_zone_offset), SEEK_SET);
|
file_.seek(static_cast<long>(speed_zone_offset), SEEK_SET);
|
||||||
|
|
||||||
uint16_t speed_zone_length = (track_length + 3) >> 2;
|
|
||||||
|
|
||||||
// read the speed zone bytes
|
// read the speed zone bytes
|
||||||
|
const uint16_t speed_zone_length = (track_length + 3) >> 2;
|
||||||
uint8_t speed_zone_contents[speed_zone_length];
|
uint8_t speed_zone_contents[speed_zone_length];
|
||||||
file_.read(speed_zone_contents, speed_zone_length);
|
file_.read(speed_zone_contents, speed_zone_length);
|
||||||
|
|
||||||
|
@ -12,11 +12,8 @@
|
|||||||
using namespace Storage;
|
using namespace Storage;
|
||||||
|
|
||||||
Time Storage::Encodings::CommodoreGCR::length_of_a_bit_in_time_zone(unsigned int time_zone) {
|
Time Storage::Encodings::CommodoreGCR::length_of_a_bit_in_time_zone(unsigned int time_zone) {
|
||||||
Time duration;
|
|
||||||
// the speed zone divides a 4Mhz clock by 13, 14, 15 or 16, with higher-numbered zones being faster (i.e. each bit taking less time)
|
// the speed zone divides a 4Mhz clock by 13, 14, 15 or 16, with higher-numbered zones being faster (i.e. each bit taking less time)
|
||||||
duration.length = 16 - time_zone;
|
return Time(16 - time_zone, 4000000u);
|
||||||
duration.clock_rate = 4000000;
|
|
||||||
return duration;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Storage::Encodings::CommodoreGCR::encoding_for_nibble(uint8_t nibble) {
|
unsigned int Storage::Encodings::CommodoreGCR::encoding_for_nibble(uint8_t nibble) {
|
||||||
|
Loading…
Reference in New Issue
Block a user