Replace download frame in Rezel Cross
Replace download frame in Toaru Majutsu to Kagaku no Ensemble
Another function replace in Kirameki School Life
Replace function in Hentai Ouji To Warawanai Neko
Replace function in Toradora! Portable
Update replace function for Toaru Majutsu to Kagaku no Ensemble.
Fix divide by zero in memcpy checks.

Happened in Resistance demo.
Avoid crashing when calling an invalid address.

We already have a check, let's use it properly.
Remove incorrect atrac decode ptr nullcheck.

Already shown in decode test to be valid.
Skip samples in the first chunk of atrac output.

This seems to be what the PSP actually does, although not sure.  The first
result is always smaller by this amount (numerous atrac files tested.)
Correct the dataOff member of atrac context.
Add breakpoints to most sceAtrac mem access.
Fix seeking in atrac after the start.

Not sure the very start is right though, arg.
Return the correct next sample at the beginning.
Clamp the final sample count during decode.

Some games depend on / expect this, or else they'll let important data get
overwritten.
Add extra frames if we run out of atrac data.

We could probably insert frames instead for GHA phase shifting, but this
will solve other bugs too, I think.
Correct the end from sceAtracGetSoundSample().

I think it's meant to be the last *valid* sample.
gles: Avoid pow(<= 0, 0) entirely, undefined.

Should work on more driver versions.  Fixes #6941.
d3d9: Emulate some logic ops with blending.

This makes Brave Story's intro visible.  Also add for GLES2/GLES3, but
doesn't seem to work on GLES2.
Simplify the viewport code a bit.