rust-console / gba

A crate that helps you make GBA games
https://docs.rs/gba
Apache License 2.0
658 stars 50 forks source link

Allow `gba` to be used in hosted environments #193

Closed zesterer closed 6 months ago

zesterer commented 7 months ago

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.

Lokathor commented 7 months ago

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?

zesterer commented 7 months ago

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.

Lokathor commented 7 months ago

In https://github.com/rust-console/gba/commit/5fe972a3a00254bf5aab6e3f5a07a8b18046b330 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.

zesterer commented 7 months ago

Thanks, I'll give that a try tonight!

zesterer commented 6 months ago

It works great. Two comments that are tangentially related:

Lokathor commented 6 months ago

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