Frontend: Hook up change disc menu item

This commit is contained in:
Connor McLaughlin 2019-10-28 17:34:59 +10:00
parent 3128d0ebcb
commit 9bda6c5ef7
2 changed files with 17 additions and 1 deletions

View file

@ -752,7 +752,8 @@ void SDLInterface::DrawMainMenuBar()
ImGui::Separator();
ImGui::MenuItem("Change Disc", nullptr, false, system_enabled);
if (ImGui::MenuItem("Change Disc", nullptr, false, system_enabled))
DoChangeDisc();
if (ImGui::MenuItem("Frame Step", nullptr, false, system_enabled))
DoFrameStep();
@ -1166,6 +1167,20 @@ void SDLInterface::DoStartBIOS()
ClearImGuiFocus();
}
void SDLInterface::DoChangeDisc()
{
Assert(m_system);
nfdchar_t* path = nullptr;
if (!NFD_OpenDialog("bin,img,cue,exe,psexe", nullptr, &path) || !path || std::strlen(path) == 0)
return;
if (m_system->InsertMedia(path))
AddOSDMessage(SmallString::FromFormat("Switched CD to '%s'", path));
else
AddOSDMessage("Failed to switch CD. The log may contain further information.");
}
void SDLInterface::DoLoadState(u32 index)
{
if (!HasSystem() && !InitializeSystem(nullptr, nullptr))

View file

@ -70,6 +70,7 @@ private:
void DoResume();
void DoStartDisc();
void DoStartBIOS();
void DoChangeDisc();
void DoLoadState(u32 index);
void DoSaveState(u32 index);
void DoTogglePause();