Add single import support

Added support for importing a single cry. Enabled the top import button and import all button.
This commit is contained in:
Dreuu 2018-08-03 20:19:43 -04:00
parent 72d982c99e
commit 3e33a0fe9a
6 changed files with 34 additions and 45 deletions

Binary file not shown.

View File

@ -226,6 +226,7 @@ Partial Class Pokemonedit
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Clr1 = New System.Windows.Forms.ComboBox()
Me.TabPage5 = New System.Windows.Forms.TabPage()
Me.Button43 = New System.Windows.Forms.Button()
Me.GroupBox35 = New System.Windows.Forms.GroupBox()
Me.Button35 = New System.Windows.Forms.Button()
Me.Button36 = New System.Windows.Forms.Button()
@ -283,7 +284,6 @@ Partial Class Pokemonedit
Me.Button30 = New System.Windows.Forms.Button()
Me.Button38 = New System.Windows.Forms.Button()
Me.Button39 = New System.Windows.Forms.Button()
Me.Button43 = New System.Windows.Forms.Button()
Me.TabControl1.SuspendLayout()
Me.TabPage1.SuspendLayout()
Me.GroupBox26.SuspendLayout()
@ -2557,6 +2557,16 @@ Partial Class Pokemonedit
Me.TabPage5.Text = "Cry Data"
Me.TabPage5.UseVisualStyleBackColor = True
'
'Button43
'
Me.Button43.Location = New System.Drawing.Point(19, 682)
Me.Button43.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.Button43.Name = "Button43"
Me.Button43.Size = New System.Drawing.Size(237, 41)
Me.Button43.TabIndex = 30
Me.Button43.Text = "Import and Repoint All"
Me.Button43.UseVisualStyleBackColor = True
'
'GroupBox35
'
Me.GroupBox35.Controls.Add(Me.Button35)
@ -2742,7 +2752,6 @@ Partial Class Pokemonedit
'
'Button33
'
Me.Button33.Enabled = False
Me.Button33.Location = New System.Drawing.Point(336, 264)
Me.Button33.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.Button33.Name = "Button33"
@ -3130,17 +3139,6 @@ Partial Class Pokemonedit
Me.Button39.Text = "Import All Cries"
Me.Button39.UseVisualStyleBackColor = True
'
'Button43
'
Me.Button43.Enabled = False
Me.Button43.Location = New System.Drawing.Point(19, 682)
Me.Button43.Margin = New System.Windows.Forms.Padding(3, 4, 3, 4)
Me.Button43.Name = "Button43"
Me.Button43.Size = New System.Drawing.Size(237, 41)
Me.Button43.TabIndex = 30
Me.Button43.Text = "Import and Repoint All"
Me.Button43.UseVisualStyleBackColor = True
'
'Pokemonedit
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(9.0!, 20.0!)

View File

@ -3914,47 +3914,38 @@ Public Class Pokemonedit
Me.Enabled = False
crynorm = ImportCry(fileOpenDialog.FileName, crynorm)
crynorm.Index += 1
Dim cryGood As Boolean = SaveCryNoPrompt(crynorm, CryTable, CryTable3)
SaveCry(crynorm, CryTable)
If cryGood Then
Me.Text = "Pokemon Editor"
Me.Enabled = True
End If
End Sub
CryConver.Text = Int32.Parse((ReverseHEX(ReadHEX(LoadedROM, ((CryTable2)) + ((i - 276) * 2), 2))), System.Globalization.NumberStyles.HexNumber)
CryPointer.Text = Hex(Int32.Parse(ReverseHEX(ReadHEX(LoadedROM, ((CryTable) + (4)) + ((CryConver.Text) * 12), 4)), System.Globalization.NumberStyles.HexNumber) - &H8000000)
CryPointer2.Text = Hex(Int32.Parse(ReverseHEX(ReadHEX(LoadedROM, ((CryTable3) + (4)) + ((CryConver.Text) * 12), 4)), System.Globalization.NumberStyles.HexNumber) - &H8000000)
Private Sub Button38_Click(sender As Object, e As EventArgs) Handles Button38.Click
FolderBrowserDialog.Description = "Select folder to export all Cries to:"
'Label53.Text = "Sample Rate: " & ((Int32.Parse(((ReverseHEX(ReadHEX(LoadedROM, ("&H" & CryPointer.Text) + (4), 4)))), System.Globalization.NumberStyles.HexNumber)) >> 10) & " Hz"
'Label54.Text = "Sample Rate: " & ((Int32.Parse(((ReverseHEX(ReadHEX(LoadedROM, ("&H" & CryPointer2.Text) + (4), 4)))), System.Globalization.NumberStyles.HexNumber)) >> 10) & " Hz"
If FolderBrowserDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
Me.Text = "Please wait..."
Me.UseWaitCursor = True
ProgressBar.Value = 0
ProgressBar.Visible = True
crynorm = LoadCry(CryConver.Text, CryTable)
crygrowl = LoadCry(CryConver.Text, CryTable3)
Label53.Text = "Sample Rate: " & crynorm.SampleRate & " Hz"
Label54.Text = "Sample Rate: " & crygrowl.SampleRate & " Hz"
Label55.Text = "Size: " & crynorm.Data.Length & " samples"
Label56.Text = "Size: " & crygrowl.Data.Length & " samples"
chkCompressed1.Checked = crynorm.Compressed
chkCompressed2.Checked = crygrowl.Compressed
pSample.Image = GetCryImage(crynorm)
pSample2.Image = GetCryImage(crygrowl)
If System.IO.Directory.Exists(FolderBrowserDialog.SelectedPath & "\Cries") = False Then
CreateDirectory(FolderBrowserDialog.SelectedPath & "\Cries")
End If
Dim LoopVar As Integer
LoopVar = 0
Me.Enabled = False
While LoopVar < (GetString(GetINIFileLocation(), header, "NumberOfPokemon", "")) - 1 = True
PKMNames.SelectedIndex = LoopVar
LoopVar = LoopVar + 1
ExportCry(FolderBrowserDialog.SelectedPath & "\Cries\" & LoopVar & ".wav", crynorm)
ProgressBar.Value = (LoopVar / (GetString(GetINIFileLocation(), header, "NumberOfPokemon", ""))) * 100
Me.Refresh()
End While
Me.Text = "Pokemon Editor"
Me.UseWaitCursor = False
Me.Enabled = True
ProgressBar.Visible = False
Me.BringToFront()
End If
End Sub