Replaced DbgPrintg EmuKrnl with DbgFuncArgs, avoiding typos altogether

This commit is contained in:
PatrickvL 2016-11-07 11:38:59 +01:00
parent 02708b4f1f
commit 94d3fbbffe
6 changed files with 540 additions and 908 deletions

View File

@ -82,8 +82,6 @@ typedef signed long sint32;
/*! define this to dump textures that are registered */
//#define _DEBUG_DUMP_TEXTURE_REGISTER "D:\\cxbx\\_textures\\"
#include "Version.h"
/*! version string dependent on trace flag */
#ifndef _DEBUG_TRACE
#define _CXBX_VERSION _GIT_VERSION " ("__DATE__ ")"
@ -105,11 +103,13 @@ extern volatile bool g_bPrintfOn;
#endif
/*! DbgPrintf enabled if _DEBUG_TRACE is set */
#ifdef _DEBUG_TRACE
#define DbgPrintf if(g_bPrintfOn) printf
#else
inline void null_func(...) { }
#define DbgPrintf null_func
#endif
#define DbgPrintf(fmt, ...) do { if (_DEBUG_TRACE) if(g_bPrintfOn) printf(fmt, __VA_ARGS__); } while (0)
// See http://stackoverflow.com/questions/1644868/c-define-macro-for-debug-printing
// TODO : print each argument indented on a separate line
#define DbgFuncArgs(fmt, ...) \
do { if (_DEBUG_TRACE) if(g_bPrintfOn) \
printf(__FILE__ " (0x%X): " __func__ "(" fmt ");\n", GetCurrentThreadID(), __VA_ARGS__); \
} while (0)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -58,20 +58,9 @@ PVOID WINAPI XTL::EmuXGIsSwizzledFormat
XTL::D3DFORMAT Format
)
{
// ******************************************************************
// * debug trace
// ******************************************************************
#ifdef _DEBUG_TRACE
{
DbgPrintf("EmuXapi (0x%X): EmuXGIsSwizzledFormat\n"
"(\n"
" Format : 0x%.08X\n"
");\n",
GetCurrentThreadId(), Format);
}
#endif
DbgFuncArgs(
" Format : 0x%.08X\n",
Format);
return FALSE;
}
@ -93,8 +82,7 @@ VOID WINAPI XTL::EmuXGSwizzleRect
{
DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleRect\n"
"(\n"
DbgFuncArgs(
" pSource : 0x%.08X\n"
" Pitch : 0x%.08X\n"
" pRect : 0x%.08X\n"
@ -102,9 +90,8 @@ VOID WINAPI XTL::EmuXGSwizzleRect
" Width : 0x%.08X\n"
" Height : 0x%.08X\n"
" pPoint : 0x%.08X\n"
" BytesPerPixel : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pSource, Pitch, pRect, pDest, Width, Height,
" BytesPerPixel : 0x%.08X\n",
pSource, Pitch, pRect, pDest, Width, Height,
pPoint, BytesPerPixel);
if(pRect == NULL && pPoint == NULL && Pitch == 0)
@ -163,8 +150,7 @@ VOID WINAPI XTL::EmuXGSwizzleBox
{
DbgPrintf("EmuXapi (0x%X): EmuXGSwizzleBox\n"
"(\n"
DbgFuncArgs(
" pSource : 0x%.08X\n"
" RowPitch : 0x%.08X\n"
" SlicePitch : 0x%.08X\n"
@ -174,9 +160,8 @@ VOID WINAPI XTL::EmuXGSwizzleBox
" Height : 0x%.08X\n"
" Depth : 0x%.08X\n"
" pPoint : 0x%.08X\n"
" BytesPerPixel : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height,
" BytesPerPixel : 0x%.08X\n",
pSource, RowPitch, SlicePitch, pBox, pDest, Width, Height,
Depth, pPoint, BytesPerPixel);
if(pDest != (LPVOID) 0x80000000)
@ -339,13 +324,11 @@ HRESULT WINAPI XTL::EmuXGWriteSurfaceOrTextureToXPR
{
DbgPrintf("EmuXapi (0x%X): EmuXGWriteSurfaceOrTextureToXPR\n"
"(\n"
DbgFuncArgs(
" pResource : 0x%.08X\n"
" cPath : 0x%.08X\n"
" bWriteSurfaceAsTexture : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pResource, cPath, bWriteSurfaceAsTexture);
" bWriteSurfaceAsTexture : 0x%.08X\n",
pResource, cPath, bWriteSurfaceAsTexture);
// TODO: If necessary, either reverse the .xbx and .xpr file formats
// and write the surface/texture to a file, or output a generic .xbx
@ -376,8 +359,7 @@ VOID WINAPI XTL::EmuXGSetTextureHeader
{
DbgPrintf("EmuXapi (0x%X): EmuXGSetTextureHeader\n"
"(\n"
DbgFuncArgs(
" Width : 0x%.08X\n"
" Height : 0x%.08X\n"
" Levels : 0x%.08X\n"
@ -386,9 +368,8 @@ VOID WINAPI XTL::EmuXGSetTextureHeader
" Pool : 0x%.08X\n"
" pTexture : 0x%.08X\n"
" Data : 0x%.08X\n"
" Pitch : 0x%.08X\n"
");\n",
GetCurrentThreadId(), Width, Height, Levels, Usage,
" Pitch : 0x%.08X\n",
Width, Height, Levels, Usage,
Format, Pool, pTexture, Data, Pitch);
// NOTES: This function simply creates a texture that needs to be registered
@ -454,13 +435,11 @@ VOID WINAPI XTL::EmuXGSetTextureHeader
//{
//
//
// DbgPrintf("EmuXapi (0x%X): EmuXFONT_OpenBitmapFontFromMemory\n"
// "(\n"
// DbgFuncArgs(
// " pFontData : 0x%.08X\n"
// " uFontDataSize : 0x%.08X\n"
// " ppFont : 0x%.08X\n"
// ");\n",
// GetCurrentThreadId(), pFontData, uFontDataSize, ppFont);
// " ppFont : 0x%.08X\n",
// pFontData, uFontDataSize, ppFont);
//
// __asm int 3;
//

View File

@ -58,12 +58,10 @@ int WINAPI XTL::EmuWSAStartup
{
DbgPrintf("EmuXapi (0x%X): EmuWSAStartup\n"
"(\n"
DbgFuncArgs(
" wVersionRequested : 0x%.08X\n"
" lpWSAData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), wVersionRequested, lpWSAData);
" lpWSAData : 0x%.08X\n",
wVersionRequested, lpWSAData);
int ret = WSAStartup(wVersionRequested, lpWSAData);
@ -82,11 +80,9 @@ INT WINAPI XTL::EmuXNetStartup
{
DbgPrintf("EmuXapi (0x%X): EmuXNetStartup\n"
"(\n"
" pDummy : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pDummy);
DbgFuncArgs(
" pDummy : 0x%.08X\n",
pDummy);
@ -101,7 +97,7 @@ DWORD WINAPI XTL::EmuXNetGetEthernetLinkStatus()
{
DbgPrintf("EmuXapi (0x%X): EmuXNetGetEthernetLinkStatus();\n", GetCurrentThreadId());
DbgFuncArgs();
@ -121,14 +117,12 @@ SOCKET XTL::EmuThis::Emusocket
{
DbgPrintf("EmuXapi (0x%X): EmuThis::Emusocket\n"
"(\n"
DbgFuncArgs(
" this : 0x%.08X\n"
" af : 0x%.08X\n"
" type : 0x%.08X\n"
" protocol : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, af, type, protocol);
" protocol : 0x%.08X\n",
this, af, type, protocol);
SOCKET ret = socket(af, type, protocol);
@ -144,14 +138,12 @@ int XTL::EmuThis::Emubind(SOCKET s, const struct sockaddr FAR *name, int namelen
{
DbgPrintf("EmuXapi (0x%X): EmuThis::Emubind\n"
"(\n"
DbgFuncArgs(
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" name : 0x%.08X\n"
" namelen : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, name, namelen);
" namelen : 0x%.08X\n",
this, s, name, namelen);
// TODO: Host-To-Network order if necessary (probably not?)
@ -169,13 +161,11 @@ int XTL::EmuThis::Emulisten(SOCKET s, int backlog)
{
DbgPrintf("EmuXapi (0x%X): EmuThis::Emulisten\n"
"(\n"
DbgFuncArgs(
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" listen : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, backlog);
" listen : 0x%.08X\n",
this, s, backlog);
// TODO: Host-To-Network order if necessary (probably not?)
@ -193,14 +183,12 @@ int XTL::EmuThis::Emuioctlsocket(SOCKET s, long cmd, u_long FAR *argp)
{
DbgPrintf("EmuXapi (0x%X): EmuThis::Emuioctlsocket\n"
"(\n"
DbgFuncArgs(
" this : 0x%.08X\n"
" s : 0x%.08X\n"
" cmd : 0x%.08X\n"
" argp : 0x%.08X\n"
");\n",
GetCurrentThreadId(), this, s, cmd, argp);
" argp : 0x%.08X\n",
this, s, cmd, argp);
int ret = ioctlsocket(s, cmd, argp);
@ -220,12 +208,10 @@ HRESULT WINAPI XOnlineLaunchNewImage
{
DbgPrintf("XOnline (0x%X): EmuXOnlineLaunchNewImage\n"
"(\n"
DbgFuncArgs(
" lpImagePath : 0x%.08X (%s)\n"
" pLaunchData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpImagePath, lpImagePath, pLaunchData);
" pLaunchData : 0x%.08X\n",
lpImagePath, lpImagePath, pLaunchData);
// TODO: Launch another .xbe from Cxbx someday?
@ -248,15 +234,13 @@ HRESULT WINAPI XTL::EmuXOnlineLogon
{
DbgPrintf("XOnline (0x%X): EmuXOnlineLogon\n"
"(\n"
DbgFuncArgs(
" pUsers : 0x%.08X\n"
" pdwServiceIDs : 0x%.08X\n"
" dwServices : 0x%.08X\n"
" hEvent : 0x%.08X\n"
" pHandle : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pUsers, pdwServiceIDs, dwServices, hEvent, pHandle);
" pHandle : 0x%.08X\n",
pUsers, pdwServiceIDs, dwServices, hEvent, pHandle);
// TODO: What will it take to log on to Xbox Live?

View File

@ -70,12 +70,10 @@ HRESULT WINAPI XTL::EmuXACTEngineCreate
{
DbgPrintf("EmuXactEng (0x%X): EmuXACTEngineCreate\n"
"(\n"
DbgFuncArgs(
" pParams : 0x%.08X\n"
" ppEngine : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pParams, ppEngine);
" ppEngine : 0x%.08X\n",
pParams, ppEngine);
// TODO: Any other form of initialization?
@ -93,7 +91,7 @@ void WINAPI XTL::EmuXACTEngineDoWork()
{
DbgPrintf("EmuXactEng (0x%X): EmuXACTEngineCreate()\n", GetCurrentThreadId() );
DbgFuncArgs();
// TODO: Anything else required here?
// AFAIK, this function just calls DirectSoundDoWork()
@ -118,14 +116,12 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterWaveBank
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterWaveBank\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pvData : 0x%.08X\n"
" dwSize : 0x%.08X\n"
" ppWaveBank : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pvData, dwSize, ppWaveBank);
" ppWaveBank : 0x%.08X\n",
pThis, pvData, dwSize, ppWaveBank);
// TODO: Implement
@ -148,13 +144,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterStreamedWaveBank
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterWaveBank\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pParams : 0x%.08X\n"
" ppWaveBank : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pParams, ppWaveBank);
" ppWaveBank : 0x%.08X\n",
pThis, pParams, ppWaveBank);
// TODO: Implement
@ -178,14 +172,12 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CreateSoundBank
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CreateSoundBank\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pvData : 0x%.08X\n"
" dwSize : 0x%.08X\n"
" ppSoundBank : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pvData, dwSize, ppSoundBank);
" ppSoundBank : 0x%.08X\n",
pThis, pvData, dwSize, ppSoundBank);
// TODO: Implement
@ -210,15 +202,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_DownloadEffectsImage
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_DownloadEffectsImage\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pvData : 0x%.08X\n"
" dwSize : 0x%.08X\n"
" pEffectLoc : 0x%.08X\n"
" ppImageDesc : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pvData, dwSize, pEffectLoc, ppImageDesc);
" ppImageDesc : 0x%.08X\n",
pThis, pvData, dwSize, pEffectLoc, ppImageDesc);
// TODO: Implement
@ -239,13 +229,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CreateSoundSource
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CreateSoundSource\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" dwFlags : 0x%.08X\n"
" ppSoundSource : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, dwFlags, ppSoundSource);
" ppSoundSource : 0x%.08X\n",
pThis, dwFlags, ppSoundSource);
*ppSoundSource = (X_XACTSoundSource*) CxbxMalloc( sizeof( X_XACTSoundSource ) );
@ -265,12 +253,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_EnableHeadphones
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_EnableHeadphones\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" fEnabled : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, fEnabled);
" fEnabled : 0x%.08X\n",
pThis, fEnabled);
@ -294,8 +280,7 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerOrientation
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerOrientation\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" xFront : %f"
" yFront : %f"
@ -303,9 +288,8 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerOrientation
" xTop : %f"
" yTop : %f"
" zTop : %f"
" dwApply : 0x%.08X"
");\n",
GetCurrentThreadId(), pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
" dwApply : 0x%.08X",
pThis, xFront, yFront, zFront, xTop, yTop, zTop, dwApply);
@ -326,15 +310,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerPosition
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerPosition\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" x : %f"
" y : %f"
" z : %f"
" dwApply : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, x, y, z, dwApply);
" dwApply : 0x%.08X\n",
pThis, x, y, z, dwApply);
@ -355,15 +337,13 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetListenerVelocity
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetListenerVelocity\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" x : %f"
" y : %f"
" z : %f"
" dwApply : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, x, y, z, dwApply);
" dwApply : 0x%.08X\n",
pThis, x, y, z, dwApply);
@ -382,13 +362,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_SetMasterVolume
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_SetMasterVolume\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" wCategory : 0x%.08X\n"
" lVolume : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, wCategory, lVolume);
" lVolume : 0x%.08X\n",
pThis, wCategory, lVolume);
@ -402,11 +380,9 @@ HRESULT WINAPI XTL::EmuIXACTEngine_CommitDeferredSettings(X_XACTEngine* pThis)
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_CommitDeferredSettings\n"
"(\n"
" pThis : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis);
DbgFuncArgs(
" pThis : 0x%.08X\n",
pThis);
@ -425,13 +401,11 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_GetSoundCueIndexFromFriendlyName\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pFriendlyName : (%s)\n"
" pdwSoundCueIndex : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pFriendlyName, pdwSoundCueIndex);
" pdwSoundCueIndex : 0x%.08X\n",
pThis, pFriendlyName, pdwSoundCueIndex);
@ -452,15 +426,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_Play
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_Play\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" dwSoundCueIndex : 0x%.08X\n"
" pSoundSource : 0x%.08X\n"
" dwFlags : 0x%.08X\n"
" ppSoundCue : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, dwSoundCueIndex, pSoundSource, dwFlags, ppSoundCue);
" ppSoundCue : 0x%.08X\n",
pThis, dwSoundCueIndex, pSoundSource, dwFlags, ppSoundCue);
@ -480,14 +452,12 @@ HRESULT WINAPI XTL::EmuIXACTSoundBank_Stop
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundBank_Stop\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" dwSoundCueIndex : 0x%.08X\n"
" dwFlags : 0x%.08X\n"
" pSoundCue : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, dwSoundCueIndex, dwFlags, pSoundCue);
" pSoundCue : 0x%.08X\n",
pThis, dwSoundCueIndex, dwFlags, pSoundCue);
@ -508,15 +478,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundSource_SetPosition
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundSource_SetPosition\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" x : %f\n"
" y : %f\n"
" z : %f\n"
" dwApply : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, x, y, z, dwApply);
" dwApply : 0x%.08X\n",
pThis, x, y, z, dwApply);
@ -537,15 +505,13 @@ HRESULT WINAPI XTL::EmuIXACTSoundSource_SetVelocity
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTSoundSource_SetVelocity\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" x : %f\n"
" y : %f\n"
" z : %f\n"
" dwApply : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, x, y, z, dwApply);
" dwApply : 0x%.08X\n",
pThis, x, y, z, dwApply);
@ -563,12 +529,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_RegisterNotification
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_RegisterNotification\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pNotificationDesc : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pNotificationDesc);
" pNotificationDesc : 0x%.08X\n",
pThis, pNotificationDesc);
@ -587,13 +551,11 @@ HRESULT WINAPI XTL::EmuIXACTEngine_GetNotification
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_GetNotification\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pNotificationDesc : 0x%.08X\n"
" pNotification : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pNotificationDesc, pNotification);
" pNotification : 0x%.08X\n",
pThis, pNotificationDesc, pNotification);
// TODO: The contents of XACT_NOTIFICATION can vary from one XDK to the next.
// The definition for 4627 is different than 5558.
@ -614,12 +576,10 @@ HRESULT WINAPI XTL::EmuIXACTEngine_UnRegisterWaveBank
{
DbgPrintf("EmuXactEng (0x%X): EmuIXACTEngine_UnRegisterWaveBank\n"
"(\n"
DbgFuncArgs(
" pThis : 0x%.08X\n"
" pWaveBank : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis, pWaveBank);
" pWaveBank : 0x%.08X\n",
pThis, pWaveBank);
// Even though the documentation doesn't tell us much, I'm
// assuming that after this function is called, the pointer

View File

@ -84,11 +84,7 @@ XTL::LAUNCH_DATA g_SavedLaunchData;
// ******************************************************************
BOOL WINAPI XTL::EmuXFormatUtilityDrive()
{
#ifdef _DEBUG_TRACE
DbgPrintf("EmuXapi (0x%X): EmuXFormatUtilityDrive()\n", GetCurrentThreadId());
#endif
DbgFuncArgs();
// TODO: yeah... we'll format... riiiiight
@ -105,11 +101,9 @@ DWORD WINAPI XTL::EmuGetTimeZoneInformation
{
DbgPrintf("EmuXapi (0x%X): EmuGetTimeZoneInformation\n"
"(\n"
" lpTimeZoneInformation : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpTimeZoneInformation);
DbgFuncArgs(
" lpTimeZoneInformation : 0x%.08X\n",
lpTimeZoneInformation);
DWORD dwRet = GetTimeZoneInformation(lpTimeZoneInformation);
@ -128,11 +122,9 @@ BOOL WINAPI XTL::EmuQueryPerformanceCounter
{
DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceCounter\n"
"(\n"
" lpPerformanceCount : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpPerformanceCount);
DbgFuncArgs(
" lpPerformanceCount : 0x%.08X\n",
lpPerformanceCount);
BOOL bRet = QueryPerformanceCounter(lpPerformanceCount);
@ -154,11 +146,9 @@ BOOL WINAPI XTL::EmuQueryPerformanceFrequency
{
DbgPrintf("EmuXapi (0x%X): EmuQueryPerformanceFrequency\n"
"(\n"
" lpFrequency : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpFrequency);
DbgFuncArgs(
" lpFrequency : 0x%.08X\n",
lpFrequency);
BOOL bRet = QueryPerformanceFrequency(lpFrequency);
@ -175,17 +165,9 @@ BOOL WINAPI XTL::EmuXMountUtilityDrive
BOOL fFormatClean
)
{
#ifdef _DEBUG_TRACE
{
DbgPrintf("EmuXapi (0x%X): EmuXMountUtilityDrive\n"
"(\n"
" fFormatClean : 0x%.08X\n"
");\n",
GetCurrentThreadId(), fFormatClean);
}
#endif
DbgFuncArgs(
" fFormatClean : 0x%.08X\n",
fFormatClean);
CxbxMountUtilityDrive(fFormatClean);
@ -203,12 +185,10 @@ VOID WINAPI XTL::EmuXInitDevices
{
DbgPrintf("EmuXapi (0x%X): EmuXInitDevices\n"
"(\n"
DbgFuncArgs(
" dwPreallocTypeCount : 0x%.08X\n"
" PreallocTypes : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwPreallocTypeCount, PreallocTypes);
" PreallocTypes : 0x%.08X\n",
dwPreallocTypeCount, PreallocTypes);
/*for( DWORD i = 0; i < dwPreallocTypeCount; i++ )
{
@ -247,11 +227,9 @@ DWORD WINAPI XTL::EmuXGetDevices
{
DbgPrintf("EmuXapi (0x%X): EmuXGetDevices\n"
"(\n"
" DeviceType : 0x%.08X\n"
");\n",
GetCurrentThreadId(), DeviceType);
DbgFuncArgs(
" DeviceType : 0x%.08X\n",
DeviceType);
DWORD ret = 0;
@ -277,13 +255,11 @@ BOOL WINAPI XTL::EmuXGetDeviceChanges
{
DbgPrintf("EmuXapi (0x%X): EmuXGetDeviceChanges\n"
"(\n"
DbgFuncArgs(
" DeviceType : 0x%.08X\n"
" pdwInsertions : 0x%.08X\n"
" pdwRemovals : 0x%.08X\n"
");\n",
GetCurrentThreadId(), DeviceType, pdwInsertions, pdwRemovals);
" pdwRemovals : 0x%.08X\n",
DeviceType, pdwInsertions, pdwRemovals);
BOOL bRet = FALSE;
static BOOL bFirst = TRUE;
@ -328,14 +304,12 @@ HANDLE WINAPI XTL::EmuXInputOpen
{
DbgPrintf("EmuXapi (0x%X): EmuXInputOpen\n"
"(\n"
DbgFuncArgs(
" DeviceType : 0x%.08X\n"
" dwPort : 0x%.08X\n"
" dwSlot : 0x%.08X\n"
" pPollingParameters : 0x%.08X\n"
");\n",
GetCurrentThreadId(), DeviceType, dwPort, dwSlot, pPollingParameters);
" pPollingParameters : 0x%.08X\n",
DeviceType, dwPort, dwSlot, pPollingParameters);
POLLING_PARAMETERS_HANDLE *pph = 0;
@ -402,11 +376,9 @@ VOID WINAPI XTL::EmuXInputClose
{
DbgPrintf("EmuXapi (0x%X): EmuXInputClose\n"
"(\n"
" hDevice : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice);
DbgFuncArgs(
" hDevice : 0x%.08X\n",
hDevice);
POLLING_PARAMETERS_HANDLE *pph = (POLLING_PARAMETERS_HANDLE*)hDevice;
@ -450,11 +422,9 @@ DWORD WINAPI XTL::EmuXInputPoll
{
DbgPrintf("EmuXapi (0x%X): EmuXInputPoll\n"
"(\n"
" hDevice : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice);
DbgFuncArgs(
" hDevice : 0x%.08X\n",
hDevice);
POLLING_PARAMETERS_HANDLE *pph = (POLLING_PARAMETERS_HANDLE*)hDevice;
@ -511,12 +481,10 @@ DWORD WINAPI XTL::EmuXInputGetCapabilities
{
DbgPrintf("EmuXapi (0x%X): EmuXInputGetCapabilities\n"
"(\n"
DbgFuncArgs(
" hDevice : 0x%.08X\n"
" pCapabilities : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice, pCapabilities);
" pCapabilities : 0x%.08X\n",
hDevice, pCapabilities);
DWORD ret = ERROR_INVALID_HANDLE;
@ -552,12 +520,10 @@ DWORD WINAPI XTL::EmuXInputGetState
{
DbgPrintf("EmuXapi (0x%X): EmuXInputGetState\n"
"(\n"
DbgFuncArgs(
" hDevice : 0x%.08X\n"
" pState : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice, pState);
" pState : 0x%.08X\n",
hDevice, pState);
DWORD ret = ERROR_INVALID_HANDLE;
@ -610,12 +576,10 @@ DWORD WINAPI XTL::EmuXInputSetState
{
DbgPrintf("EmuXapi (0x%X): EmuXInputSetState\n"
"(\n"
DbgFuncArgs(
" hDevice : 0x%.08X\n"
" pFeedback : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice, pFeedback);
" pFeedback : 0x%.08X\n",
hDevice, pFeedback);
DWORD ret = ERROR_IO_PENDING;
@ -693,12 +657,10 @@ BOOL WINAPI XTL::EmuSetThreadPriorityBoost
{
DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriorityBoost\n"
"(\n"
DbgFuncArgs(
" hThread : 0x%.08X\n"
" DisablePriorityBoost: 0x%.08X\n"
");\n",
GetCurrentThreadId(), hThread, DisablePriorityBoost);
" DisablePriorityBoost: 0x%.08X\n",
hThread, DisablePriorityBoost);
BOOL bRet = SetThreadPriorityBoost(hThread, DisablePriorityBoost);
@ -721,12 +683,10 @@ BOOL WINAPI XTL::EmuSetThreadPriority
{
DbgPrintf("EmuXapi (0x%X): EmuSetThreadPriority\n"
"(\n"
DbgFuncArgs(
" hThread : 0x%.08X\n"
" nPriority : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hThread, nPriority);
" nPriority : 0x%.08X\n",
hThread, nPriority);
BOOL bRet = SetThreadPriority(hThread, nPriority);
@ -749,11 +709,9 @@ int WINAPI XTL::EmuGetThreadPriority
{
DbgPrintf("EmuXapi (0x%X): EmuGetThreadPriority\n"
"(\n"
" hThread : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hThread);
DbgFuncArgs(
" hThread : 0x%.08X\n",
hThread);
int iRet = GetThreadPriority(hThread);
@ -776,12 +734,10 @@ BOOL WINAPI XTL::EmuGetExitCodeThread
{
DbgPrintf("EmuXapi (0x%X): EmuGetExitCodeThread\n"
"(\n"
DbgFuncArgs(
" hThread : 0x%.08X\n"
" lpExitCode : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hThread, lpExitCode);
" lpExitCode : 0x%.08X\n",
hThread, lpExitCode);
BOOL bRet = GetExitCodeThread(hThread, lpExitCode);
@ -801,12 +757,10 @@ VOID WINAPI XTL::EmuXapiThreadStartup
{
DbgPrintf("EmuXapi (0x%X): EmuXapiThreadStartup\n"
"(\n"
DbgFuncArgs(
" dwDummy1 : 0x%.08X\n"
" dwDummy2 : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwDummy1, dwDummy2);
" dwDummy2 : 0x%.08X\n",
dwDummy1, dwDummy2);
@ -842,12 +796,10 @@ VOID WINAPI XTL::EmuXRegisterThreadNotifyRoutine
{
DbgPrintf("EmuXapi (0x%X): EmuXRegisterThreadNotifyRoutine\n"
"(\n"
DbgFuncArgs(
" pThreadNotification : 0x%.08X (0x%.08X)\n"
" fRegister : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister);
" fRegister : 0x%.08X\n",
pThreadNotification, pThreadNotification->pfnNotifyRoutine, fRegister);
if(fRegister)
{
@ -898,13 +850,11 @@ DWORD WINAPI XTL::EmuQueueUserAPC
{
DbgPrintf("EmuXapi (0x%X): EmuQueueUserAPC\n"
"(\n"
DbgFuncArgs(
" pfnAPC : 0x%.08X\n"
" hThread : 0x%.08X\n"
" dwData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pfnAPC, hThread, dwData);
" dwData : 0x%.08X\n",
pfnAPC, hThread, dwData);
DWORD dwRet = 0;
@ -937,14 +887,12 @@ BOOL WINAPI XTL::EmuGetOverlappedResult
{
DbgPrintf("EmuXapi (0x%X): EmuGetOverlappedResult\n"
"(\n"
DbgFuncArgs(
" hFile : 0x%.08X\n"
" lpOverlapped : 0x%.08X\n"
" lpNumberOfBytesTransformed : 0x%.08X\n"
" bWait : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait);
" bWait : 0x%.08X\n",
hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait);
BOOL bRet = GetOverlappedResult( hFile, lpOverlapped, lpNumberOfBytesTransferred, bWait );
@ -967,12 +915,10 @@ DWORD WINAPI XTL::EmuXLaunchNewImage
{
DbgPrintf("EmuXapi (0x%X): EmuXLaunchNewImage\n"
"(\n"
DbgFuncArgs(
" lpTitlePath : 0x%.08X (%s)\n"
" pLaunchData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpTitlePath, lpTitlePath, pLaunchData);
" pLaunchData : 0x%.08X\n",
lpTitlePath, lpTitlePath, pLaunchData);
// If this function succeeds, it doesn't get a chance to return anything.
DWORD dwRet = ERROR_GEN_FAILURE;
@ -1052,12 +998,10 @@ DWORD WINAPI XTL::EmuXGetLaunchInfo
{
DbgPrintf("EmuXapi (0x%X): EmuXGetLaunchInfo\n"
"(\n"
DbgFuncArgs(
" pdwLaunchDataType : 0x%.08X\n"
" pLaunchData : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pdwLaunchDataType, pLaunchData);
" pLaunchData : 0x%.08X\n",
pdwLaunchDataType, pLaunchData);
// The title was launched by turning on the Xbox console with the title disc already in the DVD drive
DWORD dwRet = ERROR_NOT_FOUND;
@ -1121,11 +1065,9 @@ VOID WINAPI XTL::EmuXSetProcessQuantumLength
{
DbgPrintf("EmuXapi (0x%X): EmuXSetProcessQuantumLength\n"
"(\n"
" dwMilliseconds : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwMilliseconds);
DbgFuncArgs(
" dwMilliseconds : 0x%.08X\n",
dwMilliseconds);
// TODO: Implement?
EmuWarning("XSetProcessQuantumLength is being ignored!");
@ -1140,7 +1082,7 @@ DWORD WINAPI XTL::EmuXGetFileCacheSize()
{
DbgPrintf("EmuXapi (0x%X): EmuXGetFileCacheSize()\n", GetCurrentThreadId());
DbgFuncArgs();
// Return the default cache size for now.
// TODO: Save the file cache size if/when set.
@ -1164,14 +1106,12 @@ DWORD WINAPI XTL::EmuSignalObjectAndWait
{
DbgPrintf("EmuXapi (0x%X): EmuSignalObjectAndWait\n"
"(\n"
DbgFuncArgs(
" hObjectToSignal : 0x%.08X\n"
" hObjectToWaitOn : 0x%.08X\n"
" dwMilliseconds : 0x%.08X\n"
" bAlertable : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable);
" bAlertable : 0x%.08X\n",
hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable);
DWORD dwRet = SignalObjectAndWait( hObjectToSignal, hObjectToWaitOn, dwMilliseconds, bAlertable );
@ -1187,11 +1127,9 @@ BOOL WINAPI XTL::EmuPulseEvent( HANDLE hEvent )
{
DbgPrintf("EmuXapi (0x%X): EmuPulseEvent\n"
"(\n"
" hEvent : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hEvent);
DbgFuncArgs(
" hEvent : 0x%.08X\n",
hEvent);
// TODO: This function might be a bit too high level. If it is,
// feel free to implement NtPulseEvent in EmuKrnl.cpp
@ -1217,15 +1155,13 @@ MMRESULT WINAPI XTL::EmutimeSetEvent
{
DbgPrintf("EmuXapi (0x%X): EmutimeSetEvent\n"
"(\n"
DbgFuncArgs(
" uDelay : 0x%.08X\n"
" uResolution : 0x%.08X\n"
" fptc : 0x%.08X\n"
" dwUser : 0x%.08X\n"
" fuEvent : 0x%.08X\n"
");\n",
GetCurrentThreadId(), uDelay, uResolution, fptc, dwUser, fuEvent);
" fuEvent : 0x%.08X\n",
uDelay, uResolution, fptc, dwUser, fuEvent);
MMRESULT Ret = timeSetEvent( uDelay, uResolution, fptc, (DWORD_PTR) dwUser, fuEvent );
@ -1244,11 +1180,9 @@ MMRESULT WINAPI XTL::EmutimeKillEvent
{
DbgPrintf("EmuXapi (0x%X): EmuReleaseSemaphore\n"
"(\n"
" uTimerID : 0x%.08X\n"
");\n",
GetCurrentThreadId(), uTimerID);
DbgFuncArgs(
" uTimerID : 0x%.08X\n",
uTimerID);
MMRESULT Ret = timeKillEvent( uTimerID );
@ -1270,14 +1204,12 @@ VOID WINAPI XTL::EmuRaiseException
{
DbgPrintf("EmuXapi (0x%X): EmuRaiseException\n"
"(\n"
DbgFuncArgs(
" dwExceptionCode : 0x%.08X\n"
" dwExceptionFlags : 0x%.08X\n"
" nNumberOfArguments: 0x%.08X\n"
" lpArguments : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments);
" lpArguments : 0x%.08X\n",
dwExceptionCode, dwExceptionFlags, nNumberOfArguments, lpArguments);
// TODO: Implement or not?
// RaiseException(dwExceptionCode, dwExceptionFlags, nNumberOfArguments, (*(ULONG_PTR**) &lpArguments));
@ -1295,11 +1227,9 @@ DWORD WINAPI XTL::EmuGetFileAttributesA
{
DbgPrintf("EmuXapi (0x%X): EmuGetFileAttributesA\n"
"(\n"
" lpFileName : (%s)\n"
");\n",
GetCurrentThreadId(), lpFileName);
DbgFuncArgs(
" lpFileName : (%s)\n",
lpFileName);
// Dues Ex...
@ -1338,13 +1268,11 @@ DWORD WINAPI XTL::EmuXMountMUA
{
DbgPrintf("EmuXapi (0x%X): EmuXMountMUA\n"
"(\n"
DbgFuncArgs(
" dwPort : 0x%.08X\n"
" dwSlot : 0x%.08X\n"
" pchDrive : 0x%.08X (%s)\n"
");\n",
GetCurrentThreadId(), dwPort, dwSlot, pchDrive, pchDrive);
" pchDrive : 0x%.08X (%s)\n",
dwPort, dwSlot, pchDrive, pchDrive);
// TODO: Actually allow memory card emulation? This might make transferring
// game saves a bit easier if the memory card directory was configurable. =]
@ -1366,13 +1294,11 @@ HANDLE WINAPI XTL::EmuCreateWaitableTimerA
{
DbgPrintf("EmuXapi (0x%X): EmuCreateWaitableTimerA\n"
"(\n"
DbgFuncArgs(
" lpTimerAttributes : 0x%.08X\n"
" bManualReset : 0x%.08X\n"
" lpTimerName : 0x%.08X (%s)\n"
");\n",
GetCurrentThreadId(), lpTimerAttributes, bManualReset, lpTimerName, lpTimerName);
" lpTimerName : 0x%.08X (%s)\n",
lpTimerAttributes, bManualReset, lpTimerName, lpTimerName);
// For Xbox titles, this param should always be NULL.
if(lpTimerAttributes)
@ -1401,16 +1327,14 @@ BOOL WINAPI XTL::EmuSetWaitableTimer
DbgPrintf("EmuXapi (0x%X): EmuSetWaitableTimer\n"
"(\n"
DbgFuncArgs(
" hTimer : 0x%.08X\n"
" pDueTime : 0x%.08X\n"
" lPeriod : 0x%.08X\n"
" pfnCompletionRoutine : 0x%.08X\n"
" lpArgToCompletionRoutine : 0x%.08X\n"
" fResume : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hTimer, pDueTime, lPeriod, pfnCompletionRoutine,
" fResume : 0x%.08X\n",
hTimer, pDueTime, lPeriod, pfnCompletionRoutine,
lpArgToCompletionRoutine, fResume);
BOOL Ret = SetWaitableTimer( hTimer, pDueTime, lPeriod, pfnCompletionRoutine,
@ -1435,13 +1359,11 @@ DWORD WINAPI XTL::EmuXMountAlternateTitle
{
DbgPrintf("EmuXapi (0x%X): EmuXMountAlternateTitle\n"
"(\n"
DbgFuncArgs(
" lpRootPath : 0x%.08X (%s)\n"
" dwAltTitleId : 0x%.08X\n"
" pchDrive : 0x%.08X (%s)\n"
");\n",
GetCurrentThreadId(), lpRootPath, lpRootPath, dwAltTitleId, pchDrive, pchDrive);
" pchDrive : 0x%.08X (%s)\n",
lpRootPath, lpRootPath, dwAltTitleId, pchDrive, pchDrive);
// TODO: Anything?
@ -1457,11 +1379,9 @@ DWORD WINAPI XTL::EmuXUnmountAlternateTitle(CHAR chDrive)
{
DbgPrintf("EmuXapi (0x%X): EmuXUnmountAlternativeTitle\n"
"(\n"
" chDrive : 0x%.08X (%c)\n"
");\n",
GetCurrentThreadId(), chDrive, chDrive);
DbgFuncArgs(
" chDrive : 0x%.08X (%c)\n",
chDrive, chDrive);
@ -1475,7 +1395,7 @@ DWORD WINAPI XTL::EmuXGetDeviceEnumerationStatus()
{
DbgPrintf("EmuXapi (0x%X): EmuXGetDeviceEnumerationStatus()\n", GetCurrentThreadId());
DbgFuncArgs();
@ -1493,12 +1413,10 @@ DWORD WINAPI XTL::EmuXInputGetDeviceDescription
{
DbgPrintf("EmuXapi (0x%X): EmuXInputGetDeviceDescription\n"
"(\n"
DbgFuncArgs(
" hDevice : 0x%.08X\n"
" pDescription : 0x%.08X\n"
");\n",
GetCurrentThreadId(), hDevice, pDescription);
" pDescription : 0x%.08X\n",
hDevice, pDescription);
// TODO: Lightgun support?
@ -1514,8 +1432,8 @@ int WINAPI XTL::EmuXAutoPowerDownResetTimer()
{
DbgPrintf("EmuXapi (0x%X): EmuXAutoPowerDownResetTimer()\n",
GetCurrentThreadId());
DbgFuncArgs();
// Meh, that's what the 'X' is for! =]
@ -1537,13 +1455,11 @@ DWORD WINAPI XTL::EmuXMountMURootA
DbgPrintf("EmuXapi (0x%X): EmuXMountMURootA\n"
"(\n"
DbgFuncArgs(
" dwPort : 0x%.08X\n"
" dwSlot : 0x%.08X\n"
" pchDrive : 0x%.08X (%s)\n"
");\n",
GetCurrentThreadId(), dwPort, dwSlot, pchDrive, pchDrive);
" pchDrive : 0x%.08X (%s)\n",
dwPort, dwSlot, pchDrive, pchDrive);
// TODO: The params are probably wrong...