Esempio n. 1
0
void LoadConf() {
	HKEY myKey;
	DWORD type, size;

	memset(&config, 0, sizeof(config));
	strcpy(config.Hdd, HDD_DEF);
	config.HddSize = 8 * 1024;
	strcpy(config.Eth, ETH_DEF);

	if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\DEV9\\DEV9linuz", 0, KEY_ALL_ACCESS, &myKey)!=ERROR_SUCCESS) {
		LoadIniConf();
		return;
	}
	printf("Importing Settings\n");
	//Import old settings if user has upgraded this plugin
	GetKeyV("Eth", config.Eth, sizeof(config.Eth), REG_SZ);
	GetKeyV("Hdd", config.Hdd, sizeof(config.Hdd), REG_SZ);
	GetKeyVdw("HddSize", &config.HddSize);
	GetKeyVdw("ethEnable", &config.ethEnable);
	GetKeyVdw("hddEnable", &config.hddEnable);

	RegCloseKey(myKey);
	SaveConf();
	DeleteRegConf();
}
Esempio n. 2
0
void OnOk(HWND hW) {
	int i = ComboBox_GetCurSel(GetDlgItem(hW, IDC_ETHDEV));
	if (i == -1)
	{
		//adapter not selected
		if (Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED)))
		{
			//Trying to use an ethernet without
			//selected adapter, we can't have that
			SysMessage("Please select an ethernet adapter");
			return;
		}
		else 
		{
			//user not planning on using
			//ethernet anyway
			strcpy(config.Eth, ETH_DEF);
		}
	}
	else 
	{
		//adapter is selected
		char* ptr = (char*)ComboBox_GetItemData(GetDlgItem(hW, IDC_ETHDEV), i);
		strcpy(config.Eth, ptr);
	}
	
	Edit_GetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd, 256);

	config.ethEnable = Button_GetCheck(GetDlgItem(hW, IDC_ETHENABLED));
	config.hddEnable = Button_GetCheck(GetDlgItem(hW, IDC_HDDENABLED));

	SaveConf();

	EndDialog(hW, TRUE);
}
Esempio n. 3
0
File: main.c Progetto: bsv798/pcsxr
static void OnConfigExit(GtkWidget *widget, gpointer user_data) {
	widget = gtk_builder_get_object(builder, "cddev_comboboxentry");
	strncpy(CdromDev, gtk_entry_get_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget)))), 255);
	CdromDev[255] = '\0';

	widget = gtk_builder_get_object(builder, "readmode_combobox");
	ReadMode = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

	widget = gtk_builder_get_object(builder, "subQ_button");
	UseSubQ = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));

	widget = gtk_builder_get_object(builder, "spinCacheSize");
	CacheSize = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));

	widget = gtk_builder_get_object(builder, "spinCdrSpeed");
	CdrSpeed = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));

	widget = gtk_builder_get_object(builder, "comboSpinDown");
	SpinDown = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));

	SaveConf();

	gtk_widget_destroy(widget);
	exit(0);
}
int cgiMain() {
	CONFIG_T newcfg;
	int sock;
#ifdef DEBUG
	afreshOrient("cgi.txt", "a", stdout); //test
#endif /* DEBUG */

	if((sock = MyConnect()) < 0) {
		if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "MyConnect failed") != SUCCESS){
			exit(EFAILED);
		}
		exit(-1);
	}
	/* If a submit button has already been clicked, act on the submission of the form. */
	if (cgiFormSubmitClicked("savesetup") == cgiFormSuccess)
	{
		/*load the configuration file*/
		ReceiveSubmit(DEVICE_NUM, &newcfg);
		SaveConf(sock, DEVICE_NUM, newcfg);
	}  else if(LoadConf(sock, DEVICE_NUM, &newcfg) != 0) {
		if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "LoadConf failed") != SUCCESS){
			exit(EFAILED);
		}
		exit(-1);
	} 

	/* Now send the data for form */
	SendSubmit(DEVICE_NUM, newcfg);

	CloseSocket(sock);
	exit(0);
}
Esempio n. 5
0
long CFGopen() {
	GtkBuilder *builder;
	GtkWidget *widget, *MainWindow;
	char buf[256];

	LoadConf();

	builder = gtk_builder_new();

	if (!gtk_builder_add_from_resource(builder, "/org/pcsxr/dfnet/dfnet.ui", NULL)) {
		g_warning("We could not load the interface!");
		return 0;
	}

	MainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "dlgStart"));
	gtk_window_set_title(GTK_WINDOW(MainWindow), _("NetPlay"));

	widget = GTK_WIDGET(gtk_builder_get_object(builder, "btnCopyIP"));
	g_signal_connect_data(G_OBJECT(widget), "clicked",
		G_CALLBACK(OnCopyIP), NULL, NULL, G_CONNECT_AFTER);

	widget = GTK_WIDGET(gtk_builder_get_object(builder, "tbServerIP"));
	gtk_entry_set_text(GTK_ENTRY(widget), conf.ipAddress);

	widget = GTK_WIDGET(gtk_builder_get_object(builder, "tbPort"));
	sprintf(buf, "%d", conf.PortNum);
	gtk_entry_set_text(GTK_ENTRY(widget), buf);

	if (conf.PlayerNum == 1) {
		widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbServer"));
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
	} else {
		widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbClient"));
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), TRUE);
	}

	if (gtk_dialog_run(GTK_DIALOG(MainWindow)) == GTK_RESPONSE_OK) {
		widget = GTK_WIDGET(gtk_builder_get_object(builder, "tbServerIP"));
		strcpy(conf.ipAddress, gtk_entry_get_text(GTK_ENTRY(widget)));

		widget = GTK_WIDGET(gtk_builder_get_object(builder, "tbPort"));
		conf.PortNum = atoi(gtk_entry_get_text(GTK_ENTRY(widget)));

		widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbServer"));
		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
			conf.PlayerNum = 1;
		} else {
			conf.PlayerNum = 2;
		}

		SaveConf();
		gtk_widget_destroy(MainWindow);
		return 1;
	}

	gtk_widget_destroy(MainWindow);

	return 0;
}
Esempio n. 6
0
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data)
{
    const char *tempisoname;

    MainBoxUnfocus();

    tempisoname = gtk_entry_get_text(GTK_ENTRY(mainbox.file));
    if (*(tempisoname) != 0)
    {
        if (IsIsoFile(tempisoname) == -4)
        {
            IsoTableRebuild(tempisoname);
            MainBoxRefocus();
            return(TRUE);
        } // ENDIF- Do we need to rebuild an image file's index before using it?

        if (IsIsoFile(tempisoname) < 0)
        {
            tempisoname = NULL;
            MainBoxRefocus();
            MessageBoxShow("Not a Valid Image File.", 1);
            return(TRUE);
        } // ENDIF- Not an ISO file? Message and Stop here.
    } // ENDIF- Is there an ISO file to check out?

    strcpy(conf.isoname, tempisoname);
    tempisoname = NULL;
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.startcheck)) == FALSE)
    {
        conf.startconfigure = 0; // FALSE
    }
    else
    {
        conf.startconfigure = 1; // TRUE
    } // ENDIF- Was this check button turned off?
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(mainbox.restartcheck)) == FALSE)
    {
        conf.restartconfigure = 0; // FALSE
    }
    else
    {
        conf.restartconfigure = 1; // TRUE
    } // ENDIF- Was this check button turned off?
    SaveConf();
    MainBoxCancelEvent(widget, event, data);
    return(TRUE);
} // END MainBoxOKEvent()
Esempio n. 7
0
void LoadIniConf() {
	//memset(&config, 0, sizeof(config));
	//strcpy(config.Hdd, HDD_DEF);
	//config.HddSize = 8 * 1024;
	//strcpy(config.Eth, ETH_DEF);

	const std::string file(s_strIniPath + "/dev9ghz.ini");
	if (FileExists(file.c_str()) == false) {
		SaveConf();
		return;
	}
	GetPrivateProfileString("DEV9", "Eth", ETH_DEF, config.Eth, sizeof(config.Eth), file.c_str());
	GetPrivateProfileString("DEV9", "Hdd", HDD_DEF, config.Hdd, sizeof(config.Hdd), file.c_str());
	config.HddSize = GetPrivateProfileInt("DEV9", "HddSize", config.HddSize, file.c_str());
	config.ethEnable = GetPrivateProfileInt("DEV9", "ethEnable", config.ethEnable, file.c_str());
	config.hddEnable = GetPrivateProfileInt("DEV9", "hddEnable", config.hddEnable, file.c_str());
}
Esempio n. 8
0
void MainBoxOKEvent()
{
	char tempisoname[256];
	MainBoxUnfocus();
	GetDlgItemText(mainboxwindow, IDC_0202, tempisoname, 256);
	if (*(tempisoname) != 0)
	{
		if (IsIsoFile(tempisoname) == -4)
		{
			IsoTableRebuild(tempisoname);
			MainBoxRefocus();
			return;
		} // ENDIF- Do we need to rebuild an image file's index before using it?
		if (IsIsoFile(tempisoname) < 0)
		{
			MainBoxRefocus();
			MessageBox(mainboxwindow,
			           "Not a Valid Image File.",
			           "CDVDisoEFP Message",
			           MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
			return;
		} // ENDIF- Not an ISO file? Message and Stop here.
	} // ENDIF- Do we have a name to check out?
	strcpy(conf.isoname, tempisoname);
	if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0209)) == BST_UNCHECKED)
	{
		conf.startconfigure = 0; // FALSE
	}
	else
	{
		conf.startconfigure = 1; // TRUE
	} // ENDIF- Was this checkbox unchecked?
	if (Button_GetCheck(GetDlgItem(mainboxwindow, IDC_0210)) == BST_UNCHECKED)
	{
		conf.restartconfigure = 0; // FALSE
	}
	else
	{
		conf.restartconfigure = 1; // TRUE
	} // ENDIF- Was this checkbox unchecked?
	SaveConf();

	MainBoxCancelEvent();
	return;
} // END MainBoxOKEvent()
Esempio n. 9
0
gint MainBoxOKEvent(GtkWidget *widget, GdkEvent event, gpointer data) {

  const char *tempdevice;

  int retval;



  MainBoxUnfocus();



  tempdevice = gtk_entry_get_text(GTK_ENTRY(mainbox.device));

  strcpy(conf.devicename, tempdevice); // Temporarily put in new device name

  tempdevice = NULL;

  if(*(conf.devicename) != 0) {

    retval = DeviceOpen(); // Test by opening the device.

    DeviceClose(); // Failed or not, close it.

    if(retval != 0) {

      MainBoxRefocus();

      return(TRUE);

    } // ENDIF- Not an ISO file? Message and Stop here.

  } // ENDIF- Is there an ISO file to check out?



  SaveConf();



  MainBoxCancelEvent(widget, event, data);

  return(TRUE);

} // END MainBoxOKEvent()
Esempio n. 10
0
void LoadConf()
{
    HKEY myKey;
    DWORD type, size;

    memset(IsoFile, 0, sizeof(IsoFile));

    if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\CDVD\\CDVDiso", 0, KEY_ALL_ACCESS, &myKey) != ERROR_SUCCESS) {
        SaveConf();
        return;
    }

    GetKeyV("IsoFile", IsoFile, sizeof(IsoFile), REG_BINARY);
    GetKeyV("CurrentWorkingFolder", IsoCWD, sizeof(IsoCWD), REG_BINARY);
    GetKeyVdw("BlockDump", &BlockDump);

    RegCloseKey(myKey);
}
Esempio n. 11
0
void MainBoxOKEvent()
{
	int retval;
	MainBoxUnfocus();
	GetDlgItemText(mainboxwindow, IDC_0202, conf.devicename, 256);
	retval = DeviceOpen();
	DeviceClose();
	if (retval != 0) {
		MainBoxRefocus();
		MessageBox(mainboxwindow,
		           "Could not open the device",
		           "CDVDlinuz Message",
		           MB_OK | MB_ICONWARNING | MB_SETFOREGROUND);
		return;
	} // ENDIF- Trouble opening device? Abort here.
	SaveConf();
	MainBoxCancelEvent();
	return;
} // END MainBoxOKEvent()
Esempio n. 12
0
void LoadConf() {
	HKEY myKey;
	DWORD type, size;

	memset(&config, 0, sizeof(config));
	strcpy(config.Hdd, HDD_DEF);
	config.HddSize=8*1024;
	strcpy(config.Eth, ETH_DEF);

	if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\PS2Eplugin\\DEV9\\DEV9linuz", 0, KEY_ALL_ACCESS, &myKey)!=ERROR_SUCCESS) {
		SaveConf(); return;
	}
	GetKeyV("Eth", config.Eth, sizeof(config.Eth), REG_SZ);
	GetKeyV("Hdd", config.Hdd, sizeof(config.Hdd), REG_SZ);
	GetKeyVdw("HddSize", &config.HddSize);
	GetKeyVdw("ethEnable", &config.ethEnable);
	GetKeyVdw("hddEnable", &config.hddEnable);

	RegCloseKey(myKey);
}
Esempio n. 13
0
CKDConf::~CKDConf()
{
	SaveConf();
}
Esempio n. 14
0
void MainWindow::Init()
{
//debug部分**************************************************************************************************************
    autoShowTimer = new QTimer;
    connect(autoShowTimer,
            SIGNAL(timeout()),
            this,
            SLOT(on_AutoShowTimer()));

    currentDataNodeIndex = 0;
//debug部分**************************************************************************************************************

    //变量部分*******************************************************************************
    port = new MyPort;
    fileLoad = new MyFile;
    fileTemp = new MyFile;
    fileData = new MyFile;

    thresholdHeight = 500;
    thresholdLow = 200;
    currentHeight = 0;
    recvDataCount = 0;
    isStartSampling = false;
    grayWidgetCurrentPage = 0;

    //变量部分*******************************************************************************


    //Ui部分*******************************************************************************
    confShow = new widgetConf;
    //grayShow = new widgetGrayShow;
    infoShow = new widgetInfo;
    testShow = new widgetTest;
    waveShow = new widgetWaveShow;
    finishShow = new FinishShow;
    showConf = new ShowConf;
    widgetSpace = new QWidget;
    //主窗口部分*********************************
    layoutMain->addWidget(infoShow);
    layoutMain->addWidget(confShow);

    layoutMain->addWidget(testShow);
    layoutMain->addWidget(waveShow);
    layoutMain->addWidget(finishShow);
    layoutMain->addWidget(widgetSpace);
    layoutMain->setStretch(0, 1);
    layoutMain->setStretch(1, 10);
    layoutMain->setStretch(2, 10);
    layoutMain->setStretch(3, 10);
    layoutMain->setStretch(4, 10);
    layoutMain->setStretch(5, 10);


    //主窗口部分*********************************

    infoShow->spinBoxWaveCount->setValue(8);
    infoShow->spinScale->setValue(50);
    infoShow->comboProfile->setCurrentIndex(2);
    infoShow->comboShowMode->setCurrentIndex(0);


    on_ScaleChange(50);
    on_WaveCountChange(8);
    on_ProfileChange(2);

    WhenConfUi();
    //Ui部分*******************************************************************************

    //信号槽***********************************************************************************
    //当完成一次接受时触发。
    connect(port, SIGNAL(FinishThisRecv(MyDataNode&)), this, SLOT(FinishDataRecv(MyDataNode&)));

    connect(infoShow->spinScale, SIGNAL(valueChanged(int)), this, SLOT(on_ScaleChange(int)));
    connect(infoShow->spinBoxWaveCount, SIGNAL(valueChanged(int)), this, SLOT(on_WaveCountChange(int)));
    connect(infoShow->comboProfile, SIGNAL(currentIndexChanged(int)), this, SLOT(on_ProfileChange(int)));
    connect(infoShow->comboShowMode, SIGNAL(currentIndexChanged(int)), this, SLOT(on_ShowModeChange(int)));

    connect(confShow, SIGNAL(SaveConf()), this, SLOT(on_ConfSave()));

    connect(finishShow->browseMode, SIGNAL(showMode(int)), this, SLOT(on_BrowseModeSelected(int)));
}