mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-18 06:25:37 +00:00
CDROM: Only apply extra remove delay on disc swap
This commit is contained in:
parent
13b2cf6b1c
commit
c2f4b7e7b8
|
@ -347,7 +347,7 @@ bool CDROM::DoesMediaRegionMatchConsole() const
|
||||||
void CDROM::InsertMedia(std::unique_ptr<CDImage> media)
|
void CDROM::InsertMedia(std::unique_ptr<CDImage> media)
|
||||||
{
|
{
|
||||||
if (CanReadMedia())
|
if (CanReadMedia())
|
||||||
RemoveMedia();
|
RemoveMedia(true);
|
||||||
|
|
||||||
// set the region from the system area of the disc
|
// set the region from the system area of the disc
|
||||||
m_disc_region = System::GetRegionForImage(media.get());
|
m_disc_region = System::GetRegionForImage(media.get());
|
||||||
|
@ -362,13 +362,15 @@ void CDROM::InsertMedia(std::unique_ptr<CDImage> media)
|
||||||
SetHoldPosition(0, true);
|
SetHoldPosition(0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CDImage> CDROM::RemoveMedia(bool force /* = false */)
|
std::unique_ptr<CDImage> CDROM::RemoveMedia(bool for_disc_swap)
|
||||||
{
|
{
|
||||||
if (!HasMedia() && !force)
|
if (!HasMedia())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Add an additional two seconds to the disc swap, some games don't like it happening too quickly.
|
// Add an additional two seconds to the disc swap, some games don't like it happening too quickly.
|
||||||
const TickCount stop_ticks = GetTicksForStop(true) + System::ScaleTicksToOverclock(System::MASTER_CLOCK * 2);
|
TickCount stop_ticks = GetTicksForStop(true);
|
||||||
|
if (for_disc_swap)
|
||||||
|
stop_ticks += System::ScaleTicksToOverclock(System::MASTER_CLOCK * 2);
|
||||||
|
|
||||||
Log_InfoPrintf("Removing CD...");
|
Log_InfoPrintf("Removing CD...");
|
||||||
std::unique_ptr<CDImage> image = m_reader.RemoveMedia();
|
std::unique_ptr<CDImage> image = m_reader.RemoveMedia();
|
||||||
|
@ -392,7 +394,7 @@ std::unique_ptr<CDImage> CDROM::RemoveMedia(bool force /* = false */)
|
||||||
SendAsyncErrorResponse(STAT_ERROR, 0x08);
|
SendAsyncErrorResponse(STAT_ERROR, 0x08);
|
||||||
|
|
||||||
// Begin spin-down timer, we can't swap the new disc in immediately for some games (e.g. Metal Gear Solid).
|
// Begin spin-down timer, we can't swap the new disc in immediately for some games (e.g. Metal Gear Solid).
|
||||||
if (!force)
|
if (for_disc_swap)
|
||||||
{
|
{
|
||||||
m_drive_state = DriveState::ShellOpening;
|
m_drive_state = DriveState::ShellOpening;
|
||||||
m_drive_event->SetIntervalAndSchedule(stop_ticks);
|
m_drive_event->SetIntervalAndSchedule(stop_ticks);
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
bool DoesMediaRegionMatchConsole() const;
|
bool DoesMediaRegionMatchConsole() const;
|
||||||
|
|
||||||
void InsertMedia(std::unique_ptr<CDImage> media);
|
void InsertMedia(std::unique_ptr<CDImage> media);
|
||||||
std::unique_ptr<CDImage> RemoveMedia(bool force = false);
|
std::unique_ptr<CDImage> RemoveMedia(bool for_disc_swap);
|
||||||
bool PrecacheMedia();
|
bool PrecacheMedia();
|
||||||
|
|
||||||
void CPUClockChanged();
|
void CPUClockChanged();
|
||||||
|
|
|
@ -1713,7 +1713,7 @@ bool System::DoLoadState(ByteStream* state, bool force_software_renderer, bool u
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CDImage> old_media = g_cdrom.RemoveMedia();
|
std::unique_ptr<CDImage> old_media = g_cdrom.RemoveMedia(false);
|
||||||
if (old_media && old_media->GetFileName() == media_filename)
|
if (old_media && old_media->GetFileName() == media_filename)
|
||||||
{
|
{
|
||||||
Log_InfoPrintf("Re-using same media '%s'", media_filename.c_str());
|
Log_InfoPrintf("Re-using same media '%s'", media_filename.c_str());
|
||||||
|
@ -1776,7 +1776,7 @@ bool System::DoLoadState(ByteStream* state, bool force_software_renderer, bool u
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
g_cdrom.RemoveMedia();
|
g_cdrom.RemoveMedia(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure the correct card is loaded
|
// ensure the correct card is loaded
|
||||||
|
@ -2803,7 +2803,7 @@ bool System::InsertMedia(const char* path)
|
||||||
|
|
||||||
void System::RemoveMedia()
|
void System::RemoveMedia()
|
||||||
{
|
{
|
||||||
g_cdrom.RemoveMedia();
|
g_cdrom.RemoveMedia(false);
|
||||||
ClearMemorySaveStates();
|
ClearMemorySaveStates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2955,7 +2955,7 @@ bool System::SwitchMediaSubImage(u32 index)
|
||||||
if (!g_cdrom.HasMedia())
|
if (!g_cdrom.HasMedia())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
std::unique_ptr<CDImage> image = g_cdrom.RemoveMedia();
|
std::unique_ptr<CDImage> image = g_cdrom.RemoveMedia(true);
|
||||||
Assert(image);
|
Assert(image);
|
||||||
|
|
||||||
Common::Error error;
|
Common::Error error;
|
||||||
|
|
Loading…
Reference in a new issue