Implement Wiimm's SZS Tools Into the Script Language #7

Open
opened 2024-08-27 13:06:55 +02:00 by faraphel · 1 comment
Owner

Wiimm's SZS Tools in the Script Language

The script language shall be able to modify games files for Wii games since its main purpose is to mod Mario Kart Wii.
Most of the files to patch are szs files, which are archive equivalent to the more commons zip files, bmg files, which hold texts and translations for the games, tpl files, which hold the images and textures of the game, and some others tools that allow for patching the binary files of the games to install LE-CODE, allowing for the support of more tracks.

In the original MKWF-Install project, theses tools were called thanks to the python subprocess module, running theses tools with system calls to their executable form, alongside threads to parallelize many conversions (especially wbz files to szs files).
This process was nevertheless incredibly heavy because of all the system calls to the OS to loading and opening the executable files, initializing the tools, process the command line and finally process the data while displaying information in the standard output.

Theses functionalities will then be implemented by modifying the source of the original tools to turn them into libraries that will be loaded only once by the project, leaving only the essentials conversions by removing all the systems calls.

Note that this library shall NOT be modified directly to allow forward compatibility with newer version of the tools, but instead wrap it and only use the original objects defined in the source.

# Wiimm's SZS Tools in the Script Language The script language shall be able to modify games files for Wii games since its main purpose is to mod Mario Kart Wii. Most of the files to patch are `szs` files, which are archive equivalent to the more commons `zip` files, `bmg` files, which hold texts and translations for the games, `tpl` files, which hold the images and textures of the game, and some others tools that allow for patching the binary files of the games to install LE-CODE, allowing for the support of more tracks. In the original MKWF-Install project, theses tools were called thanks to the python `subprocess` module, running theses tools with system calls to their executable form, alongside threads to parallelize many conversions (especially wbz files to szs files). This process was nevertheless incredibly heavy because of all the system calls to the OS to loading and opening the executable files, initializing the tools, process the command line and finally process the data while displaying information in the standard output. Theses functionalities will then be implemented by modifying the source of the original tools to turn them into libraries that will be loaded only once by the project, leaving only the essentials conversions by removing all the systems calls. Note that this library shall NOT be modified directly to allow forward compatibility with newer version of the tools, but instead wrap it and only use the original objects defined in the source.
faraphel added this to the Atlas-Launcher project 2024-08-27 13:06:55 +02:00
faraphel added the
enhancement
label 2024-08-27 13:07:02 +02:00
faraphel added a new dependency 2024-08-27 13:07:29 +02:00
faraphel self-assigned this 2024-08-27 13:48:05 +02:00
faraphel added a new dependency 2024-08-27 13:48:43 +02:00
Author
Owner

Spotting

After some research in the source code of this tools, some functions seem interesting to expose in our new library.

SZS

An SZS file is represented with the szs_file_t structure. It can be manipulated with theses functions :

  • LoadSZS -> load an SZS file from disk

  • SaveSZS -> save an SZS file from memory

  • CopySZS -> copy an SZS file in memory

  • ExtractSZS -> extract an SZS file

  • CreateSZS -> create a new SZS from a directory on disk

  • FindFileSZS -> create a new iterator through SZS subfile

  • FindSubFileSZS -> search through an SZS iterator

  • InsertSubfileSZS -> insert a new subfile in the SZS file

  • AppendSubfileSZS -> apprend a new subfile in the SZS file

  • PrintFileSZS -> print an SZS iterator (?)

  • IterateFilesSZS -> iterate through an SZS iterator (?)

Image

Source : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-image.h

An image file is represented with the Image_t structure. It can be manipulated with theses functions :

  • LoadIMG : Load an image from disk
  • SaveIMG : Save an image to disk
  • SaveTPL : Save a TPL image to disk

BMG

Source (BMG) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/dclib/lib-bmg.h
Source (XBMG) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-xbmg.h

A bmg file is represented with the bmg_t structure. It can be manipulated with theses functions :

  • FindItemBMG

  • FindAnyItemBMG

  • InsertItemBMG

  • DeleteItemBMG

  • LoadBMG

  • SaveTextBMG

  • SaveRawFileBMG

  • LoadXBMG

  • SaveRawXBMG

  • SaveTextXBMG

Others

Source (StaticR, game data) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-staticr.h
Source (PAT) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-pat.h
Source (LEX, LE-CODE) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-lex.h

# Spotting After some research in the source code of this tools, some functions seem interesting to expose in our new library. ## SZS An SZS file is represented with the `szs_file_t` structure. It can be manipulated with theses functions : - `LoadSZS` -> load an SZS file from disk - `SaveSZS` -> save an SZS file from memory - `CopySZS` -> copy an SZS file in memory - `ExtractSZS` -> extract an SZS file - `CreateSZS` -> create a new SZS from a directory on disk - `FindFileSZS` -> create a new iterator through SZS subfile - `FindSubFileSZS` -> search through an SZS iterator - `InsertSubfileSZS` -> insert a new subfile in the SZS file - `AppendSubfileSZS` -> apprend a new subfile in the SZS file - `PrintFileSZS` -> print an SZS iterator (?) - `IterateFilesSZS` -> iterate through an SZS iterator (?) ## Image > Source : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-image.h An image file is represented with the `Image_t` structure. It can be manipulated with theses functions : - `LoadIMG` : Load an image from disk - `SaveIMG` : Save an image to disk - `SaveTPL` : Save a TPL image to disk ## BMG > Source (BMG) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/dclib/lib-bmg.h > Source (XBMG) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-xbmg.h A bmg file is represented with the `bmg_t` structure. It can be manipulated with theses functions : - `FindItemBMG` - `FindAnyItemBMG` - `InsertItemBMG` - `DeleteItemBMG` - `LoadBMG` - `SaveTextBMG` - `SaveRawFileBMG` - `LoadXBMG` - `SaveRawXBMG` - `SaveTextXBMG` ## Others > Source (StaticR, game data) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-staticr.h > Source (PAT) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-pat.h > Source (LEX, LE-CODE) : https://github.com/Wiimm/wiimms-szs-tools/blob/master/project/src/lib-lex.h
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Blocks
#2 Implement the Core}
Atlas/Atlas-Launcher
Depends on
Reference: Atlas/Atlas-Launcher#7
No description provided.