DbgPrintf and EmuWarning updates; Changed one into the other where applicable, prefixed GetCurrentThreadId() centrally, removed or added newlines where required.

This commit is contained in:
PatrickvL 2017-01-10 17:15:24 +01:00
parent 0f8ee7d7dc
commit bf7a74b248
17 changed files with 792 additions and 784 deletions

View File

@ -147,7 +147,7 @@ extern thread_local std::string _logPrefix;
do { if(g_bPrintfOn) { \
bool _had_arg = false; \
std::stringstream tmp; \
tmp << __FILENAME__ << " (" << hex2((uint16_t)GetCurrentThreadId()) << "): "; \
tmp << "[" << hex2((uint16_t)GetCurrentThreadId()) << "] " << __FILENAME__ << ": "; \
_logPrefix = tmp.str(); \
std::stringstream msg; \
msg << _logPrefix << __func__ << "(";

View File

@ -106,7 +106,7 @@ extern volatile bool g_bPrintfOn;
/*! DbgPrintf enabled if _DEBUG_TRACE is set */
#ifdef _DEBUG_TRACE
#define DbgPrintf(fmt, ...) do { if(g_bPrintfOn) printf(fmt, ##__VA_ARGS__); } while (0)
#define DbgPrintf(fmt, ...) do { if(g_bPrintfOn) printf("[0x%X] "##fmt, GetCurrentThreadId(), ##__VA_ARGS__); } while (0)
#else
inline void null_func(...) { }
#define DbgPrintf null_func

View File

@ -397,8 +397,8 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
SetConsoleTextAttribute(StdHandle, FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
printf("EmuMain (0x%X): Cxbx-Reloaded Version %s\n", GetCurrentThreadId(), _CXBX_VERSION);
printf("EmuMain (0x%X): Debug Console Allocated (DM_CONSOLE).\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Cxbx-Reloaded Version %s\n", GetCurrentThreadId(), _CXBX_VERSION);
printf("[0x%X] EmuMain: Debug Console Allocated (DM_CONSOLE).\n", GetCurrentThreadId());
}
}
else if (DbgMode == DM_FILE)
@ -407,8 +407,8 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
freopen(szDebugFilename, "wt", stdout);
printf("EmuMain (0x%X): Cxbx-Reloaded Version %s\n", GetCurrentThreadId(), _CXBX_VERSION);
printf("EmuMain (0x%X): Debug Console Allocated (DM_FILE).\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Cxbx-Reloaded Version %s\n", GetCurrentThreadId(), _CXBX_VERSION);
printf("[0x%X] EmuMain: Debug Console Allocated (DM_FILE).\n", GetCurrentThreadId());
}
else
{
@ -426,9 +426,9 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
{
#ifdef _DEBUG_TRACE
printf("EmuMain (0x%X): Debug Trace Enabled.\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Debug Trace Enabled.\n", GetCurrentThreadId());
printf("EmuMain (0x%X): CxbxKrnlInit\n"
printf("[0x%X] EmuMain: CxbxKrnlInit\n"
"(\n"
" hwndParent : 0x%.08X\n"
" pTLSData : 0x%.08X\n"
@ -443,7 +443,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
GetCurrentThreadId(), hwndParent, pTLSData, pTLS, pLibraryVersion, DbgMode, szDebugFilename, pXbeHeader, dwXbeHeaderSize, Entry);
#else
printf("EmuMain (0x%X): Debug Trace Disabled.\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Debug Trace Disabled.\n", GetCurrentThreadId());
#endif
}
@ -599,17 +599,17 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
//
// initialize grapchics
//
DbgPrintf("EmuMain (0x%X): Initializing render window.\n", GetCurrentThreadId());
DbgPrintf("EmuMain: Initializing render window.\n");
XTL::CxbxInitWindow(pXbeHeader, dwXbeHeaderSize);
if (bLLE_GPU)
{
DbgPrintf("EmuMain (0x%X): Initializing OpenGL.\n", GetCurrentThreadId());
DbgPrintf("EmuMain: Initializing OpenGL.\n");
InitOpenGLContext();
}
else
{
DbgPrintf("EmuMain (0x%X): Initializing Direct3D.\n", GetCurrentThreadId());
DbgPrintf("EmuMain: Initializing Direct3D.\n");
XTL::EmuD3DInit(pXbeHeader, dwXbeHeaderSize);
}
@ -627,11 +627,11 @@ extern "C" CXBXKRNL_API void CxbxKrnlInit
EmuX86_Init();
DbgPrintf("EmuMain (0x%X): Initial thread starting.\n", GetCurrentThreadId());
DbgPrintf("EmuMain: Initial thread starting.\n");
CxbxLaunchXbe(Entry);
DbgPrintf("EmuMain (0x%X): Initial thread ended.\n", GetCurrentThreadId());
DbgPrintf("EmuMain: Initial thread ended.\n");
fflush(stdout);
@ -654,7 +654,7 @@ extern "C" CXBXKRNL_API void CxbxKrnlCleanup(const char *szErrorMessage, ...)
va_list argp;
sprintf(szBuffer1, "EmuMain (0x%X): Recieved Fatal Message:\n\n* ", GetCurrentThreadId());
sprintf(szBuffer1, "[0x%X] EmuMain: Recieved Fatal Message:\n\n* ", GetCurrentThreadId());
va_start(argp, szErrorMessage);
@ -796,12 +796,12 @@ extern "C" CXBXKRNL_API void CxbxKrnlTerminateThread()
extern "C" CXBXKRNL_API void CxbxKrnlPanic()
{
DbgPrintf("EmuMain (0x%X): CxbxKrnlPanic()\n", GetCurrentThreadId());
DbgPrintf("EmuMain: CxbxKrnlPanic()\n");
CxbxKrnlCleanup("Kernel Panic!");
}
extern "C" CXBXKRNL_API void CxbxKrnlNoFunc()
{
DbgPrintf("EmuMain (0x%X): CxbxKrnlNoFunc()\n", GetCurrentThreadId());
DbgPrintf("EmuMain: CxbxKrnlNoFunc()\n");
}

View File

@ -124,7 +124,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuWarning(const char *szWarningMessage, ...)
va_list argp;
sprintf(szBuffer1, "EmuWarn (0x%X): ", GetCurrentThreadId());
sprintf(szBuffer1, "[0x%X] EmuWarn: ", GetCurrentThreadId());
va_start(argp, szWarningMessage);
@ -150,9 +150,9 @@ void EmuExceptionPrintDebugInformation(LPEXCEPTION_POINTERS e, bool IsBreakpoint
// print debug information
{
if (IsBreakpointException)
printf("EmuMain (0x%X): Recieved Breakpoint Exception (int 3)\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Recieved Breakpoint Exception (int 3)\n", GetCurrentThreadId());
else
printf("EmuMain (0x%X): Recieved Exception (Code := 0x%.08X)\n", GetCurrentThreadId(), e->ExceptionRecord->ExceptionCode);
printf("[0x%X] EmuMain: Recieved Exception (Code := 0x%.08X)\n", GetCurrentThreadId(), e->ExceptionRecord->ExceptionCode);
printf("\n"
" EIP := 0x%.08X EFL := 0x%.08X\n"
@ -176,7 +176,7 @@ void EmuExceptionPrintDebugInformation(LPEXCEPTION_POINTERS e, bool IsBreakpoint
void EmuExceptionExitProcess()
{
printf("EmuMain (0x%X): Aborting Emulation\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Aborting Emulation\n", GetCurrentThreadId());
fflush(stdout);
if (CxbxKrnl_hEmuParent != NULL)
@ -205,7 +205,7 @@ bool EmuExceptionBreakpointAsk(LPEXCEPTION_POINTERS e)
}
else if (ret == IDIGNORE)
{
printf("EmuMain (0x%X): Ignored Breakpoint Exception\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Ignored Breakpoint Exception\n", GetCurrentThreadId());
fflush(stdout);
e->ContextRecord->Eip += 1; // TODO : Skip actual instruction size bytes
@ -298,9 +298,9 @@ int ExitException(LPEXCEPTION_POINTERS e)
static int count = 0;
// debug information
printf("EmuMain (0x%X): * * * * * EXCEPTION * * * * *\n", GetCurrentThreadId());
printf("EmuMain (0x%X): Recieved Exception [0x%.08X]@0x%.08X\n", GetCurrentThreadId(), e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip);
printf("EmuMain (0x%X): * * * * * EXCEPTION * * * * *\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: * * * * * EXCEPTION * * * * *\n", GetCurrentThreadId());
printf("[0x%X] EmuMain: Recieved Exception [0x%.08X]@0x%.08X\n", GetCurrentThreadId(), e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip);
printf("[0x%X] EmuMain: * * * * * EXCEPTION * * * * *\n", GetCurrentThreadId());
fflush(stdout);

File diff suppressed because it is too large Load Diff

View File

@ -804,7 +804,7 @@ HRESULT XTL::CreatePixelShaderFunction(X_D3DPIXELSHADERDEF *pPSD, LPD3DXBUFFER*
if (FAILED(hRet))
{
EmuWarning("Couldn't assemble recompiled pixel shader\n");
EmuWarning("Couldn't assemble recompiled pixel shader");
if (pCompilationErrors)
{
EmuWarning((const char*)pCompilationErrors->GetBufferPointer());
@ -813,7 +813,7 @@ HRESULT XTL::CreatePixelShaderFunction(X_D3DPIXELSHADERDEF *pPSD, LPD3DXBUFFER*
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
DbgPrintf("Pixel Shader : Exception while creating pixel shader 0x%.8X", pPSD);
DbgPrintf("Pixel Shader : Exception while creating pixel shader 0x%.8X\n", pPSD);
}
if (pCompilationErrors)
{
@ -1426,7 +1426,7 @@ inline void HandleInputOutput
if (bEFProduct)
{
EmuWarning("EF Product and V1R0 register used at the same time!\n");
EmuWarning("EF Product and V1R0 register used at the same time!");
}
else
{
@ -1947,7 +1947,7 @@ inline BOOL OptimizeOperation
{
if (szMod[0])
{
EmuWarning("Pixel Shader: Destination modifier present!\n");
EmuWarning("Pixel Shader: Destination modifier present!");
}
switch (eOpTypes[2])
{
@ -2072,7 +2072,7 @@ inline BOOL OptimizeOperation
{
if (szOutputs[2][0] != 'r')
{
EmuWarning("Pixel Shader: Destination not temporary register!\n");
EmuWarning("Pixel Shader: Destination not temporary register!");
}
// ab input
iOffset += sprintf(szCommand + iOffset, "mul%s r1, %s, %s\n",
@ -2404,7 +2404,7 @@ inline BOOL OptimizeOperation
}
if (!bHandled)
{
EmuWarning("Unhandled pixel shader instruction!\n");
EmuWarning("Unhandled pixel shader instruction!");
}
// if (strcmp(szOps[2], "add") == 0)
// {
@ -2418,7 +2418,7 @@ inline BOOL OptimizeOperation
// }
// else
// {
// EmuWarning("Unhandled pixel shader instruction!\n");
// EmuWarning("Unhandled pixel shader instruction!");
// }
// }
// else if (strcmp(szOps[2], "cnd") == 0)
@ -2433,12 +2433,12 @@ inline BOOL OptimizeOperation
// }
// else
// {
// EmuWarning("Unhandled pixel shader instruction!\n");
// EmuWarning("Unhandled pixel shader instruction!");
// }
// }
// else
// {
// EmuWarning("Unhandled pixel shader instruction!\n");
// EmuWarning("Unhandled pixel shader instruction!");
// }
}
}

View File

@ -534,7 +534,7 @@ static void VshParseInstruction(uint32 *pShaderToken,
pInstruction->A.Address = ConvertCRegister(VshGetField(pShaderToken, FLD_CONST));
break;
default:
EmuWarning("Invalid instruction, parameter A type unknown %d\n", pInstruction->A.ParameterType);
EmuWarning("Invalid instruction, parameter A type unknown %d", pInstruction->A.ParameterType);
return;
}
pInstruction->A.Neg = VshGetField(pShaderToken, FLD_A_NEG);
@ -1300,7 +1300,7 @@ static boolean VshConvertShader(VSH_XBOX_SHADER *pShader,
if(pIntermediate->Output.Type != IMD_OUTPUT_R)
{
// TODO: Complete dph support
EmuWarning("Can't simulate dph for other than output r registers (yet)\n");
EmuWarning("Can't simulate dph for other than output r registers (yet)");
// attempt to find unused register...
int outRegister = -1;
@ -1573,7 +1573,7 @@ static void VshConvertToken_NOP(DWORD *pToken)
// D3DVSD_NOP
if(*pToken != DEF_VSH_NOP)
{
EmuWarning("Token NOP found, but extra parameters are given!\n");
EmuWarning("Token NOP found, but extra parameters are given!");
}
DbgVshPrintf("\tD3DVSD_NOP(),\n");
}
@ -1882,7 +1882,7 @@ static void VshConvertToken_STREAMDATA_REG(DWORD *pToken,
if(NewDataType == 0xFF)
{
EmuWarning("/* WARNING: Fatal type mismatch, no fitting type! */\n");
EmuWarning("/* WARNING: Fatal type mismatch, no fitting type! */");
}
}
@ -2046,7 +2046,7 @@ extern HRESULT XTL::EmuRecompileVshFunction
hRet = E_FAIL;
break;
default:
EmuWarning("Unknown vertex shader version 0x%02X\n", pShaderHeader->Version);
EmuWarning("Unknown vertex shader version 0x%02X", pShaderHeader->Version);
hRet = E_FAIL;
break;
}
@ -2104,8 +2104,8 @@ extern HRESULT XTL::EmuRecompileVshFunction
if (FAILED(hRet))
{
EmuWarning("Couldn't assemble recompiled vertex shader\n");
EmuWarning("%s\n", pErrors->GetBufferPointer());
EmuWarning("Couldn't assemble recompiled vertex shader");
EmuWarning("%s", pErrors->GetBufferPointer());
}
if( pErrors )

File diff suppressed because it is too large Load Diff

View File

@ -358,26 +358,27 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData)
#ifdef _DEBUG_TRACE
if (pNewTLS == 0)
{
DbgPrintf("EmuFS (0x%X): TLS Non-Existant (OK)\n", GetCurrentThreadId());
DbgPrintf("EmuFS: TLS Non-Existant (OK)\n");
}
else
{
DbgPrintf("EmuFS (0x%X): TLS Data Dump...\n", GetCurrentThreadId());
DbgPrintf("EmuFS (0x%X): 0x%.08X: ", GetCurrentThreadId(), pNewTLS);
DbgPrintf("EmuFS: TLS Data Dump...\n");
DbgPrintf("EmuFS: 0x%.08X: ", pNewTLS);
uint32 stop = pTLS->dwDataEndAddr - pTLS->dwDataStartAddr + pTLS->dwSizeofZeroFill;
// Note : Use printf instead of DbgPrintf here, which prefixes with GetCurrentThreadId() :
for (uint32 v = 0;v<stop;v++)
{
uint08 *bByte = (uint08*)pNewTLS + v;
DbgPrintf("%.01X", (uint32)*bByte);
if (g_bPrintfOn) printf("%.01X", (uint32)*bByte);
if ((v + 1) % 0x10 == 0 && v + 1<stop)
DbgPrintf("\nEmuFS (0x%X): 0x%.08X: ", GetCurrentThreadId(), ((uint32)pNewTLS + v));
if (g_bPrintfOn) printf("\nEmuFS (0x%X): 0x%.08X: ", GetCurrentThreadId(), ((uint32)pNewTLS + v));
}
DbgPrintf("\n");
if (g_bPrintfOn) printf("\n");
}
#endif
}
@ -435,5 +436,5 @@ void EmuGenerateFS(Xbe::TLS *pTLS, void *pTLSData)
mov fs : [0x14], eax
}
DbgPrintf("EmuFS (0x%X): OrgFS=%d NewFS=%d pTLS=0x%.08X\n", GetCurrentThreadId(), OrgFS, NewFS, pTLS);
DbgPrintf("EmuFS: OrgFS=%d NewFS=%d pTLS=0x%.08X\n", OrgFS, NewFS, pTLS);
}

View File

@ -280,11 +280,11 @@ XBSYSAPI EXPORTNUM(66) xboxkrnl::NTSTATUS NTAPI xboxkrnl::IoCreateFile
if (FAILED(ret))
{
DbgPrintf("EmuKrnl (0x%X): IoCreateFile Failed! (0x%.08X)\n", GetCurrentThreadId(), ret);
EmuWarning("EmuKrnl: IoCreateFile Failed! (0x%.08X)\n", ret);
}
else
{
DbgPrintf("EmuKrnl (0x%X): IoCreateFile = 0x%.08X\n", GetCurrentThreadId(), *FileHandle);
DbgPrintf("EmuKrnl: IoCreateFile = 0x%.08X\n", *FileHandle);
}
RETURN(ret);

View File

@ -180,7 +180,7 @@ XBSYSAPI EXPORTNUM(168) xboxkrnl::PVOID NTAPI xboxkrnl::MmClaimGpuInstanceMemory
MI_CONVERT_PFN_TO_PHYSICAL(MM_INSTANCE_PHYSICAL_PAGE + MM_INSTANCE_PAGE_COUNT);
// Chihiro arcade should use *NumberOfPaddingBytes = 0;
EmuWarning("*NumberOfPaddingBytes = 0x%08X\n", *NumberOfPaddingBytes);
EmuWarning("*NumberOfPaddingBytes = 0x%08X", *NumberOfPaddingBytes);
if (NumberOfBytes != MAXULONG_PTR)
{
@ -238,7 +238,7 @@ XBSYSAPI EXPORTNUM(169) xboxkrnl::PVOID NTAPI xboxkrnl::MmCreateKernelStack
/*Protect=*/PAGE_READWRITE);
if (FAILED(ret))
EmuWarning("MmCreateKernelStack failed!\n");
EmuWarning("MmCreateKernelStack failed!");
else
BaseAddress = (PVOID)((ULONG)BaseAddress + NumberOfBytes);
@ -268,7 +268,7 @@ XBSYSAPI EXPORTNUM(170) xboxkrnl::VOID NTAPI xboxkrnl::MmDeleteKernelStack
/*FreeType=*/MEM_RELEASE);
if (FAILED(ret))
EmuWarning("MmDeleteKernelStack failed!\n");
EmuWarning("MmDeleteKernelStack failed!");
}
// ******************************************************************
@ -545,7 +545,7 @@ XBSYSAPI EXPORTNUM(181) xboxkrnl::NTSTATUS NTAPI xboxkrnl::MmQueryStatistics
}
else
{
EmuWarning("EmuKrnl (0x%X): MmQueryStatistics with unusual size -> 0x%.08X\n", GetCurrentThreadId(), MemoryStatistics->Length);
EmuWarning("EmuKrnl: MmQueryStatistics with unusual size -> 0x%.08X", MemoryStatistics->Length);
ret = STATUS_INVALID_PARAMETER;
}
@ -573,7 +573,7 @@ XBSYSAPI EXPORTNUM(182) xboxkrnl::VOID NTAPI xboxkrnl::MmSetAddressProtect
if (!VirtualProtect(BaseAddress, NumberOfBytes, NewProtect & (~PAGE_WRITECOMBINE), &dwOldProtect))
EmuWarning("VirtualProtect Failed!");
DbgPrintf("EmuKrnl (0x%X): VirtualProtect was 0x%.08X -> 0x%.08X\n", GetCurrentThreadId(), dwOldProtect, NewProtect & (~PAGE_WRITECOMBINE));
DbgPrintf("EmuKrnl: VirtualProtect was 0x%.08X -> 0x%.08X\n", dwOldProtect, NewProtect & (~PAGE_WRITECOMBINE));
}
// ******************************************************************

View File

@ -209,7 +209,7 @@ XBSYSAPI EXPORTNUM(188) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateDirectoryObje
if (FAILED(ret))
EmuWarning("NtCreateDirectoryObject Failed!");
else
DbgPrintf("EmuKrnl (0x%X): NtCreateDirectoryObject DirectoryHandle = 0x%.08X\n", GetCurrentThreadId(), *DirectoryHandle);
DbgPrintf("EmuKrnl: NtCreateDirectoryObject DirectoryHandle = 0x%.08X\n", *DirectoryHandle);
RETURN(ret);
}
@ -253,7 +253,7 @@ XBSYSAPI EXPORTNUM(189) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateEvent
if (FAILED(ret))
EmuWarning("NtCreateEvent Failed!");
else
DbgPrintf("EmuKrnl (0x%X): NtCreateEvent EventHandle = 0x%.08X\n", GetCurrentThreadId(), *EventHandle);
DbgPrintf("EmuKrnl: NtCreateEvent EventHandle = 0x%.08X\n", *EventHandle);
RETURN(ret);
}
@ -322,7 +322,7 @@ XBSYSAPI EXPORTNUM(192) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateMutant
if (FAILED(ret))
EmuWarning("NtCreateMutant Failed!");
else
DbgPrintf("EmuKrnl (0x%X): NtCreateMutant MutantHandle = 0x%.08X\n", GetCurrentThreadId(), *MutantHandle);
DbgPrintf("EmuKrnl: NtCreateMutant MutantHandle = 0x%.08X\n", *MutantHandle);
RETURN(ret);
}
@ -362,7 +362,7 @@ XBSYSAPI EXPORTNUM(193) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateSemaphore
if (FAILED(ret))
EmuWarning("NtCreateSemaphore failed!");
else
DbgPrintf("EmuKrnl (0x%X): NtCreateSemaphore SemaphoreHandle = 0x%.08X\n", GetCurrentThreadId(), *SemaphoreHandle);
DbgPrintf("EmuKrnl: NtCreateSemaphore SemaphoreHandle = 0x%.08X\n", *SemaphoreHandle);
RETURN(ret);
}
@ -402,7 +402,7 @@ XBSYSAPI EXPORTNUM(194) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtCreateTimer
if (FAILED(ret))
EmuWarning("NtCreateTimer failed!");
else
DbgPrintf("EmuKrnl (0x%X): NtCreateTimer TimerHandle = 0x%.08X\n", GetCurrentThreadId(), *TimerHandle);
DbgPrintf("EmuKrnl: NtCreateTimer TimerHandle = 0x%.08X\n", *TimerHandle);
RETURN(ret);
}
@ -919,7 +919,7 @@ XBSYSAPI EXPORTNUM(210) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryFullAttributes
NTToXboxFileInformation(&nativeNetOpenInfo, Attributes, FileNetworkOpenInformation, sizeof(xboxkrnl::FILE_NETWORK_OPEN_INFORMATION));
if (FAILED(ret))
EmuWarning("NtQueryFullAttributesFile failed! (0x%.08X)\n", ret);
EmuWarning("NtQueryFullAttributesFile failed! (0x%.08X)", ret);
RETURN(ret);
}
@ -1196,7 +1196,7 @@ XBSYSAPI EXPORTNUM(217) xboxkrnl::NTSTATUS NTAPI xboxkrnl::NtQueryVirtualMemory
ret = STATUS_SUCCESS;
DbgPrintf("EmuKrnl (0x%X): NtQueryVirtualMemory: Applied fix for Forza Motorsport!\n", GetCurrentThreadId());
DbgPrintf("EmuKrnl: NtQueryVirtualMemory: Applied fix for Forza Motorsport!\n");
}
}
@ -1606,7 +1606,7 @@ XBSYSAPI EXPORTNUM(232) xboxkrnl::VOID NTAPI xboxkrnl::NtUserIoApcDispatcher
popad
}
DbgPrintf("EmuKrnl (0x%X): NtUserIoApcDispatcher Completed\n", GetCurrentThreadId());
DbgPrintf("EmuKrnl: NtUserIoApcDispatcher Completed\n");
}
// ******************************************************************

View File

@ -133,7 +133,7 @@ static unsigned int WINAPI PCSTProxy
if (pfnNotificationRoutine == NULL)
continue;
DbgPrintf("EmuKrnl (0x%X): Calling pfnNotificationRoutine[%d] (0x%.08X)\n", GetCurrentThreadId(), g_iThreadNotificationCount, pfnNotificationRoutine);
DbgPrintf("EmuKrnl: Calling pfnNotificationRoutine[%d] (0x%.08X)\n", g_iThreadNotificationCount, pfnNotificationRoutine);
pfnNotificationRoutine(TRUE);
}
@ -299,7 +299,7 @@ XBSYSAPI EXPORTNUM(255) xboxkrnl::NTSTATUS NTAPI xboxkrnl::PsCreateSystemThreadE
// *ThreadHandle = CreateThread(NULL, NULL, PCSTProxy, iPCSTProxyParam, NULL, &dwThreadId);
DbgPrintf("EmuKrnl (0x%X): ThreadHandle : 0x%X, ThreadId : 0x%.08X\n", GetCurrentThreadId(), *ThreadHandle, dwThreadId);
DbgPrintf("EmuKrnl: ThreadHandle : 0x%X, ThreadId : 0x%.08X\n", *ThreadHandle, dwThreadId);
// we must duplicate this handle in order to retain Suspend/Resume thread rights from a remote thread
{
@ -377,7 +377,7 @@ XBSYSAPI EXPORTNUM(258) xboxkrnl::VOID NTAPI xboxkrnl::PsTerminateSystemThread
if (pfnNotificationRoutine == NULL)
continue;
DbgPrintf("EmuKrnl (0x%X): Calling pfnNotificationRoutine[%d] (0x%.08X)\n", GetCurrentThreadId(), g_iThreadNotificationCount, pfnNotificationRoutine);
DbgPrintf("EmuKrnl: Calling pfnNotificationRoutine[%d] (0x%.08X)\n", g_iThreadNotificationCount, pfnNotificationRoutine);
pfnNotificationRoutine(FALSE);
}

View File

@ -510,16 +510,25 @@ DEBUG_START(USER)
DEBUG_END(USER)
#define READ32_START(DEV) uint32_t EmuNV2A_##DEV##_Read32(uint32_t addr) { uint32_t result = 0; switch (addr) {
#define READ32_UNHANDLED(DEV) default: EmuWarning("EmuX86_Read32 NV2A_" #DEV "(0x%08X) = 0x%08X [Unhandled, %s]", addr, result, DebugNV_##DEV##(addr)); return result;
#define READ32_END(DEV) } EmuWarning("EmuX86_Read32 NV2A_" #DEV "(0x%08X) = 0x%08X [Handled, %s]", addr, result, DebugNV_##DEV##(addr)); return result; }
#define WRITE32_START(DEV) void EmuNV2A_##DEV##_Write32(uint32_t addr, uint32_t value) { switch (addr) {
#define WRITE32_UNHANDLED(DEV) default: EmuWarning("EmuX86_Write32 NV2A_" #DEV "(0x%08X, 0x%08X) [Unhandled, %s]", addr, value, DebugNV_##DEV##(addr)); return;
#define WRITE32_END(DEV) } EmuWarning("EmuX86_Write32 NV2A_" #DEV "(0x%08X, 0x%08X) [Handled, %s]", addr, value, DebugNV_##DEV##(addr)); }
READ32_START(PMC)
#define DEBUG_READ32(DEV) DbgPrintf("EmuX86_Read32 NV2A_" #DEV "(0x%08X) = 0x%08X [Handled, %s]\n", addr, result, DebugNV_##DEV##(addr));
#define DEBUG_READ32_UNHANDLED(DEV) DbgPrintf("EmuX86_Read32 NV2A_" #DEV "(0x%08X) = 0x%08X [Unhandled, %s]\n", addr, result, DebugNV_##DEV##(addr));
#define DEBUG_WRITE32(DEV) DbgPrintf("EmuX86_Write32 NV2A_" #DEV "(0x%08X, 0x%08X) [Handled, %s]\n", addr, value, DebugNV_##DEV##(addr));
#define DEBUG_WRITE32_UNHANDLED(DEV) DbgPrintf("EmuX86_Write32 NV2A_" #DEV "(0x%08X, 0x%08X) [Unhandled, %s]\n", addr, value, DebugNV_##DEV##(addr));
#define DEVICE_READ32(DEV) uint32_t EmuNV2A_##DEV##_Read32(uint32_t addr)
#define DEVICE_READ32_SWITCH(addr) uint32_t result = 0; switch (addr)
#define DEVICE_READ32_END(DEV) DEBUG_READ32(DEV); return result
#define DEVICE_WRITE32(DEV) void EmuNV2A_##DEV##_Write32(uint32_t addr, uint32_t value)
#define DEVICE_WRITE32_SWITCH(DEV, addr) DEBUG_WRITE32(DEV); switch (addr)
DEVICE_READ32(PMC)
{
DEVICE_READ32_SWITCH(addr) {
case NV_PMC_BOOT_0: // chipset and stepping: NV2A, A02, Rev 0
result = 0x02A000A2;
break;
@ -529,7 +538,6 @@ READ32_START(PMC)
case NV_PMC_INTR_EN_0:
result = pmc.enabled_interrupts;
break;
case 0x0000020C: // What's this address? What does the xbe expect to read here? The Kernel base address perhaps?
result = NV20_REG_BASE_KERNEL;
break;
@ -543,7 +551,6 @@ READ32_START(PMC)
DEVICE_WRITE32(PMC)
{
DEVICE_WRITE32_SWITCH(PMC, addr) {
case NV_PMC_INTR_0:
pmc.pending_interrupts &= ~value;
update_irq();

View File

@ -96,27 +96,27 @@ uint32_t EmuX86_Read32(uint32_t addr)
uint16_t EmuX86_Read16(uint32_t addr)
{
EmuWarning("EmuX86_Read16(0x%08X) Forwarding to EmuX86_Read32...", addr);
DbgPrintf("EmuX86_Read16(0x%08X) Forwarding to EmuX86_Read32...", addr);
uint16_t value;
if (addr & 2)
value = (uint16_t)(EmuX86_Read32(addr - 2) >> 16);
else
value = (uint16_t)EmuX86_Read32(addr);
EmuWarning("EmuX86_Read16(0x%08X) = 0x%04X", addr, value);
DbgPrintf("EmuX86_Read16(0x%08X) = 0x%04X", addr, value);
return value;
}
uint8_t EmuX86_Read8(uint32_t addr)
{
EmuWarning("EmuX86_Read8(0x%08X) Forwarding to EmuX86_Read16...", addr);
DbgPrintf("EmuX86_Read8(0x%08X) Forwarding to EmuX86_Read16...", addr);
uint8_t value;
if (addr & 1)
value = (uint8_t)(EmuX86_Read16(addr - 1) >> 8);
else
value = (uint8_t)EmuX86_Read16(addr);
EmuWarning("EmuX86_Read8(0x%08X) = 0x%02X", addr, value);
DbgPrintf("EmuX86_Read8(0x%08X) = 0x%02X", addr, value);
return value;
}
@ -716,7 +716,7 @@ bool EmuX86_DecodeException(LPEXCEPTION_POINTERS e)
// and check if it successfully decoded one instruction :
if (decodedInstructionsCount != 1)
{
EmuWarning("EmuX86: Error decoding opcode at 0x%08X\n", e->ContextRecord->Eip);
EmuWarning("EmuX86: Error decoding opcode at 0x%08X", e->ContextRecord->Eip);
}
else
{

View File

@ -187,7 +187,7 @@ DWORD WINAPI XTL::EmuXGetDevices
if(DeviceType->Reserved[0] == 0 && DeviceType->Reserved[1] == 0 && DeviceType->Reserved[2] == 0)
ret = (1 << 0); // Return 1 Controller
else
EmuWarning("Unknown DeviceType (0x%.08X, 0x%.08X, 0x%.08X)\n", DeviceType->Reserved[0], DeviceType->Reserved[1], DeviceType->Reserved[2]);
EmuWarning("Unknown DeviceType (0x%.08X, 0x%.08X, 0x%.08X)", DeviceType->Reserved[0], DeviceType->Reserved[1], DeviceType->Reserved[2]);
RETURN(ret);
}
@ -224,7 +224,7 @@ BOOL WINAPI XTL::EmuXGetDeviceChanges
else
{
// TODO: What if it's not a controller?
EmuWarning("Unknown DeviceType (0x%.08X, 0x%.08X, 0x%.08X)\n", DeviceType->Reserved[0], DeviceType->Reserved[1], DeviceType->Reserved[2]);
EmuWarning("Unknown DeviceType (0x%.08X, 0x%.08X, 0x%.08X)", DeviceType->Reserved[0], DeviceType->Reserved[1], DeviceType->Reserved[2]);
}
}
else
@ -735,13 +735,13 @@ LPVOID WINAPI XTL::EmuCreateFiber
LPVOID lpParameter
)
{
DbgPrintf("EmuXapi (0x%X): EmuCreateFiber\n"
DbgPrintf("EmuXapi: EmuCreateFiber\n"
"(\n"
" dwStackSize : 0x%.08X\n"
" lpStartRoutine : 0x%.08X\n"
" lpParameter : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwStackSize, lpStartRoutine, lpParameter);
dwStackSize, lpStartRoutine, lpParameter);
LPVOID pFiber = CreateFiber( dwStackSize, lpStartRoutine, lpParameter );
if( !pFiber )
@ -767,11 +767,11 @@ VOID WINAPI XTL::EmuDeleteFiber
)
{
DbgPrintf("EmuXapi (0x%X): EmuDeleteFiber\n"
DbgPrintf("EmuXapi: EmuDeleteFiber\n"
"(\n"
" lpFiber : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpFiber );
lpFiber );
DeleteFiber( lpFiber );
@ -786,11 +786,11 @@ VOID WINAPI XTL::EmuSwitchToFiber
)
{
DbgPrintf("EmuXapi (0x%X): EmuSwitchToFiber\n"
DbgPrintf("EmuXapi: EmuSwitchToFiber\n"
"(\n"
" lpFiber : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpFiber );
lpFiber );
// SwitchToFiber( lpFiber ); // <- Hangs/crashes...
@ -816,11 +816,11 @@ LPVOID WINAPI XTL::EmuConvertThreadToFiber
LPVOID lpParameter
)
{
DbgPrintf("EmuXapi (0x%X): EmuConvertThreadToFiber\n"
DbgPrintf("EmuXapi: EmuConvertThreadToFiber\n"
"(\n"
" lpParameter : 0x%.08X\n"
");\n",
GetCurrentThreadId(), lpParameter );
lpParameter );
LPVOID pRet = ConvertThreadToFiber( lpParameter );
@ -836,11 +836,11 @@ LPVOID WINAPI XTL::EmuConvertThreadToFiber
VOID WINAPI XTL::EmuXapiFiberStartup(DWORD dwDummy)
{
DbgPrintf("EmuXapi (0x%X): EmuXapiFiberStarup()\n"
DbgPrintf("EmuXapi: EmuXapiFiberStarup()\n"
"(\n"
" dwDummy : 0x%.08X\n"
");\n",
GetCurrentThreadId(), dwDummy);
dwDummy);
typedef void (__stdcall *pfDummyFunc)(DWORD dwDummy);

View File

@ -168,6 +168,8 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
uint32 LastUnResolvedXRefs = UnResolvedXRefs+1;
uint32 OrigUnResolvedXRefs = UnResolvedXRefs;
bool bFoundD3D = false;
for(int p=0;UnResolvedXRefs < LastUnResolvedXRefs;p++)
{
DbgPrintf("HLE: Starting pass #%d...\n", p+1);
@ -287,6 +289,7 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
BuildVersion = 3911;
if(OrigBuildVersion == 4531)
BuildVersion = 4627;
}
else if (strcmp(szLibraryName, Lib_XGRAPHC) == 0)
{
// Skip scanning for XGRAPHC (XG) symbols when LLE GPU is selected