Saturday, January 30, 2010

More on Petit Copter (Ingame)

Okay, last night I was curious as to why Petit Copter kept crashing the way it does. I initially thought it was DirectSound related, but it turns out that it was really a problem with our implementation of EmuIDirect3DDevice8_SetRenderTarget. The fix was so easy, I wanted to slap myself! After that it went ingame.

After going ingame, it turns out that the game is more complex than I thought in some ways. It turns out that the game does actually use vertex shaders! Although that's not really a problem as Petit Copter's vertex shaders were really simple to convert. When I first got Petit Copter ingame, I noticed that the only thing I could see was the helicopter's rotor. This was because Cxbx compensates for the Xbox's ability to use negative numbers to identify vertex shader constants (c-96 to c96), so Cxbx adds 96 to the vertex shader constant ID of each shader instruction to fix that. This caused bugs in games using XDK 4361 and earlier (so far) and caused 3D not to render. So what I did was add 96 in EmuIDirect3DDevice8_SetVertexShaderConstant and everything that used vertex shaders in XDK 3911 - 4361 worked fine. It's a dirty hack and I'm not sure if it's a good idea to leave it there, but oh well, time will tell.

"So, how well does it run in game?" Well, everything is smooth ingame. No framerate issues as the graphics are really simple. "If everything is smooth, why can't it be considered playable yet?" Good question. There's another bug somewhere, and I can't figure out what it is. So far, it's exclusive to this game. There's a stack corruption problem in this game (might be the generated exe or CxbxKrnl.dll causing it) and it's really hard to track! If I can fix that, then the game will be considered playable. The bug is completely random. Sometimes you'll get a crash immediately, other times it won't show up for about 30 seconds if you're lucky. So if you want, watch the youtube video (link below).

Cxbx WIP: Petit Copter [Part 2] (Ingame)

Hope you enjoy it.



  1. nice progress in CXBX, i wait look Ninja Gaiden, Dead or Alive 3, Panzer and others in video soon. =)

  2. definitely i love your cxbx videos..blueshogun friend is very interesting to see how do you make the interface for the "xbox game graphic motor games"traduced in directx out and videocard motor hehe....well is very important that cxbx support all types of draws, renders, and more graphics types advanced...well i was surprised how the petit game runs at 100% practly...greetings i love your code is your opengl port?

  3. You must fix sound but is the part when you finish the emulation game :P.

  4. @saintseiya, Thanks. The OpenGL port isn't ready just yet; I added OpenGL code but didn't finish it all. When it's done, I'll post the news here!

    @Animal, it's a problem with Xbox's DirectSoundStream interface. Cxbx plays it way too fast and I'm not sure of the best solution yet.

  5. hum... ok but the important thing is the FPS Speed will be 60 or 30?

  6. I'm mostly just reading, but I wanted to say great work :)
    It's exciting to see the progress.

  7. oh, sorry, I was getting the idea that you were actually intercepting the calls and passing them through cxbx...what I meant was writing a completely independant exe...not needing the dll or whatever...