Skip to content

ritobin round-trip loses inner type for empty containers and rewrites list[pointer] as list[none] #109

@FrogCsLoL

Description

@FrogCsLoL

Summary

Empty typed containers lose their declared inner type during ritobin round-trip.

A field written as list[pointer] = {} is parsed and then written back as list[none] = {}.

Repro

Input:

0x22fca322 = VfxSystemDefinitionData {
    complexEmitterDefinitionData: list[pointer] = {}
    particleName: string = "handbuffwvfx"
    particlePath: string = "handbuffwvfx"
    flags: u16 = 197
}

Parse it with ltk_ritobin, then write it back to ritobin text.

Actual

0x22fca322 = VfxSystemDefinitionData {
    complexEmitterDefinitionData: list[none] = {}
    particleName: string = "handbuffwvfx"
    particlePath: string = "handbuffwvfx"
    flags: u16 = 197
}

Expected

0x22fca322 = VfxSystemDefinitionData {
    complexEmitterDefinitionData: list[pointer] = {}
    particleName: string = "handbuffwvfx"
    particlePath: string = "handbuffwvfx"
    flags: u16 = 197
}

Root Cause

The parser keeps the declared inner type while reading list[pointer], but when the container is empty it ends up with an empty Vec.

At that point it calls Container::try_from(items). For an empty list, that returns EmptyContainer, and the parser falls back to default(), which produces Container::None.

That causes the writer to emit list[none].

Notes

This is not VFX-specific. It should affect any empty typed container that is round-tripped through ritobin.

Proposed Fix

Move typed empty-container construction into ltk_meta so the parser does not need to guess or fall back to Container::None.

Example API:

  • Container::empty_of_kind(kind) -> Result<Self, Error>

Then ltk_ritobin can preserve the declared inner type for empty list[...] / list2[...] values instead of defaulting to None.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions