PDA

View Full Version : Chasing weird bugs


nicholash
22nd February 2007, 07:56 PM
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.

JMS
22nd February 2007, 08:14 PM
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.

HatCat
23rd February 2007, 03:56 AM
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.

Jabo
24th February 2007, 05:01 AM
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.

Anonymous
6th April 2007, 04:36 PM
gracias por el emulador

Anonymous
24th July 2007, 04:27 PM
... 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

Anonymous
5th November 2007, 05:17 PM
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;

Anonymous
29th February 2008, 05:16 PM
:( where can I Download the
Jabo's Direct8 1.6 cause my Computer Wont Let me use PJ64 without it

jamie5m
8th October 2009, 07:06 AM
how come when i play pokemon snap 64 i cannot see the gallery pictures and with pokemon snap the pictures are VITAL and i cannot play if i cant see them. how do i fix it?

HatCat
8th October 2009, 03:12 PM
Some other guy figured it out.
http://forum.pj64-emu.com/showthread.php?t=1106

Gah that's got to be like, my first post here?