mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Read the offset for the framebuffer index from the instruction stream
instead of using a literal constant, so the hook works for other games using the same function but a different offset (e.g. Zero no Kiseki). Also remove the memcpy() since the original function will do it anyway (and may do it differently if other games call the function with different arguments).
This commit is contained in:
parent
97a0b0c510
commit
230bbad1c6
1 changed files with 6 additions and 4 deletions
|
@ -579,15 +579,17 @@ static int Hook_brandish_download_frame() {
|
|||
return 0;
|
||||
}
|
||||
const u32 fb_info = Memory::Read_U32(fb_infoaddr);
|
||||
const u32 fb_index = (Memory::Read_U32(fb_info + 0x2ec8) + 1) & 1;
|
||||
const MIPSOpcode fb_index_load = Memory::Read_Instruction(currentMIPS->pc + 0x38, true);
|
||||
if (fb_index_load != MIPS_MAKE_LW(MIPS_GET_RT(fb_index_load), MIPS_GET_RS(fb_index_load), fb_index_load & 0xffff)) {
|
||||
return 0;
|
||||
}
|
||||
const u32 fb_index_offset = fb_index_load & 0xffff;
|
||||
const u32 fb_index = (Memory::Read_U32(fb_info + fb_index_offset) + 1) & 1;
|
||||
const u32 fb_address = 0x4000000 + (0x44000 * fb_index);
|
||||
const u32 dest_address = currentMIPS->r[MIPS_REG_A1];
|
||||
if (Memory::IsRAMAddress(dest_address)) {
|
||||
gpu->PerformMemoryDownload(fb_address, 0x00044000);
|
||||
memcpy(Memory::GetPointer(dest_address),
|
||||
Memory::GetPointer(fb_address), 0x00044000);
|
||||
CBreakPoints::ExecMemCheck(fb_address, true, 0x00044000, currentMIPS->pc);
|
||||
CBreakPoints::ExecMemCheck(dest_address, true, 0x00044000, currentMIPS->pc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue