Exit if fail to get instance of DirectX's SystemClock

This commit is contained in:
tomch 2007-03-26 21:27:29 +00:00
parent ba668d1bac
commit 4be82324be
3 changed files with 16 additions and 4 deletions

View File

@ -620,7 +620,7 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
// Initialize COM
CoInitialize( NULL );
SysClk_InitTimer();
bool bSysClkOK = SysClk_InitTimer();
// DSInit(); // Done when g_hFrameWindow is created (WM_CREATE)
// DO ONE-TIME INITIALIZATION
@ -659,7 +659,14 @@ int APIENTRY WinMain (HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int)
MemInitialize();
VideoInitialize();
FrameCreateWindow();
tfe_init();
if (!bSysClkOK)
{
MessageBox(g_hFrameWindow, "DirectX failed to create SystemClock instance", TEXT("AppleWin Error"), MB_OK);
break;
}
tfe_init();
Snapshot_Startup(); // Do this after everything has been init'ed
if(bSetFullScreen)

View File

@ -566,7 +566,7 @@ static bool g_bRefClockTimerActive = false;
static DWORD g_dwLastUsecPeriod = 0;
void SysClk_InitTimer()
bool SysClk_InitTimer()
{
g_hSemaphore = CreateSemaphore(NULL, 0, 1, NULL); // Max count = 1
if (g_hSemaphore == NULL)
@ -574,7 +574,12 @@ void SysClk_InitTimer()
if (CoCreateInstance(CLSID_SystemClock, NULL, CLSCTX_INPROC,
IID_IReferenceClock, (LPVOID*)&g_pRefClock) != S_OK)
{
fprintf(stderr, "Error initialising COM\n");
return false; // Fails for Win95!
}
return true;
}
void SysClk_UninitTimer()

View File

@ -40,7 +40,7 @@ void DSUninit();
LONG NewVolume(DWORD dwVolume, DWORD dwVolumeMax);
void SysClk_WaitTimer();
void SysClk_InitTimer();
bool SysClk_InitTimer();
void SysClk_UninitTimer();
void SysClk_StartTimerUsec(DWORD dwUsecPeriod);
void SysClk_StopTimer();