public void OnGameLoad()
        {
            Trace.WriteLine("Initializing addresses . . .");
            Trace.Indent();
            Stopwatch stopwatch = Stopwatch.StartNew();

            GameAddresses.Initialize();
            stopwatch.Stop();
            Trace.WriteLine("Done! (" + stopwatch.Elapsed.TotalMilliseconds.ToString("0.00") + " ms)");
            Trace.Unindent();
            Trace.WriteLine("Initializing functions . . .");
            Trace.Indent();
            stopwatch.Restart();
            GameFunctions.Initialize();
            stopwatch.Stop();
            Trace.WriteLine("Done! (" + stopwatch.Elapsed.TotalMilliseconds.ToString("0.00") + " ms)");
            Trace.Unindent();
            //Trace.WriteLine("Initializing game api . . .");
            //Trace.Indent();
            //stopwatch.Restart();
            //Game.Initialize();
            //stopwatch.Stop();
            //Trace.WriteLine("Done! (" + stopwatch.Elapsed.TotalMilliseconds.ToString("0.00") + " ms)");
            //Trace.Unindent();
        }
Beispiel #2
0
        public static void Initialize()
        {
            if (Kernel32.GetModuleHandle("game.dll") == IntPtr.Zero)
            {
                throw new Exception("Attempted to initialize " + typeof(GameAddresses).Name + " before 'game.dll' has been loaded.");
            }
            IntPtr moduleHandle = Kernel32.GetModuleHandle("game.dll");

            Trace.WriteLine("Base: 0x" + moduleHandle.ToString("X8"));
            //GameAddresses.CUnit__GetAbility = moduleHandle + CUnit__GetAbilityOffset;
            //GameAddresses.GetAbilDataCacheNodeFromId = moduleHandle + GetAbilDataCacheNodeFromIdOffset;
            //GameAddresses.CGameUI__Constructor = moduleHandle + CGameUI__ConstructorOffset;
            //GameAddresses.CGameUI__DisplayChatMessage = moduleHandle + CGameUI__DisplayChatMessageOffset;
            //GameAddresses.Unknown__UpdateMouse = moduleHandle + Unknown__UpdateMouseOffset;
            GameAddresses.Unknown__SetState = moduleHandle + Unknown__SetStateOffset;                       // Found
            //GameAddresses.GetUnitFromHandle = moduleHandle + GetUnitFromHandleOffset;
            //GameAddresses.GetTriggerFromHandle = moduleHandle + GetTriggerFromHandleOffset;
            //GameAddresses.GetDestructableFromHandle = moduleHandle + GetDestructableFromHandleOffset;
            //GameAddresses.GetItemFromHandle = moduleHandle + GetItemFromHandleOffset;
            GameAddresses.StringToJassStringIndex = moduleHandle + StringToJassStringIndexOffset;           // Found
            //GameAddresses.CTriggerWar3__Execute = moduleHandle + CTriggerWar3__ExecuteOffset;
            //GameAddresses.JassStringManager__Resize = moduleHandle + JassStringManager__ResizeOffset;
            GameAddresses.InitNatives                 = moduleHandle + InitNativesOffset;                   // Found
            GameAddresses.BindNative                  = moduleHandle + BindNativeOffset;                    // Found
            GameAddresses.Jass__Constructor           = moduleHandle + Jass__ConstructorOffset;             // Found, Probably.
            GameAddresses.VirtualMachine__RunCode     = moduleHandle + VirtualMachine__RunCodeOffset;       // Found
            GameAddresses.VirtualMachine__RunFunction = moduleHandle + VirtualMachine__RunFunctionOffset;   // Found
            GameAddresses.GetThreadLocalStorage       = moduleHandle + GetThreadLocalStorageOffset;         // Found
            GameAddresses.JassStringHandleToString    = moduleHandle + JassStringHandleToStringOffset;      // Found
            //GameAddresses.sub_6F044150 = moduleHandle + sub_6F044150Offset;
            //GameAddresses.WndProc = moduleHandle + WndProcOffset;
            IntPtr StormModuleHandle = Kernel32.GetModuleHandle("storm.dll");

            Trace.WriteLine("StormBase: 0x" + StormModuleHandle.ToString("X8"));
            GetThreadLocalStorageStorm = StormModuleHandle + 0x581FC;
            GameAddresses.IsReady      = true;
            GameAddresses.OnReady();
        }