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; }
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); }
public bool TryGetObject(string name, out NFSObject obj) { obj = GetObject(name); return(obj != null); }
public NFSFieldPointer(NFSObject parent, string offset, bool readOnly = false) : base(parent, offset, IntPtr.Size, readOnly) { }
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 }
public NFSField(NFSObject parent, string offset, bool readOnly = false) : this(parent, ParseOffset(offset), readOnly) { }
public NFSFieldDouble(NFSObject parent, string offset, bool readOnly = false) : base(parent, offset, readOnly) { }
public NFSFieldFloat(NFSObject parent, int offset, bool readOnly = false) : base(parent, offset, readOnly) { }