Пример #1
0
        private bool GetEventFlagAddress(int ID, out int address, out uint mask)
        {
            string idString = ID.ToString("D8");

            if (idString.Length == 8)
            {
                string group   = idString.Substring(0, 1);
                string area    = idString.Substring(1, 3);
                int    section = Int32.Parse(idString.Substring(4, 1));
                int    number  = Int32.Parse(idString.Substring(5, 3));

                if (Dictionaries.EventFlagGroups.ContainsKey(group) && Dictionaries.EventFlagAreas.ContainsKey(area))
                {
                    int offset = Dictionaries.EventFlagGroups[group];
                    offset += Dictionaries.EventFlagAreas[area] * 0x500;
                    offset += section * 128;
                    offset += (number - (number % 32)) / 8;

                    address  = MemoryTools.RInt32(darksoulsHandle, (IntPtr)Pointers.EventFlagPtr[gameVersion]);
                    address  = MemoryTools.RInt32(darksoulsHandle, (IntPtr)address);
                    address += offset;

                    mask = 0x80000000 >> (number % 32);
                    return(true);
                }
            }

            address = 0;
            mask    = 0;
            return(false);
        }
Пример #2
0
 public bool GetEventFlagState(int ID)
 {
     if (GetEventFlagAddress(ID, out int address, out uint mask))
     {
         uint flags = (uint)MemoryTools.RInt32(darksoulsHandle, (IntPtr)address);
         return((flags & mask) != 0);
     }
Пример #3
0
        private Process GetGame()
        {
            Process[] candidates = Process.GetProcessesByName(Constants.PROCESS_NAME);
            gameVersion = GameVersion.Unknown;

            foreach (Process candidate in candidates)
            {
                UInt32 value = MemoryTools.RUInt32(candidate.Handle, (IntPtr)Pointers.VERSION_CHECK);
                switch (value)
                {
                case Pointers.VERSION_RELEASE:
                {
                    gameVersion = GameVersion.Release;
                    return(candidate);
                }

                case Pointers.VERSION_DEBUG:
                {
                    gameVersion = GameVersion.Debug;
                    return(candidate);
                }

                // No test for the Beta version because who gives a shit
                default:
                    candidate.Dispose();
                    break;
                }
            }

            return(null);
        }