예제 #1
0
 private static void OnRunCodeCallback(VirtualMachinePtr virtualMachine, IntPtr opCode, IntPtr a3, UInt32 opLimit, IntPtr a5, CodeResult result)
 {
     try
     {
         if (InternalScript.VirtualMachine__RunCodeCallback != null)
         {
             InternalScript.VirtualMachine__RunCodeCallback(virtualMachine, opCode, a3, opLimit, a5, result);
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine("Unhandled Exception in InternalScript.OnRunCodeCallback!");
         Trace.WriteLine(e.ToString());
     }
 }
예제 #2
0
 private static void OnPostConfig(Boolean inLobby)
 {
     try
     {
         if (InternalScript.PostConfig != null)
         {
             InternalScript.PostConfig();
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine("Unhandled Exception in InternalScript.OnPostConfig!");
         Trace.WriteLine(e.ToString());
     }
 }
예제 #3
0
 private static void OnScriptLoad(String script)
 {
     try
     {
         if (InternalScript.ScriptLoad != null)
         {
             InternalScript.ScriptLoad(script);
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine("Unhandled Exception in InternalScript.OnScriptLoad!");
         Trace.WriteLine(e.ToString());
     }
 }
예제 #4
0
 private static void OnPostMain()
 {
     try
     {
         if (InternalScript.PostMain != null)
         {
             InternalScript.PostMain();
         }
     }
     catch (Exception e)
     {
         Trace.WriteLine("Unhandled Exception in InternalScript.OnPostMain!");
         Trace.WriteLine(e.ToString());
     }
 }
예제 #5
0
        unsafe private static CodeResult VirtualMachine__RunCodeHook(VirtualMachinePtr virtualMachine, IntPtr opCode, IntPtr a3, UInt32 opLimit, IntPtr a5)
        {
            var result = VirtualMachine__RunCode(virtualMachine, opCode, a3, opLimit, a5);

            try
            {
                InternalScript.OnRunCodeCallback(virtualMachine, opCode, a3, opLimit, a5, result);
            }
            catch (Exception e)
            {
                Trace.WriteLine("Unhandled Exception in InternalScript.VirtualMachine__RunFunctionHook!");
                Trace.WriteLine(e.ToString());
            }

            return(result);
        }
예제 #6
0
        private static JassPtr Jass__ConstructorHook(JassPtr @this)
        {
            var result = InternalScript.Jass__Constructor(@this);

            try
            {
                InternalScript.jass = result;
            }
            catch (Exception e)
            {
                Trace.WriteLine("Unhandled Exception in InternalScript.Jass__ConstructorHook!");
                Trace.WriteLine(e.ToString());
            }

            return(result);
        }
예제 #7
0
        unsafe private static IntPtr VirtualMachine__RunFunctionHook(VirtualMachinePtr virtualMachine, String functionName, Int32 a3, Int32 a4, Int32 a5, Int32 a6)
        {
            var result = IntPtr.Zero;

            try
            {
                switch (functionName)
                {
                case "config":
                    var file = Storm.FileOpenFileEx(IntPtr.Zero, "war3map.cs", 0);
                    if (file != IntPtr.Zero)
                    {
                        var script = Storm.FileReadToEnd(file);
                        Storm.FileCloseFile(file);
                        InternalScript.OnScriptLoad(script);
                    }
                    else
                    {
                        InternalScript.OnScriptLoad(null);
                    }
                    InternalScript.OnPreConfig(InternalGame.IsInMap);
                    result = InternalScript.VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6);
                    InternalScript.OnPostConfig(InternalGame.IsInMap);
                    break;

                case "main":
                    InternalScript.OnPreMain();
                    result = InternalScript.VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6);
                    InternalScript.OnPostMain();
                    break;

                default:
                    result = InternalScript.VirtualMachine__RunFunction(virtualMachine, functionName, a3, a4, a5, a6);
                    break;
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine("Unhandled Exception in InternalScript.VirtualMachine__RunFunctionHook!");
                Trace.WriteLine(e.ToString());
            }

            return(result);
        }