diff --git a/Gen5 Distribution Creator/Card5.vb b/Gen5 Distribution Creator/Card5.vb index 9b83890..4d8c3b4 100644 --- a/Gen5 Distribution Creator/Card5.vb +++ b/Gen5 Distribution Creator/Card5.vb @@ -1,24 +1,578 @@ -'Card Class -Public Class Card5 - Public numberOfCards As Byte - '00 00 00 - Public wonderCard(7) As String '0xCC +'Card Classes +Public Class Card5P + Public data(&H2D8) As Byte + Public Property Wondercard As Byte() '0xCC + Get + Return data.Take(&HCC) + End Get + Set(value As Byte()) + value.CopyTo(data, &H0) + End Set + End Property '00 00 - Public gameCompatability(7) As Byte + Public Property GameCompatibility As Byte + Get + Return data(&HCE) + End Get + Set(ByVal value As Byte) + data(&HCE) = value + End Set + End Property '00 - Public eventText As String '0x1F8 + Public Property EventText As String '0x1F8 + Get + Return GetString(data, &HD0, 504) + End Get + Set(ByVal value As String) + SetString(value, 252).CopyTo(data, &HD0) + End Set + End Property 'FF FF '00 - Public language(7) As Byte + Public Property Language As Byte + Get + Return data(&H2CB) + End Get + Set(ByVal value As Byte) + data(&H2CB) = value + End Set + End Property '00 00 - Public langChecksum(7) As UShort + Public Property LangChecksum As UShort + Get + Return BitConverter.ToUInt16(data, &H2CE) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(data, &H2CE) + End Set + End Property '00 for 0x1EF0 - Public startYear As UShort - Public startMonth As Byte - Public startDay As Byte - Public endYear As UShort - Public endMonth As Byte - Public endDay As Byte + Public Property StartYear As UShort + Get + Return BitConverter.ToUInt16(data, &H2D0) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(data, &H2D0) + End Set + End Property + Public Property StartMonth As Byte + Get + Return data(&H2D2) + End Get + Set(ByVal value As Byte) + data(&H2D2) = value + End Set + End Property + Public Property StartDay As Byte + Get + Return data(&H2D3) + End Get + Set(ByVal value As Byte) + data(&H2D3) = value + End Set + End Property + Public Property EndYear As UShort + Get + Return BitConverter.ToUInt16(data, &H2D4) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(data, &H2D4) + End Set + End Property + Public Property EndMonth As Byte + Get + Return data(&H2D6) + End Get + Set(ByVal value As Byte) + data(&H2D6) = value + End Set + End Property + Public Property EndDay As Byte + Get + Return data(&H2D7) + End Get + Set(ByVal value As Byte) + data(&H2D7) = value + End Set + End Property +End Class +Public Class Card5 + Public Data(&H16CF) As Byte + + Public Property NumberOfCards As Byte + Get + Return Data(&H0) + End Get + Set(ByVal value As Byte) + Data(&H0) = value + End Set + End Property + '00 00 00 + Public Property Card_1 As Byte() + Get + Return Data.Skip(&H4).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H4) + End Set + End Property + Public Property Card_2 As Byte() + Get + Return Data.Skip(&H2D4).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H2D4) + End Set + End Property + Public Property Card_3 As Byte() + Get + Return Data.Skip(&H5A4).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H5A4) + End Set + End Property + Public Property Card_4 As Byte() + Get + Return Data.Skip(&H874).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H874) + End Set + End Property + Public Property Card_5 As Byte() + Get + Return Data.Skip(&HB44).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &HB44) + End Set + End Property + Public Property Card_6 As Byte() + Get + Return Data.Skip(&HE14).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &HE14) + End Set + End Property + Public Property Card_7 As Byte() + Get + Return Data.Skip(&H10E4).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H10E4) + End Set + End Property + Public Property Card_8 As Byte() + Get + Return Data.Skip(&H13B4).Take(&H2D0) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H13B4) + End Set + End Property + +#Region "Dates 1" + Public Property StartYear_1 As UShort + Get + Return BitConverter.ToUInt16(Data, &H1684) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H1684) + End Set + End Property + Public Property StartMonth_1 As Byte + Get + Return Data(&H1686) + End Get + Set(ByVal value As Byte) + Data(&H1686) = value + End Set + End Property + Public Property StartDay_1 As Byte + Get + Return Data(&H1687) + End Get + Set(ByVal value As Byte) + Data(&H1687) = value + End Set + End Property + Public Property EndYear_1 As UShort + Get + Return BitConverter.ToUInt16(Data, &H1688) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H1688) + End Set + End Property + Public Property EndMonth_1 As Byte + Get + Return Data(&H168A) + End Get + Set(ByVal value As Byte) + Data(&H168A) = value + End Set + End Property + Public Property EndDay_1 As Byte + Get + Return Data(&H168B) + End Get + Set(ByVal value As Byte) + Data(&H168B) = value + End Set + End Property +#End Region +#Region "Dates 2" + Public Property StartYear_2 As UShort + Get + Return BitConverter.ToUInt16(Data, &H168C) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H168C) + End Set + End Property + Public Property StartMonth_2 As Byte + Get + Return Data(&H168E) + End Get + Set(ByVal value As Byte) + Data(&H168E) = value + End Set + End Property + Public Property StartDay_2 As Byte + Get + Return Data(&H168F) + End Get + Set(ByVal value As Byte) + Data(&H168F) = value + End Set + End Property + Public Property EndYear_2 As UShort + Get + Return BitConverter.ToUInt16(Data, &H1690) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H1690) + End Set + End Property + Public Property EndMonth_2 As Byte + Get + Return Data(&H1692) + End Get + Set(ByVal value As Byte) + Data(&H1692) = value + End Set + End Property + Public Property EndDay_2 As Byte + Get + Return Data(&H1693) + End Get + Set(ByVal value As Byte) + Data(&H1693) = value + End Set + End Property +#End Region +#Region "Dates 3" + Public Property StartYear_3 As UShort + Get + Return BitConverter.ToUInt16(Data, &H1694) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H1694) + End Set + End Property + Public Property StartMonth_3 As Byte + Get + Return Data(&H1696) + End Get + Set(ByVal value As Byte) + Data(&H1696) = value + End Set + End Property + Public Property StartDay_3 As Byte + Get + Return Data(&H1697) + End Get + Set(ByVal value As Byte) + Data(&H1697) = value + End Set + End Property + Public Property EndYear_3 As UShort + Get + Return BitConverter.ToUInt16(Data, &H1698) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H1698) + End Set + End Property + Public Property EndMonth_3 As Byte + Get + Return Data(&H169A) + End Get + Set(ByVal value As Byte) + Data(&H168A) = value + End Set + End Property + Public Property EndDay_3 As Byte + Get + Return Data(&H169B) + End Get + Set(ByVal value As Byte) + Data(&H169B) = value + End Set + End Property +#End Region +#Region "Dates 4" + Public Property StartYear_4 As UShort + Get + Return BitConverter.ToUInt16(Data, &H169C) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H169C) + End Set + End Property + Public Property StartMonth_4 As Byte + Get + Return Data(&H169E) + End Get + Set(ByVal value As Byte) + Data(&H169E) = value + End Set + End Property + Public Property StartDay_4 As Byte + Get + Return Data(&H169F) + End Get + Set(ByVal value As Byte) + Data(&H169F) = value + End Set + End Property + Public Property EndYear_4 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16A0) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16A0) + End Set + End Property + Public Property EndMonth_4 As Byte + Get + Return Data(&H16A2) + End Get + Set(ByVal value As Byte) + Data(&H16A2) = value + End Set + End Property + Public Property EndDay_4 As Byte + Get + Return Data(&H16A3) + End Get + Set(ByVal value As Byte) + Data(&H16A3) = value + End Set + End Property +#End Region +#Region "Dates 5" + Public Property StartYear_5 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16A4) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16A4) + End Set + End Property + Public Property StartMonth_5 As Byte + Get + Return Data(&H16A6) + End Get + Set(ByVal value As Byte) + Data(&H16A6) = value + End Set + End Property + Public Property StartDay_5 As Byte + Get + Return Data(&H16A7) + End Get + Set(ByVal value As Byte) + Data(&H16A7) = value + End Set + End Property + Public Property EndYear_5 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16A8) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16A8) + End Set + End Property + Public Property EndMonth_5 As Byte + Get + Return Data(&H16AA) + End Get + Set(ByVal value As Byte) + Data(&H16AA) = value + End Set + End Property + Public Property EndDay_5 As Byte + Get + Return Data(&H16AB) + End Get + Set(ByVal value As Byte) + Data(&H16AB) = value + End Set + End Property +#End Region +#Region "Dates 6" + Public Property StartYear_6 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16AC) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16AC) + End Set + End Property + Public Property StartMonth_6 As Byte + Get + Return Data(&H16AE) + End Get + Set(ByVal value As Byte) + Data(&H16AE) = value + End Set + End Property + Public Property StartDay_6 As Byte + Get + Return Data(&H16AF) + End Get + Set(ByVal value As Byte) + Data(&H16AF) = value + End Set + End Property + Public Property EndYear_6 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16B0) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16B0) + End Set + End Property + Public Property EndMonth_6 As Byte + Get + Return Data(&H16B2) + End Get + Set(ByVal value As Byte) + Data(&H16B2) = value + End Set + End Property + Public Property EndDay_6 As Byte + Get + Return Data(&H16B3) + End Get + Set(ByVal value As Byte) + Data(&H16B3) = value + End Set + End Property +#End Region +#Region "Dates 7" + Public Property StartYear_7 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16B4) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16B4) + End Set + End Property + Public Property StartMonth_7 As Byte + Get + Return Data(&H16B6) + End Get + Set(ByVal value As Byte) + Data(&H16B6) = value + End Set + End Property + Public Property StartDay_7 As Byte + Get + Return Data(&H16B7) + End Get + Set(ByVal value As Byte) + Data(&H16B7) = value + End Set + End Property + Public Property EndYear_7 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16B8) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16B8) + End Set + End Property + Public Property EndMonth_7 As Byte + Get + Return Data(&H16BA) + End Get + Set(ByVal value As Byte) + Data(&H16BA) = value + End Set + End Property + Public Property EndDay_7 As Byte + Get + Return Data(&H16BB) + End Get + Set(ByVal value As Byte) + Data(&H16BB) = value + End Set + End Property +#End Region +#Region "Dates 8" + Public Property StartYear_8 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16BC) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16BC) + End Set + End Property + Public Property StartMonth_8 As Byte + Get + Return Data(&H16BE) + End Get + Set(ByVal value As Byte) + Data(&H16BE) = value + End Set + End Property + Public Property StartDay_8 As Byte + Get + Return Data(&H16BF) + End Get + Set(ByVal value As Byte) + Data(&H16BF) = value + End Set + End Property + Public Property EndYear_8 As UShort + Get + Return BitConverter.ToUInt16(Data, &H16C0) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H16C0) + End Set + End Property + Public Property EndMonth_8 As Byte + Get + Return Data(&H16C2) + End Get + Set(ByVal value As Byte) + Data(&H16C2) = value + End Set + End Property + Public Property EndDay_8 As Byte + Get + Return Data(&H16C3) + End Get + Set(ByVal value As Byte) + Data(&H16C3) = value + End Set + End Property +#End Region '00 for 0x5C '14 ???? '00 00 00 00 00 00 00 diff --git a/Gen5 Distribution Creator/Common.vb b/Gen5 Distribution Creator/Common.vb index 6632ddd..e2ff199 100644 --- a/Gen5 Distribution Creator/Common.vb +++ b/Gen5 Distribution Creator/Common.vb @@ -79,7 +79,7 @@ Module Common Next Return txtTemp.ToString() End Function - Public Function GetString(data As Byte(), offset As Byte, count As Byte) + Public Function GetString(data As Byte(), offset As Byte, count As UShort) Return Encoding.Unicode.GetString(data, offset, count).Replace(ChrW(&HFFFF), "").Replace(ChrW(&H0), "") End Function Public Function SetString(ByVal value As String, ByVal maxLength As Integer) diff --git a/Gen5 Distribution Creator/Main.Designer.vb b/Gen5 Distribution Creator/Main.Designer.vb index 05f0f92..31e0bb4 100644 --- a/Gen5 Distribution Creator/Main.Designer.vb +++ b/Gen5 Distribution Creator/Main.Designer.vb @@ -77,7 +77,7 @@ Partial Class Main Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' - 'Form4 + 'Main ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font @@ -87,7 +87,7 @@ Partial Class Main Me.Controls.Add(Me.lklb_Update) Me.Controls.Add(Me.MenuStrip1) Me.MainMenuStrip = Me.MenuStrip1 - Me.Name = "Form4" + Me.Name = "Main" Me.Text = "Form4" Me.MenuStrip1.ResumeLayout(False) Me.MenuStrip1.PerformLayout() diff --git a/Gen5 Distribution Creator/Main.resx b/Gen5 Distribution Creator/Main.resx index 381f8c5..73cdba1 100644 --- a/Gen5 Distribution Creator/Main.resx +++ b/Gen5 Distribution Creator/Main.resx @@ -123,7 +123,4 @@ 17, 17 - - 132, 17 - \ No newline at end of file diff --git a/Gen5 Distribution Creator/Main.vb b/Gen5 Distribution Creator/Main.vb index e776cf2..856ffb4 100644 --- a/Gen5 Distribution Creator/Main.vb +++ b/Gen5 Distribution Creator/Main.vb @@ -4,41 +4,26 @@ Imports Newtonsoft.Json.Linq Public Class Main #Region "Variables" - Dim apppath As String = My.Application.Info.DirectoryPath 'Path to .exe directory - Dim res As String = Path.GetFullPath(Application.StartupPath & "\..\..\Resources\") 'Path to Project Resources - Dim TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Temp" 'Path to Temp + ReadOnly apppath As String = My.Application.Info.DirectoryPath 'Path to .exe directory + ReadOnly res As String = Path.GetFullPath(Application.StartupPath & "\..\..\Resources\") 'Path to Project Resources + ReadOnly TempPath As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Temp" 'Path to Temp Public Shared Local As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Regnum\PKMG5DC" 'Path to Local folder - Dim Gen As Byte = 5 - Dim card1 As New Card5 - Dim langCksm As UShort() = {&H83BC, &H9D36, &H39AA, &H4418, &HE061, &HF57A} - Dim langs As Byte() = {&H2, &H3, &H4, &H5, &H6} + ReadOnly langCksm As UShort() = {&H83BC, &H9D36, &H39AA, &H4418, &HE061, &HF57A} 'List of Language Checksums + ReadOnly langs As Byte() = {&H2, &H3, &H4, &H5, &H6} 'List of Language values #End Region - Private Sub Form4_Load(sender As Object, e As EventArgs) Handles MyBase.Load - 'CheckGen() + Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load CheckLocal() CheckTicket() UpdateChk() - Dim pgf As String = "3E0200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000470065007400200074006800650020004C00690062006500720074007900200050006100730073002100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000403DB07FE074402010000000000000000000000000000000000000000000000" - '''' - With card1 - .numberOfCards = &H8 - .wonderCard = {pgf, pgf, pgf, pgf, pgf, pgf, pgf, pgf} - .gameCompatability = {&HF0, &HC0, &H30, &H20, &H10, &HA0, &H50, &HD0} - - .language = {langs(0), langs(1), langs(2), langs(3), langs(4), langs(0), langs(0), &H8} - .langChecksum = {langCksm(0), langCksm(1), langCksm(2), langCksm(3), langCksm(4), langCksm(5), langCksm(5), &HA986} - .startYear = &H7E4 - .startMonth = &H3 - .startDay = &H14 - .endYear = .startYear + 1 - .endMonth = .startMonth - .endDay = .startDay - End With - card1.endMonth = 4 - Output() + Dim tools(,) = {{"\tools\ndstool.exe", My.Resources.ndstool}, {"\tools\extract.bat", "cd " & Local & "\tools + ndstool.exe -x ..\ticket.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin"}, {"\tools\compile.bat", "cd " & Local & "\tools + ndstool.exe -c ..\ticket2.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin"}, {"\tools\clean.bat", "cd " & Local & "\tools + rd /S/Q data + del arm9.bin arm7.bin banner.bin header.bin"}} + CreateFiles(tools) End Sub - Private Sub Form4_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing + Private Sub Main_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing Dim myIniFile As New IniFile With myIniFile .Filename = Local & "\settings.ini" @@ -53,15 +38,6 @@ Public Class Main End If End With End Sub - - 'Private Sub CheckGen() - ' Dim n As String = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName) - ' If n.Contains("G4") Then - ' Gen = 4 - ' Else - ' Gen = 5 - ' End If - 'End Sub #Region "Esentials" 'Checks For Update Private Sub UpdateChk() @@ -74,8 +50,8 @@ Public Class Main #If DEBUG Then File.WriteAllText(apppath & "/version.txt", My.Application.Info.Version.ToString) File.WriteAllText(apppath & "/version.json", "{ -" & ControlChars.Quote & "version" & ControlChars.Quote & ": " & ControlChars.Quote & My.Application.Info.Version.ToString & ControlChars.Quote & " -}") + " & ControlChars.Quote & "version" & ControlChars.Quote & ": " & ControlChars.Quote & My.Application.Info.Version.ToString & ControlChars.Quote & " + }") If My.Computer.Network.IsAvailable Then My.Computer.Network.DownloadFile("https://raw.githubusercontent.com/PlasticJustice/PKMG5DC/master/Gen5%20Distribution%20Creator/bin/Debug/version.txt", TempPath & "\vsn.txt") Dim Reader As New IO.StreamReader(TempPath & "\vsn.txt") @@ -89,31 +65,31 @@ Public Class Main lklb_Update.Hide() MenuStrip1.Location = New Point(0, 0) #Else - File.WriteAllText(TempPath & "\date.txt", My.Resources._date) - Dim dat As String = File.ReadAllText(TempPath & "\date.txt") - Me.Text = "PKMG5DC (" & dat & ")" - If My.Computer.Network.IsAvailable Then - Try - My.Computer.Network.DownloadFile("https://raw.githubusercontent.com/PlasticJustice/PKMG5DC/master/Gen5%20Distribution%20Creator/Resources/date.txt", TempPath & "\dt.txt") - Catch - File.WriteAllText(TempPath & "\dt.txt", " ") - End Try - Dim Reader As New IO.StreamReader(TempPath & "\dt.txt") - Dim dtt As String = Reader.ReadToEnd - Reader.Close() - File.Delete(TempPath & "\dt.txt") - If dat <> dtt Then - lklb_Update.Text = "New Update Available! " & dtt - MenuStrip1.Location = New Point(170, 0) - lklb_Update.Show() + File.WriteAllText(TempPath & "\date.txt", My.Resources._date) + Dim dat As String = File.ReadAllText(TempPath & "\date.txt") + Me.Text = "PKMG5DC (" & dat & ")" + If My.Computer.Network.IsAvailable Then + Try + My.Computer.Network.DownloadFile("https://raw.githubusercontent.com/PlasticJustice/PKMG5DC/master/Gen5%20Distribution%20Creator/Resources/date.txt", TempPath & "\dt.txt") + Catch + File.WriteAllText(TempPath & "\dt.txt", " ") + End Try + Dim Reader As New IO.StreamReader(TempPath & "\dt.txt") + Dim dtt As String = Reader.ReadToEnd + Reader.Close() + File.Delete(TempPath & "\dt.txt") + If dat <> dtt Then + lklb_Update.Text = "New Update Available! " & dtt + MenuStrip1.Location = New Point(170, 0) + lklb_Update.Show() + Else + lklb_Update.Hide() + MenuStrip1.Location = New Point(0, 0) + End If Else lklb_Update.Hide() - MenuStrip1.Location = New Point(0, 0) End If - Else - lklb_Update.Hide() - End If - File.Delete(TempPath & "\date.txt") + File.Delete(TempPath & "\date.txt") #End If End Sub Private Sub Lklb_Update_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles lklb_Update.LinkClicked @@ -121,10 +97,12 @@ Public Class Main Process.Start("https://raw.githubusercontent.com/PlasticJustice/PKMG5DC/releases/latest") Else MsgBox("No Internet connection! -You can not update at the moment.", vbOKOnly, "Error 404") + You can not update at the moment.", vbOKOnly, "Error 404") End If End Sub +#End Region +#Region "Startup" Private Sub CreateFolders(ByVal dirs As String()) Try @@ -186,8 +164,6 @@ You can not update at the moment.", vbOKOnly, "Error 404") End If End With End Sub -#End Region -#Region "Startup" 'Checks for Ticket Private Sub CheckTicket() If My.Settings.ticket <> Nothing Then @@ -259,56 +235,14 @@ You can not update at the moment.", vbOKOnly, "Error 404") End If End If End Sub + + 'Private Sub CheckGen() + ' Dim n As String = Path.GetFileNameWithoutExtension(Process.GetCurrentProcess().MainModule.FileName) + ' If n.Contains("G4") Then + ' Gen = 4 + ' Else + ' Gen = 5 + ' End If + 'End Sub #End Region - - Private Sub Output() - Dim cc As String = Hex_Zeros(Hex(card1.numberOfCards), 2) & "000000" - For n = 0 To card1.numberOfCards - 1 Step 1 - cc &= card1.wonderCard(n) & "0000" & Hex(card1.gameCompatability(n)) & "00" - For i = 0 To &H1F7 Step 1 - cc &= "FF" - Next i - cc &= "FFFF00" & Hex_Zeros(card1.language(n), 2) & "0000" & Little_Endian(Hex(card1.langChecksum(n)), 4) - Next n - For i = 0 To (&H13AF - ((card1.numberOfCards - 1) * &H2D0)) Step 1 '0x1eef - cc &= "00" - Next i - For i = 0 To card1.numberOfCards - 1 Step 1 - cc &= Little_Endian(Hex(card1.startYear), 4) & Hex_Zeros(Hex(card1.startMonth), 2) & Hex_Zeros(Hex(card1.startDay), 2) & - Little_Endian(Hex(card1.endYear), 4) & Hex_Zeros(Hex(card1.endMonth), 2) & Hex_Zeros(Hex(card1.endDay), 2) - Next i - For i = 0 To (&H3B - ((card1.numberOfCards - 1) * &H8)) Step 1 '0x5b - cc &= "00" - Next i - cc &= "1400000000000000" - RichTextBox1.Text = cc - End Sub - - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - Try - Dim tools(,) = {{"\tools\ndstool.exe", My.Resources.ndstool}, {"\tools\extract.bat", "cd " & Local & "\tools -ndstool.exe -x ..\ticket.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin"}, {"\tools\compile.bat", "cd " & Local & "\tools -ndstool.exe -c ..\ticket2.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin"}, {"\tools\clean.bat", "cd " & Local & "\tools -rd /S/Q data -del arm9.bin arm7.bin banner.bin header.bin"}} - CreateFiles(tools) - - ' File.WriteAllBytes(Local & "\tools\ndstool.exe", My.Resources.ndstool) - ' File.WriteAllText(Local & "\tools\extract.bat", "cd " & Local & "\tools - 'ndstool.exe -x ..\ticket.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin") - ' File.WriteAllText(Local & "\tools\compile.bat", "cd " & Local & "\tools - 'ndstool.exe -c ..\ticket2.nds -9 arm9.bin -7 arm7.bin -d data -t banner.bin -h header.bin") - ' File.WriteAllText(Local & "\tools\clean.bat", "cd " & Local & "\tools - 'rd /S/Q data - 'del arm9.bin arm7.bin banner.bin header.bin") - Process.Start(Local & "\tools\extract.bat").WaitForExit() - File.Delete(Local & "\tools\data\data.bin") - Save(Local & "\tools\data\data.bin", RichTextBox1.Text) - Process.Start(Local & "\tools\compile.bat").WaitForExit() - Process.Start(Local & "\tools\clean.bat").WaitForExit() - Catch ex As Exception - MessageBox.Show(ex.Message) - End Try - End Sub - End Class \ No newline at end of file diff --git a/Gen5 Distribution Creator/My Project/Application.Designer.vb b/Gen5 Distribution Creator/My Project/Application.Designer.vb index bbd19f2..618f4e2 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.PGFCreator + Me.MainForm = Global.PKMG5DC.Main 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 eb641e1..5b8d48e 100644 --- a/Gen5 Distribution Creator/My Project/Application.myapp +++ b/Gen5 Distribution Creator/My Project/Application.myapp @@ -1,7 +1,7 @@  true - PGFCreator + Main false 0 true diff --git a/Gen5 Distribution Creator/PGF.vb b/Gen5 Distribution Creator/PGF.vb index cb6f978..9773742 100644 --- a/Gen5 Distribution Creator/PGF.vb +++ b/Gen5 Distribution Creator/PGF.vb @@ -21,7 +21,7 @@ Return Data(&H4) End Get Set(ByVal value As Byte) - Data(&H4) = CByte(value) + Data(&H4) = value End Set End Property '00 00 00 @@ -176,7 +176,7 @@ Return Data(&HE) End Get Set(ByVal value As Byte) - Data(&HE) = CByte(value) + Data(&HE) = value End Set End Property '00 @@ -251,7 +251,7 @@ Return Data(&H34) End Get Set(value As Byte) - Data(&H34) = CByte(value) + Data(&H34) = value End Set End Property Public Property Gender As Byte @@ -259,7 +259,7 @@ Return Data(&H35) End Get Set(value As Byte) - Data(&H35) = CByte(value) + Data(&H35) = value End Set End Property Public Property Ability As Byte @@ -283,7 +283,7 @@ Return BitConverter.ToUInt16(Data, &H38) End Get Set(ByVal value As UShort) - BitConverter.GetBytes(CUShort(value)).CopyTo(Data, &H38) + BitConverter.GetBytes(value).CopyTo(Data, &H38) End Set End Property Public Property Met As UShort @@ -291,7 +291,7 @@ Return BitConverter.ToUInt16(Data, &H3A) End Get Set(ByVal value As UShort) - BitConverter.GetBytes(CUShort(value)).CopyTo(Data, &H3A) + BitConverter.GetBytes(value).CopyTo(Data, &H3A) End Set End Property Public Property Level As Byte @@ -299,12 +299,58 @@ Return Data(&H5B) End Get Set(ByVal value As Byte) - Data(&H3C) = CByte(value) - Data(&H5B) = CByte(value) + Data(&H3C) = value + Data(&H5B) = value + End Set + End Property + Public Property CV_Cool As Byte + Get + Return Data(&H3D) + End Get + Set(ByVal value As Byte) + Data(&H3D) = value + End Set + End Property + Public Property CV_Beauty As Byte + Get + Return Data(&H3E) + End Get + Set(ByVal value As Byte) + Data(&H3E) = value + End Set + End Property + Public Property CV_Cute As Byte + Get + Return Data(&H3F) + End Get + Set(ByVal value As Byte) + Data(&H3F) = value + End Set + End Property + Public Property CV_Smart As Byte + Get + Return Data(&H40) + End Get + Set(ByVal value As Byte) + Data(&H40) = value + End Set + End Property + Public Property CV_Tough As Byte + Get + Return Data(&H41) + End Get + Set(ByVal value As Byte) + Data(&H41) = value + End Set + End Property + Public Property CV_Sheen As Byte + Get + Return Data(&H42) + End Get + Set(ByVal value As Byte) + Data(&H42) = value End Set End Property - Public Property ContestStats As String '0x5 - Public Property Sheen As Byte Public Property IV_HP As Byte Get Return Data(&H43) @@ -391,9 +437,30 @@ End Property 'FF FF '00 00 - Public Property RecieveDay As Byte = 0 - Public Property RecieveMonth As Byte = 0 - Public Property RecieveYear As UShort = 0 + Public Property RecieveDay As Byte + Get + Return Data(&HAC) + End Get + Set(ByVal value As Byte) + Data(&HAC) = value + End Set + End Property + Public Property RecieveMonth As Byte + Get + Return Data(&HAD) + End Get + Set(ByVal value As Byte) + Data(&HAD) = value + End Set + End Property + Public Property RecieveYear As UShort + Get + Return BitConverter.ToUInt16(Data, &HAE) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &HAE) + End Set + End Property Public Property CardID As UShort Get Return BitConverter.ToUInt16(Data, &HB0) diff --git a/Gen5 Distribution Creator/PGFCreator.Designer.vb b/Gen5 Distribution Creator/PGFCreator.Designer.vb index 0fc2b80..380e6a3 100644 --- a/Gen5 Distribution Creator/PGFCreator.Designer.vb +++ b/Gen5 Distribution Creator/PGFCreator.Designer.vb @@ -23,69 +23,94 @@ Partial Class PGFCreator _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Me.PK5Name = New System.Windows.Forms.Label() - Me.OpenPK5 = New System.Windows.Forms.Button() - Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.lbl_PK5Name = New System.Windows.Forms.Label() + Me.btn_OpenPK5 = New System.Windows.Forms.Button() + Me.gb_PKDetails = New System.Windows.Forms.GroupBox() Me.lbl_Move4 = New System.Windows.Forms.Label() Me.lbl_Move3 = New System.Windows.Forms.Label() Me.lbl_Move2 = New System.Windows.Forms.Label() Me.lbl_Move1 = New System.Windows.Forms.Label() Me.lbl_IVs = New System.Windows.Forms.Label() - Me.lbl_Nature = New System.Windows.Forms.Label() + Me.lbl_Natures = New System.Windows.Forms.Label() Me.lbl_Ability = New System.Windows.Forms.Label() Me.lbl_Species = New System.Windows.Forms.Label() - Me.ComboBox2 = New System.Windows.Forms.ComboBox() + Me.cb_CardType = New System.Windows.Forms.ComboBox() Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components) - Me.GroupBox2 = New System.Windows.Forms.GroupBox() - Me.GroupBox3 = New System.Windows.Forms.GroupBox() - Me.ComboBox1 = New System.Windows.Forms.ComboBox() - Me.Label3 = New System.Windows.Forms.Label() + Me.gb_Pokemon = New System.Windows.Forms.GroupBox() + Me.cx_Origin = New System.Windows.Forms.CheckBox() + Me.cx_Lang = New System.Windows.Forms.CheckBox() + Me.cx_IV = New System.Windows.Forms.CheckBox() + Me.cx_PID = New System.Windows.Forms.CheckBox() + Me.lbl_Nature = New System.Windows.Forms.Label() + Me.cb_Nature = New System.Windows.Forms.ComboBox() + Me.lbl_Shiny = New System.Windows.Forms.Label() + Me.cb_Shiny = New System.Windows.Forms.ComboBox() + Me.lbl_Level = New System.Windows.Forms.Label() + Me.nud_Level = New System.Windows.Forms.NumericUpDown() + Me.lbl_OTGender = New System.Windows.Forms.Label() + Me.cb_OTGender = New System.Windows.Forms.ComboBox() + Me.lbl_Gender = New System.Windows.Forms.Label() + Me.cb_Gender = New System.Windows.Forms.ComboBox() + Me.lbl_AbilitySlot = New System.Windows.Forms.Label() + Me.cb_AbilitySlot = New System.Windows.Forms.ComboBox() + Me.gb_Item = New System.Windows.Forms.GroupBox() + Me.lbl_Simple = New System.Windows.Forms.Label() + Me.cb_Item = New System.Windows.Forms.ComboBox() + Me.lbl_CardID = New System.Windows.Forms.Label() Me.nud_CardID = New System.Windows.Forms.NumericUpDown() + Me.lbl_CardType = New System.Windows.Forms.Label() + Me.btn_Done = New System.Windows.Forms.Button() + Me.lbl_CardTitle = New System.Windows.Forms.Label() + Me.tb_CardTitle = New System.Windows.Forms.TextBox() + Me.gb_Power = New System.Windows.Forms.GroupBox() + Me.nud_Power = New System.Windows.Forms.NumericUpDown() Me.Label1 = New System.Windows.Forms.Label() - Me.Button1 = New System.Windows.Forms.Button() - Me.GroupBox1.SuspendLayout() - Me.GroupBox2.SuspendLayout() - Me.GroupBox3.SuspendLayout() + Me.gb_PKDetails.SuspendLayout() + Me.gb_Pokemon.SuspendLayout() + CType(Me.nud_Level, System.ComponentModel.ISupportInitialize).BeginInit() + Me.gb_Item.SuspendLayout() CType(Me.nud_CardID, System.ComponentModel.ISupportInitialize).BeginInit() + Me.gb_Power.SuspendLayout() + CType(Me.nud_Power, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' - 'PK5Name + 'lbl_PK5Name ' - Me.PK5Name.AutoEllipsis = True - Me.PK5Name.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D - Me.PK5Name.Location = New System.Drawing.Point(6, 28) - 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 + Me.lbl_PK5Name.AutoEllipsis = True + Me.lbl_PK5Name.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D + Me.lbl_PK5Name.Location = New System.Drawing.Point(13, 22) + Me.lbl_PK5Name.Margin = New System.Windows.Forms.Padding(3, 3, 3, 0) + Me.lbl_PK5Name.Name = "lbl_PK5Name" + Me.lbl_PK5Name.Size = New System.Drawing.Size(330, 17) + Me.lbl_PK5Name.TabIndex = 10 + Me.lbl_PK5Name.Text = "Open .pk5 ------->" + Me.lbl_PK5Name.TextAlign = System.Drawing.ContentAlignment.MiddleRight ' - 'OpenPK5 + 'btn_OpenPK5 ' - Me.OpenPK5.Location = New System.Drawing.Point(338, 24) - 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 + Me.btn_OpenPK5.Location = New System.Drawing.Point(345, 18) + Me.btn_OpenPK5.Name = "btn_OpenPK5" + Me.btn_OpenPK5.Size = New System.Drawing.Size(75, 23) + Me.btn_OpenPK5.TabIndex = 9 + Me.btn_OpenPK5.Text = "Open .pk5" + Me.btn_OpenPK5.UseVisualStyleBackColor = True ' - 'GroupBox1 + 'gb_PKDetails ' - Me.GroupBox1.Controls.Add(Me.lbl_Move4) - Me.GroupBox1.Controls.Add(Me.lbl_Move3) - Me.GroupBox1.Controls.Add(Me.lbl_Move2) - Me.GroupBox1.Controls.Add(Me.lbl_Move1) - Me.GroupBox1.Controls.Add(Me.lbl_IVs) - Me.GroupBox1.Controls.Add(Me.lbl_Nature) - Me.GroupBox1.Controls.Add(Me.lbl_Ability) - Me.GroupBox1.Controls.Add(Me.lbl_Species) - Me.GroupBox1.Location = New System.Drawing.Point(515, 13) - Me.GroupBox1.Name = "GroupBox1" - Me.GroupBox1.Size = New System.Drawing.Size(273, 287) - Me.GroupBox1.TabIndex = 12 - Me.GroupBox1.TabStop = False - Me.GroupBox1.Text = "Pokémon Info" + Me.gb_PKDetails.Controls.Add(Me.lbl_Move4) + Me.gb_PKDetails.Controls.Add(Me.lbl_Move3) + Me.gb_PKDetails.Controls.Add(Me.lbl_Move2) + Me.gb_PKDetails.Controls.Add(Me.lbl_Move1) + Me.gb_PKDetails.Controls.Add(Me.lbl_IVs) + Me.gb_PKDetails.Controls.Add(Me.lbl_Natures) + Me.gb_PKDetails.Controls.Add(Me.lbl_Ability) + Me.gb_PKDetails.Controls.Add(Me.lbl_Species) + Me.gb_PKDetails.Location = New System.Drawing.Point(61, 187) + Me.gb_PKDetails.Name = "gb_PKDetails" + Me.gb_PKDetails.Size = New System.Drawing.Size(270, 230) + Me.gb_PKDetails.TabIndex = 12 + Me.gb_PKDetails.TabStop = False + Me.gb_PKDetails.Text = "Pokémon Info" ' 'lbl_Move4 ' @@ -99,7 +124,7 @@ Partial Class PGFCreator 'lbl_Move3 ' Me.lbl_Move3.AutoSize = True - Me.lbl_Move3.Location = New System.Drawing.Point(13, 181) + Me.lbl_Move3.Location = New System.Drawing.Point(13, 180) Me.lbl_Move3.Name = "lbl_Move3" Me.lbl_Move3.Size = New System.Drawing.Size(13, 13) Me.lbl_Move3.TabIndex = 6 @@ -108,7 +133,7 @@ Partial Class PGFCreator 'lbl_Move2 ' Me.lbl_Move2.AutoSize = True - Me.lbl_Move2.Location = New System.Drawing.Point(13, 152) + Me.lbl_Move2.Location = New System.Drawing.Point(13, 155) Me.lbl_Move2.Name = "lbl_Move2" Me.lbl_Move2.Size = New System.Drawing.Size(13, 13) Me.lbl_Move2.TabIndex = 5 @@ -117,7 +142,7 @@ Partial Class PGFCreator 'lbl_Move1 ' Me.lbl_Move1.AutoSize = True - Me.lbl_Move1.Location = New System.Drawing.Point(13, 122) + Me.lbl_Move1.Location = New System.Drawing.Point(13, 130) Me.lbl_Move1.Name = "lbl_Move1" Me.lbl_Move1.Size = New System.Drawing.Size(13, 13) Me.lbl_Move1.TabIndex = 4 @@ -126,26 +151,26 @@ Partial Class PGFCreator 'lbl_IVs ' Me.lbl_IVs.AutoSize = True - Me.lbl_IVs.Location = New System.Drawing.Point(13, 94) + Me.lbl_IVs.Location = New System.Drawing.Point(13, 95) Me.lbl_IVs.Name = "lbl_IVs" Me.lbl_IVs.Size = New System.Drawing.Size(28, 13) Me.lbl_IVs.TabIndex = 3 Me.lbl_IVs.Text = "IVs: " Me.ToolTip1.SetToolTip(Me.lbl_IVs, "HP/Atk/Def/SpA/SpD/Spe") ' - 'lbl_Nature + 'lbl_Natures ' - Me.lbl_Nature.AutoSize = True - Me.lbl_Nature.Location = New System.Drawing.Point(13, 67) - Me.lbl_Nature.Name = "lbl_Nature" - Me.lbl_Nature.Size = New System.Drawing.Size(45, 13) - Me.lbl_Nature.TabIndex = 2 - Me.lbl_Nature.Text = "Nature: " + Me.lbl_Natures.AutoSize = True + Me.lbl_Natures.Location = New System.Drawing.Point(13, 70) + Me.lbl_Natures.Name = "lbl_Natures" + Me.lbl_Natures.Size = New System.Drawing.Size(45, 13) + Me.lbl_Natures.TabIndex = 2 + Me.lbl_Natures.Text = "Nature: " ' 'lbl_Ability ' Me.lbl_Ability.AutoSize = True - Me.lbl_Ability.Location = New System.Drawing.Point(13, 42) + Me.lbl_Ability.Location = New System.Drawing.Point(13, 45) Me.lbl_Ability.Name = "lbl_Ability" Me.lbl_Ability.Size = New System.Drawing.Size(40, 13) Me.lbl_Ability.TabIndex = 1 @@ -160,123 +185,380 @@ Partial Class PGFCreator Me.lbl_Species.TabIndex = 0 Me.lbl_Species.Text = "Name @ Item" ' - 'ComboBox2 + 'cb_CardType ' - Me.ComboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList - Me.ComboBox2.FormattingEnabled = True - Me.ComboBox2.Items.AddRange(New Object() {"Pokémon", "Item"}) - Me.ComboBox2.Location = New System.Drawing.Point(28, 47) - Me.ComboBox2.Name = "ComboBox2" - Me.ComboBox2.Size = New System.Drawing.Size(94, 21) - Me.ComboBox2.TabIndex = 13 + Me.cb_CardType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_CardType.FormattingEnabled = True + Me.cb_CardType.Items.AddRange(New Object() {"Pokémon", "Item", "Pass Power"}) + Me.cb_CardType.Location = New System.Drawing.Point(16, 32) + Me.cb_CardType.Name = "cb_CardType" + Me.cb_CardType.Size = New System.Drawing.Size(94, 21) + Me.cb_CardType.TabIndex = 13 ' - 'GroupBox2 + 'gb_Pokemon ' - Me.GroupBox2.Controls.Add(Me.PK5Name) - Me.GroupBox2.Controls.Add(Me.OpenPK5) - Me.GroupBox2.Location = New System.Drawing.Point(12, 96) - Me.GroupBox2.Name = "GroupBox2" - Me.GroupBox2.Size = New System.Drawing.Size(423, 71) - Me.GroupBox2.TabIndex = 14 - Me.GroupBox2.TabStop = False - Me.GroupBox2.Text = "Pokemon" + Me.gb_Pokemon.Controls.Add(Me.cx_Origin) + Me.gb_Pokemon.Controls.Add(Me.cx_Lang) + Me.gb_Pokemon.Controls.Add(Me.cx_IV) + Me.gb_Pokemon.Controls.Add(Me.cx_PID) + Me.gb_Pokemon.Controls.Add(Me.lbl_Nature) + Me.gb_Pokemon.Controls.Add(Me.cb_Nature) + Me.gb_Pokemon.Controls.Add(Me.lbl_Shiny) + Me.gb_Pokemon.Controls.Add(Me.cb_Shiny) + Me.gb_Pokemon.Controls.Add(Me.lbl_Level) + Me.gb_Pokemon.Controls.Add(Me.gb_PKDetails) + Me.gb_Pokemon.Controls.Add(Me.nud_Level) + Me.gb_Pokemon.Controls.Add(Me.lbl_OTGender) + Me.gb_Pokemon.Controls.Add(Me.cb_OTGender) + Me.gb_Pokemon.Controls.Add(Me.lbl_Gender) + Me.gb_Pokemon.Controls.Add(Me.cb_Gender) + Me.gb_Pokemon.Controls.Add(Me.lbl_AbilitySlot) + Me.gb_Pokemon.Controls.Add(Me.cb_AbilitySlot) + Me.gb_Pokemon.Controls.Add(Me.lbl_PK5Name) + Me.gb_Pokemon.Controls.Add(Me.btn_OpenPK5) + Me.gb_Pokemon.Location = New System.Drawing.Point(16, 59) + Me.gb_Pokemon.Name = "gb_Pokemon" + Me.gb_Pokemon.Size = New System.Drawing.Size(435, 430) + Me.gb_Pokemon.TabIndex = 14 + Me.gb_Pokemon.TabStop = False + Me.gb_Pokemon.Text = "Pokémon" ' - 'GroupBox3 + 'cx_Origin ' - Me.GroupBox3.Controls.Add(Me.ComboBox1) - Me.GroupBox3.Location = New System.Drawing.Point(18, 174) - Me.GroupBox3.Name = "GroupBox3" - Me.GroupBox3.Size = New System.Drawing.Size(417, 78) - Me.GroupBox3.TabIndex = 15 - Me.GroupBox3.TabStop = False - Me.GroupBox3.Text = "Item" + Me.cx_Origin.AutoSize = True + Me.cx_Origin.Location = New System.Drawing.Point(244, 158) + Me.cx_Origin.Name = "cx_Origin" + Me.cx_Origin.Size = New System.Drawing.Size(132, 17) + Me.cx_Origin.TabIndex = 35 + Me.cx_Origin.Text = "Recipient Origin Game" + Me.cx_Origin.UseVisualStyleBackColor = True ' - 'ComboBox1 + 'cx_Lang ' - Me.ComboBox1.FormattingEnabled = True - Me.ComboBox1.Location = New System.Drawing.Point(25, 35) - Me.ComboBox1.Name = "ComboBox1" - Me.ComboBox1.Size = New System.Drawing.Size(260, 21) - Me.ComboBox1.TabIndex = 0 + Me.cx_Lang.AutoSize = True + Me.cx_Lang.Location = New System.Drawing.Point(46, 158) + Me.cx_Lang.Name = "cx_Lang" + Me.cx_Lang.Size = New System.Drawing.Size(122, 17) + Me.cx_Lang.TabIndex = 34 + Me.cx_Lang.Text = "Recipient Language" + Me.cx_Lang.UseVisualStyleBackColor = True ' - 'Label3 + 'cx_IV ' - Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(128, 33) - Me.Label3.Name = "Label3" - Me.Label3.Size = New System.Drawing.Size(46, 13) - Me.Label3.TabIndex = 17 - Me.Label3.Text = "Card ID:" + Me.cx_IV.AutoSize = True + Me.cx_IV.Location = New System.Drawing.Point(345, 119) + Me.cx_IV.Name = "cx_IV" + Me.cx_IV.Size = New System.Drawing.Size(84, 17) + Me.cx_IV.TabIndex = 33 + Me.cx_IV.Text = "Random IVs" + Me.cx_IV.UseVisualStyleBackColor = True + ' + 'cx_PID + ' + Me.cx_PID.AutoSize = True + Me.cx_PID.Location = New System.Drawing.Point(244, 119) + Me.cx_PID.Name = "cx_PID" + Me.cx_PID.Size = New System.Drawing.Size(87, 17) + Me.cx_PID.TabIndex = 32 + Me.cx_PID.Text = "Random PID" + Me.cx_PID.UseVisualStyleBackColor = True + ' + 'lbl_Nature + ' + Me.lbl_Nature.AutoSize = True + Me.lbl_Nature.Location = New System.Drawing.Point(126, 105) + Me.lbl_Nature.Name = "lbl_Nature" + Me.lbl_Nature.Size = New System.Drawing.Size(42, 13) + Me.lbl_Nature.TabIndex = 31 + Me.lbl_Nature.Text = "Nature:" + ' + 'cb_Nature + ' + Me.cb_Nature.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_Nature.FormattingEnabled = True + Me.cb_Nature.Items.AddRange(New Object() {"Random", "Adamant", "Bashful", "Bold", "Brave", "Calm", "Careful", "Docile", "Gentle", "Hardy", "Hasty", "Impish", "Jolly", "Lax", "Lonely", "Mild", "Modest", "Naive", "Naughty", "Quiet", "Quirky", "Rash", "Relaxed", "Sassy", "Serious", "Timid"}) + Me.cb_Nature.Location = New System.Drawing.Point(129, 119) + Me.cb_Nature.Name = "cb_Nature" + Me.cb_Nature.Size = New System.Drawing.Size(94, 21) + Me.cb_Nature.TabIndex = 30 + ' + 'lbl_Shiny + ' + Me.lbl_Shiny.AutoSize = True + Me.lbl_Shiny.Location = New System.Drawing.Point(10, 105) + Me.lbl_Shiny.Name = "lbl_Shiny" + Me.lbl_Shiny.Size = New System.Drawing.Size(55, 13) + Me.lbl_Shiny.TabIndex = 29 + Me.lbl_Shiny.Text = "Shininess:" + ' + 'cb_Shiny + ' + Me.cb_Shiny.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_Shiny.FormattingEnabled = True + Me.cb_Shiny.Items.AddRange(New Object() {"Never Shiny", "Can be Shiny", "Always Shiny"}) + Me.cb_Shiny.Location = New System.Drawing.Point(13, 119) + Me.cb_Shiny.Name = "cb_Shiny" + Me.cb_Shiny.Size = New System.Drawing.Size(94, 21) + Me.cb_Shiny.TabIndex = 28 + ' + 'lbl_Level + ' + Me.lbl_Level.AutoSize = True + Me.lbl_Level.Location = New System.Drawing.Point(356, 58) + Me.lbl_Level.Name = "lbl_Level" + Me.lbl_Level.Size = New System.Drawing.Size(36, 13) + Me.lbl_Level.TabIndex = 23 + Me.lbl_Level.Text = "Level:" + ' + 'nud_Level + ' + Me.nud_Level.Location = New System.Drawing.Point(359, 72) + Me.nud_Level.Name = "nud_Level" + Me.nud_Level.Size = New System.Drawing.Size(60, 20) + Me.nud_Level.TabIndex = 22 + ' + 'lbl_OTGender + ' + Me.lbl_OTGender.AutoSize = True + Me.lbl_OTGender.Location = New System.Drawing.Point(126, 58) + Me.lbl_OTGender.Name = "lbl_OTGender" + Me.lbl_OTGender.Size = New System.Drawing.Size(63, 13) + Me.lbl_OTGender.TabIndex = 27 + Me.lbl_OTGender.Text = "OT Gender:" + ' + 'cb_OTGender + ' + Me.cb_OTGender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_OTGender.FormattingEnabled = True + Me.cb_OTGender.Items.AddRange(New Object() {"Male", "Female", "Recipient"}) + Me.cb_OTGender.Location = New System.Drawing.Point(129, 72) + Me.cb_OTGender.Name = "cb_OTGender" + Me.cb_OTGender.Size = New System.Drawing.Size(94, 21) + Me.cb_OTGender.TabIndex = 26 + ' + 'lbl_Gender + ' + Me.lbl_Gender.AutoSize = True + Me.lbl_Gender.Location = New System.Drawing.Point(11, 58) + Me.lbl_Gender.Name = "lbl_Gender" + Me.lbl_Gender.Size = New System.Drawing.Size(45, 13) + Me.lbl_Gender.TabIndex = 25 + Me.lbl_Gender.Text = "Gender:" + ' + 'cb_Gender + ' + Me.cb_Gender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_Gender.FormattingEnabled = True + Me.cb_Gender.Items.AddRange(New Object() {"Male", "Female", "Random"}) + Me.cb_Gender.Location = New System.Drawing.Point(14, 72) + Me.cb_Gender.Name = "cb_Gender" + Me.cb_Gender.Size = New System.Drawing.Size(94, 21) + Me.cb_Gender.TabIndex = 24 + ' + 'lbl_AbilitySlot + ' + Me.lbl_AbilitySlot.AutoSize = True + Me.lbl_AbilitySlot.Location = New System.Drawing.Point(241, 58) + Me.lbl_AbilitySlot.Name = "lbl_AbilitySlot" + Me.lbl_AbilitySlot.Size = New System.Drawing.Size(37, 13) + Me.lbl_AbilitySlot.TabIndex = 23 + Me.lbl_AbilitySlot.Text = "Ability:" + ' + 'cb_AbilitySlot + ' + Me.cb_AbilitySlot.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList + Me.cb_AbilitySlot.FormattingEnabled = True + Me.cb_AbilitySlot.Items.AddRange(New Object() {"Ability 1", "Ability 2", "Hidden Ability", "Random (w/o HA)", "Random (w/ HA)"}) + Me.cb_AbilitySlot.Location = New System.Drawing.Point(244, 72) + Me.cb_AbilitySlot.Name = "cb_AbilitySlot" + Me.cb_AbilitySlot.Size = New System.Drawing.Size(94, 21) + Me.cb_AbilitySlot.TabIndex = 22 + ' + 'gb_Item + ' + Me.gb_Item.Controls.Add(Me.lbl_Simple) + Me.gb_Item.Controls.Add(Me.cb_Item) + Me.gb_Item.Location = New System.Drawing.Point(471, 59) + Me.gb_Item.Name = "gb_Item" + Me.gb_Item.Size = New System.Drawing.Size(435, 430) + Me.gb_Item.TabIndex = 15 + Me.gb_Item.TabStop = False + Me.gb_Item.Text = "Item" + ' + 'lbl_Simple + ' + Me.lbl_Simple.AutoSize = True + Me.lbl_Simple.ForeColor = System.Drawing.SystemColors.AppWorkspace + Me.lbl_Simple.Location = New System.Drawing.Point(161, 200) + Me.lbl_Simple.Name = "lbl_Simple" + Me.lbl_Simple.Size = New System.Drawing.Size(98, 26) + Me.lbl_Simple.TabIndex = 1 + Me.lbl_Simple.Text = "That's all" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Pretty simple isn't it." + Me.lbl_Simple.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'cb_Item + ' + Me.cb_Item.FormattingEnabled = True + Me.cb_Item.Location = New System.Drawing.Point(24, 18) + Me.cb_Item.Name = "cb_Item" + Me.cb_Item.Size = New System.Drawing.Size(386, 21) + Me.cb_Item.TabIndex = 0 + ' + 'lbl_CardID + ' + Me.lbl_CardID.AutoSize = True + Me.lbl_CardID.Location = New System.Drawing.Point(387, 18) + Me.lbl_CardID.Name = "lbl_CardID" + Me.lbl_CardID.Size = New System.Drawing.Size(46, 13) + Me.lbl_CardID.TabIndex = 17 + Me.lbl_CardID.Text = "Card ID:" ' 'nud_CardID ' - Me.nud_CardID.Location = New System.Drawing.Point(128, 46) + Me.nud_CardID.Location = New System.Drawing.Point(390, 32) Me.nud_CardID.Maximum = New Decimal(New Integer() {65535, 0, 0, 0}) Me.nud_CardID.Name = "nud_CardID" Me.nud_CardID.Size = New System.Drawing.Size(60, 20) Me.nud_CardID.TabIndex = 16 ' + 'lbl_CardType + ' + Me.lbl_CardType.AutoSize = True + Me.lbl_CardType.Location = New System.Drawing.Point(13, 18) + Me.lbl_CardType.Name = "lbl_CardType" + Me.lbl_CardType.Size = New System.Drawing.Size(59, 13) + Me.lbl_CardType.TabIndex = 18 + Me.lbl_CardType.Text = "Card Type:" + ' + 'btn_Done + ' + Me.btn_Done.Location = New System.Drawing.Point(16, 505) + Me.btn_Done.Name = "btn_Done" + Me.btn_Done.Size = New System.Drawing.Size(435, 23) + Me.btn_Done.TabIndex = 19 + Me.btn_Done.Text = "Done" + Me.btn_Done.UseVisualStyleBackColor = True + ' + 'lbl_CardTitle + ' + Me.lbl_CardTitle.AutoSize = True + Me.lbl_CardTitle.Location = New System.Drawing.Point(136, 18) + Me.lbl_CardTitle.Name = "lbl_CardTitle" + Me.lbl_CardTitle.Size = New System.Drawing.Size(55, 13) + Me.lbl_CardTitle.TabIndex = 21 + Me.lbl_CardTitle.Text = "Card Title:" + ' + 'tb_CardTitle + ' + Me.tb_CardTitle.Location = New System.Drawing.Point(137, 32) + Me.tb_CardTitle.MaxLength = 36 + Me.tb_CardTitle.Name = "tb_CardTitle" + Me.tb_CardTitle.Size = New System.Drawing.Size(224, 20) + Me.tb_CardTitle.TabIndex = 20 + ' + 'gb_Power + ' + Me.gb_Power.Controls.Add(Me.nud_Power) + Me.gb_Power.Controls.Add(Me.Label1) + Me.gb_Power.Location = New System.Drawing.Point(922, 59) + Me.gb_Power.Name = "gb_Power" + Me.gb_Power.Size = New System.Drawing.Size(435, 430) + Me.gb_Power.TabIndex = 16 + Me.gb_Power.TabStop = False + Me.gb_Power.Text = "Pass Power" + ' + 'nud_Power + ' + Me.nud_Power.Location = New System.Drawing.Point(176, 22) + Me.nud_Power.Maximum = New Decimal(New Integer() {65535, 0, 0, 0}) + Me.nud_Power.Name = "nud_Power" + Me.nud_Power.Size = New System.Drawing.Size(60, 20) + Me.nud_Power.TabIndex = 17 + ' 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(25, 33) + Me.Label1.ForeColor = System.Drawing.SystemColors.AppWorkspace + Me.Label1.Location = New System.Drawing.Point(161, 200) Me.Label1.Name = "Label1" - Me.Label1.Size = New System.Drawing.Size(59, 13) - Me.Label1.TabIndex = 18 - Me.Label1.Text = "Card Type:" - ' - 'Button1 - ' - Me.Button1.Location = New System.Drawing.Point(227, 295) - Me.Button1.Name = "Button1" - Me.Button1.Size = New System.Drawing.Size(75, 23) - Me.Button1.TabIndex = 19 - Me.Button1.Text = "Button1" - Me.Button1.UseVisualStyleBackColor = True + Me.Label1.Size = New System.Drawing.Size(98, 26) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "That's all" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Pretty simple isn't it." + Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter ' '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.Button1) - Me.Controls.Add(Me.Label1) - Me.Controls.Add(Me.Label3) + Me.ClientSize = New System.Drawing.Size(1371, 540) + Me.Controls.Add(Me.gb_Power) + Me.Controls.Add(Me.lbl_CardTitle) + Me.Controls.Add(Me.tb_CardTitle) + Me.Controls.Add(Me.btn_Done) + Me.Controls.Add(Me.lbl_CardType) + Me.Controls.Add(Me.lbl_CardID) Me.Controls.Add(Me.nud_CardID) - Me.Controls.Add(Me.GroupBox3) - Me.Controls.Add(Me.GroupBox2) - Me.Controls.Add(Me.ComboBox2) - Me.Controls.Add(Me.GroupBox1) + Me.Controls.Add(Me.gb_Item) + Me.Controls.Add(Me.gb_Pokemon) + Me.Controls.Add(Me.cb_CardType) Me.Name = "PGFCreator" Me.Text = "PGFCreator" - Me.GroupBox1.ResumeLayout(False) - Me.GroupBox1.PerformLayout() - Me.GroupBox2.ResumeLayout(False) - Me.GroupBox3.ResumeLayout(False) + Me.gb_PKDetails.ResumeLayout(False) + Me.gb_PKDetails.PerformLayout() + Me.gb_Pokemon.ResumeLayout(False) + Me.gb_Pokemon.PerformLayout() + CType(Me.nud_Level, System.ComponentModel.ISupportInitialize).EndInit() + Me.gb_Item.ResumeLayout(False) + Me.gb_Item.PerformLayout() CType(Me.nud_CardID, System.ComponentModel.ISupportInitialize).EndInit() + Me.gb_Power.ResumeLayout(False) + Me.gb_Power.PerformLayout() + CType(Me.nud_Power, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub - Friend WithEvents PK5Name As Label - Friend WithEvents OpenPK5 As Button - Friend WithEvents GroupBox1 As GroupBox + Friend WithEvents lbl_PK5Name As Label + Friend WithEvents btn_OpenPK5 As Button + Friend WithEvents gb_PKDetails As GroupBox Friend WithEvents lbl_Species As Label - Friend WithEvents ComboBox2 As ComboBox + Friend WithEvents cb_CardType As ComboBox Friend WithEvents lbl_Move4 As Label Friend WithEvents lbl_Move3 As Label Friend WithEvents lbl_Move2 As Label Friend WithEvents lbl_Move1 As Label Friend WithEvents lbl_IVs As Label - Friend WithEvents lbl_Nature As Label + Friend WithEvents lbl_Natures As Label Friend WithEvents lbl_Ability As Label Friend WithEvents ToolTip1 As ToolTip - Friend WithEvents GroupBox2 As GroupBox - Friend WithEvents GroupBox3 As GroupBox - Friend WithEvents ComboBox1 As ComboBox - Friend WithEvents Label3 As Label + Friend WithEvents gb_Pokemon As GroupBox + Friend WithEvents gb_Item As GroupBox + Friend WithEvents cb_Item As ComboBox + Friend WithEvents lbl_CardID As Label Friend WithEvents nud_CardID As NumericUpDown + Friend WithEvents lbl_CardType As Label + Friend WithEvents btn_Done As Button + Friend WithEvents lbl_CardTitle As Label + Friend WithEvents tb_CardTitle As TextBox + Friend WithEvents lbl_AbilitySlot As Label + Friend WithEvents cb_AbilitySlot As ComboBox + Friend WithEvents lbl_Gender As Label + Friend WithEvents cb_Gender As ComboBox + Friend WithEvents lbl_OTGender As Label + Friend WithEvents cb_OTGender As ComboBox + Friend WithEvents lbl_Level As Label + Friend WithEvents nud_Level As NumericUpDown + Friend WithEvents lbl_Shiny As Label + Friend WithEvents cb_Shiny As ComboBox + Friend WithEvents lbl_Nature As Label + Friend WithEvents cb_Nature As ComboBox + Friend WithEvents cx_IV As CheckBox + Friend WithEvents cx_PID As CheckBox + Friend WithEvents cx_Origin As CheckBox + Friend WithEvents cx_Lang As CheckBox + Friend WithEvents lbl_Simple As Label + Friend WithEvents gb_Power As GroupBox + Friend WithEvents nud_Power As NumericUpDown Friend WithEvents Label1 As Label - Friend WithEvents Button1 As Button End Class diff --git a/Gen5 Distribution Creator/PGFCreator.vb b/Gen5 Distribution Creator/PGFCreator.vb index c05cb07..8392214 100644 --- a/Gen5 Distribution Creator/PGFCreator.vb +++ b/Gen5 Distribution Creator/PGFCreator.vb @@ -1,28 +1,49 @@ Imports System.IO - Public Class PGFCreator - Dim WC As New PGF - Dim InputPK5 As New PK5 - + Dim WC As New PGF 'Wondercard + Dim InputPK5 As New PK5 'Pokemon Data + Dim OpenFile As New OpenFileDialog + ReadOnly Natures() As String = {"Hardy", "Lonely", "Brave", "Adamant", "Naughty", "Bold", "Docile", "Relaxed", "Impish", "Lax", "Timid", "Hasty", "Serious", "Jolly", "Naive", "Modest", + "Mild", "Quiet", "Bashful", "Rash", "Calm", "Gentle", "Sassy", "Careful", "Quirky"} 'List of Natures Private Sub PGFCreator_Load(sender As Object, e As EventArgs) Handles MyBase.Load - PopulateItems(ComboBox1) - ComboBox2.SelectedIndex = 0 - ComboBox1.SelectedIndex = 0 +#If DEBUG Then + Me.Size = New Size(1387, 579) +#Else + Me.Size = New Size(483, 579) + cb_CardType.Items.Remove("Pass Power") +#End If + PopulateItems(cb_Item) + Defaults() End Sub - Private Sub OpenPK5_Click(sender As Object, e As EventArgs) Handles OpenPK5.Click - Dim OpenFile As New OpenFileDialog With { - .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.Data = File.ReadAllBytes(OpenFile.FileName) - GrabValues() - End If + 'Sets Default Settings + Private Sub Defaults() + cb_CardType.SelectedIndex = 0 + cb_Gender.SelectedIndex = 2 + cb_OTGender.SelectedIndex = 2 + cb_AbilitySlot.SelectedIndex = 3 + cb_Shiny.SelectedIndex = 1 + cb_Nature.SelectedIndex = 0 + cx_Lang.Checked = True + cx_Origin.Checked = True + cb_Item.SelectedIndex = 0 End Sub + 'Updates the WC with selected settings + Private Sub UpdateValues(sender As Object, e As EventArgs) + cb_Gender_SelectedIndexChanged(sender, e) + cb_OTGender_SelectedIndexChanged(sender, e) + cb_AbilitySlot_SelectedIndexChanged(sender, e) + nud_Level_ValueChanged(sender, e) + cb_Shiny_SelectedIndexChanged(sender, e) + cb_Nature_SelectedIndexChanged(sender, e) + cx_PID_CheckedChanged(sender, e) + cx_IV_CheckedChanged(sender, e) + cx_Lang_CheckedChanged(sender, e) + cx_Origin_CheckedChanged(sender, e) + End Sub + + 'Grabs values from PK5 Private Sub GrabValues() Try With WC @@ -30,8 +51,8 @@ Public Class PGFCreator Case 1 .TID = InputPK5.TID .SID = InputPK5.SID - .Origin = InputPK5.Origin - .PID = InputPK5.PID + If cx_Origin.Checked = False Then .Origin = InputPK5.Origin + If cx_PID.Checked = True Then .PID = InputPK5.PID .Ball = InputPK5.Ball .Item = InputPK5.Item .Move1 = InputPK5.Move1 @@ -39,17 +60,17 @@ Public Class PGFCreator .Move3 = InputPK5.Move3 .Move4 = InputPK5.Move4 .Dex = InputPK5.Dex - .Language = InputPK5.Language - .Nickname = InputPK5.Nickname + If cx_Lang.Checked = False Then .Language = InputPK5.Language + If InputPK5.IsNicknamed = True Then .Nickname = InputPK5.Nickname Else .Nickname = "" .Nature = InputPK5.Nature .EggMet = InputPK5.EggMet .Met = InputPK5.Met - .IV_HP = InputPK5.IV_HP - .IV_ATK = InputPK5.IV_ATK - .IV_DEF = InputPK5.IV_DEF - .IV_SPE = InputPK5.IV_SPE - .IV_SPA = InputPK5.IV_SPA - .IV_SPD = InputPK5.IV_SPD + If cx_IV.Checked = True Then .IV_HP = InputPK5.IV_HP + If cx_IV.Checked = True Then .IV_ATK = InputPK5.IV_ATK + If cx_IV.Checked = True Then .IV_DEF = InputPK5.IV_DEF + If cx_IV.Checked = True Then .IV_SPE = InputPK5.IV_SPE + If cx_IV.Checked = True Then .IV_SPA = InputPK5.IV_SPA + If cx_IV.Checked = True Then .IV_SPD = InputPK5.IV_SPD .Egg = InputPK5.IsEgg .OT_Name = InputPK5.OT_Name .OT_Gender = InputPK5.OT_Gender @@ -58,20 +79,18 @@ Public Class PGFCreator ConvertValues() Desc() Case 2 - .TID = GetItemID(ComboBox1.Text) + .TID = GetItemID(cb_Item.Text) Case 3 - End Select - .EventTitle = "A special Zoroark!" - .CardID = CUShort(nud_CardID.Value) .CardFrom = &H44 .Status = 1 - 'ability, shiny, event title, cardID, cardType End With - Catch ex As Exception End Try End Sub + + 'Converts value format + 'Currently just Ribbons Private Sub ConvertValues() 'Ribbons With WC @@ -91,14 +110,15 @@ Public Class PGFCreator .RibbonSouvenir = InputPK5.RibbonSouvenir .RibbonSpecial = InputPK5.RibbonSpecial End With - End Sub + + 'Generates Pokemon Description Private Sub Desc() With InputPK5 lbl_Species.Text = GetPokeName(.Dex) & " @ " & GetItemName(.Item) lbl_IVs.Text = "IVs: " & .IV_HP & "/" & .IV_ATK & "/" & .IV_DEF & "/" & .IV_SPA & "/" & .IV_SPD & "/" & .IV_SPE lbl_Ability.Text = "Ability: " & GetAbilityName(.Ability) - lbl_Nature.Text = "Nature: " & GetNature(.Nature) + lbl_Natures.Text = "Nature: " & Natures(.Nature) lbl_Move1.Text = GetMoveName(.Move1) lbl_Move2.Text = GetMoveName(.Move2) lbl_Move3.Text = GetMoveName(.Move3) @@ -110,44 +130,175 @@ Public Class PGFCreator Me.Refresh() End With End Sub - Private Function GetNature(Num As Byte) - Dim Natures() As String = {"Hardy", "Lonely", "Brave", "Adamant", "Naughty", "Bold", "Docile", "Relaxed", "Impish", "Lax", "Timid", "Hasty", "Serious", "Jolly", "Naive", "Modest", - "Mild", "Quiet", "Bashful", "Rash", "Calm", "Gentle", "Sassy", "Careful", "Quirky"} - Return Natures(Num) - End Function - - Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox2.SelectedIndexChanged - Select Case ComboBox2.Text +#Region "Controls" + 'Change Card Type + Private Sub Cb_CardType_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_CardType.SelectedIndexChanged + Select Case cb_CardType.Text Case "Pokémon" - GroupBox3.Enabled = False - GroupBox2.Enabled = True + gb_Item.Enabled = False + gb_Power.Enabled = False + gb_Pokemon.Enabled = True + gb_Pokemon.Location = New Point(16, 59) + gb_Item.Location = New Point(471, 59) + gb_Power.Location = New Point(922, 59) Array.Clear(WC.Data, 0, &H5F) WC.CardType = 1 Case "Item" - GroupBox3.Enabled = True - GroupBox2.Enabled = False + gb_Item.Enabled = True + gb_Pokemon.Enabled = False + gb_Power.Enabled = False + gb_Pokemon.Location = New Point(471, 59) + gb_Item.Location = New Point(16, 59) + gb_Power.Location = New Point(922, 59) Array.Clear(WC.Data, 0, &H5F) WC.CardType = 2 - Case "Power" - GroupBox3.Enabled = True - GroupBox2.Enabled = False + Case "Pass Power" + gb_Item.Enabled = False + gb_Pokemon.Enabled = False + gb_Power.Enabled = True + gb_Pokemon.Location = New Point(922, 59) + gb_Item.Location = New Point(471, 59) + gb_Power.Location = New Point(16, 59) Array.Clear(WC.Data, 0, &H5F) WC.CardType = 3 End Select - GrabValues() - 'Debug.Print(GetMoveID(ComboBox2.SelectedItem.ToString)) - 'TypeMove(lbl_Species, ComboBox2.SelectedItem.ToString) End Sub + 'Change Card ID Private Sub Nud_CardID_ValueChanged(sender As Object, e As EventArgs) Handles nud_CardID.ValueChanged WC.CardID = nud_CardID.Value End Sub - Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click - My.Computer.FileSystem.WriteAllBytes(Main.Local & "\output.pgf", WC.Data, False) + 'Change Card Title + Private Sub Tb_CardTitle_TextChanged(sender As Object, e As EventArgs) Handles tb_CardTitle.TextChanged + WC.EventTitle = tb_CardTitle.Text End Sub - Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged - WC.TID = GetItemID(ComboBox1.Text) + 'Loads the PK5 file + Private Sub Btn_OpenPK5_Click(sender As Object, e As EventArgs) Handles btn_OpenPK5.Click + 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) + lbl_PK5Name.Text = myFile + InputPK5.Data = File.ReadAllBytes(OpenFile.FileName) + End If + GrabValues() + UpdateValues(sender, e) End Sub + + 'Choose Gender + Private Sub Cb_Gender_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_Gender.SelectedIndexChanged + WC.Gender = cb_Gender.SelectedIndex + End Sub + + 'Choose OT Gender + Private Sub Cb_OTGender_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_OTGender.SelectedIndexChanged + Select Case cb_OTGender.SelectedIndex + Case 0, 1 + WC.OT_Gender = cb_OTGender.SelectedIndex + Case 2 + WC.OT_Gender = cb_OTGender.SelectedIndex + 1 + End Select + End Sub + + 'Choose Ability + Private Sub Cb_AbilitySlot_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_AbilitySlot.SelectedIndexChanged + WC.Ability = cb_AbilitySlot.SelectedIndex + End Sub + + 'Choose Level + Private Sub Nud_Level_ValueChanged(sender As Object, e As EventArgs) Handles nud_Level.ValueChanged + WC.Level = nud_Level.Value + End Sub + + 'Choose Shiny Possibility + Private Sub Cb_Shiny_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_Shiny.SelectedIndexChanged + WC.Shiny = cb_Shiny.SelectedIndex + End Sub + + 'Choose Nature + Private Sub Cb_Nature_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_Nature.SelectedIndexChanged + Select Case cb_Nature.Text + Case "Random" + WC.Nature = &HFF + Case Else + WC.Nature = Array.IndexOf(Natures, cb_Nature.Text) + End Select + End Sub + + 'Select whether PID is random or taken from pk5 + Private Sub Cx_PID_CheckedChanged(sender As Object, e As EventArgs) Handles cx_PID.CheckedChanged + Select Case cx_PID.Checked + Case True + WC.PID = InputPK5.PID + cx_PID.Text = "Set PID" + Case False + WC.PID = &H0 + cx_PID.Text = "Random PID" + End Select + End Sub + + 'Select whether IVs are random or taken from pk5 + Private Sub Cx_IV_CheckedChanged(sender As Object, e As EventArgs) Handles cx_IV.CheckedChanged + Select Case cx_IV.Checked + Case True + WC.IV_HP = InputPK5.IV_HP + WC.IV_ATK = InputPK5.IV_ATK + WC.IV_DEF = InputPK5.IV_DEF + WC.IV_SPE = InputPK5.IV_SPE + WC.IV_SPA = InputPK5.IV_SPA + WC.IV_SPD = InputPK5.IV_SPD + cx_IV.Text = "Set IVs" + Case False + WC.IV_HP = &HFF + WC.IV_ATK = &HFF + WC.IV_DEF = &HFF + WC.IV_SPE = &HFF + WC.IV_SPA = &HFF + WC.IV_SPD = &HFF + cx_IV.Text = "Random IVs" + End Select + End Sub + + 'Select whether language is random or taken from pk5 + Private Sub Cx_Lang_CheckedChanged(sender As Object, e As EventArgs) Handles cx_Lang.CheckedChanged + Select Case cx_Lang.Checked + Case True + WC.Language = &H0 + cx_Lang.Text = "Recipient Language" + Case False + WC.Language = InputPK5.Language + cx_Lang.Text = "Set Language" + End Select + End Sub + + 'Select whether origin is random or taken from pk5 + Private Sub Cx_Origin_CheckedChanged(sender As Object, e As EventArgs) Handles cx_Origin.CheckedChanged + Select Case cx_Origin.Checked + Case True + WC.Origin = &H0 + cx_Lang.Text = "Recipient Origin Game" + Case False + WC.Origin = InputPK5.Origin + cx_Lang.Text = "Set Origin Game" + End Select + End Sub + + 'Choose Item + Private Sub Cb_Item_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cb_Item.SelectedIndexChanged + WC.TID = GetItemID(cb_Item.Text) + End Sub + + 'Choose Pass Power ID + 'No Known Info on this + Private Sub Nud_Power_ValueChanged(sender As Object, e As EventArgs) Handles nud_Power.ValueChanged + WC.TID = nud_Power.Value + End Sub + + 'Output Button + Private Sub Btn_Done_Click(sender As Object, e As EventArgs) Handles btn_Done.Click + My.Computer.FileSystem.WriteAllBytes(Main.Local & "\output.pgf", WC.Data, False) + End Sub +#End Region End Class \ No newline at end of file diff --git a/Gen5 Distribution Creator/PK5.vb b/Gen5 Distribution Creator/PK5.vb index 633de71..f1ff699 100644 --- a/Gen5 Distribution Creator/PK5.vb +++ b/Gen5 Distribution Creator/PK5.vb @@ -550,7 +550,7 @@ End Property Public Property IV_HP As Byte Get - Return CByte((BlocIV >> 0) And &H1F) + Return (BlocIV >> 0) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 0)) Or (If(value > 31, 31UI, value) << 0)) @@ -558,7 +558,7 @@ End Property Public Property IV_ATK As Byte Get - Return CByte((BlocIV >> 5) And &H1F) + Return (BlocIV >> 5) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 5)) Or (If(value > 31, 31UI, value) << 5)) @@ -566,7 +566,7 @@ End Property Public Property IV_DEF As Byte Get - Return CByte((BlocIV >> 10) And &H1F) + Return (BlocIV >> 10) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 10)) Or (If(value > 31, 31UI, value) << 10)) @@ -574,7 +574,7 @@ End Property Public Property IV_SPE As Byte Get - Return CByte((BlocIV >> 15) And &H1F) + Return (BlocIV >> 15) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 15)) Or (If(value > 31, 31UI, value) << 15)) @@ -582,7 +582,7 @@ End Property Public Property IV_SPA As Byte Get - Return CByte((BlocIV >> 20) And &H1F) + Return (BlocIV >> 20) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 20)) Or (If(value > 31, 31UI, value) << 20)) @@ -590,7 +590,7 @@ End Property Public Property IV_SPD As Byte Get - Return CByte((BlocIV >> 25) And &H1F) + Return (BlocIV >> 25) And &H1F End Get Set(value As Byte) BlocIV = ((BlocIV And Not (&H1FUI << 25)) Or (If(value > 31, 31UI, value) << 25)) @@ -931,7 +931,7 @@ Return Data(&H41) End Get Set(value As Byte) - Data(&H41) = CByte(value) + Data(&H41) = value End Set End Property Public Property HA As Boolean @@ -967,7 +967,7 @@ Return Data(&H5F) End Get Set(ByVal value As Byte) - Data(&H5F) = CByte(value) + Data(&H5F) = value End Set End Property Public Property Sinnoh3_Ribbons1 As Byte @@ -1179,7 +1179,7 @@ Return Data(&H78) End Get Set(ByVal value As Byte) - Data(&H78) = CByte(value) + Data(&H78) = value End Set End Property Public Property EggMonth As Byte @@ -1187,7 +1187,7 @@ Return Data(&H79) End Get Set(ByVal value As Byte) - Data(&H79) = CByte(value) + Data(&H79) = value End Set End Property Public Property EggDay As Byte @@ -1195,7 +1195,7 @@ Return Data(&H7A) End Get Set(ByVal value As Byte) - Data(&H7A) = CByte(value) + Data(&H7A) = value End Set End Property Public Property MetYear As Byte @@ -1203,7 +1203,7 @@ Return Data(&H7B) End Get Set(ByVal value As Byte) - Data(&H7B) = CByte(value) + Data(&H7B) = value End Set End Property Public Property MetMonth As Byte @@ -1211,7 +1211,7 @@ Return Data(&H7C) End Get Set(ByVal value As Byte) - Data(&H7C) = CByte(value) + Data(&H7C) = value End Set End Property Public Property MetDay As Byte @@ -1219,7 +1219,7 @@ Return Data(&H7D) End Get Set(ByVal value As Byte) - Data(&H7D) = CByte(value) + Data(&H7D) = value End Set End Property Public Property EggMet As UShort @@ -1227,7 +1227,7 @@ Return BitConverter.ToUInt16(Data, &H7E) End Get Set(ByVal value As UShort) - BitConverter.GetBytes(CUShort(value)).CopyTo(Data, &H7E) + BitConverter.GetBytes(value).CopyTo(Data, &H7E) End Set End Property Public Property Met As UShort @@ -1235,7 +1235,7 @@ Return BitConverter.ToUInt16(Data, &H80) End Get Set(ByVal value As UShort) - BitConverter.GetBytes(CUShort(value)).CopyTo(Data, &H80) + BitConverter.GetBytes(value).CopyTo(Data, &H80) End Set End Property Public Property Pokerus As Byte @@ -1243,7 +1243,7 @@ Return Data(&H82) End Get Set(ByVal value As Byte) - Data(&H82) = CByte(value) + Data(&H82) = value End Set End Property Public Property Pokerus_Strain As Byte @@ -1268,7 +1268,7 @@ Return Data(&H83) End Get Set(ByVal value As Byte) - Data(&H83) = CByte(value) + Data(&H83) = value End Set End Property Public Property OT_Gender As Byte @@ -1292,23 +1292,99 @@ Return Data(&H85) End Get Set(ByVal value As Byte) - Data(&H85) = CByte(value) + Data(&H85) = value End Set End Property '00 00 - 'Public Property Status As Byte - ''00 - ''00 00 + Public Property Status As Byte + Get + Return Data(&H88) + End Get + Set(ByVal value As Byte) + Data(&H88) = value + End Set + End Property + '00 + '00 00 Public Property Level As Byte Get Return Data(&H8C) End Get Set(ByVal value As Byte) - Data(&H8C) = CByte(value) + Data(&H8C) = value End Set End Property - 'Public Property Seals As Byte - 'Public Property CurrentStats(5) As UShort '{Current HP, Max HP, Atk, Def, Spe, SpA, SpD} - 'Public Property Mail As String '0x2A + OT_Name - ''00 00 00 00 00 00 00 00 + Public Property Seals As Byte + Get + Return Data(&H8D) + End Get + Set(ByVal value As Byte) + Data(&H8D) = value + End Set + End Property + Public Property Stat_CurrentHP As UShort + Get + Return BitConverter.ToUInt16(Data, &H8E) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H8E) + End Set + End Property + Public Property Stat_MaxHP As UShort + Get + Return BitConverter.ToUInt16(Data, &H90) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H90) + End Set + End Property + Public Property Stat_ATK As UShort + Get + Return BitConverter.ToUInt16(Data, &H92) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H92) + End Set + End Property + Public Property Stat_DEF As UShort + Get + Return BitConverter.ToUInt16(Data, &H94) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H94) + End Set + End Property + Public Property Stat_SPE As UShort + Get + Return BitConverter.ToUInt16(Data, &H96) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H96) + End Set + End Property + Public Property Stat_SPA As UShort + Get + Return BitConverter.ToUInt16(Data, &H98) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H98) + End Set + End Property + Public Property Stat_SPD As UShort + Get + Return BitConverter.ToUInt16(Data, &H9A) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H9A) + End Set + End Property + Public Property Mail As Byte() '0x2A + OT_Name + Get + Return Data.Skip(&H9C).Take(&H38).ToArray() + End Get + Set(ByVal value As Byte()) + value.CopyTo(Data, &H9C) + End Set + End Property + '00 00 00 00 00 00 00 00 End Class diff --git a/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe b/Gen5 Distribution Creator/bin/Debug/PKMG5DC.exe index a802cd9..092f2b9 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 db9abd7..0c5d6f9 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/bin/Debug/version.json b/Gen5 Distribution Creator/bin/Debug/version.json index f0fb7bc..08cdb6b 100644 --- a/Gen5 Distribution Creator/bin/Debug/version.json +++ b/Gen5 Distribution Creator/bin/Debug/version.json @@ -1,3 +1,3 @@ { -"version": "1.1.4.0" -} \ No newline at end of file + "version": "1.1.4.0" + } \ No newline at end of file diff --git a/Gen5 Distribution Creator/obj/Release/PKMG5DC.vbprojAssemblyReference.cache b/Gen5 Distribution Creator/obj/Release/PKMG5DC.vbprojAssemblyReference.cache index 060a6b3..50ddee0 100644 Binary files a/Gen5 Distribution Creator/obj/Release/PKMG5DC.vbprojAssemblyReference.cache and b/Gen5 Distribution Creator/obj/Release/PKMG5DC.vbprojAssemblyReference.cache differ diff --git a/Gen5 Distribution Creator/obj/Release/TempPE/My Project.Resources.Designer.vb.dll b/Gen5 Distribution Creator/obj/Release/TempPE/My Project.Resources.Designer.vb.dll index 5628423..3f3b4f3 100644 Binary files a/Gen5 Distribution Creator/obj/Release/TempPE/My Project.Resources.Designer.vb.dll and b/Gen5 Distribution Creator/obj/Release/TempPE/My Project.Resources.Designer.vb.dll differ