Renpy Save Editor May 2026

self.current_save = None self.save_data = None self.setup_ui() def setup_ui(self): # Menu bar menubar = tk.Menu(self.root) self.root.config(menu=menubar) file_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="File", menu=file_menu) file_menu.add_command(label="Open Save", command=self.open_save) file_menu.add_command(label="Save Changes", command=self.save_changes) file_menu.add_separator() file_menu.add_command(label="Exit", command=self.root.quit) # Main frame main_frame = ttk.Frame(self.root, padding="10") main_frame.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S)) # Left panel - variable list left_frame = ttk.LabelFrame(main_frame, text="Variables", width=300) left_frame.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S), padx=5) self.search_var = tk.StringVar() self.search_var.trace('w', self.filter_variables) search_entry = ttk.Entry(left_frame, textvariable=self.search_var) search_entry.grid(row=0, column=0, sticky=(tk.W, tk.E), pady=5, padx=5) search_entry.insert(0, "Search...") self.variable_listbox = tk.Listbox(left_frame, height=25) self.variable_listbox.grid(row=1, column=0, sticky=(tk.W, tk.E, tk.N, tk.S), pady=5, padx=5) self.variable_listbox.bind('<<ListboxSelect>>', self.on_variable_select) scrollbar = ttk.Scrollbar(left_frame, orient="vertical", command=self.variable_listbox.yview) scrollbar.grid(row=1, column=1, sticky=(tk.N, tk.S)) self.variable_listbox.config(yscrollcommand=scrollbar.set) # Right panel - variable editor right_frame = ttk.LabelFrame(main_frame, text="Edit Variable", width=400) right_frame.grid(row=0, column=1, sticky=(tk.W, tk.E, tk.N, tk.S), padx=5) ttk.Label(right_frame, text="Variable Name:").grid(row=0, column=0, sticky=tk.W, pady=5) self.var_name_label = ttk.Label(right_frame, text="") self.var_name_label.grid(row=0, column=1, sticky=tk.W, pady=5) ttk.Label(right_frame, text="Type:").grid(row=1, column=0, sticky=tk.W, pady=5) self.var_type_label = ttk.Label(right_frame, text="") self.var_type_label.grid(row=1, column=1, sticky=tk.W, pady=5) ttk.Label(right_frame, text="Value:").grid(row=2, column=0, sticky=tk.W, pady=5) self.value_entry = tk.Text(right_frame, height=10, width=40) self.value_entry.grid(row=2, column=1, pady=5, padx=5) ttk.Button(right_frame, text="Update Value", command=self.update_variable).grid(row=3, column=1, pady=10) # Status bar self.status_var = tk.StringVar() self.status_var.set("Ready") status_bar = ttk.Label(self.root, textvariable=self.status_var, relief=tk.SUNKEN, anchor=tk.W) status_bar.grid(row=1, column=0, sticky=(tk.W, tk.E)) # Configure grid weights self.root.columnconfigure(0, weight=1) self.root.rowconfigure(0, weight=1) main_frame.columnconfigure(0, weight=1) main_frame.columnconfigure(1, weight=2) main_frame.rowconfigure(0, weight=1) left_frame.columnconfigure(0, weight=1) left_frame.rowconfigure(1, weight=1) self.all_variables = {} def open_save(self): filepath = filedialog.askopenfilename( title="Select Ren'Py Save File", filetypes=[("Ren'Py Saves", "*.save"), ("All Files", "*.*")] ) if not filepath: return try: self.current_save = filepath self.load_save_data() self.display_variables() self.status_var.set(f"Loaded: os.path.basename(filepath)") except Exception as e: messagebox.showerror("Error", f"Failed to load save: str(e)") self.status_var.set("Error loading save")

def extract_variables(self): """Extract game variables from save data""" self.all_variables = {} if isinstance(self.save_data, dict): # Common Ren'Py save structure if 'variables' in self.save_data: variables_dict = self.save_data['variables'] else: variables_dict = self.save_data # Filter and categorize variables for key, value in variables_dict.items(): # Skip internal Ren'Py variables if key.startswith(('_', 'renpy', 'config')): continue var_type = type(value).__name__ self.all_variables[key] = 'value': value, 'type': var_type renpy save editor

# Convert value to appropriate type val = sys.argv[3] if val.isdigit(): val = int(val) elif val.lower() == 'true': val = True elif val.lower() == 'false': val = False menu=file_menu) file_menu.add_command(label="Open Save"

print(f"✓ Updated variable = new_value") if == " main ": if len(sys.argv) != 4: print("Usage: python quick_edit.py savefile variable value") sys.exit(1) self.filter_variables) search_entry = ttk.Entry(left_frame

def save_changes(self): if not self.current_save: messagebox.showwarning("Warning", "No save file loaded") return try: # Reconstruct save data if isinstance(self.save_data, dict): if 'variables' in self.save_data: # Update variables in original structure for var_name, var_info in self.all_variables.items(): self.save_data['variables'][var_name] = var_info['value'] else: # Direct variable storage for var_name, var_info in self.all_variables.items(): self.save_data[var_name] = var_info['value'] # Save back to file backup_path = self.current_save + ".backup" import shutil shutil.copy2(self.current_save, backup_path) # Write new save file with open(self.current_save, 'wb') as f: # Write header (preserve original if possible) f.write(b'RENPYSAVE') # Compress and write data compressed = zlib.compress(json.dumps(self.save_data).encode()) f.write(compressed) self.status_var.set(f"Saved changes (backup: backup_path)") messagebox.showinfo("Success", "Save file updated successfully!") except Exception as e: messagebox.showerror("Error", f"Failed to save: str(e)") def command_line_editor(): """Command-line version for quick edits""" import sys

def display_variables(self): self.variable_listbox.delete(0, tk.END) for var_name in sorted(self.all_variables.keys()): self.variable_listbox.insert(tk.END, var_name)