Пример #1
0
def get_table_slot_dict ( req, blockdata, n ):
    # first 4b are 'high score' for top of screen
    # then 4b per score (1 through 20)
    # then 6b per rank for initials (6 char initials)

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

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

    a = decode_common.get_array ( blockdata, 84 + ( 12 * n ), 12 )

    initials = decode_char ( a [  1 ] ) + \
               decode_char ( a [  3 ] ) + \
               decode_char ( a [  5 ] ) + \
               decode_char ( a [  7 ] ) + \
               decode_char ( a [  9 ] ) + \
               decode_char ( a [ 11 ] )

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

    return d
Пример #2
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
Пример #3
0
def get_table_slot_dict ( req, blockdata, n ):
    # 0 offset to first
    # +8 to get to next
    # blocks of 9b for each score table entry
    #   4b score -> 01 00 00 00 == 1million - BCD
    #   3b initials in .. byte, A == 00, B == 01, L == 0b
    #   1b - character used (0-4, 5 choices)

    a = decode_common.get_array ( blockdata, 0 + ( 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 )

    character = a [ 7 ]

    initials = decode_char ( a [ 4 ] ) + \
               decode_char ( a [ 5 ] ) + \
               decode_char ( a [ 6 ] )

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

    return d
Пример #4
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
Пример #5
0
def get_table_slot_dict ( req, blockdata, n ):
    # blocks of 10b, for 10 scores == 100b total
    # bcd numbers; 3b for the score in bcd (6 digits), then name, and then timing info and crud

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

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

    initials = decode_char ( a [ 3 ] ) + \
               decode_char ( a [ 4 ] ) + \
               decode_char ( a [ 5 ] )

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

    return d
Пример #6
0
def get_table_slot_dict ( req, blockdata, n ):

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

    hi = ( a [ 0 ] * 100000 ) + \
         ( a [ 1 ] *  10000 ) + \
         ( a [ 2 ] *   1000 ) + \
         ( a [ 3 ] *    100 ) + \
         ( a [ 4 ] *     10 ) + \
         ( a [ 5 ] *      1 )

    initials = decode_char ( a [ 8 ] ) + \
               decode_char ( a [ 9 ] ) + \
               decode_char ( a [ 10 ] )

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

    return d
Пример #7
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