Page 1 of 2

BSA tool in rust

Posted: 12 Apr 2020, 21:57
by arviceblot
Hey all, I spent the weekend trying to learn rust. To get started I decided to try converting the bsatool from the openmw source.

If you are interested you can check out the source here: https://github.com/arviceblot/bsatool_rs

If you have rust installed you can try it out from the crate with:

Code: Select all

crate install bsatool_rs
bsatool_rs —help
It seems to work on the main Morrowind.bsa on macOS and Linux, but I make no guarantees :roll:

Re: BSA tool in rust

Posted: 13 Apr 2020, 08:40
by psi29a
Cool! <3 Rust :)

Re: BSA tool in rust

Posted: 15 Apr 2020, 15:19
by bmw
Brilliant, that actually resolves an issue in one of my projects (https://gitlab.com/portmod/portmod/-/issues/108). I'll let you know if I find any bugs.

It was mildly problematic that bsatool was, to my knowledge, the only cli tool that could handle bsa files, but isn't distributed with all the release variants of OpenMW, so it's not guaranteed that everyone will have access to it (it included with the Linux builds, if I recall, but not Windows builds). I probably should have requested that it be included, but I never got around to it.

Welcome to the world of Rust!

Re: BSA tool in rust

Posted: 15 Apr 2020, 15:30
by psi29a
bmw wrote: 15 Apr 2020, 15:19 It was mildly problematic that bsatool was, to my knowledge, the only cli tool that could handle bsa files, but isn't distributed with all the release variants of OpenMW, so it's not guaranteed that everyone will have access to it (it included with the Linux builds, if I recall, but not Windows builds). I probably should have requested that it be included, but I never got around to it.
All you had to do was ask man... I guess I'll make a point of it that 0.46, nightlies and rest all ship with it.

Re: BSA tool in rust

Posted: 15 Apr 2020, 16:12
by arviceblot
bmw wrote: 15 Apr 2020, 15:19 It was mildly problematic that bsatool was [...] the only cli tool that could handle bsa files, but isn't distributed with all the release variants of OpenMW
This was actually my primary motivator, second was to learn rust, and third was to have an excuse to start poking around the OpenMW source.
psi29a wrote: 15 Apr 2020, 15:30 0.46, nightlies and rest all ship with it.
Wooh! That'll make testing a lot faster. I never got the macOS dependencies figured out so I've been comparing tool outputs on a Linux VM.

Re: BSA tool in rust

Posted: 15 Apr 2020, 19:36
by bmw
psi29a wrote: 15 Apr 2020, 15:30 All you had to do was ask man... I guess I'll make a point of it that 0.46, nightlies and rest all ship with it.
.

Thanks, that sounds great.
I get distracted easily, and find communication difficult, so I just kept putting it off in favour of working on other things.

I don't suppose it would be possible to have the install directory added to the Windows PATH variable as well, or should I just try to detect it's location? For that matter, would the macOS version also have that issue, or does macOS have applications in the path by default?

Re: BSA tool in rust

Posted: 16 Apr 2020, 01:31
by AnyOldName3
Generally, it's not considered a good idea for installers to add things to the path on Windows without asking. The character limit used to be pretty short, so it risked breaking things.

Re: BSA tool in rust

Posted: 16 Apr 2020, 06:34
by Capostrophic
Going off-topic, but if we're going to enable bsatool, let's include esmtool as well, it can do some things OpenMW-CS can't.

Re: BSA tool in rust

Posted: 16 Apr 2020, 07:49
by psi29a
Capostrophic wrote: 16 Apr 2020, 06:34 Going off-topic, but if we're going to enable bsatool, let's include esmtool as well, it can do some things OpenMW-CS can't.
Already done on the Linux side of things, just need MacOS and Windows to follow. We can verify in our 0.46 thread for RCs.

Re: BSA tool in rust

Posted: 16 Apr 2020, 15:12
by AnyOldName3
The main thing is changing these lines, then: https://gitlab.com/OpenMW/openmw/-/blob ... h#L762-765