home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
VRML Tools for 3D Cyberspace
/
VRML_Tools_For_3D_Cyberspace.iso
/
virtus
/
prolocal.in_
/
prolocal.bin
Wrap
Text File
|
1996-07-01
|
16KB
|
512 lines
'----------------------------------------------------------------
'- more specialized little functions to make our lives easier.
'- John Alspaugh 10OCT94
'- Copyright 1993-1994 Virtus Corporation. All Rights Reserved.
'-
'- Note that this must be included after MSDETECT.INC and SETUPAPI.INC
'-
'----------------------------------------------------------------
'-------------------------------------------------------------------
'' VL_* functions are those with local variable references.
'' V* functions can stand alone.
'-------------------------------------------------------------------
'' define one of these: PROGRAM or LIBRARY. It defines the dialog
'' IDs and stuff.
'$DEFINE PROGRAM
'$ifdef PROGRAM
'$DEFINE OPTION ''if OPTION, then give the user the choice of a custom install.
''''$DEFINE SERIAL ''no serial, no work.
'$DEFINE CHATTER '' turns on the little blurby messages during the install
'''$ELSE IF LIBRARY
'$endif 'PROGRAM
'*******************************************************************
' consts for dialogs
CONST MODWININI_DLG = 7600
'*******************************************************************
' declare all the functions up front.
DECLARE SUB VL_Initialize
DECLARE SUB VL_InitDiskCosts
DECLARE SUB VL_RecalcOptFiles (ftype%)
DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
DECLARE SUB VL_SetupBillboards
DECLARE SUB VL_InitDirNames
DECLARE SUB VL_RecalcPath
DECLARE SUB VL_AddOptFilesToCopyList (ftype%)
DECLARE SUB VL_DoTheInstall
DECLARE SUB VL_MakeTheAppIcons
DECLARE SUB VL_ShowIconsOkay
DECLARE FUNCTION VL_ShouldWeSerialize AS INTEGER
DECLARE SUB VL_InitReadmeFileNames
DECLARE SUB VL_MakeTheReadmeIcons
'*******************************************************************
' these are the global variable things. They get used in lots of
' areas
'' there should be one I* const for each checkbox in dialog #6200
CONST IAPPFILES = 1
CONST ILIBRARIES = 2
CONST IMODELS = 3
CONST ITEXTURES = 4
CONST N_CHECKBOXES = 4 '' you get this from counting the number of
'' checkboxes in dialog #6200
GLOBAL DESTDIRNAME$ '' the path of the destination directory
GLOBAL PRODUCTNAME$ '' the real name of the product (like "Virtus VR")
GLOBAL EXEFILENAME$ '' the name of the exe (like VIRTUSVR.EXE)
GLOBAL PROGRAMGROUP$ '' name we want the group to have in the Program Manager
GLOBAL DATAFILEEXT$ '' file extension for the models (VVR, WLK)
GLOBAL INFFILENAME$ '' name of the INF file
GLOBAL DEFDIRNAME$ '' default directory name
GLOBAL THEINIFILE$ '' name of the ini file we associate our extension in
GLOBAL BACKUPINIFILE$ '' name we back the ini file up to
GLOBAL WINDRIVE$ '' windows drive (the windows dir is here)
GLOBAL WINDIR$
GLOBAL DIALOGDLL$ '' where the dialogs come from
''DECLARE SUB VL_Initialize
'-------------------------------------------------------------------
' inits the variables specific to this installer.
SUB VL_Initialize STATIC
WINDIR$ = GetWindowsDir()
WINDRIVE$ = ucase$(MID$(WINDIR$, 1, 1))
'' REPLACE ME!
PRODUCTNAME$ = "Virtus WalkThrough VRML"
EXEFILENAME$ = "VWTVRML.EXE"
PROGRAMGROUP$ = "Virtus WalkThrough VRML"
DATAFILEEXT$ = "WTV"
INFFILENAME$ = "VWTVRML.INF"
DEFDIRNAME$ = "VWTVRML"
BACKUPINIFILE$ = "winini.vpr"
'' REPLACE ME!
DESTDIRNAME$ = WINDRIVE$ + ":\" + DEFDIRNAME$
THEINIFILE$ = "win.ini"
DIALOGDLL$ = "mscuistf.dll"
END SUB
'*******************************************************************
' Variable and functions for the disk cost stuff. There is one
' variable for each section in the dialog #6200. Also related are
' the I* constants in the previous section
''CustInst list symbol names
GLOBAL APPNEEDS$ 'Application items need this much disk space
GLOBAL LIBRARYNEEDS$ 'Gallery items need
GLOBAL MODELNEEDS$ 'Scene items need this much disk space
GLOBAL TEXTURENEEDS$ 'Texture items need this much disk space
GLOBAL PLAYERNEEDS$ 'Texture items need this much disk space
GLOBAL EXTRACOSTS$ 'List of extra costs to add per drive. This is how much we're short.
''DECLARE SUB VL_InitDiskCosts
''DECLARE SUB VL_RecalcOptFiles (ftype%)
''DECLARE FUNCTION VL_DoCheckItems(pItem$) AS INTEGER
''DECLARE FUNCTION VL_CalcDiskCost(pDrive$) AS LONG
'-------------------------------------------------------------------
' inits the variables specific to calculating the disk costs
SUB VL_InitDiskCosts STATIC
''Disk cost list symbols
'' REPLACE ME!
APPNEEDS$ = "AppNeeds"
LIBRARYNEEDS$ = "LibraryNeeds"
MODELNEEDS$ = "ModelNeeds"
TEXTURENEEDS$ = "TextureNeeds"
'' REPLACE ME!
EXTRACOSTS$ = "ExtraCosts"
FOR i% = 1 TO 26 STEP 1
AddListItem APPNEEDS$, "0"
AddListItem LIBRARYNEEDS$, "0"
AddListItem MODELNEEDS$, "0"
AddListItem TEXTURENEEDS$, "0"
AddListItem EXTRACOSTS$, "0"
NEXT i%
END SUB
'-------------------------------------------------------------------
' calculates disk cost
SUB VL_RecalcOptFiles (ftype%) STATIC
CursorSave% = ShowWaitCursor()
ClearCopyList
VL_AddOptFilesToCopyList ftype%
fExtra% = 0
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
IF ftype% = IAPPFILES THEN
'$IFDEF PROGRAM
IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
''Add extra cost to Windows drive for ini/progman, etc.
ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
fExtra% = 1
END IF
'$ENDIF 'PROGRAM
ListSym$ = APPNEEDS$
ELSEIF ftype% = ILIBRARIES THEN
ListSym$ = LIBRARYNEEDS$
ELSEIF ftype% = IMODELS THEN
ListSym$ = MODELNEEDS$
ELSEIF ftype% = ITEXTURES THEN
ListSym$ = TEXTURENEEDS$
ELSE
ListSym$ = ""
END IF
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(ListSym$, i%))
NEXT i%
ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
IF fExtra% THEN
ReplaceListItem EXTRACOSTS$, ndrive%, "0"
END IF
RestoreCursor CursorSave%
ListSym$ = ""
END SUB
'-------------------------------------------------------------------
' handles the custom install (dialog #6200) checkboxes. Order is
' set in the dialog itself.
FUNCTION VL_DoCheckItems(pItem$) STATIC AS INTEGER
IF pItem$ = "CHK1" THEN
VL_RecalcOptFiles IAPPFILES
ok% = 1
ELSEIF pItem$ = "CHK2" THEN
VL_RecalcOptFiles ILIBRARIES
ok% = 1
ELSEIF pItem$ = "CHK3" THEN
VL_RecalcOptFiles IMODELS
ok% = 1
ELSEIF pItem$ = "CHK4" THEN
VL_RecalcOptFiles ITEXTURES
ok% = 1
ELSE
ok% = 0
END IF
VL_DoCheckItems = ok%
END FUNCTION
'-------------------------------------------------------------------
' Calculates the cost of installing the items in the list by adding
' the cost associated with each of the items.
FUNCTION VL_CalcDiskCost (pDrive$) STATIC AS LONG
'$ifdef DEBUG
if pDrive$ = "" then
BadArgErr 1, "VL_CalcDiskCost", pDrive$
end if
'$endif ''DEBUG
ndrive% = ASC(ucase$(pDrive$)) - ASC("A") + 1
diskCost& = 0
''REPLACE ME BEGIN
diskCost& = diskCost& + VAL(GetListItem(APPNEEDS$, ndrive%))
diskCost& = diskCost& + VAL(GetListItem(LIBRARYNEEDS$, ndrive%))
diskCost& = diskCost& + VAL(GetListItem(MODELNEEDS$, ndrive%))
diskCost& = diskCost& + VAL(GetListItem(TEXTURENEEDS$, ndrive%))
''REPLACE ME END
VL_CalcDiskCost = diskCost&
END FUNCTION
SUB VL_SetupBillboards STATIC
ClearBillboardList
AddToBillboardList DIALOGDLL$, 110, "FModelessDlgProc", 40
AddToBillboardList DIALOGDLL$, 111, "FModelessDlgProc", 40
AddToBillboardList DIALOGDLL$, 112, "FModelessDlgProc", 40
AddToBillboardList DIALOGDLL$, 114, "FModelessDlgProc", 40
END SUB
'*******************************************************************
' Variable and functions to deal with the directory structure and to
' place items into the right directories
' these are the names of subdirectories
GLOBAL LIBRARYDirName$ 'name of the library directory
GLOBAL MANUALDirName$ 'name of the manual directory
GLOBAL MODELSDirName$ 'name of the model directory
GLOBAL CSPACEMODDirName$ 'name of the cspace model directory
GLOBAL TEMPLEMODDirName$ 'name of the temple model directory
' vars for the full paths
GLOBAL LIBRARYDest$ 'library/
GLOBAL MANUALDest$ 'manual/
GLOBAL MODELSDest$ 'models/
GLOBAL CSPACEMODDest$ 'models/cspace
GLOBAL TEMPLEMODDest$ 'models/temple
''DECLARE SUB VL_InitDirNames
''DECLARE SUB VL_RecalcPath
''DECLARE SUB VL_AddOptFilesToCopyList (ftype%)
''DECLARE SUB VL_DoTheInstall
''DECLARE SUB VL_MakeTheAppIcons
''DECLARE SUB VL_ShowIconsOkay
'-------------------------------------------------------------------
' inits the variables for the directory management routines.
SUB VL_InitDirNames STATIC
''LOCALIZE ME BEGIN
LIBRARYDirName$ = "\LIBRARY"
MANUALDirName$ = "\MANUAL"
MODELSDirName$ = "\MODELS"
CSPACEMODDirName$ = "\CSPACE"
TEMPLEMODDirName$ = "\TEMPLE"
''LOCALIZE ME END
END SUB
'-------------------------------------------------------------------
' inits the variables specific to this installer.
SUB VL_RecalcPath STATIC
CursorSave% = ShowWaitCursor()
LIBRARYDest$ = DESTDIRNAME$ + LIBRARYDirName$
MANUALDest$ = DESTDIRNAME$ + MANUALDirName$
MODELSDest$ = DESTDIRNAME$ + MODELSDirName$
CSPACEMODDest$ = MODELSDest$ + CSPACEMODDirName$
TEMPLEMODDest$ = MODELSDest$ + TEMPLEMODDirName$
VL_RecalcOptFiles IAPPFILES
VL_RecalcOptFiles ILIBRARIES
VL_RecalcOptFiles IMODELS
VL_RecalcOptFiles ITEXTURES
RestoreCursor CursorSave%
END SUB
'-------------------------------------------------------------------
' inits the variables specific to this installer.
SUB VL_AddOptFilesToCopyList (ftype%) STATIC
IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
SrcDir$ = GetSymbolValue("STF_SRCDIR")
IF ftype% = IAPPFILES THEN
AddSectionFilesToCopyList "AppFiles", SrcDir$, DESTDIRNAME$
AddSectionFilesToCopyList "AlwaysInstall", SrcDir$, DESTDIRNAME$
ELSEIF ftype% = ILIBRARIES THEN
AddSectionFilesToCopyList "Library", SrcDir$, LIBRARYDest$
ELSEIF ftype% = IMODELS THEN
AddSectionFilesToCopyList "Models", SrcDir$, MODELSDest$
AddSectionFilesToCopyList "CSpace", SrcDir$, CSPACEMODDest$
AddSectionFilesToCopyList "Temple", SrcDir$, TEMPLEMODDest$
ELSEIF ftype% = ITEXTURES THEN
AddSectionFilesToCopyList "Manual", SrcDir$, MANUALDest$
END IF
SrcDir$ = ""
END IF
END SUB
SUB VL_DoTheInstall STATIC
CursorSave% = ShowWaitCursor()
ClearCopyList
''application
IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
CreateDir DESTDIRNAME$, cmoNone
VL_AddOptFilesToCopyList IAPPFILES
SetRestartDir WINDIR$ '' restart in
END IF
'' 2D & 3D galleries
IF GetListItem(CHECKSTATES$, ILIBRARIES) = "ON" THEN
CreateDir LIBRARYDest$, cmoNone
VL_AddOptFilesToCopyList ILIBRARIES
END IF
'' VR scenes, models
IF GetListItem(CHECKSTATES$, IMODELS) = "ON" THEN
CreateDir MODELSDest$, cmoNone
CreateDir CSPACEMODDest$, cmoNone
CreateDir TEMPLEMODDest$, cmoNone
VL_AddOptFilesToCopyList IMODELS
END IF
'' texture libs
IF GetListItem(CHECKSTATES$, ITEXTURES) = "ON" THEN
CreateDir MANUALDest$, cmoNone
VL_AddOptFilesToCopyList ITEXTURES
END IF
'$IFDEF CHATTER
VL_SetupBillboards
'$ENDIF '' CHATTER
CopyFilesInCopyList
RestoreCursor CursorSave%
END SUB
SUB VL_MakeTheAppIcons STATIC
IF (GetListItem(CHECKSTATES$, IAPPFILES) = "ON") THEN
'$IFDEF PROGRAM
'' make backup for the win.ini file, tell user about it.
winOld$ = VMakePath(GetWindowsDir(), BACKUPINIFILE$)
''' sz$ = UIStartDlg("mscuistf.dll", MODWININI_DLG, "FInfo0DlgProc", 0, "")
CopyFile VMakePath(GetWindowsDir(), THEINIFILE$), winOld$, cmoOverwrite, 0
''' UIPop 1
''Create the WalkThrough group
CreateProgmanGroup PROGRAMGROUP$, "", cmoNone
IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
''Associate .WTV and files with the application. This is writing stuff to WIN.INI.
CreateIniKeyValue THEINIFILE$,"Extensions",DATAFILEEXT$,VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + DATAFILEEXT$,cmoOverwrite
CreateProgmanItem PROGRAMGROUP$, PRODUCTNAME$, VMakePath(DESTDIRNAME$, EXEFILENAME$), "", cmoOverwrite
'' if no WalkThrough, do the same with .wlk
IF VFindExeFromRegistration ("WTP", lDest$) = 0 THEN
CreateIniKeyValue THEINIFILE$,"Extensions","WTP",VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + "WLK",cmoNone
ENDIF
'' if no WalkThrough, do the same with .wlk
IF VFindExeFromRegistration ("WLK", lDest$) = 0 THEN
CreateIniKeyValue THEINIFILE$,"Extensions","WLK",VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + "WLK",cmoNone
ENDIF
'' if no VR, do the same with .vvr
IF VFindExeFromRegistration ("VVR", lDest$) = 0 THEN
CreateIniKeyValue THEINIFILE$,"Extensions","VVR",VMakePath(DESTDIRNAME$, EXEFILENAME$)+" ^" + "VVR",cmoNone
ENDIF
END IF
'$ENDIF '' PROGRAM
END IF
END SUB
SUB VL_ShowIconsOkay STATIC
IF (GetListItem(CHECKSTATES$, IAPPFILES) = "ON") THEN
ShowProgmanGroup PROGRAMGROUP$, 1, cmoNone
Restart% = RestartListEmpty()
IF Restart% = 0 THEN
Exe$ = WINDIR$ + "\_msrstrt.exe"
Batch$ = WINDIR$ + "\_mssetup.bat"
I% = ExitExecRestart ()
RemoveFile Exe$, cmoForce
RemoveFile Batch$, cmoForce
END IF
END IF
END SUB
'-------------------------------------------------------------------
' do we want to call the serial number stuff?
FUNCTION VL_ShouldWeSerialize STATIC AS INTEGER
'$ifdef SERIAL
IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
VL_ShouldWeSerialize = 1
ELSE
VL_ShouldWeSerialize = 0
END IF
'$else
VL_ShouldWeSerialize = 0
'$endif
END FUNCTION
'*******************************************************************
' these are the global variable things. They get used in lots of
' areas
GLOBAL MAINREADME_FILENAME$ 'name of the main readme file
GLOBAL MAINREADME_ICONNAME$ 'name for the windows icon of the main readme file
''GLOBAL SCENEREADME_FILENAME$ 'name of the scenes readme file
''GLOBAL SCENEREADME_ICONNAME$ ' name for the icon for the scenes readme file
''GLOBAL EXTRAREADME_FILENAME$ 'name of the scenes readme file
''GLOBAL EXTRAREADME_ICONNAME$ ' name for the icon for the scenes readme file
''GLOBAL OTHERREADME_FILENAME$ 'name of the scenes readme file
''GLOBAL OTHERREADME_ICONNAME$ ' name for the icon for the scenes readme file
''DECLARE SUB VL_InitReadmeFileNames
''DECLARE SUB VL_MakeTheReadmeIcons
'-------------------------------------------------------------------
' init the readme file names
SUB VL_InitReadmeFileNames STATIC
MAINREADME_FILENAME$ = "README.TXT" '' name of main read me file
MAINREADME_ICONNAME$ = "WalkThrough VRML 1.0 Notes" '' icon title in windows
'' EXTRAREADME_FILENAME$ = "PLAYREAD.WRI" '' name of extra read me file
'' EXTRAREADME_ICONNAME$ = "Player Notes" '' icon title
END SUB
'-------------------------------------------------------------------
' make icons for the readme files
SUB VL_MakeTheReadmeIcons STATIC
''Put icons for the sample scenes and the readmes into program manager. Check that one of the files exists)
IF GetListItem(CHECKSTATES$, IAPPFILES) = "ON" THEN
''Create the readme
CreateProgmanItem PROGRAMGROUP$, MAINREADME_ICONNAME$, VMakePath(DESTDIRNAME$, MAINREADME_FILENAME$), "", cmoOverwrite
END IF
'' if you want to have icons for the manuals (and please, please don't use notepad for the manuals;
'' use Write, which comes with Windoes anyway, so it's available on the machines and looks N times
'' (where N is an integer, >= 2) better than notepad).
'' IF GetListItem(CHECKSTATES$, ITEXTURES) = "ON" THEN
'' ''Create the readme
'' CreateProgmanItem PROGRAMGROUP$, OTHERREADME_ICONNAME$, VMakePath(MANUALDIRNAME$, OTHERREADME_FILENAME$), "", cmoOverwrite
'' END IF
END SUB