diff --git a/PKMG5DC/Card5.vb b/PKMG5DC/Card5.vb index 5fffa93..99b13fb 100644 --- a/PKMG5DC/Card5.vb +++ b/PKMG5DC/Card5.vb @@ -1,152 +1,4 @@ -'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) - Output() - End Set - End Property - '00 00 - Public Property GameCompatibility As Byte - Get - Return data(&HCE) - End Get - Set(ByVal value As Byte) - data(&HCE) = value - Output() - End Set - End Property - Public Property White As Boolean - Get - Return (GameCompatibility And (1 << 4)) = (1 << 4) - End Get - Set(value As Boolean) - GameCompatibility = CByte((GameCompatibility And Not (1 << 4)) Or If(value, 1 << 4, 0)) - Output() - End Set - End Property - Public Property Black As Boolean - Get - Return (GameCompatibility And (1 << 5)) = (1 << 5) - End Get - Set(value As Boolean) - GameCompatibility = CByte((GameCompatibility And Not (1 << 5)) Or If(value, 1 << 5, 0)) - Output() - End Set - End Property - Public Property White2 As Boolean - Get - Return (GameCompatibility And (1 << 6)) = (1 << 6) - End Get - Set(value As Boolean) - GameCompatibility = CByte((GameCompatibility And Not (1 << 6)) Or If(value, 1 << 6, 0)) - Output() - End Set - End Property - Public Property Black2 As Boolean - Get - Return (GameCompatibility And (1 << 7)) = (1 << 7) - End Get - Set(value As Boolean) - GameCompatibility = CByte((GameCompatibility And Not (1 << 7)) Or If(value, 1 << 7, 0)) - Output() - End Set - End Property - '00 - 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) - Output() - End Set - End Property - 'FF FF - '00 - Public Property Language As Byte - Get - Return data(&H2CB) - End Get - Set(ByVal value As Byte) - data(&H2CB) = value - Output() - End Set - End Property - '00 00 - Public Property LangChecksum As UShort - Get - Return BitConverter.ToUInt16(data, &H2CE) - End Get - Set(ByVal value As UShort) - BitConverter.GetBytes(value).CopyTo(data, &H2CE) - Output() - End Set - End Property - '00 for 0x1EF0 - Public Property StartYear As UShort - Get - Return BitConverter.ToUInt16(data, &H2D0) - End Get - Set(ByVal value As UShort) - BitConverter.GetBytes(value).CopyTo(data, &H2D0) - Output() - End Set - End Property - Public Property StartMonth As Byte - Get - Return data(&H2D2) - End Get - Set(ByVal value As Byte) - data(&H2D2) = value - Output() - End Set - End Property - Public Property StartDay As Byte - Get - Return data(&H2D3) - End Get - Set(ByVal value As Byte) - data(&H2D3) = value - Output() - 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) - Output() - End Set - End Property - Public Property EndMonth As Byte - Get - Return data(&H2D6) - End Get - Set(ByVal value As Byte) - data(&H2D6) = value - Output() - End Set - End Property - Public Property EndDay As Byte - Get - Return data(&H2D7) - End Get - Set(ByVal value As Byte) - data(&H2D7) = value - Output() - End Set - End Property - - Public Sub Output() - System.IO.File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Regnum\PKMG5DC" & "\cards\" & Main5.tc_Cards.SelectedTab.Text & ".bin", data) - End Sub -End Class +'Card Class Public Class Card5 Public Data(&H16CF) As Byte @@ -159,6 +11,83 @@ Public Class Card5 End Set End Property '00 00 00 + Public Property Wondercards(n As Byte) As Byte() '0xCC + Get + Return Data.Skip(&H4 + (n * &H2D0)).Take(&HCC) + End Get + Set(value As Byte()) + value.CopyTo(Data, &H4 + (n * &H2D0)) + End Set + End Property + '00 00 + Public Property GameCompatibilities(n As Byte) As Byte + Get + Return Data(&HCE + &H4 + (n * &H2D0)) + End Get + Set(ByVal value As Byte) + Data(&HCE + &H4 + (n * &H2D0)) = value + End Set + End Property + Public Property White(n As Byte) As Boolean + Get + Return (GameCompatibilities(n) And (1 << 4)) = (1 << 4) + End Get + Set(value As Boolean) + GameCompatibilities(n) = CByte((GameCompatibilities(n) And Not (1 << 4)) Or If(value, 1 << 4, 0)) + End Set + End Property + Public Property Black(n As Byte) As Boolean + Get + Return (GameCompatibilities(n) And (1 << 5)) = (1 << 5) + End Get + Set(value As Boolean) + GameCompatibilities(n) = CByte((GameCompatibilities(n) And Not (1 << 5)) Or If(value, 1 << 5, 0)) + End Set + End Property + Public Property White2(n As Byte) As Boolean + Get + Return (GameCompatibilities(n) And (1 << 6)) = (1 << 6) + End Get + Set(value As Boolean) + GameCompatibilities(n) = CByte((GameCompatibilities(n) And Not (1 << 6)) Or If(value, 1 << 6, 0)) + End Set + End Property + Public Property Black2(n As Byte) As Boolean + Get + Return (GameCompatibilities(n) And (1 << 7)) = (1 << 7) + End Get + Set(value As Boolean) + GameCompatibilities(n) = CByte((GameCompatibilities(n) And Not (1 << 7)) Or If(value, 1 << 7, 0)) + End Set + End Property + '00 + Public Property EventText(n As Byte) As String '0x1F8 + Get + Return GetString(Data, &HD0 + &H4 + (n * &H2D0), 504) + End Get + Set(ByVal value As String) + SetString(value, 252).CopyTo(Data, &HD0 + &H4 + (n * &H2D0)) + End Set + End Property + 'FF FF + '00 + Public Property Language(n As Byte) As Byte + Get + Return Data(&H2CB + &H4 + (n * &H2D0)) + End Get + Set(ByVal value As Byte) + Data(&H2CB + &H4 + (n * &H2D0)) = value + End Set + End Property + '00 00 + Public Property LangChecksum(n As Byte) As UShort + Get + Return BitConverter.ToUInt16(Data, &H2CE + &H4 + (n * &H2D0)) + End Get + Set(ByVal value As UShort) + BitConverter.GetBytes(value).CopyTo(Data, &H2CE + &H4 + (n * &H2D0)) + End Set + End Property Public Property Cards(n As Byte) As Byte() Get Return Data.Skip(&H4 + (n * &H2D0)).Take(&H2D0) @@ -167,70 +96,6 @@ Public Class Card5 value.CopyTo(Data, &H4 + (n * &H2D0)) End Set End Property - 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 Public Property StartYears(n As Byte) As UShort Get Return BitConverter.ToUInt16(Data, &H1684 + (n * &H8)) @@ -279,408 +144,15 @@ Public Class Card5 Data(&H168B + (n * &H8)) = value 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 ???? + Public Property Unknown14 As Byte + Get + Return Data(&H16C8) + End Get + Set(value As Byte) + Data(&H16C8) = value + End Set + End Property '00 00 00 00 00 00 00 End Class diff --git a/PKMG5DC/Common.vb b/PKMG5DC/Common.vb index 683bf6b..cb7a84f 100644 --- a/PKMG5DC/Common.vb +++ b/PKMG5DC/Common.vb @@ -80,9 +80,10 @@ Module Common Return txtTemp.ToString() End Function 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), "") + Return Encoding.Unicode.GetString(data, offset, count).Replace(ChrW(&HFFFF), "").Replace(ChrW(&H0), "").Replace(ChrW(&HFFFE), vbLf) End Function Public Function SetString(ByVal value As String, ByVal maxLength As Integer) + ' value = value.Replace(vbLf, ChrW(&HFFFE)) If value.Length > maxLength Then value = value.Substring(0, maxLength) Do While value.Length < maxLength value &= ChrW(&HFFFF) diff --git a/PKMG5DC/Main5.resx b/PKMG5DC/Main5.resx index 8e4687a..555e3ce 100644 --- a/PKMG5DC/Main5.resx +++ b/PKMG5DC/Main5.resx @@ -123,9 +123,6 @@ 17, 17 - - 132, 17 - diff --git a/PKMG5DC/Main5.vb b/PKMG5DC/Main5.vb index f4659aa..6368dab 100644 --- a/PKMG5DC/Main5.vb +++ b/PKMG5DC/Main5.vb @@ -10,15 +10,13 @@ Public Class Main5 Public Shared ReadOnly Local As String = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) & "\Regnum\PKMG5DC" 'Path to Local folder Dim OpenFile As New OpenFileDialog 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 + ReadOnly langs As Byte() = {&H2, &H3, &H4, &H5, &H7} 'List of Language values Dim mySettings As New IniFile 'Settings.ini File Dim pn_Settings As New Pnl_Settings 'Panel Settings Dim doneLoad As Boolean = False Dim WC As New PGF - Dim CardPiece As New Card5P - 'Dim cardPieces(7) As String - Dim Card As New Card5 - Dim tempDate(15) As Date + Public Shared Card As New Card5 + 'Dim tempDate(15) As Date #End Region Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -31,17 +29,12 @@ Public Class Main5 rd /S/Q data del arm9.bin arm7.bin banner.bin header.bin"}} CreateFiles(tools) - For i = 0 To 7 - File.WriteAllBytes(Local & "\cards\Card " & (i + 1) & ".bin", CardPiece.data) - Next - '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() - 'cardPieces = {CardPiece.data, CardPiece.data, CardPiece.data, CardPiece.data, CardPiece.data, CardPiece.data, CardPiece.data, CardPiece.data} + 'For i = 0 To 7 + ' File.WriteAllBytes(Local & "\cards\Card " & (i + 1) & ".bin", CardPiece.data) + 'Next Tp_Add_Enter(sender, e) doneLoad = True + Cb_Region_SelectedIndexChanged(sender, e) End Sub Private Sub Main_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing With mySettings @@ -296,45 +289,40 @@ Public Class Main5 tc_Cards.TabPages.Add(NewAddTab) AddHandler NewAddTab.Enter, AddressOf Me.Tp_Add_Enter End If + tc_Cards.SelectedTab = NewTab End Sub 'Moves the panel and load the settings Private Sub MovePanel() - CardPiece.data = File.ReadAllBytes(Local & "\cards\" & tc_Cards.SelectedTab.Text & ".bin") tc_Cards.SelectedTab.Controls.Add(Me.pnl_EditCard) With pn_Settings lb_PGF.Text = .pnl_Strings(tc_Cards.SelectedIndex) rtb_EventMsg.Text = .pnl_Strings(tc_Cards.SelectedIndex + 8) - cb_MaxLimit.Checked = .maxLimit(tc_Cards.SelectedIndex) + 'If Card.EventText(tc_Cards.SelectedIndex) <> Nothing Then rtb_EventMsg.Text = Card.EventText(tc_Cards.SelectedIndex) cb_Region.SelectedIndex = .region(tc_Cards.SelectedIndex) If .dates(tc_Cards.SelectedIndex) <> Nothing Then StartDatePicker.Value = .dates(tc_Cards.SelectedIndex) If .dates(tc_Cards.SelectedIndex + 8) <> Nothing Then EndDatePicker.Value = .dates(tc_Cards.SelectedIndex + 8) + cb_MaxLimit.Checked = .maxLimit(tc_Cards.SelectedIndex) End With If doneLoad Then - 'If cardPieces(tc_Cards.SelectedIndex) IsNot Nothing Then CardPiece.data = HexStringToByteArray(cardPieces(tc_Cards.SelectedIndex)) - cb_Black.Checked = CardPiece.Black - cb_White.Checked = CardPiece.White - cb_Black2.Checked = CardPiece.Black2 - cb_White2.Checked = CardPiece.White2 + cb_Black.Checked = Card.Black(tc_Cards.SelectedIndex) + cb_White.Checked = Card.White(tc_Cards.SelectedIndex) + cb_Black2.Checked = Card.Black2(tc_Cards.SelectedIndex) + cb_White2.Checked = Card.White2(tc_Cards.SelectedIndex) End If End Sub 'Saves Panel settings Private Sub SavePanel() - 'File.WriteAllBytes(Local & "\cards\" & tc_Cards.SelectedTab.Text & ".bin", CardPiece.data) With pn_Settings .pnl_Strings(tc_Cards.SelectedIndex) = lb_PGF.Text .pnl_Strings(tc_Cards.SelectedIndex + 8) = rtb_EventMsg.Text - .maxLimit(tc_Cards.SelectedIndex) = cb_MaxLimit.Checked + 'Card.EventText(tc_Cards.SelectedIndex) = rtb_EventMsg.Text .region(tc_Cards.SelectedIndex) = cb_Region.SelectedIndex If doneLoad Then .dates(tc_Cards.SelectedIndex) = StartDatePicker.Value If doneLoad Then .dates(tc_Cards.SelectedIndex + 8) = EndDatePicker.Value + .maxLimit(tc_Cards.SelectedIndex) = cb_MaxLimit.Checked End With - 'Dim t(&H2D8) As Byte - 'For i = 0 To &H2D8 - 't(i) = 0 - 'Next - 'CardPiece.data = t End Sub 'Panel Settings @@ -352,42 +340,51 @@ Public Class Main5 If res <> Windows.Forms.DialogResult.Cancel Then Dim myFile As String = Path.GetFileName(OpenFile.FileName) lb_PGF.Text = myFile - CardPiece.Wondercard = File.ReadAllBytes(OpenFile.FileName) - File.WriteAllBytes(Local & "\testCP.bin", CardPiece.data) + WC.Data = File.ReadAllBytes(OpenFile.FileName) + With WC + .RecieveDay = 0 + .RecieveMonth = 0 + .RecieveYear = 0 + End With + Card.Wondercards(tc_Cards.SelectedIndex) = WC.Data + WC = New PGF End If 'Enable/Disable controls End Sub + Private Sub Bt_Custom_Click(sender As Object, e As EventArgs) Handles bt_Custom.Click + PGFCreator.ShowDialog() + End Sub Private Sub Cb_Black_CheckedChanged(sender As Object, e As EventArgs) Handles cb_Black.CheckedChanged Select Case cb_Black.Checked Case True - CardPiece.Black = True + Card.Black(tc_Cards.SelectedIndex) = True Case False - CardPiece.Black = False + Card.Black(tc_Cards.SelectedIndex) = False End Select End Sub Private Sub Cb_White_CheckedChanged(sender As Object, e As EventArgs) Handles cb_White.CheckedChanged Select Case cb_White.Checked Case True - CardPiece.White = True + Card.White(tc_Cards.SelectedIndex) = True Case False - CardPiece.White = False + Card.White(tc_Cards.SelectedIndex) = False End Select End Sub Private Sub Cb_Black2_CheckedChanged(sender As Object, e As EventArgs) Handles cb_Black2.CheckedChanged Select Case cb_Black2.Checked Case True - CardPiece.Black2 = True + Card.Black2(tc_Cards.SelectedIndex) = True Case False - CardPiece.Black2 = False + Card.Black2(tc_Cards.SelectedIndex) = False End Select End Sub Private Sub Cb_White2_CheckedChanged(sender As Object, e As EventArgs) Handles cb_White2.CheckedChanged Select Case cb_White2.Checked Case True - CardPiece.White2 = True + Card.White2(tc_Cards.SelectedIndex) = True Case False - CardPiece.White2 = False + Card.White2(tc_Cards.SelectedIndex) = False End Select End Sub @@ -395,31 +392,31 @@ Public Class Main5 If doneLoad Then Select Case cb_Region.SelectedIndex Case < 5 - CardPiece.LangChecksum = langCksm(cb_Region.SelectedIndex) - CardPiece.Language = langs(cb_Region.SelectedIndex) + Card.LangChecksum(tc_Cards.SelectedIndex) = langCksm(cb_Region.SelectedIndex) + Card.Language(tc_Cards.SelectedIndex) = langs(cb_Region.SelectedIndex) Case 5 - CardPiece.LangChecksum = langCksm(cb_Region.SelectedIndex) - CardPiece.Language = langs(0) + Card.LangChecksum(tc_Cards.SelectedIndex) = langCksm(cb_Region.SelectedIndex) + Card.Language(tc_Cards.SelectedIndex) = langs(0) Case Else - CardPiece.LangChecksum = langCksm(cb_Region.SelectedIndex - 1) - CardPiece.Language = langs(0) + Card.LangChecksum(tc_Cards.SelectedIndex) = langCksm(cb_Region.SelectedIndex - 1) + Card.Language(tc_Cards.SelectedIndex) = langs(0) End Select End If End Sub - Private Sub StartDatePicker_ValueChanged(sender As Object, e As EventArgs) Handles StartDatePicker.ValueChanged + Private Sub StartDatePicker_ValueChanged(sender As Object, e As EventArgs) Handles StartDatePicker.ValueChanged, cb_MaxLimit.CheckedChanged If doneLoad Then - CardPiece.StartDay = StartDatePicker.Value.Day - CardPiece.StartMonth = StartDatePicker.Value.Month - CardPiece.StartYear = StartDatePicker.Value.Year + Card.StartDays(tc_Cards.SelectedIndex) = StartDatePicker.Value.Day + Card.StartMonths(tc_Cards.SelectedIndex) = StartDatePicker.Value.Month + Card.StartYears(tc_Cards.SelectedIndex) = StartDatePicker.Value.Year End If End Sub - Private Sub EndDatePicker_ValueChanged(sender As Object, e As EventArgs) Handles EndDatePicker.ValueChanged + Private Sub EndDatePicker_ValueChanged(sender As Object, e As EventArgs) Handles EndDatePicker.ValueChanged, cb_MaxLimit.CheckedChanged If doneLoad Then - CardPiece.EndDay = EndDatePicker.Value.Day - CardPiece.EndMonth = EndDatePicker.Value.Month - CardPiece.EndYear = EndDatePicker.Value.Year + Card.EndDays(tc_Cards.SelectedIndex) = EndDatePicker.Value.Day + Card.EndMonths(tc_Cards.SelectedIndex) = EndDatePicker.Value.Month + Card.EndYears(tc_Cards.SelectedIndex) = EndDatePicker.Value.Year End If End Sub @@ -428,8 +425,8 @@ Public Class Main5 Case True lb_Start.Enabled = False lb_End.Enabled = False - tempDate(tc_Cards.SelectedIndex) = StartDatePicker.Value - tempDate(tc_Cards.SelectedIndex + 8) = EndDatePicker.Value + pn_Settings.dates(tc_Cards.SelectedIndex) = StartDatePicker.Value + pn_Settings.dates(tc_Cards.SelectedIndex + 8) = EndDatePicker.Value StartDatePicker.Value = New DateTime(1753, 1, 1) EndDatePicker.Value = New DateTime(9998, 12, 31) StartDatePicker.Enabled = False @@ -437,62 +434,25 @@ Public Class Main5 Case False lb_Start.Enabled = True lb_End.Enabled = True - StartDatePicker.Value = tempDate(tc_Cards.SelectedIndex) - EndDatePicker.Value = tempDate(tc_Cards.SelectedIndex + 8) + If pn_Settings.dates(tc_Cards.SelectedIndex) <> Nothing Then StartDatePicker.Value = pn_Settings.dates(tc_Cards.SelectedIndex) + If pn_Settings.dates(tc_Cards.SelectedIndex + 8) <> Nothing Then EndDatePicker.Value = pn_Settings.dates(tc_Cards.SelectedIndex + 8) StartDatePicker.Enabled = True EndDatePicker.Enabled = True End Select End Sub Private Sub Rtb_EventMsg_TextChanged(sender As Object, e As EventArgs) Handles rtb_EventMsg.TextChanged - CardPiece.EventText = rtb_EventMsg.Text.Replace(ChrW(&HA00), ChrW(&HFEFF)) - 'File.WriteAllBytes(Local & "\cards\" & tc_Cards.SelectedTab.Text & ".bin", CardPiece.data) - SavePanel() + Card.EventText(tc_Cards.SelectedIndex) = rtb_EventMsg.Text.Replace(vbLf, ChrW(&HFFFE)) End Sub Private Sub Bt_Build_Click(sender As Object, e As EventArgs) Handles bt_Build.Click - SavePanel() - 'File.WriteAllBytes(Local & "\testCP.bin", HexStringToByteArray(cardPieces(0))) - With Card - 'Dim listOfCards As New List(Of Byte())({ .Card_1, .Card_2, .Card_3, .Card_4, .Card_5, .Card_6, .Card_7, .Card_8}) - 'Dim listOfDates As New List(Of UShort)({ .StartDay_1, .StartDay_2, .StartDay_3, .StartDay_4, .StartDay_5, .StartDay_6, .StartDay_7, .StartDay_8}) - 'Dim n = 0 - 'For Each i As Byte() In listOfCards - ' i = cardPieces(n).Take(&H2D0) - ' n += 1 - 'Next i - 'For n = 0 To .NumberOfCards - 1 Step 1 - ' If cardPieces(n) IsNot Nothing Then - ' CardPiece.data = HexStringToByteArray(cardPieces(n)) - ' .Cards(n) = CardPiece.data.Take(&H2D0).ToArray() - ' .StartYears(n) = CardPiece.StartYear - ' .StartMonths(n) = CardPiece.StartMonth - ' .StartDays(n) = CardPiece.StartDay - ' .EndYears(n) = CardPiece.EndYear - ' .EndMonths(n) = CardPiece.EndMonth - ' .EndDays(n) = CardPiece.EndDay - ' .NumberOfCards += 1 - ' CardPiece = New Card5P - ' End If - 'Next n - 'File.WriteAllBytes(Local & "\outputCard.bin", .Data) + Card.Unknown14 = &H14 + File.WriteAllBytes(Local & "\outputCard.bin", Card.Data) - Dim listOfCards As New List(Of String)({"Card 1.bin", "Card 2.bin", "Card 3.bin", "Card 4.bin", "Card 5.bin", "Card 6.bin", "Card 7.bin", "Card 8.bin"}) - For Each i As String In listOfCards - If File.Exists(Local & "\cards\" & i) Then - CardPiece.data = File.ReadAllBytes(Local & "\cards\" & i) - Dim n = listOfCards.IndexOf(i) - .Cards(n) = CardPiece.data.Take(&H2D0).ToArray() - .StartYears(n) = CardPiece.StartYear - .StartMonths(n) = CardPiece.StartMonth - .StartDays(n) = CardPiece.StartDay - .EndYears(n) = CardPiece.EndYear - .EndMonths(n) = CardPiece.EndMonth - .EndDays(n) = CardPiece.EndDay - CardPiece = New Card5P - End If - Next i - File.WriteAllBytes(Local & "\outputCard.bin", .Data) - End With + Process.Start(Local & "\tools\extract.bat").WaitForExit() + File.Delete(Local & "\tools\data\data.bin") + File.Copy(Local & "\outputCard.bin", Local & "\tools\data\data.bin") + Process.Start(Local & "\tools\compile.bat").WaitForExit() + Process.Start(Local & "\tools\clean.bat").WaitForExit() End Sub End Class \ No newline at end of file diff --git a/PKMG5DC/PGFCreator.vb b/PKMG5DC/PGFCreator.vb index cbd3425..b448872 100644 --- a/PKMG5DC/PGFCreator.vb +++ b/PKMG5DC/PGFCreator.vb @@ -394,7 +394,10 @@ Game: " & Origin(InputPK5.Origin)) 'Output Button Private Sub Btn_Done_Click(sender As Object, e As EventArgs) Handles btn_Done.Click - My.Computer.FileSystem.WriteAllBytes(Main5.Local & "\output.pgf", WC.Data, False) + 'My.Computer.FileSystem.WriteAllBytes(Main5.Local & "\output.pgf", WC.Data, False) + Main5.Card.Wondercards(Main5.tc_Cards.SelectedIndex) = WC.Data + Main5.lb_PGF.Text = nud_CardID.Value & " - " & tb_CardTitle.Text & " (Custom)" + Close() End Sub #End Region End Class \ No newline at end of file diff --git a/PKMG5DC/bin/Debug/PKMG5DC.pdb b/PKMG5DC/bin/Debug/PKMG5DC.pdb index 79b2a21..78f79e7 100644 Binary files a/PKMG5DC/bin/Debug/PKMG5DC.pdb and b/PKMG5DC/bin/Debug/PKMG5DC.pdb differ