Ejemplo n.º 1
0
std::string SDLInputState::getBindingString(int key, int bindings_list) {
	std::string none = msg->get("(none)");

	if (bindings_list == INPUT_BINDING_DEFAULT) {
		if (inpt->binding[key] < 0)
			return none;
		else if (inpt->binding[key] < 8)
			return mouse_button[inpt->binding[key] - 1];
		else
			return getKeyName(inpt->binding[key]);
	}
	else if (bindings_list == INPUT_BINDING_ALT) {
		if (inpt->binding_alt[key] < 0)
			return none;
		else if (inpt->binding[key] < 8)
			return mouse_button[inpt->binding_alt[key] - 1];
		else
			return getKeyName(inpt->binding_alt[key]);
	}
	else if (bindings_list == INPUT_BINDING_JOYSTICK) {
		if (inpt->binding_joy[key] < 0)
			return none;
		else
			return msg->get("Button %d", inpt->binding_joy[key]);
	}
	else {
		return none;
	}
}
Ejemplo n.º 2
0
std::string SDLInputState::getBindingString(int key, int bindings_list) {
	std::string none = msg->get("(none)");

	if (bindings_list == INPUT_BINDING_DEFAULT) {
		if (inpt->binding[key] == 0 || inpt->binding[key] == -1)
			return none;
		else if (inpt->binding[key] < -1) {
			int real_button = (inpt->binding[key] + MOUSE_BIND_OFFSET) * (-1);

			if (real_button > 0 && real_button <= MOUSE_BUTTON_NAME_COUNT)
				return mouse_button[real_button - 1];
			else
				return msg->get("Mouse %d", real_button);
		}
		else
			return getKeyName(inpt->binding[key]);
	}
	else if (bindings_list == INPUT_BINDING_ALT) {
		if (inpt->binding_alt[key] == 0 || inpt->binding_alt[key] == -1)
			return none;
		else if (inpt->binding_alt[key] < -1) {
			int real_button = (inpt->binding_alt[key] + MOUSE_BIND_OFFSET) * (-1);

			if (real_button > 0 && real_button <= MOUSE_BUTTON_NAME_COUNT)
				return mouse_button[real_button - 1];
			else
				return msg->get("Mouse %d", real_button);
		}
		else
			return getKeyName(inpt->binding_alt[key]);
	}
	else if (bindings_list == INPUT_BINDING_JOYSTICK) {
		if (inpt->binding_joy[key] == -1)
			return none;
		else if (inpt->binding_joy[key] < -1) {
			int axis = (inpt->binding_joy[key] + JOY_AXIS_OFFSET) * (-1);

			if (axis % 2 == 0)
				return msg->get("Axis %d -", axis/2);
			else
				return msg->get("Axis %d +", axis/2);
		}
		else
			return msg->get("Button %d", inpt->binding_joy[key]);
	}
	else {
		return none;
	}
}
void ProducerStateTable::set(string key, vector<FieldValueTuple> &values,
                 string op /*= SET_COMMAND*/, string prefix)
{
    // Assembly redis command args into a string vector
    vector<string> args;
    args.push_back("EVALSHA");
    args.push_back(m_shaSet);
    args.push_back(to_string(values.size() + 2));
    args.push_back(getChannelName());
    args.push_back(getKeySetName());

    args.insert(args.end(), values.size(), getKeyName(key));

    args.push_back("G");
    args.push_back(key);
    for (auto& iv: values)
    {
        args.push_back(fvField(iv));
        args.push_back(fvValue(iv));
    }

    // Transform data structure
    vector<const char *> args1;
    transform(args.begin(), args.end(), back_inserter(args1), [](const string &s) { return s.c_str(); } );

    // Invoke redis command
    RedisCommand command;
    command.formatArgv((int)args1.size(), &args1[0], NULL);
    m_pipe->push(command, REDIS_REPLY_NIL);
    if (!m_buffered)
    {
        m_pipe->flush();
    }
}
void ProducerStateTable::del(string key, string op /*= DEL_COMMAND*/, string prefix)
{
    // Assembly redis command args into a string vector
    vector<string> args;
    args.push_back("EVALSHA");
    args.push_back(m_shaDel);
    args.push_back("3");
    args.push_back(getChannelName());
    args.push_back(getKeySetName());
    args.push_back(getKeyName(key));
    args.push_back("G");
    args.push_back(key);
    args.push_back("''");

    // Transform data structure
    vector<const char *> args1;
    transform(args.begin(), args.end(), back_inserter(args1), [](const string &s) { return s.c_str(); } );

    // Invoke redis command
    RedisCommand command;
    command.formatArgv((int)args1.size(), &args1[0], NULL);
    m_pipe->push(command, REDIS_REPLY_NIL);
    if (!m_buffered)
    {
        m_pipe->flush();
    }
}
Ejemplo n.º 5
0
void ConfigureInput::updateButtonLabels() {
    QString non_keyboard(tr("[non-keyboard]"));

    auto KeyToText = [&non_keyboard](const Common::ParamPackage& param) {
        if (!param.Has("engine")) {
            return QString("[not set]");
        } else if (param.Get("engine", "") != "keyboard") {
            return non_keyboard;
        } else {
            return getKeyName(param.Get("code", 0));
        }
    };

    for (int button = 0; button < Settings::NativeButton::NumButtons; button++) {
        button_map[button]->setText(KeyToText(buttons_param[button]));
    }

    for (int analog_id = 0; analog_id < Settings::NativeAnalog::NumAnalogs; analog_id++) {
        if (analogs_param[analog_id].Get("engine", "") != "analog_from_button") {
            for (QPushButton* button : analog_map_buttons[analog_id]) {
                if (button)
                    button->setText(non_keyboard);
            }
        } else {
            for (int sub_button_id = 0; sub_button_id < ANALOG_SUB_BUTTONS_NUM; sub_button_id++) {
                Common::ParamPackage param(
                    analogs_param[analog_id].Get(analog_sub_buttons[sub_button_id], ""));
                if (analog_map_buttons[analog_id][sub_button_id])
                    analog_map_buttons[analog_id][sub_button_id]->setText(KeyToText(param));
            }
        }
        analog_map_stick[analog_id]->setText("Set Analog Stick");
    }
}
Ejemplo n.º 6
0
void
KeySignatureDialog::slotKeyNameChanged(int index)
{
    if (m_ignoreComboChanges)
        return ;

    if (m_explanatoryLabel)
        m_explanatoryLabel->hide();

    const QString s = m_keyCombo->itemData(index).toString();
    std::string name(getKeyName(s, m_key.isMinor()));

    try {
        m_key = Rosegarden::Key(name);
        setValid(true);

        int space = name.find(' ');
        if (space > 0)
            name = name.substr(0, space);
        m_keyCombo->setEditText(strtoqstr(name));

    } catch (Rosegarden::Key::BadKeyName s) {
        RG_WARNING << s.getMessage();
        setValid(false);
    }

    redrawKeyPixmap();
}
Ejemplo n.º 7
0
void DataSchema::dump(DataObject* obj)
{
	LOG(0, "-- object '%s' %08x\n", getKeyName().c_str(), obj);

	if (_base)
		LOG(0, "-- - base: '%s'\n", _base->getKeyName().c_str());

	OrderedProperties& props = getOrderedProperties();

	for (uint i=0; i < props.size(); ++i)
	{
		DataProperty* prop = props[i];
		
		DataValue value;
		String valueStr = "<error>";

		if (prop->getValue(obj, value))
			valueStr = value.dumpString();

		LOG(0, "-- - #%3.1f %-13s = %s: %s%s%s\n", 
			prop->getOrder(),
			prop->getName().c_str(), 
			valueStr.c_str(), 
			DataValue::typeToStr(prop->getType()), 
			prop->isReadOnly() ? " [ro]" : "",
			prop->isSave() ? " [save]" : ""
			);
	}
}
Ejemplo n.º 8
0
 string bottomDisplay::generateHeaderSelected(){
     string toReturn="\n";
     toReturn+="                      press desired button for ";
     toReturn+=getKeyName(contentMat[yNdx][xNdx].getBound());
     toReturn+="\n\n\n";
     toReturn+="                     press back to return selection\n\n\n";
     return toReturn;
 }
Ejemplo n.º 9
0
static const wchar_t* mh_buildLabel (const wchar_t* base, int flags, int key) {
if (flags<=0 && key<=0) return base;
int wstrl = wcslen(base);
const wchar_t* zzz = malloc(sizeof(wchar_t)* (wstrl+72));
const wchar_t* keyname = getKeyName(flags, key,1);
wsprintf(zzz, L"%ls%lc%ls", base, 8, keyname);
free(keyname);
return zzz;
}
Ejemplo n.º 10
0
PublicKey
InMemoryPibImpl::getKeyBits(const Name& identity, const name::Component& keyId) const
{
  auto it = m_keys.find(getKeyName(identity, keyId));
  if (it == m_keys.end())
    throw Pib::Error("No default certificate");

  return it->second;
}
Ejemplo n.º 11
0
void
InMemoryPibImpl::setDefaultCertificateOfKey(const Name& identity, const name::Component& keyId, const Name& certName)
{
  if (!hasCertificate(certName))
    throw Pib::Error("No cert");

  Name keyName = getKeyName(identity, keyId);
  m_defaultCert[keyName] = certName;
}
Ejemplo n.º 12
0
std::string InputDeviceAdapterMouse::getFeatureName(const InputDeviceFeature& feature) const
{
    std::string result;

    /* Calculate the feature's modifier mask: */
    int featureModifierMask=0x0;
    if(feature.isButton())
        featureModifierMask=feature.getIndex()/(numButtons+numButtonKeys);
    if(feature.isValuator())
        featureModifierMask=feature.getIndex();

    /* Create the feature's modifier prefix: */
    for(int i=0; i<numModifierKeys; ++i)
        if(featureModifierMask&(0x1<<i))
        {
            /* Append the modifier key's name to the prefix: */
            result.append(getKeyName(modifierKeyCodes[i]));
            result.push_back('+');
        }

    /* Append the feature's name: */
    if(feature.isButton())
    {
        int buttonIndex=feature.getIndex()%(numButtons+numButtonKeys);

        /* Check if the button is a mouse button or a button key: */
        if(buttonIndex<numButtons)
        {
            /* Append a mouse button name: */
            char buttonName[40];
            snprintf(buttonName,sizeof(buttonName),"Mouse%d",buttonIndex+1);
            result.append(buttonName);
        }
        else
        {
            /* Append a button key name: */
            result.append(getKeyName(buttonKeyCodes[buttonIndex-numButtons]));
        }
    }
    if(feature.isValuator())
        result.append("MouseWheel");

    return result;
}
Ejemplo n.º 13
0
void
InMemoryPibImpl::setDefaultKeyOfIdentity(const Name& identity, const name::Component& keyId)
{
  Name keyName = getKeyName(identity, keyId);

  if (!hasKey(identity, keyId))
    throw Pib::Error("No key");

  m_defaultKey[identity] = keyName;
}
Ejemplo n.º 14
0
std::set<Name>
InMemoryPibImpl::getCertificatesOfKey(const Name& identity, const name::Component& keyId) const
{
  Name keyName = getKeyName(identity, keyId);

  std::set<Name> certNames;
  for (const auto& it : m_certs) {
    if (it.second.getPublicKeyName() == keyName)
      certNames.insert(it.first);
  }
  return certNames;
}
Ejemplo n.º 15
0
static refreshPreview(HWND hwnd) 
{
	TCHAR warning[1024];
	ZeroMemory(warning, sizeof(warning));
	SetWindowText(hwnd, getKeyName(virtualKey | modifiers));
	if (currentTreeItem != NULL && currentTreeItem->keyBinding != NULL) {
		KeyBindingItem *item = findTempKeyBinding(currentTreeItem->keyBinding->actionGroupName, virtualKey | modifiers);
		if (item != NULL)
			mir_sntprintf(warning, 1024, TranslateT("Shortcut already assigned to \"%s\" action.\nIf you click \"Add\" the shortcut will be reassigned."), item->actionName);
	}
	SetDlgItemText(GetParent(hwnd), IDC_MESSAGE, warning);
	EnableWindow(GetDlgItem(GetParent(hwnd), IDC_ADD), virtualKey != 0);
}
Ejemplo n.º 16
0
void ConfigureInput::setKey() {
    const QString key_value = getKeyName(key_pressed);
    if (key_pressed == Qt::Key_Escape)
        changing_button->setText(previous_mapping);
    else
        changing_button->setText(key_value);
    removeDuplicates(key_value);
    key_pressed = Qt::Key_unknown;
    releaseKeyboard();
    releaseMouse();
    changing_button = nullptr;
    previous_mapping = nullptr;
}
Ejemplo n.º 17
0
template <class WriteSet> SQLiteObjectStorage::Error SQLiteObjectStorage::applyWriteSet(const SQLiteDBPtr& db, const WriteSet& ws, int retries) {
    int num_writes=ws.writes_size();
    for (int ws_it=0;ws_it<num_writes;++ws_it) {

        String object_hex = getTableName(ws.writes(ws_it));
        String key_name = getKeyName(ws.writes(ws_it));

        int rc;
        char* remain;

        // Insert or replace the value

        String value_insert = "INSERT OR REPLACE INTO ";
        if (!ws.writes(ws_it).has_data()) {
             value_insert = "DELETE FROM ";
        }
        value_insert += "\"" TABLE_NAME "\"";
        if (!ws.writes(ws_it).has_data()) {
            value_insert+= " WHERE object = x\'" + object_hex + "\' AND key = ?";
        }else {
        //if (ws.writes(ws_it).has_data()) {
            value_insert += " (object, key, value) VALUES(x\'" + object_hex + "\', ?, ?)";
            //}
        }
        sqlite3_stmt* value_insert_stmt;

        rc = sqlite3_prepare_v2(db->db(), value_insert.c_str(), -1, &value_insert_stmt, (const char**)&remain);
        SQLite::check_sql_error(db->db(), rc, NULL, "Error preparing value insert statement");

        rc = sqlite3_bind_text(value_insert_stmt, 1, key_name.data(), (int)key_name.size(), SQLITE_TRANSIENT);
        SQLite::check_sql_error(db->db(), rc, NULL, "Error binding key name to value insert statement");
        if (rc==SQLITE_OK) {
            if (ws.writes(ws_it).has_data()) {
                rc = sqlite3_bind_blob(value_insert_stmt, 2, ws.writes(ws_it).data().data(), (int)ws.writes(ws_it).data().size(), SQLITE_TRANSIENT);
                SQLite::check_sql_error(db->db(), rc, NULL, "Error binding value to value insert statement");
            }
        }

        int step_rc = sqlite3_step(value_insert_stmt);
        if (step_rc != SQLITE_OK && step_rc != SQLITE_DONE)
            sqlite3_reset(value_insert_stmt); // allow this to be cleaned up

        rc = sqlite3_finalize(value_insert_stmt);
        SQLite::check_sql_error(db->db(), rc, NULL, "Error finalizing value insert statement");
        if (step_rc == SQLITE_BUSY || step_rc == SQLITE_LOCKED)
            return DatabaseLocked;

    }

    return None;
}
Ejemplo n.º 18
0
HelpScene::HelpScene()
{
    BitMapFont* font = new BitMapFont("Resources\\Fonts\\font.png", 
									"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,\"\"|?!_-:;&(%'/ `abcdefghi",
									"fontByLinh",
									6,
									11,
									8,
									RectI(0, 0, 8, 8));

    Graphics::getInstance()->setFont(font);

    std::string mapName = "help";
    pMap = new Map(mapName);
    lifeTexture = new Texture("Resources\\Sprites\\player\\life00.png", "life00.png");
    int viewPortSize = pMap->getMapRect().width < pMap->getMapRect().height ? pMap->getMapRect().width : pMap->getMapRect().height;
    viewPort = new ViewPort(RectI(SCWIDTH / 2 - viewPortSize / 2, SCHEIGHT / 2 - viewPortSize / 2, viewPortSize, viewPortSize));
    cam = new Camera(viewPort, pMap->getResX(), pMap->getResY(), pMap->getMapRect(), pMap->getCameraTranslatePoint());
    pPlayer = new PlayerSprite(1, pMap->getResX(), pMap->getResY(), cam->getMoveDir());
    //label("Press B to back", 15, SCWIDTH / 2, SCHEIGHT / 2, NULL, true);

    labelConversation.color = D3DCOLOR_ARGB(255, 255, 255, 0);
    labelConversation.text = "PRESS " + getKeyName(UIComponents::getInstance()->getDefaultKey(UIComponents::RIGHT, 1)) + " TO MOVE FORWARD";
    labelConversation.size = 5;
    labelConversation.space = false;
    labelConversation.xPos = 20;
    labelConversation.yPos = 32;

    label.color = D3DCOLOR_ARGB(255, 255, 0, 0);
    label.text = "PRESS KEY ESC TO BACK";
    label.size = 10;
    label.space = false;
    label.xPos = SCWIDTH / 2 - 21 * label.size / 2;
    label.yPos = SCHEIGHT - 20;

    isPause = false;
    isHelpDown = false;
    isHelpFire = false;
    isHelpLeft = false;
    isHelpRight = false;
    isHelpUp = false;
    isHelpJump = false;
    isMoreInfo = false;
    isBulletHelp = false;
    isPlayerRead = false;

    conversationFrame = 90;
    frameChangeConversation = conversationFrame;
    conversationNum = 0;
}
Ejemplo n.º 19
0
IdentityCertificate
InMemoryPibImpl::getDefaultCertificateOfKey(const Name& identity, const name::Component& keyId) const
{
  Name keyName = getKeyName(identity, keyId);

  auto it = m_defaultCert.find(keyName);
  if (it == m_defaultCert.end())
    throw Pib::Error("No default certificate");

  auto certIt = m_certs.find(it->second);
  if (certIt == m_certs.end())
    throw Pib::Error("No default certificate");
  else
    return certIt->second;
}
Ejemplo n.º 20
0
void
App::printAllPreferences()const
{
    QSettings settings;
    QStringList keys = settings.allKeys();
    for (QStringList::const_iterator it = keys.begin(); it != keys.end(); ++it) {
        QString qkeystr = *it;
        QString qvalstr = settings.value(qkeystr).toString();

        if (! qvalstr.isEmpty()) {
            std::string key = getKeyName(convert(qkeystr));
            std::cout << key << "=" << qvalstr << std::endl;
        }
    }
}
Ejemplo n.º 21
0
void
KeySignatureDialog::slotMajorMinorChanged(const QString &s)
{
    if (m_ignoreComboChanges)
        return ;

    QString text = m_keyCombo->itemData(m_keyCombo->currentIndex()).toString();
    std::string name(getKeyName(text, s == tr("Minor")));

    try {
        m_key = Rosegarden::Key(name);
        setValid(true);
    } catch (Rosegarden::Key::BadKeyName s) {
        RG_WARNING << s.getMessage();
        setValid(false);
    }

    regenerateKeyCombo();
    redrawKeyPixmap();
}
Ejemplo n.º 22
0
void DataSchema::dump()
{
	LOG(0, "-- schema '%s'\n", getKeyName().c_str());

	if (_base)
		LOG(0, "-- - base: '%s'\n", _base->getKeyName().c_str());

	OrderedProperties& props = getOrderedProperties();

	for (uint i=0; i < props.size(); ++i)
	{
		DataProperty* prop = props[i];

		LOG(0, "-- - #%3.1f %-13s : %s%s%s\n", 
			prop->getOrder(),
			prop->getName().c_str(), 
			DataValue::typeToStr(prop->getType()), 
			prop->isReadOnly() ? " [ro]" : "",
			prop->isSave() ? " [save]" : ""
			);
	}
}
Ejemplo n.º 23
0
static void refreshListBox(HWND hwnd) {
	int count = 0;
	BOOL nonDefault = FALSE;
	BOOL canUndo = FALSE;
	SendDlgItemMessage(hwnd, IDC_LIST, LB_RESETCONTENT, 0, 0);
	if (currentTreeItem->keyBinding != NULL) {
		int i;
		for (i=0; i<5; i++) {
			if (currentTreeItem->keyBinding->tempKey[i] != currentTreeItem->keyBinding->defaultKey[i]) nonDefault = TRUE;
			if (currentTreeItem->keyBinding->tempKey[i] != currentTreeItem->keyBinding->key[i]) canUndo = TRUE;
			if (currentTreeItem->keyBinding->tempKey[i] != 0) {
				SendDlgItemMessage(hwnd, IDC_LIST, LB_ADDSTRING, 0, (LPARAM)getKeyName(currentTreeItem->keyBinding->tempKey[i]));
				count++;
			}
		}
	}
	EnableWindow(GetDlgItem(hwnd, IDC_PREVIEW), currentTreeItem->keyBinding != NULL && count < 5);
	SetDlgItemText(hwnd, IDC_PREVIEW, _T(""));
	SetDlgItemText(hwnd, IDC_MESSAGE, _T(""));
	EnableWindow(GetDlgItem(hwnd, IDC_ADD), FALSE);
	EnableWindow(GetDlgItem(hwnd, IDC_DELETE), FALSE);
	EnableWindow(GetDlgItem(hwnd, IDC_BTN_RESET), nonDefault);
	EnableWindow(GetDlgItem(hwnd, IDC_BTN_UNDO), canUndo);
}
Ejemplo n.º 24
0
void
InMemoryPibImpl::addKey(const Name& identity, const name::Component& keyId, const PublicKey& publicKey)
{
  m_keys[getKeyName(identity, keyId)] = publicKey;
}
Ejemplo n.º 25
0
bool
InMemoryPibImpl::hasKey(const Name& identity, const name::Component& keyId) const
{
  return (m_keys.count(getKeyName(identity, keyId)) > 0);
}
Ejemplo n.º 26
0
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineKeyName(
	JNIEnv * env, jobject obj, jstring subkey, jint index)
{
	return getKeyName(env, HKEY_LOCAL_MACHINE, subkey, index);
}
Ejemplo n.º 27
0
void
InMemoryPibImpl::removeKey(const Name& identity, const name::Component& keyId)
{
  m_keys.erase(getKeyName(identity, keyId));
}
Ejemplo n.º 28
0
Archivo: config.c Proyecto: VCCE/VCC
LRESULT CALLBACK JoyStickConfig(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	static int LeftJoyStick[6]={IDC_LEFT_LEFT,IDC_LEFT_RIGHT,IDC_LEFT_UP,IDC_LEFT_DOWN,IDC_LEFT_FIRE1,IDC_LEFT_FIRE2};
	static int RightJoyStick[6]={IDC_RIGHT_LEFT,IDC_RIGHT_RIGHT,IDC_RIGHT_UP,IDC_RIGHT_DOWN,IDC_RIGHT_FIRE1,IDC_RIGHT_FIRE2};
	static int LeftRadios[4]={IDC_LEFT_KEYBOARD,IDC_LEFT_USEMOUSE,IDC_LEFTAUDIO,IDC_LEFTJOYSTICK};
	static int RightRadios[4]={IDC_RIGHT_KEYBOARD,IDC_RIGHT_USEMOUSE,IDC_RIGHTAUDIO,IDC_RIGHTJOYSTICK};
	switch (message)
	{
		case WM_INITDIALOG:
			JoystickIcons[0]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_KEYBOARD);
			JoystickIcons[1]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_MOUSE);
			JoystickIcons[2]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_AUDIO);
			JoystickIcons[3]=LoadIcon(EmuState.WindowInstance,(LPCTSTR)IDI_JOYSTICK);
			for (temp = 0; temp < 68; temp++)
			{
				for (temp2 = 0; temp2 < 6; temp2++)
				{
					SendDlgItemMessage(hDlg, LeftJoyStick[temp2], CB_ADDSTRING, (WPARAM)0, (LPARAM)getKeyName(temp));
					SendDlgItemMessage(hDlg, RightJoyStick[temp2], CB_ADDSTRING, (WPARAM)0, (LPARAM)getKeyName(temp));
				}
			}

			for (temp = 0; temp < 6; temp++)
			{
				EnableWindow(GetDlgItem(hDlg, LeftJoyStick[temp]), (Left.UseMouse == 0));
			}
			for (temp = 0; temp < 6; temp++)
			{
				EnableWindow(GetDlgItem(hDlg, RightJoyStick[temp]), (Right.UseMouse == 0));
			}

			for (temp=0;temp<=2;temp++)
			{
				SendDlgItemMessage(hDlg, LeftJoystickEmulation[temp], BM_SETCHECK, (temp == Left.HiRes), 0);
				SendDlgItemMessage(hDlg, RightJoystickEmulation[temp], BM_SETCHECK, (temp == Right.HiRes), 0);
			}

			EnableWindow( GetDlgItem(hDlg,IDC_LEFTAUDIODEVICE),(Left.UseMouse==2));
			EnableWindow( GetDlgItem(hDlg,IDC_RIGHTAUDIODEVICE),(Right.UseMouse==2));
			EnableWindow( GetDlgItem(hDlg,IDC_LEFTJOYSTICKDEVICE),(Left.UseMouse==3));
			EnableWindow( GetDlgItem(hDlg,IDC_RIGHTJOYSTICKDEVICE),(Right.UseMouse==3));

			EnableWindow( GetDlgItem(hDlg,IDC_LEFTJOYSTICK),(NumberofJoysticks>0));		//Grey the Joystick Radios if
			EnableWindow( GetDlgItem(hDlg,IDC_RIGHTJOYSTICK),(NumberofJoysticks>0));	//No Joysticks are present
			//populate joystick combo boxs
			for(temp=0;temp<NumberofJoysticks;temp++)
			{
				SendDlgItemMessage(hDlg,IDC_RIGHTJOYSTICKDEVICE,CB_ADDSTRING,(WPARAM)0,(LPARAM)StickName[temp]);
				SendDlgItemMessage(hDlg,IDC_LEFTJOYSTICKDEVICE,CB_ADDSTRING,(WPARAM)0,(LPARAM)StickName[temp]);
			}
			SendDlgItemMessage(hDlg,IDC_RIGHTJOYSTICKDEVICE,CB_SETCURSEL,(WPARAM)Right.DiDevice,(LPARAM)0);
			SendDlgItemMessage(hDlg,IDC_LEFTJOYSTICKDEVICE,CB_SETCURSEL,(WPARAM)Left.DiDevice,(LPARAM)0);

			SendDlgItemMessage(hDlg,LeftJoyStick[0],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Left),(LPARAM)0);
			SendDlgItemMessage(hDlg,LeftJoyStick[1],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Right),(LPARAM)0);	
			SendDlgItemMessage(hDlg,LeftJoyStick[2],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Up),(LPARAM)0);
			SendDlgItemMessage(hDlg,LeftJoyStick[3],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Down),(LPARAM)0);	
			SendDlgItemMessage(hDlg,LeftJoyStick[4],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Fire1),(LPARAM)0);	
			SendDlgItemMessage(hDlg,LeftJoyStick[5],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Left.Fire2),(LPARAM)0);	
			SendDlgItemMessage(hDlg,RightJoyStick[0],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Left),(LPARAM)0);
			SendDlgItemMessage(hDlg,RightJoyStick[1],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Right),(LPARAM)0);
			SendDlgItemMessage(hDlg,RightJoyStick[2],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Up),(LPARAM)0);	
			SendDlgItemMessage(hDlg,RightJoyStick[3],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Down),(LPARAM)0);
			SendDlgItemMessage(hDlg,RightJoyStick[4],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Fire1),(LPARAM)0);
			SendDlgItemMessage(hDlg,RightJoyStick[5],CB_SETCURSEL,(WPARAM)TranslateScan2Disp(Right.Fire2),(LPARAM)0);

			for (temp = 0; temp <= 3; temp++)
			{
				SendDlgItemMessage(hDlg, LeftRadios[temp], BM_SETCHECK, temp == Left.UseMouse, 0);
			}
			for (temp = 0; temp <= 3; temp++)
			{
				SendDlgItemMessage(hDlg, RightRadios[temp], BM_SETCHECK, temp == Right.UseMouse, 0);
			}
			TempLeft = Left;
			TempRight=Right;
			SendDlgItemMessage(hDlg,IDC_LEFTICON,STM_SETIMAGE ,(WPARAM)IMAGE_ICON,(LPARAM)JoystickIcons[Left.UseMouse]);
			SendDlgItemMessage(hDlg,IDC_RIGHTICON,STM_SETIMAGE ,(WPARAM)IMAGE_ICON,(LPARAM)JoystickIcons[Right.UseMouse]);
		break;

		case WM_COMMAND:
			for (temp = 0; temp <= 3; temp++)
			{
				if (LOWORD(wParam) == LeftRadios[temp])
				{
					for (temp2 = 0; temp2 <= 3; temp2++)
						SendDlgItemMessage(hDlg, LeftRadios[temp2], BM_SETCHECK, 0, 0);
					SendDlgItemMessage(hDlg, LeftRadios[temp], BM_SETCHECK, 1, 0);
					TempLeft.UseMouse = temp;
				}
			}

			for (temp = 0; temp <= 3; temp++)
			{
				if (LOWORD(wParam) == RightRadios[temp])
				{
					for (temp2 = 0; temp2 <= 3; temp2++)
						SendDlgItemMessage(hDlg, RightRadios[temp2], BM_SETCHECK, 0, 0);
					SendDlgItemMessage(hDlg, RightRadios[temp], BM_SETCHECK, 1, 0);
					TempRight.UseMouse = temp;
				}
			}

			for (temp = 0; temp <= 2; temp++)
			{
				if (LOWORD(wParam) == LeftJoystickEmulation[temp])
				{
					for (temp2 = 0; temp2 <= 2; temp2++)
						SendDlgItemMessage(hDlg, LeftJoystickEmulation[temp2], BM_SETCHECK, 0, 0);
					SendDlgItemMessage(hDlg, LeftJoystickEmulation[temp], BM_SETCHECK, 1, 0);
					TempLeft.HiRes = temp;
				}
			}

			for (temp = 0; temp <= 2; temp++)
			{
				if (LOWORD(wParam) == RightJoystickEmulation[temp])
				{
					for (temp2 = 0; temp2 <= 2; temp2++)
						SendDlgItemMessage(hDlg, RightJoystickEmulation[temp2], BM_SETCHECK, 0, 0);
					SendDlgItemMessage(hDlg, RightJoystickEmulation[temp], BM_SETCHECK, 1, 0);
					TempRight.HiRes = temp;
				}
			}

			for (temp = 0; temp < 6; temp++)
			{
				EnableWindow(GetDlgItem(hDlg, LeftJoyStick[temp]), (TempLeft.UseMouse == 0));
			}

			for (temp = 0; temp < 6; temp++)
			{
				EnableWindow(GetDlgItem(hDlg, RightJoyStick[temp]), (TempRight.UseMouse == 0));
			}

			EnableWindow( GetDlgItem(hDlg,IDC_LEFTAUDIODEVICE),(TempLeft.UseMouse==2));
			EnableWindow( GetDlgItem(hDlg,IDC_RIGHTAUDIODEVICE),(TempRight.UseMouse==2));
			EnableWindow( GetDlgItem(hDlg,IDC_LEFTJOYSTICKDEVICE),(TempLeft.UseMouse==3));
			EnableWindow( GetDlgItem(hDlg,IDC_RIGHTJOYSTICKDEVICE),(TempRight.UseMouse==3));

			TempLeft.Left=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[0],CB_GETCURSEL,0,0));
			TempLeft.Right=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[1],CB_GETCURSEL,0,0));
			TempLeft.Up=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[2],CB_GETCURSEL,0,0));
			TempLeft.Down=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[3],CB_GETCURSEL,0,0));
			TempLeft.Fire1=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[4],CB_GETCURSEL,0,0));
			TempLeft.Fire2=TranslateDisp2Scan(SendDlgItemMessage(hDlg,LeftJoyStick[5],CB_GETCURSEL,0,0));

			TempRight.Left=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[0],CB_GETCURSEL,0,0));
			TempRight.Right=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[1],CB_GETCURSEL,0,0));
			TempRight.Up=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[2],CB_GETCURSEL,0,0));
			TempRight.Down=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[3],CB_GETCURSEL,0,0));
			TempRight.Fire1=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[4],CB_GETCURSEL,0,0));
			TempRight.Fire2=TranslateDisp2Scan(SendDlgItemMessage(hDlg,RightJoyStick[5],CB_GETCURSEL,0,0));
			
			TempRight.DiDevice=(unsigned char)SendDlgItemMessage(hDlg,IDC_RIGHTJOYSTICKDEVICE,CB_GETCURSEL,0,0);
			TempLeft.DiDevice=(unsigned char)SendDlgItemMessage(hDlg,IDC_LEFTJOYSTICKDEVICE,CB_GETCURSEL,0,0);	//Fix Me;

			SendDlgItemMessage(hDlg,IDC_LEFTICON,STM_SETIMAGE ,(WPARAM)IMAGE_ICON,(LPARAM)JoystickIcons[TempLeft.UseMouse]);
			SendDlgItemMessage(hDlg,IDC_RIGHTICON,STM_SETIMAGE ,(WPARAM)IMAGE_ICON,(LPARAM)JoystickIcons[TempRight.UseMouse]);
		break;
	} //END switch message
	return(0);
}
Ejemplo n.º 29
0
JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserKeyName(
	JNIEnv * env, jobject obj, jstring subkey, jint index)
{
	return getKeyName(env, HKEY_CURRENT_USER, subkey, index);
}
Ejemplo n.º 30
0
void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, unsigned long long Timeout, bool bAllowRepeatLR)
{
	static unsigned long long last_keypress = 0ULL;
	unsigned long long getKeyBegin;

	//static __u16 rc_last_key =  KEY_MAX;
	static __u16 rc_last_repeat_key =  KEY_MAX;

	struct timeval tv, tvselect;
	unsigned long long InitialTimeout = Timeout;
	long long targetTimeout;

	int timer_id;
	fd_set rfds;
	t_input_event ev;

	*data = 0;

	// wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird!
	gettimeofday( &tv, NULL );
	getKeyBegin = (unsigned long long) tv.tv_usec + (unsigned long long)((unsigned long long) tv.tv_sec * (unsigned long long) 1000000);

	while(1) {
		timer_id = 0;
		if ( timers.size()> 0 )
		{
			gettimeofday( &tv, NULL );
			unsigned long long t_n= (unsigned long long) tv.tv_usec + (unsigned long long)((unsigned long long) tv.tv_sec * (unsigned long long) 1000000);
			if ( timers[0].times_out< t_n )
			{
				timer_id = checkTimers();
				*msg = NeutrinoMessages::EVT_TIMER;
				*data = timer_id;
				return;
			}
			else
			{
				targetTimeout = timers[0].times_out - t_n;
				if ( (unsigned long long) targetTimeout> Timeout)
					targetTimeout= Timeout;
				else
					timer_id = timers[0].id;
			}
		}
		else
			targetTimeout= Timeout;

		tvselect.tv_sec = targetTimeout/1000000;
		tvselect.tv_usec = targetTimeout%1000000;

		FD_ZERO(&rfds);
		for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++)
		{
			if (fd_rc[i] != -1)
				FD_SET(fd_rc[i], &rfds);
		}
#ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL
		if (true)
#else
			if (fd_keyb> 0)
#endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */
				FD_SET(fd_keyb, &rfds);

		FD_SET(fd_event, &rfds);
		FD_SET(fd_pipe_high_priority[0], &rfds);
		FD_SET(fd_pipe_low_priority[0], &rfds);

		int status =  select(fd_max+1, &rfds, NULL, NULL, &tvselect);

		if ( status == -1 )
		{
			perror("[neutrino - getMsg_us]: select returned ");
			// in case of an error return timeout...?!
			*msg = RC_timeout;
			*data = 0;
			return;
		}
		else if ( status == 0 ) // Timeout!
		{
			if ( timer_id != 0 )
			{
				timer_id = checkTimers();
				if ( timer_id != 0 )
				{
					*msg = NeutrinoMessages::EVT_TIMER;
					*data = timer_id;
					return;
				}
				else
					continue;
			}
			else
			{
				*msg = RC_timeout;
				*data = 0;
				return;
			}
		}

		if(FD_ISSET(fd_pipe_high_priority[0], &rfds))
		{
			struct event buf;

			read(fd_pipe_high_priority[0], &buf, sizeof(buf));

			*msg  = buf.msg;
			*data = buf.data;

			// printf("got event from high-pri pipe %x %x\n", *msg, *data );

			return;
		}


#ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL
		if (FD_ISSET(fd_keyb, &rfds))
		{
			int trkey;
			char key = 0;
			read(fd_keyb, &key, sizeof(key));

			switch(key)
			{
				case 27: // <- Esc
					trkey = KEY_HOME;
					break;
				case 10: // <- Return
				case 'o':
					trkey = KEY_OK;
					break;
				case 'p':
					trkey = KEY_POWER;
					break;
				case 's':
					trkey = KEY_SETUP;
					break;
				case 'h':
					trkey = KEY_HELP;
					break;
				case 'i':
					trkey = KEY_UP;
					break;
				case 'm':
					trkey = KEY_DOWN;
					break;
				case 'j':
					trkey = KEY_LEFT;
					break;
				case 'k':
					trkey = KEY_RIGHT;
					break;
				case 'r':
					trkey = KEY_RED;
					break;
				case 'g':
					trkey = KEY_GREEN;
					break;
				case 'y':
					trkey = KEY_YELLOW;
					break;
				case 'b':
					trkey = KEY_BLUE;
					break;
				case '0':
					trkey = RC_0;
					break;
				case '1':
					trkey = RC_1;
					break;
				case '2':
					trkey = RC_2;
					break;
				case '3':
					trkey = RC_3;
					break;
				case '4':
					trkey = RC_4;
					break;
				case '5':
					trkey = RC_5;
					break;
				case '6':
					trkey = RC_6;
					break;
				case '7':
					trkey = RC_7;
					break;
				case '8':
					trkey = RC_8;
					break;
				case '9':
					trkey = RC_9;
					break;
				case '+':
					trkey = RC_plus;
					break;
				case '-':
					trkey = RC_minus;
					break;
				case 'a':
					trkey = KEY_A;
					break;
				case 'u':
					trkey = KEY_U;
					break;
				case '/':
					trkey = KEY_SLASH;
					break;
				case '\\':
					trkey = KEY_BACKSLASH;
					break;
				default:
					trkey = RC_nokey;
			}
			if (trkey != RC_nokey)
			{
				*msg = trkey;
				*data = 0; /* <- button pressed */
				return;
			}
		}
#else
		/*
		   if(FD_ISSET(fd_keyb, &rfds))
		   {
		   char key = 0;
		   read(fd_keyb, &key, sizeof(key));
		   printf("keyboard: %d\n", rc_key);
		   }
		   */
#endif /* KEYBOARD_INSTEAD_OF_REMOTE_CONTROL */

		if(FD_ISSET(fd_event, &rfds)) {
			//printf("[neutrino] event - accept!\n");
			socklen_t          clilen;
			struct sockaddr_in cliaddr;
			clilen = sizeof(cliaddr);
			int fd_eventclient = accept(fd_event, (struct sockaddr *) &cliaddr, &clilen);

			*msg = RC_nokey;
			//printf("[neutrino] network event - read!\n");
			CEventServer::eventHead emsg;
			int read_bytes= recv(fd_eventclient, &emsg, sizeof(emsg), MSG_WAITALL);
			//printf("[neutrino] event read %d bytes - following %d bytes\n", read_bytes, emsg.dataSize );
			if ( read_bytes == sizeof(emsg) ) {
				bool dont_delete_p = false;

				unsigned char* p;
				p= new unsigned char[ emsg.dataSize + 1 ];
				if ( p!=NULL )
				{
					read_bytes= recv(fd_eventclient, p, emsg.dataSize, MSG_WAITALL);
					//printf("[neutrino] eventbody read %d bytes - initiator %x\n", read_bytes, emsg.initiatorID );

					if ( emsg.initiatorID == CEventServer::INITID_CONTROLD )
					{
						switch(emsg.eventID)
						{
							case CControldClient::EVT_VOLUMECHANGED :
								*msg = NeutrinoMessages::EVT_VOLCHANGED;
								*data = 0;
								break;
							case CControldClient::EVT_MUTECHANGED :
								*msg = NeutrinoMessages::EVT_MUTECHANGED;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CControldClient::EVT_VCRCHANGED :
								*msg = NeutrinoMessages::EVT_VCRCHANGED;
								*data = *(int*) p;
								break;
							case CControldClient::EVT_MODECHANGED :
								*msg = NeutrinoMessages::EVT_MODECHANGED;
								*data = *(int*) p;
								break;
							default:
								printf("[neutrino] event INITID_CONTROLD - unknown eventID 0x%x\n",  emsg.eventID );
						}
					}
					else if ( emsg.initiatorID == CEventServer::INITID_HTTPD )
					{
						switch(emsg.eventID)
						{
							case NeutrinoMessages::SHUTDOWN :
								*msg = NeutrinoMessages::SHUTDOWN;
								*data = 0;
								break;
							case NeutrinoMessages::EVT_POPUP :
								*msg = NeutrinoMessages::EVT_POPUP;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case NeutrinoMessages::EVT_EXTMSG :
								*msg = NeutrinoMessages::EVT_EXTMSG;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case NeutrinoMessages::CHANGEMODE :	// Change
								*msg = NeutrinoMessages::CHANGEMODE;
								*data = *(unsigned*) p;
								break;
							case NeutrinoMessages::STANDBY_TOGGLE :
								*msg = NeutrinoMessages::STANDBY_TOGGLE;
								*data = 0;
								break;
							case NeutrinoMessages::STANDBY_ON :
								*msg = NeutrinoMessages::STANDBY_ON;
								*data = 0;
								break;
							case NeutrinoMessages::STANDBY_OFF :
								*msg = NeutrinoMessages::STANDBY_OFF;
								*data = 0;
								break;
							case NeutrinoMessages::EVT_START_PLUGIN :
								*msg = NeutrinoMessages::EVT_START_PLUGIN;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case NeutrinoMessages::LOCK_RC :
								*msg = NeutrinoMessages::LOCK_RC;
								*data = 0;
								break;
							case NeutrinoMessages::UNLOCK_RC :
								*msg = NeutrinoMessages::UNLOCK_RC;
								*data = 0;
								break;
							default:
								printf("[neutrino] event INITID_HTTPD - unknown eventID 0x%x\n",  emsg.eventID );
						}
					}
					else if ( emsg.initiatorID == CEventServer::INITID_SECTIONSD )
					{
						//printf("[neutrino] event - from SECTIONSD %x %x\n", emsg.eventID, *(unsigned*) p);
						switch(emsg.eventID)
						{
							case CSectionsdClient::EVT_TIMESET:
								{
									struct timeval tv;
									gettimeofday( &tv, NULL );
									long long timeOld = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000);

									//printf("[neutrino] event TIMESET from SECTIONSD %x %x\n", emsg.eventID, *(unsigned*) p);
									//g_Sectionsd->registerEvent(CSectionsdClient::EVT_TIMESET, 222, NEUTRINO_UDS_NAME);
									stime((time_t*) p);

									gettimeofday( &tv, NULL );
									long long timeNew = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000);

									delete[] p;//new [] delete []
									p= new unsigned char[ sizeof(long long) ];
									*(long long*) p = timeNew - timeOld;

									if ((long long)last_keypress > *(long long*)p)
										last_keypress += *(long long *)p;

									// Timer anpassen
									for(std::vector<timer>::iterator e = timers.begin(); e != timers.end(); ++e)
										if (e->correct_time)
											e->times_out+= *(long long*) p;

									*msg          = NeutrinoMessages::EVT_TIMESET;
									*data         = (neutrino_msg_data_t) p;
									dont_delete_p = true;
								}
								break;
							case CSectionsdClient::EVT_GOT_CN_EPG:
printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n");
								*msg          = NeutrinoMessages::EVT_CURRENTNEXT_EPG;
								*data         = (neutrino_msg_data_t) p;
								dont_delete_p = true;
								break;
							case CSectionsdClient::EVT_SERVICES_UPDATE:
								*msg          = NeutrinoMessages::EVT_SERVICES_UPD;
								*data         = 0;
								break;
							case CSectionsdClient::EVT_BOUQUETS_UPDATE:
								break;
							case CSectionsdClient::EVT_WRITE_SI_FINISHED:
								*msg          = NeutrinoMessages::EVT_SI_FINISHED;
								*data         = 0;
								break;
							default:
								printf("[neutrino] event INITID_SECTIONSD - unknown eventID 0x%x\n",  emsg.eventID );
						}
					}
					else if ( emsg.initiatorID == CEventServer::INITID_ZAPIT )
					{
						//printf("[neutrino] event - from ZAPIT %x %x\n", emsg.eventID, *(unsigned*) p);
						switch(emsg.eventID)
						{
							case CZapitClient::EVT_RECORDMODE_ACTIVATED:
								*msg  = NeutrinoMessages::EVT_RECORDMODE;
								*data = true;
								break;
							case CZapitClient::EVT_RECORDMODE_DEACTIVATED:
								*msg  = NeutrinoMessages::EVT_RECORDMODE;
								*data = false;
								break;
							case CZapitClient::EVT_ZAP_COMPLETE:
								*msg = NeutrinoMessages::EVT_ZAP_COMPLETE;
								break;
							case CZapitClient::EVT_ZAP_FAILED:
								*msg = NeutrinoMessages::EVT_ZAP_FAILED;
								break;
							case CZapitClient::EVT_ZAP_SUB_FAILED:
								*msg = NeutrinoMessages::EVT_ZAP_SUB_FAILED;
								break;
							case CZapitClient::EVT_ZAP_COMPLETE_IS_NVOD:
								*msg = NeutrinoMessages::EVT_ZAP_ISNVOD;
								break;
							case CZapitClient::EVT_ZAP_SUB_COMPLETE:
								*msg = NeutrinoMessages::EVT_ZAP_SUB_COMPLETE;
								break;
							case CZapitClient::EVT_SCAN_COMPLETE:
								*msg  = NeutrinoMessages::EVT_SCAN_COMPLETE;
								*data = 0;
								break;
							case CZapitClient::EVT_SCAN_NUM_TRANSPONDERS:
								*msg  = NeutrinoMessages::EVT_SCAN_NUM_TRANSPONDERS;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_REPORT_NUM_SCANNED_TRANSPONDERS:
								*msg  = NeutrinoMessages::EVT_SCAN_REPORT_NUM_SCANNED_TRANSPONDERS;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_REPORT_FREQUENCY:
								*msg = NeutrinoMessages::EVT_SCAN_REPORT_FREQUENCY;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_FOUND_A_CHAN:
								*msg = NeutrinoMessages::EVT_SCAN_FOUND_A_CHAN;
								break;
							case CZapitClient::EVT_SCAN_SERVICENAME:
								*msg = NeutrinoMessages::EVT_SCAN_SERVICENAME;
								break;
							case CZapitClient::EVT_SCAN_FOUND_TV_CHAN:
								*msg  = NeutrinoMessages::EVT_SCAN_FOUND_TV_CHAN;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_FOUND_RADIO_CHAN:
								*msg  = NeutrinoMessages::EVT_SCAN_FOUND_RADIO_CHAN;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_FOUND_DATA_CHAN:
								*msg  = NeutrinoMessages::EVT_SCAN_FOUND_DATA_CHAN;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_REPORT_FREQUENCYP:
								*msg  = NeutrinoMessages::EVT_SCAN_REPORT_FREQUENCYP;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_NUM_CHANNELS:
								*msg = NeutrinoMessages::EVT_SCAN_NUM_CHANNELS;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_PROVIDER:
								*msg = NeutrinoMessages::EVT_SCAN_PROVIDER;
								break;
							case CZapitClient::EVT_SCAN_SATELLITE:
								*msg = NeutrinoMessages::EVT_SCAN_SATELLITE;
								break;
							case CZapitClient::EVT_BOUQUETS_CHANGED:
								*msg  = NeutrinoMessages::EVT_BOUQUETSCHANGED;
								*data = 0;
								break;
							case CZapitClient::EVT_SERVICES_CHANGED:
								*msg  = NeutrinoMessages::EVT_SERVICESCHANGED;
								*data = 0;
								break;
							case CZapitClient::EVT_ZAP_CA_CLEAR:
								*msg  = NeutrinoMessages::EVT_ZAP_CA_CLEAR;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_ZAP_CA_LOCK:
								*msg  = NeutrinoMessages::EVT_ZAP_CA_LOCK;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_ZAP_CA_FTA:
								*msg  = NeutrinoMessages::EVT_ZAP_CA_FTA;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_ZAP_CA_ID :
								*msg = NeutrinoMessages::EVT_ZAP_CA_ID;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SCAN_FAILED:
								*msg  = NeutrinoMessages::EVT_SCAN_FAILED;
								*data = 0;
								break;
							case CZapitClient::EVT_ZAP_MOTOR:
								*msg  = NeutrinoMessages::EVT_ZAP_MOTOR;
								*data = *(unsigned*) p;
								break;
							case CZapitClient::EVT_SDT_CHANGED:
								*msg          = NeutrinoMessages::EVT_SERVICES_UPD;
								*data         = 0;
								break;
							default:
								printf("[neutrino] event INITID_ZAPIT - unknown eventID 0x%x\n",  emsg.eventID );
						}
						if (((*msg) >= CRCInput::RC_WithData) && ((*msg) < CRCInput::RC_WithData + 0x10000000))
						{
							*data         = (neutrino_msg_data_t) p;
							dont_delete_p = true;
						}
					}
					else if ( emsg.initiatorID == CEventServer::INITID_TIMERD )
					{
						/*
						   if (emsg.eventID==CTimerdClient::EVT_ANNOUNCE_NEXTPROGRAM)
						   {
						   }

						   if (emsg.eventID==CTimerdClient::EVT_NEXTPROGRAM)
						   {
						 *msg = NeutrinoMessages::EVT_NEXTPROGRAM;
						 *data = (neutrino_msg_data_t) p;
						 dont_delete_p = true;
						 }
						 */
						switch(emsg.eventID)
						{
							case CTimerdClient::EVT_ANNOUNCE_RECORD :
								*msg = NeutrinoMessages::ANNOUNCE_RECORD;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_ANNOUNCE_ZAPTO :
								*msg = NeutrinoMessages::ANNOUNCE_ZAPTO;
								*data = 0;
								break;
							case CTimerdClient::EVT_ANNOUNCE_SHUTDOWN :
								*msg = NeutrinoMessages::ANNOUNCE_SHUTDOWN;
								*data = 0;
								break;
							case CTimerdClient::EVT_ANNOUNCE_SLEEPTIMER :
								*msg = NeutrinoMessages::ANNOUNCE_SLEEPTIMER;
								*data = 0;
								break;
							case CTimerdClient::EVT_SLEEPTIMER :
								*msg = NeutrinoMessages::SLEEPTIMER;
								*data = 0;
								break;
							case CTimerdClient::EVT_RECORD_START :
								*msg = NeutrinoMessages::RECORD_START;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_RECORD_STOP :
								*msg = NeutrinoMessages::RECORD_STOP;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_ZAPTO :
								*msg = NeutrinoMessages::ZAPTO;
								*data = (unsigned)  p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_SHUTDOWN :
								*msg = NeutrinoMessages::SHUTDOWN;
								*data = 0;
								break;
							case CTimerdClient::EVT_STANDBY_ON :
								*msg = NeutrinoMessages::STANDBY_ON;
								*data = 0;
								break;
							case CTimerdClient::EVT_STANDBY_OFF :
								*msg = NeutrinoMessages::STANDBY_OFF;
								*data = 0;
								break;
							case CTimerdClient::EVT_REMIND :
								*msg = NeutrinoMessages::REMIND;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_EXEC_PLUGIN :
								*msg = NeutrinoMessages::EVT_START_PLUGIN;
								*data = (unsigned) p;
								dont_delete_p = true;
								break;
							case CTimerdClient::EVT_BATCHEPG :
								*msg = NeutrinoMessages::EVT_BATCHEPG;
								*data = 0;
								break;
							default :
								printf("[neutrino] event INITID_TIMERD - unknown eventID 0x%x\n",  emsg.eventID );

						}
					}
					else if (emsg.initiatorID == CEventServer::INITID_NEUTRINO)
					{
						if ((emsg.eventID == NeutrinoMessages::EVT_RECORDING_ENDED) &&
								(read_bytes == sizeof(stream2file_status2_t)))
						{
							*msg  = NeutrinoMessages::EVT_RECORDING_ENDED;
							*data = (neutrino_msg_data_t) p;
							dont_delete_p = true;
						}
					}
					else if (emsg.initiatorID == CEventServer::INITID_GENERIC_INPUT_EVENT_PROVIDER)
					{
						if (read_bytes == sizeof(int))
						{
							*msg  = *(int *)p;
							*data = emsg.eventID;
						}
					}
					else
						printf("[neutrino] event - unknown initiatorID 0x%x\n",  emsg.initiatorID);
					if ( !dont_delete_p )
					{
						delete[] p;//new [] delete []
						p= NULL;
					}
				}
			}
			else
			{
				printf("[neutrino] event - read failed!\n");
			}

			::close(fd_eventclient);

			if ( *msg != RC_nokey )
			{
				// raus hier :)
				//printf("[neutrino] event 0x%x\n", *msg);
				return;
			}
		}

		for (int i = 0; i < NUMBER_OF_EVENT_DEVICES; i++) {
			if ((fd_rc[i] != -1) && (FD_ISSET(fd_rc[i], &rfds))) {
				int ret;
				ret = read(fd_rc[i], &ev, sizeof(t_input_event));

				if(ret != sizeof(t_input_event)) 
					continue;
				printf("key: %04x value %d, translate: %04x -%s-\n", ev.code, ev.value, translate(ev.code, i), getKeyName(translate(ev.code, i)).c_str());
				uint32_t trkey = translate(ev.code, i);

				if (trkey == RC_nokey) 
					continue;
				if (ev.value) {
#ifdef RCDEBUG
					printf("got keydown native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str());
					printf("rc_last_key %04x rc_last_repeat_key %04x\n\n", rc_last_key, rc_last_repeat_key);
#endif
					if (firstKey) {
						firstKey = false;
						int wtw = ::open ("/proc/stb/fp/was_timer_wakeup", O_WRONLY);
						if (wtw > -1) {
							write(wtw, "0\n", 2);
							::close(wtw);
						}
					}

					unsigned long long now_pressed;
					bool keyok = true;

					tv = ev.time;
					now_pressed = (unsigned long long) tv.tv_usec + (unsigned long long)((unsigned long long) tv.tv_sec * (unsigned long long) 1000000);
					if (ev.code == rc_last_key) {
						/* only allow selected keys to be repeated */
						/* (why?)                                  */
						if(mayRepeat(trkey) || (trkey == RC_up) || (trkey == RC_down   ) ||
							(trkey == RC_plus   ) || (trkey == RC_minus  ) ||
							(trkey == RC_page_down   ) || (trkey == RC_page_up  ) ||
							//(trkey == RC_standby) ||
							((bAllowRepeatLR) && ((trkey == RC_left ) ||
								(trkey == RC_right))))
						{
#ifdef ENABLE_REPEAT_CHECK
							if (rc_last_repeat_key != ev.code) {
								if ((now_pressed > last_keypress + repeat_block) ||
										/* accept all keys after time discontinuity: */
										(now_pressed < last_keypress)) 
									rc_last_repeat_key = ev.code;
								else
									keyok = false;
							}
#endif
						}
						else
							keyok = false;
					}
					else
						rc_last_repeat_key = KEY_MAX;

					rc_last_key = ev.code;

					if (keyok) {
#ifdef ENABLE_REPEAT_CHECK
						if ((now_pressed > last_keypress + repeat_block_generic) ||
								/* accept all keys after time discontinuity: */
								(now_pressed < last_keypress)) 
#endif
						{
							last_keypress = now_pressed;

							*msg = trkey;
							*data = 0; /* <- button pressed */
							if(g_settings.key_click)
								play_click();
							return;
						}
					} /*if keyok */
				} /* if (ev.value) */
				else {
					// clear rc_last_key on keyup event
#ifdef RCDEBUG
					printf("got keyup native key: %04x %04x, translate: %04x -%s-\n", ev.code, ev.code&0x1f, translate(ev.code, 0), getKeyName(translate(ev.code, 0)).c_str() );
#endif
					rc_last_key = KEY_MAX;
					if (trkey == RC_standby) {
						*msg = RC_standby;
						*data = 1; /* <- button released */
						return;
					}
				}
			}/* if FDSET */
		} /* for NUMBER_OF_EVENT_DEVICES */

		if(FD_ISSET(fd_pipe_low_priority[0], &rfds))
		{
			struct event buf;

			read(fd_pipe_low_priority[0], &buf, sizeof(buf));

			*msg  = buf.msg;
			*data = buf.data;

			// printf("got event from low-pri pipe %x %x\n", *msg, *data );

			return;
		}

		if ( InitialTimeout == 0 )
		{
			//nicht warten wenn kein key da ist
			*msg = RC_timeout;
			*data = 0;
			return;
		}
		else
		{
			//timeout neu kalkulieren
			gettimeofday( &tv, NULL );
			long long getKeyNow = (long long) tv.tv_usec + (long long)((long long) tv.tv_sec * (long long) 1000000);
			long long diff = (getKeyNow - getKeyBegin);
			if( Timeout <= (unsigned long long) diff )
			{
				*msg = RC_timeout;
				*data = 0;
				return;
			}
			else
				Timeout -= diff;
		}
	}
}