Saturday, July 17, 2010

Random update(s)





Well, I'd feel really bad if I didn't update this blog with something! =) So I thought I'd at least do a few quick things for Cxbx. Since it's on my resume, keeping it updated would help.

Even though the above screens aren't all to impressive, those two games have been driving me crazy as of late and getting it to do something is better than what it was doing before. Which leads me to another thing I wanted to bring up. Patrickvl and defiance have been talking about fixing how we emulate Critical Sections in Cxbx. So far, it appears to be a rather big problem for this emulator. Patrickvl did manage to fix a few things with Enter/LeaveCriticalSection() (hence the reason Dxbx does a better job of emulating Rayman Arena right now) and if I can get in touch with him and discuss how he fixed it, then we will see a lot more games working on Cxbx. Since I'm a noob to how critical sections work (I've never used that feature before), I'll have to further educate myself on the subject just in case I have to figure this out on my own. After taking a look myself, the big thing is that it just appears that the main problem is that the structures differ from the Xbox to the PC version. This is bad, but either way, it should be emulated correctly. For now, I guess I could just keep track of each critical section created (just like how Cxbx keeps track of every IDirectSoundBuffer* pointer created) and just save the valid params for each critical section. If this works, then it should solve problems with various games such as Blood Wake, Rayman Arena, Taz: Wanted and Zapper and possibly more. I'm assuming this will work, until I try it tonight, we'll see.

As of late, I've noticed that we've had some rather "problematic" kernel functions preventing numerous games from working correctly. One of the most notorious of those functions is NtQueryFileAttributes. Instead of dealing with that pain-in-the-ass-to-emulate function, instead I created a signature and emulated it on a higher level using the native GetFileAttributesA() function. I did this when working games such as Dues Ex and Hunter the Reckoning and it worked like a charm.

"Why haven't you updated the SVN yet if you've done all this and more?" Good question. That's because I have a bit of bad news. First of all, I was tracking down some bad DirectSound signatures for XDK 3911 when working on Blood Wake. I commented those out and was planning on fixing them later (not really a problem to fix actually), but upon doing that, I broke Halo. I assume most of you don't care about that, but it does get worse. My latest build broke Turok! Why? I don't know yet. All I know is that there's NULL surface causing the crash. I can add sanity checks to get around that, but not sure if it's a major problem. My debugging skills really suck, and so far I've been relying on other team members to help me debug stuff. That needs to change, and fast!

One more thing, I know that you guys want to play games like Conker, Midtown Madness 3, Unreal Championship II, and other games using the D3D8LTCG library. Well, I have some more bad news for you. When I was working on adding further support for this library, I did get some of the XDK samples built under the LTCG release to work, however, the code inside these functions are dynamic, NOT static like with normal D3D8 library builds. What does this mean? It means that even though one signature might work for one app/game, it's not guaranteed to work for the next as the code and signature would change per game. Furthermore, there is no standard way to dissassemble the library in IDA or use our automated tools to locate the functions. So with that being said, Cxbx CANNOT emulate these games using the method it uses now. The only way to do so is to actually create an HLE datasheet that manually specifies the location of each function similar to how Xeon works. This is really a lot of work to do since most games require many functions to be HLEd and finding them all manually can take months (unless we had a dedicated team to search them out). Now I see what Nisse was talking about =/

So, that's all I wanted to share tonight. In the mean time, I can still add a few updates here and there. Just know that I'm not completely off of this project for any reason! =)

Shogun.

15 comments:

  1. Sorry if this sounds like quite a n00b question, but now that you have made this discovery, will trying out new titles one by one lead to easier time getting compatibility, or are you just dealing with more complications?

    ReplyDelete
  2. Will see perfection believe that ;)

    ReplyDelete
  3. @Oemenia, I'm sorry, I don't quite understand. Are you asking if trying newer titles will help me fix more problems? In that case, it's a yes and no thing.

    ReplyDelete
  4. glad to see things are still going. i would be glad to help with integrating the various CRITICAL_SECTION and FILE_INFORMATION_CLASS changes i have made so far. i could also pass a long the changes regarding the index buffer patching, as well discussing as a few other additions i have been working on (related to certain information i have mentioned before). Haven't seen you online in a while, heh.

    ReplyDelete
  5. Seems like update is going to start a wave of new things to come (I hope), such as new methods of emulating certain functions. I think in the months to come there will be some nice changes happening. Like they say when hitting bottom, you can only go up from there.

    Everyone is doing a good job, Keep it up! :D

    ReplyDelete
  6. Thanks for replying.

    What i mean is that now that youve made this breakthrough, does it mean it gives you the opportunity to go ahead and get more games to run if you start going through them one by one?

    ReplyDelete
  7. Maybe you could upload broken sources as a separate branch? Somebody could take a look what went wrong.

    ReplyDelete
  8. Eh, I don't know NtQueryFileAttributes? Did you mean NtQueryInformationFile or NtQueryFullAttributesFile perhaps? In Dxbx I've patched all functions that recieve a POBJECT_ATTRIBUTES argument, via one generic function. This way, I not only take care of the ANSI<>Unicode difference, but also honour symbolic links, device-paths, access to the raw config partition, etc. Just take a look at my sources to see how this works...

    ReplyDelete
  9. Oh, and perhaps your new OOVPA messed up some other patch locations. Try to compare your previous symbol locations with the new ones; There will probably be differences, which would explain why Turok doesn't run anymore. Symbol detection is really the achilles' heel of HLE.

    ReplyDelete
  10. The problem i have with Turok and most other games that are not working for me boils down to undetected functions. The problem with HLE is not directly in the symbol detection, but in the fact that if you detect one you almost inevitably have to detect them all. Right now Turok crashes due to an access violation in the WMV/XMV decoding functions. I am still looking through things, but so far it appears the current version actually detects more functions that the main trunk version, even though the main trunk can still run Turok without issue. The problem with actually successfully detecting functions is that now those function no longer get called to set the various internal variables that other functions, that may not be detected yet, would have otherwise used. In this case since its video processing related it could easily be Sound or Graphics related, not sure yet. Turok, Rayman, Blood Wake, and a few others are all crashing in about this same area for me. Hopefully it will just end up being an undetected function. i am going to be doing some comparisons between the detections of the trunk, svn, and dxbx to see where there are any mismatches.

    ReplyDelete
  11. Ninja Gaiden please, hehe...

    Your an awesome cat though, no one else wants to work on a xbx emu cause they say its not possible and here you are, making the impossible possible, my hat goes off to you bud. Keep up the good work :).

    ReplyDelete
  12. I have nothing significant to add. Just wanted to say Thank You.

    ReplyDelete
  13. First of all, thanks for all your work!

    I've got a n00b question, but something I've wanted for years is the source code to Xbomberbox (popular home-brew xbox game), but the author's email no longer works (for years..), the next best bet would be emulating it on my PC. Is there any pointers on the net on what's involved in adding support for an additional game in the emulator? I've got a programming background, free time, and a willingness to learn, just not sure where to start.

    Thanks again

    ReplyDelete
  14. Hi there,

    is there any chance to run SSX Tricky on yours emulator? This would be great.

    ReplyDelete