Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
- fixed a bug where packed buffers had incorrect metadata
- better handling for long extract paths
- changed default uncook extension to dds
  • Loading branch information
rfuzzo committed Jan 26, 2021
1 parent 72da09e commit f3e98df
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CP77.CR2W/Modkit/Pack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public static Archive.Archive Pack(DirectoryInfo infolder, DirectoryInfo outpath
ar.Table.Offsets.Add(new OffsetEntry(
(ulong)boffset,
bzsize,
(uint) b.Length));
bsize));
}
lastoffsetidx = (uint)ar.Table.Offsets.Count;

Expand Down
10 changes: 6 additions & 4 deletions CP77.CR2W/Modkit/Uncook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ public static partial class ModTools
/// <param name="flip"></param>
/// <returns></returns>
public static int UncookSingle(this Archive.Archive ar, ulong hash, DirectoryInfo outDir,
EUncookExtension uncookext = EUncookExtension.tga, bool flip = false)
EUncookExtension uncookext = EUncookExtension.dds, bool flip = false)
{
// using var mmf = MemoryMappedFile.CreateFromFile(Filepath, FileMode.Open);

return ar.UncookSingleInner(hash, outDir, uncookext, flip);
}

private static int UncookSingleInner(this Archive.Archive ar, ulong hash, DirectoryInfo outDir, EUncookExtension uncookext = EUncookExtension.tga, bool flip = false)
private static int UncookSingleInner(this Archive.Archive ar, ulong hash, DirectoryInfo outDir,
EUncookExtension uncookext = EUncookExtension.dds, bool flip = false)
{
// checks
if (!ar.Files.ContainsKey(hash))
Expand Down Expand Up @@ -114,7 +115,8 @@ private static int UncookSingleInner(this Archive.Archive ar, ulong hash, Direct
/// <param name="uncookext"></param>
/// <param name="flip"></param>
/// <returns></returns>
public static (List<string>, int) UncookAll(this Archive.Archive ar, DirectoryInfo outDir, string pattern = "", string regex = "", EUncookExtension uncookext = EUncookExtension.tga, bool flip = false)
public static (List<string>, int) UncookAll(this Archive.Archive ar, DirectoryInfo outDir, string pattern = "",
string regex = "", EUncookExtension uncookext = EUncookExtension.dds, bool flip = false)
{
var logger = ServiceLocator.Default.ResolveType<ILoggerService>();

Expand Down Expand Up @@ -170,7 +172,7 @@ where matches.Count > 0
///
/// </summary>
public static int Uncook(CR2WFile cr2w, List<byte[]> buffers, ECookedFileFormat ext,
EUncookExtension uncookext = EUncookExtension.tga, bool flip = false)
EUncookExtension uncookext = EUncookExtension.dds, bool flip = false)
{
var infile = new FileInfo(cr2w.FileName);
var uncooksuccess = false;
Expand Down
16 changes: 9 additions & 7 deletions CP77.CR2W/WolvenKit.Cyberformats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/WolvenKit/Wolven-kit</RepositoryUrl>
<PackageTags>wolvenkit, cyberpunk2077</PackageTags>
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<FileVersion>1.0.4.0</FileVersion>
<Version>1.0.4</Version>
<AssemblyVersion>1.0.5.0</AssemblyVersion>
<FileVersion>1.0.5.0</FileVersion>
<Version>1.0.5</Version>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Resources\**" />
<EmbeddedResource Remove="Resources\**" />
<None Remove="Resources\**" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Catel.Core" Version="5.12.11" />
<PackageReference Include="DotNetHelper.FastMember.Extension" Version="2.0.0" />
Expand All @@ -28,8 +34,4 @@
<ProjectReference Include="..\WolvenKit.Common\WolvenKit.Common.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions WolvenKit.Common/DDS/TexconvWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ public static string Convert(string outDir,
{
var logger = ServiceLocator.Default.ResolveType<ILoggerService>();

if (filepath.Length > 255)
{
logger.LogString($"{filepath} - Filepath exceedds 255 characters. Please move the archive to extract to a shorter path.", Logtype.Error);
return "";
}

var proc = new ProcessStartInfo(textconvpath)
{
WorkingDirectory = Path.GetDirectoryName(textconvpath),
Expand Down
2 changes: 1 addition & 1 deletion WolvenKit.Common/WolvenKit.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<RepositoryUrl>https://github.com/WolvenKit/Wolven-kit</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>wolvenkit</PackageTags>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit f3e98df

Please sign in to comment.