Ejemplo n.º 1
0
        public Boolean saveSettings(
            int width,
            int height,
            Boolean unitActionLines,
            Boolean tooltips,
            Boolean videoWindowed,
            bool Backbuffer,
            Boolean Intro,
            bool CD,
            Boolean musicRepeat,
            Boolean musicShuffle,
            Double musicVolume,
            Double voiceVolume,
            Double soundVolume,
            int DragDistance,
            bool _GP_IEddraw,
            bool _GP_ddwrapper,
            bool _GP_NoVideoMemory,
            bool _GP_FakeVsync,
            bool ddEmulation,
            int dxEmulationType,
            bool _GP_TSDDraw,
            bool _GP_dxwnd,
            bool _GP_DxWndEnabled,
            bool _GP_DxWndWindow,
            bool _GP_DxWndWindowFrame,
            bool dxDDEmulation,
            bool procAffinity,
            WWColor[] ColorOverrides,
            Boolean OverrideColors,
            Boolean OnlyRightClickDeselect,
            Boolean DisableAltTab,
            Boolean DisableEdgeScrolling,
            Boolean IntegrateMumble,
            int TextBackgroundColor
            )
        {
            Boolean allOk = true;

            // INI SETTINGS
            SUN_ini.setIntValue("Video", "ScreenWidth", width, false);
            SUN_ini.setIntValue("Video", "ScreenHeight", height, false);

            SUN_ini.setBoolValue("Options", "UnitActionLines", unitActionLines);
            SUN_ini.setBoolValue("Intro", "PlaySide00", Intro);
            SUN_ini.setBoolValue("Video", "Video.Windowed", videoWindowed);
            SUN_ini.setBoolValue("Video", "UseGraphicsPatch", Backbuffer);
            SUN_ini.setBoolValue("Options", "NoCD", CD);
            SUN_ini.setBoolValue("Options", "SingleProcAffinity", procAffinity);

            SUN_ini.setBoolValue("Options", "ToolTips", tooltips);
            SUN_ini.setBoolValue("Audio", "IsScoreRepeat", musicRepeat);
            SUN_ini.setBoolValue("Audio", "IsScoreShuffle", musicShuffle);
            SUN_ini.setFloatValue("Audio", "ScoreVolume", musicVolume, 6);
            SUN_ini.setFloatValue("Audio", "VoiceVolume", voiceVolume, 6);
            SUN_ini.setFloatValue("Audio", "SoundVolume", soundVolume, 6);
            SUN_ini.setIntValue("Options", "DragDistance", DragDistance, false);

            /* mpHandle = setDefaultName(mpHandle);
             * SUN_ini.setStringValue("MultiPlayer","Handle", mpHandle); */

            SUN_ini.setIntValue("Video", "ScreenWidth", width, false);
            SUN_ini.setIntValue("Video", "ScreenHeight", height, false);

            for (int i = 0; i < ColorOverrides.Length; i++)
            {
                if (ColorOverrides[i] != null)
                {
                    SUN_ini.setIntValue("ColorOverrides", string.Format("Color{0}", i), ColorOverrides[i].Index);
                }
            }

            SUN_ini.setIntValue("Options", "TextBackgroundColor", TextBackgroundColor);
            SUN_ini.setBoolValue("Options", "OverrideColors", OverrideColors);
            SUN_ini.setBoolValue("Options", "OnlyRightClickDeselect", OnlyRightClickDeselect);
            SUN_ini.setBoolValue("Options", "DisableAltTab", DisableAltTab);
            SUN_ini.setBoolValue("Options", "DisableEdgeScrolling", DisableEdgeScrolling);
            SUN_ini.setBoolValue("Options", "IntegrateMumble", IntegrateMumble);

            if (!File.Exists(ProgramConstants.gamepath + ProgramConstants.GAME_SETTINGS))
            {
                GameFileManagement.WriteSunIni();
            }

            ddwrapperCfg.setBoolValue("ddraw", "NoVideoMemory", _GP_NoVideoMemory);
            ddwrapperCfg.setBoolValue("ddraw", "FakeVsync", _GP_FakeVsync);
            ddwrapperCfg.setBoolValue("ddraw", "ForceDirectDrawEmulation", ddEmulation);

            if (!File.Exists(ProgramConstants.gamepath + ProgramConstants.DDWRAPPER_SETTINGS))
            {
                GameFileManagement.WriteddwrapperCfg();
            }

            dxwnd_ini.setBoolValue("DxWnd", "NoWindowFrame", _GP_DxWndWindowFrame);
            dxwnd_ini.setBoolValue("DxWnd", "Enabled", _GP_DxWndEnabled);
            dxwnd_ini.setBoolValue("DxWnd", "RunInWindow", _GP_DxWndWindow);
            dxwnd_ini.setBoolValue("DxWnd", "ForceDirectDrawEmulation", dxDDEmulation);
            dxwnd_ini.setIntValue("DxWnd", "Emulation", dxEmulationType);

            if (!File.Exists(ProgramConstants.gamepath + ProgramConstants.DXWND_SETTINGS))
            {
                GameFileManagement.Writedxwnd_ini();
            }

            allOk &= SUN_ini.writeIni() && ddwrapperCfg.writeIni() && dxwnd_ini.writeIni();

            /* DLL SETTINGS */

            string _DDrawDll       = ProgramConstants.gamepath + "ddraw.dll";
            string _libwineDll     = ProgramConstants.gamepath + "libwine.dll";
            string _wined3dDll     = ProgramConstants.gamepath + "wined3d.dll";
            string _dxwndDll       = ProgramConstants.gamepath + "dxwnd.dll";
            string _dxwnd_ddrawDll = ProgramConstants.gamepath + "ddraw.dll";

            try
            {
                if (File.Exists(_DDrawDll))
                {
                    File.Delete(_DDrawDll);
                }
                if (File.Exists(_libwineDll))
                {
                    File.Delete(_libwineDll);
                }
                if (File.Exists(_wined3dDll))
                {
                    File.Delete(_wined3dDll);
                }
                if (File.Exists(_dxwndDll))
                {
                    File.Delete(_dxwndDll);
                }
                if (File.Exists(_dxwnd_ddrawDll))
                {
                    File.Delete(_dxwnd_ddrawDll);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                allOk = false;
            }

            if (_GP_dxwnd)
            {
                try
                {
                    File.WriteAllBytes(_dxwnd_ddrawDll, tsconfig.Properties.Resources.dxwnd_ddraw);
                    File.WriteAllBytes(_dxwndDll, tsconfig.Properties.Resources.dxwnd);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    allOk = false;
                }
            }


            if (_GP_ddwrapper)
            {
                try
                {
                    File.WriteAllBytes(_DDrawDll, tsconfig.Properties.Resources.ddwrapper);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    allOk = false;
                }
            }


            if (_GP_TSDDraw)
            {
                try
                {
                    File.WriteAllBytes(_DDrawDll, tsconfig.Properties.Resources.tsddraw);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    allOk = false;
                }
            }

            else if (_GP_IEddraw)
            {
                try
                {
                    File.WriteAllBytes(_DDrawDll, tsconfig.Properties.Resources.ddraw);
                    File.WriteAllBytes(_libwineDll, tsconfig.Properties.Resources.libwine);
                    File.WriteAllBytes(_wined3dDll, tsconfig.Properties.Resources.wined3d);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    allOk = false;
                }
            }

            return(allOk);
        }
Ejemplo n.º 2
0
        public Boolean saveSettings(
            Boolean unitActionLines,
            Boolean tooltips,
            bool Backbuffer,
            Boolean Intro,
            bool CD,
            Boolean musicRepeat,
            Boolean musicShuffle,
            Double musicVolume,
            Double voiceVolume,
            Double soundVolume,
            int DragDistance,
            bool procAffinity,
            WWColor[] ColorOverrides,
            Boolean OverrideColors,
            Boolean OnlyRightClickDeselect,
            Boolean DisableAltTab,
            Boolean DisableEdgeScrolling,
            int TextBackgroundColor
            )
        {
            Boolean allOk = true;

            // INI SETTINGS
            SUN_ini.setBoolValue("Options", "UnitActionLines", unitActionLines);
            SUN_ini.setBoolValue("Intro", "PlaySide00", Intro);
            SUN_ini.setBoolValue("Video", "UseGraphicsPatch", Backbuffer);
            SUN_ini.setBoolValue("Options", "NoCD", CD);
            SUN_ini.setBoolValue("Options", "SingleProcAffinity", procAffinity);

            SUN_ini.setBoolValue("Options", "ToolTips", tooltips);
            SUN_ini.setBoolValue("Audio", "IsScoreRepeat", musicRepeat);
            SUN_ini.setBoolValue("Audio", "IsScoreShuffle", musicShuffle);
            SUN_ini.setFloatValue("Audio", "ScoreVolume", musicVolume, 6);
            SUN_ini.setFloatValue("Audio", "VoiceVolume", voiceVolume, 6);
            SUN_ini.setFloatValue("Audio", "SoundVolume", soundVolume, 6);
            SUN_ini.setIntValue("Options", "DragDistance", DragDistance, false);

            /* mpHandle = setDefaultName(mpHandle);
             * SUN_ini.setStringValue("MultiPlayer","Handle", mpHandle); */

            for (int i = 0; i < ColorOverrides.Length; i++)
            {
                if (ColorOverrides[i] != null)
                {
                    SUN_ini.setIntValue("ColorOverrides", string.Format("Color{0}", i), ColorOverrides[i].Index);
                }
            }

            SUN_ini.setIntValue("Options", "TextBackgroundColor", TextBackgroundColor);
            SUN_ini.setBoolValue("Options", "OverrideColors", OverrideColors);
            SUN_ini.setBoolValue("Options", "OnlyRightClickDeselect", OnlyRightClickDeselect);
            SUN_ini.setBoolValue("Options", "DisableAltTab", DisableAltTab);
            SUN_ini.setBoolValue("Options", "DisableEdgeScrolling", DisableEdgeScrolling);

            if (!File.Exists(ProgramConstants.gamepath + ProgramConstants.GAME_SETTINGS))
            {
                GameFileManagement.WriteSunIni();
            }

            allOk &= SUN_ini.writeIni();

            return(allOk);
        }