void Reset() { if (!HasEscortState(STATE_ESCORT_ESCORTING)) { uiTimer = 0; uiPhase = 0; RestoreAll(); SummonList.clear(); GoSummonList.clear(); } }
void AlliesWhiteboard::Blit(LPDIRECTDRAWSURFACE DestSurf) { if(lpInputBox->IsLost() != DD_OK) { RestoreAll(); } ReceiveMarkers(); SendMarkers(); DrawMarkers(DestSurf); if(InputShown) DrawTextInput(DestSurf); }
// Fix in memory and return and pointer to the memory associated with our back buffer void *ImageBuffer::Lock(bool bLockMutexOnly, bool bWriteOnly) { #ifdef _IMAGEBUFFER_PROTECT_SURF_LOCK EnterCriticalSection(&m_cs); if(bLockMutexOnly) return NULL; #endif ShiAssert(IsReady()); HRESULT hr; DDSURFACEDESC2 ddsd; ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); // DWORD dwFlags = DDLOCK_NOSYSLOCK | DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR; DWORD dwFlags = DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR; if(bWriteOnly) dwFlags |= DDLOCK_WRITEONLY; int nRetries = 1; Retry: hr = m_pDDSBack->Lock(NULL, &ddsd, dwFlags, NULL); m_bBitsLocked = SUCCEEDED(hr); if(FAILED(hr)) { MonoPrint("ImageBuffer::Lock - Lock failed with 0x%X\n", hr); if(hr == DDERR_SURFACELOST && nRetries) { RestoreAll(); nRetries--; goto Retry; } } return ddsd.lpSurface; }
void CTLord::CreateColleagues( void ) { // 협력 객체의 생성 및 초기화 // 생성 m_pController = new CLController( this ); m_pController->CreateDbHandler( MIN( 1 ) ); CTElection * pElection = new CTElection( this ); CLEvent* pEvent = new CLEvent( this ); CLordSkill* pSkills = new CTLordSkill( this ); // 스크립트 pElection->Initialize( "election.inc" ); pEvent->Initialize( "lordevent.inc" ); pSkills->Initialize( "lordskill.txt" ); // 설정 m_pElection = pElection; m_pEvent = pEvent; m_pSkills = pSkills; // 데이터베이스로부터 이전 상태 복원 if( !RestoreAll() ) { election::OutputDebugString( "CTLord.CreateColleagues" ); exit( -1 ); } }
//------------------------------------------------------- void PersistenceHandler::Start(bool restore) { if (m_started) { m_debug << "Persistence handling already started."<< std::endl; return; } m_debug << "Starting Persistence handling"<< std::endl; try { m_dobConnection.Open(L"DOPE_SUBSCRIBE", L"0", PERSISTENCE_CONTEXT, nullptr, &m_dispatcher); m_debug << "Opened DOB connection DOPE_SUBSCRIBE"<<std::endl; } catch (Safir::Dob::NotOpenException e) { Safir::Logging::SendSystemLog(Safir::Logging::Critical, L"PersistenceHandler failed to connect to Dob, Maybe Dope is already running?"); throw StartupError(); } PerformStartupChecks(); if (restore) { // Normal startup try { m_debug << "Restoring all stored entities"<< std::endl; RestoreAll(); } catch (const Safir::Dob::AccessDeniedException & e) { throw Safir::Dob::Typesystem::SoftwareViolationException (std::wstring(L"DOSE gave me AccessDeniedException when I was trying to Set persisted data! AccessDeniedException info: ") + e.GetExceptionInfo(),__WFILE__,__LINE__); } StartSubscriptions(); ReportPersistentDataReady(); } else { // Failover startup, don't restore anything. if (Safir::Dob::PersistenceParameters::StandaloneMode()) { // If standalone mode then clear all before starting subscriptions RemoveAll(); } StartSubscriptions(); } // Start timer HandleTimeout(); m_started = true; m_debug << "Persistence handling successfully started"<<std::endl; }
void P3DModelEditPanel::UpdatePanelMinSize () { HideAll(); RestoreAll(); }
void UpdateFrame2(HWND hWnd, void* videoMem) { static BYTE phase = 0; HRESULT hRet; LPDIRECTDRAWSURFACE pdds; DDBLTFX ddbltfx; static int cnt = 0; memset(&ddbltfx, 0, sizeof(ddbltfx)); ddbltfx.dwSize = sizeof(ddbltfx); ddbltfx.dwROP = SRCCOPY; if (phase) { pdds = g_pDDSTwo; phase = 0; } else { pdds = g_pDDSOne; phase = 1; } #if 1 DDSURFACEDESC ddsd; ddsd.dwSize = sizeof(ddsd); while (true) { WaitForSingleObject(g_hRefreshScreen, INFINITE); hRet = g_pDDSPrimary->Lock(NULL, &ddsd, DDLOCK_WAITNOTBUSY | DDLOCK_DISCARD | DDLOCK_WRITEONLY, NULL); if (hRet == DD_OK) { //memcpy((char*)ddsd.lpSurface, g_videoMem, (ddsd.dwHeight - 26) * ddsd.lPitch); memcpy((char*)ddsd.lpSurface + ddsd.lPitch * 26, g_videoMem, (ddsd.dwHeight - 26) * ddsd.lPitch); //memcpy((char*)ddsd.lpSurface, videoMem, ddsd.dwHeight * ddsd.lPitch); hRet = g_pDDSPrimary->Unlock(NULL); } } //hRet = g_pDDSPrimary->Blt(NULL, g_pDDSBack, NULL, DDBLT_ROP, &ddbltfx);//dwTransType, NULL); #else while (TRUE) { hRet = g_pDDSBack->Blt(NULL, pdds, NULL, DDBLT_ROP, &ddbltfx); if (hRet == DD_OK) break; if (hRet == DDERR_SURFACELOST) { hRet = RestoreAll(); if (hRet != DD_OK) break; } if (hRet != DDERR_WASSTILLDRAWING) break; Sleep(10); } while (TRUE) { hRet = g_pDDSPrimary->Flip(NULL, 0); if (hRet == DD_OK) break; if (hRet == DDERR_SURFACELOST) { hRet = RestoreAll(); if (hRet != DD_OK) break; } if (hRet != DDERR_WASSTILLDRAWING) break; Sleep(10); } #endif }
// Constructor. Settings::Settings(const std::string& path) : _settingsPath(path), _errorHandler(NULL) { // The default values of all settings are defined here. // Printer settings are common to all prints. // Z_MICRONS_PER_REV == 2000 (2 mm lead screw pitch at 1:1 gear ratio) // R_MILLIDEGREES_PER_REV == 180000 (2:1 gear ratio for rotation) std::ostringstream printerSettings; printerSettings << "\"" << DOWNLOAD_DIR << "\":\"" << ROOT_DIR << "/download\"," << "\"" << STAGING_DIR << "\":\"" << ROOT_DIR << "/staging\"," << "\"" << PRINT_DATA_DIR << "\":\"" << ROOT_DIR << "/print_data\"," << "\"" << HARDWARE_REV << "\": 1," << "\"" << LAYER_OVERHEAD << "\": 0.660," << "\"" << MAX_TEMPERATURE << "\": 80.0," << "\"" << INSPECTION_HEIGHT << "\": 60000," << "\"" << MAX_Z_TRAVEL << "\": 160000," << "\"" << DETECT_JAMS << "\": 1," << "\"" << MAX_UNJAM_TRIES << "\": 5," << "\"" << MOTOR_TIMEOUT_FACTOR << "\": 1.1," << "\"" << MIN_MOTOR_TIMEOUT_SEC << "\": 15.0," << "\"" << PROJECTOR_LED_CURRENT << "\": -1," << "\"" << MICRO_STEPS_MODE << "\": 6," << "\"" << Z_STEP_ANGLE << "\": 1800," << "\"" << Z_MICRONS_PER_REV << "\": 2000," << "\"" << R_STEP_ANGLE << "\": 1800," << "\"" << R_MILLIDEGREES_PER_REV << "\": 180000," << "\"" << Z_HOMING_JERK << "\": 500000," << "\"" << Z_HOMING_SPEED << "\": 4500," << "\"" << R_HOMING_JERK << "\": 100000," << "\"" << R_HOMING_SPEED << "\": 5," << "\"" << R_HOMING_ANGLE << "\": -60000," << "\"" << Z_START_PRINT_JERK << "\": 100000," << "\"" << Z_START_PRINT_SPEED << "\": 4500," << "\"" << Z_START_PRINT_POSITION << "\": -165000," << "\"" << R_START_PRINT_JERK << "\": 100000," << "\"" << R_START_PRINT_SPEED << "\": 5," << "\"" << R_START_PRINT_ANGLE << "\": 60000," << "\"" << FRONT_PANEL_AWAKE_TIME << "\": 30," << "\"" << IMAGE_SCALE_FACTOR << "\": 1.0," << "\"" << USB_DRIVE_DATA_DIR << "\": \"/EmberUSB\"," << "\"" << FW_VERSION << "\": \"\""; // Print settings are specific to a print, rather than the printer as a whole std::ostringstream printSpecificSettings; printSpecificSettings << "\"" << JOB_NAME_SETTING << "\": \"\"," << "\"" << USER_NAME_SETTING << "\": \"\"," << "\"" << JOB_ID_SETTING << "\": \"\"," << "\"" << PRINT_FILE_SETTING << "\": \"\"," << "\"" << LAYER_THICKNESS << "\": 25," << "\"" << FIRST_EXPOSURE << "\": 5.0," << "\"" << BURN_IN_LAYERS << "\": 1," << "\"" << BURN_IN_EXPOSURE << "\": 4.0," << "\"" << MODEL_EXPOSURE << "\": 2.5," << "\"" << HOME_ON_APPROACH << "\": 0," << "\"" << FL_SEPARATION_R_JERK << "\": 100000," << "\"" << FL_SEPARATION_R_SPEED << "\": 6," << "\"" << FL_APPROACH_R_JERK << "\": 100000," << "\"" << FL_APPROACH_R_SPEED << "\": 6," << "\"" << FL_Z_LIFT << "\": 2000," << "\"" << FL_SEPARATION_Z_JERK << "\": 100000," << "\"" << FL_SEPARATION_Z_SPEED << "\": 4500," << "\"" << FL_APPROACH_Z_JERK << "\": 100000," << "\"" << FL_APPROACH_Z_SPEED << "\": 4500," << "\"" << FL_ROTATION << "\": 60000," << "\"" << FL_EXPOSURE_WAIT << "\": 0," << "\"" << FL_SEPARATION_WAIT << "\": 0," << "\"" << FL_APPROACH_WAIT << "\": 0," << "\"" << FL_PRESS << "\": 0," << "\"" << FL_PRESS_SPEED << "\": 4500," << "\"" << FL_PRESS_WAIT << "\": 0," << "\"" << FL_UNPRESS_SPEED << "\": 4500," << "\"" << BI_SEPARATION_R_JERK << "\": 100000," << "\"" << BI_SEPARATION_R_SPEED << "\": 11," << "\"" << BI_APPROACH_R_JERK << "\": 100000," << "\"" << BI_APPROACH_R_SPEED << "\": 11," << "\"" << BI_Z_LIFT << "\": 2000," << "\"" << BI_SEPARATION_Z_JERK << "\": 100000," << "\"" << BI_SEPARATION_Z_SPEED << "\": 4500," << "\"" << BI_APPROACH_Z_JERK << "\": 100000," << "\"" << BI_APPROACH_Z_SPEED << "\": 4500," << "\"" << BI_ROTATION << "\": 60000," << "\"" << BI_EXPOSURE_WAIT << "\": 0," << "\"" << BI_SEPARATION_WAIT << "\": 0," << "\"" << BI_APPROACH_WAIT << "\": 0," << "\"" << BI_PRESS << "\": 0," << "\"" << BI_PRESS_SPEED << "\": 4500," << "\"" << BI_PRESS_WAIT << "\": 0," << "\"" << BI_UNPRESS_SPEED << "\": 4500," << "\"" << ML_SEPARATION_R_JERK << "\": 100000," << "\"" << ML_SEPARATION_R_SPEED << "\": 12," << "\"" << ML_APPROACH_R_JERK << "\": 100000," << "\"" << ML_APPROACH_R_SPEED << "\": 12," << "\"" << ML_Z_LIFT << "\": 2000," << "\"" << ML_SEPARATION_Z_JERK << "\": 100000," << "\"" << ML_SEPARATION_Z_SPEED << "\": 4500," << "\"" << ML_APPROACH_Z_JERK << "\": 100000," << "\"" << ML_APPROACH_Z_SPEED << "\": 4500," << "\"" << ML_ROTATION << "\": 60000," << "\"" << ML_EXPOSURE_WAIT << "\": 0," << "\"" << ML_SEPARATION_WAIT << "\": 0," << "\"" << ML_APPROACH_WAIT << "\": 0," << "\"" << ML_PRESS << "\": 0," << "\"" << ML_PRESS_SPEED << "\": 4500," << "\"" << ML_PRESS_WAIT << "\": 0," << "\"" << ML_UNPRESS_SPEED << "\": 4500"; std::ostringstream JSONPrefix; JSONPrefix << "{\"" << SETTINGS_ROOT_KEY << "\":{"; // define the default value for each of the settings std::ostringstream defaultJSON; defaultJSON << JSONPrefix.str() << printerSettings.str() << "," << printSpecificSettings.str() << "}}"; _defaultJSON = defaultJSON.str(); // create a JSON string containing the default print specific settings std::ostringstream defaultPrintSpecificJSON; defaultPrintSpecificJSON << JSONPrefix.str() << printSpecificSettings.str() << "}}"; _defaultPrintSpecificJSON = defaultPrintSpecificJSON.str(); // create the set of valid setting names Document doc; doc.Parse(_defaultJSON.c_str()); const Value& root = doc[SETTINGS_ROOT_KEY]; for (Value::ConstMemberIterator itr = root.MemberBegin(); itr != root.MemberEnd(); ++itr) { _names.insert(itr->name.GetString()); } // Make sure the parent directory of the settings file exists EnsureSettingsDirectoryExists(); if (!Load(path, true)) { RestoreAll(); // clear any print data, since it probably doesn't use default settings, // but don't call any code that uses Settings! PurgeDirectory(root[PRINT_DATA_DIR].GetString()); } }