Ejemplo n.º 1
0
BOOL CBCGPRegistry::Read(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	ASSERT(m_hKey);

	BOOL	bSucess = FALSE;
	BYTE*	pData = NULL;
	UINT	uDataSize;

	Read (pszKey, &pData, &uDataSize);

	try
	{
		if (pData != NULL && m_Info.lMessage == ERROR_SUCCESS && m_Info.dwType == REG_BINARY)
		{
			CMemFile file (pData, uDataSize);
			CArchive ar (&file, CArchive::load);

			ar.m_bForceFlat = FALSE;
			ASSERT(ar.IsLoading());

			CDWordArray dwcArray;
			ASSERT(dwcArray.IsSerializable());
			dwcArray.Serialize(ar);
			ar.Close();

			if (dwcArray.GetSize() == 2)
			{
				lpPoint->x = dwcArray.GetAt(0);
				lpPoint->y = dwcArray.GetAt(1);

				bSucess = TRUE;
			}
		}
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPRegistry::Read ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CBCGPRegistry::Read ()!\n"));
	}

	m_Info.dwType = REG_POINT;
	m_Info.dwSize = sizeof(POINT);

	if (pData != NULL)
	{
		delete [] pData;
		pData = NULL;
	}

	return bSucess;
}
Ejemplo n.º 2
0
//加HP,MP
void addHpMp(bool isheordz)
{
	//wgdebug("====================加HP MP=======================%d\n",0);
    int hp, mp;
	int addHpValue,addMpValue;
	DWORD jnID;
	ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x254), &hp, 4, 0);
	ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x258), &mp, 4, 0);
    if (dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_JH))
    {
		addHpValue =  dlxiaoDllDlg->GetDlgItemInt(IDC_EDIT_HONG);
        if (hp <= addHpValue)
        {
			if(isheordz){
				if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISJNADDHP) && mp > 10 ){ 
					if( addhpjnidx > -1 ){
						ReadProcessMemory(PID, (LPCVOID)(jnPointerArray.GetAt(addhpjnidx) + 0x8), &jnID, 4, 0);
						if(jnID){
							CallUserSkill(jnID,rwId);
							Sleep(300);
						}else{
							if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
								dazuo();
							}
						}
					}else{
						if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
							dazuo();
						}
					}	
				}else if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ)){
					dazuo();
				}
			}else{
				AddRed();
			}
        }
    }
	
    if (dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_JL))
    {
		addMpValue =  dlxiaoDllDlg->GetDlgItemInt(IDC_EDIT_LANG);
        if (mp <= addMpValue)
        {
			if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISDZ) && isheordz){
				dazuo();
			}else{
				AddBlue();
			}
		}
    }
	
	//wgdebug("====================END 加HP MP=======================%d\n",0);
}
Ejemplo n.º 3
0
void addfz()
{
	int fzjnCount =0;
	int jnID;
	if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISFZJN)){
		ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x118), &fzjnCount, 4, 0);
		if(fzjnCount == 0){
			if( fzjnidx > -1 ){
				ReadProcessMemory(PID, (LPCVOID)(jnPointerArray.GetAt(fzjnidx) + 0x8), &jnID, 4, 0);
				if(jnID){
					CallUserSkill(jnID,rwId);
				}
			}
		}
	}
}
Ejemplo n.º 4
0
BOOL CRegistry::Read(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	ASSERT(m_hKey);
	const int iMaxChars = 20;
	CDWordArray dwcArray;
	DWORD dwType;
	DWORD dwData = iMaxChars;
	BYTE* byData = (BYTE*)::calloc(iMaxChars, sizeof(TCHAR));
	ASSERT(byData);

	LONG lReturn = RegQueryValueEx(m_hKey, pszKey, NULL, &dwType,
		byData, &dwData);

	if(lReturn == ERROR_SUCCESS && dwType == REG_BINARY)
	{
		ASSERT(dwData < iMaxChars);
		CMemFile file(byData, dwData);
		CArchive ar(&file, CArchive::load);
		ar.m_bForceFlat = FALSE;
		ASSERT(ar.IsLoading());
		ASSERT(dwcArray.IsSerializable());
		dwcArray.RemoveAll();
		dwcArray.SetSize(5);
		dwcArray.Serialize(ar);
		ar.Close();
		file.Close();
		lpPoint->x = dwcArray.GetAt(0);
		lpPoint->y = dwcArray.GetAt(1);
	}

	m_Info.lMessage = lReturn;
	m_Info.dwType = REG_POINT;
	m_Info.dwSize = sizeof(POINT);

	if(byData)
	{
		free(byData);
		byData = NULL;
	}

	if(lReturn == ERROR_SUCCESS)
		return TRUE;

	return FALSE;
}
Ejemplo n.º 5
0
void CCLLKDlg::StartNewGame(void)
{
	CTime t=CTime::GetCurrentTime();
	tGameTime=t;
	strTiShi1="系统时间:"+t.Format("%H:%M:%S");
	m_StatusBar.SetText(strTiShi1,2,0);
	strTiShi2.Format(" 该局时间:00:00:00");
	m_StatusBar.SetText(strTiShi2,1,0);
	strTiShi3.Format("当前游戏:%d行%d列%d种方块",m_nRow-2,m_nCol-2,m_Kind);
	m_StatusBar.SetText(strTiShi3,0,0);

	delete[] m_map;
	m_map=new int[m_nCol*m_nRow];
	for (int iNum=0;iNum<(m_nCol*m_nRow);iNum++)
	{
		m_map[iNum]=BLANK_STATE;
	}
	srand(time(NULL));
	CDWordArray tmpMap;

	for (int i=0;i<(m_nRow-2)*(m_nCol-2)/2;i++)
	{
		int x=rand()%m_Kind;
		tmpMap.Add(x);
		tmpMap.Add(x);

	}

	for (int i=1;i<(m_nCol-1);i++)
	{
		for (int j=1;j<(m_nRow-1);j++)
		{
			INT_PTR nIndex=(int(rand()*0.1+rand()*0.01+rand()))%tmpMap.GetSize();
			m_map[i+j*m_nCol]=tmpMap.GetAt(nIndex);
			tmpMap.RemoveAt(nIndex);

		}
	}
	Invalidate(false);
}
Ejemplo n.º 6
0
// When starting a mouse-key select, the anchor point, and all contiguous 
// selections that are not in the path of the current item can remain 
// selected.  All other selections are tossed, like Exploder does.
void CMultiSelTreeCtrl::DoKeyedDeselect( BOOL scrollingDown )
{
	CDWordArray keepSet;
	HTREEITEM currentItem= m_AnchorItem;
	
	// Record the contiguous selection's we're keeping
	keepSet.Add( (DWORD) m_AnchorItem );
	while(1)
	{
		if( scrollingDown )
			currentItem= GetPrevSiblingItem( currentItem);
		else
			currentItem= GetNextSiblingItem( currentItem);

		if( currentItem == NULL || !IsSelected( currentItem ) )
			break;

		keepSet.Add( (DWORD) currentItem );
	}

	// Unselect everything
	//
	int i;
	for( i= m_SelectionSet.GetSize()-1; i >= 0; i-- )
	{
		currentItem= (HTREEITEM) m_SelectionSet.GetAt(i);	
		// Undo any display atts
		SetItemState(currentItem, 0, TVIS_CUT | TVIS_BOLD | TVIS_SELECTED);
	}

	// Then select everything in the keepset
	//
	m_SelectionSet.RemoveAll();
	for( i= keepSet.GetSize()-1; i>=0; i-- )
		SetSelectState( (HTREEITEM) keepSet.GetAt(i), TRUE );

	m_PendingKeyedDeselect= FALSE;
	ShowNbrSelected();
}
//***************************************************************************************
BOOL CBCGPXMLSettings::Read(LPCTSTR pszKey, LPPOINT& lpPoint)
{
	BOOL	bSucess = FALSE;
	BYTE*	pData = NULL;
	UINT	uDataSize;

	if (!Read (pszKey, &pData, &uDataSize))
	{
		ASSERT (pData == NULL);
		return FALSE;
	}

	ASSERT (pData != NULL);

	try
	{
		CMemFile file (pData, uDataSize);
		CArchive ar (&file, CArchive::load);

		CDWordArray dwcArray;
		dwcArray.SetSize(5);
		dwcArray.Serialize (ar);
		lpPoint->x = dwcArray.GetAt(0);
		lpPoint->y = dwcArray.GetAt(1);
		bSucess = TRUE;
	}
	catch (CMemoryException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("Memory exception in CBCGPXMLSettings::Read ()!\n"));
	}
	catch (CArchiveException* pEx)
	{
		pEx->Delete ();
		TRACE(_T("CArchiveException exception in CBCGPXMLSettings::Read ()!\n"));
	}

	return TRUE;
}
Ejemplo n.º 8
0
BOOL CWindowGroups::ArrangeWindows(CWnd *pParentWindow)
{
	int i;
	RECT rect = { 0, 0, 0, 0 };

	const DWORD dwYStep = static_cast<DWORD>(NewGUI_Scale(WG_Y_STEP, pParentWindow));

	CDWordArray aPos;
	aPos.RemoveAll();

	const DWORD dwXOffset = static_cast<DWORD>(NewGUI_Scale(WG_OFFSET_LEFT, pParentWindow));
	const DWORD dwYOffset = static_cast<DWORD>(NewGUI_Scale(WG_OFFSET_TOP, pParentWindow));
	for(i = 0; i < m_aWindows.GetSize(); i++) aPos.Add(dwYOffset);

	for(i = 0; i < m_aWindows.GetSize(); i++)
	{
		if((m_aFlags.GetAt(i) & WGF_REPOSITION) == 0) continue;

		CWnd *p = (CWnd *)m_aWindows.GetAt(i);

		if(p != NULL)
		{
			p->GetWindowRect(&rect);
			rect.right = rect.right - rect.left; // Coords to sizes
			rect.bottom = rect.bottom - rect.top;
		}
		rect.top = (LONG)aPos.GetAt((int)m_aGroupIDs.GetAt(i));
		rect.left = dwXOffset;

		if(p != NULL)
			p->MoveWindow(rect.left, rect.top, rect.right, rect.bottom, TRUE);

		aPos.SetAt((int)m_aGroupIDs.GetAt(i), (DWORD)rect.top + dwYStep);
	}

	aPos.RemoveAll();
	return TRUE;
}
Ejemplo n.º 9
0
void CSynBCGPEditView::GetUndoActions( CStringList& lstActions ) const
{
	CDWordArray dwaUAT;
	m_pEdit->GetUndoActions(dwaUAT);

	lstActions.RemoveAll();

	int nIndex = (int)dwaUAT.GetSize();
	if ( nIndex != 0)
	{
		CString strAction;

		while (nIndex--)
		{
			strAction.Empty();

			switch (dwaUAT.GetAt(nIndex) & UAT_REASON) 
			{
			case g_dwUATUndefined:
				strAction.LoadString(IDS_STRING_UAT_UNDEF);
				break;

			case g_dwUATTyping:
				strAction.LoadString(IDS_STRING_UAT_TYPE);
				break;

			case g_dwUATCut:
				strAction.LoadString(IDS_STRING_UAT_CUT);
				break;

			case g_dwUATPaste:
				strAction.LoadString(IDS_STRING_UAT_PASTE);
				break;

			case g_dwUATDelete:
				strAction.LoadString(IDS_STRING_UAT_DEL);
				break;

			case g_dwUATBackspace:
				strAction.LoadString(IDS_STRING_UAT_BACK);
				break;

			case g_dwUATDragDrop:
				strAction.LoadString(IDS_STRING_UAT_DRAG);
				break;

			case g_dwUATEnter:
				strAction.LoadString(IDS_STRING_UAT_ENTER);
				break;

			case g_dwUATIndent:
				strAction.LoadString(IDS_STRING_UAT_INDENT);
				break;		

			case g_dwUATUnindent:
				strAction.LoadString(IDS_STRING_UAT_UNINDENT);
				break;

			case g_dwUATTab:
				strAction.LoadString(IDS_STRING_UAT_TAB);
				break;		

			case g_dwUATReplace:
				strAction.LoadString(IDS_STRING_UAT_REP);
				break;
			case g_dwUATComment:
				strAction.LoadString(IDS_STRING_UAT_COMM);
				break;
			case g_dwUATUncomment:
				strAction.LoadString(IDS_STRING_UAT_UNCOMM);
				break;
			case g_dwUATFormatter:
				strAction.LoadString(IDS_STRING_UAT_TIDY);
				break;
			default:
				strAction.LoadString(IDS_STRING_UAT_UNDEF);
			}			

			if (strAction.IsEmpty())
			{
				ASSERT(FALSE);
				strAction = _T("<?>");
			}

			lstActions.AddHead(strAction);
		}
	}
}
Ejemplo n.º 10
0
bool
EmbedeedFontMan::AddFont(const CString sFontFolder, const CString sFontName){
	CString sDir = sFontFolder;
	if( sDir.GetAt(sDir.GetLength() - 1) != '\\' )
		sDir += _T("\\");

	EmbedeedFont* pFont = new EmbedeedFont();

	// Load characters code map. {{
	BYTE*	lpContent	= NULL;
	int		nSize		= 0;
	if( Path::ReadFileContent(sDir + _T("codes.txt"), lpContent, nSize) && nSize > 0 ){
		CString sContent;
		memcpy(sContent.GetBufferSetLength(nSize), lpContent, nSize);

		CStringArray arrStrings;
		StringHelper::Split(&sContent, _T(";"), arrStrings);

		CString sCharCode;
		for(int i=0; i<arrStrings.GetCount(); i++){
			sCharCode		= arrStrings.GetAt(i);
			int nCharCode	= 0;
			// Hex value
			if( sCharCode.GetAt(0) == '#' )
				nCharCode = StringHelper::HexStringIntoInt(&((TCHAR*)sCharCode.GetBuffer())[1], sCharCode.GetLength() - 1);
			else
				nCharCode = _ttoi(sCharCode.GetBuffer());
			pFont->m_arrCharacters.Add((void*)nCharCode, (void*)i);
			}
		}
	else{
#ifdef _DEBUG
		CString sMsg;
		sMsg.Format(_T("Couldn't find %s"), sDir + _T("codes.txt"));
		AfxMessageBox(sMsg);
#endif
		if( lpContent )
			delete [] lpContent;
		delete pFont;
		return false;
		}
	// }}

	if( lpContent ){
		delete [] lpContent;
		lpContent = NULL;
		}

	CStringArray arrFileNames;
	if( Path::GetFilesByExtention(sDir, _T("*.bmp"), arrFileNames, true) == 0 ){
		delete pFont;
		return false;
		}
	
	for(int i=0; i<arrFileNames.GetCount(); i++){
		CString sName = arrFileNames.GetAt(i);
		CString sName2 = sName;
		CString sFile = sDir + sName;

		if( sName.Left(sFontName.GetLength()) != sFontName )
			continue; // Skip wrong file name.

		sName.Delete	(0, sFontName.GetLength());
		sName.MakeLower	();

		int nIndex = 0;
		EmbedeedFontItemInfo* pInfo = new EmbedeedFontItemInfo();
		pInfo->ZeroInit();

		// Bold
		if( sName.GetAt(nIndex) == 'b' ){
			pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_BOLD;
			nIndex ++;
			}
		// Underline
		if( sName.GetAt(nIndex) == 'u' ){
			pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_UNDERLINE;
			nIndex ++;
			}
		// Italic
		if( sName.GetAt(nIndex) == 'i' ){
			pInfo->m_nCharFlags |= EmbedeedFontItemInfo::EMBEDEED_FONT_FLAG_ITALIC;
			nIndex ++;
			}

		// Load characters map image and detect characters left offset and width (in pixels). {{
		CImage* pImage = ImageHelper::LoadImage(sFile, -1, -1, false);
		if( pImage ){
			BITMAP bmImage;
			GetObject(*pImage, sizeof(BITMAP), &bmImage);

			int			nWidthLimit				= bmImage.bmWidth;
			int			nSymbolCt				= 0;
			BYTE*		pBits					= (BYTE*)bmImage.bmBits;
			int			nXOffset				= 0;
			int			nBPP					= bmImage.bmBitsPixel/8;
			int			nSymbolMostLeftOffset	= -1;
			int			nSymbolMostRightOffset	= -1;
			CDWordArray arrSymbolLeftOffsetAndWidth;
			CString		sSymbolStartPointAndWidth;

			int nMaxXOffset = bmImage.bmWidth;
			for(int x=nXOffset; x<nMaxXOffset; x++){
				bool bClearLine = true;
				for(int y=0; y<bmImage.bmHeight; y++){
					BYTE* pLineStartingBits = &pBits[((bmImage.bmHeight - y - 1)*bmImage.bmWidthBytes)];
					BYTE* pPixel			= &pLineStartingBits[x*nBPP];

					// Is pixel visible.
					if( pPixel[0] > 10 ){
						bClearLine = false;
						if( nSymbolMostLeftOffset > -1 )
							nSymbolMostRightOffset = x;
						else
							nSymbolMostLeftOffset = x;
						continue;
						}
		
					pPixel = &pPixel[nBPP];
					}

				if( bClearLine && nSymbolMostLeftOffset > -1 ){
					if( nSymbolMostRightOffset == -1 )
						nSymbolMostRightOffset = nSymbolMostLeftOffset;
					DWORD dwCombineVal = (nSymbolMostLeftOffset << 16) | ((nSymbolMostRightOffset - nSymbolMostLeftOffset + 1)&0xFFFF);
					arrSymbolLeftOffsetAndWidth.Add(dwCombineVal);

#ifdef _DEBUG
					CString sFormat;
					sFormat.Format(_T("%d:%d;"), nSymbolMostLeftOffset, nSymbolMostRightOffset - nSymbolMostLeftOffset + 1);
					sSymbolStartPointAndWidth += sFormat;
#endif
					nSymbolMostLeftOffset	= -1;
					nSymbolMostRightOffset	= -1;
					}
				}

			pInfo->m_imageCharacters.Attach(pImage->Detach());
			delete pImage;

			if( (arrSymbolLeftOffsetAndWidth.GetCount() == pFont->m_arrCharacters.GetCount()) ){
				pInfo->m_pCharPoints = new CPoint[arrSymbolLeftOffsetAndWidth.GetCount()];
				for(int j=0; j<arrSymbolLeftOffsetAndWidth.GetCount(); j++){
					DWORD dwCombineVal = arrSymbolLeftOffsetAndWidth.GetAt(j);
					pInfo->m_pCharPoints[j].x = (int)(dwCombineVal>>16);
					pInfo->m_pCharPoints[j].y = (int)(dwCombineVal&0xFFFF);
					}
				}
			else{
#ifdef _DEBUG
				CBitmap bmImg;
				ImageHelper::CreateDIBBitmap(pInfo->m_imageCharacters.GetBPP(), bmImg, RGB(0, 0, 0), pInfo->m_imageCharacters.GetWidth(),
					pInfo->m_imageCharacters.GetHeight()*2, 0);

				CDC memDC;
				memDC.CreateCompatibleDC(NULL);
				::SelectObject(memDC, bmImg.m_hObject);

				CDC srcDC;
				srcDC.CreateCompatibleDC(NULL);
				::SelectObject(srcDC, pInfo->m_imageCharacters);
				memDC.BitBlt(0, 0, pInfo->m_imageCharacters.GetWidth(), pInfo->m_imageCharacters.GetHeight(), &srcDC, 0, 0, SRCCOPY);

				int nHeight = pInfo->m_imageCharacters.GetHeight();
				for(int j=0; j<arrSymbolLeftOffsetAndWidth.GetCount(); j++){
					DWORD dwCombineVal = arrSymbolLeftOffsetAndWidth.GetAt(j);
					int nLeft = (int)(dwCombineVal>>16);
					int nWidth = (int)(dwCombineVal&0xFFFF);

					memDC.FillSolidRect(nLeft, nHeight, nWidth, nHeight, RGB(255, 255, 0));
					}

				DeleteFile(sDir + _T("__") + sName2);
				CImage img;
				img.Attach((HBITMAP)bmImg.Detach());
				img.Save(sDir + _T("__") + sName2);
				img.Destroy();
				
				CString sMsg;
				sMsg.Format(_T("Characters count is not the same for font '%s' item '%s'"), sFontName, sName);
				AfxMessageBox(sMsg);
#endif
				delete pInfo;
				continue;
				}

			pInfo->m_nCharCount = arrSymbolLeftOffsetAndWidth.GetCount();
			}
Ejemplo n.º 11
0
UINT GjThreadProc(LPVOID lpParamter)
{ 
    DWORD isSelectGw = 0;
	DWORD gwPoint,one;
	int gwId =0;
	int hp = 0;
	int jnID;
	float rwgwjl;//人物与怪物的距离
	BYTE isUsejn;//技能是否能使用
	
	float gwx,gwy;
	while (isGjFlag)
    {
		ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x254), &hp, 4, 0);
		if(hp == 0){
			dead();
		}else{
			addHpMp(false);
			ReadProcessMemory(PID, (LPCVOID)(rwBaseAddr + 0x7b8), &isSelectGw, 4, 0);
			if (isSelectGw == 0)
			{
				if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISSELL)){
					bagfull();
				}
				Pick();
				addHpMp(true);
				addfz();
				dingdian();
				gwPoint = getGwPoint();
				if(gwPoint != 0){
					ReadProcessMemory(PID,(LPCVOID)(gwPoint+8),&gwId,4,0);
					if (gwId != 0 )
					{
						CallSelectGw(gwId);
					}
				}
				
			}
			else
			{
				CallNormal();
				readRwXY();
				ReadProcessMemory(PID, (LPCVOID)(gwPoint + 0x4), &one, 4, 0);
                ReadProcessMemory(PID, (LPCVOID)(one + 0x3C), &gwx, sizeof(FLOAT), 0);
                ReadProcessMemory(PID, (LPCVOID)(one + 0x44), &gwy, sizeof(FLOAT), 0);
				rwgwjl = sqrtf(powf((rwX - gwx), 2) + powf((rwY - gwy), 2));
				if(dlxiaoDllDlg->IsDlgButtonChecked(IDC_CHECK_ISUSERJN) && (rwgwjl <= 3) &&  usejnidx > -1){
					ReadProcessMemory(PID, (LPCVOID)(jnPointerArray.GetAt(usejnidx) + 0x8), &jnID, 4, 0);
					if(jnID){
						ReadProcessMemory(PID, (LPCVOID)(jnPointerArray.GetAt(usejnidx) + 0xC), &isUsejn, 1, 0);
						if(isUsejn == 0){	
							CallUserSkill(jnID,gwId);
						}
					}
				}
				Sleep(500);
			}
		}
	}
 
return (0);
}