private void ReplaceDDS_Click(object sender, EventArgs e) { using (var opendialog = new OpenFileDialog()) { opendialog.Filter = "DirectDraw Surface|*.dds"; if (opendialog.ShowDialog() == DialogResult.OK) { G1Texture texture = new G1Texture(); DDS newDDS = new DDS(); newDDS.Read(opendialog.FileName); if (newDDS.MipMapCount >= 10) { MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9."); newDDS.MipMapCount = 9; } if (FormatIndex == NodeIndexBin && treeView1.Nodes.ContainsKey("BIN")) { texture = BinFileList[treeView1.SelectedNode.Parent.Parent.Index][treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; texture.Replace(newDDS); } if (FormatIndex == NodeIndexG1T && treeView1.Nodes.ContainsKey("G1T")) { texture = G1TFileList[treeView1.SelectedNode.Parent.Index].Textures[treeView1.SelectedNode.Index]; texture.Replace(newDDS); } pictureBox1.Image = texture.Mipmap.GetBitmap(); } } }
private void Add_Click(object sender, EventArgs e) { using (var opendialog = new OpenFileDialog()) { opendialog.Filter = "DirectDraw Surface|*.dds"; opendialog.Multiselect = false; //For now at least, only one file at a time if (opendialog.ShowDialog() == DialogResult.OK) { DDS temp = new DDS(); temp.Read(opendialog.FileName); if (temp.MipMapCount >= 10) { MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9."); temp.MipMapCount = 9; } G1Texture texture = new G1Texture(); texture.Replace(temp); textureListBox.Items.Add(texture); textureListBox.SelectedItem = texture; } } }
private void OpenFile(string filename) { switch (Path.GetExtension(filename)) { case ".bin": case ".g1t": { currentG1T = new G1T(); currentG1T.Read(filename); foreach (G1Texture tex in currentG1T.Textures) { textureListBox.Items.Add(tex); } } break; case ".dds": { DDS temp = new DDS(); temp.Read(filename); pictureBox1.Image = temp.Texture.GetBitmap(); } break; default: { MessageBox.Show("This file format is not supported yet.", "Unsupported file format"); } break; } }
private void Replace_Click(object sender, EventArgs e) { using (var opendialog = new OpenFileDialog()) { opendialog.Filter = "DirectDraw Surface|*.dds"; opendialog.Multiselect = false; //For now at least, only one file at a time if (opendialog.ShowDialog() == DialogResult.OK) { G1Texture texture = (G1Texture)textureListBox.SelectedItem; switch (Path.GetExtension(opendialog.FileName)) { case ".dds": { DDS temp = new DDS(); temp.Read(opendialog.FileName); if (temp.MipMapCount >= 10) { MessageBox.Show("The amount of mipmaps for this texture is too big. Reducing it to 9."); temp.MipMapCount = 9; } texture.Replace(temp); } break; } pictureBox1.Image = texture.Mipmap.GetBitmap(); } } }
} //FINE AD9954_WriteRamByte() //////////////////////////////////////////////////////////// // LETTURA DI UN BYTE DALLA RAM public byte[] AD9954_ReadRam() { byte[] b = { }; DDS.Read(b); return(b); } //FINE AD9954_ReadRam()
} //FINE AD9954_WriteReg() //////////////////////////////////////////////////////////// // LETTURA REGISTRO private ulong AD9954_ReadReg(byte RegNum, byte RegSize) { ulong Val; // CONTROLLO RANGE SU REGSIZE if (RegSize < 1 || RegSize > 4) { return(0); } byte[] _cmd = { (byte)(RegNum | 0x80) }; DDS.Write(_cmd); byte[] Read = { }; DDS.Read(Read); Val = BitConverter.ToUInt32(Read, 0); return(Val); }