Beispiel #1
0
void version_updateVersionString()
{
	int length;

	// Release build
	if(build_release)
	{
		length = _cprintf(version_releaseFormat, build_version);
		Vars.pszD2bsVersionString = (char*)malloc(length+1);
		_snprintf_s(Vars.pszD2bsVersionString, length+1, length, version_releaseFormat, build_version);
	}
	// Unofficial build
	else if(vcRev_revNumber == -1)
	{
		length = strlen(version_unofficialBuild);
		Vars.pszD2bsVersionString = (char*)malloc(length+1);
		strcpy_s(Vars.pszD2bsVersionString, length+1, version_unofficialBuild);
	}
	// Revly build
	else
	{
		length = _cprintf(version_revlyFormat, vcRev_revNumber);
		Vars.pszD2bsVersionString = (char*)malloc(length+1);
		_snprintf_s(Vars.pszD2bsVersionString, length+1, length, version_revlyFormat, vcRev_revNumber);
	}
}
bool CLoginDialog::registration(){

	CString phone, name, email;
	int country=((CComboBox*) GetDlgItem(IDC_COUNTRY))->GetCurSel();
	GetDlgItemText(IDC_PHONE,phone);
	GetDlgItemText(IDC_NAME,name);
	GetDlgItemText(IDC_EMAIL,email);

	std::string header = "/oneworld/webreg?country=";
	header+=countries[country][2];
	header+="&number=";
	header+=(CT2CA)phone;
	header+="&name=";
	header+=(CT2CA)name;
	header+="&email=";
	header+=(CT2CA)email;
	header+="&countrycode=";
	header+=countries[country][2];

	CInternetSession session;
	CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
	char result[500];
	CString request(header.c_str());
	CHttpFile *pFile = pConnection->OpenRequest(1,request);
	if(!pFile->SendRequest())
		return false;
	//pFile->QueryInfo(HTTP_QUERY_FLAG_REQUEST_HEADERS,result,(LPDWORD)500);
	
#ifdef _DEBUG
	pFile->Read((void*)result,500);
	_cprintf("%s",result);
#endif

	CString rest(result);
	int start=rest.Find(_T("success\":\""));
	if(start<0)
		return false;
	start+=((CString)_T("success\":\"")).GetLength();
	int end=rest.Find(_T("\""),start);
	if(end<0)
		return false;
	CString success=rest.Mid(start, end-start);
#ifdef _DEBUG
	_cprintf("%s",(CT2CA)success);
	_cprintf("%s",result);
#endif
	start=rest.Find(_T("msg\":\""));
	start+=((CString)_T("msg\":\"")).GetLength();
	end=rest.Find(_T("\""),start);
	CString msg=rest.Mid(start, end-start);
	SetDlgItemText(IDC_LOGTEXT,msg);
	Sleep(2000);

	return true;
}
bool CLoginDialog::pinReminder(){
	CString username, email;
	int country=((CComboBox*) GetDlgItem(IDC_COUNTRY))->GetCurSel();
	std::string userPhone=countries[country][1];
	userPhone.erase(std::find(userPhone.begin(), userPhone.end(), '+'));
	userPhone.erase(std::find(userPhone.begin(), userPhone.end(), '-'));
	GetDlgItemText(IDC_PHONE,username);
	username=(CString)userPhone.c_str()+username;
	GetDlgItemText(IDC_EMAIL,email);


	std::string header = "/oneworld/forgotpin?number=";
		header+=(CT2CA)username;
		header+="&email=";
		header+=(CT2CA)email;

	CInternetSession session;
	CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
	char result[500];
	CString request(header.c_str());
	CHttpFile *pFile = pConnection->OpenRequest(1,request);
	if(!pFile->SendRequest())
		return false;
	//pFile->QueryInfo(HTTP_QUERY_FLAG_REQUEST_HEADERS,result,(LPDWORD)500);
	
#ifdef _DEBUG
	pFile->Read((void*)result,500);
	_cprintf("%s",result);
#endif

	return true;

}
Beispiel #4
0
int con_printf(char *fmt,...)
{
#ifdef LINUX

  va_list marker;
  int     i;
	
  va_start(marker,fmt);
  i = vwprintw(stdscr,fmt,marker);
  va_end(marker);
  
  refresh();
  return i;

#else

  va_list marker;
  char buf[256];

  va_start(marker, fmt);       /* Initialize variable arguments. */
  vsprintf(buf,fmt,marker);
  va_end(marker);              /* Reset variable arguments.      */

  fflush(stdout);              /* Empty the output buffer */

  return _cprintf(buf);

#endif
}
Beispiel #5
0
int _CRTAPI1  Z_cprintf (const char* Arg1, DWORD64ARGS)
{

    int RetVal;

    SHORT sTimerHandle;
    ULONG ulElapsedTime;

    if (fInitDone == FALSE) {
        ApfInitDll();
    }
    TimerOpen(&sTimerHandle, MICROSECONDS);
    TimerInit(sTimerHandle);
    //
    // Call the api
    //
    RetVal = _cprintf(Arg1, ARGS64);
    //
    // Get the elapsed time
    //
    ulElapsedTime = TimerRead(sTimerHandle);
    ApfRecordInfo(I__cprintf, ulElapsedTime - ApfData[I_CALIBRATE].ulFirstTime);
    TimerClose(sTimerHandle);

    return(RetVal);
}
Beispiel #6
0
int con_printf_xy(uint xpos, uint ypos, char *fmt,...)
{
#ifdef LINUX

  va_list marker;
  int     i;

  move(ypos-1, xpos-1);     
  refresh();
	
  va_start(marker,fmt);
  i = vwprintw(stdscr,fmt,marker);
  va_end(marker);
  
  refresh();
  return i;

#else

  va_list marker;
  char buf[256];

  gotoxy(xpos, ypos);            /* Set the cursor position */
 
  va_start(marker, fmt);         /* Initialize variable arguments. */
  vsprintf(buf,fmt,marker); 
  va_end(marker);                /* Reset variable arguments.      */

  fflush(stdout);                /* Empty the output buffer */

  return _cprintf(buf); 

#endif
}
Beispiel #7
0
/*比對*/
void CModel::OnOK()
{   
	void* MilModel;
	CString path;
	DOUBLE OffsetX = 0;
	DOUBLE OffsetY = 0;
	MilModel = malloc(sizeof(int));
	GetModuleFileName(NULL, path.GetBufferSetLength(MAX_PATH + 1), MAX_PATH);
	path.ReleaseBuffer();
	int pos = path.ReverseFind('\\');
	path = path.Left(pos) + _T("\\Temp\\");
	LPTSTR lpszText = new TCHAR[path.GetLength() + 1];
	lstrcpy(lpszText, path);
	int iSelPos = m_ModelList.GetNextItem(-1, LVIS_SELECTED);
#ifdef PRINTF
	_cprintf("%d", iSelPos);
#endif
#ifdef VI
	if (iSelPos != -1)
	{
		VI_LoadModel(MilModel, lpszText, AllModelName.at(iSelPos));
		VI_SetPatternMatch(MilModel, 1, 1, 80, 0, 360);
		VI_FindMark(MilModel, OffsetX, OffsetY);
		VI_ModelFree(MilModel);
		free(MilModel);
	}
#endif
#ifdef MOVE
	MO_Do3DLineMove((LONG)OffsetX, (LONG)OffsetY, 0, 30000, 100000, 6000);
#endif
	//CDialogEx::OnOK();
}
void CLoginDialog::OnBnClickedSave()
{
	m_Account.rememberPassword=((CButton*) GetDlgItem(IDC_SAVE))->GetCheck();
#ifdef _DEBUG
	_cprintf("Clicked!\n%d\n",m_Account.rememberPassword);
#endif
}
void Conference::OnDelete()
{
	
	CListCtrl *list= (CListCtrl*)GetDlgItem(IDC_CONFLIST);
	POSITION pos = list->GetFirstSelectedItemPosition();
	CString confNum;
	if (pos)
	{
		int i = list->GetNextSelectedItem(pos);
		//Call *pCall = (Call *) list->GetItemData(i);
		confNum=list->GetItemText(i,0);
	}
	if(confNum.GetLength()==0)
		return;

	std::string header = "/oneworld/conf_del?api_token=";
	header+=((CmicrosipDlg*)GetParent())->getToken();
	header+="&confno=";
	header+=(CT2CA)confNum;

#ifdef _DEBUG
	_cprintf("Request: %s\n",header);
#endif

	CInternetSession session;
	CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
	char result[500];
	CString request(header.c_str());
	CHttpFile *pFile = pConnection->OpenRequest(1,request);
	if(!pFile->SendRequest())
		return;
	pFile->Read((void*)result,500);
	char* status = strchr(result,']'); //checking if data is receive and is parseable
	char* eom = strchr(result,'}');
#ifdef _DEBUG
	_cprintf("Size: %p, %p, %d\n",result, status, (status-result));
#endif
	if(status==NULL)
		result[eom-result+1]='\0';
	else if(status - result < 498)
		result[status - result +2]='\0';
#ifdef _DEBUG
	_cprintf("Result: %s\n",result);
#endif
	LoadList();
}
Beispiel #10
0
double process_state( holdem_state* pstate ) 
{
	if (pstate!=NULL) {	m_holdem_state[ (++m_ndx)&0xff ] = *pstate; }

	_cprintf("state: %d\n", m_ndx&0xff);

	return 0;
}
void SpectraVFSCached::Read( size_t _nSpectraIndex, Spectra *_pDestination, bool bAsyncRead )
{
	_cprintf("disk.read\n");
	assert( _pDestination != NULL );

	size_t nBytesToRead = TOTALCACHELINEBYTES;

	// check out of array bounds
	if ( _nSpectraIndex >= m_nNumberOfSpectra )
	{
		assert(0);
		// total missed the bounds -> skip
		return;
	}

	// check for cacheline cropping
	if ( _nSpectraIndex+SpectraVFS::CACHELINESIZE >= m_nNumberOfSpectra )
	{
		// pre condition: _nIndex < m_nNumberOfSpectra 
		nBytesToRead = (m_nNumberOfSpectra-_nSpectraIndex)*SPECTRASIZE;
	}

	DWORD ndwBytesToRead = static_cast<DWORD>(nBytesToRead);

	uint64_t nOffset = static_cast<uint64_t>(_nSpectraIndex)*SPECTRASIZE;
	uint32_t nOffsetLow, nOffsetHigh;
	Helpers::UInt64toHiLow( nOffset, nOffsetLow, nOffsetHigh );
	m_IOHandle.set( nOffsetLow, nOffsetHigh );

	BOOL bReadSuccess = FALSE;

#ifdef SPECTRAVFS_ASYNC_IO
	bReadSuccess = ReadFileEx( m_FileHandle, _pDestination, ndwBytesToRead, &m_IOHandle.m_overlapped, &SpectraVFSCached::ReadFinished );

	if ( !bAsyncRead )
	{
		WaitForIO( m_IOHandle );
	}
#else
	DWORD ndwBytesRead;

	bReadSuccess = ReadFile( m_FileHandle, _pDestination, ndwBytesToRead, &ndwBytesRead, &m_IOHandle.m_overlapped );

	if ( ndwBytesRead != ndwBytesToRead )
	{
		Helpers::print( std::string("SpectraVFSCached::Read Error: not all bytes read.\n"), &m_logFile );
		assert(0);
	}
#endif

	if ( bReadSuccess == FALSE )
	{	
		DWORD err = GetLastError();
		Helpers::print( std::string("SpectraVFSCached::Read Error:")+Helpers::numberToString<DWORD>(err)+std::string("\n"), &m_logFile );
	}
}
Beispiel #12
0
//Subtracts two integers given as parameters.
int sub(int arg1, int arg2) {
	int result;
_asm {
	mov eax, arg1
	mov ebx, arg2
	sub eax,ebx
	mov result,eax
}
_cprintf("The Subtraction Yields: %d",result);				//Outputs the result
}
Beispiel #13
0
void CLog::Put( const TCHAR* text, ... ) const
{
	TCHAR buffer[ MAX_PATH * 5 ] = { 0 };

	va_list vl;
	va_start( vl, text );
	vsprintf( buffer, text, vl );
	va_end( vl );

	_cprintf( "%d\t%s\n", GetTickCount(), buffer );
}
Beispiel #14
0
void prtchar(byte c)
{
#if defined(__TS_LINUX__)
  addch((char) c);
#elif defined(__TS_DOS__)
  cprintf("%c", c);
#elif defined(__WINDOWS__)
	_cprintf("%c", c);
#else
# error Please define 'prtchar' for your target system.
#endif
}
void Conference::OnBnClickedConfsubmit()
{

	std::string header = "/oneworld/conf_create?api_token=";
	header+=((CmicrosipDlg*)GetParent())->getToken();
	header+="&pin=";
	CString pinNum;
	GetDlgItemText(IDC_CONFPIN,pinNum);
	header+=(CT2CA)pinNum;
	header+="&length=0";
	CInternetSession session;
	CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
	char result[500];
	CString request(header.c_str());
	CHttpFile *pFile = pConnection->OpenRequest(1,request);
	if(!pFile->SendRequest())
		return;
	pFile->Read((void*)result,500);
	char* status = strchr(result,']'); //checking if data is receive and is parseable
	char* eom = strchr(result,'}');
#ifdef _DEBUG
	_cprintf("Size: %p, %p, %d\n",result, status, (status-result));
#endif
	if(status==NULL)
		result[eom-result+1]='\0';
	else if(status - result < 498)
		result[status - result +2]='\0';
#ifdef _DEBUG
	_cprintf("Result: %s\n",result);
#endif

	cJSON *root = cJSON_Parse(result);
	cJSON *success = cJSON_GetObjectItem(root,"success");

	
#ifdef _DEBUG
	_cprintf("Success: %s\n",success->valuestring);
#endif
	LoadList();
}
Beispiel #16
0
double GetSymbolFromDll( const char* name ) {
   bool iserr;
   int mychair = (int) GetSymbolFromDll(0,"userchair",iserr);
   double symb= GetSymbolFromDll(mychair,name,iserr);

   if(iserr) 
   {
      _cprintf("Error with requesting symbol %s",name);
      return -1;
   }

   return symb;
}
void VoucherDialog::OnBnClickedVouchSub()
{

	CString voucher, status;
	GetDlgItemText(IDC_VOUCH_ID, voucher);
	GetDlgItemText(IDC_STATUS, status);
	((CmicrosipDlg*)GetParent())->voucher=(CT2CA)voucher;
#ifdef _DEBUG
	_cprintf("%s\n",(CT2CA)voucher);
	_cprintf("%s\n",(CT2CA)status);
	_cprintf("parent: %s\n",((CmicrosipDlg*)GetParent())->voucher);
	_cprintf("parent: %s\n",((CmicrosipDlg*)GetParent())->token);
#endif
	status = ((CmicrosipDlg*)GetParent())->SubmitVoucher();
	if(status.GetLength()==0)
		SetDlgItemText(IDC_STATUS, L"Voucher record not found.");
	else{
		SetDlgItemText(IDC_STATUS, status);
		Sleep(2000);
		EndDialog(IDOK);
	}
}
void SpectraVFSCached::Write(  size_t _nSpectraIndex, Spectra *_pSource )
{
	_cprintf("disk.write\n");
	assert( _pSource != NULL );

	size_t nBytesToWrite = TOTALCACHELINEBYTES;

	// check out of array bounds
	if ( _nSpectraIndex >= m_nNumberOfSpectra )
	{
		// total missed the bounds -> skip
		return;
	}

	// check for cacheline cropping
	if ( _nSpectraIndex+SpectraVFS::CACHELINESIZE >= m_nNumberOfSpectra )
	{
		// pre condition: _nIndex < m_nNumberOfSpectra 
		nBytesToWrite = (m_nNumberOfSpectra-_nSpectraIndex)*SPECTRASIZE;
	}

	DWORD ndwBytesToWrite = static_cast<DWORD>(nBytesToWrite);

	uint64_t nOffset = static_cast<uint64_t>(_nSpectraIndex)*SPECTRASIZE;
	uint32_t nOffsetLow, nOffsetHigh;
	Helpers::UInt64toHiLow( nOffset, nOffsetLow, nOffsetHigh );

	IOHandle writeHandle;
	writeHandle.set( nOffsetLow, nOffsetHigh );

	BOOL bWriteSuccess = FALSE;

#ifdef SPECTRAVFS_ASYNC_IO
	bWriteSuccess = WriteFileEx( m_FileHandle, _pSource, ndwBytesToWrite, &writeHandle.m_overlapped, &SpectraVFSCached::ReadFinished );
	WaitForIO( writeHandle );
#else
	DWORD ndwBytesWritten;
	bWriteSuccess = WriteFile( m_FileHandle, _pSource, ndwBytesToWrite, &ndwBytesWritten, &writeHandle.m_overlapped );
	if ( ndwBytesWritten != ndwBytesToWrite )
	{
		Helpers::print( std::string("SpectraVFSCached::Write Error: not all bytes written.\n"), &m_logFile );
		assert(0);
	}
#endif

	if ( bWriteSuccess == FALSE )
	{
		DWORD err = GetLastError();
		Helpers::print( std::string("SpectraVFSCached::Write Error:")+Helpers::numberToString<DWORD>(err)+std::string("\n"), &m_logFile );
	}
}
void Conference::LoadList(){
	CListCtrl *conf= (CListCtrl*)GetDlgItem(IDC_CONFLIST);
	conf->DeleteAllItems();

	std::string header = "/oneworld/conf_list?api_token=";
	header+=((CmicrosipDlg*)GetParent())->getToken();
	CInternetSession session;
	CHttpConnection *pConnection = session.GetHttpConnection(_T("89.163.142.253"));
	char result[500];
	CString request(header.c_str());
	CHttpFile *pFile = pConnection->OpenRequest(1,request);
	if(!pFile->SendRequest())
		return;
	pFile->Read((void*)result,500);
	char* status = strchr(result,']'); //checking if data is receive and is parseable
	char* eom = strchr(result,'}');
#ifdef _DEBUG
	_cprintf("Size: %p, %p, %d\n",result, status, (status-result));
#endif
	if(status==NULL)
		result[eom-result+1]='\0';
	else if(status - result < 4998)
		result[status - result +2]='\0';
#ifdef _DEBUG
	_cprintf("Result: %s\n",result);
#endif

	cJSON *root = cJSON_Parse(result);
	cJSON *msg = cJSON_GetObjectItem(root,"msg");
	if((status==NULL && msg == NULL) || status-result >= 4999 )
		return;
	else if(status==NULL)
		return;
	cJSON *data = cJSON_GetObjectItem(root,"data");
	int size=cJSON_GetArraySize(root); 
	
#ifdef _DEBUG
	_cprintf("Size: %d\n",size);
#endif
	size=cJSON_GetArraySize(data); 
	
#ifdef _DEBUG
	_cprintf("Size: %d\n",size);
#endif
	for(int i=0;i<size;i++){
		cJSON* item= cJSON_GetArrayItem(data,i);
		CString confNum(cJSON_GetObjectItem(item,"confno")->valuestring);
		CString pin(cJSON_GetObjectItem(item,"pin")->valuestring);
#ifdef _DEBUG
		_cprintf("Item: %s\n",(CT2CA)confNum);
		_cprintf("Pin: %s\n",(CT2CA)pin);
#endif
		int index = conf->InsertItem(i, confNum);
		conf->SetItemText(index, 1, pin);
		//conf->SetItemData(i, &confNum);
	}
}
void Conference::OnContextMenu(CWnd* pWnd, CPoint point){
	int CtrlID = pWnd->GetDlgCtrlID();
#ifdef _DEBUG
		_cprintf("CtrlID: %d\n",CtrlID);
#endif
	if(CtrlID == IDC_CONFLIST){
		CMenu popupMenu;
		//popupMenu.LoadMenu(IDR_CONFMENU);
		popupMenu.LoadMenu(IDR_CONFMENU);
		CMenu* tracker = popupMenu.GetSubMenu(0);
		TranslateMenu(tracker->m_hMenu);
		tracker->EnableMenuItem(ID_JOIN, MF_ENABLED);
		tracker->EnableMenuItem(ID_COPY, MF_ENABLED);
		tracker->EnableMenuItem(ID_DELETE, MF_ENABLED);
		tracker->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_LEFTBUTTON, point.x, point.y, this );
	}
}
Beispiel #21
0
    void Profile::consoleOutput( const std::string &s )
    {

    #ifndef LINUX
      if( !triedAllocConsole )
      {
        triedAllocConsole = true;
        AllocConsole();
      }
      _cprintf("%s", s.c_str());
    #else
      std::cout << s;
    #if PROFILING_OUTPUT_FLUSH
      std::cout << std::flush;
    #endif
    #endif
    }
Beispiel #22
0
void Crecord_playerApp::animateObject(cVector3d force)
{
  // do stuff with force: relate force to torque applied about the disc axis

  // integrate torque
  cVector3d planeForce;
  planeForce.set(force.x, force.y, 0);

  // get position of proxy on plane, get vector from center to application point
  cProxyPointForceAlgo* forceAlgo = tool->getProxy();
  m_proxyPos = forceAlgo->getProxyGlobalPosition();
    m_proxyPos.sub(m_recordMesh->getGlobalPos());
  cVector3d radius;
  radius.set(m_proxyPos.x, m_proxyPos.y, 0);

  // do cross product
  cVector3d torqueVec;
  planeForce.crossr(radius, torqueVec);

  // call that the torque applied to the disc and compute new position
  m_torque = torqueVec.z;

  // do the math for how the rotational friction may affect the whole motion
  double time_step = 0.001;
  m_rotVel = m_rotVel + m_torque/m_inertia * time_step;
  m_rotPos = m_rotPos + m_rotVel * time_step;

    // set audio direction and frequency based on rotational velocity
  if (haptics_enabled && (fabs(m_rotVel)) > 0.0)
    {
        if (m_rotVel < 0.0) record_direction = 1;
        else record_direction = -1;
    BASS_ChannelSetAttributes(stream, (int)(info.freq*fabs(m_rotVel)/6.5), -1, -1); 
        if (!(BASS_ChannelPlay(stream,FALSE)))
          _cprintf("Play error %d\n", BASS_ErrorGetCode()); 
    }
    else
    {
        BASS_ChannelStop(stream);
    }

  // rotate object
  m_recordMesh->rotate(m_recordMesh->getRot().getCol2(), m_rotVel * time_step);
  m_recordMesh->computeGlobalPositions();
}
Beispiel #23
0
/*
 * Windows does console slightly different then then unix case.
 */
static int
read_string(const char *preprompt, const char *prompt,
    char *buf, size_t len, int echo)
{
	int of = 0;
	int c;
	char *p;

	void (*oldsigintr)(int);

	_cprintf("%s%s", preprompt, prompt);

	oldsigintr = signal(SIGINT, intr);

	p = buf;
	while (intr_flag == 0) {
		c = ((echo) ? _getche() : _getch());
		if ((c == '\n') || (c == '\r')) {
			break;
		}
		if (of == 0) {
			*p++ = c;
		}
		of = (p == buf + len);
	}
	if (of) {
		p--;
	}
	*p = 0;

	if (echo == 0) {
		printf("\n");
	}

	signal(SIGINT, oldsigintr);

	if (intr_flag) {
		return (-2);
	}
	if (of) {
		return (-1);
	}
	return (0);
}
Beispiel #24
0
void prtstr(char *fmt, ...)
{
  va_list vl;
  static char buffer[1000];

  va_start(vl, fmt);
  vsprintf_s(buffer, sizeof(buffer), fmt, vl);
  va_end(vl);
  
#if defined(__TS_LINUX__)
  addstr(buffer);
#elif defined(__TS_DOS__)
  cprintf("%s", buffer);
#elif defined(__WINDOWS__)
  _cprintf("%s", buffer);
#else
# error Please define 'prtstr' for your target system.
#endif
  update();
}
Beispiel #25
0
//<summary> ÊͷŲ¥·Å¾ä±ú
//<param >
//<return> trueΪ³É¹¦£¬false ʧ°Ü
AMPDISPLAYSDK_API bool __stdcall AMP_Display_FreeHandle(LONG lHandle)
{
	if (lHandle >= 1 && lHandle <= AMP_PLAY_MAX_SUPPORTS)
	{
		 CD3DDisplay *pChannel = pPlayChannel[lHandle];
		if(pChannel != NULL)
		{
#ifdef _DEBUG
			_cprintf(" *************free port %d \n",lHandle);
#endif

			delete pChannel;
			pPlayChannel[lHandle] = NULL;
			return TRUE;
		}
	}

	g_dwError = AMP_PLAY_PARA_ERROR;
	return FALSE;

}
Beispiel #26
0
void tryGWS(){
	bool isErr;
	char* HandNumber = GetHandnumberFromDll();
	int nChairs =  (int)GetSymbolFromDll(0, "nchairs", isErr);
	int betRound = (int)GetSymbolFromDll(0, "betround", isErr);
	int nchairs=  (int)GetSymbolFromDll(0, "nchairs", isErr);
	double sblind=  GetSymbolFromDll(0, "sblind", isErr);
	double bblind=  GetSymbolFromDll(0, "bblind", isErr);
	int userchair=  (int)GetSymbolFromDll(0, "userchair", isErr);

	_cprintf("HandNumber: %s \n", HandNumber);
	_cprintf("nChairs: %i \n", nChairs);
	_cprintf("betround: %i \n", betRound);
	_cprintf("nchairs: %i \n", nchairs);
	_cprintf("sblind: %.2f \n", sblind);
	_cprintf("bblind: %.2f \n", bblind);
	_cprintf("userchair: %i \n", userchair);

}
int PfmReader::ReadHeader(FILE* source)
{
	char buf[32];

	if (source == NULL) {
		_cprintf("Error! File not found! Press enter to quit...");
		return false;
	}

	fscanf(source, "%s", buf); //throw away, already assuming pfm format

	bool valid = false;

	/*if (strncmp(buf, "Pf", 2) == 0) {
		m_channels = 1;
		valid = true;
	}
	if (strncmp(buf, "PF", 2) == 0) {
		m_channels = 3;
		valid = true;
	}*/
	fscanf(source, "%d %d", &m_width, &m_height );
	fscanf(source, "%f", &m_scale );

	envpixels = new float[m_width*m_height*3];

	// Save the rewind position.
    //m_rewindPos = m_stream.Tell();

	// set up the Info structure on the parent
	/*m_info.availableTypes = ImageReader::Info::kTypeImage;
	m_info.width = m_width;
	m_info.height = m_height;
	m_info.planes = m_channels;
	m_info.layers = -1;
	m_info.clutEntries = -1;
	m_info.mips = -1;*/

	return m_width;
}
Beispiel #28
0
//<summary> »ñÈ¡²¥·Å¾ä±ú
//<param >
//<return> trueΪ³É¹¦£¬false ʧ°Ü
AMPDISPLAYSDK_API bool __stdcall AMP_Display_GetHandle(LONG &lHandle)
{

	for(int i=1; i<=AMP_PLAY_MAX_SUPPORTS; i++)
	{
		CD3DDisplay *pChannel = pPlayChannel[i];

		if(pChannel == NULL)
		{
			pPlayChannel[i] = new CD3DDisplay();

			lHandle = i;
#ifdef _DEBUG
				_cprintf(" *************return port %d \n",lHandle);
#endif
			return TRUE;
		}			
	}
	g_dwError = AMP_PLAY_OVER_CHANNEL;
	return FALSE;

}
Beispiel #29
0
static int
read_string(const char *preprompt, const char *prompt,
            char *buf, size_t len, int echo)
{
    int of = 0;
    int c;
    char *p;
    void (*oldsigintr)(int);

    _cprintf("%s%s", preprompt, prompt);

    oldsigintr = signal(SIGINT, intr);

    p = buf;
    while(intr_flag == 0) {
        c = ((echo)? _getche(): _getch());
        if(c == '\n' || c == '\r')
            break;
        if(of == 0)
            *p++ = c;
        of = (p == buf + len);
    }
    if(of)
        p--;
    *p = 0;

    if(echo == 0) {
        printf("\n");
    }

    signal(SIGINT, oldsigintr);

    if(intr_flag)
        return -2;
    if(of)
        return -1;
    return 0;
}
Beispiel #30
0
void initClient(){
	{	
		boost::shared_ptr<boost::asio::io_service::work> w(new boost::asio::io_service::work(IOS));		
					AllocConsole();
					client.connect(IOS,"localhost", "1234");
					boost::thread t(boost::bind (&boost::asio::io_service::run, &IOS));	
					_cprintf("Cliented connected to server at localhost:1234");
					t.detach();		
	}
	/*
	boost::asio::io_service io_service;
    TCP::Client client(io_service, "localhost", "1234");
    io_service.run();
	*/
	//boost::asio::io_service IOService;
	//TCP::CLIENT::TCPClient c(IOService);
	//tClient = new TCP::CLIENT::TCPClient(IOService);
	//c.Start(IOService);
	//tClient->Start(IOService); cprintf("INIT CLIENT CALLED \n");
	
	//GS_V.push_back( GAME::GS_ptr(new GAME::GState(IOService)));
	ClientStarted = true;
}