Пример #1
0
def get_table_slot_dict ( req, blockdata, n ):
    # 0 offset to first
    # +9 to get to next
    # blocks of 9b for each score table entry
    #   1b .. 41 (A) .. not sure
    #   4b score BCD
    #   3b initials in .. BCD? guessing.
    #   1b stage (byte?)

    a = decode_common.get_array ( blockdata, 0 + ( 9 * n ), 9 )

    hi = ( decode_bcd.bcd_byte_to_int ( a [ 1 ] ) * 1000000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 2 ] ) *   10000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 3 ] ) *     100 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 4 ] ) *       1 )

    stage = decode_bcd.bcd_byte_to_int ( a [ 8 ] ) # assuminc BCD, same thing if the level count is not really high..

    initials = decode_common.decode_ascii ( a [ 5 ] ) + \
               decode_common.decode_ascii ( a [ 6 ] ) + \
               decode_common.decode_ascii ( a [ 7 ] )

    d = dict()
    d [ 'score' ] = hi
    d [ 'shortname' ] = initials

    return d
Пример #2
0
def get_table_slot_dict ( req, blockdata, n ):
    # 4b is top score
    # blocks of 8b for each score table entry
    #   4b BCD score
    #   1b stage (BCD or byte, not sure offhand)
    #   3b name in ASCII (!)

    a = decode_common.get_array ( blockdata, 4 + ( 8 * n ), 8 )

    hi = ( decode_bcd.bcd_byte_to_int ( a [ 0 ] ) * 1000000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 1 ] ) *   10000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 2 ] ) *     100 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 3 ] ) *       1 )

    stage = decode_bcd.bcd_byte_to_int ( a [ 4 ] ) # assuminc BCD, same thing if the level count is not really high..

    initials = decode_common.decode_ascii ( a [ 5 ] ) + \
               decode_common.decode_ascii ( a [ 6 ] ) + \
               decode_common.decode_ascii ( a [ 7 ] )

    d = dict()
    d [ 'score' ] = hi
    d [ 'shortname' ] = initials

    return d
Пример #3
0
def get_table_slot_dict ( req, blockdata, n ):
    # blocks of
    #   3b BCD score: 0030 00 -> 30,000
    #           0130 02 -> 230010 in game, so its b3 b2 b1  02 30 01 times 10 = 230010
    #   1b stage - 1
    #   3b initials ASCII

    a = decode_common.get_array ( blockdata, 0 + ( 7 * n ), 7 )

    hi = ( decode_bcd.bcd_byte_to_int ( a [ 2 ] ) * 100000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 1 ] ) *   1000 ) + \
         ( decode_bcd.bcd_byte_to_int ( a [ 0 ] ) *     10 )

    initials = decode_common.decode_ascii ( a [ 4 ] ) + \
               decode_common.decode_ascii ( a [ 5 ] ) + \
               decode_common.decode_ascii ( a [ 6 ] )

    d = dict()
    d [ 'score' ] = hi
    d [ 'shortname' ] = initials

    return d