Пример #1
0
        internal void WriteToConfig(CfgLauncher cfg)
        {
            char[] spaceDelim = new char[] { ' ' };

            cfg.RememberChanges = this.checkBoxRemeber.Checked;

            cfg.GamePath = this.textBoxExe.Text;

            if (this.comboBoxModSel.SelectedIndex == this.comboBoxModSel.Items.Count - 1)
            {
                cfg.Modification = this.textBoxCustMod.Text;
            }
            else
            {
                cfg.Modification = this.comboBoxModSel.Text.Split(spaceDelim, 2)[0];
            }

            cfg.CustomCmdLine = this.textBoxCmdAdd.Text;
            cfg.GfxForce      = this.checkBoxResForce.Checked;
            UInt16.TryParse(this.textBoxResWidth.Text, out cfg.GfxWidth);
            UInt16.TryParse(this.textBoxResHeight.Text, out cfg.GfxHeight);
            Byte.TryParse(this.comboBoxResDepth.Text.Split(spaceDelim, 2)[0], out cfg.GfxBpp);

            // Advanced Settings:
            cfg.ForceAlpha         = this.checkBoxForceAlpha.Checked;
            cfg.OptimizeDesktopRes = this.checkBoxDesktopRes.Checked;
            cfg.OptimizeVisibilty  = this.checkBoxVisbility.Checked;
            cfg.RenderMode         = (byte)this.comboBoxRenderMode.SelectedIndex;
            cfg.FullScreen         = this.checkBoxFullScreen.Checked;
        }
Пример #2
0
        internal void WriteToConfig(CfgLauncher cfg)
        {
            char[] spaceDelim = new char[] { ' ' };

	        cfg.RememberChanges = this.checkBoxRemeber.Checked;

	        cfg.GamePath = this.textBoxExe.Text;

	        if( this.comboBoxModSel.SelectedIndex ==  this.comboBoxModSel.Items.Count-1)
	        {
		        cfg.Modification = this.textBoxCustMod.Text;
	        } else {
                cfg.Modification = this.comboBoxModSel.Text.Split(spaceDelim, 2)[0];
	        }

	        cfg.CustomCmdLine = this.textBoxCmdAdd.Text;
	        cfg.GfxForce = this.checkBoxResForce.Checked;
	        UInt16.TryParse( this.textBoxResWidth.Text, out cfg.GfxWidth );
	        UInt16.TryParse( this.textBoxResHeight.Text, out cfg.GfxHeight );
            Byte.TryParse(this.comboBoxResDepth.Text.Split(spaceDelim, 2)[0], out cfg.GfxBpp);

	        // Advanced Settings:
	        cfg.ForceAlpha = this.checkBoxForceAlpha.Checked;
	        cfg.OptimizeDesktopRes = this.checkBoxDesktopRes.Checked;
	        cfg.OptimizeVisibilty = this.checkBoxVisbility.Checked;
	        cfg.RenderMode = (byte)this.comboBoxRenderMode.SelectedIndex;
	        cfg.FullScreen = this.checkBoxFullScreen.Checked;
        }
Пример #3
0
        public CfgSettings()
        {
            LauncherCsgo = new CfgLauncherCsgo();
            Launcher     = new CfgLauncher();
            CustomLoader = new CfgCustomLoader();
            DemoTools    = new CfgDemoTools();

            ThisDefault();
        }
Пример #4
0
        public static bool Launch(CfgLauncher cfg)
        {
            String cmds, s1;

            //
            //	build parameters:

            cmds = "-steam -gl";

            cmds += " -game " + cfg.Modification;

            // gfx settings

            cmds += " -nofbo";

            cmds += cfg.FullScreen ? " -full -stretchaspect" : " -window";

            s1 = cfg.GfxBpp.ToString();
            if (0 < s1.Length) cmds += " -" + s1 + "bpp";

            s1 = cfg.GfxWidth.ToString();
            if (0 < s1.Length) cmds += " -w " + s1;

            s1 = cfg.GfxHeight.ToString();
            if (0 < s1.Length) cmds += " -h " + s1;

            if (cfg.GfxForce) cmds += " -forceres";

            // advanced

            s1 = "standard";
            switch(cfg.RenderMode)
            {
                case 1: s1 = "fBO"; break;
                case 2: s1 = "memoryDC"; break;
            }
            cmds += " -afxRenderMode " + s1;

            cmds += " -afxForceAlpha8 " + (cfg.ForceAlpha ? 1 : 0).ToString();

            cmds += " -afxOptimizeCaptureVis " + (cfg.OptimizeVisibilty ? 1 : 0).ToString();

            // custom command line

            s1 = cfg.CustomCmdLine;
            if (0 < s1.Length)
                cmds += " " + s1;

            //
            // Launch:

            return Loader.Load(GetHookPath, cfg.GamePath, cmds);
        }
Пример #5
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            GlobalUpdateCheck.Instance.BeginCheckedNotification(m_UpdateCheckNotification);

            if (0 < GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.menuAutoUpdateCheck.Checked = true;
                StartUpdateCheck();
            }
            else if (0 == GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.stripEnableUpdateCheck.Visible = true;
            }

            // init AfxGoldSrc:
            m_AfxGoldSrc = new Afx.AfxGoldSrc(this);

            // start up public remoting system (if requested):
            if (Globals.EnableHlaeRemote)
            {
                m_HlaeRemoting = new hlae.remoting.HlaeRemoting(this);
            }

            // start-up CS:GO if requested (i.e. by command line)
            if (Globals.AutoStartCsgo)
            {
                LaunchCsgo.Launch(GlobalConfig.Instance.Settings.LauncherCsgo);
            }

            // start-up AfxHookGoldSrc if requested (i.e. by command line)
            if (Globals.AutoStartAfxHookGoldSrc)
            {
                CfgLauncher cfg = new CfgLauncher();

                cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

                Afx.AfxGoldSrc.StartSettings settings = cfg.MakeStartSettings();

                m_AfxGoldSrc.Start(settings);
            }

            // start-up CustomLoader if requested (i.e. by command line)
            if (Globals.AutoStartCustomLoader)
            {
                bool bOk = AfxCppCli.AfxHook.LauchAndHook(GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine, GlobalConfig.Instance.Settings.CustomLoader.HookDllPath);

                if (!bOk)
                {
                    MessageBox.Show("CustomLoader failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #6
0
        internal void ReadFromConfig(CfgLauncher cfg)
        {
            this.checkBoxRemeber.Checked = cfg.RememberChanges;
            this.textBoxExe.Text         = cfg.GamePath;

            int iInd = -1;

            for (int i = 0; i < this.comboBoxModSel.Items.Count; i++)
            {
                String stext = this.comboBoxModSel.Items[i].ToString();
                stext = stext.Split(new char[] { ' ' }, 2)[0];

                if (0 == String.Compare(stext, cfg.Modification))
                {
                    iInd = i;
                    break;
                }
            }

            if (iInd < 0 || iInd >= this.comboBoxModSel.Items.Count - 1)
            {
                this.textBoxCustMod.Enabled       = true;
                this.comboBoxModSel.SelectedIndex = this.comboBoxModSel.Items.Count - 1;
                this.textBoxCustMod.Text          = cfg.Modification;
            }
            else
            {
                this.textBoxCustMod.Enabled       = false;
                this.comboBoxModSel.SelectedIndex = iInd;
            }

            this.textBoxCmdAdd.Text       = cfg.CustomCmdLine;
            this.checkBoxResForce.Checked = cfg.GfxForce;
            this.textBoxResWidth.Text     = cfg.GfxWidth.ToString();
            this.textBoxResHeight.Text    = cfg.GfxHeight.ToString();
            this.comboBoxResDepth.Text    = cfg.GfxBpp.ToString();
            // Advanced Settings:
            this.checkBoxForceAlpha.Checked = cfg.ForceAlpha;
            this.checkBoxDesktopRes.Checked = cfg.OptimizeDesktopRes;
            this.checkBoxVisbility.Checked  = cfg.OptimizeVisibilty;
            //
            if (cfg.RenderMode < this.comboBoxRenderMode.Items.Count)
            {
                this.comboBoxRenderMode.SelectedIndex = cfg.RenderMode;
            }
            //
            checkBoxFullScreen.Checked = cfg.FullScreen;
        }
Пример #7
0
    internal void CopyFrom(CfgLauncher from)
    {
		this.GamePath = String.Copy(from.GamePath);
		this.Modification = String.Copy(from.Modification);
		this.CustomCmdLine = String.Copy(from.CustomCmdLine);
		this.GfxForce = from.GfxForce;
		this.GfxWidth = from.GfxWidth;
		this.GfxHeight = from.GfxHeight;
		this.GfxBpp = from.GfxBpp;
		this.RememberChanges = from.RememberChanges;
		this.ForceAlpha = from.ForceAlpha;
		this.OptimizeDesktopRes = from.OptimizeDesktopRes;
		this.OptimizeVisibilty = from.OptimizeVisibilty;
		this.FullScreen = from.FullScreen;
		this.RenderMode = from.RenderMode;
	}
Пример #8
0
 internal void CopyFrom(CfgLauncher from)
 {
     this.GamePath           = String.Copy(from.GamePath);
     this.Modification       = String.Copy(from.Modification);
     this.CustomCmdLine      = String.Copy(from.CustomCmdLine);
     this.GfxForce           = from.GfxForce;
     this.GfxWidth           = from.GfxWidth;
     this.GfxHeight          = from.GfxHeight;
     this.GfxBpp             = from.GfxBpp;
     this.RememberChanges    = from.RememberChanges;
     this.ForceAlpha         = from.ForceAlpha;
     this.OptimizeDesktopRes = from.OptimizeDesktopRes;
     this.OptimizeVisibilty  = from.OptimizeVisibilty;
     this.FullScreen         = from.FullScreen;
     this.RenderMode         = from.RenderMode;
 }
Пример #9
0
        internal void ReadFromConfig(CfgLauncher cfg)
        {
	        this.checkBoxRemeber.Checked = cfg.RememberChanges;
	        this.textBoxExe.Text = cfg.GamePath;

	        int iInd = -1;
	        for( int i = 0; i < this.comboBoxModSel.Items.Count; i++)
	        {

		        String stext = this.comboBoxModSel.Items[i].ToString();
                stext = stext.Split(new char[]{' '}, 2)[0];
                    
		        if(0 == String.Compare(stext,cfg.Modification))
		        {
			        iInd = i;
			        break;
		        }
	        }

	        if(iInd<0 || iInd >= this.comboBoxModSel.Items.Count-1)
	        {
		        this.textBoxCustMod.Enabled = true;
		        this.comboBoxModSel.SelectedIndex = this.comboBoxModSel.Items.Count - 1;
		        this.textBoxCustMod.Text = cfg.Modification;
	        }
	        else
	        {
		        this.textBoxCustMod.Enabled = false;
		        this.comboBoxModSel.SelectedIndex = iInd;
	        }

	        this.textBoxCmdAdd.Text = cfg.CustomCmdLine;
	        this.checkBoxResForce.Checked = cfg.GfxForce;
	        this.textBoxResWidth.Text = cfg.GfxWidth.ToString();
	        this.textBoxResHeight.Text = cfg.GfxHeight.ToString();
	        this.comboBoxResDepth.Text = cfg.GfxBpp.ToString();
	        // Advanced Settings:
	        this.checkBoxForceAlpha.Checked = cfg.ForceAlpha;
	        this.checkBoxDesktopRes.Checked = cfg.OptimizeDesktopRes;
	        this.checkBoxVisbility.Checked = cfg.OptimizeVisibilty;
	        //
	        if( cfg.RenderMode < this.comboBoxRenderMode.Items.Count )
		        this.comboBoxRenderMode.SelectedIndex = cfg.RenderMode;
	        //
	        checkBoxFullScreen.Checked = cfg.FullScreen;
        }
Пример #10
0
        public static bool RunLauncherDialog(IWin32Window dialogOwner)
        {
            bool bOk;

            using (LauncherForm frm = new LauncherForm())
            {
                frm.Icon          = Program.Icon;
                frm.ShowInTaskbar = false;

                CfgLauncher cfg = new CfgLauncher();

                cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

                frm.ReadFromConfig(cfg);

                if (DialogResult.OK == frm.ShowDialog(dialogOwner))
                {
                    frm.WriteToConfig(cfg);

                    if (cfg.RememberChanges)
                    {
                        GlobalConfig.Instance.Settings.Launcher.CopyFrom(cfg);
                        GlobalConfig.Instance.BackUp();
                    }

                    bOk = Launch(cfg);

                    if (!bOk)
                    {
                        MessageBox.Show("Launching failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    bOk = true;
                }
            }

            return(bOk);
        }
Пример #11
0
    public static bool RunLauncher(IWin32Window dialogOwner, Afx.AfxGoldSrc afxGoldSrc)
    {
        bool bOk;

        using (LauncherForm frm = new LauncherForm())
        {
            frm.Icon = Program.Icon;
            frm.ShowInTaskbar = false;

            CfgLauncher cfg = new CfgLauncher();

            cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

            frm.ReadFromConfig(cfg);

            if (DialogResult.OK == frm.ShowDialog(dialogOwner))
            {
                frm.WriteToConfig(cfg);

                bOk = afxGoldSrc.Start(cfg.MakeStartSettings());

                if (!bOk)
                    MessageBox.Show("Launching failed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                if (cfg.RememberChanges)
                {
                    GlobalConfig.Instance.Settings.Launcher.CopyFrom(cfg);
                    GlobalConfig.Instance.BackUp();
                }
            }
            else
                bOk = true;

        }

        return bOk;

    }
Пример #12
0
        internal void WriteToConfig(CfgLauncher cfg)
        {
            cfg.RememberChanges = this.checkBoxRemeber.Checked;

            cfg.GamePath = this.textBoxExe.Text;

            if (this.comboBoxModSel.SelectedIndex < 0 || this.comboBoxModSel.SelectedIndex >= this.modificiationValues.Length)
            {
                cfg.Modification = this.textBoxCustMod.Text;
            }
            else
            {
                cfg.Modification = this.modificiationValues[this.comboBoxModSel.SelectedIndex];
            }

            cfg.CustomCmdLine = this.textBoxCmdAdd.Text;
            cfg.GfxForce      = this.checkBoxResForce.Checked;
            UInt16.TryParse(this.textBoxResWidth.Text, out cfg.GfxWidth);
            UInt16.TryParse(this.textBoxResHeight.Text, out cfg.GfxHeight);

            if (this.comboBoxResDepth.SelectedIndex < 0 || this.comboBoxResDepth.SelectedIndex >= this.bppValues.Length)
            {
                Byte.TryParse(this.comboBoxResDepth.Text, out cfg.GfxBpp);
            }
            else
            {
                cfg.GfxBpp = this.bppValues[this.comboBoxResDepth.SelectedIndex];
            }

            // Advanced Settings:
            cfg.ForceAlpha         = this.checkBoxForceAlpha.Checked;
            cfg.OptimizeDesktopRes = this.checkBoxDesktopRes.Checked;
            cfg.OptimizeVisibilty  = this.checkBoxVisbility.Checked;
            cfg.RenderMode         = (byte)this.comboBoxRenderMode.SelectedIndex;
            cfg.FullScreen         = this.checkBoxFullScreen.Checked;
        }
Пример #13
0
 public CfgSettings()
 {
     Launcher     = new CfgLauncher();
     CustomLoader = new CfgCustomLoader();
     DemoTools    = new CfgDemoTools();
 }
Пример #14
0
 public CfgSettings()
 {
     Launcher = new CfgLauncher();
     CustomLoader = new CfgCustomLoader();
     DemoTools = new CfgDemoTools();
 }
Пример #15
0
	bool IHlaeRemote_1.LaunchEx(String OverrideCustomArgs)
	{
        Func<bool> start = delegate
        {
            // first check if HL.exe is already running:
            CfgLauncher cfg = new CfgLauncher();

            cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

            cfg.CustomCmdLine = OverrideCustomArgs;

            Afx.AfxGoldSrc.StartSettings settings = cfg.MakeStartSettings();

            return m_MainForm.AfxGoldSrc.Start(settings);
        };

        return (bool)m_MainForm.Invoke(start);
	}
Пример #16
0
        public static bool Launch(CfgLauncher cfg)
        {
            if (0 < System.Diagnostics.Process.GetProcessesByName("hl").Length)
            {
                return(false);
            }

            String cmds, s1;

            //
            //	build parameters:

            cmds = "-steam -gl";

            cmds += " -game " + cfg.Modification;

            // gfx settings

            cmds += " -nofbo";

            cmds += cfg.FullScreen ? " -full -stretchaspect" : " -window";

            s1 = cfg.GfxBpp.ToString();
            if (0 < s1.Length)
            {
                cmds += " -" + s1 + "bpp";
            }

            s1 = cfg.GfxWidth.ToString();
            if (0 < s1.Length)
            {
                cmds += " -w " + s1;
            }

            s1 = cfg.GfxHeight.ToString();
            if (0 < s1.Length)
            {
                cmds += " -h " + s1;
            }

            if (cfg.GfxForce)
            {
                cmds += " -forceres";
            }

            // advanced

            s1 = "standard";
            switch (cfg.RenderMode)
            {
            case 1: s1 = "fBO"; break;

            case 2: s1 = "memoryDC"; break;
            }
            cmds += " -afxRenderMode " + s1;

            cmds += " -afxForceAlpha8 " + (cfg.ForceAlpha ? 1 : 0).ToString();

            cmds += " -afxOptimizeCaptureVis" + (cfg.OptimizeVisibilty ? 1 : 0).ToString();

            // custom command line

            s1 = cfg.CustomCmdLine;
            if (0 < s1.Length)
            {
                cmds += " " + s1;
            }

            //
            // Launch:

            if (!AfxCppCli.AfxHook.LauchAndHook(
                    cfg.GamePath,
                    cmds,
                    System.Windows.Forms.Application.StartupPath + "\\AfxHookGoldSrc.dll"
                    ))
            {
                return(false);
            }

            return(true);
        }
Пример #17
0
	public CfgSettings()
	{
        LauncherCsgo = new CfgLauncherCsgo();
		Launcher = new CfgLauncher();
		CustomLoader = new CfgCustomLoader();
		DemoTools = new CfgDemoTools();

        ThisDefault();
	}
Пример #18
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            GlobalUpdateCheck.Instance.BeginCheckedNotification(m_UpdateCheckNotification);

            if (0 < GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.menuAutoUpdateCheck.Checked = true;
                StartUpdateCheck();
            }
            else if (0 == GlobalConfig.Instance.Settings.UpdateCheck)
            {
                this.stripEnableUpdateCheck.Visible = true;
            }

            // init AfxGoldSrc:
            m_AfxGoldSrc = new Afx.AfxGoldSrc(this);

            // start up public remoting system (if requested):
            if (Globals.EnableHlaeRemote)
            {
                m_HlaeRemoting = new hlae.remoting.HlaeRemoting(this);
            }

            // start-up AfxHookGoldSrc if requested (i.e. by command line)
            if (Globals.AutoStartAfxHookGoldSrc)
            {
                CfgLauncher cfg = new CfgLauncher();

                cfg.CopyFrom(GlobalConfig.Instance.Settings.Launcher);

                Afx.AfxGoldSrc.StartSettings settings = cfg.MakeStartSettings();

                m_AfxGoldSrc.Start(settings);
            }

            // start-up CustomLoader if requested (i.e. by command line)
            if (Globals.AutoStartCustomLoader)
            {
                bool bOk = AfxCppCli.AfxHook.LauchAndHook(GlobalConfig.Instance.Settings.CustomLoader.ProgramPath, GlobalConfig.Instance.Settings.CustomLoader.CmdLine, GlobalConfig.Instance.Settings.CustomLoader.HookDllPath);

                if (!bOk)
                    MessageBox.Show("CustomLoader failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }