how would i go about finding a total time played value in a save file? i want to change it so that I can unlock some things in the game, but i have to have played it for many hours. If, for example, the total time played is 16 hours 30 minutes and 25 seconds, would i search for these values individually and find the place where they all line up or would they be stored as a different value?
sorry, i'm new to this and i thought that i had a pretty good understanding of hex, but this has me confused.
This might be of use, though its in VB it should convert easily.
Public Sub timelord()
Dim ts As New TimeSpan(0, 0, timeread.Text)
timebox.Text = (ts.ToString)
It was for reading total game time and displaying it in the form of HH:MM:SS, i deduced it was stored in seconds via an educated guess, timespan should work for you nicely assuming the values aren't just a string like seph is showing.
i clearly wrote the editor this came from while drunk, its a mess, but this is how i then converted the format back into seconds:
Public Sub timeshift()
Dim time2sec As TimeSpan = TimeSpan.Parse(timebox.Text)
timeread.Text = time2sec.TotalSeconds
Catch ex As Exception
MsgBox("Time must be in the format HH:MM:SS")
Thank you everyone for the help. I finally figured it out. the problem was that i wasnt sure what the time value was because the game gave me total play time instead of campain play time and online play time seperately. 8Ball's post was on point when he said that the value he was looking for was stored in seconds. my value was too, so i compared 2 different saves and found the difference, stored in seconds.
Join Date : Jan 2011
Location : somewhere In Ireland
Posts : 2,733
Re: Editing a time value
Originally Posted by kartleyBecil
i read about the TimeSpan c# data type, but i'm not sure I get it.
Look at 8Balls example.
TimeSpan interval = new TimeSpan(2, 14, 18);
Console.WriteLine(interval.ToString());// Displays "02:14:18".
TimeSpan also have various properties you can call e.g: TimeSpan.Seconds, TimeSpan.Minutes
/// <summary>Converts an Int64 FileTime to a DateTime</summary>
/// <param name="input">The long value to convert</param>
public static DateTime ToDateTime(long input)
//Contains a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).
//This is usually stored in 8 byte in files - hex
return DateTime.FromFileTime(input);//Converts long(FileTime) to local time
/// <summary>Converts a DateTime to an Int64 FileTime</summary>
/// <param name="input">The date time input</param>
public static long ToInt64(DateTime input)
I hope that helps you. If you still don't understand then copy the code, run it and try step through the codes till you understand.
Downloads : 69 || Uploads : 22 || Rep Power : 5454 || Posts : 2,733 || Thanks : 557 ||
Thanked 2,961 Times in 735 Posts
## If you don't Contribute || Help - Why should I Contribute || Help - Leechers Should not be helped ##