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.

1 comment:

  1. Chihiro shouldn't use any special MMIO. I had the boot-screen running in my emulator using the default xbox memory map.
    It might have special MMIO, but I doubt its anything important.

    In contrast to SEGAs other arcades, the chihiro is actually a very lightweight (hardware-implemented) loader for xbox. Most of the xbox interfaces were kept. Hence the games use the xbox API for almost anything.
    You can also verify this by checking the kernel - there are no chihiro kernel exports.

    The JVS functions are used internally, the commands are most likely send to the chihiro-boards.

    The JVS input is actually converted to xbox-usb. Hence no special work is required.

    The chihiro kernel exports another IDE device though - the RAM from the chihiro mediaboard (?) which is the FATX game image (Just check which devices the game tries to link).