Best way to check if OS supports ARGB sprites
Michael Drake (88) 336 posts |
What’s the best way to check if the OS version supports `(os_mode)0×78608051` sprites from C? It’s a RISC OS 5.21 sprite mode word format (32bpp 8:8:8:8 AABBGGRR). |
Jeffrey Lee (213) 6048 posts |
The way I generally recommend is to use OS_ReadModeVariable to check what the kernel says: On RISC OS 3.5 and above, attempting to use OS_ReadModeVariable to read the details of an unknown or unsupported sprite type will generally result in the kernel acting as if it was given a type 6 (i.e. 32bpp) sprite mode word. By comparing the values returned by the kernel against the expected values for a given mode word, this can be used as a method of determining if the kernel/OS supports that sprite type. https://www.riscosopen.org/wiki/documentation/show/Sprite%20Mode%20Word This works because although SpriteExtend is responsible for a lot of the heavy lifting, the kernel also needs to have knowledge of all the sprite formats for the simpler things (like OS_ReadModeVariable) to work correctly. And you’re unlikely to be running a kernel which understands a sprite format which SpriteExtend can’t render (you’d have to have deliberately softloaded an older version). So for this case, you’d check that the ModeFlags are 8<<12. |
David J. Ruck (33) 1635 posts |
Would be very useful to publish some reference code for that, to avoid upteen different broken implementations. |
Michael Drake (88) 336 posts |
Thanks Jeffrey! Implemented here although I’ve only tested on a Pi400 where it’s correctly detected as supported. |