void MicroSettingsDlg::slotSaveStuff() { for ( unsigned i = 0; i < m_portNames.size(); i++ ) savePort(i); m_pMicroSettings->removeAllVariables(); for ( int i=0; i< m_pWidget->variables->numRows(); i++ ) saveVariable(i); m_pMicroSettings->setPinMappings( m_pinMappings ); }
//---------------------------------------------------------------------- // For saving and loading functions //---------------------------------------------------------------------- void saveFunction(LoadedFunction *fun, Common::WriteStream *stream) { int a; stream->writeUint16BE(fun->originalNumber); if (fun->calledBy) { stream->writeByte(1); saveFunction(fun->calledBy, stream); } else { stream->writeByte(0); } stream->writeUint32LE(fun->timeLeft); stream->writeUint16BE(fun->runThisLine); stream->writeByte(fun->cancelMe); stream->writeByte(fun->returnSomething); stream->writeByte(fun->isSpeech); saveVariable(&(fun->reg), stream); if (fun->freezerLevel) { fatal(ERROR_GAME_SAVE_FROZEN); } saveStack(fun->stack, stream); for (a = 0; a < fun->numLocals; a++) { saveVariable(&(fun->localVars[a]), stream); } }
void HmCcTc::saveVariables() { try { BidCoSPeer::saveVariables(); saveVariable(1000, _currentDutyCycleDeviceAddress); saveVariable(1004, _valveState); saveVariable(1005, _newValveState); saveVariable(1006, _lastDutyCycleEvent); saveVariable(1007, (int64_t)_dutyCycleMessageCounter); } catch(const std::exception& ex) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(BaseLib::Exception& ex) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { GD::out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
//---------------------------------------------------------------------- // For saving and loading stacks... //---------------------------------------------------------------------- void saveStack(VariableStack *vs, Common::WriteStream *stream) { int elements = 0; int a; VariableStack *search = vs; while (search) { elements++; search = search->next; } stream->writeUint16BE(elements); search = vs; for (a = 0; a < elements; a++) { saveVariable(&search->thisVar, stream); search = search->next; } }
void HM_LC_SWX_FM::saveStates() { try { std::vector<uint8_t> serializedData; serializeStates(serializedData); saveVariable(1001, serializedData); } catch(const std::exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(Exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void HM_LC_SWX_FM::saveVariables() { try { if(_deviceID == 0) return; HomeMaticDevice::saveVariables(); saveVariable(1000, _channelCount); saveStates(); //1001 } catch(const std::exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(Exception& ex) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what()); } catch(...) { Output::printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__); } }
void nasolver<nr_type_t>::saveResults (const std::string &volts, const std::string &s, int saveOPs, qucs::vector * f) { int N = countNodes (); int M = countVoltageSources (); // add node voltage variables if (!volts.empty()) { for (int r = 0; r < N; r++) { std::string n = createV (r, volts, saveOPs); if(!n.empty()) { saveVariable (n, x->get (r), f); } } } // add branch current variables if (!amps.empty()) { for (int r = 0; r < M; r++) { std::string n = createI (r, amps, saveOPs); if (!n.empty()) { saveVariable (n, x->get (r + N), f); } } } // add voltage probe data if (!volts.empty()) { circuit * root = subnet->getRoot (); for (circuit * c = root; c != NULL; c = (circuit *) c->getNext ()) { if (!c->isProbe ()) continue; if (!c->getSubcircuit().empty() && !(saveOPs & SAVE_ALL)) continue; if (volts != "vn") c->saveOperatingPoints (); std::string n = createOP (c->getName (), volts); saveVariable (n, nr_complex_t (c->getOperatingPoint ("Vr"), c->getOperatingPoint ("Vi")), f); } } // save operating points of non-linear circuits if requested if (saveOPs & SAVE_OPS) { circuit * root = subnet->getRoot (); for (circuit * c = root; c != NULL; c = (circuit *) c->getNext ()) { if (!c->isNonLinear ()) continue; if (!c->getSubcircuit ().empty() && !(saveOPs & SAVE_ALL)) continue; c->calcOperatingPoints (); for (auto ops: c->getOperatingPoints ()) { operatingpoint &p = ops.second; std::string n = createOP (c->getName (), p.getName ()); saveVariable (n, p.getValue (), f); } } } }
bool saveGame(const Common::String &fname) { Common::OutSaveFile *fp = g_system->getSavefileManager()->openForSaving(fname); if (fp == NULL) return false; fp->writeString("SLUDSA"); fp->writeByte(0); fp->writeByte(0); fp->writeByte(MAJOR_VERSION); fp->writeByte(MINOR_VERSION); if (!g_sludge->_gfxMan->saveThumbnail(fp)) return false; fp->write(&fileTime, sizeof(FILETIME)); // DON'T ADD ANYTHING NEW BEFORE THIS POINT! fp->writeByte(allowAnyFilename); fp->writeByte(captureAllKeys); fp->writeByte(true); g_sludge->_txtMan->saveFont(fp); // Save backdrop fp->writeUint16BE(g_sludge->_gfxMan->getCamX()); fp->writeUint16BE(g_sludge->_gfxMan->getCamY()); fp->writeFloatLE(g_sludge->_gfxMan->getCamZoom()); fp->writeByte(brightnessLevel); g_sludge->_gfxMan->saveHSI(fp); // Save event handlers g_sludge->_evtMan->saveHandlers(fp); // Save regions saveRegions(fp); g_sludge->_cursorMan->saveCursor(fp); // Save functions LoadedFunction *thisFunction = allRunningFunctions; int countFunctions = 0; while (thisFunction) { countFunctions++; thisFunction = thisFunction->next; } fp->writeUint16BE(countFunctions); thisFunction = allRunningFunctions; while (thisFunction) { saveFunction(thisFunction, fp); thisFunction = thisFunction->next; } for (int a = 0; a < numGlobals; a++) { saveVariable(&globalVars[a], fp); } savePeople(fp); if (currentFloor->numPolygons) { fp->writeByte(1); fp->writeUint16BE(currentFloor->originalNum); } else { fp->writeByte(0); } g_sludge->_gfxMan->saveZBuffer(fp); g_sludge->_gfxMan->saveLightMap(fp); fp->writeByte(fadeMode); g_sludge->_speechMan->save(fp); saveStatusBars(fp); g_sludge->_soundMan->saveSounds(fp); fp->writeUint16BE(saveEncoding); blur_saveSettings(fp); g_sludge->_gfxMan->saveColors(fp); g_sludge->_gfxMan->saveParallax(fp); fp->writeByte(0); g_sludge->_languageMan->saveLanguageSetting(fp); g_sludge->_gfxMan->saveSnapshot(fp); fp->flush(); fp->finalize(); delete fp; clearStackLib(); return true; }