void CSkins::RefreshSkinList(bool clear) { CALLSTACK_ADD(); if(clear) Clear(); IStorageTW::CLoadHelper<CSkins> *pLoadHelper = new IStorageTW::CLoadHelper<CSkins>; pLoadHelper->pSelf = this; pLoadHelper->pFullDir = "skins"; Storage()->ListDirectory(IStorageTW::TYPE_ALL, "skins", SkinScan, pLoadHelper); if(!g_Config.m_ClVanillaSkinsOnly) { pLoadHelper->pFullDir = "downloadedskins"; Storage()->ListDirectory(IStorageTW::TYPE_SAVE, "downloadedskins", SkinScan, pLoadHelper); } if(m_aSkins.size() == 0) { Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load skins. folder='skins/'"); CSkin DummySkin; DummySkin.m_OrgTexture = -1; DummySkin.m_ColorTexture = -1; str_copy(DummySkin.m_aName, "dummy", sizeof(DummySkin.m_aName)); DummySkin.m_BloodColor = vec3(1.0f, 1.0f, 1.0f); m_aSkins.add(DummySkin); } delete pLoadHelper; }
void CGameClient::OnInit() { m_pGraphics = Kernel()->RequestInterface<IGraphics>(); // propagate pointers m_UI.SetGraphics(Graphics(), TextRender()); m_RenderTools.m_pGraphics = Graphics(); m_RenderTools.m_pUI = UI(); int64 Start = time_get(); // set the language g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console()); // TODO: this should be different // setup item sizes for(int i = 0; i < NUM_NETOBJTYPES; i++) Client()->SnapSetStaticsize(i, m_NetObjHandler.GetObjSize(i)); // load default font static CFont *pDefaultFont = 0; char aFilename[512]; IOHANDLE File = Storage()->OpenFile("fonts/DejaVuSans.ttf", IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename)); if(File) { io_close(File); pDefaultFont = TextRender()->LoadFont(aFilename); TextRender()->SetDefaultFont(pDefaultFont); } if(!pDefaultFont) Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='fonts/DejaVuSans.ttf'"); // init all components for(int i = m_All.m_Num-1; i >= 0; --i) m_All.m_paComponents[i]->OnInit(); // setup load amount// load textures for(int i = 0; i < g_pData->m_NumImages; i++) { g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0); g_GameClient.m_pMenus->RenderLoading(); } for(int i = 0; i < m_All.m_Num; i++) m_All.m_paComponents[i]->OnReset(); int64 End = time_get(); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End-Start)*1000)/(float)time_freq()); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf); m_ServerMode = SERVERMODE_PURE; m_DDRaceMsgSent = false; m_ShowOthers = -1; // Set free binds to DDRace binds if it's active if(!g_Config.m_ClDDRaceBindsSet && g_Config.m_ClDDRaceBinds) gs_Binds.SetDDRaceBinds(true); }
void CGameClient::OnInit() { m_pGraphics = Kernel()->RequestInterface<IGraphics>(); // propagate pointers m_UI.SetGraphics(Graphics(), TextRender()); m_RenderTools.m_pGraphics = Graphics(); m_RenderTools.m_pUI = UI(); int64 Start = time_get(); // set the language g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console()); // TODO: this should be different // setup item sizes for(int i = 0; i < NUM_NETOBJTYPES; i++) Client()->SnapSetStaticsize(i, m_NetObjHandler.GetObjSize(i)); // load default font char aFontName[256]; str_format(aFontName, sizeof(aFontName), "fonts/%s", g_Config.m_ClFontfile); char aFilename[512]; IOHANDLE File = Storage()->OpenFile(aFontName, IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename)); if(File) { io_close(File); if(TextRender()->LoadFont(aFilename)) { char aBuf[256]; str_format(aBuf, sizeof(aBuf), "failed to load font. filename='%s'", aFontName); Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", aBuf); } } // init all components for(int i = m_All.m_Num-1; i >= 0; --i) m_All.m_paComponents[i]->OnInit(); // setup load amount// load textures for(int i = 0; i < g_pData->m_NumImages; i++) { g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0); m_pMenus->RenderLoading(); } OnReset(); int64 End = time_get(); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End-Start)*1000)/(float)time_freq()); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf); m_ServerMode = SERVERMODE_PURE; }
void CGameClient::OnInit() { int64 Start = time_get(); // set the language g_Localization.Load(g_Config.m_ClLanguagefile, Storage(), Console()); // init all components // setup item sizes for(int i = 0; i < NUM_NETOBJTYPES; i++) Client()->SnapSetStaticsize(i, m_NetObjHandler.GetObjSize(i)); // load default font static CFont *pDefaultFont = 0; char aFilename[512]; IOHANDLE File = Storage()->OpenFile("fonts/DejaVuSans.ttf", IOFLAG_READ, IStorage::TYPE_ALL, aFilename, sizeof(aFilename)); if(File) { io_close(File); pDefaultFont = TextRender()->LoadFont(aFilename); TextRender()->SetDefaultFont(pDefaultFont); } if(!pDefaultFont) Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load font. filename='fonts/DejaVuSans.ttf'"); // init all components for(int i = m_All.m_Num-1; i >= 0; --i) m_All.m_paComponents[i]->OnInit(); // setup load amount// load textures for(int i = 0; i < g_pData->m_NumImages; i++) { g_pData->m_aImages[i].m_Id = Graphics()->LoadTexture(g_pData->m_aImages[i].m_pFilename, IStorage::TYPE_ALL, CImageInfo::FORMAT_AUTO, 0); g_GameClient.m_pMenus->RenderLoading(); } for(int i = 0; i < m_All.m_Num; i++) m_All.m_paComponents[i]->OnReset(); g_GameClient.m_pMenus->RenderLoading(); int64 End = time_get(); char aBuf[256]; str_format(aBuf, sizeof(aBuf), "initialisation finished after %.2fms", ((End-Start)*1000)/(float)time_freq()); Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "gameclient", aBuf); m_ServerMode = SERVERMODE_PURE; }
int test_storage_layer_size() { int Error(0); gli::storage Storage( 2, 1, 1, gli::storage::dimensions3_type(2, 2, 1), sizeof(glm::u8vec4), gli::storage::dimensions3_type(1)); std::vector<glm::u8vec4> Data(8, glm::u8vec4(0)); for(std::size_t i = 0; i < 4; ++i) Data[i + 0] = glm::u8vec4(255, 127, 0, 255); for(std::size_t i = 0; i < 4; ++i) Data[i + 4] = glm::u8vec4(0, 127, 255, 255); memcpy(Storage.data(), &Data[0][0], Data.size() * sizeof(glm::u8vec4)); Error += Storage.blockSize() == sizeof(glm::u8vec4) ? 0 : 1; Error += Storage.levelSize(0) == sizeof(glm::u8vec4) * 2 * 2 ? 0 : 1; Error += Storage.faceSize() == sizeof(glm::u8vec4) * 2 * 2 ? 0 : 1; Error += Storage.layerSize() == sizeof(glm::u8vec4) * 2 * 2 ? 0 : 1; Error += Storage.size() == sizeof(glm::u8vec4) * 2 * 2 * 2 ? 0 : 1; return Error; }
int test_storage_face_size() { int Error(0); gli::storage Storage( 1, 6, 1, gli::storage::dimensions3_type(2, 2, 1), sizeof(glm::u8vec4), gli::storage::dimensions3_type(1)); gli::storage::size_type BlockSize = Storage.blockSize(); Error += BlockSize == sizeof(glm::u8vec4) ? 0 : 1; gli::storage::size_type LevelSize = Storage.levelSize(0); Error += LevelSize == sizeof(glm::u8vec4) * 2 * 2 ? 0 : 1; gli::storage::size_type FaceSize = Storage.faceSize(); Error += FaceSize == sizeof(glm::u8vec4) * 2 * 2 ? 0 : 1; gli::storage::size_type LayerSize = Storage.layerSize(); Error += LayerSize == sizeof(glm::u8vec4) * 2 * 2 * 6 ? 0 : 1; gli::storage::size_type Size = Storage.size(); Error += Size == sizeof(glm::u8vec4) * 2 * 2 * 6 ? 0 : 1; return Error; }
ComplexType Vertex4::operator()(long MatsubaraNumber1, long MatsubaraNumber2, long MatsubaraNumber3) const { //if(isVanishing()) // return 0.0; //else return Storage(MatsubaraNumber1,MatsubaraNumber2,MatsubaraNumber3); }
//--------------------------------------------------------------------------- void TConfiguration::Load() { TGuard Guard(FCriticalSection); std::unique_ptr<THierarchicalStorage> Storage(CreateStorage(false)); Storage->SetAccessMode(smRead); LoadFrom(Storage.get()); }
bool CTextRenderer::LoadFont(const char* pFilename) { char aFullPath[512]; IOHANDLE File = Storage()->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL, aFullPath, sizeof(aFullPath)); if(!File) { dbg_msg("TextRenderer", "Can't open %s", pFilename); return false; } io_close(File); CFont* pFont = new CFont(); str_copy(pFont->m_aFilename, aFullPath, sizeof(pFont->m_aFilename)); if(FT_New_Face(m_FTLibrary, pFont->m_aFilename, 0, &pFont->m_FtFace) != FT_Err_Ok) { dbg_msg("TextRenderer", "Can't create a regular font from %s", pFilename); delete pFont; return false; } pFont->m_pHBFont = hb_ft_font_create(pFont->m_FtFace, 0); m_Fonts.add(pFont); return true; }
bool ImageTexture::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="image" && p_value.get_type()==Variant::IMAGE) create_from_image( p_value,flags ); else if (p_name=="flags") if (w*h==0) flags=p_value; else set_flags(p_value); else if (p_name=="size") { Size2 s = p_value; w=s.width; h=s.height; VisualServer::get_singleton()->texture_set_size_override(texture,w,h); } else if (p_name=="storage") { storage=Storage(p_value.operator int()); } else if (p_name=="lossy_quality") { lossy_storage_quality=p_value; } else if (p_name=="_data") { _set_data(p_value); } else return false; return true; }
int run() { int Error(0); std::vector<test> Tests; Tests.push_back(test(gli::RGBA8U, 0, 0, 340)); Tests.push_back(test(gli::RGBA8U, 1, 256, 340)); Tests.push_back(test(gli::RGBA8U, 3, 336, 340)); Tests.push_back(test(gli::RGBA32F, 0, 0, 1360)); Tests.push_back(test(gli::RGBA32F, 1, 1024, 1360)); Tests.push_back(test(gli::RGB_DXT1, 0, 0, 56)); Tests.push_back(test(gli::RGBA_DXT1, 1, 32, 56)); for(std::size_t i = 0; i < Tests.size(); ++i) { gli::storage Storage( 1, 1, 4, Tests[i].Format, gli::storage::dimensions3_type(8, 8, 1)); gli::storage::size_type Offset = gli::detail::imageAddressing(Storage, 0, 0, Tests[i].Level); gli::storage::size_type Size = Storage.size(); Error += Offset == Tests[i].Offset ? 0 : 1; Error += Size == Tests[i].Size ? 0 : 1; } return Error; }
void CRaceDemo::SaveDemo(const char* pDemo) { char aNewFilename[512]; char aOldFilename[512]; if(g_Config.m_ClDemoName) { char aPlayerName[MAX_NAME_LENGTH]; str_copy(aPlayerName, m_pClient->m_aClients[m_pClient->m_Snap.m_LocalClientID].m_aName, sizeof(aPlayerName)); // check the player name for(int i = 0; i < MAX_NAME_LENGTH; i++) { if(!aPlayerName[i]) break; if(aPlayerName[i] == '\\' || aPlayerName[i] == '/' || aPlayerName[i] == '|' || aPlayerName[i] == ':' || aPlayerName[i] == '*' || aPlayerName[i] == '?' || aPlayerName[i] == '<' || aPlayerName[i] == '>' || aPlayerName[i] == '"') aPlayerName[i] = '%'; str_format(aNewFilename, sizeof(aNewFilename), "demos/%s_%5.2f_%s.demo", pDemo, m_Time, aPlayerName); } } else str_format(aNewFilename, sizeof(aNewFilename), "demos/%s_%5.2f.demo", pDemo, m_Time); str_format(aOldFilename, sizeof(aOldFilename), "demos/%s_tmp.demo", m_pMap); Storage()->RenameFile(aOldFilename, aNewFilename, IStorage::TYPE_SAVE); dbg_msg("racedemo", "Saved better demo"); }
//--------------------------------------------------------------------------- void TConfiguration::DoSave(bool All, bool Explicit) { if (FDontSave) { return; } std::unique_ptr<THierarchicalStorage> Storage(CreateStorage(false)); Storage->SetAccessMode(smReadWrite); Storage->SetExplicit(Explicit); if (Storage->OpenSubKey(GetConfigurationSubKey(), true)) { SaveData(Storage.get(), All); } Saved(); if (All) { StoredSessions->Save(true, Explicit); } // clean up as last, so that if it fails (read only INI), the saving can proceed if (GetStorage() == stRegistry) { CleanupIniFile(); } }
void CGameConsole::Dump(int Type) { CInstance *pConsole = Type == 1 ? &m_RemoteConsole : &m_LocalConsole; char aFilename[128]; time_t Time; char aDate[20]; time(&Time); tm* TimeInfo = localtime(&Time); strftime(aDate, sizeof(aDate), "%Y-%m-%d_%I-%M", TimeInfo); for(int i = 0; i < 10; i++) { IOHANDLE io; str_format(aFilename, sizeof(aFilename), "dumps/%s_dump%s-%05d.txt", Type==1?"remote_console":"local_console", aDate, i); io = Storage()->OpenFile(aFilename, IOFLAG_WRITE); if(io) { #if defined(CONF_FAMILY_WINDOWS) static const char Newline[] = "\r\n"; #else static const char Newline[] = "\n"; #endif for(char *pEntry = pConsole->m_Backlog.First(); pEntry; pEntry = pConsole->m_Backlog.Next(pEntry)) { io_write(io, pEntry, str_length(pEntry)); io_write(io, Newline, sizeof(Newline)-1); } io_close(io); break; } } }
bool CubeMap::_set(const StringName& p_name, const Variant& p_value) { if (p_name=="side/left") { set_side(SIDE_LEFT,p_value); } else if (p_name=="side/right") { set_side(SIDE_RIGHT,p_value); } else if (p_name=="side/bottom") { set_side(SIDE_BOTTOM,p_value); } else if (p_name=="side/top") { set_side(SIDE_TOP,p_value); } else if (p_name=="side/front") { set_side(SIDE_FRONT,p_value); } else if (p_name=="side/back") { set_side(SIDE_BACK,p_value); } else if (p_name=="flags") { set_flags(p_value); } else if (p_name=="storage") { storage=Storage(p_value.operator int()); } else if (p_name=="lossy_quality") { lossy_storage_quality=p_value; } else return false; return true; }
void CSkins::OnInit() { m_EventSkinPrefix[0] = '\0'; if(g_Config.m_Events) { time_t rawtime; struct tm* timeinfo; time(&rawtime); timeinfo = localtime(&rawtime); if(timeinfo->tm_mon == 11 && timeinfo->tm_mday >= 24 && timeinfo->tm_mday <= 26) { // Christmas str_copy(m_EventSkinPrefix, "santa", sizeof(m_EventSkinPrefix)); } } // load skins m_aSkins.clear(); Storage()->ListDirectory(IStorage::TYPE_ALL, "skins", SkinScan, this); if(!m_aSkins.size()) { Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load skins. folder='skins/'"); CSkin DummySkin; DummySkin.m_IsVanilla = true; DummySkin.m_OrgTexture = -1; DummySkin.m_ColorTexture = -1; str_copy(DummySkin.m_aName, "dummy", sizeof(DummySkin.m_aName)); DummySkin.m_BloodColor = ColorRGBA(1.0f, 1.0f, 1.0f); m_aSkins.add(DummySkin); } }
void CGameConsole::Dump(int Type) { CInstance *pConsole = Type == CONSOLETYPE_REMOTE ? &m_RemoteConsole : &m_LocalConsole; char aFilename[128]; char aDate[20]; str_timestamp(aDate, sizeof(aDate)); str_format(aFilename, sizeof(aFilename), "dumps/%s_dump_%s.txt", Type==CONSOLETYPE_REMOTE?"remote_console":"local_console", aDate); IOHANDLE io = Storage()->OpenFile(aFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE); if(io) { #if defined(CONF_FAMILY_WINDOWS) static const char Newline[] = "\r\n"; #else static const char Newline[] = "\n"; #endif for(CInstance::CBacklogEntry *pEntry = pConsole->m_Backlog.First(); pEntry; pEntry = pConsole->m_Backlog.Next(pEntry)) { io_write(io, pEntry->m_aText, str_length(pEntry->m_aText)); io_write(io, Newline, sizeof(Newline)-1); } io_close(io); } }
void TConfiguration::DoSave(bool All, bool Explicit) { if (FDontSave) { return; } std::unique_ptr<THierarchicalStorage> Storage(CreateConfigStorage()); Storage->SetAccessMode(smReadWrite); Storage->SetExplicit(Explicit); if (Storage->OpenSubKey(GetConfigurationSubKey(), true)) { // if saving to TOptionsStorage, make sure we save everything so that // all configuration is properly transferred to the master storage bool ConfigAll = All || Storage->GetTemporary(); SaveData(Storage.get(), ConfigAll); } Saved(); if (All) { StoredSessions->Save(true, Explicit); } // clean up as last, so that if it fails (read only INI), the saving can proceed if (GetStorage() == stRegistry) { CleanupIniFile(); } }
void CMenus::DemolistPopulate() { m_lDemos.clear(); if(!str_comp(m_aCurrentDemoFolder, "demos")) m_DemolistStorageType = IStorage::TYPE_ALL; Storage()->ListDirectory(m_DemolistStorageType, m_aCurrentDemoFolder, DemolistFetchCallback, this); }
void CTeeFiles::Remove(int Id) { char aBuf[512]; str_format(aBuf, sizeof(aBuf), "xclient/teefiles/%s", m_aTees[Id].m_aFilename); Storage()->RemoveFile(aBuf, IStorage::TYPE_SAVE); m_aTees.remove_index(Id); }
int run() { int Error(0); std::vector<test> Tests; Tests.push_back(test(gli::storage::dimensions3_type(4, 4, 1), gli::RGBA8U, 64, 128)); Tests.push_back(test(gli::storage::dimensions3_type(4, 4, 1), gli::RGB16F, 96, 192)); Tests.push_back(test(gli::storage::dimensions3_type(4, 4, 1), gli::RGBA32F, 256, 512)); Tests.push_back(test(gli::storage::dimensions3_type(4, 4, 1), gli::RGBA_DXT1, 8, 16)); Tests.push_back(test(gli::storage::dimensions3_type(8, 8, 1), gli::RGBA_DXT1, 32, 64)); Tests.push_back(test(gli::storage::dimensions3_type(4, 4, 1), gli::R_ATI1N_SNORM, 8, 16)); for(std::size_t i = 0; i < Tests.size(); ++i) { gli::storage Storage( 2, 1, 1, Tests[i].Format, Tests[i].Dimensions); gli::storage::size_type Offset = gli::detail::imageAddressing(Storage, 1, 0, 0); gli::storage::size_type Size = Storage.size(); Error += Offset == Tests[i].Offset ? 0 : 1; Error += Size == Tests[i].Size ? 0 : 1; } return Error; }
void Storage( BufferSize size, const void* data, Bitfield<BufferStorageBit> flags ) const { Storage(BufferData(size, data), flags); }
void CTeeFiles::OnInit() { m_aTees.clear(); Storage()->ListDirectory(IStorage::TYPE_SAVE, "xclient/teefiles", TeeFileScan, this); if(!m_aTees.size()) { Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "gameclient", "failed to load teefiles. folder='xclient/teefiles'"); } }
void CRaceDemo::OnShutdown() { if(Client()->DemoIsRecording()) Client()->RaceRecordStop(); char aFilename[512]; str_format(aFilename, sizeof(aFilename), "demos/%s_tmp.demo", m_pMap); Storage()->RemoveFile(aFilename, IStorage::TYPE_SAVE); }
void DrugStorageManagement::initUI() { Storage(); Allot(); Inventory(); Check(); Pricing(); Statistics(); }
void TFarConfiguration::Load() { std::unique_ptr<THierarchicalStorage> Storage(CreateConfigStorage()); FForceInheritance = true; SCOPE_EXIT { FForceInheritance = false; }; TGUIConfiguration::Load(Storage.get()); }
void CMenus::DemolistPopulate() { CALLSTACK_ADD(); m_lDemos.clear(); if(!str_comp(m_aCurrentDemoFolder, "demos")) m_DemolistStorageType = IStorageTW::TYPE_ALL; Storage()->ListDirectoryInfo(m_DemolistStorageType, m_aCurrentDemoFolder, DemolistFetchCallback, this); m_lDemos.sort_range(); }
void CGhost::StopRecord(int Time) { m_Recording = false; bool RecordingToFile = GhostRecorder()->IsRecording(); if(RecordingToFile) GhostRecorder()->Stop(m_CurGhost.m_Path.Size(), Time); CMenus::CGhostItem *pOwnGhost = m_pClient->m_pMenus->GetOwnGhost(); if(Time > 0 && (!pOwnGhost || Time < pOwnGhost->m_Time)) { if(pOwnGhost && pOwnGhost->Active()) Unload(pOwnGhost->m_Slot); // add to active ghosts int Slot = GetSlot(); if(Slot != -1) m_aActiveGhosts[Slot] = std::move(m_CurGhost); // create ghost item CMenus::CGhostItem Item; if(RecordingToFile) GetPath(Item.m_aFilename, sizeof(Item.m_aFilename), m_CurGhost.m_aPlayer, Time); str_copy(Item.m_aPlayer, m_CurGhost.m_aPlayer, sizeof(Item.m_aPlayer)); Item.m_Time = Time; Item.m_Slot = Slot; // save new ghost file if(Item.HasFile()) Storage()->RenameFile(m_aTmpFilename, Item.m_aFilename, IStorage::TYPE_SAVE); // add item to menu list m_pClient->m_pMenus->UpdateOwnGhost(Item); } else if(RecordingToFile) // no new record Storage()->RemoveFile(m_aTmpFilename, IStorage::TYPE_SAVE); m_aTmpFilename[0] = 0; m_CurGhost.Reset(); }
void TConfiguration::RememberLastFingerprint(const UnicodeString & SiteKey, const UnicodeString & FingerprintType, const UnicodeString & Fingerprint) { std::unique_ptr<THierarchicalStorage> Storage(CreateConfigStorage()); Storage->SetAccessMode(smReadWrite); if (Storage->OpenSubKey(GetConfigurationSubKey(), true) && Storage->OpenSubKey("LastFingerprints", true)) { UnicodeString FingerprintKey = FormatFingerprintKey(SiteKey, FingerprintType); Storage->WriteString(FingerprintKey, Fingerprint); } }
void ImageTexture::_set_data(Dictionary p_data) { Image img = p_data["image"]; uint32_t flags = p_data["flags"]; create_from_image(img, flags); set_storage(Storage(p_data["storage"].operator int())); set_lossy_storage_quality(p_data["lossy_quality"]); set_size_override(p_data["size"]); };