Return 0xCAFE from screen.init() to force display the screen first
authorMichael Georgoulopoulos <mgeorgoulopoulos@gmail.com>
Sun, 4 Sep 2016 11:05:07 +0000 (14:05 +0300)
committerMichael Georgoulopoulos <mgeorgoulopoulos@gmail.com>
Sun, 4 Sep 2016 11:05:07 +0000 (14:05 +0300)
src/mike.c
src/screen.c

index 5ab5276..ed995d9 100644 (file)
@@ -87,7 +87,11 @@ static int init(void)
 
        processNormal();
 
+#ifdef MIKE_PC
+       return 0xCAFE;
+#else
        return 0;
+#endif
 }
 
 static void destroy(void)
index 178cf7d..4379778 100644 (file)
@@ -34,9 +34,20 @@ int scr_init(void)
        assert(num_screens <= NUM_SCR);
 
        for(i=0; i<num_screens; i++) {
-               if(scr[i]->init() == -1) {
+               int r;
+               r = scr[i]->init();
+               if(r == -1) {
                        return -1;
                }
+
+               /* Make the effect run first if it returns "CAFE" from ins init() */
+               if (r == 0xCAFE) {
+                       struct screen *tmp;
+                       tmp = scr[i];
+                       scr[i] = scr[0];
+                       scr[0] = tmp;
+                       printf("*** Screen %s displayed out of order ***\n", scr[0]->name);
+               }
        }
        return 0;
 }