Beispiel #1
0
        internal static string PreviewShaderChain(string pic1, string pic2, string pic3)
        {
            Reset();
            string sp = Setup(pic1, pic2, pic3);
            if(sp != null) return sp;

            INIFile iniFile = new INIFile(Statics.iniFileName, ShaderActive.iniShaderWhat, true);
            List<string> shaderList = new List<string>(iniFile.getSectList(ShaderActive.iniShaderChain));
            foreach (string s in shaderList) {
                string path = Statics.runDir + "\\" + Statics.pathShaders + "\\" + s + ".fx";
                Effect effect;

                try {
                    effect = Effect.FromFile(DXMain.device, path, null, null, ShaderFlags.NotCloneable, null);
                    if(effect == null) throw new ApplicationException();
                } catch {
                    return "Shader '"+path+"' failed to load.";
                }

                try {
                    effect.Technique = "T0";
                    effect.ValidateTechnique("T0");
                } catch {
                    return "Shader '"+path+"' failed validation.";
                }

                effects.Add(LoadShaderTextures(effect));
            }

            return null;
        }
Beispiel #2
0
        public ShaderActive()
        {
            InitializeComponent();
            Statics.Localizations.Apply(this);

            foreach (String s in Directory.GetFiles(Statics.runDir + "\\" + Statics.pathShaders)) {
                if(s.EndsWith(".fx")) lbAvailable.Items.Add(Path.GetFileNameWithoutExtension(s));
            }

            INIFile iniFile = new INIFile(Statics.iniFileName, iniShaderWhat, true);
            List<string> shaderList = new List<string>(iniFile.getSectList(iniShaderChain));
            foreach (string s in shaderList) {
                if (File.Exists(Statics.runDir + "\\" + Statics.pathShaders + "\\" + s + ".fx")) {
                    lbSelected.Items.Add(s);
                }
            }
        }
Beispiel #3
0
        private void SaveMWINI()
        {
            INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default, true);

            mwini.setKey("FPSLimit", (int)udFPSLimit.Value);
            mwini.setKey ("SSEnable", cbScreenshots.Checked);
            mwini.setKey ("NoThread", !cbThreadLoad.Checked);
            mwini.setKey ("YesToAll", cbYesToAll.Checked);
            mwini.setKey ("HDShadow", cbHQShadows.Checked);
            mwini.setKey ("ShowFPS", cbShowFPS.Checked);
            mwini.setKey ("AudioOff", cbAudio.Checked);
            mwini.setKey ("Subtitles", cbSubtitles.Checked);
            mwini.setKey ("HitFader", cbHitFader.Checked);

            mwini.setKey("UseConstant", true);
            mwini.setKey("ConstantValue", Decimal.ToSingle(udLightingConst.Value));
            mwini.setKey("UseLinear", true);
            mwini.setKey("LinearValue", Decimal.ToSingle(udLightingLinear.Value));
            mwini.setKey("UseQuadratic", true);
            mwini.setKey("QuadraticValue", Decimal.ToSingle(udLightingQuad.Value));

            mwini.save ();
        }
Beispiel #4
0
 private void SaveGraphicsSettings()
 {
     INIFile iniFile = new INIFile (Statics.iniFileName, iniSettings, true);
     // Config
     iniFile.setKey ("Version", Statics.versionString);
     iniFile.setKey ("IipSpeed", cmbTipReadSpd.SelectedIndex);
     iniFile.setKey ("Language", cmbUILanguage.Text);
     iniFile.setKey ("AutoLang", cbUILangAuto.Checked);
     iniFile.setKey ("DisableMGE", cbDisableMGE.Checked);
     // Graphics
     iniFile.setKey ("AntiAlias", cmbAntiAlias.SelectedIndex);
     iniFile.setKey ("VWait", cmbVWait.SelectedIndex);
     iniFile.setKey ("Refresh", cmbRefreshRate.Text);
     iniFile.setKey ("AnisoLvl", cmbAnisoLevel.SelectedIndex);
     iniFile.setKey ("LODBias", (double)udLOD.Value);
     iniFile.setKey ("FogMode", cmbFogMode.SelectedIndex);
     iniFile.setKey ("FOV", (double)udFOV.Value);
     iniFile.setKey ("FPSCount", cbFPSCounter.Checked);
     iniFile.setKey ("Messages", cbDisplayMessages.Checked);
     iniFile.setKey ("MsgTime", (double)udMsgsTime.Value);
     iniFile.setKey ("HWShader", cbHWShader.Checked);
     iniFile.setKey ("SSFormat", cmbSShotFormat.SelectedIndex);
     if (tbSShotDir.TextAlign == HorizontalAlignment.Left) iniFile.setKey ("SSDir", tbSShotDir.Text);
     else iniFile.setKey ("SSDir", "");
     iniFile.setKey ("SSName", tbSShotName.Text);
     iniFile.setKey ("SSNum", (double)udSShotNum.Value);
     // In-game
     iniFile.setKey ("DisableMWSE", cbDisableMWSE.Checked);
     iniFile.setKey ("HDRTime", (double)udHDR.Value);
     iniFile.setKey ("Cam3rdCustom", cbCam3rdPrsn.Checked);
     iniFile.setKey ("Cam3rdX", (double)udCam3rdX.Value);
     iniFile.setKey ("Cam3rdY", (double)udCam3rdY.Value);
     iniFile.setKey ("Cam3rdZ", (double)udCam3rdZ.Value);
     iniFile.setKey ("AutoCrosshair", cbAutoCrosshair.Checked);
     iniFile.setKey ("MenuCaching", cbMenuCaching.Checked);
     // Distant Land
     iniFile.setKey ("DistLand", cbDLDistantLand.Checked);
     iniFile.setKey ("DistStat", cbDLDistantStatics.Checked);
     iniFile.setKey ("DrawDist", (double)udDLDrawDist.Value);
     iniFile.setKey ("AutoDist", cbDLAutoDist.Checked);
     iniFile.setKey ("AutoDistBy", rbDLAutoByAFogEnd.Checked ? 2 : 1);
     iniFile.setKey ("EndNear", (double)udDLDistNear.Value);
     iniFile.setKey ("EndFar", (double)udDLDistFar.Value);
     iniFile.setKey ("EndVFar", (double)udDLDistVeryFar.Value);
     iniFile.setKey ("SizeFar", (double)udDLSizeFar.Value);
     iniFile.setKey ("SizeVFar", (double)udDLSizeVeryFar.Value);
     iniFile.setKey ("ReflLand", cbDLReflLand.Checked);
     iniFile.setKey ("ReflNear", cbDLReflNStatics.Checked);
     iniFile.setKey ("ReflIntr", cbDLReflInterior.Checked);
     iniFile.setKey ("SkyRefl", cbDLSkyRefl.Checked);
     iniFile.setKey ("ReflBlur", cbDLReflBlur.Checked);
     iniFile.setKey ("DynRipples", cbDLDynRipples.Checked);
     iniFile.setKey ("WaveHght", (double)udDLWtrWave.Value);
     iniFile.setKey ("Caustics", (double)udDLWtrCaust.Value);
     iniFile.setKey ("AboveBeg", (double)udDLFogAStart.Value);
     iniFile.setKey ("AboveEnd", (double)udDLFogAEnd.Value);
     iniFile.setKey ("BelowBeg", (double)udDLFogBStart.Value);
     iniFile.setKey ("BelowEnd", (double)udDLFogBEnd.Value);
     iniFile.setKey ("InterBeg", (double)udDLFogIStart.Value);
     iniFile.setKey ("InterEnd", (double)udDLFogIEnd.Value);
     iniFile.setKey ("ExpFog", cbDLFogExp.Checked);
     iniFile.setKey ("DLExpMul", (double)udDLFogExpMul.Value);
     iniFile.setKey ("Scatter", cbDLScattering.Checked);
     iniFile.setKey ("SunShadows", cbDLSunShadows.Checked);
     iniFile.setKey ("PPLighting", cbPerPixelLighting.Checked);
     iniFile.save ();
     try {
         RegistryKey key = Registry.LocalMachine.OpenSubKey (Statics.reg_mw, true);
         if (key != null) {
             key.SetValue ("Pixelshader", new byte [] { Convert.ToByte (cbDisableMGE.Checked) });
             key.Close ();
         }
     } catch { }
 }
 // saving settings after plugin selection
 private void SavePlugsSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniPlugsTab, true);
     iniFile.setKey("PlugSort", rbPlugsName.Checked ? 0d : rbPlugsType.Checked ? 1d : rbPlugsLoad.Checked ? 2d : 2d);
     List<String> items = new List<String>(pluginDirs);
     for (int i = 0; i < items.Count; i++) if (String.Compare(Path.GetFullPath(items[i]), Path.GetFullPath(Statics.fn_statics), true, Statics.Culture) == 0) items.RemoveAt(i--);
     iniFile.setSectList(iniDLWizardPlugDirs, items.ToArray());
     List<String> checkeditems = new List<String>();
     foreach (String item in clbPlugsModList.CheckedItems) if (pluginList.Plugins[item.ToLower(Statics.Culture)].Checked == CheckState.Checked) checkeditems.Add(item);
     iniFile.setSectList(iniDLWizardPlugs, checkeditems.ToArray());
     iniFile.save();
 }
Beispiel #6
0
 // saving settings after land mesh creation
 private void SaveMeshSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniMeshTab, true);
     iniFile.setKey("WorldMesh", (cmbMeshWorldDetail_auto ? -1 : (double)cmbMeshWorldDetail.SelectedIndex));
     iniFile.save();
 }
Beispiel #7
0
 // saving settings after plugin selection
 private void SavePlugsSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniPlugsTab, true);
     double temp;
     if (rbPlugsName.Checked) temp = 0;
     else if (rbPlugsType.Checked) temp = 1;
     else if (rbPlugsLoad.Checked) temp = 2;
     else temp = 1;
     iniFile.setKey("PlugSort", temp);
     iniFile.setSectList(iniDLWizardPlugDirs, pluginDirs.ToArray());
     List<string> tempList = new List<string>();
     foreach (string s in clbPlugsModList.CheckedItems) tempList.Add(s);
     iniFile.setSectList(iniDLWizardPlugs, tempList.ToArray());
     iniFile.save();
 }
Beispiel #8
0
        public static void Main(string[] sargs)
        {
            Thread.CurrentThread.CurrentUICulture = Culture;
            CommandArgs args = new CommandArgs (sargs);

            if (args.styles) Application.EnableVisualStyles ();

            // Damn .NET text rendering
            Application.SetCompatibleTextRenderingDefault(false);

            Directory.SetCurrentDirectory (System.IO.Path.GetDirectoryName (Application.ExecutablePath));

            Localizations = new LocalizationInterface ();
            try {
                string [] langfiles = Directory.GetFiles ("MGE3", "*.lng");
                foreach (string langfile in langfiles) {
                    Localizations.Add (langfile);
                }
            } catch { };
            string language = "English (default)";
            bool autoLanguage = true;
            try {
                INIFile MGEini = new INIFile (iniFileName, new INIFile.INIVariableDef [] { INIFile.iniDefEmpty, MainForm.iniLanguage, MainForm.iniAutoLang });
                language = MGEini.getKeyString ("Language");
                autoLanguage = (MGEini.getKeyValue ("AutoLang") == 1);
            } catch { }
            Localizations.Current = language;
            Localizations.ApplyStrings("", strings);

            if (args.mutex && !MutexCheck.PerformCheck ()) {
                MessageBox.Show (strings ["MGEguiRunning"], strings ["Error"]);
                return;
            }
            Process [] morrowind = Process.GetProcessesByName ("Morrowind");
            foreach (Process p in morrowind) {
                MessageBox.Show (strings ["MWRunning"], strings ["Error"]);
                return;
            }

            if (!File.Exists ("./morrowind.exe") || !File.Exists ("./morrowind.ini") || !Directory.Exists ("data files")) {
                MessageBox.Show (strings ["NotMWDir"], strings ["Error"]);
                return;
            }
            if (!Directory.Exists ("MGE3") || !File.Exists ("./MGE3/MGEfuncs.dll") || !File.Exists ("./d3d8.dll") ||
               !File.Exists ("./dinput8.dll")) {
                MessageBox.Show (strings ["MGEMissing"], strings ["Error"]);
                return;
            }
            //Morrowind version info
            try {
                FileVersionInfo MorrowVersion = FileVersionInfo.GetVersionInfo ("Morrowind.exe");
                if (MorrowVersion.FileMajorPart != 1 || MorrowVersion.FileMinorPart < 6) {
                    MessageBox.Show (strings ["MWIncompat"], strings ["Error"]);
                    return;
                }
            } catch {
                MessageBox.Show (strings ["MWCorrupt"], strings ["Error"]);
                return;
            }

            runDir = System.Windows.Forms.Application.StartupPath;
            //check if MW registry keys exist
            if (Registry.LocalMachine.OpenSubKey (reg_mw) == null) {
                MessageBox.Show (strings ["MWRegistry"], strings ["Error"]);
                return;
            }

            //Create some structures
            for (int i = 0; i < MACROS; i++) {
                Macros [i] = new Macro ();
            }
            for (int i = 0; i < TRIGGERS; i++) {
                Triggers [i] = new Trigger ();
            }
            DXMain.GetDeviceCaps ();
            mf = new MainForm (autoLanguage);
            Application.Run (mf);
        }
Beispiel #9
0
 private void SaveGraphicsSettings()
 {
     INIFile iniFile = new INIFile (Statics.iniFileName, iniSettings, true);
     //Main
     iniFile.setKey ("Version", Statics.versionString);
     iniFile.setKey ("IipSpeed", cmbTipReadSpd.SelectedIndex);
     iniFile.setKey ("Language", cmbUILanguage.Text);
     iniFile.setKey ("AutoLang", cbUILangAuto.Checked);
     //MGE disabled
     iniFile.setKey ("DisableMGE", cbDisableMGE.Checked);
     //Global Graphics
     iniFile.setKey ("AntiAlias", cmbAntiAlias.SelectedIndex);
     iniFile.setKey ("ZBuffer", cmbZBuffer.SelectedIndex);
     iniFile.setKey ("VWait", cmbVWait.SelectedIndex);
     iniFile.setKey ("Refresh", cmbRefreshRate.Text);
     //Render State
     iniFile.setKey ("ScaleFilt", cmbScaleFilter.SelectedIndex);
     iniFile.setKey ("MipFilt", cmbMipFilter.SelectedIndex);
     iniFile.setKey ("AnisoLvl", cmbAnisoLevel.SelectedIndex);
     iniFile.setKey ("LODBias", (double)udLOD.Value);
     iniFile.setKey ("FogMode", cmbFogMode.SelectedIndex);
     iniFile.setKey ("InitZoom", (double)udZoom.Value);
     iniFile.setKey ("ScrRot", (double)udRotation.Value);
     iniFile.setKey ("FOV", (double)udFOV.Value);
     iniFile.setKey ("UseFog", cbFog.Checked);
     iniFile.setKey ("FPSCount", cbFPSCounter.Checked);
     iniFile.setKey ("Messages", cbDisplayMessages.Checked);
     iniFile.setKey ("MsgTime", (double)udMsgsTime.Value);
     iniFile.setKey ("HWShader", cbHWShader.Checked);
     iniFile.setKey("DisableShadersInMenu", cbDisableShadersInMenu.Checked);
     iniFile.setKey ("AAFix", cbAAFix.Checked);
     iniFile.setKey ("SSFormat", cmbSShotFormat.SelectedIndex);
     if (tbSShotDir.TextAlign == HorizontalAlignment.Left) iniFile.setKey ("SSDir", tbSShotDir.Text);
     else iniFile.setKey ("SSDir", "");
     iniFile.setKey ("SSName", tbSShotName.Text);
     iniFile.setKey ("SSNum", (double)udSShotNum.Value);
     //Input
     iniFile.setKey ("LagFix", cbLagFix.Checked);
     //Misc
     iniFile.setKey ("DisableMWSE", cbDisableMWSE.Checked);
     iniFile.setKey ("DisableMWE", cbDisableMWE.CheckState == CheckState.Checked);
     iniFile.setKey ("DisableIntegration", cbDisableIntegration.Checked);
     iniFile.setKey ("DisablePatch", cbDisablePatch.Checked);
     iniFile.setKey ("AffectUI", cbZoomEffectsHUD.Checked);
     iniFile.setKey ("AspectZoom", cbAspectZoom.Checked);
     iniFile.setKey ("HookTex", cbHook.Checked);
     iniFile.setKey ("ShaderVars", cbSetEffectVars.Checked);
     iniFile.setKey ("ShaderDepth", cbShaderDepth.Checked);
     iniFile.setKey ("UseHDR", cbHDR.Checked);
     iniFile.setKey ("HDRTime", (double)udHDR.Value);
     iniFile.setKey ("KeepFPS", cbFPSConst.Checked);
     iniFile.setKey ("FPSDesired", (double)udFPSDes.Value);
     iniFile.setKey ("FPSToler", (double)udFPSTol.Value);
     iniFile.setKey ("MaxMWView", (double)udMaxView.Value);
     iniFile.setKey ("MinMWView", (double)udMinView.Value);
     iniFile.setKey ("AIToMWView", cbBindAI.Checked);
     iniFile.setKey ("CPUIdle", cbIdle.Checked);
     iniFile.setKey ("IdleTime", (double)udIdle.Value);
     iniFile.setKey ("Cam3rdCustom", cbCam3rdPrsn.Checked);
     iniFile.setKey ("Cam3rdX", (double)udCam3rdX.Value);
     iniFile.setKey ("Cam3rdY", (double)udCam3rdY.Value);
     iniFile.setKey ("Cam3rdZ", (double)udCam3rdZ.Value);
     //Distant Land
     iniFile.setKey ("DistLand", cbDLDistantLand.Checked);
     iniFile.setKey ("DistStat", cbDLDistantStatics.Checked);
     iniFile.setKey ("DLShader", rbDLSM30.Checked ? 3 : 2);
     foreach (KeyValuePair<string, bool> v in DLOptions) iniFile.setKey (v.Key, v.Value);
     iniFile.setKey ("DrawDist", (double)udDLDrawDist.Value);
     iniFile.setKey ("AutoDist", cbDLAutoDist.Checked);
     int autoDistBy;
     if (rbDLAutoByAFogEnd.Checked) autoDistBy = 2;
     else autoDistBy = 1;
     iniFile.setKey ("AutoDistBy", autoDistBy);
     //iniFile.setKey ("DistBlur", (double)udDLBlur.Value);  //removed
     iniFile.setKey ("EndNear", (double)udDLDistNear.Value);
     iniFile.setKey ("EndFar", (double)udDLDistFar.Value);
     iniFile.setKey ("EndVFar", (double)udDLDistVeryFar.Value);
     iniFile.setKey ("SizeFar", (double)udDLSizeFar.Value);
     iniFile.setKey ("SizeVFar", (double)udDLSizeVeryFar.Value);
     iniFile.setKey ("ReflLand", cbDLReflLand.Checked);
     iniFile.setKey ("ReflNear", cbDLReflNStatics.Checked);
     iniFile.setKey ("ReflFar", cbDLReflFStatics.Checked);
     iniFile.setKey ("SkyRefl", cbDLSkyRefl.Checked);
     iniFile.setKey ("ReflBlur", cbDLReflBlur.Checked);
     iniFile.setKey ("DynRipples", cbDLDynRipples.Checked);
     iniFile.setKey ("WaveHght", (double)udDLWtrWave.Value);
     iniFile.setKey ("Caustics", (double)udDLWtrCaust.Value);
     iniFile.setKey ("AboveBeg", (double)udDLFogAStart.Value);
     iniFile.setKey ("AboveEnd", (double)udDLFogAEnd.Value);
     iniFile.setKey ("BelowBeg", (double)udDLFogBStart.Value);
     iniFile.setKey ("BelowEnd", (double)udDLFogBEnd.Value);
     iniFile.setKey ("InterBeg", (double)udDLFogIStart.Value);
     iniFile.setKey ("InterEnd", (double)udDLFogIEnd.Value);
     iniFile.setKey ("ExpFog", cbDLFogExp.Checked);
     iniFile.setKey ("DLExpMul", (double)udDLFogExpMul.Value);
     //Tools
     iniFile.setKey("PTreeWidth", (double)PatchTreeSize.Width);
     iniFile.setKey("PTreeHeight", (double)PatchTreeSize.Height);
     iniFile.setKey("PEditorWidth", (double)PatchEditorSize.Width);
     iniFile.setKey("PEditorHeight", (double)PatchEditorSize.Height);
     iniFile.setKey("PEditorBarW", (double)PatchEditorBars.Width);
     iniFile.setKey("PEditorBarH", (double)PatchEditorBars.Height);
     iniFile.save ();
     try {
         RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind, true);
         if (key != null) {
             key.SetValue ("Pixelshader", new byte [] { Convert.ToByte (!gbDistantLand.Enabled) });
             key.Close ();
         }
     } catch { }
 }
Beispiel #10
0
 private void LoadMWINI()
 {
     INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default);
     cbScreenshots.Checked = (mwini.getKeyValue ("SSEnable") == 1);
     cbThreadLoad.Checked = (mwini.getKeyValue ("NoThread") != 1);
     cbYesToAll.Checked = (mwini.getKeyValue ("YesToAll") == 1);
     cbHQShadows.Checked = (mwini.getKeyValue ("HDShadow") == 1);
     cbShowFPS.Checked = (mwini.getKeyValue ("ShowFPS") == 1);
     cbAudio.Checked = (mwini.getKeyValue ("AudioOff") == 1);
     cbSubtitles.Checked = (mwini.getKeyValue ("Subtitles") == 1);
     cbHitFader.Checked = (mwini.getKeyValue ("HitFader") == 1);
     cbMultipleCS.Checked = (mwini.getKeyValue ("MultiCS") == 1);
 }
Beispiel #11
0
 private void LoadGraphicsSettings(bool reset, bool save)
 {
     INIFile iniFile = new INIFile (reset ? Statics.fn_nul : Statics.iniFileName, iniSettings, true);
     if (reset) iniFile.fileName = Statics.iniFileName;
     else bCalcRefresh_Click (null, null);
     if (save) {
         iniFile.initialize ();
         iniFile.save ();
     }
     loading = true;
     //Main
     cmbTipReadSpd.SelectedIndex = (int)iniFile.getKeyValue ("IipSpeed");
     //Global Graphics
     cmbAntiAlias.SelectedIndex = (int)iniFile.getKeyValue ("AntiAlias");
     cmbZBuffer.SelectedIndex = (int)iniFile.getKeyValue ("ZBuffer");
     cmbVWait.SelectedIndex = (int)iniFile.getKeyValue ("VWait");
     cmbRefreshRate.SelectedIndex = cmbRefreshRate.FindStringExact (iniFile.getKeyValue ("Refresh").ToString ());
     if (cmbRefreshRate.SelectedIndex == -1) cmbRefreshRate.SelectedIndex = 0;
     //Render State
     cmbScaleFilter.SelectedIndex = (int)iniFile.getKeyValue ("ScaleFilt");
     cmbMipFilter.SelectedIndex = (int)iniFile.getKeyValue ("MipFilt");
     cmbAnisoLevel.SelectedIndex = (int)iniFile.getKeyValue ("AnisoLvl");
     udLOD.Value = (int)iniFile.getKeyValue ("LODBias");
     cmbFogMode.SelectedIndex = (int)iniFile.getKeyValue ("FogMode");
     udZoom.Value = (decimal)iniFile.getKeyValue ("InitZoom");
     udRotation.Value = (decimal)iniFile.getKeyValue ("ScrRot");
     udFOV.Value = (decimal)iniFile.getKeyValue ("FOV");
     cbFog.Checked = (iniFile.getKeyValue ("UseFog") == 1);
     cbFPSCounter.Checked = (iniFile.getKeyValue ("FPSCount") == 1);
     cbDisplayMessages.Checked = (iniFile.getKeyValue ("Messages") == 1);
     udMsgsTime.Value = (decimal)iniFile.getKeyValue ("MsgTime");
     cbHWShader.Checked = (iniFile.getKeyValue ("HWShader") == 1);
     cbDisableShadersInMenu.Checked = (iniFile.getKeyValue("DisableShadersInMenu") == 1);
     cbAAFix.Checked = (iniFile.getKeyValue ("AAFix") == 1);
     cmbSShotFormat.SelectedIndex = (int)iniFile.getKeyValue ("SSFormat");
     tbSShotDir.Text = iniFile.getKeyString ("SSDir");
     if (tbSShotDir.Text.Length == 0) bSSDirClear_Click (null, null);
     tbSShotName.Text = iniFile.getKeyString ("SSName");
     udSShotNum.Value = (decimal)iniFile.getKeyValue ("SSNum");
     //Input
     cbLagFix.Checked = (iniFile.getKeyValue ("LagFix") == 1);
     //Misc
     cbDisableMWSE.Checked = (iniFile.getKeyValue ("DisableMWSE") == 1);
     cbDisableMWE.CheckState = (iniFile.getKeyValue("DisableMWE") == 1) ? CheckState.Checked : File.Exists(Statics.fn_mwedll) ? CheckState.Unchecked : CheckState.Indeterminate;
     cbDisableIntegration.Checked = (iniFile.getKeyValue("DisableIntegration") == 1);
     cbDisablePatch.Checked = (iniFile.getKeyValue("DisablePatch") == 1);
     cbZoomEffectsHUD.Checked = (iniFile.getKeyValue ("AffectUI") == 1);
     cbAspectZoom.Checked = (iniFile.getKeyValue ("AspectZoom") == 1);
     cbHook.Checked = (iniFile.getKeyValue ("HookTex") == 1);
     cbSetEffectVars.Checked = (iniFile.getKeyValue ("ShaderVars") == 1);
     cbHDR.Checked = (iniFile.getKeyValue ("UseHDR") == 1);
     udHDR.Value = (decimal)iniFile.getKeyValue ("HDRTime");
     cbFPSConst.Checked = (iniFile.getKeyValue ("KeepFPS") == 1);
     udFPSDes.Value = (int)iniFile.getKeyValue ("FPSDesired");
     udFPSTol.Value = (int)iniFile.getKeyValue ("FPSToler");
     udMaxView.Value = (int)iniFile.getKeyValue ("MaxMWView");
     udMinView.Value = (int)iniFile.getKeyValue ("MinMWView");
     cbBindAI.Checked = (iniFile.getKeyValue ("AIToMWView") == 1);
     cbIdle.Checked = (iniFile.getKeyValue ("CPUIdle") == 1);
     udIdle.Value = (int)iniFile.getKeyValue ("IdleTime");
     cbShaderDepth.Checked = (iniFile.getKeyValue ("ShaderDepth") == 1);
     cbCam3rdPrsn.Checked = (iniFile.getKeyValue ("Cam3rdCustom") == 1);
     udCam3rdX.Value = (decimal)iniFile.getKeyValue ("Cam3rdX");
     udCam3rdY.Value = (decimal)iniFile.getKeyValue ("Cam3rdY");
     udCam3rdZ.Value = (decimal)iniFile.getKeyValue ("Cam3rdZ");
     //Distant Land
     cbDLDistantLand.Checked = (iniFile.getKeyValue ("DistLand") == 1);
     List<string> list = new List<string> (DLOptions.Keys);
     foreach (string key in list) DLOptions [key] = (iniFile.getKeyValue (key) == 1);
     cbDLDistantStatics.Checked = (iniFile.getKeyValue ("DistStat") == 1);
     udDLDrawDist.Value = (decimal)iniFile.getKeyValue ("DrawDist");
     //udDLBlur.Value = (int)iniFile.getKeyValue ("DistBlur");   //removed
     udDLDistNear.Value = (decimal)iniFile.getKeyValue ("EndNear");
     udDLDistFar.Value = (decimal)iniFile.getKeyValue ("EndFar");
     udDLDistVeryFar.Value = (int)iniFile.getKeyValue ("EndVFar");
     udDLSizeFar.Value = (decimal)iniFile.getKeyValue ("SizeFar");
     udDLSizeVeryFar.Value = (decimal)iniFile.getKeyValue ("SizeVFar");
     cbDLReflLand.Checked = (iniFile.getKeyValue ("ReflLand") == 1);
     cbDLReflNStatics.Checked = (iniFile.getKeyValue ("ReflNear") == 1);
     cbDLReflFStatics.Checked = (iniFile.getKeyValue ("ReflFar") == 1);
     udDLFogAStart.Value = (decimal)iniFile.getKeyValue ("AboveBeg");
     udDLFogAEnd.Value = (decimal)iniFile.getKeyValue ("AboveEnd");
     udDLFogBStart.Value = (decimal)iniFile.getKeyValue ("BelowBeg");
     udDLFogBEnd.Value = (decimal)iniFile.getKeyValue ("BelowEnd");
     udDLFogIStart.Value = (decimal)iniFile.getKeyValue ("InterBeg");
     udDLFogIEnd.Value = (decimal)iniFile.getKeyValue ("InterEnd");
     cbDLSkyRefl.Checked = (iniFile.getKeyValue ("SkyRefl") == 1);
     cbDLDynRipples.Checked = (iniFile.getKeyValue ("DynRipples") == 1);
     rbDLSM30.Checked = (iniFile.getKeyValue ("DLShader") == 3);
     cbDLReflBlur.Checked = (iniFile.getKeyValue ("ReflBlur") == 1);
     udDLFogExpMul.Value = (decimal)iniFile.getKeyValue ("DLExpMul");
     cbDLFogExp.Checked = (iniFile.getKeyValue ("ExpFog") == 1);
     udDLWtrWave.Value = (decimal)iniFile.getKeyValue ("WaveHght");
     udDLWtrCaust.Value = (decimal)iniFile.getKeyValue ("Caustics");
     int autoDistBy = (int)iniFile.getKeyValue ("AutoDistBy");
     rbDLAutoByDrawDist.Checked = (autoDistBy == 1);
     rbDLAutoByAFogEnd.Checked = (autoDistBy == 2);
     cbDLAutoDist.Checked = (iniFile.getKeyValue ("AutoDist") == 1);
     //MGE disabled
     cbDisableMGE.Checked = (iniFile.getKeyValue ("DisableMGE") == 1);
     //Tools
     PatchTreeSize.Width = (int)iniFile.getKeyValue("PTreeWidth");
     PatchTreeSize.Height = (int)iniFile.getKeyValue("PTreeHeight");
     PatchEditorSize.Width = (int)iniFile.getKeyValue("PEditorWidth");
     PatchEditorSize.Height = (int)iniFile.getKeyValue("PEditorHeight");
     PatchEditorBars.Width = (int)iniFile.getKeyValue("PEditorBarW");
     PatchEditorBars.Height = (int)iniFile.getKeyValue("PEditorBarH");
     loading = false;
 }
Beispiel #12
0
 private void bResetSettings_Click(object sender, EventArgs e)
 {
     bool delete = cbClearINI.Checked;
     DialogResult res = MessageBox.Show (String.Format (strings ["AskReset"].text, (delete ? strings ["ResetSaved"].text : "")), strings ["ResetAsk"].text, MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
     if (res == DialogResult.Yes) {
         LoadGraphicsSettings (true, delete);
         INIFile iniFile = new INIFile (Statics.iniFileName, DLWeatherForm.iniWeatherSettings, true);
         iniFile.reinitialize ();
         iniFile.save ();
         cbSkipMovie.Checked = false;
         cbConsole.Checked = false;
         cbClearINI.Checked = false;
         cbImportIni.Checked = false;
         cbAltCombat.Checked = false;
     }
 }
Beispiel #13
0
 /* Configuration methods */
 // loading all settings
 private void LoadSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string lastdir = Statics.fn_datafiles;
     for (int i = 0; i < pluginDirs.Count; i++ ) {
         if (String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(lastdir), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_statics), true, Statics.Culture) == 0 ||
             String.Compare(Path.GetFullPath(pluginDirs[i]), Path.GetFullPath(Statics.fn_datafiles), true, Statics.Culture) == 0)
             pluginDirs.RemoveAt(i--);
         else lastdir = pluginDirs[i];
     }
     pluginDirs.Insert(0, Statics.fn_statics);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs, preselectedPlugins);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatLowQualTextures.Checked = (iniFile.getKeyValue("LowQualTex") == 1);
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOldSimplification.Checked = (iniFile.getKeyValue("OldSimply") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }
Beispiel #14
0
 private void LoadGraphicsSettings(bool reset, bool save)
 {
     INIFile iniFile = new INIFile (reset ? Statics.fn_nul : Statics.iniFileName, iniSettings, true);
     if (reset)
         iniFile.fileName = Statics.iniFileName;
     else
         bCalcRefresh_Click (null, null);
     if (save) {
         iniFile.initialize ();
         iniFile.save ();
     }
     loading = true;
     // Config
     cmbTipReadSpd.SelectedIndex = (int)iniFile.getKeyValue ("IipSpeed");
     // Graphics
     cmbAntiAlias.SelectedIndex = (int)iniFile.getKeyValue ("AntiAlias");
     cmbVWait.SelectedIndex = (int)iniFile.getKeyValue ("VWait");
     cmbRefreshRate.SelectedIndex = cmbRefreshRate.FindStringExact (iniFile.getKeyValue ("Refresh").ToString ());
     if (cmbRefreshRate.SelectedIndex == -1) cmbRefreshRate.SelectedIndex = 0;
     cmbAnisoLevel.SelectedIndex = (int)iniFile.getKeyValue ("AnisoLvl");
     udLOD.Value = (decimal)iniFile.getKeyValue ("LODBias");
     cmbFogMode.SelectedIndex = (int)iniFile.getKeyValue ("FogMode");
     udFOV.Value = (decimal)iniFile.getKeyValue ("FOV");
     cbFPSCounter.Checked = (iniFile.getKeyValue ("FPSCount") == 1);
     cbDisplayMessages.Checked = (iniFile.getKeyValue ("Messages") == 1);
     udMsgsTime.Value = (decimal)iniFile.getKeyValue ("MsgTime");
     cbHWShader.Checked = (iniFile.getKeyValue ("HWShader") == 1);
     cmbSShotFormat.SelectedIndex = (int)iniFile.getKeyValue ("SSFormat");
     tbSShotDir.Text = iniFile.getKeyString ("SSDir");
     if (tbSShotDir.Text.Length == 0) bSSDirClear_Click (null, null);
     tbSShotName.Text = iniFile.getKeyString ("SSName");
     udSShotNum.Value = (decimal)iniFile.getKeyValue ("SSNum");
     // In-game
     cbDisableMGE.Checked = (iniFile.getKeyValue ("DisableMGE") == 1);
     cbDisableMWSE.Checked = (iniFile.getKeyValue ("DisableMWSE") == 1);
     udHDR.Value = (decimal)iniFile.getKeyValue ("HDRTime");
     cbCam3rdPrsn.Checked = (iniFile.getKeyValue ("Cam3rdCustom") == 1);
     udCam3rdX.Value = (decimal)iniFile.getKeyValue ("Cam3rdX");
     udCam3rdY.Value = (decimal)iniFile.getKeyValue ("Cam3rdY");
     udCam3rdZ.Value = (decimal)iniFile.getKeyValue ("Cam3rdZ");
     cbAutoCrosshair.Checked = (iniFile.getKeyValue ("AutoCrosshair") == 1);
     cbMenuCaching.Checked = (iniFile.getKeyValue ("MenuCaching") == 1);
     // Distant Land
     cbDLDistantLand.Checked = (iniFile.getKeyValue ("DistLand") == 1);
     cbDLDistantStatics.Checked = (iniFile.getKeyValue ("DistStat") == 1);
     udDLDrawDist.Value = (decimal)iniFile.getKeyValue ("DrawDist");
     udDLDistNear.Value = (decimal)iniFile.getKeyValue ("EndNear");
     udDLDistFar.Value = (decimal)iniFile.getKeyValue ("EndFar");
     udDLDistVeryFar.Value = (int)iniFile.getKeyValue ("EndVFar");
     udDLSizeFar.Value = (decimal)iniFile.getKeyValue ("SizeFar");
     udDLSizeVeryFar.Value = (decimal)iniFile.getKeyValue ("SizeVFar");
     cbDLReflLand.Checked = (iniFile.getKeyValue ("ReflLand") == 1);
     cbDLReflNStatics.Checked = (iniFile.getKeyValue ("ReflNear") == 1);
     cbDLReflInterior.Checked = (iniFile.getKeyValue ("ReflIntr") == 1);
     udDLFogAStart.Value = (decimal)iniFile.getKeyValue ("AboveBeg");
     udDLFogAEnd.Value = (decimal)iniFile.getKeyValue ("AboveEnd");
     udDLFogBStart.Value = (decimal)iniFile.getKeyValue ("BelowBeg");
     udDLFogBEnd.Value = (decimal)iniFile.getKeyValue ("BelowEnd");
     udDLFogIStart.Value = (decimal)iniFile.getKeyValue ("InterBeg");
     udDLFogIEnd.Value = (decimal)iniFile.getKeyValue ("InterEnd");
     cbDLSkyRefl.Checked = (iniFile.getKeyValue ("SkyRefl") == 1);
     cbDLDynRipples.Checked = (iniFile.getKeyValue ("DynRipples") == 1);
     cbDLReflBlur.Checked = (iniFile.getKeyValue ("ReflBlur") == 1);
     udDLFogExpMul.Value = (decimal)iniFile.getKeyValue ("DLExpMul");
     cbDLFogExp.Checked = (iniFile.getKeyValue ("ExpFog") == 1);
     cbDLScattering.Checked = (iniFile.getKeyValue ("Scatter") == 1);
     udDLWtrWave.Value = (decimal)iniFile.getKeyValue ("WaveHght");
     udDLWtrCaust.Value = (decimal)iniFile.getKeyValue ("Caustics");
     int autoDistBy = (int)iniFile.getKeyValue ("AutoDistBy");
     rbDLAutoByDrawDist.Checked = (autoDistBy == 1);
     rbDLAutoByAFogEnd.Checked = (autoDistBy == 2);
     cbDLAutoDist.Checked = (iniFile.getKeyValue ("AutoDist") == 1);
     cbDLSunShadows.Checked = (iniFile.getKeyValue ("SunShadows") == 1);
     cbPerPixelLighting.Checked = (iniFile.getKeyValue ("PPLighting") == 1);
     loading = false;
 }
Beispiel #15
0
 private void SaveMWINI()
 {
     INIFile mwini = new INIFile (Statics.fn_mwini, mwSettings, System.Text.Encoding.Default, true);
     mwini.setKey ("SSEnable", cbScreenshots.Checked);
     mwini.setKey ("NoThread", !cbThreadLoad.Checked);
     mwini.setKey ("YesToAll", cbYesToAll.Checked);
     mwini.setKey ("HDShadow", cbHQShadows.Checked);
     mwini.setKey ("ShowFPS", cbShowFPS.Checked);
     mwini.setKey ("AudioOff", cbAudio.Checked);
     mwini.setKey ("Subtitles", cbSubtitles.Checked);
     mwini.setKey ("HitFader", cbHitFader.Checked);
     mwini.setKey ("MultiCS", cbMultipleCS.Checked);
     mwini.save ();
 }
Beispiel #16
0
        private void bSave_Click(object sender,EventArgs e)
        {
            INIFile iniFile = new INIFile(Statics.iniFileName, iniShaderWhat, true);
            List<string> tempList = new List<string>();
            foreach (string s in lbSelected.Items) tempList.Add(s);
            iniFile.setSectOrderedList(iniShaderChain, tempList.ToArray());
            iniFile.save();

            Close();
        }
Beispiel #17
0
 private void bSave_Click(object sender, EventArgs e)
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniWeatherSettings, true);
     iniFile.initialize();
     foreach (Control ctl in this.Controls["gbWind"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     foreach (Control ctl in this.Controls["gbFogDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         iniFile.setKey(ud.Name.Substring(2), (double)ud.Value);
     }
     iniFile.save();
     Close();
 }
Beispiel #18
0
        public static void Main(string[] sargs)
        {
            Thread.CurrentThread.CurrentUICulture = Culture;
            CommandArgs args = new CommandArgs (sargs);

            if (args.styles) Application.EnableVisualStyles ();

            // Damn .NET text rendering
            Application.SetCompatibleTextRenderingDefault(false);

            Directory.SetCurrentDirectory (System.IO.Path.GetDirectoryName (Application.ExecutablePath));

            Localizations = new LocalizationInterface ();
            try {
                string [] langfiles = Directory.GetFiles ("MGE3", "*.lng");
                foreach (string langfile in langfiles) {
                    Localizations.Add (langfile);
                }
            } catch { };
            Localizations.Add(new LocalizationInterface.Localization((Form)null));    // Adds truncated variant of default localization.
            String language = DefaultLocalization.Language;
            bool autoLanguage = true;
            try {
                INIFile MGEini = new INIFile (iniFileName, new INIFile.INIVariableDef [] { INIFile.iniDefEmpty, MainForm.iniLanguage, MainForm.iniAutoLang });
                language = MGEini.getKeyString ("Language");
                autoLanguage = (MGEini.getKeyValue ("AutoLang") == 1);
            } catch { }
            Localizations.Current = language;
            Localizations.ApplyStrings("", strings);

            if (args.mutex && !MutexCheck.PerformCheck ()) {
                MessageBox.Show (strings ["MGEguiRunning"], strings ["Error"]);
                return;
            }
            Process [] morrowind = Process.GetProcessesByName ("Morrowind");
            foreach (Process p in morrowind) {
                MessageBox.Show (strings ["MWRunning"], strings ["Error"]);
                return;
            }

            if (!File.Exists ("./morrowind.exe") || !File.Exists ("./morrowind.ini") || !Directory.Exists ("data files")) {
                MessageBox.Show (strings ["NotMWDir"], strings ["Error"]);
                return;
            }
            if (!Directory.Exists ("MGE3") || !File.Exists ("./MGE3/MGEfuncs.dll") || !File.Exists ("./d3d8.dll") ||
               !File.Exists ("./dinput8.dll")) {
                MessageBox.Show (strings ["MGEMissing"], strings ["Error"]);
                return;
            }
            //Morrowind version info
            try {
                FileVersionInfo MorrowVersion = FileVersionInfo.GetVersionInfo ("Morrowind.exe");
                if (MorrowVersion.ProductPrivatePart != 722 && MorrowVersion.ProductPrivatePart != 1029 && MorrowVersion.ProductPrivatePart != 1875 && MorrowVersion.ProductPrivatePart != 1820)
                {
                    MessageBox.Show (strings ["MWIncompat"], strings ["Error"]);
                    return;
                }
            } catch {
                MessageBox.Show (strings ["MWCorrupt"], strings ["Error"]);
                return;
            }
            //Check for dsound.dll
            if (File.Exists ("dsound.dll") && new System.IO.FileInfo ("dsound.dll").Length == 16384) {
                try {
                    File.Delete ("dsound.dll");
                } catch {
                    MessageBox.Show (strings ["DSound"], strings ["Error"]);
                    return;
                }
            }

            runDir = System.Windows.Forms.Application.StartupPath;
            //check if MW registry keys exist
            RegistryKey key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind);
            if (key != null) { key.Close(); key = null;
            } else {
                MessageBox.Show (strings ["MWRegistry"], strings ["Error"]);
                return;
            }

            //mendres: Check if MGE needs administrator privileges.
            try {
                key = Statics.reg_key_bethesda.OpenSubKey(Statics.reg_morrowind, true);
            } catch (System.Security.SecurityException) {
                MessageBox.Show(strings["MgeAccess"], strings["Error"]);
                return;
            }
            if (key != null) { key.Close(); key = null; }

            //Create the data files directories MGE uses
            if (!Directory.Exists (@"data files\shaders")) {
                Directory.CreateDirectory (@"data files\shaders");
            }
            if (!Directory.Exists (@"data files\MGE meshes")) {
                Directory.CreateDirectory (@"data files\MGE meshes");
            }
            if (!Directory.Exists (@"data files\Textures\MGE")) {
                Directory.CreateDirectory (@"data files\Textures\MGE");
            }
            if (!Directory.Exists (@"data files\MGE videos")) {
                Directory.CreateDirectory (@"data files\MGE videos");
            }
            if (!Directory.Exists (@"data files\shaders\default")) {
                Directory.CreateDirectory (@"data files\shaders\default");
            }
            if (!Directory.Exists (@"data files\shaders\water")) {
                Directory.CreateDirectory (@"data files\shaders\water");
            }
            //Create some structures
            for (int i = 0; i < MACROS; i++) {
                Macros [i] = new Macro ();
            }
            for (int i = 0; i < TRIGGERS; i++) {
                Triggers [i] = new Trigger ();
            }
            DXMain.GetDeviceCaps ();
            bool GUIchecker = !lightversion;
            while (GUIchecker != lightversion) {
                GUIchecker = lightversion;
                if (lightversion) {
                    mfl = new MainFormLight(autoLanguage);
                    Application.Run(mfl);
                } else {
                    mf = new MainForm (autoLanguage);
                    Application.Run (mf);
                }
            }
        }
Beispiel #19
0
 private void LoadSettings()
 {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniWeatherSettings);
     foreach (Control ctl in this.Controls["gbWind"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2));
     }
     foreach (Control ctl in this.Controls["gbFogDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2));
     }
     foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         ud.Value = (decimal)iniFile.getKeyValue(ud.Name.Substring(2));
     }
     iniFile = new INIFile("NUL", iniWeatherSettings);
     foreach (Control ctl in this.Controls["gbWind"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         string s = ud.Name.Substring(2);
         defaults.Add(s, (float)iniFile.getKeyValue(s));
     }
     foreach (Control ctl in this.Controls["gbFogDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         string s = ud.Name.Substring(2);
         defaults.Add(s, (float)iniFile.getKeyValue(s));
     }
     foreach (Control ctl in this.Controls["gbFogOffsDay"].Controls) {
         if (ctl.Name.Substring(0, 2) != "ud") continue;
         NumericUpDown ud = (NumericUpDown)ctl;
         string s = ud.Name.Substring(2);
         defaults.Add(s, (float)iniFile.getKeyValue(s));
     }
 }
Beispiel #20
0
 /* Configuration methods */
 
 // loading all settings
 private void LoadSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniDLWizardVars, true);
     configure = !iniFile.hasSection(iniDLWizardSets);
     if (configure) {
         iniFile.initialize();
         iniFile.save();
     }
     pluginDirs = new List<string>(iniFile.getSectList(iniDLWizardPlugDirs));
     pluginDirs.Sort();
     string dir2 = "";
     foreach (string s in pluginDirs) {
         string dir1 = s.ToLower(Statics.Culture);
         if (dir1 == dir2) pluginDirs.Remove(s);
         dir2 = dir1;
     }
     pluginList = new MWPlugins(Statics.fn_datafiles, pluginDirs);
     switch ((int)iniFile.getKeyValue("PlugSort")) {
         case 0: rbPlugsName.Checked = true; break;
         case 1: rbPlugsType.Checked = true; break;
         case 2: rbPlugsLoad.Checked = true; break;
     }
     pluginsSort(null, null);
     preselectedPlugins = iniFile.getSectList(iniDLWizardPlugs);
     SelectPlugins(preselectedPlugins);
     cmbTexWorldResolution.SelectedIndex = (int)iniFile.getKeyValue("TexRes");
     cmbTexWorldNormalRes.SelectedIndex = (int)iniFile.getKeyValue("NormRes");
     cbTexTwoStep.Checked = (iniFile.getKeyValue("Tex2Step") == 1);
     cmbMeshWorldDetail.SelectedIndex = (int)iniFile.getKeyValue("WorldMesh");
     udStatMinSize.Value = (int)iniFile.getKeyValue("MinStat");
     udStatGrassDensity.Value = (int)iniFile.getKeyValue("GrassDens");
     cmbStatSimplifyMeshes.SelectedIndex = (int)iniFile.getKeyValue("StatMesh");
     cmbStatSkipMipLevels.SelectedIndex = (int)iniFile.getKeyValue("SkipMip");
     cbStatActivators.Checked = (iniFile.getKeyValue("Activators") == 1);
     cbStatIncludeMisc.Checked = (iniFile.getKeyValue("MiscObj") == 1);
     cbStatOverrideList.Checked = (iniFile.getKeyValue("UseStatOvr") == 1);
     cbStatIntExt.Checked = (iniFile.getKeyValue("StatIntExt") == 1);
     cbStatIntWater.Checked = (iniFile.getKeyValue("StatIntWater") == 1);
     lbStatOverrideList.Items.Clear();
     lbStatOverrideList.Items.AddRange(iniFile.getSectList(iniDLWizardStatOvr));
     lStatOverrideList.Enabled = (lbStatOverrideList.Items.Count == 0);
 }
Beispiel #21
0
 public Localization(string fileName)
 {
     FileName = fileName;
     langFile = new INIFile (fileName, langINI);
     Language = langFile.getKeyString (entLang);
     Translator = langFile.getKeyString (entTtor);
 }
Beispiel #22
0
 // saving settings after land texture creation
 private void SaveTexSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniTexTab, true);
     iniFile.setKey("TexRes", cmbTexWorldResolution.SelectedIndex);
     iniFile.setKey("NormRes", cmbTexWorldNormalRes.SelectedIndex);
     iniFile.setKey("Tex2Step", cbTexTwoStep.Checked);
     iniFile.save();
 }
Beispiel #23
0
        private void LoadMWINI()
        {
            INIFile mwini = new INIFile(Statics.fn_mwini, mwSettings, System.Text.Encoding.Default);

            // Clamp to 120fps maximum
            double fpslimit = Math.Min(mwini.getKeyValue("FPSLimit"), 120.0);
            udFPSLimit.Value = new Decimal(fpslimit);

            cbScreenshots.Checked = (mwini.getKeyValue("SSEnable") == 1);
            cbThreadLoad.Checked = (mwini.getKeyValue("NoThread") != 1);
            cbYesToAll.Checked = (mwini.getKeyValue("YesToAll") == 1);
            cbHQShadows.Checked = (mwini.getKeyValue("HDShadow") == 1);
            cbShowFPS.Checked = (mwini.getKeyValue("ShowFPS") == 1);
            cbAudio.Checked = (mwini.getKeyValue("AudioOff") == 1);
            cbSubtitles.Checked = (mwini.getKeyValue("Subtitles") == 1);
            cbHitFader.Checked = (mwini.getKeyValue("HitFader") == 1);

            if(mwini.getKeyValue("UseConstant") == 1)
                udLightingConst.Value =  new Decimal(mwini.getKeyValue("ConstantValue"));
            if(mwini.getKeyValue("UseLinear") == 1)
                udLightingLinear.Value =  new Decimal(mwini.getKeyValue("LinearValue"));
            if(mwini.getKeyValue("UseQuadratic") == 1)
                udLightingQuad.Value =  new Decimal(mwini.getKeyValue("QuadraticValue"));
        }
Beispiel #24
0
 // saving settings after statics creation
 private void SaveStatSettings() {
     INIFile iniFile = new INIFile(Statics.iniFileName, iniStatTab, true);
     iniFile.setKey("MinStat", (double)udStatMinSize.Value);
     iniFile.setKey("GrassDens", (double)udStatGrassDensity.Value);
     iniFile.setKey("StatMesh", cmbStatSimplifyMeshes.SelectedIndex);
     iniFile.setKey("SkipMip", cmbStatSkipMipLevels.SelectedIndex);
     iniFile.setKey("Activators", cbStatActivators.Checked);
     iniFile.setKey("MiscObj", cbStatIncludeMisc.Checked);
     iniFile.setKey("UseStatOvr", cbStatOverrideList.Checked);
     iniFile.setKey("StatIntExt", cbStatIntExt.Checked);
     iniFile.setKey("StatIntWater", cbStatIntWater.Checked);
     List<string> tempList = new List<string>();
     foreach (string s in lbStatOverrideList.Items) tempList.Add(s);
     iniFile.setSectOrderedList(iniDLWizardStatOvr, tempList.ToArray());
     iniFile.save();
 }
            /// <summary>
            /// Default Localization
            /// </summary>
            public Localization(Form form)
            {
                FileName = "";
                List<INIFile.INIVariableDef> lang = new List<INIFile.INIVariableDef>(langINI);
                lang.AddRange(AddVariableDef(DefaultLocalization._Strings, DefaultLocalization.__Strings));
                lang.AddRange(AddVariableDef(DefaultLocalization.MainForm_Strings, DefaultLocalization._MainForm_Strings));

                if(form != null) {
                    Dictionary<String, String> default_text = new Dictionary<String, String>();
                    Control [] controls = Statics.GetChildControls (form);
                    foreach (Control control in controls) {
                        if (!(control is ComboBox || control is TextBox || control is NumericUpDown) || control.Name == "tbSShotDir") if (!default_text.ContainsValue(control.Name)) default_text.Add(control.Name, control.Text);
                    }
                    lang.AddRange(AddVariableDef("MainForm.Text", default_text));
                }

                lang.AddRange(AddVariableDef(DefaultLocalization.MainForm_ToolTips, DefaultLocalization._MainForm_ToolTips));
                INIFile langFile = new INIFile(lang.ToArray());
                Language = DefaultLocalization.Language;
                Translator = "";
                langFiles.Add(langFile);
            }