Do you like my hacking? If so, please consider leaving something in the
Fediverse (Mastodon etc): @Sprite_tm@social. spritesmods.com
The firmware to display the graphical effects is completely written in C. It has to do two things: display the swirling textures and overlay all the particles over it.
Getting the image data for the swirling textures proved somewhat more difficult than I thought. I expected them to be among the other material textures inside a big png-file inside the Minecraft main .jar-file, but they were nowhere to be found. Only after decompiling the code with the excellent Minecraft Coder Pack, I found out that the textures are re-calculated every time you start Minecraft, using some nifty floating point algorithm.
Recreating this code in C was fairly easy. Letting the STM32 do all these
calculations on-the-fly wouldn't be feasible, though, so I decided to let my PC do
the calculations and just spit out 32 16x16 images of the swirl animation. These
could then be linked into the STM32s code and end up in it's flash memory. I also was
curious what exactly I was looking at: the 16x16 pixels making up the texture don't
give away more than that it is some kind of swirl. Now I had the code I could also
render it in a larger image size so I could take a look at that magnificent swirl
in all it's glory:
...Hokay, that's one texture that's best kept at 16x16 pixels.
With everything precalculated, it was time to move on to the STM32s code. I've written it in C and compiled it with gcc using libopenstm32 to do some of the initialisation of the STM32. All these tools and libs can be obtained by running the summon-arm-toolchain script, by the way.
The STM32 code itself isn't that difficult. Basically, it initializes it's own peripherials and the the LCD, and then proceeds to calculate and send the imagery, one line at a time, to the LCD. Every frame, the particles' position and size is adjusted to make it look like the particles are flying into the portal, and that's about it.