示例#1
0
        public static string GetOpcodeNameForServer(uint opcode, uint Handler)
        {
            string output = SMSG.FirstOrDefault(p => p.Value == opcode).Key;

            //if (Config.BinDiff != string.Empty && output == null)
            //    output = Program.OpTable.getSMSGNameFromHandler(Program.FuncDiff.getOldFunction(Handler)); // SMSG diff is not working yet

            return(output);
        }
示例#2
0
        public static bool TryPopulate(bool smsg = true)
        {
            if ((smsg ? SMSG : CMSG).Count != 0)
            {
                return(true);
            }

            Logger.WriteConsoleLine("Loading opcodes from GitHub, build 19103...");
            try
            {
                WebClient    client  = new WebClient();
                Stream       stream  = client.OpenRead(FilePath);
                StreamReader reader  = new StreamReader(stream);
                var          content = reader.ReadToEnd().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
                stream.Close();
                foreach (var line in content)
                {
                    var rgxResult = OpcodeRgx.Match(line);
                    if (!rgxResult.Success)
                    {
                        continue;
                    }

                    var opcodeName  = rgxResult.Groups[1].Value;
                    var opcodeValue = Convert.ToInt32(rgxResult.Groups[2].Value, 16);
                    if (opcodeName.Contains("CMSG"))
                    {
                        CMSG.Add(opcodeName, opcodeValue);
                    }
                    else
                    {
                        SMSG.Add(opcodeName, opcodeValue);
                    }
                }
            }
            catch (WebException /*whatever*/) // Haha so funny I is.
            {
                Logger.WriteConsoleLine("Unable to query opcodes. Exiting. Try again.");
                return(false);
            }

            return((smsg ? SMSG : CMSG).Count != 0);
        }
示例#3
0
 public static string GetOpcodeNameForServer(uint opcode)
 {
     return(SMSG.FirstOrDefault(p => p.Value == opcode).Key);
 }
示例#4
0
        static void Main(string[] args)
        {
            Console.WriteLine(">> Loading configuration options...");
            if (!Config.Load(args))
            {
                return;
            }

            if (Config.NoCmsg && Config.NoSmsg)
            {
                Logger.WriteConsoleLine("Please give me something to do.");
                Config.ShowHelp();
                return;
            }

            Logger.CreateOutputStream(Config.OutputFile);

            Console.WriteLine(">> Opening Wow client...");
            ClientStream = new BinaryReader(File.OpenRead(Config.Executable));
            if (!BaseStream.CanRead)
            {
                return;
            }

            ClientBytes = File.ReadAllBytes(Config.Executable);
            Disasm      = new UnmanagedBuffer(ClientBytes);
            Env         = Emulator.Create(BaseStream);

            if (!Config.NoSmsg)
            {
                Console.WriteLine(">> Discovering JAM groups...");
                foreach (var pattern in ClientGroupPatterns) // Load jam groups...
                {
                    var offsets = ClientBytes.FindPattern(pattern, 0xFF);
                    if (offsets.Count == 0)
                    {
                        Console.WriteLine(@"Could not find group name "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        return;
                    }
                    else
                    {
                        Console.WriteLine(@"Found JAM Group "" {0}""", System.Text.Encoding.ASCII.GetString(pattern.Skip(1).ToArray()));
                        Dispatchers.Add(new JamDispatch((int)(offsets[0] + 1)));
                    }
                }
            }

            if (!Config.NoGhNames && !Opcodes.TryPopulate())
            {
                return;
            }

            if (!Config.NoSmsg)
            {
                SMSG.Dump();
            }

            if (!Config.NoCmsg)
            {
                CMSG.Dump(Config.SpecificOpcodeValue);
            }
        }