feat: CLI-only version (without GTK)
Modify the build system and the source files to support building a CLI-only version with only glib2 as a dependency. Use CLI_ONLY=1 ./configure, then make clean all.
This commit is contained in:
@@ -206,22 +206,29 @@ void RS01ReadSector(Image *image, unsigned char *buf, gint64 s)
|
||||
#define CRCBUFSIZE (1024*256)
|
||||
|
||||
void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, int mode)
|
||||
{ RS01Widgets *wl = NULL;
|
||||
{
|
||||
#ifndef CLI
|
||||
RS01Widgets *wl = NULL;
|
||||
#endif
|
||||
unsigned char buf[2048];
|
||||
guint32 *crcbuf = NULL;
|
||||
int unrecoverable_sectors = 0;
|
||||
int crcidx = 0;
|
||||
struct MD5Context image_md5;
|
||||
gint64 s, first_missing, last_missing;
|
||||
#ifndef CLI
|
||||
gint64 prev_missing = 0;
|
||||
gint64 prev_crc_errors = 0;
|
||||
#endif
|
||||
int last_percent,current_missing;
|
||||
char *msg;
|
||||
|
||||
/* Extract widget list from method */
|
||||
|
||||
#ifndef CLI
|
||||
if(method->widgetList)
|
||||
wl = (RS01Widgets*)method->widgetList;
|
||||
#endif
|
||||
|
||||
/* Position behind the ecc file header,
|
||||
initialize CRC buffer pointers */
|
||||
@@ -256,11 +263,13 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
|
||||
|
||||
/* Check for user interruption */
|
||||
|
||||
#ifndef CLI
|
||||
if(Closure->stopActions)
|
||||
{ image->sectorsMissing += image->sectorSize - s;
|
||||
if(crcbuf) g_free(crcbuf);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Read the next sector */
|
||||
|
||||
@@ -352,12 +361,16 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
|
||||
|
||||
MD5Update(&image_md5, buf, n); /* update image md5sum */
|
||||
|
||||
#ifndef CLI
|
||||
if(Closure->guiMode && mode & PRINT_MODE)
|
||||
percent = (VERIFY_IMAGE_SEGMENTS*(s+1))/image->sectorSize;
|
||||
else percent = (100*(s+1))/image->sectorSize;
|
||||
else
|
||||
#endif
|
||||
percent = (100*(s+1))/image->sectorSize;
|
||||
if(last_percent != percent)
|
||||
{ PrintProgress(msg,percent);
|
||||
|
||||
#ifndef CLI
|
||||
if(Closure->guiMode && mode & CREATE_CRC)
|
||||
SetProgress(wl->encPBar1, percent, 100);
|
||||
|
||||
@@ -369,6 +382,7 @@ void RS01ScanImage(Method *method, Image* image, struct MD5Context *ecc_ctxt, in
|
||||
prev_missing = image->sectorsMissing;
|
||||
prev_crc_errors = image->crcErrors;
|
||||
}
|
||||
#endif
|
||||
|
||||
last_percent = percent;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user