diff --git a/.gitignore b/.gitignore index f6463af..4728bd4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -*roblox-version-folder -*grapejuice-prefix \ No newline at end of file +*path* +*backup* +*config* \ No newline at end of file diff --git a/README.md b/README.md index 3331d32..6007d43 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,13 @@ +**Note: This is not a FPS booster.** # Roblox Tweaker ## [Download](https://github.com/OhRetro/Roblox-Tweaker/archive/refs/heads/stable-stage.zip). -## [Download Roblox Texture Remover Legacy](https://github.com/OhRetro/Roblox-Tweaker/releases/tag/Legacy). -An easier automatic way to remove the textures from Roblox.
-It is recommended using [Roblox FPS Unlocker](https://github.com/axstin/rbxfpsunlocker/releases) made by [axstin](https://github.com/axstin).
-Version: v2.1 +An one of the automatic ways to tweak Roblox.
+I recommended using [Roblox FPS Unlocker](https://github.com/axstin/rbxfpsunlocker/releases) made by [axstin](https://github.com/axstin).
-**Note: This is not a FPS booster;** +# Roblox Tweaker C Edition + +In case of not wanting to install Python just to use Roblox Tweaker,
+You should try [Roblox Tweaker C Edition](https://github.com/OhRetro/Roblox-Tweaker-C-Edition) ![roblox_tweaker_logo (Small)](https://user-images.githubusercontent.com/70819072/132238157-9f3a0148-aced-4fb8-ab3c-bc878a0537ec.png) \ No newline at end of file diff --git a/main.py b/main.py index 2290b3f..25b167c 100644 --- a/main.py +++ b/main.py @@ -1,118 +1,218 @@ #Roblox Tweaker -_version = ["2.1", "Stable"] +VERSION = ["2.2", "Stable"] #Imports -try: - from oreto_utils import Terminal - from oreto_utils import File +from os import environ as os_environ, name as os_name +from contextlib import suppress as cl_suppress +from types import NoneType +from traceback import format_exc as tb_format_exc +from sys import argv as sys_argv -except ImportError as missing_package: - print(missing_package) - exit(1) +ONLY_WINDOWS = "--no-windows" not in sys_argv -finally: - from os import environ as os_environ, name as os_name - from tkinter import Tk, filedialog - from shutil import rmtree as sh_rmtree - from contextlib import suppress as ctxl_suppress +if ONLY_WINDOWS and os_name != "nt": + print("Roblox Tweaker was intended to be runned on Windows, Exiting...") + exit(2) + +elif not ONLY_WINDOWS: + print("Roblox Tweaker running with \"--no-windows\" flag.") + +with cl_suppress(ImportError): + from rich import print -if os_name != "nt": - print("This program was intended to be run on Windows, Exiting...") +try: + from oreto_utils.terminal_utils import title as out_title, clear as out_clear, waitinput as out_waitinput + from oreto_utils.file_utils import File as ouf_File + from oreto_utils.folder_utils import Folder as ouf_Folder, folderselect as ouf_folderselect + from oreto_utils.others_utils import countdown as ouo_countdown + +except ImportError as missing_package: + print(tb_format_exc()) + print("\n[!] Please try running \"pip install -r requirements.txt\"") exit(1) class RobloxTweaker(): def __init__(self): - Terminal.title(f"Roblox Tweaker v{_version[0]} {_version[1]}") - Terminal.clear() + out_title(f"Roblox Tweaker v{VERSION[0]} {VERSION[1]}") + out_clear() self.running = True - self.exit_code = None self._roblox_versions_path = os_environ["LocalAppData"]+"/Roblox/Versions" - self._textures_folders_path = "/PlatformContent/pc/textures" + self._textures_folders_path = "PlatformContent/pc/textures" + + self._exception_texs = ["sky", "brdfLUT.dds", "studs.dds", "wangIndex.dds"] - self._textures_folders_list = ["aluminum", "brick", "cobblestone", "concrete", "diamondplate", "fabric", "glass", "granite", "grass", - "ice", "marble", "metal", "pebble", "plastic", "rust", "sand", "slate", "water", "wood", "woodplanks"] - - self.roblox_version_file = File(file_name="roblox-version-folder", file_ext="") + self.path_file = ouf_File("path.txt") + self.path_dir = ouf_Folder("", self._roblox_versions_path) + self.backup_dir = ouf_Folder("backup") - if not self.roblox_version_file.exists(): - self.write_file() + if not self.path_file.exists(): + print("[Path File Not Found.]") + self.writepath() + out_clear() - if self.roblox_version_file.exists: - self._rvf_r = self.roblox_version_file.read() + if self.path_file.exists: + self.path = self.path_file.read() + self.path_folder = ouf_Folder("", self.path) while self.running: - self.menu() - - def menu(self): - print(f"Roblox Tweaker v{_version[0]} {_version[1]}") - print("What do you want to do?\n") - print("[D]elete Textures\n[U]pdate Roblox Version Folder Path\n[E]xit\n") - print(f"Current Roblox Version Folder Path:\n\"{self._rvf_r}\"\nType: {self.get_type()}\n") - _selected_option = input(">") - - if _selected_option in ["D", "d", "1"]: - self.delete_textures() + print(f"Roblox Tweaker v{VERSION[0]} {VERSION[1]}") + print("What do you want to do?\n") + print("[1]Delete Textures\n[2]Show Textures List\n[3]Update Roblox Version Path\n[4]Backup Textures\n[5]Restore Textures from Backup\n[0]Exit\n") + print(f"Current Roblox Version Path:\n\"{self.path}\"\nType: {self.gettype()}") + _selected_option = input(">") - elif _selected_option in ["U", "u", "2"]: - self.update_path() - - elif _selected_option in ["E", "e", "3"]: - Terminal.clear() - self.exit_code = 0 - self.running = False + if _selected_option in ["D", "d", "1"]: + self.deletetextures() + + elif _selected_option in ["S", "s", "2"]: + self.listtextures() - else: - Terminal.clear() + elif _selected_option in ["U", "u", "3"]: + self.writepath() + self.path = self.path_file.read() + self.path_folder = ouf_Folder("", self.path) + elif _selected_option in ["B", "b", "4"]: + self.backuptextures() + + elif _selected_option in ["R", "r", "5"]: + self.restoretextures() + + elif _selected_option in ["E", "e", "0"]: + out_clear() + self.running = False + + else: + out_clear() + #Delete Textures - def delete_textures(self): - for _texture_folder in self._textures_folders_list: - with ctxl_suppress(FileNotFoundError): - sh_rmtree(f"{self._rvf_r}/{self._textures_folders_path}/{_texture_folder}") + def deletetextures(self): + out_clear() + textures_path = ouf_Folder(self._textures_folders_path, self.path) + textures_list = textures_path.list() + + option = None + while option not in ["a", "all", "l", "leave"]: + print("[Delete Textures]\n") + print("Do you want to delete ALL textures or leave some untouched?\n") + option = input("[A]ll\n[L]eave (Default) (Recommended)\n\n>") or "l" + + if option.lower() in ["l", "leave"]: + textures_path.deletecontents(self._exception_texs) + + elif option.lower() in ["a", "all"]: + option = None + while option not in ["y", "yes", "n", "no"]: + out_clear() + print("Do you want to backup the textures before deleting?\n") + option = input("[Y]es (Default) (Recommended)\n[N]o\n\n>") or "y" + + if option.lower() in ["y", "yes"]: + self.backuptextures() + out_clear() + + ouo_countdown(3, "Deleting Textures in ", "Deleting Textures...") - Terminal.clear() - print("[Textures Deleted.]\n") + textures_path.deletecontents() + + out_clear() + + if len(textures_list) <= len(self._exception_texs): + print("[There's nothing to delete.]\n") + else: + print("[Textures Deleted.]\n") + + #List Textures + def listtextures(self): + out_clear() + textures_path = ouf_Folder(self._textures_folders_path, self.path) + try: + textures_list = textures_path.list() + success = True + except FileNotFoundError: + print("Unable to detemine type, path is inexistent, Try updating the path.") + success = False + + if success: + print("[Textures List]") + for texture in textures_list: + print(texture) + print("") + + out_waitinput() + out_clear() + + #Backup Textures + def backuptextures(self): + out_clear() + textures_path = ouf_Folder(self._textures_folders_path, self.path) - #Update Roblox Version Folder Path - def update_path(self): - _updated = self.write_file() - self._rvf_r = self.roblox_version_file.read() - Terminal.clear() + if not self.backup_dir.exists(): + self.backup_dir.create() + + print("[Copying contents to the backup directory]") + if self.backup_dir.list(): + + print("[Overwriting backup directory]") + self.backup_dir.deletecontents() + + textures_path.copycontents(self.backup_dir._folder["FULL_PATH"]) - if _updated: - print("[Updated]\n") + print("[Done]\n") + + #Restore Textures from Backup + def restoretextures(self): + out_clear() + + textures_path = ouf_Folder(self._textures_folders_path, self.path) + + if self.backup_dir.exists(): + if self.backup_dir.list(): + print("[Restoring Textures]") + textures_path.deletecontents() + self.backup_dir.copycontents(textures_path._folder["FULL_PATH"]) + print("[Done]\n") + + else: + print("[There's nothing to restore.]\n") + else: - print("[Operation Canceled]\n") - - #Select Directory - def select_directory(self, title, initialdir): - dialog = Tk() - dialog.withdraw() - - return filedialog.askdirectory(title=title, initialdir=initialdir, parent=dialog) - + print("[There's nothing to restore.]\n") + + out_waitinput() + out_clear() + #Write File - def write_file(self): - self.roblox_version_path = self.select_directory("Select a Roblox Version Folder.", self._roblox_versions_path) + def writepath(self): + while True: + roblox_version_path = ouf_folderselect("Select a Roblox Version", self._roblox_versions_path, True) + + if type(roblox_version_path) != NoneType and roblox_version_path.split("/")[-1].startswith("version-"): + break + + self.path_file.write(roblox_version_path) + out_clear() + print("[Path File Written.]\n") - if self.roblox_version_path == "": - return False - - self.roblox_version_file.write(self.roblox_version_path) - return True - #Get which Roblox Type is currently selected - def get_type(self): - rop = File(file_name="RobloxPlayerBeta", file_ext=".exe", file_path=f"{self._rvf_r}") - ros = File(file_name="RobloxStudioBeta", file_ext=".exe", file_path=f"{self._rvf_r}") + def gettype(self): + roblox_exes = ["RobloxPlayerBeta.exe", "RobloxStudioBeta.exe"] + try: + roblox_version_path = ouf_Folder("", self.path).list() + + except FileNotFoundError: + return "Unable to detemine type, path is inexistent, Try updating the path." - if rop.exists(): + if roblox_exes[0] in roblox_version_path: return "Roblox Player" - elif ros.exists(): + + elif roblox_exes[1] in roblox_version_path: return "Roblox Studio" - + + else: + return "Unknown" + if __name__ == "__main__": - _rt = RobloxTweaker() - exit(_rt.exit_code) + RobloxTweaker() diff --git a/requirements.txt b/requirements.txt index 2b7d6c8..da1ea2f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -oreto-utils>=0.5 \ No newline at end of file +oreto-utils==0.9 \ No newline at end of file