public HollowKnightComponent(LiveSplitState state) { mem = new HollowKnightMemory(); settings = new HollowKnightSettings(); foreach (string key in keys) { currentValues[key] = ""; } if (state != null) { Model = new TimerModel() { CurrentState = state }; Model.InitializeGameTime(); Model.CurrentState.IsGameTimePaused = true; state.OnReset += OnReset; state.OnPause += OnPause; state.OnResume += OnResume; state.OnStart += OnStart; state.OnSplit += OnSplit; state.OnUndoSplit += OnUndoSplit; state.OnSkipSplit += OnSkipSplit; } }
public ProgramPointer(HollowKnightMemory memory, MemPointer pointer) { this.Memory = memory; this.Name = pointer; this.AutoDeref = true; lastID = memory.Program == null ? -1 : memory.Program.Id; lastTry = DateTime.MinValue; }
public HollowKnightComponent() { mem = new HollowKnightMemory(); settings = new HollowKnightSettings(); foreach (string key in keys) { currentValues[key] = ""; } }
public int UpdateHP(HollowKnightMemory mem) { int hp = HP; if (Pointer != 0) { HP = mem.Program.Read <int>((IntPtr)Pointer, 0x10 + HPIndex * 4, 0x14); } return(hp); }
public HollowKnightInfo() { this.DoubleBuffered = true; InitializeComponent(); Text = "Hollow Knight Info " + Assembly.GetExecutingAssembly().GetName().Version.ToString(); Memory = new HollowKnightMemory(); Thread t = new Thread(UpdateLoop); t.IsBackground = true; t.Start(); }
public int UpdateHP(HollowKnightMemory mem, int newHP = -1) { int hp = HP; if (Pointer != 0) { if (newHP > 0) { HP = newHP; mem.Program.Write <int>((IntPtr)Pointer, newHP, 0x10 + HPIndex * 4, 0x14); } else { HP = mem.Program.Read <int>((IntPtr)Pointer, 0x10 + HPIndex * 4, 0x14); } } return(hp); }
public ProgramPointer(HollowKnightMemory memory, MemPointer pointer) { this.Memory = memory; this.Name = pointer; this.AutoDeref = true; //This shows up if the Modding API is installed. In this case the pointer for GameManager is slightly off. if (File.Exists(Path.Combine(Path.GetDirectoryName(Memory.Program.MainModule.FileName), @"hollow_knight_Data\Managed\Assembly-CSharp.xml"))) { Log("Modding API Detected, using API Signature for GameManager"); foreach (KeyValuePair <MemVersion, Dictionary <MemPointer, string> > pattern in funcPatterns) { pattern.Value[MemPointer.GameManager] = "558BEC5783EC048B7D088B05????????83EC086A0050E8????????83C41085C07423B8????????893883EC0C57E8????????83C41083EC0C57393FE8????????83C410EB3F8B05"; } } lastID = memory.Program == null ? -1 : memory.Program.Id; lastTry = DateTime.MinValue; }
public void UpdateData(HollowKnightMemory mem, Action <string> logWriter) { Process program = mem.Program; byte[] playerData = mem.GetPlayerData(DataLength); foreach (KeyValuePair <string, PlayerKey> pair in Data) { PlayerKey key = pair.Value; switch (key.Name) { case "scenesVisited": case "scenesMapped": case "scenesEncounteredBench": case "scenesGrubRescued": case "scenesEncounteredCocoon": case "scenesEncounteredDreamPlant": case "scenesEncounteredDreamPlantC": case "playerStory": case "MPCharge": case "MPReserve": case "equippedCharms": continue; } object oldValue = key.Value; switch (key.Type) { case "Vector3": key.Value = new PointF(BitConverter.ToSingle(playerData, key.Index), BitConverter.ToSingle(playerData, key.Index + 4)); break; case "Single": key.Value = BitConverter.ToSingle(playerData, key.Index); break; case "Int16": key.Value = BitConverter.ToInt16(playerData, key.Index); break; case "Int64": key.Value = BitConverter.ToInt64(playerData, key.Index); break; case "String": key.Value = program.Read((IntPtr)BitConverter.ToUInt32(playerData, key.Index)); break; case "Completion": key.Value = program.Read <bool>((IntPtr)BitConverter.ToUInt32(playerData, key.Index), 0xa); break; case "Byte": key.Value = playerData[key.Index]; break; case "Boolean": key.Value = playerData[key.Index] == 1; break; default: key.Value = BitConverter.ToInt32(playerData, key.Index); break; } bool changed = oldValue == null; if (!changed) { switch (key.Type) { case "Vector3": changed = (PointF)oldValue != (PointF)key.Value; break; case "Single": changed = (float)oldValue != (float)key.Value; break; case "Int16": changed = (short)oldValue != (short)key.Value; break; case "Int64": changed = (long)oldValue != (long)key.Value; break; case "String": changed = (string)oldValue != (string)key.Value; break; case "Completion": changed = (bool)oldValue != (bool)key.Value; break; case "Byte": changed = (byte)oldValue != (byte)key.Value; break; case "Boolean": changed = (bool)oldValue != (bool)key.Value; break; default: changed = (int)oldValue != (int)key.Value; break; } } if (changed && oldValue != null && logWriter != null) { logWriter(key.ToString(oldValue)); } } }