Skip to content

Commit

Permalink
GPU: Correct Marvel copy hook size check.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Nov 12, 2022
1 parent 4618299 commit 50f7095
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Core/HLE/ReplaceTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,10 +1271,12 @@ static u32 marvelalliance1_copy_size = 0;
static int Hook_marvelalliance1_copy_a1_before() {
marvelalliance1_copy_src = currentMIPS->r[MIPS_REG_A1];
marvelalliance1_copy_dst = currentMIPS->r[MIPS_REG_V1];
marvelalliance1_copy_size = currentMIPS->r[MIPS_REG_V0] - currentMIPS->r[MIPS_REG_V1];
marvelalliance1_copy_size = currentMIPS->r[MIPS_REG_V0] - currentMIPS->r[MIPS_REG_A1];

gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a1_before");
if (Memory::IsValidRange(marvelalliance1_copy_src, marvelalliance1_copy_size)) {
gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a1_before");
}

return 0;
}
Expand All @@ -1284,15 +1286,19 @@ static int Hook_marvelalliance1_copy_a2_before() {
marvelalliance1_copy_dst = currentMIPS->r[MIPS_REG_V0];
marvelalliance1_copy_size = currentMIPS->r[MIPS_REG_A1] - currentMIPS->r[MIPS_REG_A2];

gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a2_before");
if (Memory::IsValidRange(marvelalliance1_copy_src, marvelalliance1_copy_size)) {
gpu->PerformReadbackToMemory(marvelalliance1_copy_src, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::WRITE, marvelalliance1_copy_src, marvelalliance1_copy_size, "marvelalliance1_copy_a2_before");
}

return 0;
}

static int Hook_marvelalliance1_copy_after() {
gpu->PerformWriteColorFromMemory(marvelalliance1_copy_dst, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::READ, marvelalliance1_copy_dst, marvelalliance1_copy_size, "marvelalliance1_copy_after");
if (Memory::IsValidRange(marvelalliance1_copy_dst, marvelalliance1_copy_size)) {
gpu->PerformWriteColorFromMemory(marvelalliance1_copy_dst, marvelalliance1_copy_size);
NotifyMemInfo(MemBlockFlags::READ, marvelalliance1_copy_dst, marvelalliance1_copy_size, "marvelalliance1_copy_after");
}

return 0;
}
Expand Down

0 comments on commit 50f7095

Please sign in to comment.