Hi, I Am Trying To Make a "Need For Speed Undercover" Mod Tool But After I Make And Mod It The Game Reads The File Is Damaged. If I Can get a correct code you will be in credits and have a Full Version Code! Btw that only means if it works. Thanks, KillerVidz. Sorce: Code: Imports PackageIO Public Class Form1 Dim Filepath As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Open As New OpenFileDialog Open.Filter = "Gamesave (*.*)|*.*" Open.Title = "Open Gamesave" If Open.ShowDialog = Windows.Forms.DialogResult.OK Then Filepath = Open.FileName ReadFile(Filepath) Else Return End If End Sub Public Sub ReadFile(ByVal FilePath As String) Dim Reader As New PackageIO.Reader(FilePath, PackageIO.Endian.Big) Reader.Position = 71185 'Decimal Not Hex TextBox1.Text = Reader.ReadInt32 End Sub Public Sub WriteFile(ByVal FilePath As String) Dim Writer As New PackageIO.Writer(FilePath, PackageIO.Endian.Big) Writer.Position = 71185 'Decimal Not Hex Writer.WriteInt32((TextBox1.Text)) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try WriteFile(Filepath) MsgBox(("File Saved!")) ReadFile(Filepath) Catch ex As Exception MsgBox("Error", MsgBoxStyle.Critical, "") End Try End Sub ---------------------------------------------------------------------------------------------------------------------------------------------- Ignore This Bit Code: Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged RichTextBox1.Text = "Non Working Mod Tool Made By KillerVidz At XpGamesaves" End Sub End Class
Why are you making the editor read in decimal and not hex? Just curious. (I haven't messed with Undercover, so Just trying to get to the bottom of it) Try something like this: Code: Public Sub ReadFile() Dim Reader As New PackageIO.Reader(FilePath, PackageIO.Endian.Big) Reader.Position = &H71185 NumericUpDown1.Value = Reader.ReadInt32 Reader.Close() End Sub Public Sub WriteFile() Dim Writer As New PackageIO.Writer(filepath, PackageIO.Endian.Big) Writer.Position = &H71185 Writer.WriteInt32(NumericUpDown1.Value) Writer.Close() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try WriteFile() MsgBox(("File Saved!")) ReadFile() Catch ex As Exception MsgBox("Error", MsgBoxStyle.Critical, "") End Try End Sub Making the reader/writer in Hex as well as pointing it to a NumericUpDown should not cause any problems with reading/writing. Textboxes can pose some issues when it comes to certain things like integers and strings. If it still comes up corrupted then there is an additional hash (checksum) that needs to be fixed after making changes to the save and before rehashing/resigning.
Thanks Dude Gunna Try It Out Tomorrow. Ermm... I Couldent Get The Full Version To Work So I Could Only Put You In Credit's My Bad .... ILL Send You The Download Link Tomorrow If You Wanna Download It.
lol I'm not worried about the credits. Just helping out. I saw your PM you sent, Delete those 2 instances Filepath located within Writefile() and Readfile() (Make it look like that and see if that works).
No problem, that should let you read, write and save properly now. If it does not continue to work as far as the changes to the save were saved but the save is corrupted upon loading it in the game, then there is an additional hash (Checksum) that is require to fix before rehashing/resigning.