Oh, dear. Very well, I'll have a look at that and make some safer swap space in general for it. IDK why it was designed to share these resources at all. In fact, it seems as if it could just have locals, that exist until the function exits, but perhaps there's a reason that wasn't done, that I don't know about.
( I hadn't tracked back where else loadsxr() was used that might conflict. I did track back the palette setting functions, to ensure that it wasn't those, and then I was hit by this server nightmare. )
I can't imagine that it writing to temp_buf, as it does, is safe, either, FWIW.
TY Saffith.
P.S. Do you think that either of these could be linked to it randomly pausing or triggering things? I'll look at loadscr() tomorrow, but I can't imagine that doing anything that'd pause the game, unless somehow for a frame it invalidates some ptr and doesn't know what to do with itself, but that'd usually just crash.
If after safety-netting this, it still does it, I guess it's time for more robust debugging. Part of me wants to fix this to read cset2 values at the same time, because nothing does that properly. Nothing at all.