Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
stevemonaco committed Sep 22, 2020
2 parents 8981b8e + 0bf8536 commit eeb985c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ImageMagitek/Codec/Serialization/XmlGraphicsFormatReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ public MagitekResults<GraphicsFormat> LoadFromFile(string fileName)
});

if (validationErrors.Any())
{
validationErrors.Insert(0, $"Codec '{fileName}' failed to be validated");
return new MagitekResults<GraphicsFormat>.Failed(validationErrors);
}


XElement formatNode = doc.Element("format");

Expand All @@ -59,7 +63,7 @@ public MagitekResults<GraphicsFormat> LoadFromFile(string fileName)
else if (codecs.colortype == "direct")
format.ColorType = PixelColorType.Direct;
else
throw new XmlException($"Unsupported colortype '{codecs.colortype}'");
throw new XmlException($"Unsupported colortype '{codecs.colortype}' while parsing codec '{fileName}'");

format.ColorDepth = int.Parse(codecs.colordepth);

Expand All @@ -68,7 +72,7 @@ public MagitekResults<GraphicsFormat> LoadFromFile(string fileName)
else if (codecs.layout == "linear")
format.Layout = ImageLayout.Single;
else
throw new XmlException($"Unsupported layout '{codecs.layout}'");
throw new XmlException($"Unsupported layout '{codecs.layout}' while parsing codec '{fileName}'");

if (codecs.fixedsize == "true")
format.FixedSize = true;
Expand All @@ -84,7 +88,7 @@ public MagitekResults<GraphicsFormat> LoadFromFile(string fileName)
string[] mergeInts = mergestring.Split(',');

if (mergeInts.Length != format.ColorDepth)
throw new Exception("The number of entries in mergepriority does not match the colordepth");
throw new Exception("The number of entries in mergepriority does not match the colordepth while parsing codec '{fileName}'");

format.MergePlanePriority = new int[format.ColorDepth];

Expand Down
3 changes: 3 additions & 0 deletions ImageMagitek/ImageMagitek.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
</ItemGroup>

<ItemGroup>
<None Update="_codecs\GBA4bpp.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="_codecs\Tokimemo1bpp.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
16 changes: 16 additions & 0 deletions ImageMagitek/_codecs/GBA4bpp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<format name="GBA 4bpp" version="0.8">
<codec>
<colortype>indexed</colortype>
<colordepth>4</colordepth>
<layout>tiled</layout>
<defaultheight>8</defaultheight>
<defaultwidth>8</defaultwidth>
<fixedsize>false</fixedsize>
<mergepriority>3, 2, 1, 0</mergepriority>
</codec>
<image>
<colordepth>4</colordepth>
<rowinterlace>false</rowinterlace>
<rowpixelpattern>1, 0</rowpixelpattern>
</image>
</format>

0 comments on commit eeb985c

Please sign in to comment.