Skip to content

Add int/float widening from 32 to 64 bits for rbx_binary #305

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

Merged
merged 4 commits into from
Jun 30, 2023

Conversation

ThatTimothy
Copy link
Contributor

This PR supports widening ints & floats from 32 bits to 64 bits.

Basically, if we deserialize a property we expect to be 64 bits and it's actually 32 bits, we can safely convert over.

This fixes issues where Roblox previously had values serialized as 32 bits, but then they got upgraded to 64 bits later on. This only really occurs in older files, but it's a good blanket fix to have regardless.

There might be a better solution with migrations but I'm not as familiar with that; we can always remove this change if that gets figured out. I don't think this will break anything, unless Roblox goes from 64 back to 32 for a value and rbx_dom doesn't update in time, though that doesn't seem very likely. It's more likely that this will automatically migrate a value if Roblox changes something from 32 bits to 64.

This fixes #301, and rbx_xml's fix is tracked in #303.

Let me know if there's anything else I need to change! I wanted to make a test for this, but I couldn't figure out how to get a binary file in the wrong format other than my repo file, and it looks like the file resolutions paths are broken on my cursed Cygwin setup, so I couldn't run any tests. Hopefully this is good!

This change allows us to accept a Int32 even when
the canonical type is Int64, and automatically
migrate it over. This would fix rojo-rbx#301.
This change allows us to accept a Float32 even
when we expect a Float64, seamlessly migrating it
over.

See rojo-rbx#301.
Copy link
Member

@Dekkonot Dekkonot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries on the lack of testing, since this is such a simple change. Thanks for the contribution!

@Dekkonot Dekkonot merged commit 1dffd05 into rojo-rbx:master Jun 30, 2023
@ThatTimothy ThatTimothy deleted the int-32-to-int-64-patch branch June 30, 2023 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Type mismatch: Property IntValue.Value should be Int32, but it was Int64
2 participants