⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spliter.c.svn-base

📁 A Flash Player with ActionScript support. Write in C and C++. It have two part, one is Player and an
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
    p->Width=SWAP16(p->Width);    if (type==3) {        reader_GetRgba(reader,&(p->ColorRGB));    } else {        reader_GetRgb(reader,(&(p->ColorRGB)));    }    return 0;}int g_GetLineStyleArray(struct reader_t *reader,struct LineStyleArray **p,int type) {    UI8 count;    UI16 e_count;    int len;    int i;    if (reader->read(reader, &count, 1) !=1 )        return gg_error();    if (count==0xff) {        if (reader->read(reader, &e_count, 2) !=2 )            return gg_error();        e_count=SWAP16(e_count);        len=e_count;    } else {        len=count;    }    *p=(struct LineStyleArray*)malloc(sizeof(struct LineStyleArray)+sizeof(struct LineStyle)*(len-1));    bzero((void *)*p,sizeof(struct LineStyleArray)+sizeof(struct LineStyle)*(len-1));    (*p)->count=len;    for(i=0;i<len;i++) {        g_GetLineStyle(reader,&((*p)->LineStyles[i]),type);    }    return 0;}int g_GetShapeRecords(struct reader_t *reader,struct ShapeRecord **ShapeRecord_p,int type) {    UI8 NumFillBits,NumLineBits;    UI8 TypeFlag,Flags;    int MoveBits;    int NumBits;    struct StraightEdgeRecord *StraightEdgeRecordP;    struct CurvedEdgeRecord   *CurvedEdgeRecordP;    struct StyleChangeRecord  *StyleChangeRecordP;    struct ShapeRecord *ShapeRecordP,*dq = NULL;    reader->bitpos=8;    NumFillBits=reader_GetBits(reader,4);    NumLineBits=reader_GetBits(reader,4);    while (1) {        TypeFlag=(UI8)reader_GetBits(reader,1);        if (TypeFlag==0) {            Flags=(UI8)reader_GetBits(reader,5);            if (Flags==0) {#if DEBUG                printf("EndShapeRecord\n");#endif                return 0;            } else {#if DEBUG                printf("StyleChangeRecord\n");#endif                StyleChangeRecordP=(struct StyleChangeRecord *)malloc(sizeof(struct StyleChangeRecord));                bzero((void *)StyleChangeRecordP,sizeof(struct StyleChangeRecord));                StyleChangeRecordP->Flags=Flags;                if ((Flags&(StateMoveTo))==(StateMoveTo)) {                    MoveBits=(int)reader_GetBits(reader,5);                    StyleChangeRecordP->MoveDeltaX=(long)reader_GetSBits(reader,MoveBits);                    StyleChangeRecordP->MoveDeltaY=(long)reader_GetSBits(reader,MoveBits);                }                if ((Flags&(StateFillStyle0))==(StateFillStyle0)) {                    StyleChangeRecordP->FillStyle0=(long)reader_GetBits(reader,NumFillBits);                }                if ((Flags&(StateFillStyle1))==(StateFillStyle1)) {                    StyleChangeRecordP->FillStyle1=(long)reader_GetBits(reader,NumFillBits);                }                if ((Flags&(StateLineStyle))==(StateLineStyle)) {                    StyleChangeRecordP->LineStyle=(long)reader_GetBits(reader,NumLineBits);                }                if ((Flags&(StateNewStyles))==(StateNewStyles)) {                    g_GetFillStyleArray(reader,&(StyleChangeRecordP->FillStylesP),type);                    g_GetLineStyleArray(reader,&(StyleChangeRecordP->LineStylesP),type);                    NumFillBits=(long)reader_GetBits(reader,4);                    NumLineBits=(long)reader_GetBits(reader,4);                }                ShapeRecordP=(struct ShapeRecord *)StyleChangeRecordP;            }        } else {            Flags=(UI8)reader_GetBits(reader,1);            if (Flags==0) {#if DEBUG                printf("CurvedEdgeRecord\n");#endif                CurvedEdgeRecordP=(struct CurvedEdgeRecord *)malloc(sizeof(struct CurvedEdgeRecord));                bzero((void *)CurvedEdgeRecordP,sizeof(struct CurvedEdgeRecord));                CurvedEdgeRecordP->Flags=(TCurvedEdge);                NumBits=(int)reader_GetBits(reader,4);                NumBits+=2;                CurvedEdgeRecordP->ControlDeltaX=(long)reader_GetSBits(reader,NumBits);                CurvedEdgeRecordP->ControlDeltaY=(long)reader_GetSBits(reader,NumBits);                CurvedEdgeRecordP->AnchorDeltaX=(long)reader_GetSBits(reader,NumBits);                CurvedEdgeRecordP->AnchorDeltaY=(long)reader_GetSBits(reader,NumBits);                ShapeRecordP=(struct ShapeRecord *)CurvedEdgeRecordP;            } else {#if DEBUG                printf("StraightEdgeRecord\n");#endif                StraightEdgeRecordP=(struct StraightEdgeRecord *)malloc(sizeof(struct StraightEdgeRecord));                bzero((void *)StraightEdgeRecordP,sizeof(struct StraightEdgeRecord));                StraightEdgeRecordP->Flags=(TStraightEdge);                NumBits=(int)reader_GetBits(reader,4);                NumBits+=2;                StraightEdgeRecordP->StraightLineFlag=(UB_1)reader_GetBits(reader,1);                if (StraightEdgeRecordP->StraightLineFlag) {                    StraightEdgeRecordP->StraightLineDeltaX=(long)reader_GetSBits(reader,NumBits);                    StraightEdgeRecordP->StraightLineDeltaY=(long)reader_GetSBits(reader,NumBits);                } else {                    StraightEdgeRecordP->VertLineFlag=(UB_1)reader_GetBits(reader,1);                    if (StraightEdgeRecordP->VertLineFlag) {                        StraightEdgeRecordP->VertLineDeltaY=(long)reader_GetSBits(reader,NumBits);                    } else {                        StraightEdgeRecordP->HorLineDeltaX=(long)reader_GetSBits(reader,NumBits);                    }                }                ShapeRecordP=(struct ShapeRecord *)StraightEdgeRecordP;            }        }        if (*ShapeRecord_p==NULL) {            *ShapeRecord_p=ShapeRecordP;        } else {            if ( dq == NULL) {                dq=*ShapeRecord_p;            }            while(dq->NextP) {                dq=dq->NextP;            }            dq->NextP=ShapeRecordP;        }    }}int g_GetShapeWithStyle(struct reader_t *reader,struct DefineShape *shape_p,int type) {    g_GetFillStyleArray(reader,&(shape_p->FillStylesP),type);    g_GetLineStyleArray(reader,&(shape_p->LineStylesP),type);    g_GetShapeRecords(reader,&(shape_p->ShapeRecordsP),type);    return 0;}int g_GetDefineShape(struct reader_t *reader,swf_file_t *swf_p,int len,int type) {    struct DefineShape *p;    UI16 id;    int size;    size=sizeof(struct DefineShape);    p=(struct DefineShape *)malloc(size);#if DEBUG    printf("GetDefineShape function begin\n");    printf("p:%p\n",p);    printf("size%d\n",size);#endif    bzero((void*)p,sizeof(struct DefineShape));    if (reader->read(reader, &id, 2) !=2 )        return gg_error();    id=SWAP16(id);#if DEBUG    printf("id:%d\n",id);#endif    p->CharacterType=CharShape;#if DEBUG    printf("p->CharacterType:%d\n",p->CharacterType);#endif    reader_GetRect(reader,&(p->ShapeBounds));    g_GetShapeWithStyle(reader,p,type);#if DEBUG    printf("GetDefineShape function end\n");#endif    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);    return 0;}int g_GetDefineBits(struct reader_t *reader,swf_file_t *swf_p,int len) {    struct DefineBits *p;    UI16 id;    int datacount=0;    datacount=len-2;    p=(struct DefineBits *)malloc(sizeof(struct DefineBits)+datacount);    bzero((void *)p,sizeof(struct DefineBits)+datacount);    if (reader->read(reader, &id, 2) !=2 )        return gg_error();    p->JPEGDataLength=datacount;    p->CharacterType=(CharBitsOne);    if (reader->read(reader, p->JPEGData, datacount) != datacount)        return gg_error();    //    bmp_makebmp(p);    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetDefineBitsJPEG(struct reader_t *reader,swf_file_t *swf_p,int len,int type) {    struct DefineBitsJPEG *p;    UI16 id;    char cp[4];    int datacount=0;    if (type==3) {        datacount=len-6;    } else {        datacount=len-2;    }    p=(struct DefineBitsJPEG *)malloc(sizeof(struct DefineBitsJPEG)+datacount);    bzero((void *)p,sizeof(struct DefineBitsJPEG)+datacount);    if (reader->read(reader, &id, 2) !=2 )        return gg_error();    p->CharacterType=(CharBitsJPEG);    if (type==3) {        if (reader->read(reader, cp, 4) !=4 )            return gg_error();        p->JPEGDataLength=GET32(cp);        p->AlphaDataLength=datacount-p->JPEGDataLength;    } else {        p->JPEGDataLength=datacount;    }    if (reader->read(reader, p->JPEGData, datacount) != datacount)        return gg_error();    //    bmp_makebmp(p);    return g_AddToDict(swf_p,id,(struct DefineCharacter*)p);}int g_GetShowframe(struct reader_t *reader) {    struct MovieClips *p;    p=reader->MovieClipsPointer;    while (p->NextP) {        p=p->NextP;    }    p->frame+=1;    return 0;}int g_GetSoundEnvelope(struct reader_t *reader,struct SoundEnvelope *EnvelopeP) {    char strp[4];    UI16 Num;    if (reader->read(reader, (void*)strp, 4) !=4 )        return gg_error();    EnvelopeP->Pos44=GET32(strp);    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    EnvelopeP->LeftLevel=SWAP16(Num);    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    EnvelopeP->RightLevel=SWAP16(Num);    return 0;}int g_GetSoundInfo(struct reader_t *reader,int len,struct SoundInfo **SoundInfoP) {    struct SoundInfo* p;    UI8 flags=0;    char strp[4];    UI32 InPoint=0,OutPoint=0;    UI16 LoopCount=0;    UI8 EnvPoints=0;    int count=1;    int i;    if (reader->read(reader, &flags, 1) !=1 )        return gg_error();    if ((flags&HasInPoint)==HasInPoint) {        if (reader->read(reader, (void*)strp, 4) !=4 )            return gg_error();        InPoint=GET32(strp);    }    if ((flags&HasOutPoint)==HasOutPoint) {        if (reader->read(reader, (void*)strp, 4) !=4 )            return gg_error();        OutPoint=GET32(strp);    }    if ((flags&HasLoops)==HasLoops) {        if (reader->read(reader, &LoopCount, 2) !=2 )            return gg_error();        LoopCount=SWAP16(LoopCount);    }    if ((flags&HasEnvelope)==HasEnvelope) {        if (reader->read(reader, &EnvPoints, 1) !=1 )            return gg_error();        if (EnvPoints!=0) {            count=EnvPoints;        }    }    p=(struct SoundInfo*)malloc(sizeof(struct SoundInfo)+sizeof(struct SoundEnvelope)*(count-1));    bzero((void*)p,(sizeof(struct SoundInfo)+sizeof(struct SoundEnvelope)*(count-1)));    p->Flags=flags;    p->InPoint=InPoint;    p->OutPoint=OutPoint;    p->LoopCount=LoopCount;    p->EnvPoints=EnvPoints;    for (i=0;i<EnvPoints;i++) {        g_GetSoundEnvelope(reader,&(p->EnvelopeRecords[i]));    }    *SoundInfoP = p;    return 0;}int g_GetStartSound(struct reader_t *reader,int len) {    struct MovieClips *p;    struct  StartSound *Sp,*SoundP;    p=reader->MovieClipsPointer;    while (p->NextP) {        p=p->NextP;    }    SoundP=(struct  StartSound *)malloc(sizeof(struct  StartSound));    bzero((void *)SoundP,sizeof(struct  StartSound));    if (reader->read(reader, &(SoundP->SoundId), 2) !=2 )        return gg_error();    SoundP->SoundId=SWAP16(SoundP->SoundId);    g_GetSoundInfo(reader,len,&(SoundP->SoundInfoP));    Sp=p->MovieClipP->Frames[p->frame].EventSoundP;    if (Sp) {        while (Sp->NextP)            Sp=Sp->NextP;        Sp->NextP=SoundP;    } else {        p->MovieClipP->Frames[p->frame].EventSoundP = SoundP;    }    return 0;}int g_GetSoundStreamHead(struct reader_t *reader,int len) {    struct MovieClips *MCp;    struct SoundStreamHead *p;    UI16 Num;    SI16 SNum;    MCp=reader->MovieClipsPointer;    while (MCp->NextP) {        MCp=MCp->NextP;    }    p=(struct SoundStreamHead*)malloc(sizeof(struct SoundStreamHead));    bzero((void*)p,sizeof(struct SoundStreamHead));    if (reader->read(reader, &(p->PlaybackFlags), 1) !=1 )        return gg_error();    if (reader->read(reader, &(p->StreamSoundFlags), 1) !=1 )        return gg_error();    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    p->StreamSoundSampleCount=SWAP16(Num);    if((p->StreamSoundFlags&MP3)==MP3) {        if (reader->read(reader, &SNum, 2) !=2 )            return gg_error();        p->LatencySeek=SWAP16(SNum);    }    MCp->MovieClipP->Frames[MCp->frame].SoundStreamHeadP=p;    return 0;}int g_GetRemoveObject(struct reader_t *reader,int len,int type) {    struct RemoveObject *p;    struct PAndRObjects *dq;    UI16 Num;    struct MovieClips *MCp;    MCp=reader->MovieClipsPointer;    while (MCp->NextP) {        MCp=MCp->NextP;    }    p=(struct RemoveObject *)malloc(sizeof(struct RemoveObject));    bzero((void *)p,sizeof(struct RemoveObject));    if (type==1) {        if (reader->read(reader, &Num, 2) !=2 )            return gg_error();        p->CharacterID=SWAP16(Num);        p->PlaceAndRemoveType=TRemoveObjectOne;    } else {        p->PlaceAndRemoveType=TRemoveObjectTwo;    }    if (reader->read(reader, &Num, 2) !=2 )        return gg_error();    p->Depth=SWAP16(Num);    dq=MCp->MovieClipP->Frames[MCp->frame].TagsListP;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -