Exemplo n.º 1
0
 public GameState GameState()
 {
     //GameStateMachine.m_instance.CurrentState
     return((GameState)GameStateMachine.Read <int>(Program, 0xb8, 0x0, 0x10));
 }
Exemplo n.º 2
0
 public Screen TitleScreen()
 {
     //TitleScreenManager.Instance.m_currentScreen
     return((Screen)TitleScreenManager.Read <int>(Program, 0xb8, 0x0, 0xb8));
 }
Exemplo n.º 3
0
        private void PopulateUberStates()
        {
            uberIDLookup = new Dictionary <long, UberState>();
            //UberStateCollection.Instance.m_descriptorsArray
            IntPtr descriptors = (IntPtr)UberStateCollection.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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);
            }
        }
Exemplo n.º 4
0
        public void UpdateUberState(UberState uberState = null)
        {
            //UbserStateController.m_currentStateValueStore.m_groupMap
            IntPtr groups = (IntPtr)UberStateController.Read <ulong>(Program, 0xb8, 0x40, 0x18);
            //.Count
            int groupCount = Program.Read <int>(groups, 0x20);

            //.Values
            groups = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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 = (IntPtr)Program.Read <ulong>(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)];
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
 public string CurrentScene()
 {
     //Scenes.Manager.m_currentScene.Scene
     return(ScenesManager.Read(Program, 0xb8, 0x0, 0x180, 0x10, 0x0));
 }
Exemplo n.º 6
0
 public bool IsActive()
 {
     //PlayerUberStateGroup.Instance.PlayerUberState.m_isActive
     return(PlayerUberStateGroup.Read <bool>(Program, 0xb8, 0x0, 0x18, 0x4C));
 }
Exemplo n.º 7
0
 public Vector2 Position()
 {
     //Characters.Sein.PlatformBehaviour.PlatformMovement.m_prevPosition
     return(Characters.Read <Vector2>(Program, 0xb8, 0x10, 0x98, 0x18, 0xd0));
 }
Exemplo n.º 8
0
 public bool IsLoadingGame()
 {
     //GameController.FreezeFixedUpdate || GameController.Instance.m_isLoadingGame
     return(GameController.Read <bool>(Program, 0xb8, 0xa) || GameController.Read <bool>(Program, 0xb8, 0x0, 0x103));
 }
Exemplo n.º 9
0
 public bool DebugEnabled()
 {
     return(CheatsHandler.Read <bool>(Program, 0xb8, 0x8));
 }