someone972
Member
Posts: 57
Threads: 4
Joined: May 2012
Reputation:
1
|
RE: !IMPORTANT! New test patch for gamepad/dll issues
I finally figured out why the sound fails sometimes. When the sound updater is being created the SDL_CreateThread function is called before SDL_CreateMutex. The updater thread starts running before the mutex is created, so the call to SDL_LockMutex is passed a NULL pointer. This is where it gets tricky: sometimes the mutex is finished being created before SDL_UnlockMutex is called in the updater. This makes the next call to SDL_LockMutex in the updater block, stopping sound from playing. When the mutex has not yet been created by the time SDL_UnlockMutex is called it has no issues.
TLDR: Essentially the SDL_CreateMutex call needs to be moved ahead of the SDL_CreateThread call when creating the sound updater if my debugging is correct.
EDIT2: Scratch EDIT1, I just had missed a few instructions when moving stuff around. I moved the CreateMutex call above the CreateThread call by moving and fixing up the hex bytecode. I've tried the executable thoroughly and it no longer has the no sound/hanging issue anymore, both with hardware and software. Will this fix be incorporated into the next patch?
(This post was last modified: 09-12-2013, 02:42 PM by someone972.)
|
|
09-12-2013, 02:08 PM |
|