Skip to content

Commit

Permalink
Merge branch 'dev' into dev-work
Browse files Browse the repository at this point in the history
  • Loading branch information
Offline-R503B committed Jan 25, 2021
2 parents 59179bc + 71b2911 commit da5286c
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 228 deletions.
2 changes: 2 additions & 0 deletions CP77.CR2W/Modkit/Uncook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ private static int UncookSingleInner(this Archive.Archive ar, ulong hash, Direct
return -1;
}

(_, buffers) = ar.GetFileData(hash, true);

for (int i = 0; i < buffers.Count; i++)
{
var buffer = buffers[i];
Expand Down
16 changes: 0 additions & 16 deletions CP77.CR2W/Resources/AppSettingsService.cs

This file was deleted.

20 changes: 7 additions & 13 deletions CP77.CR2W/WolvenKit.Cyberformats.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,11 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/WolvenKit/Wolven-kit</RepositoryUrl>
<PackageTags>wolvenkit, cyberpunk2077</PackageTags>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<Version>1.0.1</Version>
<AssemblyVersion>1.0.4.0</AssemblyVersion>
<FileVersion>1.0.4.0</FileVersion>
<Version>1.0.4</Version>
</PropertyGroup>

<ItemGroup>
<None Remove="Resources\archivehashes.zip" />
</ItemGroup>

<ItemGroup>
<Content Include="Resources\archivehashes.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

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

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

</Project>
1 change: 0 additions & 1 deletion CP77.MSTests/ArchiveTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using WolvenKit.Common.Services;
using CP77.CR2W;
using CP77.CR2W.Archive;
using CP77.CR2W.Resources;
using Microsoft.Extensions.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
Expand Down
1 change: 0 additions & 1 deletion CP77.MSTests/Cr2wUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using WolvenKit.Common.Services;
using CP77.CR2W;
using CP77.CR2W.Archive;
using CP77.CR2W.Resources;
using Microsoft.Extensions.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
Expand Down
2 changes: 0 additions & 2 deletions CP77.MSTests/GameUnitTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Windows;
using Catel.IoC;
using CP77.CR2W.Archive;
using CP77.CR2W.Resources;
using Microsoft.Extensions.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using WolvenKit.Common.Oodle;
Expand Down Expand Up @@ -71,7 +70,6 @@ protected static void Setup(TestContext context)

ServiceLocator.Default.RegisterType<ILoggerService, LoggerService>();
ServiceLocator.Default.RegisterType<IHashService, HashService>();
ServiceLocator.Default.RegisterType<IAppSettingsService, AppSettingsService>();

var hashService = ServiceLocator.Default.ResolveType<IHashService>();
hashService.ReloadLocally();
Expand Down
41 changes: 12 additions & 29 deletions CP77Tools/CP77Tools.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<AssemblyVersion>1.1.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<DefineConstants Condition=" '$(OS)' == 'Windows_NT' ">IS_WINDOWS_BUILD</DefineConstants>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishTrimmed>true</PublishTrimmed>
<PublishReadyToRun>true</PublishReadyToRun>
<DebugType>embedded</DebugType>
</PropertyGroup>

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

<ItemGroup>
<ItemGroup>
<None Remove="lib\kraken.so" />
</ItemGroup>

Expand All @@ -33,10 +29,8 @@

<ItemGroup>
<PackageReference Include="Luna.ConsoleProgressBar" Version="1.0.29" />
<PackageReference Include="CsvHelper" Version="18.0.0" />
<PackageReference Include="CsvHelper" Version="21.1.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
<PackageReference Include="WolvenKit.Common" Version="1.0.0" />
<PackageReference Include="WolvenKit.Cyberformats" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -49,22 +43,11 @@
</ItemGroup>

<ItemGroup>
<Content Update="C:\Users\ghost\.nuget\packages\wolvenkit.common\1.0.0\contentFiles\any\net5.0-windows7.0\DDS\texconv.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="C:\Users\ghost\.nuget\packages\wolvenkit.cyberformats\1.0.0\contentFiles\any\net5.0-windows7.0\Resources\archivehashes.zip">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>

<ItemGroup>
<None Update="oo2core_8_win64.dll">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<ProjectReference Include="..\CP77.CR2W\WolvenKit.Cyberformats.csproj" />
<ProjectReference Include="..\WolvenKit.Common\WolvenKit.Common.csproj" />
</ItemGroup>


<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<DefineConstants>_WINDOWS</DefineConstants>
</PropertyGroup>
</Project>
5 changes: 0 additions & 5 deletions CP77Tools/Commands/HashCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ public HashCommand() : base(Name, Description)
AddOption(new Option<string[]>(new[] {"--input", "-i"}, "Create FNV1A hash of given string"));
AddOption(new Option<bool>(new[] {"--missing", "-m"}, ""));

AddCommand(new Command("update", "Update the Archived Hashes")
{
Handler = CommandHandler.Create(ConsoleFunctions.UpdateHashesAsync)
});

Handler = CommandHandler.Create<string[], bool>(ConsoleFunctions.HashTask);
}
}
Expand Down
2 changes: 0 additions & 2 deletions CP77Tools/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.ComponentModel;
using System.IO;
using System.Reflection;
using CP77.CR2W.Resources;
using CP77Tools.Commands;
using CP77Tools.Extensions;
using Luna.ConsoleProgressBar;
Expand All @@ -31,7 +30,6 @@ public static async Task Main(string[] args)

ServiceLocator.Default.RegisterType<ILoggerService, LoggerService>();
ServiceLocator.Default.RegisterType<IHashService, HashService>();
ServiceLocator.Default.RegisterType<IAppSettingsService, AppSettingsService>();

var logger = ServiceLocator.Default.ResolveType<ILoggerService>();
var hashService = ServiceLocator.Default.ResolveType<IHashService>();
Expand Down
16 changes: 8 additions & 8 deletions CP77Tools/Tasks/DumpTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,14 @@ public static int DumpTaskInner(string path, bool imports, bool missinghashes,
// write
var arobj = new ArchiveDumpObject()
{
Filename = ar.Filepath,
Filename = ar.ArchiveAbsolutePath,
FileDictionary = fileDictionary,
TextureDictionary = texDictionary
};

if (imports)
{
using var hwriter = File.CreateText($"{ar.Filepath}.hashes.csv");
using var hwriter = File.CreateText($"{ar.ArchiveAbsolutePath}.hashes.csv");
hwriter.WriteLine("String,Hash");
List<string> allimports = new List<string>();

Expand All @@ -308,10 +308,10 @@ public static int DumpTaskInner(string path, bool imports, bool missinghashes,
hwriter.WriteLine($"{str},{hash}");
}

logger.LogString($"Finished. Dump file written to {ar.Filepath}.", Logtype.Success);
logger.LogString($"Finished. Dump file written to {ar.ArchiveAbsolutePath}.", Logtype.Success);

//write
File.WriteAllText($"{ar.Filepath}.json",
File.WriteAllText($"{ar.ArchiveAbsolutePath}.json",
JsonConvert.SerializeObject(arobj, Formatting.Indented, new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Expand All @@ -325,7 +325,7 @@ public static int DumpTaskInner(string path, bool imports, bool missinghashes,
if (texinfo)
{
//write
File.WriteAllText($"{ar.Filepath}.textures.json",
File.WriteAllText($"{ar.ArchiveAbsolutePath}.textures.json",
JsonConvert.SerializeObject(arobj, Formatting.Indented, new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
Expand All @@ -339,15 +339,15 @@ public static int DumpTaskInner(string path, bool imports, bool missinghashes,
// TODO: add this here
if (dump)
{
File.WriteAllText($"{ar.Filepath}.json",
File.WriteAllText($"{ar.ArchiveAbsolutePath}.json",
JsonConvert.SerializeObject(ar, Formatting.Indented, new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
PreserveReferencesHandling = PreserveReferencesHandling.None,
TypeNameHandling = TypeNameHandling.None
}));

logger.LogString($"Finished dumping {ar.Filepath}.", Logtype.Success);
logger.LogString($"Finished dumping {ar.ArchiveAbsolutePath}.", Logtype.Success);
}

if (list)
Expand Down Expand Up @@ -424,7 +424,7 @@ public static int DumpTaskInner(string path, bool imports, bool missinghashes,
ctr++;
}
}
logger.LogString($"{ar.Filepath} - missing: {ctr}", Logtype.Normal);
logger.LogString($"{ar.ArchiveAbsolutePath} - missing: {ctr}", Logtype.Normal);
}
}

Expand Down
11 changes: 0 additions & 11 deletions CP77Tools/Tasks/HashTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,6 @@ public static int HashTask(string[] input, bool missing)
}


return 1;
}

public static async Task<int> UpdateHashesAsync()
{
var hashService = ServiceLocator.Default.ResolveType<IHashService>();
if (await hashService.RefreshAsync())
{
/*await*/ hashService.ReloadLocally();
}

return 1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion CP77Tools/Tasks/PackTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private static void PackTaskInner(string path, string outpath, int cp = 0)

var ar = ModTools.Pack(basedir, outDir);
if (ar != null)
logger.LogString($"Finished packing {ar.Filepath}.", Logtype.Success);
logger.LogString($"Finished packing {ar.ArchiveAbsolutePath}.", Logtype.Success);
else
logger.LogString($"Packing failed.", Logtype.Error);

Expand Down
8 changes: 4 additions & 4 deletions CP77Tools/Tasks/UnbundleTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ private static void UnbundleTaskInner(string path, string outpath,
{
var archiveManager = new ArchiveManager(basedir);
// TODO: use the manager here?
archiveFileInfos = archiveManager.Archives.Select(_ => new FileInfo(_.Value.Filepath)).ToList();
archiveFileInfos = archiveManager.Archives.Select(_ => new FileInfo(_.Value.ArchiveAbsolutePath)).ToList();
}
else
{
Expand Down Expand Up @@ -122,20 +122,20 @@ private static void UnbundleTaskInner(string path, string outpath,
foreach (var hash_num in hashlist)
{
ar.ExtractSingle(hash_num, outDir);
logger.LogString($" {ar.Filepath}: Extracted one file: {hash_num}", Logtype.Success);
logger.LogString($" {ar.ArchiveAbsolutePath}: Extracted one file: {hash_num}", Logtype.Success);
}

logger.LogString($"Bulk extraction from hashlist file completed!", Logtype.Success);
}
else if (isHash && hashNumber != 0)
{
ar.ExtractSingle(hashNumber, outDir);
logger.LogString($" {ar.Filepath}: Extracted one file: {hashNumber}", Logtype.Success);
logger.LogString($" {ar.ArchiveAbsolutePath}: Extracted one file: {hashNumber}", Logtype.Success);
}
else
{
var r = ar.ExtractAll(outDir, pattern, regex);
logger.LogString($"{ar.Filepath}: Extracted {r.Item1.Count}/{r.Item2} files.",
logger.LogString($"{ar.ArchiveAbsolutePath}: Extracted {r.Item1.Count}/{r.Item2} files.",
Logtype.Success);
}

Expand Down
6 changes: 3 additions & 3 deletions CP77Tools/Tasks/UncookTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void UncookTaskInner(string path, string outpath,
{
var archiveManager = new ArchiveManager(basedir);
// TODO: use the manager here?
archiveFileInfos = archiveManager.Archives.Select(_ => new FileInfo(_.Value.Filepath)).ToList();
archiveFileInfos = archiveManager.Archives.Select(_ => new FileInfo(_.Value.ArchiveAbsolutePath)).ToList();
}
else
{
Expand Down Expand Up @@ -112,12 +112,12 @@ private static void UncookTaskInner(string path, string outpath,
if (hash != 0)
{
ar.UncookSingle(hash, outDir, uext, flip);
logger.LogString($" {ar.Filepath}: Uncooked one file: {hash}", Logtype.Success);
logger.LogString($" {ar.ArchiveAbsolutePath}: Uncooked one file: {hash}", Logtype.Success);
}
else
{
var r = ar.UncookAll(outDir, pattern, regex, uext, flip);
logger.LogString($" {ar.Filepath}: Uncooked {r.Item1.Count}/{r.Item2} files.",
logger.LogString($" {ar.ArchiveAbsolutePath}: Uncooked {r.Item1.Count}/{r.Item2} files.",
Logtype.Success);
}
}
Expand Down
2 changes: 1 addition & 1 deletion WolvenKit.Common/DDS/TexconvWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public enum EUncookExtension
public static class TexconvWrapper
{

private static string textconvpath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "DDS/texconv.exe");
private static string textconvpath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "texconv.exe");


public static string Convert(string outDir,
Expand Down
File renamed without changes.
Loading

0 comments on commit da5286c

Please sign in to comment.