Permalink
Browse files

Vif-Rec: Fix skip size calculation.

(also a line ending issue, hope it doesn't mess it up lol)
  • Loading branch information...
1 parent 2662809 commit cf993c2a3632a6371fc807da1ee6b945ccca5b9d @refractionpcsx2 refractionpcsx2 committed Jan 29, 2016
Showing with 1 addition and 1 deletion.
  1. +1 −1 pcsx2/x86/newVif_Dynarec.cpp
@@ -257,7 +257,7 @@ _vifT static __fi u8* dVifsetVUptr(uint cl, uint wl, bool isFill) {
//if (wl == 256) isFill = true;
if (!isFill) {
uint skipSize = (cl - wl) * 16;
- uint blocks = v.block.num / wl;
+ uint blocks = (v.block.num + (wl-1)) / wl; //Need to round up num's to calculate skip size correctly.
length += (blocks-1) * skipSize;
}

8 comments on commit cf993c2

@refractionpcsx2
Member

@gregory38 can you try the test run again?

@refractionpcsx2
Member

A nicer (and faster) solution would be to make the vif rec support vu address wrapping, but that could be more work :P The bonus as a result would mean less dropping back to the VIF interpreter, which is what this is currently doing.

@gregory38
Contributor

Better. It remains the issue with the configuration of mode 3.

Mirroring VU could easier than you think. I already did some mirroring for the RAM in my recompiler branch. Maybe we could do the same for the VU too.

@gregory38
Contributor

By the way, you can run the test with this kind of command

./tests/run_test.pl --suite ~/project/ps2autotests/tests/dma  --cfg bin/inis --cpu 4 --test mod --show
@refractionpcsx2
Member

it uses indirect displacement for accessing the memory address on this, not quite sure how we can do it, i believe the vu commands compile to work for a certain setup of a certain length, it can be anywhere in memory so we can't recompile with the wrapping in, unless we put a sneaky mem mask in after the address is retrieved, that may work quite well.

I can't run that, don't have python installed :P I was just starting to look at the mode issue, see if i can replicate it.

@gregory38
Contributor

It is PERL and actually it requires babun. But you can run the elf directly.

Actually you can mirror the address space in the OS MMU. So you can map 0x10001000 to 0x10002000 for example. And you don't need anything special. Actually I didn't check that it is really working (but it oughts to work)

@refractionpcsx2
Member

well ill leave that to you as you seem to be the rec wizard these days (way ahead of me).

This mod thing is driving me nuts, the emu wont even boot with it now with nothing changed, really confusing haha

Edit: I should mention this is with the interpreter, seems to think there is no data to increment, but this is at the boot part, although the stcycle test works fine

@refractionpcsx2
Member

Sussed the crash, VIFfuncTable wasn't big enough so it was trying to reference outside the array, although VS pointed to something completely irrelivant, so I'm guessing it was buggering up the stack.

Please sign in to comment.