home *** CD-ROM | disk | FTP | other *** search
/ Mega Dittos - The Screensaver / megadittos.iso / dittos / specific.inc < prev    next >
Text File  |  1994-07-03  |  11KB  |  303 lines

  1. ''
  2. '' MegaDittos 1.0 CD-specific install functions
  3. '' Copyright (c) 1994 Aristosoft, Inc.
  4. ''
  5.  
  6. '' Globals:
  7. GLOBAL ADDir$    '' After Dark's directory
  8. GLOBAL SSDir$   '' screen saver directory
  9. GLOBAL SSRes%   '' Result of query
  10.  
  11. '' Set up product-specific titles, etc.
  12. SUB SetProductTitles STATIC
  13.     SetTitle "MegaDittos CD"
  14. END SUB
  15.  
  16.  
  17. FUNCTION InfFile() STATIC AS STRING
  18.     InfFile = "RAWDEAL.INF"
  19. END FUNCTION
  20.  
  21.  
  22. FUNCTION MakeInstDir(D$) STATIC AS STRING
  23.  
  24.     '' If we're lucky, this will tell us where we're located
  25.     S$ = GetIniKeyString(WININI$, "Aristosoft", "DITTOS")
  26.  
  27.     '' If that didn't work, then we'll punt with the default
  28.     IF S$ = "" THEN
  29.     S$ = D$ + ":\DITTOS"
  30.     END IF
  31.  
  32.     '' DITTO.EXE must be in the DITTO directory
  33.     IF EXISTS(MakePath(S$, "DITTO.EXE")) THEN
  34.     r% = DoMsgBox("An installed copy of MegaDittos was found in " + S$+ ".  Setup recommends that you install this product in the same location.", "MegaDittos", MB_OK)
  35.     ELSE
  36.         '' Find out where to install .AD files, if anywhere
  37.         ADDir$ = GetIniKeyString(MakePath(WINDIR$, "AD_PREFS.INI"), "After Dark", "Path")
  38.         IF EXISTS(MakePath(ADDir$, "AD.EXE")) THEN
  39.             SSRes% = DoMsgBox("Setup has located a copy of After Dark in " + ADDir$ + ".  Do you want to use MegaDittos with After Dark?", "MegaDittos", MB_YESNO)
  40.             S$ = ADDir$
  41.         ELSE
  42.             SSRes% = IDNO
  43.             ADDir$ = ""
  44.         END IF
  45.     END IF
  46.     MakeInstDir = S$
  47.     P$ = ""
  48. END FUNCTION
  49.  
  50.  
  51. SUB AddInfSectionNames(BASE$, TAPPS$, SOUNDS$, VOICES$, BASEINST$, TAPPSINST$, SOUNDSINST$, VOICESINST$) STATIC
  52.  
  53.     '' These are the base files we can install
  54.     IF SSRes% = IDNO THEN
  55.         AddListItem BASE$, "Base Files"
  56.     END IF
  57.     SetSymbolValue BASEINST$, GetSymbolValue(BASE$)
  58.  
  59.     '' These are the screen savers we can install
  60.     AddListItem TAPPS$, "Billvis and Gorehead"
  61.     AddListItem TAPPS$, "Clinton Coneheads"
  62.     AddListItem TAPPS$, "Dollar Bill"
  63.     AddListItem TAPPS$, "HillaryCare"
  64.     AddListItem TAPPS$, "Hillarygizer Bunny"
  65.     AddListItem TAPPS$, "Liberassic Park"
  66.     AddListItem TAPPS$, "Owl Gore"
  67.     AddListItem TAPPS$, "Raw Deal Headlines"
  68.     AddListItem TAPPS$, "Whitewater Grafting"
  69.  
  70.     '' By default, we install all Talking Apps
  71.     SetSymbolValue TAPPSINST$, GetSymbolValue(TAPPS$)
  72.  
  73.     AddListItem TAPPS$, "Billvis (extended version)"
  74.  
  75.     '' These are the sounds we can install
  76.  
  77.     '' By default, we install all the above
  78.     SetSymbolValue SOUNDSINST$, GetSymbolValue(SOUNDS$)
  79. END SUB
  80.  
  81.  
  82. SUB RecalcPath STATIC
  83.     CursorSave% = ShowWaitCursor()
  84.     RecalcOptFiles BASEFILES
  85.     RecalcOptFiles SOUNDFILES
  86.     RecalcOptFiles TAPPFILES
  87.     RestoreCursor CursorSave%
  88. END SUB
  89.  
  90.  
  91. SUB AddOptFiles STATIC
  92.     AddOptFilesToCopyList BASEFILES
  93.     AddOptFilesToCopyList TAPPFILES
  94.     AddOptFilesToCopyList SOUNDFILES
  95. END SUB
  96.  
  97.  
  98. SUB AddOptFilesToCopyList (ftype%) STATIC
  99.  
  100.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  101.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  102.         IF ftype% = BASEFILES THEN
  103.  
  104.             '' Base files
  105.             l% = GetListLength(BASEINST$)
  106.             FOR i% = 1 TO l% STEP 1
  107.                 AddSectionFilesToCopyList GetListItem(BASEINST$, i%), SrcDir$, DEST$
  108.             NEXT i%
  109.  
  110.             '' We always install these
  111.             AddSectionFilesToCopyList "System Files", SrcDir$, SYSDIR$
  112.  
  113.             IF INSTDSOUND% OR EXISTS(MakePath(SYSDIR$, "DSOUND.DLL")) THEN
  114.                 AddSectionFilesToCopyList "DSOUND Files", SrcDir$, SYSDIR$
  115.             END IF
  116.  
  117.         ELSEIF ftype% = TAPPFILES THEN
  118.  
  119.             l% = GetListLength(TAPPSINST$)
  120.  
  121.         FOR i% = 1 TO l% STEP 1
  122.                 AddSectionFilesToCopyList GetListItem(TAPPSINST$, i%), SrcDir$, DEST$
  123.         NEXT i%
  124.         END IF
  125.     SrcDir$ = ""
  126.     END IF
  127.  
  128. END SUB
  129.  
  130.  
  131. SUB SetDriveStatus STATIC
  132.     FITS% = 0
  133.     drive$ = MID$(DEST$, 1, 1)
  134.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  135.  
  136.     cost& = VAL(GetListItem(BASENEEDS$, ndrive%))
  137.     cost& = cost& + VAL(GetListItem(SOUNDNEEDS$, ndrive%))
  138.     cost& = cost& + VAL(GetListItem(TAPPNEEDS$, ndrive%))
  139.  
  140.     free& = GetFreeSpaceForDrive(drive$)
  141.     IF cost& > free& THEN
  142.     FITS% = 1
  143.     END IF
  144.     ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
  145.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  146.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  147.  
  148.     IF drive$ = WINDRIVE$ THEN
  149.     ReplaceListItem DRIVETEXT$, 4, ""
  150.     ReplaceListItem DRIVETEXT$, 5, ""
  151.     ReplaceListItem DRIVETEXT$, 6, ""
  152.     ELSE
  153.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  154.  
  155.     cost& = VAL(GetListItem(BASENEEDS$, ndrive%))
  156.     cost& = cost& + VAL(GetListItem(SOUNDNEEDS$, ndrive%))
  157.     cost& = cost& + VAL(GetListItem(TAPPNEEDS$, ndrive%))
  158.  
  159.     IF cost& = 0 THEN
  160.         ReplaceListItem DRIVETEXT$, 4, ""
  161.         ReplaceListItem DRIVETEXT$, 5, ""
  162.         ReplaceListItem DRIVETEXT$, 6, ""
  163.     ELSE
  164.         free& = GetFreeSpaceForDrive(WINDRIVE$)
  165.         IF cost& > free& THEN
  166.         FITS% = 1
  167.         END IF
  168.         ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  169.         ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  170.         ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  171.     END IF
  172.     END IF
  173. END SUB
  174.  
  175.  
  176. '' Add billboard dialogs for this app
  177. SUB AddBillboards STATIC
  178.     AddToBillboardList CUIDLL$, BBD1, "FModelessDlgProc", 100
  179.     AddToBillboardList CUIDLL$, BBD2, "FModelessDlgProc", 100
  180.     AddToBillboardList CUIDLL$, BBD3, "FModelessDlgProc", 100
  181.     AddToBillboardList CUIDLL$, BBD4, "FModelessDlgProc", 100
  182.     AddToBillboardList CUIDLL$, BBD5, "FModelessDlgProc", 100
  183.     AddToBillboardList CUIDLL$, BBD6, "FModelessDlgProc", 100
  184. END SUB
  185.  
  186.  
  187. CONST IDC_OWNER = 104
  188. CONST IDC_WORKPLACE = 106
  189. CONST RT_RCDATA = 10
  190.  
  191. SUB ConfigureApps STATIC
  192.  
  193.     '' This is so Fixer can find where we're installed
  194.     CreateIniKeyValue WININI$, "Aristosoft", "DITTOS", DEST$, cmoOverwrite
  195.  
  196.     IF SSRes% = IDNO THEN
  197.         '' This is the name of the group we'll install into
  198.         GROUP$ = "MegaDittos"
  199.         CreateProgmanGroup GROUP$, "", cmoNone
  200.     END IF
  201.  
  202.     '' Configure base applications
  203.     IF GetListItem(CHECKSTATES$, BASEFILES) = "ON" THEN
  204.  
  205.         '' Install this only if we're not using AD
  206.         IF SSRes% = IDNO THEN
  207.             ''Stamp the WFSABOUT resources
  208.             IF len(OWNER$) > 0 THEN
  209.                 StampResource "Base Files", "Runner", DEST$, RT_RCDATA, IDC_OWNER, OWNER$ + chr$(0), len(OWNER$) + 1
  210.             ELSE
  211.                 StampResource "Base Files", "Runner", DEST$, RT_RCDATA, IDC_OWNER, " " + chr$(0), 2
  212.             END IF
  213.             IF len(WORKPLACE$) > 0 THEN
  214.                 StampResource "Base Files", "Runner", DEST$, RT_RCDATA, IDC_WORKPLACE, WORKPLACE$ + chr$(0), len(WORKPLACE$) + 1
  215.             ELSE
  216.                 StampResource "Base Files", "Runner", DEST$, RT_RCDATA, IDC_WORKPLACE, " " + chr$(0), 2
  217.             END IF
  218.  
  219.             CreateProgmanItem GROUP$, "MegaDittos", MakePath(DEST$, "ditto.exe"), "", cmoOverwrite
  220.             CreateProgmanItem GROUP$, "Read Me!", MakePath(DEST$, "readme.wri"), "", cmoOverwrite
  221.         END IF
  222.  
  223.         '' Setup Video for Windows
  224.     CreateIniKeyValue SYSINI$, "Drivers", "VIDC.CVID", "iccvid.drv", cmoNone
  225.         CreateIniKeyValue SYSINI$, "Drivers", "wavemapper", "msacm.drv", cmoNone
  226.         CreateIniKeyValue SYSINI$, "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoNone
  227.  
  228.     END IF
  229.  
  230.     '' Install DSOUND.DLL as the wave driver if there isn't one already, somewhere...
  231.     IF INSTDSOUND% AND EXISTS(MakePath(SYSDIR$, "DSOUND.DLL")) THEN
  232.     CreateIniKeyValue SYSINI$, "drivers", "wave", "DSOUND.DLL", cmoOverwrite
  233.     END IF
  234. END SUB
  235.  
  236.  
  237.  
  238. '' Remove all files and directories...
  239.  
  240. SUB DoUninstall STATIC
  241.     IF IDYES = DoMsgBox("Are you sure you want to remove MegaDittos from your system?", "MegaDittos", MB_YESNO) THEN
  242.     DEST$ = GetIniKeyString(WININI$, "Aristosoft", "DITTOS")
  243.     IF DEST$ <> "" THEN
  244.  
  245.         SendProgmanCommand "[DeleteGroup(""MegaDittos"")]"
  246.  
  247.             KillFile MakePath(DEST$, "RODBUNNY.AD")
  248.             KillFile MakePath(DEST$, "HILLCARE.AD")