Skip to content

Commit a8c8ca6

Browse files
author
theawesomecoder61
committed
Version 1.4
1 parent 53fb55f commit a8c8ca6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+4277
-692
lines changed

Blacksmith/App.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
<setting name="renderMode" serializeAs="String">
3535
<value>0</value>
3636
</setting>
37+
<setting name="pointSize" serializeAs="String">
38+
<value>5</value>
39+
</setting>
3740
</Blacksmith.Properties.Settings>
3841
</userSettings>
3942
<runtime>
-17.5 KB
Binary file not shown.

Blacksmith/Blacksmith.csproj

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@
8383
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
8484
<HintPath>..\packages\NLog.4.5.10\lib\net45\NLog.dll</HintPath>
8585
</Reference>
86-
<Reference Include="ObjParser, Version=1.0.0.0, Culture=neutral, processorArchitecture=AMD64">
87-
<SpecificVersion>False</SpecificVersion>
88-
<HintPath>Binaries\x64\ObjParser.dll</HintPath>
89-
</Reference>
9086
<Reference Include="OpenTK, Version=3.0.1.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
9187
<HintPath>..\packages\OpenTK.3.0.1\lib\net20\OpenTK.dll</HintPath>
9288
</Reference>
@@ -123,6 +119,13 @@
123119
</ItemGroup>
124120
<ItemGroup>
125121
<Compile Include="Enums\EntryTreeNodeType.cs" />
122+
<Compile Include="Enums\FindType.cs" />
123+
<Compile Include="Forms\ResourceViewer.cs">
124+
<SubType>Form</SubType>
125+
</Compile>
126+
<Compile Include="Forms\ResourceViewer.Designer.cs">
127+
<DependentUpon>ResourceViewer.cs</DependentUpon>
128+
</Compile>
126129
<Compile Include="IO\BigEndianBinaryReader.cs" />
127130
<Compile Include="FileTypes\PCK.cs" />
128131
<Compile Include="Forms\AboutBox.cs">
@@ -149,14 +152,17 @@
149152
<Compile Include="Forms\SoundpackBrowser.Designer.cs">
150153
<DependentUpon>SoundpackBrowser.cs</DependentUpon>
151154
</Compile>
152-
<Compile Include="Three\DynamicMesh.cs" />
155+
<Compile Include="Three\DAEWriter.cs" />
156+
<Compile Include="Three\IO_DAE.cs" />
157+
<Compile Include="Three\Mesh.cs" />
153158
<Compile Include="Three\RenderMode.cs" />
154159
<Compile Include="Three\ShaderProgram.cs" />
155-
<Content Include="Binaries\x64\ObjParser.dll" />
160+
<Compile Include="Three\TextRenderer.cs" />
156161
<Content Include="Form1 backup.cs">
157162
<SubType>Form</SubType>
158163
</Content>
159-
<Content Include="Three\D3DScene.cs" />
164+
<None Include="Resources\arrow_in.png" />
165+
<Content Include="Three\D3DScene.txt" />
160166
<Compile Include="Enums\DXT.cs" />
161167
<Compile Include="Enums\ResourceType.cs" />
162168
<Compile Include="FileTypes\Forge.cs" />
@@ -180,9 +186,9 @@
180186
</Compile>
181187
<Compile Include="Three\Camera.cs" />
182188
<Compile Include="Three\GLViewer.cs" />
183-
<Compile Include="Three\OBJMesh.cs" />
184-
<Content Include="Three\ThreeViewer.cs" />
185-
<Compile Include="Three\Mesh.cs" />
189+
<Compile Include="Three\OBJModel.cs" />
190+
<Content Include="Three\ThreeViewer.txt" />
191+
<Compile Include="Three\Model.cs" />
186192
<Content Include="Three\GLViewer backup.txt" />
187193
<Content Include="Shaders\fs.glsl">
188194
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
@@ -202,6 +208,9 @@
202208
<EmbeddedResource Include="Forms\FindDialog.resx">
203209
<DependentUpon>FindDialog.cs</DependentUpon>
204210
</EmbeddedResource>
211+
<EmbeddedResource Include="Forms\ResourceViewer.resx">
212+
<DependentUpon>ResourceViewer.cs</DependentUpon>
213+
</EmbeddedResource>
205214
<EmbeddedResource Include="Forms\SoundpackBrowser.resx">
206215
<DependentUpon>SoundpackBrowser.cs</DependentUpon>
207216
</EmbeddedResource>
@@ -244,6 +253,12 @@
244253
<Content Include="Shaders\vs_tex.glsl">
245254
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
246255
</Content>
256+
<Content Include="Shaders\fs_normal.glsl">
257+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
258+
</Content>
259+
<Content Include="Shaders\vs_normal.glsl">
260+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
261+
</Content>
247262
</ItemGroup>
248263
<ItemGroup>
249264
<None Include="App.config" />
@@ -284,4 +299,8 @@
284299
<Error Condition="!Exists('..\packages\Zstandard.Net.1.1.6\build\Zstandard.Net.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Zstandard.Net.1.1.6\build\Zstandard.Net.targets'))" />
285300
</Target>
286301
<Import Project="..\packages\Zstandard.Net.1.1.6\build\Zstandard.Net.targets" Condition="Exists('..\packages\Zstandard.Net.1.1.6\build\Zstandard.Net.targets')" />
302+
<PropertyGroup>
303+
<PostBuildEvent>
304+
</PostBuildEvent>
305+
</PropertyGroup>
287306
</Project>

Blacksmith/EntryTreeNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ public class EntryTreeNode : TreeNode
88
{
99
public Forge Forge;
1010
public Game Game;
11-
//public int Levels { get { return Helpers.CountStringOccurrences(FullPath, "\\"); } }
1211
public long Offset;
1312
public string Path;
13+
public long ResourceOffset = -1;
1414
public ResourceType ResourceType = ResourceType._NONE;
15-
public int Size = -1;
15+
public long Size = -1;
1616
public EntryTreeNodeType Type = EntryTreeNodeType.NONE;
1717

1818
public EntryTreeNode() : base("")

Blacksmith/Enums/FindType.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace Blacksmith.Enums
2+
{
3+
public enum FindType
4+
{
5+
NORMAL,
6+
REGEX,
7+
WILDCARD
8+
}
9+
}

Blacksmith/Enums/ResourceType.cs

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,56 @@
22

33
namespace Blacksmith.Enums
44
{
5-
public enum ResourceType
5+
public enum ResourceType : uint
66
{
7-
_NONE = 0,
8-
COMPILED_MESH = 1,
9-
LOCALIZATION_DATA = 2,
10-
LOCALIZATION_MANAGER = 3,
11-
LOCALIZATION_PACKAGE = 4,
12-
MATERIAL = 5,
13-
MESH = 6,
14-
MIPMAP = 7,
15-
TEXTURE_MAP = 8,
16-
TEXTURE_SET = 9
7+
// http://wiki.tbotr.net/index.php?title=Assassins_Creed:File_Formats
8+
_NONE = 4291144048, // something I chose randomly
9+
ANIMATION = 262342271,
10+
BUILD_TABLE = 585940579,
11+
CELL_DATA_BLOCK = 2888548200, // unconfirmed
12+
COMPILED_MATERIAL_TEMPLATE = 1000043639,
13+
COMPILED_MESH = 4238218645,
14+
COMPILED_MESH_INSTANCE = 1130893339,
15+
COMPILED_TEXTURE_MAP = 321093609,
16+
COMRPESSED_LOCALIZATION_DATA = 3531835829,
17+
ENTITY = 159662430,
18+
HAIR_MESH = 2121000489,
19+
LOCALIZATION_MANAGER = 1248910915,
20+
LOCALIZATION_PACKAGE = 1849465967,
21+
LOD_SELECTOR = 1373399936,
22+
MASK_16 = 2461622132,
23+
MATERIAL = 2244483011,
24+
MATERIAL_INFO = 2560476850,
25+
MATERIAL_TEMPLATE = 3170581626,
26+
MESH = 1096652136,
27+
MESH_DATA = 105229237,
28+
MESH_INSTANCE_DATA = 1399756347,
29+
MESH_PRIMITIVE = 2775812079,
30+
MESH_SHAPE_TRIANGLE_MATERIAL_DATA = 2407545263,
31+
MESH_SOURCE = 3981995930,
32+
MIPMAP = 491489187,
33+
SKELETON = 615435132,
34+
TERRAIN = 130771501,
35+
TEXTURE_BASE = 535104481,
36+
TEXTURE_GRADIENT = 610229413,
37+
TEXTURE_MAP = 2729961751,
38+
TEXTURE_SET = 3608045168,
39+
TEXTURE_SOURCE = 2849914618
1740
}
1841

1942
public static class ResourceTypeExtensions
2043
{
21-
public static readonly string[] VALUES =
22-
{
23-
"", // none
24-
"FC9E1595", // compiled mesh
25-
"D28389B5", // localization data
26-
"4A70DE43", // localization manager
27-
"6E3C9C6F", // localization package
28-
"85C817C3", // material
29-
"415D9568", // mesh
30-
"1D4B87A3", // mipmap
31-
"A2B7E917", // texture map
32-
"D70E6670" // texture set
33-
};
34-
3544
public static ResourceType GetResourceType(uint hexBytesAsInt)
3645
{
37-
string hex = string.Format("{0:X4}", hexBytesAsInt).PadLeft(8, '0');
38-
return Array.IndexOf(VALUES, hex) > -1 ?
39-
(ResourceType)Enum.GetValues(typeof(ResourceType)).GetValue(Array.IndexOf(VALUES, hex)) :
40-
ResourceType._NONE;
46+
string hexBytes = string.Format("{0:X4}", hexBytesAsInt).PadLeft(8, '0');
47+
return GetResourceType(hexBytes);
4148
}
4249

43-
public static ResourceType GetResourceTypeWithString(string hexBytes)
50+
public static ResourceType GetResourceType(string hexBytes)
4451
{
45-
return Array.IndexOf(VALUES, hexBytes) > -1 ?
46-
(ResourceType)Enum.GetValues(typeof(ResourceType)).GetValue(Array.IndexOf(VALUES, hexBytes)) :
47-
ResourceType._NONE;
52+
ResourceType type = ResourceType._NONE;
53+
Enum.TryParse(hexBytes, out type);
54+
return type;
4855
}
4956
}
5057
}

Blacksmith/FileTypes/Forge.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void Read()
129129
DataHeader1 = new DataHeader1Block
130130
{
131131
NumOfEntries = reader.ReadInt32(),
132-
Unknown1 = Helpers.ReadInts(reader, 4),
132+
Unknown1 = Helpers.ReadInt32s(reader, 4),
133133
Unknown2 = reader.ReadInt64(),
134134
MaxFilesForThisIndex = reader.ReadInt32(),
135135
Unknown3 = reader.ReadInt32(),
@@ -180,13 +180,13 @@ public void Read()
180180
{
181181
RawDataSize = reader.ReadInt32(),
182182
FileDataID = reader.ReadInt64(),
183-
Unknown1 = Helpers.ReadInts(reader, 4),
183+
Unknown1 = Helpers.ReadInt32s(reader, 4),
184184
NextFileCount = reader.ReadInt32(),
185185
PreviousFileCount = reader.ReadInt32(),
186186
Unknown2 = reader.ReadInt32(),
187187
Timestamp = reader.ReadInt32(),
188188
Name = new string(reader.ReadChars(128)),
189-
Unknown3 = Helpers.ReadInts(reader, 5)
189+
Unknown3 = Helpers.ReadInt32s(reader, 5)
190190
};
191191

192192
// remove non-ASCII characters from the name
@@ -242,15 +242,15 @@ public byte[] GetRawData(FileEntry fileEntry)
242242
/// <param name="offset"></param>
243243
/// <param name="size"></param>
244244
/// <returns></returns>
245-
public byte[] GetRawData(long offset, int size)
245+
public byte[] GetRawData(long offset, long size)
246246
{
247247
byte[] data = new byte[size];
248248
using (Stream stream = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.Read))
249249
{
250250
using (BinaryReader reader = new BinaryReader(stream))
251251
{
252252
reader.BaseStream.Seek(offset, SeekOrigin.Begin); // the checksum is ignored
253-
data = reader.ReadBytes(size);
253+
data = reader.ReadBytes((int)size);
254254
}
255255
}
256256
return data;

0 commit comments

Comments
 (0)