Skip to content

Commit 470527a

Browse files
committed
Write timestamps from recctrl.bin to extracted files 'Last Modified'
date
1 parent e0da8e0 commit 470527a

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

XbRecUnpack/Program.cs

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
/* XbRecUnpack - tool for extracting Xbox recctrl.bin files
22
* by emoose
3-
*
4-
* Changelog:
5-
* v1.234:
6-
* - Changed out LZX decoder to a native C# version, no longer need to P/Invoke any windows DLLs :)
7-
*
8-
* v0.123:
9-
* - Initial version, finally got Xbox/Xbox360 recctrl unpacking to work fine!
103
*/
114

125
using System;
@@ -25,7 +18,7 @@ static void Main(string[] args)
2518
bool extractFiles = true;
2619

2720
Console.WriteLine("XbRecUnpack - tool for extracting Xbox recctrl.bin files");
28-
Console.WriteLine("v1.234 by emoose");
21+
Console.WriteLine("v1.2345 by emoose");
2922

3023
string filePath = @"";
3124
int pathIdx = 0;
@@ -143,7 +136,11 @@ static void ProcessRecovery(string controlPath, string dataPath, string outputPa
143136

144137
try
145138
{
146-
entry.Extract(dataStream, File.Create(destPath));
139+
using(var destStream = File.Create(destPath))
140+
entry.Extract(dataStream, destStream);
141+
142+
// Set last modified time to entry's timestamp
143+
File.SetLastWriteTime(destPath, entry.DateTime);
147144
}
148145
catch (LzxInvalidWindowSize)
149146
{

XbRecUnpack/RecoveryControlFile.cs

+11-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class RecoveryControlEntry
1414
public ushort VersionIndex;
1515
public ushort DeviceIndex;
1616
public uint DecompressedSize;
17-
public ulong FileTime;
17+
public long FileTime;
1818
public string FilePath;
1919

2020
// Array of LZX compression-block sizes, all should decompress to a 0x8000 byte block
@@ -36,6 +36,14 @@ public int CompressedSize
3636
}
3737
}
3838

39+
public DateTime DateTime
40+
{
41+
get
42+
{
43+
return DateTime.FromFileTime(FileTime);
44+
}
45+
}
46+
3947
public RecoveryControlEntry(RecoveryControlFile baseFile)
4048
{
4149
_baseFile = baseFile;
@@ -55,8 +63,8 @@ public void Read(BinaryReader reader)
5563
// So we need this so we can trim it down to the proper size
5664
DecompressedSize = reader.ReadUInt32();
5765

58-
// FILETIME timestamp of the file, we should probably convert this...
59-
FileTime = reader.ReadUInt64();
66+
// FILETIME timestamp of the file
67+
FileTime = reader.ReadInt64();
6068

6169
// Path of this file
6270
FilePath = reader.ReadMSString();

0 commit comments

Comments
 (0)