EXPORT void CALL UpdateScreen (void)
{
    frameSkipper.update();

    //has there been any display lists since last update
    if (OGL.frame_prevdl == OGL.frame_dl) return;

    OGL.frame_prevdl = OGL.frame_dl;

    if (OGL.frame_dl > 0) OGL.frame_vsync++;

    if (OGL.mustRenderDlist)
    {
		if(config.printFPS)
		{
		    static unsigned int lastTick=0;
		    static int frames=0;
		    unsigned int nowTick = SDL_GetTicks();
		    frames++;
		    if(lastTick + 5000 <= nowTick)
		    {
		        printf("Video: %.3f VI/S\n", frames/5.0);

		        frames = 0;
		        lastTick = nowTick;
		    }
		}
	
        OGL.screenUpdate=true;
        VI_UpdateScreen();
        OGL.mustRenderDlist = false;
    }
}
void PluginAPI::UpdateScreen()
{
	LOG(LOG_APIFUNC, "UpdateScreen\n");
#ifdef RSPTHREAD
	_callAPICommand(acUpdateScreen);
#else
	VI_UpdateScreen();
#endif
}
DWORD WINAPI RSP_ThreadProc( LPVOID lpParameter )
{
    RSP_Init();

    SetEvent( RSP.threadFinished );
#ifndef _DEBUG
    __try
    {
#endif
        while (TRUE)
        {
            switch (WaitForMultipleObjects( 6, RSP.threadMsg, FALSE, INFINITE ))
            {
            case (WAIT_OBJECT_0 + RSPMSG_PROCESSDLIST):
                RSP_ProcessDList();
                break;
            case (WAIT_OBJECT_0 + RSPMSG_UPDATESCREEN):
                VI_UpdateScreen();
                break;
            case (WAIT_OBJECT_0 + RSPMSG_CLOSE):
                OGL_Stop();
                SetEvent( RSP.threadFinished );
                return 1;
            case (WAIT_OBJECT_0 + RSPMSG_DESTROYTEXTURES):
                Combiner_Destroy();
                FrameBuffer_Destroy();
                TextureCache_Destroy();
                break;
            case (WAIT_OBJECT_0 + RSPMSG_INITTEXTURES):
                FrameBuffer_Init();
                TextureCache_Init();
                Combiner_Init();
                gSP.changed = gDP.changed = 0xFFFFFFFF;
                break;
            case (WAIT_OBJECT_0 + RSPMSG_CAPTURESCREEN):
                OGL_SaveScreenshot();
                break;
            }
            SetEvent( RSP.threadFinished );
        }
#ifndef _DEBUG
    }
    __except(EXCEPTION_EXECUTE_HANDLER)
    {
        char exception[256];
        sprintf( exception, "Win32 exception 0x%08X occured in glN64", GetExceptionCode() );
        MessageBox( NULL, exception, pluginName, MB_OK | MB_ICONERROR );

        GBI_Destroy();
        DepthBuffer_Destroy();
        OGL_Stop();
    }
#endif
    RSP.thread = NULL;
    return 0;
}
EXPORT void CALL UpdateScreen (void)
{
    //has there been any display lists since last update
    if (OGL.frame_prevdl == OGL.frame_dl) return;

    OGL.frame_prevdl = OGL.frame_dl;

    if (OGL.mustRenderDlist)
    {
        OGL.screenUpdate=true;
        VI_UpdateScreen();
        OGL.mustRenderDlist = false;
    }
}
Exemple #5
0
int RSP_ThreadProc(void *param)
{
    RSP_Init();
    while(true)
    {
        int num = 0;

        RSP.threadIdle = RSP.threadEvents.empty();

        //process all events
        while(!RSP.threadEvents.empty())
        {
            switch (RSP.threadEvents.front())
            {
                case (RSPMSG_PROCESSDLIST):
                    RSP_ProcessDList();
                    break;
                case (RSPMSG_UPDATESCREEN):
                    VI_UpdateScreen();
                    break;
                case (RSPMSG_CLOSE):
                    OGL_Stop();
                    return 0;
                    break;
                case (RSPMSG_DESTROYTEXTURES):
                    Combiner_Destroy();
                    TextureCache_Destroy();
                    break;
                case (RSPMSG_INITTEXTURES):
                    TextureCache_Init();
                    Combiner_Init();
                    gSP.changed = gDP.changed = 0xFFFFFFFF;
                    break;
                case (RSPMSG_CAPTURESCREEN):
                    OGL_SaveScreenshot();
                    break;
            }
            RSP.threadEvents.pop();
            num++;
        }
    }

    return 0;
}
void RSP_ThreadProc(std::mutex * _pRspThreadMtx, std::mutex * _pPluginThreadMtx, std::condition_variable_any * _pRspThreadCv, std::condition_variable_any * _pPluginThreadCv, API_COMMAND * _pCommand)
{
	_pRspThreadMtx->lock();
	RSP_Init();
	GBI.init();
	Config_LoadConfig();
	video().start();
	assert(!isGLError());

	while (true) {
		_pPluginThreadMtx->lock();
		_pPluginThreadCv->notify_one();
		_pPluginThreadMtx->unlock();
		_pRspThreadCv->wait(*_pRspThreadMtx);
		switch (*_pCommand) {
		case acProcessDList:
			RSP_ProcessDList();
			break;
		case acProcessRDPList:
			RDP_ProcessRDPList();
			break;
		case acUpdateScreen:
			VI_UpdateScreen();
			break;
		case acRomClosed:
			TFH.shutdown();
			video().stop();
			GBI.destroy();
			*_pCommand = acNone;
			_pRspThreadMtx->unlock();
			_pPluginThreadMtx->lock();
			_pPluginThreadCv->notify_one();
			_pPluginThreadMtx->unlock();
			return;
		}
		assert(!isGLError());
		*_pCommand = acNone;
	}
}
	bool run() {
		VI_UpdateScreen();
		return true;
	}