This project is read-only.

Recompiler issues

Nov 22, 2011 at 6:19 PM

Sorry if there is/was already a thread on this, but I have problems with searching this site, and my queries are too general, anyway.

Has anyone made a serious recent effort to improve the recompiler?

It's nice that this project has x86-64 and ppc versions, unlike the original (but maybe inherited from other projects, not that it really matters), but it still retains most of the issues with the original.  Back when the original was recently abandoned, I tried to get 2 games working without issues:  Legaia and Vagrant Story.  With some improvements to the invalidation marking code, I was able to get Legaia to work reliably (i.e., no more crashing on special moves), and even Vagrant Story seemed to fail less often (a few problematic room transitions no longer crash, but some special events still do); then I just decided to abandon it and use my real ps2 instead.  Lately I decided to resume using pcsx and got some new games for testing, and many just didn't work at all with the recompiler (but my old patches, ported to x86-64, do fix issues with Legaia and Vagrant Story as before).  I spent a lot of time trying to figure out why it doesn't work right, and making numerous little changes.  I got some things to work better, but in the end, I just consider it a lost cause.  Back when I was originally trying to make it better, my machine just couldn't handle most games without the recompiler turned on, but now even my slow laptop has no problems.  Instead, maybe just cleaning up the interpreter would be the best thing, although it would require a bit of work (some simple enhancements like global register variables and improvement of the native/simulated BIOS could improve performance significantly).  I suspect most of why the recompiler doesn't work right is due to interrupts not being delivered properly (in fact, many of the issues I see appear to me to be interrupt-related, in particular sound issues).  I'd like to fix these, but I don't really like the code base as it is.  If I were to fix things, I'd probably make some major changes (such as a more centralized event timer and tighter integration of peripherals/elimination of the plugin system entirely), and I'd probably also abandon it before finishing it, because I don't really care enough.

Nov 25, 2011 at 2:40 AM

Well, I'd rather not start a private conversation on this.  If nobody wants to post publicly, I'll take that as a no.  I also don't really feel a need for SVN access; this is not my project, so I prefer someone review my patches before entering them.  In fact, I don't like posting partial/non-working patches, either; this is why I have never posted my patches to the recompiler, and probably never will.  My current incomplete patch has improved invalidation (e.g. invalidation calls in more places, and invalidation of an entire block if even one word in the block changes), rewritten branch/load delay logic, use of a few global registers (Linux/x86-64 ABI only) for speed and simplified addressing, native GTE load/store primitives, and a few other changes.  It would take a bit of effort on my part to ensure the i386 and ppc recompilers have similar improvements, even though my original patch was i386-only.

I didn't really mark down every single game which failed with recompiler turned on.  Even with my own modifications (and not due to them, I assure you; I used to keep multiple binaries around just to convince myself of that) many games fail, usually well into the game.  For example, FF7-9, Thousand Arms, and probably others I don't remember all fail or have issues in combat and other special events.  Some of these games take 20+ minutes of game play before the first failure (If you don't know the special moves, Legaia can take over an hour before it first crashes), and save states get invalidated so easily, it's hard for me to test some of these more than once.  Xenogears is the easiest to trigger:  it crashes in the opening title sequence (and the fact that I spent way too much time trying to cure that is what made me mostly give up and just use the interpreter by default, even though other games still occasionally bog down too much).  I believe the Xenogears issue may actually be cache-related rather than interrupt-related, but I never did find the exact cause.  I should probably mention that I use a different config file for every game, so for the few games the recompiler works with, I leave it turned on.  There are probably plenty of bug reports against the recompiler (I noticed that someone else reported the Legaia failure, for example), but I didn't look too hard before posting this.

Nov 28, 2011 at 7:16 PM

Sometimes the behavior just changes, and the bugs are hard to notice.  In any case, I don't write this stuff down, and my memory gets hazy about games I didn't play much or didn't play in ages; that's why I didn't want to provide a complete list in the first place.  I suppose I might be wrong about ff7, and maybe ff9, since I haven't played in so long.  I'm pretty sure I'm right about ff8, since I stopped playing for specifically that reason (ff8 actually still bogs down on my machine w/o recompiler).  I really only care about/play a few games, and others I can only stand for a short while at a time (ff7-9 in particular bug me by penalizing me for wanting to apply strategy in combat rather than rushing to the nearest menu item).

Dec 5, 2011 at 1:42 AM

One problem if you decide to use global registers: Clang, what the Mac port uses, doesn't support them. This might not change for the foreseeable future. This would be fixed if the Mac build switched to llvm-gcc, but Apple has indicated that they're mainly focusing on Clang.

Dec 6, 2011 at 10:35 PM

There are other issues with global registers as well, which is why I abandoned the idea on the interpreter, and limited it to a few commonly used values that aren't actually global, but loaded before every recompiled code call in the recompiler.  In any case, the Mac x86-64 ABI is likely different from the Windows and Linux x86-64 ABIs, so the list of available registers would differ, at the very least.  I have not even looked into the non-Linux ABIs, since I don't run them (and have no means to even do so for the Mac).

I did run the interpreter for a while with cycle, code, and pc in registers, but I did not test for very long since it had issues.  I can't say how much of an improvement it was, since I was testing for functionality still when I abandoned it.  It probably wasn't worth the effort.  That was my first attempt to improve the interpreter instead of the recompiler, since the recompiler wasn't getting any better.