Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize Roslyn Source Generation to reduce boilerplate in (de)serialization #6

Open
PaulusParssinen opened this issue Feb 15, 2023 · 1 comment
Assignees
Labels
General Issues not specific to any particular area

Comments

@PaulusParssinen
Copy link
Owner

The Shockwave file format includes many common patterns/structures and is somewhat consistent with them. For example, arrays and some smaller common structures ones such as Point, CastMemberId and Rect are represented using common structure in binary. In addition to those, most "complex" and important one of them is internally called VList aka "Vector List". It's not actually "complex" but just annoying to write (de)serialization logic for and I have been thinking how to handle them best for few years now. VLists appear in many important resources of the file format, such as Cast member metadata (VWCF, later embedded to CASt) and Cross Cast Links (ccl ) and more.

Now heavily inspired by csnover's earthquake-rust pvec! macro (seriously, this man's a genius!), I'm planning to implement something similar to make the handling VLists significantly easier by using build time Roslyn source generation.

This issue is just a tracking issue for my design for this model which is a work in progress.

TODO: Design

Basically VLists consists of header and a offset table that points to entries in following it.

I'm also currently in process of designing a source generation process for all the Lingo bytecode instructions which will share components with this but still essentially be seperate generator.

@PaulusParssinen PaulusParssinen added the General Issues not specific to any particular area label Feb 15, 2023
@PaulusParssinen PaulusParssinen self-assigned this Feb 15, 2023
@PaulusParssinen
Copy link
Owner Author

Some source generation infrastructure is in place and currently used for Lingo instruction generation which is much simpler than generalized (de)serialization. This will essentially require developing a value type model which is constructed from Roslyn AST.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Issues not specific to any particular area
Projects
None yet
Development

No branches or pull requests

1 participant