Add a hook for Hexyz Force's "monoclome" thread.

This fixes missing graphics in some areas in GLES, due to direct framebuf
access.
This commit is contained in:
Unknown W. Brackets 2014-05-30 23:28:21 -07:00
parent 9f01c02626
commit b2dc92b942
3 changed files with 24 additions and 3 deletions

View File

@ -439,11 +439,11 @@ static int Replace_dl_write_matrix() {
}
static bool GetMIPSStaticAddress(u32 &addr, s32 lui_offset, s32 lw_offset) {
const MIPSOpcode upper = Memory::Read_Instruction(currentMIPS->pc + lui_offset);
const MIPSOpcode upper = Memory::Read_Instruction(currentMIPS->pc + lui_offset, true);
if (upper != MIPS_MAKE_LUI(MIPS_GET_RT(upper), upper & 0xffff)) {
return false;
}
const MIPSOpcode lower = Memory::Read_Instruction(currentMIPS->pc + lw_offset);
const MIPSOpcode lower = Memory::Read_Instruction(currentMIPS->pc + lw_offset, true);
if (lower != MIPS_MAKE_LW(MIPS_GET_RT(lower), MIPS_GET_RS(lower), lower & 0xffff)) {
return false;
}
@ -473,6 +473,22 @@ static int Hook_godseaterburst_blit_texture() {
return 0;
}
static int Hook_hexyzforce_monoclome_thread() {
u32 fb_info;
if (!GetMIPSStaticAddress(fb_info, -4, 0)) {
return 0;
}
const u32 fb_address = Memory::Read_U32(fb_info);
if (Memory::IsVRAMAddress(fb_address)) {
// Cheat a bit to force a download of the framebuffer.
// VRAM + 0x00400000 is simply a VRAM mirror.
gpu->PerformMemoryCopy(fb_address ^ 0x00400000, fb_address, 0x00088000);
CBreakPoints::ExecMemCheck(fb_address, true, 0x00088000, currentMIPS->pc);
}
return 0;
}
// Can either replace with C functions or functions emitted in Asm/ArmAsm.
static const ReplacementTableEntry entries[] = {
// TODO: I think some games can be helped quite a bit by implementing the
@ -513,6 +529,7 @@ static const ReplacementTableEntry entries[] = {
// { "vmmul_q_transp", &Replace_vmmul_q_transp, 0, 0},
{ "godseaterburst_blit_texture", &Hook_godseaterburst_blit_texture, 0, REPFLAG_HOOKENTER},
{ "hexyzforce_monoclome_thread", &Hook_hexyzforce_monoclome_thread, 0, REPFLAG_HOOKENTER, 0x58},
{}
};
@ -578,6 +595,8 @@ void WriteReplaceInstructions(u32 address, u64 hash, int size) {
WriteReplaceInstruction(address, index);
}
}
} else if (entry->flags & REPFLAG_HOOKENTER) {
WriteReplaceInstruction(address + entry->hookOffset, index);
} else {
WriteReplaceInstruction(address, index);
}

View File

@ -52,6 +52,7 @@ struct ReplacementTableEntry {
ReplaceFunc replaceFunc;
MIPSComp::MIPSReplaceFunc jitReplaceFunc;
int flags;
s32 hookOffset;
};
void Replacement_Init();

View File

@ -87,6 +87,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0x0654fc8adbe16ef7, 28, "vmul_q", },
{ 0x06b243c926fa6ab5, 24, "vf2in_q", },
{ 0x06e2826e02056114, 56, "wcslen", },
{ 0x073cf0b61d3b875a, 416, "hexyzforce_monoclome_thread", }, // Hexyz Force
{ 0x075fa9b234b41e9b, 32, "fmodf", },
{ 0x0a051019bdd786c3, 184, "strcasecmp", },
{ 0x0a46dc426054bb9d, 24, "vector_add_t", },
@ -149,7 +150,7 @@ static const HardHashTableEntry hardcodedHashes[] = {
{ 0x317afeb882ff324a, 212, "memcpy", }, // Mimana
{ 0x31ea2e192f5095a1, 52, "vector_add_t", },
{ 0x31f523ef18898e0e, 420, "logf", },
{ 0x32215b1d2196377f, 844, "godseaterburst_blit_texture", },
{ 0x32215b1d2196377f, 844, "godseaterburst_blit_texture", }, // Gods Eater Burst
{ 0x32806967fe81568b, 40, "vector_sub_t_2", },
{ 0x32ceb9a7f72b9385, 440, "_strtoul_r", },
{ 0x32e6bc7c151491ed, 68, "memchr", },