Skip to content

Instantly share code, notes, and snippets.

MemoryStream stream = new MemoryStream();
try
{
m_packets.Clear();
int count = m_packetCount;
if (count > 0)
m_packets.Capacity = count;
RawChunkHeader header;
@LordJZ
LordJZ / gist:997133
Created May 28, 2011 19:20
StreamHandler
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
namespace WhatIf
{
/// <summary>
@LordJZ
LordJZ / gist:998728
Created May 30, 2011 11:01
as of 4.1.0
enum Opcodes {
[OpcodeDescription("EVENT_CHAT_SERVER_RECONNECTED")]
[OpcodeDescription("handler: CGChat* this; m_chatServerDown = 0; RejoinChannels(); ReregisterAddonMessagePrefixes();")]
SMSG_CHAT_SERVER_RECONNECTED = 36478,
[OpcodeDescription("Script_RegisterAddonPrefix")]
[OpcodeDescription("Introduced in patch 4.1.0.")]
CMSG_REGISTER_ADDON_PREFIXES = 13075,
[OpcodeDescription("Sent in CGChat::ReregisterAddonMessagePrefixes")]
[OpcodeDescription("Introduced in patch 4.1.0.")]
CMSG_UNREGISTER_ALL_ADDON_PREFIXES = 29441,
[Flags]
public enum MovementFlags : uint
{
None = 0x00000000,
Forward = 0x00000001,
Backward = 0x00000002,
StrafeLeft = 0x00000004,
StrafeRight = 0x00000008,
TurnLeft = 0x00000010,
TurnRight = 0x00000020,
@LordJZ
LordJZ / gist:1055297
Created June 29, 2011 23:48
PackedData
using System;
using System.Collections;
using System.IO;
using System.Text;
namespace Kamilla.WorldOfWarcraft.Latest.OpcodeDatas
{
public abstract class PackedData : OpcodeData
{
protected abstract int[] MaskSequence { get; }
@LordJZ
LordJZ / gist:1055306
Created June 29, 2011 23:54
sub_6D9620 jam ctor
.text:006D9620
.text:006D9620 ; =============== S U B R O U T I N E =======================================
.text:006D9620
.text:006D9620 ; Attributes: bp-based frame
.text:006D9620
.text:006D9620 sub_6D9620 proc near ; CODE XREF: sub_6E1410+2Cp
.text:006D9620 ; sub_6E1450+4j
.text:006D9620
.text:006D9620 var_10 = dword ptr -10h
.text:006D9620 var_C = byte ptr -0Ch
@LordJZ
LordJZ / gist:1056730
Created June 30, 2011 17:33
4.1 packed data decoding mechanism ripper
void decodePackedData(ea_t addr)
{
int insn_size;
ea_t regbase = 65536;
uint16 reg = 0;
qvector<int> mask;
mask.reserve(16);
qvector<int> bytes;
bytes.reserve(16);
@LordJZ
LordJZ / gist:1061455
Created July 2, 2011 17:50
SMSG_CHAR_ENUM as of 4.2
using System;
using Kamilla.WorldOfWarcraft.Latest.OpcodeDatas;
namespace Kamilla.WorldOfWarcraft.Latest.Parsers.Lobby
{
[WowPacketParser(WowOpcodes.SMSG_CHAR_ENUM)]
[WowPacketParser(WowOpcodes.SMSG_COMPRESSED_CHAR_ENUM)]
internal sealed class CharEnumParser : WowPacketParser
{
protected unsafe override void Parse()
@LordJZ
LordJZ / gist:1061776
Created July 2, 2011 23:27
SMSG_COMPOUND_PACKET 4.2 sample
Decompressed packet: 2591 compressed size, 2582 decompressed size (-0.3% profit).
Opcode: SMSG_ACCOUNT_DATA_TIMES (0x2E3E), AccountDataTimesParser (21+2 bytes)
Server Time: 29.06.2011 23:01:59
Unk Byte: 1
Mask: GlobalCache
GlobalConfigCache time: 05/02/2011 04:13:43
GlobalBindingsCache time: 05/02/2011 04:03:11
GlobalMacrosCache time: 05/02/2011 04:03:12
@LordJZ
LordJZ / gist:1061778
Created July 2, 2011 23:27
SMSG_COMPOUND_PACKET 4.2 reader
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Kamilla.WorldOfWarcraft.Latest.Parsers.Misc
{
[WowPacketParser(WowOpcodes.SMSG_COMPRESSED_COMPOUND_PACKET)]
[WowPacketParser(WowOpcodes.SMSG_COMPOUND_PACKET)]
internal sealed class CompoundPacketParser : WowPacketParser