www.pudn.com > dvdmb-src-0.2.9.zip > dvdmb.cpp


/* 
DVD Master Backup v0.2.9 
*/ 
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include "dvdmb_logo.xpm" 
 
Fl_Pixmap *logo; 
static Fl_Box *image_box; 
 
Fl_Menu_Bar *menubar; 
Fl_Help_Dialog *help; 
Fl_Window *window; 
Fl_Window *window2; 
Fl_Window *window3; 
Fl_Window *window4; 
Fl_Window *window5; 
Fl_Progress *progress; 
Fl_Progress *progress1; 
Fl_Box *label_01; 
Fl_Box *label_02; 
Fl_Box *label_03; 
Fl_Box *label_04; 
Fl_Box *label_05; 
Fl_Box *label_06; 
Fl_Box *label_07; 
Fl_Box *label_08; 
Fl_Box *label_09; 
Fl_Box *label_10; 
Fl_Box *label_11; 
Fl_Box *label_12; 
Fl_Box *label_13; 
Fl_Box *label_14; 
Fl_Box *label_15; 
Fl_Box *label_16; 
Fl_Menu_Button *menu_button_02; 
Fl_Menu_Button *menu_button_03; 
Fl_Menu_Button *menu_button_04; 
Fl_Menu_Button *menu_button_05; 
Fl_Menu_Button *menu_button_06; 
Fl_Menu_Button *menu_button_07; 
Fl_Output *output_box_01; 
Fl_Output *output_box_02; 
Fl_Output *output_box_03; 
Fl_Output *output_box_10; 
Fl_Output *output_box_11; 
Fl_Output *output_box_12; 
Fl_Output *output_box_13; 
Fl_Output *output_box_14; 
Fl_Input *input_box_01; 
Fl_Button *button1; 
int button1_data; 
Fl_Light_Button *button2; 
int button2_data; 
Fl_Light_Button *button3; 
int button3_data; 
Fl_Button *button4; 
int button4_data; 
Fl_Button *button5; 
int button5_data; 
Fl_Button *button6; 
int button6_data; 
Fl_Button *button7; 
int button7_data; 
Fl_Button *button8; 
int button8_data; 
Fl_Button *button9; 
int button9_data; 
Fl_Button *button10; 
int button10_data; 
Fl_Button *button11; 
int button11_data; 
char *output_dir = "\\"; 
char *drive_letter = "\\"; 
char path_output_dir[255]; 
char dvd_drive[16]; 
char output_drive[16]; 
char processing_vts[255]; 
char * Search_Result; 
char * ch; 
char endfile[255] = ""; 
int vob = 0; 
char avi_filename[255] = ""; 
char old_avi_filename[255] = ""; 
char remove_file[255] = ""; 
char remove_file_command[255] = ""; 
char lang[255] = "0x80"; // default soundtrack 
char movie_title[3] = "01"; // default movie number 
//char vob_file[3] = "01"; // default movie number 
char selected_lang[255] = "English"; // default language 
char bitrate[255] = "400"; // Default bitrate 
char framerate[255] =  "-f0"; // NTSC 
int avi_size = 650; // avi size base 
//char avi_resolution = "352 240"; // 512 296 
char avi_resolution_x[255] = "352"; 
char avi_resolution_y[255] = "240"; 
char test_file[255] = ""; 
int main_movie = 1; 
int cle_de_fichier = 0; 
long taille_fichier = 0; 
char char_taille_fichier[255] = ""; 
char preview_mpeg2avi_command_line[255] = ""; 
int vcd = 0; 
int ntsc = 0; 
int pal = 0; 
int ac3 = 0; 
int mp3 = 1; 
char ac3_text[255]; 
char mp3_text[255]; 
 
void dvdmb_launcher(){ 
char dvdmb_launcher_ini[255]; 
char copy_files_dest[255]; 
strcpy(dvdmb_launcher_ini, output_dir); 
strcat(dvdmb_launcher_ini, "\\divx\\dvdmb_launcher.ini"); 
WritePrivateProfileString("CONFIG","movie_title", input_box_01->value(), dvdmb_launcher_ini); 
strcpy(copy_files_dest, output_dir); 
strcat(copy_files_dest, "\\divx\\klcodec203b.exe"); 
CopyFile(".\\klcodec203b.exe", copy_files_dest, FALSE); 
strcpy(copy_files_dest, output_dir); 
strcat(copy_files_dest, "\\divx\\dvdmb_launcher.exe"); 
CopyFile(".\\dvdmb_launcher.exe", copy_files_dest, FALSE); 
strcpy(copy_files_dest, output_dir); 
strcat(copy_files_dest, "\\divx\\autorun.inf"); 
CopyFile(".\\autorun.inf", copy_files_dest, FALSE); 
}  
 
void options(){ 
GetPrivateProfileString("CONFIG","AC3","",ac3_text,255,".\\dvdmb.ini"); 
GetPrivateProfileString("CONFIG","MP3","",mp3_text,255,".\\dvdmb.ini"); 
ac3 = atoi(ac3_text); 
mp3 = atoi(mp3_text); 
if (ac3 == 1){output_box_14->value("AC3");} 
if (mp3 == 1){output_box_14->value("MP3");} 
window5->show(); 
} 
 
int check_connection(){ 
 
} 
 
int check_version(){ 
HINSTANCE hInstance = ShellExecute(NULL, "open", "http://dvdmb.nlvtelecom.com/cgi-bin/checkver.cgi?ver=29", NULL, NULL, SW_NORMAL); 
} 
 
int ReplaceTerm(char *szSource, char *szDest, char *szTerm, char *szReplace) 
    { 
char *szLast; 
char *szLocation; 
int nOccurances = 0; 
if (!szSource || !szDest) { 
return -1; 
} 
szDest[0] = NULL; 
szLast = szSource; 
szLocation = strstr(szLast, szTerm); 
while (szLocation) { 
strncat(szDest, szLast, szLocation - szLast); 
strcat(szDest, szReplace);  
szLast = szLocation + strlen(szTerm); 
szLocation = strstr(szLast, szTerm); 
nOccurances++; 
} 
strcat(szDest, szLast); 
return nOccurances; 
} 
 
// Read and parse the ifo file 
void ifo(){ 
char ifo_command_line[256]; 
strcpy(ifo_command_line, "ifodecoder.exe "); 
strcat(ifo_command_line, output_dir); 
strcat(ifo_command_line, "\\VTS_"); 
strcat(ifo_command_line, movie_title); 
strcat(ifo_command_line, "_0.IFO > "); 
strcat(ifo_command_line, output_dir); 
strcat(ifo_command_line, "\\parsed_ifo.txt"); 
system(ifo_command_line); 
 
//open the parsed ifo file 
char ifo_filename[256]; 
char line_ifo[256]; 
//char lang01[256] = ""; 
//char lang02[256] = ""; 
//char lang03[256] = ""; 
//char lang04[256] = ""; 
//char lang05[256] = ""; 
//char replace_line_ifo[256]; 
//char selected_lang_string[255]; 
//strcpy(selected_lang_string, "lang_code:    "); 
//strcpy(selected_lang_string, selected_lang); 
int count_ifo_line = 0; 
int stop_lang = 0; 
strcpy(ifo_filename, output_dir); 
strcat(ifo_filename, "\\parsed_ifo.txt"); 
ifstream fin(ifo_filename); 
while (fin.getline(line_ifo,255)){ 
//count_ifo_line++; 
//Search_Result = strstr(line_ifo, "	mode:		AC3 (4Ch)"); 
Search_Result = strstr(line_ifo, "	mode:"); 
if (Search_Result != NULL) { 
count_ifo_line++; 
} 
 
if (stop_lang == 0){ 
//ReplaceTerm(line_ifo, replace_line_ifo, "\t", ""); 
Search_Result = strstr(line_ifo, selected_lang); 
if (Search_Result != NULL) { 
if (count_ifo_line == 0){strcpy(lang, "0x80");} 
if (count_ifo_line == 1){strcpy(lang, "0x81");} 
if (count_ifo_line == 2){strcpy(lang, "0x82");} 
if (count_ifo_line == 3){strcpy(lang, "0x83");} 
if (count_ifo_line == 4){strcpy(lang, "0x84");} 
if (count_ifo_line == 5){strcpy(lang, "0x85");} 
if (count_ifo_line == 6){strcpy(lang, "0x86");} 
stop_lang = 1; 
} 
} 
 
} 
fin.close(); 
//MessageBox(NULL, lang, "DVD Master Backup", MB_OK); 
 
system("del grep.txt"); 
char grep_command_line[256] = ""; 
char grep_line[256] = ""; 
char replace_grep_line[256] = ""; 
strcpy(grep_command_line, "grep.exe chain time: "); 
strcat(grep_command_line, output_dir); 
strcat(grep_command_line, "\\parsed_ifo.txt > grep.txt"); 
system(grep_command_line); 
ifstream grep("grep.txt"); 
grep.getline(grep_line,255); 
grep.close(); 
ReplaceTerm(grep_line, replace_grep_line, "parsed_ifo.txt:\t\tchain time: ", ""); 
strcpy(grep_line, replace_grep_line); 
// Bitrate calculation 
char movie_time[255] = ""; 
char movie_time_hh[255] = ""; 
char movie_time_mm[255] = ""; 
char temp_movie_time[255] = ""; 
int int_movie_time_hh = 0; 
int int_movie_time_mm = 0; 
int int_bitrate = 0; 
int divx_size = 0; 
ReplaceTerm(grep_line, movie_time, ":", ""); 
strncpy(movie_time_hh, movie_time, 2); 
ReplaceTerm(movie_time, temp_movie_time, movie_time_hh, ""); 
strncpy(movie_time_mm, temp_movie_time, 2); 
int_movie_time_hh = atoi(movie_time_hh); 
int_movie_time_mm = atoi(movie_time_mm); 
 
if (main_movie == 1){ 
int_bitrate = (avi_size*8*1024)/(int_movie_time_hh*3600+int_movie_time_mm*60); 
if (ac3 == 1){int_bitrate = int_bitrate - 192;} 
if (mp3 == 1){int_bitrate = int_bitrate - 128;} 
itoa(int_bitrate, bitrate, 10); 
/* 
int reifo = 0; 
if (int_bitrate < 200){reifo = 1;} 
if (int_bitrate > 1000){reifo = 1;} 
if (reifo == 1){ 
MessageBox(NULL, "bitrate value has been corrected", "DVD Master Backup", MB_OK); 
ifo(); 
} 
*/ 
//MessageBox(NULL, bitrate, "DVD Master Backup", MB_OK); 
//MessageBox(NULL, movie_time, "DVD Master Backup", MB_OK); 
 
} 
else { 
int_bitrate = 692; 
int_bitrate = int_bitrate - 192; 
itoa(int_bitrate, bitrate, 10); 
} 
//if (vcd == 1){ 
//int_bitrate = 1150; 
//itoa(int_bitrate, bitrate, 10); 
//MessageBox(NULL, bitrate, "DVD Master Backup", MB_OK); 
//} 
} 
 
// rename and move the avi file to it final directory 
void rename_avi(){ 
char avi_dir[256]; 
strcpy(avi_dir, output_dir); 
strcat(avi_dir, "\\divx"); 
CreateDirectory(avi_dir, NULL); 
strcpy(avi_filename, avi_dir); 
strcat(avi_filename, "\\"); 
strcat(avi_filename, input_box_01->value()); 
strcpy(old_avi_filename, output_dir); 
strcat(old_avi_filename, "\\part00.avi"); 
MoveFile(old_avi_filename, avi_filename); 
window->hide(); 
char divx_folder[255]; 
strcpy(divx_folder, output_dir); 
strcat(divx_folder, "\\divx"); 
HINSTANCE hInstance = ShellExecute(NULL, "open", divx_folder, NULL, NULL, SW_SHOWNORMAL); 
return; 
} 
 
void besweet_vcd(){ 
char besweet_command_line[255]; 
strcpy (besweet_command_line, "BeSweet.exe -core( -input \""); 
strcat (besweet_command_line, output_dir); 
strcat (besweet_command_line, "\\dvdmb.avistream"); 
strcat (besweet_command_line, lang); 
strcat (besweet_command_line, ".ac3\" -output \""); 
strcat (besweet_command_line, output_dir); 
strcat (besweet_command_line, "\\dvdmb.wav\" -2ch ) -azid( -s stereo ) -ssrc( --rate 44100 )"); 
//MessageBox(NULL, besweet_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo4; 
PROCESS_INFORMATION piProcessInfo4; 
memset(&siStartupInfo4, 0, sizeof(siStartupInfo4)); 
memset(&piProcessInfo4, 0, sizeof(piProcessInfo4)); 
siStartupInfo4.cb = sizeof(siStartupInfo4); 
CreateProcess("besweet.exe", besweet_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo4, &piProcessInfo4); 
window->hide(); 
WaitForSingleObject(piProcessInfo4.hProcess, INFINITE); 
::CloseHandle(piProcessInfo4.hThread); 
::CloseHandle(piProcessInfo4.hProcess); 
window->show(); 
} 
 
void besweet(){ 
char besweet_command_line[255]; 
strcpy (besweet_command_line, "BeSweet.exe -core( -input \""); 
strcat (besweet_command_line, output_dir); 
strcat (besweet_command_line, "\\dvdmb.avistream"); 
strcat (besweet_command_line, lang); 
strcat (besweet_command_line, ".ac3\" -output \""); 
strcat (besweet_command_line, output_dir); 
strcat (besweet_command_line, "\\dvdmb.mp3\" ) -azid( -c normal -L -3db ) -ota( -hybridgain ) -boost( /b2=5 ) -lame( -p --alt-preset 128 )"); 
//MessageBox(NULL, besweet_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo4; 
PROCESS_INFORMATION piProcessInfo4; 
memset(&siStartupInfo4, 0, sizeof(siStartupInfo4)); 
memset(&piProcessInfo4, 0, sizeof(piProcessInfo4)); 
siStartupInfo4.cb = sizeof(siStartupInfo4); 
CreateProcess("besweet.exe", besweet_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo4, &piProcessInfo4); 
window->hide(); 
WaitForSingleObject(piProcessInfo4.hProcess, INFINITE); 
::CloseHandle(piProcessInfo4.hThread); 
::CloseHandle(piProcessInfo4.hProcess); 
window->show(); 
} 
 
void dvdmb_vcd(){ 
char dvdmb_vcd_command_line[255]; 
strcpy(dvdmb_vcd_command_line, " "); 
strcat(dvdmb_vcd_command_line, output_dir); 
strcat(dvdmb_vcd_command_line, "\\dvdmb_pcm.avi "); 
strcat(dvdmb_vcd_command_line, output_dir); 
strcat(dvdmb_vcd_command_line, "\\dvdmb.mpg"); 
//MessageBox(NULL, dvdmb_vcd_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo; 
PROCESS_INFORMATION piProcessInfo; 
memset(&siStartupInfo, 0, sizeof(siStartupInfo)); 
memset(&piProcessInfo, 0, sizeof(piProcessInfo)); 
siStartupInfo.cb = sizeof(siStartupInfo); 
CreateProcess(".\\plugins\\dvdmb_vcd\\dvdmb_vcd.exe", dvdmb_vcd_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
window->hide(); 
WaitForSingleObject(piProcessInfo.hProcess, INFINITE); 
::CloseHandle(piProcessInfo.hThread); 
::CloseHandle(piProcessInfo.hProcess); 
window->show(); 
} 
 
void avimux(){ 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\part00.avi"); 
char avimux_command_line[255]; 
strcpy(avimux_command_line, " "); 
strcat(avimux_command_line, output_dir); 
strcat(avimux_command_line, "\\dvdmb.avi "); 
strcat(avimux_command_line, output_dir); 
strcat(avimux_command_line, "\\dvdmb.mp3 "); 
strcat(avimux_command_line, output_dir); 
//MessageBox(NULL, avimux_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo; 
PROCESS_INFORMATION piProcessInfo; 
memset(&siStartupInfo, 0, sizeof(siStartupInfo)); 
memset(&piProcessInfo, 0, sizeof(piProcessInfo)); 
siStartupInfo.cb = sizeof(siStartupInfo); 
CreateProcess("AVIMux_GUI.exe", avimux_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
window->hide(); 
WaitForSingleObject(piProcessInfo.hProcess, INFINITE); 
::CloseHandle(piProcessInfo.hThread); 
::CloseHandle(piProcessInfo.hProcess); 
window->show(); 
} 
 
void avimux_vcd(){ 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\part00.avi"); 
char avimux_command_line[255]; 
strcpy(avimux_command_line, " "); 
strcat(avimux_command_line, output_dir); 
strcat(avimux_command_line, "\\dvdmb.avi "); 
strcat(avimux_command_line, output_dir); 
strcat(avimux_command_line, "\\dvdmb.wav "); 
strcat(avimux_command_line, output_dir); 
//MessageBox(NULL, avimux_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo; 
PROCESS_INFORMATION piProcessInfo; 
memset(&siStartupInfo, 0, sizeof(siStartupInfo)); 
memset(&piProcessInfo, 0, sizeof(piProcessInfo)); 
siStartupInfo.cb = sizeof(siStartupInfo); 
CreateProcess("AVIMux_GUI.exe", avimux_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
window->hide(); 
WaitForSingleObject(piProcessInfo.hProcess, INFINITE); 
::CloseHandle(piProcessInfo.hThread); 
::CloseHandle(piProcessInfo.hProcess); 
window->show(); 
} 
 
// Join the avi and the ac3 soundtrack 
void aviac3(){ 
int progress_wait = 0; 
progress1->maximum(5000000); 
window->show(); 
Fl::check(); 
window2->show(); 
Fl::check(); 
char aviac3_command_line[256]; 
strcpy(aviac3_command_line, " "); 
strcat(aviac3_command_line, output_dir); 
strcat(aviac3_command_line, "\\dvdmb.avi "); 
strcat(aviac3_command_line, output_dir); 
strcat(aviac3_command_line, "\\dvdmb.avistream"); 
strcat(aviac3_command_line, lang); 
strcat(aviac3_command_line, ".ac3 "); 
strcat (aviac3_command_line, output_dir); 
STARTUPINFO         siStartupInfo2; 
PROCESS_INFORMATION piProcessInfo2; 
memset(&siStartupInfo2, 0, sizeof(siStartupInfo2)); 
memset(&piProcessInfo2, 0, sizeof(piProcessInfo2)); 
siStartupInfo2.cb = sizeof(siStartupInfo2); 
siStartupInfo2.dwFlags = STARTF_USESHOWWINDOW; 
siStartupInfo2.wShowWindow = SW_HIDE; 
CreateProcess("aviac3.exe", aviac3_command_line, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo2, &piProcessInfo2); 
while(WaitForSingleObject(piProcessInfo2.hProcess, 0)){ 
progress_wait++; 
progress1->value(progress_wait); 
if (progress_wait == 5000000){progress_wait = 0;} 
Fl::check(); 
} 
::CloseHandle(piProcessInfo2.hThread); 
::CloseHandle(piProcessInfo2.hProcess); 
window->show(); 
window2->hide(); 
return; 
} 
 
// Preview the avi to crop/resize it 
void preview() { 
remove("m2a.bat"); 
strcpy(preview_mpeg2avi_command_line, " -b "); 
strcat(preview_mpeg2avi_command_line, output_dir); 
strcat(preview_mpeg2avi_command_line, "\\MPEG2AVI.lst "); 
//strcat(preview_mpeg2avi_command_line, "-s4D "); 
strcat(preview_mpeg2avi_command_line, framerate); 
strcat(preview_mpeg2avi_command_line, " -q1 -r1 -p 3 3 "); 
//strcat(preview_mpeg2avi_command_line, " -q1 -r1 "); 
strcat(preview_mpeg2avi_command_line, "-a "); 
strcat(preview_mpeg2avi_command_line, "-1 "); 
strcat(preview_mpeg2avi_command_line, avi_resolution_x); 
strcat(preview_mpeg2avi_command_line, " "); 
strcat(preview_mpeg2avi_command_line, avi_resolution_y); 
strcat(preview_mpeg2avi_command_line, " -3X "); 
strcat(preview_mpeg2avi_command_line, avi_resolution_x); 
strcat(preview_mpeg2avi_command_line, " -3Y "); 
strcat(preview_mpeg2avi_command_line, avi_resolution_y); 
strcat(preview_mpeg2avi_command_line, " -o6"); 
STARTUPINFO         siStartupInfo; 
PROCESS_INFORMATION piProcessInfo; 
memset(&siStartupInfo, 0, sizeof(siStartupInfo)); 
memset(&piProcessInfo, 0, sizeof(piProcessInfo)); 
siStartupInfo.cb = sizeof(siStartupInfo); 
CreateProcess("m2apx3g.exe", preview_mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
//CreateProcess("mpeg2avisve.exe", preview_mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
//CreateProcess("m2apx3g.016.exe", preview_mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
window->hide(); 
WaitForSingleObject(piProcessInfo.hProcess, INFINITE); 
::CloseHandle(piProcessInfo.hThread); 
::CloseHandle(piProcessInfo.hProcess); 
window->show(); 
} 
 
// Function to test if a file exist 
int Check_File(char *FileName) 
{ 
ifstream FileL; 
FileL.open(FileName); 
if(!FileL) 
{ 
FileL.close(); 
return -1; 
} 
else 
{ 
FileL.close(); 
return 0; 
} 
} 
 
// mpeg to avi 
void mpeg2avi() { 
char m2a_command_line[255]; 
char m2a_command_line_tmp[255]; 
char line[256]; 
ifstream fin("m2a.bat"); 
while (fin.getline(line,255)){ 
strcpy(m2a_command_line, line); 
} 
fin.close(); 
char output_filename[256]; 
strcpy(output_filename, output_dir); 
strcat(output_filename, "\\dvdmb.avi"); 
 
char replace_lang[256]; 
strcpy(replace_lang, "-a"); 
strcat(replace_lang, lang); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "start /wait", ""); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "-f", "-s4D -f"); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "-r1", "-r1 -p 3 3"); 
//ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "-r1", "-r1"); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "m2apx3g.exe", ""); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "c:\\temp", output_filename); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
ReplaceTerm(m2a_command_line, m2a_command_line_tmp, "-a", replace_lang); 
strcpy(m2a_command_line, m2a_command_line_tmp); 
 
// Choose the correct divx codec 
/* 
char divxauto_command_line[256]; 
strcpy(divxauto_command_line, "divxauto.exe L 10 100 "); 
strcat(divxauto_command_line, bitrate); 
WinExec(divxauto_command_line, SW_SHOW); 
char mpeg2avi_command_line[256]; 
strcpy (mpeg2avi_command_line, m2a_command_line); 
*/ 
 
char divxauto_command_line[256]; 
strcpy(divxauto_command_line, "divxauto5.exe  WI00:\"ICCompressorChoose() - YV12\" CB00:\"DivX Pro 5.0.5 Codec\" BT04: WI01:\"DivX codec properties\" ED04:\"-bv1 "); 
strcat(divxauto_command_line, bitrate); 
strcat(divxauto_command_line, " -psy 1 -key 300 -sc 50 -pq 5 -vbv 4000000,3145728,2359296 -profile 3\" BT11: WI00: BT02: QU00:"); 
WinExec(divxauto_command_line, SW_SHOW); 
 
char mpeg2avi_command_line[256]; 
strcpy (mpeg2avi_command_line, m2a_command_line); 
 
if (Check_File("m2a.bat") == -1) { 
strcpy(mpeg2avi_command_line, " -b "); 
strcat(mpeg2avi_command_line, output_dir); 
strcat(mpeg2avi_command_line, "\\MPEG2AVI.lst "); 
strcat(mpeg2avi_command_line, "-s4D "); 
strcat(mpeg2avi_command_line, framerate); 
//strcat(mpeg2avi_command_line, " -q1 -r1 -p 3 3 "); 
strcat(mpeg2avi_command_line, " -q1 -r1 "); 
//0xE0 
strcat(mpeg2avi_command_line, replace_lang); 
strcat(mpeg2avi_command_line, " -1 "); 
strcat(mpeg2avi_command_line, avi_resolution_x); 
strcat(mpeg2avi_command_line, " "); 
strcat(mpeg2avi_command_line, avi_resolution_y); 
strcat(mpeg2avi_command_line, " -3X "); 
strcat(mpeg2avi_command_line, avi_resolution_x); 
strcat(mpeg2avi_command_line, " -3Y "); 
strcat(mpeg2avi_command_line, avi_resolution_y); 
strcat(mpeg2avi_command_line, " -o8 "); 
strcat(mpeg2avi_command_line, output_dir); 
strcat(mpeg2avi_command_line, "\\dvdmb.avi"); 
} 
 
remove("m2a.bat"); 
//MessageBox(NULL, mpeg2avi_command_line, "DVD Master Backup", MB_OK); 
STARTUPINFO         siStartupInfo; 
PROCESS_INFORMATION piProcessInfo; 
memset(&siStartupInfo, 0, sizeof(siStartupInfo)); 
memset(&piProcessInfo, 0, sizeof(piProcessInfo)); 
siStartupInfo.cb = sizeof(siStartupInfo); 
CreateProcess("m2apx3g.exe", mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
//CreateProcess("mpeg2avisve.exe", mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
//CreateProcess("m2apx3g.016.exe", mpeg2avi_command_line,  NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo, &piProcessInfo); 
window->hide(); 
WaitForSingleObject(piProcessInfo.hProcess, INFINITE); 
::CloseHandle(piProcessInfo.hThread); 
::CloseHandle(piProcessInfo.hProcess); 
window->show(); 
} 
 
// Erase all temporary files        
void remove_files(){ 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.LST"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.VO*"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.IFO"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.avi"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.ac3"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.txt"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\end"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.mp3"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
strcpy (remove_file, "del "); 
strcat (remove_file, output_dir); 
strcat (remove_file, "\\*.wav"); 
ReplaceTerm(remove_file, remove_file_command, "/", "\\"); 
system(remove_file_command); 
} 
 
// Language selection callbacks 
void English_callback(){ 
strcpy(selected_lang, "English"); 
output_box_03->value(selected_lang); 
} 
void Francais_callback(){ 
strcpy(selected_lang, "Français"); 
output_box_03->value(selected_lang); 
} 
void Spanish_callback(){ 
strcpy(selected_lang, "Español"); 
output_box_03->value(selected_lang); 
} 
void Portugues_callback(){ 
strcpy(selected_lang, "Português"); 
output_box_03->value(selected_lang); 
} 
void Japenese_callback(){ 
strcpy(selected_lang, "Japenese"); 
output_box_03->value(selected_lang); 
} 
void Italiano_callback(){ 
strcpy(selected_lang, "Italiano"); 
output_box_03->value(selected_lang); 
} 
void Deutsch_callback(){ 
strcpy(selected_lang, "Deutsch"); 
output_box_03->value(selected_lang); 
} 
void Chinese_callback(){ 
strcpy(selected_lang, "Chinese"); 
output_box_03->value(selected_lang); 
} 
void Korean_callback(){ 
strcpy(selected_lang, "Korean"); 
output_box_03->value(selected_lang); 
} 
void Thai_callback(){ 
strcpy(selected_lang, "Thai"); 
output_box_03->value(selected_lang); 
} 
void Nederlands_callback(){ 
strcpy(selected_lang, "Nederlands"); 
output_box_03->value(selected_lang); 
} 
void Castellano_callback(){ 
strcpy(selected_lang, "Castellano"); 
output_box_03->value(selected_lang); 
} 
void Dansk_callback(){ 
strcpy(selected_lang, "Dansk"); 
output_box_03->value(selected_lang); 
} 
void Suomi_callback(){ 
strcpy(selected_lang, "Suomi"); 
output_box_03->value(selected_lang); 
} 
void Cesky_callback(){ 
strcpy(selected_lang, "Cesky"); 
output_box_03->value(selected_lang); 
} 
void Svenska_callback(){ 
strcpy(selected_lang, "Svenska"); 
output_box_03->value(selected_lang); 
} 
void Norsk_callback(){ 
strcpy(selected_lang, "Norsk"); 
output_box_03->value(selected_lang); 
} 
void Polski_callback(){ 
strcpy(selected_lang, "Polski"); 
output_box_03->value(selected_lang); 
} 
void Arabic_callback(){ 
strcpy(selected_lang, "Arabic"); 
output_box_03->value(selected_lang); 
} 
void Islenska_callback(){ 
strcpy(selected_lang, "Islenska"); 
output_box_03->value(selected_lang); 
} 
void Magyar_callback(){ 
strcpy(selected_lang, "Magyar"); 
output_box_03->value(selected_lang); 
} 
void Romaneste_callback(){ 
strcpy(selected_lang, "Romaneste"); 
output_box_03->value(selected_lang); 
} 
void Japanese_callback(){ 
strcpy(selected_lang, "Japanese"); 
output_box_03->value(selected_lang); 
} 
 
void ac3_callback(){ 
ac3 = 1; 
mp3 = 0; 
output_box_14->value("AC3"); 
} 
 
void mp3_callback(){ 
ac3 = 0; 
mp3 = 1; 
output_box_14->value("MP3"); 
} 
 
Fl_Menu_Item menuitems7[] = { 
{ "AC3",' ', (Fl_Callback *)ac3_callback }, 
{ "MP3 (default)",' ', (Fl_Callback *)mp3_callback } 
}; 
 
// Menu items for the language selection box 
Fl_Menu_Item menuitems2[] = { 
{ "Arabic",' ', (Fl_Callback *)Arabic_callback }, 
{ "Castellano",' ', (Fl_Callback *)Castellano_callback }, 
{ "Cesky",' ', (Fl_Callback *)Cesky_callback }, 
{ "Chinese",' ', (Fl_Callback *)Chinese_callback }, 
{ "Dansk",' ', (Fl_Callback *)Dansk_callback }, 
{ "Deutsch",' ', (Fl_Callback *)Deutsch_callback }, 
{ "English",' ', (Fl_Callback *)English_callback }, 
{ "Español",' ', (Fl_Callback *)Spanish_callback }, 
{ "Français",' ', (Fl_Callback *)Francais_callback }, 
{ "Islenska",' ', (Fl_Callback *)Islenska_callback }, 
{ "Italiano",' ', (Fl_Callback *)Italiano_callback }, 
{ "Japanese",' ', (Fl_Callback *)Japanese_callback }, 
{ "Korean",' ', (Fl_Callback *)Korean_callback }, 
{ "Magyar",' ', (Fl_Callback *)Magyar_callback }, 
{ "Nederlands",' ', (Fl_Callback *)Nederlands_callback }, 
{ "Norsk",' ', (Fl_Callback *)Norsk_callback }, 
{ "Polski",' ', (Fl_Callback *)Polski_callback }, 
{ "Português",' ', (Fl_Callback *)Portugues_callback }, 
{ "Romaneste",' ', (Fl_Callback *)Romaneste_callback }, 
{ "Suomi",' ', (Fl_Callback *)Suomi_callback }, 
{ "Svenska",' ', (Fl_Callback *)Svenska_callback }, 
{ "Thai",' ', (Fl_Callback *)Thai_callback } 
}; 
 
 
 
void donate_7_callback(){ 
HINSTANCE hInstance = ShellExecute(NULL, "open", "http://www.regsoft.net/purchase.php3?productid=58377", NULL, NULL, SW_NORMAL); 
} 
 
void donate_12_callback(){ 
HINSTANCE hInstance = ShellExecute(NULL, "open", "http://www.regsoft.net/purchase.php3?productid=58378", NULL, NULL, SW_NORMAL); 
} 
 
Fl_Menu_Item menuitems3[] = { 
{ "$7 donation",' ', (Fl_Callback *)donate_7_callback }, 
{ "$12 donation",' ', (Fl_Callback *)donate_12_callback } 
}; 
 
void check_movie_title(){ 
strcpy(test_file, dvd_drive); 
strcat(test_file, "/VIDEO_TS/"); 
strcat(test_file, "VTS_"); 
strcat(test_file, movie_title); 
strcat(test_file, "_1.VOB"); 
//MessageBox(NULL, test_file, "DVD Master Backup", MB_OK); 
if (Check_File(test_file) != -1) { 
if ((cle_de_fichier = open(test_file, O_RDONLY)) == -1) 
MessageBox(NULL, "Can't open the file", "DVD Master Backup", MB_OK); 
else 
{ 
taille_fichier = filelength(cle_de_fichier); 
taille_fichier = (taille_fichier / 1024) / 1024; 
itoa(taille_fichier, char_taille_fichier, 10); 
close(cle_de_fichier); 
//MessageBox(NULL, char_taille_fichier, "DVD Master Backup", MB_OK); 
if (taille_fichier <= 1000){ 
MessageBox(NULL, "This title does not appear to be the main movie", "DVD Master Backup", MB_OK); 
main_movie = 0; 
return; 
//strcpy(movie_title, "01"); 
//output_box_11->value(movie_title); 
} 
return; 
} 
} 
else { 
MessageBox(NULL, "This title does not exist", "DVD Master Backup", MB_OK); 
strcpy(movie_title, ""); 
output_box_11->value(movie_title); 
return; 
} 
} 
 
void title_01_callback(){ 
strcpy(movie_title, "01"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_02_callback(){ 
strcpy(movie_title, "02"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_03_callback(){ 
strcpy(movie_title, "03"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_04_callback(){ 
strcpy(movie_title, "04"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_05_callback(){ 
strcpy(movie_title, "05"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_06_callback(){ 
strcpy(movie_title, "06"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_07_callback(){ 
strcpy(movie_title, "07"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_08_callback(){ 
strcpy(movie_title, "08"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_09_callback(){ 
strcpy(movie_title, "09"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
void title_10_callback(){ 
strcpy(movie_title, "10"); 
output_box_11->value(movie_title); 
check_movie_title(); 
} 
 
Fl_Menu_Item menuitems4[] = { 
{ "01 (default)",' ', (Fl_Callback *)title_01_callback }, 
{ "02",' ', (Fl_Callback *)title_02_callback }, 
{ "03",' ', (Fl_Callback *)title_03_callback }, 
{ "04",' ', (Fl_Callback *)title_04_callback }, 
{ "05",' ', (Fl_Callback *)title_05_callback }, 
{ "06",' ', (Fl_Callback *)title_06_callback }, 
{ "07",' ', (Fl_Callback *)title_07_callback }, 
{ "08",' ', (Fl_Callback *)title_08_callback }, 
{ "09",' ', (Fl_Callback *)title_09_callback }, 
{ "10",' ', (Fl_Callback *)title_10_callback } 
}; 
 
void ntsc_callback(){ 
strcpy(framerate, "-f0"); 
ntsc = 1; 
output_box_12->value("NTSC"); 
strcpy(avi_resolution_x, "512"); 
strcpy(avi_resolution_y, "296"); 
if (vcd == 1){ 
strcpy(avi_resolution_x, "352"); 
strcpy(avi_resolution_y, "240"); 
} 
} 
 
void pal_callback(){ 
strcpy(framerate, "-f2"); 
pal = 1; 
output_box_12->value("PAL / SECAM"); 
strcpy(avi_resolution_x, "512"); 
strcpy(avi_resolution_y, "296"); 
if (vcd == 1){ 
strcpy(avi_resolution_x, "352"); 
strcpy(avi_resolution_y, "288"); 
} 
} 
 
Fl_Menu_Item menuitems5[] = { 
{ "NTSC",' ', (Fl_Callback *)ntsc_callback }, 
{ "PAL / SECAM",' ', (Fl_Callback *)pal_callback } 
}; 
 
void divx_callback(){ 
vcd = 0; 
output_box_13->value("DIVX"); 
strcpy(avi_resolution_x, "512"); 
strcpy(avi_resolution_y, "296"); 
} 
 
void vcd_callback(){ 
vcd = 1; 
output_box_13->value("VCD"); 
if (ntsc == 1){ 
strcpy(avi_resolution_x, "352"); 
strcpy(avi_resolution_y, "240"); 
} 
if (pal == 1){ 
strcpy(avi_resolution_x, "352"); 
strcpy(avi_resolution_y, "288"); 
} 
} 
 
Fl_Menu_Item menuitems6[] = { 
{ "DIVX",' ', (Fl_Callback *)divx_callback }, 
{ "VCD",' ', (Fl_Callback *)vcd_callback } 
}; 
 
static unsigned char	_reverse[0x100]; 
static unsigned char	_table[0x100] = { 
0x33, 0x73, 0x3B, 0x26, 0x63, 0x23, 0x6B, 0x76, 0x3E, 0x7E, 0x36, 0x2B, 0x6E, 0x2E, 0x66, 0x7B, 
0xD3, 0x93, 0xDB, 0x06, 0x43, 0x03, 0x4B, 0x96, 0xDE, 0x9E, 0xD6, 0x0B, 0x4E, 0x0E, 0x46, 0x9B, 
0x57, 0x17, 0x5F, 0x82, 0xC7, 0x87, 0xCF, 0x12, 0x5A, 0x1A, 0x52, 0x8F, 0xCA, 0x8A, 0xC2, 0x1F, 
0xD9, 0x99, 0xD1, 0x00, 0x49, 0x09, 0x41, 0x90, 0xD8, 0x98, 0xD0, 0x01, 0x48, 0x08, 0x40, 0x91, 
0x3D, 0x7D, 0x35, 0x24, 0x6D, 0x2D, 0x65, 0x74, 0x3C, 0x7C, 0x34, 0x25, 0x6C, 0x2C, 0x64, 0x75, 
0xDD, 0x9D, 0xD5, 0x04, 0x4D, 0x0D, 0x45, 0x94, 0xDC, 0x9C, 0xD4, 0x05, 0x4C, 0x0C, 0x44, 0x95, 
0x59, 0x19, 0x51, 0x80, 0xC9, 0x89, 0xC1, 0x10, 0x58, 0x18, 0x50, 0x81, 0xC8, 0x88, 0xC0, 0x11, 
0xD7, 0x97, 0xDF, 0x02, 0x47, 0x07, 0x4F, 0x92, 0xDA, 0x9A, 0xD2, 0x0F, 0x4A, 0x0A, 0x42, 0x9F, 
0x53, 0x13, 0x5B, 0x86, 0xC3, 0x83, 0xCB, 0x16, 0x5E, 0x1E, 0x56, 0x8B, 0xCE, 0x8E, 0xC6, 0x1B, 
0xB3, 0xF3, 0xBB, 0xA6, 0xE3, 0xA3, 0xEB, 0xF6, 0xBE, 0xFE, 0xB6, 0xAB, 0xEE, 0xAE, 0xE6, 0xFB, 
0x37, 0x77, 0x3F, 0x22, 0x67, 0x27, 0x6F, 0x72, 0x3A, 0x7A, 0x32, 0x2F, 0x6A, 0x2A, 0x62, 0x7F, 
0xB9, 0xF9, 0xB1, 0xA0, 0xE9, 0xA9, 0xE1, 0xF0, 0xB8, 0xF8, 0xB0, 0xA1, 0xE8, 0xA8, 0xE0, 0xF1, 
0x5D, 0x1D, 0x55, 0x84, 0xCD, 0x8D, 0xC5, 0x14, 0x5C, 0x1C, 0x54, 0x85, 0xCC, 0x8C, 0xC4, 0x15, 
0xBD, 0xFD, 0xB5, 0xA4, 0xED, 0xAD, 0xE5, 0xF4, 0xBC, 0xFC, 0xB4, 0xA5, 0xEC, 0xAC, 0xE4, 0xF5, 
0x39, 0x79, 0x31, 0x20, 0x69, 0x29, 0x61, 0x70, 0x38, 0x78, 0x30, 0x21, 0x68, 0x28, 0x60, 0x71, 
0xB7, 0xF7, 0xBF, 0xA2, 0xE7, 0xA7, 0xEF, 0xF2, 0xBA, 0xFA, 0xB2, 0xAF, 0xEA, 0xAA, 0xE2, 0xFF, 
}; 
 
//---------------------------------------------------------------------------------------------------------- 
 
inline void _ClockLfsr0Forward(int &lfsr0) 
{ 
Fl::check(); 
	int	temp; 
 
	temp = (lfsr0 << 3) | (lfsr0 >> 14); 
	lfsr0 = (lfsr0 >> 8) | ((((((temp << 3) ^ temp) << 3) ^ temp ^ lfsr0) & 0xFF) << 9); 
} 
 
inline void _ClockLfsr1Forward(int &lfsr1) 
{ 
Fl::check(); 
	lfsr1 = (lfsr1 >> 8) | ((((((((lfsr1 >> 8) ^ lfsr1) >> 1) ^ lfsr1) >> 3) ^ lfsr1) & 0xFF) << 17); 
} 
 
inline void _ClockBackward(int &lfsr0, int &lfsr1) 
{ 
Fl::check(); 
	int	temp0, temp1; 
 
	lfsr0 = ((lfsr0 << 8) ^ ((((lfsr0 >> 3) ^ lfsr0) >> 6) & 0xFF)) & ((1 << 17) - 1); 
	temp0 = ((lfsr1 >> 17) ^ (lfsr1 >> 4)) & 0xFF; 
	temp1 = (lfsr1 << 5) | (temp0 >> 3); 
	temp1 = ((temp1 >> 1) ^ temp1) & 0xFF; 
	lfsr1 = ((lfsr1 << 8) | ((((((temp1 >> 2) ^ temp1) >> 1) ^ temp1) >> 3) ^ temp1 ^ temp0)) & ((1 << 25) - 1); 
} 
 
static void _Salt(int &lfsr0, int &lfsr1, const unsigned char salt[5]) 
{ 
Fl::check(); 
	lfsr0 ^= (_reverse[salt[0]] << 9) | _reverse[salt[1]]; 
	lfsr1 ^= ((_reverse[salt[2]] & 0xE0) << 17) | ((_reverse[salt[2]] & 0x1F) << 16) | (_reverse[salt[3]] << 8) | _reverse[salt[4]]; 
} 
 
static void _PrintKey(int lfsr0, int lfsr1) 
{ 
output_box_10->value("key:"); 
printf("key:"); 
printf(" %02X", _reverse[lfsr0 >> 9]); 
printf(" %02X", _reverse[lfsr0 & 0xFF]); 
printf(" %02X", _reverse[((lfsr1 >> 16) & 0x1F) | ((lfsr1 >> 17) & 0xE0)]); 
printf(" %02X", _reverse[(lfsr1 >> 8) & 0xFF]); 
printf(" %02X", _reverse[lfsr1 & 0xFF]); 
printf("\n"); 
} 
 
static int _FindLfsr(const unsigned char *crypt, int offset, const unsigned char *plain, int &result0, int &result1) 
{ 
int		loop0, loop1, lfsr0, lfsr1, carry, count; 
for(loop0 = count = 0; loop0 != (1 << 18); loop0++) { 
lfsr0 = loop0 >> 1; 
carry = loop0 & 0x01; 
for(loop1 = lfsr1 = 0; loop1 != 4; loop1++) { 
_ClockLfsr0Forward(lfsr0); 
carry = (_table[crypt[offset + loop1]] ^ plain[loop1]) - ((lfsr0 >> 9) ^ 0xFF) - carry; 
lfsr1 = (lfsr1 >> 8) | ((carry & 0xFF) << 17); 
carry = (carry >> 8) & 0x01; 
} 
for(; loop1 != 7; loop1++) { 
_ClockLfsr0Forward(lfsr0); 
_ClockLfsr1Forward(lfsr1); 
carry += ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17); 
if((carry & 0xFF) != (_table[crypt[offset + loop1]] ^ plain[loop1])) { 
break; 
} 
carry >>= 8; 
} 
if(loop1 == 7) { 
for(loop1 = 0; loop1 != 6; loop1++) { 
_ClockBackward(lfsr0, lfsr1); 
} 
carry = ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17) + (loop0 & 0x01); 
if((carry & 0xFF) == (_table[crypt[offset]] ^ plain[0])) { 
for(loop1 = 0; loop1 != offset + 1; loop1++) { 
_ClockBackward(lfsr0, lfsr1); 
} 
if(lfsr0 & 0x100 && lfsr1 & 0x200000) { 
result0 = lfsr0; 
result1 = lfsr1; 
count++; 
} 
} 
} 
} 
return count; 
} 
 
static int _FindKey(const char *filename, int &lfsr0, int &lfsr1) 
{ 
unsigned char	buffer[0x800], plain[7] = { 0x00, 0x00, 0x01, 0xBE, 0x00, 0x00, 0xFF }; 
	int				result, offset, left, flag, block, count; 
	FILE			*file; 
	char points[255] = "Please wait"; 
    int int_points = 0; 
    int int_count_points = 0; 
  
	result = 1; 
	if((file = fopen(filename, "rb")) == 0) { 
//printf("error: can't open input file '%s'\n", filename); 
output_box_10->value("error: can't open input file"); 
	} else { 
		for(flag = block = 0; fread(buffer, 1, sizeof buffer, file) == sizeof buffer; block++) { 
int_points++; 
if (int_points == 120){ 
int_points = 0; 
strcat(points, "."); 
int_count_points++; 
if (int_count_points == 55){ 
int_count_points = 0; 
strcpy(points, "Please wait"); 
} 
output_box_10->value(points); 
Fl::check(); 
} 
fflush(stdout); 
if(buffer[0x14] & 0x10) { 
flag |= 0x01; 
if(buffer[0x00] == 0x00 && buffer[0x01] == 0x00 && buffer[0x02] == 0x01 && buffer[0x03] == 0xBA 
&& buffer[0x0E] == 0x00 && buffer[0x0F] == 0x00 && buffer[0x10] == 0x01) { 
offset = 0x14 + (buffer[0x12] << 8) + buffer[0x13]; 
if(0x80 <= offset && offset <= 0x7F9) { 
flag |= 0x02; 
left = 0x800 - offset - 6; 
plain[4] = (char) (left >> 8); 
plain[5] = (char) left; 
if((count = _FindLfsr(buffer + 0x80, offset - 0x80, plain, lfsr0, lfsr1)) == 1) { 
_Salt(lfsr0, lfsr1, buffer + 0x54); 
result = 0; 
break; 
} else if(count) { 
//printf("\rblock %d reported %d possible keys, skipping\n", block, count); 
output_box_10->value("skipping");						 
} 
} 
} 
} 
} 
fclose(file); 
fclose(file); 
} 
return result; 
} 
 
static void _Decrypt(unsigned char *buffer, int lfsr0, int lfsr1) 
{ 
int	loop0, carry; 
_Salt(lfsr0, lfsr1, buffer + 0x54); 
for(loop0 = carry = 0, buffer += 0x80; loop0 != 0x800 - 0x80; loop0++, buffer++) { 
_ClockLfsr0Forward(lfsr0); 
_ClockLfsr1Forward(lfsr1); 
carry += ((lfsr0 >> 9) ^ 0xFF) + (lfsr1 >> 17); 
*buffer = (unsigned char) (_table[*buffer] ^ carry); 
carry >>= 8; 
} 
} 
 
static int _DecryptFile(const char *filename0, const char *filename1, int lfsr0, int lfsr1) 
{ 
unsigned char	buffer[0x800]; 
int				result, block; 
FILE			*file0, *file1; 
 
HANDLE hFile; 
DWORD dwFileSize; 
char text_filesize[256]; 
int filesize; 
char text_block[256]; 
char progress_label[256]; 
char text_percentage[256]; 
int percentage; 
hFile = CreateFile (filename0, 
		GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING, 
		FILE_ATTRIBUTE_NORMAL,(HANDLE)NULL); 
dwFileSize = GetFileSize (hFile, NULL); 
progress->maximum(dwFileSize); 
ltoa(dwFileSize, text_filesize, 10); 
filesize = atoi(text_filesize); 
filesize = filesize/2048; 
itoa(filesize, text_filesize, 10); 
progress->maximum(filesize); 
 
	result = 1; 
	if((file0 = fopen(filename0, "rb")) == 0) { 
//printf("error: can't open input file '%s'\n", filename0); 
output_box_10->value("error: can't open input file");	 
	} else { 
		if((file1 = fopen(filename1, "ab")) == 0) { 
//printf("error: can't create/truncate output file '%s'\n", filename1); 
output_box_10->value("error: can't create/truncate output file"); 
		} else { 
			for(block = 0;; block++) { 
progress ->value(block); 
itoa(block, text_block, 10); 
percentage = ((block*100)/filesize); 
itoa(percentage, text_percentage, 10); 
strcpy(progress_label, "Blocks: "); 
strcat(progress_label, text_block); 
strcat(progress_label, " / "); 
strcat(progress_label, text_filesize); 
strcat(progress_label, " ("); 
strcat(progress_label, text_percentage); 
strcat(progress_label, "%)"); 
progress->label(progress_label); 
if(block % 10 == 0) { 
fflush(stdout); 
} 
if(fread(buffer, 1, sizeof buffer, file0) != sizeof buffer) { 
result = 0; 
break; 
} 
if(buffer[0x14] & 0x10) { 
_Decrypt(buffer, lfsr0, lfsr1); 
buffer[0x14] &= ~0x10; 
} 
if(fwrite(buffer, 1, sizeof buffer, file1) != sizeof buffer) { 
//printf("\nerror: can't write to output file\n"); 
output_box_10->value("error: can't write to output file"); 
break; 
} 
} 
fclose(file1); 
} 
fclose(file0); 
} 
return result; 
} 
 
static int _truncate( const char *dest ) 
{ 
	char a[5],nam[45]; 
	strcpy(nam,dest); 
	int fh, tsiz, length; 
	FILE *fds, *fdd; 
	if( (fds = fopen(dest,"rb")) == NULL ) 
		return 1; 
	fseek(fds,-1L,SEEK_END); 
	length = fread(a,1,2,fds); 
	fclose(fds); 
	if( (fh = _open( dest , _O_RDWR | _O_BINARY)) == -1 ) 
		return 1; 
	tsiz = _filelength( fh ); 
	_chsize ( fh, tsiz - 1 ); 
	_close(fh); 
	nam[19] = nam[19] + 1; 
	if( (fdd = fopen(nam,"wb")) == NULL ) 
		return 1; 
	fwrite(a,1,length,fdd); 
	fclose(fdd); 
	return 0; 
} 
 
 
static int _rawcopy(const char *sour , const char *dest) 
{ 
   char a[262144]; 
   FILE *fds, *fdd; 
   int length; 
    
   if ((fds = fopen(sour,"rb")) != NULL) { 
	   if ((fdd = fopen(dest,"ab")) != NULL) { 
		   while((length = fread(a,1,262144,fds)) != 0) { 
			   fwrite(a,1,length,fdd); 
		   } 
		   fclose(fds); 
		   fclose(fdd); 
		   return 0; 
	   } 
   } 
//   printf("Unable to complete copy\n"); 
output_box_10->value("Unable to complete copy"); 
   return 1; 
} 
 
int extract_vob() 
{ 
 
} 
 
void button1_callback(Fl_Widget *w, void *data) { 
output_dir = fl_dir_chooser("Choose a directory", output_dir, 1); 
Search_Result = strstr(output_dir, " "); 
if (Search_Result != NULL) { 
MessageBox(NULL, "Folder name can't contain spaces", "DVD Master Backup", MB_OK); 
} 
 
ch = "C:"; 
Search_Result = strstr(output_dir, ch); 
if (Search_Result != NULL) { 
ReplaceTerm(output_dir, path_output_dir, "C:", ""); 
strcpy (output_drive, "c"); 
} 
 
ch = "D:"; 
Search_Result = strstr(output_dir, ch); 
if (Search_Result != NULL) { 
ReplaceTerm(output_dir, path_output_dir, "D:", ""); 
strcpy (output_drive, "d"); 
} 
 
ch = "E:"; 
Search_Result = strstr(output_dir, ch); 
if (Search_Result != NULL) { 
ReplaceTerm(output_dir, path_output_dir, "E:", ""); 
strcpy (output_drive, "e"); 
} 
 
ch = "F:"; 
Search_Result = strstr(output_dir, ch); 
if (Search_Result != NULL) { 
ReplaceTerm(output_dir, path_output_dir, "F:", ""); 
strcpy (output_drive, "f"); 
} 
 
ch = "G:"; 
Search_Result = strstr(output_dir, ch); 
if (Search_Result != NULL) { 
ReplaceTerm(output_dir, path_output_dir, "G:", ""); 
strcpy (output_drive, "g"); 
} 
 
output_box_02->value(output_dir); 
} 
 
 
void button2_callback(Fl_Widget *w, void *data) { 
 
strcpy(test_file, output_dir); 
strcat(test_file, "/divx/"); 
strcat(test_file, input_box_01->value()); 
//MessageBox(NULL, test_file, "DVD Master Backup", MB_OK); 
if (Check_File(test_file) != -1) { 
MessageBox(NULL, "There is already a avi file with the name you gave.", "DVD Master Backup", MB_OK); 
button2->value(0); 
return; 
} 
 
button2->hide(); 
button2 = new Fl_Light_Button(380, 245, 0, 0, ""); 
 
output_box_10->value("Authentication of the DVD drive..."); 
Fl::check(); 
STARTUPINFO         siStartupInfo3; 
PROCESS_INFORMATION piProcessInfo3; 
memset(&siStartupInfo3, 0, sizeof(siStartupInfo3)); 
memset(&piProcessInfo3, 0, sizeof(piProcessInfo3)); 
siStartupInfo3.cb = sizeof(siStartupInfo3); 
CreateProcess("auth.exe", "", NULL, NULL, FALSE,  
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &siStartupInfo3, &piProcessInfo3); 
WaitForSingleObject(piProcessInfo3.hProcess, INFINITE); 
::CloseHandle(piProcessInfo3.hThread); 
::CloseHandle(piProcessInfo3.hProcess); 
 
char parsed_output_dir[256]; 
ReplaceTerm(output_dir, parsed_output_dir, "/", "\\"); 
strcpy(output_dir, parsed_output_dir); 
output_box_02->value(output_dir); 
output_box_10->value("Please wait..."); 
Fl::check(); 
button3->show(); 
button3->value(1); 
strcpy(test_file, output_dir); 
strcat(test_file, "/MPEG2AVI.LST"); 
if (Check_File(test_file) != -1) { 
strcpy(test_file, output_dir); 
strcat(test_file, "/end"); 
if (Check_File(test_file) == -1) { 
remove_files(); 
} 
} 
strcpy(endfile, output_dir); 
strcat(endfile, "/end"); 
if (Check_File(endfile) != -1) { 
if (vob == 0){ 
if (MessageBox(NULL, "A previous project has been found\nDo you want to use it ?", "DVD Master Backup", MB_YESNO)==IDNO){ 
remove_files(); 
button2_callback(NULL, NULL); 
} 
} 
ifo(); 
progress->label(" "); 
if (vcd == 0){ 
if (MessageBox(NULL, "Do you want to preview/crop the movie ?", "DVD Master Backup", MB_YESNO)==IDYES){ 
preview(); 
} 
} 
mpeg2avi(); 
if (vcd == 1){ 
besweet_vcd(); 
avimux_vcd(); 
dvdmb_vcd(); 
} 
if (vcd == 0){ 
if (ac3 ==1){ 
aviac3(); 
} 
if (mp3 ==1){ 
besweet(); 
avimux(); 
} 
rename_avi(); 
dvdmb_launcher(); 
} 
if (MessageBox(NULL, "The Divx movie has been created.\nDo you want to delete the temporary files ?", "DVD Master Backup", MB_YESNO)==IDYES){ 
remove_files(); 
} 
WinExec("dvdmb.exe", SW_SHOW); 
exit(0); 
return; 
} 
vob = 1; 
int argc;  
char **argv; 
argc = 4; 
int f , n=49 , tr=0 , raw=0 , arg=0 , i=49; 
 
//argv[1] = dvd_drive; 
//argv[2] = output_drive; 
//argv[3] = "01"; 
//argv[4] = ""; 
	 
	for (f = 4 ; f < argc ; f++) { 
		if (strcmp(argv[f],"rawcopy") == 0) { 
			raw = 1 ; f = argc ; arg++ ;} 
	} 
	//raw=1; 
	for (f = 4 ; f < argc ; f++) { 
		if (strcmp(argv[f],"notrunc") == 0) { 
			tr = 0 ; f = argc ; arg++ ;} 
	} 
	if ( (argc < 4 && argc > 6) || arg != argc - 4 || strlen(dvd_drive) >= 3 || strlen(output_drive) >= 3 
		|| strlen(movie_title) != 2 ) 
		{  
 // printf ("Syntax : vobdectr    [rawcopy] [notrunc]\n"); 
output_box_10->value("Syntax"); 
	return;} 
	 
	int	loop0, loop1, value, lfsr0, lfsr1; 
 
	for(loop0 = 0; loop0 != 0x100; loop0++) { 
	Fl::check(); 
		for(loop1 = value = 0; loop1 != 8; loop1++) { 
		Fl::check(); 
			value |= ((loop0 >> loop1) & 0x01) << (7 - loop1); 
		} 
		_reverse[loop0] = (unsigned char) value; 
	} 
 
	FILE *dummy , *cont; 
	char sour[45] , dest[45] , path[11] = "\\VIDEO_TS\\" , nam[9] = "VTS_00_0" 
		, trs[45] , trd[45] , dks[45] , dkd[45] 
		, lst[45] , direc[12] = ""; 
	direc[0] = output_drive[0]; 
	for (f = 0 ; f <= 1 ; f++) { 
	Fl::check(); 
		nam[4+f] = movie_title[f]; 
	} 
	_makepath(trs,dvd_drive,path,nam,"IFO"); 
	_makepath(trd,output_drive,path_output_dir,nam,"IFO"); 
	_makepath(dks,dvd_drive,path,"VIDEO_TS","IFO"); 
	_makepath(dkd,output_drive,path_output_dir,"VIDEO_TS","IFO"); 
	nam[7]=n; 
	_makepath(sour,dvd_drive,path,nam,"VOB"); 
	_makepath(dest,output_drive,path_output_dir,nam,"VOB"); 
	_makepath(lst,output_drive,path_output_dir,"MPEG2AVI","LST"); 
 
	while (( dummy = fopen(sour,"rb")) != NULL ) { 
		n++ ; sour[19] = n ; fclose(dummy); 
	} 
	if ((sour[19] = n = n - 1) == 48)	{ 
//printf("There is no title %s on this disc\n","01"); 
output_box_10->value("There is no title"); 
		  return; 
	} 
	if (_mkdir(direc) != 0) { 
//printf("Directory '%s' already exists\n",direc) ; return 1; 
//output_box_10->value("Directory already exists"); 
	} 
	if (raw == 0) { 
		while ( _FindKey(sour , lfsr0 , lfsr1) ) { 
		Fl::check(); 
			sour[19]--; 
			if (sour[19] == 48) { 
MessageBox(NULL, "Unable to decode the DVD key\nMaybe it's a non-encrypted movie.", "DVD Master Backup", MB_OK); 
WinExec("dvdmb.exe", SW_SHOW); 
exit(0); 
				return; 
			} 
		} 
_PrintKey(lfsr0, lfsr1); 
 } 
 
//printf("Copying tree files...\n"); 
output_box_10->value("Copying tree files..."); 
	if(_rawcopy(trs,trd)) 
		return; 
	if(_rawcopy(dks,dkd)) 
		return; 
	for(sour[19] = 49 ; sour[19] <= n ; sour[19]++) { 
	Fl::check(); 
		dest[19] = sour[19]; 
//printf("Processing 'VTS_%c%c_%c.VOB'...\n",sour[16],sour[17],sour[19]); 
strcpy(processing_vts, sour); 
output_box_10->value(processing_vts); 
cont = fopen(lst,"a+"); 
fprintf(cont , "%s\n" , dest); 
fclose(cont); 
if( raw == 0 && _DecryptFile(sour, dest, lfsr0, lfsr1) ) 
return; 
if( raw == 1 && _rawcopy(sour, dest) ) 
return; 
if ( sour[19] != n && tr == 1 && _truncate(dest) ) { 
//printf("Unable to truncate current file\n"); 
output_box_10->value("Unable to truncate current file"); 
return; 
} 
} 
 
strcpy(endfile, output_dir); 
strcat(endfile, "/end"); 
WritePrivateProfileString("END","END", "END", endfile); 
ifo(); 
if (vcd == 0){ 
if (MessageBox(NULL, "Do you want to preview/crop the movie ?", "DVD Master Backup", MB_YESNO)==IDYES){ 
preview(); 
} 
} 
mpeg2avi(); 
if (vcd == 1){ 
besweet_vcd(); 
avimux_vcd(); 
dvdmb_vcd(); 
} 
if (vcd == 0){ 
if (ac3 ==1){ 
aviac3(); 
} 
if (mp3 ==1){ 
besweet(); 
avimux(); 
} 
rename_avi(); 
dvdmb_launcher(); 
} 
if (MessageBox(NULL, "The Divx movie has been created in the Divx folder of your temporary folder.\n\nDo you want to delete the temporary files ?", "DVD Master Backup", MB_YESNO)==IDYES){ 
remove_files(); 
} 
WinExec("dvdmb.exe", SW_SHOW); 
exit(0); 
 
 
	return; 
} 
 
void button3_callback(Fl_Widget *w, void *data) { 
WinExec("dvdmb.exe", SW_SHOW); 
exit(0); 
} 
 
void button4_callback(Fl_Widget *w, void *data) { 
help->show(); 
help->load("help.htm"); 
} 
 
void button5_callback(Fl_Widget *w, void *data) { 
MessageBox(NULL, "Be sure that a DVD disk is present in the DVD drive you want to select.", "DVD Master Backup", MB_OK); 
drive_letter = fl_dir_chooser("Choose a DVD drive", drive_letter, 1); 
strncpy (dvd_drive, drive_letter, 2); 
output_box_01->value(dvd_drive); 
} 
 
void button6_callback(Fl_Widget *w, void *data) { 
window3->hide(); 
window4->hide(); 
window->show(); 
} 
 
void button7_callback(Fl_Widget *w, void *data) { 
MessageBox(NULL, "Here you can change the default movie title.\nWhen we refer to a title we mean a feature of a DVD.\nFor example, DVD's usually contain the main movie that is the 1st title (01)\nthen they will have the main trailer, 2nd title (02)...\nBut sometimes the main movie is located elsewhere.", "DVD Master Backup", MB_OK); 
} 
 
void exit_callback() { 
exit(0); 
} 
 
void about_box_callback() { 
window4->show(); 
} 
 
void gpl_callback() { 
HINSTANCE hInstance = ShellExecute(NULL, "open", "gpl.txt", NULL, NULL, SW_NORMAL); 
} 
 
void null_callback(){ 
 
} 
 
Fl_Menu_Item menuitems[] = { 
{ "&File", 0, 0, 0, FL_SUBMENU }, 
{ "&Exit",' ', (Fl_Callback *)exit_callback }, 
{ 0 }, 
{ "&Tools", 0, 0, 0, FL_SUBMENU }, 
//{ "&Options",' ', (Fl_Callback *)null_callback }, 
{ "&Options",' ', (Fl_Callback *)options }, 
{ "&Check for updates",' ', (Fl_Callback *)check_version }, 
{ 0 }, 
{ "&Help", 0, 0, 0, FL_SUBMENU }, 
{ "&Readme",' ', (Fl_Callback *)button4_callback }, 
{ "&GPL license",' ', (Fl_Callback *)gpl_callback }, 
{ "&About DVDMB...",' ', (Fl_Callback *)about_box_callback } 
}; 
 
void button8_callback(Fl_Widget *w, void *data) { 
HINSTANCE hInstance = ShellExecute(NULL, "open", "mailto:dvdmb@nlvtelecom.com", NULL, NULL, SW_NORMAL); 
} 
 
void button9_callback(Fl_Widget *w, void *data) { 
HINSTANCE hInstance = ShellExecute(NULL, "open", "http://dvdmb.nlvtelecom.com", NULL, NULL, SW_NORMAL); 
} 
 
void button10_callback(Fl_Widget *w, void *data) { 
itoa(ac3, ac3_text, 10); 
itoa(mp3, mp3_text, 10); 
WritePrivateProfileString("CONFIG","AC3", ac3_text,".\\dvdmb.ini"); 
WritePrivateProfileString("CONFIG","MP3", mp3_text,".\\dvdmb.ini"); 
window5->hide(); 
} 
 
void button11_callback(Fl_Widget *w, void *data) { 
MessageBox(NULL, "AC3:\nFast encoding but may cause audio sync problems and/or oversized movie.\n\nMP3:\nBest encoding choice but the encoding process will be more slower compared with the AC3 codec.", "DVD Master Backup", MB_OK); 
} 
 
int main (int argc2, char *argv2[]) 
{ 
GetPrivateProfileString("CONFIG","AC3","",ac3_text,255,".\\dvdmb.ini"); 
GetPrivateProfileString("CONFIG","MP3","",mp3_text,255,".\\dvdmb.ini"); 
ac3 = atoi(ac3_text); 
mp3 = atoi(mp3_text); 
 
window = new Fl_Window (190, 90, 435, 270,"DVD Master Backup"); 
 
menubar = new Fl_Menu_Bar(0, 0, 435, 25, ""); 
menubar->menu(menuitems); 
 
label_05 = new Fl_Box(44, 35, 0, 20, "DVD drive"); 
output_box_01 = new Fl_Output (125,35,30,20); 
button5 = new Fl_Button(160, 35, 20, 20, "..."); 
button5->callback(button5_callback, &button5_data); 
 
menu_button_04 = new Fl_Menu_Button(10, 60, 110, 20, "Title nbr"); 
menu_button_04->menu(menuitems4); 
output_box_11 = new Fl_Output (125,60,30,20); 
//strcpy(movie_title, "01"); 
//output_box_11->value(movie_title); 
button7 = new Fl_Button(160, 60, 20, 20, " ? "); 
button7->callback(button7_callback, &button7_data); 
 
menu_button_05 = new Fl_Menu_Button(10, 85, 110, 20, "Standard"); 
menu_button_05->menu(menuitems5); 
output_box_12 = new Fl_Output (125,85,100,20); 
//output_box_12->value("NTSC"); 
 
if (Check_File(".\\plugins\\dvdmb_vcd\\dvdmb_vcd.exe") != -1) { 
menu_button_06 = new Fl_Menu_Button(265, 85, 110, 20, "Output"); 
menu_button_06->menu(menuitems6); 
output_box_13 = new Fl_Output (380,85,50,20); 
output_box_13->value("DIVX"); 
} 
 
label_01 = new Fl_Box(62, 110, 0, 20, "Output directory"); 
output_box_02 = new Fl_Output (125,110,280,20); 
button1 = new Fl_Button(410, 110, 20, 20, "..."); 
button1->callback(button1_callback, &button1_data); 
 
label_02 = new Fl_Box(52, 135, 0, 20, "AVI filename"); 
input_box_01 = new Fl_Input (125,135,150,20); 
input_box_01->value("movie.avi"); 
 
menu_button_02 = new Fl_Menu_Button(10, 160, 110, 20, "Language"); 
menu_button_02->menu(menuitems2); 
output_box_03 = new Fl_Output (125,160,150,20); 
output_box_03->value("English"); 
 
label_03 = new Fl_Box(48, 185, 0, 20, "Current file"); 
output_box_10 = new Fl_Output (125,185,305,20); 
progress = new Fl_Progress(125,210,305,20, "Current file"); 
progress->color(FL_GRAY); 
progress->selection_color(FL_YELLOW); 
 
button4 = new Fl_Button(10, 220, 110, 20, "Help / About"); 
button4->callback(button4_callback, &button4_data); 
button4->hide(); 
button2 = new Fl_Light_Button(380, 245, 50, 20, "Go"); 
button2->callback(button2_callback, &button2_data); 
button2->selection_color(FL_GREEN); 
button3 = new Fl_Light_Button(380, 245, 50, 20, "Stop"); 
button3->callback(button3_callback, &button3_data); 
button3->selection_color(FL_GREEN); 
 
button3->hide(); 
window->end (); 
 
window2 = new Fl_Window (330, 270, 150, 50,"DVD Master Backup"); 
label_04 = new Fl_Box(75, 10, 0, 10, "Please wait ..."); 
progress1 = new Fl_Progress(25,25,100,20,""); 
progress1->color(FL_GRAY); 
//progress1->selection_color(FL_YELLOW); 
window2->end (); 
 
window3 = new Fl_Window (310, 150, 220, 225,"DVD Master Backup"); 
button6 = new Fl_Button(165, 200, 50, 20, "OK"); 
button6->callback(button6_callback, &button6_data); 
//window3->icon((char*)LoadIcon(fl_display, MAKEINTRESOURCE(IDI_ICON))); 
window3->color(FL_WHITE); 
image_box = new Fl_Box(10, 10, 200, 176); 
logo = new Fl_Pixmap(dvdmb_logo); 
logo->label(image_box); 
menu_button_03 = new Fl_Menu_Button(05, 200, 155, 20, "Make a donation"); 
menu_button_03->menu(menuitems3); 
window3->end (); 
 
window4 = new Fl_Window (310, 150, 220, 225,"DVD Master Backup"); 
button6 = new Fl_Button(165, 200, 50, 20, "OK"); 
button6->callback(button6_callback, &button6_data); 
label_07 = new Fl_Box(64, 14, 0, 10, "DVD Master Backup"); 
label_07->labelsize(12); 
label_07->labelfont(FL_BOLD); 
label_07->labeltype(FL_SHADOW_LABEL); 
label_08 = new Fl_Box(40, 35, 0, 10, "Version 0.2.9"); 
label_08->labelsize(11); 
label_09 = new Fl_Box(100, 52, 0, 10, "License: GPL \(General Public License)"); 
label_09->labelsize(11); 
label_10 = new Fl_Box(24, 69, 0, 10, "E-mail:"); 
label_10->labelsize(11); 
button8 = new Fl_Button(45, 66, 130, 15, "     dvdmb@@nlvtelecom.com"); 
button8->callback(button8_callback, &button8_data); 
button8->labelsize(11); 
button8->labelcolor(FL_BLUE); 
label_11 = new Fl_Box(31, 86, 0, 10, "Web site:"); 
label_11->labelsize(11); 
button9 = new Fl_Button(60, 84, 145, 15, "http://dvdmb.nlvtelecom.com"); 
button9->callback(button9_callback, &button9_data); 
button9->labelsize(11); 
button9->labelcolor(FL_BLUE); 
menu_button_03 = new Fl_Menu_Button(05, 200, 155, 20, "Make a donation"); 
menu_button_03->menu(menuitems3); 
window4->end (); 
 
window5 = new Fl_Window (330, 190, 240, 80,"DVDMB - Options"); 
menu_button_07 = new Fl_Menu_Button(05, 05, 155, 20, "Audio codec"); 
menu_button_07->menu(menuitems7); 
output_box_14 = new Fl_Output (165,05,45,20); 
button11 = new Fl_Button(215, 05, 20, 20, "?"); 
button11->callback(button11_callback, &button11_data); 
button10 = new Fl_Button(170, 55, 65, 20, "Save"); 
button10->callback(button10_callback, &button10_data); 
window5->end (); 
 
help = new Fl_Help_Dialog(); 
 
window3->show (argc2, argv2); 
//window2->show (argc2, argv2); 
 
return Fl::run(); 
 
}