Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
stenzek
GitHub Repository: stenzek/duckstation
Path: blob/master/src/core/cdrom.h
4211 views
1
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <[email protected]>
2
// SPDX-License-Identifier: CC-BY-NC-ND-4.0
3
4
#pragma once
5
6
#include "types.h"
7
8
#include <memory>
9
#include <string>
10
#include <tuple>
11
#include <utility>
12
13
class Error;
14
class CDImage;
15
class StateWrapper;
16
17
namespace CDROM {
18
19
void Initialize();
20
void Shutdown();
21
void Reset();
22
bool DoState(StateWrapper& sw);
23
24
bool HasMedia();
25
const std::string& GetMediaPath();
26
u32 GetCurrentSubImage();
27
const CDImage* GetMedia();
28
DiscRegion GetDiscRegion();
29
bool IsMediaPS1Disc();
30
bool IsMediaAudioCD();
31
bool DoesMediaRegionMatchConsole();
32
33
bool InsertMedia(std::unique_ptr<CDImage>& media, DiscRegion region, std::string_view serial, std::string_view title,
34
Error* error);
35
std::unique_ptr<CDImage> RemoveMedia(bool for_disc_swap);
36
bool PrecacheMedia();
37
bool HasNonStandardOrReplacementSubQ();
38
39
void CPUClockChanged();
40
41
// I/O
42
u8 ReadRegister(u32 offset);
43
void WriteRegister(u32 offset, u8 value);
44
void DMARead(u32* words, u32 word_count);
45
46
// Render statistics debug window.
47
void DrawDebugWindow(float scale);
48
49
void SetReadaheadSectors(u32 readahead_sectors);
50
void DisableReadSpeedup();
51
52
/// Reads a frame from the audio FIFO, used by the SPU.
53
std::tuple<s16, s16> GetAudioFrame();
54
55
} // namespace CDROM
56
57