Beispiel #1
0
      public bool SetValue(double value, uint address, bool absoluteAddress = false, uint?mask = null, int?shift = null)
      {
          byte[] bytes        = BitConverter.GetBytes(value);
          byte[] bytes1       = bytes.Take(4).ToArray();
          byte[] bytes2       = bytes.Skip(4).Take(4).ToArray();
          byte[] bytesSwapped = bytes2.Concat(bytes1).ToArray();

          bool returnValue = WriteRam(bytesSwapped, (UIntPtr)address, EndiannessType.Little, absoluteAddress);

          if (returnValue)
          {
              WatchVariableLockManager.UpdateMemoryLockValue(value, address, typeof(double), mask, shift);
          }
          return(returnValue);
      }
Beispiel #2
0
        public bool SetValue(UInt32 value, uint address, bool absoluteAddress = false, uint?mask = null)
        {
            if (mask.HasValue)
            {
                uint oldValue = GetUInt32(address, absoluteAddress);
                value = (uint)((oldValue & ~mask.Value) | (value & mask.Value));
            }
            bool returnValue = WriteRamLittleEndian(BitConverter.GetBytes(value), address, absoluteAddress);

            if (returnValue)
            {
                WatchVariableLockManager.UpdateMemoryLockValue(value.ToString(), address, typeof(uint), mask);
            }
            return(returnValue);
        }
Beispiel #3
0
        public bool SetValue(sbyte value, uint address, bool absoluteAddress = false, uint?mask = null)
        {
            if (mask.HasValue)
            {
                sbyte oldValue = GetSByte(address, absoluteAddress);
                value = (sbyte)((oldValue & ~mask.Value) | (value & mask.Value));
            }
            bool returnValue = WriteRamLittleEndian(new byte[] { (byte)value }, address, absoluteAddress);

            if (returnValue)
            {
                WatchVariableLockManager.UpdateMemoryLockValue(value.ToString(), address, typeof(sbyte), mask);
            }
            return(returnValue);
        }
Beispiel #4
0
        public void ToggleLocked(bool?newLockedValueNullable, List <uint> addresses = null)
        {
            bool currentLockedValue = WatchVariableLockManager.ContainsLocksBool(WatchVar, addresses);
            bool newLockedValue     = newLockedValueNullable ?? !currentLockedValue;

            if (newLockedValue == currentLockedValue)
            {
                return;
            }

            if (newLockedValue)
            {
                WatchVariableLockManager.AddLocks(WatchVar, addresses);
            }
            else
            {
                WatchVariableLockManager.RemoveLocks(WatchVar, addresses);
            }
        }
Beispiel #5
0
      public bool SetValue(UInt32 value, uint address, bool absoluteAddress = false, uint?mask = null, int?shift = null)
      {
          if (shift.HasValue)
          {
              value = (uint)(value << shift.Value);
          }
          if (mask.HasValue)
          {
              uint oldValue = GetUInt32(address, absoluteAddress);
              value = (uint)((oldValue & ~mask.Value) | (value & mask.Value));
          }
          bool returnValue = WriteRam(BitConverter.GetBytes(value), (UIntPtr)address, EndiannessType.Little, absoluteAddress);

          if (returnValue)
          {
              WatchVariableLockManager.UpdateMemoryLockValue(value, address, typeof(uint), mask, shift);
          }
          return(returnValue);
      }
Beispiel #6
0
      public bool SetValue(sbyte value, uint address, bool absoluteAddress = false, uint?mask = null, int?shift = null)
      {
          if (shift.HasValue)
          {
              value = (sbyte)(value << shift.Value);
          }
          if (mask.HasValue)
          {
              sbyte oldValue = GetSByte(address, absoluteAddress);
              value = (sbyte)((oldValue & ~mask.Value) | (value & mask.Value));
          }
          bool returnValue = WriteRam(new byte[] { (byte)value }, (UIntPtr)address, EndiannessType.Little, absoluteAddress);

          if (returnValue)
          {
              WatchVariableLockManager.UpdateMemoryLockValue(value, address, typeof(sbyte), mask, shift);
          }
          return(returnValue);
      }
Beispiel #7
0
        private void OnUpdate(object sender, EventArgs e)
        {
            using (new AccessScope <StroopMainForm>(this))
            {
                labelFpsCounter.Text = "FPS: " + (int)Config.Stream?.FpsInPractice ?? "<none>";
                UpdateComboBoxes();
                DataModels.Update();
                FormManager.Update();
                ObjectSlotsManager.Update();
                //Config.InjectionManager.Update();

                foreach (TabPage page in tabControlMain.TabPages)
                {
                    Tabs.STROOPTab.UpdateTab(page, tabControlMain.SelectedTab == page);
                }

                WatchVariableLockManager.Update();
                TriangleDataModel.ClearCache();
            }
        }
Beispiel #8
0
 private void OnUpdate(object sender, EventArgs e)
 {
     this.TryInvoke(new Action(() =>
     {
         UpdateComboBoxes();
         DataModels.Update();
         Config.ObjectSlotsManager.Update();
         Config.ObjectManager.Update(tabControlMain.SelectedTab == tabPageObject);
         Config.MarioManager.Update(tabControlMain.SelectedTab == tabPageMario);
         Config.CameraManager.Update(tabControlMain.SelectedTab == tabPageCamera);
         Config.HudManager.Update(tabControlMain.SelectedTab == tabPageHud);
         Config.ActionsManager.Update(tabControlMain.SelectedTab == tabPageActions);
         Config.WaterManager.Update(tabControlMain.SelectedTab == tabPageWater);
         Config.SnowManager.Update(tabControlMain.SelectedTab == tabPageSnow);
         Config.InputManager.Update(tabControlMain.SelectedTab == tabPageInput);
         Config.FileManager.Update(tabControlMain.SelectedTab == tabPageFile);
         Config.MainSaveManager.Update(tabControlMain.SelectedTab == tabPageMainSave);
         Config.QuarterFrameManager.Update(tabControlMain.SelectedTab == tabPageQuarterFrame);
         Config.CustomManager.Update(tabControlMain.SelectedTab == tabPageCustom);
         Config.VarHackManager.Update(tabControlMain.SelectedTab == tabPageVarHack);
         Config.CamHackManager.Update(tabControlMain.SelectedTab == tabPageCamHack);
         Config.MiscManager.Update(tabControlMain.SelectedTab == tabPageMisc);
         Config.TriangleManager.Update(tabControlMain.SelectedTab == tabPageTriangles);
         Config.AreaManager.Update(tabControlMain.SelectedTab == tabPageArea);
         Config.DebugManager.Update(tabControlMain.SelectedTab == tabPageDebug);
         Config.PuManager.Update(tabControlMain.SelectedTab == tabPagePu);
         Config.TasManager.Update(tabControlMain.SelectedTab == tabPageTas);
         Config.TestingManager.Update(tabControlMain.SelectedTab == tabPageTesting);
         Config.GfxManager.Update(tabControlMain.SelectedTab == tabPageGfx);
         Config.OptionsManager.Update(tabControlMain.SelectedTab == tabPageOptions);
         Config.MemoryManager.Update(tabControlMain.SelectedTab == tabPageMemory);
         Config.CoinManager.Update(tabControlMain.SelectedTab == tabPageCoin);
         Config.M64Manager.Update(tabControlMain.SelectedTab == tabPageM64);
         Config.MapManager?.Update();
         Config.Map2Manager?.Update();
         Config.ModelManager?.Update();
         Config.InjectionManager.Update();
         Config.HackManager.Update();
         WatchVariableLockManager.Update();
     }));
 }
Beispiel #9
0
      public uint GetUInt32(uint address, bool absoluteAddress = false, uint?mask = null, int?shift = null)
      {
          object lockValue   = WatchVariableLockManager.GetMemoryLockValue(address, typeof(uint), mask, shift);
          uint?  parsedValue = ParsingUtilities.ParseUIntRoundingWrapping(lockValue);

          if (parsedValue.HasValue)
          {
              return(parsedValue.Value);
          }

          uint value = BitConverter.ToUInt32(ReadRam((UIntPtr)address, 4, EndiannessType.Little, absoluteAddress), 0);

          if (mask.HasValue)
          {
              value = (uint)(value & mask.Value);
          }
          if (shift.HasValue)
          {
              value = (uint)(value >> shift.Value);
          }
          return(value);
      }
Beispiel #10
0
      public sbyte GetSByte(uint address, bool absoluteAddress = false, uint?mask = null, int?shift = null)
      {
          object lockValue   = WatchVariableLockManager.GetMemoryLockValue(address, typeof(sbyte), mask, shift);
          sbyte? parsedValue = ParsingUtilities.ParseSByteRoundingWrapping(lockValue);

          if (parsedValue.HasValue)
          {
              return(parsedValue.Value);
          }

          sbyte value = (sbyte)ReadRam((UIntPtr)address, 1, EndiannessType.Little, absoluteAddress)[0];

          if (mask.HasValue)
          {
              value = (sbyte)(value & mask.Value);
          }
          if (shift.HasValue)
          {
              value = (sbyte)(value >> shift.Value);
          }
          return(value);
      }
Beispiel #11
0
        public bool AddValue(object objectValue, bool add, List <uint> addresses = null)
        {
            double?changeValueNullable = ParsingUtilities.ParseDoubleNullable(objectValue);

            if (!changeValueNullable.HasValue)
            {
                return(false);
            }
            double changeValue = changeValueNullable.Value;

            List <object>  currentValues = _watchVar.GetValues(addresses);
            List <double?> currentValuesDoubleNullable =
                currentValues.ConvertAll(
                    currentValue => ParsingUtilities.ParseDoubleNullable(currentValue));
            List <object> newValues = currentValuesDoubleNullable.ConvertAll(currentValueDoubleNullable =>
            {
                if (!currentValueDoubleNullable.HasValue)
                {
                    return(null);
                }
                double currentValueDouble = currentValueDoubleNullable.Value;
                object convertedValue     = ConvertValue(currentValueDouble, false, false);
                // TODO tyler fix this for float logic
                double convertedValueDouble = ParsingUtilities.ParseDouble(convertedValue);
                double modifiedValue        = convertedValueDouble + changeValue * (add ? +1 : -1);
                object unconvertedValue     = UnconvertValue(modifiedValue);
                return(unconvertedValue);
            });

            bool success = _watchVar.SetValues(newValues, addresses);

            if (success && GetLockedBool(addresses))
            {
                WatchVariableLockManager.UpdateLockValues(_watchVar, newValues, addresses);
            }
            return(success);
        }
Beispiel #12
0
 public bool GetLockedBool(List <uint> addresses = null)
 {
     return(WatchVariableLockManager.ContainsLocksBool(WatchVar, addresses));
 }
Beispiel #13
0
 public CheckState GetLockedCheckState(List <uint> addresses = null)
 {
     return(WatchVariableLockManager.ContainsLocksCheckState(WatchVar, addresses));
 }
Beispiel #14
0
 public void UpdateItemCheckStates(List <uint> addresses = null)
 {
     _itemLock.Checked           = GetLockedBool(addresses);
     _itemRemoveAllLocks.Visible = WatchVariableLockManager.ContainsAnyLocks();
     _itemFixAddress.Checked     = _watchVarControl.FixedAddressList != null;
 }