本文整理汇总了C++中CCritSect::Lock方法的典型用法代码示例。如果您正苦于以下问题:C++ CCritSect::Lock方法的具体用法?C++ CCritSect::Lock怎么用?C++ CCritSect::Lock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCritSect
的用法示例。
在下文中一共展示了CCritSect::Lock方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static void ResizeStep2(void)
{
g_CritialSection.Lock();
// Delete all OpenGL textures
gTextureManager.CleanUp();
RDP_Cleanup();
// delete our opengl renderer
CDeviceBuilder::GetBuilder()->DeleteRender();
// call video extension function with updated width, height (this creates a new OpenGL context)
windowSetting.uDisplayWidth = status.gNewResizeWidth;
windowSetting.uDisplayHeight = status.gNewResizeHeight;
CoreVideo_ResizeWindow(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight);
// re-initialize our OpenGL graphics context state
bool res = CGraphicsContext::Get()->ResizeInitialize(windowSetting.uDisplayWidth, windowSetting.uDisplayHeight, !windowSetting.bDisplayFullscreen);
if (res)
{
// re-create the OpenGL renderer
CDeviceBuilder::GetBuilder()->CreateRender();
CRender::GetRender()->Initialize();
DLParser_Init();
}
g_CritialSection.Unlock();
status.ToResize = false;
}
示例2:
//---------------------------------------------------------------------------------------
// Static (local) functions
static void ChangeWindowStep2()
{
status.bDisableFPS = true;
windowSetting.bDisplayFullscreen = !windowSetting.bDisplayFullscreen;
g_CritialSection.Lock();
windowSetting.bDisplayFullscreen = CGraphicsContext::Get()->ToggleFullscreen();
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
g_CritialSection.Unlock();
status.bDisableFPS = false;
status.ToToggleFullScreen = FALSE;
}
示例3: StopVideo
void StopVideo()
{
if( CGraphicsContext::Get()->IsWindowed() == false )
{
status.ToToggleFullScreen = TRUE;
CGraphicsContext::Get()->ToggleFullscreen();
status.ToToggleFullScreen = FALSE;
}
g_CritialSection.Lock();
status.bGameIsRunning = false;
try {
// Kill all textures?
gTextureManager.RecycleAllTextures();
gTextureManager.CleanUp();
RDP_Cleanup();
CloseExternalTextures();
CDeviceBuilder::GetBuilder()->DeleteRender();
CGraphicsContext::Get()->CleanUp();
CDeviceBuilder::GetBuilder()->DeleteGraphicsContext();
}
catch(...)
{
TRACE0("Some exceptions during RomClosed");
}
g_CritialSection.Unlock();
windowSetting.dps = windowSetting.fps = -1;
windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF;
status.gDlistCount = status.gFrameCount = 0;
#ifndef _XBOX
KillTimer(g_GraphicsInfo.hWnd, windowSetting.timer);
if( windowSetting.screenSaverStatus )
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, TRUE, 0, 0); // Enable screen saver
#endif
DEBUGGER_ONLY({delete surfTlut;});
示例4: ChangeWindowStep2
void ChangeWindowStep2()
{
#ifndef _XBOX
status.bDisableFPS = true;
windowSetting.bDisplayFullscreen = 1-windowSetting.bDisplayFullscreen;
g_CritialSection.Lock();
windowSetting.bDisplayFullscreen = CGraphicsContext::Get()->ToggleFullscreen();
if( windowSetting.bDisplayFullscreen )
{
if( g_GraphicsInfo.hStatusBar != NULL )
{
ShowWindow(g_GraphicsInfo.hStatusBar, SW_HIDE);
}
ShowCursor(FALSE);
}
else
{
if( g_GraphicsInfo.hStatusBar != NULL )
{
ShowWindow(g_GraphicsInfo.hStatusBar, SW_SHOW);
}
ShowCursor(TRUE);
}
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
CGraphicsContext::Get()->Clear(CLEAR_COLOR_AND_DEPTH_BUFFER);
CGraphicsContext::Get()->UpdateFrame();
g_CritialSection.Unlock();
status.bDisableFPS = false;
status.ToToggleFullScreen = FALSE;
#endif
}
示例5: StopVideo
void StopVideo()
{
if( CGraphicsContext::Get()->IsWindowed() == false )
{
status.ToToggleFullScreen = TRUE;
CGraphicsContext::Get()->ToggleFullscreen();
status.ToToggleFullScreen = FALSE;
}
g_CritialSection.Lock();
status.bGameIsRunning = false;
try {
CloseExternalTextures();
// Kill all textures?
gTextureManager.RecycleAllTextures();
gTextureManager.CleanUp();
RDP_Cleanup();
CDeviceBuilder::GetBuilder()->DeleteRender();
CGraphicsContext::Get()->CleanUp();
CDeviceBuilder::GetBuilder()->DeleteGraphicsContext();
}
catch(...)
{
TRACE0("Some exceptions during RomClosed");
}
g_CritialSection.Unlock();
windowSetting.dps = windowSetting.fps = -1;
windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF;
status.gDlistCount = status.gFrameCount = 0;
}
示例6: SetVIScales
static void UpdateScreenStep2 (void)
{
status.bVIOriginIsUpdated = false;
if( status.ToToggleFullScreen && status.gDlistCount > 0 )
{
ChangeWindowStep2();
return;
}
g_CritialSection.Lock();
if( status.bHandleN64RenderTexture )
g_pFrameBufferManager->CloseRenderTexture(true);
g_pFrameBufferManager->SetAddrBeDisplayed(*g_GraphicsInfo.VI_ORIGIN_REG);
if( status.gDlistCount == 0 )
{
// CPU frame buffer update
uint32 width = *g_GraphicsInfo.VI_WIDTH_REG;
if( (*g_GraphicsInfo.VI_ORIGIN_REG & (g_dwRamSize-1) ) > width*2 && *g_GraphicsInfo.VI_H_START_REG != 0 && width != 0 )
{
SetVIScales();
CRender::GetRender()->DrawFrameBuffer(true);
CGraphicsContext::Get()->UpdateFrame();
}
g_CritialSection.Unlock();
return;
}
TXTRBUF_DETAIL_DUMP(TRACE1("VI ORIG is updated to %08X", *g_GraphicsInfo.VI_ORIGIN_REG));
if( currentRomOptions.screenUpdateSetting == SCREEN_UPDATE_AT_VI_UPDATE )
{
CGraphicsContext::Get()->UpdateFrame();
DEBUGGER_IF_DUMP( pauseAtNext, TRACE1("Update Screen: VIORIG=%08X", *g_GraphicsInfo.VI_ORIGIN_REG));
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_FRAME);
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_SET_CIMG);
g_CritialSection.Unlock();
return;
}
TXTRBUF_DETAIL_DUMP(TRACE1("VI ORIG is updated to %08X", *g_GraphicsInfo.VI_ORIGIN_REG));
if( currentRomOptions.screenUpdateSetting == SCREEN_UPDATE_AT_VI_UPDATE_AND_DRAWN )
{
if( status.bScreenIsDrawn )
{
CGraphicsContext::Get()->UpdateFrame();
DEBUGGER_IF_DUMP( pauseAtNext, TRACE1("Update Screen: VIORIG=%08X", *g_GraphicsInfo.VI_ORIGIN_REG));
}
else
{
DEBUGGER_IF_DUMP( pauseAtNext, TRACE1("Skip Screen Update: VIORIG=%08X", *g_GraphicsInfo.VI_ORIGIN_REG));
}
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_FRAME);
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_SET_CIMG);
g_CritialSection.Unlock();
return;
}
if( currentRomOptions.screenUpdateSetting==SCREEN_UPDATE_AT_VI_CHANGE )
{
if( *g_GraphicsInfo.VI_ORIGIN_REG != status.curVIOriginReg )
{
if( *g_GraphicsInfo.VI_ORIGIN_REG < status.curDisplayBuffer || *g_GraphicsInfo.VI_ORIGIN_REG > status.curDisplayBuffer+0x2000 )
{
status.curDisplayBuffer = *g_GraphicsInfo.VI_ORIGIN_REG;
status.curVIOriginReg = status.curDisplayBuffer;
//status.curRenderBuffer = NULL;
CGraphicsContext::Get()->UpdateFrame();
DEBUGGER_IF_DUMP( pauseAtNext, TRACE1("Update Screen: VIORIG=%08X", *g_GraphicsInfo.VI_ORIGIN_REG));
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_FRAME);
DEBUGGER_PAUSE_COUNT_N_WITHOUT_UPDATE(NEXT_SET_CIMG);
}
else
{
status.curDisplayBuffer = *g_GraphicsInfo.VI_ORIGIN_REG;
status.curVIOriginReg = status.curDisplayBuffer;
DEBUGGER_PAUSE_AND_DUMP_NO_UPDATE(NEXT_FRAME, {DebuggerAppendMsg("Skip Screen Update, closed to the display buffer, VIORIG=%08X", *g_GraphicsInfo.VI_ORIGIN_REG);});
}
}
else
{
示例7: StartVideo
bool StartVideo(void)
{
#ifndef _XBOX
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &windowSetting.screenSaverStatus, 0);
if( windowSetting.screenSaverStatus )
SystemParametersInfo(SPI_SETSCREENSAVEACTIVE, FALSE, 0, 0); // Disable screen saver
windowSetting.timer = SetTimer(g_GraphicsInfo.hWnd, 100, 1000, (TIMERPROC)TimerProc);
#endif
windowSetting.dps = windowSetting.fps = -1;
windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF;
g_CritialSection.Lock();
memcpy(&g_curRomInfo.romheader, g_GraphicsInfo.HEADER, sizeof(ROMHeader));
unsigned char *puc = (unsigned char *) &g_curRomInfo.romheader;
unsigned int i;
unsigned char temp;
for (i = 0; i < sizeof(ROMHeader); i += 4) /* byte-swap the ROM header */
{
temp = puc[i];
puc[i] = puc[i+3];
puc[i+3] = temp;
temp = puc[i+1];
puc[i+1] = puc[i+2];
puc[i+2] = temp;
}
ROM_GetRomNameFromHeader(g_curRomInfo.szGameName, &g_curRomInfo.romheader);
Ini_GetRomOptions(&g_curRomInfo);
char *p = g_curRomInfo.szGameName + (lstrlen(g_curRomInfo.szGameName) -1); // -1 to skip null
while (p >= g_curRomInfo.szGameName)
{
if( *p == ':' || *p == '\\' || *p == '/' )
*p = '-';
p--;
}
GenerateCurrentRomOptions();
status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID);
if( status.dwTvSystem == TV_SYSTEM_NTSC )
status.fRatio = 0.75f;
else
status.fRatio = 9/11.0f;;
InitExternalTextures();
try {
CDeviceBuilder::GetBuilder()->CreateGraphicsContext();
CGraphicsContext::InitWindowInfo();
bool res = CGraphicsContext::Get()->Initialize(g_GraphicsInfo.hWnd, g_GraphicsInfo.hStatusBar, 640, 480, TRUE);
if(!res )
{
g_CritialSection.Unlock();
return false;
}
CDeviceBuilder::GetBuilder()->CreateRender();
CRender::GetRender()->Initialize();
DLParser_Init();
status.bGameIsRunning = true;
}
catch(...)
{
ErrorMsg("Exception caught while starting video renderer");
throw 0;
}
g_CritialSection.Unlock();
return true;
}
示例8: StartVideo
void StartVideo(void)
{
#ifdef DEBUGON
// _break();
#endif
windowSetting.dps = windowSetting.fps = -1;
windowSetting.lastSecDlistCount = windowSetting.lastSecFrameCount = 0xFFFFFFFF;
g_CritialSection.Lock();
memcpy(&g_curRomInfo.romheader, g_GraphicsInfo.HEADER, sizeof(ROMHeader));
#ifndef _BIG_ENDIAN
unsigned char *puc = (unsigned char *) &g_curRomInfo.romheader;
unsigned int i;
unsigned char temp;
for (i = 0; i < sizeof(ROMHeader); i += 4)
{
temp = puc[i];
puc[i] = puc[i+3];
puc[i+3] = temp;
temp = puc[i+1];
puc[i+1] = puc[i+2];
puc[i+2] = temp;
}
#endif //_BIG_ENDIAN
ROM_GetRomNameFromHeader(g_curRomInfo.szGameName, &g_curRomInfo.romheader);
Ini_GetRomOptions(&g_curRomInfo);
char *p = (char *) g_curRomInfo.szGameName + (strlen((char *) g_curRomInfo.szGameName) -1); // -1 to skip null
while (p >= (char *) g_curRomInfo.szGameName)
{
if( *p == ':' || *p == '\\' || *p == '/' )
*p = '-';
p--;
}
GenerateCurrentRomOptions();
status.dwTvSystem = CountryCodeToTVSystem(g_curRomInfo.romheader.nCountryID);
if( status.dwTvSystem == TV_SYSTEM_NTSC )
status.fRatio = 0.75f;
else
status.fRatio = 9/11.0f;;
InitExternalTextures();
try {
#ifdef __GX__
CDeviceBuilder::SelectDeviceType(OGL_DEVICE);
#endif //__GX__
#ifdef XENON
CDeviceBuilder::SelectDeviceType(OGL_DEVICE);
#endif
CDeviceBuilder::GetBuilder()->CreateGraphicsContext();
CGraphicsContext::InitWindowInfo();
windowSetting.bDisplayFullscreen = FALSE;
bool res = CGraphicsContext::Get()->Initialize(0, 0, 640, 480, TRUE);
CDeviceBuilder::GetBuilder()->CreateRender();
CRender::GetRender()->Initialize();
if( res )
{
DLParser_Init();
}
status.bGameIsRunning = true;
}
catch(...)
{
ErrorMsg("Error to start video");
throw 0;
}
g_CritialSection.Unlock();
}