public override bool ResolveLinks() { var result = base.ResolveLinks(); FunctionMap = new List <ME3Function>(); foreach (var funcEntry in _FunctionMap) { var func = PCC.GetExportObject(funcEntry.FunctionObjectIndex) as ME3Function; if (func == null) { return(false); } FunctionMap.Add(func); } DefinedFunctions = new List <ME3Function>(); foreach (var member in Members) { if (member.GetType() == typeof(ME3Function)) { DefinedFunctions.Add(member as ME3Function); } } return(result); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); var entry = PCC.GetObjectEntry(_FuncIndex); if (entry != null) { FunctionName = entry.ObjectName; Function = PCC.GetObjectEntry(_FuncIndex).Object as ME3Function; } if (Function == null) // TODO { return(true); // this should be false, but until native objects are handled by the library this will have to do. } entry = PCC.GetObjectEntry(_DeleIndex); if (entry != null) { DelegateName = entry.ObjectName; Delegate = PCC.GetObjectEntry(_DeleIndex).Object as ME3Function; } if (Delegate == null) // TODO { return(true); // this should be false, but until native objects are handled by the library this will have to do. } return(result); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); InnerProperty = PCC.GetExportObject(_InnerIndex) as ME3Property; return(result); }
public Expression DecompileInstanceDelegate() // TODO: check code, seems ok? { PopByte(); var name = PCC.GetName(ReadNameRef()); StartPositions.Pop(); return(new SymbolReference(null, null, null, "UNSUPPORTED: InstanceDelegate: " + name)); }
public NameLiteral DecompileNameConst() { PopByte(); var value = PCC.GetName(ReadNameRef()); StartPositions.Pop(); return(new NameLiteral(value, null, null)); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); SuperField = PCC.GetExportObject(_SuperIndex) as ME3Field; NextField = PCC.GetExportObject(_NextIndex) as ME3Field; return(result); }
public Expression DecompileDelegateProperty() // TODO: is this proper? Is it even used in ME3? { PopByte(); var name = PCC.GetName(ReadNameRef()); var obj = ReadObject(); // probably the delegate StartPositions.Pop(); var objName = obj != null ? obj.ObjectName : "None"; return(new SymbolReference(null, null, null, name + "(" + objName + ")")); }
private ObjectTableEntry ReadObject() { var index = ReadIndex(); var remaining = DataContainer.DataScriptSize - (Position - _totalPadding); Buffer.BlockCopy(_data, Position, _data, Position + 4, remaining); // copy the data forward Buffer.BlockCopy(new byte[] { 0, 0, 0, 0 }, 0, _data, Position, 4); // write 0 padding _totalPadding += 4; Position += 4; return(PCC.GetObjectEntry(index)); }
public Expression DecompileObjectLookup() { var obj = ReadObject(); if (obj == null) { return(null); // ERROR } StartPositions.Pop(); ASTNode node = null; //attempt to resolve Enum references so that byte constants can be converted to enum values if (obj.ClassName == "ByteProperty") { if (LibInitialized) { IEntry typeExp = obj.Parent; string scope = null; while (typeExp.ClassName != "Class" && typeExp.ClassName != "ScriptStruct") { scope = scope is null ? typeExp.ObjectName.Name : $"{typeExp.ObjectName}.{scope}"; typeExp = typeExp.Parent; } if (ReadOnlySymbolTable.TryGetType(typeExp.ObjectName, out VariableType cls)) { scope = scope is null?cls.GetScope() : $"{cls.GetScope()}.{scope}"; if (ReadOnlySymbolTable.TryGetSymbolFromSpecificScope(obj.ObjectName, out ASTNode astNode, scope) && astNode is VariableDeclaration decl && decl.VarType is Enumeration enumeration) { node = enumeration; } } } if (node is null && obj is ExportEntry exp && PCC.GetEntry(exp.GetBinaryData <UByteProperty>().Enum) is IEntry enumEntry) { if (enumEntry is ExportEntry enumExp) { node = ME3ObjectToASTConverter.ConvertEnum(enumExp.GetBinaryData <UEnum>()); } else if (LibInitialized && ReadOnlySymbolTable.TryGetType(enumEntry.ObjectName, out Enumeration enumeration)) { node = enumeration; } } } return(new SymbolReference(node, obj.ObjectName.Instanced)); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); var entry = PCC.GetObjectEntry(_EnumIndex); if (entry != null) { Enum = entry.Object as ME3Enum; } IsEnum = Enum == null ? false : true; return(result); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); var entry = PCC.GetObjectEntry(_ObjectIndex); if (entry != null) { Object = PCC.GetObjectEntry(_ObjectIndex).Object as ME3Object; } IsNativeImport = Object == null ? false : true; return(result); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); var entry = PCC.GetObjectEntry(_StructIndex); if (entry != null) { Struct = PCC.GetObjectEntry(_StructIndex).Object as ME3Object; } if (Struct == null) // TODO { return(true); // this should be false, but until native objects are handled by the library this will have to do. } return(result); }
public override bool Deserialize() { var result = base.Deserialize(); var nameCount = Data.ReadInt32(); _NameRefs = new List <NameReference>(nameCount); Names = new List <String>(); for (int n = 0; n < nameCount; n++) { _NameRefs.Add(Data.ReadNameRef()); Names.Add(PCC.GetName(_NameRefs[n])); } return(result); }
public static PCC GetPcc(string pcc) { PCC objPcc = new PCC(); GetPccDAL objGetPcc = new GetPccDAL(); try { objPcc = objGetPcc.GetPcc(pcc, CommonENT.MYCTSDB_CONNECTION); } catch { objPcc = objGetPcc.GetPcc(pcc, CommonENT.MYCTSDBBACKUP_CONNECTION); } return(objPcc); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); OuterClass = PCC.GetExportObject(_OuterClassIndex) as ME3Class; ImplementedInterfaces = new List <ME3Class>(); Components = new List <ME3Object>(); FunctionRefs = new List <ME3Function>(); foreach (var interfaceRef in _ImplInterfaces) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(interfaceRef.ClassIndex); if (obj != null) { ImplementedInterfaces.Add(obj as ME3Class); } } foreach (var component in _Components) // TODO: overhaul to objectableentry, or provide native object support. { var obj = PCC.GetExportObject(component.ComponentObjectIndex); if (obj != null) { Components.Add(obj); } } foreach (var funcRef in _FunctionRefs) // TODO: overhaul { var entry = PCC.GetObjectEntry(funcRef); if (entry != null) // TODO: this shoud probably never happen. { ME3Function func = entry.Object as ME3Function; FunctionRefs.Add(func); } } States = new List <ME3State>(); foreach (var state in Members.Where(s => typeof(ME3State) == s.GetType())) { States.Add(state as ME3State); } return(result); }
private void DecompileLabelTable() { PopByte(); var name = ReadNameRef(); var ofs = ReadUInt32(); while (ofs != 0x0000FFFF) // ends with non-ref + max-offset { var entry = new LabelTableEntry(); entry.NameRef = name; entry.Name = PCC.GetName(name); entry.Offset = ofs; LabelTable.Add(entry); name = ReadNameRef(); ofs = ReadUInt32(); } }
public override bool Deserialize() { var result = base.Deserialize(); var ArrayInfo = Data.ReadInt32(); ArraySize = (UInt16)(ArrayInfo & 0x0000FFFFU); ArrayElementSize = (UInt16)(ArrayInfo >> 16); PropertyFlags = (PropertyFlags)Data.ReadUInt64(); if (PropertyFlags.HasFlag(PropertyFlags.Net)) { ReplicateOffset = Data.ReadUInt16(); } _CategoryNameRef = Data.ReadNameRef(); Category = PCC.GetName(_CategoryNameRef); ReplicateOffset = Data.ReadUInt16(); // TODO: verify, see code ReplicateIndex = Data.ReadUInt16(); return(result); }
public PCC GetPcc(string pcc, string connectionName) { Database db = DatabaseFactory.CreateDatabase(connectionName); DbCommand dbCommand = db.GetStoredProcCommand(Resources.GetPccResources.SP_GetPcc); db.AddInParameter(dbCommand, Resources.GetPccResources.PARAM_PCC, DbType.String, pcc); PCC Pcc = new PCC(); using (IDataReader dr = db.ExecuteReader(dbCommand)) { int _pcc = dr.GetOrdinal(Resources.GetPccResources.PARAM_CAT_PCC_ID); int _name = dr.GetOrdinal(Resources.GetPccResources.PARAM_CAT_PCC_NAME); int _application = dr.GetOrdinal(Resources.GetPccResources.PARAM_APPLICATION_ID); int _tipo = dr.GetOrdinal(Resources.GetPccResources.PARAM_TYPE); int _tool = dr.GetOrdinal(Resources.GetPccResources.PARAM_TOOL); int _gds = dr.GetOrdinal(Resources.GetPccResources.PARAM_GDS); try { if (dr.Read()) { Guid guid = new Guid(); Pcc.PccCode = (dr[_pcc] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_pcc); Pcc.Name = (dr[_name] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_name); Pcc.Tipo = (dr[_tipo] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_tipo); Pcc.Tool = (dr[_tool] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_tool); Pcc.GDS = (dr[_gds] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_gds); guid = dr.GetGuid(_application); Pcc.Type = Convert.ToString(guid); } } catch { } } return(Pcc); }
public override bool ResolveLinks() { var result = base.ResolveLinks(); Members = new List <ME3Object>(); Structs = new List <ME3Struct>(); Enums = new List <ME3Enum>(); Variables = new List <ME3Property>(); Constants = new List <ME3Const>(); ME3Field obj = PCC.GetExportObject(FirstChildIndex) as ME3Field; while (obj != null) { Members.Add(obj); if (obj.GetType().IsSubclassOf(typeof(ME3Property))) { Variables.Add(obj as ME3Property); } else if (String.Compare(obj.ExportEntry.ClassName, "enum", StringComparison.OrdinalIgnoreCase) == 0) { Enums.Add(obj as ME3Enum); } else if (String.Compare(obj.ExportEntry.ClassName, "const", StringComparison.OrdinalIgnoreCase) == 0) { Constants.Add(obj as ME3Const); // TODO: does this happen? If so, handle in decompiler, locals etc. } else if (String.Compare(obj.ExportEntry.ClassName, "Struct", StringComparison.OrdinalIgnoreCase) == 0 || String.Compare(obj.ExportEntry.ClassName, "ScriptStruct", StringComparison.OrdinalIgnoreCase) == 0) { // TODO: is this correct, struct/scriptstruct? Structs.Add(obj as ME3Struct); } obj = obj.NextField; } return(result); }
private void txtPCC_TextChanged(object sender, EventArgs e) { TextBox txt = (TextBox)sender; Common.SetDeleteListBoxPCCs(txt, lbPCC); if (txtPCC.Text.Length == 4) { PCC objPcc = GetPccBL.GetPcc(txtPCC.Text); if (!string.IsNullOrEmpty(objPcc.PccCode)) { txtPCC.Text = objPcc.PccCode; txtPCC.Enabled = true; txtName.Text = objPcc.Name; if (objPcc.Type.Equals("0c286646-e94e-4ecd-afc4-1b94180dcc11")) { cmbType.Text = "CONSOLID"; } else { cmbType.Text = "CTS"; } if (objPcc.Tipo.Equals("OPERATIVO")) { TypeBox.Text = "OPERATIVO"; } else if (objPcc.Tipo.Equals("GETTHERE")) { TypeBox.Text = "GETTHERE"; } else if (objPcc.Tipo.Equals("GETTHERE")) { TypeBox.Text = "GETTHERE"; } else if (objPcc.Tipo.Equals("IPCC")) { TypeBox.Text = "IPCC"; } else if (objPcc.Tipo.Equals("CONSOLIDADOR")) { TypeBox.Text = "CONSOLIDADOR"; } else if (objPcc.Tipo.Equals("BIZSITE")) { TypeBox.Text = "BIZSITE"; } else if (objPcc.Tipo.Equals("ROBOTICO")) { TypeBox.Text = "ROBOTICO"; } else if (objPcc.Tipo.Equals("CAPACITACION")) { TypeBox.Text = "CAPACITACION"; } if (objPcc.Tool.Equals("ONLINE ")) { ToolBox.Text = "ONLINE"; } else if (objPcc.Tool.Equals("OFFLINE ")) { ToolBox.Text = "OFFLINE"; } else if (objPcc.Tool.Equals("ONLINE")) { ToolBox.Text = "ONLINE"; } else if (objPcc.Tool.Equals("OFFLINE")) { ToolBox.Text = "ONLINE"; } if (objPcc.GDS.Equals("SABRE")) { GDSBox.Text = ("SABRE"); } else if (objPcc.GDS.Equals("AMADEUS")) { GDSBox.Text = ("AMADEUS"); } else if (objPcc.GDS.Equals("WORLDSPAN")) { GDSBox.Text = ("WORLDSPAN"); } } else { txtPCC.Text = string.Empty; txtPCC.Enabled = true; txtName.Text = string.Empty; cmbType.Text = string.Empty; TypeBox.Text = string.Empty; ToolBox.Text = string.Empty; GDSBox.Text = string.Empty; } } }
public override bool Deserialize() { OuterIndex = Data.ReadIndex(); DelegateValue = PCC.GetName(Data.ReadNameRef()); return(true); }
public ProductADD() { InitializeComponent(); PCC.KategoriListesi(cmbProductCategory); txtProductBarcode.Focus(); }
public override bool Deserialize() { EnumValue = PCC.GetName(Data.ReadNameRef()); return(true); }
public Expression DecompileFunctionCall(bool byName = false, bool withUnknShort = false, bool global = false) { PopByte(); String funcName; if (byName) { funcName = PCC.GetName(ReadNameRef()); } else { var funcObj = ReadObject(); funcName = funcObj.ObjectName; if (funcName == DataContainer.Name && !isInClassContext) // If we're calling ourself, it's a super call { var str = "super"; var currentClass = DataContainer.ExportEntry.GetOuterOfType("Class").Object as ME3Class; var funcOuterClass = funcObj.GetOuterOfType("Class").ObjectName; if (currentClass != null && currentClass.SuperField != null && currentClass.SuperField.Name == funcOuterClass) { funcName = str + "." + funcName; } else { funcName = str + "(" + funcOuterClass + ")." + funcName; } } } if (global) { funcName = "global." + funcName; } if (withUnknShort) { ReadInt16(); // TODO: related to unkn65, split out? Possibly jump? } var parameters = new List <Expression>(); while (!CurrentIs(StandardByteCodes.EndFunctionParms)) { if (CurrentIs(StandardByteCodes.Nothing)) { PopByte(); // TODO: is this reasonable? what does it mean? parameters.Add(new SymbolReference(null, null, null, "None")); continue; } var param = DecompileExpression(); if (param == null) { return(null); // ERROR } parameters.Add(param); } PopByte(); StartPositions.Pop(); var func = new SymbolReference(null, null, null, funcName); return(new FunctionCall(func, parameters, null, null)); }