Esempio n. 1
0
void GameConfigKeys (unsigned int key, bool special, bool release, int x, int y) {
    if (release) return;
	switch (key) {
		case SDLK_q: Winsys.Quit (); break;
		case 27: Winsys.SetMode (g_game.prev_mode); break;
		case SDLK_TAB: if (curr_focus < 7) curr_focus++; else curr_focus = 0; break;
		case 13: 
			switch (curr_focus) {
				case 6: Winsys.SetMode (g_game.prev_mode); break;
				case 7: SetConfig (); break;
				default: SetConfig (); break;
			} break;
		case 276: 
			switch (curr_focus) {
				case 0: ToggleFullscreen (); break; 
				case 1: ChangeRes (-1); break;
				case 2: ChangeMusVol (-1); break;
				case 3: ChangeSoundVol (-1); break;
				case 4: ChangeDetail (-1); break;
				case 5: ChangeLanguage (-1); break;
			} break;
		case 275: 
			switch (curr_focus) {
				case 0: ToggleFullscreen (); break; 
				case 1: ChangeRes (1); break;
				case 2: ChangeMusVol (1); break;
				case 3: ChangeSoundVol (1); break;
				case 4: ChangeDetail (1); break;
				case 5: ChangeLanguage (1); break;
			} break;
		case 273: if (curr_focus > 0) curr_focus--; break;
		case 274: if (curr_focus < 7) curr_focus++; break;
	}
}
Esempio n. 2
0
void PlayerDriver::setLooping( int isLooping )
{
    m_bIsLooping = isLooping;
    if (m_bIsLooping)
    {
        SetConfig("FinishMode", FINISH_RESTART_TO_PREFETCH);
        SetConfig("LoopingInCurrentTrack", TRUE);
    }
}
Esempio n. 3
0
void CommManager::DisconnectedNotify()
{
#ifdef _DEBUG
    SetConfig(1000 * 30, 1000 * 30);
#else
    SetConfig(1000 * 60 * 30, g_ConfigInfo.nTryConnectIntervalM * 60 * 1000);
#endif
    ::InterlockedExchange(&m_bConnected, FALSE);
    debugLog(_T("DISCONNECTED"));
}
Esempio n. 4
0
void AuctionBotConfig::SetConfig(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue)
{
    SetConfig(index, sConfigMgr->GetIntDefault(fieldname, defvalue));

    if (int32(GetConfig(index)) < 0)
    {
        TC_LOG_ERROR("ahbot", "AHBot: %s (%i) can't be negative. Using %u instead.", fieldname, int32(GetConfig(index)), defvalue);
        SetConfig(index, defvalue);
    }
}
Esempio n. 5
0
void AuctionBotConfig::SetConfigMax(AuctionBotConfigUInt32Values index, char const* fieldname, uint32 defvalue, uint32 maxvalue)
{
    SetConfig(index, sConfigMgr->GetIntDefault(fieldname, defvalue));

    if (GetConfig(index) > maxvalue)
    {
        TC_LOG_ERROR("ahbot", "AHBot: %s (%u) must be in range 0...%u. Using %u instead.", fieldname, GetConfig(index), maxvalue, maxvalue);
        SetConfig(index, maxvalue);
    }
}
Esempio n. 6
0
// Return false if the serial configuration is not valid for the host.
bool
CeCosTestSerialFilter::VerifyConfig(CeCosSerial &pSer, ser_cfg_t* new_cfg)
{
    ser_cfg_t old_cfg;
    bool rc;

    // Try changing to the new config, recording the result. Then restore
    // the original config.
    rc = SetConfig(pSer, new_cfg, &old_cfg);
    SetConfig(pSer, &old_cfg, NULL);

    return rc;
}
Esempio n. 7
0
void    plDynamicTextMap::Create( uint32_t width, uint32_t height, bool hasAlpha, uint32_t extraWidth, uint32_t extraHeight )
{
    SetConfig( hasAlpha ? kARGB32Config : kRGB32Config );


    fVisWidth = (uint16_t)width;
    fVisHeight = (uint16_t)height;
    fHasAlpha = hasAlpha;

    for( fWidth = 1; fWidth < width + extraWidth; fWidth <<= 1 );
    for( fHeight = 1; fHeight < height + extraHeight; fHeight <<= 1 );

    // instead of allocating the fImage here, we'll wait for the first draw operation to be called (in IIsValid)
    fHasCreateBeenCalled = true;

    fRowBytes = fWidth << 2;
    fNumLevels = 1;
    fFlags |= plMipmap::kDontThrowAwayImage | plMipmap::kAutoGenMipmap;
    fCompressionType = plMipmap::kUncompressed;
    fUncompressedInfo.fType = plMipmap::UncompressedInfo::kRGB8888;

    // Destroy the old texture ref, if we have one. This should force the 
    // pipeline to recreate one more suitable for our use
    SetDeviceRef( nil );

    // Some init color
    SetFont( "Arial", 12 );
    hsColorRGBA color;
    color.Set( 0,0,1,1);
    SetTextColor( color );

    SetCurrLevel( 0 );
    plProfile_Inc(DynaTexts);

}
void CGameConfig::Keyb (unsigned int key, bool special, bool release, int x, int y) {
	if (release) return;

	if (key != SDLK_UP && key != SDLK_DOWN)
		KeyGUI(key, 0, release);
	switch (key) {
		case SDLK_q:
			State::manager.RequestQuit();
			break;
		case SDLK_ESCAPE:
			State::manager.RequestEnterState (*State::manager.PreviousState());
			break;
		case SDLK_RETURN:
			if (textbuttons[0]->focussed())
				State::manager.RequestEnterState (*State::manager.PreviousState());
			else if (textbuttons[1]->focussed())
				SetConfig ();
			break;
		case SDLK_UP:
			DecreaseFocus();
			break;
		case SDLK_DOWN:
			IncreaseFocus();
			break;
	}
}
Esempio n. 9
0
bool OMXClock::Stop(bool lock)
{
	if (!GetComponent())
		return false;

	if (lock)
		Lock();

	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
	OMX_TIME_CONFIG_CLOCKSTATETYPE clock;
	OMX_INIT_STRUCTURE(clock);

	clock.eState = OMX_TIME_ClockStateStopped;
	clock.nOffset = ToOMXTime(-1000LL * OMX_PRE_ROLL);

	omxErr = SetConfig(OMX_IndexConfigTimeClockState, &clock);
	if (omxErr != OMX_ErrorNone)
	{
		if (lock)
			Unlock();

		return false;
	}

	m_eState = clock.eState;

	m_lastMediaTime = 0.0f;

	if (lock)
		Unlock();

	return true;
}
Esempio n. 10
0
bool
FlarmDevice::SetRange(unsigned range, OperationEnvironment &env)
{
  NarrowString<32> buffer;
  buffer.Format("%d", range);
  return SetConfig("RANGE", buffer, env);
}
Esempio n. 11
0
/******************************************************************************
* Dialogs                                                                     *
******************************************************************************/
void ConvertMarkersToTempoDialog (COMMAND_T* = NULL)
{
	static HWND hwnd = CreateDialog(g_hInst, MAKEINTRESOURCE(IDD_BR_MARKERS_TO_TEMPO), g_hwndParent, ConvertMarkersToTempoProc);

	if (g_convertMarkersToTempoDialog)
	{
		KillTimer(hwnd, 1);
		ShowWindow(hwnd, SW_HIDE);
		g_convertMarkersToTempoDialog = false;
	}

	else
	{
		// Detect timebase
		bool cancel = false;
		int timebase; GetConfig("itemtimelock", timebase);
		if (timebase)
		{
			int answer = MessageBox(g_hwndParent, __LOCALIZE("Project timebase is not set to time. Do you want to set it now?","sws_DLG_166"), __LOCALIZE("SWS - Warning","sws_mbox"), MB_YESNOCANCEL);
			if (answer == 6)
				SetConfig("itemtimelock", 0);
			if (answer == 2)
				cancel = true;
		}

		if (!cancel)
		{
			SetTimer(hwnd, 1, 100, NULL);
			ShowWindow(hwnd, SW_SHOW);
			SetFocus(hwnd);
			g_convertMarkersToTempoDialog = true;
		}
	}
	RefreshToolbar(SWSGetCommandID(ConvertMarkersToTempoDialog));
}
Esempio n. 12
0
void CapstoneTokenizer::UpdateConfig()
{
    SetConfig(ConfigBool("Disassembler", "Uppercase"),
              ConfigBool("Disassembler", "TabbedMnemonic"),
              ConfigBool("Disassembler", "ArgumentSpaces"),
              ConfigBool("Disassembler", "MemorySpaces"));
}
Esempio n. 13
0
void scfInit(BYTE delay) {
    BYTE i;
    
    //If delay = 0, return!
    if (delay == 0) return;

    //Clear Screen
    serPutRomString(AnsiEscClearScreen);

    /*
     * Wait a couple of seconds for user input.
	 * - If something is detected, start config.
	 * - If nothing detected, start main program.
     */
	serPutRomString(PressKeyForConfig);

	for (i = delay; i > 0; --i)	//Delay for 50mS x 60 = 3 sec
	{
		if ((i % 8) == 0) serPutByte('.');
		if (serIsGetReady())
		{
	        SetConfig();
			break;
		}
		DelayMs(50);
	}
	serPutByte('\r');
	serPutByte('\n');
}
Esempio n. 14
0
/**
  Process synchronous 'control' requests
*/
TInt DZeroCopyLoopbackChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2)
	{
	(void)a2;   // a2 not used in this example

	TInt r;

	switch (aFunction)
		{
		case RZeroCopyLoopbackDriver::EGetConfig:
			r = GetConfig((TDes8*)a1);
			break;

		case RZeroCopyLoopbackDriver::ESetConfig:
			r = SetConfig((const TDesC8*)a1);
			break;

		case RZeroCopyLoopbackDriver::ELoadPond:
			r = LoadPond((TPondTransferBuf*)a1);
			break;
		
		case RZeroCopyLoopbackDriver::EUnloadPond:
			r = UnloadPond();
			break;
		
		default:
			r = KErrNotSupported;
			break;
		}

	return r;
	}
Esempio n. 15
0
bool
FlarmDevice::SetBaudRate(unsigned baud_id, OperationEnvironment &env)
{
  NarrowString<32> buffer;
  buffer.Format("%u", baud_id);
  return SetConfig("BAUD", buffer, env);
}
Esempio n. 16
0
bool
FlarmDevice::SetRange(unsigned range)
{
  StaticString<32> buffer;
  buffer.Format(_T("%d"), range);
  return SetConfig("RANGE", buffer);
}
TInt DExampleChannel::DoControl(TInt aFunction,TAny* a1,TAny* /*a2*/)
{
    TInt r = KErrNone;
    switch (aFunction)
    {
    case RPagingExample::ESetRealtimeState:
        iDynamicDfcQ->SetRealtimeState(a1 ? ERealtimeStateOn : ERealtimeStateWarn);
        break;

    case RPagingExample::EGetConfig:
        r = Kern::ThreadRawWrite(iClient, a1, (TAny*)&iConfig, sizeof(TConfigData), iClient);
        break;

    case RPagingExample::ESetConfig:
    {
        TConfigData newConfig;
        r = Kern::ThreadRawRead(iClient, a1, &newConfig, sizeof(TConfigData));
        if (r == KErrNone)
            SetConfig(newConfig);
    }
    break;

    default:
        r = KErrNotSupported;
    }
    return r;
}
Esempio n. 18
0
bool OMXClock::SetReferenceClock(bool hasAudio, bool lock)
{
	if (lock)
		Lock();

	bool ret = true;
	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
	OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE refClock;
	OMX_INIT_STRUCTURE(refClock);

	if (hasAudio)
		refClock.eClock = OMX_TIME_RefClockAudio;
	else
		refClock.eClock = OMX_TIME_RefClockVideo;

	if (refClock.eClock != m_eClock)
	{
		omxErr = SetConfig(OMX_IndexConfigTimeActiveRefClock, &refClock);
		if (omxErr != OMX_ErrorNone)
		{
			ret = false;
		}
		m_eClock = refClock.eClock;
	}

	m_lastMediaTime = 0.0f;

	if (lock)
		Unlock();

	return ret;
}
Esempio n. 19
0
bool OMXClock::Step(int steps, bool lock)
{
	if (!GetComponent())
		return false;

	if (lock)
		Lock();

	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
	OMX_PARAM_U32TYPE param;
	OMX_INIT_STRUCTURE(param);

	param.nPortIndex = OMX_ALL;
	param.nU32 = steps;

	omxErr = SetConfig(OMX_IndexConfigSingleStep, &param);
	if (omxErr != OMX_ErrorNone)
	{
		if (lock)
			Unlock();

		return false;
	}

	m_lastMediaTime = 0.0f;
	if (lock)
		Unlock();

	return true;
}
Esempio n. 20
0
bool OMXClock::Start(bool lock)
{
	if (!GetComponent())
		return false;

	if (lock)
		Lock();

	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
	OMX_TIME_CONFIG_CLOCKSTATETYPE clock;
	OMX_INIT_STRUCTURE(clock);

	clock.eState = OMX_TIME_ClockStateRunning;

	omxErr = SetConfig(OMX_IndexConfigTimeClockState, &clock);
	if (omxErr != OMX_ErrorNone)
	{
		if (lock)
			Unlock();

		return false;
	}

	m_eState = clock.eState;

	m_lastMediaTime = 0.0f;

	if (lock)
		Unlock();

	return true;
}
Esempio n. 21
0
NPT_Result HttpConnector::start()
{
	if (m_started) {
		return NPT_ERROR_INVALID_STATE;
	}

	NPT_Result nr;

	Config cfg;
	cfg.m_ListenAddress     = m_ifAddr;
	cfg.m_ListenPort        = 0;
	cfg.m_IoTimeout         = NPT_HTTP_SERVER_DEFAULT_IO_TIMEOUT;
	cfg.m_ConnectionTimeout = NPT_HTTP_SERVER_DEFAULT_CONNECTION_TIMEOUT;
	nr = SetConfig(cfg);
	if (NPT_FAILED(nr)) {
		return nr;
	}

	m_abortFlag = false;
	nr = NPT_Thread::Start();
	if (NPT_FAILED(nr)) {
		return nr;
	}

	m_started = true;
	return NPT_SUCCESS;
}
int main(int argc, char **argv) {
    if (!ReadParameter(argc, argv)) {
        std::cout << "Bad Parameters.\n";
        return 1;
    }
    SetConfig();
    if (compress) {
        // Compress
        db_compress::Compressor compressor(outputFileName, schema, config);
        int iter_cnt = 0;
        while (1) {
            std::cout << "Iteration " << ++iter_cnt << " Starts\n";
            std::ifstream inFile(inputFileName);
            std::string str;
            int tuple_cnt = 0;
            while (std::getline(inFile,str)) {
                std::stringstream sstream(str);
                std::string item;
                db_compress::Tuple tuple(schema.attr_type.size());
                
                db_compress::IntegerAttrValue attr(++tuple_cnt);
                tuple.attr[0] = &attr; 

                size_t count = 0;
                std::vector< std::unique_ptr<ColorAttr> > vec;
                while (std::getline(sstream, item, ' ')) {
                    if (++ count > 1)
                        AppendAttr(std::stod(item), &tuple, count - 1);
                }
                // The first item is tuple id
                if (count != schema.attr_type.size()) {
                    std::cerr << "File Format Error!\n";
                }
                compressor.ReadTuple(tuple);
                if (!compressor.RequireFullPass() && 
                    tuple_cnt >= NonFullPassStopPoint) {
                    break;
                }
            }
            compressor.EndOfData();
            if (!compressor.RequireMoreIterations()) 
                break;
        }
    } else {
        // Decompress
        db_compress::Decompressor decompressor(inputFileName, schema);
        std::ofstream outFile(outputFileName);
        decompressor.Init();
        while (decompressor.HasNext()) {
            db_compress::Tuple tuple(33);
            decompressor.ReadNextTuple(&tuple);
            for (size_t i = 0; i < schema.attr_type.size(); ++i) {
                double attr = ExtractAttr(&tuple, i);
                outFile << attr << (i == schema.attr_type.size() - 1 ? '\n' : ' ');
            } 
        }
    }
    return 0;
}
Esempio n. 23
0
NMErr
OTIPEndpoint::Initialize(NMConfigRef inConfig)
{
		
	SetConfig((NMIPConfigPriv *) inConfig);

	return (kNMNoError);
}
Esempio n. 24
0
void GSdxApp::SetConfig(const char* entry, int value)
{
	char buff[32] = {0};

	sprintf(buff, "%d", value);

	SetConfig(entry, buff);
}
Esempio n. 25
0
CALSAAudioSource::CALSAAudioSource(CLiveConfig *pConfig) : CMediaSource() 
{
  SetConfig(pConfig);

  m_prevTimestamp = 0;
  m_timestampOverflowArray = NULL;
  m_timestampOverflowArrayIndex = 0;
  m_audioMaxBufferSize = 0;
}
void CGameConfig::Mouse (int button, int state, int x, int y) {
	if (state == 1) {
		TWidget* focussed = ClickGUI(x, y);

		if (focussed == textbuttons[0])
			State::manager.RequestEnterState (*State::manager.PreviousState());
		else if (focussed == textbuttons[1])
			SetConfig ();
	}
}
Esempio n. 27
0
bool
FlarmDevice::SetConfig(const char *setting, const TCHAR *value,
                       OperationEnvironment &env)
{
  WideToUTF8Converter narrow_value(value);
  if (!narrow_value.IsValid())
    return false;

  return SetConfig(setting, narrow_value, env);
}
Esempio n. 28
0
void GProfile::SetConfigBinary(const char *szSection, const char *szEntry, unsigned char *lValue, int nValueLength)
{
	// UUencode the binary
	BUFFER b;
	BufferInit(&b);
	uuencode(lValue, nValueLength, &b);
	GString strEncoded((char *)b.pBuf, b.cLen);
	BufferTerminate(&b);
	
	SetConfig(szSection, szEntry, strEncoded, 0 );
}
Esempio n. 29
0
// Set default configuration.
void
CeCosTestSerialFilter::CMD_DefaultConfig(CeCosSerial &pSer)
{
    static const ser_cfg_t default_ser_cfg = { 9600, 
                                               8, 
                                               CeCosSerial::ONE_STOP_BIT,
                                               false };

    TargetASCIIWrite(pSer, "OK");
    SetConfig(pSer, &default_ser_cfg, NULL);
}
Esempio n. 30
0
int GSdxApp::GetPrivateProfileInt(const char* lpAppName, const char* lpKeyName, int nDefault, const char* lpFileName)
{
	BuildConfigurationMap(lpFileName);

	std::string value = m_configuration_map[std::string(lpKeyName)];
	if (value.empty()) {
		// save the value for futur call
		SetConfig(lpKeyName, nDefault);
		return nDefault;
	} else
		return atoi(value.c_str());
}