Sign in to follow this  
th3w1zard1

TOOL:Lightweight GUI Patcher

Recommended Posts

Lightweight GUI Patcher


A very simple CLI-based tool that'll take a folder of GUIs made for one resolution and patch them to work for another resolution. Please report any bugs.

Simply input the path to the GUI file (or folder of GUI files) and the output location, your desired resolution, and let it work.

GUI Resizer CLI Tool

Overview

This is a simple command-line interface (CLI) tool designed to adjust and scale GUI (Graphical User Interface) files based on different screen resolutions. The tool reads `.gui` files from the popular game Star Wars: Knights of the Old Republic and adjusts the layout to fit various resolutions and aspect ratios. It supports multiple resolutions and can handle batch processing of files.

Features

  • Multi-Resolution Support: The tool can adjust GUI files to fit several resolutions across different aspect ratios, such as 16:9, 16:10, 4:3, 5:4, 21:9, 3:2, and 1:1.
  • Batch Processing: You can process multiple GUI files at once, making it easy to adjust a whole directory of files.
  • Logging: Outputs logs to track the processing of files, including which resolutions were processed and where the output files are saved.
  • Cross-Platform: Works on Windows, Linux, and macOS with Python 3.8+.

Usage

Basic Command

To run the tool, use the following command:

python3 gui_resizer.py --input <input-path> --output <output-path> --resolution <resolution>

Parameters

--input: The path to the `.gui` file(s) you want to process. You can specify a single file or a directory containing multiple `.gui` files.
--output: The directory where the processed files will be saved.
--resolution: The target resolution(s). Use the format `WIDTHxHEIGHT` (e.g., `1920x1080`). You can also specify `ALL` to process all common resolutions.

Example

To convert all `.gui` files in the directory `input_files/` to fit a 1920x1080 resolution and save them to the `output_files/` directory, run:

python3 gui_resizer.py --input input_files/ --output output_files/ --resolution 1920x1080

Logging

If logging is enabled, a log file named `output.log` will be created in the specified output directory. This file will contain details of the processing operations performed.

How It Works

1. Input Handling: The tool takes in `.gui` files or directories containing these files and reads them using the `pykotor` library.
  
2. Resolution Scaling: The tool scales the GUI elements based on the specified target resolution(s). It calculates scale factors based on the original dimensions of the GUI and applies these factors to resize elements accordingly.

3. Output Generation: The processed GUI files are then saved to the specified output directory, organized by resolution.

 

Credit:
Cortisol for PyKotor (90% of the code)

DarthParametric for testing and brainstorming the idea


 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this