Exemplo n.º 1
0
        /// <summary>
        /// Creates a handle to the game's process so we can start reading and writing memory
        /// </summary>
        /// <returns>if the attachment is successful</returns>
        public bool Attach()
        {
            // Close old process
            if (ProcessHandle != IntPtr.Zero)
            {
                ProcessMemory.CloseHandle(ProcessHandle);
                ProcessHandle = IntPtr.Zero;
                _process      = null;
            }

            // Find DAL: RR Process
            _process = Process.GetProcesses().FirstOrDefault(t => t.ProcessName.Contains("DATE A LIVE RIO-REINCARNATION"));
            if (_process == null)
            {
                return(false);
            }
            // Get process handle
            ProcessHandle = ProcessMemory.OpenProcess(ProcessMemory.ProcessAccessFlags.All, false, _process.Id);
            if (ProcessHandle == IntPtr.Zero)
            {
                return(false);
            }
            // Patch out the IP out of bounds check
            ProcessHandle.WriteUInt16(0x0048A5C2, 0x9090);
            return(true);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Closes the process handle we opened at the start
 /// </summary>
 public void Detach()
 {
     if (ProcessHandle != IntPtr.Zero)
     {
         // Close the handle
         ProcessMemory.CloseHandle(ProcessHandle);
         // Set process handle to null
         ProcessHandle = IntPtr.Zero;
         _process      = null;
     }
 }