⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hong_sub.cpp

📁 国内著名网络游戏dragon的客户端登陆用完整源码 配套一起上传的服务端部分可开服 无说明文档
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	sprintf( temp,"save%04d.img", c);
	fp = Fopen( temp, "wb" );
	if( fp )
	{
		SaveAliasHeader( 640, 480, fp);
		for( int i = 0 ; i < SCREEN_HEIGHT ; i ++)
		{
			for( int j = 0 ; j < SCREEN_WIDTH * 2 ; j +=2)
			{
				if( _PixelInfo.BitMaskR != 0x7C00) // 555啊 酒聪搁.
				{
					r = (0xf800 & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))>> 8;
					g = (0x07c0 & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))>> 3;
					b = (0x001f & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))<< 3;
				}
				else 
				{
					r = (0x7c00 & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))>> 7;
					g = (0x03e0 & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))>> 2;
					b = (0x001f & *(unsigned short *)(g_DestBackBuf + i * dDxSize + j ))<< 3;
				}
				fputc( 1, fp);
				fwrite( &b, 1, 1, fp);
				fwrite( &g, 1, 1, fp);
				fwrite( &r, 1, 1, fp);
			}
			//fwrite( CTempvRamBuf + i * DxSize , ScreenXSize * ColorByte, 1, fp);
		}
		fclose(fp);
	}	
		
	c++;
	fp =Fopen( "capturescreen.tmp", "wt" );
	if( fp )
	{	
		fprintf( fp, "%d", c );
		fclose(fp);
	}	
}		
		
/*		
		31536000	= 1 year.
		2592000		= 1 month.
		86400		= 1 day.
		3600		= 1 hour.
		60			= 1 min.
*/		

void Log( char *msg, char *name, ... )
{
#ifdef _DEBUG
	
	if( GetSysInfo( SI_GAME_MAKE_MODE ) )
	{

		char temp[ FILENAME_MAX];
		va_list va;

		va_start( va, name );
		vsprintf( temp, name, va );
		va_end( va );
		FILE *fp;

		fp = Fopen( msg,  "at+" );
		if( fp )
		{
			fprintf(fp, "%s\n", temp  );
			fclose(fp);
		}			
	}				
#endif				
}					
					
					
///////////////////// 0525 lkh 荐沥 ///////////////////
void	ReturnCircleResult(int s_X, int s_Y, int e_X, int e_Y, float &result_X, float &result_Y, int angle)
{					
	//int		result_X, result_Y;
	//荐沥谅钎 悸泼(矫累痢阑 盔痢栏肺 初绊)
	double radian = (double )angle * 3.141592 / 180.;
					
	e_X = e_X - s_X;
	e_Y = e_Y - s_Y;
					
	result_X = (float)( cos(radian)*e_X-sin(radian)*e_Y);
	result_Y = (float)(-sin(radian)*e_X+cos(radian)*e_Y);
					
	result_X += s_X;
	result_Y += s_Y;
					
//	sprintf(temp, "%3.1f-%3.1f", result_X, result_Y);
//	MessageBox(NULL, temp, 0, MB_OK);
}					

int ReturnFileNumber( char *sou )
{
	char temp[FILENAME_MAX];
	WIN32_FIND_DATA		FindFileData;
	HANDLE				hFile;
	int nCount = 0;

	
	sprintf( temp, "%s*.*", sou );
	
	if ( ( hFile = FindFirstFile( temp, &FindFileData ) ) != INVALID_HANDLE_VALUE )
	{
		if ( FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
		{
			nCount++;
		}
	}
	while( FindNextFile( hFile, &FindFileData ) )
	{
		if ( FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
		{
			nCount++;
		}
	}
	FindClose( hFile );

	return nCount;
}

	
void Dir2DirCopy( char *sou, char *dest )
{	
	WIN32_FIND_DATA		FindFileData;
	HANDLE				hFile;
	int nCount = 0;

	char tempsou[ FILENAME_MAX];
	char tempdest[ FILENAME_MAX];
	char temp[FILENAME_MAX];
	
	sprintf( temp, "%s*.*", sou );
	
	if ( ( hFile = FindFirstFile( temp, &FindFileData ) ) != INVALID_HANDLE_VALUE )
	{
		if ( FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
		{

			sprintf( tempsou, "%s%s", sou, FindFileData.cFileName );
			sprintf( tempdest, "%s%s", dest, FindFileData.cFileName );

			SetFileAttributes( tempdest, FILE_ATTRIBUTE_NORMAL );
			CopyFile( tempsou, tempdest, FALSE );
			SetFileAttributes( tempsou, FILE_ATTRIBUTE_NORMAL );
			DeleteFile( tempsou);

			nCount++;
		}
	}
	while( FindNextFile( hFile, &FindFileData ) )
	{
		if ( FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
		{
			sprintf( tempsou, "%s%s", sou, FindFileData.cFileName );
			sprintf( tempdest, "%s%s", dest, FindFileData.cFileName );
			SetFileAttributes( tempdest, FILE_ATTRIBUTE_NORMAL );
			CopyFile( tempsou, tempdest, FALSE );
			SetFileAttributes( tempsou, FILE_ATTRIBUTE_NORMAL );
			DeleteFile( tempsou);

			nCount++;
		}
	}
	FindClose( hFile );
}

extern bool CheckTempChar( char ch, char *white );
void DeleteDir( char *dir )
{	
	WIN32_FIND_DATA		FindFileData;
	HANDLE				hFile;

	char tempsou[ FILENAME_MAX];
	char temp[FILENAME_MAX];
	
	sprintf( temp, "%s/*.*", dir );
	
	if ( ( hFile = FindFirstFile( temp, &FindFileData ) ) != INVALID_HANDLE_VALUE )
	{
		do 
		{
			if( CheckTempChar( FindFileData.cFileName[0], " .") ) continue;
			sprintf( tempsou, "%s/%s", dir, FindFileData.cFileName );

			if ( FindFileData.dwFileAttributes != FILE_ATTRIBUTE_DIRECTORY )
			{				
				SetFileAttributes( tempsou, FILE_ATTRIBUTE_NORMAL );
				DeleteFile( tempsou);
			}
			else
			{
				DeleteDir( tempsou );
			}
		}while( FindNextFile( hFile, &FindFileData ) );
		FindClose( hFile );
	}
	int ret = RemoveDirectory( dir );
}

/*--------------------------------------------------------------------------------------------------------------------

扁 瓷 : 荤侩登绰 Language俊 蝶扼 
搬 苞 : 茄臂篮 1, 吝惫绢 2, 老绢 3 阑 府畔茄促. 
		弊寇俊绰 -1甫 府畔茄促. 
		康绢档 -1甫 府畔茄促. 


	LANGID langid = GetSystemDefaultLangID();

		0x0000 Language Neutral 
		0x0400 Process Default Language 
		0x0436 Afrikaans 
		0x041c Albanian 
		0x0401 Arabic (Saudi Arabia) 
		0x0801 Arabic (Iraq) 
		0x0c01 Arabic (Egypt) 
		0x1001 Arabic (Libya) 
		0x1401 Arabic (Algeria) 
		0x1801 Arabic (Morocco) 
		0x1c01 Arabic (Tunisia) 
		0x2001 Arabic (Oman) 
		0x2401 Arabic (Yemen) 
		0x2801 Arabic (Syria) 
		0x2c01 Arabic (Jordan) 
		0x3001 Arabic (Lebanon) 
		0x3401 Arabic (Kuwait) 
		0x3801 Arabic (U.A.E.) 
		0x3c01 Arabic (Bahrain) 
		0x4001 Arabic (Qatar) 
		0x042b Windows 2000: Armenian. This is Unicode only. 
		0x044d Windows 2000: Assamese. This is Unicode only. 
		0x042c Azeri (Latin) 
		0x082c Azeri (Cyrillic) 
		0x042d Basque 
		0x0423 Belarussian 
		0x0445 Windows 2000: Bengali. This is Unicode only. 
		0x0402 Bulgarian 
		0x0455 Burmese 
		0x0403 Catalan 
		0x0404 Chinese (Taiwan) 
		0x0804 Chinese (PRC) 
		0x0c04 Chinese (Hong Kong SAR, PRC) 
		0x1004 Chinese (Singapore) 
		0x1404 Chinese (Macau SAR) 
		0x041a Croatian 
		0x0405 Czech 
		0x0406 Danish 
		0x0413 Dutch (Netherlands) 
		0x0813 Dutch (Belgium) 
		0x0409 English (United States) 
		0x0809 English (United Kingdom) 
		0x0c09 English (Australian) 
		0x1009 English (Canadian) 
		0x1409 English (New Zealand) 
		0x1809 English (Ireland) 
		0x1c09 English (South Africa) 
		0x2009 English (Jamaica) 
		0x2409 English (Caribbean) 
		0x2809 English (Belize) 
		0x2c09 English (Trinidad) 
		0x3009 English (Zimbabwe) 
		0x3409 English (Philippines) 
		0x0425 Estonian 
		0x0438 Faeroese 
		0x0429 Farsi 
		0x040b Finnish 
		0x040c French (Standard) 
		0x080c French (Belgian) 
		0x0c0c French (Canadian) 
		0x100c French (Switzerland) 
		0x140c French (Luxembourg) 
		0x180c French (Monaco) 
		0x0437 Windows 2000: Georgian. This is Unicode only. 
		0x0407 German (Standard) 
		0x0807 German (Switzerland) 
		0x0c07 German (Austria) 
		0x1007 German (Luxembourg) 
		0x1407 German (Liechtenstein) 
		0x0408 Greek 
		0x0447 Windows 2000: Gujarati. This is Unicode only. 
		0x040d Hebrew 
		0x0439 Windows 2000: Hindi. This is Unicode only. 
		0x040e Hungarian 
		0x040f Icelandic 
		0x0421 Indonesian 
		0x0410 Italian (Standard) 
		0x0810 Italian (Switzerland) 
		0x0411 Japanese 
		0x044b Windows 2000: Kannada. This is Unicode only. 
		0x0860 Kashmiri (India) 
		0x043f Kazakh 
		0x0457 Windows 2000: Konkani. This is Unicode only. 
		0x0412 Korean 
		0x0812 Korean (Johab) 
		0x0426 Latvian 
		0x0427 Lithuanian 
		0x0827 Lithuanian (Classic) 
		0x042f Macedonian 
		0x043e Malay (Malaysian) 
		0x083e Malay (Brunei Darussalam) 
		0x044c Windows 2000: Malayalam. This is Unicode only. 
		0x0458 Manipuri 
		0x044e Windows 2000: Marathi. This is Unicode only. 
		0x0861 Windows 2000: Nepali (India). This is Unicode only. 
		0x0414 Norwegian (Bokmal) 
		0x0814 Norwegian (Nynorsk) 
		0x0448 Windows 2000: Oriya. This is Unicode only. 
		0x0415 Polish 
		0x0416 Portuguese (Brazil) 
		0x0816 Portuguese (Standard) 
		0x0446 Windows 2000: Punjabi. This is Unicode only. 
		0x0418 Romanian 
		0x0419 Russian 
		0x044f Windows 2000: Sanskrit. This is Unicode only. 
		0x0c1a Serbian (Cyrillic) 
		0x081a Serbian (Latin) 
		0x0459 Sindhi 
		0x041b Slovak 
		0x0424 Slovenian 
		0x040a Spanish (Traditional Sort) 
		0x080a Spanish (Mexican) 
		0x0c0a Spanish (Modern Sort) 
		0x100a Spanish (Guatemala) 
		0x140a Spanish (Costa Rica) 
		0x180a Spanish (Panama) 
		0x1c0a Spanish (Dominican Republic) 
		0x200a Spanish (Venezuela) 
		0x240a Spanish (Colombia) 
		0x280a Spanish (Peru) 
		0x2c0a Spanish (Argentina) 
		0x300a Spanish (Ecuador) 
		0x340a Spanish (Chile) 
		0x380a Spanish (Uruguay) 
		0x3c0a Spanish (Paraguay) 
		0x400a Spanish (Bolivia) 
		0x440a Spanish (El Salvador) 
		0x480a Spanish (Honduras) 
		0x4c0a Spanish (Nicaragua) 
		0x500a Spanish (Puerto Rico) 
		0x0430 Sutu 
		0x0441 Swahili (Kenya) 
		0x041d Swedish 
		0x081d Swedish (Finland) 
		0x0449 Windows 2000: Tamil. This is Unicode only. 
		0x0444 Tatar (Tatarstan) 
		0x044a Windows 2000: Telugu. This is Unicode only. 
		0x041e Thai 
		0x041f Turkish 
		0x0422 Ukrainian 
		0x0420 Urdu (Pakistan) 
		0x0820 Urdu (India) 
		0x0443 Uzbek (Latin) 
		0x0843 Uzbek (Cyrillic) 
		0x042a Vietnamese 
--------------------------------------------------------------------------------------------------------------------*/
int ReturnLanguageID( void )
{
	LANGID langid = GetSystemDefaultLangID();

	switch( langid )
	{
	case 0x0412 ://Korean 
	case 0x0812 ://Korean (Johab) 
		return 1;

	case 0x0404 ://Chinese (Taiwan)	
	case 0x0804 ://Chinese (PRC)	
	case 0x0c04 ://Chinese (Hong Kong SAR, PRC) 
	case 0x1004 ://Chinese (Singapore) 
	case 0x1404 ://Chinese (Macau SAR) 
		return 2;

	case 0x0411 ://Japanese 
		return 3;

	}

	return -1;
}



// 010314 KHS  Blocking the Accelator 

#define WV_NT_		2
#define WV_9X_		1
#define WV_ETC_		0

int GetWindowVersion( void )
{
	DWORD dwVersion = GetVersion();
	
//  Get the Windows version.
	DWORD dwWindowsMajorVersion =  (DWORD)(LOBYTE(LOWORD(dwVersion)));
	DWORD dwWindowsMinorVersion =  (DWORD)(HIBYTE(LOWORD(dwVersion)));
	
// Get the build number.
	
	if (dwVersion < 0x80000000)              // Windows NT/2000, Whistler
		return WV_NT_;
	else if (dwWindowsMajorVersion < 4)      // Win32s
		return WV_ETC_;
	else                                     // Windows 95/98/Me
		return WV_9X_;
}	
	

#pragma optimize( "agpswy", on )


#define FREE_INT_NO 5	
void Ring0()
{	//在Windows9x下进入ring0后进行的操作
	__asm   
	{       
		cli 
		mov al,34h
		out 43h,al	//写入8253控制寄存器,设置写0号定时器
		mov ax,bx 	
		out 40h,al	//写定时值低位
		mov al,ah 
		out 40h,al	//写定时值高位
		sti 
		iretd;
	}       
}           
             


void SetClock9x(int freq)
{
	union Function_Pointer
	{
		void (*pointer)();
		char bytes[sizeof(void *)];
	}OldIntAddress,NewIntAddress;

	int IDTAddress;		//IDT表基地址
	int IDTItemAddress;	//要修改的中断门所在地址
	char *Pointer;	//要修改的中断门所在地址,指针形式

	__asm
	{
		push eax
		sidt [esp-2]
		pop eax
		mov IDTAddress,eax	//得到IDT表基地址
	}
	
	IDTItemAddress=FREE_INT_NO*8+IDTAddress;
	Pointer=(char *)IDTItemAddress;
	NewIntAddress.pointer=Ring0;
	
	OldIntAddress.bytes[0]=Pointer[0];
	OldIntAddress.bytes[1]=Pointer[1];
	OldIntAddress.bytes[2]=Pointer[6];
	OldIntAddress.bytes[3]=Pointer[7];	//保存旧的中断门

	Pointer[0]=NewIntAddress.bytes[0];
	Pointer[1]=NewIntAddress.bytes[1];
	Pointer[6]=NewIntAddress.bytes[2];
	Pointer[7]=NewIntAddress.bytes[3]; //设置新的中断门
	
	__asm
	{
		mov ebx,freq
		int FREE_INT_NO			//产生中断,进入ring0
	}

	Pointer[0]=OldIntAddress.bytes[0];
	Pointer[1]=OldIntAddress.bytes[1];
	Pointer[6]=OldIntAddress.bytes[2];
	Pointer[7]=OldIntAddress.bytes[3];	//恢复旧的中断门
}

void CurrentGameDate( DWORD t, int *y, int *mo, int *d, int *h, int *mi, int *sec )
{
	DWORD rest;

	*y		= t / 31536000;		// 0
	rest	= t % 31536000;

	*mo		= rest / 2592000;   // +1
	rest	= rest % 2592000;

	*d		= rest / 86400;		// +1
	rest	= rest % 86400;

	*h		= rest / 3600;		//  0 
	rest	= rest % 3600;

	*mi		= rest / 60;		//  0
	*sec	= rest % 60;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -