Ejemplo n.º 1
0
        private long ReadValue(SplitInfo split)
        {
            long value = 0;

            if (split != null && split.Size != ValueSize.Manual)
            {
                switch (split.Size)
                {
                case ValueSize.UInt8: value = mem.Read <byte>(split.Section, split.Offset); break;

                case ValueSize.Int8: value = mem.Read <sbyte>(split.Section, split.Offset); break;

                case ValueSize.UInt16: value = mem.Read <ushort>(split.Section, split.Offset); break;

                case ValueSize.Int16: value = mem.Read <short>(split.Section, split.Offset); break;

                case ValueSize.UInt32: value = mem.Read <uint>(split.Section, split.Offset); break;

                case ValueSize.Int32: value = mem.Read <int>(split.Section, split.Offset); break;

                case ValueSize.Float: value = (long)mem.Read <float>(split.Section, split.Offset); break;
                }
                if (split.Type == SplitType.Bitwise)
                {
                    value &= split.Value;
                }
            }
            return(value);
        }
Ejemplo n.º 2
0
        private void UpdateSplitValue()
        {
            SplitInfo split = currentSplit + 1 < settings.Splits.Count ? settings.Splits[currentSplit + 1] : null;

            if (split != null)
            {
                split.LastValue = ReadValue(split);
            }
        }
Ejemplo n.º 3
0
        private void LogValues()
        {
            if (lastLogCheck == 0)
            {
                hasLog       = File.Exists(LOGFILE);
                lastLogCheck = 300;
            }
            lastLogCheck--;

            if (hasLog || !Console.IsOutputRedirected)
            {
                string    prev = string.Empty, curr = string.Empty;
                SplitInfo split = currentSplit + 1 < settings.Splits.Count ? settings.Splits[currentSplit + 1] : null;
                foreach (string key in keys)
                {
                    prev = currentValues[key];

                    switch (key)
                    {
                    case "CurrentSplit": curr = currentSplit.ToString(); break;

                    case "Pointer": curr = mem.Pointer(); break;

                    case "Offset": curr = split != null?split.Offset.ToString("X") : string.Empty; break;

                    case "Section": curr = split != null?split.Section.ToString() : string.Empty; break;

                    case "Type": curr = split != null?split.Type.ToString() : string.Empty; break;

                    case "Size": curr = split != null?split.Size.ToString() : string.Empty; break;

                    case "ShouldSplit": curr = split != null?split.ShouldSplit.ToString() : string.Empty; break;

                    case "Value": curr = split != null?split.LastValue.ToString() : string.Empty; break;

                    default: curr = string.Empty; break;
                    }

                    if (string.IsNullOrEmpty(prev))
                    {
                        prev = string.Empty;
                    }
                    if (string.IsNullOrEmpty(curr))
                    {
                        curr = string.Empty;
                    }
                    if (!prev.Equals(curr))
                    {
                        WriteLog(DateTime.Now.ToString(@"HH\:mm\:ss.fff") + (Model != null ? " | " + Model.CurrentState.CurrentTime.RealTime.Value.ToString("G").Substring(3, 11) : "") + ": " + key + ": ".PadRight(16 - key.Length, ' ') + prev.PadLeft(25, ' ') + " -> " + curr);

                        currentValues[key] = curr;
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void HandleSplits()
        {
            bool shouldSplit = false;

            SplitInfo split = currentSplit + 1 < settings.Splits.Count ? settings.Splits[currentSplit + 1] : null;

            if (split != null && split.Size != ValueSize.Manual)
            {
                long value = ReadValue(split);
                switch (split.Type)
                {
                case SplitType.Equals: shouldSplit = value == split.Value && value != split.LastValue; break;

                case SplitType.GreaterThan: shouldSplit = value > split.Value && value != split.LastValue; break;

                case SplitType.LessThan: shouldSplit = value < split.Value && value != split.LastValue; break;

                case SplitType.Bitwise:
                case SplitType.Changed: shouldSplit = value != split.LastValue; break;

                case SplitType.ChangedFrom: shouldSplit = split.LastValue == split.Value && value != split.LastValue; break;
                }
                split.LastValue = value;

                if (!split.ShouldSplit && shouldSplit)
                {
                    LogValues();
                    currentSplit++;
                    shouldSplit = false;
                }
                else if (shouldSplit)
                {
                    LogValues();
                }
            }

            HandleSplit(shouldSplit, false);
        }