Prepare new LBA representation
This commit is contained in:
@@ -44,7 +44,7 @@ namespace JabyEngine {
|
||||
return const_cast<volatile State&>(current_state);
|
||||
}
|
||||
|
||||
void read_file(FileInfo file_info, const SectorBufferAllocator& buffer_allocator);
|
||||
void read_file(AutoLBAEntry file_info, const SectorBufferAllocator& buffer_allocator);
|
||||
void continue_reading();
|
||||
}
|
||||
}
|
||||
|
@@ -17,15 +17,6 @@ namespace JabyEngine {
|
||||
Error,
|
||||
};
|
||||
|
||||
struct FileInfo {
|
||||
uint16_t lba;
|
||||
uint16_t sectors;
|
||||
|
||||
static constexpr FileInfo from(const AutoLBAEntry& entry) {
|
||||
return FileInfo{entry.lba, CD_IO::DataSector::words_to_sectors(entry.size_words)};
|
||||
}
|
||||
};
|
||||
|
||||
class SectorBufferAllocator {
|
||||
private:
|
||||
typedef CD_IO::DataSector* (*AllocatorFunction)(void* ctx);
|
||||
@@ -61,17 +52,13 @@ namespace JabyEngine {
|
||||
uint8_t sec;
|
||||
uint8_t sector;
|
||||
|
||||
static constexpr CDTimeStamp from(uint16_t lba) {
|
||||
const auto [min, new_lba] = div_and_mod(lba, static_cast<uint16_t>(MaxSector*MaxSeconds));
|
||||
const auto [sec, sectors] = div_and_mod(new_lba, static_cast<uint16_t>(MaxSector));
|
||||
static constexpr CDTimeStamp from(uint32_t lba) {
|
||||
const auto [min, new_lba] = div_and_mod(lba, MaxSector*MaxSeconds);
|
||||
const auto [sec, sectors] = div_and_mod(new_lba, MaxSector);
|
||||
|
||||
return CDTimeStamp{static_cast<uint8_t>(min), static_cast<uint8_t>(sec), static_cast<uint8_t>(sectors)};
|
||||
}
|
||||
|
||||
static constexpr CDTimeStamp from(const FileInfo& file_info) {
|
||||
return CDTimeStamp::from(file_info.lba);
|
||||
}
|
||||
|
||||
constexpr uint8_t get_min_cd() const {
|
||||
return to_bcd(this->min);
|
||||
}
|
||||
|
Reference in New Issue
Block a user