TAAFT
Free mode
100% free
Freemium
Free Trial
Create tool
  • Fix My Code
    Your AI software engineer: Clean, fix, and optimize code.
    Open
    1,135
    242
    1.0
    392
    Released 3mo ago
    100% Free
    ```python # trainer_emulator.py import sys import os from PySide6.QtWidgets import ( QApplication, QWidget, QVBoxLayout, QHBoxLayout, QPushButton, QLabel, QListWidget, QListWidgetItem, QLineEdit, QCheckBox, QMessageBox, QFileDialog ) from PySide6.QtCore import Qt # Supported emulators and their cheat file extensions EMULATORS = { "PCSX2": ".pnach", "Dolphin": ".gct", "DuckStation": ".pcsxr", "RetroArch": ".cht", "PPSSPP": ".db" } class Cheat: def __init__(self, name, code, enabled=False): self.name = name self.code = code self.enabled = enabled class Game: def __init__(self, name): self.name = name self.cheats = [] class TrainerApp(QWidget): def __init__(self): super().__init__() self.setWindowTitle("UCT - Universal Cheat Trainer") self.setGeometry(200, 200, 800, 600) self.games = {} self.current_emulator = None self.current_game = None self.init_ui() def init_ui(self): main_layout = QVBoxLayout() # Emulator buttons emulator_layout = QHBoxLayout() for emu in EMULATORS: btn = QPushButton(emu) btn.clicked.connect(lambda checked, e=emu: self.load_emulator(e)) emulator_layout.addWidget(btn) main_layout.addLayout(emulator_layout) # Game selection self.game_list = QListWidget() self.game_list.itemClicked.connect(self.select_game) main_layout.addWidget(QLabel("Games:")) main_layout.addWidget(self.game_list) # Cheat filter/search filter_layout = QHBoxLayout() self.search_box = QLineEdit() self.search_box.setPlaceholderText("Search cheats...") self.search_box.textChanged.connect(self.filter_cheats) filter_layout.addWidget(self.search_box) main_layout.addLayout(filter_layout) # Cheat list with checkboxes self.cheat_list = QListWidget() main_layout.addWidget(QLabel("Cheats:")) main_layout.addWidget(self.cheat_list) # Manual cheat file adder add_file_btn = QPushButton("Add Cheat File") add_file_btn.clicked.connect(self.add_cheat_file) main_layout.addWidget(add_file_btn) # Help button help_btn = QPushButton("Help") help_btn.clicked.connect(self.show_help) main_layout.addWidget(help_btn) self.setLayout(main_layout) def load_emulator(self, emulator): self.current_emulator = emulator self.game_list.clear() self.cheat_list.clear() self.games.clear() # Auto-scan cheat folder (optional) cheat_folder = QFileDialog.getExistingDirectory(self, f"Select {emulator} Cheat Folder") if not cheat_folder: return for file in os.listdir(cheat_folder): if file.endswith(EMULATORS[emulator]): game_name = os.path.splitext(file)[0] game = Game(game_name) try: with open(os.path.join(cheat_folder, file), "r") as f: for line in f: line = line.strip() if line: cheat = Cheat(line, line) game.cheats.append(cheat) except Exception as e: QMessageBox.warning(self, "Error", f"Failed to load {file}:\n{str(e)}") self.games[game_name] = game self.game_list.addItem(game_name) def select_game(self, item): game_name = item.text() self.current_game = self.games.get(game_name) self.update_cheat_list() def update_cheat_list(self): self.cheat_list.clear() if not self.current_game: return for cheat in self.current_game.cheats: item = QListWidgetItem(cheat.name) item.setFlags(item.flags() | Qt.ItemIsUserCheckable) item.setCheckState(Qt.Checked if cheat.enabled else Qt.Unchecked) self.cheat_list.addItem(item) self.cheat_list.itemChanged.connect(self.toggle_cheat) def toggle_cheat(self, item): if not self.current_game: return cheat_name = item.text() for cheat in self.current_game.cheats: if cheat.name == cheat_name: cheat.enabled = item.checkState() == Qt.Checked break def filter_cheats(self): if not self.current_game: return search_text = self.search_box.text().lower() for i in range(self.cheat_list.count()): item = self.cheat_list.item(i) item.setHidden(search_text not in item.text().lower()) def add_cheat_file(self): file_path, _ = QFileDialog.getOpenFileName(self, "Select Cheat File") if not file_path: return try: game_name = os.path.splitext(os.path.basename(file_path))[0] game = Game(game_name) with open(file_path, "r") as f: for line in f: line = line.strip() if line: cheat = Cheat(line, line) game.cheats.append(cheat) self.games[game_name] = game self.game_list.addItem(game_name) except Exception as e: QMessageBox.warning(self, "Error", f"Failed to load file:\n{str(e)}") def show_help(self): QMessageBox.information( self, "Help", "1. Select an emulator.\n" "2. Choose the cheat folder or add a cheat file manually.\n" "3. Select a game to view cheats.\n" "4. Toggle cheats on/off using the checkboxes.\n" "5. Use the search box to filter cheats.\n" "Note: Memory injection is not implemented in this prototype." ) if __name__ == "__main__": app = QApplication(sys.argv) trainer = TrainerApp() trainer.show() sys.exit(app.exec()) ```

Other tools

Post
0 AIs selected
Clear selection
#
Name
Task