//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //Procedure InitAggregator //Date Wed 29 Apr 1998 //------------------------------------------------------------------------------ void Aggregator::InitAggregator() { ULong n; AggFrameCount=0; AggBuffer.InitBuffer(); AggBuffer.SetTempCurr(); do { for (n=0;n<MAXPLAYERS;n++) { AggBuffer.GetTemp()->Acks[n]=FALSE; } memset(&(AggBuffer.GetTemp()->aggpack),0,sizeof(AGGSENDPACKET)); AggBuffer.GetTemp()->ResendStatus=0; AggBuffer.UpdateTemp(); } while (AggBuffer.GetTemp()!=AggBuffer.GetCurr()); ClearMessageQueue(); InitReservePackets(); ResetAcks(); ResetFlag=false; InitAggArrayBuffer(); time=0; clearbuffertime=0; buffer=FALSE; }
void ScreenGameplayLesson::Init() { ASSERT( GAMESTATE->GetCurrentStyle(GAMESTATE->GetMasterPlayerNumber()) != NULL ); ASSERT( GAMESTATE->m_pCurSong != NULL ); /* Now that we've set up, init the base class. */ ScreenGameplayNormal::Init(); ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc. GAMESTATE->m_bGameplayLeadIn.Set( false ); m_DancingState = STATE_DANCING; // Load pages Song *pSong = GAMESTATE->m_pCurSong; RString sDir = pSong->GetSongDir(); vector<RString> vs; GetDirListing( sDir+"Page*", vs, true, true ); m_vPages.resize( vs.size() ); FOREACH( RString, vs, s ) { int i = s - vs.begin(); AutoActor &aa = m_vPages[i]; LuaThreadVariable iIndex( "PageIndex", LuaReference::Create(i) ); LuaThreadVariable iPages( "NumPages", LuaReference::Create( (int)vs.size() ) ); aa.Load( *s ); aa->SetDrawOrder( DRAW_ORDER_OVERLAY+1 ); this->AddChild( aa ); }
void ScreenGameplaySyncMachine::Init() { m_bForceNoNetwork = true; GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR ); GAMESTATE->SetCurrentStyle( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) ); AdjustSync::ResetOriginalSyncData(); RString sFile = THEME->GetPathO("ScreenGameplaySyncMachine","music"); // Allow themers to use either a .ssc or .sm file for this. -aj SSCLoader loaderSSC; SMLoader loaderSM; if(sFile.Right(4) == ".ssc") loaderSSC.LoadFromSimfile( sFile, m_Song ); else loaderSM.LoadFromSimfile( sFile, m_Song ); m_Song.SetSongDir( Dirname(sFile) ); m_Song.TidyUpData(); GAMESTATE->m_pCurSong.Set( &m_Song ); // Needs proper StepsType -freem vector<Steps*> vpSteps; SongUtil::GetPlayableSteps( &m_Song, vpSteps ); ASSERT_M(vpSteps.size() > 0, "No playable steps for ScreenGameplaySyncMachine"); Steps *pSteps = vpSteps[0]; GAMESTATE->m_pCurSteps[GAMESTATE->GetFirstHumanPlayer()].Set( pSteps ); GamePreferences::m_AutoPlay.Set( PC_HUMAN ); ScreenGameplayNormal::Init(); SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_AutosyncType, SongOptions::AUTOSYNC_MACHINE ); ClearMessageQueue(); // remove all of the messages set in ScreenGameplay that animate "ready", "here we go", etc. GAMESTATE->m_bGameplayLeadIn.Set( false ); m_DancingState = STATE_DANCING; m_textSyncInfo.SetName( "SyncInfo" ); m_textSyncInfo.LoadFromFont( THEME->GetPathF(m_sName,"SyncInfo") ); ActorUtil::LoadAllCommands( m_textSyncInfo, m_sName ); this->AddChild( &m_textSyncInfo ); this->SubscribeToMessage( Message_AutosyncChanged ); RefreshText(); }
LRESULT CALLBACK WaitDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { switch (uMsg) { case WM_INITDIALOG: CenterWindow(hwnd,GetWindow(hwnd,GW_OWNER)); return TRUE; case WM_NOTIFY: if (((LPNMHDR)lParam)->code==NM_CLICK) ClearMessageQueue(hwnd,10); // ??? break; default: break; } return FALSE; }
bool wxGISNetworkService::Stop(void) { for(size_t i = 0; i < m_NetworkPluginArray.size(); i++) wgDELETE(m_NetworkPluginArray[i], Stop()); for(ConnIT it = m_NetworkConnectionMap.begin(); it != m_NetworkConnectionMap.end(); ++it) if(it->second) it->second->Disconnect(); //clear messages ClearMessageQueue(); //2. Stop out thread if(m_pMsgOutThread) m_pMsgOutThread->Delete(); wxLogMessage(_("wxGISNetworkService: Service stopped")); return true; }
/* * DownloadProgressCallback: Callback function for each file in an archive. */ bool DownloadProgressCallback(const char *filename, ExtractionStatus status) { switch (status) { case EXTRACT_DONE: ClearMessageQueue(); // Check for user hitting abort button debug(("Crusher file %s extracted\n", filename)); break; case EXTRACT_CANT_RENAME: extraction_error = IDS_BADTEMPFILE; break; case EXTRACT_BAD_PERMISSIONS: extraction_error = IDS_BADPERMISSION; break; case EXTRACT_OUT_OF_MEMORY: extraction_error = IDS_BADMEM; break; case EXTRACT_BAD_CRC: case EXTRACT_UNKNOWN: extraction_error = IDS_BADARCHIVE; break; case EXTRACT_DISK_FULL: extraction_error = IDS_DISKFULL; break; } // Other errors if (status != EXTRACT_OK && extraction_error == 0) extraction_error = IDS_UNKNOWNERROR; // Check for user abort if (abort_download) return false; return true; }
// IGraphBuilder STDMETHODIMP CRealMediaGraph::RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList) { m_fn = lpcwstrFile; CHAR buff[MAX_PATH] = {0}; WideCharToMultiByte(GetACP(), 0, lpcwstrFile, -1, buff, MAX_PATH, 0, 0); CStringA fn(buff); if(fn.Find("://") < 0) fn = "file://" + fn; m_pRMP->m_unPercentComplete = 100; ClearMessageQueue(); if(PNR_OK != m_pRMP->m_pPlayer->OpenURL(fn)) return E_FAIL; m_pRMP->m_pPlayer->Pause()/*Stop()*/; // please, don't start just yet return S_OK; }
//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //Procedure AggregatorGetPackets //Date Thu 20 Mar 1997 //------------------------------------------------------------------------------ void Aggregator::AggregatorGetPackets() //Bool reset, Bool timercall) { LPACPACKET RecPacket; HRESULT res; ULong n,m; bool SendResult; myDPID from; DWORD BufferLen; char* Buffer; #ifndef NDEBUG if (!_DPlay.Host) _Error.SayAndQuit("Player processing packets to aggregator!!!!!"); #endif if (ResetFlag) { InitAggregator(); #ifdef AGGLOGS Log("RESET aggregator\n"); #endif } else if (Running) { // calls from timer are every 1/50 sec. Use to determine timeout time++; clearbuffertime++; GetAllMessages(); MakeAndSendAggPacket(); if (buffer) { // only resend packets or clear buffers if we are REAL game mode, not whilst // in resync!!!!!!!!!!!!! if (AllowResendOrBurstCatchUp()) { SLong entry=RequireResend(); if (entry!=-1) { Resend(entry); } else if (BurstInBuffer()) { BurstCatchup(); } } } } else { // receive and junk all messages to aggregator as we are not ready for them yet!!!! ClearMessageQueue(); } }
static bool ExtractArchive(const char *zip_file, const char *out_dir) { struct archive *input = archive_read_new(); archive_read_support_format_all(input); archive_read_support_compression_all(input); struct archive *output = archive_write_disk_new(); archive_write_disk_set_options(output, ARCHIVE_EXTRACT_TIME); archive_write_disk_set_standard_lookup(output); int hRes; const int BLOCK_SIZE = 65536; int r = archive_read_open_filename(input, zip_file, BLOCK_SIZE); if (r != ARCHIVE_OK) { extraction_error = IDS_BADARCHIVE; return false; } // libarchive can only extract into the current directory, so we // need to set it and restore it. char original_dir[MAX_PATH]; char *cRet = getcwd(original_dir, sizeof(original_dir)); hRes = chdir(out_dir); bool retval = true; while (true) { struct archive_entry *entry; r = archive_read_next_header(input, &entry); if (r == ARCHIVE_EOF) break; if (r != ARCHIVE_OK) { extraction_error = IDS_BADARCHIVE; retval = false; break; } r = archive_write_header(output, entry); if (r != ARCHIVE_OK) { const char *msg = archive_error_string(output); extraction_error = IDS_UNKNOWNERROR; retval = false; break; } if (archive_entry_size(entry) > 0) { r = CopyArchiveData(input, output); if (r != ARCHIVE_OK) { const char *msg = archive_error_string(output); extraction_error = IDS_UNKNOWNERROR; retval = false; break; } } r = archive_write_finish_entry(output); if (r != ARCHIVE_OK) { extraction_error = IDS_UNKNOWNERROR; retval = false; break; } // Extraction went OK; process Windows messages ClearMessageQueue(); } archive_read_close(input); archive_read_free(input); archive_write_close(output); archive_write_free(output); // Go back to original working directory hRes = chdir(original_dir); return retval; }
bool ExtractArchive(const char *zip_file, const char *out_dir) { struct archive *input = archive_read_new(); archive_read_support_format_all(input); archive_read_support_compression_all(input); struct archive *output = archive_write_disk_new(); archive_write_disk_set_options(output, ARCHIVE_EXTRACT_TIME); archive_write_disk_set_standard_lookup(output); const int BLOCK_SIZE = 65536; int r = archive_read_open_filename(input, zip_file, BLOCK_SIZE); if (r != ARCHIVE_OK) { debug(("Error opening archive %s: %s\n", zip_file, archive_error_string(input))); extraction_error = IDS_BADARCHIVE; return false; } // libarchive can only extract into the current directory, so we // need to set it and restore it. char original_dir[MAX_PATH]; getcwd(original_dir, sizeof(original_dir)); chdir(out_dir); bool retval = true; while (true) { struct archive_entry *entry; r = archive_read_next_header(input, &entry); if (r == ARCHIVE_EOF) break; if (r != ARCHIVE_OK) { debug(("Error reading archive header: %s\n", archive_error_string(input))); extraction_error = IDS_BADARCHIVE; retval = false; break; } r = archive_write_header(output, entry); if (r != ARCHIVE_OK) { debug(("Error writing archive header: %s\n", archive_error_string(input))); extraction_error = IDS_UNKNOWNERROR; retval = false; break; } if (archive_entry_size(entry) > 0) { r = CopyArchiveData(input, output); if (r != ARCHIVE_OK) { debug(("CopyArchiveData error: %s\n", archive_error_string(input))); extraction_error = IDS_UNKNOWNERROR; retval = false; break; } } r = archive_write_finish_entry(output); if (r != ARCHIVE_OK) { debug(("write_finish_entry error: %s\n", archive_error_string(input))); extraction_error = IDS_UNKNOWNERROR; retval = false; break; } debug(("Archive file %s extracted\n", archive_entry_pathname(entry))); // Extraction went OK; process Windows messages ClearMessageQueue(); // Check for user hitting abort button // Check for user abort if (abort_download) { retval = false; break; } } archive_read_close(input); archive_read_free(input); archive_write_close(output); archive_write_free(output); // Go back to original working directory chdir(original_dir); return retval; }