void LogMbInfo(RESIDU* currResidu,int mbWidth,int mbHeight) { int i,j; for (i = 0;i<mbHeight;i++) { for (j = 0 ;j<mbWidth;j++) { logStr("%d ",currResidu[i*mbWidth+j].MbType); } logStr("\n"); } }
void FinishFrameSVC( NAL *Nal, SPS *Sps, PPS *Pps, LIST_MMO *Current_pic, SLICE *Slice, int EndOfSlice, DATA *TabBlbock, RESIDU *Residu, MMO *Mmo) { if (!EndOfSlice && Mmo -> MemoryAllocation){ LAYER_MMO *LayerMmo = &(Mmo->LayerMMO[Nal->LayerId]); DEP_MMO* dep_mmo = LayerMmo->dep_mmo; if ( Nal -> PicToDisplay && Nal->bFinishLayerRepresent){ const int PicWidthInPix = (Sps -> pic_width_in_mbs + 2) << 4; const int PicHeightInPix = (Sps -> pic_height_in_map_units ) << 4; short *mvL0 = Current_pic->mv_memory_l0; short *mvL1 = Current_pic->mv_memory_l1; short *refL0 = Current_pic->ref_memory_l0; short *refL1 = Current_pic->ref_memory_l1; unsigned char *Y = Current_pic->picture_memory_y; unsigned char *U = Current_pic->picture_memory_u; unsigned char *V = Current_pic->picture_memory_v; //Deblocking filter if (!Nal -> DqId){ Loop_filter_avc(Sps, Pps, Slice, Current_pic, LayerMmo->mb_slice_table, TabBlbock, mvL0, mvL1, refL0, refL1, Residu, Y, U, V); }else { Loop_filter_svc(Nal, Sps, Pps, Slice, Current_pic, LayerMmo->mb_slice_table, mvL0, mvL1, refL0, refL1, Residu, Y, U, V); } //Padding for motion interpolation ImageSetEdges(Y, U, V, PicWidthInPix, PicHeightInPix); logStr("add to poc buffer, poc:%d, pic number:%d\tmemory:%x\n",Current_pic->poc, Mmo->nb_img_display - Mmo -> num_free_poc_address,Current_pic->picture_memory_y); StorePicture(&(Mmo->poc_params[Mmo->nb_img_display - Mmo -> num_free_poc_address]), Current_pic,Sps,Nal->DqIdToDisplay); Mmo->num_free_poc_address--; } } }
NS_IMETHODIMP nsAutoSyncState::SetState(int32_t aState) { mSyncState = aState; if (aState == stCompletedIdle) { ResetDownloadQ(); //tell folder to let go of its cached msg db pointer nsresult rv; nsCOMPtr<nsIMsgMailSession> session = do_GetService(NS_MSGMAILSESSION_CONTRACTID, &rv); if (NS_SUCCEEDED(rv) && session) { nsCOMPtr <nsIMsgFolder> ownerFolder = do_QueryReferent(mOwnerFolder, &rv); NS_ENSURE_SUCCESS(rv, rv); bool folderOpen; uint32_t folderFlags; ownerFolder->GetFlags(&folderFlags); session->IsFolderOpenInWindow(ownerFolder, &folderOpen); if (!folderOpen && ! (folderFlags & nsMsgFolderFlags::Inbox)) ownerFolder->SetMsgDatabase(nullptr); } } nsCString logStr("Sync State set to "); logStr.Append(stateStrings[aState]); logStr.Append(" for "); LogOwnerFolderName(logStr.get()); return NS_OK; }
void UninstallAllThread::removeDesuraCache() { gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_CACHE")); onLogEvent(logStr); m_iTotalPos++; std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0); onProgressEvent(pair); UTIL::FS::Path path(getCachePath(), "", false); std::vector<std::string> extList; extList.push_back("mcf"); for (size_t x=0; x<20; x++) extList.push_back(gcString("part_{0}", x)); UTIL::FS::Path dbDir(UTIL::OS::getAppDataPath(), L"", false); delLeftOverMcf(path, extList); delLeftOverMcf(dbDir, extList); UTIL::FS::Path mcfUploads = dbDir; UTIL::FS::Path mcfStore = dbDir; mcfUploads += UTIL::FS::File("mcf_uploads.sqlite"); mcfStore += UTIL::FS::File("mcfstoreb.sqlite"); UTIL::FS::delFile(mcfUploads); UTIL::FS::delFile(mcfStore); }
void UninstallAllThread::removeGameExplorerInfo() { gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_GAMEEXPLORER")); onLogEvent(logStr); m_iTotalPos++; std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0); onProgressEvent(pair); std::vector<std::string> regKeys; UTIL::WIN::getAllRegKeys("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games", regKeys, true); for (size_t x=0; x<regKeys.size(); x++) { gcString regKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games\\{0}\\AppExePath", regKeys[x]); std::string value = UTIL::WIN::getRegValue(regKey, true); if (value.find("desura://") != 0) continue; regKey = gcString("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\GameUX\\Games\\{0}", regKeys[x]); UTIL::WIN::delRegTree(regKey.c_str(), true); } UTIL::FS::Path gdfFolder(UTIL::OS::getAppDataPath(), L"", false); gdfFolder += "GDF"; UTIL::FS::delFolder(gdfFolder); }
void Log::outDB(LogTypes type, const char * str) { if (!str || type >= MAX_LOG_TYPES) return; std::string logStr(str); if (logStr.empty()) return; LoginDatabase.EscapeString(logStr); LoginDatabase.PExecute("INSERT INTO logs (time, realm, type, string) " "VALUES (" UI64FMTD ", %u, %u, '%s');", uint64(time(0)), realm, type, logStr.c_str()); }
void Log::outDB(LogTypes type, const char * str) { if (!str || type >= MAX_LOG_TYPES) return; std::string logStr(str); if (logStr.empty()) return; PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_ADD_LOG); stmt->setInt32(0, realm); stmt->setInt32(1, type); stmt->setString(2, logStr); LoginDatabase.Execute(stmt); }
void DisplayOrderSvc( decoder_context* pdecoder_context, DISPLAY_M* display_memory, int *x_size, int *y_size, int *Crop, int *img_to_display, MMO *Mmo) { int j; //The picture management is conditioned if the current layer is allocated if (Mmo -> MemoryAllocation){ //Just to avoid the AU parsing of players //Detect if we have waited enough decoded frame except for the first frame. if (0 == Mmo->num_free_poc_address){ int BestPos; POC_PARAMS *Frame; int dsiplayBaseLayerId = get_layer_id(pdecoder_context->dq_to_display,pdecoder_context->layer_id_table); Frame = FindBestFrame(Mmo, Mmo -> poc_params, &BestPos, MIN_POC); if (!Frame -> is_ghost){ //Try to know if we can release the memory address LAYER_MMO *LayerMmo = &Mmo -> LayerMMO [dsiplayBaseLayerId]; Mmo -> num_free_poc_address ++; CurrentDisplay(Mmo, LayerMmo, Frame -> Picture, display_memory); logStr("display pic poc:%d\tmemory:%x\n",Frame -> Picture -> poc,Frame -> Picture->picture_memory_y); log_flush(); printf("\t display :%d %d %d %d\n", Mmo -> LayerMMO [0] . num_decoded_frame, Frame -> Picture -> poc, Frame -> x_size, Frame -> y_size); *img_to_display = 1; *x_size = Frame -> x_size; *y_size = Frame -> y_size; *Crop = Frame -> Crop; for (j = BestPos; j < Mmo -> nb_img_display - Mmo -> num_free_poc_address + 1; j++){ memmove(&Mmo -> poc_params[j], &Mmo -> poc_params[j + 1], 1 * sizeof(POC_PARAMS)); } }else{ assert(0); } }else{ //Not ready yet *img_to_display = 0; } } }
void UninstallAllThread::removeUninstallInfo() { gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_UNINSTALL")); onLogEvent(logStr); m_iTotalPos++; std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0); onProgressEvent(pair); std::vector<std::string> regKeys; UTIL::WIN::getAllRegKeys("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall", regKeys); for (size_t x=0; x<regKeys.size(); x++) { std::string key = regKeys[x]; if (key.find("Desura") != 0) continue; gcString regKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{0}", key); UTIL::WIN::delRegTree(regKey.c_str()); } }
void UninstallAllThread::removeDesuraSettings() { gcString logStr("{0}\n", Managers::GetString("#DUN_THREAD_SETTINGS")); onLogEvent(logStr); m_iTotalPos++; std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0); onProgressEvent(pair); UTIL::FS::Path dbDir(UTIL::OS::getAppDataPath(), L"", false); std::vector<UTIL::FS::Path> fileList; std::vector<UTIL::FS::Path> folderList; UTIL::FS::getAllFiles(dbDir, fileList, nullptr); UTIL::FS::getAllFolders(dbDir, folderList); for (size_t x=0; x<fileList.size(); x++) { std::string fileName = fileList[x].getFile().getFile(); if (fileName == "mcfstoreb.sqlite" || fileName == "mcf_uploads.sqlite") continue; UTIL::FS::delFile(fileList[x]); } for (size_t x=0; x<folderList.size(); x++) { std::string folderName = folderList[x].getLastFolder(); if (folderName == "mods" || folderName == "games" || folderName == "GDF") continue; UTIL::FS::delFolder(folderList[x]); } }
// 创建所有下级对话框 void FormDeploy::initChildDialog() { //const int numbers = 7; //const TCHAR *idd = L"IDD_TAB_PAGE"; //TCHAR *name = (TCHAR*)calloc(128, sizeof(TCHAR)); HINSTANCE hInst = GetModuleHandle(NULL); RECT rc = {}; GetClientRect( this->hWnd, &rc); //wsprintf(name, L"%s%d", idd, 0); hwndChild[0] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE1), hWnd, HwndWndProc0); hwndChild[1] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE2), hWnd, HwndWndProc1); hwndChild[2] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE3), hWnd, HwndWndProc2); hwndChild[3] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE4), hWnd, HwndWndProc3); hwndChild[4] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE5), hWnd, HwndWndProc4); hwndChild[5] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE6), hWnd, HwndWndProc5); hwndChild[6] = CreateDialog(hInst, MAKEINTRESOURCE(IDD_TAB_PAGE7), hWnd, HwndWndProc6); for (int i = 0 ; i < 7; i++){ if (NULL == hwndChild[i]){ logStr(L"生成子窗口失败。"); break; } } showTab(0); // this->sm->init(hwndChild); this->sm->fileGet(dbHelper->getPath(L"fileSystem.properties")); //SettingItem *si = this->sm->findItem(L"backupPath"); //si->toString(); this->sm->dataSet(TRUE); }
//-------- Begin of function Remote::process_receive_queue ---------// // // Process messages in the receive queue. // void Remote::process_receive_queue() { if( !process_queue_flag ) // avoid sys.yield() return; int processFlag; int loopCount=0; disable_poll_msg(); RemoteQueue &rq = receive_queue[0]; RemoteQueueTraverse rqt(rq); if( !rq.validate_queue() ) err.run( "Queue corrupted, Remote::process_receive_queue()" ); //---- if not started yet, process the message without handling the message sequence ----// if( !power.enable_flag ) { for( rqt.traverse_set_start(); !rqt.traverse_finish(); rqt.traverse_next() ) { err_when( ++loopCount > 1000 ); RemoteMsg* remoteMsgPtr = rqt.get_remote_msg(); remoteMsgPtr->process_msg(); } } else //--------- process in the order of nation recno --------// { LOG_BEGIN; for( int nationRecno=1 ; nationRecno<=nation_array.size() ; ++nationRecno ) { if( nation_array.is_deleted(nationRecno) || nation_array[nationRecno]->nation_type==NATION_AI ) continue; nation_processing = nationRecno; processFlag=0; //-------- scan through the message queue --------// loopCount = 0; for( rqt.traverse_set_start(); !rqt.traverse_finish(); rqt.traverse_next() ) { err_when( ++loopCount > 1000 ); RemoteMsg* remoteMsgPtr = rqt.get_remote_msg(); //--- check if this message indicates the start of a new message queue ---// if( remoteMsgPtr->id == MSG_QUEUE_HEADER ) { short msgNation = *(short *)(&remoteMsgPtr->data_buf[sizeof(DWORD)]); //--- if this is the message queue of the nation we should process now ----// if(msgNation==nationRecno ) // struct of data_buf: <DWORD> frameCount + <short> nationRecno { processFlag = 1; } else //--- if this is a message queue that should be processed now ---// { if( processFlag ) //--- if we were previously processing the right queue, now the processing is complete by this point ---// break; // message on next nation is met, stop this nation } } else if( remoteMsgPtr->id == MSG_QUEUE_TRAILER ) { short msgNation = *(short *)remoteMsgPtr->data_buf; //--- if this is the message queue of the nation we should process now ----// if(msgNation==nationRecno ) // struct of data_buf:<short> nationRecno break; // end of that nation } else { //--- if this is the message queue of the nation we should process now ----// if( processFlag ) { #if defined(ENABLE_LOG) String logStr("begin process remote message id:"); logStr += (long) remoteMsgPtr->id; logStr += " of nation "; logStr += nation_processing; LOG_MSG(logStr); #endif remoteMsgPtr->process_msg(); LOG_MSG("end process remote message"); LOG_MSG(m.get_random_seed()); } } } nation_processing = 0; } LOG_END; } //---------- clear receive_queue[0] and shift from next queue ------// rq.clear(); int n; for( n = 1; n < RECEIVE_QUEUE_BACKUP; ++n) { receive_queue[n-1].swap(receive_queue[n]); receive_frame_count[n-1] = receive_frame_count[n]; } receive_frame_count[n-1]++; enable_poll_msg(); }
HWND FormDeploy::Create(HINSTANCE hInst, HWND hWndMain) { RECT rc = {}; GetClientRect(hWndMain,&rc); //WNDCLASSEX wc; //memset(&wc,0,sizeof(wc)); //wc.hInstance = hInst; //wc.lpszClassName = WC_TABCONTROL; //wc.cbSize = sizeof(WNDCLASSEX); //wc.style = CS_HREDRAW | CS_VREDRAW; //wc.lpfnWndProc = DeployTabWndProc; //wc.cbClsExtra = 0; //wc.cbWndExtra = 0; //wc.hIcon = NULL; //wc.hCursor = LoadCursor(NULL,IDC_ARROW); //wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); //wc.lpszMenuName = NULL; //wc.hIconSm = NULL; //RegisterClassEx(&wc); HWND hWnd2 = CreateWindowEx(NULL, WC_TABCONTROL, L"tab1", WS_VISIBLE | WS_CHILD, 0, 0, rc.right, rc.bottom, hWndMain, NULL, hInst, NULL); if (hWnd2 == NULL) { logStr(L"创建失败"); return 0; } TCHAR Name[7][9] = { L"系统", L"客户端", L"目录", L"二维码", L"铭牌", L"移动安全", L"高级" }; TCITEM ti; memset(&ti, 0, sizeof(ti)); ti.cchTextMax = 9; ti.mask = TCIF_TEXT;// | TCIF_IMAGE; //ti.iImage = -1; int t = sizeof(Name) / sizeof(Name[0]); HDC hdc = GetDC(hWnd2); for (int i = 0; i < t; i++) { ti.pszText = Name[i]; TabCtrl_InsertItem(hWnd2, i, &ti); //TextOut(hdc, // lpdis->rcItem.left, // lpdis->rcItem.top, // ti.pszText, // lstrlen(ti.pszText)); //SendMessage(hWnd2,TCM_INSERTITEM,(WPARAM)0,(LPARAM) (LPTCITEM)&ti); } DeleteDC(hdc); TabCtrl_SetCurSel(hWnd2, 0); // ShowWindow(hWnd2, SW_SHOW); // UpdateWindow(hWnd2); this->hWnd = hWnd2; this->initChildDialog(); return this->hWnd; }
void UninstallAllThread::run() { if (!m_pUser) return; bool removeSimple = HasAnyFlags(m_iFlags, REMOVE_SIMPLE); bool removeCache = HasAnyFlags(m_iFlags, REMOVE_CACHE); bool removeSettings = HasAnyFlags(m_iFlags, REMOVE_SETTINGS); std::vector<UserCore::Item::ItemHandleI*> uninstallList; std::vector<UserCore::Item::ItemInfoI*> gamesList; m_pUser->getItemManager()->getGameList(gamesList); for (size_t x=0; x<gamesList.size(); x++) { UserCore::Item::ItemInfoI* game = gamesList[x]; std::vector<UserCore::Item::ItemInfoI*> modList; for (size_t y=0; y<modList.size(); y++) { if (modList[x]->isInstalled() && (modList[x]->isComplex() || removeSimple)) uninstallList.push_back(m_pUser->getItemManager()->findItemHandle(modList[x]->getId())); } if (removeSimple && game->isInstalled()) uninstallList.push_back(m_pUser->getItemManager()->findItemHandle(game->getId())); } { gcString str("{0}\n", Managers::GetString("#DUN_THREAD_UNINSTALL")); onLogEvent(str); } m_iTotal = uninstallList.size() + (removeCache?1:0) + (removeSettings?1:0) + 2; for (size_t x=0; x<uninstallList.size(); x++) { m_iTotalPos++; std::pair<uint32,uint32> pair(m_iTotalPos*100/m_iTotal, 0); onProgressEvent(pair); if (isStopped()) break; UserCore::Item::ItemHandleI* itemHandle = uninstallList[x]; if (!itemHandle) continue; gcString logStr("\t{0}\n", gcString(Managers::GetString("#DUN_THREAD_UNINSTALL_SUB"), itemHandle->getItemInfo()->getName())); onLogEvent(logStr); itemHandle->addHelper(this); itemHandle->uninstall(this, true, false); m_WaitCondition.wait(); itemHandle->delHelper(this); } m_pUser->logOut(); removeUninstallInfo(); removeGameExplorerInfo(); if (removeCache) removeDesuraCache(); if (removeSettings) removeDesuraSettings(); gcString finalLogStr("{0}\n", Managers::GetString("#DUN_THREAD_FINAL")); onLogEvent(finalLogStr); UTIL::WIN::delRegValue(APPID); UTIL::WIN::delRegValue(APPBUILD); UTIL::WIN::delRegValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Desura\\DesuraApp\\InstallPath"); UTIL::FS::Path path(UTIL::OS::getCommonProgramFilesPath(), L"", false); UTIL::FS::delFolder(path); UTIL::FS::delEmptyFolders(m_pUser->getAppDataPath()); UTIL::WIN::delRegKey("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Desura"); onCompleteEvent(); }