def tmp_select(profile_name): for field_id in fields: set_entry_text(entry=fields[field_id], text=self.preferences.get_profile_value( tab, profile_name, field_id)) self.preferences.set_default_profile(tab, profile_name) self.preferences.save()
def create_decompile_script_frame(self, notebook): decompile_script_frame = ttk.Frame(notebook) self.add_title_label_to_frame( text="Decompile a ROM's script to an already existing project.", frame=decompile_script_frame) input_rom_entry = self.add_rom_fields_to_frame( name="ROM", frame=decompile_script_frame) project_entry = self.add_project_fields_to_frame( name="Project", frame=decompile_script_frame) def decompile_script_tmp(): self.preferences[ "default decompile script rom"] = input_rom_entry.get() self.preferences.save() self.do_decompile_script(input_rom_entry, project_entry) button = Button(decompile_script_frame, text="Decompile Script", command=decompile_script_tmp) button.pack(fill=BOTH, expand=1) self.components.append(button) if self.preferences["default decompile script rom"]: set_entry_text( entry=input_rom_entry, text=self.preferences["default decompile script rom"]) return decompile_script_frame
def create_create_patch_frame(self, notebook): patcher_create_frame = ttk.Frame(notebook) self.add_title_label_to_frame("Create EBP patch from a ROM", patcher_create_frame) clean_rom_entry = self.add_rom_fields_to_frame( name="Clean ROM", frame=patcher_create_frame, padding_buttons=0) modified_rom_entry = self.add_rom_fields_to_frame( name="Modified ROM", frame=patcher_create_frame, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame( name="Patch", frame=patcher_create_frame, save=True) def create_patch_tmp(): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default modified rom"] = modified_rom_entry.get() self.preferences.save() self.do_create_patch(clean_rom_entry, modified_rom_entry, patch_entry) button = Button(patcher_create_frame, text="Create Patch", command=create_patch_tmp) button.pack(fill=BOTH, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default modified rom"]: set_entry_text(entry=modified_rom_entry, text=self.preferences["default patched rom"]) return patcher_create_frame
def tmp_select(profile_name): for field_id in fields: set_entry_text( entry=fields[field_id], text=self.preferences.get_profile_value(tab, profile_name, field_id) ) self.preferences.set_default_profile(tab, profile_name) self.preferences.save()
def create_upgrade_frame(self, notebook): upgrade_frame = ttk.Frame(notebook) self.add_title_label_to_frame( text= "Upgrade a project created using an older version of CoilSnake.", frame=upgrade_frame) rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=upgrade_frame) project_entry = self.add_project_fields_to_frame(name="Project", frame=upgrade_frame) def upgrade_tmp(): self.preferences["default upgrade rom"] = rom_entry.get() self.preferences.save() self.do_upgrade(rom_entry, project_entry) self.upgrade_button = Button(upgrade_frame, text="Upgrade", command=upgrade_tmp) self.upgrade_button.pack(fill=BOTH, expand=1) self.components.append(self.upgrade_button) if self.preferences["default upgrade rom"]: set_entry_text(entry=rom_entry, text=self.preferences["default upgrade rom"]) return upgrade_frame
def create_create_patch_frame(self, notebook): patcher_create_frame = ttk.Frame(notebook) self.add_title_label_to_frame("Create EBP patch from a ROM", patcher_create_frame) clean_rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=patcher_create_frame, padding_buttons=0) modified_rom_entry = self.add_rom_fields_to_frame(name="Modified ROM", frame=patcher_create_frame, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame(name="Patch", frame=patcher_create_frame, save=True) def create_patch_tmp(): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default modified rom"] = modified_rom_entry.get() self.preferences.save() self.do_create_patch(clean_rom_entry, modified_rom_entry, patch_entry) button = Button(patcher_create_frame, text="Create Patch", command=create_patch_tmp) button.pack(fill=BOTH, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default modified rom"]: set_entry_text(entry=modified_rom_entry, text=self.preferences["default patched rom"]) return patcher_create_frame
def create_apply_patch_frame(self, notebook): patcher_patch_frame = ttk.Frame(notebook) self.add_title_label_to_frame("Apply an EBP or IPS patch to a ROM", patcher_patch_frame) clean_rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=patcher_patch_frame, padding_buttons=0) patched_rom_entry = self.add_rom_fields_to_frame(name="Patched ROM", frame=patcher_patch_frame, save=True, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame(name="Patch", frame=patcher_patch_frame) headered_var = self.add_headered_field_to_frame(name="ROM Header (IPS only)", frame=patcher_patch_frame) def patch_rom_tmp(): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default patched rom"] = patched_rom_entry.get() self.preferences["default patch"] = patch_entry.get() self.preferences.save() self.do_patch_rom(clean_rom_entry, patched_rom_entry, patch_entry, headered_var) button = Button(patcher_patch_frame, text="Patch ROM", command=patch_rom_tmp) button.pack(fill=BOTH, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default patched rom"]: set_entry_text(entry=patched_rom_entry, text=self.preferences["default patched rom"]) if self.preferences["default patch"]: set_entry_text(entry=patch_entry, text=self.preferences["default patch"]) return patcher_patch_frame
def create_apply_patch_frame(self, notebook): patcher_patch_frame = tkinter.ttk.Frame(notebook) self.add_title_label_to_frame("Apply an EBP or IPS patch to a ROM", patcher_patch_frame) clean_rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=patcher_patch_frame, padding_buttons=0) patched_rom_entry = self.add_rom_fields_to_frame(name="Patched ROM", frame=patcher_patch_frame, save=True, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame(name="Patch", frame=patcher_patch_frame) headered_var = self.add_headered_field_to_frame(name="ROM Header (IPS only)", frame=patcher_patch_frame) def patch_rom_tmp(): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default patched rom"] = patched_rom_entry.get() self.preferences["default patch"] = patch_entry.get() self.preferences.save() self.do_patch_rom(clean_rom_entry, patched_rom_entry, patch_entry, headered_var) button = Button(patcher_patch_frame, text="Patch ROM", command=patch_rom_tmp) button.pack(fill=X, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default patched rom"]: set_entry_text(entry=patched_rom_entry, text=self.preferences["default patched rom"]) if self.preferences["default patch"]: set_entry_text(entry=patch_entry, text=self.preferences["default patch"]) return patcher_patch_frame
def create_decompile_script_frame(self, notebook): decompile_script_frame = ttk.Frame(notebook) self.add_title_label_to_frame(text="Decompile a ROM's script to an already existing project.", frame=decompile_script_frame) input_rom_entry = self.add_rom_fields_to_frame(name="ROM", frame=decompile_script_frame) project_entry = self.add_project_fields_to_frame(name="Project", frame=decompile_script_frame) def decompile_script_tmp(): self.preferences["default decompile script rom"] = input_rom_entry.get() self.preferences.save() self.do_decompile_script(input_rom_entry, project_entry) button = Button(decompile_script_frame, text="Decompile Script", command=decompile_script_tmp) button.pack(fill=BOTH, expand=1) self.components.append(button) if self.preferences["default decompile script rom"]: set_entry_text(entry=input_rom_entry, text=self.preferences["default decompile script rom"]) return decompile_script_frame
def create_upgrade_frame(self, notebook): upgrade_frame = ttk.Frame(notebook) self.add_title_label_to_frame(text="Upgrade a project created using an older version of CoilSnake.", frame=upgrade_frame) rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=upgrade_frame) project_entry = self.add_project_fields_to_frame(name="Project", frame=upgrade_frame) def upgrade_tmp(): self.preferences["default upgrade rom"] = rom_entry.get() self.preferences.save() self.do_upgrade(rom_entry, project_entry) self.upgrade_button = Button(upgrade_frame, text="Upgrade", command=upgrade_tmp) self.upgrade_button.pack(fill=BOTH, expand=1) self.components.append(self.upgrade_button) if self.preferences["default upgrade rom"]: set_entry_text(entry=rom_entry, text=self.preferences["default upgrade rom"]) return upgrade_frame
def create_create_patch_frame(self, notebook): patcher_create_frame = tkinter.ttk.Frame(notebook) self.add_title_label_to_frame("Create EBP patch from a ROM", patcher_create_frame) clean_rom_entry = self.add_rom_fields_to_frame( name="Clean ROM", frame=patcher_create_frame, padding_buttons=0) hacked_rom_entry = self.add_rom_fields_to_frame( name="Modified ROM", frame=patcher_create_frame, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame( name="Patch", frame=patcher_create_frame, save=True) def create_patch_tmp(author, description, title): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default hacked rom"] = hacked_rom_entry.get() self.preferences["default created patch"] = patch_entry.get() self.preferences.save() self.do_create_patch(clean_rom_entry, hacked_rom_entry, patch_entry, author, description, title) def create_patch_do_first(): if patch_entry.get().endswith(".ebp"): popup_ebp_patch_info(self, notebook) elif patch_entry.get().endswith(".ips"): create_patch_tmp("", "", "") else: exc = Exception( "Could not create patch because patch does not end in .ips or .ebp" ) log.error(exc) def popup_ebp_patch_info(self, notebook): if self.preferences["default author"] is None: self.preferences["default author"] = "Author" author = self.preferences["default author"] if self.preferences["default description"] is None: self.preferences["default description"] = "Description" description = self.preferences["default description"] if self.preferences["default title"] is None: self.preferences["default title"] = "Title" title = self.preferences["default title"] top = self.top = Toplevel(notebook) top.wm_title("EBP Patch") l = Label(top, text="Input EBP Patch Info.") l.pack() auth = Entry(top) auth.delete(0, ) auth.insert(0, author) auth.pack() desc = Entry(top) desc.delete(0, ) desc.insert(0, description) desc.pack() titl = Entry(top) titl.delete(0, ) titl.insert(0, title) titl.pack() def cleanup(): author = auth.get() self.preferences["default author"] = author description = desc.get() self.preferences["default description"] = description title = titl.get() self.preferences["default title"] = title self.top.destroy() create_patch_tmp(author, description, title) self.b = Button(top, text='OK', command=cleanup) self.b.pack() button = Button(patcher_create_frame, text="Create Patch", command=create_patch_do_first) button.pack(fill=X, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default hacked rom"]: set_entry_text(entry=hacked_rom_entry, text=self.preferences["default hacked rom"]) if self.preferences["default created patch"]: set_entry_text(entry=patch_entry, text=self.preferences["default created patch"]) return patcher_create_frame
def create_create_patch_frame(self, notebook): patcher_create_frame = tkinter.ttk.Frame(notebook) self.add_title_label_to_frame("Create EBP patch from a ROM", patcher_create_frame) clean_rom_entry = self.add_rom_fields_to_frame(name="Clean ROM", frame=patcher_create_frame, padding_buttons=0) hacked_rom_entry = self.add_rom_fields_to_frame(name="Modified ROM", frame=patcher_create_frame, padding_buttons=0) patch_entry = self.add_patch_fields_to_frame(name="Patch", frame=patcher_create_frame, save=True) def create_patch_tmp(author, description, title): self.preferences["default clean rom"] = clean_rom_entry.get() self.preferences["default hacked rom"] = hacked_rom_entry.get() self.preferences["default created patch"] = patch_entry.get() self.preferences.save() self.do_create_patch(clean_rom_entry, hacked_rom_entry, patch_entry, author, description, title) def create_patch_do_first(): if patch_entry.get().endswith(".ebp"): popup_ebp_patch_info(self, notebook) elif patch_entry.get().endswith(".ips"): create_patch_tmp("", "", "") else: exc = Exception("Could not create patch because patch does not end in .ips or .ebp") log.error(exc) def popup_ebp_patch_info(self, notebook): if self.preferences["default author"] is None: self.preferences["default author"] = "Author" author = self.preferences["default author"] if self.preferences["default description"] is None: self.preferences["default description"] = "Description" description = self.preferences["default description"] if self.preferences["default title"] is None: self.preferences["default title"] = "Title" title = self.preferences["default title"] top = self.top = Toplevel(notebook) top.wm_title("EBP Patch") l = Label(top,text="Input EBP Patch Info.") l.pack() auth = Entry(top) auth.delete(0,) auth.insert(0,author) auth.pack() desc = Entry(top) desc.delete(0,) desc.insert(0,description) desc.pack() titl = Entry(top) titl.delete(0,) titl.insert(0,title) titl.pack() def cleanup(): author = auth.get() self.preferences["default author"] = author description = desc.get() self.preferences["default description"] = description title = titl.get() self.preferences["default title"] = title self.top.destroy() create_patch_tmp(author, description, title) self.b=Button(top,text='OK',command=cleanup) self.b.pack() button = Button(patcher_create_frame, text="Create Patch", command=create_patch_do_first) button.pack(fill=X, expand=1) self.components.append(button) if self.preferences["default clean rom"]: set_entry_text(entry=clean_rom_entry, text=self.preferences["default clean rom"]) if self.preferences["default hacked rom"]: set_entry_text(entry=hacked_rom_entry, text=self.preferences["default hacked rom"]) if self.preferences["default created patch"]: set_entry_text(entry=patch_entry, text=self.preferences["default created patch"]) return patcher_create_frame