Skip to content

Support for null pointers #2

@BioTomateDE

Description

@BioTomateDE

Null pointers in pointer lists (or in general) are not yet supported and cause a hard error.
If every pointer list element could be null, all of the corresponding Vecs would have to be Vec<Option<SomeElement>>.
This is very annoying to handle and would make LibGM's interface lowkey bad, since nullables don't directly exist in Rust and are kind of painful with Options constantly.

In order to support null pointers, I need to find out which elements can actually be nulled out.
I also need to know which elements are referenced by ID/Index.
Elements who are never referenced by index are easy to handle: just skip null elements.

I have some ideas for "live patching" which would keep track of how many null pointers are skipped for each list and then shift all GMRefs to those element types globally to correct the indices (since elements were skipped). This would allow for clean Vec<SomeElement> interfaces.

If you know anything about this or have some ideas, please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions