1
0
mirror of synced 2025-02-25 22:38:07 +01:00

Fix bfres shape flags, msbt text fixes, and extracting archive fixes

This commit is contained in:
KillzXGaming 2019-09-19 20:11:21 -04:00
parent db04c5102a
commit c47d9bc2bc
8 changed files with 24 additions and 11 deletions

View File

@ -268,9 +268,10 @@ namespace FirstPlugin
EntryCount = reader.ReadUInt32(); EntryCount = reader.ReadUInt32();
Offsets = reader.ReadUInt32s((int)EntryCount); Offsets = reader.ReadUInt32s((int)EntryCount);
Console.WriteLine($"");
for (int i = 0; i < EntryCount; i++) for (int i = 0; i < EntryCount; i++)
{ {
reader.Position = Offsets[i] + Position; reader.SeekBegin(Offsets[i] + Position);
ReadMessageString(reader, (uint)i); ReadMessageString(reader, (uint)i);
} }
} }
@ -279,13 +280,20 @@ namespace FirstPlugin
{ {
List<byte> chars = new List<byte>(); List<byte> chars = new List<byte>();
short charCheck = reader.ReadInt16(); byte charCheck = reader.ReadByte();
while (charCheck != 0) byte charCheck2 = reader.ReadByte();
while (charCheck != 0 && charCheck2 != 0)
{ {
chars.Add((byte)(charCheck >> 8)); chars.Add(charCheck);
chars.Add((byte)(charCheck & 255)); chars.Add(charCheck2);
charCheck = reader.ReadInt16(); if (reader.Position < reader.BaseStream.Length - 2)
{
charCheck = reader.ReadByte();
charCheck2 = reader.ReadByte();
}
else
break;
} }
TextData.Add(new StringEntry(chars.ToArray()) { Index = index, }); TextData.Add(new StringEntry(chars.ToArray()) { Index = index, });

View File

@ -111,9 +111,9 @@ namespace Toolbox.Library
if (ParentPath != string.Empty) if (ParentPath != string.Empty)
FilePath = FilePath.Replace(ParentPath, string.Empty); FilePath = FilePath.Replace(ParentPath, string.Empty);
var path = Path.Combine(overridePath, FilePath); var path = $"{overridePath}/{FilePath}";
progressBar.Task = $"Extracting File {file}"; progressBar.Task = $"Extracting File {FileName}";
progressBar.Value = (Curfile++ * 100) / Collection.Count(); progressBar.Value = (Curfile++ * 100) / Collection.Count();
progressBar.Refresh(); progressBar.Refresh();
CreateDirectoryIfExists($"{path}"); CreateDirectoryIfExists($"{path}");

View File

@ -19,6 +19,12 @@ namespace Toolbox.Library.IO
this.Position = 0; this.Position = 0;
} }
public FileReader(Stream stream, Encoding encoding, bool leaveOpen = false)
: base(stream, encoding, leaveOpen)
{
this.Position = 0;
}
public FileReader(string fileName, bool leaveOpen = false) public FileReader(string fileName, bool leaveOpen = false)
: this(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), leaveOpen) : this(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), leaveOpen)
{ {

View File

@ -34,10 +34,9 @@ void main()
{ {
// Convert to sRGB. // Convert to sRGB.
vec3 whiteColorSRGB = pow(whiteColor.rgb, vec3(1.0 / gamma)); vec3 whiteColorSRGB = pow(whiteColor.rgb, vec3(1.0 / gamma));
vec3 blackColorSRGB = pow(blackColor.rgb, vec3(1.0 / gamma));
vec3 whiteInterpolation = whiteColor.rgb * textureMap0.rgb; vec3 whiteInterpolation = whiteColorSRGB.rgb * textureMap0.rgb;
vec3 blackInterpolation = (vec3(1) - textureMap0.rgb) * blackColorSRGB.rgb; vec3 blackInterpolation = (vec3(1) - textureMap0.rgb) * blackColor.rgb;
vec3 colorBlend = whiteInterpolation + blackInterpolation; vec3 colorBlend = whiteInterpolation + blackInterpolation;