private List <AbstractWrapper[]> findFragKeys() { List <AbstractWrapper[]> fragKeys = new List <AbstractWrapper[]>(); foreach (String pkg in fragkeys) { IPackageFile p = SimPe.Packages.File.LoadFromFile(pkg); if (p == null) { continue; } IPackedFileDescriptor[] apfd = p.FindFiles(0x0C560F39 /*BINX*/); SimPe.Wait.SubStart(apfd.Length); foreach (IPackedFileDescriptor bx in apfd) { try { // is there a paired 3idr? IPackedFileDescriptor pfd = p.FindFile(SimPe.Data.MetaData.REF_FILE /*3IDR*/, bx.SubType, bx.Group, bx.Instance); if (pfd == null) { continue; } // load the pair SimPe.Plugin.RefFile fk3idr = new SimPe.Plugin.RefFile(); fk3idr.ProcessData(pfd, p); SimPe.PackedFiles.Wrapper.Cpf fkCpf = new SimPe.PackedFiles.Wrapper.Cpf(); fkCpf.ProcessData(bx, p); // does the pair point to the object we're working on? SimPe.PackedFiles.Wrapper.CpfItem objKeyIdx = fkCpf.GetItem("objectidx"); if (objKeyIdx == null || objKeyIdx.Datatype != SimPe.Data.MetaData.DataTypes.dtUInteger) { continue; } if (!fk3idr.Items[objKeyIdx.UIntegerValue].Equals(objKeyCPF)) { continue; } // success - save the fragkey fragKeys.Add(new AbstractWrapper[] { fkCpf, fk3idr }); } finally { SimPe.Wait.Progress++; } } SimPe.Wait.SubStop(); } return(fragKeys); }
private void Main() { if (!MessageBox.Show(L.Get("pjSMLbegin"), L.Get("pjSML"), MessageBoxButtons.OKCancel, MessageBoxIcon.Information).Equals(DialogResult.OK)) { return; } SimPe.Plugin.RefFile refFile = new SimPe.Plugin.RefFile(); refFile.ProcessData(refFilePFD, currentPackage); if (LinkBodyMesh(refFile)) { refFile.SynchronizeUserData(); MessageBox.Show(L.Get("pjSMLdone"), L.Get("pjSML"), MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void makeCpf3idrPair() { objKeyCPF = null; objKey3IDR = null; if (currentPfd == null || currentPackage == null) { return; } if (currentPfd.Type == 0x0C1FE246 /*XMOL*/ || currentPfd.Type == 0x2C1FD8A1 /*XTOL*/ || currentPfd.Type == SimPe.Data.MetaData.GZPS) { AbstractWrapper p3 = findInPackagelist(objkeys, SimPe.Data.MetaData.REF_FILE, currentPfd); if (p3 != null) { objKeyCPF = new SimPe.PackedFiles.Wrapper.Cpf(); objKeyCPF.ProcessData(currentPfd, currentPackage); addFile(p3); objKey3IDR = new SimPe.Plugin.RefFile(); objKey3IDR.ProcessData(p3.FileDescriptor, p3.Package); } } else if (currentPfd.Type == SimPe.Data.MetaData.REF_FILE /*3IDR*/) { foreach (uint t in new uint[] { 0x0C1FE246 /*XMOL*/, 0x2C1FD8A1 /*XTOL*/, SimPe.Data.MetaData.GZPS }) { AbstractWrapper pc = (SimPe.PackedFiles.Wrapper.Cpf)findInPackagelist(objkeys, t, currentPfd); if (pc != null) { addFile(pc); objKeyCPF = new SimPe.PackedFiles.Wrapper.Cpf(); objKeyCPF.ProcessData(pc.FileDescriptor, pc.Package); objKey3IDR = new SimPe.Plugin.RefFile(); objKey3IDR.ProcessData(currentPfd, currentPackage); break; } } } }
protected void LoadSkinImageFormPackage(SimPe.Interfaces.Files.IPackageFile package) { Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xAC506764); foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { try { SimPe.Plugin.RefFile reffile = new SimPe.Plugin.RefFile(); reffile.ProcessData(pfd, package); refs.Add(reffile); } catch (Exception) {} } pfds = package.FindFiles(0x49596978); foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { try { SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true); matd.ProcessData(pfd, package); matds.Add(matd); } catch (Exception) {} } //Material Files Interfaces.Files.IPackedFileDescriptor[] nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP); pfds = package.FindFiles(0x49596978); Plugin.Nmap nmap = new SimPe.Plugin.Nmap(null); if (nmap_pfd.Length > 0) { nmap.ProcessData(nmap_pfd[0], package); } bool check = false; foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { try { SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true); check = false; foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items) { if ( (epfd.Group == pfd.Group) && (epfd.Instance == pfd.Instance) ) { matd.FileDescriptor = pfd; matd.Package = package; matds.Add(matd); check = true; } } //not found in the FileMap, so process Normally if (!check) { matd.ProcessData(pfd, package); matds.Add(matd); } } catch (Exception) {} } //Texture Files nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP); pfds = package.FindFiles(0x1C4A276C); check = false; foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds) { try { SimPe.Plugin.Txtr txtr = new SimPe.Plugin.Txtr(null, true); check = false; foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items) { if ( (epfd.Group == pfd.Group) && (epfd.Instance == pfd.Instance) ) { txtr.FileDescriptor = pfd; txtr.Package = package; txtrs.Add(epfd.Filename, txtr); continue; } } //not found in the FileMap, so process Normally if (!check) { txtr.ProcessData(pfd, package); foreach (SimPe.Plugin.ImageData id in txtr.Blocks) { txtrs.Add(id.NameResource.FileName.ToLower(), txtr); } } } catch (Exception) {} } }