Skip to content

Handle source-protected AOIs - #69

Draft
santiagolgzz wants to merge 5 commits into
hutcheb:mainfrom
santiagolgzz:up/protected-routines-notes
Draft

santiagolgzz wants to merge 5 commits into
hutcheb:mainfrom
santiagolgzz:up/protected-routines-notes

Conversation

@santiagolgzz

Copy link
Copy Markdown

Fixes #38. Depends on #67.

As found in #38, the routines that come out with no type are inside source-protected AOIs. Their contents are encrypted, and the converter read them as if they weren't. Besides the missing types, those AOIs got scrambled bytes as their vendor, revision and dates, plus a long list of fake local tags.

Now the converter recognises protected AOIs and keeps only what is stored readably: name, description, and routine names and types. A conversion note says what was left out. On the two of my 20 projects with protected AOIs, 68 routines get their real type and about 340 fake tags disappear.

Fallbacks that skip or guess something now record a short plain-English
note as well as logging a warning: a controller tag left out, a
produced/consumed tag exported as Base, a guessed Region Map offset, an
unrecovered Region Map rung, and a routine with no readable type exported
as RLL. The notes are available as project.conversion_notes and written as
one XML comment at the top of the L5X; a fallback that hits many objects
gets one line naming the first few and a count. With no notes, the output
is unchanged.
When no unclaimed rung fits the gap, no rung is missing and nothing was
skipped or guessed, so it is logged but no longer noted.
Source protection replaces a record's attribute block with an encrypted
envelope (marker 0x0AAA96AA where the attribute count would be). Such a
record now raises ValueError instead of being misparsed, unless the caller
passes allow_protected=True; then it parses to its readable header and
main record, with `protected` set.
Encrypted (source-protected) routines, e.g. inside a vendor's protected
Add-On Instruction, have an unreadable extended-attribute area, so parsing
failed and the routine was exported with Type="". The 60-byte main record
is intact; read the type from it (issue hutcheb#38).

Detects protection with RxGeneric.from_bytes(allow_protected=True), and
logs a warning naming the routine.
Source protection replaces an AOI record's attribute block with an
encrypted envelope (marker 0x0AAA96AA where the attribute count would
be). The revision, vendor, dates, help text and parameter usage live in
that block, so the old reader printed ciphertext as the Vendor and
listed every parameter as a local tag.

Detect the envelope and export such an AOI with only what is stored
readably: its name, its description (from the backing data type's
comments) and its routine names and types. Everything else is left out,
and one warning per AOI says so.

Detects protection with RxGeneric.from_bytes(allow_protected=True).
@santiagolgzz
santiagolgzz force-pushed the up/protected-routines-notes branch from bafc99c to be05880 Compare November 4, 2026 21:32

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant