79 lines
2.1 KiB
C++
79 lines
2.1 KiB
C++
#include "MainWindow.hpp"
|
|
#ifdef _WIN32
|
|
#include "D3D.hpp"
|
|
#include <imgui_impl_dx11.cpp>
|
|
#endif
|
|
|
|
#include <imgui_impl_sdl2.h>
|
|
#include <imgui.h>
|
|
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "SDL.hpp"
|
|
#include "../Scsi/CdRom.hpp"
|
|
|
|
namespace Li::Gui {
|
|
|
|
std::string getDrivesList() {
|
|
std::vector<std::string>* drives = Li::Scsi::CdRom::ListOpticalDrives();
|
|
|
|
std::string drivesComboBox = "";
|
|
for (std::string drive : *drives) {
|
|
drivesComboBox += drive + '\0';
|
|
}
|
|
|
|
return drivesComboBox;
|
|
}
|
|
|
|
MainWindow::MainWindow() {
|
|
this->sdl = new SDL("DumpDVD", 800, 400);
|
|
bool showDemoWindow = true;
|
|
int selectedDrive = 0;
|
|
ImGuiWindowFlags windowFlags = 0;
|
|
windowFlags |= ImGuiWindowFlags_NoCollapse;
|
|
int selectedDriveSpeed = 22;
|
|
|
|
std::string drives = getDrivesList();
|
|
|
|
while (!this->sdl->IsExiting()) {
|
|
this->sdl->PollEvent();
|
|
this->sdl->NewFrame();
|
|
|
|
const ImGuiViewport* mainViewport = ImGui::GetMainViewport();
|
|
ImGui::SetNextWindowPos(ImVec2(mainViewport->WorkPos.x, mainViewport->WorkPos.y), ImGuiCond_FirstUseEver);
|
|
ImGui::SetNextWindowSize(ImVec2(550, 680), ImGuiCond_FirstUseEver);
|
|
|
|
ImGui::Begin("DVD Dumper", NULL, windowFlags);
|
|
ImGui::Text("Select Drive:");
|
|
ImGui::SameLine();
|
|
ImGui::Combo("", &selectedDrive, drives.c_str());
|
|
ImGui::SameLine();
|
|
if (ImGui::Button("Refresh", ImVec2(70, 20))) {
|
|
drives = getDrivesList();
|
|
}
|
|
|
|
const int numDrvSpeeds = 23;
|
|
const char* driveSepeds[numDrvSpeeds] = { "1x", "2x", "2.4x", "3x", "4x", "5x",
|
|
"6x", "8x", "10x", "12x", "14x", "16x",
|
|
"18x", "20x", "22x", "24x", "32x", "40x",
|
|
"44x", "48x", "52x", "56x", "MAX"};
|
|
const char* driveSpeedName = (selectedDriveSpeed >= 0 && selectedDriveSpeed < numDrvSpeeds) ? driveSepeds[selectedDriveSpeed] : "Unknown";
|
|
ImGui::Text("Read Speed:");
|
|
ImGui::SameLine();
|
|
ImGui::SliderInt("", &selectedDriveSpeed, 0, numDrvSpeeds - 1, driveSpeedName);
|
|
|
|
ImGui::End();
|
|
if (showDemoWindow)
|
|
ImGui::ShowDemoWindow(&showDemoWindow);
|
|
|
|
this->sdl->Render();
|
|
}
|
|
|
|
}
|
|
|
|
MainWindow::~MainWindow() {
|
|
|
|
}
|
|
|
|
} |