Esempio n. 1
0
static void AddAdapterProperty( GI::ObjectProto *proto )
{
    proto->AddProperty( KEYVALUE( PMAX_STACKCNT, (long) DEFAULT_MAX_STACKCNT ) );
    proto->AddProperty( KEYVALUE( PSTACKCNT, 0L ) );
    proto->AddProperty( KEYVALUE( PID, NULL_GUID ) );
    proto->AddProperty( KEYVALUE( PMAKER_NAME, "" ) );
}
Esempio n. 2
0
void des_init( DESKEYTABLE * keytable , unsigned char * key )
{
	int	i, c;
	LB	a, d, k;
	
	a.l = PC1TABLEFT[ key[7] ];
	d.l = PC1TABRIGHT[ key[7] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[6] ];
	d.l += PC1TABRIGHT[ key[6] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[5] ];
	d.l += PC1TABRIGHT[ key[5] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[4] ];
	d.l += PC1TABRIGHT[ key[4] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[3] ];
	d.l += PC1TABRIGHT[ key[3] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[2] ];
	d.l += PC1TABRIGHT[ key[2] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[1] ];
	d.l += PC1TABRIGHT[ key[1] ];
	a.l <<= 1;
	d.l <<= 1;
	a.l += PC1TABLEFT[ key[0] ];
	d.l += PC1TABRIGHT[ key[0] ];
	a.b.b3 &= 0xF0;
	d.b.b3 <<= 4;
	
	for( i = 0 ; i<16 ; i++ ) {
		for( c = SHIFT[i] ; c-- ; ) {           
			a.l = (a.l<<1) + ((a.b.b0&0x80u)?0x10:0);
			d.l = (d.l<<1) + ((d.b.b0&0x80u)?0x10:0);
		} 

#define KEYVALUE(x,s) (unsigned char)((((((((((((x>>s[0]))<<1)+((x>>s[1])&1))<<1)+((x>>s[2])&1))<<1)+((x>>s[3])&1))<<1)+((x>>s[4])&1))<<1)+((x>>s[5])&1))

		k.b.b0 = KEYVALUE( a.l, KEYTAB[0]);
		k.b.b1 = KEYVALUE( a.l, KEYTAB[2]);
		k.b.b2 = KEYVALUE( d.l, KEYTAB[4]);
		k.b.b3 = KEYVALUE( d.l, KEYTAB[6]);
		keytable->KEY[i].KEY0246 = k.l;
		
		k.b.b0 = KEYVALUE( a.l, KEYTAB[1]);
		k.b.b1 = KEYVALUE( a.l, KEYTAB[3]);
		k.b.b2 = KEYVALUE( d.l, KEYTAB[5]);
		k.b.b3 = KEYVALUE( d.l, KEYTAB[7]);
		keytable->KEY[i].KEY1357 = k.l;
	}
}
Esempio n. 3
0
static bool LoadProto( GI::ObjectProto *proto, CRFile *file )
{
    long index = ReadLong( file );
    proto->AddProperty( KEYVALUE( PINDEX, index ) );

    std::string origName = ReadString( file );
    proto->AddProperty( KEYVALUE( PORIGNAME, origName ) );

    std::string name = ReadString( file );
    proto->AddProperty( KEYVALUE( PNAME, name ) );

    SkipByte<1>( file );

    long goldPrice = ReadLong( file );
    proto->AddProperty( KEYVALUE( PGOLD_PRICE, goldPrice ) );

    long sliverPrice = ReadLong( file );
    proto->AddProperty( KEYVALUE( PSILVER_PRICE, sliverPrice ) );

    long type = ReadLong( file );
    proto->AddProperty( KEYVALUE( PTYPE, type ) );

    long pic = ReadLong( file );
    proto->AddProperty( KEYVALUE( PUI_PICID, pic ) );

    pic = ReadLong( file );
    proto->AddProperty( KEYVALUE( PRGN_PICID, pic ) );

    pic = ReadLong( file );
    proto->AddProperty( KEYVALUE( PEQUIP_PICID, pic ) );

    SkipByte<4*3>( file );
    SkipByte<1>( file );
    SkipByte<4>( file );

    std::string desc = ReadString( file );
    proto->AddProperty( KEYVALUE( PDESC, desc ) );

    // NOTE: 
    AddAdapterProperty( proto );

    LoadExtProperty( proto, file );
    LoadSuitProperty( proto, file );
    LoadTriggerProperty( proto, file );
    
    return true;
}
Esempio n. 4
0
static bool LoadExtProperty( GI::ObjectProto *proto, CRFile *file )
{
    long cnt = ReadLong( file );
    for( long i = 0; i < cnt; ++ i )
    {
        long type = ReadNumber<short>( file );
        SkipByte<1>( file );
        SkipByte<1>( file );

        long val1 = ReadLong( file );
        long val2 = ReadLong( file );

        if( type == PMAX_STACKCNT_DEP )
        {
            SetIfExist( proto, KEYVALUE( PMAX_STACKCNT, val1 ) );
        }
        else
        {
            SetIfExist( proto, KEYVALUE( type, TypeSet::ValueType::LongPair( val1, val2 ) ) );
        }
    }
    return true;
}