/// <summary> /// Returns a description of the operands of the call to another BHAV /// </summary> /// <param name="lng">true to get long description</param> /// <returns>description of the BHAV call operands</returns> /// <remarks>See http://www.modthesims2.com/showthread.php?t=117411 for more info</remarks> protected override string Operands(bool lng) { Bhav bhav = Wrapper; if (bhav == null) { return("???"); } int myArgc = (int)instruction.Parent.Header.ArgumentCount; int thisArgc = bhav.Header.ArgumentCount; if (thisArgc == 0) { return(lng ? pjse.Localization.GetString("noargs") : ""); } string s = ""; if (lng) { s += thisArgc.ToString() + " " + (thisArgc == 1 ? pjse.Localization.GetString("oneArg") : pjse.Localization.GetString("manyArgs")) + ": "; } byte[] o = new byte[16]; ((byte[])instruction.Operands).CopyTo(o, 0); ((byte[])instruction.Reserved1).CopyTo(o, 8); TPRP tprp = (TPRP)bhav.SiblingResource(TPRP.TPRPtype); switch (opFormat(instruction.NodeVersion, o)) { case dataFormat.useTemps: s += this.doTemps(thisArgc, lng, tprp); break; case dataFormat.oldFormat: s += this.do8Cx(thisArgc, lng, tprp, o, instruction.NodeVersion == 0); break; case dataFormat.newFormat: if (thisArgc < 9) { s += this.do4OI(thisArgc, lng, tprp, o); } else { s += this.doZero(thisArgc, lng, tprp); } break; case dataFormat.useParams: if (thisArgc < 9) { s += this.doParams(thisArgc, myArgc, lng, tprp); } else { s += this.doZero(thisArgc, lng, tprp); } break; } return(s); }
public void Execute(Instruction inst) { internalchg = true; ckbDecimal.Checked = pjse.Settings.PJSE.DecimalDOValue; ckbUseInstancePicker.Checked = pjse.Settings.PJSE.InstancePickerAsText; this.inst = inst; foreach (LabelledDataOwner ldoc in aldoc) { ldoc.Instruction = inst; } nodeVersion = inst.NodeVersion; pjse.FileTable.Entry ftEntry = inst.Parent.ResourceByInstance(SimPe.Data.MetaData.BHAV_FILE, inst.OpCode); TPRP tprp = null; if (ftEntry != null) { Bhav wrapper = (Bhav)ftEntry.Wrapper; tprp = (TPRP)wrapper.SiblingResource(TPRP.TPRPtype); nrArgs = wrapper.Header.ArgumentCount; this.lbBhavName.Text = "0x" + SimPe.Helper.HexString(inst.OpCode) + ": " + wrapper.FileName; this.lbArgC.Text = "0x" + SimPe.Helper.HexString(nrArgs); } else { this.lbBhavName.Text = "0x" + SimPe.Helper.HexString(inst.OpCode) + ": [" + pjse.Localization.GetString("bhavnotfound") + "]"; this.lbArgC.Text = "(???)"; } operands = new byte[16]; ((byte[])inst.Operands).CopyTo(operands, 0); ((byte[])inst.Reserved1).CopyTo(operands, 8); for (int i = 0; i < nrArgs; i++) { if (tprp != null && !tprp.TextOnly && i < tprp.ParamCount) { albArg[i].Text = tprp[false, i].Label; } else { albArg[i].Text = pjse.Localization.GetString("unk"); } } for (int i = nrArgs; i < albArg.Length; i++) { albArg[i].Text = pjse.Localization.GetString("bwb_unused"); } format = pjse.BhavNameWizards.BhavWizBhav.opFormat(inst.NodeVersion, operands); rbTemps.Checked = format == BhavWizBhav.dataFormat.useTemps; rbOld.Checked = format == BhavWizBhav.dataFormat.oldFormat; rbNew.Checked = format == BhavWizBhav.dataFormat.newFormat; rbCallers.Enabled = nodeVersion > 0; rbCallers.Checked = format == BhavWizBhav.dataFormat.useParams; doFormat(); internalchg = false; return; }