| ▲ | zahlman 2 days ago | |
I did J2ME development in the 64KB JAR era. I can still remember setting up palette swapping (inspired by retro consoles, but still a common contemporary idea e.g. on GBA) by loading the byte data of PNG resources into an array and locating and replacing the PLTE chunk before handing it off to the MIDP image loader. Always wondered if anyone else had picked up the trick. I can also remember people suggesting on Nokia in particular to just store raw bitmaps (since they'd be compressed in the JAR anyway) with their API and that this was saving tons of space for some people... later I found out that one of these reports came from someone who had started out with individual image files for 12x12 tiles that had a full 256-entry PLTE (i.e., more colour entries than pixels). I also remember a device-specific bug where doing something like `x[y+1]`, where `y` was a static byte set to -1, would produce an `IndexOutOfBoundsError` claiming the index used was -256. I assume this was some threading issue in the Java implementation, where the value would be loaded into a register and then the sign-extension would somehow affect the register after the increment. I only ever reproduced it with static class members, I think (but it did also happen with shorts). | ||