Frontend: Hook up "Start Disc"

This commit is contained in:
Connor McLaughlin 2019-10-20 20:47:27 +10:00
parent 795a3e7ca8
commit 0b58f1facf
2 changed files with 29 additions and 3 deletions

View file

@ -38,6 +38,9 @@
<ProjectReference Include="..\..\dep\imgui\imgui.vcxproj">
<Project>{bb08260f-6fbc-46af-8924-090ee71360c6}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\nativefiledialog\nativefiledialog.vcxproj">
<Project>{ace32f47-2960-4fb3-9f77-2c375625bf61}</Project>
</ProjectReference>
<ProjectReference Include="..\..\dep\YBaseLib\Source\YBaseLib.vcxproj">
<Project>{b56ce698-7300-4fa5-9609-942f1d05c5a2}</Project>
</ProjectReference>

View file

@ -13,6 +13,7 @@
#include <imgui.h>
#include <imgui_impl_opengl3.h>
#include <imgui_impl_sdl.h>
#include <nfd.h>
Log_SetChannel(SDLInterface);
SDLInterface::SDLInterface() = default;
@ -651,7 +652,8 @@ void SDLInterface::DrawPoweredOffWindow()
ImGui::NewLine();
ImGui::SetCursorPosX(button_left);
ImGui::Button("Start Disc", button_size);
if (ImGui::Button("Start Disc", button_size))
DoStartDisc();
ImGui::NewLine();
ImGui::SetCursorPosX(button_left);
@ -754,14 +756,35 @@ void SDLInterface::DoReset()
void SDLInterface::DoResume() {}
void SDLInterface::DoStartDisc() {}
void SDLInterface::DoStartDisc()
{
Assert(!m_system);
nfdchar_t* path = nullptr;
if (!NFD_OpenDialog("bin,img,cue,exe,psexe", nullptr, &path) || !path || std::strlen(path) == 0)
return;
AddOSDMessage(SmallString::FromFormat("Starting disc from '%s'...", path));
if (!InitializeSystem(path, nullptr))
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "System initialization failed.", m_window);
return;
}
ConnectDevices();
}
void SDLInterface::DoStartBIOS()
{
Assert(!m_system);
AddOSDMessage("Starting BIOS...");
InitializeSystem(nullptr, nullptr);
if (!InitializeSystem(nullptr, nullptr))
{
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "System initialization failed.", m_window);
return;
}
ConnectDevices();
}