DumpDVD/DumpDVD/Main.cpp

66 lines
1.8 KiB
C++

#include <iostream>
#include "Gui/MainWindow.hpp"
#ifdef _WIN32
#include <Windows.h>
#endif
//#include "Extra.h"
//#include <windows.h>
//const int readAtOnce = 0x1000;
//static uint8_t buffer[DVDCSS_BLOCK_SIZE * readAtOnce];
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hInstPrev, PSTR cmdline, int cmdshow)
{
Li::Gui::MainWindow* mainWindow = new Li::Gui::MainWindow();
delete mainWindow;
/*FILE* fd;
fopen_s(&fd, "out.iso", "wb");
if (fd == NULL) return 1;
dvdcss_t drive = dvdcss_open(argv[1]);
HANDLE handle = (HANDLE)dvdcss_get_raw_fd(drive);
uint64_t totalSectors = getTotalSectors(handle);
allowReadPastDisc(handle);
setDriveSpeed(handle, 0xFFFF, 0xFFFF);
dvdcss_seek(drive, 0, DVDCSS_SEEK_KEY);
time_t stime;
time(&stime);
uint64_t currentSector = 0;
int sectorsRead = 0;
do {
int sectorsToRead = readAtOnce;
if ( (currentSector + sectorsToRead) > totalSectors) {
sectorsToRead = totalSectors - currentSector;
}
sectorsRead = dvdcss_read(drive, buffer, sectorsToRead, DVDCSS_READ_DECRYPT);
if (sectorsRead <= 0) {
printf("\nthere was an error; SectorsRead = %i\nLastError = %i\n", sectorsRead, GetLastError());
break;
}
fwrite(buffer, DVDCSS_BLOCK_SIZE * sectorsRead, 1, fd);
currentSector += sectorsRead;
float progress = (((float)currentSector / (float)totalSectors) * 100.0);
printf("ripping dvd: %llu/%llu %f%%\r", currentSector, totalSectors, progress);
} while (currentSector < totalSectors);
time_t etime;
time(&etime);
time_t difference = (etime - stime);
printf("\nstart time: %llu \nend time: %llu \n\ntotal time taken: %llus\n", stime, etime, difference);
fclose(fd);
return 0;*/
}