mirror of
https://github.com/RenegadeRaven/PKMG5DC.git
synced 2026-09-09 02:55:31 -05:00
Started Rewriting PGFCreator
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -32,7 +32,7 @@ Namespace My
|
||||
|
||||
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
|
||||
Protected Overrides Sub OnCreateMainForm()
|
||||
Me.MainForm = Global.PKMG5DC.Main
|
||||
Me.MainForm = Global.PKMG5DC.PGFCreator
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<MySubMain>true</MySubMain>
|
||||
<MainForm>Main</MainForm>
|
||||
<MainForm>PGFCreator</MainForm>
|
||||
<SingleInstance>false</SingleInstance>
|
||||
<ShutdownMode>0</ShutdownMode>
|
||||
<EnableVisualStyles>true</EnableVisualStyles>
|
||||
|
||||
65
Gen5 Distribution Creator/PGFCreator.Designer.vb
generated
Normal file
65
Gen5 Distribution Creator/PGFCreator.Designer.vb
generated
Normal file
@@ -0,0 +1,65 @@
|
||||
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
|
||||
Partial Class PGFCreator
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
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.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
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
|
||||
120
Gen5 Distribution Creator/PGFCreator.resx
Normal file
120
Gen5 Distribution Creator/PGFCreator.resx
Normal file
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
58
Gen5 Distribution Creator/PGFCreator.vb
Normal file
58
Gen5 Distribution Creator/PGFCreator.vb
Normal file
@@ -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
|
||||
@@ -158,6 +158,12 @@
|
||||
</Compile>
|
||||
<Compile Include="PCD.vb" />
|
||||
<Compile Include="PGF.vb" />
|
||||
<Compile Include="PGFCreator.Designer.vb">
|
||||
<DependentUpon>PGFCreator.vb</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PGFCreator.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="CustomMessageBox.resx">
|
||||
@@ -184,6 +190,9 @@
|
||||
<EmbeddedResource Include="options.resx">
|
||||
<DependentUpon>options.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="PGFCreator.resx">
|
||||
<DependentUpon>PGFCreator.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ILMerge.props" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user