韩国官方奇迹S9的最新封包乱序处理源代码

// PacketTwister.h: interface for the PacketTwister class.
//////////////////////////////////////////////////////////////////////

#ifndef __PACKETTWISTER_H__
#define __PACKETTWISTER_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class PacketTwister
{
public:
        PacketTwister(){};
        virtual ~PacketTwister(){};

        virtual void Twist(BYTE* data, int length) = 0;
        virtual void Correct(BYTE* data, int length) = 0;
};

#endif

// PacketTwisterImpl.h: interface for the PacketTwisterImpl class.
//
//////////////////////////////////////////////////////////////////////

#ifndef __PACKETTWISTERIMPL_H__
#define __PACKETTWISTERIMPL_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "PacketTwistRunner.h"

class PacketTwister_1 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);
       
        PacketTwister_1(){};
        virtual ~PacketTwister_1(){};
};

class PacketTwister_2 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_2(){};
        virtual ~PacketTwister_2(){};
};

class PacketTwister_3 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_3(){};
        virtual ~PacketTwister_3(){};
};

class PacketTwister_4 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_4(){};
        virtual ~PacketTwister_4(){};
};

class PacketTwister_5 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_5(){};
        virtual ~PacketTwister_5(){};
};

class PacketTwister_6 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_6(){};
        virtual ~PacketTwister_6(){};
};

class PacketTwister_7 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_7(){};
        virtual ~PacketTwister_7(){};
};

class PacketTwister_8 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_8(){};
        virtual ~PacketTwister_8(){};
};

class PacketTwister_9 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_9(){};
        virtual ~PacketTwister_9(){};
};

class PacketTwister_10 : public PacketTwister
{
public:
        virtual void Twist(BYTE* data, int length);
        virtual void Correct(BYTE* data, int length);

        PacketTwister_10(){};
        virtual ~PacketTwister_10(){};
};

...

#endif

// PacketTwistRunner.h: interface for the PacketTwistRunner class.
//
//////////////////////////////////////////////////////////////////////

#ifndef __PACKETTWISTRUNNER_H__
#define __PACKETTWISTRUNNER_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <map>
#include "PacketTwister.h"

class PacketTwistRunner
{
private:
        std::map<BYTE, PacketTwister*> m_twisters;

public:
        PacketTwistRunner();
        ~PacketTwistRunner();

        PacketTwistRunner(const PacketTwistRunner& rhs) : m_twisters( rhs.m_twisters )
        {
                if (this == &rhs) return;
        };

        const PacketTwistRunner& operator=(const PacketTwistRunner& rhs)
        {
                if (this == &rhs) return *this;

                m_twisters = rhs.m_twisters;

                return *this;
        };

        bool Install();
        void Twist(BYTE headCode, BYTE* data, int length);
        void Correct(BYTE headCode, BYTE* data, int length);
        void Finish();
};

#endif

本文出自 7j45 > 奇迹一条龙