Replace DBG_PRINTF with EmuLog

This commit is contained in:
Anthony Miles 2019-06-07 23:26:26 +12:00
parent e97aecf278
commit 9a7ded6a53
30 changed files with 268 additions and 268 deletions

View File

@ -431,7 +431,7 @@ extern thread_local std::string _logThreadPrefix;
#define LOG_ONCE(msg, ...) { static bool bFirstTime = true; if(bFirstTime) { bFirstTime = false; DBG_PRINTF("TRAC: " ## msg, __VA_ARGS__); } }
#define LOG_XBOX_CALL(func) DBG_PRINTF("TRAC: Xbox " ## func ## "() call\n");
#define LOG_XBOX_CALL(func) EmuLog(LOG_LEVEL::DEBUG, "TRAC: Xbox " ## func ## "() call");
#define LOG_FIRST_XBOX_CALL(func) LOG_ONCE("First Xbox " ## func ## "() call\n");
//

View File

@ -122,7 +122,7 @@ namespace xbdm {
void DmSendNotificationString(LPCSTR sz)
{
// Just send this string to Cxbx's debug output :
DBG_PRINTF("%s\n", sz);
EmuLog(LOG_LEVEL::DEBUG, "%s", sz);
}
// 0x0025 (37)

View File

@ -1463,7 +1463,7 @@ static DWORD WINAPI EmuRenderWindow(LPVOID lpVoid)
}
}
DBG_PRINTF("Message-Pump thread is running.\n");
EmuLog(LOG_LEVEL::DEBUG, "Message-Pump thread is running.");
SetFocus(g_hEmuWindow);
@ -1742,7 +1742,7 @@ static DWORD WINAPI EmuUpdateTickCount(LPVOID)
// since callbacks come from here
InitXboxThread(g_CPUOthers); // avoid Xbox1 core for lowest possible latency
DBG_PRINTF("Timing thread is running.\n");
EmuLog(LOG_LEVEL::DEBUG, "Timing thread is running.");
// current vertical blank count
int curvb = 0;
@ -1861,18 +1861,18 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
CxbxSetThreadName("Cxbx CreateDevice Proxy");
DBG_PRINTF("CreateDevice proxy thread is running.\n");
EmuLog(LOG_LEVEL::DEBUG, "CreateDevice proxy thread is running.");
while(true)
{
// if we have been signalled, create the device with cached parameters
if(g_EmuCDPD.bReady)
{
DBG_PRINTF("CreateDevice proxy thread received request.\n");
EmuLog(LOG_LEVEL::DEBUG, "CreateDevice proxy thread received request.");
// only one device should be created at once
if (g_pD3DDevice != nullptr) {
DBG_PRINTF("CreateDevice proxy thread releasing old Device.\n");
EmuLog(LOG_LEVEL::DEBUG, "CreateDevice proxy thread releasing old Device.");
g_pD3DDevice->EndScene();
@ -1972,13 +1972,13 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
{
const char* resolution = g_XBVideo.szVideoResolution;
if (2 != sscanf(resolution, "%u x %u", &g_EmuCDPD.HostPresentationParameters.BackBufferWidth, &g_EmuCDPD.HostPresentationParameters.BackBufferHeight)) {
DBG_PRINTF("EmuCreateDeviceProxy: Couldn't parse resolution : %s.\n", resolution);
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Couldn't parse resolution : %s.", resolution);
}
else {
if (g_EmuCDPD.HostPresentationParameters.BackBufferWidth == 640)
DBG_PRINTF("EmuCreateDeviceProxy: Default width wasn't updated.\n");
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Default width wasn't updated.");
if (g_EmuCDPD.HostPresentationParameters.BackBufferWidth == 480)
DBG_PRINTF("EmuCreateDeviceProxy: Default height wasn't updated.\n");
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Default height wasn't updated.");
}
XTL::D3DDISPLAYMODE D3DDisplayMode;
@ -1998,13 +1998,13 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
&g_EmuCDPD.HostPresentationParameters.BackBufferHeight,
szBackBufferFormat,
&g_EmuCDPD.HostPresentationParameters.FullScreen_RefreshRateInHz)) {
DBG_PRINTF("EmuCreateDeviceProxy: Couldn't parse resolution : %s.\n", resolution);
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Couldn't parse resolution : %s.", resolution);
}
else {
if (g_EmuCDPD.HostPresentationParameters.BackBufferWidth == 640)
DBG_PRINTF("EmuCreateDeviceProxy: Default width wasn't updated.\n");
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Default width wasn't updated.");
if (g_EmuCDPD.HostPresentationParameters.BackBufferWidth == 480)
DBG_PRINTF("EmuCreateDeviceProxy: Default height wasn't updated.\n");
EmuLog(LOG_LEVEL::DEBUG, "EmuCreateDeviceProxy: Default height wasn't updated.");
}
if(strcmp(szBackBufferFormat, "x1r5g5b5") == 0)
@ -2021,14 +2021,14 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
// detect vertex processing capabilities
if((g_D3DCaps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT) && g_EmuCDPD.DeviceType == XTL::D3DDEVTYPE_HAL)
{
DBG_PRINTF("Using hardware vertex processing\n");
EmuLog(LOG_LEVEL::DEBUG, "Using hardware vertex processing");
g_EmuCDPD.BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING;
g_dwVertexShaderUsage = 0;
}
else
{
DBG_PRINTF("Using software vertex processing\n");
EmuLog(LOG_LEVEL::DEBUG, "Using software vertex processing");
g_EmuCDPD.BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING;
g_dwVertexShaderUsage = D3DUSAGE_SOFTWAREPROCESSING;
@ -2182,7 +2182,7 @@ static DWORD WINAPI EmuCreateDeviceProxy(LPVOID)
g_pDD7->GetFourCCCodes(&dwCodes, lpCodes);
for(DWORD v=0;v<dwCodes;v++)
{
DBG_PRINTF("FourCC[%d] = %.4s\n", v, (char *)&(lpCodes[v]));
EmuLog(LOG_LEVEL::DEBUG, "FourCC[%d] = %.4s", v, (char *)&(lpCodes[v]));
// Map known FourCC codes to Xbox Format
int X_Format;
switch (lpCodes[v]) {
@ -2393,7 +2393,7 @@ void CxbxUpdateActiveIndexBuffer
CxbxKrnlCleanup("CxbxUpdateActiveIndexBuffer: Could not lock index buffer!");
}
DBG_PRINTF("CxbxUpdateActiveIndexBuffer: Copying %d indices (D3DFMT_INDEX16)\n", IndexCount);
EmuLog(LOG_LEVEL::DEBUG, "CxbxUpdateActiveIndexBuffer: Copying %d indices (D3DFMT_INDEX16)", IndexCount);
memcpy(pData, pIndexData, IndexCount * sizeof(XTL::INDEX16));
indexBuffer.pHostIndexBuffer->Unlock();
@ -2776,7 +2776,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_LoadVertexShader_4)
// LOG_FUNC_ARG(Handle)
// LOG_FUNC_ARG(Address)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_LoadVertexShader_4(Handle : %d Address : %08x);\n", Handle, Address);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_LoadVertexShader_4(Handle : %d Address : %08x);", Handle, Address);
// Handle is always address of an Xbox VertexShader struct, or-ed with 1 (X_D3DFVF_RESERVED0)
// An Xbox VertexShader contains : a 'Vshd' signature, flags, a size, a program (and constants)
@ -3449,7 +3449,7 @@ HRESULT WINAPI XTL::EMUPATCH(D3DDevice_CreateVertexShader)
}
}
//DBG_PRINTF("MaxVertexShaderConst = %d\n", g_D3DCaps.MaxVertexShaderConst);
//EmuLog(LOG_LEVEL::DEBUG, "MaxVertexShaderConst = %d", g_D3DCaps.MaxVertexShaderConst);
if (SUCCEEDED(hRet) && pRecompiledFunction != nullptr)
{
@ -3728,7 +3728,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTexture_4)
// LOG_FUNC_ARG(Stage)
// LOG_FUNC_ARG(pTexture)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetTexture_4(Stage : %d pTexture : %08x);\n", Stage, pTexture);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetTexture_4(Stage : %d pTexture : %08x);", Stage, pTexture);
// Call the Xbox implementation of this function, to properly handle reference counting for us
//XB_trampoline(VOID, WINAPI, D3DDevice_SetTexture_4, (X_D3DBaseTexture*));
@ -3957,7 +3957,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetVertexData4f)
}
g_InlineVertexBuffer_Table = (struct _D3DIVB*)realloc(g_InlineVertexBuffer_Table, sizeof(struct _D3DIVB) * g_InlineVertexBuffer_TableLength);
DBG_PRINTF("Reallocated g_InlineVertexBuffer_Table to %d entries\n", g_InlineVertexBuffer_TableLength);
EmuLog(LOG_LEVEL::DEBUG, "Reallocated g_InlineVertexBuffer_Table to %d entries", g_InlineVertexBuffer_TableLength);
}
// Is this the initial call after D3DDevice_Begin() ?
@ -4733,7 +4733,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
DEBUG_D3DRESULT(hRet, "pHostParentTexture->GetSurfaceLevel");
if (hRet == D3D_OK) {
SetHostSurface(pXboxSurface, pNewHostSurface);
DBG_PRINTF("CreateHostResource : Successfully created surface level (%u, 0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created surface level (%u, 0x%.08X, 0x%.08X)",
SurfaceLevel, pResource, pNewHostSurface);
return;
}
@ -4758,7 +4758,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
DEBUG_D3DRESULT(hRet, "pParentHostVolumeTexture->GetVolumeLevel");
if (hRet == D3D_OK) {
SetHostVolume(pXboxVolume, pNewHostVolume);
DBG_PRINTF("CreateHostResource : Successfully created volume level (%u, 0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created volume level (%u, 0x%.08X, 0x%.08X)",
VolumeLevel, pResource, pNewHostVolume);
return;
}
@ -5007,9 +5007,9 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
}
SetHostSurface(pResource, pNewHostSurface);
DBG_PRINTF("CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)",
ResourceTypeName, pResource, pNewHostSurface);
DBG_PRINTF("CreateHostResource : Width : %d, Height : %d, Format : %d\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Width : %d, Height : %d, Format : %d",
dwWidth, dwHeight, PCFormat);
break;
}
@ -5022,7 +5022,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
// and retrieve and convert all of it's GetVolumeLevel() slices.
pNewHostVolume = nullptr;
// SetHostVolume(pResource, pNewHostVolume);
// DBG_PRINTF("CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)\n",
// EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)",
// ResourceTypeName, pResource, pNewHostVolume);
break;
}
@ -5076,7 +5076,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
}
SetHostTexture(pResource, pNewHostTexture);
DBG_PRINTF("CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)",
ResourceTypeName, pResource, pNewHostTexture);
break;
}
@ -5094,13 +5094,13 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
}
SetHostVolumeTexture(pResource, pNewHostVolumeTexture);
DBG_PRINTF("CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)",
ResourceTypeName, pResource, pNewHostVolumeTexture);
break;
}
case XTL::X_D3DRTYPE_CUBETEXTURE: {
DBG_PRINTF("CreateCubeTexture(%d, %d, 0, %d, D3DPOOL_MANAGED)\n", dwWidth,
EmuLog(LOG_LEVEL::DEBUG, "CreateCubeTexture(%d, %d, 0, %d, D3DPOOL_MANAGED)", dwWidth,
dwMipMapLevels, PCFormat);
hRet = g_pD3DDevice->CreateCubeTexture(dwWidth, dwMipMapLevels, D3DUsage,
@ -5118,7 +5118,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
// TODO : Because cube face surfaces can be used as a render-target,
// we should call SetHostSurface() on all 6 faces, so that when Xbox
// code accesses a face, the host counterpart is already registered!
DBG_PRINTF("CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)\n",
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %s (0x%.08X, 0x%.08X)",
ResourceTypeName, pResource, pNewHostCubeTexture);
break;
}
@ -5204,7 +5204,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
// Do we need to convert to ARGB?
if (bConvertToARGB) {
DBG_PRINTF("Unsupported texture format, expanding to D3DFMT_A8R8G8B8\n");
EmuLog(LOG_LEVEL::DEBUG, "Unsupported texture format, expanding to D3DFMT_A8R8G8B8");
// Convert a row at a time, using a libyuv-like callback approach :
if (!ConvertD3DTextureToARGBBuffer(
@ -5371,7 +5371,7 @@ void CreateHostResource(XTL::X_D3DResource *pResource, DWORD D3DUsage, int iText
break;
}
DBG_PRINTF("CreateHostResource : Successfully created %S (0x%.08X, 0x%.08X, 0x%.08X)\n", ResourceTypeName, pResource->Data, pPushBuffer->Size, pPushBuffer->AllocationSize);
EmuLog(LOG_LEVEL::DEBUG, "CreateHostResource : Successfully created %S (0x%.08X, 0x%.08X, 0x%.08X)", ResourceTypeName, pResource->Data, pPushBuffer->Size, pPushBuffer->AllocationSize);
break;
}
@ -5706,7 +5706,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTextureState_BorderColor_4)
// LOG_FUNC_ARG(Stage)
// LOG_FUNC_ARG(Value)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetTextureState_BorderColor_4(Stage : %d Value : %d);\n", Stage, Value);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetTextureState_BorderColor_4(Stage : %d Value : %d);", Stage, Value);
HRESULT hRet;
hRet = g_pD3DDevice->SetSamplerState(Stage, D3DSAMP_BORDERCOLOR, Value);
@ -5804,7 +5804,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)
// LOG_FUNC_ARG(Type)
// LOG_FUNC_ARG(Value)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetTextureState_BumpEnv_8(Stage : %d Type : %d Value : %d);\n", Stage, Type, Value);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetTextureState_BumpEnv_8(Stage : %d Type : %d Value : %d);", Stage, Type, Value);
HRESULT hRet = D3D_OK;
@ -6717,7 +6717,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetStreamSource_4)
// LOG_FUNC_ARG(pStreamData)
// LOG_FUNC_ARG(Stride)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetStreamSource_4(StreamNumber : %08X pStreamData : %08X Stride : %08X);\n", StreamNumber, pStreamData, Stride);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetStreamSource_4(StreamNumber : %08X pStreamData : %08X Stride : %08X);", StreamNumber, pStreamData, Stride);
// Forward to Xbox implementation
// This should stop us having to patch GetStreamSource!
@ -6750,7 +6750,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetStreamSource_8)
// LOG_FUNC_ARG(pStreamData)
// LOG_FUNC_ARG(Stride)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetStreamSource_8(StreamNumber : %08X pStreamData : %08X Stride : %08X);\n", StreamNumber, pStreamData, Stride);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetStreamSource_8(StreamNumber : %08X pStreamData : %08X Stride : %08X);", StreamNumber, pStreamData, Stride);
// Forward to Xbox implementation
// This should stop us having to patch GetStreamSource!
@ -7261,7 +7261,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetPixelShader_0)
//LOG_FUNC_ONE_ARG(Handle);
DBG_PRINTF("D3DDevice_SetPixelShader_0(Handle : %d);\n", Handle);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetPixelShader_0(Handle : %d);", Handle);
// Call the Xbox function to make sure D3D structures get set
//XB_trampoline(VOID, WINAPI, D3DDevice_SetPixelShader_0, ());
@ -9081,7 +9081,7 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetPixelShaderConstant_4)
// LOG_FUNC_ARG(pConstantData)
// LOG_FUNC_ARG(ConstantCount)
// LOG_FUNC_END;
DBG_PRINTF("D3DDevice_SetPixelShaderConstant_4(Register : %d pConstantData : %08X ConstantCount : %d);\n", Register, pConstantData, ConstantCount);
EmuLog(LOG_LEVEL::DEBUG, "D3DDevice_SetPixelShaderConstant_4(Register : %d pConstantData : %08X ConstantCount : %d);", Register, pConstantData, ConstantCount);
// TODO: This hack is necessary for Vertex Shaders on XDKs prior to 4361, but if this
// causes problems with pixel shaders, feel free to comment out the hack below.

View File

@ -1030,7 +1030,7 @@ XTL::D3DFORMAT XTL::EmuXB2PC_D3DFormat(X_D3DFORMAT Format)
{
const FormatInfo *info = &FormatInfos[Format];
if (info->warning != nullptr) {
DBG_PRINTF("EmuXB2PC_D3DFormat %s\n", info->warning);
EmuLog(LOG_LEVEL::DEBUG, "EmuXB2PC_D3DFormat %s", info->warning);
}
return info->pc;

View File

@ -1602,7 +1602,7 @@ bool PSH_IMD_ARGUMENT::Decode(const DWORD Value, DWORD aMask, TArgumentType Argu
Type = PARAM_EF_PROD;
break;
default :
DBG_PRINTF("INVALID ARGUMENT!\n");
EmuLog(LOG_LEVEL::DEBUG, "INVALID ARGUMENT!");
Result = false;
}
@ -2250,8 +2250,8 @@ void PSH_XBOX_SHADER::Log(const char *PhaseStr)
{
//if (MayLog(lfUnit))
{
DBG_PRINTF("New decoding - %s :\n", PhaseStr);
DBG_PRINTF("%s\n", ToString().c_str());
EmuLog(LOG_LEVEL::DEBUG, "New decoding - %s :", PhaseStr);
EmuLog(LOG_LEVEL::DEBUG, "%s", ToString().c_str());
}
}
@ -2450,7 +2450,7 @@ PSH_RECOMPILED_SHADER PSH_XBOX_SHADER::Decode(XTL::X_D3DPIXELSHADERDEF *pPSDef)
//if (MayLog(LogFlags))
{
// print relevant contents to the debug console
DBG_PRINTF("%s\n", DecodedToString(pPSDef).c_str());
EmuLog(LOG_LEVEL::DEBUG, "%s", DecodedToString(pPSDef).c_str());
}
// TODO:
@ -3702,7 +3702,7 @@ bool PSH_XBOX_SHADER::RemoveUselessWrites()
if ( (CurArg->Address < MaxTemporaryRegisters)
&& ((RegUsage[CurArg->Type][CurArg->Address] & CurArg->Mask) == 0))
{
DBG_PRINTF("; Removed useless assignment to register %s\n", CurArg->ToString().c_str());
EmuLog(LOG_LEVEL::DEBUG, "; Removed useless assignment to register %s", CurArg->ToString().c_str());
CurArg->Type = PARAM_DISCARD;
Result = true;
}
@ -3999,7 +3999,7 @@ void PSH_XBOX_SHADER::ConvertXFCToNative(int i)
InsertIntermediate(&Ins, InsertPos);
++InsertPos;
DBG_PRINTF("; Inserted final combiner calculation of V1R0_sum register\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted final combiner calculation of V1R0_sum register");
}
if (NeedsProd)
@ -4011,7 +4011,7 @@ void PSH_XBOX_SHADER::ConvertXFCToNative(int i)
Ins.Parameters[1] = Cur.Parameters[5]; // F
InsertIntermediate(&Ins, InsertPos);
++InsertPos;
DBG_PRINTF("; Inserted final combiner calculation of EF_prod register\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted final combiner calculation of EF_prod register");
}
// The final combiner calculates : r0.rgb=s0*s1 + (1-s0)*s2 + s3
@ -4461,7 +4461,7 @@ bool PSH_XBOX_SHADER::FixArgumentModifiers()
InsertIntermediate(&Ins, InsertPos);
++InsertPos;
++Cur;
DBG_PRINTF("; Used intermediate move to avoid argument modifier\n");
EmuLog(LOG_LEVEL::DEBUG, "; Used intermediate move to avoid argument modifier");
Result = true;
}
}
@ -4483,7 +4483,7 @@ bool PSH_XBOX_SHADER::FixArgumentModifiers()
Ins.CommentString = "Inserted to avoid constant modifier (applied below on register)";
InsertIntermediate(&Ins, InsertPos);
++InsertPos;
DBG_PRINTF("; Used intermediate move to avoid constant modifier\n");
EmuLog(LOG_LEVEL::DEBUG, "; Used intermediate move to avoid constant modifier");
Result = true;
}
}
@ -4519,7 +4519,7 @@ bool PSH_XBOX_SHADER::FixConstantParameters()
if (Cur->Parameters[p].SetScaleConstRegister(Cur->Parameters[p].GetConstValue(), Recompiled))
{
DBG_PRINTF("; Replaced constant value with constant register\n");
EmuLog(LOG_LEVEL::DEBUG, "; Replaced constant value with constant register");
Result = true;
}
}
@ -4559,7 +4559,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(0.5f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_bias";
DBG_PRINTF("; Inserted adjustment by constant register for INST_bias\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_bias");
break;
}
case INSMOD_X2: // y = x * 2
@ -4573,7 +4573,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(2.0f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_x2";
DBG_PRINTF("; Inserted adjustment by constant register for INST_x2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_x2");
break;
}
case INSMOD_BX2: // y = (x - 0.5) * 2 // Xbox only : TODO : Fixup occurrances!
@ -4583,7 +4583,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Parameters[1].SetScaleConstRegister(2.0f, Recompiled);
Ins.Parameters[2].SetScaleConstRegister(-1.0f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_bx2";
DBG_PRINTF("; Inserted adjustment by constant register for INST_bx2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_bx2");
break;
}
case INSMOD_X4: // y = x * 4
@ -4597,7 +4597,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(4.0f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_x4";
DBG_PRINTF("; Inserted adjustment by constant register for INST_x4\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_x4");
break;
}
case INSMOD_D2: // y = x * 0.5
@ -4611,7 +4611,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(0.5f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_d2";
DBG_PRINTF("; Inserted adjustment by constant register for INST_d2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_d2");
break;
}
case INSMOD_X8: // y = x * 8 // ps 1.4 only
@ -4625,7 +4625,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(8.0f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_x8";
DBG_PRINTF("; Inserted adjustment by constant register for INST_x8\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_x8");
break;
}
case INSMOD_D4: // y = x * 0.25 // ps 1.4 only
@ -4639,7 +4639,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(0.25f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_d4";
DBG_PRINTF("; Inserted adjustment by constant register for INST_d4\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_d4");
break;
}
case INSMOD_D8: // y = x * 0.125 // ps 1.4 only
@ -4653,7 +4653,7 @@ bool PSH_XBOX_SHADER::FixInstructionModifiers()
Ins.Output[0] = Ins.Parameters[0] = Cur->Output[0];
Ins.Parameters[1].SetScaleConstRegister(0.125f, Recompiled);
Ins.CommentString = "; Inserted adjustment by constant register for INST_d8";
DBG_PRINTF("; Inserted adjustment by constant register for INST_d8\n");
EmuLog(LOG_LEVEL::DEBUG, "; Inserted adjustment by constant register for INST_d8");
break;
}
case INSMOD_SAT: // Xbox doesn"t support this, but has ARGMOD_SATURATE instead
@ -4772,7 +4772,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op2->Parameters[2] = Op1->Parameters[0];
DeleteIntermediate(i);
DeleteIntermediate(i);
DBG_PRINTF("; Changed temporary MUL,MUL,CND via MOV,MOV,CND into a single CND\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MUL,CND via MOV,MOV,CND into a single CND");
Result = true;
continue;
}
@ -4797,7 +4797,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op2->Modifier = Op0->Modifier;
DeleteIntermediate(i);
DeleteIntermediate(i);
DBG_PRINTF("; Changed temporary MUL,MUL,ADD into a single LRP\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MUL,ADD into a single LRP");
Result = true;
continue;
}
@ -4814,7 +4814,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op2->Modifier = Op0->Modifier;
DeleteIntermediate(i);
DeleteIntermediate(i);
DBG_PRINTF("; Changed temporary MUL,MUL,ADD into a single MAD\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MUL,ADD into a single MAD");
Result = true;
continue;
}
@ -4829,7 +4829,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op1->Parameters[2] = Op0->Output[0];
// Remove the trailing ADD :
DeleteIntermediate(i+2);
DBG_PRINTF("; Changed temporary MUL,MUL,ADD into a MUL,MAD\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MUL,ADD into a MUL,MAD");
Result = true;
continue;
}
@ -4846,7 +4846,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op2->Parameters[1] = Op1->Parameters[0];
DeleteIntermediate(i);
DeleteIntermediate(i);
DBG_PRINTF("; Changed temporary MUL,MUL,ADD into a MUL\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MUL,ADD into a MUL");
Result = true;
continue;
}
@ -4871,7 +4871,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
Op0->Opcode = PO_MAD;
Op0->Parameters[2] = Op1->Parameters[1];
DeleteIntermediate(i+1);
DBG_PRINTF("; Changed MUL,ADD into a single MAD\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MUL,ADD into a single MAD");
Result = true;
continue;
}
@ -4956,7 +4956,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
if (CanOptimize)
{
DeleteIntermediate(i);
DBG_PRINTF("; Moved MOV input into following instructions\n");
EmuLog(LOG_LEVEL::DEBUG, "; Moved MOV input into following instructions");
Result = true;
}
}
@ -4976,7 +4976,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
// > mul r0.rgb, r0,t0
Op0->Output[0] = Op1->Output[0];
DeleteIntermediate(i+1);
DBG_PRINTF("; Changed temporary MUL,MOV into a MUL\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed temporary MUL,MOV into a MUL");
Result = true;
continue;
}
@ -4989,7 +4989,7 @@ bool PSH_XBOX_SHADER::CombineInstructions()
if (IsRegisterFreeFromIndexOnwards(i, PARAM_R, 1))
{
ReplaceRegisterFromIndexOnwards(i, Op0->Output[0].Type, Op0->Output[0].Address, PARAM_R, 1);
DBG_PRINTF("; Changed fake register by r1\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed fake register by r1");
Result = true;
continue;
}
@ -5017,7 +5017,7 @@ bool PSH_XBOX_SHADER::SimplifyMOV(PPSH_INTERMEDIATE_FORMAT Cur)
if (CanSimplify)
{
Cur->Opcode = PO_NOP; // This nop will be removed in a recursive fixup
DBG_PRINTF("; Changed MOV into a NOP\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MOV into a NOP");
return true;
}
}
@ -5035,11 +5035,11 @@ bool PSH_XBOX_SHADER::SimplifyMOV(PPSH_INTERMEDIATE_FORMAT Cur)
Cur->Parameters[0].Address = 0;
Cur->Parameters[0].Modifiers = 0;
Cur->Parameters[1] = Cur->Parameters[0];
DBG_PRINTF("; Changed MOV 0 into a SUB v0,v0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MOV 0 into a SUB v0,v0");
}
else
{
DBG_PRINTF("; Changed MOV 0 into a MOV c0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MOV 0 into a MOV c0");
}
return true;
@ -5080,11 +5080,11 @@ bool PSH_XBOX_SHADER::SimplifyMOV(PPSH_INTERMEDIATE_FORMAT Cur)
// Try to simulate all factors (0.5, 1.0 and 2.0) using an output modifier :
Cur->ScaleOutput(Factor);
DBG_PRINTF("; Changed MOV {const} into a SUB_factor 1-v0,-v0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MOV {const} into a SUB_factor 1-v0,-v0");
}
else
{
DBG_PRINTF("; Changed MOV {const} into a MOV c#\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MOV {const} into a MOV c#");
}
return true;
}
@ -5098,7 +5098,7 @@ bool PSH_XBOX_SHADER::SimplifyADD(PPSH_INTERMEDIATE_FORMAT Cur)
{
// Change it into a MOV (the first argument is already in-place)
Cur->Opcode = PO_MOV;
DBG_PRINTF("; Changed ADD s0,0 into a MOV s0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed ADD s0,0 into a MOV s0");
return true;
}
return false;
@ -5113,7 +5113,7 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
// Change it into s2 :
Cur->Opcode = PO_MOV;
Cur->Parameters[0] = Cur->Parameters[2];
DBG_PRINTF("; Changed MAD s0,0 into a MOV s0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0,0 into a MOV s0");
return true;
}
@ -5122,7 +5122,7 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
{
// Change it into s0*s1 :
Cur->Opcode = PO_MUL;
DBG_PRINTF("; Changed MAD s0, s1,0 into a MUL s0, s1\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0, s1,0 into a MUL s0, s1");
return true;
}
@ -5132,7 +5132,7 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
// Change it into s0+s2 :
Cur->Opcode = PO_ADD;
Cur->Parameters[1] = Cur->Parameters[2];
DBG_PRINTF("; Changed MAD s0,1,s2 into a ADD s0,s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0,1,s2 into a ADD s0,s2");
return true;
}
@ -5143,7 +5143,7 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Cur->Opcode = PO_SUB;
Cur->Parameters[1] = Cur->Parameters[0];
Cur->Parameters[0] = Cur->Parameters[2];
DBG_PRINTF("; Changed MAD s0,-1,s2 into a SUB s2,s0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0,-1,s2 into a SUB s2,s0");
return true;
}
@ -5164,11 +5164,11 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Ins.Output[0] = Ins.Parameters[0] = Cur->Parameters[1];
Ins.CommentString = "; Inserted to perform division by 2";
InsertIntermediate(&Ins, index);
DBG_PRINTF("; Changed MAD 0.5,s1,s2 into a MOV_d2 s1, s1 ADD s1, s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD 0.5,s1,s2 into a MOV_d2 s1, s1 ADD s1, s2");
}
else
{
DBG_PRINTF("; Changed MAD 0.5,s1,s2 into a MAD c#,s1,s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD 0.5,s1,s2 into a MAD c#,s1,s2");
}
return true;
}
@ -5188,11 +5188,11 @@ bool PSH_XBOX_SHADER::SimplifyMAD(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Ins.Output[0] = Ins.Parameters[0] = Cur->Parameters[0];
Ins.CommentString = "; Inserted to perform division by 2";
InsertIntermediate(&Ins, index);
DBG_PRINTF("; Changed MAD s0,0.5,s2 into a MOV_d2 s0, s0 ADD s0, s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0,0.5,s2 into a MOV_d2 s0, s0 ADD s0, s2");
}
else
{
DBG_PRINTF("; Changed MAD s0,0.5,s2 into a MAD s0,c#,s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MAD s0,0.5,s2 into a MAD s0,c#,s2");
}
return true;
}
@ -5206,7 +5206,7 @@ bool PSH_XBOX_SHADER::SimplifySUB(PPSH_INTERMEDIATE_FORMAT Cur)
{
// Change it into a MOV (the first argument is already in-place)
Cur->Opcode = PO_MOV;
DBG_PRINTF("; Changed SUB x, 0 into a MOV x\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed SUB x, 0 into a MOV x");
return true;
}
return false;
@ -5220,7 +5220,7 @@ bool PSH_XBOX_SHADER::SimplifyMUL(PPSH_INTERMEDIATE_FORMAT Cur)
// Change it into a MOV (the 0 argument will be resolve in a recursive MOV fixup) :
Cur->Opcode = PO_MOV;
Cur->Parameters[0].SetConstValue(0.0);
DBG_PRINTF("; Changed MUL s0,0 into a MOV 0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MUL s0,0 into a MOV 0");
return true;
}
@ -5230,7 +5230,7 @@ bool PSH_XBOX_SHADER::SimplifyMUL(PPSH_INTERMEDIATE_FORMAT Cur)
// Change it into a simple MOV and scale the output instead :
Cur->Opcode = PO_MOV;
Cur->ScaleOutput(Cur->Parameters[1].GetConstValue());
DBG_PRINTF("; Changed MUL s0,{const} into a MOV_factor s0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed MUL s0,{const} into a MOV_factor s0");
return true;
}
return false;
@ -5245,7 +5245,7 @@ bool PSH_XBOX_SHADER::SimplifyLRP(PPSH_INTERMEDIATE_FORMAT Cur, int index)
{
// Change it into a MUL (calculating the left part : s0*s1 :
Cur->Opcode = PO_MUL;
DBG_PRINTF("; Changed LRP s0,s1,s2 (where (1-s0)*s2=0) into a MUL s0,s1\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed LRP s0,s1,s2 (where (1-s0)*s2=0) into a MUL s0,s1");
return true;
}
@ -5256,7 +5256,7 @@ bool PSH_XBOX_SHADER::SimplifyLRP(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Cur->Opcode = PO_MUL;
Cur->Parameters[0].Invert();
Cur->Parameters[1] = Cur->Parameters[2];
DBG_PRINTF("; Changed LRP s0,s1,s2 (where s0*s1=0) into a MUL (1-s0),s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed LRP s0,s1,s2 (where s0*s1=0) into a MUL (1-s0),s2");
return true;
}
@ -5267,7 +5267,7 @@ bool PSH_XBOX_SHADER::SimplifyLRP(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Cur->Opcode = PO_MAD;
Cur->Parameters[2] = Cur->Parameters[0];
Cur->Parameters[2].Invert();
DBG_PRINTF("; Changed LRP s0,s1,1 into a MAD s0,s1,1-s0\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed LRP s0,s1,1 into a MAD s0,s1,1-s0");
return true;
}
@ -5278,7 +5278,7 @@ bool PSH_XBOX_SHADER::SimplifyLRP(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Cur->Opcode = PO_MAD;
Cur->Parameters[1] = Cur->Parameters[2];
Cur->Parameters[1].Invert();
DBG_PRINTF("; Changed LRP s0,1,s2 into a MAD s0,1-s2,s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed LRP s0,1,s2 into a MAD s0,1-s2,s2");
return true;
}
@ -5305,7 +5305,7 @@ bool PSH_XBOX_SHADER::SimplifyLRP(PPSH_INTERMEDIATE_FORMAT Cur, int index)
Ins.Parameters[0].SetRegister(Cur->Output[0].Type, Cur->Output[0].Address, 0);
Ins.CommentString = "; Inserted to avoid LRP parameters referencing the output register";
InsertIntermediate(&Ins, index);
DBG_PRINTF("; Changed LRP s0,1,s2 into a MAD s0,1-s2,s2\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed LRP s0,1,s2 into a MAD s0,1-s2,s2");
return true;
}
}
@ -5333,7 +5333,7 @@ bool PSH_XBOX_SHADER::FixupCND(PPSH_INTERMEDIATE_FORMAT Cur, int index)
std::swap(Cur->Parameters[1], Cur->Parameters[2]);
Ins.CommentString = Cur->CommentString = "; Changed CND into SUB CMP";
InsertIntermediate(&Ins, index);
DBG_PRINTF("; Changed CND into SUB CMP\n");
EmuLog(LOG_LEVEL::DEBUG, "; Changed CND into SUB CMP");
return true;
}
@ -6560,7 +6560,7 @@ inline void HandleInputOutput
// 6928: check this as I doubt whether it works really like that
/*if(strcmp(szInput[i], "r1")==0)
{
// DBG_PRINTF("channel: %s\n", szChannels[i]);
// EmuLog(LOG_LEVEL::DEBUG, "channel: %s", szChannels[i]);
// Sleep(3000);
if((strcmp(szChannels[i], ".a")==0) && (!bR1AWritten)) {
@ -6765,7 +6765,7 @@ inline void HandleInputOutput
//EmuWarningMsg("THIS IS WRONG, FIX ME!");
//if(!szOutput[1][0])
// strcpy(szOut1, szOutput[2]);
DBG_PRINTF("(!szOutput[0][0] || !szOutput[1][0]) && szOutput[2][0] = TRUE!\n");
EmuLog(LOG_LEVEL::DEBUG, "(!szOutput[0][0] || !szOutput[1][0]) && szOutput[2][0] = TRUE!");
BOOL bUsable=TRUE;
for(i=2; i<4; i++)
@ -6779,7 +6779,7 @@ inline void HandleInputOutput
strcpy(szOut, szOutput[2]);
DBG_PRINTF("BUsable = TRUE, new output: %s\n", szOut);
EmuLog(LOG_LEVEL::DEBUG, "BUsable = TRUE, new output: %s", szOut);
}
else {

View File

@ -805,7 +805,7 @@ VOID XTL::EmuFlushIVB()
bool bFVF = VshHandleIsFVF(g_CurrentXboxVertexShaderHandle);
DWORD dwCurFVF = (bFVF) ? g_CurrentXboxVertexShaderHandle : g_InlineVertexBuffer_FVF;
DBG_PRINTF("g_InlineVertexBuffer_TableOffset := %d\n", g_InlineVertexBuffer_TableOffset);
EmuLog(LOG_LEVEL::DEBUG, "g_InlineVertexBuffer_TableOffset := %d", g_InlineVertexBuffer_TableOffset);
// Check the given FVF
switch (dwCurFVF & D3DFVF_POSITION_MASK) {
@ -857,34 +857,34 @@ VOID XTL::EmuFlushIVB()
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Position.z;
if (dwPos == D3DFVF_XYZRHW) {
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Rhw;
DBG_PRINTF("IVB Position := {%f, %f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Rhw);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Rhw);
}
else { // XYZRHW cannot be combined with NORMAL, but the other XYZ formats can :
switch (dwPos) {
case D3DFVF_XYZ:
DBG_PRINTF("IVB Position := {%f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z);
break;
case D3DFVF_XYZB1:
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[0];
DBG_PRINTF("IVB Position := {%f, %f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0]);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0]);
break;
case D3DFVF_XYZB2:
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[0];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[1];
DBG_PRINTF("IVB Position := {%f, %f, %f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1]);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1]);
break;
case D3DFVF_XYZB3:
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[0];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[1];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[2];
DBG_PRINTF("IVB Position := {%f, %f, %f, %f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1], g_InlineVertexBuffer_Table[v].Blend[2]);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f, %f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1], g_InlineVertexBuffer_Table[v].Blend[2]);
break;
case D3DFVF_XYZB4:
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[0];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[1];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[2];
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Blend[3];
DBG_PRINTF("IVB Position := {%f, %f, %f, %f, %f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1], g_InlineVertexBuffer_Table[v].Blend[2], g_InlineVertexBuffer_Table[v].Blend[3]);
EmuLog(LOG_LEVEL::DEBUG, "IVB Position := {%f, %f, %f, %f, %f, %f, %f}", g_InlineVertexBuffer_Table[v].Position.x, g_InlineVertexBuffer_Table[v].Position.y, g_InlineVertexBuffer_Table[v].Position.z, g_InlineVertexBuffer_Table[v].Blend[0], g_InlineVertexBuffer_Table[v].Blend[1], g_InlineVertexBuffer_Table[v].Blend[2], g_InlineVertexBuffer_Table[v].Blend[3]);
break;
default:
CxbxKrnlCleanup("Unsupported Position Mask (FVF := 0x%.08X dwPos := 0x%.08X)", dwCurFVF, dwPos);
@ -895,25 +895,25 @@ VOID XTL::EmuFlushIVB()
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Normal.x;
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Normal.y;
*pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Normal.z;
DBG_PRINTF("IVB Normal := {%f, %f, %f}\n", g_InlineVertexBuffer_Table[v].Normal.x, g_InlineVertexBuffer_Table[v].Normal.y, g_InlineVertexBuffer_Table[v].Normal.z);
EmuLog(LOG_LEVEL::DEBUG, "IVB Normal := {%f, %f, %f}", g_InlineVertexBuffer_Table[v].Normal.x, g_InlineVertexBuffer_Table[v].Normal.y, g_InlineVertexBuffer_Table[v].Normal.z);
}
}
#if 0 // TODO : Was this supported on Xbox from some point in time (pun intended)?
if (dwCurFVF & D3DFVF_PSIZE) {
*(DWORD*)pVertexBufferData++ = g_InlineVertexBuffer_Table[v].PointSize;
DBG_PRINTF("IVB PointSize := 0x%.08X\n", g_InlineVertexBuffer_Table[v].PointSize);
EmuLog(LOG_LEVEL::DEBUG, "IVB PointSize := 0x%.08X", g_InlineVertexBuffer_Table[v].PointSize);
}
#endif
if (dwCurFVF & D3DFVF_DIFFUSE) {
*(DWORD*)pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Diffuse;
DBG_PRINTF("IVB Diffuse := 0x%.08X\n", g_InlineVertexBuffer_Table[v].Diffuse);
EmuLog(LOG_LEVEL::DEBUG, "IVB Diffuse := 0x%.08X", g_InlineVertexBuffer_Table[v].Diffuse);
}
if (dwCurFVF & D3DFVF_SPECULAR) {
*(DWORD*)pVertexBufferData++ = g_InlineVertexBuffer_Table[v].Specular;
DBG_PRINTF("IVB Specular := 0x%.08X\n", g_InlineVertexBuffer_Table[v].Specular);
EmuLog(LOG_LEVEL::DEBUG, "IVB Specular := 0x%.08X", g_InlineVertexBuffer_Table[v].Specular);
}
for (unsigned int i = 0; i < dwTexN; i++) {
@ -930,10 +930,10 @@ VOID XTL::EmuFlushIVB()
if (g_bPrintfOn) {
switch (TexSize[i]) {
case 1: DBG_PRINTF("IVB TexCoord%d := {%f}\n", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x); break;
case 2: DBG_PRINTF("IVB TexCoord%d := {%f, %f}\n", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y); break;
case 3: DBG_PRINTF("IVB TexCoord%d := {%f, %f, %f}\n", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y, g_InlineVertexBuffer_Table[v].TexCoord[i].z); break;
case 4: DBG_PRINTF("IVB TexCoord%d := {%f, %f, %f, %f}\n", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y, g_InlineVertexBuffer_Table[v].TexCoord[i].z, g_InlineVertexBuffer_Table[v].TexCoord[i].w); break;
case 1: EmuLog(LOG_LEVEL::DEBUG, "IVB TexCoord%d := {%f}", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x); break;
case 2: EmuLog(LOG_LEVEL::DEBUG, "IVB TexCoord%d := {%f, %f}", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y); break;
case 3: EmuLog(LOG_LEVEL::DEBUG, "IVB TexCoord%d := {%f, %f, %f}", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y, g_InlineVertexBuffer_Table[v].TexCoord[i].z); break;
case 4: EmuLog(LOG_LEVEL::DEBUG, "IVB TexCoord%d := {%f, %f, %f, %f}", i + 1, g_InlineVertexBuffer_Table[v].TexCoord[i].x, g_InlineVertexBuffer_Table[v].TexCoord[i].y, g_InlineVertexBuffer_Table[v].TexCoord[i].z, g_InlineVertexBuffer_Table[v].TexCoord[i].w); break;
}
}
}

View File

@ -936,7 +936,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateBuffer)
GeneratePCMFormat(DSBufferDesc, pdsbd->lpwfxFormat, (*ppBuffer)->EmuFlags, pdsbd->dwBufferBytes, &(*ppBuffer)->X_BufferCache, (*ppBuffer)->X_BufferCacheSize);
(*ppBuffer)->EmuBufferDesc = DSBufferDesc;
DBG_PRINTF("DirectSoundCreateBuffer, *ppBuffer := 0x%08X, bytes := 0x%08X\n", *ppBuffer, (*ppBuffer)->EmuBufferDesc.dwBufferBytes);
EmuLog(LOG_LEVEL::DEBUG, "DirectSoundCreateBuffer, *ppBuffer := 0x%08X, bytes := 0x%08X", *ppBuffer, (*ppBuffer)->EmuBufferDesc.dwBufferBytes);
hRet = DSoundBufferCreate(&DSBufferDesc, (*ppBuffer)->EmuDirectSoundBuffer8);
if (FAILED(hRet)) {
@ -1745,7 +1745,7 @@ HRESULT WINAPI XTL::EMUPATCH(DirectSoundCreateStream)
(*ppStream)->Xb_lpvContext = pdssd->lpvContext;
//TODO: Implement mixbin variable support. Or just merge pdssd struct into DS Stream class.
DBG_PRINTF("DirectSoundCreateStream, *ppStream := 0x%.08X\n", *ppStream);
EmuLog(LOG_LEVEL::DEBUG, "DirectSoundCreateStream, *ppStream := 0x%.08X", *ppStream);
hRet = DSoundBufferCreate(&DSBufferDesc, (*ppStream)->EmuDirectSoundBuffer8);
if (FAILED(hRet)) {
@ -3204,7 +3204,7 @@ HRESULT WINAPI XTL::EMUPATCH(IDirectSound_GetCaps)
pDSCaps->dwFree2DBuffers = (pDSCaps->dwFreeBufferSGEs == 0 ? 0 : 0x200 /* TODO: Replace me to g_dwFree2DBuffers*/ );
pDSCaps->dwFree3DBuffers = (pDSCaps->dwFreeBufferSGEs == 0 ? 0 : 0x200 /* TODO: Replace me to g_dwFree3DBuffers*/ );
DBG_PRINTF("X_DSCAPS: dwFree2DBuffers = %8X | dwFree3DBuffers = %8X | dwFreeBufferSGEs = %08X | dwMemAlloc = %08X\n", pDSCaps->dwFree2DBuffers, pDSCaps->dwFree3DBuffers, pDSCaps->dwFreeBufferSGEs, pDSCaps->dwMemoryAllocated);
EmuLog(LOG_LEVEL::DEBUG, "X_DSCAPS: dwFree2DBuffers = %8X | dwFree3DBuffers = %8X | dwFreeBufferSGEs = %08X | dwMemAlloc = %08X", pDSCaps->dwFree2DBuffers, pDSCaps->dwFree3DBuffers, pDSCaps->dwFreeBufferSGEs, pDSCaps->dwMemoryAllocated);
}
leaveCriticalSection;

View File

@ -1039,7 +1039,7 @@ DWORD WINAPI XTL::EMUPATCH(XInputGetState)
if((dwPort >= 0) && (dwPort <= total_xinput_gamepad))
{
DBG_PRINTF("EmuXInputGetState(): dwPort = %d\n", dwPort );
EmuLog(LOG_LEVEL::DEBUG, "EmuXInputGetState(): dwPort = %d", dwPort );
//for xinput, we query the state corresponds to port.
if (g_XInputEnabled) {

View File

@ -231,7 +231,7 @@ XBSYSAPI EXPORTNUM(44) xboxkrnl::ULONG NTAPI xboxkrnl::HalGetInterruptVector
*Irql = (KIRQL)VECTOR2IRQL(dwVector);
#ifdef _DEBUG_TRACE
DBG_PRINTF("HalGetInterruptVector(): Interrupt vector requested for %d (%s)\n",
EmuLog(LOG_LEVEL::DEBUG, "HalGetInterruptVector(): Interrupt vector requested for %d (%s)",
BusInterruptLevel, IRQNames[BusInterruptLevel]);
#endif
}

View File

@ -298,7 +298,7 @@ XBSYSAPI EXPORTNUM(66) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoCreateFile
}
else
{
DBG_PRINTF("IoCreateFile = 0x%.8X\n", *FileHandle);
EmuLog(LOG_LEVEL::DEBUG, "IoCreateFile = 0x%.8X", *FileHandle);
}
RETURN(ret);

View File

@ -301,7 +301,7 @@ void ExecuteDpcQueue()
pkdpc->Inserted = FALSE;
// Set DpcRoutineActive to support KeIsExecutingDpc:
KeGetCurrentPrcb()->DpcRoutineActive = TRUE; // Experimental
DBG_PRINTF("Global DpcQueue, calling DPC at 0x%.8X\n", pkdpc->DeferredRoutine);
EmuLog(LOG_LEVEL::DEBUG, "Global DpcQueue, calling DPC at 0x%.8X", pkdpc->DeferredRoutine);
__try {
// Call the Deferred Procedure :
pkdpc->DeferredRoutine(
@ -2236,7 +2236,7 @@ XBSYSAPI EXPORTNUM(159) xboxkrnl::NTSTATUS NTAPI xboxkrnl::KeWaitForSingleObject
Timer->Header.WaitListHead.Blink = &WaitTimer->WaitListEntry;
WaitTimer->NextWaitBlock = WaitBlock;
if (KiInsertTreeTimer(Timer, *Timeout) == FALSE) {
DBG_PRINTF("%s: KiInsertTreeTimer(Timer, *Timeout) == FALSE\n", __func__);
EmuLog(LOG_LEVEL::DEBUG, "%s: KiInsertTreeTimer(Timer, *Timeout) == FALSE", __func__);
WaitStatus = (NTSTATUS)STATUS_TIMEOUT;
KiTimerUnlock();
goto NoWait;

View File

@ -332,7 +332,7 @@ xboxkrnl::BOOLEAN FASTCALL xboxkrnl::KiInsertTimerTable
PLIST_ENTRY ListHead, NextEntry;
PKTIMER CurrentTimer;
DBG_PRINTF("%s: inserting Timer %p, Hand: %lu\n", __func__, Timer, Hand);
EmuLog(LOG_LEVEL::DEBUG, "%s: inserting Timer %p, Hand: %lu", __func__, Timer, Hand);
ASSERT_TIMER_LOCKED;
@ -368,7 +368,7 @@ xboxkrnl::BOOLEAN FASTCALL xboxkrnl::KiInsertTimerTable
/* Make sure it hasn't expired already */
InterruptTime.QuadPart = KeQueryInterruptTime();
if (DueTime <= InterruptTime.QuadPart) {
DBG_PRINTF("Timer %p already expired\n", Timer);
EmuLog(LOG_LEVEL::DEBUG, "Timer %p already expired", Timer);
Expired = TRUE;
}
}
@ -441,7 +441,7 @@ xboxkrnl::BOOLEAN xboxkrnl::KiComputeDueTime
if (DifferenceTime.u.HighPart >= 0)
{
/* Cancel everything */
DBG_PRINTF("Timer %p already expired\n", Timer);
EmuLog(LOG_LEVEL::DEBUG, "Timer %p already expired", Timer);
Timer->Header.SignalState = TRUE;
Timer->DueTime.QuadPart = 0;
*Hand = 0;
@ -641,7 +641,7 @@ xboxkrnl::VOID NTAPI xboxkrnl::KiTimerExpiration
for (i = 0; DpcCalls; DpcCalls--, i++)
{
/* Call the DPC */
DBG_PRINTF("%s, calling DPC at 0x%.8X\n", __func__, DpcEntry[i].Routine);
EmuLog(LOG_LEVEL::DEBUG, "%s, calling DPC at 0x%.8X", __func__, DpcEntry[i].Routine);
__try {
// Call the Deferred Procedure :
DpcEntry[i].Routine(
@ -689,7 +689,7 @@ xboxkrnl::VOID NTAPI xboxkrnl::KiTimerExpiration
for (i = 0; DpcCalls; DpcCalls--, i++)
{
/* Call the DPC */
DBG_PRINTF("%s, calling DPC at 0x%.8X\n", __func__, DpcEntry[i].Routine);
EmuLog(LOG_LEVEL::DEBUG, "%s, calling DPC at 0x%.8X", __func__, DpcEntry[i].Routine);
__try {
// Call the Deferred Procedure :
DpcEntry[i].Routine(
@ -734,7 +734,7 @@ xboxkrnl::VOID NTAPI xboxkrnl::KiTimerExpiration
for (i = 0; DpcCalls; DpcCalls--, i++)
{
/* Call the DPC */
DBG_PRINTF("%s, calling DPC at 0x%.8X\n", __func__, DpcEntry[i].Routine);
EmuLog(LOG_LEVEL::DEBUG, "%s, calling DPC at 0x%.8X", __func__, DpcEntry[i].Routine);
__try {
// Call the Deferred Procedure :
DpcEntry[i].Routine(
@ -849,7 +849,7 @@ xboxkrnl::VOID FASTCALL xboxkrnl::KiTimerListExpire
for (i = 0; DpcCalls; DpcCalls--, i++)
{
/* Call the DPC */
DBG_PRINTF("%s, calling DPC at 0x%.8X\n", __func__, DpcEntry[i].Routine);
EmuLog(LOG_LEVEL::DEBUG, "%s, calling DPC at 0x%.8X", __func__, DpcEntry[i].Routine);
__try {
// Call the Deferred Procedure :
DpcEntry[i].Routine(

View File

@ -413,15 +413,15 @@ XBSYSAPI EXPORTNUM(181) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmQueryStatistics
{
g_VMManager.MemoryStatistics(MemoryStatistics);
DBG_PRINTF(" MemoryStatistics->Length = 0x%.08X\n", MemoryStatistics->Length);
DBG_PRINTF(" MemoryStatistics->TotalPhysicalPages = 0x%.08X\n", MemoryStatistics->TotalPhysicalPages);
DBG_PRINTF(" MemoryStatistics->AvailablePages = 0x%.08X\n", MemoryStatistics->AvailablePages);
DBG_PRINTF(" MemoryStatistics->VirtualMemoryBytesCommitted = 0x%.08X\n", MemoryStatistics->VirtualMemoryBytesCommitted);
DBG_PRINTF(" MemoryStatistics->VirtualMemoryBytesReserved = 0x%.08X\n", MemoryStatistics->VirtualMemoryBytesReserved);
DBG_PRINTF(" MemoryStatistics->CachePagesCommitted = 0x%.08X\n", MemoryStatistics->CachePagesCommitted);
DBG_PRINTF(" MemoryStatistics->PoolPagesCommitted = 0x%.08X\n", MemoryStatistics->PoolPagesCommitted);
DBG_PRINTF(" MemoryStatistics->StackPagesCommitted = 0x%.08X\n", MemoryStatistics->StackPagesCommitted);
DBG_PRINTF(" MemoryStatistics->ImagePagesCommitted = 0x%.08X\n", MemoryStatistics->ImagePagesCommitted);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->Length = 0x%.08X", MemoryStatistics->Length);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->TotalPhysicalPages = 0x%.08X", MemoryStatistics->TotalPhysicalPages);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->AvailablePages = 0x%.08X", MemoryStatistics->AvailablePages);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->VirtualMemoryBytesCommitted = 0x%.08X", MemoryStatistics->VirtualMemoryBytesCommitted);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->VirtualMemoryBytesReserved = 0x%.08X", MemoryStatistics->VirtualMemoryBytesReserved);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->CachePagesCommitted = 0x%.08X", MemoryStatistics->CachePagesCommitted);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->PoolPagesCommitted = 0x%.08X", MemoryStatistics->PoolPagesCommitted);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->StackPagesCommitted = 0x%.08X", MemoryStatistics->StackPagesCommitted);
EmuLog(LOG_LEVEL::DEBUG, " MemoryStatistics->ImagePagesCommitted = 0x%.08X", MemoryStatistics->ImagePagesCommitted);
ret = STATUS_SUCCESS;
}

View File

@ -170,7 +170,7 @@ XBSYSAPI EXPORTNUM(187) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtClose
// Delete duplicate threads created by our implementation of NtQueueApcThread()
if( GetHandleInformation( g_DuplicateHandles[Handle], &flags ) != 0 )
{
DBG_PRINTF("Closing duplicate handle...\n" );
EmuLog(LOG_LEVEL::DEBUG, "Closing duplicate handle..." );
CloseHandle( g_DuplicateHandles[Handle] );
g_DuplicateHandles.erase(Handle);
@ -215,7 +215,7 @@ XBSYSAPI EXPORTNUM(188) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateDirectoryObje
if (FAILED(ret))
EmuLog(LOG_LEVEL::WARNING, "NtCreateDirectoryObject Failed!");
else
DBG_PRINTF("NtCreateDirectoryObject DirectoryHandle = 0x%.8X\n", *DirectoryHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateDirectoryObject DirectoryHandle = 0x%.8X", *DirectoryHandle);
RETURN(ret);
}
@ -292,10 +292,10 @@ XBSYSAPI EXPORTNUM(189) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateEvent
if(FAILED(ret))
EmuLog(LOG_LEVEL::WARNING, "NtCreateEvent Failed!");
else
DBG_PRINTF("NtCreateEvent EventHandle = 0x%.8X\n", *EventHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateEvent EventHandle = 0x%.8X", *EventHandle);
}
else
DBG_PRINTF("NtCreateEvent EventHandle = 0x%.8X\n", *EventHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateEvent EventHandle = 0x%.8X", *EventHandle);
RETURN(ret);
}
@ -420,10 +420,10 @@ XBSYSAPI EXPORTNUM(192) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateMutant
if(FAILED(ret))
EmuLog(LOG_LEVEL::WARNING, "NtCreateMutant Failed!");
else
DBG_PRINTF("NtCreateMutant MutantHandle = 0x%.8X\n", *MutantHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateMutant MutantHandle = 0x%.8X", *MutantHandle);
}
else
DBG_PRINTF("NtCreateMutant MutantHandle = 0x%.8X\n", *MutantHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateMutant MutantHandle = 0x%.8X", *MutantHandle);
RETURN(ret);
}
@ -495,10 +495,10 @@ XBSYSAPI EXPORTNUM(193) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateSemaphore
if(FAILED(ret))
EmuLog(LOG_LEVEL::WARNING, "NtCreateSemaphore failed!");
else
DBG_PRINTF("NtCreateSemaphore SemaphoreHandle = 0x%.8X\n", *SemaphoreHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateSemaphore SemaphoreHandle = 0x%.8X", *SemaphoreHandle);
}
else
DBG_PRINTF("NtCreateSemaphore SemaphoreHandle = 0x%.8X\n", *SemaphoreHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateSemaphore SemaphoreHandle = 0x%.8X", *SemaphoreHandle);
RETURN(ret);
}
@ -558,7 +558,7 @@ XBSYSAPI EXPORTNUM(194) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateTimer
if (FAILED(ret))
EmuLog(LOG_LEVEL::WARNING, "NtCreateTimer failed!");
else
DBG_PRINTF("NtCreateTimer TimerHandle = 0x%.8X\n", *TimerHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtCreateTimer TimerHandle = 0x%.8X", *TimerHandle);
RETURN(ret);
}
@ -901,7 +901,7 @@ XBSYSAPI EXPORTNUM(203) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtOpenSymbolicLinkObj
if (ret != STATUS_SUCCESS)
EmuLog(LOG_LEVEL::WARNING, "NtOpenSymbolicLinkObject failed! (%s)", NtStatusToString(ret));
else
DBG_PRINTF("NtOpenSymbolicLinkObject LinkHandle^ = 0x%.8X\n", *LinkHandle);
EmuLog(LOG_LEVEL::DEBUG, "NtOpenSymbolicLinkObject LinkHandle^ = 0x%.8X", *LinkHandle);
RETURN(ret);
}
@ -1007,7 +1007,7 @@ XBSYSAPI EXPORTNUM(206) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueueApcThread
else
{
g_DuplicateHandles[ThreadHandle] = hApcThread; // Save this thread because we'll need to de-reference it later
DBG_PRINTF("DuplicateHandle returned 0x%X (ThreadId 0x%.4X)\n", hApcThread, GetThreadId( hApcThread ) );
EmuLog(LOG_LEVEL::DEBUG, "DuplicateHandle returned 0x%X (ThreadId 0x%.4X)", hApcThread, GetThreadId( hApcThread ) );
}
@ -1463,13 +1463,13 @@ XBSYSAPI EXPORTNUM(217) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVirtualMemory
if (ret == STATUS_SUCCESS)
{
DBG_PRINTF(" Buffer->AllocationBase = 0x%.08X\n", Buffer->AllocationBase);
DBG_PRINTF(" Buffer->AllocationProtect = 0x%.08X\n", Buffer->AllocationProtect);
DBG_PRINTF(" Buffer->BaseAddress = 0x%.08X\n", Buffer->BaseAddress);
DBG_PRINTF(" Buffer->RegionSize = 0x%.08X\n", Buffer->RegionSize);
DBG_PRINTF(" Buffer->State = 0x%.08X\n", Buffer->State);
DBG_PRINTF(" Buffer->Protect = 0x%.08X\n", Buffer->Protect);
DBG_PRINTF(" Buffer->Type = 0x%.08X\n", Buffer->Type);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->AllocationBase = 0x%.08X", Buffer->AllocationBase);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->AllocationProtect = 0x%.08X", Buffer->AllocationProtect);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->BaseAddress = 0x%.08X", Buffer->BaseAddress);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->RegionSize = 0x%.08X", Buffer->RegionSize);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->State = 0x%.08X", Buffer->State);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->Protect = 0x%.08X", Buffer->Protect);
EmuLog(LOG_LEVEL::DEBUG, " Buffer->Type = 0x%.08X", Buffer->Type);
}
#if 0
@ -1493,7 +1493,7 @@ XBSYSAPI EXPORTNUM(217) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVirtualMemory
ret = STATUS_SUCCESS;
DBG_PRINTF("NtQueryVirtualMemory: Applied fix for Forza Motorsport!\n");
EmuLog(LOG_LEVEL::DEBUG, "NtQueryVirtualMemory: Applied fix for Forza Motorsport!");
}
}
#endif
@ -2053,7 +2053,7 @@ XBSYSAPI EXPORTNUM(232) xboxkrnl::VOID NTAPI xboxkrnl::NtUserIoApcDispatcher
(CompletionRoutine)(dwErrorCode, dwTransferred, lpOverlapped);
DBG_PRINTF("NtUserIoApcDispatcher Completed\n");
EmuLog(LOG_LEVEL::DEBUG, "NtUserIoApcDispatcher Completed");
}
// ******************************************************************

View File

@ -296,7 +296,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE
if (pfnNotificationRoutine == NULL)
continue;
DBG_PRINTF("Calling pfnNotificationRoutine[%d] (0x%.8X)\n", g_iThreadNotificationCount, pfnNotificationRoutine);
EmuLog(LOG_LEVEL::DEBUG, "Calling pfnNotificationRoutine[%d] (0x%.8X)", g_iThreadNotificationCount, pfnNotificationRoutine);
pfnNotificationRoutine(TRUE);
}
@ -305,7 +305,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE
*ThreadHandle = (HANDLE)_beginthreadex(NULL, KernelStackSize, PCSTProxy, iPCSTProxyParam, NULL, (unsigned int*)&dwThreadId);
// Note : DO NOT use iPCSTProxyParam anymore, since ownership is transferred to the proxy (which frees it too)
DBG_PRINTF("Waiting for Xbox proxy thread to start...\n");
EmuLog(LOG_LEVEL::DEBUG, "Waiting for Xbox proxy thread to start...");
while (bWait) {
dwThreadWait = WaitForSingleObject(hStartedEvent, INFINITE);
@ -316,7 +316,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE
break;
}
case WAIT_OBJECT_0: { // The state of the specified object is signaled.
DBG_PRINTF("Xbox proxy thread is started.\n");
EmuLog(LOG_LEVEL::DEBUG, "Xbox proxy thread is started.");
bWait = false;
break;
}
@ -337,7 +337,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE
hStartedEvent = NULL;
// Log ThreadID identical to how GetCurrentThreadID() is rendered :
DBG_PRINTF("Created Xbox proxy thread. Handle : 0x%X, ThreadId : [0x%.4X]\n", *ThreadHandle, dwThreadId);
EmuLog(LOG_LEVEL::DEBUG, "Created Xbox proxy thread. Handle : 0x%X, ThreadId : [0x%.4X]", *ThreadHandle, dwThreadId);
CxbxKrnlRegisterThread(*ThreadHandle);
@ -434,7 +434,7 @@ XBSYSAPI EXPORTNUM(258) xboxkrnl::VOID NTAPI xboxkrnl::PsTerminateSystemThread
if (pfnNotificationRoutine == NULL)
continue;
DBG_PRINTF("Calling pfnNotificationRoutine[%d] (0x%.8X)\n", g_iThreadNotificationCount, pfnNotificationRoutine);
EmuLog(LOG_LEVEL::DEBUG, "Calling pfnNotificationRoutine[%d] (0x%.8X)", g_iThreadNotificationCount, pfnNotificationRoutine);
pfnNotificationRoutine(FALSE);
}

View File

@ -1438,7 +1438,7 @@ XBSYSAPI EXPORTNUM(301) xboxkrnl::ULONG NTAPI xboxkrnl::RtlNtStatusToDosError
return LOWORD(Status);
no_mapping:
DBG_PRINTF("no mapping for %08x\n", Status);
EmuLog(LOG_LEVEL::DEBUG, "no mapping for %08x", Status);
ret = ERROR_MR_MID_NOT_FOUND;
*/
RETURN(ret);

View File

@ -285,7 +285,7 @@ xboxkrnl::VOID NTAPI JumpedBlockCryptCBC
}
if (ret == MBEDTLS_ERR_DES_INVALID_INPUT_LENGTH) {
DBG_PRINTF("%s: dwInputLength was not a multiple of 8 (it was %lu)\n", __func__, dwInputLength);
EmuLog(LOG_LEVEL::DEBUG, "%s: dwInputLength was not a multiple of 8 (it was %lu)", __func__, dwInputLength);
}
}

View File

@ -554,7 +554,7 @@ DWORD PhysicalMemory::PatchXboxPermissions(DWORD Perms)
{
// One of XBOX_PAGE_READONLY or XBOX_PAGE_READWRITE must be specified
DBG_PRINTF("%s: Memory permissions bug detected\n", __func__);
EmuLog(LOG_LEVEL::DEBUG, "%s: Memory permissions bug detected", __func__);
return XBOX_PAGE_EXECUTE_READWRITE;
}
@ -575,7 +575,7 @@ DWORD PhysicalMemory::PatchXboxPermissions(DWORD Perms)
// If we reach here it means that both XBOX_PAGE_READONLY and XBOX_PAGE_READWRITE were specified, and so the
// input is probably invalid
DBG_PRINTF("%s: Memory permissions bug detected\n", __func__);
EmuLog(LOG_LEVEL::DEBUG, "%s: Memory permissions bug detected", __func__);
return XBOX_PAGE_EXECUTE_READWRITE;
}
}
@ -641,7 +641,7 @@ DWORD PhysicalMemory::ConvertXboxToWinProtection(DWORD Perms)
// If we reach here it means that more than one permission modifier was specified, and so the input is
// probably invalid
DBG_PRINTF("%s: Memory permissions bug detected\n", __func__);
EmuLog(LOG_LEVEL::DEBUG, "%s: Memory permissions bug detected", __func__);
return PAGE_EXECUTE_READWRITE;
}
}

View File

@ -570,7 +570,7 @@ VAddr VMManager::ClaimGpuMemory(size_t Size, size_t* BytesToSkip)
}
m_NV2AInstanceMemoryBytes = Size;
DBG_PRINTF("MmClaimGpuInstanceMemory : Allocated bytes remaining = 0x%.8X\n", m_NV2AInstanceMemoryBytes);
EmuLog(LOG_LEVEL::DEBUG, "MmClaimGpuInstanceMemory : Allocated bytes remaining = 0x%.8X", m_NV2AInstanceMemoryBytes);
Unlock();
}
@ -617,12 +617,12 @@ void VMManager::PersistMemory(VAddr addr, size_t Size, bool bPersist)
if (bPersist)
{
*(VAddr*)(CONTIGUOUS_MEMORY_BASE + PAGE_SIZE - 4) = addr;
DBG_PRINTF("Persisting LaunchDataPage\n");
EmuLog(LOG_LEVEL::DEBUG, "Persisting LaunchDataPage");
}
else
{
*(VAddr*)(CONTIGUOUS_MEMORY_BASE + PAGE_SIZE - 4) = NULL;
DBG_PRINTF("Forgetting LaunchDataPage\n");
EmuLog(LOG_LEVEL::DEBUG, "Forgetting LaunchDataPage");
}
}
else
@ -630,12 +630,12 @@ void VMManager::PersistMemory(VAddr addr, size_t Size, bool bPersist)
if (bPersist)
{
*(VAddr*)(CONTIGUOUS_MEMORY_BASE + PAGE_SIZE - 8) = addr;
DBG_PRINTF("Persisting FrameBuffer\n");
EmuLog(LOG_LEVEL::DEBUG, "Persisting FrameBuffer");
}
else
{
*(VAddr*)(CONTIGUOUS_MEMORY_BASE + PAGE_SIZE - 8) = NULL;
DBG_PRINTF("Forgetting FrameBuffer\n");
EmuLog(LOG_LEVEL::DEBUG, "Forgetting FrameBuffer");
}
}
}
@ -703,7 +703,7 @@ void VMManager::RestorePersistentMemory()
RestorePersistentAllocation(LauchDataAddress, GetPteAddress(LauchDataAddress)->Hardware.PFN,
GetPteAddress(LauchDataAddress)->Hardware.PFN, ContiguousType);
DBG_PRINTF("Restored LaunchDataPage\n");
EmuLog(LOG_LEVEL::DEBUG, "Restored LaunchDataPage");
}
if (FrameBufferAddress != 0 && IS_PHYSICAL_ADDRESS(FrameBufferAddress)) {
@ -713,7 +713,7 @@ void VMManager::RestorePersistentMemory()
RestorePersistentAllocation(FrameBufferAddress, GetPteAddress(FrameBufferAddress)->Hardware.PFN,
GetPteAddress(FrameBufferAddress)->Hardware.PFN + (QuerySize(FrameBufferAddress, false) >> PAGE_SHIFT) - 1, ContiguousType);
DBG_PRINTF("Restored FrameBuffer\n");
EmuLog(LOG_LEVEL::DEBUG, "Restored FrameBuffer");
}
}
}
@ -1444,7 +1444,7 @@ size_t VMManager::QuerySize(VAddr addr, bool bCxbxCaller)
else if(IS_USER_ADDRESS(addr)) { Type = UserRegion; }
else
{
DBG_PRINTF("QuerySize: Unknown memory region queried.\n");
EmuLog(LOG_LEVEL::DEBUG, "QuerySize: Unknown memory region queried.");
Unlock();
RETURN(Size);
}
@ -1601,7 +1601,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
if (!ConvertXboxToPteProtection(Protect, &TempPte)) { RETURN(STATUS_INVALID_PAGE_PROTECTION); }
DBG_PRINTF("%s requested range : 0x%.8X - 0x%.8X\n", __func__, CapturedBase, CapturedBase + CapturedSize);
EmuLog(LOG_LEVEL::DEBUG, "%s requested range : 0x%.8X - 0x%.8X", __func__, CapturedBase, CapturedBase + CapturedSize);
Lock();
@ -1682,7 +1682,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
{
// XBOX_MEM_COMMIT was not specified, so we are done with the allocation
DBG_PRINTF("%s resulting range : 0x%.8X - 0x%.8X\n", __func__, AlignedCapturedBase, AlignedCapturedBase + AlignedCapturedSize);
EmuLog(LOG_LEVEL::DEBUG, "%s resulting range : 0x%.8X - 0x%.8X", __func__, AlignedCapturedBase, AlignedCapturedBase + AlignedCapturedSize);
*addr = AlignedCapturedBase;
*Size = AlignedCapturedSize;
@ -1752,7 +1752,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
if (!VirtualAlloc((void*)AlignedCapturedBase, AlignedCapturedSize, MEM_COMMIT,
(ConvertXboxToWinProtection(PatchXboxPermissions(Protect))) & ~(PAGE_WRITECOMBINE | PAGE_NOCACHE)))
{
DBG_PRINTF("%s: VirtualAlloc failed to commit the memory! The error was %d\n", __func__, GetLastError());
EmuLog(LOG_LEVEL::DEBUG, "%s: VirtualAlloc failed to commit the memory! The error was %d", __func__, GetLastError());
status = STATUS_NO_MEMORY;
goto Exit;
}
@ -1785,7 +1785,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
// Because VirtualAlloc always zeros the memory for us, XBOX_MEM_NOZERO is still unsupported
if (AllocationType & XBOX_MEM_NOZERO) { DBG_PRINTF("XBOX_MEM_NOZERO flag is not supported!\n"); }
if (AllocationType & XBOX_MEM_NOZERO) { EmuLog(LOG_LEVEL::DEBUG, "XBOX_MEM_NOZERO flag is not supported!"); }
// If some pte's were detected to have different permissions in the above check, we need to update those as well
@ -1797,7 +1797,7 @@ xboxkrnl::NTSTATUS VMManager::XbAllocateVirtualMemory(VAddr* addr, ULONG ZeroBit
XbVirtualProtect(&TempAddr, &TempSize, &TempProtect);
}
DBG_PRINTF("%s resulting range : 0x%.8X - 0x%.8X\n", __func__, AlignedCapturedBase, AlignedCapturedBase + AlignedCapturedSize);
EmuLog(LOG_LEVEL::DEBUG, "%s resulting range : 0x%.8X - 0x%.8X", __func__, AlignedCapturedBase, AlignedCapturedBase + AlignedCapturedSize);
*addr = AlignedCapturedBase;
*Size = AlignedCapturedSize;
@ -1958,7 +1958,7 @@ xboxkrnl::NTSTATUS VMManager::XbFreeVirtualMemory(VAddr* addr, size_t* Size, DWO
{
if (!VirtualFree((void*)AlignedCapturedBase, AlignedCapturedSize, MEM_DECOMMIT))
{
DBG_PRINTF("%s: VirtualFree failed to decommit the memory! The error was %d\n", __func__, GetLastError());
EmuLog(LOG_LEVEL::DEBUG, "%s: VirtualFree failed to decommit the memory! The error was %d", __func__, GetLastError());
}
}
}
@ -2621,7 +2621,7 @@ void VMManager::UpdateMemoryPermissions(VAddr addr, size_t Size, DWORD Perms)
DWORD dummy;
if (!VirtualProtect((void*)addr, Size, WindowsPerms & ~(PAGE_WRITECOMBINE | PAGE_NOCACHE), &dummy))
{
DBG_PRINTF("VirtualProtect failed. The error code was %d\n", GetLastError());
EmuLog(LOG_LEVEL::DEBUG, "VirtualProtect failed. The error code was %d", GetLastError());
}
}
@ -2675,7 +2675,7 @@ void VMManager::DestructVMA(VAddr addr, MemoryRegionType Type, size_t Size)
if (!ret)
{
DBG_PRINTF("Deallocation routine failed with error %d\n", GetLastError());
EmuLog(LOG_LEVEL::DEBUG, "Deallocation routine failed with error %d", GetLastError());
}
}
@ -2701,7 +2701,7 @@ void VMManager::DestructVMA(VAddr addr, MemoryRegionType Type, size_t Size)
}
else
{
DBG_PRINTF("std::prev(CarvedVmaIt) was not free\n");
EmuLog(LOG_LEVEL::DEBUG, "std::prev(CarvedVmaIt) was not free");
it = CarvedVmaIt;

View File

@ -572,9 +572,9 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData)
#ifdef _DEBUG_TRACE
// dump raw TLS data
if (pNewTLS == nullptr) {
DBG_PRINTF("TLS Non-Existant (OK)\n");
EmuLog(LOG_LEVEL::DEBUG, "TLS Non-Existant (OK)");
} else {
DBG_PRINTF("TLS Data Dump...\n");
EmuLog(LOG_LEVEL::DEBUG, "TLS Data Dump...");
if (g_bPrintfOn) {
for (uint32_t v = 4; v < dwCopySize + 4; v++) {// Note : Don't dump dwZeroSize
@ -677,5 +677,5 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData)
// Make the KPCR struct available to KeGetPcr()
EmuKeSetPcr(NewPcr);
DBG_PRINTF("Installed KPCR in TIB_ArbitraryDataSlot (with pTLS = 0x%.8X)\n", pTLS);
EmuLog(LOG_LEVEL::DEBUG, "Installed KPCR in TIB_ArbitraryDataSlot (with pTLS = 0x%.8X)", pTLS);
}

View File

@ -461,13 +461,13 @@ NTSTATUS CxbxConvertFilePath(
replace_all( RelativePath, "\\\\", "\\" );
if (g_bPrintfOn) {
DBG_PRINTF("%s Corrected path...\n", aFileAPIName.c_str());
DBG_PRINTF(" Org:\"%s\"\n", OriginalPath.c_str());
EmuLog(LOG_LEVEL::DEBUG, "%s Corrected path...", aFileAPIName.c_str());
EmuLog(LOG_LEVEL::DEBUG, " Org:\"%s\"", OriginalPath.c_str());
if (_strnicmp(HostPath.c_str(), CxbxBasePath.c_str(), CxbxBasePath.length()) == 0) {
DBG_PRINTF(" New:\"$CxbxPath\\%s%s\"\n", (HostPath.substr(CxbxBasePath.length(), std::string::npos)).c_str(), RelativePath.c_str());
EmuLog(LOG_LEVEL::DEBUG, " New:\"$CxbxPath\\%s%s\"", (HostPath.substr(CxbxBasePath.length(), std::string::npos)).c_str(), RelativePath.c_str());
}
else
DBG_PRINTF(" New:\"$XbePath\\%s\"\n", RelativePath.c_str());
EmuLog(LOG_LEVEL::DEBUG, " New:\"$XbePath\\%s\"", RelativePath.c_str());
}
}
else
@ -666,7 +666,7 @@ NTSTATUS EmuNtSymbolicLinkObject::Init(std::string aSymbolicLinkName, std::strin
else
{
NtSymbolicLinkObjects[DriveLetter - 'A'] = this;
DBG_PRINTF("Linked \"%s\" to \"%s\" (residing at \"%s\")\n", aSymbolicLinkName.c_str(), aFullPath.c_str(), HostSymbolicLinkPath.c_str());
EmuLog(LOG_LEVEL::DEBUG, "Linked \"%s\" to \"%s\" (residing at \"%s\")", aSymbolicLinkName.c_str(), aFullPath.c_str(), HostSymbolicLinkPath.c_str());
}
}
}

View File

@ -256,7 +256,7 @@ void EmuNVNet_UpdateIRQ()
{
if (EmuNVNet_GetRegister(NvRegIrqMask, 4) &&
EmuNVNet_GetRegister(NvRegIrqStatus, 4)) {
DBG_PRINTF("Asserting IRQ\n");
EmuLog(LOG_LEVEL::DEBUG, "Asserting IRQ");
HalSystemInterrupts[4].Assert(true);
} else {
HalSystemInterrupts[4].Assert(false);
@ -275,7 +275,7 @@ int EmuNVNet_MiiReadWrite(uint64_t val)
reg = mii_ctl & ((1 << NVREG_MIICTL_ADDRSHIFT) - 1);
write = mii_ctl & NVREG_MIICTL_WRITE;
DBG_PRINTF("nvnet mii %s: phy 0x%x %s [0x%x]\n", write ? "write" : "read", phy_addr, EmuNVNet_GetMiiRegisterName(reg), reg);
EmuLog(LOG_LEVEL::DEBUG, "nvnet mii %s: phy 0x%x %s [0x%x]", write ? "write" : "read", phy_addr, EmuNVNet_GetMiiRegisterName(reg), reg);
if (phy_addr != 1) {
return -1;
@ -306,7 +306,7 @@ int EmuNVNet_MiiReadWrite(uint64_t val)
uint32_t EmuNVNet_Read(xbaddr addr, int size)
{
DBG_PRINTF("Read%d: %s (0x%.8X)\n", size * 8, EmuNVNet_GetRegisterName(addr), addr);
EmuLog(LOG_LEVEL::DEBUG, "Read%d: %s (0x%.8X)", size * 8, EmuNVNet_GetRegisterName(addr), addr);
switch (addr) {
case NvRegMIIData:
@ -339,7 +339,7 @@ void EmuNVNet_DMAPacketFromGuest()
DBG_PRINTF("Looking at ring desc %d (%llx): ", s->tx_ring_index, tx_ring_addr);
DBG_PRINTF("Buffer: 0x%x, ", desc.packet_buffer);
DBG_PRINTF("Length: 0x%x, ", desc.length);
DBG_PRINTF("Flags: 0x%x\n", desc.flags);
EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags);
s->tx_ring_index += 1;
@ -348,7 +348,7 @@ void EmuNVNet_DMAPacketFromGuest()
}
/* Transfer packet from guest memory */
DBG_PRINTF("Sending packet...\n");
EmuLog(LOG_LEVEL::DEBUG, "Sending packet...");
memcpy(s->txrx_dma_buf, (void*)(desc.packet_buffer | CONTIGUOUS_MEMORY_BASE), desc.length + 1);
g_NVNet->PCAPSend(s->txrx_dma_buf, desc.length + 1);
@ -363,14 +363,14 @@ void EmuNVNet_DMAPacketFromGuest()
memcpy((void*)(tx_ring_addr | CONTIGUOUS_MEMORY_BASE), &desc, sizeof(desc));
if (is_last_packet) {
DBG_PRINTF(" -- Last packet\n");
EmuLog(LOG_LEVEL::DEBUG, " -- Last packet");
break;
}
}
if (packet_sent) {
/* Trigger interrupt */
DBG_PRINTF("Triggering interrupt\n");
EmuLog(LOG_LEVEL::DEBUG, "Triggering interrupt");
EmuNVNet_SetRegister(NvRegIrqStatus, NVREG_IRQSTAT_BIT4, 4);
EmuNVNet_UpdateIRQ();
}
@ -393,7 +393,7 @@ bool EmuNVNet_DMAPacketToGuest(void* packet, size_t size)
DBG_PRINTF("Looking at ring descriptor %d (0x%llx): ", s->rx_ring_index, rx_ring_addr);
DBG_PRINTF("Buffer: 0x%x, ", desc.packet_buffer);
DBG_PRINTF("Length: 0x%x, ", desc.length);
DBG_PRINTF("Flags: 0x%x\n", desc.flags);
EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags);
s->rx_ring_index += 1;
@ -402,7 +402,7 @@ bool EmuNVNet_DMAPacketToGuest(void* packet, size_t size)
}
/* Transfer packet from device to memory */
DBG_PRINTF("Transferring packet, size 0x%zx, to memory at 0x%x\n", size, desc.packet_buffer);
EmuLog(LOG_LEVEL::DEBUG, "Transferring packet, size 0x%zx, to memory at 0x%x", size, desc.packet_buffer);
memcpy((void*)(desc.packet_buffer | CONTIGUOUS_MEMORY_BASE), packet, size);
/* Update descriptor indicating the packet is waiting */
@ -411,17 +411,17 @@ bool EmuNVNet_DMAPacketToGuest(void* packet, size_t size)
memcpy((void*)(rx_ring_addr | CONTIGUOUS_MEMORY_BASE), &desc, sizeof(desc));
DBG_PRINTF("Updated ring descriptor: ");
DBG_PRINTF("Length: 0x%x, ", desc.length);
DBG_PRINTF("Flags: 0x%x\n", desc.flags);
EmuLog(LOG_LEVEL::DEBUG, "Flags: 0x%x", desc.flags);
/* Trigger interrupt */
DBG_PRINTF("Triggering interrupt\n");
EmuLog(LOG_LEVEL::DEBUG, "Triggering interrupt");
EmuNVNet_SetRegister(NvRegIrqStatus, NVREG_IRQSTAT_BIT1, 4);
EmuNVNet_UpdateIRQ();
return true;
}
/* Could not find free buffer, or packet too large. */
DBG_PRINTF("Could not find free buffer!\n");
EmuLog(LOG_LEVEL::DEBUG, "Could not find free buffer!");
return false;
}
@ -438,7 +438,7 @@ void EmuNVNet_Write(xbaddr addr, uint32_t value, int size)
break;
case NvRegTxRxControl:
if (value == NVREG_TXRXCTL_KICK) {
DBG_PRINTF("NvRegTxRxControl = NVREG_TXRXCTL_KICK!\n");
EmuLog(LOG_LEVEL::DEBUG, "NvRegTxRxControl = NVREG_TXRXCTL_KICK!");
EmuNVNet_DMAPacketFromGuest();
}
@ -474,7 +474,7 @@ void EmuNVNet_Write(xbaddr addr, uint32_t value, int size)
break;
}
DBG_PRINTF("Write%d: %s (0x%.8X) = 0x%.8X\n", size * 8, EmuNVNet_GetRegisterName(addr), addr, value);
EmuLog(LOG_LEVEL::DEBUG, "Write%d: %s (0x%.8X) = 0x%.8X", size * 8, EmuNVNet_GetRegisterName(addr), addr, value);
}
std::thread NVNetRecvThread;

View File

@ -44,7 +44,7 @@ namespace xboxkrnl
void SetLEDSequence(LED::Sequence aLEDSequence)
{
// See https://xboxdevwiki.net/PIC#The_LED
DBG_PRINTF("SetLEDSequence : %u\n", (byte)aLEDSequence);
EmuLog(LOG_LEVEL::DEBUG, "SetLEDSequence : %u", (byte)aLEDSequence);
union {
UINT LedSequenceBlock;

View File

@ -390,7 +390,7 @@ void Hub::UsbHub_HandleControl(XboxDeviceState* dev, USBPacket* p,
goto fail;
}
port = &m_HubState->ports[n];
DBG_PRINTF("GetPortStatus -> Address 0x%X, wIndex %d, wPortStatus %d, wPortChange %d\n",
EmuLog(LOG_LEVEL::DEBUG, "GetPortStatus -> Address 0x%X, wIndex %d, wPortStatus %d, wPortChange %d",
m_HubState->dev.Addr, index, port->wPortStatus, port->wPortChange);
data[0] = port->wPortStatus;
data[1] = port->wPortStatus >> 8;
@ -415,7 +415,7 @@ void Hub::UsbHub_HandleControl(XboxDeviceState* dev, USBPacket* p,
USBHubPort* port;
XboxDeviceState* dev;
DBG_PRINTF("SetPortFeature -> Address 0x%X, wIndex %d, Feature %s\n",
EmuLog(LOG_LEVEL::DEBUG, "SetPortFeature -> Address 0x%X, wIndex %d, Feature %s",
m_HubState->dev.Addr, index, GetFeatureName(value).c_str());
if (n >= NUM_PORTS) {
@ -453,7 +453,7 @@ void Hub::UsbHub_HandleControl(XboxDeviceState* dev, USBPacket* p,
unsigned int n = index - 1;
USBHubPort *port;
DBG_PRINTF("ClearPortFeature -> Address 0x%X, wIndex %d, Feature %s\n",
EmuLog(LOG_LEVEL::DEBUG, "ClearPortFeature -> Address 0x%X, wIndex %d, Feature %s",
m_HubState->dev.Addr, index, GetFeatureName(value).c_str());
if (n >= NUM_PORTS) {
@ -540,7 +540,7 @@ void Hub::UsbHub_HandleData(XboxDeviceState* dev, USBPacket* p)
p->Status = USB_RET_BABBLE;
return;
}
DBG_PRINTF("Address 0x%X, Status %d\n", m_HubState->dev.Addr, status);
EmuLog(LOG_LEVEL::DEBUG, "Address 0x%X, Status %d", m_HubState->dev.Addr, status);
for (i = 0; i < n; i++) {
buf[i] = status >> (8 * i);
}

View File

@ -97,9 +97,9 @@ static const char* OHCI_RegNames[] = {
//#define DEBUG_OHCI_REG
#ifdef DEBUG_OHCI_REG
#define DUMP_REG_R(reg_val) DBG_PRINTF("%s, R, reg_val: 0x%X\n", OHCI_RegNames[Addr >> 2], reg_val)
#define DUMP_REG_W(reg_val, val) DBG_PRINTF("%s, W, reg_val: 0x%X, val: 0x%X\n", OHCI_RegNames[Addr >> 2], reg_val, val)
#define DUMP_REG_RO(reg_val, val) DBG_PRINTF("%s, RO, reg_val: 0x%X, val: 0x%X\n", OHCI_RegNames[Addr >> 2], reg_val, val)
#define DUMP_REG_R(reg_val) EmuLog(LOG_LEVEL::DEBUG, "%s, R, reg_val: 0x%X", OHCI_RegNames[Addr >> 2], reg_val)
#define DUMP_REG_W(reg_val, val) EmuLog(LOG_LEVEL::DEBUG, "%s, W, reg_val: 0x%X, val: 0x%X", OHCI_RegNames[Addr >> 2], reg_val, val)
#define DUMP_REG_RO(reg_val, val) EmuLog(LOG_LEVEL::DEBUG, "%s, RO, reg_val: 0x%X, val: 0x%X", OHCI_RegNames[Addr >> 2], reg_val, val)
#else
#define DUMP_REG_R(reg_val)
#define DUMP_REG_W(reg_val, val)
@ -577,7 +577,7 @@ int OHCI::OHCI_ServiceTD(OHCI_ED* Ed)
// See if this TD has already been submitted to the device
completion = (addr == m_AsyncTD);
if (completion && !m_AsyncComplete) {
DBG_PRINTF("Skipping async TD\n");
EmuLog(LOG_LEVEL::DEBUG, "Skipping async TD");
return 1;
}
if (OHCI_ReadTD(addr, &td)) {
@ -681,7 +681,7 @@ int OHCI::OHCI_ServiceTD(OHCI_ED* Ed)
// From QEMU: "??? The hardware should allow one active packet per endpoint.
// We only allow one active packet per controller. This should be sufficient
// as long as devices respond in a timely manner."
DBG_PRINTF("too many pending packets\n");
EmuLog(LOG_LEVEL::DEBUG, "too many pending packets");
return 1;
}
dev = OHCI_FindDevice(OHCI_BM(Ed->Flags, ED_FA));
@ -755,29 +755,29 @@ int OHCI::OHCI_ServiceTD(OHCI_ED* Ed)
}
else {
if (ret >= 0) {
DBG_PRINTF("Underrun\n");
EmuLog(LOG_LEVEL::DEBUG, "Underrun");
OHCI_SET_BM(td.Flags, TD_CC, OHCI_CC_DATAUNDERRUN);
}
else {
switch (ret) {
case USB_RET_IOERROR:
case USB_RET_NODEV:
DBG_PRINTF("Received DEV ERROR\n");
EmuLog(LOG_LEVEL::DEBUG, "Received DEV ERROR");
OHCI_SET_BM(td.Flags, TD_CC, OHCI_CC_DEVICENOTRESPONDING);
break;
case USB_RET_NAK:
DBG_PRINTF("Received NAK\n");
EmuLog(LOG_LEVEL::DEBUG, "Received NAK");
return 1;
case USB_RET_STALL:
DBG_PRINTF("Received STALL\n");
EmuLog(LOG_LEVEL::DEBUG, "Received STALL");
OHCI_SET_BM(td.Flags, TD_CC, OHCI_CC_STALL);
break;
case USB_RET_BABBLE:
DBG_PRINTF("Received BABBLE\n");
EmuLog(LOG_LEVEL::DEBUG, "Received BABBLE");
OHCI_SET_BM(td.Flags, TD_CC, OHCI_CC_DATAOVERRUN);
break;
default:
DBG_PRINTF("Bad device response %d\n", ret);
EmuLog(LOG_LEVEL::DEBUG, "Bad device response %d", ret);
OHCI_SET_BM(td.Flags, TD_CC, OHCI_CC_UNDEXPETEDPID);
OHCI_SET_BM(td.Flags, TD_EC, 3);
}
@ -874,7 +874,7 @@ void OHCI::OHCI_StateReset()
OHCI_StopEndpoints();
DBG_PRINTF("Reset event.\n");
EmuLog(LOG_LEVEL::DEBUG, "Reset event.");
}
void OHCI::OHCI_BusStart()
@ -882,7 +882,7 @@ void OHCI::OHCI_BusStart()
// Create the EOF timer.
m_pEOFtimer = Timer_Create(OHCI_FrameBoundaryWrapper, this, "", nullptr);
DBG_PRINTF("Operational event\n");
EmuLog(LOG_LEVEL::DEBUG, "Operational event");
// SOF event
OHCI_SOF(true);
@ -929,11 +929,11 @@ void OHCI::OHCI_ChangeState(uint32_t Value)
case Suspend:
OHCI_BusStop();
DBG_PRINTF("Suspend event\n");
EmuLog(LOG_LEVEL::DEBUG, "Suspend event");
break;
case Resume:
DBG_PRINTF("Resume event\n");
EmuLog(LOG_LEVEL::DEBUG, "Resume event");
break;
case Reset:
@ -960,7 +960,7 @@ uint32_t OHCI::OHCI_ReadRegister(xbaddr Addr)
if (Addr & 3) {
// The standard allows only aligned reads to the registers
DBG_PRINTF("Unaligned read. Ignoring.\n");
EmuLog(LOG_LEVEL::DEBUG, "Unaligned read. Ignoring.");
return ret;
}
else {
@ -1099,7 +1099,7 @@ void OHCI::OHCI_WriteRegister(xbaddr Addr, uint32_t Value)
{
if (Addr & 3) {
// The standard allows only aligned writes to the registers
DBG_PRINTF("Unaligned write. Ignoring.\n");
EmuLog(LOG_LEVEL::DEBUG, "Unaligned write. Ignoring.");
return;
}
else {
@ -1189,7 +1189,7 @@ void OHCI::OHCI_WriteRegister(xbaddr Addr, uint32_t Value)
case 13: // HcFmInterval
{
if ((Value & OHCI_FMI_FI) != (m_Registers.HcFmInterval & OHCI_FMI_FI)) {
DBG_PRINTF("Changing frame interval duration. New value is %u\n", Value & OHCI_FMI_FI);
EmuLog(LOG_LEVEL::DEBUG, "Changing frame interval duration. New value is %u", Value & OHCI_FMI_FI);
}
m_Registers.HcFmInterval = Value & ~0xC000;
DUMP_REG_W(m_Registers.HcFmInterval, Value);
@ -1328,7 +1328,7 @@ void OHCI::OHCI_SetHubStatus(uint32_t Value)
for (i = 0; i < 4; i++) {
OHCI_PortPower(i, 0);
}
DBG_PRINTF("powered down all ports\n");
EmuLog(LOG_LEVEL::DEBUG, "powered down all ports");
}
if (Value & OHCI_RHS_LPSC) {
@ -1337,7 +1337,7 @@ void OHCI::OHCI_SetHubStatus(uint32_t Value)
for (i = 0; i < 4; i++) {
OHCI_PortPower(i, 1);
}
DBG_PRINTF("powered up all ports\n");
EmuLog(LOG_LEVEL::DEBUG, "powered up all ports");
}
if (Value & OHCI_RHS_DRWE) {
@ -1386,11 +1386,11 @@ void OHCI::OHCI_PortSetStatus(int PortNum, uint32_t Value)
OHCI_PortSetIfConnected(PortNum, Value & OHCI_PORT_PES);
if (OHCI_PortSetIfConnected(PortNum, Value & OHCI_PORT_PSS)) {
DBG_PRINTF("port %d: SUSPEND\n", PortNum);
EmuLog(LOG_LEVEL::DEBUG, "port %d: SUSPEND", PortNum);
}
if (OHCI_PortSetIfConnected(PortNum, Value & OHCI_PORT_PRS)) {
DBG_PRINTF("port %d: RESET\n", PortNum);
EmuLog(LOG_LEVEL::DEBUG, "port %d: RESET", PortNum);
m_UsbDevice->USB_DeviceReset(port->UsbPort.Dev);
port->HcRhPortStatus &= ~OHCI_PORT_PRS;
// ??? Should this also set OHCI_PORT_PESC
@ -1458,7 +1458,7 @@ void OHCI::OHCI_Detach(USBPort* Port)
port->HcRhPortStatus |= OHCI_PORT_PESC;
}
DBG_PRINTF("Detached port %d\n", Port->PortIndex);
EmuLog(LOG_LEVEL::DEBUG, "Detached port %d", Port->PortIndex);
if (old_state != port->HcRhPortStatus) {
OHCI_SetInterrupt(OHCI_INTR_RHSC);
@ -1486,7 +1486,7 @@ void OHCI::OHCI_Attach(USBPort* Port)
OHCI_SetInterrupt(OHCI_INTR_RD);
}
DBG_PRINTF("Attached port %d\n", Port->PortIndex);
EmuLog(LOG_LEVEL::DEBUG, "Attached port %d", Port->PortIndex);
if (old_state != port->HcRhPortStatus) {
OHCI_SetInterrupt(OHCI_INTR_RHSC);
@ -1503,14 +1503,14 @@ void OHCI::OHCI_Wakeup(USBPort* port1)
OHCIPort* port = &m_Registers.RhPort[port1->PortIndex];
uint32_t intr = 0;
if (port->HcRhPortStatus & OHCI_PORT_PSS) {
DBG_PRINTF("port %d: wakeup\n", port1->PortIndex);
EmuLog(LOG_LEVEL::DEBUG, "port %d: wakeup", port1->PortIndex);
port->HcRhPortStatus |= OHCI_PORT_PSSC;
port->HcRhPortStatus &= ~OHCI_PORT_PSS;
intr = OHCI_INTR_RHSC;
}
// Note that the controller can be suspended even if this port is not
if ((m_Registers.HcControl & OHCI_CTL_HCFS) == Suspend) {
DBG_PRINTF("remote-wakeup: SUSPEND->RESUME\n");
EmuLog(LOG_LEVEL::DEBUG, "remote-wakeup: SUSPEND->RESUME");
// From the OHCI standard: "The only interrupts possible in the USBSUSPEND state are ResumeDetected (the
// Host Controller will have changed the HostControllerFunctionalState to the USBRESUME state)
// and OwnershipChange."
@ -1545,7 +1545,7 @@ void OHCI::OHCI_ProcessLists(int completion)
// Only process the control list if it is enabled (HcControl) and has available TD's (HcCommandStatus)
if ((m_Registers.HcControl & OHCI_CTL_CLE) && (m_Registers.HcCommandStatus & OHCI_STATUS_CLF)) {
if (m_Registers.HcControlCurrentED && m_Registers.HcControlCurrentED != m_Registers.HcControlHeadED) {
DBG_PRINTF("head 0x%X, current 0x%X\n", m_Registers.HcControlHeadED, m_Registers.HcControlCurrentED);
EmuLog(LOG_LEVEL::DEBUG, "head 0x%X, current 0x%X", m_Registers.HcControlHeadED, m_Registers.HcControlCurrentED);
}
if (!OHCI_ServiceEDlist(m_Registers.HcControlHeadED, completion)) {
m_Registers.HcControlCurrentED = 0;
@ -1585,7 +1585,7 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
addr = ed->HeadP & OHCI_DPTR_MASK;
if (OHCI_ReadIsoTD(addr, &iso_td)) {
DBG_PRINTF("ISO_TD read error at physical address 0x%X\n", addr);
EmuLog(LOG_LEVEL::DEBUG, "ISO_TD read error at physical address 0x%X", addr);
OHCI_FatalError();
return 0;
}
@ -1616,13 +1616,13 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
if (relative_frame_number < 0) {
// From the OHCI standard: "If the relative frame number is negative, then the current frame is earlier than the 0th frame
// of the Isochronous TD and the Host Controller advances to the next ED."
DBG_PRINTF("ISO_TD R=%d < 0\n", relative_frame_number);
EmuLog(LOG_LEVEL::DEBUG, "ISO_TD R=%d < 0", relative_frame_number);
return 1;
}
else if (relative_frame_number > frame_count) {
// From the OHCI standard: "If the relative frame number is greater than
// FrameCount, then the Isochronous TD has expired and a error condition exists."
DBG_PRINTF("ISO_TD R=%d > FC=%d\n", relative_frame_number, frame_count);
EmuLog(LOG_LEVEL::DEBUG, "ISO_TD R=%d > FC=%d", relative_frame_number, frame_count);
OHCI_SET_BM(iso_td.Flags, TD_CC, OHCI_CC_DATAOVERRUN);
ed->HeadP &= ~OHCI_DPTR_MASK;
ed->HeadP |= (iso_td.NextTD & OHCI_DPTR_MASK);
@ -1668,7 +1668,7 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
}
if (!iso_td.BufferPage0 || !iso_td.BufferEnd) {
DBG_PRINTF("ISO_TD bp 0x%.8X be 0x%.8X\n", iso_td.BufferPage0, iso_td.BufferEnd);
EmuLog(LOG_LEVEL::DEBUG, "ISO_TD bp 0x%.8X be 0x%.8X", iso_td.BufferPage0, iso_td.BufferEnd);
return 1;
}
@ -1686,7 +1686,7 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xE) ||
((relative_frame_number < frame_count) &&
!(OHCI_BM(next_offset, TD_PSW_CC) & 0xE))) {
DBG_PRINTF("ISO_TD cc != not accessed 0x%.8x 0x%.8x\n", start_offset, next_offset);
EmuLog(LOG_LEVEL::DEBUG, "ISO_TD cc != not accessed 0x%.8x 0x%.8x", start_offset, next_offset);
return 1;
}
@ -1789,12 +1789,12 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
else {
// Handle the error condition
if (ret > static_cast<ptrdiff_t>(len)) { // Sequence Error
DBG_PRINTF("DataOverrun %d > %zu\n", ret, len);
EmuLog(LOG_LEVEL::DEBUG, "DataOverrun %d > %zu", ret, len);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_CC, OHCI_CC_DATAOVERRUN);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_SIZE, len);
}
else if (ret >= 0) { // Sequence Error
DBG_PRINTF("DataUnderrun %d\n", ret);
EmuLog(LOG_LEVEL::DEBUG, "DataUnderrun %d", ret);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_CC, OHCI_CC_DATAUNDERRUN);
}
else {
@ -1806,12 +1806,12 @@ int OHCI::OHCI_ServiceIsoTD(OHCI_ED* ed, int completion)
break;
case USB_RET_NAK: // NAK and STALL
case USB_RET_STALL:
DBG_PRINTF("got NAK/STALL %d\n", ret);
EmuLog(LOG_LEVEL::DEBUG, "got NAK/STALL %d", ret);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_CC, OHCI_CC_STALL);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_SIZE, 0);
break;
default: // Unknown Error
DBG_PRINTF("Bad device response %d\n", ret);
EmuLog(LOG_LEVEL::DEBUG, "Bad device response %d", ret);
OHCI_SET_BM(iso_td.Offset[relative_frame_number], TD_PSW_CC, OHCI_CC_UNDEXPETEDPID);
break;
}

View File

@ -379,7 +379,7 @@ void USBDevice::USB_DoTokenSetup(XboxDeviceState* s, USBPacket* p)
}
else {
if (s->SetupLength > sizeof(s->DataBuffer)) {
DBG_PRINTF("CTRL buffer too small (%d > %zu)\n", s->SetupLength, sizeof(s->DataBuffer));
EmuLog(LOG_LEVEL::DEBUG, "CTRL buffer too small (%d > %zu)", s->SetupLength, sizeof(s->DataBuffer));
p->Status = USB_RET_STALL;
return;
}
@ -862,7 +862,7 @@ int USBDevice::USBDesc_HandleControl(XboxDeviceState* dev, USBPacket *p,
// From the USB 1.1 standard: "This request sets the device address for all future device accesses.
// The wValue field specifies the device address to use for all subsequent accesses"
dev->Addr = value;
DBG_PRINTF("Address 0x%X set for device %s\n", dev->Addr, dev->ProductDesc.c_str());
EmuLog(LOG_LEVEL::DEBUG, "Address 0x%X set for device %s", dev->Addr, dev->ProductDesc.c_str());
ret = 0;
break;
}
@ -888,7 +888,7 @@ int USBDevice::USBDesc_HandleControl(XboxDeviceState* dev, USBPacket *p,
// From the USB 1.1 standard: "This request sets the device configuration. The lower byte of the wValue field specifies the desired configuration.
// This configuration value must be zero or match a configuration value from a configuration descriptor"
ret = USBDesc_SetConfig(dev, value);
DBG_PRINTF("Received standard SetConfiguration() request for device at address 0x%X. Configuration selected is %d and returned %d\n",
EmuLog(LOG_LEVEL::DEBUG, "Received standard SetConfiguration() request for device at address 0x%X. Configuration selected is %d and returned %d",
dev->Addr, value, ret);
break;
}
@ -922,7 +922,7 @@ int USBDevice::USBDesc_HandleControl(XboxDeviceState* dev, USBPacket *p,
dev->RemoteWakeup = 0;
ret = 0;
}
DBG_PRINTF("Received standard ClearFeature() request for device at address 0x%X. Feature selected is %d and returned %d\n",
EmuLog(LOG_LEVEL::DEBUG, "Received standard ClearFeature() request for device at address 0x%X. Feature selected is %d and returned %d",
dev->Addr, value, ret);
break;
}
@ -934,7 +934,7 @@ int USBDevice::USBDesc_HandleControl(XboxDeviceState* dev, USBPacket *p,
dev->RemoteWakeup = 1;
ret = 0;
}
DBG_PRINTF("Received standard SetFeature() request for device at address 0x%X. Feature selected is %d and returned %d\n",
EmuLog(LOG_LEVEL::DEBUG, "Received standard SetFeature() request for device at address 0x%X. Feature selected is %d and returned %d",
dev->Addr, value, ret);
break;
}
@ -983,7 +983,7 @@ int USBDevice::USBDesc_HandleStandardGetDescriptor(XboxDeviceState* dev, USBPack
switch (type) {
case USB_DT_DEVICE: {
ret = USB_ReadDeviceDesc(&desc->id, dev->Device, buf, sizeof(buf));
DBG_PRINTF("Read operation of device descriptor of device 0x%X returns %d\n", dev->Addr, ret);
EmuLog(LOG_LEVEL::DEBUG, "Read operation of device descriptor of device 0x%X returns %d", dev->Addr, ret);
break;
}
@ -991,13 +991,13 @@ int USBDevice::USBDesc_HandleStandardGetDescriptor(XboxDeviceState* dev, USBPack
if (index < dev->Device->bNumConfigurations) {
ret = USB_ReadConfigurationDesc(dev->Device->confs + index, flags, buf, sizeof(buf));
}
DBG_PRINTF("Read operation of configuration descriptor %d of device 0x%X returns %d\n", index, dev->Addr, ret);
EmuLog(LOG_LEVEL::DEBUG, "Read operation of configuration descriptor %d of device 0x%X returns %d", index, dev->Addr, ret);
break;
}
case USB_DT_STRING: {
ret = USB_ReadStringDesc(dev, index, buf, sizeof(buf));
DBG_PRINTF("Read operation of string descriptor %d of device 0x%X returns %d\n", index, dev->Addr, ret);
EmuLog(LOG_LEVEL::DEBUG, "Read operation of string descriptor %d of device 0x%X returns %d", index, dev->Addr, ret);
break;
}

View File

@ -340,7 +340,7 @@ void XidGamepad::UsbXid_Attach(XboxDeviceState* dev)
void XidGamepad::UsbXid_HandleReset()
{
DBG_PRINTF("Reset event\n");
EmuLog(LOG_LEVEL::DEBUG, "Reset event");
}
void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
@ -348,7 +348,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
{
int ret = m_UsbDev->USBDesc_HandleControl(dev, p, request, value, index, length, data);
if (ret >= 0) {
DBG_PRINTF("Handled by USBDesc_HandleControl, ret is %d\n", ret);
EmuLog(LOG_LEVEL::DEBUG, "Handled by USBDesc_HandleControl, ret is %d", ret);
return;
}
@ -358,7 +358,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
// From the HID standard: "The Get_Report request allows the host to receive a report via the Control pipe.
// The wValue field specifies the Report Type in the high byte and the Report ID in the low byte. Set Report ID
// to 0 (zero) if Report IDs are not used. 01 = input, 02 = output, 03 = feature, 04-FF = reserved"
DBG_PRINTF("GET_REPORT xpad request 0x%X\n", value);
EmuLog(LOG_LEVEL::DEBUG, "GET_REPORT xpad request 0x%X", value);
// JayFoxRox's analysis: "This 0x0100 case is for input.
// This is the case where the Xbox wants to read input data from the controller.
// Confirmed with a real Duke controller :
@ -399,7 +399,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
// setting the state of input, output, or feature controls. The meaning of the request fields for the Set_Report
// request is the same as for the Get_Report request, however the data direction is reversed and the Report
// Data is sent from host to device."
DBG_PRINTF("SET_REPORT xpad request 0x%X\n", value);
EmuLog(LOG_LEVEL::DEBUG, "SET_REPORT xpad request 0x%X", value);
// JayFoxRox's analysis: "The 0x0200 case below is for output.
// This is the case where the Xbox wants to write rumble data to the controller.
// To my knowledge :
@ -429,7 +429,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
// XID-specific requests
case VendorInterfaceRequest | USB_REQ_GET_DESCRIPTOR: {
DBG_PRINTF("GET_DESCRIPTOR xpad request 0x%x\n", value);
EmuLog(LOG_LEVEL::DEBUG, "GET_DESCRIPTOR xpad request 0x%x", value);
if (value == 0x4200) {
assert(m_XidState->xid_desc->bLength <= length);
std::memcpy(data, m_XidState->xid_desc, m_XidState->xid_desc->bLength);
@ -443,7 +443,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
}
case VendorInterfaceRequest | XID_GET_CAPABILITIES: {
DBG_PRINTF("XID_GET_CAPABILITIES xpad request 0x%x\n", value);
EmuLog(LOG_LEVEL::DEBUG, "XID_GET_CAPABILITIES xpad request 0x%x", value);
if (value == 0x0100) {
if (length > m_XidState->in_state_capabilities.bLength) {
length = m_XidState->in_state_capabilities.bLength;
@ -467,7 +467,7 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
case ((USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_DEVICE) << 8) | USB_REQ_GET_DESCRIPTOR: {
/* FIXME: ! */
DBG_PRINTF("Unknown xpad request 0x%X: value = 0x%X\n", request, value);
EmuLog(LOG_LEVEL::DEBUG, "Unknown xpad request 0x%X: value = 0x%X", request, value);
std::memset(data, 0x00, length);
//FIXME: Intended for the hub: usbd_get_hub_descriptor, UT_READ_CLASS?!
p->Status = USB_RET_STALL;
@ -477,14 +477,14 @@ void XidGamepad::UsbXid_HandleControl(XboxDeviceState* dev, USBPacket* p,
case ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_ENDPOINT) << 8) | USB_REQ_CLEAR_FEATURE: {
/* FIXME: ! */
DBG_PRINTF("Unknown xpad request 0x%X: value = 0x%X\n", request, value);
EmuLog(LOG_LEVEL::DEBUG, "Unknown xpad request 0x%X: value = 0x%X", request, value);
std::memset(data, 0x00, length);
p->Status = USB_RET_STALL;
break;
}
default:
DBG_PRINTF("USB stalled on request 0x%X value 0x%X\n", request, value);
EmuLog(LOG_LEVEL::DEBUG, "USB stalled on request 0x%X value 0x%X", request, value);
p->Status = USB_RET_STALL;
assert(0);
break;
@ -558,7 +558,7 @@ void XidGamepad::UpdateForceFeedback()
// implementation is untested and could potentially contain errors
/* FIXME: Check actuator endianess */
DBG_PRINTF("Set rumble power to left: 0x%X and right: 0x%X\n",
EmuLog(LOG_LEVEL::DEBUG, "Set rumble power to left: 0x%X and right: 0x%X",
m_XidState->out_state.left_actuator_strength,
m_XidState->out_state.right_actuator_strength);
}

View File

@ -160,11 +160,11 @@ static void update_irq(NV2AState *d)
#include "EmuNV2A_DEBUG.cpp"
#define DEBUG_READ32(DEV) DBG_PRINTF("Rd32 NV2A " #DEV "(0x%08X) = 0x%08X [Handled %s]\n", addr, result, DebugNV_##DEV##(addr))
#define DEBUG_READ32_UNHANDLED(DEV) { DBG_PRINTF("Rd32 NV2A " #DEV "(0x%08X) = 0x%08X [Unhandled %s]\n", addr, result, DebugNV_##DEV##(addr)); return result; }
#define DEBUG_READ32(DEV) EmuLog(LOG_LEVEL::DEBUG, "Rd32 NV2A " #DEV "(0x%08X) = 0x%08X [Handled %s]", addr, result, DebugNV_##DEV##(addr))
#define DEBUG_READ32_UNHANDLED(DEV) { EmuLog(LOG_LEVEL::DEBUG, "Rd32 NV2A " #DEV "(0x%08X) = 0x%08X [Unhandled %s]", addr, result, DebugNV_##DEV##(addr)); return result; }
#define DEBUG_WRITE32(DEV) DBG_PRINTF("Wr32 NV2A " #DEV "(0x%08X, 0x%08X) [Handled %s]\n", addr, value, DebugNV_##DEV##(addr))
#define DEBUG_WRITE32_UNHANDLED(DEV) { DBG_PRINTF("Wr32 NV2A " #DEV "(0x%08X, 0x%08X) [Unhandled %s]\n", addr, value, DebugNV_##DEV##(addr)); return; }
#define DEBUG_WRITE32(DEV) EmuLog(LOG_LEVEL::DEBUG, "Wr32 NV2A " #DEV "(0x%08X, 0x%08X) [Handled %s]", addr, value, DebugNV_##DEV##(addr))
#define DEBUG_WRITE32_UNHANDLED(DEV) { EmuLog(LOG_LEVEL::DEBUG, "Wr32 NV2A " #DEV "(0x%08X, 0x%08X) [Unhandled %s]", addr, value, DebugNV_##DEV##(addr)); return; }
#define DEVICE_READ32(DEV) uint32_t EmuNV2A_##DEV##_Read32(NV2AState *d, xbaddr addr)
#define DEVICE_READ32_SWITCH() uint32_t result = 0; switch (addr)

View File

@ -169,7 +169,7 @@ uint32_t EmuFlash_Read32(xbaddr addr) // TODO : Move to EmuFlash.cpp
return -1;
}
DBG_PRINTF("Read32 FLASH_ROM (0x%.8X) = 0x%.8X [HANDLED]\n", addr, r);
EmuLog(LOG_LEVEL::DEBUG, "Read32 FLASH_ROM (0x%.8X) = 0x%.8X [HANDLED]", addr, r);
return r;
}
@ -201,7 +201,7 @@ uint32_t EmuX86_Read(xbaddr addr, int size)
//pass the memory-access through to normal memory :
value = EmuX86_Mem_Read(addr, size);
DBG_PRINTF("Read(0x%08X, %d) = 0x%08X\n", addr, size, value);
EmuLog(LOG_LEVEL::DEBUG, "Read(0x%08X, %d) = 0x%08X", addr, size, value);
}
return value;
@ -226,7 +226,7 @@ void EmuX86_Write(xbaddr addr, uint32_t value, int size)
}
// Pass the memory-access through to normal memory :
DBG_PRINTF("Write(0x%.8X, 0x%.8X, %d)\n", addr, value, size);
EmuLog(LOG_LEVEL::DEBUG, "Write(0x%.8X, 0x%.8X, %d)", addr, value, size);
EmuX86_Mem_Write(addr, value, size);
}
@ -3309,7 +3309,7 @@ opcode_error:
void EmuX86_Init()
{
DBG_PRINTF("Initializing distorm version %d\n", distorm_version());
EmuLog(LOG_LEVEL::DEBUG, "Initializing distorm version %d", distorm_version());
AddVectoredExceptionHandler(/*FirstHandler=*/ULONG(true), lleException);

View File

@ -120,7 +120,7 @@ void WndMain::ResizeWindow(HWND hwnd, bool bForGUI)
const char* resolution = XBVideoConf.szVideoResolution;
if (2 != sscanf(resolution, "%d x %d", &m_w, &m_h)) {
DBG_PRINTF("Couldn't parse resolution : %s.\n", resolution);
EmuLog(LOG_LEVEL::DEBUG, "Couldn't parse resolution : %s.", resolution);
}
}