diff --git a/.vs/GBAPokemonGameEditor/v14/.suo b/.vs/GBAPokemonGameEditor/v14/.suo index dc4d65c..d19db70 100644 Binary files a/.vs/GBAPokemonGameEditor/v14/.suo and b/.vs/GBAPokemonGameEditor/v14/.suo differ diff --git a/GBAPokemonGameEditor/AbilityEdit.vb b/GBAPokemonGameEditor/AbilityEdit.vb index 48aca3c..7fbe622 100644 --- a/GBAPokemonGameEditor/AbilityEdit.vb +++ b/GBAPokemonGameEditor/AbilityEdit.vb @@ -60,8 +60,9 @@ DexDescp = Mid$(DexDescp, 1, InStr(1, DexDescp, "\x")) DexDescp = Replace(DexDescp, "\n", vbCrLf) DexDescp = Replace(RTrim$(DexDescp), "\", "") + CurrentAbilityDescripLength = Len(DexDescp) TextBox3.Text = DexDescp - TextBox3.MaxLength = Len(DexDescp) + FileClose(FileNum) End Sub diff --git a/GBAPokemonGameEditor/AttackEditor.vb b/GBAPokemonGameEditor/AttackEditor.vb index ea49508..003f470 100644 --- a/GBAPokemonGameEditor/AttackEditor.vb +++ b/GBAPokemonGameEditor/AttackEditor.vb @@ -305,7 +305,6 @@ AttackDescp = Replace(RTrim$(AttackDescp), "\", "") CurrentAttackDescripLength = Len(AttackDescp) TextBox7.Text = AttackDescp - TextBox7.MaxLength = Len(AttackDescp) FileClose(FileNum) diff --git a/GBAPokemonGameEditor/INI.vb b/GBAPokemonGameEditor/INI.vb index 295c64f..886909d 100644 --- a/GBAPokemonGameEditor/INI.vb +++ b/GBAPokemonGameEditor/INI.vb @@ -22,11 +22,14 @@ ByVal lpKeyName As Integer, ByVal lpString As Integer, _ ByVal lpFileName As String) As Integer - Public Function GetString(ByVal strFilename As String, ByVal Section As String, _ + Public Function GetString(ByVal strFilename As String, ByVal Section As String, ByVal Key As String, ByVal [Default] As String) As String + + GetString = "" + Dim intCharCount As Integer Dim objResult As New System.Text.StringBuilder(256) - intCharCount = GetPrivateProfileString(Section, Key, _ + intCharCount = GetPrivateProfileString(Section, Key, [Default], objResult, objResult.Capacity, strFilename) If intCharCount > 0 Then GetString = Left(objResult.ToString, intCharCount) diff --git a/GBAPokemonGameEditor/ItemEditor.Designer.vb b/GBAPokemonGameEditor/ItemEditor.Designer.vb index 1e6c74d..6da5735 100644 --- a/GBAPokemonGameEditor/ItemEditor.Designer.vb +++ b/GBAPokemonGameEditor/ItemEditor.Designer.vb @@ -61,6 +61,8 @@ Partial Class ItemEditor Me.BattleUsagePTTextBox = New System.Windows.Forms.TextBox() Me.Label14 = New System.Windows.Forms.Label() Me.BUTextBox = New System.Windows.Forms.TextBox() + Me.Label21 = New System.Windows.Forms.Label() + Me.Button6 = New System.Windows.Forms.Button() Me.GroupBox1.SuspendLayout() Me.GroupBox2.SuspendLayout() CType(Me.ItemImagePictureBox, System.ComponentModel.ISupportInitialize).BeginInit() @@ -108,7 +110,7 @@ Partial Class ItemEditor 'Label1 ' Me.Label1.AutoSize = True - Me.Label1.Location = New System.Drawing.Point(183, 185) + Me.Label1.Location = New System.Drawing.Point(165, 209) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(36, 13) Me.Label1.TabIndex = 2 @@ -117,7 +119,7 @@ Partial Class ItemEditor 'Label2 ' Me.Label2.AutoSize = True - Me.Label2.Location = New System.Drawing.Point(183, 210) + Me.Label2.Location = New System.Drawing.Point(165, 234) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(34, 13) Me.Label2.TabIndex = 3 @@ -125,14 +127,14 @@ Partial Class ItemEditor ' 'IndexTextBox ' - Me.IndexTextBox.Location = New System.Drawing.Point(248, 182) + Me.IndexTextBox.Location = New System.Drawing.Point(230, 206) Me.IndexTextBox.Name = "IndexTextBox" Me.IndexTextBox.Size = New System.Drawing.Size(40, 20) Me.IndexTextBox.TabIndex = 4 ' 'PriceTextBox ' - Me.PriceTextBox.Location = New System.Drawing.Point(248, 207) + Me.PriceTextBox.Location = New System.Drawing.Point(230, 231) Me.PriceTextBox.Name = "PriceTextBox" Me.PriceTextBox.Size = New System.Drawing.Size(40, 20) Me.PriceTextBox.TabIndex = 5 @@ -224,8 +226,7 @@ Partial Class ItemEditor Me.DsrptnTextBox.Location = New System.Drawing.Point(15, 72) Me.DsrptnTextBox.Multiline = True Me.DsrptnTextBox.Name = "DsrptnTextBox" - Me.DsrptnTextBox.ReadOnly = True - Me.DsrptnTextBox.Size = New System.Drawing.Size(147, 74) + Me.DsrptnTextBox.Size = New System.Drawing.Size(156, 74) Me.DsrptnTextBox.TabIndex = 29 ' 'DescribPointTextBox @@ -237,13 +238,15 @@ Partial Class ItemEditor ' 'GroupBox3 ' + Me.GroupBox3.Controls.Add(Me.Label21) + Me.GroupBox3.Controls.Add(Me.Button6) Me.GroupBox3.Controls.Add(Me.DescribPointTextBox) Me.GroupBox3.Controls.Add(Me.DscrpRpntBttn) Me.GroupBox3.Controls.Add(Me.DsrptnTextBox) Me.GroupBox3.Controls.Add(Me.Label10) Me.GroupBox3.Location = New System.Drawing.Point(168, 12) Me.GroupBox3.Name = "GroupBox3" - Me.GroupBox3.Size = New System.Drawing.Size(188, 153) + Me.GroupBox3.Size = New System.Drawing.Size(188, 188) Me.GroupBox3.TabIndex = 32 Me.GroupBox3.TabStop = False Me.GroupBox3.Text = "Description Pointer:" @@ -251,7 +254,7 @@ Partial Class ItemEditor 'Label5 ' Me.Label5.AutoSize = True - Me.Label5.Location = New System.Drawing.Point(180, 236) + Me.Label5.Location = New System.Drawing.Point(162, 260) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(63, 13) Me.Label5.TabIndex = 33 @@ -259,7 +262,7 @@ Partial Class ItemEditor ' 'HoldEffectTextBox ' - Me.HoldEffectTextBox.Location = New System.Drawing.Point(248, 233) + Me.HoldEffectTextBox.Location = New System.Drawing.Point(230, 257) Me.HoldEffectTextBox.Name = "HoldEffectTextBox" Me.HoldEffectTextBox.Size = New System.Drawing.Size(40, 20) Me.HoldEffectTextBox.TabIndex = 34 @@ -267,7 +270,7 @@ Partial Class ItemEditor 'Label6 ' Me.Label6.AutoSize = True - Me.Label6.Location = New System.Drawing.Point(180, 262) + Me.Label6.Location = New System.Drawing.Point(162, 286) Me.Label6.Name = "Label6" Me.Label6.Size = New System.Drawing.Size(37, 13) Me.Label6.TabIndex = 35 @@ -275,7 +278,7 @@ Partial Class ItemEditor ' 'ValueTextBox ' - Me.ValueTextBox.Location = New System.Drawing.Point(248, 259) + Me.ValueTextBox.Location = New System.Drawing.Point(230, 283) Me.ValueTextBox.Name = "ValueTextBox" Me.ValueTextBox.Size = New System.Drawing.Size(40, 20) Me.ValueTextBox.TabIndex = 36 @@ -283,7 +286,7 @@ Partial Class ItemEditor 'Label7 ' Me.Label7.AutoSize = True - Me.Label7.Location = New System.Drawing.Point(300, 185) + Me.Label7.Location = New System.Drawing.Point(282, 209) Me.Label7.Name = "Label7" Me.Label7.Size = New System.Drawing.Size(78, 13) Me.Label7.TabIndex = 37 @@ -291,14 +294,14 @@ Partial Class ItemEditor ' 'MysteryValue2TextBox ' - Me.MysteryValue2TextBox.Location = New System.Drawing.Point(396, 207) + Me.MysteryValue2TextBox.Location = New System.Drawing.Point(378, 231) Me.MysteryValue2TextBox.Name = "MysteryValue2TextBox" Me.MysteryValue2TextBox.Size = New System.Drawing.Size(40, 20) Me.MysteryValue2TextBox.TabIndex = 39 ' 'MysteryValue1TextBox ' - Me.MysteryValue1TextBox.Location = New System.Drawing.Point(396, 182) + Me.MysteryValue1TextBox.Location = New System.Drawing.Point(378, 206) Me.MysteryValue1TextBox.Name = "MysteryValue1TextBox" Me.MysteryValue1TextBox.Size = New System.Drawing.Size(40, 20) Me.MysteryValue1TextBox.TabIndex = 38 @@ -306,7 +309,7 @@ Partial Class ItemEditor 'Label8 ' Me.Label8.AutoSize = True - Me.Label8.Location = New System.Drawing.Point(300, 236) + Me.Label8.Location = New System.Drawing.Point(282, 260) Me.Label8.Name = "Label8" Me.Label8.Size = New System.Drawing.Size(44, 13) Me.Label8.TabIndex = 40 @@ -317,14 +320,14 @@ Partial Class ItemEditor Me.PocketComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList Me.PocketComboBox.FormattingEnabled = True Me.PocketComboBox.Items.AddRange(New Object() {"???", "Items", "Poke Balls", "TM/HM's", "Berries", "Key Items"}) - Me.PocketComboBox.Location = New System.Drawing.Point(396, 233) + Me.PocketComboBox.Location = New System.Drawing.Point(378, 257) Me.PocketComboBox.Name = "PocketComboBox" Me.PocketComboBox.Size = New System.Drawing.Size(82, 21) Me.PocketComboBox.TabIndex = 41 ' 'TypeTextBox ' - Me.TypeTextBox.Location = New System.Drawing.Point(396, 259) + Me.TypeTextBox.Location = New System.Drawing.Point(378, 283) Me.TypeTextBox.Name = "TypeTextBox" Me.TypeTextBox.Size = New System.Drawing.Size(40, 20) Me.TypeTextBox.TabIndex = 43 @@ -332,7 +335,7 @@ Partial Class ItemEditor 'Label9 ' Me.Label9.AutoSize = True - Me.Label9.Location = New System.Drawing.Point(300, 259) + Me.Label9.Location = New System.Drawing.Point(282, 283) Me.Label9.Name = "Label9" Me.Label9.Size = New System.Drawing.Size(34, 13) Me.Label9.TabIndex = 42 @@ -341,7 +344,7 @@ Partial Class ItemEditor 'Label11 ' Me.Label11.AutoSize = True - Me.Label11.Location = New System.Drawing.Point(300, 210) + Me.Label11.Location = New System.Drawing.Point(282, 234) Me.Label11.Name = "Label11" Me.Label11.Size = New System.Drawing.Size(69, 13) Me.Label11.TabIndex = 44 @@ -395,11 +398,30 @@ Partial Class ItemEditor Me.BUTextBox.Size = New System.Drawing.Size(25, 20) Me.BUTextBox.TabIndex = 50 ' + 'Label21 + ' + Me.Label21.AutoSize = True + Me.Label21.ForeColor = System.Drawing.SystemColors.ControlText + Me.Label21.Location = New System.Drawing.Point(14, 149) + Me.Label21.Name = "Label21" + Me.Label21.Size = New System.Drawing.Size(43, 13) + Me.Label21.TabIndex = 33 + Me.Label21.Text = "Length:" + ' + 'Button6 + ' + Me.Button6.Location = New System.Drawing.Point(104, 162) + Me.Button6.Name = "Button6" + Me.Button6.Size = New System.Drawing.Size(67, 20) + Me.Button6.TabIndex = 32 + Me.Button6.Text = "Save" + Me.Button6.UseVisualStyleBackColor = True + ' 'ItemEditor ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(496, 318) + Me.ClientSize = New System.Drawing.Size(496, 316) Me.Controls.Add(Me.BUTextBox) Me.Controls.Add(Me.Label14) Me.Controls.Add(Me.Label13) @@ -482,4 +504,6 @@ Partial Class ItemEditor Friend WithEvents BattleUsagePTTextBox As TextBox Friend WithEvents Label14 As Label Friend WithEvents BUTextBox As TextBox + Friend WithEvents Label21 As Label + Friend WithEvents Button6 As Button End Class diff --git a/GBAPokemonGameEditor/ItemEditor.vb b/GBAPokemonGameEditor/ItemEditor.vb index 03a0370..0eeedf9 100644 --- a/GBAPokemonGameEditor/ItemEditor.vb +++ b/GBAPokemonGameEditor/ItemEditor.vb @@ -9,6 +9,7 @@ Public Class ItemEditor Dim ItemBaseOff As Integer Dim ItemPicDataOff As Integer + Dim CurrentItemDescripLength As Integer Private Sub ItemEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -76,8 +77,9 @@ Public Class ItemEditor ItemDescp = Mid$(ItemDescp, 1, InStr(1, ItemDescp, "\x")) ItemDescp = Replace(ItemDescp, "\n", vbCrLf) ItemDescp = Replace(RTrim$(ItemDescp), "\", "") + + CurrentItemDescripLength = Len(ItemDescp) DsrptnTextBox.Text = ItemDescp - DsrptnTextBox.MaxLength = Len(ItemDescp) FileClose(FileNum) @@ -165,9 +167,90 @@ Public Class ItemEditor ItemDescp = Mid$(ItemDescp, 1, InStr(1, ItemDescp, "\x")) ItemDescp = Replace(ItemDescp, "\n", vbCrLf) ItemDescp = Replace(RTrim$(ItemDescp), "\", "") + CurrentItemDescripLength = Len(DsrptnTextBox.Text) DsrptnTextBox.Text = ItemDescp - DsrptnTextBox.MaxLength = Len(ItemDescp) + FileClose(FileNum) End Sub + + Private Sub DsrptnTextBox_TextChanged(sender As Object, e As EventArgs) Handles DsrptnTextBox.TextChanged + Label21.Text = "Length: " & Len(DsrptnTextBox.Text) & "/" & CurrentItemDescripLength + Label21.ForeColor = Color.Black + + If Len(DsrptnTextBox.Text) > CurrentItemDescripLength Then + Label21.Text = Label21.Text & " Requires repoint!" + + Label21.ForeColor = Color.Red + + End If + End Sub + + Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click + Dim curdespoff As String + + Dim destowrite As String + + curdespoff = Hex(Int32.Parse((ReverseHEX(ReadHEX(LoadedROM, ((ItemBaseOff) + 20) + (ItemListComboBox.SelectedIndex * 44), 4))), System.Globalization.NumberStyles.HexNumber) - &H8000000) + + destowrite = Asc2Sapp(Replace(DsrptnTextBox.Text, vbCrLf, "\n") & "\x") + + + + If Len(DsrptnTextBox.Text) > CurrentItemDescripLength Then + + + Dim result As DialogResult = MessageBox.Show("The text will be written to free space and the pointer will be repointed. Would you like to do that?", + "Repoint?", + MessageBoxButtons.YesNo) + + If (result = DialogResult.Yes) Then + + Dim newtextoff As String + + newtextoff = SearchFreeSpaceFourAligned(LoadedROM, &HFF, (Len(destowrite & " ")), "&H" & GetString(GetINIFileLocation(), header, "StartSearchingForSpaceOffset", "800000")) + + FileNum = FreeFile() + + FileOpen(FileNum, LoadedROM, OpenMode.Binary) + + FilePut(FileNum, destowrite & " ", ("&H" & Hex(newtextoff)) + 1, False) + + FileClose(FileNum) + + DescribPointTextBox.Text = Hex(newtextoff) + + DscrpRpntBttn.PerformClick() + + + + Label21.Text = "Length: " & Len(DsrptnTextBox.Text) & "/" & CurrentItemDescripLength + Label21.ForeColor = Color.Black + + If Len(DsrptnTextBox.Text) > CurrentItemDescripLength Then + Label21.Text = Label21.Text & " Requires repoint!" + + Label21.ForeColor = Color.Red + + End If + + Else + + End If + + Else + + + FileNum = FreeFile() + + FileOpen(FileNum, LoadedROM, OpenMode.Binary) + + FilePut(FileNum, destowrite, ("&H" & curdespoff) + 1, False) + + FileClose(FileNum) + + DescribPointTextBox.Text = curdespoff + + End If + End Sub End Class \ No newline at end of file diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.application b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.application index 30a8ab0..84b9c83 100644 --- a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.application +++ b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.application @@ -16,7 +16,7 @@ - QXbsJUSt7zEqcwyu4f9qTclSKLk= + dmxmZqC3lB1fAtfZ/mtThipMKaQ= diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe index 3a8840f..67f46ba 100644 Binary files a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe and b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe differ diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe.manifest b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe.manifest index eba6d7b..d8b1ea2 100644 --- a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe.manifest +++ b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.exe.manifest @@ -43,14 +43,14 @@ - + - 4g4MnS03k1DDsta0wOovUeCbvEU= + Hfbh8iSw+yPSWA4weY4mwYINHjM= diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.pdb b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.pdb index 8639d52..8a66869 100644 Binary files a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.pdb and b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.pdb differ diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.application b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.application index 30a8ab0..84b9c83 100644 --- a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.application +++ b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.application @@ -16,7 +16,7 @@ - QXbsJUSt7zEqcwyu4f9qTclSKLk= + dmxmZqC3lB1fAtfZ/mtThipMKaQ= diff --git a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.exe.manifest b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.exe.manifest index eba6d7b..d8b1ea2 100644 --- a/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.exe.manifest +++ b/GBAPokemonGameEditor/bin/Debug/PokemonGameEditor.vshost.exe.manifest @@ -43,14 +43,14 @@ - + - 4g4MnS03k1DDsta0wOovUeCbvEU= + Hfbh8iSw+yPSWA4weY4mwYINHjM= diff --git a/GBAPokemonGameEditor/bin/Debug/app.publish/PokemonGameEditor.exe b/GBAPokemonGameEditor/bin/Debug/app.publish/PokemonGameEditor.exe index 3a8840f..67f46ba 100644 Binary files a/GBAPokemonGameEditor/bin/Debug/app.publish/PokemonGameEditor.exe and b/GBAPokemonGameEditor/bin/Debug/app.publish/PokemonGameEditor.exe differ diff --git a/GBAPokemonGameEditor/modTextSapp.vb b/GBAPokemonGameEditor/modTextSapp.vb index 3f62c16..bf6a19d 100644 --- a/GBAPokemonGameEditor/modTextSapp.vb +++ b/GBAPokemonGameEditor/modTextSapp.vb @@ -4,6 +4,7 @@ Option Explicit Off Module modTextSapp Public Function Asc2Sapp(ByVal asciistring As String) As String o = "" + Y = "" Dim m As Boolean For i = 1 To Len(asciistring) @@ -784,6 +785,7 @@ Module modTextSapp Public Function NameAsc2Sapp(ByVal asciistring As String) As String o = "" + Y = "" Dim m As Boolean For i = 1 To Len(asciistring) diff --git a/GBAPokemonGameEditor/obj/x86/Debug/GBAPokemonGameEditor.vbproj.GenerateResource.Cache b/GBAPokemonGameEditor/obj/x86/Debug/GBAPokemonGameEditor.vbproj.GenerateResource.Cache index 0a7d072..d161d07 100644 Binary files a/GBAPokemonGameEditor/obj/x86/Debug/GBAPokemonGameEditor.vbproj.GenerateResource.Cache and b/GBAPokemonGameEditor/obj/x86/Debug/GBAPokemonGameEditor.vbproj.GenerateResource.Cache differ diff --git a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.application b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.application index 30a8ab0..84b9c83 100644 --- a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.application +++ b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.application @@ -16,7 +16,7 @@ - QXbsJUSt7zEqcwyu4f9qTclSKLk= + dmxmZqC3lB1fAtfZ/mtThipMKaQ= diff --git a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe index 3a8840f..67f46ba 100644 Binary files a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe and b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe differ diff --git a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe.manifest b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe.manifest index eba6d7b..d8b1ea2 100644 --- a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe.manifest +++ b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.exe.manifest @@ -43,14 +43,14 @@ - + - 4g4MnS03k1DDsta0wOovUeCbvEU= + Hfbh8iSw+yPSWA4weY4mwYINHjM= diff --git a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.pdb b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.pdb index 8639d52..8a66869 100644 Binary files a/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.pdb and b/GBAPokemonGameEditor/obj/x86/Debug/PokemonGameEditor.pdb differ