mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-08 18:06:34 +00:00
Add and use VBSP constants
This commit is contained in:
@@ -2,30 +2,12 @@ using System.IO;
|
||||
using System.Text;
|
||||
using BurnOutSharp.Models.VBSP;
|
||||
using BurnOutSharp.Utilities;
|
||||
using static BurnOutSharp.Models.VBSP.Constants;
|
||||
|
||||
namespace BurnOutSharp.Builders
|
||||
{
|
||||
public static class VBSP
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// Total number of lumps in the package
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_COUNT = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the entities lump
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_ENTITIES = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the pakfile lump
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_PAKFILE = 40;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Byte Data
|
||||
|
||||
/// <summary>
|
||||
@@ -101,7 +83,7 @@ namespace BurnOutSharp.Builders
|
||||
|
||||
byte[] signature = data.ReadBytes(4);
|
||||
header.Signature = Encoding.ASCII.GetString(signature);
|
||||
if (header.Signature != "VBSP")
|
||||
if (header.Signature != SignatureString)
|
||||
return null;
|
||||
|
||||
header.Version = data.ReadInt32();
|
||||
|
||||
26
BurnOutSharp.Models/VBSP/Constants.cs
Normal file
26
BurnOutSharp.Models/VBSP/Constants.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace BurnOutSharp.Models.VBSP
|
||||
{
|
||||
public static class Constants
|
||||
{
|
||||
public static readonly byte[] SignatureBytes = new byte[] { 0x56, 0x42, 0x53, 0x50 };
|
||||
|
||||
public const string SignatureString = "VBSP";
|
||||
|
||||
public const uint SignatureUInt32 = 0x50534256;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of lumps in the package
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_COUNT = 64;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the entities lump
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_ENTITIES = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Index for the pakfile lump
|
||||
/// </summary>
|
||||
public const int HL_VBSP_LUMP_PAKFILE = 40;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using static BurnOutSharp.Models.VBSP.Constants;
|
||||
|
||||
namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
@@ -138,10 +138,10 @@ namespace BurnOutSharp.Wrappers
|
||||
string specialLumpName = string.Empty;
|
||||
switch (i)
|
||||
{
|
||||
case Builders.VBSP.HL_VBSP_LUMP_ENTITIES:
|
||||
case HL_VBSP_LUMP_ENTITIES:
|
||||
specialLumpName = " (entities)";
|
||||
break;
|
||||
case Builders.VBSP.HL_VBSP_LUMP_PAKFILE:
|
||||
case HL_VBSP_LUMP_PAKFILE:
|
||||
specialLumpName = " (pakfile)";
|
||||
break;
|
||||
}
|
||||
@@ -211,10 +211,10 @@ namespace BurnOutSharp.Wrappers
|
||||
string filename = $"lump_{index}.bin";
|
||||
switch (index)
|
||||
{
|
||||
case Builders.VBSP.HL_VBSP_LUMP_ENTITIES:
|
||||
case HL_VBSP_LUMP_ENTITIES:
|
||||
filename = "entities.ent";
|
||||
break;
|
||||
case Builders.VBSP.HL_VBSP_LUMP_PAKFILE:
|
||||
case HL_VBSP_LUMP_PAKFILE:
|
||||
filename = "pakfile.zip";
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user