HLE: Hook Worms text render copy func.

This func takes drawn text and replaces stencil with alpha based on the
color intensity to prepare text for blending.

See #12380.
This commit is contained in:
Unknown W. Brackets 2021-01-17 12:38:03 -08:00
parent 8fe9bedb78
commit 53b9a8e48c
2 changed files with 13 additions and 0 deletions

View file

@ -1238,6 +1238,17 @@ static int Hook_motorstorm_pixel_read() {
return 0;
}
static int Hook_worms_copy_normalize_alpha() {
// At this point in the function (0x0CC), s1 is the framebuf and a2 is the size.
u32 fb_address = currentMIPS->r[MIPS_REG_S1];
u32 fb_size = currentMIPS->r[MIPS_REG_A2];
if (Memory::IsVRAMAddress(fb_address) && Memory::IsValidRange(fb_address, fb_size)) {
gpu->PerformMemoryDownload(fb_address, fb_size);
CBreakPoints::ExecMemCheck(fb_address, true, fb_size, currentMIPS->pc);
}
return 0;
}
#define JITFUNC(f) (&MIPSComp::MIPSFrontendInterface::f)
// Can either replace with C functions or functions emitted in Asm/ArmAsm.
@ -1350,6 +1361,7 @@ static const ReplacementTableEntry entries[] = {
{ "starocean_clear_framebuf", &Hook_starocean_clear_framebuf_before, 0, REPFLAG_HOOKENTER, 0 },
{ "starocean_clear_framebuf", &Hook_starocean_clear_framebuf_after, 0, REPFLAG_HOOKEXIT, 0 },
{ "motorstorm_pixel_read", &Hook_motorstorm_pixel_read, 0, REPFLAG_HOOKENTER, 0 },
{ "worms_copy_normalize_alpha", &Hook_worms_copy_normalize_alpha, 0, REPFLAG_HOOKENTER, 0x0CC },
{}
};

View file

@ -325,6 +325,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0x8df2928848857e97, 164, "strcat", },
{ 0x8e48cabd529ca6b5, 52, "vector_multiply_t", },
{ 0x8e97dcb03fbaba5c, 104, "vmmul_q_transp", },
{ 0x8ecf804bbe7922e5, 572, "worms_copy_normalize_alpha" }, // Worms Battle Islands (US)
{ 0x8ee81b03d2eef1e7, 28, "vmul_t", },
{ 0x8f09fb8693c3c49d, 992, "kirameki_school_life_download_frame", }, // Hentai Ouji To Warawanai Neko
{ 0x8f19c41e8b987e18, 100, "matrix_mogrify", },