def wait_for_ssb_update(self, ssb: SsbLoadedFile): if ssb.filename in self.new_breakpoint_mapping: # We can switch now update. self.breakpoint_mapping[ ssb.filename] = self.new_breakpoint_mapping[ssb.filename] del self.new_breakpoint_mapping[ssb.filename] with open_utf8(self._breakpoint_filename, 'w') as f: json.dump(self.breakpoint_mapping, f) ssb.unregister_reload_event_manager(self.wait_for_ssb_update)
def deserialize(cls, data: bytes, *, filename, static_data, project_fm, **kwargs) -> 'SsbLoadedFile': f = SsbLoadedFile(filename, FileType.SSB.deserialize(data, static_data), None, project_fm) f.exps.ssb_hash = SsbFileManager.hash(data) return f
def get_ssb(self, filename, ssb_file_manager: 'SsbFileManager') -> 'SsbLoadedFile': self._check_loaded() if filename not in self._open_files: try: ssb_bin = self._rom.getFileByName(filename) except ValueError as err: raise FileNotFoundError(str(err)) from err self._open_files[filename] = SsbLoadedFile( filename, FileType.SSB.deserialize(ssb_bin, self._static_data), ssb_file_manager, self._project_fm) self._open_files[filename].exps.ssb_hash = ssb_file_manager.hash( ssb_bin) return self._open_files[filename]
def _register_ssb_handler(self, loaded_ssb: SsbLoadedFile): self._registered_ssbs.append(loaded_ssb) loaded_ssb.register_reload_event_editor(self.on_ssb_reload) loaded_ssb.register_property_callback(self.on_ssb_property_change)