TPC TXI Parsing UTC list ordering Fixes#342
Open
vrifftech wants to merge 2 commits into
Open
Conversation
Contributor
|
Message that will be displayed on users' first pull request |
Contributor
|
Thank you so much for putting effort into this @vrifftech I look forward to looking at the changes soon. Thank you for doing your utmost to adhere to the overly meticulous pr template :D |
bodencrouch
reviewed
Jul 6, 2026
| try: | ||
| Tpc.from_bytes(data) | ||
| except kaitaistruct.KaitaiStructError: | ||
| except (kaitaistruct.KaitaiStructError, UnicodeDecodeError, OSError, ValueError): |
Contributor
There was a problem hiding this comment.
huh i'm glad you realized i needed the other exception checks as i'm sure i had them somewhere else in the codebase. I guess they never made it in after the Kaitai expansion fell in. I'm so interested if you ran into UnicodeDecodeError through guess-and-check or if you pulled from the previous exception gate though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Fixes two PyKotor resource handling issues:
Preserves original GFF list ordering when editing UTC feat and force power lists.
Previously, removing one existing feat and adding a new feat could append the new feat to the end of
FeatList, shifting later entries and causing TSLPatcher diff output to rewrite many unrelated list items. The updated behavior fills removed original list slots with newly added values before appending extras, producing minimal diffs for order-sensitive GFF lists.Improves embedded TXI parsing and roundtripping for TPC files.
Some valid animated/cycle TPCs contain embedded TXI data after the packed image payload. The parser could miss or misinterpret this TXI data, especially for textures using
proceduretype cycle,numx, andnumy. The updated parser detects embedded TXI data more robustly, strips null terminators, and preserves original TXI text during roundtrip unless parsed TXI features are changed.This fixes cases where tools using PyKotor could generate noisy or incompatible TSLPatcher instructions, and cases where embedded TXI metadata in valid TPC textures was not parsed correctly.
Type of Change
Package(s) Affected
Tools/Changes Made
proceduretype cyclenumxnumyfpsblending additiveTesting
Test Results