gint DeviceBoxFileEvent(GtkWidget *widget, GdkEvent event, gpointer data) { int returnval; char templine[256]; struct IsoFile *tempfile; returnval = IsIsoFile(gtk_entry_get_text(GTK_ENTRY(devicebox.file))); if (returnval == -1) { gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: ---"); return (TRUE); } // ENDIF- Not a name of any sort? if (returnval == -2) { gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Not a file"); return (TRUE); } // ENDIF- Not a regular file? if (returnval == -3) { gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Not a valid image file"); return (TRUE); } // ENDIF- Not an image file? if (returnval == -4) { gtk_label_set_text(GTK_LABEL(devicebox.filedesc), "File Type: Missing Table File (will rebuild)"); return (TRUE); } // ENDIF- Not a regular file? tempfile = IsoFileOpenForRead(gtk_entry_get_text(GTK_ENTRY(devicebox.file))); sprintf(templine, "File Type: %s%s%s", multinames[tempfile->multi], tempfile->imagename, compressdesc[tempfile->compress]); gtk_label_set_text(GTK_LABEL(devicebox.filedesc), templine); tempfile = IsoFileClose(tempfile); return (TRUE); } // END DeviceBoxFileEvent()
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) { const char *tempisoname; MainBoxUnfocus(); tempisoname = gtk_entry_get_text(GTK_ENTRY(mainbox.file)); if (*(tempisoname) != 0) { if (IsIsoFile(tempisoname) == -4) { IsoTableRebuild(tempisoname); MainBoxRefocus(); return(TRUE); } // ENDIF- Do we need to rebuild an image file's index before using it? if (IsIsoFile(tempisoname) < 0) { tempisoname = NULL; MainBoxRefocus(); MessageBoxShow("Not a Valid Image File.", 1); return(TRUE); } // ENDIF- Not an ISO file? Message and Stop here. } // ENDIF- Is there an ISO file to check out? strcpy(conf.isoname, tempisoname); tempisoname = NULL; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.startcheck)) == FALSE) { conf.startconfigure = 0; // FALSE } else { conf.startconfigure = 1; // TRUE } // ENDIF- Was this check button turned off? if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck)) == FALSE) { conf.restartconfigure = 0; // FALSE } else { conf.restartconfigure = 1; // TRUE } // ENDIF- Was this check button turned off? SaveConf(); MainBoxCancelEvent(widget, event, data); return(TRUE); } // END MainBoxOKEvent()
void MainBoxOKEvent() { char tempisoname[256]; MainBoxUnfocus(); GetDlgItemText(mainboxwindow, IDC_0202, tempisoname, 256); if (*(tempisoname) != 0) { if (IsIsoFile(tempisoname) == -4) { IsoTableRebuild(tempisoname); MainBoxRefocus(); return; } // ENDIF- Do we need to rebuild an image file's index before using it? if (IsIsoFile(tempisoname) < 0) { MainBoxRefocus(); MessageBox(mainboxwindow, "Not a Valid Image File.", "CDVDisoEFP Message", MB_OK | MB_ICONWARNING | MB_SETFOREGROUND); return; } // ENDIF- Not an ISO file? Message and Stop here. } // ENDIF- Do we have a name to check out? strcpy(conf.isoname, tempisoname); if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0209)) == BST_UNCHECKED) { conf.startconfigure = 0; // FALSE } else { conf.startconfigure = 1; // TRUE } // ENDIF- Was this checkbox unchecked? if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0210)) == BST_UNCHECKED) { conf.restartconfigure = 0; // FALSE } else { conf.restartconfigure = 1; // TRUE } // ENDIF- Was this checkbox unchecked? SaveConf(); MainBoxCancelEvent(); return; } // END MainBoxOKEvent()
s32 CALLBACK CDVDtest() { #ifdef VERBOSE_FUNCTION_INTERFACE PrintLog("CDVDiso interface: CDVDtest()"); #endif /* VERBOSE_FUNCTION_INTERFACE */ InitConf(); // Odd... hasn't CDVDinit been called yet? LoadConf(); if (conf.isoname[0] == 0) return (0); // No name chosen yet. Catch on Open() if (IsIsoFile(conf.isoname) == 0) return (0); // Valid name. Go. return (-1); // Invalid name - reconfigure first. // Note really need this? Why not just return(0)... } // END CDVDtest()
void MainBoxFileEvent() { int returnval; char templine[256]; struct IsoFile *tempfile; GetDlgItemText(mainboxwindow, IDC_0202, templine, 256); returnval = IsIsoFile(templine); if (returnval == -1) { SetDlgItemText(mainboxwindow, IDC_0204, "File Type: ---"); return; } // ENDIF- Not a name of any sort? if (returnval == -2) { SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a file"); return; } // ENDIF- Not a regular file? if (returnval == -3) { SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Not a valid image file"); return; } // ENDIF- Not an Image file? if (returnval == -4) { SetDlgItemText(mainboxwindow, IDC_0204, "File Type: Missing Table File (will rebuild)"); return; } // ENDIF- Missing Compression seek table? tempfile = IsoFileOpenForRead(templine); sprintf(templine, "File Type: %s%s%s", multinames[tempfile->multi], tempfile->imagename, compressdesc[tempfile->compress]); SetDlgItemText(mainboxwindow, IDC_0204, templine); tempfile = IsoFileClose(tempfile); return; } // END MainBoxFileEvent()
gint ConversionBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) { char templine[256]; char tempblock[2352]; const char *filename; int compressmethod; int multi; struct IsoFile *fromfile; struct IsoFile *tofile; int i; off64_t endsector; int stop; int retval; ConversionBoxUnfocus(); filename = gtk_entry_get_text(GTK_ENTRY(conversionbox.file)); if (IsIsoFile(filename) < 0) { filename = NULL; MessageBoxShow("Not a valid file", 3); return(TRUE); } // ENDIF- Not an Iso File? Stop early. compressmethod = gtk_combo_box_get_active(GTK_COMBO_BOX(conversionbox.compress)); if (compressmethod > 0) compressmethod += 2; multi = 0; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(conversionbox.multi)) == TRUE) multi = 1; fromfile = NULL; fromfile = IsoFileOpenForRead(filename); if (fromfile == NULL) { filename = NULL; MessageBoxShow("Cannot opening the source file", 3); return(TRUE); } // ENDIF- Not an Iso File? Stop early. if ((compressmethod == fromfile->compress) && (multi == fromfile->multi)) { fromfile = IsoFileClose(fromfile); filename = NULL; MessageBoxShow("Compress/Multifile methods match - no need to convert", 3); return(TRUE); } // ENDIF- Not an Iso File? Stop early. tofile = IsoFileOpenForWrite(filename, GetImageTypeConvertTo(fromfile->imagetype), multi, compressmethod); if (tofile == NULL) { fromfile = IsoFileClose(fromfile); filename = NULL; MessageBoxShow("Cannot create the new file", 3); return(TRUE); } // ENDIF- Not an Iso File? Stop early. if (fromfile->multi == 1) { i = 0; while ((i < 10) && (IsoFileSeek(fromfile, fromfile->multisectorend[i] + 1) == 0)) i++; endsector = fromfile->multisectorend[fromfile->multiend]; } else { endsector = fromfile->filesectorsize; } // ENDIF- Get ending sector from multifile? (Or single file?) IsoFileSeek(fromfile, 0); // Open Progress Bar sprintf(templine, "%s: %s%s -> %s%s", filename, multinames[fromfile->multi], compressdesc[fromfile->compress], multinames[tofile->multi], compressdesc[tofile->compress]); ProgressBoxStart(templine, endsector); tofile->cdvdtype = fromfile->cdvdtype; for (i = 0; i < 2048; i++) tofile->toc[i] = fromfile->toc[i]; stop = 0; mainbox.stop = 0; progressbox.stop = 0; while ((stop == 0) && (tofile->sectorpos < endsector)) { retval = IsoFileRead(fromfile, tempblock); if (retval < 0) { MessageBoxShow("Trouble reading source file", 3); stop = 1; } else { retval = IsoFileWrite(tofile, tempblock); if (retval < 0) { MessageBoxShow("Trouble writing new file", 3); stop = 1; } // ENDIF- Trouble writing out the next block? } // ENDIF- Trouble reading in the next block? ProgressBoxTick(tofile->sectorpos); while (gtk_events_pending()) gtk_main_iteration(); if (mainbox.stop != 0) stop = 2; if (progressbox.stop != 0) stop = 2; } // ENDWHILE- Not stopped for some reason... ProgressBoxStop(); if (stop == 0) { if (tofile->multi == 1) tofile->name[tofile->multipos] = '0'; // First file strcpy(templine, tofile->name); // fromfile = IsoFileCloseAndDelete(fromfile); fromfile = IsoFileClose(fromfile); IsoSaveTOC(tofile); tofile = IsoFileClose(tofile); gtk_entry_set_text(GTK_ENTRY(mainbox.file), templine); } else { fromfile = IsoFileClose(fromfile); tofile = IsoFileCloseAndDelete(tofile); } // ENDIF- Did we succeed in the transfer? if (stop != 1) ConversionBoxRefocus(); if (stop == 0) ConversionBoxCancelEvent(widget, event, data); return(TRUE); } // END ConversionBoxOKEvent()