Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/core/cdrom_subq_replacement.h
4214 views
1
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "util/cd_image.h"
7
8
#include <cstdio>
9
#include <unordered_map>
10
11
class CDROMSubQReplacement
12
{
13
public:
14
CDROMSubQReplacement();
15
~CDROMSubQReplacement();
16
17
// NOTE: Can return true if no sbi is available, false means load/parse error.
18
static bool LoadForImage(std::unique_ptr<CDROMSubQReplacement>* ret, CDImage* image, std::string_view serial,
19
std::string_view title, Error* error);
20
21
size_t GetReplacementSectorCount() const { return m_replacement_subq.size(); }
22
23
/// Returns the replacement subchannel data for the specified sector.
24
const CDImage::SubChannelQ* GetReplacementSubQ(u32 lba) const;
25
26
private:
27
using ReplacementMap = std::unordered_map<u32, CDImage::SubChannelQ>;
28
29
static std::unique_ptr<CDROMSubQReplacement> LoadSBI(const std::string& path, std::FILE* fp, Error* error);
30
static std::unique_ptr<CDROMSubQReplacement> LoadLSD(const std::string& path, std::FILE* fp, Error* error);
31
32
ReplacementMap m_replacement_subq;
33
};
34
35