Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
################################################################################
# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
################################################################################

/MoveTool/obj
/.vs
*/obj
*/bin
*.user
*.config
/packages/*
461 changes: 267 additions & 194 deletions MoveLib/BAC.cs

Large diffs are not rendered by default.

2,133 changes: 1,083 additions & 1,050 deletions MoveLib/BCM.cs

Large diffs are not rendered by default.

25 changes: 17 additions & 8 deletions MoveLib/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,37 @@

namespace MoveLib
{
/// <summary>
/// Common functions used by multiple MoveLib classes.
/// </summary>
public static class Common
{
public const int ADDRESS_CONTENT_PTR = 0x18; // Address of pointer to content OR size of metadata, depending on how you look at it.
public const int ADDRESS_FOOTER_PTR = 0x93;

/// <summary>
/// Removes the Uasset's metadata section (header) and returns the remainder.
/// </summary>
/// <param name="fileBytes"></param>
/// <returns>The main content/data of the Uasset.</returns>
public static byte[] RemoveUassetHeader(byte[] fileBytes)
{
var tempList = fileBytes.ToList();

int sizeOfHeader = BitConverter.ToInt32(fileBytes, 0x18);
int sizeOfHeader = BitConverter.ToInt32(fileBytes, ADDRESS_CONTENT_PTR);

tempList.RemoveRange(0, sizeOfHeader + 36);
return tempList.ToArray();
}

public static byte[] GetUassetHeader(byte[] fileBytes)
{
var tempList = fileBytes.ToList();

int sizeOfHeader = BitConverter.ToInt32(fileBytes, 0x18);
int sizeOfHeader = BitConverter.ToInt32(fileBytes, ADDRESS_CONTENT_PTR); // get the value @18 - the size of the header (or pointer to the end of the header)

byte[] array = new byte[sizeOfHeader];
tempList.CopyTo(0, array, 0, sizeOfHeader);
byte[] headerBytes = new byte[sizeOfHeader];
Array.Copy(fileBytes, headerBytes, sizeOfHeader);

return array;
return headerBytes;
}

public static List<byte> CreateUassetFile(List<byte> fileBytes, byte[] uassetHeader)
Expand All @@ -37,7 +46,7 @@ public static List<byte> CreateUassetFile(List<byte> fileBytes, byte[] uassetHea
0x09, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
});
}); // "None" bytes (+ 4 extra zeros?)

var tempLengthBytes = BitConverter.GetBytes(fileBytes.Count);

Expand Down
5 changes: 2 additions & 3 deletions MoveLib/MoveLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand Down
2 changes: 1 addition & 1 deletion MoveLib/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="11.0.2" targetFramework="net452" />
</packages>
13 changes: 7 additions & 6 deletions MoveTool/MoveTool.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MoveLib\MoveLib.csproj">
Expand All @@ -55,11 +56,11 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
<Target Name="AfterResolveReferences">
<ItemGroup>
<EmbeddedResource Include="@(ReferenceCopyLocalPaths)" Condition="'%(ReferenceCopyLocalPaths.Extension)' == '.dll'">
<LogicalName>%(ReferenceCopyLocalPaths.DestinationSubDirectory)%(ReferenceCopyLocalPaths.Filename)%(ReferenceCopyLocalPaths.Extension)</LogicalName>
</EmbeddedResource>
</ItemGroup>
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Loading