コード例 #1
0
ファイル: SendReceiveData.cpp プロジェクト: Quasier77/WinLIRC
int SendReceiveData::decodeCommand(char *out) {

	//==================
	UINT outCode;
	char buttonName[32];
	//==================

	outCode = irCode & 0x7F;

	switch(outCode) {
		
		case 12:	strcpy_s(buttonName,"POWER");	break;

		case 63:	strcpy_s(buttonName,"0");	break;
		case 1:		strcpy_s(buttonName,"1");	break;
		case 2:		strcpy_s(buttonName,"2");	break;
		case 3:		strcpy_s(buttonName,"3");	break;
		case 4:		strcpy_s(buttonName,"4");	break;
		case 5:		strcpy_s(buttonName,"5");	break;
		case 6:		strcpy_s(buttonName,"6");	break;
		case 7:		strcpy_s(buttonName,"7");	break;
		case 8:		strcpy_s(buttonName,"8");	break;
		case 9:		strcpy_s(buttonName,"9");	break;

		case 40:	strcpy_s(buttonName,"REC_TV");	break;
		case 38:	strcpy_s(buttonName,"GUIDE");	break;
		case 37:	strcpy_s(buttonName,"LIVE_TV");break;

		case 35:	strcpy_s(buttonName,"BACK");	break;
		case 15:	strcpy_s(buttonName,"MORE");	break;

		case 30:	strcpy_s(buttonName,"UP");		break;
		case 31:	strcpy_s(buttonName,"DOWN");	break;
		case 32:	strcpy_s(buttonName,"LEFT");	break;
		case 33:	strcpy_s(buttonName,"RIGHT");	break;
		case 34:	strcpy_s(buttonName,"OK");		break;

		case 17:	strcpy_s(buttonName,"VOL-");	break;
		case 16:	strcpy_s(buttonName,"VOL+");	break;
		case 19:	strcpy_s(buttonName,"CH/PG-");	break;
		case 18:	strcpy_s(buttonName,"CH/PG+");	break;

		case 23:	strcpy_s(buttonName,"RECORD");	break;
		case 13:	strcpy_s(buttonName,"MCE");	break;
		case 25:	strcpy_s(buttonName,"STOP");	break;
		case 11:	strcpy_s(buttonName,"MENU");	break;

		case 21:	strcpy_s(buttonName,"<<");		break;
		case 24:	strcpy_s(buttonName,"||");		break;
		case 20:	strcpy_s(buttonName,">>");		break;
		case 10:	strcpy_s(buttonName,"ESC");	break;

		case 27:	strcpy_s(buttonName,"|<<");	break;
		case 22:	strcpy_s(buttonName,"PLAY");	break;
		case 26:	strcpy_s(buttonName,">>|");	break;
		case 14:	strcpy_s(buttonName,"MUTE");	break;

		case 93:	strcpy_s(buttonName,"*");		break;
		case 74:	strcpy_s(buttonName,"CLEAR");	break;
		case 92:	strcpy_s(buttonName,"#");		break;

		case 98:	strcpy_s(buttonName,"MOUSE_BUTTON_LEFT");	break;
		case 79:	strcpy_s(buttonName,"MOUSE_BUTTON_RIGHT");break;

		case 94:	strcpy_s(buttonName,"MOUSE_UP");	break;
		case 95:	strcpy_s(buttonName,"MOUSE_DOWN");	break;
		case 96:	strcpy_s(buttonName,"MOUSE_LEFT");	break;
		case 97:	strcpy_s(buttonName,"MOUSE_RIGHT");break;

		case 100:	strcpy_s(buttonName,"HELP");		break;
		case 36:	strcpy_s(buttonName,"DVD_MENU");	break;
		case 99:	strcpy_s(buttonName,"FULLSCREEN");	break;
		case 106:	strcpy_s(buttonName,"ENTER");		break;

		default: {
			irCode	= 0;
			repeats = 0;
			return 0;
		}

	}

	lastValue	= irCode;
	irCode		= 0;

	_snprintf_s(out,PACKET_SIZE+1,PACKET_SIZE+1,"%016llx %02x %s %s\n",__int64(0),repeats,buttonName,"MaxterPlus");

	return 1;

}
コード例 #2
0
//加载ini配置文件
BOOL CServerGameDesk::LoadIni()
{
	CString s = CINIFile::GetAppPath ();/////本地路径
	CINIFile f( s +GET_SKIN_FOLDER(szTempStr) +"_s.ini");
	CString key = TEXT("game");

	m_iBaseNote = f.GetKeyVal(key,"BaseNote",1);				//底注		
	if(m_iBaseNote<1)
	{
		m_iBaseNote=1;
	}
	m_byBTime = f.GetKeyVal(key,"BeginTime",30);				//开始时间
	if(m_byBTime<10)
	{
		m_byBTime=10;
	}
	m_bySCTime = f.GetKeyVal(key,"SCtime",120);					//发牌时间
	m_byTTime = f.GetKeyVal(key,"ThinkTime",30);				//游戏思考时间
	if(m_byTTime<10)
	{
		m_byTTime=10;
	}
	m_byRTime = f.GetKeyVal(key,"ResultTime",15);				//结算后等待时间
	if(m_byRTime<10)
	{
		m_byRTime=10;
	}
	m_iAllCardCount = f.GetKeyVal(key,"cardcount",54);

	m_iGoodCard  =  f.GetKeyVal(key,"iGoodCard",0);

	m_bHaveKing  = f.GetKeyVal(key,"HaveKing",1);				//是否有王

	m_bWriteLog = f.GetKeyVal(key,"WriteLog",false);

	//--add-by-dwj-20121203------
	m_bAIWinAndLostAutoCtrl = f.GetKeyVal(key,"AIWinAndLostAutoCtrl",0);		//机器人输赢控制20121122dwj
	m_iAIWantWinMoneyA1	= f.GetKeyVal(key,"AIWantWinMoneyA1 ",__int64(500000));		/**<机器人赢钱区域1  */
	m_iAIWantWinMoneyA2	= f.GetKeyVal(key,"AIWantWinMoneyA2 ",__int64(5000000));		/**<机器人赢钱区域2  */
	m_iAIWantWinMoneyA3	= f.GetKeyVal(key,"AIWantWinMoneyA3 ",__int64(50000000));		/**<机器人赢钱区域3  */
	m_iAIWinLuckyAtA1	= f.GetKeyVal(key,"AIWinLuckyAtA1 ",90);				/**<机器人在区域1赢钱的概率  */
	m_iAIWinLuckyAtA2	= f.GetKeyVal(key,"AIWinLuckyAtA2 ",70);				/**<机器人输赢控制:机器人在区域2赢钱的概率  */
	m_iAIWinLuckyAtA3	= f.GetKeyVal(key,"AIWinLuckyAtA3 ",50);				/**<机器人输赢控制:机器人在区域3赢钱的概率  */
	m_iAIWinLuckyAtA4	= f.GetKeyVal(key,"AIWinLuckyAtA4 ",30);				/**<机器人输赢控制:机器人在区域4赢钱的概率  */
	m_iAddMoneyEveryDay	= f.GetKeyVal(key,"AddMoneyEveryDay ",__int64(0));	/**<机器人输赢控制:机器人每日在赢钱A1、A2、A3区域递增的钱的数值  */
	m_iAIHaveWinMoney	= f.GetKeyVal(key,"AIHaveWinMoney ",__int64(0));	/**<机器人输赢控制:直接从配置文件中读取机器人已经赢钱的数目  */
	m_iReSetAIHaveWinMoney	= f.GetKeyVal(key,"ReSetAIHaveWinMoney ",__int64(0)); //记录重置机器人赢钱数,如果游戏过程中改变了就要改变机器人赢钱数;

	//赔率配置
	CString keyName;
	for (int i=0; i<MAX_SHAPE_COUNT; i++)
	{
		keyName.Format("CardShape%d",i);
		m_bCardShapeBase[i]=f.GetKeyVal(key,keyName,1);
		if(m_bCardShapeBase[i]<1)
		{
			m_bCardShapeBase[i] = 1;
		}
		
	}
	m_iCardShape &=0x00000000;
	m_iCardShape |= (f.GetKeyVal(key,"Yn",0)&0xFFFFFFFF);//银牛
	m_iCardShape |= ((f.GetKeyVal(key,"Jn",0)<<1)&0xFFFFFFFF);//金牛
	m_iCardShape |= ((f.GetKeyVal(key,"Bomb",0)<<2)&0xFFFFFFFF);//炸弹
	m_iCardShape |= ((f.GetKeyVal(key,"Five",0)<<3)&0xFFFFFFFF);//五小

	m_Logic.SetCardShape(m_iCardShape);
	
	return true;
}
コード例 #3
0
ファイル: CommonAceDef.hpp プロジェクト: DavidPulido/Contruct
long ExtObject::cmn_eGetFilter(LPVAL params, ExpReturn& ret)
{ 
	return ret = __int64(info.pInfo->filter.getCOLORREF());
}
コード例 #4
0
ファイル: hwprof.cpp プロジェクト: csentelle/simplexsvm
void CHWProfile::dumpprint(ProxyStream& os, int Hide)const
{
	if(First == NULL)
	{
		::dumpprint(os,"\n\r=========== Profile empty ============\n\r");
		return;
	}
	
	::dumpprint(os,"\n\r=========== Profile ==================\n\r");

	__int64 All = 0;
	int Count = 0;
	CHWProfileEntry* That;
	for(CHWProfileEntry* That = First; That; That = That->Next)
	{              
		if(That->Line >= 0)
		{
			Count++;
    		All += That->xTicks;
		};
    }

	CHWProfileEntry** Map = new CHWProfileEntry*[Count];

	Count = 0;	
	for(That = First; That; That = That->Next)
	{         
		if(That->Line >= 0)
		{	
			int i = 0;
			for (i=0; i<Count && Map[i]->xTicks > That->xTicks; i++);
			for (int j=Count; j>i; j--)
				Map[j] = Map[j-1];
			Map[i] = That;
			Count++;
		};
	};

	__int64 ShowTime = All;
	__int64 TimeNotShown = All;
	int ShowCount = Count;
	if(Hide>0)
		ShowTime -= All/Hide;
	else if(-Hide > 0 && -Hide < Count)
		ShowCount = -Hide;
	int LFileName = 0;

	int i = 0;
	for(i = 0; i < ShowCount && ShowTime > 0; i++)
	{
		That = Map[i];
		__int64 xTicks = That->xTicks;
		if(xTicks < 0) xTicks = 0;
		ShowTime -= xTicks;
		TimeNotShown -= xTicks;
		int iLFileName = (int)::strlen(That->FileName);

		if(LFileName < iLFileName) 
			LFileName = iLFileName;
	};
	ShowCount = i;
	
	for(i = 0; i < ShowCount; i++)
	{
		That = Map[i];
		__int64 xTicks = That->xTicks;
		if(xTicks < 0) xTicks = 0;
		::dumpprint(os,That->FileName);
		::dumpprint(os,"(");
		int LLine = ::dumpprint(os,That->Line);
		::dumpprint(os,"):");
		
		int Spaces = LFileName + 6 - (int)::strlen(That->FileName) - LLine;
		while(Spaces > 0)
		{
			::dumpprint(os," ");
			--Spaces;
		};

		::dumpprint(os,i);
		::dumpprint(os,":\t");
		int LCalls = ::dumpprint(os,That->Calls);
		::dumpprint(os,"x");
		while(LCalls++ < 6)	::dumpprint(os," ");
		::dumpprint(os,"\t");
		::dumpprinttime(os,xTicks, That->Calls);
		::dumpprint(os," \t");
		::dumpprinttime(os,xTicks, 1);
		::dumpprint(os," \t");
		::dumpprint(os,__int64(100.0*float(xTicks) / float(All)));
		::dumpprint(os,"%\t");
		::dumpprint(os,That->Flag);
		::dumpprint(os,"\n\r");
	};

	delete Map;

	::dumpprint(os,"Total: \t");
	::dumpprinttime(os,All, 1);
	
	if(i < Count) 
	{
		::dumpprint(os," (");
		::dumpprint(os,Count-i);
		::dumpprint(os," not-shown-items ");
		::dumpprinttime(os,TimeNotShown,1);
		::dumpprint(os,")");
	};

	::dumpprint(os,"\n\r======================================\n\r");
	
};
コード例 #5
0
static __int64 getDiff(FILETIME before, FILETIME after)
{
    __int64 i0 = (__int64(before.dwHighDateTime) << 32) + before.dwLowDateTime;
    __int64 i1 = (__int64( after.dwHighDateTime) << 32) +  after.dwLowDateTime;
    return i1 - i0;
}
コード例 #6
0
ファイル: BookmarkDlg.cpp プロジェクト: KB3NZQ/hexedit4
void CBookmarkDlg::OnValidate() 
{
	int move_count = 0;      // Number of bookmarks moved due to being past EOF

	CWaitCursor wc;
	CBookmarkList *pbl = theApp.GetBookmarkList();
	int fcc = grid_.GetFixedColumnCount();
	range_set<int> tt;                  // the grid rows to be removed

	for (int row = grid_.GetFixedRowCount(); row < grid_.GetRowCount(); ++row)
	{
		int index = grid_.GetItemData(row, fcc + COL_NAME);
		CDocument *pdoc;
		ASSERT(index > -1 && index < int(pbl->file_.size()));

		if (theApp.m_pDocTemplate->MatchDocType(pbl->file_[index], pdoc) == 
			CDocTemplate::yesAlreadyOpen)
		{
			// Bookmarks are checked when we open the document so we don't need to validate again here
			// (Ie this bookmark was checked when the file was opened.)
#if 0
			// The file is open so we need to check that the bookmark is <= the
			// in-memory file length which may be different to the on-disk length.
			if (pbl->filepos_[index] > ((CHexEditDoc *)pdoc)->length())
			{
				TRACE2("Validate: removing %s, file %s (loaded) is too short\n", pbl->name_[index], pbl->file_[index]);
				pbl->Remove(index);
				tt.insert(row);
			}
#endif
		}
		else if (_access(pbl->file_[index], 0) != -1)
		{
			// File found but make sure the bookmark is <= file length
			CFileStatus fs;                 // Used to get file size

			if (CFile64::GetStatus(pbl->file_[index], fs) &&
				pbl->filepos_[index] > __int64(fs.m_size))
			{
				TRACE2("Validate: moving %s, file %s is too short\n", pbl->name_[index], pbl->file_[index]);
				pbl->filepos_[index] = fs.m_size;
				UpdateRow(index, row);
				++move_count;
				// pbl->RemoveBookmark(index);
				// tt.insert(row);
			}
		}
		else
		{
			ASSERT(pbl->file_[index].Mid(1, 2) == ":\\"); // GetDriveType expects "D:\" under win9x

			// File not found so remove bookmark from the list
			// (unless it's a network/removeable file and net_retain_ is on)
			bool net_retain = ((CButton *)GetDlgItem(IDC_NET_RETAIN))->GetCheck() == BST_CHECKED;
			if (!net_retain || ::GetDriveType(pbl->file_[index].Left(3)) == DRIVE_FIXED)
			{
				TRACE2("Validate: removing bookmark %s, file %s not found\n", pbl->name_[index], pbl->file_[index]);
				pbl->RemoveBookmark(index);
				tt.insert(row);
			}
		}
	}

	// Now remove the rows from the display starting from the end
	range_set<int>::const_iterator pp;

	// Remove elements starting at end so that we don't muck up the row order
	for (pp = tt.end(); pp != tt.begin(); )
		grid_.DeleteRow(*(--pp));
	grid_.Refresh();

	if (move_count > 0 || tt.size() > 0)
	{
		CString mess;

		mess.Format("%ld bookmarks were deleted (files missing)\n"
					"%ld bookmarks were moved (past EOF)",
					long(tt.size()), long(move_count));
		AfxMessageBox(mess);
	}
	else
		AfxMessageBox("No bookmarks were deleted or moved.");
}
コード例 #7
0
ファイル: sltime.cpp プロジェクト: tradejs/TradeCpp
sltimespan::sltimespan(long lDays, int nHours, int nMins, int nSecs) throw()
{
	m_timeSpan = nSecs + 60* (nMins + 60* (nHours + __int64(24) * lDays));
}
コード例 #8
0
ファイル: remote_keyboard.cpp プロジェクト: jhp1900/WorkDemo
LRESULT RemoteKeyboard::OnUpdateStatus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandle)
{
	static bool _last_enabled = true;
	bool _enable = (wParam != 0);
	unsigned int _check_value = (unsigned int)(lParam);
	TCHAR name[32];

	if (_last_enabled != _enable) {
		_last_enabled = _enable;
		for (int i = 1;; ++i) {
			_stprintf_s(name, sizeof(name) / sizeof(TCHAR), _T("rkbc_%02d"), i);
			if (!EnableControl(name, _last_enabled))
				break;
		}
	}

	if (_last_enabled) {
		unsigned int _recode_status = _check_value & 0x3;
		unsigned int _ch_status = (_check_value >> 2) & 0xf;
		unsigned int _director_status = (_check_value >> 6) & 0x3;

		for (int i = 1; i < 14; ++i) {
			_stprintf_s(name, sizeof(name) / sizeof(TCHAR), _T("rkbc_%02d"), i);

			if (i < 4) {
				EnableControl(name, _recode_status != i);
			} else if (i < 12) {
				EnableControl(name, _ch_status != i - 3);
			} else {
				EnableControl(name, _director_status != i - 11);
			}
		}
	}

	auto _GetExtendInfoWrap = [this](byte* &pBuf, long &nSize) -> boolean {
		boolean ret = false;

		RpcTryExcept
			ret = rkbc_GetExtendInfo(m_hwBinding, kExtendType_LessionInfo, __int64(m_lession_info_checksum), &pBuf, &nSize);
		RpcExcept(1)
			ret = false;
		RpcEndExcept

			return ret;
	};

	/* 如果同步排课界面不处于显示状态,则不刷新 */
	if (!m_PaintManager.FindControl(_T("sync_panel"))->IsVisible())	 
		return 0;
	byte *pBuf = 0;
	long nSize = 0;
	if (_enable && _GetExtendInfoWrap(pBuf, nSize) && pBuf) {
		auto const &items = g_LessionMappingTable;

		pugi::xml_document doc;
		if (doc.load(LPCTSTR(pBuf))) {
			pugi::xml_node elem = doc.child(_T("lesson"));
			if (elem) {
				for (int i = 0; i < _countof(items); ++i) {
					DuiLib::CControlUI *ctrl;
					if (ctrl = m_PaintManager.FindControl(items[i].name))
						ctrl->SetText(elem.attribute(items[i].attr).as_string());
				}

				m_lession_info = LPCTSTR(pBuf);
				boost::crc_32_type result;
				result.process_bytes(reinterpret_cast<const byte *>(m_lession_info.data()), (m_lession_info.size() + 1) * sizeof(wchar_t));
				m_lession_info_checksum = result.checksum();
			}
		}
		midl_user_free(pBuf);
	}

	return LRESULT();
}
コード例 #9
0
ファイル: BookmarkDlg.cpp プロジェクト: KB3NZQ/hexedit4
// Given a bookmark (index) and a row in the grid control (row) update
// the row with the bookmark info and (optionally) select the row
void CBookmarkDlg::UpdateRow(int index, int row, BOOL select /*=FALSE*/)
{
	CBookmarkList *pbl = theApp.GetBookmarkList();

	int fcc = grid_.GetFixedColumnCount();

#if 0
	// If the file is already open we have to check the document to get the latest position
	if (last_file_ != pbl->file_[index])
	{
		if (theApp.m_pDocTemplate->MatchDocType(pbl->file_[index], pdoc_) != 
			CDocTemplate::yesAlreadyOpen)
		{
			pdoc_ = NULL;
		}
		last_file_ = pbl->file_[index];
	}
#endif

	GV_ITEM item;
	item.row = row;
	item.mask = GVIF_STATE|GVIF_FORMAT|GVIF_TEXT|GVIF_PARAM;
	item.nState = GVIS_READONLY;
	if (select) item.nState |= GVIS_SELECTED;

	struct tm *timeptr;             // Used in displaying dates
	char disp[128];

	// Split filename into name and path
	int path_len;                   // Length of path (full name without filename)
	path_len = pbl->file_[index].ReverseFind('\\');
	if (path_len == -1) path_len = pbl->file_[index].ReverseFind('/');
	if (path_len == -1) path_len = pbl->file_[index].ReverseFind(':');
	if (path_len == -1)
		path_len = 0;
	else
		++path_len;

	int ext_pos = pbl->file_[index].ReverseFind('.');
	if (ext_pos < path_len) ext_pos = -1;              // '.' in a sub-directory name

	for (int column = 0; column < COL_LAST; ++column)
	{
		item.col = column + fcc;

		switch (column)
		{
		case COL_NAME:
			item.nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			item.strText = pbl->name_[index];
			item.lParam = index;
			break;
		case COL_FILE:
			item.nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			item.strText = pbl->file_[index].Mid(path_len);
			item.lParam = (LONGLONG)grid_.GetCell(item.row, fcc + COL_LOCN);
			break;
		case COL_LOCN:
			item.nFormat = DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			item.strText = pbl->file_[index].Left(path_len);
			item.lParam = (LONGLONG)grid_.GetCell(item.row, fcc + COL_POS);
			break;
		case COL_POS:
			item.nFormat = DT_RIGHT|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			FILE_ADDRESS addr;
			if (pdoc_ != NULL)
				addr = __int64(((CHexEditDoc *)pdoc_)->GetBookmarkPos(index));
			else
				addr = __int64(pbl->filepos_[index]);
			sprintf(disp, "%I64d", addr);
			item.strText = disp;
			::AddCommas(item.strText);
			item.lParam = addr;          // lParam is now 64 bit
			break;
		case COL_MODIFIED:
			item.nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			if ((timeptr = localtime(&pbl->modified_[index])) == NULL)
				item.strText = "Invalid";
			else
			{
				strftime(disp, sizeof(disp), "%c", timeptr);
				item.strText = disp;
			}
			item.lParam = pbl->modified_[index];
			break;
		case COL_ACCESSED:
			item.nFormat = DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS;
			if ((timeptr = localtime(&pbl->accessed_[index])) == NULL)
				item.strText = "Invalid";
			else
			{
				strftime(disp, sizeof(disp), "%c", timeptr);
				item.strText = disp;
			}
			item.lParam = pbl->accessed_[index];
			break;
		default:
			ASSERT(0);
		}

		// Make sure we don't deselect a row that was already selected
		if (column == 0 && !select && (grid_.GetItemState(row, 0) & GVIS_SELECTED) != 0)
			item.nState |= GVIS_SELECTED;

		grid_.SetItem(&item);
	}
	grid_.RedrawRow(row);
}
コード例 #10
0
MightyTimeSpan::MightyTimeSpan(LONG lDays, int nHours, int nMins, int nSecs) throw()
{
	m_timeSpan = nSecs + 60* (nMins + 60* (nHours + __int64(24) * lDays));
}
コード例 #11
0
ファイル: dibgrit.cpp プロジェクト: raindropmedia/y60
void CDIBGrItem::drawClippedNoAlpha
( PLBmp * pCanvas,
  CRect * pRect
)
// Draws the object. pRect must have been clipped already.
{
    PLBYTE * pDest;
    PLBYTE * pSrc;
    PLBYTE * pSrcStart;
    PLBYTE * pAlpha = NULL;

    // Invisible.
    if (m_Opacity < 3)
        return;

    PLBYTE ** pDestLineArray = pCanvas->GetLineArray();
    PLBYTE ** pSrcLineArray = m_pBmp->GetLineArray();

    // Calculate Loop invariants.
    double YScale = (double)(m_pBmp->GetHeight())/m_h;
    int ys = (int)(YScale*65536);
    int SrcLineNum;

    double XScale = (double)(m_pBmp->GetWidth())/m_w;
    int xs = (int)(XScale*65536)*4;

    __int64 Alpha = __int64(m_Opacity) + (__int64(m_Opacity)<<16)
                    + (__int64(m_Opacity)<<32) + (__int64(m_Opacity)<<48);
    int SrcStart = ((pRect->left-m_x)*xs)<<16;
    __int64 Negator = 0x00ff00ff00ff00ff;
    int LoopStart = pRect->left-m_x;
    int LoopLen = pRect->right-pRect->left+1;

    for (int sy = pRect->top; sy<pRect->bottom; sy++)
    {   // For each line

        pDest = pDestLineArray[sy] + pRect->left*4;
        SrcLineNum = (int)((sy-m_y)*ys)>>16;
        pSrc = pSrcLineArray[SrcLineNum];
        pSrcStart = pSrc+SrcStart;

        __asm
        {
            mov ecx, LoopLen

            mov edi, pDest
            mov edx, 0

            // Set up constants.
            mov esi, pSrcStart

            movq mm3, Alpha
            movq mm4, mm3
            movq mm6, Negator
            pxor mm4, mm6
            pxor mm0, mm0

            startofloop:
            ALIGN 16
            // Load source, do alpha calc.
            movd mm1, [esi]
            add edi, 4
            punpcklbw mm1, mm0
            // Load destination, do neg. alpha calc.
            movd mm2, [edi-4]
            // Calc source address for next iteration.
            add edx, xs
            punpcklbw mm2, mm0
            mov esi, edx
            pmullw mm1, mm3
            shr esi, 16
            pmullw mm2, mm4
            add esi, pSrcStart
            and esi, 0xfffffffc

            paddusw mm1, mm2
            psrlw mm1, 8

            // Write results back.
            packuswb mm1, mm0
            movd [edi-4], mm1

            dec ecx
            jnz startofloop

        }
    }
    __asm         emms
}
コード例 #12
0
ファイル: dibgrit.cpp プロジェクト: raindropmedia/y60
inline void CDIBGrItem::drawAlphaLine
( PLBYTE * pDest,
  PLBYTE * pSrc,
  CRect * pRect
)
// Draws one line. No scaling. Assumes alpha channel exists.
{

    PLBYTE * pSrcStart = pSrc+(pRect->left-m_x)*4;
    __int64 Alpha = __int64(m_Opacity) + (__int64(m_Opacity)<<16)
                    + (__int64(m_Opacity)<<32) + (__int64(m_Opacity)<<48);
    __int64 Negator = 0x00ff00ff00ff00ff;
    int LoopLen = pRect->right-pRect->left+1;

    __asm
    {
        mov ecx, LoopLen

        mov edi, pDest

        // Set up constants.
        mov esi, pSrcStart

        movq mm7, Alpha
        movq mm6, Negator
        pxor mm0, mm0

        // Calculate current alpha.
        movzx eax, byte ptr [esi+PL_RGBA_ALPHA]
        mov ebx, eax
        shl ebx, 8
        or  ebx, eax
        shl ebx, 8

        startofloop:
        ALIGN 16
        or  ebx, eax
        // Load source, do alpha calc.
        movd mm1, [esi]
        movd mm3, ebx
        add edi, 4
        punpcklbw mm3, mm0
        punpcklbw mm1, mm0
        pmullw mm3, mm7
        // Load destination, do neg. alpha calc.
        movd mm2, [edi-4]
        add esi, 4
        psrlw mm3, 8
        punpcklbw mm2, mm0
        pmullw mm1, mm3
        pxor mm3, mm6
        pmullw mm2, mm3
        dec ecx
        je endofloop

        // Calculate alpha for next iteration
        movzx eax, byte ptr [esi+PL_RGBA_ALPHA]

        paddusw mm1, mm2
        mov ebx, eax
        psrlw mm1, 8
        shl ebx, 8

        // Write results back.
        packuswb mm1, mm0
        or  ebx, eax
        movd [edi-4], mm1
        shl ebx, 8
        jmp startofloop
        endofloop:

    }
}
コード例 #13
0
ファイル: threadinfo.cpp プロジェクト: VerySleepy/verysleepy
static __int64 getTotal(FILETIME time)
{
	return (__int64(time.dwHighDateTime) << 32) + time.dwLowDateTime;
}
コード例 #14
0
RESLT COutputReader::OpenOutputFile(TCHAR *FileName)
{
	DWORD bytes;
	//int i;
	//SPECIESBINOUTINF speInf;
	CEnvironmentData bath;
	CEnvironmentData salt;
	CEnvironmentData temp;
	//DWORD filePointer;
	//RESLT res;
	//BOOL rslt;

	if(m_hdl != NULL && m_hdl != INVALID_HANDLE_VALUE)
		CloseOutputFile();

	m_hdl = CreateFile(FileName, GENERIC_READ, NULL, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, 0);
	if(m_hdl == INVALID_HANDLE_VALUE)
		return OPENFILEREAD_ERROR;


	if(FALSE == ReadFile(m_hdl, &m_sceParams, sizeof(_fSCENARIOPARAMS), &bytes, NULL))
	{
		CloseOutputFile();
		return FILEREAD_ERROR;
	}

	//CloseOutputFile();
	return OK;

	// Not sure about what follows
# if 0

	m_binOutputConfig = CFileManager::TranslateBinFileOutConfiguration(m_sceParams.binOutStateItemConfig);

	// Read in the bathymetry file (if the scenario was configured to save it).
	if(m_binOutputConfig.headerInf.bathyMap == TRUE && OK != (res = bath.LoadFromBinFile(m_hdl)))
	{
		CloseOutputFile();
		return res;
	}

	// Read in the salinity file (if the scenario was configured to save it).
	if(m_binOutputConfig.headerInf.salinityMap == TRUE && OK != (res = salt.LoadFromBinFile(m_hdl)))
	{
		CloseOutputFile();
		return res;
	}

	// Read in the temperature file (if the scenario was configured to save it).
	if(m_binOutputConfig.headerInf.temperatureMap == TRUE && OK != (res = temp.LoadFromBinFile(m_hdl)))
	{
		CloseOutputFile();
		return res;
	}

	// Skip past statistical data if scenario was configured to save it.
	if(m_binOutputConfig.headerInf.postRunAnalysis == TRUE)
	{
		filePointer = MySetFilePointer(m_hdl, sizeof(TAKE), FILE_CURRENT);
		filePointer = MySetFilePointer(m_hdl, sizeof(TAKESTATS)*m_sceParams.numSpecies, FILE_CURRENT);
	}

	// Read in species model information (if the scenario was configured to save it).
	if(m_binOutputConfig.headerInf.speInfAndAnimatAsscn == TRUE)
	{
		_ASSERT(m_speInf == NULL);
		_ASSERT(m_aniAssoc == NULL);
		m_speInf = new SPECIESBINOUTINF[m_sceParams.numSpecies];
		m_aniAssoc = new ANIMATASSCN[m_sceParams.totalNumAnimats];

		// Skip over minor species information
		for(i=0; i<(int)m_sceParams.numSpecies && rslt == TRUE; i++)
		{
			if(FALSE == (rslt = ReadFile(m_hdl, &m_speInf[i], sizeof(SPECIESBINOUTINF), &bytes, NULL)))
				return FILEREAD_ERROR;

			// Skip past the behavior names that belong to this species.
			filePointer = MySetFilePointer(m_hdl, __int64(m_speInf[i].description.numBehaviors) * sizeof(BEHAVIOR_NAME), FILE_CURRENT);
			if(INVALID_SET_FILE_POINTER == filePointer)
				return SETFILEPOINTER_ERROR;
		}

		// Read in animat summaries/association to species.
		rslt &= ReadFile(m_hdl, m_aniAssoc, m_sceParams.totalNumAnimats * sizeof(ANIMATASSCN), &bytes, NULL);
			return FILEREAD_ERROR;
	}

	// Skip over acoustic exposures, get the file pointer for animat states (- 1 
	// to number of iterations because because an initial AE isn't saved).




	m_filePointerAnimats =
		MySetFilePointer(m_hdl, __int64(m_sceParams.duration-1) * sizeof(ACST_SRC_STATE), FILE_CURRENT);
	if(INVALID_SET_FILE_POINTER == filePointer)
		return SETFILEPOINTER_ERROR;

	return OK;
#endif
}