CDROM: Special case immediate GetlocP after play/read before int

Fixes CDDA in Mad Panic Coaster.
This commit is contained in:
Connor McLaughlin
2021-10-27 20:03:55 +10:00
parent 58f05498e5
commit 25f69e7f8c
15 changed files with 68 additions and 60 deletions

View File

@ -1913,7 +1913,18 @@ void CDROM::UpdatePhysicalPosition(bool update_logical)
const u32 ticks = TimingEvents::GetGlobalTickCounter();
if (IsSeeking() || IsReadingOrPlaying() || !m_secondary_status.motor_on)
{
// set by the event
// If we're seeking+reading the first sector (no stat bits set), we need to return the set/current lba, not the last
// physical LBA. Failing to do so may result in a track-jumped position getting returned in GetlocP, which causes
// Mad Panic Coaster to go into a seek+play loop.
if ((m_secondary_status.bits & (STAT_READING | STAT_PLAYING_CDDA | STAT_MOTOR_ON)) == STAT_MOTOR_ON &&
m_current_lba != m_physical_lba)
{
Log_WarningPrintf("Jumping to hold position [%u->%u] while %s first sector", m_physical_lba, m_current_lba,
(m_drive_state == DriveState::Reading) ? "reading" : "playing");
SetHoldPosition(m_current_lba, true);
}
// Otherwise, this gets updated by the read event.
return;
}

View File

@ -456,25 +456,6 @@ bool HostInterface::SaveState(const char* filename)
return result;
}
void HostInterface::OnSystemCreated() {}
void HostInterface::OnSystemPaused(bool paused) {}
void HostInterface::OnSystemDestroyed() {}
void HostInterface::OnSystemPerformanceCountersUpdated() {}
void HostInterface::OnDisplayInvalidated() {}
void HostInterface::OnSystemStateSaved(bool global, s32 slot) {}
void HostInterface::OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title)
{
}
void HostInterface::OnControllerTypeChanged(u32 slot) {}
std::string HostInterface::GetShaderCacheBasePath() const
{
return GetUserDirectoryRelativePath("cache/");
@ -1197,13 +1178,3 @@ void HostInterface::RecreateSystem()
System::ResetThrottler();
OnDisplayInvalidated();
}
void HostInterface::SetMouseMode(bool relative, bool hide_cursor) {}
void HostInterface::DisplayLoadingScreen(const char* message, int progress_min /*= -1*/, int progress_max /*= -1*/,
int progress_value /*= -1*/)
{
Log_InfoPrintf("Loading: %s %d of %d-%d", message, progress_value, progress_min, progress_max);
}
void HostInterface::GetGameInfo(const char* path, CDImage* image, std::string* code, std::string* title) {}

View File

@ -88,10 +88,10 @@ public:
/// Displays a loading screen with the logo, rendered with ImGui. Use when executing possibly-time-consuming tasks
/// such as compiling shaders when starting up.
virtual void DisplayLoadingScreen(const char* message, int progress_min = -1, int progress_max = -1,
int progress_value = -1);
int progress_value = -1) = 0;
/// Retrieves information about specified game from game list.
virtual void GetGameInfo(const char* path, CDImage* image, std::string* code, std::string* title);
virtual void GetGameInfo(const char* path, CDImage* image, std::string* code, std::string* title) = 0;
/// Returns the directory where per-game memory cards will be saved.
virtual std::string GetMemoryCardDirectory() const;
@ -147,11 +147,11 @@ public:
virtual std::unique_ptr<ByteStream> OpenPackageFile(const char* path, u32 flags) = 0;
virtual void OnRunningGameChanged(const std::string& path, CDImage* image, const std::string& game_code,
const std::string& game_title);
virtual void OnSystemPerformanceCountersUpdated();
const std::string& game_title) = 0;
virtual void OnSystemPerformanceCountersUpdated() = 0;
/// Called when the display is invalidated (e.g. a state is loaded).
virtual void OnDisplayInvalidated();
virtual void OnDisplayInvalidated() = 0;
protected:
virtual bool AcquireHostDisplay() = 0;
@ -159,11 +159,10 @@ protected:
virtual std::unique_ptr<AudioStream> CreateAudioStream(AudioBackend backend) = 0;
virtual s32 GetAudioOutputVolume() const;
virtual void OnSystemCreated();
virtual void OnSystemPaused(bool paused);
virtual void OnSystemDestroyed();
virtual void OnSystemStateSaved(bool global, s32 slot);
virtual void OnControllerTypeChanged(u32 slot);
virtual void OnSystemCreated() = 0;
virtual void OnSystemPaused(bool paused) = 0;
virtual void OnSystemDestroyed() = 0;
virtual void OnControllerTypeChanged(u32 slot) = 0;
/// Restores all settings to defaults.
virtual void SetDefaultSettings(SettingsInterface& si);
@ -184,7 +183,7 @@ protected:
virtual void RecreateSystem();
/// Enables "relative" mouse mode, locking the cursor position and returning relative coordinates.
virtual void SetMouseMode(bool relative, bool hide_cursor);
virtual void SetMouseMode(bool relative, bool hide_cursor) = 0;
/// Call when host display size changes, use with "match display" aspect ratio setting.
virtual void OnHostDisplayResized();