Exemplo n.º 1
0
HRESULT CScnWait::OnTimer( XUIMessageTimer *pTimer, BOOL& bHandled )
{
	switch(pTimer->nId) {
		case TM_DELETE:
			if(FileOperationManager::getInstance().isDone()) {
				// File Operation is complete
				KillTimer(TM_DELETE);

				if(waitReboot)
					Restart();
				else
					NavigateBack(XUSER_INDEX_ANY);

				bHandled = TRUE;
			}
			break;
		case TM_TIMEOUT:
			if(RemovePathCallBack::getInstance().getDone()) {
				// File Operation is complete
				KillTimer(TM_DELETE);

				if(waitReboot)
					Restart();
				else
					NavigateBack(XUSER_INDEX_ANY);

				bHandled = TRUE;
			}
			break;
	};

    return S_OK;
}
Exemplo n.º 2
0
void Handle_Home(int disable_screenshot)
{
	if (CFG.home == CFG_HOME_EXIT) {
		Con_Clear();
		printf("\n");
		printf_("Exiting...");
		__console_flush(0);
		Sys_Exit();
	} else if (CFG.home == CFG_HOME_SCRSHOT) {
		__console_flush(0);
		Make_ScreenShot();
		if (disable_screenshot)	CFG.home = CFG_HOME_EXIT;
	} else if (CFG.home == CFG_HOME_HBC) {
		Con_Clear();
		printf("\n");
		printf_("HBC...");
		__console_flush(0);
		Sys_HBC();
	} else if (CFG.home == CFG_HOME_REBOOT) { 
		Con_Clear();
		Restart();
	} else {
		// Priiloader magic words, and channels
		if ((CFG.home & 0xFF) < 'a') {
			// upper case final letter implies channel
			Con_Clear();
			Sys_Channel(CFG.home);
		} else {
			// lower case final letter implies magic word
			Con_Clear();
			*(vu32*)0x8132FFFB = CFG.home;
			Restart();
		}
	}
}
Exemplo n.º 3
0
void CClient::TimeRoutine(int now)
{
	CLock lock(&m_criticalSection);
	switch (m_status)
	{
	case NETSTATUS_CompletionNotify:
		{
			if (m_lastActionTime)
			{
				if (now-m_lastActionTime > MAX_IDLE_TIME)
				{
					LOG("Client[%d] has been idled for a long time.", GetID());
					Restart(NETOP_Receive);
				}
			}
			else
			{
				DWORD connectTime = 0;
				int optSize = sizeof(connectTime);
				if (getsockopt(m_socket, SOL_SOCKET, SO_CONNECT_TIME, (char*)&connectTime, &optSize) == SOCKET_ERROR)
				{
					LOGNET("Client[%d] fail to get socket connection time.", GetID());
				}
				else
				{
					if (connectTime!=0xFFFFFFFF && connectTime>DENIAL_SERVICE_TIME)
					{
						LOG("Client[%d] may be a malicious application.", GetID());
						Restart(NETOP_Receive);
					}
				}
			}
		}
		break;
	case NETSTATUS_Disconnecting:
		{
			if (m_lastActionTime)
			{
				if (now-m_lastActionTime > MAX_DISCONNECT_TIME)
				{
					LOG("Client[%d] has been in disconnecting for a long time.", GetID());
					Restart(NETOP_Disconnect);
				}
			}
			else
			{
				LOG("Client[%d] has been in disconnecting, but last action time is zero.", GetID());
			}
		}
		break;
	default:
		break;
	}
}
NS_IMETHODIMP sbSeekableChannel::SetPos(
    PRUint64                    pos)
{
    DataSet::iterator           dataSetIterator;
    Segment                     findSegment;
    nsresult                    result = NS_OK;

    /* Check if channel is restarting. */
    if (mRestarting)
        result = NS_ERROR_SONGBIRD_SEEKABLE_CHANNEL_RESTART;

    /* Find a segment containing the new position. */
    if (NS_SUCCEEDED(result) && (pos < mContentLength))
    {
        findSegment.offset = pos;
        findSegment.length = 0;
        dataSetIterator = mChannelData.find(&findSegment);
        if (dataSetIterator == mChannelData.end())
            result = NS_ERROR_SONGBIRD_SEEKABLE_CHANNEL_RESTART;
    }

    /* Restart channel if needed. */
    if (!mRestarting && (result == NS_ERROR_SONGBIRD_SEEKABLE_CHANNEL_RESTART))
        Restart(pos);

    /* Set the channel position. */
    if (NS_SUCCEEDED(result))
        mPos = pos;

    return (result);
}
Exemplo n.º 5
0
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 构造函数
HWND CChildWnd::Create()
{
	// 转到开始
	Restart();

	// 获取窗口状态
	BOOL bMaximized = CClientWnd::GetChildCount() ? 
		((GetWindowLong(CClientWnd::m_hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) == FALSE) : CIni::GetInt(INI_MaxOnOpen);

	// 创建窗口	
	m_hWnd = CreateMDIWindow(STR_AppName TEXT("ChildWnd"), m_tzFileName, 0, 
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
		CClientWnd::m_hWnd, g_hInst, (LPARAM) this);

	if (m_hWnd)
	{
		// 调整播放窗口大小
		SetVideoSize(m_uWidth, m_uHeight);
		_ExIf(bMaximized, ShowWindow(m_hWnd, SW_MAXIMIZE));

		// 播放设置
		SetPlayWnd(m_hPlayWnd);
		_ExIf(CIni::GetInt(INI_DirectDraw, TRUE), EnableDDraw());
		_ExIf(CIni::GetInt(INI_PlayOnOpen), Play());
	}

	return m_hWnd;
}
Exemplo n.º 6
0
void __Menu_Controls(void)
{
	u32 buttons = Wpad_WaitButtons();

	/* UP/DOWN buttons */
	if (buttons & WPAD_BUTTON_UP)
		__Menu_MoveList(-1);
	if (buttons & WPAD_BUTTON_DOWN)
		__Menu_MoveList(1);

	/* LEFT/RIGHT buttons */
	if (buttons & WPAD_BUTTON_LEFT)
		__Menu_MoveList(-ENTRIES_PER_PAGE);
	if (buttons & WPAD_BUTTON_RIGHT)
		__Menu_MoveList(ENTRIES_PER_PAGE);


	/* HOME button */
	if (buttons & WPAD_BUTTON_HOME)
		Restart();

	/* PLUS (+) button */
	if (buttons & WPAD_BUTTON_PLUS)
		Menu_Manage(selected, 'i');

	/* MINUS (-) button */
	if (buttons & WPAD_BUTTON_MINUS)
		Menu_Manage(selected, 'u');

	/* ONE (1) button */
	if (buttons & WPAD_BUTTON_1)
		Menu_Device();
}
Exemplo n.º 7
0
CLog::CLog(char *szFilename) {
    Initialize();
    SetName(szFilename);
    Restart();
    LineFeedsOn();
//    if(bDebug) _Add("DEBUGGING ACTIVE");
}
Exemplo n.º 8
0
bool CHC_GameSystem::LoadMap(char * filename) {
	FILE * fin;
	if ((fin = fopen(filename, "r")) == NULL) return false;

	fscanf(fin, "%d%d", &map_w, &map_h);	
	for (int i = 0; i != map_w; i++)
		for (int j = 0; j != map_h; j++)
			ori_map[i][j].setBlank();

	fscanf(fin, "%d%d", &num_sender, &num_receiver);
	int x, y, d, r, g, b;
	for (int i = 0; i != num_sender; i++) {
		fscanf(fin, "%d%d%d", &x, &y, &d);
		ori_map[x][y].dir = d;
		ori_map[x][y].obj = SENDER_ID;
		fscanf(fin, "%d%d%d", &r, &g, &b);
		ori_map[x][y].col[d / 2].setColor(r, g, b);
	}
	for (int i = 0; i != num_receiver; i++) {
		fscanf(fin, "%d%d", &x, &y);
		ori_map[x][y].obj = RECEIVER_ID;
		fscanf(fin, "%d%d%d", &r, &g, &b);
		ori_map[x][y].col[0].setColor(r, g, b);
	}
	for (int i = 0; i != NUM_MIRROR_SORT; i++) {
		fscanf(fin, "%d", &num_mirror[i]);
	}
	Restart();

	return true;
}
Exemplo n.º 9
0
void Disclaimer(void)
{
	/* Print disclaimer */
	printf("  [DISCLAIMER]:\n\n");

	printf("    THIS APPLICATION COMES WITH NO WARRANTY AT ALL,\n");
	printf("    NEITHER EXPRESS NOR IMPLIED.\n");
	printf("    I DO NOT TAKE ANY RESPONSIBILITY FOR ANY DAMAGE IN YOUR\n");
	printf("    WII CONSOLE BECAUSE OF A IMPROPER USAGE OF THIS SOFTWARE.\n\n");

	printf(">>  If you agree and install the streamed wad\n");
	printf(">>  press A button to continue.\n");
	printf(">>  Otherwise, press B button to restart your Wii.\n");

	/* Wait for user answer */
	for (;;) {
		u32 buttons = Wpad_WaitButtons();

		/* A button */
		if ((buttons & WPAD_BUTTON_A)||(buttons & PAD_BUTTON_A))
			break;

		/* B button */
		if ((buttons & WPAD_BUTTON_B)||(buttons & WPAD_CLASSIC_BUTTON_B))
			Restart();
	}
}
Exemplo n.º 10
0
void btTracker::RestartTracker()
{
  // Stop/finish the tracker, then call Restart() after DT_TRACKER_FINISHED.
  Stop();
  m_f_restart = 1;
  if( DT_TRACKER_FINISHED == m_status ) Restart();
}
Exemplo n.º 11
0
void btTracker::Reset(time_t new_interval)
{
  m_interval = new_interval ? new_interval : m_default_interval;

  if( INVALID_SOCKET != m_sock ){
    if( *cfg_verbose && DT_TRACKER_READY==m_status )
      CONSOLE.Debug("Disconnected from tracker at %s", m_spec->url);
    if( !g_secondary_process )
      shutdown(m_sock, SHUT_RDWR);
    CLOSE_SOCKET(m_sock);
    m_sock = INVALID_SOCKET;
  }

  if( m_redirect ){
    delete m_spec;
    m_spec = m_redirect;
    m_redirect = (tracker_spec *)0;
  }

  m_request_buffer.Reset();
  m_response_buffer.Reset();
  if( now < m_last_timestamp ) m_last_timestamp = now;  // time reversed

  if( m_f_stop ){
    if( m_f_restart )
      m_status = m_f_started ? DT_TRACKER_FREE : DT_TRACKER_FINISHED;
    else m_status = DT_TRACKER_FINISHED;

    if( DT_TRACKER_FINISHED == m_status ){
      m_f_started = 0;
      if( m_f_restart ) Restart();
    }
  }
  else m_status = DT_TRACKER_FREE;
}
Exemplo n.º 12
0
    void World::Update()
    {
        if(m_state == IDLE)
        {
            if(LoadResources())
            {

            }
        }
        else if(m_state == PLAYING)
        {
            if(!IsBallInBounds())
            {
                ChangeState(GAMEOVER);
            }
            else
            {
                UpdateBall();
                UpdatePlayer1();
                UpdatePlayer2(); 
            }
        }
        else if(m_state == GAMEOVER)
        {
            if(HasBallCollideLeft())
            {
                m_player2.UpdateScore(1);
            }
            else if(HasBallCollideRight())
            {
                m_player1.UpdateScore(1);
            }
            Restart();
        }
    }
Exemplo n.º 13
0
void APawn::PawnClientRestart()
{
	Restart();

	APlayerController* PC = Cast<APlayerController>(Controller);
	if (PC && PC->IsLocalController())
	{
		// Handle camera possession
		if (PC->bAutoManageActiveCameraTarget)
		{
			PC->AutoManageActiveCameraTarget(this);
		}

		// Set up player input component, if there isn't one already.
		if (InputComponent == NULL)
		{
			InputComponent = CreatePlayerInputComponent();
			if (InputComponent)
			{
				SetupPlayerInputComponent(InputComponent);
				InputComponent->RegisterComponent();
				if (UInputDelegateBinding::SupportsInputDelegate(GetClass()))
				{
					InputComponent->bBlockInput = bBlockInput;
					UInputDelegateBinding::BindInputDelegates(GetClass(), InputComponent);
				}

			}
		}
	}
}
Exemplo n.º 14
0
Snake::Snake(unsigned headcolor, unsigned segmentcolor, unsigned coincolor)
{
    this->headcolor = headcolor;
    this->segmentcolor = segmentcolor;
    this->coincolor = coincolor;
    Restart();
}
Exemplo n.º 15
0
void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength)
{
    AssertValidKeyLength(keylength);

    Restart();

    HashTransformation &hash = AccessHash();
    unsigned int blockSize = hash.BlockSize();

    if (!blockSize)
        throw InvalidArgument("HMAC: can only be used with a block-based hash function");

    if (keylength <= blockSize)
        memcpy(AccessIpad(), userKey, keylength);
    else
    {
        AccessHash().CalculateDigest(AccessIpad(), userKey, keylength);
        keylength = hash.DigestSize();
    }

    assert(keylength <= blockSize);
    memset(AccessIpad()+keylength, 0, blockSize-keylength);

    for (unsigned int i=0; i<blockSize; i++)
    {
        AccessOpad()[i] = AccessIpad()[i] ^ OPAD;
        AccessIpad()[i] ^= IPAD;
    }
}
Exemplo n.º 16
0
int main( int argc, char * argv[] )
{
	// 屏蔽信号
	signal( SIGCLD, SIG_IGN );
	signal( SIGILL, SIG_IGN );
	signal( SIGIOT, SIG_IGN );
	signal( SIGFPE, SIG_IGN );
	signal( SIGBUS, SIG_IGN );
	signal( SIGSYS, SIG_IGN );
	signal( SIGTRAP, SIG_IGN );
	signal( SIGSEGV, SIG_IGN );
	
	if( argc > 1 )
	{
		if( strcmp( argv[1], "start" ) == 0 )
		{
			Start();
			return 0;
		}
		else if( strcmp( argv[1], "stop" ) == 0 )
		{
			Stop();
			return 0;
		}
		else if( strcmp( argv[1], "restart" ) == 0 )
		{
			Restart();
			return 0;
		}
	}
	
	printf( " Usage   : ./PgSqlService start|stop|restart\n" );
    return 0;
}
Exemplo n.º 17
0
void ReplayMode::Undo() {
	if(skip_step > 0 || current_step == 0)
		return;
	mainGame->dInfo.isReplaySkiping = true;
	Restart(false);
	Pause(false, false);
}
Exemplo n.º 18
0
void CGame::OnUpdate(float time)
{
	CApp::OnUpdate(time);
	if(!pause)
	{
		live_obj=0;

		for(int i=0;i<npcs.size();i++)
		{
			if(npcs[i]->isLive())
			{
				live_obj++;
			}
		}
		ObjectsCheck();
		if(player->isLive() && live_obj==0)
		{
			NextLevel();
		}
		if(player->isLive()==false)
		{
			Restart();
		}
	}
}
//---------------------------------------------------------------------------
// Constructors/Destructors
//---------------------------------------------------------------------------
Civilization::Civilization(TImage *ptrVirtualCiv, TScrollBox *ptrVirtualTerrain, TImage *IPreview, TLabel *LEpoch)
{
 FoodCollected = 0;                       // No food collected at the beginning
 Epoch = 0;                               // Start from turn 0
 TurnsRemaining = TURNS_BEFORE_SELECTION; // Set turn remaining before the Natural Selection occurs

 Cities = new TList();                    // Civilization begins with no City
 Roads = new TList();                     // ... and no routes
 Nest = NULL;
 FoodSourceCity = NULL;
 CityBuildingRoad = NULL;                 // ... and no roads are being built

 DeliveryTime = new TList();


 Ants = new TList();                      // Create some ants at random...
 LoadAnts();

 Restart();                               // Prepare the environment for simulation

 VirtualCiv = ptrVirtualCiv;
 VirtualTerrain = ptrVirtualTerrain;
 Preview = IPreview;
 LabelEpoch = LEpoch;
}
Exemplo n.º 20
0
Arquivo: xsm.c Projeto: aosm/X11
static void
PropertyChangeXtHandler(Widget w, XtPointer closure, XEvent *event, 
			Boolean *continue_to_dispatch)
{
    if (w == topLevel && event->type == PropertyNotify &&
	event->xproperty.atom == wmStateAtom)
    {
	XtRemoveEventHandler (topLevel, PropertyChangeMask, False,
	    PropertyChangeXtHandler, NULL);

	/*
	 * Restart the rest of the session aware clients.
	 */

	Restart (RESTART_REST_OF_CLIENTS);


	/*
	 * Start apps that aren't session aware that were specified
	 * by the user.
	 */

	StartNonSessionAwareApps ();
    }
}
int main(int argc, char **argv)
{
	/* Load Custom IOS */
	IOS_ReloadIOS(249);

	/* Initialize subsystems */
	Sys_Init();

	/* Set video mode */
	Video_SetMode();

	/* Initialize console */
	Gui_InitConsole();

	/* Draw background */
	Gui_DrawBackground();

	/* Initialize Wiimote subsystem */
	Wpad_Init();

	/* Initialize disc subsystem */
	Disc_Init();

	/* Mount SD card */
	Fat_MountSD();

	/* Menu loop */
	Menu_Loop();

	/* Restart */
	Restart();

	return 0;
}
Exemplo n.º 22
0
void HMAC_Base::UncheckedSetKey(const byte *userKey, unsigned int keylength, const NameValuePairs &)
{
	AssertValidKeyLength(keylength);

	Restart();

	HashTransformation &hash = AccessHash();
	unsigned int blockSize = hash.BlockSize();

	if (!blockSize)
		throw InvalidArgument("HMAC: can only be used with a block-based hash function");

	m_buf.resize(2*AccessHash().BlockSize() + AccessHash().DigestSize());

	if (keylength <= blockSize)
		memcpy(AccessIpad(), userKey, keylength);
	else
	{
		AccessHash().CalculateDigest(AccessIpad(), userKey, keylength);
		keylength = hash.DigestSize();
	}

	CRYPTOPP_ASSERT(keylength <= blockSize);
	memset(AccessIpad()+keylength, 0, blockSize-keylength);

	for (unsigned int i=0; i<blockSize; i++)
	{
		AccessOpad()[i] = AccessIpad()[i] ^ 0x5c;
		AccessIpad()[i] ^= 0x36;
	}
}
Exemplo n.º 23
0
void Model::PrintButton()
{
  if (m_printing)
    Restart();
  else
    Print();
}
Exemplo n.º 24
0
void ParticleEmitter::Update(float32 timeElapsed)
{
    timeElapsed *= playbackSpeed;
    time += timeElapsed;
    float32 t = time / lifeTime;

    if (colorOverLife)
    {
        currentColor = colorOverLife->GetValue(t);
    }

    if(isAutorestart && (time > lifeTime))
    {
        time -= lifeTime;

        // Restart() resets repeatCount, so store it locally and then revert.
        int16 curRepeatCount = repeatCount;
        Restart(true);
        repeatCount = curRepeatCount;

        repeatCount ++;
    }

    Vector<ParticleLayer*>::iterator it;
    for(it = layers.begin(); it != layers.end(); ++it)
    {
        if(!(*it)->isDisabled)
            (*it)->Update(timeElapsed);
    }
}
Exemplo n.º 25
0
CountdownTimer::CountdownTimer(size_t countdownTimeMs, bool start)
      : DoneTimeMs(0)
      , CountdownTimeMs(countdownTimeMs)
    {
        if(start)
            Restart();
    }
Exemplo n.º 26
0
void CEvolverDlg::OnTimer(UINT nIDEvent)
{
	if(nIDEvent == m_NotifyTimer)
	{
		if(m_Counter == 0)
		{
			// Show changelog
			CFrameMain* pFrame = (CFrameMain*) AfxGetApp()->GetMainWnd();
			pFrame->OpenBrowser("http://www.gnucleus.com/update2/ChangeLog.txt");
		}

		m_Counter++;
		m_progBar.SetPos(m_Counter);
		m_stcProgress.SetWindowText("Evolution in " + DWrdtoStr((150 - m_Counter) / 10) + " seconds...");
	
		if(m_Counter == 150)
			StartDownload();
	}

	if(nIDEvent == m_UpgradeTimer)
	{
		// Get File IDs
		std::vector<int> FileIDs;

		VARIANT var = m_autUpdate->GetFileIDs();
		SAFEARRAY* psa = var.parray;

		int* nArray;
		SafeArrayAccessData(psa, reinterpret_cast<void**> (&nArray));

		for(int i = 0; i < psa->rgsabound->cElements; i++)
			FileIDs.push_back(nArray[i]);

		SafeArrayUnaccessData(psa);
		VariantClear(&var);

		// Update status
		if(m_autUpdate->GetTotalCompleted())
			m_stcProgress.SetWindowText("Downloading Files...");

		if(m_autUpdate->GetTotalSize())
			m_progBar.SetPos(m_autUpdate->GetTotalCompleted() * 100 / m_autUpdate->GetTotalSize());
	}

	if(nIDEvent == m_CloseTimer)
	{
		m_Counter++;
		m_progBar.SetPos(m_Counter);
		m_stcProgress.SetWindowText("Restarting in " + DWrdtoStr((150 - m_Counter) / 10) + " seconds...");
	
		if(m_Counter == 150)
		{
			Restart();
			return;
		}
	}

	CDialog::OnTimer(nIDEvent);
}
Exemplo n.º 27
0
void masterControl() {
    MenuItem menuitems[10];
    menuitems[0].text = (char*)"SS";
    menuitems[1].text = (char*)"LS";
    menuitems[2].text = (char*)"Lk0";
    menuitems[3].text = (char*)"Lk1";
#ifdef ENABLE_DEBUG
    menuitems[4].text = (char*)"Dbg0";
    menuitems[5].text = (char*)"Dbg1";
    menuitems[6].text = (char*)"Ac0";
    menuitems[7].text = (char*)"Ac1";
    menuitems[8].text = (char*)"Rst";
#endif

    Menu menu;
    menu.items=menuitems;
#ifdef ENABLE_DEBUG
    menu.numitems=9;
#else
    menu.numitems=4;
#endif
    menu.scrollout=1;
#ifdef ENABLE_DEBUG
    menu.title = (char*)"CTRL";
#endif
    while(1) {
        int res = doMenu(&menu);
        if(res == MENU_RETURN_EXIT) return;
        else if(res == MENU_RETURN_SELECTION) {
            switch(menu.selection) {
            case 1:
                saveSettings();
                break;
            case 2:
                loadSettings();
                break;
            case 3:
            case 4:
                // do not autosave, to allow full control of the operator
                setSetting(SETTING_ENABLE_LOCK, menu.selection-3, 0);
                break;
#ifdef ENABLE_DEBUG
            case 5:
            case 6:
                setDebugMode(menu.selection-5);
                break;
            case 7:
            case 8:
                // do not autosave, to allow full control of the operator
                setSetting(SETTING_ACTIVATION_STATUS, menu.selection-7, 0);
                break;
            case 9:
                Restart();
                break;
#endif
            }
        }
    }
}
Exemplo n.º 28
0
void Halftoner::Flush()
{
    if (!started)
    {
        return;
    }
    Restart();
} //Flush
Exemplo n.º 29
0
void Printer::PrintButton()
{
  if (device==NULL) return;
  if (printing)
    Restart();
  else
    Print();
}
Exemplo n.º 30
0
Arquivo: main.cpp Projeto: Syntaf/GGG
/// End function/variable declaration
int main()
{
    Map mObj(2);
    Message::PrintOpening();
    Message::RunMenu(mObj);
    do{LoopGame(mObj);}while(Restart(mObj));
    std::cout << "\n\t\tThanks for playing!";
}