CDImage: Support sub-images, use subimages for m3u

This commit is contained in:
Connor McLaughlin
2021-03-27 02:19:23 +10:00
parent 573aa6d9cc
commit 50d712c3fe
23 changed files with 443 additions and 312 deletions

View File

@ -914,8 +914,8 @@ void QtHostInterface::changeDiscFromPlaylist(quint32 index)
if (System::IsShutdown())
return;
if (!System::SwitchMediaFromPlaylist(index))
ReportFormattedError("Failed to switch to playlist index %u", index);
if (!System::SwitchMediaSubImage(index))
ReportFormattedError("Failed to switch to subimage %u", index);
}
static QString FormatTimestampForSaveStateMenu(u64 timestamp)
@ -1063,15 +1063,15 @@ void QtHostInterface::populateGameListContextMenu(const GameListEntry* entry, QW
void QtHostInterface::populatePlaylistEntryMenu(QMenu* menu)
{
if (!System::IsValid())
if (!System::IsValid() || !System::HasMediaSubImages())
return;
QActionGroup* ag = new QActionGroup(menu);
const u32 count = System::GetMediaPlaylistCount();
const u32 current = System::GetMediaPlaylistIndex();
const u32 count = System::GetMediaSubImageCount();
const u32 current = System::GetMediaSubImageIndex();
for (u32 i = 0; i < count; i++)
{
QAction* action = ag->addAction(QString::fromStdString(System::GetMediaPlaylistPath(i)));
QAction* action = ag->addAction(QString::fromStdString(System::GetMediaSubImageTitle(i)));
action->setCheckable(true);
action->setChecked(i == current);
connect(action, &QAction::triggered, [this, i]() { changeDiscFromPlaylist(i); });