This commit is contained in:
Aaron Robinson 2003-10-17 04:26:14 +00:00
parent 8f9f07d99d
commit bf7b949d2b
4 changed files with 26 additions and 10 deletions

View File

@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="Cxbx" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101

View File

@ -79,7 +79,8 @@ extern "C" CXBXKRNL_API void NTAPI EmuSuspend();
// resume emulation
extern "C" CXBXKRNL_API void NTAPI EmuResume();
// global flag specifying current emulation state
// global flags specifying current emulation state
extern BOOL g_bEmuException;
extern BOOL g_bEmuSuspended;
// global exception patching address

View File

@ -72,6 +72,7 @@ extern HANDLE g_hTDrive = NULL;
extern HANDLE g_hUDrive = NULL;
extern HANDLE g_hZDrive = NULL;
extern BOOL g_bEmuSuspended = FALSE;
extern BOOL g_bEmuException = FALSE;
// global exception patching address
extern uint32 g_HaloHack[4] = {0};
@ -510,7 +511,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit
// _USE_XGMATH Disabled in mesh :[
// halo : dword_0_2E2D18
// halo : 1744F0 (bink)
//_asm int 3
_asm int 3
Entry();
@ -563,7 +564,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuWarning(const char *szWarningMessage, ...)
// cleanup emulation
extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage, ...)
{
EmuSuspend();
g_bEmuException = TRUE;
// print out error message (if exists)
if(szErrorMessage != NULL)
@ -589,8 +590,6 @@ extern "C" CXBXKRNL_API void NTAPI EmuCleanup(const char *szErrorMessage, ...)
MessageBox(NULL, szBuffer1, "CxbxKrnl", MB_OK | MB_ICONSTOP);
}
EmuResume();
printf("CxbxKrnl: Terminating Process\n");
fflush(stdout);
@ -642,7 +641,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuRegisterThread(HANDLE hThread)
// suspend all threads that have been created with PsCreateSystemThreadEx
extern "C" CXBXKRNL_API void NTAPI EmuSuspend()
{
if(g_bEmuSuspended)
if(g_bEmuSuspended || g_bEmuException)
return;
g_bEmuSuspended = TRUE;
@ -697,6 +696,8 @@ extern "C" CXBXKRNL_API void NTAPI EmuResume()
// exception handler
extern int EmuException(LPEXCEPTION_POINTERS e)
{
g_bEmuException = TRUE;
if(EmuIsXboxFS())
EmuSwapFS();
@ -745,6 +746,8 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
printf("EmuMain (0x%X): Halo Access Adjust 1 was applied!\n", GetCurrentThreadId());
#endif
g_bEmuException = FALSE;
return EXCEPTION_CONTINUE_EXECUTION;
}
}
@ -778,6 +781,8 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
printf("EmuMain (0x%X): Halo Access Adjust 2 was applied!\n", GetCurrentThreadId());
#endif
g_bEmuException = FALSE;
return EXCEPTION_CONTINUE_EXECUTION;
}
}
@ -830,6 +835,9 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
else if(ret == IDIGNORE)
{
printf("EmuMain (0x%X): Ignored Breakpoint Exception\n", GetCurrentThreadId());
g_bEmuException = FALSE;
return EXCEPTION_CONTINUE_EXECUTION;
}
}
@ -851,6 +859,8 @@ extern int EmuException(LPEXCEPTION_POINTERS e)
}
}
g_bEmuException = FALSE;
return EXCEPTION_CONTINUE_SEARCH;
}

View File

@ -3327,11 +3327,13 @@ BOOL WINAPI XTL::EmuIDirect3DResource8_IsBusy
// debug trace
#ifdef _DEBUG_TRACE
{
/* too much output
printf("EmuD3D8 (0x%X): EmuIDirect3DResource8_IsBusy\n"
"(\n"
" pThis : 0x%.08X\n"
");\n",
GetCurrentThreadId(), pThis);
//*/
}
#endif
@ -5000,10 +5002,10 @@ HRESULT WINAPI XTL::EmuIDirect3DDevice8_SetStreamSource
printf("EmuD3D8 (0x%X): EmuIDirect3DDevice8_SetStreamSource\n"
"(\n"
" StreamNumber : 0x%.08X\n"
" pStreamData : 0x%.08X\n"
" pStreamData : 0x%.08X (0x%.08X)\n"
" Stride : 0x%.08X\n"
");\n",
GetCurrentThreadId(), StreamNumber, pStreamData, Stride);
GetCurrentThreadId(), StreamNumber, pStreamData, (pStreamData != 0) ? pStreamData->EmuVertexBuffer8 : 0, Stride);
}
#endif
@ -5459,9 +5461,12 @@ VOID WINAPI XTL::EmuIDirect3DDevice8_DrawIndexedVertices
uint32 nStride = EmuFixupVerticesA(PrimitiveType, PrimitiveCount, pOrigVertexBuffer8, pHackVertexBuffer8, 0, 0, 0, 0);
if(pIndexData != 0)
EmuCleanup("Unsupported?");
g_pD3DDevice8->DrawIndexedPrimitive
(
PCPrimitiveType, 0, VertexCount, ((DWORD)pIndexData)/2, PrimitiveCount
PCPrimitiveType, 0, VertexCount, /*((DWORD)pIndexData)/2*/0, PrimitiveCount
);
if(nStride != -1)