// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin // SPDX-License-Identifier: CC-BY-NC-ND-4.0 #pragma once #include "util/cd_image.h" #include class CDROMSubQReplacement { public: CDROMSubQReplacement(); ~CDROMSubQReplacement(); // NOTE: Can return true if no sbi is available, false means load/parse error. static bool LoadForImage(std::unique_ptr* ret, CDImage* image, std::string_view serial, std::string_view title, Error* error); size_t GetReplacementSectorCount() const { return m_replacement_subq.size(); } /// Returns the replacement subchannel data for the specified sector. const CDImage::SubChannelQ* GetReplacementSubQ(u32 lba) const; private: using ReplacementMap = std::unordered_map; static std::unique_ptr LoadSBI(const std::string& path, Error* error); static std::unique_ptr LoadLSD(const std::string& path, Error* error); ReplacementMap m_replacement_subq; };