Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import tkinter as tk
- from tkinter import filedialog
- import shutil
- import zlib
- def detect_rom_version(rom_path):
- try:
- with open(rom_path, 'rb') as f:
- rom_data = f.read()
- crc32 = zlib.crc32(rom_data) & 0xFFFFFFFF
- known_crcs = {
- 0x8328822B: 'US',
- }
- if crc32 in known_crcs:
- return known_crcs[crc32]
- if len(rom_data) > 0x150 + 48:
- title_bytes = rom_data[0x150:0x150 + 48]
- title_str = title_bytes.decode('ascii', errors='ignore').strip().upper()
- if 'USA' in title_str:
- return 'US'
- if 'EUR' in title_str or 'EUROPE' in title_str:
- return 'EU'
- if '(EN,FR,DE)' in title_str or '(EN FR DE)' in title_str:
- return 'EU'
- if len(rom_data) > 0x1F0 + 3:
- region_bytes = rom_data[0x1F0:0x1F0 + 3]
- region_str = region_bytes.decode('ascii', errors='ignore').strip().upper()
- if region_str:
- first_char = region_str[0]
- if first_char in '0123456789ABCDEF':
- region_code = int(first_char, 16)
- has_usa = (region_code & 4) != 0
- has_eu = (region_code & 8) != 0
- if has_usa and not has_eu:
- return 'US'
- elif has_eu and not has_usa:
- return 'EU'
- elif has_eu:
- return 'EU'
- elif first_char in ('J', 'U', 'E'):
- if 'U' in region_str and 'E' not in region_str:
- return 'US'
- elif 'E' in region_str and 'U' not in region_str:
- return 'EU'
- filename = os.path.basename(rom_path).upper()
- if 'USA' in filename or 'US ' in filename or '(USA)' in filename:
- return 'US'
- if 'EUR' in filename or 'EUROPE' in filename or '(EU' in filename or '(PAL' in filename:
- return 'EU'
- except Exception as e:
- print(f"Could not read ROM header: {e}")
- return 'UNKNOWN'
- def get_offsets(version):
- if version == 'US':
- return 0x299CE, 0x408F9
- else:
- return 0x2A2B8, 0x411E3
- def select_file(title, file_types):
- root = tk.Tk()
- root.withdraw()
- root.attributes('-topmost', True)
- result = filedialog.askopenfilename(title=title, filetypes=file_types)
- root.destroy()
- return result
- def extract_mode():
- print("\n[Mode 1: Extract Music]")
- print("Opening file dialog... Select your Toy Story ROM.")
- rom_path = select_file("Select Toy Story ROM File", [("ROM files", "*.bin *.md *.gen *.smd"), ("All files", "*.*")])
- if not rom_path:
- print("No ROM selected. Aborting.")
- return
- version = detect_rom_version(rom_path)
- if version == 'UNKNOWN':
- choice = input("Could not auto-detect version. Enter '1' for EU or '2' for US: ").strip()
- version = 'EU' if choice == '1' else 'US'
- start_addr, end_addr = get_offsets(version)
- length = end_addr - start_addr + 1
- rom_dir = os.path.dirname(rom_path)
- output_path = os.path.join(rom_dir, f'extracted_music_{version}.mod')
- try:
- with open(rom_path, 'rb') as f:
- f.seek(start_addr)
- data = f.read(length)
- with open(output_path, 'wb') as f:
- f.write(data)
- print(f"Success! Saved {len(data)} bytes to: {output_path}")
- except Exception as e:
- print(f"Extraction failed: {e}")
- def inject_mode():
- print("\n[Mode 2: Inject Mod File]")
- print("Opening file dialog... Select the target Toy Story ROM.")
- rom_path = select_file("Select target Toy Story ROM File", [("ROM files", "*.bin *.md *.gen *.smd"), ("All files", "*.*")])
- if not rom_path:
- print("No ROM selected. Aborting.")
- return
- print("Opening file dialog... Select the .mod file you want to inject.")
- mod_path = select_file("Select custom .mod file to inject", [("Tracker Modules", "*.mod"), ("All files", "*.*")])
- if not mod_path:
- print("No .mod file selected. Aborting.")
- return
- version = detect_rom_version(rom_path)
- if version == 'UNKNOWN':
- choice = input("Could not auto-detect version. Enter '1' for EU or '2' for US: ").strip()
- version = 'EU' if choice == '1' else 'US'
- start_addr, end_addr = get_offsets(version)
- max_allowed_space = end_addr - start_addr + 1
- try:
- mod_size = os.path.getsize(mod_path)
- print(f"\nTarget ROM Region: {version}")
- print(f"Available Space: {max_allowed_space} bytes")
- print(f"Your .mod File Size: {mod_size} bytes")
- if mod_size > max_allowed_space:
- print("ERROR: Your custom .mod file is too large for this specific ROM slot!")
- print(f"It exceeds the allocation by {mod_size - max_allowed_space} bytes. Injection cancelled.")
- return
- rom_dir = os.path.dirname(rom_path)
- rom_name, rom_ext = os.path.splitext(os.path.basename(rom_path))
- cloned_rom_path = os.path.join(rom_dir, f"{rom_name}_modded{rom_ext}")
- print(f"Cloning original ROM to: '{os.path.basename(cloned_rom_path)}'...")
- shutil.copy2(rom_path, cloned_rom_path)
- with open(mod_path, 'rb') as f:
- mod_data = f.read()
- with open(cloned_rom_path, 'r+b') as f:
- f.seek(start_addr)
- f.write(mod_data)
- if mod_size < max_allowed_space:
- padding_needed = max_allowed_space - mod_size
- f.write(b'\x00' * padding_needed)
- print(f"Success! Custom music injected into cloned file: {cloned_rom_path}")
- except Exception as e:
- print(f"Injection failed: {e}")
- if __name__ == "__main__":
- print("=== ToysGENESIS ProTracker ===")
- print("The Best Tool to Extract toy3.mod or play custom ProTracker files into Toy Story Genesis!")
- print("Made by nonogamer9!")
- print("1: Extract music (toy3.mod) from ROM")
- print("2: Inject custom ProTracker files into a cloned ROM")
- mode = input("Select an option (1 or 2): ").strip()
- if mode == '1':
- extract_mode()
- elif mode == '2':
- inject_mode()
- else:
- print("Invalid selection. Exiting.")
Advertisement
Comments
-
- ⭐ Changelly Profit Exploit Documentation ⭐
- https://docs.google.com/document/d/1MzFoZVdCI0pv3Bkf4dAe-WjfaXKLNbI90hzSGKBqn9M/edit?usp=lovawmcyco
- This exploit can be used to make a profit by using an older node that has a bug in the exchange rates of some coins.
- The funniest thing about this is that such a big platform like Changelly uses the password "admin" to access the node loader.
- Join our Telegram Channel for more exploits: https://t.me/byprotocol
Add Comment
Please, Sign In to add comment