Commit 6755a5f5 authored by Richard Gobeille's avatar Richard Gobeille
Browse files

audiolib: move Windows debug thread naming stuff out of driver_winmm and into winbits.h

parent fc08bd34
......@@ -31,6 +31,7 @@
#include "midifuncs.h"
#include "multivoc.h"
#include "osd.h"
#include "winbits.h"
#include <mmsystem.h>
......@@ -714,28 +715,12 @@ static void CALLBACK midi_callback(HMIDIOUT out, UINT msg, DWORD_PTR dwInstance,
WinMMDrv_MIDI_Unlock();
}
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; /* must be 0x1000 */
LPCSTR szName; /* pointer to name (in user addr space) */
DWORD dwThreadID; /* thread ID (-1=caller thread) */
DWORD dwFlags; /* reserved for future use, must be zero */
} THREADNAME_INFO;
#pragma pack(pop)
static DWORD WINAPI midiDataThread(LPVOID lpParameter)
{
UNREFERENCED_PARAMETER(lpParameter);
#ifndef NDEBUG
if (IsDebuggerPresent())
{
THREADNAME_INFO wtf = { 0x1000, "midiDataThread", (DWORD)-1, 0 };
RaiseException(0x406D1388, 0, sizeof(wtf) / sizeof(ULONG_PTR), (const ULONG_PTR*) &wtf);
}
debugThreadName("midiDataThread");
#endif
DWORD sleepAmount = 100 / MME_THREAD_QUEUE_INTERVAL;
do
......
......@@ -23,8 +23,12 @@
* OggVorbis source support for MultiVoc
*/
#include "compat.h"
#include "_multivc.h"
#include "compat.h"
#ifdef _WIN32
#include "winbits.h"
#endif
#ifdef HAVE_VORBIS
......@@ -342,11 +346,11 @@ int MV_PlayVorbis(char *ptr, uint32_t length, int loopstart, int loopend, int pi
int status = ov_open_callbacks((void *)vd, &vd->vf, 0, 0, vorbis_callbacks);
vorbis_info *vi;
if (status < 0 || ((vi = ov_info(&vd->vf, 0)) == nullptr) || vi->channels < 1 || vi->channels > 2)
{
if (status == 0)
ov_clear(&vd->vf);
else
if (status < 0 || ((vi = ov_info(&vd->vf, 0)) == nullptr) || vi->channels < 1 || vi->channels > 2)
{
if (status == 0)
ov_clear(&vd->vf);
else
MV_Printf("MV_PlayVorbis: err %d\n", status);
ALIGNED_FREE_AND_NULL(voice->rawdataptr);
......
......@@ -16,6 +16,28 @@
# define WindowClass "buildapp"
#endif
#if !defined NDEBUG
# pragma pack(push, 8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; /* must be 0x1000 */
LPCSTR szName; /* pointer to name (in user addr space) */
DWORD dwThreadID; /* thread ID (-1=caller thread) */
DWORD dwFlags; /* reserved for future use, must be zero */
} THREADNAME_INFO;
# pragma pack(pop)
static inline void debugThreadName(char const *name)
{
UNREFERENCED_PARAMETER(name);
if (IsDebuggerPresent())
{
THREADNAME_INFO wtf = { 0x1000, name, (DWORD)-1, 0 };
RaiseException(0x406D1388, 0, sizeof(wtf) / sizeof(ULONG_PTR), (const ULONG_PTR *)&wtf);
}
}
#endif
// TODO: actually make the layout switching unnecessary :/
extern int32_t win_priorityclass;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment