コード例 #1
0
ファイル: SAMPLE.C プロジェクト: arnobmallick/team_psx
/* in  : val	0 or 1 (コントローラとの併用 : 1) */
void InitMemCard(long val)
{
	InitCARD(val);		/* 通常 val=1 : コントローラと併用 */
	StartCARD();
	_bu_init();
	ChangeClearPAD(0);

	EnterCriticalSection();
	ev0  = OpenEvent(SwCARD, EvSpIOE, EvMdNOINTR, NULL);
	ev1  = OpenEvent(SwCARD, EvSpERROR, EvMdNOINTR, NULL);
	ev2  = OpenEvent(SwCARD, EvSpTIMOUT, EvMdNOINTR, NULL);
	ev3  = OpenEvent(SwCARD, EvSpNEW, EvMdNOINTR, NULL);
	ev10 = OpenEvent(HwCARD, EvSpIOE, EvMdNOINTR, NULL);
	ev11 = OpenEvent(HwCARD, EvSpERROR, EvMdNOINTR, NULL);
	ev12 = OpenEvent(HwCARD, EvSpTIMOUT, EvMdNOINTR, NULL);
	ev13 = OpenEvent(HwCARD, EvSpNEW, EvMdNOINTR, NULL);
	ExitCriticalSection();

	EnableEvent(ev0);
	EnableEvent(ev1);
	EnableEvent(ev2);
	EnableEvent(ev3);
	EnableEvent(ev10);
	EnableEvent(ev11);
	EnableEvent(ev12);
	EnableEvent(ev13);

}
コード例 #2
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
bool CXBoxRenderManager::Configure(unsigned int width, unsigned int height, unsigned int d_width, unsigned int d_height, float fps, unsigned flags)
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);      

  if(!m_pRenderer) 
  {
    RestoreCriticalSection(g_graphicsContext, locks);
    CLog::Log(LOGERROR, "%s called without a valid Renderer object", __FUNCTION__);
    return false;
  }

  bool result = m_pRenderer->Configure(width, height, d_width, d_height, fps, flags);
  if(result)
  {
    if( flags & CONF_FLAGS_FULLSCREEN )
    {
      lock.Leave();
      g_application.getApplicationMessenger().SwitchToFullscreen();
      lock.Enter();
    }
    m_pRenderer->Update(false);
    m_bIsStarted = true;
  }
  
  RestoreCriticalSection(g_graphicsContext, locks);
  return result;
}
コード例 #3
0
void CGUIPythonWindowXMLDialog::Show(bool show /* = true */)
{
    int count = ExitCriticalSection(g_graphicsContext);
    ThreadMessage tMsg = {TMSG_GUI_PYTHON_DIALOG, 1, show ? 1 : 0};
    tMsg.lpVoid = this;
    g_application.getApplicationMessenger().SendMessage(tMsg, true);
    RestoreCriticalSection(g_graphicsContext, count);
}
コード例 #4
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
void CWinRenderManager::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CSharedLock lock(m_sharedSection); 
  RestoreCriticalSection(g_graphicsContext, locks);

  if (m_pRenderer)
    m_pRenderer->RenderUpdate(clear, flags, alpha);
}
コード例 #5
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
void CWinRenderManager::CreateThumbnail(LPDIRECT3DSURFACE8 surface, unsigned int width, unsigned int height)
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  if (m_pRenderer)
    m_pRenderer->CreateThumbnail(surface, width, height);
}
コード例 #6
0
ファイル: Object.cpp プロジェクト: rafdp/MeteoProject
void Direct3DObject::Draw (ID3D11DeviceContext* deviceContext, 
						   Direct3DCamera* cam)
{
	BEGIN_EXCEPTION_HANDLING

	EnterCriticalSection ();

	//printf ("%d\n", vertices_.size());
	uint16_t i = rand () % vertices_.size ();
	//printf ("%f %f %f\n", vertices_[i].x, vertices_[i].y, vertices_[i].z);
	if (buffersSet_ == false)
		_EXC_N (BUFFERS_NOT_SET, 
				"D3D: Unable to draw with the buffers not set (obj %d)" _ 
				objectId_)

	if (vertices_.size () == 0)
		_EXC_N (EMPTY_VERTICES, 
				"D3D: Unable to draw object with empty vertex buffer (obj %d)" _ 
				objectId_)

	UINT stride = sizeof (Vertex_t);
	UINT offset = 0;
	deviceContext->IASetVertexBuffers (0, 1, &vertexBuffer_, &stride, &offset);
	if (drawIndexed_)
	{
		if (indices_.size () == 0)
			_EXC_N (EMPTY_INDICES,
					"D3D: Unable to draw object with empty index buffer (obj %d)" _
					objectId_)
			deviceContext->IASetIndexBuffer (indexBuffer_, DXGI_FORMAT_R32_UINT, 0);
	} 


	XMVECTOR temp;
	currM_.objData_.World       = XMMatrixTranspose (currM_.world_);
	currM_.objData_.View        = XMMatrixTranspose (cam->GetView());
	currM_.objData_.Projection  = XMMatrixTranspose (cam->GetProjection());
	currM_.objData_.InverseView = XMMatrixTranspose (XMMatrixInverse (&temp, cam->GetView ()));
	currM_.objData_.InverseProjection = XMMatrixTranspose (XMMatrixInverse(&temp, cam->GetProjection ()));

	
	cbManager_->Update (objectBufferN_, deviceContext);
	cbManager_->SendVSBuffer (objectBufferN_, deviceContext);
	cbManager_->SendGSBuffer (objectBufferN_, deviceContext);
	cbManager_->SendPSBuffer (objectBufferN_, deviceContext);

	deviceContext->IASetPrimitiveTopology (topology_);

	if (drawIndexed_)
		deviceContext->DrawIndexed (static_cast<UINT> (indices_.size ()), 0, 0);
	else
		deviceContext->Draw (static_cast<UINT> (vertices_.size ()), 0);
	ExitCriticalSection ();

	END_EXCEPTION_HANDLING (DRAW_OBJECT)

}
コード例 #7
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
void CWinRenderManager::Update(bool bPauseDrawing)
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  m_bPauseDrawing = bPauseDrawing;
  if (m_pRenderer)
    m_pRenderer->Update(bPauseDrawing);
}
コード例 #8
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
CWinRenderManager::~CWinRenderManager()
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  if (m_pRenderer)
    delete m_pRenderer;
  m_pRenderer = NULL;
}
コード例 #9
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
void CXBoxRenderManager::CreateThumbnail(SDL_Surface * surface, unsigned int width, unsigned int height)
#endif
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  if (m_pRenderer)
    m_pRenderer->CreateThumbnail(surface, width, height);
}
コード例 #10
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
unsigned int CXBoxRenderManager::PreInit()
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

#ifndef HAS_SDL
  if(!g_eventVBlank)
  {
    //Only do this on first run
    g_eventVBlank = CreateEvent(NULL,FALSE,FALSE,NULL);
    D3DDevice::SetVerticalBlankCallback((D3DVBLANKCALLBACK)VBlankCallback);
  }
#endif

  /* no pedning present */
  m_eventPresented.Set();

  m_bIsStarted = false;
  m_bPauseDrawing = false;
  m_presentdelay = 5;
  if (!m_pRenderer)
  { 
#ifndef HAS_SDL
    // no renderer
    m_rendermethod = g_guiSettings.GetInt("videoplayer.rendermethod");
    if (m_rendermethod == RENDER_OVERLAYS)
    {
      CLog::Log(LOGDEBUG, __FUNCTION__" - Selected Overlay-Renderer");
      m_pRenderer = new CComboRenderer(g_graphicsContext.Get3DDevice());
    }
    else if (m_rendermethod == RENDER_HQ_RGB_SHADER)
    {
      CLog::Log(LOGDEBUG, __FUNCTION__" - Selected RGB-Renderer");
      m_pRenderer = new CRGBRenderer(g_graphicsContext.Get3DDevice());
    }
    else if (m_rendermethod == RENDER_HQ_RGB_SHADERV2)
    {
      CLog::Log(LOGDEBUG, __FUNCTION__" - Selected RGB-Renderer V2");
      m_pRenderer = new CRGBRendererV2(g_graphicsContext.Get3DDevice());
    }
    else // if (g_guiSettings.GetInt("videoplayer.rendermethod") == RENDER_LQ_RGB_SHADER)
    {
      CLog::Log(LOGDEBUG, __FUNCTION__" - Selected LQShader-Renderer");
      m_pRenderer = new CPixelShaderRenderer(g_graphicsContext.Get3DDevice());
    }
#elif defined(HAS_SDL_OPENGL)
    m_pRenderer = new CLinuxRendererGL();
#else
    m_pRenderer = new CLinuxRenderer();
#endif
  }

  return m_pRenderer->PreInit();
}
コード例 #11
0
ファイル: RenderManager.cpp プロジェクト: Bobbin007/xbmc
 CRetakeLock(CSharedSection &section, bool immidiate = true, CCriticalSection &owned = g_graphicsContext)
   : m_owned(owned)
 {
   m_count = ExitCriticalSection(m_owned);
   m_lock  = new T(section);
   if(immidiate)
   {
     RestoreCriticalSection(m_owned, m_count);
     m_count = 0;
   }
 }
コード例 #12
0
void CGUIDialog::Close(bool forceClose /* = false */)
{
  if (!g_application.IsCurrentThread())
  {
    // make sure graphics lock is not held
    int nCount = ExitCriticalSection(g_graphicsContext);
    g_application.getApplicationMessenger().Close(this, forceClose);
    RestoreCriticalSection(g_graphicsContext, nCount);
  }
  else
    g_application.getApplicationMessenger().Close(this, forceClose);
}
コード例 #13
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
CXBoxRenderManager::~CXBoxRenderManager()
{
#ifndef _LINUX
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);
#endif

  if (m_pRenderer)
    delete m_pRenderer;
  m_pRenderer = NULL;
}
コード例 #14
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
void CXBoxRenderManager::RenderUpdate(bool clear, DWORD flags, DWORD alpha)
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CSharedLock lock(m_sharedSection); 
  RestoreCriticalSection(g_graphicsContext, locks);

#ifdef HAS_SDL_OPENGL  
  if (m_pRenderer)
    m_pRenderer->RenderUpdate(clear, flags | RENDER_FLAG_LAST, alpha);

  m_eventPresented.Set();
#endif
}
コード例 #15
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
void CWinRenderManager::UnInit()
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  m_bIsStarted = false;
  if (m_pRenderer)
  {
    m_pRenderer->UnInit();
    delete m_pRenderer;
    m_pRenderer = NULL;
  }
}
コード例 #16
0
ファイル: XThreadUtils.cpp プロジェクト: Avoidnf8/xbmc-fork
static int InternalThreadFunc(void *data)
{
#ifdef __APPLE__
  pthread_once(&keyOnce, MakeTlsKey);
  pthread_setspecific(tlsParamKey, data);

  // Save the Mach port with the handle.
  ((InternalThreadParam* )data)->handle->m_machThreadPort = mach_thread_self();
#else
  pParam = (InternalThreadParam *)data;
#endif

  int nRc = -1;

  // assign termination handler
  struct sigaction action;
  action.sa_handler = handler;
  sigemptyset (&action.sa_mask);
  action.sa_flags = 0;
  //sigaction (SIGABRT, &action, NULL);
  //sigaction (SIGSEGV, &action, NULL);

#ifdef __APPLE__
  void* pool = InitializeAutoReleasePool();
#endif

  try {
     CLog::Log(LOGDEBUG,"Running thread %lu", (unsigned long)SDL_ThreadID());
     nRc = GET_PARAM()->threadFunc(GET_PARAM()->data);
  }
  catch(...) {
    CLog::Log(LOGERROR,"thread 0x%x raised an exception. terminating it.", SDL_ThreadID());
  }

#ifdef __APPLE__
    DestroyAutoReleasePool(pool);
#endif

  if (OwningCriticalSection(g_graphicsContext))
  {
    CLog::Log(LOGERROR,"thread terminated and still owns graphic context. releasing it.");
    ExitCriticalSection(g_graphicsContext);
  }

  SetEvent(GET_PARAM()->handle);
  CloseHandle(GET_PARAM()->handle);
  delete GET_PARAM();
  return nRc;
}
コード例 #17
0
ファイル: SAMPLE.C プロジェクト: arnobmallick/team_psx
/* メモリカード制御モジュールの終了 */
void StopMemCard(void)
{
	EnterCriticalSection();
	CloseEvent(ev0);
	CloseEvent(ev1);
	CloseEvent(ev2);
	CloseEvent(ev3);
	CloseEvent(ev10);
	CloseEvent(ev11);
	CloseEvent(ev12);
	CloseEvent(ev13);
	ExitCriticalSection();
#if 0
	StopCARD();
#endif
}
コード例 #18
0
ファイル: WinRenderManager.cpp プロジェクト: Castlecard/plex
unsigned int CWinRenderManager::PreInit()
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);
  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  m_bIsStarted = false;
  m_bPauseDrawing = false;

  if (!m_pRenderer)
  { // no renderer
      CLog::Log(LOGDEBUG, __FUNCTION__" - Selected Win RGB-Renderer ");
      m_pRenderer = new CPixelShaderRenderer(g_graphicsContext.Get3DDevice());
  }
  return m_pRenderer->PreInit();
}
コード例 #19
0
ファイル: XThreadUtils.cpp プロジェクト: Avoidnf8/xbmc-fork
void handler (int signum)
{
  CLog::Log(LOGERROR,"thread 0x%x (%lu) got signal %d. terminating thread abnormally.", SDL_ThreadID(), (unsigned long)SDL_ThreadID(), signum);
  if (GET_PARAM() && GET_PARAM()->handle)
  {
    SetEvent(GET_PARAM()->handle);
    CloseHandle(GET_PARAM()->handle);
    delete GET_PARAM();
  }

  if (OwningCriticalSection(g_graphicsContext))
  {
    CLog::Log(LOGWARNING,"killed thread owns graphic context. releasing it.");
    ExitCriticalSection(g_graphicsContext);
  }

  pthread_exit(NULL);
}
コード例 #20
0
ファイル: RenderManager.cpp プロジェクト: suhongrui/plex
void CXBoxRenderManager::UnInit()
{
  DWORD locks = ExitCriticalSection(g_graphicsContext);

  m_bStop = true;
  m_eventFrame.Set();
  StopThread();

  CExclusiveLock lock(m_sharedSection);
  RestoreCriticalSection(g_graphicsContext, locks);

  m_bIsStarted = false;
  if (m_pRenderer)
  {
    m_pRenderer->UnInit();
#ifndef _LINUX
    delete m_pRenderer;
    m_pRenderer = NULL;
#endif
  }
}