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_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_plugins(self, fp): self.plugin_info_size = data.f_int32(fp) self.plugin_count = data.f_uint8(fp) self.plugins = [] for i in xrange(0, self.plugin_count): self.plugins.append( data.f_wstring(fp) )
def from_fobj(self, fobj): self.name = data.f_wstring(fobj) self.categ = data.f_uint8(fobj) self.value = data.f_int32(fobj) return self