[JK2SP] Avoid a stack overflow in SG_WriteScreenshot.