Sunday, March 31, 2013

More on Virtua Cop 3

Out of sheer curiosity, I wanted to see if I could at least get into the test menu for Virtua Cop 3.  Did I? Yup, I sure did.

Aside from the fact that it looks rather bad (it's because of a render target issue, causing the primary colour buffer not to be cleared properly AFAIK), it does work and I can change the settings and what not.  How did I do it?  I simply ran the vc3_t.xbe which takes you into the test mode.  That .xbe doesn't do much except pass along some parameters to tell Virtua Cop 3 to start in test mode.  Cxbx saves those parameters to disk as CxbxLaunchData.bin and loads it during the next call to GetLaunchData.  If VC3 doesn't find this data, then it will just try to load normally.  Trying to exit and resume normal loading will cause a crash unfortunately.  A call to RtlEnterCriticalSection that crashes when it calls EmuSwapFS is something I've never figured out how to fix as there are a handful of games that do this.

Still haven't worked out the problem with JVS not being recognized yet.  Just thought I'd share that since the Cxbx news front has been getting silent lately.


Virtua Cop 3 is starting to work.

Well, I spent my entire Saturday afternoon working on Cxbx for one request (now do you know how much I love you guys?) and finally got a result worth posting.

Okay, I have good news and bad news.  The good news is that it's finally confirmed that Cxbx is capable of emulating Sega Chihiro games.  Good thing, because it's a load off of my mind.  The mystery was killing me!  The bad news is that there are some parts of the JVS I/O board may have to be emulated in order for games to work.  Instead of emulating the JVS, I've been skipping and ignoring the port mapped I/O access functions as well as just creating stubs for the hijacked JVS functions.

This screen shot is proof.

Although I'm very pleased to have reached this far with Virtua Cop 3, I'll have to further research Chihiro's JVS hardware.  There's a chance that we may not have to emulate it though, since JayFoxRox's emu managed to get passed this.  It's probably a matter of satisfying a few conditions.

I'll put more work/thought into this later.  It's passed 1AM and I'm tired.  I'm just glad it's showing something for the time being.


Saturday, March 30, 2013

More on Chihiro

Okay, I do get people that continuously ask me about the possibility of playing SEGA Chihiro games on Cxbx.  Tbh, I do think it's possible, but no one has done it yet.  What it would take to do it is also a mystery.  Have I been working on it?  Yes, I spent some time last night doing some work on it.

By a fairly popular request, I've been working on Virtua Cop 3.  The reason I've chosen to accept this request is because it works on a debug Xbox without any major issues, as long as you have a TV that supports HD component cables.  Fortunately, I have a debug Xbox and a CRT that does support it, so there's a possibility I could use a lightgun.  Using the gamepad is really hard because the thumbstick is extremely sensitive.  One of these days, I should make a video of me playing it.

Now, before I go any further, I wanted to do a bit of backtracking so you understand where I'm coming from.  Remember when I made a post regarding Martin_sw's progress on his branch for Chihiro?  Although I haven't seen him in ages, I have had to essentially rediscover his work on my own.  Meaning, the Jvs functions I had to start adding myself.  I don't know exactly what the functions do or exactly what their parameters are, but at least I know the names of each function and how many parameters per function.  So, I added some stubs for the following functions:

  • JvsEEPROM_Read
  • JvsBACKUP_Read
  • JvsBACKUP_Write
  • JvsEEPROM_Write
  • JvsScFirmwareDownload
  • JvsScFirmwareUpload
  • JvsFirmwareUpload
There's more to add, but I haven't added them all yet.  So, what's stopping it from working?  The game appears to be accessing some port mapped I/O addresses directly and I haven't stopped to examine exactly what hardware is being accessed.  It was passed 2am and I was ready to hit the sack.  I could easily just make Cxbx skip over that stuff, but I'd rather see exactly what it's trying to do.  Since I'm on my Mac right now, I can't load up the disassembler right now and show you exactly what I'm talking about.

So there you have it.  For those of you who were wondering what I've been doing with Chihiro, this is it.  I'd like to try some more games to see if I get the same thing, or if this is just specific to Virtua Cop 3.  Thanks for reading.


EDIT: I copied and pasted the PMIO code I was talking about to pastebin, right here:

In particular, this is the one I'm examining since it's causing Cxbx to crash atm.

.text:000F5F50 sub_F5F50       proc near               ; CODE XREF: sub_F6C70+4F p
.text:000F5F50                                         ; DATA XREF: .data:off_215C58 o
.text:000F5F50                 mov     dx, 4026h
.text:000F5F54                 mov     ax, 102h
.text:000F5F58                 out     dx, ax
.text:000F5F5A                 mov     dx, 40E0h
.text:000F5F5E                 mov     al, 5
.text:000F5F60                 out     dx, al
.text:000F5F61                 retn
.text:000F5F61 sub_F5F50       endp

Since I don't know what ports these are off hand, I may have to do a bit of research on what they are.  I have two options, attempt to ignore the privileged instructions (in, out), or try to emulate the functionality.

Thursday, March 14, 2013

Castlevania: Curse of Darkness

This is something that I've been meaning to talk about for quite some time now, but kept forgetting to blog about it and get everyone else's viewpoint on it...

Right now, the game that's been showing the most progress on Cxbx is Castlevania: Curse of Darkness.  What does it do?  Well, for starters, it DOES go ingame, but does have two key issues with the, and they are:

- Lack of 8-bit palettized texture support
- Incomplete and buggy vertex shader conversion.

The first one has been implemented rather well in Dxbx.  I just haven't gotten around to adding it in Cxbx.  This is something that I can most definitely do, since I have a basic .tga loader which I modified to support 8-bit textures and have created a very basic mini-3rd person shooter for Xbox once, so I have a means of testing it thoroughly.  In short, I'm not too worried about this atm.

But what DOES worry me is the vertex shader problems.  Honestly, I have absolutely NO IDEA how Cxbx converts the vertex shader to a readable form, nor do I understand how the vertex or pixel shader is converted on a real Xbox.  I know it should be straight forward, but I've always had trouble grasping it.

Fixing these two things will get the game playable beyond the shadow of a doubt.  Input, background music, and everything else works fine.  Keep in mind that this game was ported from PS2 and still contains some coding architecture that is best optimized for PS2.  Replacing the VU transformation code, all of the transformations are done in the vertex shaders.  The textures are also all palettized because of the PS2's video memory limitations (only 4MB, but lots of bandwidth).

But the biggest question is, do people want this?  Honestly, that's not a very big concern for me because I care more about the emu's success and compatibility than what people want to play from an immediate perspective.

So, please let me know what you all think of this.  I'm really curious to know.