Friday 27 June 2014

Simple and efficient Touch and Drag Rigidbodies for Unity 3d

Check out this tutorial by one of my friends Newtonian who had recently opened a new blog. here is the link fot the tut -
 http://www.newtonians3d.blogspot.in/2014/06/a-simple-and-efficient-touch-and-drag.html
Check out his tutorial, It's a good one. 

Monday 9 June 2014

How to Make a simple Game Trainer In Visual C# (with Source code Download)

Hello, Readers i'am here after a long time because i was busy. (i also archived this blog) But right now i'am presenting you a little tutorial on how to make a trainer for games in visual C#.
First of all you hae to select a game to cheat with. Youcan choose anything but i've choosen gta 3 and i'am going to show how to hack its money value.

Step 1. Our first step is to find some values in the game which we want to edit like health, armour, coins etc and their respective memory addresses. You can use many tools for this purpose but i reccommend you to use cheat engine. You can download it here http://www.cheatengine.org/downloads.php. I'am supposing that you will find the addresses of money, armour etc easily on your own by following their tutorial. Now, as you have also found it the adress for money in gta 3 is 0x0094139C (forget this '0x' it's just for show).

Step 2. Now let's start with visual C#. (just open it up). Start a new project with Windows form App Then go to project menu and click on add class. It will show up like this
Then Copy this code and Paste It All (this cose is not writtem by me so i'am not owner of this)

using System;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace ProcessMemoryReaderLib
{
    /// <summary>
    /// ProcessMemoryReader is a class that enables direct reading a process memory
    /// </summary>
    class ProcessMemoryReaderApi
    {
        // constants information can be found in <winnt.h>
        [Flags]
        public enum ProcessAccessType
        {
            PROCESS_TERMINATE = (0x0001),
            PROCESS_CREATE_THREAD = (0x0002),
            PROCESS_SET_SESSIONID = (0x0004),
            PROCESS_VM_OPERATION = (0x0008),
            PROCESS_VM_READ = (0x0010),
            PROCESS_VM_WRITE = (0x0020),
            PROCESS_DUP_HANDLE = (0x0040),
            PROCESS_CREATE_PROCESS = (0x0080),
            PROCESS_SET_QUOTA = (0x0100),
            PROCESS_SET_INFORMATION = (0x0200),
            PROCESS_QUERY_INFORMATION = (0x0400)
        }

        // function declarations are found in the MSDN and in <winbase.h>

        //        HANDLE OpenProcess(
        //            DWORD dwDesiredAccess,  // access flag
        //            BOOL bInheritHandle,    // handle inheritance option
        //            DWORD dwProcessId       // process identifier
        //            );
        [DllImport("kernel32.dll")]
        public static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId);

        //        BOOL CloseHandle(
        //            HANDLE hObject   // handle to object
        //            );
        [DllImport("kernel32.dll")]
        public static extern Int32 CloseHandle(IntPtr hObject);

        //        BOOL ReadProcessMemory(
        //            HANDLE hProcess,              // handle to the process
        //            LPCVOID lpBaseAddress,        // base of memory area
        //            LPVOID lpBuffer,              // data buffer
        //            SIZE_T nSize,                 // number of bytes to read
        //            SIZE_T * lpNumberOfBytesRead  // number of bytes read
        //            );
        [DllImport("kernel32.dll")]
        public static extern Int32 ReadProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesRead);

        //        BOOL WriteProcessMemory(
        //            HANDLE hProcess,                // handle to process
        //            LPVOID lpBaseAddress,           // base of memory area
        //            LPCVOID lpBuffer,               // data buffer
        //            SIZE_T nSize,                   // count of bytes to write
        //            SIZE_T * lpNumberOfBytesWritten // count of bytes written
        //            );
        [DllImport("kernel32.dll")]
        public static extern Int32 WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, [In, Out] byte[] buffer, UInt32 size, out IntPtr lpNumberOfBytesWritten);


    }

    public class ProcessMemoryReader
    {

        public ProcessMemoryReader()
        {
        }

        /// <summary>   
        /// Process from which to read       
        /// </summary>
        public Process ReadProcess
        {
            get
            {
                return m_ReadProcess;
            }
            set
            {
                m_ReadProcess = value;
            }
        }

        private Process m_ReadProcess = null;

        private IntPtr m_hProcess = IntPtr.Zero;

        public void OpenProcess()
        {
            //            m_hProcess = ProcessMemoryReaderApi.OpenProcess(ProcessMemoryReaderApi.PROCESS_VM_READ, 1, (uint)m_ReadProcess.Id);
            ProcessMemoryReaderApi.ProcessAccessType access;
            access = ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_READ
                | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_WRITE
                | ProcessMemoryReaderApi.ProcessAccessType.PROCESS_VM_OPERATION;
            m_hProcess = ProcessMemoryReaderApi.OpenProcess((uint)access, 1, (uint)m_ReadProcess.Id);
        }

        public void CloseHandle()
        {
            int iRetValue;
            iRetValue = ProcessMemoryReaderApi.CloseHandle(m_hProcess);
            if (iRetValue == 0)
                throw new Exception("CloseHandle failed");
        }

        public byte[] ReadProcessMemory(IntPtr MemoryAddress, uint bytesToRead, out int bytesRead)
        {
            byte[] buffer = new byte[bytesToRead];

            IntPtr ptrBytesRead;
            ProcessMemoryReaderApi.ReadProcessMemory(m_hProcess, MemoryAddress, buffer, bytesToRead, out ptrBytesRead);

            bytesRead = ptrBytesRead.ToInt32();

            return buffer;
        }

        public void WriteProcessMemory(IntPtr MemoryAddress, byte[] bytesToWrite, out int bytesWritten)
        {
            IntPtr ptrBytesWritten;
            ProcessMemoryReaderApi.WriteProcessMemory(m_hProcess, MemoryAddress, bytesToWrite, (uint)bytesToWrite.Length, out ptrBytesWritten);

            bytesWritten = ptrBytesWritten.ToInt32();
        }




    }
}


Step 3 In This Step we will detect the Game process for taking further action on it. Add this code outside all methods (not outside the class) -

 System.Diagnostics.Process[] myprocesses = System.Diagnostics.Process.GetProcessesByName("gta3");
 ProcessMemoryReaderLib.ProcessMemoryReader preader =  new ProcessMemoryReaderLib.ProcessMemoryReader();


Once you have done it Go back to the Form1 and add a button. Double click the button and it's code will show up like this. (what we have done so far)
Now write This code In the two curly braces below the button1_click method -

 preader.ReadProcess = myprocesses[0];
 preader.OpenProcess();

This code uses the ProcessMemoryReaderLib class to open our process (gta3) which allow us to read and write bytes in that process. But now we only want to write bytes at our money address. The money used in gta 3 is 4 byte (int) value if you want to change a float value, there is avery simple solution just change the 'int value' line to 'float value' So Add this below -

int byteswritten; //the final bytes writed not a case of concern for us
int address;
address = 0x0094139C; // This  our money address in gta3
int value; //declaration of the value if you want float, double, bool etc just replace the 'int' with the value type you wnt like float value , double value etc.
byte[] valuebyte; //array of bytes to be written on adress
value = 555555; //here is our money value
valuebyte = BitConverter.GetBytes(value); //the write processmemory only take bytes as arguments so we simply convert the value we want to change to bytes
preader.WriteProcessMemory((IntPtr)address, valuebyte, out byteswritten);

// Here is the method that does the magic it

Now you can test it through debug menu --> start debugging and see your coins flipped (actually changed to 555555)

Note - Test your application only when The game is running otherwise visual c# will throw an exception.

Download Link For Source Code (As promised in title) -  Here is the full source code for this tutorial -

http://www.4shared.com/rar/k4ELd2Cyce/Trainer_In_Csharp_source.html
Do not hesitate to download the source it's hust 113 kb. It also include compiled files includin under 'bin' folder if someone wants to just test it out.

So, Here is just a very basic tutorial on making a game trainer in visual c#. This tutorial only works for static addresses.it do not work on pointers which change the adrress dynamically, but i'am working on that and soon I'll post the tutorial on replacing values of pointers to make the trainer more effective and will work on most games. I'll post that in a week. Thanks for Reading My blog, bye.

Monday 17 February 2014

Closing of this blog

For some of my personal reasons i've decided to close this blog forever. I repeat once more this blog WILL NOT BE UPDATED any more.

Tuesday 21 January 2014

2D Car Game Update 3 with download (new features - motorcycle physics,accurate speedometer, reset feature,)

Hello, Blog readers i'am presenting my 2D car Movement, which will now include a motorcycle physics which is quite unrealistic at present but I will make it better in future updates. Another new feature is a speedometer with GUI which is very accurate. Also, now you can press 'r' to reset your Car position whin it's flipped. Some screenshots -

A screenshot showing the new speedometer
The new motorcycle physics which is very inaccurate and unreralistic at this moment


And finally, The download link for the project files --


Note - The motorcycle sprite in this unity project is from bikemania flashgames247.com). I've just taken a screenshot of game and then seperated the tires and bike in photoshop.
 


Sunday 19 January 2014

Download Free 3d Models (in 3ds .max format)

Hi readers, This is my post after my long break due to winter vacations. But i'am back now, today i'am sharing some of my 3d Car Models i made with 3ds max for a unity racing game. These models are ideal for game (you can remove turbosmooth modifier when using it in game). Here are few renders of my two cars --
And now at last the Download Link for these cars.
Click Here To Download My 3D car models

note - These scene files are setup in vray, so if you don't have vray, just change the materials to standard and assign the default scanline renderer.

Thanks for reading my blog.