Thursday, 22 February 2007

Chasing weird bugs

Written by zilmar
Last updated Friday, 30 March 2007

One of the bugs reported in the new beta was that some games did not have sound/sound effects/music where they did in version 1.6. So some games might have music but no sound effects. The game this was first noticed in was doom64. It had sound in the intro sequence, but once you got in to the game it had no sound. I figured that since this worked in 1.6 but not in 1.7 then it should not be too hard to fix. Maybe 4 hour’s worth of work, boy was I wrong.

First off change all the normal setting, change to interpreter, use all the same plug-ins from 1.6. It should work but it doesn't. The game has still has sound in the intro, but once in game it does not. Ok make a save state in 1.6 and take it across, now have sound from save but no sound effects. Change the source code so I can log what is data is being to the RSP. After a day of tweaking I am able to get the same timings, it seems to generate the exact same data. It does not appear anything is different here, so I have no clue what is causing it. I try using Azimers audio plugin and set it to HLE the audio. This works, the audio is now playing, this suggests that what is sent to the RSP is correct.

I am totally confused at this point, I know it was working in 1.6 so I try one of the oldest version of 1.7 I had the source for (1.7.0.7). This is still failing, so I decide to slowly de-evolve the source back to the 1.6 code. Make sure all the interpreter ops are the same. On to getting the memory code back to the original, after that timing. Then the code for plugins. Then timing code. Then settings, I am totally confused there is not much left and none of the code left should effect the game. Then change some on the initialization code and it is working. Only took me a week to get to this point.

Ok, now I am getting somewhere. 8 hours latter I have narrowed down exactly what allows 1.6 to play with audio and 1.7 does not. The difference was that in 1.6 I created a thread to load the game and then this spawned another thread to execute the emulated core. In 1.7 I reduced it down to not re-spawning because I did not think it was needed. Ok I have a solution, this works when I start the CPU I just do it in another thread.

I just do not like this solution it might work but it makes no sense. I start to move more code in to the CPU thread to find out if there was anything that could give me a better idea what is actually causing this to happen. I find what does not like to be in the same thread as the emulation, initialization of the graphics plug-in. WTF initialization of the gfx plugin in another thread fixes the audio in game! Ok time to try the other gfx plugins. All the Direct X ones have the same effect with doom64, although the opengl has sound working.

Now it is time to talk to Jabo, to see if he has any clue. He has none. He has tracked down the problem to initiating d3d, do this and no sound effect, skip this you got audio. Ok do some more research it suggests that the creating the d3d object should be done in the thread that controls the UI because it adds different hooks in to the message handling. I change this so after loading the rom it will send a message to the UI to initialize the plugins there. This works, not necessarily the nicest solution, and I do not know exactly how it caused the issues. But at least it is working now and better then just spawning a thread for the sake of it.

Comments (10) >> feed
Great Job
written by JMS, February 23, 2007

Its news like this that makes me glad that I donated to such a dedicated team. Thanks alot guys and I hope that the rest Beta Testing community and I can help you make 1.7 the best.

...The Pixelmeister
written by Iconoclast, February 23, 2007

Not all of the DirectX plugins had this issue with Direct3D initialization in the emulation threads, only Jabo's Direct3D 8 1.6, 1.7, and Rice's Video Plugin 5.9.9 and up (when using the DirectX rendering engine setting). It was definitely Direct3D-related, but it isn't Direct3D in general, using what is discovered here. Maybe it's the version of DirectX used? Direct64 (9) and Jabo's Direct3D 6 1.5.2 (6) are the plugins that don't have this issue, and they don't use DirectX 8. I cannot test Direct3D 7 on this system.

Good blog
written by Jabo, February 24, 2007

I have issues like this almost once a month, something is broken and it was broken potentially years ago. It can take forever to figure it out, and its usually the silliest thing. It's amazing the lengths we go to sometimes in quality control and fixing things.

...
written by ares, April 07, 2007

gracias por el emulador

...
written by JaymeUK, July 25, 2007

... hmm you have totally lost me on all of this , as i have said before im not a coder, lol so i dont think i should be reading stuff that gets too technical like this.

Well no more reading the technical blogs for me

...
written by MonkBoy!!, November 06, 2007

1-Need support a Kaillera!! The Kaillera its a multy Player plugin!!!
2-Need input turbo buttom per buttom
3-Need trasnfer pokemon game of N64 to Game boy emulator Pokemon game,
4-Need Hack Rouble Pack support in Mario Kart, rs;

...
written by ahcO-aniH | Hina-Ocha, March 01, 2008

smilies/sad.gif where can I Download the
Jabo's Direct8 1.6 cause my Computer Wont Let me use PJ64 without it

...
written by me, May 15, 2008

smilies/smiley.gif smilies/wink.gif smilies/cheesy.gif smilies/grin.gif smilies/angry.gif smilies/sad.gif smilies/shocked.gif smilies/cool.gif smilies/tongue.gif smilies/undecided.gif smilies/kiss.gif smilies/kiss.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif

...
written by gngh, June 10, 2008

smilies/smiley.gif smilies/wink.gif smilies/cheesy.gif smilies/grin.gif smilies/angry.gif smilies/sad.gif smilies/shocked.gif smilies/cool.gif smilies/tongue.gif smilies/undecided.gif smilies/kiss.gif smilies/cry.gif

...
written by gngh, June 10, 2008

smilies/smiley.gif smilies/smiley.gif smilies/smiley.gif smilies/smiley.gif smilies/smiley.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/wink.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/cheesy.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/grin.gif smilies/angry.gif smilies/angry.gif smilies/angry.gif smilies/angry.gif smilies/angry.gif smilies/angry.gif smilies/sad.gif smilies/sad.gif smilies/sad.gif smilies/sad.gif smilies/shocked.gif smilies/shocked.gif smilies/shocked.gif smilies/shocked.gif smilies/shocked.gif smilies/shocked.gif smilies/shocked.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/cool.gif smilies/tongue.gif smilies/tongue.gif smilies/tongue.gif smilies/tongue.gif smilies/tongue.gif smilies/tongue.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/undecided.gif smilies/kiss.gif smilies/kiss.gif smilies/kiss.gif smilies/kiss.gif smilies/kiss.gif smilies/kiss.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif smilies/cry.gif

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley
Smiley

busy  
< Prev   Next >

Account Login

Categories

News Archive