home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Mousebroken 1.0.1 / source / Mousebroken source ƒ / init code / init.c next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.2 KB  |  107 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        init.c
  4.  
  5. Purpose:    This module handles INIT initialization & installation of
  6.             the correct VBL (if any).
  7.  
  8.  
  9. Mousebroken -=- your computer isn't truly broken until it's mousebroken
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "structs.h"
  30. #include "init.h"
  31. #include "prefs.h"
  32. #include "really notify.h"
  33. #include "meat.h"
  34. #include "SetUpA4.h"
  35.  
  36. void main(void)
  37. {
  38.     int                resultCode;
  39.     PrefHandle        cdevStorage;
  40.     Boolean            goon;
  41.     
  42.     RememberA0();
  43.     SetUpA4();
  44.     
  45.     goon=TRUE;
  46.     
  47.     cdevStorage=NewHandle(sizeof(PrefStruct));
  48.     if (cdevStorage==0L)
  49.     {
  50.         StartupError(kNoMemory);
  51.         RestoreA4();
  52.         return;
  53.     }
  54.     
  55.     if (goon)
  56.     {
  57.         resultCode=PreferencesInit(cdevStorage);
  58.         if ((resultCode!=prefs_allsWell) && (resultCode!=prefs_virginErr))
  59.         {
  60.             StartupError(resultCode);
  61.             goon=FALSE;
  62.         }
  63.     }
  64.     
  65.     if (goon)
  66.     {
  67.         resultCode=GetModuleInfo(cdevStorage);
  68.         if (resultCode!=allsWell)
  69.         {
  70.             StartupError(resultCode);
  71.             goon=FALSE;
  72.         }
  73.     }
  74.     
  75.     if (goon)
  76.     {
  77.         if (((**cdevStorage).isOn) && ((**cdevStorage).moduleIndex!=0))
  78.         {
  79.             resultCode=OpenTheModule(cdevStorage);
  80.             if (resultCode!=allsWell)
  81.             {
  82.                 StartupError(resultCode);
  83.                 goon=FALSE;
  84.             }
  85.             
  86.             if (goon)
  87.             {
  88.                 resultCode=InstallTheMouseVBL(cdevStorage);
  89.                 CloseTheModule(cdevStorage);
  90.                 if (resultCode!=allsWell)
  91.                 {
  92.                     StartupError(resultCode);
  93.                     goon=FALSE;
  94.                 }
  95.             }
  96.         }
  97.     }
  98.     
  99.     SaveThePrefs(cdevStorage);
  100.     
  101.     if (goon)
  102.         StartupGood(cdevStorage);
  103.     
  104.     DisposeHandle(cdevStorage);
  105.     RestoreA4();
  106. }
  107.