Register for your free account! | Forgot your password?

You last visited: Today at 23:40

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Dynamic FPS Unlocker. [Code]

Discussion on Dynamic FPS Unlocker. [Code] within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Dynamic FPS Unlocker. [Code]

Okay so,

Is your private server missing a FPS Unlocker?

Well look no further! If you don't know how to use the code, you dont need it.

The address's you see are the sleep address's inside the conquer.exe, use olydbg to get them for a different patch.

Cant remember what patch the current address's are for, 5180 I think and this worked perfectly afaik(Coded this about a year ago)

You can create a form, add 3 buttons, add this code, each of the buttons selects a different fps and yeah, change fps everytime on loadup for a different users preferance.

This does not edit the compiled exe in any way, Only its memory which is reset upon restart of the executable.

Revised:
Quote:
Originally Posted by _DreadNought_ View Post
Revised class:
Code:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;

//FPSUnlocker.Conquer.Start(name, blacknull);

namespace FPSUnlocker
{
    /// <summary>
    ///  This class has the ability to start Conquer Online with the specified Arguments such as "blacknull" while unlocking the FPS.
    /// </summary>
    public class Conquer
    {
        #region DLL Stuffz
        [DllImport("kernel32.dll")]
        static extern int ResumeThread(IntPtr hThread);

        [DllImport("kernel32.dll")]
        static extern int SuspendThread(IntPtr hThread);

        [DllImport("kernel32.dll")]
        static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess,
            bool bInheritHandle,
            uint dwThreadId
        );

        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, IntPtr lpNumberOfBytesWritten);

        [DllImport("Kernel32.dll")]
        public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, Int32 dwProcessId);

        [Flags]
        public enum ThreadAccess
        {
            TERMINATE = (0x0001),
            SUSPEND_RESUME = (0x0002),
            GET_CONTEXT = (0x0008),
            SET_CONTEXT = (0x0010),
            SET_INFORMATION = (0x0020),
            QUERY_INFORMATION = (0x0040),
            SET_THREAD_TOKEN = (0x0080),
            IMPERSONATE = (0x0100),
            DIRECT_IMPERSONATION = (0x0200)
        }
        #endregion

        Process _conquerProcess;
        readonly string _arguments;
        readonly string _name;
        private IntPtr _hProcess;

        /// <summary>
        /// Class initalizer, This must be used to allow for Dynamic use.
        /// </summary>
        /// <param name="name">Must not contain characters such as " * / \ ? " commonly set to "Conquer.exe"</param>
        /// <param name="arguments">Arguments you want to start the Conquer process with commonly set to "blacknull"</param>
        public Conquer(string name, string arguments)
        {
            _name = name;
            _arguments = arguments;
        }

        public Exception Start(IntPtr addr1, IntPtr addr2)
        {
            try
            {
                _conquerProcess = new Process
                                      {
                                          StartInfo =
                                              {
                                                  Arguments = _arguments,
                                                  FileName = _name,
                                                  WorkingDirectory = Environment.CurrentDirectory
                                              }
                                      };
                _conquerProcess.Start();
                _conquerProcess.WaitForInputIdle();
                Thread.Sleep(2000);//Just testing, Can be removed without harm, I think.
                FreezeThreads();
                var form = new FPSUnlocker();
                if (form.ShowDialog() == DialogResult.Yes)
                {
                    //Write our shit.
                    if (Openprocess())
                    {
                        var a1 = addr1;//0x005B14CE
                        var a2 = addr2;//0x005B14D7
                        var bytesWritten = IntPtr.Zero;
                        var buf = new byte[] { 0x07 };
                        var buf2 = new byte[] { 0x07 };
                        WriteProcessMemory(_hProcess, a1, buf, (uint)buf.Length, bytesWritten);
                        WriteProcessMemory(_hProcess, a2, buf2, (uint)buf2.Length, bytesWritten);
                        UnfreezeThreads();
                        Application.Exit();
                    }
                }
                UnfreezeThreads();
            }
            catch (Exception e)
            {
                if (!_conquerProcess.HasExited)
                    _conquerProcess.Kill();
                return e;
            }
            return null;
        }

        private void FreezeThreads()
        {
            foreach (ProcessThread pT in _conquerProcess.Threads)
            {
                var ptrOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
                SuspendThread(ptrOpenThread);
            }
        }
        private void UnfreezeThreads()
        {
            foreach (ProcessThread pT in _conquerProcess.Threads)
            {
                var ptrOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
                ResumeThread(ptrOpenThread);
            }
        }
        private bool Openprocess()
        {
            _hProcess = OpenProcess(0x1F0FFF, 1, _conquerProcess.Id);
            if (_hProcess == IntPtr.Zero)
            {
                MessageBox.Show("OpenProcess(0x1F0FFF, 1, ID) failed with following error: " + Marshal.GetLastWin32Error());
                return false;
            }
            return true;
        }
    }
}
Note: the addresses in there wont work for any conquer.exe you have to get them yourself.
Old code:
_DreadNought_ is offline  
Thanks
14 Users
Old 02/29/2012, 14:32   #2
 
-Sensei-'s Avatar
 
elite*gold: 0
Join Date: Oct 2011
Posts: 267
Received Thanks: 59
Good work.
-Sensei- is offline  
Old 02/29/2012, 14:38   #3
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Good job, tho the problem comes to most people uses nullables loader, so this won't work ^^.

But well making a bypass around the process start is not that hard.

Addresses for 5517+:
0x5AB53E
0x5AB547
I don't have a username is offline  
Thanks
1 User
Old 02/29/2012, 14:46   #4


 
Korvacs's Avatar
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,125
Received Thanks: 2,518
Quote:
Originally Posted by _DreadNought_ View Post
29 views, one thanks, not one comment? o rly?
My WDF extracter thread has 1176 downloads, 7975 views, 49 thanks, 53 replies, so really how bad is your thread doing compared lol.... Thats just the nature of epvpers.
Korvacs is offline  
Thanks
4 Users
Old 02/29/2012, 15:38   #5
 
JobvdH's Avatar
 
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
This is a great thread! I'm going to use this.
Thanks for sharing!
JobvdH is offline  
Old 02/29/2012, 15:57   #6
 
Captivate's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 1,532
Received Thanks: 575
Came a few weeks late for me, thanks anyway!
Captivate is offline  
Old 02/29/2012, 19:43   #7
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Quote:
Originally Posted by Korvacs View Post
My WDF extracter thread has 1176 downloads, 7975 views, 49 thanks, 53 replies, so really how bad is your thread doing compared lol.... Thats just the nature of epvpers.
Yeah I kinda figured that out, but yeah.

This works great when you show the form when the process is at its Idle state.(Where its the small square loading school come up) Just freeze it, Show the form, and unfreeze it after your finished.

NOTE: The values 0x09 for 40fps etc ARE NOT ACCURATE.

Would be nice if someone left some feedback on the code and if it worked for them.

#edit
Oh lol nvm, I left that in the code.
_DreadNought_ is offline  
Old 11/19/2012, 21:14   #8
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,223
Received Thanks: 867
Revised class:
Code:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;

//FPSUnlocker.Conquer.Start(name, blacknull);

namespace FPSUnlocker
{
    /// <summary>
    ///  This class has the ability to start Conquer Online with the specified Arguments such as "blacknull" while unlocking the FPS.
    /// </summary>
    public class Conquer
    {
        #region DLL Stuffz
        [DllImport("kernel32.dll")]
        static extern int ResumeThread(IntPtr hThread);

        [DllImport("kernel32.dll")]
        static extern int SuspendThread(IntPtr hThread);

        [DllImport("kernel32.dll")]
        static extern IntPtr OpenThread(ThreadAccess dwDesiredAccess,
            bool bInheritHandle,
            uint dwThreadId
        );

        [DllImport("kernel32.dll", SetLastError = true)]
        public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, IntPtr lpNumberOfBytesWritten);

        [DllImport("Kernel32.dll")]
        public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, Int32 dwProcessId);

        [Flags]
        public enum ThreadAccess
        {
            TERMINATE = (0x0001),
            SUSPEND_RESUME = (0x0002),
            GET_CONTEXT = (0x0008),
            SET_CONTEXT = (0x0010),
            SET_INFORMATION = (0x0020),
            QUERY_INFORMATION = (0x0040),
            SET_THREAD_TOKEN = (0x0080),
            IMPERSONATE = (0x0100),
            DIRECT_IMPERSONATION = (0x0200)
        }
        #endregion

        Process _conquerProcess;
        readonly string _arguments;
        readonly string _name;
        private IntPtr _hProcess;

        /// <summary>
        /// Class initalizer, This must be used to allow for Dynamic use.
        /// </summary>
        /// <param name="name">Must not contain characters such as " * / \ ? " commonly set to "Conquer.exe"</param>
        /// <param name="arguments">Arguments you want to start the Conquer process with commonly set to "blacknull"</param>
        public Conquer(string name, string arguments)
        {
            _name = name;
            _arguments = arguments;
        }

        public Exception Start(IntPtr addr1, IntPtr addr2)
        {
            try
            {
                _conquerProcess = new Process
                                      {
                                          StartInfo =
                                              {
                                                  Arguments = _arguments,
                                                  FileName = _name,
                                                  WorkingDirectory = Environment.CurrentDirectory
                                              }
                                      };
                _conquerProcess.Start();
                _conquerProcess.WaitForInputIdle();
                Thread.Sleep(2000);//Just testing, Can be removed without harm, I think.
                FreezeThreads();
                var form = new FPSUnlocker();
                if (form.ShowDialog() == DialogResult.Yes)
                {
                    //Write our shit.
                    if (Openprocess())
                    {
                        var a1 = addr1;//0x005B14CE
                        var a2 = addr2;//0x005B14D7
                        var bytesWritten = IntPtr.Zero;
                        var buf = new byte[] { 0x07 };
                        var buf2 = new byte[] { 0x07 };
                        WriteProcessMemory(_hProcess, a1, buf, (uint)buf.Length, bytesWritten);
                        WriteProcessMemory(_hProcess, a2, buf2, (uint)buf2.Length, bytesWritten);
                        UnfreezeThreads();
                        Application.Exit();
                    }
                }
                UnfreezeThreads();
            }
            catch (Exception e)
            {
                if (!_conquerProcess.HasExited)
                    _conquerProcess.Kill();
                return e;
            }
            return null;
        }

        private void FreezeThreads()
        {
            foreach (ProcessThread pT in _conquerProcess.Threads)
            {
                var ptrOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
                SuspendThread(ptrOpenThread);
            }
        }
        private void UnfreezeThreads()
        {
            foreach (ProcessThread pT in _conquerProcess.Threads)
            {
                var ptrOpenThread = OpenThread(ThreadAccess.SUSPEND_RESUME, false, (uint)pT.Id);
                ResumeThread(ptrOpenThread);
            }
        }
        private bool Openprocess()
        {
            _hProcess = OpenProcess(0x1F0FFF, 1, _conquerProcess.Id);
            if (_hProcess == IntPtr.Zero)
            {
                MessageBox.Show("OpenProcess(0x1F0FFF, 1, ID) failed with following error: " + Marshal.GetLastWin32Error());
                return false;
            }
            return true;
        }
    }
}
Note: the addresses in there wont work for any conquer.exe you have to get them yourself.
_DreadNought_ is offline  
Old 11/22/2012, 09:57   #9
 
Ultimation's Avatar
 
elite*gold: 0
Join Date: Mar 2005
Posts: 1,425
Received Thanks: 1,565
Quote:
Originally Posted by I don't have a username View Post
Good job, tho the problem comes to most people uses nullables loader, so this won't work ^^.

But well making a bypass around the process start is not that hard.

Addresses for 5517+:
0x5AB53E
0x5AB547
*cough* D3D8.dll
Ultimation is offline  
Thanks
1 User
Old 11/22/2012, 10:52   #10
 
elite*gold: 0
Join Date: Dec 2011
Posts: 1,537
Received Thanks: 785
Quote:
Originally Posted by Ultimation View Post
*cough* D3D8.dll
lolol
I don't have a username is offline  
Reply


Similar Threads Similar Threads
Achievement unlocker or portriat unlocker?
10/11/2011 - Starcraft 2 - 2 Replies
Hello, Just wondering if there is any achievement unlockers or portrait unlockers? Only reason is I want some of the portriats which look amazing, so yeah. Thank You!



All times are GMT +2. The time now is 23:40.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.