コード例 #1
0
void NewDeviceWidget::onSetButtonClicked()
{


	//Check whether the Device Name is of appropriate length
	if (deviceNameInput->text().count() < 1 || deviceNameInput->text().count() > 16) //1 - 16 is the valid length range
	{
		deviceNameLabel->setText("The device name must be between 1-12 characters:");
		deviceNameLabel->setPalette(errorTextPalette);
	}
	else
	{
		 
		/* Save this Device Name and Type to the Registry */

		HKEY inssidiousHKCU;
		if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CURRENT_USER, L"Software\\Inssidious\\DevicePairs", 0, 0, 0, KEY_WRITE, 0, &inssidiousHKCU, 0))
		{
			RegSetValueEx(
				inssidiousHKCU,
				QString(MAC + "-Name").toStdWString().c_str(),
				0,
				REG_SZ,
				LPBYTE(deviceNameInput->text().utf16()),
				deviceNameInput->text().size() * sizeof(wchar_t)
			);


			RegSetValueEx(
				inssidiousHKCU,
				QString(MAC + "-Type").toStdWString().c_str(),
				0,
				REG_SZ,
				LPBYTE(deviceTypeComboBox->currentText().utf16()),
				deviceTypeComboBox->currentText().size() * sizeof(wchar_t)
				);
		}


		/* Send out the name and type values */

		emit setDeviceInfo(MAC, deviceNameInput->text(), deviceTypeComboBox->currentText());

	}

}
コード例 #2
0
ファイル: Emulator.c プロジェクト: kkklatu/blueMSX-libretro
void emulatorStart(const char* stateName) {
   int frequency;
   int success = 0;
   int reversePeriod = 0;
   int reverseBufferCnt = 0;

    archEmulationStartNotification();
    emulatorResume();

    emuExitFlag = 0;

    mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MOONSOUND, 1);
    mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_YAMAHA_SFG, 1);
    mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXAUDIO, 1);
    mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_MSXMUSIC, 1);
    mixerIsChannelTypeActive(mixer, MIXER_CHANNEL_SCC, 1);


    properties->emulation.pauseSwitch = 0;
    switchSetPause(properties->emulation.pauseSwitch);

    machine = machineCreate(properties->emulation.machineName);

    if (machine == NULL) {
        archShowStartEmuFailDialog();
        archEmulationStopNotification();
        emuState = EMU_STOPPED;
        archEmulationStartFailure();
        return;
    }

    boardSetMachine(machine);


    setDeviceInfo(&deviceInfo);

    inputEventReset();

    archSoundResume();
    archMidiEnable(1);

    emuState = EMU_PAUSED;
    strcpy(emuStateName, stateName ? stateName : "");

    emuState = EMU_RUNNING;

    emulatorSetFrequency(50 , &frequency);

    switchSetFront(properties->emulation.frontSwitch);
    switchSetPause(properties->emulation.pauseSwitch);
    switchSetAudio(properties->emulation.audioSwitch);

    if (properties->emulation.reverseEnable && properties->emulation.reverseMaxTime > 0) {
        reversePeriod = 50;
        reverseBufferCnt = properties->emulation.reverseMaxTime * 1000 / reversePeriod;
    }
    success = boardRun(machine,
                       &deviceInfo,
                       mixer,
                       *emuStateName ? emuStateName : NULL,
                       frequency,
                       0,
                       0,
                       NULL);
    if (!success) {
        archEmulationStopNotification();
        emuState = EMU_STOPPED;
        archEmulationStartFailure();
    }
}