Sunday, April 17, 2011

Think I Found the JSRF Problem and Other Random Cxbx stuff.

Meh, it's been a while since I've updated this blog. Lately, I've been working IRL (which is great) and haven't done a whole lot on Cxbx (needed a break anyway), but I do have a few things I want to say though.

First, I'd like to thank Evan "spidertrax" for sending me the copy of Amped in exchange for the game's sound track. This game has been a major help in finding problems within Cxbx. While the lack of XG signatures were obviously lacking, I was quite sure that it had to be the source of numerous problems. I managed to get a dirty disc error out of it, but that was about it so far. (Screen above, obviously).

Let's start from the beginning. When I got the copy of Amped, I noticed that there was something strange going on in EmuIDirect3DResource8_Register. Cxbx's implementation interprets it as a vertex buffer, but wasn't the case. So, I loaded up the .xbe file in IDA and applied the necessary .sig files to see if there was anything not being intercepted. Turns out it was XGSetTextureHeader. Never noticed that function before then, but I honestly don't see what makes it useful to begin with. What the function does is fill in the variables within the structure (D3DTexture is not a real COM interface) and return a pointer that is ready to be passed into D3DResource::Register. Sounds easy to implement right? Yeah, but so far, I can't get it to work for some reason. More on that later.

My initial thought after finding it was "I bet this is the culprit causing the trouble with other games like Crazy Taxi III!" So, I pulled up Crazy Taxi III. Did I find it there? I sure did! So after that, improving XG emulation has been a higher priority. What was my next instinct? Test JSRF, of course. Was it there? IIRC, yup, it was. Is that what was causing the problem? Not sure, but there were other XG functions being used in it, so I'm sure it's one of 'em. With JSRF, the particular one that caught my interest was XGCompressRect. Never noticed that one either, but if it's like XGSwizzleRect internally, then it needs to be emulated. If I can ever get a working implementation of that function and all of the XGSet[x]Header function(s), then maybe it will finally work. Honestly, JSRF has been kicking my ass for a long time, I'm running out of patience with it. If it doesn't put out after THIS, I'm going to say "f@#% it" for a while and try again later.