SpriteExtend bug for sprite Append?
Martin Avison (27) 1494 posts |
Has anyone else found a problem with OS_SpriteOp,35 (Append) which I think is provided by SpriteExtend ? I have an example of a small program to Append two sprites, which works fine if the sprites do not have masks, but creates a corrupted sprite area/file if they do have masks. I have tried this on the following RO versions, with SpriteExtend version… Or it could be a silly error in my test program…
If the verify after is uncommented, it fails with Unrecognised Sprite Data. The test sprites are 8×8, no palette, Mode 20, containing a red offset +. The nomask sprite has no mask and a grey background, and mask is all red but masked where the grey was. The Dump of the Sprites2 file shows the problem: The Append creates a mask that is twice as large as it should be, and so the pointer to the next sprite is &40 more than it should be, and this is included in the saved sprite file. If the rubbish is removed from the file, and the newmask next offset corrected, the sprite file is usable and looks correct. Can anyone confirm my findings, or say what I am doing wrong?! Dump of Sprites2 File
|
Sprow (202) 1158 posts |
I can’t see anything you’re doing wrong, so it must be SpriteExtend. |
Martin Avison (27) 1494 posts |
Thanks Sprow for the confirmation I was not going mad! After an afternoon spent investigating, I think I now know what is wrong… In Tungsten.mixed.RiscOS.Sources.Video.Render.SprExtend.Sources.SprExtend, after label Go_AppendSprite and just before label chunterblock there are lines (all with comment ; merged from 0.62 (GPS))…
I believe that the cause of the problem is that if (when) the chunterblock routine is called, and returns without Z set (as it does!) the routime maskchunterblock is also called … but this is only for new format masks. Looks to me like a classic case of depending on BL preserving flags! I also suspect the second DebugIf EQ should be NE? For my test case, changing the BLNE maskchunterblock to NOP resolves my problem, but obviously it needs fixing properly. Can someone with the ability to change the source verify my diagnosis, and fix this please? Thanks |
Sprow (202) 1158 posts |
Interesting find! Seems to be broken in RISC OS 3.60 too, so this is a bug trapped in amber. |
Martin Avison (27) 1494 posts |
v4.39 and v6.10 also have the problem! If I get chance I will see if I can check if the return from chunterblock restored flags or not. |
Sprow (202) 1158 posts |
I’ve checked in a change (two places doing the same thing), and used your BASIC program to append all 16 combinations of old/new/mask/no mask/H/V successfully. |
Martin Avison (27) 1494 posts |
Brilliant! The old bugs are the best ones to squash. Thanks. Is there any way I can get the new module? (without running 5.19, that is – I still softloading 5.18 until I have finished other testing). |