void View2DWindow::Save(wxFile& fs) { SaveItem(fs,v2d->scale); SaveItem(fs,v2d->center); SaveItem(fs,v2d->mirror); SaveItem(fs, View2D::bc); }
void InventoryItem::SetCustomInfo(const char *ci) { if(ci == NULL) m_customInfo = ""; else m_customInfo = ci; SaveItem(); }
void ScriptingSettingsDlg::OnRegister(wxCommandEvent& event) { wxListCtrl* list = XRCCTRL(*this, "chkStartupScripts", wxListCtrl); long sel = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); SaveItem(sel); UpdateState(); }
void InventoryItem::Move(uint32 new_location, EVEItemFlags new_flag, bool notify) { uint32 old_location = locationID(); EVEItemFlags old_flag = flag(); if( new_location == old_location && new_flag == old_flag ) return; //nothing to do... //first, take myself out of my old inventory, if its loaded. Inventory *old_inventory = m_factory.GetInventory( old_location, false ); if(old_inventory != NULL) old_inventory->RemoveItem( InventoryItemRef( this ) ); //releases its ref m_locationID = new_location; m_flag = new_flag; //then make sure that my new inventory is updated, if its loaded. Inventory *new_inventory = m_factory.GetInventory( new_location, false ); if( new_inventory != NULL ) new_inventory->AddItem( InventoryItemRef( this ) ); //makes a new ref SaveItem(); //notify about the changes. if( notify ) { std::map<int32, PyRep *> changes; if( new_location != old_location ) changes[ixLocationID] = new PyInt(old_location); if( new_flag != old_flag ) changes[ixFlag] = new PyInt(old_flag); SendItemChange( ownerID(), changes ); //changes is consumed } }
bool InventoryItem::SetQuantity(uint32 qty_new, bool notify) { //if an object has its singleton set then it shouldn't be able to add/remove qty if(m_singleton) { //Print error codelog(ITEM__ERROR, "%s (%u): Failed to set quantity %u , the items singleton bit is set", m_itemName.c_str(), m_itemID, qty_new); //return false return false; } uint32 old_qty = m_quantity; m_quantity = qty_new; SaveItem(); //notify about the changes. if(notify) { std::map<int32, PyRep *> changes; //send the notify to the new owner. changes[ixQuantity] = new PyInt(old_qty); SendItemChange(m_ownerID, changes); //changes is consumed } return true; }
void CEditDialog::ShowList(const QString& TopNode) { XML.clear("OCStuff","Stuff"); XML.load(settingsfile); this->TopNode=TopNode; InitLayout(true); if (XML.documentElement->childCount(TopNode)==0) { theNode=XML.documentElement->appendChild(TopNode); if (TopNode=="Controller") { QDomLiteElement* ctl=theNode->appendChild(TopNode+"Element"); ctl->setAttribute("Name","Pan"); ctl->setAttribute("Controller",10); ctl->setAttribute("Value",80); } } else { theNode=XML.documentElement->elementByTag(TopNode); } for (int i=0;i<theNode->childCount();i++) { QListWidgetItem* item=new QListWidgetItem(theNode->childElement(i)->attribute("Name")); item->setFlags( item->flags() | Qt::ItemIsEditable); ui->listWidget->addItem(item); } ui->SaveItem->setEnabled(ui->listWidget->currentRow()>-1); connect(ui->AddItem,SIGNAL(clicked()),this,SLOT(AddItem())); connect(ui->RemoveItem,SIGNAL(clicked()),this,SLOT(RemoveItem())); connect(ui->listWidget,SIGNAL(itemChanged(QListWidgetItem*)),this,SLOT(RenameItem(QListWidgetItem*))); connect(ui->listWidget,SIGNAL(currentRowChanged(int)),this,SLOT(SetItem(int))); connect(this,SIGNAL(accepted()),this,SLOT(HideList())); connect(ui->SaveItem,SIGNAL(clicked()),this,SLOT(SaveItem())); }
void InventoryItem::Relocate(const GPoint &pos) { if(m_position == pos) return; m_position = pos; SaveItem(); }
void ScriptingSettingsDlg::OnScriptMenuChanged(wxCommandEvent& event) { if (m_IgnoreTextEvents) return; wxListCtrl* list = XRCCTRL(*this, "chkStartupScripts", wxListCtrl); long sel = list->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); SaveItem(sel); UpdateState(); }
void ScriptingSettingsDlg::OnListDeselection(wxListEvent& event) { // Manager::Get()->GetLogManager()->DebugLog(F(_T("Deselected %d"), event.GetIndex())); // save long sel = event.GetIndex(); SaveItem(sel); UpdateState(); }
bool InventoryItem::SetFlag(EVEItemFlags new_flag, bool notify) { EVEItemFlags old_flag = m_flag; m_flag = new_flag; SaveItem(); if(notify) { std::map<int32, PyRep *> changes; //send the notify to the new owner. changes[ixFlag] = new PyInt(new_flag); SendItemChange(m_ownerID, changes); //changes is consumed } return true; }
virtual bool ServiceItem(specialitemload_t const &item) { bool ret = false; if(m_SQL) { if(item.loadtype == SPECIALITEM_LOAD) { ret = LoadItem(item); } else if(item.loadtype == SPECIALITEM_SAVE) { ret = SaveItem(item); } } return ret; }
bool InventoryItem::ChangeSingleton(bool new_singleton, bool notify) { bool old_singleton = m_singleton; if(new_singleton == old_singleton) return true; //nothing to do... m_singleton = new_singleton; SaveItem(); //notify about the changes. if(notify) { std::map<int32, PyRep *> changes; changes[ixSingleton] = new PyInt(old_singleton); SendItemChange(m_ownerID, changes); //changes is consumed } return true; }
void InventoryItem::ChangeOwner(uint32 new_owner, bool notify) { uint32 old_owner = m_ownerID; if(new_owner == old_owner) return; //nothing to do... m_ownerID = new_owner; SaveItem(); //notify about the changes. if(notify) { std::map<int32, PyRep *> changes; //send the notify to the new owner. changes[ixOwnerID] = new PyInt(old_owner); SendItemChange(new_owner, changes); //changes is consumed //also send the notify to the old owner. changes[ixOwnerID] = new PyInt(old_owner); SendItemChange(old_owner, changes); //changes is consumed } }
void CMCAModParam::DoApply() { char *Name = m_pParent->m_pName; char Temp[_MAX_PATH]; bool bCarryOn; if (m_bCollectingParametersForNewISO) { bCarryOn = true; } else { bCarryOn = m_pParent->Validate(); } if (bCarryOn) { SaveItem(Name,"BATVOLTH", IDC_MODPARAMS_BATVOLTH); SaveItem(Name,"BATVOLTL", IDC_MODPARAMS_BATVOLTL); SaveItem(Name,"SUP_P15H", IDC_MODPARAMS_SUP_P15H); SaveItem(Name,"SUP_P15L", IDC_MODPARAMS_SUP_P15L); SaveItem(Name,"SUP_M15H", IDC_MODPARAMS_SUP_M15H); SaveItem(Name,"SUP_M15L", IDC_MODPARAMS_SUP_M15L); SaveItem(Name,"SUP_P05H", IDC_MODPARAMS_SUP_P05H); SaveItem(Name,"SUP_P05L", IDC_MODPARAMS_SUP_P05L); SaveItem(Name,"TIME_ERR", IDC_MODPARAMS_TIME_ERR); SaveItem(Name,"SLOW_RESET", IDC_MODPARAMS_SLOW_RESET); SaveItem(Name,"NODE", IDC_MODPARAMS_NODE); SaveItem(Name,"MAXCYCLE", IDC_MODPARAMS_MAXCYCLE); SaveItem(Name,"MAXPAUSE", IDC_MODPARAMS_MAXPAUSE); SaveItem(Name,"DO_DUMP", IDC_MODPARAMS_DODUMP, true); SaveItem(Name,"AUTOTIMESET",IDC_CHECK_ALLOWAUTODATE, true); SaveItem(Name,"LOG_FILTER", IDC_MODPARAMS_LOGFILTER, true); SaveItem(Name,"LOG_MII", IDC_MODPARAMS_LOGMII, true); SaveItem(Name,"PORT", IDC_MODPARAMS_PORT); SaveItem(Name,"MAXINQUIRE", IDC_MODPARAMS_MAXINQUIRE); SaveItem(Name,"MAXSTATUS", IDC_MODPARAMS_MAXSTATUS); SaveItem(Name,"COMMFAIL", IDC_MODPARAMS_COMMFAIL); SaveItem(Name,"TIMEOUT", IDC_MODPARAMS_TIMEOUT); SaveItem(Name,"MAXBBM", IDC_MODPARAMS_MAXBBM); SaveItem(Name,FILE_ID, IDC_MODPARAMS_FILEID); m_iSpectrumFileType = ((CComboBox*)GetDlgItem(IDC_MODPARAMS_SPECTRAFILE))->GetCurSel(); WritePrivateProfileString( Name,"SPECTRAFILETYPE",itoa(m_iSpectrumFileType,Temp,10), m_pParent->m_szIniFile); GetDlgItemText(IDC_MODPARAMS_SAVELOC,Temp,sizeof(Temp)); while ((Temp[strlen(Temp)-1]=='\\')|| (Temp[strlen(Temp)-1]=='/' ) ) { Temp[strlen(Temp)-1] = NULL; SetDlgItemText(IDC_MODPARAMS_SAVELOC,Temp); } SaveItem(Name,SAVE_LOC, IDC_MODPARAMS_SAVELOC); if (access(Temp,0)==-1) { _mkdir(Temp); strcat(Temp,"\\archive"); _mkdir(Temp); } //propagate all the new values to the program if (!m_bCollectingParametersForNewISO) m_pParent->UpdateParams(true); }//end bCarryOn }
static void CheckForChanges(HWND hWnd, int bNeedConfirmation = 1) { if (ChangesNotSaved(hWnd, lastItem)) if ((!bNeedConfirmation) || MessageBox(hWnd, TranslateT("Some changes weren't saved. Apply the changes now?"), TranslateT("Changes not saved"), MB_YESNO | MB_ICONINFORMATION) == IDYES) SaveItem(hWnd, lastItem, TRUE); }
static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { PFolderItem item; switch (msg) { case WM_INITDIALOG: lastItem = NULL; TranslateDialogDefault(hWnd); bInitializing = 1; LoadRegisteredFolderSections(hWnd); bInitializing = 0; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_FOLDER_EDIT: switch (HIWORD(wParam)) { case EN_CHANGE: RefreshPreview(hWnd); if (!bInitializing) SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); //show the apply button. } break; case IDC_REFRESH_BUTTON: RefreshPreview(hWnd); break; case IDC_HELP_BUTTON: ShowWindow( CreateDialog(hInstance, MAKEINTRESOURCE(IDD_VARIABLES_HELP), hWnd, DlgProcVariables), SW_SHOW); break; case IDC_FOLDERS_SECTIONS_LIST: switch (HIWORD(wParam)) { case LBN_SELCHANGE: CheckForChanges(hWnd); LoadRegisteredFolderItems(hWnd); lastItem = NULL; SetEditText(hWnd, L""); RefreshPreview(hWnd); } break; case IDC_FOLDERS_ITEMS_LIST: switch (HIWORD(wParam)) { case LBN_SELCHANGE: item = GetSelectedItem(hWnd); if (item != NULL) { CheckForChanges(hWnd); LoadItem(hWnd, item); } lastItem = item; } } break; case WM_NOTIFY: switch(((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: item = GetSelectedItem(hWnd); if (item) { SaveItem(hWnd, item, FALSE); LoadItem(hWnd, item); } for (int i=0; i < lstRegisteredFolders.getCount(); i++) lstRegisteredFolders[i].Save(); CallPathChangedEvents(); } } break; } return 0; }
void Render::Save(wxFile& fs) { SaveItem(fs,b1); SaveItem(fs,b2); SaveItem(fs,LightDir); SaveItem(fs,step_length); // int rm_num = rendering_methods.size(); SaveItem(fs,rm_num); for(int k=0;k<rm_num;k++) { RenderingMethod* tmp = rendering_methods[k]; SaveString(fs,tmp->fs_filename); SaveString(fs,tmp->caption); SaveItem(fs,tmp->size); SaveItem(fs,tmp->pos); SaveItem(fs,tmp->isos_sum); SaveItem(fs,tmp->quads_sum); for(int i=0;i<MAX_VD_NUMBER;i++) { SaveItem(fs,tmp->min_level[i]); SaveItem(fs,tmp->max_level[i]); SaveItem(fs,tmp->opacity[i]); SaveVector(fs,tmp->tf_quads[i]); SaveVector(fs,tmp->tf_points[i]); SaveVector(fs,tmp->isos[i]); SaveItem(fs,tmp->iso_last[i]); SaveItem(fs,tmp->quad_last[i]); } SaveItem(fs,tmp->use_accel_struct); SaveItem(fs,tmp->use_cubic_filt); SaveItem(fs,tmp->drop_shadows); SaveItem(fs,tmp->shade_mode); SaveItem(fs,tmp->tf_type); } SaveItem(fs,CurRM); }
void InventoryItem::Rename(const char *to) { m_itemName = to; SaveItem(); }
void CEventModParam::DoApply() { char *Name = m_pParent->m_pName; char Temp[_MAX_PATH]; //get all the stuff and save it bool bCarryOn; if (m_bCollectingParametersForNewISO) { bCarryOn = true; } else { bCarryOn = m_pParent->Validate(); } if (bCarryOn) { SaveItem(Name,"TIME_ERR", IDC_EVENTMODPARAMS_TIME_ERR); SaveItem(Name,"SLOW_RESET", IDC_EVENTMODPARAMS_SLOW_RESET); SaveItem(Name,"NODE", IDC_EVENTMODPARAMS_NODE); SaveItem(Name,"MAXCYCLE", IDC_EVENTMODPARAMS_MAXCYCLE); SaveItem(Name,"MAXPAUSE", IDC_EVENTMODPARAMS_MAXPAUSE); SaveItem(Name,"DO_DUMP", IDC_EVENTMODPARAMS_DODUMP, true); SaveItem(Name,"AUTOTIMESET",IDC_CHECK_ALLOWAUTODATE,true); // SaveItem(Name,"LOG_FILTER", IDC_EVENTMODPARAMS_LOGFILTER,true); // SaveItem(Name,"LOG_MII", IDC_EVENTMODPARAMS_LOGMII, true); SaveItem(Name,"PORT", IDC_EVENTMODPARAMS_PORT); SaveItem(Name,"MAXINQUIRE", IDC_EVENTMODPARAMS_MAXINQUIRE); SaveItem(Name,"MAXSTATUS", IDC_EVENTMODPARAMS_MAXSTATUS); SaveItem(Name,"COMMFAIL", IDC_EVENTMODPARAMS_COMMFAIL); SaveItem(Name,"TIMEOUT", IDC_EVENTMODPARAMS_TIMEOUT); SaveItem(Name,"MAXBBM", IDC_EVENTMODPARAMS_MAXBBM); SaveItem(Name, FILE_ID, IDC_EVENTMODPARAMS_FILEID); // SaveItem(Name,"BINARY_BBM", IDC_CHECK_BINARY,true); GetDlgItemText(IDC_EVENTMODPARAMS_SAVELOC,Temp,sizeof(Temp)); while ((Temp[strlen(Temp)-1]=='\\')|| (Temp[strlen(Temp)-1]=='/' ) ) { Temp[strlen(Temp)-1] = NULL; SetDlgItemText(IDC_EVENTMODPARAMS_SAVELOC,Temp); } SaveItem(Name,SAVE_LOC, IDC_EVENTMODPARAMS_SAVELOC); if (_access(Temp,0)==-1) { _mkdir(Temp); strcat(Temp,"\\archive"); _mkdir(Temp); } if (m_bCollectingParametersForNewISO) { WritePrivateProfileString(Name,"FLAGCOMM","0",m_pParent->m_szIniFile); WritePrivateProfileString(Name,"FLAGOTHR","0",m_pParent->m_szIniFile); WritePrivateProfileString(Name,"FLAGTIME","0",m_pParent->m_szIniFile); } //propagate all the new values to the program if (!m_bCollectingParametersForNewISO) m_pParent->UpdateParams(true); }//end bCarryOn }
///////////////////////////////////////////////////////////////////////////// // CHHMRConfig2 message handlers void CHHMRConfig2::DoApply() { if (m_pPS)m_pPS->SetToClose(0); char *Name = m_pParent->m_pName; char Temp[16]; bool bActivateTestButton = true; if (((CButton*)GetDlgItem(IDC_CAMERAPORT1))->GetCheck()==1) strcpy(Temp,"PORT1"); else if (((CButton*)GetDlgItem(IDC_CAMERAPORT2))->GetCheck()==1) strcpy(Temp,"PORT2"); else if (((CButton*)GetDlgItem(IDC_CAMERAPORT3))->GetCheck()==1) strcpy(Temp,"PORT3"); else { KillTimer(TRIGGER_CAMERA_END); strcpy(Temp,"NONE"); bActivateTestButton = false; } WritePrivateProfileString(Name,"CAMERA_PORT",Temp, m_pParent->m_szIniFile); if (bActivateTestButton) GetDlgItem(IDC_BUTTON_TESTPORT)->EnableWindow(true); SaveItem(Name,"CAMERA_PIN", IDC_CAMERAPIN); Temp[0] = NULL; if (((CButton*)GetDlgItem(IDC_CAMERATRIGTOTALS))->GetCheck()==1) strcat(Temp,"T"); if (((CButton*)GetDlgItem(IDC_CAMERATRIGREALS))->GetCheck()==1) strcat(Temp,"R"); if (((CButton*)GetDlgItem(IDC_CAMERATRIGTOTALS1))->GetCheck()==1) strcat(Temp,"1"); WritePrivateProfileString(Name,"CAMERA_TRIGGER_TYPE",Temp, m_pParent->m_szIniFile); int Days = GetDlgItemInt(IDC_HHMRCONFIG_EDIT1); int Hours= GetDlgItemInt(IDC_HHMRCONFIG_EDIT2); int Min = GetDlgItemInt(IDC_HHMRCONFIG_EDIT3); int Sec = GetDlgItemInt(IDC_HHMRCONFIG_EDIT4); while (Sec >= 60) { Sec -= 60; Min++; } while (Min >= 60) { Min -= 60; Hours++; } while (Hours >= 24) { Hours -= 24; Days++; } sprintf(Temp,"%d:%d:%d:%d",Days,Hours,Min,Sec); WritePrivateProfileString(Name,"CAMERA_TRIGGER_HOLDOFF",Temp, m_pParent->m_szIniFile); Days = GetDlgItemInt(IDC_HHMRCONFIG_EDIT5); Hours= GetDlgItemInt(IDC_HHMRCONFIG_EDIT6); Min = GetDlgItemInt(IDC_HHMRCONFIG_EDIT7); Sec = GetDlgItemInt(IDC_HHMRCONFIG_EDIT8); while (Sec >= 60) { Sec -= 60; Min++; } while (Min >= 60) { Min -= 60; Hours++; } while (Hours >= 24) { Hours -= 24; Days++; } sprintf(Temp,"%d:%d:%d:%d",Days,Hours,Min,Sec); WritePrivateProfileString(Name,"CAMERA_TRIGGER_SUPPRESS",Temp, m_pParent->m_szIniFile); }
void __cdecl SaveGame() { int v0; // eax signed int v1; // ebx signed int v2; // esi int v3; // esi int v4; // esi int *v5; // esi int *v6; // esi int i; // esi int *v8; // esi int *v9; // esi int j; // esi int *v11; // esi int *v12; // esi int k; // esi signed int v14; // esi int l; // esi int m; // esi int *v17; // esi int *v18; // esi int n; // esi int *v20; // esi char *v21; // edi signed int v22; // ebx _BYTE *v23; // edi signed int v24; // ebx char *v25; // edi signed int v26; // ebx char *v27; // edi int (*v28)[112]; // ebx int *v29; // edi signed int v30; // ebx char *v31; // edi signed int v32; // ebx char *v33; // edi signed int v34; // ebx char *v35; // edi signed int v36; // ebx char *v37; // edi signed int v38; // ebx unsigned char *v39; // edi signed int v40; // ebx char *v41; // edi int v42; // esi void *v43; // esi int v44; // eax char v45[260]; // [esp+Ch] [ebp-10Ch] void *ptr; // [esp+110h] [ebp-8h] int v47; // [esp+114h] [ebp-4h] v0 = codec_get_encoded_len(262147); /* FILEBUFF */ ptr = DiabloAllocPtr(v0); tbuff = ptr; ISave_2('RETL'); OSave(setlevel); ISave((unsigned char)setlvlnum); ISave(currlevel); ISave((unsigned char)leveltype); ISave(ViewX); ISave(ViewY); OSave(invflag); OSave(chrflag); ISave(nummonsters); ISave(numitems); ISave(nummissiles); ISave(nobjects); v1 = 0; v2 = 0; do { ISave_2(glSeedTbl[v2]); ISave(gnLevelTypeTbl[v2]); ++v2; } while ( v2 < 17 ); SavePlayer(myplr); v3 = 0; do SaveQuest(v3++); while ( v3 < 16 ); v4 = 0; do SavePortal(v4++); while ( v4 < 4 ); v5 = monstkills; do { ISave_2(*v5); ++v5; } while ( (signed int)v5 < (signed int)&monstkills[200] ); if ( leveltype ) { v6 = monstactive; do { ISave(*v6); ++v6; } while ( (signed int)v6 < (signed int)&monstactive[200] ); for ( i = 0; i < nummonsters; ++i ) SaveMonster(monstactive[i]); v8 = missileactive; do { BSave(*(_BYTE *)v8); ++v8; } while ( (signed int)v8 < (signed int)&missileactive[125] ); v9 = missileavail; do { BSave(*(_BYTE *)v9); ++v9; } while ( (signed int)v9 < (signed int)&missileavail[125] ); for ( j = 0; j < nummissiles; ++j ) SaveMissile(missileactive[j]); v11 = objectactive; do { BSave(*(_BYTE *)v11); ++v11; } while ( (signed int)v11 < (signed int)&objectactive[127] ); v12 = objectavail; do { BSave(*(_BYTE *)v12); ++v12; } while ( (signed int)v12 < (signed int)&objectavail[127] ); for ( k = 0; k < nobjects; ++k ) SaveObject(objectactive[k]); ISave(numlights); v14 = 0; do BSave(lightactive[v14++]); while ( v14 < 32 ); for ( l = 0; l < numlights; ++l ) SaveLighting((unsigned char)lightactive[l]); ISave(visionid); ISave(numvision); for ( m = 0; m < numvision; ++m ) SaveVision(m); } v17 = itemactive; do { BSave(*(_BYTE *)v17); ++v17; } while ( (signed int)v17 < (signed int)&itemactive[127] ); v18 = itemavail; do { BSave(*(_BYTE *)v18); ++v18; } while ( (signed int)v18 < (signed int)&itemavail[127] ); for ( n = 0; n < numitems; ++n ) SaveItem(itemactive[n]); v20 = UniqueItemFlag; do { OSave(*v20); ++v20; } while ( (signed int)v20 < (signed int)&UniqueItemFlag[128] ); do { v21 = (char *)dTransVal + v1; v47 = 112; do { BSave(*v21); v21 += 112; --v47; } while ( v47 ); ++v1; } while ( v1 < 112 ); v22 = 0; do { v23 = (unsigned char *)dFlags + v22; v47 = 112; do { BSave(*v23 & 0xF8); v23 += 112; --v47; } while ( v47 ); ++v22; } while ( v22 < 112 ); v24 = 0; do { v25 = (char *)dPlayer + v24; v47 = 112; do { BSave(*v25); v25 += 112; --v47; } while ( v47 ); ++v24; } while ( v24 < 112 ); v26 = 0; do { v27 = (char *)dItem + v26; v47 = 112; do { BSave(*v27); v27 += 112; --v47; } while ( v47 ); ++v26; } while ( v26 < 112 ); if ( leveltype ) { v28 = dMonster; do { v29 = (int *)v28; v47 = 112; do { ISave(*v29); v29 += 112; --v47; } while ( v47 ); v28 = (int (*)[112])((char *)v28 + 4); } while ( (signed int)v28 < (signed int)dMonster[1] ); v30 = 0; do { v31 = (char *)dDead + v30; v47 = 112; do { BSave(*v31); v31 += 112; --v47; } while ( v47 ); ++v30; } while ( v30 < 112 ); v32 = 0; do { v33 = (char *)dObject + v32; v47 = 112; do { BSave(*v33); v33 += 112; --v47; } while ( v47 ); ++v32; } while ( v32 < 112 ); v34 = 0; do { v35 = (char *)dTransVal + v34; v47 = 112; do { BSave(*v35); v35 += 112; --v47; } while ( v47 ); ++v34; } while ( v34 < 112 ); v36 = 0; do { v37 = (char *)dTransVal2 + v36; v47 = 112; do { BSave(*v37); v37 += 112; --v47; } while ( v47 ); ++v36; } while ( v36 < 112 ); v38 = 0; do { v39 = (unsigned char *)automapview + v38; v47 = 40; do { OSave(*v39); v39 += 40; --v47; } while ( v47 ); ++v38; } while ( v38 < 40 ); v40 = 0; do { v41 = (char *)dMissile + v40; v47 = 112; do { BSave(*v41); v41 += 112; --v47; } while ( v47 ); ++v40; } while ( v40 < 112 ); } ISave(numpremium); ISave(premiumlevel); v42 = 0; do SavePremium(v42++); while ( v42 < 6 ); OSave(automapflag); ISave(AutoMapScale); pfile_get_game_name(v45); v43 = ptr; v44 = codec_get_encoded_len((_BYTE *)tbuff - (_BYTE *)ptr); pfile_write_save_file(v45, v43, (_BYTE *)tbuff - (_BYTE *)v43, v44); mem_free_dbg(v43); *(_DWORD *)&gbValidSaveFile = 1; pfile_rename_temp_to_perm(); pfile_write_hero(); }
void CJSRModParam::DoApply() { //get all the data from the controls and save them // TRACE("CJSRModParam::DoApply\n"); char Name[_MAX_PATH]; char Temp[_MAX_PATH]; strncpy(Name, m_pParent->GetName(),sizeof(Name)-1); if (GetDlgItemInt(IDC_JSRMODPARAMS_MAX_TIMEOUT) < MAX_TIMEOUT_SPIN_MIN) SetDlgItemInt(IDC_JSRMODPARAMS_MAX_TIMEOUT,MAX_TIMEOUT_SPIN_MIN); if (GetDlgItemInt(IDC_JSRMODPARAMS_MAX_TIMEOUT) > MAX_TIMEOUT_SPIN_MAX) SetDlgItemInt(IDC_JSRMODPARAMS_MAX_TIMEOUT,MAX_TIMEOUT_SPIN_MAX); if (GetDlgItemInt(IDC_JSRMODPARAMS_SLOW_RESET) < SLOW_RESET_SPIN_MIN) SetDlgItemInt(IDC_JSRMODPARAMS_SLOW_RESET,SLOW_RESET_SPIN_MIN); if (GetDlgItemInt(IDC_JSRMODPARAMS_SLOW_RESET) > SLOW_RESET_SPIN_MAX) SetDlgItemInt(IDC_JSRMODPARAMS_SLOW_RESET,SLOW_RESET_SPIN_MAX); SaveItem(Name,"HIGHVOLTH", IDC_JSRMODPARAMS_HIGHVOLTH); SaveItem(Name,"HIGHVOLTL", IDC_JSRMODPARAMS_HIGHVOLTL); SaveItem(Name,"SLOW_RESET", IDC_JSRMODPARAMS_SLOW_RESET); SaveItem(Name, NODE , IDC_JSRMODPARAMS_NODE); SaveItem(Name,"MAXCYCLE", IDC_JSRMODPARAMS_MAXCYCLE); SaveItem(Name, MAXPAUSE , IDC_JSRMODPARAMS_MAXPAUSE); SaveItem(Name,"COMMFAIL", IDC_JSRMODPARAMS_MAX_TIMEOUT); SaveItem(Name,"REALSTHRESH", IDC_JSRMODPARAMS_REALSTHRESH); SaveItem(Name,"TOTALSTHRESH", IDC_JSRMODPARAMS_TOTALSTHRESH); SaveItem(Name,"TOTALS1THRESH",IDC_JSRMODPARAMS_TOTALS1THRESH); SaveItem(Name,"TOTALSLOWTHRESH",IDC_JSRMODPARAMS_TOTALSLTHRESH); SaveItem(Name,"SIGMATHRESH", IDC_JSRMODPARAMS_SIGMATHRESH); SaveItem(Name,"MAXCOMPRESS", IDC_JSRMODPARAMS_MAXCOMPRESS); SaveItem(Name,"COUNTTIMEUNIT",IDC_JSRMODPARAMS_CT_UNITS); SaveItem(Name,"COUNTTIMEEXP", IDC_JSRMODPARAMS_CT_EXP); SaveItem(Name,"DO_DUMP", IDC_JSRMODPARAMS_DODUMP, true); SaveItem(Name,"LOG_FILTER", IDC_JSRMODPARAMS_LOGFILTER, true); // SaveItem(Name,"LOG_MII", IDC_JSRMODPARAMS_LOGMII, true); SaveItem(Name, FILE_ID, IDC_JSRMODPARAMS_FILEID); SaveItem(Name,"PORT", IDC_JSRMODPARAMS_PORT); GetDlgItemText(IDC_JSRMODPARAMS_CT_UNITS,Temp,sizeof(Temp)); WritePrivateProfileString(Name, "COUNTTIMEUNIT", Temp, m_pParent->m_szIniFile); GetDlgItemText(IDC_JSRMODPARAMS_CT_EXP,Temp,sizeof(Temp)); WritePrivateProfileString(Name, "COUNTTIMEEXP",Temp,m_pParent->m_szIniFile); int select = ((CComboBox*)GetDlgItem(IDC_JSRMODPARAMS_PREDELAY))->GetCurSel(); sprintf(Temp,"%0X",select); WritePrivateProfileString(Name, "PREDELAY",Temp,m_pParent->m_szIniFile); GetDlgItemText(IDC_JSRMODPARAMS_GATEWIDTH,Temp,sizeof(Temp)); WritePrivateProfileString(Name,"GATEWIDTH",Temp,m_pParent->m_szIniFile); GetDlgItemText(IDC_JSRMODPARAMS_HIGHV,Temp,sizeof(Temp)); WritePrivateProfileString(Name,"HIGHV",Temp,m_pParent->m_szIniFile); GetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Temp,sizeof(Temp)); while ((Temp[strlen(Temp)-1]=='\\')|| (Temp[strlen(Temp)-1]=='/' ) ) { Temp[strlen(Temp)-1] = NULL; SetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Temp); } SaveItem(Name,SAVE_LOC, IDC_JSRMODPARAMS_SAVELOC); if (_access(Temp,0)==-1) { _mkdir(Temp); strcat(Temp,"\\archive"); _mkdir(Temp); } //propagate all the new values to the program if (!m_bCollectingParametersForNewISO) { m_pParent->UpdateParams(true); m_pApplyButton->EnableWindow(FALSE); } }
void CV8File::PackFromFolder(char *dirname, char *filename_out) { //CV8File V8File; char cur_dir[MAX_PATH]; strcpy(cur_dir, dirname); struct _finddata_t find_data; long hFind; char filename[MAX_PATH];//, filename_out[MAX_PATH]; struct _stat stat; FILE *file_in, *file_out; char *point_pos; //sprintf(filename_out, "%s\\pack.cf", cur_dir); file_out = fopen(filename_out, "wb"); sprintf(filename, "%s\\FileHeader", cur_dir); _stat(filename, &stat); stFileHeader FileHeader; file_in = fopen(filename, "rb"); fread(&FileHeader, 1, stat.st_size, file_in); fclose(file_in); sprintf(filename, "%s\\*.header", cur_dir); hFind = _findfirst(filename, &find_data); FileHeader.blocks_num = 0; if( hFind != -1 ) { do { FileHeader.blocks_num ++; } while( _findnext(hFind, &find_data) == 0 ); _findclose(hFind); } fwrite(&FileHeader, 1, sizeof(stFileHeader), file_out); stBlockAddr *pNewBlocksAddr = new stBlockAddr[FileHeader.blocks_num]; stBlock *pNewBlocks = new stBlock[FileHeader.blocks_num]; DWORD cur_block_addr = sizeof(stFileHeader) + sizeof(stItemHeader); if (sizeof(stBlockAddr) * FileHeader.blocks_num < 512) cur_block_addr += 512; else cur_block_addr += sizeof(stBlockAddr) * FileHeader.blocks_num; hFind = _findfirst(filename, &find_data); UINT block_num = 0; if( hFind != -1 ) { do { sprintf(filename, "%s\\%s", cur_dir, find_data.name); _stat(filename, &stat); pNewBlocks[block_num].HeaderSize = stat.st_size; pNewBlocks[block_num].pHeader = new BYTE[pNewBlocks[block_num].HeaderSize]; file_in = fopen(filename, "rb"); fread(pNewBlocks[block_num].pHeader, 1, pNewBlocks[block_num].HeaderSize, file_in); fclose(file_in); point_pos = strrchr(filename, '.'); filename[point_pos - filename] = 0; strcat(filename, ".data"); _stat(filename, &stat); pNewBlocks[block_num].DataSize = stat.st_size; pNewBlocks[block_num].pData = new BYTE[pNewBlocks[block_num].DataSize]; file_in = fopen(filename, "rb"); fread(pNewBlocks[block_num].pData, 1, pNewBlocks[block_num].DataSize, file_in); fclose(file_in); pNewBlocksAddr[block_num].block_header_addr = cur_block_addr; cur_block_addr += sizeof(stItemHeader) + pNewBlocks[block_num].HeaderSize; pNewBlocksAddr[block_num].block_data_addr = cur_block_addr; cur_block_addr += sizeof(stItemHeader); if (pNewBlocks[block_num].DataSize > 512) cur_block_addr += pNewBlocks[block_num].DataSize; else cur_block_addr += 512; pNewBlocksAddr[block_num].fffffff = 0x7fffffff; block_num++; } while( _findnext(hFind, &find_data) == 0 ); _findclose(hFind); } //FileHeader.blocks_num = block_num; SaveItem(file_out, (BYTE*) pNewBlocksAddr, sizeof(stBlockAddr) * FileHeader.blocks_num); for(block_num = 0; block_num < FileHeader.blocks_num; block_num++) { SaveItem(file_out, pNewBlocks[block_num].pHeader, pNewBlocks[block_num].HeaderSize, pNewBlocks[block_num].HeaderSize); SaveItem(file_out, pNewBlocks[block_num].pData, pNewBlocks[block_num].DataSize); //delete[] pNewBlocks[block_num].pHeader; //delete[] pNewBlocks[block_num].pData; } delete[] pNewBlocksAddr; delete[] pNewBlocks; //fseek(file_out, SEEK_SET, 0); //fwrite(&FileHeader, 1, sizeof(stFileHeader), file_out); fclose(file_out); }
void __cdecl SaveLevel() { int v0; // eax int i; // esi int j; // esi void *v47; // esi int v48; // eax int v49; // eax char v50[260]; // [esp+0h] [ebp-10Ch] void *SaveBuff; // [esp+104h] [ebp-8h] if ( !currlevel ) glSeedTbl[0] = GetRndSeed(); v0 = codec_get_encoded_len(262147); /* FILEBUFF */ SaveBuff = DiabloAllocPtr(v0); tbuff = SaveBuff; if ( leveltype ) { for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dDead[j][i]); /* check */ } } } ISave(nummonsters); ISave(numitems); ISave(nobjects); if ( leveltype ) { for(i = 0; i < 200; i++) ISave(monstactive[i]); for(i = 0; i < nummonsters; i++) SaveMonster(monstactive[i]); for(i = 0; i < 127; i++) BSave(objectactive[i]); for(i = 0; i < 127; i++) BSave(objectavail[i]); for(i = 0; i < nobjects; i++) SaveObject(objectactive[i]); } for(i = 0; i < 127; i++) BSave(itemactive[i]); for(i = 0; i < 127; i++) BSave(itemavail[i]); for(i = 0; i < numitems; i++) SaveItem(itemactive[i]); for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dFlags[j][i] & 0xF8); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dItem[j][i]); } } if ( leveltype ) { for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { ISave(dMonster[j][i]); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dObject[j][i]); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dTransVal[j][i]); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dTransVal2[j][i]); } } for(i = 0; i < 40; i++) { for(j = 0; j < 40; j++) { OSave(automapview[j][i]); } } for(i = 0; i < 112; i++) { for(j = 0; j < 112; j++) { BSave(dMissile[j][i]); } } } GetTempLevelNames(v50); v47 = SaveBuff; v48 = codec_get_encoded_len((_BYTE *)tbuff - (_BYTE *)SaveBuff); pfile_write_save_file(v50, v47, (_BYTE *)tbuff - (_BYTE *)v47, v48); mem_free_dbg(v47); v49 = myplr; if ( setlevel ) plr[v49]._pSLvlVisited[(unsigned char)setlvlnum] = 1; else plr[v49]._pLvlVisited[currlevel] = 1; }
int CV8File::SaveFile(FILE *file_out) { UINT block_num; BYTE *DataOut = NULL; //UINT deflate_size; //file_out = fopen(filename, "wb"); fwrite(&FileHeader, 1, sizeof(FileHeader), file_out); stBlockAddr *pNewBlocksAddr = new stBlockAddr[FileHeader.blocks_num]; DWORD cur_block_addr = sizeof(stFileHeader) + sizeof(stItemHeader); if (sizeof(stBlockAddr) * FileHeader.blocks_num < 512) cur_block_addr += 512; else cur_block_addr += sizeof(stBlockAddr) * FileHeader.blocks_num; for (block_num = 0; block_num < FileHeader.blocks_num; block_num++) { pNewBlocksAddr[block_num].block_header_addr = cur_block_addr; cur_block_addr += sizeof(stItemHeader) + pBlocks[block_num].HeaderSize; pNewBlocksAddr[block_num].block_data_addr = cur_block_addr; cur_block_addr += sizeof(stItemHeader); if (pBlocks[block_num].DataSize > 512) cur_block_addr += pBlocks[block_num].DataSize; else cur_block_addr += 512; pNewBlocksAddr[block_num].fffffff = 0x7fffffff; } SaveItem(file_out, (BYTE*) pNewBlocksAddr, sizeof(stBlockAddr) * FileHeader.blocks_num); for (block_num= 0; block_num < FileHeader.blocks_num; block_num++) { SaveItem(file_out, pBlocks[block_num].pHeader, pBlocks[block_num].HeaderSize, pBlocks[block_num].HeaderSize); SaveItem(file_out, pBlocks[block_num].pData, pBlocks[block_num].DataSize); /* if (pBlocks[block_num].IsV8File) { } else { if (IsDataPacked && pBlocks[block_num].pData) { deflate_size = Deflate(pBlocks[block_num].pData, pBlocks[block_num].DataSize, &DataOut); SaveItem(file_out, DataOut, deflate_size); } } */ } //fclose(file_out); delete[] pNewBlocksAddr; free(DataOut); return false; }