コード例 #1
0
        public NFSField(NFSObject parent, int offset, bool readOnly = false)
        {
            this.parent = parent;
            Offset      = offset;
            ReadOnly    = readOnly;

            //This will trigger a memory read on Field and assign it to FieldDefault
            FieldDefault = Field;
        }
コード例 #2
0
        public NFSObject GetObject(string name)
        {
            if (!memManager.IsProcessOpen())
            {
                return(null);
            }

            //Also avoid hammering on the game while it's still loading
            if (objectList.Count == 0 && name != "UIRootController")
            {
                return(null);
            }

            NFSObject type = null;

            if (!objectList.TryGetValue(name, out type) || !type.IsValid())
            {
                //If we haven't found any objects yet, we're still waiting for the game world to load
                string status = (objectList.Count == 0) ? "Waiting for game world..." : "Finding " + name + "...";
                parent.PushStatus(status);

                try {
                    switch (name)
                    {
                    case "AiDirectorEntityData":
                        type = objectList.GetOrAdd(name, new NFSObjectAiDirectorEntityData(memManager)); break;

                    case "PacingLibraryEntityData":
                        type = objectList.GetOrAdd(name, new NFSObjectPacingLibraryEntityData(memManager)); break;

                    case "HealthProfilesListEntityData":
                        type = objectList.GetOrAdd(name, new NFSObjectHealthProfilesListEntityData(memManager)); break;

                    case "PersonaLibraryPrefab":
                        type = objectList.GetOrAdd(name, new NFSObjectPersonaLibraryPrefab(memManager)); break;

                    case "GameTime":
                        type = objectList.GetOrAdd(name, new NFSObjectGameTime(memManager)); break;

                    case "SpikestripWeapon":
                        type = objectList.GetOrAdd(name, new NFSObjectSpikestripWeapon(memManager)); break;

                    case "AttackHeliEntityData":
                        type = objectList.GetOrAdd(name, new NFSObjectAttackHeliEntityData(memManager)); break;

                    case "UIRootController":
                        type = objectList.GetOrAdd(name, new NFSObjectUIRootController(memManager)); break;

                    case "ProfileOptions":
                        type = objectList.GetOrAdd(name, new NFSObjectProfileOptions(memManager)); break;

                    case "PacingPursuitScheduleHard":
                        type = objectList.GetOrAdd(name, new NFSObjectPacingPursuitScheduleHard(memManager)); break;

                    default:
                        return(null);
                    }
                }
                catch (Exception ex) {
                    //Don't start printing errors until we've at least found something once, otherwise we probably aren't even in the game world yet
                    if (objectList.Count > 0)
                    {
                        parent.SetStatus(ex.Message);
                    }
                }

                parent.PopStatus(status);
            }

            return(type);
        }
コード例 #3
0
 public bool TryGetObject(string name, out NFSObject obj)
 {
     obj = GetObject(name);
     return(obj != null);
 }
コード例 #4
0
 public NFSFieldPointer(NFSObject parent, string offset, bool readOnly = false) : base(parent, offset, IntPtr.Size, readOnly)
 {
 }
コード例 #5
0
 public NFSFieldByteArray(NFSObject parent, string offset, int fieldSize, bool readOnly = false)
     : base(parent, offset, readOnly)
 {
     FieldSize    = fieldSize;
     FieldDefault = Field; //HACK can't call base constructor later, so must do this again
 }
コード例 #6
0
 public NFSField(NFSObject parent, string offset, bool readOnly = false) : this(parent, ParseOffset(offset), readOnly)
 {
 }
コード例 #7
0
 public NFSFieldDouble(NFSObject parent, string offset, bool readOnly = false) : base(parent, offset, readOnly)
 {
 }
コード例 #8
0
 public NFSFieldFloat(NFSObject parent, int offset, bool readOnly = false) : base(parent, offset, readOnly)
 {
 }