home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Millennium Auction
/
AUCTION_1.bin
/
setup
/
auction.mst
< prev
next >
Wrap
Text File
|
1994-06-18
|
28KB
|
804 lines
'****************************************************************************
' Setup routine for Program Auction
' Prog: Vatche
' Rev: 1.0
'
' Features:
' 1.0: Set Path
' Exit Confirmation
' Bad Path trap
' Help hooks (actual files still have to be implemented)
' Installation of Auction group and two icons
' Copy of the files to the correct location
'
' 2.0: Must add the version control on the files being copied
' The version control is done by the disklay program and so I
' do not need to do it here.
'
' Currently the sections in the auction.inf file are
' ACM Drivers
' AVI Codecs
' VfW Runtime
' Exe and Dll
'
' Copyright ⌐ 1993-1994, Eidolon, Inc.
'****************************************************************************
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
DECLARE FUNCTION InitTests(DestDrv$) AS INTEGER
DECLARE FUNCTION NumberOfColors AS INTEGER
DECLARE FUNCTION MakePath(szDir$, szFile$) AS STRING
DECLARE FUNCTION InstallVFW AS INTEGER
DECLARE SUB InstallFont(IniKey$, szFile$)
DECLARE FUNCTION FreeDiskSpace AS INTEGER
DECLARE FUNCTION GetDC LIB "user.exe" (hWnd%) AS INTEGER
DECLARE FUNCTION ReleaseDC LIB "User" (hwnd%, hdc%) AS INTEGER
DECLARE FUNCTION GetDeviceCaps LIB "gdi.exe" (hdc%,icap%) AS INTEGER
DECLARE FUNCTION GetFreeSpace LIB "kernel.exe" (ununsed%) AS LONG
''DECLARE FUNCTION FValidFATDir LIB "MSCOMSTF.DLL" (szDir$) AS INTEGER
DECLARE FUNCTION AddFontResource LIB "Gdi.exe" (szFile$) AS INTEGER
DECLARE FUNCTION OnWindowsNT LIB "iniupd.dll" AS INTEGER
DECLARE FUNCTION VflatdPresent LIB "iniupd.dll" AS INTEGER
DECLARE SUB Reboot LIB "iniupd.dll"
DECLARE FUNCTION ExitWindowsExec LIB "User" (Exec$, Param$) AS INTEGER
DECLARE FUNCTION ShowWindow LIB "User.exe" (hWnd%,iShow%) AS INTEGER
DECLARE FUNCTION SetWindowLong LIB "User.exe" (hWnd%, offset%, style&) AS LONG
''DECLARE SUB FixScreenProc LIB "mscuistf.dll" (arg%)
DECLARE FUNCTION DisableMurmur LIB "leidsetd.dll" AS INTEGER
'****************************************************************************
'Error trap
'****************************************************************************
ON ERROR GOTO ERRORQUIT
'***************************************************************************
'CONSTANTS
'****************************************************************************
CONST VGA_WIDTH = 640 'VGA
CONST VGA_HEIGHT = 480
CONST HARD_DISK_SPACE_REQUIRED = 3000000
CONST RAM_REQUIRED = 4000
CONST MAJ_DOS_VERSION = 5
CONST PROCESSOR_386 = 3
CONST COLOR_256 = 256
'****************************************************************************
'Window.h stuff
'****************************************************************************
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H00800000
CONST WS_CLIPCHILDREN = &H02000000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
CONST NUMCOLORS = 24 'windows constants
CONST RASTERCAPS = 38 '
CONST SIZEPALETTE = 104 '
CONST RC_PALETTE = &H0100 'mask for cheking VGA mode
CONST PMILOGO = 2 'Bitmap value from dialogs.rc file
'These are all the values for the dialog boxes copies from the header file
'manually
CONST WELCOME = 100
CONST PLEASE_WAIT = 105
CONST FILESWILLBEINSTALLED = 106
CONST RESTART = 107
CONST RESTART2 = 108
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST HELP2 = 901
CONST HELP3_2DRIVES = 902
CONST OVERWRITE_OPTIONS = 1000
CONST DIRECTORY_NEW = 1100
CONST HARD_DISK = 6200
CONST DISKFULL = 6300
CONST BADPATH = 6400
CONST MODELESS = 7000
'''$Define DEBUG
'****************************************************************************
'VARIABLES
'Required for the DialogProc values
'****************************************************************************
GLOBAL WINFILE$
''Dialog list symbol names
GLOBAL BUTTONSTATE$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$
'' Source and Destination information
GLOBAL DEST$
GLOBAL DestDrv$
GLOBAL WinDrv$
GLOBAL WinDir$
GLOBAL WinSysDir$
GLOBAL SrcDir$
GLOBAL SrcDrv$
'' Ini files (with paths)
GLOBAL ControlIni$
GLOBAL SystemIni$
GLOBAL WinIni$
GLOBAL Flg%
'****************************************************************************
'Start of program
'****************************************************************************
INIT:
'DLL for Dialog boxes
CUIDLL$ = "auc_cui.dll" ''Source of dialog boxes
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
hWnd%=HwndFrame()
'' AddToBillboardList CUIDLL$, MODELESS, "FBitmapDlgProc", 1
'' SetBitmap CUIDLL$, 2
SWLxx&=SetWindowLong(hWnd%,GWL_STYLE,WS_VISIBLE+WS_BORDER+WS_CLIPCHILDREN)
SWyy%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
'' Initialisation of various values
DEST$ = "C:\Auction"
SrcDir$ = GetSymbolValue("STF_SRCDIR") + "Setup"
SrcDrv$ = MID$(SrcDir$,1,1)
WinDir$ = GetWindowsDir()
WinSysDir$ = GetWindowsSysDir()
WinDrv$ = MID$(WinDir$,1,1)
ControlIni$ = MakePath(WinDir$, "control.ini")
SystemIni$ = MakePath(WinDir$, "system.ini")
WinIni$ = MakePath(WinDir$, "win.ini")
''CustInst list symbols, these symbols are hard coded in dlgprocs.c
''ButtonState refers to button INSTALL in the HardDiskAvailable Dialog
BUTTONSTATE$ = "ButtonState"
STATUSTEXT$ = "StatusItemsText"
DRIVETEXT$ = "DriveStatusText"
FOR i% = 1 TO 1 STEP 1
AddListItem BUTTONSTATE$, ""
NEXT i%
FOR i% = 1 TO 7 STEP 1
AddListItem STATUSTEXT$, ""
NEXT i%
FOR i% = 1 TO 9 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
'SetBitmap CUIDLL$, PMILOGO
SetTitle "Millennium Auction installation routine"
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSEIF sz$ = "EXIT" THEN
UIPop 1
GOSUB ASKQUIT
GOTO WELCOME
ELSE
UIPop 1
GOTO WELCOME
ENDIF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus" , "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
oldest$ = DEST$
DEST$ = GetSymbolValue("EditTextOut")
DestDrv$ = MID$(LTRIM$(DEST$),1,1)
'$ifdef DEBUG
PRINT "DestDrv$ ??",DestDrv$
'$endif ''DEBUG
IF IsDriveValid(DestDrv$) = 0 THEN
GOSUB BADDRIVE
GOTO GETPATHL1
END IF
IF IsDirWritable(DEST$) = 0 THEN ''Not Writeable
i% = DoMsgBox("This directory is invalid","Stop",MB_OK)
GOTO GETPATHL1
ELSE '' Directory writeable
IF DoesDirExist(DEST$) = 0 THEN
GOSUB NEWPATH
IF Flg = 0 THEN
GOTO GETPATHL1
END IF
END IF
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO GETPATHL1
END IF
i% = InitTests(DestDrv$)
IF i% = 2 THEN
GOTO QUIT
END IF
ClearCopyList
szInf$ = GetSymbolValue("STF_SRCINFPATH")
If szInf$ = "" Then
szInf$ = GetSymbolValue("STF_CWDDIR") + "AUCT.INF"
End If
ReadInfFile szInf$
sz$ = UIStartDlg(CUIDLL$, PLEASE_WAIT, "FModelessDlgProc", 0, "")
cursor% = ShowWaitCursor()
' Check the amount of space required
EnoughSpace% = FreeDiskSpace
RestoreCursor(cursor%)
UIPop 1
IF enoughSpace% = 1 THEN
DISKFULL:
sz$ = UIStartDlg(CUIDLL$, DISKFULL, "FInfoDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOTO DISKFULL
ENDIF
ENDIF
HARDDISK:
'' Differentiate help between one and two drive installation
IF DestDrv$ = WinDrv$ THEN
sz$ = UIStartDlg(CUIDLL$, HARD_DISK, "FCustInstDlgProc", HELP2, HELPPROC$)
ELSE
sz$ = UIStartDlg(CUIDLL$, HARD_DISK, "FCustInstDlgProc", HELP3_2DRIVES, HELPPROC$)
ENDIF
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO HARDDISK
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO HARDDISK
ELSE
UIPop 1
GOTO GETPATH
ENDIF
INSTALL:
sz$ = UIStartDlg(CUIDLL$, FILESWILLBEINSTALLED, "FModelessDlgProc", 0, "")
cursor% = ShowWaitCursor()
' Make a backup copy of the system files: system.ini, win.ini, control.ini, reg.dat
CopyFile SystemIni$ , MakePath(WinDir$, "system.auc"), cmoOverwrite, 0
CopyFile WinIni$ , MakePath(WinDir$, "win.auc"), cmoOverwrite, 0
CopyFile ControlIni$, MakePath(WinDir$, "control.auc"), cmoOverwrite, 0
CopyFile MakePath(WinDir$, "reg.dat"), MakePath(WinDir$, "REG.auc"), cmoOverwrite, 0
' Add the MSRLEC codec to the system.ini file
test$ = GetIniKeyString(SystemIni$,"Drivers","VIDC.RLEC")
IF test$ = "" THEN
CreateSysIniKeyValue SystemIni$,"Drivers","VIDC.RLEC","msrlec.drv", cmoVital
ENDIF
' Add the MSACM driver to the control panel so that we may use it
test$ = GetIniKeyString(SystemIni$, "MSACM", "EnableControl")
IF test$ = "" THEN
CreateIniKeyValue SystemIni$, "MSACM", "EnableControl", "1",cmoOverwrite
ENDIF
test2$ = GetIniKeyString(SystemIni$, "Drivers", "Wavemapper")
IF test2$ = "" THEN
CreateIniKeyValue SystemIni$, "Drivers", "Wavemapper" , "msacm.drv" , cmoOverwrite
ENDIF
test3$ = GetIniKeyString(SystemIni$, "Drivers", "MSACM.msadpcm")
IF test3$ = "" THEN
CreateIniKeyValue SystemIni$, "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
ENDIF
test4$ = GetIniKeyString(SystemIni$, "Drivers", "MSACM.imaadpcm")
IF test4$ = "" THEN
CreateIniKeyValue SystemIni$, "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
ENDIF
' Add the CD Audio driver if it is not installed
ClearCopyList
AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "AVI Codecs", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "Exe and Dlls", SrcDir$, DEST$
AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "MSRLEC", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "Auctioneer", SrcDir$, MakePath(DEST$, "Aud")
AddSectionFilesToCopyList "Data", SrcDir$, MakePath(DEST$, "Dat")
UIPop 1
''PRINT "CD drive = ", SrcDrv$
''RestartDir$ = MakePath(DestDrv$, "Auctmp")
RestartDir$ = DEST$
SetRestartDir RestartDir$
CopyFilesInCopyList
'' Add the correct ini key for the CD in Auction.ini
AuctionIni$ = MakePath(DEST$, "Auction.ini")
PRINT "Destination drive = ", DestDrv$
CreateIniKeyValue AuctionIni$, "config", "CD-Drive", SrcDrv$, cmoOverwrite
'' If MediaVision Card disable the murmur
test5% = DisableMurmur()
CreateIniKeyValue AuctionIni$, "Engine", "DisableMurmur", LTRIM$(STR$(test5%)), cmoOverwrite
'' Set up the ini values for VFW
dummy% = InstallVFW
'' Do the windows display stuff
AucExe$ = MakePath(DEST$, "Auction.exe")
AucReadme$ = MakePath(DEST$, "Readme.txt")
AucDemo$ = SrcDrv$ + ":\Demo\Demo.exe"
AucIntro$ = SrcDrv$ + ":\Intro\Intro.exe"
CreateProgmanGroup "Auction","",cmoNone
ShowProgmanGroup "Auction",1 ,cmoNone
CreateProgmanItem "Auction","Millennium Auction", AucExe$,"",cmoOverwrite
CreateProgmanItem "Auction","Readme", AucReadme$,"",cmoOverwrite
CreateProgmanItem "Auction","Demo", AucDemo$,"",cmoOverwrite
CreateProgmanItem "Auction","One World History", AucIntro$,"",cmoOverwrite
RestoreCursor(cursor%)
'' Restart Windows: if system files have been added (SYSTEM flag in Dsklayt)
'' then restart automatically else, give the user the choice
RESTRT% = RestartListEmpty ()
PRINT "RESTART% = ", RESTRT%
WinExe$ = MakePath(RESTARTDIR$, "\_msrstrt.exe")
WinBatch$ = MakePath(RESTARTDIR$, "\_mssetup.bat")
Empty$ = ""
RESTART:
IF RESTRT% = 0 THEN
sz$ = UIStartDlg(CUIDLL$, RESTART, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO RESTART
ENDIF
I% = ExitExecRestart ()
RemoveFile WinExe$, cmoForce
RemoveFile WinBatch$, cmoForce
END
ELSE
sz$ = UIStartDlg(CUIDLL$, RESTART2, "FQuitDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
I% = ExitWindowsExec (WinExe$, Empty$)
IF I% = 0 THEN
GOTO RESTART
ELSE
END
ENDIF
ELSEIF sz$ = "EXIT" THEN
UIPopAll
END
ELSEIF sz$ = "REACTIVATE" THEN
GOTO RESTART
ELSE
UIPop 1
END IF
END IF
GOTO QUIT
'****************************************************************************
'The drive given for a path is bad
'****************************************************************************
BADDRIVE:
i% = DoMsgBox("Cannot use this drive","No good",MB_OK)
RETURN
'****************************************************************************
'If Directory name is OK but does not exist
'****************************************************************************
NEWPATH:
Flg% = 0
SetSymbolValue "EditTextIn", DEST$
sz$ = UIStartDlg(CUIDLL$, DIRECTORY_NEW, "FInfo0DlgProc", 0, "")
IF sz$ = "CONTINUE" THEN ''Create
CreateDir DEST$, cmoNone
UIPop 1
Flg% = 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO NEWPATH
ELSE
UIPop 1
ENDIF
RETURN
'****************************************************************************
'Requires MSDETECT.INC
'Check whether for timing it is worth checking first in the windows directory
'It is better to use GetWindowsDir rather than using FindFileInTree
'Note that path name is terminated with a backslash
'****************************************************************************
FORCEQUIT:
i%=DoMsgBox("Your system does not have adequate capabilities for auction", "Warning", MB_OK)
END
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FRadioDlgProc", APPHELP, HELPPROC$)
IF sz$ = "EXIT" THEN
UIPopAll
GOTO QUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
ENDIF
RETURN
ERRORQUIT:
'$ifdef DEBUG
PRINT "Error line number is ",ERL
PRINT "File in which error occurred is ",ERF
PRINT "The error code is", ERR
PRINT "The error is ",ERROR$(ERR)
'$endif ''DEBUG
'GOODQUIT:
QUIT:
END
'****************************************************************************
'****************************************************************************
' FUNCTIONS AND SUBDIRECTORIES
'****************************************************************************
'****************************************************************************
'****************************************************************************
'Installs the user defined fonts
'****************************************************************************
SUB InstallFont (IniKey$, szFile$) STATIC
CreateIniKeyValue WinDir$ + "win.ini", "fonts", IniKey$, szFile$, cmoNone
dummy% = AddFontResource(szFile$)
END SUB
'****************************************************************************
'Set up all the ini key values for video for windows
' ADPCM stuff is done further up
'****************************************************************************
FUNCTION InstallVFW STATIC AS INTEGER
''Updating WIN.INI and SYSTEM.INI
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.RT21", "indeov.drv", cmoOverwrite
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.MRLE", "msrle.drv", cmoOverwrite
CreateIniKeyValue WinIni$, "mci extensions", "avi", "AVIVideo", cmoOverwrite
CreateIniKeyValue SystemIni$, "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.IV31", "indeov.drv", cmoOverwrite
CreateIniKeyValue SystemIni$, "Drivers", "VIDC.YVU9", "indeov.drv", cmoOverwrite
CreateIniKeyValue ControlIni$, "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
CreateIniKeyValue ControlIni$, "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
CreateIniKeyValue ControlIni$, "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
'' Update the VfW options to ensure our setup
CreateIniKeyValue WinIni$, "MCIAVI", "SkipFrames", "1", cmoOverwrite
CreateIniKeyValue WinIni$, "MCIAVI", "DefaultVideo", "Window", cmoOverwrite
IF VflatdPresent() = 0 THEN
CreateSysIniKeyValue SystemIni$, "386Enh", "device", "dva.386", cmoOverwrite
END IF
Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg"))
Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg"))
Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg"))
'' Mplayer
CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite
Run ("profdisp.exe")
END FUNCTION
'***********************************************************************
'Check if there is enough space on the hard drive to install the files
' DEST$ is a global value
'***********************************************************************
FUNCTION FreeDiskSpace STATIC AS INTEGER
''Add all files to the copy list and check the amount of free space
ReturnVal% = 0 ''All is OK
ClearCopyList
'' Files to be added to the windows directory
AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "AVI Codecs", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "MSRLEC", SrcDir$, WinSysDir$
AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$
AddSectionFilesToCopyList "Exe and Dlls", SrcDir$, DEST$
AddSectionFilesToCopyList "Auctioneer", SrcDir$, MakePath(DEST$, "Aud")
AddSectionFilesToCopyList "Data", SrcDir$, MakePath(DEST$, "Dat")
'$ifdef DEBUG
DumpCopyList "e:\auction.out"
PRINT "I am copying the auctioneer file to ", MakePath(DEST$, "Aud")
'$endif ''DEBUG
szExtras$ = "Extras"
szCosts$ = "Costs"
szNeededs$ = "Neededs"
FOR i% = 1 TO 26 STEP 1
AddListItem szExtras$, "0"
AddListItem szCosts$, "0"
AddListItem szNeededs$, "0"
NEXT i%
aucDrive% = ASC(ucase$(DestDrv$)) - ASC("A") + 1
sysDrive% = ASC(ucase$(WinDrv$)) - ASC("A") + 1
ret& = GetCopyListCost(szExtras$, szCosts$, szNeededs$)
'' ret = 0 means that all is OK otherwise not enough space
IF ret& <> 0 THEN
'' Grey out the INSTALL BUTTON in the dialog box
PRINT "BAD BAD button"
ReplaceListItem BUTTONSTATE$, 1, "ON"
ReturnVal% = 1 ''Not enough space
ReplaceListItem DRIVETEXT$, 8, "There is not enough room on your hard disk to install the Game!!"
ReplaceListItem DRIVETEXT$, 9, "Change your destination directory or erase some file from your hard disk"
ELSE
'' Normal format
PRINT "We have a normal button"
ReplaceListItem BUTTONSTATE$, 1, ""
'' No need for the extra text
ReplaceListItem DRIVETEXT$, 8, ""
ReplaceListItem DRIVETEXT$, 9, ""
ENDIF
'$ifdef DEBUG
PRINT "Windows Drive number = ", sysDrive%
PRINT "Auction Drive number = ", aucDrive%
PRINT "DestDir$ = ", DestDir$
'$endif ''DEBUG
wincost& = VAL(GetListItem(szCosts$, sysDrive%))
destcost& = VAL(GetListItem(szCosts$, aucDrive%))
'' No need for the second column of information
IF DestDrv$ = WinDrv$ THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ReplaceListItem DRIVETEXT$, 7, ""
ELSE
winfree& = GetFreeSpaceForDrive(WinDrv$)
ReplaceListItem DRIVETEXT$, 4, WinDrv$
ReplaceListItem DRIVETEXT$, 5, STR$(wincost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 6, STR$(winfree& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 7, "Windows Drive:"
END IF
destfree& = GetFreeSpaceForDrive(DestDrv$)
ReplaceListItem DRIVETEXT$, 1, DestDrv$
ReplaceListItem DRIVETEXT$, 2, STR$(destcost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 3, STR$(destfree& / 1024) + " K"
'$ifdef DEBUG
PRINT "Cost for Drive C = ", wincost&
PRINT "Cost for install Drive = ", destcost&
'$endif ''DEBUG
FreeDiskspace = ReturnVal%
END FUNCTION
'****************************************************************************
'NumberOfColors returns the number of colors that windows is running in
'****************************************************************************
FUNCTION NumberOfColors STATIC AS INTEGER
hdc%=GetDC(HwndFrame())
IF GetDeviceCaps(hdc%, RASTERCAPS) AND RC_PALETTE THEN
numclrs%=GetDeviceCaps(hdc%,SIZEPALETTE)
ELSE
numclrs%=GetDeviceCaps(hdc%, NUMCOLORS)
ENDIF
dummy% = ReleaseDC( 0, hdc%)
END FUNCTION
'****************************************************************************
'These are the routines to check if the configuration of the system is not
'correct for the game. The tests performed are:
' Processor type (to ensure MPC specs)
' Display (256 color VGA)
' Available Hard DIsk Space
' Available RAM on the machine (includes Swap file)
' DOS 5.0 should be loaded
' Windows 3.1 (need multimedia extensions)
' Mouse (may require test for multiinput
' device
'Return: 0 if all is OK
' 1 if a warning box should be put but can install
' 2 Exit installation
'****************************************************************************
FUNCTION InitTests(DestDrv$) STATIC AS INTEGER
'*************************************************************************
'Check Processor type
'*************************************************************************
InitTests%=0
c1% = GetProcessorType
IF c1% < 3 THEN
InitTests%=2
i%=DoMsgBox(STR$(c1%), "Processor Type", MB_OK)
ENDIF
'*************************************************************************
'Check for 256 color mode VGA
'Also see colors.mst for number of colors test
'*************************************************************************
c2% = GetScreenHeight()
c3% = GetScreenWidth()
c4% = NumberOfColors
IF c2% <> VGA_WIDTH THEN
'i%=DoMsgBox(STR$(c2%), "Screen width", MB_OK)
InitTests%=1
ELSEIF c3% <> VGA_HEIGHT THEN
'i%=DoMsgBox(STR$(c3%), "Screen Height", MB_OK)
InitTests%=1
ELSEIF c4% <> COLOR_256 THEN
'i%=DoMsgBox(STR$(c4%), "Number of Colors", MB_OK)
InitTests%=1
ENDIF
'*************************************************************************
'Check available RAM on the machine
'*************************************************************************
RAM& = GetFreeSpace (unused%)
IF RAM& < RAM_REQUIRED THEN
i%=DoMsgBox(STR$(RAM&), "RAM Required", MB_OK)
InitTests%=1
ENDIF
'*************************************************************************
'Ensure DOS 5.0 is loaded
'*************************************************************************
cDos% = GetDOSMajorVersion()
IF cDOS% < MAJ_DOS_VERSION THEN
i%=DoMsgBox(STR$(cDos%), "Dos Version required", MB_OK)
InitTests%=2
ENDIF
'*************************************************************************
'Ensure that windows version is OK
'*************************************************************************
cWin% = GetWindowsMajorVersion()
IF cWin% < MAJ_Win_VERSION THEN
i%=DoMsgBox(STR$(cWin%), "Win Version required", MB_OK)
InitTests%=2
ENDIF
'*************************************************************************
'Check if mouse has been installed
'Requires MSDETECT.INC
'cmouse% = 1 if exists
'*************************************************************************
cmouse% = HasMouseInstalled()
IF cmouse% <> 1 THEN
i%=DoMsgBox(STR$(cmouse%), "Mouse Present", MB_OK)
InitTests%=2
' Write Dialog box stating that mouse is not installed, and that
' instruction must be followed to play the game without a mouse
ENDIF
END FUNCTION
'*************************************************************************
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION