Duckstation/src/core/cdrom.h

48 lines
1 KiB
C
Raw Normal View History

// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
2019-09-17 09:22:39 +00:00
#pragma once
2019-09-21 15:12:16 +00:00
#include "types.h"
2023-01-09 09:34:40 +00:00
#include <memory>
#include <string>
#include <tuple>
2023-01-09 09:34:40 +00:00
class CDImage;
2019-09-17 09:22:39 +00:00
class StateWrapper;
2019-10-15 07:27:35 +00:00
2023-01-09 09:34:40 +00:00
namespace CDROM {
2019-10-15 07:27:35 +00:00
2023-01-09 09:34:40 +00:00
void Initialize();
void Shutdown();
void Reset();
bool DoState(StateWrapper& sw);
2023-01-09 09:34:40 +00:00
bool HasMedia();
const std::string& GetMediaFileName();
const CDImage* GetMedia();
DiscRegion GetDiscRegion();
bool IsMediaPS1Disc();
2023-01-19 12:41:32 +00:00
bool IsMediaAudioCD();
2023-01-09 09:34:40 +00:00
bool DoesMediaRegionMatchConsole();
2019-10-15 07:27:35 +00:00
2023-01-09 09:34:40 +00:00
void InsertMedia(std::unique_ptr<CDImage> media);
std::unique_ptr<CDImage> RemoveMedia(bool for_disc_swap);
bool PrecacheMedia();
2019-09-17 09:22:39 +00:00
2023-01-09 09:34:40 +00:00
void CPUClockChanged();
2023-01-09 09:34:40 +00:00
// I/O
u8 ReadRegister(u32 offset);
void WriteRegister(u32 offset, u8 value);
void DMARead(u32* words, u32 word_count);
2023-01-09 09:34:40 +00:00
// Render statistics debug window.
void DrawDebugWindow();
2023-01-09 09:34:40 +00:00
void SetReadaheadSectors(u32 readahead_sectors);
2023-01-09 09:34:40 +00:00
/// Reads a frame from the audio FIFO, used by the SPU.
std::tuple<s16, s16> GetAudioFrame();
JIT optimizations and refactoring (#675) * CPU/Recompiler: Use rel32 call where possible for no-args * JitCodeBuffer: Support using preallocated buffer * CPU/Recompiler/AArch64: Use bl instead of blr for short branches * CPU/CodeCache: Allocate recompiler buffer in program space This means we don't need 64-bit moves for every call out of the recompiler. * GTE: Don't store as u16 and load as u32 * CPU/Recompiler: Add methods to emit global load/stores * GTE: Convert class to namespace * CPU/Recompiler: Call GTE functions directly * Settings: Turn into a global variable * GPU: Replace local pointers with global * InterruptController: Turn into a global pointer * System: Replace local pointers with global * Timers: Turn into a global instance * DMA: Turn into a global instance * SPU: Turn into a global instance * CDROM: Turn into a global instance * MDEC: Turn into a global instance * Pad: Turn into a global instance * SIO: Turn into a global instance * CDROM: Move audio FIFO to the heap * CPU/Recompiler: Drop ASMFunctions No longer needed since we have code in the same 4GB window. * CPUCodeCache: Turn class into namespace * Bus: Local pointer -> global pointers * CPU: Turn class into namespace * Bus: Turn into namespace * GTE: Store registers in CPU state struct Allows relative addressing on ARM. * CPU/Recompiler: Align code storage to page size * CPU/Recompiler: Fix relative branches on A64 * HostInterface: Local references to global * System: Turn into a namespace, move events out * Add guard pages * Android: Fix build
2020-07-31 07:09:18 +00:00
2023-01-09 09:34:40 +00:00
} // namespace CDROM