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
55 changes: 55 additions & 0 deletions SAGE/Games/Kane's Wrath/AptAptData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Files;
using SAGE;

namespace SAGE.Compiler
{
public class AptAptData : CompileHandler
{
public override bool Compile(GameAssetType gameAsset, Uri baseUri, BinaryAsset asset, XmlNode node, GameDefinition game,
string trace, ref int position, out string ErrorDescription)
{
BinaryAsset blob = new BinaryAsset(0);
string file = null;
foreach (XmlAttribute attribute in node.Attributes)
{
switch (attribute.Name)
{
case "File":
file = attribute.Value;
break;
}
}
if (file == null)
{
ErrorDescription = string.Format("No file set for {0}", trace);
return false;
}
Uri fileUri = Macro.Parse(file);
if (!fileUri.IsAbsoluteUri)
{
fileUri = new Uri(baseUri, fileUri);
}
file = fileUri.LocalPath;
if (!File.Exists(file))
{
ErrorDescription = string.Format("File not found for {0}", trace);
return false;
}
using (FileStream blobStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (BinaryReader blobReader = new BinaryReader(blobStream))
{
blob.Content = blobReader.ReadBytes((int)(blobStream.Length));
}
}
asset.SubAssets.Add(0x04, blob);
FileHelper.SetInt(blob.Content.Length, 0x08, asset.Content);
ErrorDescription = string.Empty;
return true;
}
}
}
65 changes: 65 additions & 0 deletions SAGE/Games/Kane's Wrath/AptAssets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="utf-8" ?>
<AssetDefinition xmlns="uri:thundermods.net:SAGE:WrathEdXML:AssetDefinition">

<GameAsset
id="AptAptData"
TypeHash="914776178"
HasSpecialCompileHandling="true">
<EntryInheritance
id="base"
AssetType="BaseAssetType" />
<EntryFile
id="File"
AssetType="DataBlob"
IsAttribute="true"
IsRequired="true" />
</GameAsset>

<GameAsset
id="AptConstData"
TypeHash="485025173"
HasSpecialCompileHandling="true">
<EntryInheritance
id="base"
AssetType="BaseAssetType" />
<EntryFile
id="File"
AssetType="DataBlob"
IsAttribute="true"
IsRequired="true" />
</GameAsset>

<GameAsset
id="AptDatData"
TypeHash="1006108345"
HasSpecialCompileHandling="true">
<EntryInheritance
id="base"
AssetType="BaseAssetType" />
<EntryFile
id="File"
AssetType="DataBlob"
IsAttribute="true"
IsRequired="true" />
</GameAsset>

<GameAsset
id="AptGeometryData"
TypeHash="1982570919"
HasSpecialCompileHandling="true">
<EntryInheritance
id="base"
AssetType="BaseAssetType" />
<EntryFile
id="File"
AssetType="DataBlob"
IsAttribute="true"
IsRequired="true" />
<Entry
id="AptID"
AssetType="SageInt"
IsAttribute="true"
IsRequired="true" />
</GameAsset>

</AssetDefinition>
55 changes: 55 additions & 0 deletions SAGE/Games/Kane's Wrath/AptConstData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Files;
using SAGE;

namespace SAGE.Compiler
{
public class AptConstData : CompileHandler
{
public override bool Compile(GameAssetType gameAsset, Uri baseUri, BinaryAsset asset, XmlNode node, GameDefinition game,
string trace, ref int position, out string ErrorDescription)
{
BinaryAsset blob = new BinaryAsset(0);
string file = null;
foreach (XmlAttribute attribute in node.Attributes)
{
switch (attribute.Name)
{
case "File":
file = attribute.Value;
break;
}
}
if (file == null)
{
ErrorDescription = string.Format("No file set for {0}", trace);
return false;
}
Uri fileUri = Macro.Parse(file);
if (!fileUri.IsAbsoluteUri)
{
fileUri = new Uri(baseUri, fileUri);
}
file = fileUri.LocalPath;
if (!File.Exists(file))
{
ErrorDescription = string.Format("File not found for {0}", trace);
return false;
}
using (FileStream blobStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (BinaryReader blobReader = new BinaryReader(blobStream))
{
blob.Content = blobReader.ReadBytes((int)(blobStream.Length));
}
}
asset.SubAssets.Add(0x04, blob);
FileHelper.SetInt(blob.Content.Length, 0x08, asset.Content);
ErrorDescription = string.Empty;
return true;
}
}
}
55 changes: 55 additions & 0 deletions SAGE/Games/Kane's Wrath/AptDatData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Files;
using SAGE;

namespace SAGE.Compiler
{
public class AptConstData : CompileHandler
{
public override bool Compile(GameAssetType gameAsset, Uri baseUri, BinaryAsset asset, XmlNode node, GameDefinition game,
string trace, ref int position, out string ErrorDescription)
{
BinaryAsset blob = new BinaryAsset(0);
string file = null;
foreach (XmlAttribute attribute in node.Attributes)
{
switch (attribute.Name)
{
case "File":
file = attribute.Value;
break;
}
}
if (file == null)
{
ErrorDescription = string.Format("No file set for {0}", trace);
return false;
}
Uri fileUri = Macro.Parse(file);
if (!fileUri.IsAbsoluteUri)
{
fileUri = new Uri(baseUri, fileUri);
}
file = fileUri.LocalPath;
if (!File.Exists(file))
{
ErrorDescription = string.Format("File not found for {0}", trace);
return false;
}
using (FileStream blobStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (BinaryReader blobReader = new BinaryReader(blobStream))
{
blob.Content = blobReader.ReadBytes((int)(blobStream.Length));
}
}
asset.SubAssets.Add(0x04, blob);
FileHelper.SetInt(blob.Content.Length, 0x08, asset.Content);
ErrorDescription = string.Empty;
return true;
}
}
}
58 changes: 58 additions & 0 deletions SAGE/Games/Kane's Wrath/AptGeometryData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using Files;
using SAGE;

namespace SAGE.Compiler
{
public class AptConstData : CompileHandler
{
public override bool Compile(GameAssetType gameAsset, Uri baseUri, BinaryAsset asset, XmlNode node, GameDefinition game,
string trace, ref int position, out string ErrorDescription)
{
BinaryAsset blob = new BinaryAsset(0);
string file = null;
foreach (XmlAttribute attribute in node.Attributes)
{
switch (attribute.Name)
{
case "File":
file = attribute.Value;
break;
case "AptID":
FileHelper.SetInt(int.Parse(attribute.Value), 0x0C, asset.Content);
break;
}
}
if (file == null)
{
ErrorDescription = string.Format("No file set for {0}", trace);
return false;
}
Uri fileUri = Macro.Parse(file);
if (!fileUri.IsAbsoluteUri)
{
fileUri = new Uri(baseUri, fileUri);
}
file = fileUri.LocalPath;
if (!File.Exists(file))
{
ErrorDescription = string.Format("File not found for {0}", trace);
return false;
}
using (FileStream blobStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (BinaryReader blobReader = new BinaryReader(blobStream))
{
blob.Content = blobReader.ReadBytes((int)(blobStream.Length));
}
}
asset.SubAssets.Add(0x04, blob);
FileHelper.SetInt(blob.Content.Length, 0x08, asset.Content);
ErrorDescription = string.Empty;
return true;
}
}
}
Loading