Example #1
0
s32 CALLBACK CDVDctrlTrayOpen() {
  HWND lastwindow;
  int i;
  int retval;

#ifdef VERBOSE_FUNCTION_INTERFACE
  PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
#endif /* VERBOSE_FUNCTION_INTERFACE */
  // CDVDclose();
  isofile = IsoFileClose(isofile);
  deviceopencount = 50;

  // CDVDopen();
  lastwindow = GetActiveWindow();
  LoadConf();
  if((conf.isoname[0] == 0) || (conf.isoname[0] == '[') ||
     ((conf.restartconfigure == 1) && (deviceopencount > 0))) {
    DialogBox(progmodule,
              MAKEINTRESOURCE(DLG_0200),
              lastwindow,
              (DLGPROC)MainBoxCallback);
    SetActiveWindow(lastwindow);
    LoadConf();
    // Blank out the name in config file afterwards? Seems excessive.
  } // ENDIF- Haven't initialized the configure program yet? Do so now.
  lastwindow = NULL;
  deviceopencount = 0; // Temp line!
  // NOTE: What happened to repetitive polling when disc not in drive?

  isofile = IsoFileOpenForRead(conf.isoname);
  if(isofile == NULL) {
#ifdef VERBOSE_FUNCTION_INTERFACE
    PrintLog("CDVDiso interface:   Failed to open ISO file!");
#endif /* VERBOSE_FUNCTION_INTERFACE */
    // return(-1); // Removed to simulate disc not in drive.
    for(i = 0; i < 2048; i++)  isocdcheck[i] = 0;
    return(0);
  } // ENDIF- Trouble opening file? Abort.

  retval = IsoFileSeek(isofile, 16);
  if(retval != 0)  return(-1);
  retval = IsoFileRead(isofile, isobuffer);
  if(retval != 0)  return(-1);

  if(deviceopencount > 0) {
    i = 0;
    while((i < 2048) && (isocdcheck[i] == isobuffer[i]))  i++;
    if(i == 2048)  deviceopencount = 0; // Same CD/DVD? No delay.
  } // ENDIF- Is this a restart? Check for disc change.

  for(i = 0; i < 2048; i++)  isocdcheck[i] = isobuffer[i];

  return(0);
} // END CDVDctrlTrayOpen()
Example #2
0
void OnInitDialog(HWND hW) {
	char *dev;
	//int i;

	LoadConf();

	ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "Expansion");
	ComboBox_AddString(GetDlgItem(hW, IDC_BAYTYPE), "PC Card");
	for (int j=0;j<2;j++)
	{
	for (int i=0; i<pcap_io_get_dev_num(); i++) {
		dev = pcap_io_get_dev_desc(i,j);
		int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), dev);
		ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup(pcap_io_get_dev_name(i,j)));
		if (strcmp(pcap_io_get_dev_name(i,j), config.Eth) == 0) {
			ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm);
		}
	}
	}
	vector<tap_adapter> * al=GetTapAdapters();
	for (size_t i=0; i<al->size(); i++) {
		
		int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str());
		ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup( al[0][i].guid.c_str()));
		if (strcmp(al[0][i].guid.c_str(), config.Eth) == 0) {
			ComboBox_SetCurSel(GetDlgItem(hW, IDC_ETHDEV), itm);
		}
	}

	Edit_SetText(GetDlgItem(hW, IDC_HDDFILE), config.Hdd);

	Button_SetCheck(GetDlgItem(hW, IDC_ETHENABLED), config.ethEnable);
	Button_SetCheck(GetDlgItem(hW, IDC_HDDENABLED), config.hddEnable);
}
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);
}
Example #4
0
BOOL CAutoDialDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
	//  执行此操作
	SetIcon(m_hIcon, TRUE);			// 设置大图标
	SetIcon(m_hIcon, FALSE);		// 设置小图标

	SetWindowPos(NULL,0,0,0,0,NULL);
	SetWindowLong(this->GetSafeHwnd(),GWL_EXSTYLE,WS_EX_TOOLWINDOW|WS_EX_STATICEDGE); 
	
	// TODO: 在此添加额外的初始化代码
	if (0 == GetModuleFileName(NULL, m_szAppPath, MAX_PATH)){
		AfxMessageBox("获取程序运行路径失败");
		EndDialog(IDCANCEL);
		return FALSE;
	}
	if (!LoadConf()){
		AfxMessageBox("加载配置文件失败");
		EndDialog(IDCANCEL);
		return FALSE;
	}

	RunWhenStart(TRUE);

	SetWindowText("ZAutoDial");
	m_bConn = AutoCheck();
	SetTimer(s_dwTimeEvent, m_dwTimeElapse * 1000, NULL);
	ToTray(m_bConn);
	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
}
Example #5
0
s32 CALLBACK CDVDctrlTrayOpen()
{
	int i;
#ifdef VERBOSE_FUNCTION_INTERFACE
	PrintLog("CDVDiso interface: CDVDctrlTrayOpen()");
#endif /* VERBOSE_FUNCTION_INTERFACE */
	// Close()
	isofile = IsoFileClose(isofile);
	deviceopencount = 50;
	// and re-Open()
	if ((conf.isoname[0] == 0) ||
	    ((conf.restartconfigure != 0) && (deviceopencount > 0))) {
		ExecCfg("configure");
		LoadConf();
	} // ENDIF- Haven't initialized the configure program yet? Do so now.
	isofile = IsoFileOpenForRead(conf.isoname);
	if (isofile == NULL) {
#ifdef VERBOSE_FUNCTION_INTERFACE
		PrintLog("CDVDiso interface:   Failed to open ISO file!");
#endif /* VERBOSE_FUNCTION_INTERFACE */
	} // ENDIF- Trouble opening file? Abort.
	if (deviceopencount > 0) {
		i = 0;
		while ((i < 2048) && (isocdcheck[i] == isobuffer[i]))  i++;
		if (i == 2048)  deviceopencount = 0; // Same CD/DVD? No delay.
	} // ENDIF- Is this a restart? Check for disc change.
	for (i = 0; i < 2048; i++)  isocdcheck[i] = isobuffer[i];
	return (0);
} // END CDVDctrlTrayOpen()
int cgiMain() {
	CONFIG_T cfg, rcfg;
	int sock;
	int err;
	int checks;

#if 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(EFAILED);
	}
	/*load the configuration file*/
	if((err = LoadConf(sock, DEVICE_NUM, &cfg)) != 0) {
		/*load the configuration file*/
		if(cgi_sprint("FAILED", "", INTERNAL_SERVERERR, "LoadConf failed") != SUCCESS){
			exit(EFAILED);
		}
		exit(EFAILED);
	}
	/* If a submit button has already been clicked, act on the submission of the form. */
	if (cgiFormSubmitClicked("login_loginpage") == cgiFormSuccess) {
		strcpy(cfg.user.uname, SUPERNAME);

		if((err = ReceiveSubmit(DEVICE_NUM, &rcfg)) != SUCCESS) {
			if(cgi_sprint("FAILED", "", BADREQUIST, "ReceiveSubmit failed") != SUCCESS){
				exit(EFAILED);
			}
			exit(EFAILED);
		}

		if((checks = CheckLogin(rcfg.user, cfg.user)) != SUCCESS) {
			if(cgi_sprint("FAILED", "", UNAUTHENTICATION, "authentication failed") != SUCCESS){
				exit(EFAILED);
			}
			exit(EFAILED);
		} else {
			//AUTHENTICATION
			if(setenv(CGI_AUTH_IP, CGICLIENTIP, 1) != 0) {
				if(cgi_sprint("FAILED", "", 100, "authentication save failed") != SUCCESS){
					exit(EFAILED);
				}
				exit(EFAILED);
			}
			if(cgi_sprint("SUCCESS", "../main.html", SUSSHAND, "request success") != SUCCESS){
				exit(EFAILED);
			}
		}

		//SendSubmit(DEVICE_NUM, rcfg);

	}

	CloseSocket(sock);
	return SUCCESS;
}
Example #7
0
void MainBoxDisplay()
{
	LoadConf();
	// Adjust window position?
	// We held off setting the name until now... so description would show.
	SetDlgItemText(mainboxwindow, IDC_0202, conf.isoname);
	if (conf.startconfigure == 0)
	{
		Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_UNCHECKED);
	}
	else
	{
		Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0209), BST_CHECKED);
	} // ENDIF- Do we need to uncheck this box?
	if (conf.restartconfigure == 0)
	{
		Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_UNCHECKED);
	}
	else
	{
		Button_SetCheck(GetDlgItem(mainboxwindow, IDC_0210), BST_CHECKED);
	} // ENDIF- Do we need to uncheck this box?
	// First Time - Show the window
	ShowWindow(mainboxwindow, SW_SHOWNORMAL);
} // END MainBoxDisplay()
Example #8
0
long sockOpen() {
	if (ExecCfg("open", 0) == 0) return -1;

	LoadConf();

	return 0;
}
Example #9
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;
}
Example #10
0
void MainBoxDisplay()
{
	InitConf(); // Man, am I boiling mad! CDVDinit() should have been called first!
	LoadConf();
	// Adjust window position?
	// We held off setting the name until now... so description would show.
	SetDlgItemText(mainboxwindow, IDC_0202, conf.devicename);
	// First Time - Show the window
	ShowWindow(mainboxwindow, SW_SHOWNORMAL);
} // END MainBoxDisplay()
Example #11
0
s32 CALLBACK CDVDtest()
{
#ifdef VERBOSE_FUNCTION_INTERFACE
	PrintLog("CDVDiso interface: CDVDtest()");
#endif /* VERBOSE_FUNCTION_INTERFACE */
	InitConf(); // Odd... hasn't CDVDinit been called yet?
	LoadConf();
	if (conf.isoname[0] == 0)  return (0); // No name chosen yet. Catch on Open()
	if (IsIsoFile(conf.isoname) == 0)  return (0); // Valid name. Go.
	return (-1); // Invalid name - reconfigure first.
	// Note really need this? Why not just return(0)...
} // END CDVDtest()
Example #12
0
s32 CALLBACK DEV9open(void *pDsp) 
{
	DEV9_LOG("DEV9open\n");
	LoadConf();
	DEV9_LOG("open r+: %s\n", config.Hdd);
	config.HddSize = 8*1024;
	
	iopPC = (u32*)pDsp;
	
#ifdef ENABLE_ATA
	ata_init();
#endif
	return _DEV9open();
}
Example #13
0
s32 CALLBACK CDVDopen(const char* pTitleFilename)
{
	int retval;
	int i;
#ifdef VERBOSE_FUNCTION_INTERFACE
	PrintLog("CDVDiso interface: CDVDopen()");
#endif /* VERBOSE_FUNCTION_INTERFACE */
	LoadConf();
	if (pTitleFilename != NULL) strcpy(conf.isoname, pTitleFilename);
	if ((conf.isoname[0] == 0) ||
	    ((conf.startconfigure != 0) && (deviceopencount == 0)) ||
	    ((conf.restartconfigure != 0) && (deviceopencount > 0))) {
		ExecCfg("configure");
		LoadConf();
	} // ENDIF- Haven't initialized the configure program yet? Do so now.
	isofile = IsoFileOpenForRead(conf.isoname);
	if (isofile == NULL) {
#ifdef VERBOSE_FUNCTION_INTERFACE
		PrintLog("CDVDiso interface:   Failed to open ISO file!");
#endif /* VERBOSE_FUNCTION_INTERFACE */
		// return(-1); // Taken out for "NULL" device simulation
		for (i = 0; i < 2048; i++)  isocdcheck[i] = 0;
		return (0);
	} // ENDIF- Trouble opening file? Abort.
	retval = IsoFileSeek(isofile, 16);
	if (retval != 0)  return (-1);
	retval = IsoFileRead(isofile, isobuffer);
	if (retval != 0)  return (-1);
	if (deviceopencount > 0) {
		i = 0;
		while ((i < 2048) && (isocdcheck[i] == isobuffer[i]))  i++;
		if (i == 2048)  deviceopencount = 0; // Same CD/DVD? No delay.
	} // ENDIF- Is this a restart? Check for disc change.
	for (i = 0; i < 2048; i++)  isocdcheck[i] = isobuffer[i];
	return (0);
} // END CDVDopen()
Example #14
0
s32 CALLBACK DEV9open(void *pDsp) 
{
	DEV9_LOG("DEV9open\n");
	LoadConf();
	DEV9_LOG("open r+: %s\n", config.Hdd);
	config.HddSize = 8*1024;
	
	tx_p_first=false; // reset stack init hack so it works on game reboots 

	iopPC = (u32*)pDsp;
	
#ifdef ENABLE_ATA
	ata_init();
#endif
	return _DEV9open();
}
Example #15
0
int main(int argc, char *argv[])
{
	gtk_init(NULL, NULL);

	OpenLog();
	InitConf();
	LoadConf();
	MainBoxDisplay();
	ProgressBoxDisplay();
	MessageBoxDisplay();

	gtk_widget_show_all(mainbox.window);
	gtk_main();
	CloseLog();
	return(0);
} // END main()
Example #16
0
s32 CALLBACK CDVDopen(const char* pTitleFilename) {
  s32 s32result;

#ifdef VERBOSE_FUNCTION
  PrintLog("CDVD interface: CDVDopen()");
#endif /* VERBOSE_FUNCTION */

  InitBuffer();

  LoadConf();

  errno = 0;
  s32result = DeviceOpen();
  if(s32result != 0)  return(s32result);
  if(errno != 0)  return(-1);

  return(0);
} // END CDVDopen();
Example #17
0
void ColorizeProcess(HANDLE hStdOut, WORD wDefaultAttributes, const TCHAR* conf, std::wstring& sCmdLine)
{
    CopyFileThreadData OutData;
    OutData.hOut = hStdOut;
    OutData.wAttributes = wDefaultAttributes;

    CopyFileThreadData ErrData;
    ErrData.hOut = hStdOut;
    ErrData.wAttributes = FOREGROUND_RED | FOREGROUND_INTENSITY;

    LoadConf(OutData.vRegExAttribute, ErrData.vRegExAttribute, conf);

    Pipe hChildStd_OUT;
    Pipe hChildStd_ERR;

    OutData.hIn = hChildStd_OUT.read().get();
    ErrData.hIn = hChildStd_ERR.read().get();

    Handle hProcess;
    Handle hThread;
    {
        STARTUPINFO            siStartupInfo = { sizeof(siStartupInfo) };
        PROCESS_INFORMATION    piProcessInfo = { 0 };
 
        siStartupInfo.dwFlags = STARTF_USESTDHANDLES;
        siStartupInfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
        siStartupInfo.hStdOutput = hChildStd_OUT.write().get();
        siStartupInfo.hStdError = hChildStd_ERR.write().get();

        WIN(CreateProcess(NULL, const_cast<LPTSTR>(sCmdLine.c_str()), NULL, NULL, TRUE, 0, NULL, NULL, &siStartupInfo, &piProcessInfo), _T("CreateProcess"));

        hProcess.attach(piProcessInfo.hProcess);
        hThread.attach(piProcessInfo.hThread);
    }

    hChildStd_OUT.write().close();
    hChildStd_ERR.write().close();

    Handle hThreadOut(CreateThread(NULL, 0, &CopyFileThread, &OutData, 0, NULL));
    Handle hThreadErr(CreateThread(NULL, 0, &CopyFileThread, &ErrData, 0, NULL));

    HANDLE hWait[] = { hThreadOut.get(), hThreadErr.get(), hProcess.get() };
    WIN(WaitForMultipleObjects(ARRAYSIZE(hWait), hWait, TRUE, INFINITE) == WAIT_OBJECT_0, _T("WaitForMultipleObjects"));
}
Example #18
0
File: cdr.c Project: bsv798/pcsxr
long CDRopen(void) {
	LoadConf();

#ifndef _MACOSX
	if (IsCdHandleOpen())
		return 0; // it's already open
#endif

	if (OpenCdHandle(CdromDev) == -1) { // if we can't open the cdrom we'll works as a null plugin
		fprintf(stderr, "CDR: Could not open %s\n", CdromDev);
	}

	fReadTrack = ReadTrackT[ReadMode];
	fGetBuffer = GetBufferT[ReadMode];

	if (ReadMode == THREADED) {
		cdcache = (CacheData *)malloc(CacheSize * sizeof(CacheData));
		if (cdcache == NULL) return -1;
		memset((void *)cdcache, 0, CacheSize * sizeof(CacheData));

		found = 0;
	} else {
		cdbuffer = cr.buf + 12; /* skip sync data */
	}

	if (ReadMode == THREADED) {
		pthread_attr_t attr;

		pthread_mutex_init(&mut, NULL);
		pthread_cond_init(&cond, NULL);
		locked = 0;

		pthread_attr_init(&attr);
		pthread_create(&thread, &attr, CdrThread, NULL);

		cacheaddr = -1;
	} else thread = (pthread_t)-1;

	playing = 0;
	stopth = 0;
	initial_time = 0;

	return 0;
}
Example #19
0
int main(void)
{
OSCCAL=eeprom_read_byte(0x00);        // Настройка генератора.
PRR=0x0b;           // выключаем лишние устройства.
DDRB=0b00000111;    //  настраиваем порт в
PORTB=0b00000000;   // сбрасываем в ноль
DDRA= 0b10011000;    // настраиваем порт А
PORTA=0b00010000;   // выключаем приемопередатчик
DIDR0=0b00000110;   // отключаем цифровые входы от компаратора
// сторожевой таймер
WDTCSR=0x18;        // настраиваем сторожевой таймер
WDTCSR=0x29;        // сторожевой таймер сброс через 8 секунд.
// настройка переменных
flag=0;
set_sleep_mode(SLEEP_MODE_IDLE);
sleep_enable();
id_yd=0;
while (1)
      {  
		 ClsBit(PORTA,pwr_up); // выключаем приемник
		 flag=0;
		 delay_ms(20);
		 ACSR=0b00011011; // включаем компаратор.
		 delay_ms(10);
		 sei(); // разрешаем прерывания 
         while(!flag)  	sleep_cpu();  //ждем удара и усыпляем контролер 
		 // удар произошел передаем данные
		 // 
		 cli(); // запрещаем прерывания.
		 SetBit(PORTA,pwr_up);  // включаем приемник
		 delay_ms(10);       	// задержка 10 ms.
		 LoadConf();         	// загружаем конфигурацию.  
		 // передаем пакет.      
         PutChar(0xe7);
         PutChar(adr);  
         PutChar(id_yd);      
		 ce0; // активизируем передачу    
         delay_ms(9); // делаем выдержку по времени 1 ms.
		 wdr(); // сбрасываем сторожевой таймер.
      }
}
Example #20
0
File: main.c Project: bsv798/pcsxr
long CDRconfigure() {
	LoadConf();

	MainWindow = gtk_builder_get_object(builder, "CfgWnd");
	gtk_window_set_title(GTK_WINDOW(MainWindow), _("CDR configuration"));

	widget = gtk_builder_get_object(builder, "CfgWnd");
	g_signal_connect_data(G_OBJECT(widget), "delete_event",
		G_CALLBACK(OnConfigExit), NULL, NULL, G_CONNECT_AFTER);

	widget = gtk_builder_get_object(builder, "cfg_closebutton");
	g_signal_connect_data(G_OBJECT(widget), "clicked",
		G_CALLBACK(OnConfigExit), NULL, NULL, G_CONNECT_AFTER);

	widget = gtk_builder_get_object(builder, "cddev_comboboxentry");
	fill_drives_list(widget);
	gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN(widget))), CdromDev);

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

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

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

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

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

	gtk_widget_show(MainWindow);
	gtk_main();

	return 0;
}
Example #21
0
int main(int argc, char *argv[]){
	/* The starting point of time counting */
	int timer_start = SDL_GetTicks();
	
	SDL_Event event;
	
	LoadConf();
	
	/* Creates the application process, which is initializes and
	 * creates a window, 3D environment, so on.
	 * In this case, we're creating a Qt environment. */
  initGL();
	
  /* Random generator initialization */
	srand ( time(NULL) );

	/* Initialize a script engine, Lua in this case */
	lua_engine = new LuaEngine();
	
	/* Load a script for the engine */
	lua_engine->LoadLuaScript("data/scripts/technocracy.lua");
	
	/* Updating the timers start to now. */
	timer_start = SDL_GetTicks();
  /* Updating the local time to 0, as initialization might take time. */
  time_now = SDL_GetTicks() - timer_start;
	/* Updating the real time to start from now. */
	real_time = SDL_GetTicks() - timer_start;
  
	/* runs until done==1*/
  int done;
  for(done = 0; !done;){
		/* Updating the real time.*/
		real_time = SDL_GetTicks();
		
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glLoadIdentity();

    glTranslatef(0.0f,0.0f,-0.0f);

		/* Runs the whole .. everything */
		lua_engine->Run(time_now);

    SDL_GL_SwapBuffers();
    SDL_PollEvent(&event);
		
		/* Poll SDL events as long as there's any left and do seeking with LEFT and RIGHT arrow */
    while( SDL_PollEvent( &event ) ){
        switch( event.type ){
            /* Look for a keypress */
            case SDL_KEYDOWN:
                /* Check the SDLKey values and move change the coords */
                switch( event.key.keysym.sym ){
                    case SDLK_LEFT:
												seeking = 1;
                        break;
										case SDLK_RIGHT:
												seeking = 2;
												break;
                    case SDLK_ESCAPE:
                        done = 1;
												break;
                    default:
                        break;
                }
							break;
						case SDL_KEYUP:
							seeking = 0;
							break;
            }
        }
		if (seeking == 1)
			time_now -= (SDL_GetTicks() - real_time ) * 5;
		if (seeking == 2)
				time_now += (SDL_GetTicks() - real_time ) * 3;
		else
			time_now += SDL_GetTicks() - real_time;
	}

	delete lua_engine;
  SDL_Quit();
	cout<<"Classes and libraries DESTROYED succesfully!\n";
  return(0);
}
Example #22
0
bool
CGroup::Init (const CDBCtrl::SGroup &group)
{
	SetdwCreateId(group.dwUserId);	
	SetdwId(group.dwGroupId);
	m_byFlag = group.byFlag;
	SetstrCreateName(group.strCreateName);
	SetstrName(group.strGroupName);
	SetdwCredit(group.dwCredit);
	SetwLevel(group.wLevel);
	if (group.strMember == "") // for create new group
	{
		SGroupMember tmpMember;
		tmpMember.dwUserId = group.dwUserId;
		tmpMember.dwCredit = 0;
		tmpMember.byPosion = E_GA_PRESIDENT;
		tmpMember.dwCreditSupport = 0;
		m_mapUserGroup[group.dwUserId] = tmpMember;

		SetwPersionNumber(1);
		SetdwMissionFlushPoint(time(NULL));
		uint32_t remain = GetNextTimeEveryDay(GlobalConfig::FlashMission, m_dwMissionFlushPoint) - m_dwMissionFlushPoint; 
		SetdwMissionFlushTime(remain);
	}
	else
	{
		ByteBuffer tmp,tmpMember;
		tmp.append(group.strContent.data(), group.strContent.size());
		tmpMember.append(group.strMember.data(), group.strMember.size());
		if (DeserializeDB(tmp, tmpMember))
		{
			IME_ERROR("DeserializeDB fail userid %u, groupid %u", group.dwUserId, group.dwGroupId); 
			return false;
		}

		time_t now = time(NULL);
		if (now >= GetNextTimeEveryDay(GlobalConfig::FlashMission, m_dwMissionFlushPoint)) 
		{
			SetdwMissionFlushPoint(now);
			SetbyMissionFlushNumber(0);
			MissionFlush();
		}
		uint32_t remain = GetNextTimeEveryDay(GlobalConfig::FlashMission, m_dwMissionFlushPoint) - m_dwMissionFlushPoint;
		SetdwMissionFlushTime(remain);
	}
	if (LoadConf())
	{
		IME_ERROR("loadconf fail userid %u, groupid %u", group.dwUserId, group.dwGroupId); 
		return false;
	}
	if (Calculate())
	{
		IME_ERROR("calculate fail userid %u, groupid %u", group.dwUserId, group.dwGroupId);
		return false;
	}

	IME_LOG("group id %u, group name %s, create userid %u create name %s "
			"credit %u, level %u, persion limit %u,", 
			m_dwId, m_strName.c_str(), m_dwCreateId, m_strCreateName.c_str(), m_dwCredit, m_wLevel, m_wPersionLimit);
	for (int i = 0; i < m_vecPosion5Persion.size(); i++)
	{
		IME_LOG("%u userid %u ", i, m_vecPosion5Persion[i].get<uint32_t>());
	}
	IME_LOG("persion number %u, strNotice %s, need credit %u, credit limit %u ",
			m_wPersionNumber, m_strNotice.c_str(), m_dwNeedCredit, m_dwCreditLimit);
	std::map<uint32_t, SGroupMember>::iterator it;
	for (it = m_mapUserGroup.begin(); it != m_mapUserGroup.end(); it++)
	{
		IME_LOG("userid %u, credit %u, position %u", it->first, it->second.dwCredit, it->second.byPosion);
	}
	return true;
}		/* -----  end of method CGroup::Init  ----- */