mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2024-08-20 17:09:19 +08:00
Slightly more robust FXC parsing.
This commit is contained in:
parent
3e15734b20
commit
dc6c843401
@ -108,8 +108,8 @@ namespace CodeWalker.GameFiles
|
|||||||
if (!shader.Read(br, exbyteflag1))
|
if (!shader.Read(br, exbyteflag1))
|
||||||
{
|
{
|
||||||
LastError += shader.LastError;
|
LastError += shader.LastError;
|
||||||
gindex = 6; //get outta the loop
|
//gindex = 6; //get outta the loop?
|
||||||
break;
|
//break;
|
||||||
}
|
}
|
||||||
shaders.Add(shader);
|
shaders.Add(shader);
|
||||||
shadergrp.Add(shader);
|
shadergrp.Add(shader);
|
||||||
@ -134,7 +134,7 @@ namespace CodeWalker.GameFiles
|
|||||||
CBufferDict = new Dictionary<uint, FxcCBuffer>();
|
CBufferDict = new Dictionary<uint, FxcCBuffer>();
|
||||||
FxcCBuffer cbtmp = null;
|
FxcCBuffer cbtmp = null;
|
||||||
|
|
||||||
try //things can be undertain after this...
|
try //things can be uncertain after this...
|
||||||
{
|
{
|
||||||
|
|
||||||
byte cbCount1 = br.ReadByte();
|
byte cbCount1 = br.ReadByte();
|
||||||
@ -531,6 +531,7 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
[TypeConverter(typeof(ExpandableObjectConverter))] public class FxcShader
|
[TypeConverter(typeof(ExpandableObjectConverter))] public class FxcShader
|
||||||
{
|
{
|
||||||
|
public long Offset { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string[] Params { get; set; }
|
public string[] Params { get; set; }
|
||||||
public FxcShaderBufferRef[] Buffers { get; set; }//CBuffers
|
public FxcShaderBufferRef[] Buffers { get; set; }//CBuffers
|
||||||
@ -544,6 +545,8 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
public bool Read(BinaryReader br, bool exbyteflag)
|
public bool Read(BinaryReader br, bool exbyteflag)
|
||||||
{
|
{
|
||||||
|
Offset = br.BaseStream.Position;
|
||||||
|
|
||||||
Name = FxcFile.ReadString(br);
|
Name = FxcFile.ReadString(br);
|
||||||
|
|
||||||
if (Name.Length == 0)
|
if (Name.Length == 0)
|
||||||
@ -596,8 +599,6 @@ namespace CodeWalker.GameFiles
|
|||||||
|
|
||||||
ShaderProfile = ByteCodeObj.GetVersion();
|
ShaderProfile = ByteCodeObj.GetVersion();
|
||||||
|
|
||||||
Disassembly = ByteCodeObj.Disassemble();
|
|
||||||
|
|
||||||
|
|
||||||
switch (ShaderProfile.Version)
|
switch (ShaderProfile.Version)
|
||||||
{
|
{
|
||||||
@ -613,6 +614,10 @@ namespace CodeWalker.GameFiles
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//do disassembly last, so any errors won't cause the file read to break
|
||||||
|
Disassembly = ByteCodeObj.Disassemble();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user