private void SaveFlags(EFlags modified)
        {
            var oldFlags = (EFlags)vm.PhysicalMemory.GetUInt16(vm.Processor.SS, (ushort)(vm.Processor.SP + 4));

            oldFlags &= ~modified;
            vm.PhysicalMemory.SetUInt16(vm.Processor.SS, (ushort)(vm.Processor.SP + 4), (ushort)(oldFlags | (vm.Processor.Flags.Value & modified)));
        }
Exemple #2
0
        /// <summary>
        /// Deserialises an object from <paramref name="stream"/>.
        /// The type will be constructed using <see cref="ReflectionHelper.Construct{T}"/>
        /// </summary>
        public static T Deserialise <T>(Stream stream, EFlags flags = EFlags.None)
        {
            T r = ReflectionHelper.Construct <T>();

            using (StreamReader sr = new StreamReader(stream))
            {
                while (!sr.EndOfStream)
                {
                    string l = sr.ReadLine();

                    string[] e = l.Split(new[] { '=' }, 2);

                    FieldInfo field = typeof(T).GetField(e[0]);

                    if (field == null)
                    {
                        if (flags.Has(EFlags.ErrorOnUnknownField))
                        {
                            throw new FormatException($"The INI deserialiser encountered a field {{{e[0]}}} but that field does not exist in the type {{{typeof(T).ToUiString()}}}. The file may have been saved using an older version of the software.");
                        }
                        else
                        {
                            continue;
                        }
                    }

                    object x = StringToObject(e[1], field.FieldType);

                    field.SetValue(r, x);
                }
            }

            return(r);
        }
        }                                    // for pool

        public TriangleRaycastCallback(ref IndexedVector3 from, ref IndexedVector3 to, EFlags flags)
        {
            m_from        = from;
            m_to          = to;
            m_flags       = flags;
            m_hitFraction = 1f;
        }
Exemple #4
0
        private void SaveLoad(bool save, EFlags flags)
        {
            ProgressReporter prog = ProgressReporter.GetEmpty(); // too fast to warrent dialogue

            if (flags.Has(EFlags.DoNotShowAgain))
            {
                XmlSettings.SaveLoad(save, FileId.DoNotShowAgain, ref this.DoNotShowAgain, null, prog);
            }
            if (flags.Has(EFlags.RecentSessions))
            {
                XmlSettings.SaveLoad(save, FileId.RecentSessions, ref this.RecentSessions, null, prog);
            }
            if (flags.Has(EFlags.RecentWorkspaces))
            {
                XmlSettings.SaveLoad(save, FileId.RecentWorkspaces, ref this.RecentWorkspaces, null, prog);
            }
            if (flags.Has(EFlags.General))
            {
                XmlSettings.SaveLoad(save, FileId.General, ref this.General, null, prog);
            }
            if (flags.Has(EFlags.FileLoadInfo))
            {
                XmlSettings.SaveLoad(save, FileId.FileLoadInfo, ref this.FileLoadInfo, null, prog);
            }
        }
 public virtual void Initialize(ref IndexedVector3 from, ref IndexedVector3 to, EFlags flags)
 {
     m_from        = from;
     m_to          = to;
     m_flags       = flags;
     m_hitFraction = 1f;
 }
Exemple #6
0
        public void GetContentMetadata(Book.Part part, EFlags flags = default)
        {
            var filename = part.AaxFileItem.FileName;

            Log(3, this, () => $"\"{filename.SubstitUser ()}\", flags={flags}");

            try {
                var contentMetadataFile = findContentMetadataFile(filename);
                if (contentMetadataFile is null || contentMetadataFile.Filename is null)
                {
                    part.AaxFileItem.ContentMetadataFile = new AsinJsonFile(null, null);
                    return;
                }

                part.AaxFileItem.ContentMetadataFile = contentMetadataFile;
                string metafile = contentMetadataFile.Filename;
                Log(3, this, () => $"\"{metafile.SubstitUser ()}\"");

                if (flags.HasFlag(EFlags.fileOnly))
                {
                    return;
                }

                getContentMetaChapters(part, metafile, flags.HasFlag(EFlags.skuOnly));
            } catch (Exception exc) {
                Log(1, this, () => exc.ToShortString());
            }
        }
Exemple #7
0
        internal unsafe void ReadFromHandle(SafeThreadHandle handle)
        {
            Native native;

            native.ContextFlags = (UInt32)(ContextFlags.i386 | ContextFlags.Integer | ContextFlags.Control | ContextFlags.Segments);

#if x86
            bool success = GetThreadContext(handle, &native);
#elif x64
            bool success = Wow64GetThreadContext(handle, &native);
#endif
            if (!success)
            {
                throw new Win32Exception();
            }

            Eax    = native.Eax;
            Ebx    = native.Ebx;
            Ecx    = native.Ecx;
            Edx    = native.Edx;
            Edi    = native.Edi;
            Esi    = native.Esi;
            Ebp    = native.Ebp;
            Eip    = native.Eip;
            EFlags = (EFlags)native.EFlags;
            SegDs  = native.SegDs;
            SegCs  = native.SegCs;
            SegSs  = native.SegSs;
            SegGs  = native.SegGs;
            SegFs  = native.SegFs;
            SegEs  = native.SegEs;
        }
Exemple #8
0
 public void SetGameGenie(byte?compare, byte value)
 {
     flags  |= EFlags.GameGenie;
     Compare = compare;
     Value   = value;
     Sync();
 }
        public GetSystemFlags(String CurrentFlags)
        {
            InitializeComponent();

            foreach (EnumFlags EFlags in Enum.GetValues(typeof(EnumFlags)))
            {
                _ValueFlags.Add(EFlags.ToString());
            }

            for (int i = 0; i < _ValueFlags.Count; i++)
            {
                listBox_Flags.Items.Add(_ValueFlags[i].ToString());
            }


            // Parse current flags
            CurrentFlags = CurrentFlags.Replace("(", "");
            CurrentFlags = CurrentFlags.Replace(")", "");
            CurrentFlags = CurrentFlags.Replace(" ", "");

            string[] ParsedString = CurrentFlags.Split(new char[] { '+' });
            for (int i = 0; i < ParsedString.Length; i++)
            {
                listBox_Flags.SelectedItems.Add(ParsedString[i]);
            }
        }
        public PlayerAnimationUpdate(ushort playerId, PlayerAnimator animator)
        {
            PlayerId = playerId;

            JumpWeight         = animator.jumpWeight;
            JumpNormalizedTime = animator.jumpNormalizedTime;
            //Compress AnimIndex, assume their values are less than 256
            IdleAnimIndex   = (byte)animator.idleAnimIndex;
            SailAnimIndex   = (byte)animator.sailAnimIndex;
            MiningAnimIndex = (byte)animator.miningAnimIndex;
            MiningWeight    = animator.miningWeight;

            MovementState = animator.movementState;
            HorzSpeed     = animator.controller.horzSpeed;
            VertSpeed     = animator.controller.vertSpeed;
            Turning       = animator.turning;

            Flags = 0;
            if (animator.controller.actionWalk.isGrounded)
            {
                Flags |= EFlags.isGrounded;
            }

            if (animator.controller.actionDrift.inWater)
            {
                Flags |= EFlags.inWater;
            }
        }
 public TriangleRaycastCallback() { } // for pool
 public TriangleRaycastCallback(ref IndexedVector3 from, ref IndexedVector3 to, EFlags flags)
 {
     m_from = from;
     m_to = to;
     m_flags = flags;
     m_hitFraction = 1f;
 }
Exemple #12
0
		public btTriangleRaycastCallback( ref btVector3 from, ref btVector3 to, EFlags flags = EFlags.kF_None )
		{
			m_from = ( from );
			m_to = ( to );
			//@BP Mod
			m_flags = ( flags );
			m_hitFraction = ( btScalar.BT_ONE );
		}
        public virtual void Initialize(ref IndexedVector3 from, ref IndexedVector3 to, EFlags flags)
        {
            m_from = from;
            m_to = to;
            m_flags = flags;
            m_hitFraction = 1f;

        }
Exemple #14
0
 public InLiteral(EFlags flags = EFlags.Escaped, char escape_character = '\\')
 {
     m_flags            = flags;
     m_escape_character = escape_character;
     m_quote_character  = '\0';
     m_in_literal_state = false;
     m_in_literal       = false;
     m_escape           = false;
 }
        CreateInternal(
            string tokenizedString,
            Module macroSource,
            bool verbatim,
            TokenizedStringArray positionalTokens,
            EFlags flags)
        {
            if (null == tokenizedString)
            {
                return(null);
            }

            // strings can be created during the multithreaded phase
            lock (Cache)
            {
                if (0 == (flags & EFlags.NoCache))
                {
                    var search = Cache.Where((ts) =>
                    {
                        // first check the simple states for equivalence
                        if (ts.OriginalString == tokenizedString && ts.ModuleWithMacros == macroSource && ts.Verbatim == verbatim)
                        {
                            // and then check the positional tokens, if they exist
                            var samePosTokenCount = ((null != positionalTokens) && (positionalTokens.Count() == ts.PositionalTokens.Count())) ||
                                                    ((null == positionalTokens) && (0 == ts.PositionalTokens.Count()));
                            if (!samePosTokenCount)
                            {
                                return(false);
                            }
                            for (int i = 0; i < ts.PositionalTokens.Count(); ++i)
                            {
                                // because positional tokens are TokenizedStrings, they will refer to the same object
                                if (ts.PositionalTokens[i] != positionalTokens[i])
                                {
                                    return(false);
                                }
                            }
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    });
                    var foundTS = search.FirstOrDefault();
                    if (null != foundTS)
                    {
                        ++foundTS.RefCount;
                        return(foundTS);
                    }
                }
                var newTS = new TokenizedString(tokenizedString, macroSource, verbatim, positionalTokens, flags);
                Cache.Add(newTS);
                return(newTS);
            }
        }
 public void ToggleFlagIf(EFlags flags, bool condition)
 {
     if (condition)
     {
         SetFlags(flags);
     }
     else
     {
         ClearFlags(flags);
     }
 }
Exemple #17
0
 void RegisterVariables()
 {
     _variableResolver.Register("AppName", () => System.IO.Path.GetFileNameWithoutExtension(ProgramHostPath));
     _variableResolver.Register("AppFolder", () => System.IO.Path.GetDirectoryName(ProgramHostPath));
     _variableResolver.Register("Win3muFolder", () =>
     {
         if (System.Reflection.Assembly.GetExecutingAssembly() != null)
         {
             return(System.IO.Path.GetDirectoryName(typeof(Machine).Assembly.Location));
         }
         return(null);
     });
     _variableResolver.Register("ax", () => ax.ToString("X4"));
     _variableResolver.Register("bx", () => bx.ToString("X4"));
     _variableResolver.Register("cx", () => cx.ToString("X4"));
     _variableResolver.Register("dx", () => dx.ToString("X4"));
     _variableResolver.Register("si", () => si.ToString("X4"));
     _variableResolver.Register("di", () => di.ToString("X4"));
     _variableResolver.Register("sp", () => sp.ToString("X4"));
     _variableResolver.Register("bp", () => bp.ToString("X4"));
     _variableResolver.Register("ip", () => ip.ToString("X4"));
     _variableResolver.Register("cs", () => cs.ToString("X4"));
     _variableResolver.Register("es", () => es.ToString("X4"));
     _variableResolver.Register("ds", () => ds.ToString("X4"));
     _variableResolver.Register("ss", () => ss.ToString("X4"));
     _variableResolver.Register("eflags", () => EFlags.ToString("X4"));
     _variableResolver.Register("al", () => al.ToString("X2"));
     _variableResolver.Register("ah", () => ah.ToString("X2"));
     _variableResolver.Register("bl", () => bl.ToString("X2"));
     _variableResolver.Register("bh", () => bh.ToString("X2"));
     _variableResolver.Register("cl", () => cl.ToString("X2"));
     _variableResolver.Register("ch", () => ch.ToString("X2"));
     _variableResolver.Register("dl", () => dl.ToString("X2"));
     _variableResolver.Register("dh", () => dh.ToString("X2"));
     _variableResolver.Register("asm", () =>
     {
         if (_disassembled == null)
         {
             _disassembled = _disassembler.Read(cs, ip);
         }
         return(_disassembled);
     });
     _variableResolver.Register("annotations", () =>
     {
         if (_disassembled == null)
         {
             _disassembled = _disassembler.Read(cs, ip);
         }
         return(_expressionContext.GenerateDisassemblyAnnotations(_disassembled, _disassembler.ImplicitParams));
     });
     _variableResolver.Register("cputime", () => CpuTime.ToString());
 }
        /// <summary>
        /// Sets the activity's flags.
        /// </summary>
        /// <param name="flags">Flags.</param>
        public void SetFlags(EFlags flags)
        {
            this.flags = flags;

            for (int i = 0; i < 32; i++)
            {
                switch ((EFlags)i)
                {
                case EFlags.AllowScreenshot:
                    InvalidateOptionsMenu();
                    break;
                }
            }
        }
        public (bool, int) ValidateRequest(HttpContext context)
        {
            Boolean IsValidToken = false;
            int     StatusCode   = default(int);
            DiQueue diQueue      = DiQueue.GetInstance();

            currentSession                      = context.RequestServices.GetService(typeof(CurrentSession)) as CurrentSession;
            currentSession.RequestPath          = context.Request != null ? context.Request.Path.Value : "";
            currentSession.FileUploadFolderName = this.configuration.GetValue <string>("Configuration:FolderName");
            Parallel.ForEach(context.Request.Headers, header =>
            {
                if (header.Value.FirstOrDefault() != null)
                {
                    if (header.Key == TokenName)
                    {
                        currentSession.Authorization = header.Value.ToString().Trim();
                    }
                }
            });

            if (NoCheck.Where(x => x.ToLower() == currentSession.RequestPath.Replace(@"/api/", "").ToLower()).FirstOrDefault() == null)
            {
                if (!string.IsNullOrEmpty(currentSession.Authorization))
                {
                    EFlags flag = this.beanContext.ValidateToken(currentSession.Authorization);
                    StatusCode   = (int)flag;
                    IsValidToken = false;
                    if (flag == EFlags.Success)
                    {
                        IsValidToken = true;
                        StatusCode   = (int)EFlags.Success;
                    }
                }
                else
                {
                    StatusCode   = (int)EFlags.TokenNotFound;
                    IsValidToken = false;
                }
            }
            else
            {
                IsValidToken = true;
                StatusCode   = (int)EFlags.Success;
            }
            return(IsValidToken, StatusCode);
        }
        public void UpdateFlags(ulong result, uint size, EFlags flags)
        {
            if (flags.HasFlag(EFlags.ZeroFlag))
            {
                ToggleFlagIf(EFlags.ZeroFlag, result == 0);
            }

            // http://graphics.stanford.edu/~seander/bithacks.html#ParityWith64Bits
            if (flags.HasFlag(EFlags.ParityFlag))
            {
                ToggleFlagIf(EFlags.ParityFlag, ((((((((ulong)result & 0xFF) * (ulong)0x0101010101010101) & 0x8040201008040201) % 0x1FF) & 1) == 0)));
            }

            if (flags.HasFlag(EFlags.SignFlag))
            {
                uint signFlag = (uint)(1 << (int)((size << 3) - 1));
                ToggleFlagIf(EFlags.SignFlag, (result & signFlag) == signFlag);
            }

            if (flags.HasFlag(EFlags.AdjustFlag))
            {
                ToggleFlagIf(EFlags.AdjustFlag, (result & 8) == 8);
            }

            if (flags.HasFlag(EFlags.OverflowFlag))
            {
                long signedResult = (long)result;
                if (size == 1)
                {
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > sbyte.MaxValue || signedResult < sbyte.MinValue);
                }
                else if (size == 2)
                {
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > short.MaxValue || signedResult < short.MinValue);
                }
                else if (size == 4)
                {
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > int.MaxValue || signedResult < int.MinValue);
                }
            }

            if (flags.HasFlag(EFlags.CarryFlag))
            {
                ToggleFlagIf(EFlags.CarryFlag, ((result >> ((int)size << 3)) & 1) == 1);
            }
        }
        public void Reset()
        {
            CallOffsets = new List <uint>();
            JumpBacks   = new List <uint>();
            Debugger.Reset();

            Eax       = new Eax();
            Ebx       = new Ebx();
            Ecx       = new Ecx();
            Edx       = new Edx();
            Esi       = new Esi();
            Edi       = new Edi();
            Esp       = new Esp();
            Ebp       = new Ebp();
            Eip       = 1;
            EFlags    = EFlags.ZeroFlag;
            Esp.Value = BaseAddress + 400;
        }
Exemple #22
0
        /// <summary>
        /// Sets the activity's flags.
        /// </summary>
        /// <param name="flags">Flags.</param>
        public void SetFlags(EFlags flags)
        {
            this.flags = flags;

            for (int i = 0; i < 32; i++)
            {
                switch ((EFlags)i)
                {
                case EFlags.AllowScreenshot:
                    Activity.InvalidateOptionsMenu();
                    break;

                case EFlags.StartRecording:
                    Activity.InvalidateOptionsMenu();
                    break;
                }
            }
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="box">Box to manage (mandatory)</param>
        /// <param name="editButton">Edit button (optional)</param>
        /// <param name="items">Items to populate with</param>
        /// <param name="includeNull">Whether to include an extra item for a "null" or empty selection.</param>
        public EditableComboBox([NotNull] ComboBox box, [CanBeNull] Button editButton, [NotNull] IDataSet items, EFlags flags)
        {
            this.ComboBox     = box;
            this._button      = editButton;
            this._includeNull = flags.Has(EFlags.IncludeNone) ? ENullItemName.RepresentingNone : flags.Has(EFlags.IncludeAll) ? ENullItemName.RepresentingAll : ENullItemName.NoNullItem;
            this._flags       = flags;
            this._config      = items;

            if (this._button != null)
            {
                this._button.Click += this._button_Click;
            }

            this.ComboBox.DrawMode              = DrawMode.OwnerDrawFixed;
            this.ComboBox.DrawItem             += this.ComboBox_DrawItem;
            this.ComboBox.DropDown             += this.ComboBox_DropDown; // Update on every drop-down in case something else modified the list
            this.ComboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged;
            this.UpdateItemsNoPreserve();                                 // Don't do this yet or we'll NRE if the caller has events on the combobox
        }
Exemple #24
0
        /// <summary>
        /// Gets a string for displaying set CPU flags.
        /// </summary>
        /// <param name="flags">The CPU flags to format.</param>
        /// <returns>String containing set CPU flags.</returns>
        private string GetFlagsString(EFlags flags)
        {
            var buffer = new StringBuilder();

            if ((flags & EFlags.Carry) != 0)
            {
                buffer.Append('C');
            }
            if ((flags & EFlags.Parity) != 0)
            {
                buffer.Append('P');
            }
            if ((flags & EFlags.Auxiliary) != 0)
            {
                buffer.Append('A');
            }
            if ((flags & EFlags.Zero) != 0)
            {
                buffer.Append('Z');
            }
            if ((flags & EFlags.Sign) != 0)
            {
                buffer.Append('S');
            }
            if ((flags & EFlags.Trap) != 0)
            {
                buffer.Append('T');
            }
            if ((flags & EFlags.InterruptEnable) != 0)
            {
                buffer.Append('I');
            }
            if ((flags & EFlags.Direction) != 0)
            {
                buffer.Append('D');
            }
            if ((flags & EFlags.Overflow) != 0)
            {
                buffer.Append('O');
            }

            return(buffer.ToString());
        }
Exemple #25
0
        private void FireException(string Message, EFlags ExceptionCode, string Token)
        {
            SessionException exception = new SessionException();

            exception.SetMessage(Message);
            exception.Token         = Token;
            exception.ExceptionCode = ExceptionCode;

            string Url = GetDefaultUrl();

            if (Url != null)
            {
                throw exception;
            }
            else
            {
                throw new ApplicationException("Session expire. Please login again.");
            }
        }
Exemple #26
0
        public H2BitmapCollection(Stream stream, int offset, int magic)
        {
            BinaryReader binReader = new BinaryReader(stream);
            stream.Position = offset;

            Type = (EType)binReader.ReadInt16();
            Format = (EFormat)binReader.ReadInt16();
            Usage = (EUsage)binReader.ReadInt16();
            Flags = (EFlags)binReader.ReadInt16();
            DetailFadeFactor = binReader.ReadSingle();
            SharpenAmount = binReader.ReadSingle();
            BumpHeight = binReader.ReadSingle();
            SpriteBudgetSize = (ESpriteBudgetSize)binReader.ReadInt16();
            SpriteBudgetCount = binReader.ReadInt16();
            ColourPlateWidth = binReader.ReadInt16();
            ColourPlateHeight = binReader.ReadInt16();
            CompressedColourPlateDataCount = binReader.ReadInt32();
            CompressedColourPlateDataPointer = binReader.ReadInt32();
            ProcessedPixelDataCount = binReader.ReadInt32();
            ProcessedPixelDataPointer = binReader.ReadInt32();
            BlueFilterSize = binReader.ReadSingle();
            AlphaBias = binReader.ReadSingle();
            MipmapCount = binReader.ReadInt16();
            SpriteUsage = (ESpriteUsage)binReader.ReadInt16();
            SpriteSpacing = binReader.ReadInt16();
            ForceFormat = binReader.ReadInt16();

            int sequenceCount = binReader.ReadInt32();
            int sequencePointer = binReader.ReadInt32();
            int bitmapCount = binReader.ReadInt32();
            int bitmapPointer = binReader.ReadInt32();

            Sequences = new Sequence[sequenceCount];
            for (int i = 0; i < sequenceCount; i++)
                Sequences[i] = new Sequence(stream, (sequencePointer - magic) + (i * Sequence.SizeOf), magic);

            Bitmaps = new BitmapData[bitmapCount];
            for (int i = 0; i < bitmapCount; i++)
                Bitmaps[i] = new BitmapData(stream, (bitmapPointer - magic) + (i * BitmapData.SizeOf));
        }
Exemple #27
0
        public string GenerateMessage(EFlags FlagName)
        {
            string Message = string.Empty;

            switch (FlagName)
            {
            case EFlags.TokenExpired:
                Message = "Your token get expired.";
                break;

            case EFlags.TokenNotFound:
                Message = "Your request does't contain authentication token.";
                break;

            case EFlags.InvalidToken:
                Message = "Invalid requested token.";
                break;

            default: Message = "Getting unknown error"; break;
            }
            return(Message);
        }
 private TokenizedString(
     string original,
     Module moduleWithMacros,
     bool verbatim,
     TokenizedStringArray positionalTokens,
     EFlags flags)
 {
     this.CreationStackTrace = System.Environment.StackTrace;
     this.ModuleWithMacros   = moduleWithMacros;
     if (null != positionalTokens)
     {
         this.PositionalTokens.AddRange(positionalTokens);
     }
     this.Verbatim       = verbatim;
     this.Flags         |= flags;
     this.OriginalString = original;
     if (verbatim)
     {
         this.ParsedString = NormalizeDirectorySeparators(original);
         return;
     }
 }
Exemple #29
0
 internal void SetReadOnly()
 {
     m_attrs |= EFlags.ReadOnly;
 }
Exemple #30
0
 internal void SetConst()
 {
     m_attrs |= EFlags.Const;
 }
Exemple #31
0
 internal void SetNew()
 {
     m_attrs |= EFlags.New;
 }
Exemple #32
0
        public void UpdateFlags(ulong result, uint size, EFlags flags)
        {
            if (flags.HasFlag(EFlags.ZeroFlag))
                ToggleFlagIf(EFlags.ZeroFlag, result == 0);

            // http://graphics.stanford.edu/~seander/bithacks.html#ParityWith64Bits
            if (flags.HasFlag(EFlags.ParityFlag))
                ToggleFlagIf(EFlags.ParityFlag, ((((((((ulong)result & 0xFF) * (ulong)0x0101010101010101) & 0x8040201008040201) % 0x1FF) & 1) == 0)));

            if (flags.HasFlag(EFlags.SignFlag))
            {
                uint signFlag = (uint)(1 << (int)((size << 3) - 1));
                ToggleFlagIf(EFlags.SignFlag, (result & signFlag) == signFlag);
            }

            if (flags.HasFlag(EFlags.AdjustFlag))
                ToggleFlagIf(EFlags.AdjustFlag, (result & 8) == 8);

            if (flags.HasFlag(EFlags.OverflowFlag))
            {
                long signedResult = (long)result;
                if (size == 1)
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > sbyte.MaxValue || signedResult < sbyte.MinValue);
                else if (size == 2)
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > short.MaxValue || signedResult < short.MinValue);
                else if (size == 4)
                    ToggleFlagIf(EFlags.OverflowFlag, signedResult > int.MaxValue || signedResult < int.MinValue);
            }

            if (flags.HasFlag(EFlags.CarryFlag))
                ToggleFlagIf(EFlags.CarryFlag, ((result >> ((int)size << 3)) & 1) == 1);
        }
Exemple #33
0
 protected void ModifyFlags(EFlags xi_remove, EFlags xi_add)
 {
     Flags = (ushort)((Flags & ~(ushort)xi_remove) | (ushort)xi_add);
 }
Exemple #34
0
 public void RemoveGameGenie()
 {
     flags &= ~EFlags.GameGenie;
     Sync();
 }
Exemple #35
0
 /// <summary>
 /// Adds the given flags to the activity's flags.
 /// </summary>
 /// <param name="flags">Flags.</param>
 public void AddFlags(EFlags flags)
 {
     SetFlags(flags | flags);
 }
Exemple #36
0
 public void SetFlags(EFlags flags)
 {
     EFlags = EFlags.Set(flags);
 }
Exemple #37
0
 internal void SetPrivate()
 {
     Debug.Assert(VisibilityNotSet);
     m_attrs |= EFlags.Private;
 }
Exemple #38
0
 internal void SetProtected()
 {
     Debug.Assert(VisibilityNotSet);
     m_attrs |= EFlags.Protected;
 }
Exemple #39
0
 internal void SetPublic()
 {
     Debug.Assert(VisibilityNotSet);
     m_attrs |= EFlags.Public;
 }
Exemple #40
0
 public void ClearFlags()
 {
     EFlags = EFlags.Clear();
 }
Exemple #41
0
 public void ClearFlags(EFlags flags)
 {
     EFlags = EFlags.Clear(flags);
 }
Exemple #42
0
			public void RemoveGameGenie()
			{
				flags &= ~EFlags.GameGenie;
				Sync();
			}
Exemple #43
0
        public void Reset()
        {
            CallOffsets = new List<uint>();
            JumpBacks = new List<uint>();
            Debugger.Reset();

            Eax = new Eax();
            Ebx = new Ebx();
            Ecx = new Ecx();
            Edx = new Edx();
            Esi = new Esi();
            Edi = new Edi();
            Esp = new Esp();
            Ebp = new Ebp();
            Eip = 1;
            EFlags = EFlags.ZeroFlag;
            Esp.Value = BaseAddress + 400;
        }
Exemple #44
0
            public BitmapData(Stream stream, int offset)
            {
                BinaryReader binReader = new BinaryReader(stream);
                stream.Position = offset;

                Tag = binReader.ReadChars(4);
                Width = binReader.ReadInt16();
                Height = binReader.ReadInt16();
                Depth = binReader.ReadInt16();
                Type = (EType)binReader.ReadInt16();
                Format = (EFormat)binReader.ReadInt16();
                Flags = (EFlags)binReader.ReadUInt16();
                RegistrationPointX = binReader.ReadInt16();
                RegistrationPointY = binReader.ReadInt16();
                MIPMapCount = binReader.ReadInt16();
                PixelOffset = binReader.ReadInt32();
                unused00 = binReader.ReadInt16();
                LOD1Offset = binReader.ReadInt32();
                LOD2Offset = binReader.ReadInt32();
                LOD3Offset = binReader.ReadInt32();
                unused0 = binReader.ReadInt32();
                unused1 = binReader.ReadInt32();
                unused2 = binReader.ReadInt32();
                LOD1Size = binReader.ReadInt32();
                LOD2Size = binReader.ReadInt32();
                LOD3Size = binReader.ReadInt32();
                unused3 = binReader.ReadInt32();
                unused4 = binReader.ReadInt32();
                unused5 = binReader.ReadInt32();
                ID = binReader.ReadInt32();
                unused6 = binReader.ReadBytes(32);
            } 
Exemple #45
0
 public static EFlags Set(this EFlags eFlags, EFlags flags)
 {
     return eFlags | flags & AllEFlags;
 }
        CreateInternal(
            string tokenizedString,
            Module macroSource,
            bool verbatim,
            TokenizedStringArray positionalTokens,
            EFlags flags)
        {
            if (null == tokenizedString)
            {
                return null;
            }

            // strings can be created during the multithreaded phase
            lock (Cache)
            {
                if (0 == (flags & EFlags.NoCache))
                {
                    var search = Cache.Where((ts) =>
                    {
                        // first check the simple states for equivalence
                        if (ts.OriginalString == tokenizedString && ts.ModuleWithMacros == macroSource && ts.Verbatim == verbatim)
                        {
                            // and then check the positional tokens, if they exist
                            var samePosTokenCount = ((null != positionalTokens) && (positionalTokens.Count() == ts.PositionalTokens.Count())) ||
                                                    ((null == positionalTokens) && (0 == ts.PositionalTokens.Count()));
                            if (!samePosTokenCount)
                            {
                                return false;
                            }
                            for (int i = 0; i < ts.PositionalTokens.Count(); ++i)
                            {
                                // because positional tokens are TokenizedStrings, they will refer to the same object
                                if (ts.PositionalTokens[i] != positionalTokens[i])
                                {
                                    return false;
                                }
                            }
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    });
                    var foundTS = search.FirstOrDefault();
                    if (null != foundTS)
                    {
                        ++foundTS.RefCount;
                        return foundTS;
                    }
                }
                var newTS = new TokenizedString(tokenizedString, macroSource, verbatim, positionalTokens, flags);
                Cache.Add(newTS);
                return newTS;
            }
        }
 public TriangleRaycastCallback(ref Vector3 from, ref Vector3 to, EFlags flags)
 {
     HitFraction = 1.0f;
 }
Exemple #48
0
			public void SetGameGenie(byte? compare, byte value)
			{
				flags |= EFlags.GameGenie;
				Compare = compare;
				Value = value;
				Sync();
			}
Exemple #49
0
 /// <summary>
 /// Queries whether or not the activity has the given flags.
 /// </summary>
 /// <returns><c>true</c> if this instance has flags the specified flags; otherwise, <c>false</c>.</returns>
 /// <param name="flags">Flags.</param>
 public bool HasFlags(EFlags flags)
 {
     return((this.flags & flags) == flags);
 }
Exemple #50
0
 public void ToggleFlagIf(EFlags flags, bool condition)
 {
     if (condition) SetFlags(flags); else ClearFlags(flags);
 }
Exemple #51
0
 /// <summary>
 /// Removes the given flags to the activity's flags.
 /// </summary>
 /// <param name="flags">Flags.</param>
 public void RemoveFlags(EFlags flags)
 {
     SetFlags(flags ^ flags);
 }
Exemple #52
0
 internal void SetVirtual()
 {
     Debug.Assert(!IsOverride && !IsStatic && !IsSealed);
     m_attrs |= EFlags.Virtual;
 }
Exemple #53
0
 public static EFlags Clear(this EFlags eFlags, EFlags flags)
 {
     return eFlags & (EFlags)(AllEFlags - flags);
 }
Exemple #54
0
 internal void SetOverride()
 {
     Debug.Assert(!IsVirtual && !IsStatic && !IsSealed);
     m_attrs |= EFlags.Override;
 }
 private TokenizedString(
     string original,
     Module moduleWithMacros,
     bool verbatim,
     TokenizedStringArray positionalTokens,
     EFlags flags)
 {
     this.CreationStackTrace = System.Environment.StackTrace;
     this.ModuleWithMacros = moduleWithMacros;
     if (null != positionalTokens)
     {
         this.PositionalTokens.AddRange(positionalTokens);
     }
     this.Verbatim = verbatim;
     this.Flags |= flags;
     this.OriginalString = original;
     if (verbatim)
     {
         this.ParsedString = NormalizeDirectorySeparators(original);
         return;
     }
 }
Exemple #56
0
 internal void SetAbstract()
 {
     Debug.Assert(!IsSealed);
     m_attrs |= EFlags.Abstract;   
 }
Exemple #57
0
 internal void SetSealed()
 {
     Debug.Assert(!IsAbstract);
     m_attrs |= EFlags.Sealed;
 }
 public TriangleRaycastCallback(ref Vector3 from, ref Vector3 to, EFlags flags)
 {
     HitFraction = 1.0f;
 }
Exemple #59
0
 internal void SetInternal()
 {
     Debug.Assert(VisibilityNotSet);
     m_attrs |= EFlags.Internal;
 }
Exemple #60
0
 internal void SetStatic()
 {
     Debug.Assert(!IsVirtual && !IsOverride);
     m_attrs |= EFlags.Static;
 }