GENH4 update

git-svn-id: https://vgmstream.svn.sourceforge.net/svnroot/vgmstream@579 51a99a44-fe44-0410-b1ba-c3e57ba2b86b
This commit is contained in:
manakoAT 2009-02-08 15:43:30 +00:00
parent ac4184fd03
commit 4ea79c2d81
11 changed files with 137 additions and 25 deletions

View File

@ -42,6 +42,12 @@
this.txtInterleaveCreator = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.comboFileFomat = new System.Windows.Forms.ComboBox();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.txtLoopStartCreator = new System.Windows.Forms.TextBox();
this.txtLoopEndCreator = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// listBox1
@ -99,7 +105,7 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(366, 74);
this.label3.Location = new System.Drawing.Point(366, 97);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(54, 13);
this.label3.TabIndex = 6;
@ -108,7 +114,7 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(366, 25);
this.label4.Location = new System.Drawing.Point(366, 48);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(69, 13);
this.label4.TabIndex = 7;
@ -116,28 +122,28 @@
//
// txtHeaderSkipCreator
//
this.txtHeaderSkipCreator.Location = new System.Drawing.Point(369, 41);
this.txtHeaderSkipCreator.Location = new System.Drawing.Point(369, 64);
this.txtHeaderSkipCreator.Name = "txtHeaderSkipCreator";
this.txtHeaderSkipCreator.Size = new System.Drawing.Size(100, 20);
this.txtHeaderSkipCreator.TabIndex = 8;
//
// txtFrequencyCreator
//
this.txtFrequencyCreator.Location = new System.Drawing.Point(480, 90);
this.txtFrequencyCreator.Location = new System.Drawing.Point(480, 113);
this.txtFrequencyCreator.Name = "txtFrequencyCreator";
this.txtFrequencyCreator.Size = new System.Drawing.Size(100, 20);
this.txtFrequencyCreator.TabIndex = 9;
//
// txtChannelsCreator
//
this.txtChannelsCreator.Location = new System.Drawing.Point(369, 90);
this.txtChannelsCreator.Location = new System.Drawing.Point(369, 113);
this.txtChannelsCreator.Name = "txtChannelsCreator";
this.txtChannelsCreator.Size = new System.Drawing.Size(100, 20);
this.txtChannelsCreator.TabIndex = 10;
//
// txtInterleaveCreator
//
this.txtInterleaveCreator.Location = new System.Drawing.Point(480, 41);
this.txtInterleaveCreator.Location = new System.Drawing.Point(480, 64);
this.txtInterleaveCreator.Name = "txtInterleaveCreator";
this.txtInterleaveCreator.Size = new System.Drawing.Size(100, 20);
this.txtInterleaveCreator.TabIndex = 11;
@ -145,7 +151,7 @@
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(477, 74);
this.label5.Location = new System.Drawing.Point(477, 97);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(60, 13);
this.label5.TabIndex = 12;
@ -154,15 +160,86 @@
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(477, 25);
this.label6.Location = new System.Drawing.Point(477, 48);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(57, 13);
this.label6.TabIndex = 13;
this.label6.Text = "Interleave:";
//
// comboFileFomat
//
this.comboFileFomat.FormattingEnabled = true;
this.comboFileFomat.Items.AddRange(new object[] {
"0x00 - PlayStation 4-bit ADPCM",
"0x01 - XBOX 4-bit IMA ADPCM",
"0x02 - GameCube ADP/DTK 4-bit ADPCM",
"0x03 - PCM RAW (Big Endian)",
"0x04 - PCM RAW (Little Endian)",
"0x05 - PCM RAW (8-Bit)",
"0x06 - Squareroot-delta-exact 8-bit DPCM",
"0x07 - Interleaved DVI 4-Bit IMA ADPCM",
"0x08 - MPEG Layer Audio File (MP1/2/3)",
"0x09 - 4-bit IMA ADPCM",
"0x0A - Yamaha AICA 4-bit ADPCM",
"0x0B - Microsoft 4-bit IMA ADPCM",
"0x0C - Nintendo GameCube DSP 4-bit ADPCM",
"0x0D - PCM RAW (8-Bit Unsigned)",
"0x0E - PlayStation 4-bit ADPCM (with bad flags)"});
this.comboFileFomat.Location = new System.Drawing.Point(338, 24);
this.comboFileFomat.Name = "comboFileFomat";
this.comboFileFomat.Size = new System.Drawing.Size(302, 21);
this.comboFileFomat.TabIndex = 15;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(338, 5);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(61, 13);
this.label7.TabIndex = 16;
this.label7.Text = "File Format:";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(366, 151);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(108, 13);
this.label8.TabIndex = 17;
this.label8.Text = "Loop Start (Samples):";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(477, 151);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(105, 13);
this.label9.TabIndex = 18;
this.label9.Text = "Loop End (Samples):";
//
// txtLoopStartCreator
//
this.txtLoopStartCreator.Location = new System.Drawing.Point(369, 167);
this.txtLoopStartCreator.Name = "txtLoopStartCreator";
this.txtLoopStartCreator.Size = new System.Drawing.Size(100, 20);
this.txtLoopStartCreator.TabIndex = 19;
//
// txtLoopEndCreator
//
this.txtLoopEndCreator.Location = new System.Drawing.Point(480, 167);
this.txtLoopEndCreator.Name = "txtLoopEndCreator";
this.txtLoopEndCreator.Size = new System.Drawing.Size(100, 20);
this.txtLoopEndCreator.TabIndex = 20;
//
// Form1
//
this.ClientSize = new System.Drawing.Size(652, 355);
this.Controls.Add(this.txtLoopEndCreator);
this.Controls.Add(this.txtLoopStartCreator);
this.Controls.Add(this.label9);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);
this.Controls.Add(this.comboFileFomat);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.txtInterleaveCreator);
@ -200,6 +277,12 @@
private System.Windows.Forms.TextBox txtInterleaveCreator;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.ComboBox comboFileFomat;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox txtLoopStartCreator;
private System.Windows.Forms.TextBox txtLoopEndCreator;

View File

@ -38,55 +38,66 @@ namespace Generic_Header_Creator_4
private void cmdCreateGENH_Click(object sender, EventArgs e)
{
// Call the Export Routine with given Values
// Name_Of_The_Function(Input_File,Start_Offset,Export_Length,File_To_Write_To)
FileStream strInputFileCreator = new FileStream(Path.GetFullPath(this.txtInputFileCreator.Text), FileMode.Open, FileAccess.Read);
FileStream strOutputFileCreator = new FileStream(Path.GetFullPath(this.txtGENHOutputNameCreator.Text), FileMode.Create, FileAccess.Write);
// Place checks for values and all needed stuff here
int GENHHeaderSkip = int.Parse(this.txtHeaderSkipCreator.Text);
int GENHToken = 0x484E4547; //HNEG (GENH)
int GENHChannels = int.Parse(this.txtChannelsCreator.Text);
int GENHInterleave = int.Parse(this.txtInterleaveCreator.Text);
int GENHFrequency = int.Parse(this.txtFrequencyCreator.Text);
int GENHLoopStart = int.Parse(this.txtLoopStartCreator.Text);
int GENHLoopEnd = int.Parse(this.txtLoopEndCreator.Text);
int GENHIdentiferByte = (this.comboFileFomat.SelectedIndex);
int GENHHeaderSkip = int.Parse(this.txtHeaderSkipCreator.Text);
//int GENHFileStartOffset;
// Call the Export Routine with given Values
// Name_Of_The_Function(Input_File,Start_Offset,Export_Length,File_To_Write_To)
ExtractChunkToFile(strInputFileCreator, 0, (int)strInputFileCreator.Length, this.txtGENHOutputNameCreator.Text);
FileStream strOutputFileCreator = new FileStream(Path.GetFullPath(this.txtGENHOutputNameCreator.Text), FileMode.Open, FileAccess.Write);
BinaryWriter bw = new BinaryWriter(strOutputFileCreator);
int strGENH = 0x484E4547; //HNEG (GENH)
bw.Write(strGENH);
bw.Write(GENHChannels);
bw.Write(GENHInterleave);
bw.Write(GENHToken); // 0x00
bw.Write(GENHChannels); // 0x04
bw.Write(GENHInterleave); // 0x08
bw.Write(GENHFrequency); // 0x0C
bw.Write(GENHLoopStart); // 0x10
bw.Write(GENHLoopEnd); // 0x14
bw.Write(GENHIdentiferByte); // 0x18
// flush and close
bw.Flush();
bw.Close();
// Call the "Export Routine"
ExtractChunkToFile(strInputFileCreator, 0, (int)strInputFileCreator.Length, this.txtGENHOutputNameCreator.Text, 4096);
// Close the Input File after processing
strInputFileCreator.Close();
strInputFileCreator.Dispose();
strOutputFileCreator.Close();
strOutputFileCreator.Dispose();
}
// This is the "Export Routine", all needed values were calculated earlier
private void ExtractChunkToFile(Stream strInputFileCreator, long pOffset, int pLength, string strOutputFileCreator, int headerSkip)
private void ExtractChunkToFile(Stream strInputFileCreator, long pOffset, int pLength, string strOutputFileCreator)
{
BinaryWriter bw = null;
try
{ // Open the Output File
bw = new BinaryWriter(File.Open(strOutputFileCreator, FileMode.Create, FileAccess.Write));
bw.BaseStream.Position = 0x1000;
int read = 0;
int totalBytes = 0;
byte[] bytes = new byte[2048];
strInputFileCreator.Seek((long)pOffset, SeekOrigin.Begin);
// write empty vals
bw.Write(new byte[headerSkip], 0, headerSkip);
//bw.Write(new byte[headerSkip], 0, headerSkip);
int maxread = pLength > bytes.Length ? bytes.Length : pLength;
@ -107,4 +118,8 @@ namespace Generic_Header_Creator_4
}
}
}
}

View File

@ -6,3 +6,11 @@ E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Hea
E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.csproj.GenerateResource.Cache
E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.exe
E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.pdb
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\ResolveAssemblyReference.cache
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic_Header_Creator_4.Form1.resources
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic_Header_Creator_4.Properties.Resources.resources
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.csproj.GenerateResource.Cache
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.exe
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\bin\Debug\Generic Header Creator 4.exe
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\bin\Debug\Generic Header Creator 4.pdb
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Debug\Generic Header Creator 4.pdb

View File

@ -8,3 +8,9 @@ E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Hea
E:\_ARCHIV\#Tools - Programmieren\Visual C#\Generic Header Creator 4\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic_Header_Creator_4.Form1.resources
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic Header Creator 4.exe
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic Header Creator 4.pdb
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\bin\Release\Generic Header Creator 4.exe
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\bin\Release\Generic Header Creator 4.pdb
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\ResolveAssemblyReference.cache
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic_Header_Creator_4.Form1.resources
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic_Header_Creator_4.Properties.Resources.resources
E:\_ARCHIV\#Tools - Programmieren\Visual CPP\_PROJECTS\VGMSTREAM\Generic Header Creator 4\Generic Header Creator 4\obj\Release\Generic Header Creator 4.csproj.GenerateResource.Cache