From 16173a8338cf4f2a656e2a0bb3631d23b3fd1856 Mon Sep 17 00:00:00 2001
From: Steve Revill <srevill@gitlab.riscosopen.org>
Date: Thu, 13 Sep 2012 00:16:43 +0000
Subject: [PATCH] Simplify and improve a bit.

Version 0.03. Tagged as 'BootFX-0_03'
---
 VersionNum     | 20 +++++++--------
 c/bootfx       | 67 ++++++++++++++++++++++++++------------------------
 cmhg/bootfxHdr |  5 ++--
 3 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/VersionNum b/VersionNum
index de88df1..812194c 100644
--- a/VersionNum
+++ b/VersionNum
@@ -1,23 +1,23 @@
-/* (0.02)
+/* (0.03)
  *
  * This file is automatically maintained by srccommit, do not edit manually.
  * Last processed by srccommit version: 1.1.
  *
  */
-#define Module_MajorVersion_CMHG        0.02
+#define Module_MajorVersion_CMHG        0.03
 #define Module_MinorVersion_CMHG        
-#define Module_Date_CMHG                03 Sep 2012
+#define Module_Date_CMHG                13 Sep 2012
 
-#define Module_MajorVersion             "0.02"
-#define Module_Version                  2
+#define Module_MajorVersion             "0.03"
+#define Module_Version                  3
 #define Module_MinorVersion             ""
-#define Module_Date                     "03 Sep 2012"
+#define Module_Date                     "13 Sep 2012"
 
-#define Module_ApplicationDate          "03-Sep-12"
+#define Module_ApplicationDate          "13-Sep-12"
 
 #define Module_ComponentName            "BootFX"
 #define Module_ComponentPath            "bsd/RiscOS/Sources/Video/UserI/BootFX"
 
-#define Module_FullVersion              "0.02"
-#define Module_HelpVersion              "0.02 (03 Sep 2012)"
-#define Module_LibraryVersionInfo       "0:2"
+#define Module_FullVersion              "0.03"
+#define Module_HelpVersion              "0.03 (13 Sep 2012)"
+#define Module_LibraryVersionInfo       "0:3"
diff --git a/c/bootfx b/c/bootfx
index 3ce6c46..c67b647 100644
--- a/c/bootfx
+++ b/c/bootfx
@@ -57,6 +57,7 @@ extern void *SplashResources(void);
 extern void *Bar24Resources(void);
 extern void *PreDeskResources(void);
 
+#if 0
 /** Table of the number of following bytes (parameters) for a given VDU code (the table index).
  */
 static uint32_t vdu_params[32] =
@@ -70,7 +71,7 @@ static uint32_t vdu_params[32] =
   /* 24 */ 8, 5, 0, 0,
   /* 28 */ 4, 4, 0, 2
 };
-
+#endif
 
 /* Various potentially useful structures */
 typedef struct sprite_area_s sprite_area_t;
@@ -172,8 +173,8 @@ static uint32_t       scale_matrix[4];         /**< Scale factor block (for curr
 static uint32_t       pixel_trans[4];          /**< Pixel translation table (for current mode). */
 static void          *splash_jpeg    = NULL;   /**< Pointer to the splash screen JPEG data (NULL if none). */
 static size_t         splash_size    = 0;      /**< Size (bytes) of the splash screen JPEG data. */
-static void          *Workspace      = NULL;
-static bool           claimed_wrchv  = false;
+static void          *Workspace      = NULL;   /**< Module workspace pointer. */
+//static bool           claimed_wrchv  = false;  /**< Flag to indicate we have claimed WrchV. */
 
 
 /********************************************************************************
@@ -394,16 +395,14 @@ static _kernel_oserror *set_text_window(void)
 }
 
 
+#if 0
 static _kernel_oserror *claim_wrchv(void)
 {
-/* TODO: this bit needs a lot more testing, so disable it for now... */
-#if 0
   if (!claimed_wrchv)
   {
     ERR(_swix(OS_Claim, _INR(0,2), WrchV, &oswrchv_entry, Workspace));
     claimed_wrchv = true;
   }
-#endif
   return NULL;
 }
 
@@ -417,6 +416,7 @@ static _kernel_oserror *release_wrchv(void)
   }
   return NULL;
 }
+#endif
 
 
 /** Do all sorts of stuff on a mode change.
@@ -428,35 +428,31 @@ static _kernel_oserror *release_wrchv(void)
 static _kernel_oserror *mode_has_changed(void)
 {
   _kernel_oserror *err;
+  bool             predesk = not_in_desktop();
 
   /* Re-cache our mode information when there's a mode change */
   ERR(read_mode_info());
 
-  /* Only do this bit if we're not yet in the desktop */
-  if (not_in_desktop())
+  if (!predesk)
   {
-    (void) _swix(ScreenFX_Fade, _INR(0,3), 1, 0, 0, FADE_OUT_CS);
-  }
-  else
-  {
-    ERR(claim_wrchv());
+    return NULL;
   }
 
+  /* Fade quickly to black */
+  (void) _swix(ScreenFX_Fade, _INR(0,3), 1, 0, 0, FADE_OUT_CS);
+
   /* Plot the splash screen JPEG full-screen */
   if (splash_jpeg)
   {
     ERR_GOTO(plot_fullscreen_jepg(splash_jpeg, splash_size));
   }
 
-  /* Only do this bit if we're not yet in the desktop */
-  if (not_in_desktop())
-  {
-    /* Fade back in from black (more slowly and in the background) */
-    (void) _swix(ScreenFX_Fade, _INR(0,3), 0, 0, 0xFFFFFF00, FADE_IN_CS);
+  /* Fade in from black (more slowly and in the background) */
+  (void) _swix(ScreenFX_Fade, _INR(0,3), 0, 0, 0xFFFFFF00, FADE_IN_CS);
+
+  /* Set up the text window and fade (quickly) to black */
+  ERR(set_text_window());
 
-    /* Set up the text window and fade (quickly) to black */
-    ERR(set_text_window());
-  }
   return NULL;
 
 error:
@@ -777,7 +773,6 @@ _kernel_oserror *Module_Final(int fatal, int podule, void *pw)
   /* Free various buffers */
   FREE(msg_desc);
   FREE(cli_buf);
-  FREE(splash_jpeg);
   if (!bar_spr_resfs)
   {
     FREE(bar_spr_area);
@@ -792,7 +787,7 @@ _kernel_oserror *Module_Final(int fatal, int podule, void *pw)
 #endif
 
   /* Restore WrchV to its normal state */
-  (void) release_wrchv();
+  //(void) release_wrchv();
 
   return NULL;
 }
@@ -812,20 +807,26 @@ void Module_Service(int service_number, _kernel_swi_regs *r, void *pw)
       (void) mode_has_changed();
       break;
     }
-    case Service_WimpReportError:
-    {
-      /* Restore WrchV to its normal state */
-      (void) release_wrchv();
-
-      break;
-    }
+//    case Service_WimpReportError:
+//    {
+//      /* Restore WrchV to its normal state */
+//      //(void) release_wrchv();
+//
+//      break;
+//    }
     case Service_DesktopWelcome:
     {
       /* Restore WrchV to its normal state */
-      (void) release_wrchv();
+      //(void) release_wrchv();
 
       /* Stop doing splash screen plotting */
-      splash_jpeg = NULL;
+      if (splash_jpeg)
+      {
+        (void) plot_fullscreen_jepg(splash_jpeg, splash_size);
+        splash_jpeg = NULL;
+
+//        ERR(claim_wrchv());
+      }
 
       /* Discard the progress bar sprite data (and free the buffer) */
       (void) cli_free(NULL);
@@ -889,6 +890,7 @@ _kernel_oserror *Module_Cmd(const char *arg_string, int argc, int cmd_no, void *
 }
 
 
+#if 0
 /********************************************************************************
  *
  * This handler is entered for every character that passes through WrchV.
@@ -922,3 +924,4 @@ extern int OSWrchV_Handler(_kernel_swi_regs *r, void *pw)
   }
   return pass;
 }
+#endif
diff --git a/cmhg/bootfxHdr b/cmhg/bootfxHdr
index 8963707..9ecfb90 100644
--- a/cmhg/bootfxHdr
+++ b/cmhg/bootfxHdr
@@ -15,9 +15,10 @@ initialisation-code:	Module_Init
 
 finalisation-code:	Module_Final
 
-vector-handlers:	oswrchv_entry/OSWrchV_Handler
+;vector-handlers:	oswrchv_entry/OSWrchV_Handler
 
-service-call-handler:	Module_Service Service_ModeChange Service_WimpReportError Service_DesktopWelcome
+service-call-handler:	Module_Service Service_ModeChange Service_DesktopWelcome
+;service-call-handler:	Module_Service Service_ModeChange Service_WimpReportError Service_DesktopWelcome
 
 command-keyword-table:	Module_Cmd BootFX_BarLoad(,
 					min-args:1,
-- 
GitLab