def parse_file_location_table(self, fp): self.unknown_table1_offset = data.f_uint32(fp) self.unknown_table3_offset = data.f_uint32(fp) self.glob_data_table1_offset = data.f_uint32(fp) self.glob_data_table2_offset = data.f_uint32(fp) self.changed_forms_offset = data.f_uint32(fp) self.glob_data_table3_offset = data.f_uint32(fp) self.glob_data_table1_count = data.f_uint32(fp) self.glob_data_table2_count = data.f_uint32(fp) self.glob_data_table3_count = data.f_uint32(fp) self.changed_form_count = data.f_uint32(fp) self.unknown_4 = data.f_buf(4*15, fp)
def parse_full(self, file): if not os.path.exists(file): return False with open(file, 'rb') as fp: self.parse_header(fp) self.parse_plugins(fp) self.parse_file_location_table(fp) self.global_data_table1 = [] for i in xrange(0, self.glob_data_table1_count): self.global_data_table1.append(self.parse_global_data(fp)) self.global_data_table2 = [] for i in xrange(0, self.glob_data_table2_count): self.global_data_table2.append(self.parse_global_data(fp)) self.changed_forms = [] for i in xrange(0, self.changed_form_count): self.changed_forms.append(self.parse_changed_form(fp)) self.global_data_table3 = [] for i in xrange(0, self.glob_data_table3_count+1): self.global_data_table3.append(self.parse_global_data(fp)) self.unknown_table1 = '' self.unknown_table2 = '' self.unknown_table3 = [] self.unknown_table1_count = data.f_uint32(fp) #print 'unknown table1 count: %d' % self.unknown_table1_count if self.unknown_table1_count > 0: self.unknown_table1 = data.f_buf(self.unknown_table1_count*4, fp) self.unknown_table2_count = data.f_uint32(fp) #print 'unknown table2 count: %d' % self.unknown_table2_count if self.unknown_table2_count > 0: self.unknown_table2 = data.f_buf(self.unknown_table2_count*4, fp) self.unknown_table3_size = data.f_uint32(fp) #print 'unknown table3 size: %d' % self.unknown_table3_size self.unknown_table3_count = data.f_uint32(fp) #print 'unknown table3 count: %d' % self.unknown_table3_count if self.unknown_table3_count > 0: for i in xrange(0, self.unknown_table3_count): self.unknown_table3.append( data.f_wstring(fp) ) return True
def parse_changed_form(self, fp): cf = data._CHANGEDFORM() cf.unknown_1 = data.f_uint8(fp) cf.unknown_2 = data.f_uint8(fp) cf.unknown_3 = data.f_uint8(fp) cf.unknown_4 = data.f_uint32(fp) cf.flags = data.f_uint8(fp) cf.version = data.f_uint8(fp) len_flag = (cf.flags & 0xC0) >> 6 #print "flags: %02X, version: %d, len_flag: %d" % (cf.flags, cf.version, len_flag) if len_flag == 0: cf.len_1 = data.f_uint8(fp) cf.len_2 = data.f_uint8(fp) elif len_flag == 1: cf.len_1 = data.f_uint16(fp) cf.len_2 = data.f_uint16(fp) elif len_flag == 2: cf.len_1 = data.f_uint32(fp) cf.len_2 = data.f_uint32(fp) #print "len1: %d, len2: %d" % (cf.len_1, cf.len_2) if cf.len_1 > 0: cf.data = data.f_buf(cf.len_1, fp) return cf
def parse_header(self, fp): self.file_magic = data.f_string(13, fp) self.hd_size = data.f_uint32(fp) self.version = data.f_uint32(fp) self.save_num = data.f_uint32(fp) self.player_nm = data.f_wstring(fp) self.player_lvl = data.f_uint32(fp) self.player_loc = data.f_wstring(fp) self.ingame_dt = data.f_wstring(fp) self.player_race = data.f_wstring(fp) self.unknown_1 = data.f_uint16(fp) self.unknown_2 = data.f_float(fp) self.unknown_3 = data.f_float(fp) self.filetime = data.f_filetime(fp) self.shot_w = data.f_uint32(fp) self.shot_h = data.f_uint32(fp) self.shot_data = data.f_buf(3*self.shot_h*self.shot_w, fp) self.form_ver = data.f_uint8(fp)
def parse_global_data(self, fp): gb = data._GLOBALDATA() gb.type_ = data.f_uint32(fp) gb.len_ = data.f_uint32(fp) gb.data = data.f_buf(gb.len_, fp) return gb
def from_fobj(self, fobj): count = data.f_uint32(fobj) for i in xrange(0, count): self.items.append( MiscStat().from_fobj(fobj) ) return self