roccodev / bdat-rs Goto Github PK
View Code? Open in Web Editor NEWA library to read and write BDAT tables from all Xenoblade games
License: Apache License 2.0
A library to read and write BDAT tables from all Xenoblade games
License: Apache License 2.0
I've been experimenting with making the reading and writing code for modern bdat files more self documenting using binrw. I've linked a gist for code with binrw 0.13.3 that can read and rebuild all bdat files in Xenoblade 3 1:1 with the originals. This code doesn't include converting to and from the ModernTable
type since it looks like you're reworking that on a separate branch. It should also be doable to store enum values instead of bytes for each row and still rebuild the data correctly.
https://gist.github.com/ScanMountGoat/a406b36a8d103eed035663ec42c3b9f5
The implementation is a lot shorter, but the main advantage in my opinion is making the code easier to reason about. The basic process for reading would be to parse the bdat data into an owned Bdat
. Writing this back to the file without any changes should produce identical bytes. Converting the Bdat
to a friendlier representation like ModernTable
can be done with from_
and to_
conversion functions. Splitting the read/write logic and conversion logic also means the conversions can be tested by comparing the Bdat
structs instead of diffing binary files.
If we want the types to be an implementation detail, we could just have functions that take a reader or bytes and return Vec<ModernTable
, Vec<LegacyTable
, or an enum with both. This would avoid all the current complexity on the user side of dealing with opaque readers or slices that will probably get converted immediately to tables anyway. The bdat files are tiny, so the performance cost of parsing and converting all tables is low.
Currently, the library only supports BDATs from Xenoblade 3.
I would like to be able to run the CLI tool with cargo run -p bdat-toolset
and check all code with cargo check
. I can always cd into the toolset directory, but that creates multiple target directories.
Table structures that borrow strings from their buffer, instead of cloning them.
This will make it easier for people that don't want to compile the program from source. It looks like it should just be a matter of copying some of ci.yml to a new file with a trigger for releases.
What would be the file format for hashes? I tried a CSV with hashes, and it didn't work. I also didn't see any examples in the code.
The ability to pack tables on-the-fly without a schema file, with a syntax like:
bdat-toolset pack --table Table1=Table1.json --table Table2=Table2.json -f json -o file.bdat
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.