public void UpdateUberState(UberState uberState = null) { //UbserStateController.m_currentStateValueStore.m_groupMap IntPtr groups = UberStateController.Read <IntPtr>(Program, 0xb8, 0x40, 0x18); //.Count int groupCount = Program.Read <int>(groups, 0x20); //.Values groups = Program.Read <IntPtr>(groups, 0x18); byte[] groupsData = Program.Read(groups + 0x20, groupCount * 0x18); bool updateAll = uberState == null; for (int i = 0; i < groupCount; i++) { //.Values[i].m_id.m_id IntPtr group = (IntPtr)BitConverter.ToUInt64(groupsData, 0x10 + (i * 0x18)); byte[] groupData = Program.Read(group + 0x18, 48); long groupID = Program.Read <int>((IntPtr)BitConverter.ToUInt64(groupData, 0), 0x10); if (!updateAll && groupID != uberState.GroupID) { continue; } //.Values[i].m_objectStateMap IntPtr map = (IntPtr)BitConverter.ToUInt64(groupData, 8); //.Values[i].m_objectStateMap.Count int mapCount = Program.Read <int>(map, 0x20); if (mapCount > 0 && (updateAll || uberState.IsObjectType)) { map = Program.Read <IntPtr>(map, 0x18); byte[] data = Program.Read(map + 0x20, mapCount * 0x18); for (int j = 0; j < mapCount; j++) { //.Values[i].m_objectStateMap.Keys[j] long id = BitConverter.ToInt32(data, j * 0x18); if (!updateAll && id != uberState.ID) { continue; } if (!updateAll || uberIDLookup.TryGetValue((groupID << 32) | id, out uberState)) { if (uberState.Type == UberStateType.SavePedestalUberState) { uberState.Value.Byte = Program.Read <byte>((IntPtr)BitConverter.ToUInt64(data, 0x10 + (j * 0x18)), 0x11); } else { //playerUberStateDescriptor } } } } //.Values[i].m_boolStateMap map = (IntPtr)BitConverter.ToUInt64(groupData, 16); //.Values[i].m_boolStateMap.Count mapCount = Program.Read <int>(map, 0x20); if (mapCount > 0 && (updateAll || uberState.IsBoolType)) { map = Program.Read <IntPtr>(map, 0x18); byte[] data = Program.Read(map + 0x20, mapCount * 0x18); for (int j = 0; j < mapCount; j++) { //.Values[i].m_boolStateMap.Keys[j] long id = BitConverter.ToInt32(data, j * 0x18); if (!updateAll && id != uberState.ID) { continue; } if (!updateAll || uberIDLookup.TryGetValue((groupID << 32) | id, out uberState)) { uberState.Value.Bool = data[0x10 + (j * 0x18)] != 0; } } } //.Values[i].m_floatStateMap map = (IntPtr)BitConverter.ToUInt64(groupData, 24); //.Values[i].m_floatStateMap.Count mapCount = Program.Read <int>(map, 0x20); if (mapCount > 0 && (updateAll || uberState.IsFloatType)) { map = Program.Read <IntPtr>(map, 0x18); byte[] data = Program.Read(map + 0x20, mapCount * 0x18); for (int j = 0; j < mapCount; j++) { //.Values[i].m_floatStateMap.Keys[j] long id = BitConverter.ToInt32(data, j * 0x18); if (!updateAll && id != uberState.ID) { continue; } if (!updateAll || uberIDLookup.TryGetValue((groupID << 32) | id, out uberState)) { uberState.Value.Float = BitConverter.ToSingle(data, 0x10 + (j * 0x18)); } } } //.Values[i].m_intStateMap map = (IntPtr)BitConverter.ToUInt64(groupData, 32); //.Values[i].m_intStateMap.Count mapCount = Program.Read <int>(map, 0x20); if (mapCount > 0 && (updateAll || uberState.IsIntType)) { map = Program.Read <IntPtr>(map, 0x18); byte[] data = Program.Read(map + 0x20, mapCount * 0x18); for (int j = 0; j < mapCount; j++) { //.Values[i].m_intStateMap.Keys[j] long id = BitConverter.ToInt32(data, j * 0x18); if (!updateAll && id != uberState.ID) { continue; } if (!updateAll || uberIDLookup.TryGetValue((groupID << 32) | id, out uberState)) { uberState.Value.Int = BitConverter.ToInt32(data, 0x10 + (j * 0x18)); } } } //.Values[i].m_byteStateMap map = (IntPtr)BitConverter.ToUInt64(groupData, 40); //.Values[i].m_byteStateMap.Count mapCount = Program.Read <int>(map, 0x20); if (mapCount > 0 && (updateAll || uberState.IsByteType)) { map = Program.Read <IntPtr>(map, 0x18); byte[] data = Program.Read(map + 0x20, mapCount * 0x18); for (int j = 0; j < mapCount; j++) { //.Values[i].m_byteStateMap.Keys[j] long id = BitConverter.ToInt32(data, j * 0x18); if (!updateAll && id != uberState.ID) { continue; } if (!updateAll || uberIDLookup.TryGetValue((groupID << 32) | id, out uberState)) { uberState.Value.Byte = data[0x10 + (j * 0x18)]; } } } } }
public ControlScheme GetControlScheme() { //GameSettings.Instance.m_currentControlSchemes return(GameSettings.Read <ControlScheme>(Program, 0xb8, 0x0, 0x94)); }
private void PopulateUberStates() { uberIDLookup = new Dictionary <long, UberState>(); //UberStateCollection.Instance.m_descriptorsArray IntPtr descriptors = UberStateCollection.Read <IntPtr>(Program, 0xb8, 0x10, 0x20); //.Count int descriptorsCount = Program.Read <int>(descriptors, 0x18); byte[] data = Program.Read(descriptors + 0x20, descriptorsCount * 0x8); for (int i = 0; i < descriptorsCount; i++) { //.m_descriptorsArray[i] IntPtr descriptor = (IntPtr)BitConverter.ToUInt64(data, i * 0x8); UberStateType type = UberStateType.SerializedBooleanUberState; Enum.TryParse <UberStateType>(Program.ReadAscii(descriptor, 0x0, 0x10, 0x0), out type); int groupOffset = 0x38; switch (type) { case UberStateType.SerializedByteUberState: case UberStateType.SerializedIntUberState: case UberStateType.SavePedestalUberState: groupOffset = 0x30; break; case UberStateType.PlayerUberStateDescriptor: groupOffset = 0x40; break; case UberStateType.CountUberState: case UberStateType.BooleanUberState: case UberStateType.ByteUberState: case UberStateType.IntUberState: case UberStateType.ConditionUberState: continue; } //.m_descriptorsArray[i].ID.m_id int id = Program.Read <int>(descriptor, 0x18, 0x10); //.m_descriptorsArray[i].Name IntPtr namePtr = Program.Read <IntPtr>(descriptor, 0x10, 0x48); string name = string.Empty; if (namePtr != IntPtr.Zero) { name = Program.ReadAscii(namePtr); } else { name = Program.ReadAscii(descriptor, 0x10, 0x50); } //.m_descriptorsArray[i].Group.ID.m_id int groupID = Program.Read <int>(descriptor, groupOffset, 0x18, 0x10); //.m_descriptorsArray[i].Group.Name namePtr = Program.Read <IntPtr>(descriptor, groupOffset, 0x10, 0x48); string groupName = string.Empty; if (namePtr != IntPtr.Zero) { groupName = Program.ReadAscii(namePtr); } else { groupName = Program.ReadAscii(descriptor, groupOffset, 0x10, 0x50); } UberState uberState = new UberState() { Type = type, ID = id, Name = name, GroupID = groupID, GroupName = groupName }; uberIDLookup.Add(((long)groupID << 32) | (long)id, uberState); } }
public GameState GameState() { //GameStateMachine.m_instance.CurrentState return((GameState)GameStateMachine.Read <int>(Program, 0xb8, 0x0, 0x10)); }
public Screen TitleScreen() { //TitleScreenManager.Instance.m_currentScreen return((Screen)TitleScreenManager.Read <int>(Program, 0xb8, 0x0, 0xb8)); }
public AreaType PlayerArea() { //GameWorld.CurrentArea.Area.WorldMapAreaUniqueID return(GameWorld.Read <AreaType>(Program, 0xb8, 0x0, 0x30, 0x10, 0x20)); }
public double ElapsedTime() { //GameController.Instance.Timer.CurrentTime return(GameController.Read <double>(Program, 0xb8, 0x0, 0x28, 0x20)); }
public Stats PlayerStats() { //PlayerUberStateGroup.Instance.PlayerUberState.m_state.Stats return(PlayerUberStateGroup.Read <Stats>(Program, 0xb8, 0x0, 0x18, 0x30, 0x28, 0x10)); }
public Vector2 Position() { //Characters.Sein.PlatformBehaviour.PlatformMovement.m_prevPosition return(Characters.Read <Vector2>(Program, 0xb8, 0x10, 0x98, 0x18, 0xd0)); }
public int Difficulty() { //DifficultyController.Instance.Difficulty return(DifficultyController.Read <int>(Program, 0xb8, 0x0, 0x20)); }
public int FrameCount() { return(FrameCounter.Read <int>(Program, 0xb8, 0x0)); }
public bool NoPauseEnabled() { return(NoPausePatch.Read <int>(Program) == 0x4890C5FF); }
public bool DebugEnabled() { return(CheatsHandler.Read <bool>(Program, 0xb8, 0x0, 0x20)); }
public float RaceTime() { return(RaceSystem.Read <float>(Program, 0xb8, 0x0, 0x28, 0x18)); }