在CI可以這樣做:如何更改列表(Python)的索引/偏移量?
return byte_99DC2C[byte_C06740[dword_C06738]++];
在Lua中我可以這樣做:
memory.readbyte(0x83084+memory.readbyte(0x62e10+(memory.readbyte(0x62e18)+1)));
我怎樣才能做到這一點在Python和一個列表(因爲我不能做業務在RAM上)?
我想在Python這樣的事情,但它是錯誤的:
rn_table = [0x63, 0x06, 0xF0, 0x23, 0xF8, 0xE5, 0xA8, 0x01, 0xC1, 0xAE, 0x7F, 0x48,
0x7B, 0xB1, 0xDC, 0x09, 0x22, 0x6D, 0x7D, 0xEE, 0x9D, 0x58, 0xD5, 0x55, 0x24, 0x39, 0x7A, 0xDF,
0x8E, 0x54, 0x6C, 0x1B, 0xC0, 0x0B, 0xD0, 0x43, 0xD8, 0x9A, 0x47, 0x5D, 0x21, 0x02, 0x17, 0x4B,
0xDB, 0x11, 0xAF, 0x70, 0xCD, 0x4D, 0x34, 0x49, 0x72, 0x91, 0x2D, 0x62, 0x97, 0x59, 0x45, 0xF7,
0x6E, 0x46, 0xAA, 0x0A, 0xA3, 0xC8, 0x31, 0x92, 0x38, 0xFA, 0xD4, 0xE6, 0xCB, 0xF3, 0xDE, 0x6B,
0xBB, 0xF1, 0x1C, 0x3C, 0xD6, 0xAD, 0xB2, 0xA9, 0xDD, 0x57, 0x42, 0x95, 0x0C, 0x79, 0x25, 0x1F,
0xBC, 0xE7, 0xAC, 0x5B, 0x83, 0x28, 0x76, 0xF2, 0x18, 0xDA, 0x87, 0xA1, 0x61, 0x6F, 0xBE, 0x5A,
0x5E, 0x51, 0xEF, 0xB0, 0xC9, 0x15, 0x74, 0x89, 0xBD, 0xD1, 0xA2, 0x75, 0xD7, 0x99, 0x85, 0x4C,
0x4F, 0xD2, 0xBF, 0x4A, 0x20, 0x08, 0x56, 0xA0, 0x50, 0x3A, 0x67, 0x26, 0x41, 0x33, 0xB7, 0xBA,
0xFB, 0x30, 0xCF, 0x7C, 0x84, 0x2C, 0x32, 0xE9, 0x1D, 0x16, 0x82, 0x78, 0xA4, 0x80, 0x65, 0x5F,
0x0E, 0x27, 0xB9, 0x19, 0xC3, 0xA7, 0xB6, 0x00, 0x3B, 0xFC, 0x88, 0xE1, 0xC6, 0x93, 0xFE, 0x8B,
0xD9, 0xB8, 0x13, 0x69, 0x2F, 0x64, 0x12, 0x37, 0xFD, 0x77, 0xE2, 0xB5, 0x04, 0xE0, 0x1A, 0x8C,
0x8F, 0xB4, 0xCC, 0xF9, 0x60, 0xEB, 0x29, 0xE3, 0x90, 0xA5, 0x68, 0x3D, 0x81, 0x73, 0x3F, 0xAB,
0x7E, 0xB3, 0x0F, 0xCE, 0xC4, 0x35, 0x94, 0x96, 0x86, 0x71, 0xD3, 0x2A, 0xE4, 0x9F, 0x9C, 0xEC,
0x4E, 0x14, 0xF5, 0xEA, 0x40, 0xA6, 0xF6, 0x03, 0x98, 0xC5, 0x07, 0xF4, 0x2B, 0xC2, 0x3E, 0xE8,
0x9B, 0x36, 0x53, 0x2E, 0x8D, 0x0D, 0x52, 0x10, 0x66, 0x1E, 0xED, 0x8A, 0x44, 0x9E, 0x05, 0xFF,
0x5C, 0xC7, 0x6A, 0xCA, 0x00, 0x0C, 0x12, 0x19, 0x21, 0x27, 0x2D, 0x35, 0x3D, 0x49, 0x51, 0x5A,
0x62, 0x69, 0x72, 0x7A, 0x83, 0x8B, 0x94, 0x9D, 0xA5, 0xAB, 0xB2, 0xB9, 0xC1, 0xC9, 0xD2, 0xD9,
0xDE, 0xE3, 0xE8, 0xED, 0xF5]
c06738_lookups = [0,0,0,0,0,0,0,0,0]
c06740_chooser = 0
dword_C06748 = 0
def calc_crit():
return 99 * sub_5D191A()/65535 + 1
def sub_5D191A():
return sub_5C8BF2()
def sub_5C8BF2():
v2 = sub_5C8BA1()
v0 = dword_C06748 + 1 and 7
if (v0):
sub_5C8B80()
return v2 or (sub_5C8BA1() << 8)
def sub_5C8BA1():
return rn_table[c06740_chooser[c06738_lookups]+1]
def sub_5C8B80():
result = dword_C06738 + 1 + 1
c06738_lookups and 7
return result
calc_crit()
print "c06738_lookups: %r" % c06738_lookups
我想index
是列表lookups
的位置編號。所以我想增加索引,使它看起來在位置1(這是在列表中的值4
)。
我想增加索引,以便我可以對列表中的第二個值執行操作我顯然不希望這個硬編碼,因爲我想隨意循環位置)。
我該怎麼做?
爲什麼不直接分配給'index'呢? 'index + = 1'。 –
你爲什麼要這樣做,而不是僅僅使用python中的列表工作的標準方式? – Stuart
此外,你的Lua代碼完全不同於C代碼。 –