comparison pytouhou/formats/ecl.py @ 66:a701a89192a9

Add offset translation for all relative jumps.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Thu, 25 Aug 2011 11:33:47 -0700
parents d469012368b3
children e2cb9d434dc2
comparison
equal deleted inserted replaced
65:0efec109f798 66:a701a89192a9
174 174
175 175
176 # Translate offsets to instruction pointers 176 # Translate offsets to instruction pointers
177 for instr_offset, (i, instr) in zip(instruction_offsets, enumerate(ecl.subs[-1])): 177 for instr_offset, (i, instr) in zip(instruction_offsets, enumerate(ecl.subs[-1])):
178 time, opcode, rank_mask, param_mask, args = instr 178 time, opcode, rank_mask, param_mask, args = instr
179 if opcode in (2, 31): # relative_jump 179 if opcode in (2, 29, 30, 31, 32, 33, 34): # relative_jump
180 frame, relative_offset = args 180 frame, relative_offset = args
181 args = frame, instruction_offsets.index(instr_offset + relative_offset) 181 args = frame, instruction_offsets.index(instr_offset + relative_offset)
182 elif opcode == 3: # relative_jump_ex 182 elif opcode == 3: # relative_jump_ex
183 frame, relative_offset, counter_id = args 183 frame, relative_offset, counter_id = args
184 args = frame, instruction_offsets.index(instr_offset + relative_offset), counter_id 184 args = frame, instruction_offsets.index(instr_offset + relative_offset), counter_id