Exemplo n.º 1
0
        void updateMEConfig(MeType gameId)
        {
            enableGameDataMenu(false);
            string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                       Assembly.GetExecutingAssembly().GetName().Name);

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string filename = Path.Combine(path, "me" + (int)gameId + "map.bin");

            if (!File.Exists(filename))
            {
                MessageBox.Show("Unable to update LOD settings.\nYou must scan your game using Texture Manager first always!");
                enableGameDataMenu(true);
                return;
            }
            GameData gameData = new GameData(gameId, _configIni);

            path = gameData.EngineConfigIniPath;
            bool exist = File.Exists(path);

            if (!exist)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }
            ConfIni engineConf = new ConfIni(path);

            LODSettings.updateLOD(gameId, engineConf);
            MessageBox.Show("Game configuration file at " + path + " updated.");
            enableGameDataMenu(true);
        }
    public void OnValidate()
    {
        radius           = Mathf.Max(radius, 1);
        noiseHeightScale = Mathf.Max(noiseHeightScale, 0);

        if (lodSettings != null)
        {
            if (lodSettings.Length == validVertexIncrements.Length)
            {
                for (int i = 0; i < lodSettings.Length; i++)
                {
                    if (lodSettings[i].vertexIncrement != GetVertexIncrement(i))
                    {
                        lodSettings[i].vertexIncrement = GetVertexIncrement(i);
                    }
                }
            }
            else
            {
                lodSettings = new LODSettings[validVertexIncrements.Length];
                for (int i = 0; i < lodSettings.Length; i++)
                {
                    lodSettings[i] = new LODSettings(GetVertexIncrement(i), i * (chunkSize / 2) + chunkSize);
                }
            }
        }
    }
Exemplo n.º 3
0
            public LODGroupSettings(int lodParentIndex)
            {
                int lodCount = lodParentIndex + 1;

                lodSettings = new LODSettings[lodCount];
                float percentage = 1.0f / lodCount;

                for (int i = 0; i < lodSettings.Length; i++)
                {
                    lodSettings[i] = new LODSettings(1 - (percentage * (i + 1)));
                }
            }
Exemplo n.º 4
0
        private void updateGfxME(MeType gameId, bool softShadowsMode = false)
        {
            enableGameDataMenu(false);
            GameData gameData = new GameData(gameId, _configIni);
            string   path     = gameData.EngineConfigIniPath;
            bool     exist    = File.Exists(path);

            if (!exist)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }
            ConfIni engineConf = new ConfIni(path);

            LODSettings.updateGFXSettings(gameId, engineConf, false, false);
            MessageBox.Show("Game configuration file at " + path + " updated.");
            enableGameDataMenu(true);
        }
    void PrepareRenderData()
    {
        // Element indexing
        for (int i = 0; i < crowdMgr.Count; i++)
        {
            instanceID[i] = i;
        }

        for (int i = 0; i < weaponMgr.Count; i++)
        {
            weaponID[i] = i;
        }

        SkinnedMeshRenderer firstLODRenderer = lodSettings[0].lodPrefab.GetComponent <SkinnedMeshRenderer>();

        boneNumber = firstLODRenderer.bones.Count();

        LoadBakedAnimations();

        // Init materials for rendering
        GPUSkinMaterial       = ApplyMaterialWithGPUSkinning(GPUSkinShader, firstLODRenderer.sharedMaterial);
        GPUSkinMaterialSimple = ApplyMaterialWithGPUSkinning(GPUSkinShaderSimple, firstLODRenderer.sharedMaterial);
        GPUWeaponMaterial     = ApplyWeaponMaterialWithGPUSkinning(GPUSkinShader, weaponMgr.WeaponMaterial);

        // Process weapons
        if (weaponMgr.AvailableWeapons.Count > 0)
        {
            int maxDrawnWeapon = lodSettings[0].size + lodSettings[1].size;
            foreach (Mesh mesh in weaponMgr.AvailableWeapons)
            {
                weaponBatches.Add(new InstanceBatch(maxDrawnWeapon, ProcessMesh(mesh)));
            }
        }

        // Process character meshes
        for (int i = 0; i < lodSettings.Count; i++)
        {
            LODSettings lod          = lodSettings[i];
            Mesh        meshNoWeapon = ProcessMesh(lod.lodPrefab.GetComponent <SkinnedMeshRenderer>().sharedMesh);

            LODBatches.Add(new InstanceBatch(lod.size, meshNoWeapon));

            Destroy(lod.lodPrefab);
        }
    }
Exemplo n.º 6
0
        private void removeLODSettings(MeType gameId)
        {
            enableGameDataMenu(false);
            GameData gameData = new GameData(gameId, _configIni);
            string   path     = gameData.EngineConfigIniPath;
            bool     exist    = File.Exists(path);

            if (exist)
            {
                ConfIni engineConf = new ConfIni(path);
                LODSettings.removeLOD(gameId, engineConf);
                MessageBox.Show("INFO: Game configuration file at " + path + " updated.");
            }
            else
            {
                MessageBox.Show("INFO: Game configuration file at " + path + " not exist, nothing done.");
            }
            enableGameDataMenu(true);
        }
    // Init lod settings and additional LODs for more data than total capacity
    void InitLODs()
    {
        int lodCapacity = 0;

        for (int i = 0; i < lodSettings.Count; i++)
        {
            lodSettings[i].distance *= lodSettings[i].distance;
            lodSettings[i].maxSize   = lodSettings[i].size;
            if (lodSettings[i].size > 1000)
            {
                lodSettings[i].size = 1000;
            }
            lodCapacity += lodSettings[i].size;
        }

        // If the provided LODs does not cover the crowd count,
        // generate more LODs until they do
        LODSettings lastLOD = lodSettings.Last();

        while (crowdMgr.Count > lodCapacity)
        {
            LODSettings lod = new LODSettings
            {
                distance  = lastLOD.distance,
                lodPrefab = lastLOD.lodPrefab,
                size      = Math.Min(crowdMgr.Count - lodCapacity, 1000)
            };
            lod.maxSize = lod.size;

            lodSettings.Add(lod);

            LODBatches.Add(new InstanceBatch(lod.maxSize, LODBatches.Last().Mesh));

            lodCapacity += lod.size;
        }
    }
Exemplo n.º 8
0
        private void buttonSTART_Click(object sender, EventArgs e)
        {
            buttonsEnable(false);
            buttonPreInstallCheck.Enabled = false;
            buttonSTART.Enabled           = false;
            labelFinalStatus.Text         = "Process in progress...";

            errors = "";
            log    = "";
            Misc.startTimer();

            log += "Prepare game data started..." + Environment.NewLine;
            updateStatusPrepare("In progress...");
            if (GameData.gameType == MeType.ME1_TYPE)
            {
                Misc.VerifyME1Exe(gameData, false);
            }

            if (GameData.gameType == MeType.ME3_TYPE)
            {
                ME3DLC.unpackAllDLC(null, this);
                gameData.getPackages(true, true);
            }

            if (GameData.gameType != MeType.ME1_TYPE)
            {
                gameData.getTfcTextures();
            }

            checkBoxPrepare.Checked = true;
            updateStatusPrepare("");
            log += "Prepare game data finished" + Environment.NewLine + Environment.NewLine;

            if (Directory.Exists(GameData.DLCData))
            {
                List <string> dirs = Directory.EnumerateDirectories(GameData.DLCData).ToList();
                log += "Detected folowing folders in DLC path:" + Environment.NewLine;
                for (int dl = 0; dl < dirs.Count; dl++)
                {
                    log += Path.GetFileName(dirs[dl]) + Environment.NewLine;
                }
            }
            else
            {
                log += "Not detected folders in DLC path" + Environment.NewLine;
            }
            log += Environment.NewLine;

            log += "Scan textures started..." + Environment.NewLine;
            updateStatusScan("In progress...");
            if (checkBoxOptionFaster.Checked)
            {
                errors += treeScan.PrepareListOfTextures(null, cachePackageMgr, null, this, ref log, true);
            }
            else
            {
                errors += treeScan.PrepareListOfTextures(null, null, null, this, ref log, true);
            }
            textures             = treeScan.treeScan;
            checkBoxScan.Checked = true;
            updateStatusScan("");
            log += "Scan textures finished" + Environment.NewLine + Environment.NewLine;


            if (checkBoxOptionFaster.Checked)
            {
                if (GameData.gameType == MeType.ME1_TYPE)
                {
                    log += "Remove mipmaps started..." + Environment.NewLine;
                    updateStatusMipMaps("In progress...");
                    errors += mipMaps.removeMipMapsME1(1, textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked);
                    errors += mipMaps.removeMipMapsME1(2, textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked);
                    checkBoxMipMaps.Checked = true;
                    updateStatusMipMaps("");
                    log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine;
                }
                else
                {
                    log += "Remove mipmaps started..." + Environment.NewLine;
                    updateStatusMipMaps("In progress...");
                    errors += mipMaps.removeMipMapsME2ME3(textures, cachePackageMgr, null, this, checkBoxPreEnableRepack.Checked);
                    checkBoxMipMaps.Checked = true;
                    updateStatusMipMaps("");
                    log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine;
                }
            }


            log += "Process textures started..." + Environment.NewLine;
            updateStatusTextures("In progress...");
            applyModules();
            checkBoxTextures.Checked = true;
            updateStatusTextures("");
            log += "Process textures finished" + Environment.NewLine + Environment.NewLine;


            updateStatusStore("Progress...");
            cachePackageMgr.CloseAllWithSave(checkBoxPreEnableRepack.Checked);
            checkBoxStore.Checked = true;
            updateStatusStore("");


            if (!checkBoxOptionFaster.Checked)
            {
                if (GameData.gameType == MeType.ME1_TYPE)
                {
                    log += "Remove mipmaps started..." + Environment.NewLine;
                    updateStatusMipMaps("In progress...");
                    errors += mipMaps.removeMipMapsME1(1, textures, null, null, this, checkBoxPreEnableRepack.Checked);
                    errors += mipMaps.removeMipMapsME1(2, textures, null, null, this, checkBoxPreEnableRepack.Checked);
                    checkBoxMipMaps.Checked = true;
                    updateStatusMipMaps("");
                    log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine;
                }
                else
                {
                    log += "Remove mipmaps started..." + Environment.NewLine;
                    updateStatusMipMaps("In progress...");
                    errors += mipMaps.removeMipMapsME2ME3(textures, null, null, this, checkBoxPreEnableRepack.Checked);
                    checkBoxMipMaps.Checked = true;
                    updateStatusMipMaps("");
                    log += "Remove mipmaps finished" + Environment.NewLine + Environment.NewLine;
                }
            }

            log += "Updating LODs and other settings started..." + Environment.NewLine;
            updateStatusLOD("In progress...");
            string path  = gameData.EngineConfigIniPath;
            bool   exist = File.Exists(path);

            if (!exist)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }
            ConfIni engineConf = new ConfIni(path);

            LODSettings.updateLOD((MeType)gameId, engineConf);
            LODSettings.updateGFXSettings((MeType)gameId, engineConf);
            checkBoxLOD.Checked = true;
            updateStatusLOD("");
            log += "Updating LODs and other settings finished" + Environment.NewLine + Environment.NewLine;


            if (checkBoxPreEnableRepack.Checked)
            {
                log += "Repack started..." + Environment.NewLine;
                for (int i = 0; i < GameData.packageFiles.Count; i++)
                {
                    updateStatusRepackZlib("Repacking PCC files... " + ((i + 1) * 100 / GameData.packageFiles.Count) + " %");
                    Package package = new Package(GameData.packageFiles[i], true, true);
                    if (package.compressed && package.compressionType != Package.CompressionType.Zlib)
                    {
                        package.Dispose();
                        package = new Package(GameData.packageFiles[i]);
                        package.SaveToFile(true);
                    }
                }
                checkBoxRepackZlib.Checked = true;
                updateStatusRepackZlib("");
                log += "Repack finished" + Environment.NewLine + Environment.NewLine;
            }


            if (checkBoxPreEnablePack.Checked)
            {
                if (Directory.Exists(GameData.DLCData))
                {
                    TOCBinFile.UpdateAllTOCBinFiles();

                    log += "Repack started..." + Environment.NewLine;
                    updateStatusPackDLC("In progress...");
                    List <string> DLCs = Directory.GetDirectories(GameData.DLCData).ToList();
                    for (int i = 0; i < DLCs.Count; i++)
                    {
                        List <string> files = Directory.GetFiles(DLCs[i], "Mount.dlc", SearchOption.AllDirectories).ToList();
                        if (files.Count == 0)
                        {
                            DLCs.RemoveAt(i--);
                        }
                    }

                    string tmpDlcDir = Path.Combine(GameData.GamePath, "BIOGame", "DLCTemp");
                    for (int i = 0; i < DLCs.Count; i++)
                    {
                        string DLCname = Path.GetFileName(DLCs[i]);
                        string outPath = Path.Combine(tmpDlcDir, DLCname, "CookedPCConsole", "Default.sfar");
                        ME3DLC dlc     = new ME3DLC(null);
                        dlc.fullRePack(DLCs[i], outPath, DLCname, null, this);
                    }

                    Directory.Delete(GameData.DLCData, true);
                    Directory.Move(tmpDlcDir, GameData.DLCData);

                    updateStatusPackDLC("");
                    log += "Repack started finished" + Environment.NewLine + Environment.NewLine;
                }
                checkBoxPackDLC.Checked = true;
            }


            var time = Misc.stopTimer();

            labelFinalStatus.Text = "Process finished. Process total time: " + Misc.getTimerFormat(time);
            buttonExit.Enabled    = true;
            buttonNormal.Enabled  = true;

            log += "==========================================" + Environment.NewLine;
            log += "LOD settings:" + Environment.NewLine;
            LODSettings.readLOD((MeType)gameId, engineConf, ref log);
            log += "==========================================" + Environment.NewLine;

            string filename = "install-log.txt";

            if (File.Exists(filename))
            {
                File.Delete(filename);
            }
            using (FileStream fs = new FileStream(filename, FileMode.CreateNew))
            {
                fs.WriteStringASCII(log);
            }

            filename = "errors-install.txt";
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }
            if (errors != "")
            {
                using (FileStream fs = new FileStream(filename, FileMode.CreateNew))
                {
                    fs.WriteStringASCII(errors);
                }
                MessageBox.Show("WARNING: Some errors have occured!");
                Process.Start(filename);
            }
        }
 public LabLaunchController(ExternalSiteDemoContext context, IConfiguration configuration)
 {
     Configuration = configuration;
     _context      = context;
     _Settings     = Configuration.GetSection("LODSettings").Get <LODSettings>();
 }