예제 #1
0
 static string GetMode(StringBuilder sb, InstructionDef def)
 {
     sb.Clear();
     if ((def.Flags1 & InstructionDefFlags1.Bit16) != 0)
     {
         sb.Append("16");
     }
     if ((def.Flags1 & InstructionDefFlags1.Bit32) != 0)
     {
         if (sb.Length > 0)
         {
             sb.Append('/');
         }
         sb.Append("32");
     }
     if ((def.Flags1 & InstructionDefFlags1.Bit64) != 0)
     {
         if (sb.Length > 0)
         {
             sb.Append('/');
         }
         sb.Append("64");
     }
     if (sb.Length == 0)
     {
         throw new InvalidOperationException();
     }
     sb.Append("-bit");
     return(sb.ToString());
 }
예제 #2
0
 private void WriteInstructionToConsole(InstructionDef instr)
 {
     CONS.WriteLine($"  {nameof(InstructionDef)}");
     CONS.WriteLine($"    defName: {instr.Name.ToStringOrDefault()}");
     CONS.WriteLine($"    text: {instr.Text.ToStringOrDefault()}");
     CONS.WriteLine($"    instructionClass: {instr.InstructionClass.ToStringOrDefault()}");
     CONS.WriteLine($"    eventTagInitiate: {instr.EventTagInitiate.ToStringOrDefault()}");
     CONS.WriteLine($"    concept: {instr.Concept.ToStringOrDefault()}");
     CONS.WriteLine($"    thingDef: {instr.ThingDef.ToStringOrDefault()}");
     if (instr.TargetCount.HasValue)
     {
         CONS.WriteLine($"    targetCount: {instr.TargetCount.Value}");
     }
     CONS.WriteLine($"    recipeDef: {instr.RecipeDef.ToStringOrDefault()}");
     if (instr.RecipeTargetCount.HasValue)
     {
         CONS.WriteLine($"    recipeTargetCount: {instr.RecipeTargetCount.Value}");
     }
     CONS.WriteLine($"    giveOnActivateDef: {instr.GiveOnActivateDef.ToStringOrDefault()}");
     if (instr.GiveOnActivateCount.HasValue)
     {
         CONS.WriteLine($"    giveOnActivateCount: {instr.GiveOnActivateCount.Value}");
     }
     CONS.WriteLine($"    onMapInstruction: {instr.OnMapInstruction.ToStringOrDefault()}");
     if ((instr.ActionTagsAllowed?.Any()).GetValueOrDefault())
     {
         CONS.WriteLine("    actionTagsAllowed");
         foreach (var li in instr.ActionTagsAllowed)
         {
             CONS.WriteLine($"      li: {li.ToStringOrDefault()}");
         }
     }
     if ((instr.EventTagsEnd?.Any()).GetValueOrDefault())
     {
         CONS.WriteLine("    eventTagsEnd");
         foreach (var li in instr.EventTagsEnd)
         {
             CONS.WriteLine($"      li: {li.ToStringOrDefault()}");
         }
     }
     if ((instr.HighlightTags?.Any()).GetValueOrDefault())
     {
         CONS.WriteLine("    highlightTags");
         foreach (var li in instr.HighlightTags)
         {
             CONS.WriteLine($"      li: {li.ToStringOrDefault()}");
         }
     }
     CONS.WriteLine($"    rejectInputMessage: {instr.RejectInputMessage.ToStringOrDefault()}");
     if (instr.StartCentered.HasValue)
     {
         CONS.WriteLine($"    startCentered: {instr.StartCentered.Value}");
     }
     if (instr.ResetBuildDesignatorStuffs.HasValue)
     {
         CONS.WriteLine($"    resetBuildDesignatorStuffs: {instr.ResetBuildDesignatorStuffs.Value}");
     }
     if (instr.EndTutorial.HasValue)
     {
         CONS.WriteLine($"    endTutorial: {instr.EndTutorial.Value}");
     }
 }
예제 #3
0
 public FpuStackInfo(InstructionDef def)
 {
     Increment   = def.FpuStackIncrement;
     Conditional = (def.Flags3 & InstructionDefFlags3.IsFpuCondWriteTop) != 0;
     WritesTop   = (def.Flags3 & InstructionDefFlags3.WritesFpuTop) != 0;
 }
예제 #4
0
 public ImpliedOpsKey(InstructionDef def) => this.def = def;
예제 #5
0
 static string GetCpuid(Dictionary <EnumValue, string> toCpuidName, InstructionDef def) =>
 string.Join(" and ", def.Cpuid.Select(a => toCpuidName[a]));