bool IsInsertedDiscRunning() { if (!s_disc) return false; WaitUntilIdle(); return SConfig::GetInstance().GetGameID() == s_disc->GetGameID(); }
bool UpdateRunningGameMetadata(const DiscIO::Partition& partition, std::optional<u64> title_id) { if (!s_disc) return false; WaitUntilIdle(); if (title_id) { const std::optional<u64> volume_title_id = s_disc->GetTitleID(partition); if (!volume_title_id || *volume_title_id != *title_id) return false; } SConfig::GetInstance().SetRunningGameMetadata(*s_disc, partition); return true; }
void DoState(PointerWrap& p) { // By waiting for the DVD thread to be done working, we ensure // that s_request_queue will be empty and that the DVD thread // won't be touching anything while this function runs. WaitUntilIdle(); // Move all results from s_result_queue to s_result_map because // PointerWrap::Do supports std::map but not Common::SPSCQueue. // This won't affect the behavior of FinishRead. ReadResult result; while (s_result_queue.Pop(result)) s_result_map.emplace(result.first.id, std::move(result)); // Both queues are now empty, so we don't need to savestate them. p.Do(s_result_map); p.Do(s_next_id); // s_disc isn't savestated (because it points to files on the // local system). Instead, we check that the status of the disc // is the same as when the savestate was made. This won't catch // cases of having the wrong disc inserted, though. // TODO: Check the game ID, disc number, revision? bool had_disc = HasDisc(); p.Do(had_disc); if (had_disc != HasDisc()) { if (had_disc) PanicAlertT("An inserted disc was expected but not found."); else s_disc.reset(); } // TODO: Savestates can be smaller if the buffers of results aren't saved, // but instead get re-read from the disc when loading the savestate. // TODO: It would be possible to create a savestate faster by stopping // the DVD thread regardless of whether there are pending requests. // After loading a savestate, the debug log in FinishRead will report // screwed up times for requests that were submitted before the savestate // was made. Handling that properly may be more effort than it's worth. }
void FVulkanDevice::PrepareForDestroy() { WaitUntilIdle(); }
IOS::ES::TicketReader GetTicket(const DiscIO::Partition& partition) { WaitUntilIdle(); return s_disc->GetTicket(partition); }
void SetDisc(std::unique_ptr<DiscIO::Volume> disc) { WaitUntilIdle(); s_disc = std::move(disc); }