2019-12-06 06:23:08 +00:00
|
|
|
#pragma once
|
|
|
|
#include "cd_image.h"
|
|
|
|
#include "types.h"
|
|
|
|
#include <array>
|
|
|
|
#include <cstdio>
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
class CDSubChannelReplacement
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum : u32
|
|
|
|
{
|
|
|
|
SUBCHANNEL_Q_SIZE = 12,
|
|
|
|
};
|
|
|
|
|
2020-06-23 09:04:16 +00:00
|
|
|
using ReplacementData = std::array<u8, SUBCHANNEL_Q_SIZE>;
|
|
|
|
|
2019-12-06 06:23:08 +00:00
|
|
|
CDSubChannelReplacement();
|
|
|
|
~CDSubChannelReplacement();
|
|
|
|
|
|
|
|
u32 GetReplacementSectorCount() const { return static_cast<u32>(m_replacement_subq.size()); }
|
|
|
|
|
|
|
|
bool LoadSBI(const char* path);
|
|
|
|
|
|
|
|
/// Returns the replacement subchannel data for the specified position (in BCD).
|
2020-06-23 09:04:16 +00:00
|
|
|
bool GetReplacementSubChannelQ(u8 minute_bcd, u8 second_bcd, u8 frame_bcd, ReplacementData& subq_data) const;
|
2019-12-06 06:23:08 +00:00
|
|
|
|
|
|
|
/// Returns the replacement subchannel data for the specified sector.
|
2020-06-23 09:04:16 +00:00
|
|
|
bool GetReplacementSubChannelQ(u32 lba, ReplacementData& subq_data) const;
|
2019-12-06 06:23:08 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
using ReplacementMap = std::unordered_map<u32, ReplacementData>;
|
|
|
|
|
2020-06-23 09:04:16 +00:00
|
|
|
ReplacementMap m_replacement_subq;
|
2019-12-06 06:23:08 +00:00
|
|
|
};
|