GenWND is a software tool designed to analyze and edit WND files, which contain UI settings for the game Command & Conquer: Generals – Zero Hour. The tool allows for loading, analyzing, and displaying window (Windows) objects from a WND file in a graphical and organized manner. It was built using PyQt6 and provides an intuitive user interface for managing and understanding WND files.
The project is inspired by an existing proprietary software with the name WNDEdit, developed by deezer. The goal of GenWND is to enhance the functionality and features of the original tool, while maintaining the original purpose and design.
The project is structured as follows:
GenWND/
├── readme.md
├── logs/
│ ├── log_current.log
│ └── log_current_old.log
├── resources/
│ ├── example.wnd
│ └── styles.qss
├── src/
│ ├── error_handler.py
│ ├── file_tree.py
│ ├── log_manager.py
│ ├── main.py
│ ├── object_tree.py
│ ├── property_editor.py
│ ├── window/
│ │ ├── line_iterator.py
│ │ ├── window.py
│ │ └── wnd_parser.py
-
main.py: The main UI file. Displays the graphical interface, which is divided into three parts:
- The left section for folder management.
- The next section for navigating objects in the WND file.
- The section to display the properties of the selected object.
-
error_handler.py: Error handling. At error level 2, it allows skipping errors without stopping the process (for example, when loading a WND file, if errors are not skipped, they will stop the loading process).
-
file_tree.py: File tree management. Allows navigation between files in the folder.
-
log_manager.py: Log management. Creates a new log file and replaces the old one with
log_current_old.log
. -
object_tree.py: Creates an object tree from the WND file and displays the windows and their hierarchy.
-
property_editor.py: Window property editor. Displays and allows changes to the selected window's properties.
-
window/line_iterator.py: Allows line-by-line iteration through the WND file, including a line counter and filename.
-
window/window.py: Processes a single window structure from the WND file, creating objects with window properties (WindowProperties).
-
window/wnd_parser.py: A processing file that parses a WND file and returns an object representing the window hierarchy.
A WND file is a simple text file containing UI settings for the game. Here's an example of a WND file:
WINDOW
WINDOWTYPE = USER
NAME = "dummy"
... rest of window properties
CHILD
WINDOW ; child
WINDOWTYPE = CHECKBOX
... rest of window child properties
END
ENDALLCHILDREN
END
After parsing the file, a Python object like this would be generated:
parser = {
'file_metadata': {
'FILE_VERSION': 'num',
'LAYOUTBLOCK': {
'LAYOUTINIT': 'value',
'LAYOUTSHUTDOWN': 'value',
'LAYOUTUPDATE': 'value'
}
},
'windows': [
Window(
key=uuid1, # Random UUID for each window
properties={'OPTION1': 'value1', 'OPTION2': 'value2'},
children=[
Window(
key=uuid2,
properties={'OPTION1': 'value1', 'OPTION2': 'value2'},
children=[]
),
Window(
key=uuid3,
properties={'OPTION3': 'value3'},
children=[]
),
Window(
key=uuid4,
properties={'OPTION4': 'value4'},
children=[
Window(
key=uuid5,
properties={'OPTION5': 'value5'},
children=[]
)
]
)
]
)
]
}
- Python 3.10
- PyQt6
-
Download the code:
git clone https://github.com/DevGeniusCode/GenWND.git cd GenWND
-
Install the dependencies:
pip install -r requirements.txt
To run the software, simply execute the main.py
file:
python src/main.py
- Open the WND file via the interface.
- The software will analyze the file and display the object tree.
- You can navigate between windows and view the properties of each window.
In case of errors during the WND file parsing, GenWND uses an error-handling mechanism:
- Errors at level 2 allow the user to skip the error.
- If the error is critical, the loading process will stop.
If you would like to contribute, feel free to submit a Pull Request or open an Issue with suggestions or problems.
The project is licensed under the Mozilla Public License 2.0 (MPL-2.0) and requires contributions in a collaborative manner while adhering to the Contributor Covenant code of conduct.