home *** CD-ROM | disk | FTP | other *** search
/ Secret Service 58b / secret_service_58b01.iso / Mechcom / Setup / SETUP.RUL < prev   
Text File  |  1998-04-15  |  54KB  |  1,384 lines

  1. /*----------------------------------------------------------------------------
  2.     MechCommander Installation Program Script
  3.     For InstallShield3
  4.     Started 2/25/97
  5.     Author: FFS
  6.  
  7.     Based on 
  8. ----------------------------------------------------------------------------*/
  9.  
  10. declare
  11.  
  12.     #include "Sddialog.h"
  13.  
  14.    // Constant declarations.
  15.    #define SPACE_REQUIRED          200000000              // Disk space in bytes.  Full Install.
  16.    #define MFC_SPACE_REQUIRED       3000000
  17.    #define APP_NAME                "MechCommander(tm) Demo"
  18.    #define PROGRAM_FOLDER_NAME     "FASA Interactive\\MechCommander"
  19.    #define APPBASE_PATH            "FasaInteractive\\MechCmdrDemo"
  20.    #define APPBASE_PATH_WIN32S     "FASAINteractive\\MechCmdrDemo"
  21.    #define COMPANY_NAME            "FASA Interactive"
  22.    #define PRODUCT_NAME            "MechCommander Demo"
  23.    #define PRODUCT_VERSION         "1.0"
  24.    #define DEINSTALL_KEY           "MechCommander UnInstall"
  25.    #define UNINSTALL_NAME          "MechCommander Demo"
  26.    #define PRODUCT_KEY             "MechCommanderDemo"
  27.     #define MM_DLL_FILE "\\winmm.dll"
  28.     #define K32_DLL_FILE "\\kernel32.dll"
  29.     #define DX_DLL_FILE "dsetup.dll"
  30.     #define CPU_DLL_FILE "cpuinfo.dll"
  31.  
  32.     #define DSETUP_DDRAW            1
  33.     #define DSETUP_DSOUND           2
  34.     #define DSETUP_DDRAWDRV         8
  35.     #define DSETUP_DSOUNDDRV        16
  36.  
  37.    // Global variable declarations.
  38.    STRING  svFolder, svDir, szMsg, szFileSet, szTitle, svUninstLogFile;
  39.    STRING  svTarget, szProgram, szParam, szTemp, szAppPath, svMFCTarget;
  40.    STRING  svSource,lSource,lDest,oldSource,oldDest,appName;
  41.    STRING  askTitle,askMsg1,askMsg2,szComponents,szDlgBmp,szChkMFC;
  42.    BOOL    bSpaceOk, bWinNT, bWin32s, bIsShellExplorer, bRestartMachine;
  43.    NUMBER  nResult, LogFileHandle, strLocation, nOP, installType, verResult, ourWindow,nvResult,nvNextDisk,svCopyParm;
  44.    STRING  szDDrawPath, szDSoundPath, szDDrawVer, szDSoundVer,szDLL, pathString, szQuestion, szLicenseFile;
  45.    BOOL    bDirectDrawInstalled, bDirectSoundInstalled;
  46.  
  47.    STRING  mcRoot,mcDataArt,mcDataEdart,mcDataCameras,mcDataFonts,mcDataHtml,mcDataIface,mcDataMissions;
  48.    STRING  mcDataWarriors,mcDataProfiles,mcDataMovies,mcDataObjects,mcDataSound,mcDataSprites,mcDataPalettes;
  49.    STRING  mcDataTerrain,mcDataTiles,mcMFC,mcLogArt,mcDataSave;
  50.  
  51.    STRING  scRoot,scDataArt,scDataEdart,scDataCameras,scDataFonts,scDataHtml,scDataIface,scDataMissions;
  52.    STRING  scDataWarriors,scDataProfiles,scDataMovies,scDataObjects,scDataSound,scDataSprites,scDataPalettes;
  53.    STRING  scDataTerrain,scDataTiles,scMFC,scDataTemp,mcDataTemp,scLogArt,scDataSave;
  54.  
  55.    // Function declarations.
  56.    prototype SetupScreen ();
  57.    prototype CheckRequirements ();
  58.    prototype DefineFileSet (STRING, STRING, STRING, STRING, STRING, NUMBER, NUMBER);
  59.     prototype CheckForSoundCard();
  60.    prototype RunFileSet (STRING, STRING, NUMBER);
  61.  
  62.    // Prototype MydllReturn in MYDLL.DLL.
  63.    prototype  WINMM.waveOutGetNumDevs();
  64.    prototype  KERNEL32.GlobalMemoryStatus(POINTER);
  65.    prototype  CPUINFO.wincpuid();
  66.    prototype  CPUINFO.wincpufeatures();
  67.    prototype  CPUINFO.cpuspeed();
  68.  
  69.     #define MEM_BUFFER_SIZE        32
  70.     typedef MemoryBuffer
  71.     begin
  72.         INT dwLength;        // sizeof(MEMORYSTATUS) 
  73.         INT dwMemoryLoad;    // percent of memory in use 
  74.         INT dwTotalPhys;     // bytes of physical memory 
  75.         INT dwAvailPhys;     // free physical memory bytes 
  76.         INT dwTotalPageFile; // bytes of paging file 
  77.         INT dwAvailPageFile; // free bytes of paging file 
  78.         INT dwTotalVirtual;  // user bytes of address space 
  79.         INT dwAvailVirtual;  // free user bytes 
  80.     end;
  81.  
  82.     MemoryBuffer    memBuffer;
  83.     POINTER            pMemBuffer,pPathString;
  84.  
  85. program
  86.  
  87. start:
  88.  
  89.    Disable (BACKGROUND);
  90.  
  91.    // Set installation info., which is required for registry entries.
  92.    InstallationInfo(COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY);
  93.  
  94.    // Set up the installation screen.
  95.    SetupScreen();
  96.    Enable (DIALOGCACHE);
  97.  
  98.     szDlgBmp = SRCDIR ^ "dlg.bmp";
  99.    DialogSetInfo(DLG_INFO_ALTIMAGE,szDlgBmp,TRUE);
  100.  
  101.    // Create a Welcome dialog.
  102.    WelcomeDlg:
  103.       Disable(BACKBUTTON);
  104.       Welcome("MechCommander Installation", 0);
  105.       Enable(BACKBUTTON);
  106.  
  107.     LicenseAgreement:
  108.  
  109.    szTitle       = "MechCommander Demo License Agreement";
  110.    szMsg         = "Please read the following license agreement. Use " +
  111.                    "the scroll bar to view\nthe rest of this agreement";
  112.    szQuestion    = "Do you accept all the terms of the preceding license " +
  113.  
  114.                    "agreement?  If so,\nclick on the Yes push button. " +
  115.                    "If you select No, Setup will close.";
  116.    szLicenseFile = SRCDIR ^ "license.txt";
  117.  
  118.    nResult = SdLicense(szTitle, szMsg, szQuestion, szLicenseFile);
  119.  
  120.     if (nResult = BACK) then
  121.         goto WelcomeDlg;
  122.    endif;
  123.  
  124.     //------------------------------------------------------------------------------------------------------
  125.       // Test target system for proper configuration.
  126.       // Right now, we only test operating system version.
  127.       // We Need to check
  128.       //        -Processor Speed.
  129.       //        -System Memory.
  130.       //        -Sound Card.
  131.       //        -Video Card.
  132.       //        -DirectX Install and Version.
  133.       // Replace following with a switch statement based on result of CheckRequirements.
  134.       // If DirectX needs Mucking with, run the DirectX Setup program as well.
  135.     SysCheck:
  136.  
  137.         nResult = CheckRequirements();
  138.         if (nResult = 1) then
  139.             goto LicenseAgreement;
  140.         endif;
  141.  
  142.       if (nResult < 0) then
  143.         goto EndInstall;
  144.     endif;
  145.     //------------------------------------------------------------------------------------------------------
  146.  
  147.     //--------------------------------------------------------------------------------
  148.     // Ask user for preferred Install options here.  Full or Light.
  149.     CheckInstall:
  150.     szComponents = "Full Install";
  151.     ComponentAddItem(szComponents, "Full Install (200 Mb)", 1024, TRUE);
  152.  
  153.     askTitle = "MechCommander Install Options";
  154.     askMsg1 = "Choose the type of Install you would like to do.";
  155.     askMsg2 = "Once you have selected the Install Type, Press the Next Button to continue.";
  156.  
  157.     nResult = SdAskOptions(askTitle,askMsg1,askMsg2,"",szComponents,EXCLUSIVE);
  158.  
  159.     if (nResult = BACK) then
  160.         goto SysCheck;
  161.     endif;
  162.  
  163.     installType = 1;
  164.     //--------------------------------------------------------------------------------
  165.  
  166.     //--------------------------------------------------------------------------
  167.    // Ask user for a destination location for the installation.--
  168.    GetTargetDirectory:
  169.  
  170.    // InstallShield sets PROGRAMFILES such that it points to 'Program Files' directory location.
  171.  
  172.         if ( PROGRAMFILES = "") then
  173.             svTarget = TARGETDISK ^ "\\Program Files\\" ^ APPBASE_PATH;
  174.         else
  175.             svTarget = PROGRAMFILES ^ APPBASE_PATH;
  176.         endif;
  177.  
  178.         svMFCTarget = WINSYSDIR;
  179.  
  180.         SdProductName(APP_NAME);
  181.         szMsg = "Setup will install "+APP_NAME+" in the following\n"+
  182.                 "folder.\n\n"+
  183.                 "To install to this folder, click Next.\n\n"+
  184.                 "To install to a different folder, click Browse and select another\n"+
  185.                 "folder.\n\n"+
  186.                 "You can choose not to install "+APP_NAME+" by\n"+
  187.                 "clicking Cancel to exit Setup\n\n"+
  188.                 "It is STRONGLY recommended that you defrag the drive\n"+
  189.                 "in which the demo is installed!";
  190.         if (SdAskDestPath("MechCommander Demo Install Location", szMsg, svTarget, 0 ) = BACK) then
  191.             goto CheckInstall;
  192.         endif;
  193.  
  194.       // Perform space check of target drive.
  195.       // If not enough space, give user opportunity to try anyway.
  196.       // This is valid IF they are installing over an old copy.
  197.       bSpaceOk = TRUE;
  198.       if (GetDiskSpace(svTarget) < SPACE_REQUIRED) then
  199.             szMsg = "There isn't enough disk space on the destination chosen\n"+
  200.                     "to Install the MechCommander Demo.  This may not be correct\n"+
  201.                     "if the game is already installed there.  Do you want to go ahead\n"+
  202.                     "and install to that drive and directory anyway?";
  203.             bSpaceOk = AskYesNo(szMsg,NO);
  204.             if (bSpaceOk = NO) then
  205.                 goto GetTargetDirectory;
  206.             endif;
  207.       endif;
  208.  
  209.     strLocation = StrFind(SRCDIR,"SETUP");
  210.     CopyBytes(svSource,0,SRCDIR,0,strLocation);
  211.     SRCDIR = svSource;
  212.  
  213.       if (AskYesNo( "Do you want to view the README file now?", YES ) = YES) then
  214.          LaunchApp( "WRITE.EXE", SRCDIR ^ "README.doc" );
  215.          Delay( 2 );
  216.       endif;
  217.  
  218. //#ifdef DEBUG
  219. //CreateFile(LogFileHandle,SRCDIR,"mechcmdr.log");
  220. //WriteLine(LogFileHandle,svTarget);
  221. //WriteLine(LogFileHandle,svTarget ^"\\honorb.exe";
  222. //CloseFile(LogFileHandle);
  223. //#endif
  224.  
  225.    // Set the App Paths key for the main program.
  226.    szAppPath = svTarget;
  227.    RegDBSetItem( REGDB_APPPATH, szAppPath );
  228.  
  229.    szProgram = svTarget ^ "\\mechcmdr.exe";
  230.    RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
  231.  
  232.     //-----------------------------------------------------------------------------
  233.     if (installType = 1) then
  234.         svCopyParm = COMP_NORMAL;
  235.         goto FullInstall;
  236.     elseif (installType = 2) then
  237.         svCopyParm = COMP_UPDATE_DATE;
  238.         goto FullInstall;
  239.     else
  240.         svCopyParm = COMP_NORMAL;
  241.         goto PartInstall;
  242.     endif;
  243.     //-----------------------------------------------------------------------------
  244.  
  245.     //-----------------------------------------------------------------------------
  246.     // Setup the file transfer.  This is for FULL INSTALL.  REALLY PAINFUL.  OUCH!
  247.     FullInstall:
  248.        SetupFilesToTransfer:
  249.           TARGETDIR = svTarget;
  250.  
  251.    TransferFiles:
  252.       // Prepare InstallShield3 to record deinstallation information.
  253.       DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  254.       RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
  255.  
  256.       // Set up progress indicator and information gauge.
  257.       Disable(DIALOGCACHE);
  258.       Enable(STATUSDLG);
  259.  
  260.     oldSource = SRCDIR;
  261.     oldDest = TARGETDIR;
  262.  
  263.     SetStatusWindow(0, "Installing MechCommander Demo....");
  264.  
  265.     scRoot = oldSource;
  266.     mcRoot = oldDest;
  267.  
  268.     #ifndef TEDITOR
  269.     scDataArt = oldSource ^ "data\\art\\";
  270.     mcDataArt = oldDest ^ "\\data\\art";
  271.     #endif
  272.  
  273.     scDataMovies = oldSource ^ "data\\movies\\";
  274.     mcDataMovies = oldDest ^ "\\data\\movies";
  275.  
  276.     scDataObjects = oldSource ^ "data\\objects\\";
  277.     mcDataObjects = oldDest ^ "\\data\\objects";
  278.  
  279.     scDataSound = oldSource ^ "data\\sound\\";
  280.     mcDataSound = oldDest ^ "\\data\\sound";
  281.  
  282.     scDataSprites = oldSource ^ "data\\sprites\\";
  283.     mcDataSprites = oldDest ^ "\\data\\sprites";
  284.  
  285.     scDataTiles = oldSource ^ "data\\tiles\\";
  286.     mcDataTiles = oldDest ^ "\\data\\tiles";
  287.  
  288.     scDataTemp = oldSource ^ "data\\savegame\\temp\\";
  289.     mcDataTemp = oldDest ^ "\\data\\savegame\\temp";
  290.  
  291.     scDataSave = oldSource ^ "data\\savegame\\";
  292.     mcDataSave = oldDest ^ "\\data\\savegame";
  293.  
  294.     //-------------------------------------------------------------------
  295.     if (CreateDir(mcRoot) < 0) then
  296.         MessageBox("Unable to create data directory " ^ mcRoot ^ " on Destination",SEVERE);
  297.     endif;
  298.     
  299.     if (CreateDir(mcDataArt) < 0) then
  300.         MessageBox("Unable to create data directory " ^ mcDataArt ^ " on Destination",SEVERE);
  301.     endif;
  302.  
  303.     if (CreateDir(mcDataMovies) < 0) then
  304.         MessageBox("Unable to create data directory " ^ mcDataMovies ^ " on Destination",SEVERE);
  305.     endif;
  306.     
  307.     if (CreateDir(mcDataObjects) < 0) then
  308.         MessageBox("Unable to create data directory " ^ mcDataObjects ^ " on Destination",SEVERE);
  309.     endif;
  310.  
  311.     if (CreateDir(mcDataSound) < 0) then
  312.         MessageBox("Unable to create data directory " ^ mcDataSound ^ " on Destination",SEVERE);
  313.     endif;
  314.  
  315.     if (CreateDir(mcDataSprites) < 0) then
  316.         MessageBox("Unable to create data directory " ^ mcDataSprites ^ " on Destination",SEVERE);
  317.     endif;
  318.  
  319.     if (CreateDir(mcDataTiles) < 0) then
  320.         MessageBox("Unable to create data directory " ^ mcDataTiles ^ " on Destination",SEVERE);
  321.     endif;
  322.     
  323.     if (CreateDir(mcDataTemp) < 0) then
  324.         MessageBox("Unable to create data directory " ^ mcDataTemp ^ " on Destination",SEVERE);
  325.     endif;
  326.  
  327.     //----------------------------------------------------------------------------------------------
  328.         //------------------------------------
  329.         // Define the File Set
  330.         SRCDIR=oldSource;
  331.         TARGETDIR=mcRoot;
  332.  
  333.         szFileSet = "mcSet";
  334.         //FileSetBeginDefine(szFileSet);
  335.  
  336.         //------------------------------------
  337.         SetStatusWindow(-1, "Copying MechCommander Main Files...");
  338.         //FileSetRoot(szFileSet,scRoot);
  339.         SRCDIR = scRoot;
  340.         TARGETDIR = mcRoot;
  341.  
  342.         StatusUpdate(ON,5);
  343.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  344.         if (nvResult != 0) then
  345.             szMsg = "There isn't enough space in the Directory\n"+
  346.                 "selected to install MechCommander\n";
  347.             MessageBox(szMsg,SEVERE);
  348.             goto EndInstall;
  349.         endif;
  350.  
  351.         //------------------------------------
  352.         SetStatusWindow(-1, "Copying MechCommander GUI Art Files...");
  353.         TARGETDIR = mcDataArt;
  354.         //FileSetRoot(szFileSet,scDataArt);
  355.         SRCDIR = scDataArt;
  356.  
  357.         StatusUpdate(ON,6);
  358.         nvResult = XCopyFile("art.pak","art.pak",svCopyParm);
  359.         if (nvResult != 0) then
  360.             szMsg = "There isn't enough space in the Directory\n"+
  361.                 "selected to install MechCommander\n";
  362.             MessageBox(szMsg,SEVERE);
  363.             goto EndInstall;
  364.         endif;
  365.         
  366.         //------------------------------------
  367.         SetStatusWindow(-1, "Copying MechCommander Logistics Files...");
  368.         TARGETDIR = mcDataSave;
  369.         //FileSetRoot(szFileSet,scDataMissions);
  370.         SRCDIR = scDataSave;
  371.  
  372.         StatusUpdate(ON,7);
  373.         nvResult = XCopyFile("*.pkk","*.pkk",svCopyParm);
  374.         if (nvResult != 0) then
  375.             szMsg = "There isn't enough space in the Directory\n"+
  376.                 "selected to install MechCommander\n";
  377.             MessageBox(szMsg,SEVERE);
  378.             goto EndInstall;
  379.         endif;
  380.  
  381.         //------------------------------------
  382.         SetStatusWindow(-1, "Copying MechCommander Movie Files...");
  383.         TARGETDIR = mcDataMovies;
  384.         //FileSetRoot(szFileSet,scDataMovies);
  385.         SRCDIR = scDataMovies;
  386.  
  387.         StatusUpdate(ON,15);
  388.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  389.         if (nvResult != 0) then
  390.             szMsg = "There isn't enough space in the Directory\n"+
  391.                 "selected to install MechCommander\n";
  392.             MessageBox(szMsg,SEVERE);
  393.             goto EndInstall;
  394.         endif;
  395.  
  396.         //------------------------------------
  397.         SetStatusWindow(-1, "Copying MechCommander Object Files...");
  398.         TARGETDIR = mcDataObjects;
  399.         //FileSetRoot(szFileSet,scDataObjects);
  400.         SRCDIR = scDataObjects;
  401.  
  402.         StatusUpdate(ON,20);
  403.         nvResult = XCopyFile("object2.pak","object2.pak",svCopyParm);
  404.         if (nvResult != 0) then
  405.             szMsg = "There isn't enough space in the Directory\n"+
  406.                 "selected to install MechCommander\n";
  407.             MessageBox(szMsg,SEVERE);
  408.             goto EndInstall;
  409.         endif;
  410.  
  411.         //------------------------------------
  412.         SetStatusWindow(-1, "Copying MechCommander Sound Files...");
  413.         TARGETDIR = mcDataSound;
  414.         //FileSetRoot(szFileSet,scDataSound);
  415.         SRCDIR = scDataSound;
  416.  
  417.         StatusUpdate(ON,25);
  418.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  419.         if (nvResult != 0) then
  420.             szMsg = "There isn't enough space in the Directory\n"+
  421.                 "selected to install MechCommander\n";
  422.             MessageBox(szMsg,SEVERE);
  423.             goto EndInstall;
  424.         endif;
  425.  
  426.         //------------------------------------
  427.         SetStatusWindow(-1, "Copying MechCommander Sprite Files...");
  428.         TARGETDIR = mcDataSprites;
  429.         SRCDIR = scDataSprites;
  430.         //FileSetRoot(szFileSet,scDataSprites);
  431.  
  432.         StatusUpdate(ON,30);
  433.         nvResult = XCopyFile("leftarms.pak","leftarms.pak",svCopyParm);
  434.         if (nvResult != 0) then
  435.             szMsg = "There isn't enough space in the Directory\n"+
  436.                 "selected to install MechCommander\n";
  437.             MessageBox(szMsg,SEVERE);
  438.             goto EndInstall;
  439.         endif;
  440.  
  441.         StatusUpdate(ON,35);
  442.         nvResult = XCopyFile("rightarms.pak","rightarms.pak",svCopyParm);
  443.         if (nvResult != 0) then
  444.             szMsg = "There isn't enough space in the Directory\n"+
  445.                 "selected to install MechCommander\n";
  446.             MessageBox(szMsg,SEVERE);
  447.             goto EndInstall;
  448.         endif;
  449.  
  450.         StatusUpdate(ON,40);
  451.         nvResult = XCopyFile("torsos.pak","torsos.pak",svCopyParm);
  452.         if (nvResult != 0) then
  453.             szMsg = "There isn't enough space in the Directory\n"+
  454.                 "selected to install MechCommander\n";
  455.             MessageBox(szMsg,SEVERE);
  456.             goto EndInstall;
  457.         endif;
  458.  
  459.         StatusUpdate(ON,45);
  460.         nvResult = XCopyFile("legs.pak","legs.pak",svCopyParm);
  461.         if (nvResult != 0) then
  462.             szMsg = "There isn't enough space in the Directory\n"+
  463.                 "selected to install MechCommander\n";
  464.             MessageBox(szMsg,SEVERE);
  465.             goto EndInstall;
  466.         endif;
  467.  
  468.         StatusUpdate(ON,50);
  469.         nvResult = XCopyFile("leftarms90.pak","leftarms90.pak",svCopyParm);
  470.         if (nvResult != 0) then
  471.             szMsg = "There isn't enough space in the Directory\n"+
  472.                 "selected to install MechCommander\n";
  473.             MessageBox(szMsg,SEVERE);
  474.             goto EndInstall;
  475.         endif;
  476.         
  477.         StatusUpdate(ON,55);
  478.         nvResult = XCopyFile("rightarms90.pak","rightarms90.pak",svCopyParm);
  479.         if (nvResult != 0) then
  480.             szMsg = "There isn't enough space in the Directory\n"+
  481.                 "selected to install MechCommander\n";
  482.             MessageBox(szMsg,SEVERE);
  483.             goto EndInstall;
  484.         endif;
  485.  
  486.         StatusUpdate(ON,60);
  487.         nvResult = XCopyFile("torsos90.pak","torsos90.pak",svCopyParm);
  488.         if (nvResult != 0) then
  489.             szMsg = "There isn't enough space in the Directory\n"+
  490.                 "selected to install MechCommander\n";
  491.             MessageBox(szMsg,SEVERE);
  492.             goto EndInstall;
  493.         endif;
  494.  
  495.         StatusUpdate(ON,70);
  496.         nvResult = XCopyFile("legs90.pak","legs90.pak",svCopyParm);
  497.         if (nvResult != 0) then
  498.             szMsg = "There isn't enough space in the Directory\n"+
  499.                 "selected to install MechCommander\n";
  500.             MessageBox(szMsg,SEVERE);
  501.             goto EndInstall;
  502.         endif;
  503.  
  504.         StatusUpdate(ON,80);
  505.         nvResult = XCopyFile("shapes.pak","shapes.pak",svCopyParm);
  506.         if (nvResult != 0) then
  507.             szMsg = "There isn't enough space in the Directory\n"+
  508.                 "selected to install MechCommander\n";
  509.             MessageBox(szMsg,SEVERE);
  510.             goto EndInstall;
  511.         endif;
  512.  
  513.         StatusUpdate(ON,90);
  514.         nvResult = XCopyFile("sprites.pak","sprites.pak",svCopyParm);
  515.         if (nvResult != 0) then
  516.             szMsg = "There isn't enough space in the Directory\n"+
  517.                 "selected to install MechCommander\n";
  518.             MessageBox(szMsg,SEVERE);
  519.             goto EndInstall;
  520.         endif;
  521.  
  522.         StatusUpdate(ON,91);
  523.         nvResult = XCopyFile("feet.pak","feet.pak",svCopyParm);
  524.         if (nvResult != 0) then
  525.             szMsg = "There isn't enough space in the Directory\n"+
  526.                 "selected to install MechCommander\n";
  527.             MessageBox(szMsg,SEVERE);
  528.             goto EndInstall;
  529.         endif;
  530.  
  531.         StatusUpdate(ON,92);
  532.         nvResult = XCopyFile("crater.pak","crater.pak",svCopyParm);
  533.         if (nvResult != 0) then
  534.             szMsg = "There isn't enough space in the Directory\n"+
  535.                 "selected to install MechCommander\n";
  536.             MessageBox(szMsg,SEVERE);
  537.             goto EndInstall;
  538.         endif;
  539.  
  540.         nvResult = XCopyFile("shadow.pak","shadow.pak",svCopyParm);
  541.         if (nvResult != 0) then
  542.             szMsg = "There isn't enough space in the Directory\n"+
  543.                 "selected to install MechCommander\n";
  544.             MessageBox(szMsg,SEVERE);
  545.             goto EndInstall;
  546.         endif;
  547.  
  548.         nvResult = XCopyFile("blip.pak","blip.pak",svCopyParm);
  549.         if (nvResult != 0) then
  550.             szMsg = "There isn't enough space in the Directory\n"+
  551.                 "selected to install MechCommander\n";
  552.             MessageBox(szMsg,SEVERE);
  553.             goto EndInstall;
  554.         endif;
  555.  
  556.         StatusUpdate(ON,95);
  557.         nvResult = XCopyFile("cursors.pak","cursors.pak",svCopyParm);
  558.         if (nvResult != 0) then
  559.             szMsg = "There isn't enough space in the Directory\n"+
  560.                 "selected to install MechCommander\n";
  561.             MessageBox(szMsg,SEVERE);
  562.             goto EndInstall;
  563.         endif;
  564.  
  565.         //------------------------------------
  566.         SetStatusWindow(-1, "Copying MechCommander Tile Files...");
  567.         TARGETDIR = mcDataTiles;
  568.         //FileSetRoot(szFileSet,scDataTiles);
  569.         SRCDIR = scDataTiles;
  570.  
  571.         StatusUpdate(ON,98);
  572.         nvResult = XCopyFile("tiles.pak","tiles.pak",svCopyParm);
  573.         if (nvResult != 0) then
  574.             szMsg = "There isn't enough space in the Directory\n"+
  575.                 "selected to install MechCommander\n";
  576.             MessageBox(szMsg,SEVERE);
  577.             goto EndInstall;
  578.         endif;
  579.  
  580.     //----------------------------------------------------------------------------------------------
  581.  
  582.     //----------------------------------------------------------------------------------------------
  583.     // If we get here, we need to construct the system.cfg file for the fact that
  584.     // much of MechCommander resides somewhere else now.
  585.     OpenFileMode(FILE_MODE_APPEND);
  586.     CreateFile(LogFileHandle,mcRoot,"system.cfg");
  587.         WriteLine(LogFileHandle,"FITini");
  588.         WriteLine(LogFileHandle,"");
  589.         WriteLine(LogFileHandle,"[UseSound]");
  590.         WriteLine(LogFileHandle,"");
  591.         WriteLine(LogFileHandle,"[UseMusic]");
  592.         WriteLine(LogFileHandle,"");
  593.         WriteLine(LogFileHandle,"[ABL]");
  594.         WriteLine(LogFileHandle,"ul SymbolTableHeapSize = 767999");
  595.         WriteLine(LogFileHandle,"ul StackHeapSize = 511999");
  596.         WriteLine(LogFileHandle,"ul CodeHeapSize = 307199");
  597.         WriteLine(LogFileHandle,"ul RunTimeStackSize = 20479");
  598.         WriteLine(LogFileHandle,"ul MaxCodeBlockSize = 20479");
  599.         WriteLine(LogFileHandle,"ul MaxRegisteredModules = 200");
  600.         WriteLine(LogFileHandle,"ul MaxStaticVariables = 100");
  601.         WriteLine(LogFileHandle,"l MaxWatchesPerModule = 20");
  602.         WriteLine(LogFileHandle,"l MaxBreakPointsPermOdule = 20");
  603.         WriteLine(LogFileHandle,"ul DebuggerEnabled = 0");
  604.         WriteLine(LogFileHandle,"ul IncludeDebugInfo = 0");
  605.         WriteLine(LogFileHandle,"");
  606.         WriteLine(LogFileHandle,"[systemHeap]");
  607.         WriteLine(LogFileHandle,"ul systemHeapSize=1708851");
  608.         WriteLine(LogFileHandle,"ul guiHeapSize=2047999");
  609.         WriteLine(LogFileHandle,"ul soundHeapSize=767999");
  610.         WriteLine(LogFileHandle,"ul logisticsHeapSize=10485759");
  611.         WriteLine(LogFileHandle,"");
  612.         WriteLine(LogFileHandle,"[systemPaths]");
  613.         WriteLine(LogFileHandle,"");
  614.  
  615.         WriteLine(LogFileHandle,"st terrainPath = \"data\\terrain\\\"");                        //HD
  616.         WriteLine(LogFileHandle,"st palettePath = \"data\\palette\\\"");                        //CD    
  617.         WriteLine(LogFileHandle,"st paletteName = \"palette\"");
  618.         WriteLine(LogFileHandle,"st artPath = \"data\\art\\\"");                                //CD
  619.         WriteLine(LogFileHandle,"st fontPath = \"data\\fonts\\\"");                                //CD
  620.         WriteLine(LogFileHandle,"st savePath = \"data\\savegame\\\"");                            //HD
  621.         WriteLine(LogFileHandle,"st spritePath = \"data\\sprites\\\"");                            //CD
  622.         WriteLine(LogFileHandle,"st shapesPath = \"data\\sprites\\\"");                            //CD
  623.         WriteLine(LogFileHandle,"st soundPath = \"data\\sound\\\"");                            //HD
  624.         WriteLine(LogFileHandle,"st objectPath = \"data\\objects\\\"");                            //HD
  625.         WriteLine(LogFileHandle,"st cameraPath = \"data\\cameras\\\"");                            //CD
  626.         WriteLine(LogFileHandle,"st tilePath = \"data\\tiles\\\"");                                //HD
  627.         WriteLine(LogFileHandle,"st missionPath = \"data\\missions\\\"");                        //CD
  628.         WriteLine(LogFileHandle,"st missionName = \"MechCmdr1\"");                        
  629.         WriteLine(LogFileHandle,"st warriorPath = \"data\\missions\\warriors\\\"");                //CD
  630.         WriteLine(LogFileHandle,"st profilePath = \"data\\missions\\profiles\\\"");                //CD
  631.         WriteLine(LogFileHandle,"st interfacepath = \"data\\iface\\\"");                        //CD
  632.         WriteLine(LogFileHandle,"st moviepath = \"data\\movies\\\"");                            //CD
  633.         WriteLine(LogFileHandle,"");
  634.         WriteLine(LogFileHandle,"st CDterrainPath = \""+scRoot+"data\\terrain\\\"");                        //HD
  635.         WriteLine(LogFileHandle,"st CDpalettePath = \""+scRoot+"data\\palette\\\"");            //CD    
  636.         WriteLine(LogFileHandle,"st CDartPath = \""+scRoot+"data\\art\\\"");                    //CD
  637.         WriteLine(LogFileHandle,"st CDfontPath = \""+scRoot+"data\\fonts\\\"");                    //CD
  638.         WriteLine(LogFileHandle,"st CDspritePath = \""+scRoot+"data\\sprites\\\"");                //CD
  639.         WriteLine(LogFileHandle,"st CDsoundPath = \""+scRoot+"data\\sound\\\"");                   //HD
  640.         WriteLine(LogFileHandle,"st CDobjectPath = \""+scRoot+"data\\objects\\\"");                //HD
  641.         WriteLine(LogFileHandle,"st CDcameraPath = \""+scRoot+"data\\cameras\\\"");                //CD
  642.         WriteLine(LogFileHandle,"st CDtilePath = \""+scRoot+"data\\tiles\\\"");                       //HD
  643.         WriteLine(LogFileHandle,"st CDmissionPath = \""+scRoot+"data\\missions\\\"");            //CD
  644.         WriteLine(LogFileHandle,"st CDwarriorPath = \""+scRoot+"data\\missions\\warriors\\\"");    //CD
  645.         WriteLine(LogFileHandle,"st CDprofilePath = \""+scRoot+"data\\missions\\profiles\\\"");    //CD
  646.         WriteLine(LogFileHandle,"st CDinterfacepath = \""+scRoot+"data\\iface\\\"");            //CD
  647.         WriteLine(LogFileHandle,"st CDmoviepath = \""+scRoot+"data\\movies\\\"");                //CD
  648.         WriteLine(LogFileHandle,"");
  649.         WriteLine(LogFileHandle,"[FastFiles]");
  650.         WriteLine(LogFileHandle,"l NumFastFiles = 5");
  651.         WriteLine(LogFileHandle,"");
  652.         WriteLine(LogFileHandle,"st File0=\"art.fst\"");
  653.         WriteLine(LogFileHandle,"st File1=\"mission.fst\"");
  654.         WriteLine(LogFileHandle,"st File2=\"misc.fst\"");
  655.         WriteLine(LogFileHandle,"st FIle3=\"terrain.fst\"");
  656.         WriteLine(LogFileHandle,"st FIle4=\"shapes.fst\"");
  657.         WriteLine(LogFileHandle,"");
  658.         WriteLine(LogFileHandle,"FITend");
  659.     CloseFile(LogFileHandle);
  660.  
  661.     //----------------------------------------------------------------------------------------------
  662.     // Write the prefs.cfg for this machine.
  663.     CreateFile(LogFileHandle,mcRoot,"prefs.cfg");
  664.         WriteLine(LogFileHandle,"FITini");
  665.         WriteLine(LogFileHandle,"");
  666.         WriteLine(LogFileHandle,"[MechCommander]");
  667.         WriteLine(LogFileHandle,"b PaletteCycle = T");
  668.         WriteLine(LogFileHandle,"b DirectDraw = T");
  669.        if ((memBuffer.dwTotalPhys/1024) < (30000)) then
  670.             WriteLine(LogFileHandle,"b Use90Pixel = f");
  671.             WriteLine(LogFileHandle,"b Force45Pixel = t");
  672.             WriteLine(LogFileHandle,"b Force16Mb = t");
  673.        elseif ((memBuffer.dwTotalPhys/1024) < (60000)) then
  674.             WriteLine(LogFileHandle,"b Use90Pixel = t");
  675.             WriteLine(LogFileHandle,"b Force45Pixel = f");
  676.             WriteLine(LogFileHandle,"b Force32Mb = t");
  677.        else
  678.             WriteLine(LogFileHandle,"b Use90Pixel = t");
  679.             WriteLine(LogFileHandle,"b Force45Pixel = f");
  680.        endif;
  681.  
  682.         WriteLine(LogFileHandle,"");
  683.         WriteLine(LogFileHandle,"FITend");
  684.     CloseFile(LogFileHandle);
  685.  
  686.       Delay(1);
  687.  
  688.     goto CheckDirectX;
  689.     //-----------------------------------------------------------------------------
  690.  
  691.     //-----------------------------------------------------------------------------
  692.     // Setup the file transfer.  This is for FULL INSTALL.  REALLY PAINFUL.  OUCH!
  693.     PartInstall:
  694.          TARGETDIR = svTarget;
  695.  
  696.     strLocation = StrFind(SRCDIR,"SETUP");
  697.     CopyBytes(svSource,0,SRCDIR,0,strLocation);
  698.     SRCDIR = svSource;
  699.  
  700.       // Prepare InstallShield3 to record deinstallation information.
  701.       DeinstallStart( svTarget, svUninstLogFile, DEINSTALL_KEY, 0 );
  702.       RegDBSetItem( REGDB_UNINSTALL_NAME, UNINSTALL_NAME );
  703.  
  704.       // Set up progress indicator and information gauge.
  705.       Disable(DIALOGCACHE);
  706.       Enable(STATUSDLG);
  707.  
  708.     oldSource = SRCDIR;
  709.     oldDest = TARGETDIR;
  710.  
  711.     SetStatusWindow(0, "Installing MechCommander....");
  712.  
  713.     scRoot = oldSource;
  714.     mcRoot = oldDest;
  715.  
  716.     scDataArt = oldSource ^ "data\\art\\";
  717.     mcDataArt = oldDest ^ "\\data\\art";
  718.  
  719.     scDataMovies = oldSource ^ "data\\movies\\";
  720.     mcDataMovies = oldDest ^ "\\data\\movies";
  721.  
  722.     scDataObjects = oldSource ^ "data\\objects\\";
  723.     mcDataObjects = oldDest ^ "\\data\\objects";
  724.  
  725.     scDataSound = oldSource ^ "data\\sound\\";
  726.     mcDataSound = oldDest ^ "\\data\\sound";
  727.  
  728.     scDataSprites = oldSource ^ "data\\sprites\\";
  729.     mcDataSprites = oldDest ^ "\\data\\sprites";
  730.  
  731.     scDataTiles = oldSource ^ "data\\tiles\\";
  732.     mcDataTiles = oldDest ^ "\\data\\tiles";
  733.  
  734.     scDataTemp = oldSource ^ "data\\savegame\\temp\\";
  735.     mcDataTemp = oldDest ^ "\\data\\savegame\\temp";
  736.  
  737.     scDataSave = oldSource ^ "data\\savegame\\\\";
  738.     mcDataSave = oldDest ^ "\\data\\savegame\\";
  739.  
  740.     //-------------------------------------------------------------------
  741.     if (CreateDir(mcRoot) < 0) then
  742.         MessageBox("Unable to create data directory " ^ mcRoot ^ " on Destination",SEVERE);
  743.     endif;
  744.     
  745.     if (CreateDir(mcDataArt) < 0) then
  746.         MessageBox("Unable to create data directory " ^ mcDataArt ^ " on Destination",SEVERE);
  747.     endif;
  748.  
  749.     if (CreateDir(mcDataMovies) < 0) then
  750.         MessageBox("Unable to create data directory " ^ mcDataMovies ^ " on Destination",SEVERE);
  751.     endif;
  752.     
  753.     if (CreateDir(mcDataObjects) < 0) then
  754.         MessageBox("Unable to create data directory " ^ mcDataObjects ^ " on Destination",SEVERE);
  755.     endif;
  756.  
  757.     if (CreateDir(mcDataSound) < 0) then
  758.         MessageBox("Unable to create data directory " ^ mcDataSound ^ " on Destination",SEVERE);
  759.     endif;
  760.  
  761.     if (CreateDir(mcDataSprites) < 0) then
  762.         MessageBox("Unable to create data directory " ^ mcDataSprites ^ " on Destination",SEVERE);
  763.     endif;
  764.  
  765.     if (CreateDir(mcDataTiles) < 0) then
  766.         MessageBox("Unable to create data directory " ^ mcDataTiles ^ " on Destination",SEVERE);
  767.     endif;
  768.     
  769.     if (CreateDir(mcDataTemp) < 0) then
  770.         MessageBox("Unable to create data directory " ^ mcDataTemp ^ " on Destination",SEVERE);
  771.     endif;
  772.  
  773.     //----------------------------------------------------------------------------------------------
  774.         //------------------------------------
  775.         // Define the File Set
  776.         SRCDIR=oldSource;
  777.         TARGETDIR=mcRoot;
  778.  
  779.         szFileSet = "mcSet";
  780.         //FileSetBeginDefine(szFileSet);
  781.  
  782.         //------------------------------------
  783.         SetStatusWindow(-1, "Copying MechCommander Main Files...");
  784.         //FileSetRoot(szFileSet,scRoot);
  785.         SRCDIR = scRoot;
  786.         TARGETDIR = mcRoot;
  787.  
  788.         StatusUpdate(ON,5);
  789.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  790.         if (nvResult != 0) then
  791.             szMsg = "There isn't enough space in the Directory\n"+
  792.                 "selected to install MechCommander\n";
  793.             MessageBox(szMsg,SEVERE);
  794.             goto EndInstall;
  795.         endif;
  796.  
  797.         //------------------------------------
  798.         SetStatusWindow(-1, "Copying MechCommander GUI Art Files...");
  799.         TARGETDIR = mcDataArt;
  800.         //FileSetRoot(szFileSet,scDataArt);
  801.         SRCDIR = scDataArt;
  802.  
  803.         StatusUpdate(ON,6);
  804.         nvResult = XCopyFile("art.pak","art.pak",svCopyParm);
  805.         if (nvResult != 0) then
  806.             szMsg = "There isn't enough space in the Directory\n"+
  807.                 "selected to install MechCommander\n";
  808.             MessageBox(szMsg,SEVERE);
  809.             goto EndInstall;
  810.         endif;
  811.  
  812.         //------------------------------------
  813.         SetStatusWindow(-1, "Copying MechCommander Logistics Files...");
  814.         TARGETDIR = mcDataSave;
  815.         //FileSetRoot(szFileSet,scDataMissions);
  816.         SRCDIR = scDataSave;
  817.  
  818.         StatusUpdate(ON,9);
  819.         nvResult = XCopyFile("*.pkk","*.pkk",svCopyParm);
  820.         if (nvResult != 0) then
  821.             szMsg = "There isn't enough space in the Directory\n"+
  822.                 "selected to install MechCommander\n";
  823.             MessageBox(szMsg,SEVERE);
  824.             goto EndInstall;
  825.         endif;
  826.  
  827.         //------------------------------------
  828.         SetStatusWindow(-1, "Copying MechCommander Object Files...");
  829.         TARGETDIR = mcDataObjects;
  830.         //FileSetRoot(szFileSet,scDataObjects);
  831.         SRCDIR = scDataObjects;
  832.  
  833.         StatusUpdate(ON,22);
  834.         nvResult = XCopyFile("object2.pak","object2.pak",svCopyParm);
  835.         if (nvResult != 0) then
  836.             szMsg = "There isn't enough space in the Directory\n"+
  837.                 "selected to install MechCommander\n";
  838.             MessageBox(szMsg,SEVERE);
  839.             goto EndInstall;
  840.         endif;
  841.  
  842.         //------------------------------------
  843.         SetStatusWindow(-1, "Copying MechCommander Sound Files...");
  844.         TARGETDIR = mcDataSound;
  845.         //FileSetRoot(szFileSet,scDataSound);
  846.         SRCDIR = scDataSound;
  847.  
  848.         StatusUpdate(ON,30);
  849.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  850.         if (nvResult != 0) then
  851.             szMsg = "There isn't enough space in the Directory\n"+
  852.                 "selected to install MechCommander\n";
  853.             MessageBox(szMsg,SEVERE);
  854.             goto EndInstall;
  855.         endif;
  856.  
  857.         //------------------------------------
  858.         SetStatusWindow(-1, "Copying MechCommander Tile Files...");
  859.         TARGETDIR = mcDataTiles;
  860.         //FileSetRoot(szFileSet,scDataTiles);
  861.         SRCDIR = scDataTiles;
  862.  
  863.         StatusUpdate(ON,90);
  864.         nvResult = XCopyFile("*.*","*.*",svCopyParm);
  865.         if (nvResult != 0) then
  866.             szMsg = "There isn't enough space in the Directory\n"+
  867.                 "selected to install MechCommander\n";
  868.             MessageBox(szMsg,SEVERE);
  869.             goto EndInstall;
  870.         endif;
  871.  
  872.     //----------------------------------------------------------------------------------------------
  873.     // If we get here, we need to construct the system.cfg file for the fact that
  874.     // much of MechCommander resides somewhere else now.
  875.     OpenFileMode(FILE_MODE_APPEND);
  876.     CreateFile(LogFileHandle,mcRoot,"system.cfg");
  877.         WriteLine(LogFileHandle,"FITini");
  878.         WriteLine(LogFileHandle,"");
  879.         WriteLine(LogFileHandle,"[UseSound]");
  880.         WriteLine(LogFileHandle,"");
  881.         WriteLine(LogFileHandle,"[UseMusic]");
  882.         WriteLine(LogFileHandle,"");
  883.         WriteLine(LogFileHandle,"[ABL]");
  884.         WriteLine(LogFileHandle,"ul SymbolTableHeapSize = 767999");
  885.         WriteLine(LogFileHandle,"ul StackHeapSize = 511999");
  886.         WriteLine(LogFileHandle,"ul CodeHeapSize = 307199");
  887.         WriteLine(LogFileHandle,"ul RunTimeStackSize = 20479");
  888.         WriteLine(LogFileHandle,"ul MaxCodeBlockSize = 20479");
  889.         WriteLine(LogFileHandle,"ul MaxRegisteredModules = 200");
  890.         WriteLine(LogFileHandle,"ul MaxStaticVariables = 100");
  891.         WriteLine(LogFileHandle,"l MaxWatchesPerModule = 20");
  892.         WriteLine(LogFileHandle,"l MaxBreakPointsPermOdule = 20");
  893.         WriteLine(LogFileHandle,"ul DebuggerEnabled = 0");
  894.         WriteLine(LogFileHandle,"ul IncludeDebugInfo = 0");
  895.         WriteLine(LogFileHandle,"");
  896.         WriteLine(LogFileHandle,"[systemHeap]");
  897.         WriteLine(LogFileHandle,"ul systemHeapSize=1708851");
  898.         WriteLine(LogFileHandle,"ul guiHeapSize=2047999");
  899.         WriteLine(LogFileHandle,"ul soundHeapSize=767999");
  900.         WriteLine(LogFileHandle,"ul logisticsHeapSize=10485759");
  901.         WriteLine(LogFileHandle,"");
  902.         WriteLine(LogFileHandle,"[systemPaths]");
  903.         WriteLine(LogFileHandle,"");
  904.  
  905.         WriteLine(LogFileHandle,"st terrainPath = \"data\\terrain\\\"");                        //HD
  906.         WriteLine(LogFileHandle,"st palettePath = \"data\\palette\\\"");                        //HD    
  907.         WriteLine(LogFileHandle,"st paletteName = \"palette\"");
  908.         WriteLine(LogFileHandle,"st artPath = \"data\\art\\\"");                                //HD
  909.         WriteLine(LogFileHandle,"st fontPath = \"data\\fonts\\\"");                                //HD
  910.         WriteLine(LogFileHandle,"st savePath = \"data\\savegame\\\"");                            //HD
  911.         WriteLine(LogFileHandle,"st spritePath = \""+scRoot+"data\\sprites\\\"");                //CD
  912.         WriteLine(LogFileHandle,"st shapesPath = \"data\\sprites\\\"");                            //CD
  913.         WriteLine(LogFileHandle,"st soundPath = \"data\\sound\\\"");                            //HD
  914.         WriteLine(LogFileHandle,"st objectPath = \"data\\objects\\\"");                            //HD
  915.         WriteLine(LogFileHandle,"st cameraPath = \"data\\cameras\\\"");                            //HD
  916.         WriteLine(LogFileHandle,"st tilePath = \"data\\tiles\\\"");                                //HD
  917.         WriteLine(LogFileHandle,"st missionPath = \"data\\missions\\\"");                        //HD
  918.         WriteLine(LogFileHandle,"st missionName = \"MechCmdr1\"");                                
  919.         WriteLine(LogFileHandle,"st warriorPath = \"data\\missions\\warriors\\\"");                //HD
  920.         WriteLine(LogFileHandle,"st profilePath = \"data\\missions\\profiles\\\"");                //HD
  921.         WriteLine(LogFileHandle,"st interfacepath = \"data\\iface\\\"");                        //HD
  922.         WriteLine(LogFileHandle,"st moviepath = \""+scRoot+"data\\movies\\\"");                    //CD
  923.         WriteLine(LogFileHandle,"");
  924.         WriteLine(LogFileHandle,"st CDterrainPath = \""+scRoot+"data\\terrain\\\"");                        //HD
  925.         WriteLine(LogFileHandle,"st CDpalettePath = \""+scRoot+"data\\palette\\\"");            //CD    
  926.         WriteLine(LogFileHandle,"st CDartPath = \""+scRoot+"data\\art\\\"");                    //CD
  927.         WriteLine(LogFileHandle,"st CDfontPath = \""+scRoot+"data\\fonts\\\"");                    //CD
  928.         WriteLine(LogFileHandle,"st CDspritePath = \""+scRoot+"data\\sprites\\\"");                //CD
  929.         WriteLine(LogFileHandle,"st CDsoundPath = \""+scRoot+"data\\sound\\\"");                            //HD
  930.         WriteLine(LogFileHandle,"st CDobjectPath = \""+scRoot+"data\\objects\\\"");                //HD
  931.         WriteLine(LogFileHandle,"st CDcameraPath = \""+scRoot+"data\\cameras\\\"");                //CD
  932.         WriteLine(LogFileHandle,"st CDtilePath = \""+scRoot+"data\\tiles\\\"");                       //HD
  933.         WriteLine(LogFileHandle,"st CDmissionPath = \""+scRoot+"data\\missions\\\"");            //CD
  934.         WriteLine(LogFileHandle,"st CDwarriorPath = \""+scRoot+"data\\missions\\warriors\\\"");    //CD
  935.         WriteLine(LogFileHandle,"st CDprofilePath = \""+scRoot+"data\\missions\\profiles\\\"");    //CD
  936.         WriteLine(LogFileHandle,"st CDinterfacepath = \""+scRoot+"data\\iface\\\"");            //CD
  937.         WriteLine(LogFileHandle,"st CDmoviepath = \""+scRoot+"data\\movies\\\"");                //CD
  938.         WriteLine(LogFileHandle,"");
  939.         WriteLine(LogFileHandle,"[FastFiles]");
  940.         WriteLine(LogFileHandle,"l NumFastFiles = 5");
  941.         WriteLine(LogFileHandle,"");
  942.         WriteLine(LogFileHandle,"st File0=\"art.fst\"");
  943.         WriteLine(LogFileHandle,"st File1=\"mission.fst\"");
  944.         WriteLine(LogFileHandle,"st File2=\"misc.fst\"");
  945.         WriteLine(LogFileHandle,"st FIle3=\"terrain.fst\"");
  946.         WriteLine(LogFileHandle,"st FIle4=\"shapes.fst\"");
  947.         WriteLine(LogFileHandle,"");
  948.         WriteLine(LogFileHandle,"FITend");
  949.     CloseFile(LogFileHandle);
  950.  
  951.     //----------------------------------------------------------------------------------------------
  952.     // Write the prefs.cfg for this machine.
  953.     CreateFile(LogFileHandle,mcRoot,"prefs.cfg");
  954.         WriteLine(LogFileHandle,"FITini");
  955.         WriteLine(LogFileHandle,"");
  956.         WriteLine(LogFileHandle,"[MechCommander]");
  957.         WriteLine(LogFileHandle,"b PaletteCycle = T");
  958.         WriteLine(LogFileHandle,"b DirectDraw = T");
  959.        if ((memBuffer.dwTotalPhys/1024) < (30000)) then
  960.             WriteLine(LogFileHandle,"b Use90Pixel = f");
  961.             WriteLine(LogFileHandle,"b Force45Pixel = t");
  962.        else
  963.             WriteLine(LogFileHandle,"b Use90Pixel = t");
  964.             WriteLine(LogFileHandle,"b Force45Pixel = f");
  965.        endif;
  966.  
  967.         WriteLine(LogFileHandle,"b Force32Mb = t");
  968.         WriteLine(LogFileHandle,"");
  969.         WriteLine(LogFileHandle,"FITend");
  970.     CloseFile(LogFileHandle);
  971.  
  972.       Delay(1);
  973.     //-----------------------------------------------------------------------------
  974.  
  975.  
  976.     //------------------------------------------------------------------------------------
  977.     // Check for Direct X installed and for WinNT which can't install it anyway.
  978.     CheckDirectX:
  979.     //------------------------------------------------------------------------------------
  980.  
  981.     //---------------------------------------------------------------------------------------
  982.     // Create program folders and icons.
  983.    InstallProgramItems:
  984.       SetStatusWindow(98, "Creating Program Folder and Icons....");
  985.  
  986.       if (!bIsShellExplorer) then
  987.         MessageBox("This needs Win95 or WinNT 4.0 or Better",SEVERE);
  988.       endif;
  989.  
  990.         if (bWinNT) then
  991.             ProgDefGroupType(PERSONAL);
  992.         endif;
  993.  
  994.       svFolder = PROGRAM_FOLDER_NAME;
  995.       CreateProgramFolder(svFolder);
  996.       ShowProgramFolder(svFolder, 0);
  997.  
  998.       szProgram = oldDest ^ "MechCmdr.exe";
  999.       appName =  "MechCommander Demo";
  1000.  
  1001.     LongPathToQuote( szProgram, TRUE );
  1002.       if (AddFolderIcon( svFolder,appName, szProgram, oldDest ,"", 0, "", REPLACE ) < 0) then
  1003.         MessageBox("Unable to Add Icon to Menu",SEVERE);
  1004.         endif;
  1005.  
  1006.     //---------------------------------------------------------------------------------------
  1007.  
  1008.     //---------------------------------------------------------------------------------------
  1009.    // Announce setup complete and offer to read README file
  1010.    FinalInstallProcess:
  1011.     SetStatusWindow(100, "Installation Complete");
  1012.  
  1013.         pathString = scRoot+"directx\\directx\\mcdxsetup.exe";
  1014.         nvResult = LaunchAppAndWait(pathString,"",WAIT);
  1015.  
  1016.            szMsg = "MechCommander Demo Setup Must restart your machine\n"+
  1017.                    "for MechCommander Demo to work properly\n\n"+
  1018.                    "Choose one of the following options and click OK to finish setup";
  1019.         RebootDialog("Restart Machine",szMsg,0);
  1020.  
  1021.       szMsg = "Setup is complete.  You may run the installed program " +
  1022.               "by double-clicking on the program icon.";
  1023.       MessageBox( szMsg, INFORMATION );
  1024.  
  1025.     EndInstall:
  1026.     //---------------------------------------------------------------------------------------
  1027.  
  1028. exit;
  1029.  
  1030. /*---------------------------------------------------------------------------*\
  1031.  *
  1032.  * Function:  SetupScreen
  1033.  *
  1034.  *  Purpose:  This function will set up the screen look.  This includes
  1035.  *            colors, fonts, text to be displayed, etc.
  1036.  *
  1037. \*-------------------------------------------------------------------------*/
  1038.  
  1039. function SetupScreen()
  1040.   NUMBER  nDx, nDy;
  1041.  
  1042. begin
  1043.    GetExtents( nDx, nDy );
  1044.  
  1045.    Enable( DEFWINDOWMODE );
  1046.    Enable( INDVFILESTATUS );
  1047.    Enable( BITMAP256COLORS );
  1048.  
  1049.    SetTitle( "Installing " + APP_NAME, 24, WHITE );
  1050.  
  1051.    SetColor( BACKGROUND, BK_BLUE ); // Dark blue.
  1052.    SetColor( STATUSBAR, BLUE );     // Bright blue.
  1053.    SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
  1054.  
  1055.    PlaceBitmap("setup.bmp",1,CENTERED,CENTERED,TILED);
  1056.  
  1057.    Enable( BACKGROUND );
  1058.  
  1059.    Delay( 1 );
  1060. end;
  1061.  
  1062. /*---------------------------------------------------------------------------*\
  1063.  *
  1064.  * Function:  CheckForSoundCard
  1065.  *
  1066.  *  Purpose:  This function will check for the presence of s Digital Sound Card.
  1067.  *
  1068. \*-------------------------------------------------------------------------*/
  1069.  
  1070. function CheckForSoundCard()
  1071.  
  1072.    NUMBER    numDevs;
  1073.    STRING    szDLL;
  1074.  
  1075. begin
  1076.  
  1077.    szDLL = WINSYSDIR + MM_DLL_FILE;
  1078.  
  1079. /*--------------------------------------------------------------------------*\
  1080.  *
  1081.  * Load winMM.DLL into memory.
  1082.  *
  1083. \*--------------------------------------------------------------------------*/
  1084.    nResult = UseDLL (szDLL);
  1085.  
  1086.     numDevs = waveOutGetNumDevs();
  1087.  
  1088. /*--------------------------------------------------------------------------*\
  1089.  *
  1090.  * The following removes MYDLL.DLL from memory.
  1091.  *
  1092. \*--------------------------------------------------------------------------*/
  1093.  
  1094.    UnUseDLL (szDLL);
  1095.  
  1096.     return(numDevs);
  1097. end;
  1098.  
  1099. /*---------------------------------------------------------------------------*\
  1100.  *
  1101.  * Function:  CheckRequirements
  1102.  *
  1103.  *  Purpose:  This function will check all minimum requirements for the
  1104.  *            application being installed.  If any fail, then the user
  1105.  *            is informed and the installation is terminated.
  1106.  *
  1107. \*---------------------------------------------------------------------------*/
  1108.  
  1109. function CheckRequirements()
  1110.    NUMBER  nvDx, nvDy, nvResult, goodResult, nSoundCard;
  1111.    NUMBER  pCPUId, pCPUFeatures, pCPUSpeed;
  1112.    STRING  svResult;
  1113.    STRING  szList,szDLL;
  1114.    LIST        listInfo;
  1115.  
  1116. begin
  1117.    // Check screen resolution.
  1118.    GetExtents( nvDx, nvDy );
  1119.  
  1120.     goodResult = 0;
  1121.     listInfo = ListCreate(STRINGLIST);
  1122.  
  1123.    if (nvDy < 480) then
  1124.       MessageBox( "This program requires VGA or better resolution.", WARNING );
  1125.       abort;
  1126.    endif;
  1127.  
  1128.    // Determine the target system's operating system.
  1129.    GetSystemInfo( OS, nvResult, svResult );
  1130.  
  1131.    bWinNT           = FALSE;
  1132.    bWin32s          = FALSE;
  1133.    bIsShellExplorer = FALSE;
  1134.  
  1135.    if (nvResult =  IS_WINDOWSNT) then
  1136.       bWinNT = TRUE;                   // Running Windows NT.
  1137.       // Check to see if the shell being used is EXPLORER shell.
  1138.       if (( nvResult = IS_WINDOWSNT ) || ( nvResult = IS_WINDOWS95 )) then
  1139.          if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
  1140.             if (nvResult >= 5) then
  1141.                bIsShellExplorer = TRUE;
  1142.                ListAddString(listInfo,"Operating System is Windows NT 5.0 or better.",AFTER);
  1143.                ListAddString(listInfo,"This Game needs NT 5.0 at least--PASSED",AFTER);
  1144.                ListAddString(listInfo," ",AFTER);
  1145.             else
  1146.                ListAddString(listInfo,"Operating System is Windows NT 4.0 or less.",AFTER);
  1147.                ListAddString(listInfo,"This Game needs NT 5.0 at least--FAILED",AFTER);
  1148.                ListAddString(listInfo," ",AFTER);
  1149.                 MessageBox("MechCommander Requires Win95, Win98 or WinNT 5.0 at least.  Unable to Install",SEVERE);
  1150.                 goodResult = -1;
  1151.             endif;
  1152.          endif;
  1153.       endif;
  1154.  
  1155.    elseif (nvResult =  IS_WIN32S) then
  1156.        ListAddString(listInfo,"Operating System is WIN32s.",AFTER);
  1157.        ListAddString(listInfo,"This Game needs NT 5.0 or Win95, Win98 at least--FAILED",AFTER);
  1158.        ListAddString(listInfo," ",AFTER);
  1159.         MessageBox("MechCommander Requires Win95, Win98 or WinNT 5.0 at least.  Unable to Install",SEVERE);
  1160.         goodResult = -2;
  1161.    elseif (nvResult = IS_WINDOWS95 ) then
  1162.        ListAddString(listInfo,"Operating System is Windows 95 or better.",AFTER);
  1163.        ListAddString(listInfo,"This Game needs Win95 or Win98 at least--PASSED",AFTER);
  1164.        ListAddString(listInfo," ",AFTER);
  1165.       bIsShellExplorer = TRUE;
  1166.     else
  1167.        ListAddString(listInfo,"Operating System is Windows 3.11 or less.",AFTER);
  1168.        ListAddString(listInfo,"This Game needs NT 5.0 or Win95, Win98 at least--FAILED",AFTER);
  1169.        ListAddString(listInfo," ",AFTER);
  1170.         MessageBox("MechCommander Requires Win95, Win98 or WinNT 5.0 at least.  Unable to Install",SEVERE);
  1171.         goodResult = -4;
  1172.    endif;
  1173.  
  1174.    szDLL = WINSYSDIR + K32_DLL_FILE;
  1175.    nResult = UseDLL (szDLL);
  1176.  
  1177.     //------------------------------------------
  1178.    // Determine the target system's Base Memory
  1179.    memBuffer.dwLength = MEM_BUFFER_SIZE;
  1180.    pMemBuffer = AddressStruct(memBuffer);
  1181.  
  1182.     GlobalMemoryStatus(pMemBuffer);
  1183.  
  1184.     Sprintf(szList,"Physical System Memory is %ldK bytes of RAM.",(memBuffer.dwTotalPhys/1024));
  1185.     ListAddString(listInfo,szList,AFTER);
  1186.  
  1187.    if ((memBuffer.dwTotalPhys/1024) < (15000)) then
  1188.         MessageBox("MechCommander Requires at Least 16 MB of RAM!",SEVERE);
  1189.         goodResult = -3;
  1190.        ListAddString(listInfo,"This Game needs 15000K of RAM at least--FAILED",AFTER);
  1191.        ListAddString(listInfo," ",AFTER);
  1192.     else
  1193.        ListAddString(listInfo,"This Game needs 15000K of RAM at least--PASSED",AFTER);
  1194.        ListAddString(listInfo,"31000K of RAM is Recommended",AFTER);
  1195.        ListAddString(listInfo," ",AFTER);
  1196.    endif;
  1197.  
  1198.     //--------------------------------------------------------
  1199.     nResult = UnUseDLL (szDLL);
  1200.  
  1201.     //--------------------------------------------------------
  1202.    // Determine the target system's Processor and Speed
  1203.    szDLL = CPU_DLL_FILE;
  1204.    nResult = UseDLL (szDLL);
  1205.  
  1206.     pCPUId = wincpuid();
  1207.     pCPUFeatures = wincpufeatures();
  1208.     pCPUSpeed = cpuspeed();
  1209.     
  1210.     if ((pCPUId < 5) && (pCPUId > 2)) then
  1211.         if (pCPUId = 3) then
  1212.             ListAddString(listInfo,"System Processor is 386",AFTER);
  1213.         endif;
  1214.         if (pCPUId = 4) then
  1215.             ListAddString(listInfo,"System Processor is 486",AFTER);
  1216.         endif;
  1217.         ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--FAILED",AFTER);
  1218.     else
  1219.         if ((pCPUId > 4) && (pCPUId < 8)) then
  1220.             if (pCPUId = 5) then
  1221.                 if (pCPUFeatures & 0x0080000) then
  1222.                     Sprintf(szList,"System Processor is %ldMhz Pentium with MMX.",pCPUSpeed);
  1223.                     ListAddString(listInfo,szList,AFTER);
  1224.                 else
  1225.                     Sprintf(szList,"System Processor is %ldMhz Pentium",pCPUSpeed);
  1226.                     ListAddString(listInfo,szList,AFTER);
  1227.                 endif;
  1228.  
  1229.                 if (pCPUSpeed >= 133) then
  1230.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--PASSED",AFTER);
  1231.                     ListAddString(listInfo,"A 166Mhz Pentium with MMX is Recommended",AFTER);
  1232.                 else
  1233.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--FAILED",AFTER);
  1234.                 endif;
  1235.  
  1236.             endif;
  1237.  
  1238.             if (pCPUId = 6) then
  1239.                 if (pCPUFeatures & 0x0080000) then
  1240.                     Sprintf(szList,"System Processor is %ldMhz Pentium PRO with MMX",pCPUSpeed);
  1241.                     ListAddString(listInfo,szList,AFTER);
  1242.                 else
  1243.                     Sprintf(szList,"System Processor is %ldMhz Pentium PRO",pCPUSpeed);
  1244.                     ListAddString(listInfo,szList,AFTER);
  1245.                 endif;
  1246.  
  1247.                 if (pCPUSpeed >= 133) then
  1248.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--PASSED",AFTER);
  1249.                     ListAddString(listInfo,"A 166Mhz Pentium with MMX is Recommended",AFTER);
  1250.                 else
  1251.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--FAILED",AFTER);
  1252.                 endif;
  1253.             endif;
  1254.  
  1255.             if (pCPUId = 7) then
  1256.                 ListAddString(listInfo,"System Processor is Pentium II",AFTER);
  1257.  
  1258.                 if (pCPUSpeed >= 133) then
  1259.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--PASSED",AFTER);
  1260.                     ListAddString(listInfo,"A 166Mhz Pentium with MMX is Recommended",AFTER);
  1261.                 else
  1262.                     ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--FAILED",AFTER);
  1263.                 endif;
  1264.             endif;
  1265.  
  1266.         else
  1267.             ListAddString(listInfo,"System Processor is UNKNOWN!",AFTER);
  1268.             ListAddString(listInfo,"This Game needs a 133Mhz Pentium or Better--UNKNOWN",AFTER);
  1269.             ListAddString(listInfo,"A 166Mhz Pentium with MMX is Recommended",AFTER);
  1270.         endif;
  1271.     endif;
  1272.  
  1273.    ListAddString(listInfo," ",AFTER);
  1274.     //--------------------------------------------------------
  1275.     nResult = UnUseDLL (szDLL);
  1276.  
  1277.     //--------------------------------------------------------
  1278.    // Determine the target system's digital sound card status
  1279.     nSoundCard = CheckForSoundCard();
  1280.  
  1281.     if (nSoundCard != 0) then
  1282.         ListAddString(listInfo,"System has Digital Sound Card Installed",AFTER);
  1283.        ListAddString(listInfo,"This Game needs a Digital Sound Card--PASSED",AFTER);
  1284.        ListAddString(listInfo," ",AFTER);
  1285.     else
  1286.         ListAddString(listInfo,"System does not have Digital Sound Card Installed",AFTER);
  1287.        ListAddString(listInfo,"This Game needs a Digital Sound Card--FAILED",AFTER);
  1288.        ListAddString(listInfo," ",AFTER);
  1289.         MessageBox("MechCommander Requires a a Digital Output Device (Sound Card)",SEVERE);
  1290.     endif;
  1291.  
  1292. /*
  1293.     //---------------------------------------------------------------------------------------
  1294.     // Version Check Direct X and offer to install.
  1295.     // We only care about DirectDraw and DirectSound.
  1296.     // As such, only check them.
  1297.     verResult = VerFindFileVersion("ddraw.dll",szDDrawPath,szDDrawVer);
  1298.  
  1299.     //----------------------------------------------------
  1300.     // Couldn't find the file.  Handle it.
  1301.     if (verResult != 0) then
  1302.         if (bWinNT = TRUE) then
  1303.             //-------------------------------------------------------------------------------------------------
  1304.             // This can't happen, in theory because we shouldn't get here if we tried to install on NT < 4.0.
  1305.             // Handle it anyway.
  1306.             szMsg = "This is Windows NT and I can't find DirectDraw.\n"+
  1307.                     "The only way that can happen is if this is a version of NT earlier than 4.0 Build 1381\n"+
  1308.                     "MechCommander requires that DirectDraw be installed and cannot install on this version of NT";
  1309.             MessageBox(szMsg,SEVERE);
  1310.             bDirectDrawInstalled = FALSE;
  1311.             ListAddString(listInfo,"DirectDraw Not Installed Under WinNT.",AFTER);
  1312.            ListAddString(listInfo,"This Game needs NT with DirectDraw--FAILED",AFTER);
  1313.            ListAddString(listInfo," ",AFTER);
  1314.         else
  1315.             //-----------------------------------------------------------------------------------------------
  1316.             //We are in Win95 and DirectDraw is NOT installed.  Warn 'em that they need to and take 'em there.
  1317.             szMsg = "This is Win95 or greater and I could not find DirectDraw.\n"+
  1318.                     "You must Install Direct X Version 5.0 at least or MechCommander will not work.";
  1319.             MessageBox(szMsg,INFORMATION);
  1320.             ListAddString(listInfo,"DirectDraw Not Installed Under Win95.",AFTER);
  1321.            ListAddString(listInfo,"This Game needs Win95 with DirectDraw--FAILED",AFTER);
  1322.            ListAddString(listInfo," ",AFTER);
  1323.             bDirectDrawInstalled = FALSE;
  1324.         endif;
  1325.     else
  1326.         bDirectDrawInstalled = TRUE;
  1327.         Sprintf(szList,"DirectDraw Version %s Installed.",szDDrawVer);
  1328.         ListAddString(listInfo,szList,AFTER);
  1329.        ListAddString(listInfo,"This Game needs DirectDraw--PASSED",AFTER);        //Put version Info in here.
  1330.        ListAddString(listInfo," ",AFTER);
  1331.     endif;
  1332.  
  1333.     if (nSoundCard != 0) then
  1334.         verResult = VerFindFileVersion("dsound.dll",szDSoundPath,szDSoundVer);
  1335.         //----------------------------------------------------
  1336.         // Couldn't find the file.  Handle it.
  1337.         if ((verResult = FILE_NO_VERSION) || (verResult = FILE_NOT_FOUND)) then
  1338.             if (bWinNT = TRUE) then
  1339.                 //-------------------------------------------------------------------------------------------------
  1340.                 // This can happen if they haven't installed a Digital Sound Device on NT.  We should check for
  1341.                 // a digital Sound Card here.
  1342.                 szMsg = "This is Windows NT and I can't find DirectSound.\n"+
  1343.                         "You may not have a digital sound card installed and MechCommander requires one.\n"+
  1344.                         "Or your sound card does not support DirectSound under NT.  MechCommander does not\n"+
  1345.                         "require DirectSound but performance, especially under NT, is DRAMATICALLY improved.\n";
  1346.  
  1347.                 MessageBox(szMsg,SEVERE);
  1348.                 bDirectSoundInstalled = FALSE;
  1349.                 ListAddString(listInfo,"DirectSound Not Installed Under WinNT.",AFTER);
  1350.                ListAddString(listInfo,"This Game works better with DirectSound--MARGINAL",AFTER);
  1351.                ListAddString(listInfo," ",AFTER);
  1352.             else
  1353.                 //-----------------------------------------------------------------------------------------------
  1354.                 //We are in Win95 and DirectDraw is NOT installed.  Warn 'em that they need to and take 'em there.
  1355.                 szMsg = "This is Win95 or greater and I could not find DirectSound.\n"+
  1356.                         "You must Install Direct X Version 5.0 at least or MechCommander will not work.";
  1357.                 MessageBox(szMsg,INFORMATION);
  1358.                 bDirectSoundInstalled = FALSE;
  1359.                 ListAddString(listInfo,"DirectSound Not Installed Under Win95.",AFTER);
  1360.                ListAddString(listInfo,"This Game works better with DirectSound--MARGINAL",AFTER);
  1361.                ListAddString(listInfo," ",AFTER);
  1362.             endif;
  1363.         else
  1364.             bDirectSoundInstalled = TRUE;
  1365.             Sprintf(szList,"DirectSound Version %s Installed.",szDSoundVer);
  1366.             ListAddString(listInfo,szList,AFTER);
  1367.            ListAddString(listInfo,"This Game works better with DirectSound--PASSED",AFTER);
  1368.            ListAddString(listInfo," ",AFTER);
  1369.         endif;
  1370.     endif;
  1371. */
  1372.     //------------------------------------------
  1373.    // Display System Info
  1374.     nvResult = SdShowInfoList("System Information","The text below Describes your system configuration",listInfo);
  1375.  
  1376.     if (nvResult = BACK) then
  1377.         goodResult = 1;
  1378.     endif;
  1379.  
  1380.     return goodResult;
  1381. end;
  1382.  
  1383. #include "sddialog.rul"
  1384.