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
OPS savefiles (palette key) break BSON specification, preventing interoperability #941
Comments
why didn't you open a pull request? |
I'm not sure how to version this correctly in this codebase, it's a breaking change |
This has been known for a long time and we've decided that because there's nothing we need to be interoperable with, it's a non-issue. As a fix of the bureaucratic variety, we would accept a PR that renames BSON.cpp/h to PowderON.cpp/h. |
I mean I'm working on a simulator that takes in OPS savefiles in Rust, so that's one thing that it's a problem for lol |
Welcome to tech, where technical debt is cumulative and mistakes made 10 years ago affect you today :) |
To be clear, I'm being depressing about this for more than just the fun of it. I see no economic way to fix this. We do try to maintain compatibility with old clients at least to the point of having them be able to render a partial thumbnail of new saves, and fixing this problem would make that impossible. In light of the interoperability requirements we have that I explained above (none), this would not be economical. |
I manage to parse it in python, because the library I use doesn't care about all the keys I don't use. If you don't fetch palette info, are you able to parse the save data? |
Changing this to use BSON_OBJECT should still be reasonably backwards compatible. Palette data is optional-ish as the game will fall back to the compiled element map and should still be able to render thumbnails most of the time. |
Hi,
In GameSave.cpp#2481-2486
bson_append_start_array
is used, and thenbson_append_int
is called with a key of(*iter).first.c_str()
.bson_append_start_array
uses the typeBSON_ARRAY
, which according to the BSON 1.1 specification must follow this format:This means that the savefiles contain invalid BSON - this breaks other parsers, such as bson-rust - it just so happens to be accepted by the particular bson.cpp the powder toy uses and thus isn't noticed.
To fix this,
bson_append_start_object
should be called instead.and accordingly, loading should instead check for
BSON_OBJECT
.The text was updated successfully, but these errors were encountered: