diff --git a/Gen5 Distribution Creator/Common.vb b/Gen5 Distribution Creator/Common.vb index 1d0ad9f..4af65f0 100644 --- a/Gen5 Distribution Creator/Common.vb +++ b/Gen5 Distribution Creator/Common.vb @@ -68,4 +68,13 @@ Dim myBytes As Byte() = HexStringToByteArray(Main.RichTextBox1.Text) My.Computer.FileSystem.WriteAllBytes(myFile, myBytes, False) End Sub + + Public Function ByteArrayToHexString(ByVal myFile As String) + Dim myBytes As Byte() = My.Computer.FileSystem.ReadAllBytes(myFile) + Dim txtTemp As New System.Text.StringBuilder() + For Each myByte As Byte In myBytes + txtTemp.Append(myByte.ToString("X2")) + Next + Return txtTemp.ToString() + End Function End Module diff --git a/Gen5 Distribution Creator/My Project/Application.Designer.vb b/Gen5 Distribution Creator/My Project/Application.Designer.vb index 618f4e2..bbd19f2 100644 --- a/Gen5 Distribution Creator/My Project/Application.Designer.vb +++ b/Gen5 Distribution Creator/My Project/Application.Designer.vb @@ -32,7 +32,7 @@ Namespace My _ Protected Overrides Sub OnCreateMainForm() - Me.MainForm = Global.PKMG5DC.Main + Me.MainForm = Global.PKMG5DC.PGFCreator End Sub End Class End Namespace diff --git a/Gen5 Distribution Creator/My Project/Application.myapp b/Gen5 Distribution Creator/My Project/Application.myapp index 5b8d48e..eb641e1 100644 --- a/Gen5 Distribution Creator/My Project/Application.myapp +++ b/Gen5 Distribution Creator/My Project/Application.myapp @@ -1,7 +1,7 @@  true - Main + PGFCreator false 0 true diff --git a/Gen5 Distribution Creator/PGFCreator.Designer.vb b/Gen5 Distribution Creator/PGFCreator.Designer.vb new file mode 100644 index 0000000..15d2202 --- /dev/null +++ b/Gen5 Distribution Creator/PGFCreator.Designer.vb @@ -0,0 +1,65 @@ + _ +Partial Class PGFCreator + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.PK5Name = New System.Windows.Forms.Label() + Me.OpenPK5 = New System.Windows.Forms.Button() + Me.SuspendLayout() + ' + 'PK5Name + ' + Me.PK5Name.AutoEllipsis = True + Me.PK5Name.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D + Me.PK5Name.Location = New System.Drawing.Point(35, 55) + Me.PK5Name.Margin = New System.Windows.Forms.Padding(3, 3, 3, 0) + Me.PK5Name.Name = "PK5Name" + Me.PK5Name.Size = New System.Drawing.Size(330, 17) + Me.PK5Name.TabIndex = 10 + Me.PK5Name.Text = "Open .pk5 ------->" + Me.PK5Name.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'OpenPK5 + ' + Me.OpenPK5.Location = New System.Drawing.Point(367, 51) + Me.OpenPK5.Name = "OpenPK5" + Me.OpenPK5.Size = New System.Drawing.Size(75, 23) + Me.OpenPK5.TabIndex = 9 + Me.OpenPK5.Text = "Open .pk5" + Me.OpenPK5.UseVisualStyleBackColor = True + ' + 'PGFCreator + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.PK5Name) + Me.Controls.Add(Me.OpenPK5) + Me.Name = "PGFCreator" + Me.Text = "PGFCreator" + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents PK5Name As Label + Friend WithEvents OpenPK5 As Button +End Class diff --git a/Gen5 Distribution Creator/PGFCreator.resx b/Gen5 Distribution Creator/PGFCreator.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Gen5 Distribution Creator/PGFCreator.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Gen5 Distribution Creator/PGFCreator.vb b/Gen5 Distribution Creator/PGFCreator.vb new file mode 100644 index 0000000..570ccc2 --- /dev/null +++ b/Gen5 Distribution Creator/PGFCreator.vb @@ -0,0 +1,58 @@ +Imports System.IO +Public Class PGFCreator + Dim WC As New PGF + Dim InputPK5 As String + + Private Sub PGFCreator_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + End Sub + + Private Sub OpenPK5_Click(sender As Object, e As EventArgs) Handles OpenPK5.Click + Dim OpenFile As New OpenFileDialog + OpenFile.Filter = "Gen 5 PKM (*.pk5)|*.pk5|All files (*.*)|*.*" + Dim res As DialogResult = OpenFile.ShowDialog() + If res <> Windows.Forms.DialogResult.Cancel Then + Dim myFile As String = Path.GetFileName(OpenFile.FileName) + PK5Name.Text = myFile + InputPK5 = ByteArrayToHexString(OpenFile.FileName) + GrabValues() + End If + End Sub + + Private Sub GrabValues() + Try + With WC + .TID = Convert.ToUInt16(Little_Endian(InputPK5.Remove(28).ToArray().Skip(24).ToArray(), 4), 16) + .SID = Convert.ToUInt16(Little_Endian(InputPK5.Remove(32).ToArray().Skip(28).ToArray(), 4), 16) + .Origin = Convert.ToUInt16(InputPK5.Remove(192).ToArray().Skip(190).ToArray(), 16) + .Ribbons(0) = Convert.ToUInt16(InputPK5.Remove(78).ToArray().Skip(76).ToArray(), 16) + .Ribbons(1) = Convert.ToUInt16(InputPK5.Remove(80).ToArray().Skip(78).ToArray(), 16) + .Ball = Convert.ToUInt16(InputPK5.Remove(264).ToArray().Skip(262).ToArray(), 16) + .Item = Convert.ToUInt16(Little_Endian(InputPK5.Remove(24).ToArray().Skip(20).ToArray(), 4), 16) + .Moves(0) = Convert.ToUInt16(Little_Endian(InputPK5.Remove(84).ToArray().Skip(80).ToArray(), 4), 16) + .Moves(1) = Convert.ToUInt16(Little_Endian(InputPK5.Remove(88).ToArray().Skip(84).ToArray(), 4), 16) + .Moves(2) = Convert.ToUInt16(Little_Endian(InputPK5.Remove(92).ToArray().Skip(88).ToArray(), 4), 16) + .Moves(3) = Convert.ToUInt16(Little_Endian(InputPK5.Remove(96).ToArray().Skip(92).ToArray(), 4), 16) + .Dex = Convert.ToUInt16(Little_Endian(InputPK5.Remove(20).ToArray().Skip(16).ToArray(), 4), 16) + .Language = Convert.ToUInt16(InputPK5.Remove(48).ToArray().Skip(46).ToArray(), 16) + .Nickname = InputPK5.Remove(188).ToArray().Skip(144).ToArray() + .Nature = Convert.ToUInt16(InputPK5.Remove(132).ToArray().Skip(130).ToArray(), 16) + .EggMet = Convert.ToUInt16(Little_Endian(InputPK5.Remove(256).ToArray().Skip(252).ToArray(), 4), 16) + .Met = Convert.ToUInt16(Little_Endian(InputPK5.Remove(260).ToArray().Skip(256).ToArray(), 4), 16) + Dim bloc As String = Hex_Zeros(Convert.ToString(Convert.ToUInt32(Little_Endian(InputPK5.Remove(120).ToArray().Skip(112).ToArray(), 8), 16), 2), 32) + .IVs(0) = Convert.ToInt32(bloc.Skip(27).ToArray(), 2) + .IVs(1) = Convert.ToInt32(bloc.Remove(27).ToArray().Skip(22).ToArray(), 2) + .IVs(2) = Convert.ToInt32(bloc.Remove(22).ToArray().Skip(17).ToArray(), 2) + .IVs(3) = Convert.ToInt32(bloc.Remove(17).ToArray().Skip(12).ToArray(), 2) + .IVs(4) = Convert.ToInt32(bloc.Remove(12).ToArray().Skip(7).ToArray(), 2) + .IVs(5) = Convert.ToInt32(bloc.Remove(7).ToArray().Skip(2).ToArray(), 2) + .Egg = Convert.ToUInt16(bloc.Remove(3).ToArray().Skip(1).ToArray(), 2) + .OT_Name = InputPK5.Remove(240).ToArray().Skip(208).ToArray() + .OT_Gender = Convert.ToUInt16(Hex_Zeros(Convert.ToString(Convert.ToUInt16(InputPK5.Remove(266).ToArray().Skip(264).ToArray(), 16), 2), 8).ToString.Remove(1), 2) + .Gender = Convert.ToUInt16(Hex_Zeros(Convert.ToString(Convert.ToUInt16(InputPK5.Remove(130).ToArray().Skip(128).ToArray(), 16), 2), 8).ToString.Remove(7).ToArray().Skip(6).ToArray(), 2) + + End With + Catch ex As Exception + End Try + End Sub +End Class \ No newline at end of file diff --git a/Gen5 Distribution Creator/PKMG5DC.vbproj b/Gen5 Distribution Creator/PKMG5DC.vbproj index 4ef5bb6..aa2ca14 100644 --- a/Gen5 Distribution Creator/PKMG5DC.vbproj +++ b/Gen5 Distribution Creator/PKMG5DC.vbproj @@ -158,6 +158,12 @@ + + PGFCreator.vb + + + Form + @@ -184,6 +190,9 @@ options.vb + + PGFCreator.vb + diff --git a/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe b/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe index 2cefc2a..9fa3347 100644 Binary files a/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe and b/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe differ diff --git a/Gen5 Distribution Creator/bin/Debug/PKMG5DC.pdb b/Gen5 Distribution Creator/bin/Debug/PKMG5DC.pdb index 723bfba..61bfd4c 100644 Binary files a/Gen5 Distribution Creator/bin/Debug/PKMG5DC.pdb and b/Gen5 Distribution Creator/bin/Debug/PKMG5DC.pdb differ diff --git a/Gen5 Distribution Creator/obj/Debug/PKMG5DC.vbproj.FileListAbsolute.txt b/Gen5 Distribution Creator/obj/Debug/PKMG5DC.vbproj.FileListAbsolute.txt index c0a4348..7f57260 100644 --- a/Gen5 Distribution Creator/obj/Debug/PKMG5DC.vbproj.FileListAbsolute.txt +++ b/Gen5 Distribution Creator/obj/Debug/PKMG5DC.vbproj.FileListAbsolute.txt @@ -3,10 +3,11 @@ C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Form1.resources C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Form2.resources C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Form3.resources -C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Form4.resources C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Resources.resources C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Options.resources C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.vbproj.GenerateResource.cache C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.vbproj.CoreCompileInputs.cache C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.exe C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.pdb +C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.Main.resources +C:\Users\Kochen Family\source\repos\New folder\PKMG5DC\Gen5 Distribution Creator\obj\Debug\PKMG5DC.PGFCreator.resources