Exemplo n.º 1
0
        private void UpdateSplitValue()
        {
            SplitInfo split = currentSplit + 1 < settings.Splits.Count ? settings.Splits[currentSplit + 1] : null;

            if (split != null)
            {
                split.LastValue = ReadValue(split);
            }
        }
Exemplo n.º 2
0
        private string GetSplitInfo()
        {
            SplitInfo split = currentSplit + 1 < settings.Splits.Count ? settings.Splits[currentSplit + 1] : null;

            if (split == null)
            {
                return("(No More Splits In Settings)");
            }

            return((split.ShouldSplit ? "(Split) " : "(Sub) ") + split.Offset.ToString() + "[" + split.Size.ToString() + "] " + split.Type.ToString() + " " + split.Value.ToString());
        }
Exemplo 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 "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;
                    }
                }
            }
        }
Exemplo 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.Changed: shouldSplit = value != split.LastValue; break;

                case SplitType.ChangedGreaterThan: shouldSplit = value > split.LastValue; break;

                case SplitType.ChangedLessThan: shouldSplit = value < split.LastValue; break;
                }
                split.LastValue = value;

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

            HandleSplit(shouldSplit, false);
        }
Exemplo n.º 5
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.Offset); break;

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

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

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

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

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