Esempio n. 1
0
 private unsafe static void HandleVarDump(List <string> commands)
 {
     Trace.WriteLine("=== VARIABLE DUMP ===");
     if (commands.Count >= 1)
     {
         string text = commands[0];
         Trace.WriteLine($"Variable: {text}");
         VirtualMachine *ptr  = *GameFunctions.GetThreadLocalStorage()->Jass.AsUnsafe()->VirtualMachine;
         Variable *      ptr2 = (Variable *)ptr->GlobalTable->Lookup(text);
         if (ptr2 != null)
         {
             Trace.WriteLine($" - Value: {ptr2->Value}");
             Trace.WriteLine($" - Type: {ptr2->Type}");
             Trace.WriteLine($" - Type2: {ptr2->Type2}");
             Trace.WriteLine($" - IsFunctionArgument: {ptr2->IsFunctionArgument}");
         }
         else
         {
             Trace.WriteLine(" - NOT FOUND!");
         }
     }
     else
     {
         Trace.WriteLine("Invalid usage");
         Trace.WriteLine("Usage: SCDBG VARDUMP <name>");
     }
 }
Esempio n. 2
0
 public unsafe Variable *[] GetAllGlobals()
 {
     HT_Node *[]  allValues        = GlobalTable->GetAllValues();
     Variable *[] variablePtrArray = new Variable *[allValues.Length];
     for (int index = 0; index < allValues.Length; ++index)
     {
         variablePtrArray[index] = (Variable *)allValues[index];
     }
     return(variablePtrArray);
 }
Esempio n. 3
0
        public unsafe static string VariableToString(Variable *variable, string split)
        {
            VirtualMachine *ptr  = *GameFunctions.GetThreadLocalStorage()->Jass.AsUnsafe()->VirtualMachine;
            string          text = $"{variable->Type}{split}{variable->Type2}{split}{variable->Name.AsString()}";
            string          text2;

            switch (variable->Type)
            {
            case JassType.IntegerArray:
            case JassType.RealArray:
            case JassType.StringArray:
            case JassType.HandleArray:
            case JassType.BooleanArray:
            {
                JassArray *ptr2     = (JassArray *)(void *)variable->Value;
                JassType   jassType = (JassType)(variable->Type - JassType.Real);
                text = $"{text}{split}{jassType}";
                if (ptr2 == null)
                {
                    text += "[null]";
                }
                else
                {
                    try
                    {
                        text2 = "[";
                        for (int i = 0; i < ptr2->Length; i++)
                        {
                            text2 += VariableValueToString(ptr2->Data[i * sizeof(IntPtr) / sizeof(IntPtr)], jassType);
                            if (i < ptr2->Length - 1)
                            {
                                text2 += ", ";
                            }
                        }
                        text += text2 + "]";
                    }
                    catch
                    {
                        text += "[null]";
                    }
                }
                break;
            }

            default:
                text = $"{text}{split}{VariableValueToString(variable->Value, variable->Type)}";
                break;
            }
            return(text);
        }
Esempio n. 4
0
 unsafe public VariablePtr(Variable *pointer)
 {
     this.pointer = new IntPtr(pointer);
 }
Esempio n. 5
0
 public static unsafe extern int _CreateMap(IntPtr ctx, Variable *outvar, Int32 numitems);
Esempio n. 6
0
 public static unsafe extern IntPtr _CreateObjectIPA(IntPtr ctx, Variable *outvar, UInt32 mem, IntPtr iface);
Esempio n. 7
0
 public static unsafe extern int _CreateObject(IntPtr ctx, Variable *outvar, IntPtr data, IntPtr iface);
Esempio n. 8
0
 public static unsafe extern IntPtr _ToStringBufP(IntPtr ctx, Variable *item, Int32 *outsize);
Esempio n. 9
0
 public static unsafe extern void IterGetData(IntPtr ctx, Variable item, Variable *outkey, Variable *outval);