home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Life: Multimedia Mega Pac
/
Multimedia_Mega-Pac_Computer_Life_1996.iso
/
er
/
simcity
/
disk1
/
sc2k4win.ms_
/
sc2k4win.bin
Wrap
Text File
|
1995-01-18
|
9KB
|
347 lines
'**************************************************************************
'* SimCity 2000 For Windows Demo Setup file
'* By Chris Weiss
'* Last Edited 12/9/94 9:52:38 AM
'* Some portions (c) 1994 Microsoft Corp.
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST DEMONAG = 500
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST VIDEOHELP = 901
CONST CPUHELP = 903
CONST MODEHELP = 904
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST PATHEXISTS = 6500
CONST CONFNAME = 7300
CONST GETUSER = 7500
CONST BADNAME = 7700
CONST BADVIDEO = 7701
CONST BADCOMPANY = 7702
CONST BADCPU = 7703
CONST BADMODE = 7704
''Misc program values
CONST INSTALLED_SIZE = 7000000 ''Size of installed SC2k for free space check
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL USERNAME$ ''User registration name.
GLOBAL COMPANYNAME$ ''Company Name
GLOBAL WINDIR$
GLOBAL WINSYSDIR$
GLOBAL WING1$
WINDIR$ = GetWindowsDir()
WINSYSDIR$ = GetWindowsSysDir ()
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle " SimCity 2000(R) Demo for Windows Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
DEST$ = "C:\SC2DEMOW"
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
CHECKCPU:
i% = GetProcessorType ()
IF i% < 3 THEN
sz$ = UIStartDLG(CUIDLL$, BADCPU, "FInfoDlgProc", CPUHELP, HELPPROC$)
IF SZ$ = "CONTINUE" THEN
UIPop 1
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO CHECKCPU
END IF
END IF
CHECKMODE:
i% = GetWindowsMode ()
IF i% < 2 THEN
sz$ = UIStartDLG(CUIDLL$, BADMODE, "FInfoDlgProc", MODEHELP, HELPPROC$)
IF SZ$ = "CONTINUE" THEN
UIPop 1
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO CHECKMODE
END IF
END IF
GETTHEUSER:
USERNAME$ = "SimCity 2000"
COMPANYNAME$ = "Interactive Demo"
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF MID$(DEST$, LEN(DEST$), 1) = "\" THEN
DEST$ = MID$(DEST$,1,LEN(DEST$) - 1)
END IF
' Is it a writeable directory?
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
''temp$ = "Free Space is " + str$(GetFreeSpaceForDrive(MID$(DEST$,1,1)))
''i% = DoMsgBox(temp$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
' Check free space
IF GetFreeSpaceForDrive(MID$(DEST$,1,1)) < INSTALLED_SIZE THEN
GOSUB TOOBIG
GOTO GETPATHL1
END IF
' Does it exist?
IF DoesFileExist(DEST$ + "\SC2DEMOW.EXE", FemExists) = 1 THEN
SetSymbolValue "ConfirmTextIn", DEST$
sz$ = UIStartDlg(CUIDLL$, PATHEXISTS, "FConfirmDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETTHEUSER
ELSEIF sz$ = "REACTIVATE" THEN
GOTO DOWING
ELSE
UIPop 1
END IF
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETTHEUSER
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
DOWING:
' This portion installs the DVA.386 driver on machines in Enhanced Mode
IF VflatdPresent() = 0 THEN
CreateSysIniKeyValue GetWindowsDir + "system.ini", "386Enh", "device", GetWindowsSysDir+"dva.386", cmoOverwrite
bInstallDVA% = 1
END IF
WING1$ = "WinG"
RemoveIniSection "WIN.INI", wing1$, CmoNone
Install
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted! Please call Maxis Technical Support.", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
OpenLogFile MakePath(DEST$, "SETUP.LOG"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
ClearCopyList
ClearBillboardList
AddToBillboardList "mscuistf.dll", DEMONAG, "FModelessDlgProc", 1
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "WING", SrcDir$, WINSYSDIR$
CopyFilesInCopyList
ini$ = MakePath(DEST$, "SC2DEMOW.INI")
CreateIniKeyValue ini$, "REGISTRATION", "Mayor Name", USERNAME$, cmoOverwrite
CreateIniKeyValue ini$, "REGISTRATION", "Company Name", COMPANYNAME$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Home", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Scenarios", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Graphics", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Music", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Cities", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Tilesets", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "PATHS", "Data", DEST$, cmoOverwrite
CreateIniKeyValue ini$, "LOCALIZE", "Language", "USA", cmoOverwrite
CreateIniKeyValue ini$, "WINDOWS", "Edit Window Position", "0 0 0 0", cmoOverwrite
CreateIniKeyValue ini$, "WINDOWS", "Toolbar Position", "0 0", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "Speed", "Normal", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "Sound", "On", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "Music", "On", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "AutoGoto", "On", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "Auto Budget", "Off", cmoOverwrite
CreateIniKeyValue ini$, "OPTIONS", "No Disasters", "Off", cmoOverwrite
CreateProgmanGroup "SimCity 2000", "", cmoNone
ShowProgmanGroup "SimCity 2000", 1, cmoNone
CreateProgmanItem "SimCity 2000", "SimCity 2000 Demo for Windows", DEST$ + "\SC2DEMOW.EXE", "", cmoOverwrite
CreateProgmanItem "SimCity 2000", "SimCity 2000 Demo for Windows Readme", DEST$ + "\README.WRI", "", cmoOverwrite
CreateProgmanItem "SimCity 2000", "SimCity 2000 Demo for Windows Help", DEST$ + "\SC2DEMOW.HLP", "", cmoOverwrite
CloseLogFile
END SUB
'**
'** 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