diff --git a/src/fpid.c b/src/fpid.c index 9220570..c2340f8 100644 --- a/src/fpid.c +++ b/src/fpid.c @@ -20,6 +20,29 @@ #include #include +/* global structs */ +char *pieces[] = { + "xloader", // xloader.bin + "2nd", // 2nd + "secondary", // secondary.bin + "kernel", // zImage + "initfs", // jffs'd initfs + "rootfs", // 80mB of blob + "omap-nand", // 8kB of food for the nand + "fiasco", // FIASCO IMAGE + NULL +}; + +long fpid_size(const char *filename) +{ + long sz; + FILE *fd = fopen(filename, "r"); + fseek(fd, 0, SEEK_END); + sz = ftell(fd); + fclose(fd); + return sz; +} + const char *fpid_file(const char *filename) { FILE *fd; @@ -45,6 +68,9 @@ const char *fpid_file(const char *filename) size = ftell(fd); fclose(fd); + if (!memcmp(b, "\xb4", 1)) + return pieces[PIECE_FIASCO]; + else if (!memcmp(b+0x34, "2NDAPE", 6)) return pieces[PIECE_2ND]; else diff --git a/src/gui/Makefile b/src/gui/Makefile index 661bf66..58d9bc2 100644 --- a/src/gui/Makefile +++ b/src/gui/Makefile @@ -1,5 +1,5 @@ all: - gtkamlc --Xcc=-I../squeue ../squeue/squeue.c ../squeue/squeue.vapi gui.gtkaml --pkg gtk+-2.0 -o a.out + gtkamlc --save-temps --Xcc=-I../squeue ../squeue/squeue.c ../fpid.c ../squeue/squeue.vapi gui.gtkaml extras.vapi --pkg gtk+-2.0 -o goxf test: valac --save-temps --Xcc=-I.. squeue.vapi test.vala ../squeue.c -o v diff --git a/src/gui/extras.vapi b/src/gui/extras.vapi new file mode 100644 index 0000000..d8f2ddc --- /dev/null +++ b/src/gui/extras.vapi @@ -0,0 +1,10 @@ +namespace Extras { + public class External { + [CCode (cname = "system")] + public static int system(string cmd); + [CCode (cname = "fpid_file")] + public static string fpid_file(string file); + [CCode (cname = "fpid_size")] + public static long fpid_size(string file); + } +} diff --git a/src/gui/gui.gtkaml b/src/gui/gui.gtkaml index 8094da2..43ba5ca 100644 --- a/src/gui/gui.gtkaml +++ b/src/gui/gui.gtkaml @@ -6,8 +6,14 @@ --> - + @@ -21,6 +27,17 @@ + + + + + + + + + + + @@ -38,33 +55,36 @@ - +