rust-console/gba

Allow `gba` to be used in hosted environments

zesterer opened this issue · 6 comments

A lot of the assets I'm using need preprocessing. I do this preprocessing as part of my build.rs script.

I use a common crate containing type definitions used by both the (hosted) preprocessing code, and the in-game code that represent various things (textures, etc.).

Sadly, I can't make use of any of the types in gba such as Color because the crate has a lot of platform-specific code and (that I can see) no good way to turn it off.

It would be nice to see a default-enabled on-gba feature or something of the sort to allow these platform-independent types to be used in other contexts.

It's funny you should ask. I was just wanting to flex a little Rust activity and looking at doing an update to this crate as a possible activity in that area.

So, I'm guessing that you'd mostly want anything using inline assembly to be optional? Is there anything not using inline assembly that's also a problem in a hosted envrionment?

Yep, pretty much! I've not explored the crate enough to know exactly what does and doesn't fall in those respective categories. I think types that might be useful in interfaces are particularly useful though: Color, and perhaps some of the VolGrid-like types/traits.

In 5fe972a I did a very quick adjustment to gate stuff that won't build on an x86_64 machine behind an on_gba feature. Give it a quick try and if that works well enough for now I can publish a patch.

Thanks, I'll give that a try tonight!

It works great. Two comments that are tangentially related:

  • I think on_gba should be enabled by default to avoid confusion
  • It would be nice to have bytemuck support for some of the types like Fixed, Color, etc.

I was able to sit down and get most of this published in 0.11.6, but i forgot about the bytemuck support, I'll have to get to that soon