Пример #1
0
bool ConfigConnection::Init(bool checkEnabled)
{
	{
		Lock il(_initLock);
		if (_initState == INIT_STATE_CONNECTING) {
			return false;
		}
		_initState = INIT_STATE_CONNECTING;
	}

	if (!(_pthiCommand.PTHIClient.Init(1))) {
		Deinit();
		return false;
	}

	if (checkEnabled) {
		if (_CFCON_AMT_ENABLED != IsAMTEnabled(true)) {
			Deinit();
			return false;
		}
	}

	{
		Lock il(_initLock);
		if (_initState != INIT_STATE_CONNECTING) {
			_pthiCommand.PTHIClient.Deinit();
			return false;
		}
		_initState = INIT_STATE_CONNECTED;
	}

	return true;
}
Пример #2
0
void BotCore::Wait()
{
	log.GetLog(BotLogger::DBG).Put(INFO, "BotCore::Wait: controlling thread waiting for lock release");
	--running; // semaphore lock, waits for increment.  if increment has already happened, don't block
	log.GetLog(BotLogger::DBG).Put(INFO, "BotCore::Wait: controlling awoke, bot shutdown starting");
	Deinit();
}
Пример #3
0
EXPORT void snes_term()
{
   S9xDeinitAPU();
   Deinit();
   S9xGraphicsDeinit();
   S9xUnmapAllControls();
}
Пример #4
0
CHikv3Parser::~CHikv3Parser()
{
	if (m_hNewHandle != NULL)
		Deinit();

	J_OS::LOGINFO("CHikv3Parser::CHikv3Parser distroyed");
}
int openmax_processor::Init(size_t nbPort)
//*******************************************************************************
{ // Make the binding of interfaces
	int result= eNoError;
	Deinit(); //First clean if necessary
	m_NbPorts=nbPort;
	m_pPortInfo = new portInformation[nbPort];
	if (m_pPortInfo ==NULL)
	{
		result= eError_CannotAllocate_PortInfo;
	}
	else
	{ // Init all port info to null;
		portInformation *pInfo;
		for(size_t i=0; i < nbPort; i++)
		{ //Default ports initialisation
			pInfo=&m_pPortInfo[i];
			pInfo->Default();
		}
	}
	//Allocate port array
	m_pPort = new Port[nbPort];
	if (m_pPort ==NULL)
	{
		result= eError_CannotAllocate_Ports;
	}
	else
	{ // Init all port info to null;
	}
	return(result);
}
Пример #6
0
CMp4FileWriter::~CMp4FileWriter()
{
	if( m_bInit )
	{
		Deinit();
	}
}
Пример #7
0
int main( int argc, char *argv[])
{
	Initialize();
	Run();
	Deinit();
	return 0;
}
Пример #8
0
void Object::Destroy()
{
	Deinit();


	// @todo Keep?
//	delete this;
}
                        ODE_SearchReplace :: ~ODE_SearchReplace ( )
{

  ClosePHs();

  Deinit();

}
Пример #10
0
InputDeviceManager::~InputDeviceManager()
{
    //dtor
    if(mInitialized)
    {
        Deinit();
    }
}
AdaptiveHistogramCamshift::~AdaptiveHistogramCamshift()
{
  // Safe free buffers.
  Deinit();
  // Destroy windows.
  cvDestroyWindow(m_controlsGUIWndName.c_str());
  cvDestroyWindow(m_backprojectWndName.c_str());
  cvDestroyWindow(m_histogramWndName.c_str());
}
Пример #12
0
void retro_deinit(void)
{
   S9xDeinitAPU();
   Deinit();
   S9xGraphicsDeinit();
   S9xUnmapAllControls();
   
   free(GFX.Screen);
}
Пример #13
0
//외부에서 생성된 텍스쳐를 직접 찔러넣기. renter texture나 외부 라이브러리에서 생성된 텍스쳐에서 쓴다
bool Texture::Init(HandleType handle, const ImageDesc &img_desc, bool is_rtt) {
  if(handle_ != 0) {
    Deinit();
  }
  handle_ = handle;
  img_desc_ = img_desc;
  is_render_to_texture_ = is_rtt;
  return true;
}
Пример #14
0
static void snes_init (void)
{
    memset(&Settings, 0, sizeof(Settings));
    Settings.SpeedhackGameID = SPEEDHACK_NONE;
    Settings.Transparency = TRUE;
    Settings.FrameTimePAL = 20000;
    Settings.FrameTimeNTSC = 16667;
    Settings.SoundPlaybackRate = 32000;
    Settings.SoundInputRate = 32000;
    Settings.HDMATimingHack = 100;
    Settings.BlockInvalidVRAMAccessMaster = TRUE;
    Settings.CartAName[0] = 0;
    Settings.CartBName[0] = 0;
    Settings.Crosshair = 1;

    CPU.Flags = 0;

    if (!Init() || !S9xInitAPU())
    {
        Deinit();
        S9xDeinitAPU();
        if (log_cb)
            log_cb(RETRO_LOG_ERROR, "Failed to init Memory or APU.\n");
        exit(1);
    }

    //very slow devices will still pop

    //this needs to be applied to all snes9x cores

    //increasing the buffer size does not cause extra lag(tested with 1000ms buffer)
    //bool8 S9xInitSound (int buffer_ms, int lag_ms)

    S9xInitSound(1000, 0);//just give it a 1 second buffer

    S9xSetSamplesAvailableCallback(S9xAudioCallback);

    GFX.Pitch = use_overscan ? 1024 : 2048; // FIXME: What is this supposed to do? Overscan has nothing to do with anything like this. If this is the Wii performance hack, it should be done differently.

#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)
    /* request 128-bit alignment here if possible */
    posix_memalign((void**)&GFX.Screen, 16, GFX.Pitch * 512 * sizeof(uint16));
#else
    GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
#endif

    S9xGraphicsInit();

    retro_set_controller_port_device(0, RETRO_DEVICE_JOYPAD);
    retro_set_controller_port_device(1, RETRO_DEVICE_JOYPAD);

    S9xUnmapAllControls();
    map_buttons();

    /* Initialize SuperFX CPU to normal speed by default */
    Settings.SuperFXSpeedPerLine = 0.417 * 10.5e6;
}
Пример #15
0
void Rekd2D::Core::RunnableWindow::Unload()
{
	Deinit();

	for (std::vector<IComponent*>::iterator it = m_Components.begin(); it != m_Components.end(); ++it)
	{
		if (*it) delete (*it);
	}
	m_Components.clear();
}
Пример #16
0
static void Close (vlc_va_t *va)
{
    vlc_va_sys_t *sys = va->sys;

    if (sys->context.decoder != VDP_INVALID_HANDLE)
        Deinit (va);
    sys->DeviceDestroy (sys->device);
    XCloseDisplay (sys->display);
    free (sys);
}
Пример #17
0
void Editor::LoadProject(string dir)
{
	Deinit();
	gameFolder = dir;
	programFolder = dir+"/bin/x64/linux";

	LoadFile("settings/game.prop");
//	fileSystem->Init();
	scene->Init();
}
Пример #18
0
static void Close(vlc_va_t *va)
{
    vlc_va_sys_t *sys = va->sys;

    if (sys->context->decoder != VDP_INVALID_HANDLE)
        Deinit(va);
    vdp_release_x11(sys->vdp);
    av_free(sys->context);
    free(sys);
}
Пример #19
0
EXPORT void snes_init()
{
	int i;
	if(environ_cb)
	{
		unsigned pitch;
		if (!environ_cb(SNES_ENVIRONMENT_GET_OVERSCAN, &use_overscan))
			use_overscan = FALSE;

		if (use_overscan)
		{
			struct snes_geometry geom = {256, 239, 512, 512};
			environ_cb(SNES_ENVIRONMENT_SET_GEOMETRY, &geom);
			pitch = 1024;
			environ_cb(SNES_ENVIRONMENT_SET_PITCH, &pitch);
		}
	}
	memset(&Settings, 0, sizeof(Settings));
	Settings.FrameTimePAL = 20000;
	Settings.FrameTimeNTSC = 16667;
	Settings.SoundPlaybackRate = 32000;
	Settings.SoundInputRate = 32000;
	Settings.HDMATimingHack = 100;
	Settings.BlockInvalidVRAMAccessMaster = TRUE;
	Settings.CartAName[0] = 0;
	Settings.CartBName[0] = 0;
	Settings.Crosshair = 1;

	CPU.Flags = 0;

	if (!Init() || !S9xInitAPU())
	{
		Deinit();
		S9xDeinitAPU();
		fprintf(stderr, "[libsnes]: Failed to init Memory or APU.\n");
		exit(1);
	}

	S9xInitSound(16, 0);
	S9xSetSamplesAvailableCallback(S9xAudioCallback);

	GFX.Pitch = use_overscan ? 1024 : 2048;
	GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16));
	S9xGraphicsInit();

	for ( i = 0; i < 2; i++)
	{
		S9xSetController(i, CTL_JOYPAD, i, 0, 0, 0);
		snes_devices[i] = SNES_DEVICE_JOYPAD;
	}

	S9xUnmapAllControls();
	map_buttons();
}
Пример #20
0
GradientEffect::~GradientEffect()
{
    RETAILMSG(ZONE_OBJECT | ZONE_VERBOSE, "\t~GradientEffect( %4d )", m_ID);

    // Delete the shaders when the last instance is freed
    if (0 == ATOMIC_DECREMENT( GradientEffect::s_NumInstances ))
    {
        RETAILMSG(ZONE_INFO, "~GradientEffect: last instance deleted, freeing Color shaders");
        Deinit();
    }
}
Пример #21
0
RippleEffect::~RippleEffect()
{
    RETAILMSG(ZONE_OBJECT | ZONE_VERBOSE, "\t~RippleEffect( %4d )", m_ID);

    SAFE_ARRAY_DELETE(m_pRippledVertices);

    // Delete the shaders when the last instance is freed
    if (0 == ATOMIC_DECREMENT( RippleEffect::s_NumInstances ))
    {
        RETAILMSG(ZONE_INFO, "~RippleEffect: last instance deleted, freeing Ripple shaders");
        Deinit();
    }
}
Пример #22
0
static int Setup(vlc_va_t *va, void **ctxp, vlc_fourcc_t *chromap,
                 int width, int height)
{
    vlc_va_sys_t *sys = va->sys;

    if (sys->context->decoder != VDP_INVALID_HANDLE)
    {
        if (sys->width == width && sys->height == height)
            return VLC_SUCCESS;
        Deinit(va);
        sys->context->decoder = VDP_INVALID_HANDLE;
    }

    return Init(va, ctxp, chromap, width, height);
}
Пример #23
0
BOOL WINAPI DllMain (HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) {

    switch (dwReason) {
		case DLL_PROCESS_ATTACH:
			Init();
			break;
		case DLL_PROCESS_DETACH:
			Deinit();
			break;
		case DLL_THREAD_ATTACH:
	        break;
		case DLL_THREAD_DETACH:
	        break;
    }

    return true;
}
Пример #24
0
void CLKernel::Init()
{
	Deinit();

	cl_context & ctx = CLManager::Get()->GetContext();
	const cl_device_id *device = &(CLManager::Get()->GetDeviceId());

	cl_int ciErrNum;	// Error code var

	printf("CL Compiling file '%s', kernel '%s'....\n", m_filename.c_str(), m_kernelName.c_str() );

	while (true)
	{
		int numBytes;          // Byte size of kernel code
		const char * cSourceCL = ::TextFileRead( m_filename.c_str(), &numBytes );

		// Create the program
		size_t programSize = numBytes;
		m_clProgram = clCreateProgramWithSource(ctx, 1, (const char **)&cSourceCL, &programSize, &ciErrNum);
		CHECK_CL(ciErrNum);

		delete[] cSourceCL;

		// build program
		ciErrNum = clBuildProgram(m_clProgram, 1, device, NULL, NULL, NULL);
		if (ciErrNum != CL_SUCCESS)
		{
			size_t len;
			char buffer[4096];
			clGetProgramBuildInfo(m_clProgram, CLManager::Get()->GetDeviceId(), CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len);
			MESSAGE_BOX("CL Compile Error", "CL '%s'\nCompile Error: %s", m_filename.c_str(), buffer );
		}
		else
		{
			printf("CL Compiled file '%s', kernel '%s' successfully!\n", m_filename.c_str(), m_kernelName.c_str() );
			// compiled successfully, quit!
			break;
		}
	}

	// create kernel
	m_clKernel = clCreateKernel(m_clProgram, m_kernelName.c_str(), &ciErrNum);
	CHECK_CL(ciErrNum);
}
Пример #25
0
/* This is called from CApplication::ProcessSlow() and is used to tell if nfs have been idle for too long */
void CNFSConnection::CheckIfIdle()
{
  /* We check if there are open connections. This is done without a lock to not halt the mainthread. It should be thread safe as
   worst case scenario is that m_OpenConnections could read 0 and then changed to 1 if this happens it will enter the if wich will lead to another check, wich is locked.  */
  if (m_OpenConnections == 0 && m_pNfsContext != NULL)
  { /* I've set the the maxiumum IDLE time to be 1 min and 30 sec. */
    PLATFORM::CLockObject lock(*this);
    if (m_OpenConnections == 0 /* check again - when locked */)
    {
      if (m_IdleTimeout > 0)
      {
        m_IdleTimeout--;
      }
      else
      {
        XBMC->Log(ADDON::LOG_NOTICE, "NFS is idle. Closing the remaining connections.");
        Deinit();
      }
    }
  }
  
  if( m_pNfsContext != NULL )
  {
    PLATFORM::CLockObject lock(m_keepAliveLock);
    //handle keep alive on opened files
    for( tFileKeepAliveMap::iterator it = m_KeepAliveTimeouts.begin();it!=m_KeepAliveTimeouts.end();it++)
    {
      if(it->second.refreshCounter > 0)
      {
        it->second.refreshCounter--;
      }
      else
      {
        keepAlive(it->second.exportPath, it->first);
        //reset timeout
        resetKeepAlive(it->second.exportPath, it->first);
      }
    }
  }
}
Пример #26
0
int32_t FceuGraphics::ChangeResolution(uint32_t resId, uint16_t pal60Hz)
{
	LOG_DBG("SNES9xGraphics::ChangeResolution(%d, %d)\n", resId, pal60Hz);
	int32_t ret;

	PSGLGraphics::DeinitDbgFont();
	Deinit();
	
	PSGLGraphics::Init(resId, pal60Hz);
	PSGLInit();
	SetDimensions(240, 256 * 4);

	Rect r;
	r.x = 0;
	r.y = 0;
	r.w = 256;
	r.h = 240;
	SetRect(r);
	SetAspectRatio(m_ratio);
	PSGLGraphics::InitDbgFont();
	PSGLGraphics::SetResolution();
}
Пример #27
0
void SerialPortC::SetSpeed(PortSpeedE NewSpeed)
	{
	Speed = NewSpeed;

	int rs_Baud;

	switch (NewSpeed)
		{
		default: assert(FALSE);

		case PS_300:	{ rs_Baud = 2; break; }
		case PS_600:	{ rs_Baud = 3; break; }
		case PS_1200:	{ rs_Baud = 4; break; }
		case PS_2400:	{ rs_Baud = 5; break; }
		case PS_4800:	{ rs_Baud = 6; break; }
		case PS_9600:	{ rs_Baud = 7; break; }
		case PS_19200:	{ rs_Baud = 8; break; }
		case PS_38400:	{ rs_Baud = 9; break; }
		case PS_57600:	{ rs_Baud = 10; break; }
		case PS_115200: { rs_Baud = 11; break; }
		}

	// disable interrupts for baud change
	if (IsInitialized())
		{
		Deinit();
		}

	assert(initrs);
	(*initrs)((cfg.mdata - 1), rs_Baud, 0, 0, 3, cfg.checkCTS);

	SetInitialized();

	if (cfg.baudPause)
		{
		pause(cfg.baudPause);
		}
	}
Пример #28
0
void LMEConnection::_apfChannelOpenDirect(unsigned char *rxBuffer, unsigned int bytesRead, UINT32 *senderChannel, int *status)
{
	unsigned char *pCurrent;
	APF_GENERIC_HEADER *pHeader = (APF_GENERIC_HEADER *)rxBuffer;

	if (bytesRead < sizeof(APF_GENERIC_HEADER) +
	    ntohl(pHeader->StringLength) +
	    7 + (5 * sizeof(UINT32))) {
		PRINT("Error receiving data from HECI\n");
		Deinit();
		return;
	}

	pCurrent = rxBuffer + sizeof(APF_GENERIC_HEADER) +
		APF_STR_SIZE_OF(APF_OPEN_CHANNEL_REQUEST_DIRECT);

	LMEChannelOpenRequestMessage channelOpenRequest;
	channelOpenRequest.ChannelType = LMEChannelOpenRequestMessage::DIRECT;

	channelOpenRequest.SenderChannel = ntohl(*((UINT32 *)pCurrent));
	if (senderChannel) {
		*senderChannel = channelOpenRequest.SenderChannel;
	}
	pCurrent += sizeof(UINT32);
	channelOpenRequest.InitialWindow = ntohl(*((UINT32 *)pCurrent));
	pCurrent += 2 * sizeof(UINT32);

	UINT32 len = ntohl(*((UINT32 *)pCurrent));
	pCurrent += sizeof(UINT32);
	channelOpenRequest.Address.append((char *)pCurrent, len);
	pCurrent += len;
	channelOpenRequest.Port = ntohl(*((UINT32 *)pCurrent));
	pCurrent += sizeof(UINT32);

	_cb(_cbParam, &channelOpenRequest, sizeof(channelOpenRequest), status);
}
Пример #29
0
void cEffect::Reload()
{
	Deinit();
	Init( GetNameID(), macFile );
}
Пример #30
0
RakVoice::~RakVoice()
{
	Deinit();
}