chiark / gitweb /
mention --upload at top of README
[ypp-sc-tools.main.git] / pctb / structure.c
index 6ccbb5e76b217518c54b7dcd66c84cb66e1554c4..fba7670a3b510e105dff978f1d21350928c0963f 100644 (file)
@@ -92,10 +92,16 @@ const CanonColourInfo canoncolourinfos[]= {
 
 static void mustfail1(const char *file, int line, const char *what) {
   fprintf(stderr,
-         "\n\n"
-         "Unable to figure out contents of YPP client display.\n"
-         " Check that your client is logged in has the correct display.\n"
-         " If that isn't the problem, please report this as a fault.\n\n"
+ "\n\n"
+ "Unable to figure out contents of YPP client display.\n"
+ "Please check the following:\n"
+ "   * YPP client is showing commodity listing screen\n"
+ "   * YPP client has antialiased text turned off (Ye / Options / General)\n"
+ "   * YPP client window is on top (we try to raise it but your window\n"
+ "      manager might have prevented that from succeeding)\n"
+ "   * Your X display is 24bpp (NB some VNC servers use 16bpp by default)\n"
+ "\n"
+ "If all of these are true, please report this as a fault.\n\n"
          "Technical details:"
          " %s:%d: requirement failed:\n"
          " %s\n",
@@ -525,23 +531,9 @@ void analyse(FILE *tsv_output) {
 
 DEBUG_DEFINE_SOME_DEBUGF(structcolon,colondebugf)
 
-void find_islandname(void) {
+Rect find_sunshine_widget(void) {
   Rect sunshiner;
-  char sunshine[MAXIMGIDENT], archisland[MAXIMGIDENT];
-
-  RgbImage *ri= alloc_rgb_image(page0_rgbimage->w, page0_rgbimage->h);
-  const unsigned char *srcp;
-  unsigned char *destp, *endp;
-  for (srcp=page0_rgbimage->data, destp=ri->data,
-        endp= ri->data + 3 * ri->w * ri->h;
-       destp < endp;
-       srcp++, destp++) {
-    unsigned char c= *srcp & 0xf0;
-    *destp= c | (c>>4);
-  }
 
-  cim= page_images[0];
-  
   sunshiner.tl.x= cim->w - 1034 +  885;
   sunshiner.br.x= cim->w - 1034 + 1020;
   sunshiner.tl.y= 227;
@@ -557,6 +549,24 @@ void find_islandname(void) {
   ADJUST_BOX(sunshiner,"o",20, (cim->w - 1034 + 700), MUST, tl,x,-1);
   ADJUST_BOX(sunshiner,"o",20,  cim->w,               MUST, br,x,+1);
   debug_rect("sunshiner",1, sunshiner);
+  return sunshiner;
+}
+
+void find_islandname(RgbImage *ri) {
+  find_structure(page_images[0], 0);
+
+  Rect sunshiner= find_sunshine_widget();
+  char sunshine[MAXIMGIDENT], archisland[MAXIMGIDENT];
+
+  const unsigned char *srcp;
+  unsigned char *destp, *endp;
+  for (srcp=page0_rgbimage->data, destp=ri->data,
+        endp= ri->data + 3 * ri->w * ri->h;
+       destp < endp;
+       srcp++, destp++) {
+    unsigned char c= *srcp & 0xf0;
+    *destp= c | (c>>4);
+  }
 
   identify_rgbimage(ri, sunshiner, sunshine, "sunshine widget");
   
@@ -626,6 +636,7 @@ void find_islandname(void) {
     Point p;
     int nspaces=1, might_be_colon=0;
     uint32_t colon_pattern= 0;
+    p.y=-1;
 
     for (p.x=islandnamer.br.x; p.x>islandnamer.tl.x; p.x--) {
       colondebugf("structcolon: x=%4d nsp=%2d mbc=%d cp=%08"PRIx32" ",
@@ -677,8 +688,6 @@ void find_islandname(void) {
     islandnamer.br.x= p.x;
 
     identify_rgbimage(ri, islandnamer, archisland, "island");
-
-    assert(!"not vessel");
   }
 
   char *delim= strstr(archisland," - ");