133 Commits
1.5.7 ... main

Author SHA1 Message Date
Matt Nadareski
729a2ca0a2 Update final notice 2025-09-29 07:29:37 -04:00
Matt Nadareski
d9b7ebedc3 Add deprecation notice 2025-09-26 12:00:12 -04:00
Matt Nadareski
19e9734a6f Migrate non-executable models to Serialization 2025-09-26 11:57:24 -04:00
Matt Nadareski
f101df48ae Migrate support file models to Serialization 2025-09-26 11:39:29 -04:00
Matt Nadareski
ceececd8a0 Remove now-unnecessary warning disable 2025-09-26 10:58:10 -04:00
Matt Nadareski
d86f539da4 Migrate archive models to Serialization 2025-09-26 10:54:17 -04:00
Matt Nadareski
54b0a0f4b1 Migrate ASN1 models to Serialization 2025-09-26 10:22:32 -04:00
Matt Nadareski
c6cba88ba6 Migrate metadata models to Serialization 2025-09-26 10:22:11 -04:00
Matt Nadareski
063d91db6d Add some more notes about SFX 2025-09-26 08:50:59 -04:00
Matt Nadareski
f7311b8f01 Add observed values 2025-09-26 08:45:18 -04:00
Matt Nadareski
697a2e0f05 Reduce redundant remarks 2025-09-26 08:43:04 -04:00
Matt Nadareski
35806a16d2 Relabel to an unknown because correlation is difficult 2025-09-26 08:41:09 -04:00
Matt Nadareski
550e8f5d8b Clarify unknown offset information 2025-09-26 08:13:51 -04:00
Matt Nadareski
c5a818d1a3 Missing? field 2025-09-26 08:03:46 -04:00
Matt Nadareski
12943ac578 Remove incorrect remark 2025-09-26 07:56:51 -04:00
Matt Nadareski
028fdf14f6 More Advanced Installer notes 2025-09-26 07:56:30 -04:00
Matt Nadareski
e535b23953 Correct some information 2025-09-25 22:51:54 -04:00
Matt Nadareski
b94f011c15 Better footer research 2025-09-25 22:50:30 -04:00
Matt Nadareski
a7fa074877 Add anotehr note about size 2025-09-25 22:36:45 -04:00
Matt Nadareski
219ce890c4 Reorganize remarks a bit 2025-09-25 22:28:01 -04:00
Matt Nadareski
76fcc49d6d Start documenting Advanced Installer 2025-09-25 22:23:50 -04:00
Matt Nadareski
d7ade2efc4 Add ASN.1 models 2025-09-24 09:31:40 -04:00
Matt Nadareski
f4f1870cee Fix this for later 2025-09-22 19:32:26 -04:00
Matt Nadareski
0130a9caee Bump version 2025-09-22 17:26:04 -04:00
Matt Nadareski
da204f129f Remove unnecessary NoWarn 2025-09-22 17:22:32 -04:00
Matt Nadareski
945a62d1f2 Add COFF constants 2025-09-22 15:57:16 -04:00
Matt Nadareski
8ab5088607 Simplify naming in comments 2025-09-22 12:58:02 -04:00
Matt Nadareski
9e9fcac654 Move delay load table because it was missed 2025-09-22 12:39:44 -04:00
Matt Nadareski
76dac1025c Move TODO more out of the way 2025-09-22 12:38:03 -04:00
Matt Nadareski
0ec1cac7cf Remove TODO that was done 2025-09-22 12:36:01 -04:00
Matt Nadareski
6a0b97fdcd Remove meta-tables 2025-09-22 12:34:26 -04:00
Matt Nadareski
66f7adc49a Slightly change description on optional header 2025-09-22 12:19:06 -04:00
Matt Nadareski
4bc685ba23 Move TLS 2025-09-22 12:17:29 -04:00
Matt Nadareski
89ef827251 Move resource 2025-09-22 12:16:47 -04:00
Matt Nadareski
beb42b7e35 Move load configuration 2025-09-22 12:13:08 -04:00
Matt Nadareski
0502808962 This goes in resource entries 2025-09-22 12:07:26 -04:00
Matt Nadareski
e3411d3984 This is also import-related 2025-09-22 12:06:46 -04:00
Matt Nadareski
9d13cb01e3 Move import table 2025-09-22 12:06:05 -04:00
Matt Nadareski
649ea98a52 Move export table 2025-09-22 12:04:06 -04:00
Matt Nadareski
b90d7c5e9a Move debug data table 2025-09-22 12:01:12 -04:00
Matt Nadareski
9def156302 Move delay load directory table 2025-09-22 11:56:11 -04:00
Matt Nadareski
e1db4fc17b Move attribute certificate table 2025-09-22 11:52:28 -04:00
Matt Nadareski
ae4ad5c272 Optional header is partially COFF 2025-09-22 11:38:24 -04:00
Matt Nadareski
5bda523aec Sections are COFF, who knew? 2025-09-22 11:29:39 -04:00
Matt Nadareski
eda099d44e Separate out COFF stuff maybe for later? 2025-09-22 11:26:08 -04:00
Matt Nadareski
b5ac9304a4 Move base relocation to new namespace 2025-09-22 11:14:27 -04:00
Matt Nadareski
b40f84dd4b Move more things to resource entries namespace 2025-09-22 11:09:58 -04:00
Matt Nadareski
4a276fb65e Move MoPaQ encryption constants to IO 2025-09-22 10:37:40 -04:00
Matt Nadareski
973a94b340 Move LZX models to IO 2025-09-22 10:33:33 -04:00
Matt Nadareski
c6062f71eb Move Quantum compression models to IO 2025-09-22 10:29:29 -04:00
Matt Nadareski
fd7746fae3 Move MSZIP "model" to IO 2025-09-22 10:22:38 -04:00
Matt Nadareski
d3c6bdf23f Update Newtonsoft 2025-09-22 09:46:23 -04:00
Matt Nadareski
605a3bf30d Add a bunch of useful constants 2025-09-22 09:35:00 -04:00
Matt Nadareski
710ddc912d Add and update models needed for BOS 2025-09-22 09:06:33 -04:00
HeroponRikiBestest
2f94464b7d Small matroschka model update (#14)
* Small model updates, mainly documentation. Not essential.

* wrong branch lol
2025-09-19 12:09:16 -04:00
Matt Nadareski
b3d9bd3d6b Add some more hashes for fun 2025-09-19 08:29:49 -04:00
Matt Nadareski
c51c16ed2d Add RA extensions to Logiqx (fixes #13) 2025-09-17 09:29:29 -04:00
HeroponRikiBestest
978b6904db Add fileData variable to MatroshkaEntry.cs model (#12)
* Add fileData variable to MatroshkaEntry.cs model

This will be necessary to handle parsing properly in serialization.

* Use PascalCase
2025-09-16 15:30:47 -04:00
Matt Nadareski
d62bd2f60c Cleanup from last PR 2025-09-12 12:54:22 -04:00
Deterous
26f7f4d7da AACS2 support (#11)
* AACS2 support

* Better names

* libaacs links
2025-09-12 12:50:32 -04:00
Matt Nadareski
50a6f9ba89 There 2025-09-10 21:52:09 -04:00
Matt Nadareski
f07c11fb47 Simplify TLS directory 2025-09-09 13:54:19 -04:00
Matt Nadareski
dc47f64ee6 Sync a few notes from Serialization 2025-09-09 13:52:48 -04:00
Matt Nadareski
69006247a9 One more potential constant 2025-09-09 12:32:11 -04:00
Matt Nadareski
9c43b80502 Rename to be more accurate 2025-09-09 12:29:26 -04:00
Matt Nadareski
cbb7563724 Add missing symbol types, make a flag 2025-09-09 11:07:51 -04:00
Matt Nadareski
c7530884b3 Add constant notes 2025-09-09 09:42:55 -04:00
Matt Nadareski
e59c9205d4 Make OptionalHeader a bit more correct 2025-09-09 09:30:43 -04:00
Matt Nadareski
f5859638c2 Move these 2025-09-08 21:09:54 -04:00
Matt Nadareski
84d3740e73 Yeah 2025-09-08 21:07:25 -04:00
Matt Nadareski
517324ab58 Bump version 2025-09-05 09:10:29 -04:00
Matt Nadareski
a02c037995 Remind myself of this 2025-09-02 19:20:59 -04:00
Matt Nadareski
a1890e1fe6 I messed this up too 2025-09-01 16:17:02 -04:00
Matt Nadareski
32c6633788 Fix this naming for later 2025-09-01 15:52:50 -04:00
Matt Nadareski
81b53c9785 Bump version 2025-09-01 15:05:53 -04:00
Matt Nadareski
54c05f2746 Sync changes from downstream 2025-09-01 15:05:15 -04:00
Matt Nadareski
4a4d7ceddf Make this more clear 2025-08-28 23:37:18 -04:00
Matt Nadareski
0f029c5979 Fix one 2025-08-28 21:29:23 -04:00
Matt Nadareski
bb4fee91d9 Sort some things around PE 2025-08-28 21:18:39 -04:00
Matt Nadareski
ed56e2543d Convert this to an array 2025-08-28 12:12:04 -04:00
Matt Nadareski
d675673e50 More descriptive names 2025-08-28 09:47:01 -04:00
Matt Nadareski
ebee967c7f Clean up gzip and tar a bit 2025-08-28 09:27:08 -04:00
Matt Nadareski
f5da54eaac Fix some tar model issues 2025-08-28 08:56:11 -04:00
Matt Nadareski
2350c1af27 Add placeholder models 2025-08-28 07:46:23 -04:00
Matt Nadareski
454d507b41 Source my sources 2025-08-28 07:40:09 -04:00
Matt Nadareski
10de4acbb9 File ending thing for PKZIP 2025-08-28 07:38:11 -04:00
Matt Nadareski
8ec91d8d04 Add a couple missing extra field structures 2025-08-27 22:28:06 -04:00
Matt Nadareski
1d62d69a53 Interleaved types don't need to be here 2025-08-27 22:09:28 -04:00
Matt Nadareski
5b5fed8932 Rename a few things 2025-08-27 21:09:30 -04:00
Matt Nadareski
32123d4b80 Fix one more PKZIP extra field 2025-08-27 20:40:32 -04:00
Matt Nadareski
f5717c3929 Forgot to sync change here 2025-08-27 19:19:36 -04:00
Matt Nadareski
e8db261d73 Start making some fixes to PKZIP 2025-08-27 19:14:31 -04:00
Matt Nadareski
9557f43dab Add placeholder extras field 2025-08-27 18:43:26 -04:00
Matt Nadareski
51b9c1a016 Make PKZIP models a bit easier to follow 2025-08-27 12:51:57 -04:00
Matt Nadareski
bb3cd54865 Remove now-useless note 2025-08-15 10:13:31 -04:00
Matt Nadareski
0c6060a901 Clickable sources, archive links for dead pages 2025-08-15 10:09:43 -04:00
Matt Nadareski
c18770f627 Upstream changes from WiseUnpacker 2025-08-15 08:59:29 -04:00
Matt Nadareski
c2a5d6770c Upstream changes from WiseUnpacker 2025-08-13 12:22:11 -04:00
Matt Nadareski
4ef79ccdca Upstream changes from WiseUnpacker 2025-08-10 21:44:23 -04:00
Matt Nadareski
cf5135f330 Slight NE cleanup 2025-08-10 20:36:53 -04:00
Matt Nadareski
6d989209db Update NE notes and structure a bit more 2025-08-10 20:15:49 -04:00
Matt Nadareski
cc48593646 Upstream changes from WiseUnpacker 2025-08-09 10:26:37 -04:00
Matt Nadareski
415d571b65 Upstream changes from WiseUnpacker 2025-08-06 09:33:51 -04:00
Matt Nadareski
4a6e244b38 Upstream changes from WiseUnpacker 2025-08-04 12:16:34 -04:00
Matt Nadareski
771a39517f Upstream changes from WiseUnpacker 2025-08-01 16:06:32 -04:00
Matt Nadareski
b072a3809c Fix enum 2025-08-01 10:32:17 -04:00
Matt Nadareski
341585206a Add Wise Installer models from REWise
All credit to CYBERDEV for their work in documenting these structures in the first place
2025-07-31 22:35:04 -04:00
Matt Nadareski
2dc2ab5dd1 Add OLE models 2025-07-30 22:46:37 -04:00
Matt Nadareski
144a3ce52b Fix CFB comments 2025-07-29 22:45:15 -04:00
Matt Nadareski
85199789f7 Add new Matroshka package comment 2025-07-28 07:54:29 -04:00
Matt Nadareski
fb39216c82 Bump verison 2025-07-24 09:11:34 -04:00
Matt Nadareski
1a2de39868 Fix Dir serialization issue 2025-07-24 09:11:10 -04:00
Matt Nadareski
f18b6c8850 Bump version 2025-07-23 09:48:18 -04:00
Matt Nadareski
8f1e49e464 Add .NET Standard 2.0 and 2.1 2025-07-23 09:43:12 -04:00
Matt Nadareski
6547242f93 Clean up more Matroskha comments 2025-07-21 11:27:20 -04:00
Matt Nadareski
edf00f3ab2 Add analysis block comment 2025-07-21 11:25:18 -04:00
Matt Nadareski
bce4736037 Clean up more Matroskha comments 2025-07-21 11:23:25 -04:00
Matt Nadareski
81f28974c0 More remark corrections based on more samples 2025-07-21 11:10:35 -04:00
Matt Nadareski
30ebe84af4 Remove disproven theory 2025-07-21 11:08:01 -04:00
Matt Nadareski
b07fbdedd6 Add secondary length note 2025-07-21 09:39:31 -04:00
Matt Nadareski
cd8fff4a86 Slight tweaks to Matroska entry notes 2025-07-21 09:21:56 -04:00
Matt Nadareski
3d3275e3cb Add SecuROM Matroshka models
All research thanks to HeroponRikiBestest
2025-07-21 09:11:37 -04:00
Matt Nadareski
4c76ce1230 Add SecuROM DFA models
All research thanks to HeroponRikiBestest
2025-07-21 08:10:25 -04:00
Matt Nadareski
0c4e3b4bf2 Dirs can be nested 2025-06-24 12:32:14 -04:00
Matt Nadareski
e8f4386199 Add mess alternative ListXML model 2025-05-28 09:53:05 -04:00
Matt Nadareski
ab66ccf3c5 Update copyright 2024-12-30 21:19:05 -05:00
Matt Nadareski
cc60d54a33 Remove unnecessary action step 2024-12-30 21:18:59 -05:00
Matt Nadareski
e805f4cb9a Ensure .NET versions are installed for testing 2024-12-19 10:50:01 -05:00
Matt Nadareski
328c893a38 Ensure .NET versions are installed for testing 2024-12-19 10:45:08 -05:00
Matt Nadareski
ab2a12c996 Bump version 2024-12-16 12:10:13 -05:00
Matt Nadareski
362b123661 Allow symbols to be packed 2024-12-16 11:37:18 -05:00
Matt Nadareski
4a8a4746a2 Add big-endian note for PS4 PKG 2024-12-16 11:31:38 -05:00
Deterous
3f368a3be8 Create model for PS4 app.pkg header (#7)
* Create model for PS4 app.pkg header

* Rename PS4 app.pkg class

* Fix typo

* Requested changes

* Add newline
2024-12-15 20:12:06 -05:00
842 changed files with 7012 additions and 32757 deletions

View File

@@ -16,22 +16,22 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Run tests
run: dotnet test
- name: Run publish script
run: ./publish-nix.sh
- name: Upload build
uses: actions/upload-artifact@v4
with:
name: 'Nuget Package'
path: '*.nupkg'
- name: Upload to rolling
uses: ncipollo/release-action@v1.14.0
with:
allowUpdates: True
artifacts: '*.nupkg'
artifacts: "*.nupkg,*.snupkg"
body: 'Last built commit: ${{ github.sha }}'
name: 'Rolling Release'
prerelease: True

View File

@@ -11,7 +11,13 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Build
run: dotnet build
run: dotnet build
- name: Run tests
run: dotnet test

7
LICENSE Normal file
View File

@@ -0,0 +1,7 @@
Copyright (c) 2018-2025 Matt Nadareski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -2,6 +2,8 @@
[![Build and Test](https://github.com/SabreTools/SabreTools.Models/actions/workflows/build_and_test.yml/badge.svg?branch=main)](https://github.com/SabreTools/SabreTools.Models/actions/workflows/build_and_test.yml)
**NOTICE**: This library has been deprecated. All functionality formerly in this library is in [SabreTools.Serialization](https://github.com/SabreTools/SabreTools.Serialization) as of version 2.0.0.
This library comprises of models that represent either directly serializable or representative structures for all SabreTools projects. All of the main models representing metadata files should have parsers created outside of the current code.
Find the link to the Nuget package [here](https://www.nuget.org/packages/SabreTools.Models).
@@ -12,10 +14,53 @@ For the most recent stable build, download the latest release here: [Releases Pa
For the latest WIP build here: [Rolling Release](https://github.com/SabreTools/SabreTools.Models/releases/rolling)
## Missing Metadata Models
## Notable Information Sources
The following metadata file formats do not have models included in this library yet and, as such, do not have serializers:
Not all of this information was able to be gathered directly from the files in question, so here is a non-exhaustive list of sites and projects that allow this project to exist. Most of the models also have direct links to specific pages or code snippets, where available.
- Missfile
- SabreJSON
- SabreDAT XML
| Site/Project | Models Directory |
| --- | --- |
| [3DBrew](https://www.3dbrew.org/wiki/Main_Page) | N3DS |
| [Aaru Data Preservation Suite](https://github.com/aaru-dps) | PIC |
| [Advanced Access Content System Licensing Administrator (AACS LA)](https://aacsla.com/) | AACS |
| [BYTE*](https://web.archive.org/web/20240703222951/https://bytepointer.com/index.htm) | NewExecutable |
| [cabextract/libmspack](https://www.cabextract.org.uk/) | LZ |
| [DBox](https://dbox.tools/) | Xbox |
| [DebugInfo.com](https://www.debuginfo.com/index.html) | PortableExecutable |
| [Devilsclaw](https://devilsclaws.net/) | PFF |
| [DSiBrew](https://dsibrew.org/wiki/Main_Page) | Nitro |
| [DVD Resources for Open Source Development](https://dvd.sourceforge.net/) | DVD |
| [EDM/2](https://www.edm2.com/index.php/Main_Page) | LinearExecutable |
| [faydoc.tripod.com](https://faydoc.tripod.com/formats/) | LinearExecutable |
| [GuitarGame_ChartFormats](https://github.com/TheNathannator/GuitarGame_ChartFormats/) | Charts |
| [HandWiki](https://handwiki.org/wiki/Start) | Quantum |
| [HLLib](https://github.com/RavuAlHemio/hllib/) | BSP, GCF, NCF, PAK, SGA, VPK, WAD3, XZP |
| [IBM Documentation](https://www.ibm.com/docs/en) | TAR |
| [IETF](https://www.ietf.org/) | GZIP |
| [Independent Commodore Library](https://petlibrary.tripod.com/) | PKZIP |
| [Ladislav Zezula](http://zezula.net/en/tools/main.html) | MoPaQ |
| [libaacs](https://code.videolan.org/videolan/libaacs/) | AACS |
| [libbdplus](https://github.com/mwgoldsmith/bdplus) | BD+ |
| [libexe](https://github.com/libyal/libexe/) | NewExecutable |
| [MAME](https://github.com/mamedev/mame/) | CHD |
| [Matthew Russotto](http://www.russotto.net/quantumcomp.html) | Compression/Quantum |
| [Microsoft Learn](https://learn.microsoft.com/en-us/) | BMP, CFB, Compression/LZX, Compression/MSZIP, MicrosoftCabinet, OLE, PortableExecutable, SecuROM, WiseInstaller |
| [msitools](https://github.com/GNOME/msitools/) | CFB |
| [OSDev.org](https://wiki.osdev.org/Expanded_Main_Page) | MSDOS, NewExecutable |
| [PInvoke.net](http://www.pinvoke.net/index.aspx) | MSDOS |
| [PKWARE(?)](https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT) | PKZIP |
| [PS3 Developer Wiki](https://www.psdevwiki.com/ps3/) | IRD, PlayStation3 |
| [RanseiLink](https://github.com/Deijin27/RanseiLink) | Nitro |
| [Reverse Engineering Wise](https://codeberg.org/CYBERDEV/REWise) | WiseInstaller |
| [SharpCompress](https://github.com/adamhathcock/sharpcompress) | PKZIP |
| [Source SDK 2013](https://github.com/ValveSoftware/source-sdk-2013) | BSP |
| [Technical Committee T10](https://www.t10.org/) | PIC |
| [The Go tools for Windows + Assembler](https://www.godevtool.com/) | PortableExecutable |
| [The Whole Half-Life](https://twhl.info/wiki/page/Specification:_WAD3) | WAD3 |
| [Unshield](https://github.com/twogood/unshield) | InstallShieldCabinet |
| [unshieldv3](https://github.com/wfr/unshieldv3) | InstallShieldArchiveV3 |
| [Valve Developer Community](https://developer.valvesoftware.com/wiki/Main_Page) | BSP, VPK |
| [w4kfu's bl0g](https://web.archive.org/web/20250206143756/http://blog.w4kfu.com/) | SafeDisc |
| [Wine](https://github.com/wine-mirror/wine/) | LZ |
| [XboxDevWiki.net](https://xboxdevwiki.net/Main_Page) | Xbox |
| [XeNTaX Game Research Forum](http://web.archive.org/web/20231031162306/https://forum.xentax.com/) | SFFS |

View File

@@ -1,16 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <summary>
/// This record type is undocumented but found in real media key blocks
/// </summary>
public sealed class CopyrightRecord : Record
{
/// <summary>
/// Null-terminated ASCII string representing the copyright
/// </summary>
[MarshalAs(UnmanagedType.LPStr)]
public string? Copyright;
}
}

View File

@@ -1,25 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DriveRevocationListEntry
{
/// <summary>
/// A 2-byte Range value indicates the range of revoked IDs starting
/// from the ID contained in the record. A value of zero in the Range
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range;
/// <summary>
/// A 6-byte Drive ID value identifying the Licensed Drive being revoked
/// (or the first in a range of Licensed Drives being revoked, in the
/// case of a non-zero Range value).
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? DriveID;
}
}

View File

@@ -1,26 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// A properly formatted type 3 or type 4 Media Key Block contains exactly
/// one Drive Revocation List Record. It follows the Host Revocation List
/// Record, although it may not immediately follow it.
///
/// The Drive Revocation List Record is identical to the Host Revocation
/// List Record, except it has type 2016, and it contains Drive Revocation
/// List Entries, not Host Revocation List Entries. The Drive Revocation List
/// Entries refer to Drive IDs in the Drive Certificates.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class DriveRevocationListRecord : Record
{
/// <summary>
/// The total number of Drive Revocation List Entry fields that follow.
/// </summary>
public uint TotalNumberOfEntries { get; set; }
/// <summary>
/// Revocation list entries
/// </summary>
public DriveRevocationSignatureBlock[]? SignatureBlocks { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class DriveRevocationSignatureBlock
{
/// <summary>
/// The number of Drive Revocation List Entry fields in the signature block.
/// </summary>
public uint NumberOfEntries { get; set; }
/// <summary>
/// A list of 8-byte Host Drive List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
public DriveRevocationListEntry[]? EntryFields { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// A properly formatted MKB shall contain an End of Media Key Block Record.
/// When a device encounters this Record it stops processing the MKB, using
/// whatever Km value it has calculated up to that point as the final Km for
/// that MKB (pending possible checks for correctness of the key, as
/// described previously).
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class EndOfMediaKeyBlockRecord : Record
{
/// <summary>
/// AACS LAs signature on the data in the Media Key Block up to,
/// but not including, this record. Devices depending on the Version
/// Number in the Type and Version Record must verify the signature.
/// Other devices may ignore the signature data. If any device
/// determines that the signature does not verify or is omitted, it
/// must refuse to use the Media Key.
/// </summary>
public byte[]? SignatureData { get; set; }
}
}

View File

@@ -1,46 +0,0 @@
namespace SabreTools.Models.AACS
{
public enum MediaKeyBlockType : uint
{
/// <summary>
/// (Type 3). This is a normal Media Key Block suitable for being recorded
/// on a AACS Recordable Media. Both Class I and Class II Licensed Products
/// use it to directly calculate the Media Key.
/// </summary>
Type3 = 0x00031003,
/// <summary>
/// (Type 4). This is a Media Key Block that has been designed to use Key
/// Conversion Data (KCD). Thus, it is suitable only for pre-recorded media
/// from which the KCD is derived. Both Class I and Class II Licensed Products
/// use it to directly calculate the Media Key.
/// </summary>
Type4 = 0x00041003,
/// <summary>
/// (Type 10). This is a Class II Media Key Block (one that has the functionality
/// of a Sequence Key Block). This can only be processed by Class II Licensed
/// Products; Class I Licensed Products are revoked in Type 10 Media Key Blocks
/// and cannot process them. This type does not contain the Host Revocation List
/// Record, the Drive Revocation List Record, and the Media Key Data Record, as
/// described in the following sections. It does contain the records shown in
/// Section 3.2.5.2, which are only processed by Class II Licensed Products.
/// </summary>
Type10 = 0x000A1003,
}
public enum RecordType : byte
{
EndOfMediaKeyBlock = 0x02,
ExplicitSubsetDifference = 0x04,
MediaKeyData = 0x05,
SubsetDifferenceIndex = 0x07,
TypeAndVersion = 0x10,
DriveRevocationList = 0x20,
HostRevocationList = 0x21,
VerifyMediaKey = 0x81,
// Not documented
Copyright = 0x7F,
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class ExplicitSubsetDifferenceRecord : Record
{
/// <summary>
/// In this record, each subset-difference is encoded with 5 bytes.
/// </summary>
public SubsetDifference[]? SubsetDifferences { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class HostRevocationListEntry
{
/// <summary>
/// A 2-byte Range value indicates the range of revoked IDs starting
/// from the ID contained in the record. A value of zero in the Range
/// field indicates that only one ID is being revoked, a value of one
/// in the Range field indicates two IDs are being revoked, and so on.
/// </summary>
public ushort Range;
/// <summary>
/// A 6-byte Host ID value identifying the host being revoked (or the
/// first in a range of hosts being revoked, in the case of a non-zero
/// Range value).
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[]? HostID;
}
}

View File

@@ -1,29 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// A properly formatted type 3 or type 4 Media Key Block shall have exactly
/// one Host Revocation List Record as its second record. This record provides
/// a list of hosts that have been revoked by the AACS LA. The AACS specification
/// is applicable to PC-based system where a Licensed Drive and PC Host act
/// together as the Recording Device and/or Playback Device for AACS Content.
/// AACS uses a drive-host authentication protocol for the host to verify the
/// integrity of the data received from the Licensed Drive, and for the Licensed
/// Drive to check the validity of the host application. The Type and Version
/// Record and the Host Revocation List Record are guaranteed to be the first two
/// records of a Media Key Block, to make it easier for Licensed Drives to extract
/// this data from an arbitrary Media Key Block.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class HostRevocationListRecord : Record
{
/// <summary>
/// The total number of Host Revocation List Entry fields that follow.
/// </summary>
public uint TotalNumberOfEntries { get; set; }
/// <summary>
/// Revocation list entries
/// </summary>
public HostRevocationSignatureBlock[]? SignatureBlocks { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class HostRevocationSignatureBlock
{
/// <summary>
/// The number of Host Revocation List Entry fields in the signature block.
/// </summary>
public uint NumberOfEntries { get; set; }
/// <summary>
/// A list of 8-byte Host Revocation List Entry fields, the length of this
/// list being equal to the number in the signature block.
/// </summary>
public HostRevocationListEntry[]? EntryFields { get; set; }
}
}

View File

@@ -1,14 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// A Media Key Block is formatted as a sequence of contiguous Records.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class MediaKeyBlock
{
/// <summary>
/// Records
/// </summary>
public Record[]? Records { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// This record gives the associated encrypted media key data for the
/// subset-differences identified in the Explicit Subset-Difference Record.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class MediaKeyDataRecord : Record
{
/// <summary>
/// Each subset difference has its associated 16 bytes in this
/// record, in the same order it is encountered in the subset-difference
/// record. This 16 bytes is the ciphertext value C in the media
/// key calculation.
/// </summary>
public byte[][]? MediaKeyData { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// Each Record begins with a one-byte Record Type field, followed by a
/// three-byte Record Length field.
///
/// The following subsections describe the currently defined Record types,
/// and how a device processes each. All multi-byte integers, including
/// the length field, are “Big Endian”; in other words, the most significant
/// byte comes first in the record.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public abstract class Record
{
/// <summary>
/// The Record Type field value indicates the type of the Record.
/// </summary>
public RecordType RecordType { get; set; }
/// <summary>
/// The Record Length field value indicates the number of bytes in
/// the Record, including the Record Type and the Record Length
/// fields themselves. Record lengths are always multiples of 4 bytes.
/// </summary>
// <remarks>UInt24 not UInt32</remarks>
public uint RecordLength { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.AACS
{
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class SubsetDifference
{
/// <summary>
/// The mask for u is given by the first byte. That byte is
/// treated as a number, the number of low-order 0-bits in
/// the mask. For example, the value 0x01 denotes a mask of
/// 0xFFFFFFFE; value 0x0A denotes a mask of 0xFFFFFC00.
/// </summary>
public byte Mask;
/// <summary>
/// The last 4 bytes are the uv number, most significant
/// byte first.
/// </summary>
public uint Number;
}
}

View File

@@ -1,26 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// This is a speed-up record which can be ignored by devices not wishing to
/// take advantage of it. It is a lookup table which allows devices to quickly
/// find their subset-difference in the Explicit Subset-Difference record,
/// without processing the entire record. This Subset-Difference Index record
/// is always present, and always precedes the Explicit Subset-Difference record
/// in the MKB, although it does not necessarily immediately precede it.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class SubsetDifferenceIndexRecord : Record
{
/// <summary>
/// The number of devices per index offset.
/// </summary>
public uint Span { get; set; }
/// <summary>
/// These offsets refer to the offset within the following Explicit
/// Subset-Difference record, with 0 being the start of the record.
/// </summary>
// <remarks>UInt24 not UInt32</remarks>
public uint[]? Offsets { get; set; }
}
}

View File

@@ -1,32 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// Devices, except for recording devices which are writing Media Key Block
/// Extensions, may ignore this record. Recording devices shall verify the
/// signature (see End of Media Key Block record) and use the Version Number
/// in this record to determine if a new Media Key BLock Extension is, in
/// fact, more recent than the Media Key Block Extension that is currently
/// on the media.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class TypeAndVersionRecord : Record
{
/// <summary>
/// For AACS applications, the MKBType field is one of three values.
/// It is not an error for a Type 3 Media Key Block to be used for
/// controlling access to AACS Content on pre- recorded media. In
/// this case, the device shall not use the KCD.
/// </summary>
public MediaKeyBlockType MediaKeyBlockType { get; set; }
/// <summary>
/// The Version Number is a 32-bit unsigned integer. Each time the
/// licensing agency changes the revocation, it increments the version
/// number and inserts the new value in subsequent Media Key Blocks.
/// Thus, larger values indicate more recent Media Key Blocks. The
/// Version Numbers begin at 1; 0 is a special value used for test
/// Media Key Blocks.
/// </summary>
public uint VersionNumber { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
namespace SabreTools.Models.AACS
{
/// <summary>
/// A properly formatted MKB shall have exactly one Verify Media Key Record
/// as its first record. The presence of the Verify Media Key Record in an MKB
/// is mandatory, but the use of the Record by a device is not mandatory. The
/// device may use the Verify Media Key Record to verify the correctness of a
/// given MKB, or of its processing of it. If everything is correct, the device
/// should observe the condition:
/// [AES_128D(vKm, C]msb_64 == 0x0123456789ABCDEF)]
/// where Km is the Media Key value.
/// </summary>
/// <see href="https://aacsla.com/wp-content/uploads/2019/02/AACS_Spec_Common_Final_0953.pdf"/>
public sealed class VerifyMediaKeyRecord : Record
{
/// <summary>
/// Bytes 4 through 19 of the Record contain the ciphertext value
/// Cv = AES-128E (Km, 0x0123456789ABCDEF || 0xXXXXXXXXXXXXXXXX)
/// where 0xXXXXXXXXXXXXXXXX is an arbitrary 8-byte value, and Km is
/// the correct final Media Key value.
/// </summary>
public byte[]? CiphertextValue { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
namespace SabreTools.Models.AdvancedInstaller
{
/// <summary>
/// Single entry in the file table
/// </summary>
public class FileEntry
{
/// <summary>
/// Unknown
/// </summary>
/// <remarks>
/// Observed values:
/// - 00 00 00 00 (INI)
/// - 01 00 00 00 (MSI, CAB)
/// - 05 00 00 00 (DLL)
/// </remarks>
public uint Unknown0 { get; set; }
/// <summary>
/// Unknown
/// </summary>
/// <remarks>
/// Observed values:
/// - 00 00 00 00 (MSI)
/// - 01 00 00 00 (CAB)
/// - 03 00 00 00 (INI)
/// - 0C 00 00 00 (DLL)
/// </remarks>
public uint? Unknown1 { get; set; }
/// <summary>
/// Unknown, always 0?
/// </summary>
/// <remarks>
/// Observed values:
/// - 00 00 00 00 (DLL, MSI, CAB, INI)
/// </remarks>
public uint? Unknown2 { get; set; }
/// <summary>
/// Size of the file
/// </summary>
public uint FileSize { get; set; }
/// <summary>
/// Offset of the file relative to the start
/// of the SFX stub
/// </summary>
public uint FileOffset { get; set; }
/// <summary>
/// Size of the file name in characters
/// </summary>
public uint NameSize { get; set; }
/// <summary>
/// Unicode-encoded file name
/// </summary>
public string? Name { get; set; }
}
}

View File

@@ -0,0 +1,109 @@
namespace SabreTools.Models.AdvancedInstaller
{
/// <summary>
/// Structure similar to the end of central directory
/// header in PKZIP files
/// </summary>
public class Footer
{
/// <summary>
/// Unknown
/// </summary>
/// <remarks>
/// Observed values:
/// - 00 00 00 00
/// </remarks>
public uint Unknown0 { get; set; }
/// <summary>
/// Size of the original filename?
/// </summary>
/// <remarks>Doesn't exist in some cases?</remarks>
public uint? OriginalFilenameSize { get; set; }
/// <summary>
/// Unicode-encoded original filename?
/// </summary>
/// <remarks>Doesn't exist in some cases?</remarks>
public string? OriginalFilename { get; set; }
/// <summary>
/// Unknown, possibly a string count?
/// </summary>
/// <remarks>
/// Only seen when the preceeding two fields exist
///
/// Observed values:
/// - 01 00 00 00
/// </remarks>
public uint? Unknown1 { get; set; }
/// <summary>
/// Pointer to <see cref="Unknown0"/>?
/// </summary>
public uint FooterOffset { get; set; }
/// <summary>
/// Number of entries that preceed the footer
/// </summary>
public uint EntryCount { get; set; }
/// <summary>
/// Unknown
/// </summary>
/// <remarks>
/// Observed values:
/// - 64 00 00 00
/// </remarks>
public uint Unknown2 { get; set; }
/// <summary>
/// Unknown offset
/// </summary>
/// <remarks>
/// Points to <see cref="Unknown0"/> if no original filename.
/// Points to <see cref="EntryCount"/> if contains an original filename.
/// </remarks>
public uint UnknownOffset { get; set; }
/// <summary>
/// Offset of the start of the file table
/// </summary>
public uint TablePointer { get; set; }
/// <summary>
/// Offset to the start of the file data
/// </summary>
public uint FileDataStart { get; set; }
/// <summary>
/// Hex string that looks like a key or other identifier
/// </summary>
/// <remarks>32 bytes</remarks>
public string? HexString { get; set; }
/// <summary>
/// Unknown
/// </summary>
/// <remarks>
/// Offset pointer to <see cref="FileDataStart"/>
/// relative to the end of the signature if no filename
/// exists.
///
/// Observed values:
/// - 32 00 00 00 (No original filename)
/// - 13 02 00 00 (Original filename)
/// </remarks>
public uint Unknown3 { get; set; }
/// <summary>
/// "ADVINSTSFX"
/// </summary>
public string? Signature { get; set; }
/// <summary>
/// Unknown, always 0? Padding?
/// </summary>
public ushort? Unknown4 { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace SabreTools.Models.AdvancedInstaller
{
/// <summary>
/// Represents the structure at the end of a Caphyon
/// Advanced Installer SFX file. These SFX files store
/// all files uncompressed sequentially in the overlay
/// of an executable.
///
/// The design is similar to the end of central directory
/// in a PKZIP file. The footer needs to be read before
/// the entry table as both the pointer to the start of
/// the table as well as the entry count are included there.
///
/// The layout of this is derived from the layout in the
/// physical file.
/// </summary>
public class SFX
{
/// <summary>
/// Set of file entries
/// </summary>
public FileEntry[]? Entries { get; set; }
/// <summary>
/// Footer representing the central directory
/// </summary>
public Footer? Footer { get; set; }
}
}

View File

@@ -1,205 +0,0 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.ArchiveDotOrg
{
[XmlRoot("file")]
public class File
{
[XmlAttribute("name")]
public string? Name { get; set; }
/// <remarks>Is this a set of defined values?</remarks>
[XmlAttribute("source")]
public string? Source { get; set; }
[XmlElement("btih")]
public string? BitTorrentMagnetHash { get; set; }
[XmlElement("mtime")]
public string? LastModifiedTime { get; set; }
[XmlElement("size")]
public string? Size { get; set; }
[XmlElement("md5")]
public string? MD5 { get; set; }
[XmlElement("crc32")]
public string? CRC32 { get; set; }
[XmlElement("sha1")]
public string? SHA1 { get; set; }
[XmlElement("filecount")]
public string? FileCount { get; set; }
/// <remarks>Is this a set of defined values?</remarks>
[XmlElement("format")]
public string? Format { get; set; }
[XmlElement("original")]
public string? Original { get; set; }
/// <remarks>Is this a set of defined values?</remarks>
[XmlElement("summation")]
public string? Summation { get; set; }
[XmlElement("matrix_number")]
public string? MatrixNumber { get; set; }
[XmlElement("collection-catalog-number")]
public string? CollectionCatalogNumber { get; set; }
[XmlElement("publisher")]
public string? Publisher { get; set; }
[XmlElement("comment")]
public string? Comment { get; set; }
#region ASR-Related
[XmlElement("asr_detected_lang")]
public string? ASRDetectedLang { get; set; }
[XmlElement("asr_detected_lang_conf")]
public string? ASRDetectedLangConf { get; set; }
[XmlElement("asr_transcribed_lang")]
public string? ASRTranscribedLang { get; set; }
[XmlElement("whisper_asr_module_version")]
public string? WhisperASRModuleVersion { get; set; }
[XmlElement("whisper_model_hash")]
public string? WhisperModelHash { get; set; }
[XmlElement("whisper_model_name")]
public string? WhisperModelName { get; set; }
[XmlElement("whisper_version")]
public string? WhisperVersion { get; set; }
#endregion
#region OCR-Related
[XmlElement("cloth_cover_detection_module_version")]
public string? ClothCoverDetectionModuleVersion { get; set; }
[XmlElement("hocr_char_to_word_hocr_version")]
public string? hOCRCharToWordhOCRVersion { get; set; }
[XmlElement("hocr_char_to_word_module_version")]
public string? hOCRCharToWordModuleVersion { get; set; }
[XmlElement("hocr_fts_text_hocr_version")]
public string? hOCRFtsTexthOCRVersion { get; set; }
[XmlElement("hocr_fts_text_module_version")]
public string? hOCRFtsTextModuleVersion { get; set; }
[XmlElement("hocr_pageindex_hocr_version")]
public string? hOCRPageIndexhOCRVersion { get; set; }
[XmlElement("hocr_pageindex_module_version")]
public string? hOCRPageIndexModuleVersion { get; set; }
[XmlElement("ocr")]
public string? TesseractOCR { get; set; }
[XmlElement("ocr_converted")]
public string? TesseractOCRConverted { get; set; }
[XmlElement("ocr_detected_lang")]
public string? TesseractOCRDetectedLang { get; set; }
[XmlElement("ocr_detected_lang_conf")]
public string? TesseractOCRDetectedLangConf { get; set; }
[XmlElement("ocr_detected_script")]
public string? TesseractOCRDetectedScript { get; set; }
[XmlElement("ocr_detected_script_conf")]
public string? TesseractOCRDetectedScriptConf { get; set; }
[XmlElement("ocr_module_version")]
public string? TesseractOCRModuleVersion { get; set; }
[XmlElement("ocr_parameters")]
public string? TesseractOCRParameters { get; set; }
[XmlElement("pdf_module_version")]
public string? PDFModuleVersion { get; set; }
[XmlElement("word_conf_0_10")]
public string? WordConfidenceInterval0To10 { get; set; }
[XmlElement("word_conf_11_20")]
public string? WordConfidenceInterval11To20 { get; set; }
[XmlElement("word_conf_21_30")]
public string? WordConfidenceInterval21To30 { get; set; }
[XmlElement("word_conf_31_40")]
public string? WordConfidenceInterval31To40 { get; set; }
[XmlElement("word_conf_41_50")]
public string? WordConfidenceInterval41To50 { get; set; }
[XmlElement("word_conf_51_60")]
public string? WordConfidenceInterval51To60 { get; set; }
[XmlElement("word_conf_61_70")]
public string? WordConfidenceInterval61To70 { get; set; }
[XmlElement("word_conf_71_80")]
public string? WordConfidenceInterval71To80 { get; set; }
[XmlElement("word_conf_81_90")]
public string? WordConfidenceInterval81To90 { get; set; }
[XmlElement("word_conf_91_100")]
public string? WordConfidenceInterval91To100 { get; set; }
#endregion
#region Media-Related
[XmlElement("album")]
public string? Album { get; set; }
[XmlElement("artist")]
public string? Artist { get; set; }
[XmlElement("bitrate")]
public string? Bitrate { get; set; }
[XmlElement("creator")]
public string? Creator { get; set; }
[XmlElement("height")]
public string? Height { get; set; }
[XmlElement("length")]
public string? Length { get; set; }
[XmlElement("preview-image")]
public string? PreviewImage { get; set; }
/// <remarks>Is this a set of defined values?</remarks>
[XmlElement("rotation")]
public string? Rotation { get; set; }
[XmlElement("title")]
public string? Title { get; set; }
[XmlElement("track")]
public string? Track { get; set; }
[XmlElement("width")]
public string? Width { get; set; }
#endregion
}
}

View File

@@ -1,12 +0,0 @@
using System.Xml;
using System.Xml.Serialization;
namespace SabreTools.Models.ArchiveDotOrg
{
[XmlRoot("files")]
public class Files
{
[XmlElement("file")]
public File[]? File { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
namespace SabreTools.Models.AttractMode
{
/// <summary>
/// #Name;Title;Emulator;CloneOf;Year;Manufacturer;Category;Players;Rotation;Control;Status;DisplayCount;DisplayType;AltRomname;AltTitle;Extra;Buttons /// </summary>
/// </summary>
public class MetadataFile
{
[Required]
public string[]? Header { get; set; }
public Row[]? Row { get; set; }
}
}

View File

@@ -1,51 +0,0 @@
namespace SabreTools.Models.AttractMode
{
public class Row
{
/// <remarks>Also called Romname</remarks>
[Required]
public string? Name { get; set; }
public string? Title { get; set; }
public string? Emulator { get; set; }
public string? CloneOf { get; set; }
public string? Year { get; set; }
public string? Manufacturer { get; set; }
public string? Category { get; set; }
public string? Players { get; set; }
public string? Rotation { get; set; }
public string? Control { get; set; }
public string? Status { get; set; }
public string? DisplayCount { get; set; }
public string? DisplayType { get; set; }
public string? AltRomname { get; set; }
public string? AltTitle { get; set; }
public string? Extra { get; set; }
public string? Buttons { get; set; }
public string? Favorite { get; set; }
public string? Tags { get; set; }
public string? PlayedCount { get; set; }
public string? PlayedTime { get; set; }
public string? FileIsAvailable { get; set; }
}
}

View File

@@ -1,7 +0,0 @@
namespace SabreTools.Models.BDPlus
{
public static class Constants
{
public const string SignatureString = "BDSVM_CC";
}
}

View File

@@ -1,50 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BDPlus
{
/// <see href="https://github.com/mwgoldsmith/bdplus/blob/master/src/libbdplus/bdsvm/loader.c"/>
public sealed class SVM
{
/// <summary>
/// "BDSVM_CC"
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
public string? Signature;
/// <summary>
/// Unknown data
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[]? Unknown1 = new byte[5];
/// <summary>
/// Version year
/// </summary>
public ushort Year;
/// <summary>
/// Version month
/// </summary>
public byte Month;
/// <summary>
/// Version day
/// </summary>
public byte Day;
/// <summary>
/// Unknown data
/// </summary>
public uint Unknown2;
/// <summary>
/// Length
/// </summary>
public uint Length;
/// <summary>
/// Length bytes of data
/// </summary>
public byte[]? Data { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
namespace SabreTools.Models.BFPK
{
/// <summary>
/// BFPK custom archive format
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
public sealed class Archive
{
/// <summary>
/// Header
/// </summary>
public Header? Header { get; set; }
/// <summary>
/// Files
/// </summary>
public FileEntry[]? Files { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BFPK
{
public static class Constants
{
public static readonly byte[] SignatureBytes = [0x42, 0x46, 0x50, 0x4b];
public const string SignatureString = "BFPK";
public const uint SignatureUInt32 = 0x4b504642;
}
}

View File

@@ -1,34 +0,0 @@
namespace SabreTools.Models.BFPK
{
/// <summary>
/// File entry
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
public sealed class FileEntry
{
/// <summary>
/// Name size
/// </summary>
public int NameSize { get; set; }
/// <summary>
/// Name
/// </summary>
public string? Name { get; set; }
/// <summary>
/// Uncompressed size
/// </summary>
public int UncompressedSize { get; set; }
/// <summary>
/// Offset
/// </summary>
public int Offset { get; set; }
/// <summary>
/// Compressed size
/// </summary>
public int CompressedSize { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BFPK
{
/// <summary>
/// Header
/// </summary>
/// <see cref="https://forum.xentax.com/viewtopic.php?t=5102"/>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public sealed class Header
{
/// <summary>
/// "BFPK"
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
public string? Magic;
/// <summary>
/// Version
/// </summary>
public int Version;
/// <summary>
/// Files
/// </summary>
public int Files;
}
}

View File

@@ -1,38 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
/// The BITMAPFILEHEADER structure contains information about the type, size,
/// and layout of a file that contains a DIB.
/// </summary>
/// <see href="https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-bitmapfileheader"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPFILEHEADER
{
/// <summary>
/// The file type; must be BM.
/// </summary>
public ushort Type;
/// <summary>
/// The size, in bytes, of the bitmap file.
/// </summary>
public uint Size;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved1;
/// <summary>
/// Reserved; must be zero.
/// </summary>
public ushort Reserved2;
/// <summary>
/// The offset, in bytes, from the beginning of the BITMAPFILEHEADER structure to the bitmap bits.
/// </summary>
public uint OffBits;
}
}

View File

@@ -1,97 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BMP
{
/// <summary>
/// The BITMAPINFOHEADER structure contains information about the dimensions and
/// color format of a device-independent bitmap (DIB).
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public sealed class BITMAPINFOHEADER
{
/// <summary>
/// Specifies the number of bytes required by the structure. This value does
/// not include the size of the color table or the size of the color masks,
/// if they are appended to the end of structure.
/// </summary>
public uint Size;
/// <summary>
/// Specifies the width of the bitmap, in pixels.
/// </summary>
public int Width;
/// <summary>
/// Specifies the height of the bitmap, in pixels.
/// - For uncompressed RGB bitmaps, if biHeight is positive, the bitmap is a
/// bottom-up DIB with the origin at the lower left corner. If biHeight is
/// negative, the bitmap is a top-down DIB with the origin at the upper left
/// corner.
/// - For YUV bitmaps, the bitmap is always top-down, regardless of the sign of
/// biHeight. Decoders should offer YUV formats with positive biHeight, but for
/// backward compatibility they should accept YUV formats with either positive
/// or negative biHeight.
/// - For compressed formats, biHeight must be positive, regardless of image orientation.
/// </summary>
public int Height;
/// <summary>
/// Specifies the number of planes for the target device. This value must be set to 1.
/// </summary>
public ushort Planes;
/// <summary>
/// Specifies the number of bits per pixel (bpp). For uncompressed formats, this value
/// is the average number of bits per pixel. For compressed formats, this value is the
/// implied bit depth of the uncompressed image, after the image has been decoded.
/// </summary>
public ushort BitCount;
/// <summary>
/// For compressed video and YUV formats, this member is a FOURCC code, specified as a
/// DWORD in little-endian order. For example, YUYV video has the FOURCC 'VYUY' or
/// 0x56595559. For more information, see FOURCC Codes.
///
/// For uncompressed RGB formats, the following values are possible:
/// - BI_RGB: Uncompressed RGB.
/// - BI_BITFIELDS: Uncompressed RGB with color masks. Valid for 16-bpp and 32-bpp bitmaps.
///
/// Note that BI_JPG and BI_PNG are not valid video formats.
///
/// For 16-bpp bitmaps, if biCompression equals BI_RGB, the format is always RGB 555.
/// If biCompression equals BI_BITFIELDS, the format is either RGB 555 or RGB 565. Use
/// the subtype GUID in the AM_MEDIA_TYPE structure to determine the specific RGB type.
/// </summary>
public uint Compression;
/// <summary>
/// Specifies the size, in bytes, of the image. This can be set to 0 for uncompressed
/// RGB bitmaps.
/// </summary>
public uint SizeImage;
/// <summary>
/// Specifies the horizontal resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int XPelsPerMeter;
/// <summary>
/// Specifies the vertical resolution, in pixels per meter, of the target device for
/// the bitmap.
/// </summary>
public int YPelsPerMeter;
/// <summary>
/// Specifies the number of color indices in the color table that are actually used by
/// the bitmap.
/// </summary>
public uint ClrUsed;
/// <summary>
/// Specifies the number of color indices that are considered important for displaying
/// the bitmap. If this value is zero, all colors are important.
/// </summary>
public uint ClrImportant;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class AmbientIndexLump : Lump
{
/// <summary>
/// Indicies
/// </summary>
public LeafAmbientIndex[]? Indicies { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class AmbientLightingLump : Lump
{
/// <summary>
/// Lightings
/// </summary>
public LeafAmbientLighting[]? Lightings { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The brush lump (Lump 18) contains all brushes that were
/// present in the original VMF file before compiling.
/// Unlike faces, brushes are constructive solid geometry (CSG)
/// defined by planes instead of edges and vertices. It is the
/// presence of the brush and brushside lumps in Source BSP
/// files that makes decompiling them a much easier job than
/// for GoldSrc files, which lacked this info.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Brush
{
/// <summary>
/// First brushside
/// </summary>
public int FirstSide;
/// <summary>
/// Number of brushsides
/// </summary>
public int NumSides;
/// <summary>
/// Contents flags
/// </summary>
public VbspContents Contents;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class BrushesLump : Lump
{
/// <summary>
/// Brushes
/// </summary>
public Brush[]? Brushes { get; set; }
}
}

View File

@@ -1,48 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Planenum is an index info the plane array, giving the plane
/// corresponding to this brushside. Texinfo and dispinfo are
/// references into the texture and displacement info lumps.
/// Bevel is zero for normal brush sides, but 1 if the side is
/// a bevel plane (which seem to be used for collision detection).
///
/// Unlike the face array, brushsides are not culled (removed)
/// where they touch the void. Void-facing sides do however have
/// their texinfo entry changed to the tools/toolsnodraw texture
/// during the compile process. Note there is no direct way of
/// linking brushes and brushsides and the corresponding face array
/// entries which are used to render that brush. Brushsides are
/// used by the engine to calculate all player physics collision
/// with world brushes. (Vphysics objects use lump 29 instead.)
///
/// The maximum number of brushsides is 65536 (MAX_MAP_BRUSHSIDES).
/// The maximum number of brushsides on a single brush is 128 (MAX_BRUSH_SIDES).
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Brushside
{
/// <summary>
/// Facing out of the leaf
/// </summary>
public ushort PlaneNum;
/// <summary>
/// Texture info
/// </summary>
public short TextureInfo;
/// <summary>
/// Displacement info
/// </summary>
public short DisplacementInfo;
/// <summary>
/// Is the side a bevel plane?
/// </summary>
public short Bevel;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class BrushsidesLump : Lump
{
/// <summary>
/// Brushsides
/// </summary>
public Brushside[]? Brushsides { get; set; }
}
}

View File

@@ -1,66 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The face lump contains the surfaces of the scene.
///
/// The first number of this data structure is an index into
/// the planes lump giving a plane which is parallel to this
/// face (meaning they share the same normal). The second
/// value may be seen as a boolean. If nPlaneSide equals 0,
/// then the normal vector of this face equals the one of the
/// parallel plane exactly. Otherwise, the normal of the plane
/// has to be multiplied by -1 to point into the right direction.
/// Afterwards we have an index into the surfedges lump, as
/// well as the count of consecutive surfedges from that position.
/// Furthermore there is an index into the texture info lump,
/// which is used to find the BSPTEXINFO structure needed to
/// calculate the texture coordinates for this face. Afterwards,
/// there are four bytes giving some lighting information (partly
/// used by the renderer to hide sky surfaces). Finally we have
/// an offset in byes giving the beginning of the binary lightmap
/// data of this face in the lighting lump.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspFace
{
/// <summary>
/// Plane the face is parallel to
/// </summary>
public ushort PlaneIndex;
/// <summary>
/// Set if different normals orientation
/// </summary>
public ushort PlaneSideCount;
/// <summary>
/// Index of the first surfedge
/// </summary>
public uint FirstEdgeIndex;
/// <summary>
/// Number of consecutive surfedges
/// </summary>
public ushort NumberOfEdges;
/// <summary>
/// Index of the texture info structure
/// </summary>
public ushort TextureInfoIndex;
/// <summary>
/// Specify lighting styles
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? LightingStyles = new byte[4];
/// <summary>
/// Offsets into the raw lightmap data; if less than zero,
/// then a lightmap was not baked for the given face.
/// </summary>
public int LightmapOffset;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspFacesLump : Lump
{
/// <summary>
/// Faces
/// </summary>
public BspFace[]? Faces { get; set; }
}
}

View File

@@ -1,94 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// Half-Life Level
/// </summary>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspFile
{
/// <summary>
/// Header data
/// </summary>
public BspHeader? Header { get; set; }
#region Lumps
/// <summary>
/// LUMP_ENTITIES [0]
/// </summary>
public EntitiesLump? Entities { get; set; }
/// <summary>
/// LUMP_PLANES [1]
/// </summary>
public PlanesLump? PlanesLump { get; set; }
/// <summary>
/// LUMP_TEXTURES [2]
/// </summary>
public TextureLump? TextureLump { get; set; }
/// <summary>
/// LUMP_VERTICES [3]
/// </summary>
public VerticesLump? VerticesLump { get; set; }
/// <summary>
/// LUMP_VISIBILITY [4]
/// </summary>
public VisibilityLump? VisibilityLump { get; set; }
/// <summary>
/// LUMP_NODES [5]
/// </summary>
public BspNodesLump? NodesLump { get; set; }
/// <summary>
/// LUMP_TEXINFO [6]
/// </summary>
public BspTexinfoLump? TexinfoLump { get; set; }
/// <summary>
/// LUMP_FACES [7]
/// </summary>
public BspFacesLump? FacesLump { get; set; }
/// <summary>
/// LUMP_LIGHTING [8]
/// </summary>
public LightmapLump? LightmapLump { get; set; }
/// <summary>
/// LUMP_CLIPNODES [9]
/// </summary>s
public ClipnodesLump? ClipnodesLump { get; set; }
/// <summary>
/// LUMP_LEAVES [10]
/// </summary>
public BspLeavesLump? LeavesLump { get; set; }
/// <summary>
/// LUMP_MARKSURFACES [11]
/// </summary>
public MarksurfacesLump? MarksurfacesLump { get; set; }
/// <summary>
/// LUMP_EDGES [12]
/// </summary>
public EdgesLump? EdgesLump { get; set; }
/// <summary>
/// LUMP_SURFEDGES [13]
/// </summary>
public SurfedgesLump? SurfedgesLump { get; set; }
/// <summary>
/// LUMP_MODELS [14]
/// </summary>
public BspModelsLump? ModelsLump { get; set; }
#endregion
}
}

View File

@@ -1,23 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspHeader
{
/// <summary>
/// Version
/// </summary>
/// <remarks>Must be 30 for a valid HL BSP file</remarks>
public int Version;
/// <summary>
/// Lumps
/// </summary>
/// <remarks>15 entries</remarks>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.BSP_HEADER_LUMPS)]
public BspLumpEntry[]? Lumps;
}
}

View File

@@ -1,67 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The leaves lump contains the leaves of the BSP tree.
///
/// The first entry of this struct is the type of the content
/// of this leaf. It can be one of the predefined values, found
/// in the compiler source codes, and is litte relevant for the
/// actual rendering process. All the more important is the
/// next integer containing the offset into the vis lump. It
/// defines the start of the raw PVS data for this leaf. If this
/// value equals -1, no VIS lists are available for this leaf,
/// usually if the map has been built without the VIS compiler.
/// The next two 16bit integer triples span the bounding box of
/// this leaf. Furthermore, the struct contains an index pointing
/// into the array of marksurfaces loaded from the marksufaces
/// lump as well as the number of consecutive marksurfaces belonging
/// to this leaf. The marksurfaces are looped through during the
/// rendering process and point to the actual faces. The final 4 bytes
/// specify the volume of ambient sounds in Quake, but are unused in
/// GoldSrc.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspLeaf
{
/// <summary>
/// Contents enumeration
/// </summary>
public BspContents Contents;
/// <summary>
/// Offset into the visibility lump
/// </summary>
public int VisOffset;
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public short[] Mins = new short[3];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public short[] Maxs = new short[3];
/// <summary>
/// Index into marksurfaces array
/// </summary>
public ushort FirstMarkSurfaceIndex;
/// <summary>
/// Count of marksurfaces array
/// </summary>
public ushort MarkSurfacesCount;
/// <summary>
/// Ambient sound levels
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public byte[]? AmbientLevels = new byte[4];
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspLeavesLump : Lump
{
/// <summary>
/// Leaves
/// </summary>
public BspLeaf[]? Leaves { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public class BspLumpEntry
{
/// <summary>
/// File offset to data
/// </summary>
public int Offset;
/// <summary>
/// Length of data
/// </summary>
public int Length;
}
}

View File

@@ -1,63 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// A model is kind of a mini BSP tree. Its size is determinded
/// by the bounding box spaned by the first to members of this
/// struct. The major difference between a model and the BSP
/// tree holding the scene is that the models use a local
/// coordinate system for their vertexes and just state its
/// origin in world coordinates. During rendering the coordinate
/// system is translated to the origin of the model (glTranslate())
/// and moved back after the models BSP tree has been traversed.
/// Furthermore their are 4 indexes into node arrays. The first
/// one has proofed to index the root node of the mini BSP tree
/// used for rendering. The other three indexes could probably be
/// used for collision detection, meaning they point into the
/// clipnodes, but I am not sure about this. The meaning of the
/// next value is also somehow unclear to me. Finally their are
/// direct indexes into the faces array, not taking the redirecting
/// by the marksurfaces.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspModel
{
/// <summary>
/// Defines bounding box
/// </summary>
public Vector3D? Mins;
/// <summary>
/// Defines bounding box
/// </summary>
public Vector3D? Maxs;
/// <summary>
/// Coordinates to move the coordinate system
/// </summary>
public Vector3D? OriginVector;
/// <summary>
/// Index into nodes array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MAX_MAP_HULLS)]
public int[]? HeadnodesIndex = new int[Constants.MAX_MAP_HULLS];
/// <summary>
/// ???
/// </summary>
public int VisLeafsCount;
/// <summary>
/// Index into faces
/// </summary>
public int FirstFaceIndex;
/// <summary>
/// Count of faces
/// </summary>
public int FacesCount;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspModelsLump : Lump
{
/// <summary>
/// Model
/// </summary>
public BspModel[]? Models { get; set; }
}
}

View File

@@ -1,62 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// This lump is simple again and contains an array of binary
/// structures, the nodes, which are a major part of the BSP tree.
///
/// Every BSPNODE structure represents a node in the BSP tree and
/// every node equals more or less a division step of the BSP algorithm.
/// Therefore, each node has an index (iPlane) referring to a plane
/// in the plane lump which devides the node into its two child nodes.
/// The childnodes are also stored as indexes. Contrary to the plane
/// index, the node index for the child is signed. If the index is
/// larger than 0, the index indicates a child node. If it is equal
/// to or smaller than zero (no valid array index), the bitwise
/// inversed value of the index gives an index into the leaves lump.
/// Additionally two points (nMins, nMaxs) span the bounding box
/// (AABB, axis aligned bounding box) delimitting the space of the node.
/// Finally firstFace indexes into the face lump and spezifies the
/// first of nFaces surfaces contained in this node.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public class BspNode
{
/// <summary>
/// Index into Planes lump
/// </summary>
public uint PlaneIndex;
/// <summary>
/// If > 0, then indices into Nodes.
/// Otherwise bitwise inverse indices into Leafs
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public ushort[] Children = new ushort[2];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public ushort[] Mins = new ushort[3];
/// <summary>
/// Defines bounding box
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public ushort[] Maxs = new ushort[3];
/// <summary>
/// Index into Faces
/// </summary>
public ushort FirstFace;
/// <summary>
/// Count of Faces
/// </summary>
public ushort FaceCount;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspNodesLump : Lump
{
/// <summary>
/// Nodes
/// </summary>
public BspNode[]? Nodes { get; set; }
}
}

View File

@@ -1,52 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The texinfo lump contains informations about how textures are
/// applied to surfaces. The lump itself is an array of binary data
/// structures.
///
/// This struct is mainly responsible for the calculation of the texture
/// coordinates (vS, fSShift, vT, fTShift). This values determine the
/// position of the texture on the surface. The iMiptex integer refers
/// to the textures in the texture lump and would be the index in an
/// array of BSPMITEX structs. Finally, there are 4 Bytes used for flags.
/// Only one flag is used by the vanilla engine, being 0x1 for disabling
/// lightmaps and subdivision for the surface (used by sky and liquids).
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class BspTexinfo
{
/// <summary>
/// S-vector
/// </summary>
public Vector3D? SVector;
/// <summary>
/// Texture shift in the S direction
/// </summary>
public float TextureSShift;
/// <summary>
/// T-vector
/// </summary>
public Vector3D? TVector;
/// <summary>
/// Texture shift in the T direction
/// </summary>
public float TextureTShift;
/// <summary>
/// Index into textures array
/// </summary>
public uint MiptexIndex;
/// <summary>
/// Texture flags
/// </summary>
public TextureFlag Flags;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class BspTexinfoLump : Lump
{
/// <summary>
/// Texinfos
/// </summary>
public BspTexinfo[]? Texinfos { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L600"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispCornerNeighbors
{
/// <summary>
/// Indices of neighbors.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public ushort[] Neighbors = new ushort[4];
public byte NeighborCount;
}
}

View File

@@ -1,12 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L583"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispNeighbor
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public CDispSubNeighbor[]? SubNeighbors = new CDispSubNeighbor[2];
}
}

View File

@@ -1,32 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <see href="https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/sp/src/public/bspfile.h#L557"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class CDispSubNeighbor
{
/// <summary>
/// This indexes into ddispinfos.
/// </summary>
/// <remarks>0xFFFF if there is no neighbor here.</remarks>
public ushort NeighborIndex;
/// <summary>
/// (CCW) rotation of the neighbor wrt this displacement.
/// </summary>
public byte NeighborOrientation;
// These use the NeighborSpan type.
/// <summary>
/// Where the neighbor fits onto this side of our displacement.
/// </summary>
public byte Span;
/// <summary>
/// Where we fit onto our neighbor.
/// </summary>
public byte NeighborSpan;
}
}

View File

@@ -1,28 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// This lump contains the so-called clipnodes, which build a second
/// BSP tree used only for collision detection.
///
/// This structure is a reduced form of the BSPNODE struct from the
/// nodes lump. Also the BSP tree built by the clipnodes is simpler
/// than the one described by the BSPNODEs to accelerate collision calculations.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Clipnode
{
/// <summary>
/// Index into planes
/// </summary>
public int PlaneIndex;
/// <summary>
/// Negative numbers are contents
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public short[]? ChildrenIndices = new short[2];
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class ClipnodesLump : Lump
{
/// <summary>
/// Clipnodes
/// </summary>
public Clipnode[]? Clipnodes { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// 4-byte lightmap structure
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public class ColorRGBExp32
{
public byte Red;
public byte Green;
public byte Blue;
public sbyte Exponent;
}
}

View File

@@ -1,16 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The lighting data for each sample is represented by an array
/// of 6 ColorRGBExp32
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public class CompressedLightCube
{
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public ColorRGBExp32[]? Colors;
}
}

View File

@@ -1,100 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public static class Constants
{
#region Header
/// <summary>
/// Number of lumps in a BSP
/// </summary>
public const int BSP_HEADER_LUMPS = 15;
/// <summary>
/// Number of lumps in a VBSP
/// </summary>
public const int VBSP_HEADER_LUMPS = 64;
#endregion
#region Lump
public const int MAX_MAP_HULLS = 4;
public const int MAX_MAP_MODELS = 400;
public const int MAX_MAP_BRUSHES = 4096;
public const int MAX_MAP_ENTITIES = 1024;
public const int MAX_MAP_ENTSTRING = (128 * 1024);
public const int MAX_MAP_PLANES = 32767;
public const int MAX_MAP_NODES = 32767;
public const int MAX_MAP_CLIPNODES = 32767;
public const int MAX_MAP_LEAFS = 8192;
public const int MAX_MAP_VERTS = 65535;
public const int MAX_MAP_FACES = 65535;
public const int MAX_MAP_MARKSURFACES = 65535;
public const int MAX_MAP_TEXINFO = 8192;
public const int MAX_MAP_EDGES = 256000;
public const int MAX_MAP_SURFEDGES = 512000;
public const int MAX_MAP_TEXTURES = 512;
public const int MAX_MAP_MIPTEX = 0x200000;
public const int MAX_MAP_LIGHTING = 0x200000;
public const int MAX_MAP_VISIBILITY = 0x200000;
public const int MAX_MAP_PORTALS = 65536;
#endregion
#region Entities
public const int MAX_KEY = 32;
public const int MAX_VALUE = 1024;
#endregion
#region Textures
public const int MAXTEXTURENAME = 16;
public const int MIPLEVELS = 4;
#endregion
#region VBSP
public static readonly byte[] SignatureBytes = [0x56, 0x42, 0x53, 0x50];
public const string SignatureString = "VBSP";
public const uint SignatureUInt32 = 0x50534256;
#endregion
#region LZMA
public static readonly byte[] LzmaHeaderBytes = [0x4C, 0x5A, 0x4D, 0x41];
public const string LzmaHeaderString = "LZMA";
public const uint LzmaHeaderUInt32 = 0x414D5A4C;
#endregion
#region Overlay
public const int OVERLAY_BSP_FACE_COUNT = 64;
#endregion
#region Worldlights
/// <summary>
/// This says that the light was put into the per-leaf ambient cubes.
/// </summary>
public const int DWL_FLAGS_INAMBIENTCUBE = 0x0001;
#endregion
}
}

View File

@@ -1,50 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The dcubemapsample_t structure defines the location of a
/// env_cubemap entity in the map. The origin member contains
/// integer x,y,z coordinates of the cubemap, and the size member
/// is resolution of the cubemap, specified as 2^(size-1) pixels
/// square. If set as 0, the default size of 6 (32x32 pixels) is
/// used. There can be a maximum of 1024 (MAX_MAP_CUBEMAPSAMPLES)
/// cubemaps in a file.
///
/// When the "buildcubemaps" console command is performed, six
/// snapshots of the map (one for each direction) are taken at the
/// location of each env_cubemap entity. These snapshots are stored
/// in a multi-frame texture (vtf) file, which is added to the
/// Pakfile lump (see above). The textures are named cX_Y_Z.vtf,
/// where (X,Y,Z) are the (integer) coordinates of the corresponding
/// cubemap.
///
/// Faces containing materials that are environment mapped (e.g.
/// shiny textures) reference their assigned cubemap through their
/// material name. A face with a material named (e.g.) walls/shiny.vmt
/// is altered (new Texinfo & Texdata entries are created) to refer
/// to a renamed material maps/mapname/walls/shiny_X_Y_Z.vmt, where
/// (X,Y,Z) are the cubemap coordinates as before. This .vmt file
/// is also stored in the Pakfile, and references the cubemap .vtf
/// file through its $envmap property.
///
/// Version 20 files contain extra cX_Y_Z.hdr.vtf files in the
/// Pakfile lump, containing HDR texture files in RGBA16161616F
/// (16-bit per channel) format.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Cubemap
{
/// <summary>
/// Position of light snapped to the nearest integer
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public int[]? Origin = new int[3];
/// <summary>
/// Resolution of cubemap, 0 - default
/// </summary>
public int Size;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class CubemapsLump : Lump
{
/// <summary>
/// Cubemaps
/// </summary>
public Cubemap[]? Cubemaps { get; set; }
}
}

View File

@@ -1,93 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The structure is 176 bytes long. The startPosition element is the
/// coordinates of the first corner of the displacement. DispVertStart
/// and DispTriStart are indices into the DispVerts and DispTris lumps.
/// The power entry gives the number of subdivisions in the displacement
/// surface - allowed values are 2, 3 and 4, and these correspond to 4,
/// 8 and 16 subdivisions on each side of the displacement surface.
/// The structure also references any neighbouring displacements on the
/// sides or the corners of this displacement through the EdgeNeighbors
/// and CornerNeighbors members. There are complex rules governing the
/// order that these neighbour displacements are given; see the comments
/// in bspfile.h for more. The MapFace value is an index into the face
/// array and is face that was turned into a displacement surface.
/// This face is used to set the texture and overall physical location
/// and boundaries of the displacement.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DispInfo
{
/// <summary>
/// Start position used for orientation
/// </summary>
public Vector3D? StartPosition;
/// <summary>
/// Index into LUMP_DISP_VERTS.
/// </summary>
public int DispVertStart;
/// <summary>
/// Index into LUMP_DISP_TRIS.
/// </summary>
public int DispTriStart;
/// <summary>
/// Power - indicates size of surface (2^power 1)
/// </summary>
public int Power;
/// <summary>
/// Minimum tesselation allowed
/// </summary>
public int MinTess;
/// <summary>
/// Lighting smoothing angle
/// </summary>
public float SmoothingAngle;
/// <summary>
/// Surface contents
/// </summary>
public int Contents;
/// <summary>
/// Which map face this displacement comes from.
/// </summary>
public ushort MapFace;
/// <summary>
/// Index into ddisplightmapalpha.
/// </summary>
public int LightmapAlphaStart;
/// <summary>
/// Index into LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS.
/// </summary>
public int LightmapSamplePositionStart;
/// <summary>
/// Indexed by NEIGHBOREDGE_ defines.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public CDispNeighbor[]? EdgeNeighbors = new CDispNeighbor[4];
/// <summary>
/// Indexed by CORNER_ defines.
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public CDispCornerNeighbors[]? CornerNeighbors = new CDispCornerNeighbors[4];
/// <summary>
/// Active verticies
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public uint[]? AllowedVerts = new uint[10];
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class DispInfosLump : Lump
{
/// <summary>
/// Infos
/// </summary>
public DispInfo[]? Infos { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// he DispTris lump (Lump 48) contains "triangle tags" or flags
/// related to the properties of a particular triangle in the
/// displacement mesh.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DispTri
{
/// <summary>
/// Displacement triangle tags.
/// </summary>
public DispTriTag Tags;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class DispTrisLump : Lump
{
/// <summary>
/// Tris
/// </summary>
public DispTri[]? Tris { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The DispVerts lump (Lump 33) contains the vertex data of the displacements.
/// vec is the normalized vector of the offset of each displacement vertex from
/// its original (flat) position; dist is the distance the offset has taken
/// place; and alpha is the alpha-blending of the texture at that vertex.
///
/// A displacement of power p references (2^p + 1)^2 dispverts in the array,
/// starting from the DispVertStart index.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class DispVert
{
/// <summary>
/// Vector field defining displacement volume.
/// </summary>
public Vector3D? Vec;
/// <summary>
/// Displacement distances.
/// </summary>
public float Dist;
/// <summary>
/// "Per vertex" alpha values.
/// </summary>
public float Alpha;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class DispVertsLump : Lump
{
/// <summary>
/// Verts
/// </summary>
public DispVert[]? Verts { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The edges delimit the face and further refer to the vertices of the
/// face. Each edge is pointing to the start and end vertex of the edge.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Edge
{
/// <summary>
/// Indices into vertex array
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public ushort[]? VertexIndices = new ushort[2];
}
}

View File

@@ -1,12 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class EdgesLump : Lump
{
/// <summary>
/// Edge
/// </summary>
public Edge[]? Edges { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class EntitiesLump : Lump
{
/// <summary>
/// Entities
/// </summary>
public Entity[]? Entities { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
using System.Collections.Generic;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The entity lump is basically a pure ASCII text section.
/// It consists of the string representations of all entities,
/// which are copied directly from the input file to the output
/// BSP file by the compiler.
///
/// Every entity begins and ends with curly brackets. In between
/// there are the attributes of the entity, one in each line,
/// which are pairs of strings enclosed by quotes. The first
/// string is the name of the attribute (the key), the second one
/// its value. The attribute "classname" is mandatory for every
/// entity specifiying its type and therefore, how it is
/// interpreted by the engine.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class Entity
{
/// <summary>
/// Entity attributes
/// </summary>
public List<KeyValuePair<string, string>>? Attributes { get; set; }
}
}

View File

@@ -1,926 +0,0 @@
using System;
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public enum BspContents : int
{
CONTENTS_EMPTY = -1,
CONTENTS_SOLID = -2,
CONTENTS_WATER = -3,
CONTENTS_SLIME = -4,
CONTENTS_LAVA = -5,
CONTENTS_SKY = -6,
CONTENTS_ORIGIN = -7,
CONTENTS_CLIP = -8,
CONTENTS_CURRENT_0 = -9,
CONTENTS_CURRENT_90 = -10,
CONTENTS_CURRENT_180 = -11,
CONTENTS_CURRENT_270 = -12,
CONTENTS_CURRENT_UP = -13,
CONTENTS_CURRENT_DOWN = -14,
CONTENTS_TRANSLUCENT = -15,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_flags_(Source)"/>
[Flags]
public enum VbspContents : uint
{
/// <summary>
/// No contents
/// </summary>
CONTENTS_EMPTY = 0x00000000,
/// <summary>
/// An eye is never valid in a solid
/// </summary>
CONTENTS_SOLID = 0x00000001,
/// <summary>
/// Translucent, but not watery (glass)
/// </summary>
CONTENTS_WINDOW = 0x00000002,
/// <summary>
/// Unused
/// </summary>
CONTENTS_AUX = 0x00000004,
/// <summary>
/// Alpha-tested "grate" textures. Bullets/sight pass through,
/// but solids don't
/// </summary>
CONTENTS_GRATE = 0x00000008,
/// <summary>
/// Set via %CompileSlime. Unlike Quake II, slime does not do
/// damage; a separate trigger_hurt should be used for this.
/// </summary>
CONTENTS_SLIME = 0x00000010,
/// <summary>
/// Set via %CompileWater.
/// </summary>
CONTENTS_WATER = 0x00000020,
/// <summary>
/// Unknown purpose; only set by %CompilePlayerControlClip.
/// </summary>
CONTENTS_MIST = 0x00000040,
/// <summary>
/// Block AI line of sight
/// </summary>
CONTENTS_BLOCKLOS = 0x00000040,
/// <summary>
/// Things that cannot be seen through (may be non-solid though)
/// </summary>
CONTENTS_OPAQUE = 0x00000080,
/// <summary>
/// Unknown
/// </summary>
CONTENTS_TESTFOGVOLUME = 0x00000100,
/// <summary>
/// Unused
/// </summary>
CONTENTS_UNUSED = 0x00000200,
/// <summary>
/// Unused
/// </summary>
CONTENTS_UNUSED6 = 0x00000400,
/// <summary>
/// If it's visible, grab from the top + update LAST_VISIBLE_CONTENTS
/// if not visible, then grab from the bottom.
/// </summary>
CONTENTS_BLOCKLIGHT = 0x00000400,
/// <summary>
/// Per team contents used to differentiate collisions
/// between players and objects on different teams
/// </summary>
CONTENTS_TEAM1 = 0x00000800,
/// <summary>
/// Per team contents used to differentiate collisions
/// between players and objects on different teams
/// </summary>
CONTENTS_TEAM2 = 0x00001000,
/// <summary>
/// Ignore CONTENTS_OPAQUE on surfaces that have SURF_NODRAW
/// </summary>
CONTENTS_IGNORE_NODRAW_OPAQUE = 0x00002000,
/// <summary>
/// Hits entities which are MOVETYPE_PUSH (doors, plats, etc.)
/// </summary>
CONTENTS_MOVEABLE = 0x00004000,
/// <summary>
/// Is an areaportal.
/// </summary>
CONTENTS_AREAPORTAL = 0x00008000,
/// <summary>
/// Solid to players, including bots.
/// </summary>
CONTENTS_PLAYERCLIP = 0x00010000,
/// <summary>
/// Solid to monsters, better known in Source as NPCs. Also solid
/// to bots in CSGO, even though they are players.
/// </summary>
CONTENTS_MONSTERCLIP = 0x00020000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_0 = 0x00040000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_90 = 0x00080000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_180 = 0x00100000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_270 = 0x00200000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_UP = 0x00400000,
/// <summary>
/// Currents can be added to any other contents, and may be mixed
/// </summary>
CONTENTS_CURRENT_DOWN = 0x00800000,
/// <summary>
/// Unknown
/// </summary>
CONTENTS_BRUSH_PAINT = 0x00040000,
/// <summary>
/// Unknown
/// </summary>
CONTENTS_GRENADECLIP = 0x00080000,
/// <summary>
/// Unknown
/// </summary>
CONTENTS_DRONECLIP = 0x00100000,
/// <summary>
/// Removed before bsping an entity
/// </summary>
CONTENTS_ORIGIN = 0x01000000,
/// <summary>
/// Should never be on a brush, only in game
/// </summary>
CONTENTS_MONSTER = 0x02000000,
/// <summary>
/// Solid to point traces (ex hitscan weapons) and non-debris
/// physics objects[confirm]. Non-solid to QPhysics entities,
/// such as players.
/// </summary>
CONTENTS_DEBRIS = 0x04000000,
/// <summary>
/// Brushes to be added after vis leafs
/// </summary>
CONTENTS_DETAIL = 0x08000000,
/// <summary>
/// Auto set if any surface has trans
/// </summary>
CONTENTS_TRANSLUCENT = 0x10000000,
/// <summary>
/// Is a ladder
/// </summary>
CONTENTS_LADDER = 0x20000000,
/// <summary>
/// Use accurate hitboxes on trace
/// </summary>
CONTENTS_HITBOX = 0x40000000,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[Flags]
public enum DispTriTag : ushort
{
DISPTRI_TAG_SURFACE = 0x01,
DISPTRI_TAG_WALKABLE = 0x02,
DISPTRI_TAG_BUILDABLE = 0x04,
DISPTRI_FLAG_SURFPROP1 = 0x08,
DISPTRI_FLAG_SURFPROP2 = 0x10,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public enum EmitType
{
/// <summary>
/// 90 degree spotlight
/// </summary>
EMIT_SURFACE,
/// <summary>
/// Simple point light source
/// </summary>
EMIT_POINT,
/// <summary>
/// Spotlight with penumbra
/// </summary>
EMIT_SPOTLIGHT,
/// <summary>
/// Directional light with no falloff
/// (surface must trace to SKY texture)
/// </summary>
EMIT_SKYLIGHT,
/// <summary>
/// Linear falloff, non-lambertian
/// </summary>
EMIT_QUAKELIGHT,
/// <summary>
/// Spherical light source with no falloff
/// (surface must trace to SKY texture)
/// </summary>
EMIT_SKYAMBIENT,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public enum LumpType : int
{
#region BSP and VBSP
/// <summary>
/// The entity lump is basically a pure ASCII text section.
/// It consists of the string representations of all entities,
/// which are copied directly from the input file to the output
/// BSP file by the compiler.
/// </summary>
LUMP_ENTITIES = 0,
/// <summary>
/// This lump is a simple array of binary data structures.
/// Each of this structures defines a plane in 3-dimensional
/// space by using the Hesse normal form
/// </summary>
LUMP_PLANES = 1,
/// <summary>
/// The texture lump is somehow a bit more complex then the
/// other lumps, because it is possible to save textures
/// directly within the BSP file instead of storing them in
/// external WAD files.
/// </summary>
/// <remarks>LUMP_TEXDATA in VBSP</remarks>
LUMP_TEXTURES = 2,
/// <summary>
/// This lump simply consists of all vertices of the BSP tree.
/// They are stored as a primitve array of triples of floats.
/// </summary>
/// <remarks>LUMP_VERTEXES in VBSP</remarks>
LUMP_VERTICES = 3,
/// <summary>
/// The VIS lump contains data, which is irrelevant to the actual
/// BSP tree, but offers a way to boost up the speed of the
/// renderer significantly. Especially complex maps profit from
/// the use if this data. This lump contains the so-called
/// Potentially Visible Sets (PVS) (also called VIS lists) in the
/// same amout of leaves of the tree, the user can enter (often
/// referred to as VisLeaves). The visiblilty lists are stored as
/// sequences of bitfields, which are run-length encoded.
/// </summary>
LUMP_VISIBILITY = 4,
/// <summary>
/// This lump is simple again and contains an array of binary
/// structures, the nodes, which are a major part of the BSP tree.
/// </summary>
LUMP_NODES = 5,
/// <summary>
/// The texinfo lump contains informations about how textures are
/// applied to surfaces. The lump itself is an array of binary data
/// structures.
/// </summary>
LUMP_TEXINFO = 6,
/// <summary>
/// The face lump contains the surfaces of the scene.
/// </summary>
LUMP_FACES = 7,
/// <summary>
/// This is one of the largest lumps in the BSP file. The lightmap
/// lump stores all lightmaps used in the entire map. The lightmaps
/// are arrays of triples of bytes (3 channel color, RGB) and stored
/// continuously.
/// </summary>
LUMP_LIGHTING = 8,
/// <summary>
/// This lump contains the so-called clipnodes, which build a second
/// BSP tree used only for collision detection.
/// </summary>
/// <remarks>LUMP_OCCLUSION in VBSP</remarks>
LUMP_CLIPNODES = 9,
/// <summary>
/// The leaves lump contains the leaves of the BSP tree.
/// </summary>
/// <remarks>LUMP_LEAFS in VBSP</remarks>
LUMP_LEAVES = 10,
/// <summary>
/// The marksurfaces lump is a simple array of short integers.
/// </summary>
/// <remarks>LUMP_FACEIDS in VBSP</remarks>
LUMP_MARKSURFACES = 11,
/// <summary>
/// The edges delimit the face and further refer to the vertices of the
/// face. Each edge is pointing to the start and end vertex of the edge.
/// </summary>
LUMP_EDGES = 12,
/// <summary>
/// This lump represents pretty much the same mechanism as the marksurfaces.
/// A face can insert its surfedge indexes into this array to get the
/// corresponding edges delimitting the face and further pointing to the
/// vertexes, which are required for rendering. The index can be positive
/// or negative. If the value of the surfedge is positive, the first vertex
/// of the edge is used as vertex for rendering the face, otherwise, the
/// value is multiplied by -1 and the second vertex of the indexed edge is
/// used.
/// </summary>
LUMP_SURFEDGES = 13,
/// <summary>
/// A model is kind of a mini BSP tree. Its size is determinded by the
/// bounding box spaned by the first to members of this struct.
/// </summary>
LUMP_MODELS = 14,
#endregion
#region VBSP Only
/// <summary>
/// Internal world lights converted from the entity lump
/// </summary>
LUMP_WORLDLIGHTS = 15,
/// <summary>
/// Index to faces in each leaf
/// </summary>
LUMP_LEAFFACES = 16,
/// <summary>
/// Index to brushes in each leaf
/// </summary>
LUMP_LEAFBRUSHES = 17,
/// <summary>
/// Brush array
/// </summary>
LUMP_BRUSHES = 18,
/// <summary>
/// Brushside array
/// </summary>
LUMP_BRUSHSIDES = 19,
/// <summary>
/// Area array
/// </summary>
LUMP_AREAS = 20,
/// <summary>
/// Portals between areas
/// </summary>
LUMP_AREAPORTALS = 21,
/// <remarks>Source 2004</remarks>
LUMP_PORTALS = 22,
/// <summary>
/// Unused
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_UNUSED0 = 22,
/// <summary>
/// Static props convex hull lists
/// </summary>
/// <remarks>Source (L4D2 Branch)</remarks>
LUMP_PROPCOLLISION = 22,
/// <summary>
/// Leaves that are enterable by the player
/// </summary>
/// <remarks>Source 2004</remarks>
LUMP_CLUSTERS = 23,
/// <summary>
/// Unused
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_UNUSED1 = 23,
/// <summary>
/// Static prop convex hulls
/// </summary>
/// <remarks>Source (L4D2 Branch)</remarks>
LUMP_PROPHULLS = 23,
/// <summary>
/// Vertices of portal polygons
/// </summary>
/// <remarks>Source 2004</remarks>
LUMP_PORTALVERTS = 24,
/// <summary>
/// Unused
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_UNUSED2 = 24,
/// <summary>
/// Used to store client side entities (Similar to Lump #0)
/// </summary>
/// <remarks>Source (TacInt branch)</remarks>
LUMP_FAKEENTITIES = 24,
/// <summary>
/// Static prop collision vertices
/// </summary>
/// <remarks>Source (L4D2 Branch)</remarks>
LUMP_PROPHULLVERTS = 24,
/// <remarks>Source 2004</remarks>
LUMP_CLUSTERPORTALS = 25,
/// <summary>
/// Unused
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_UNUSED3 = 25,
/// <summary>
/// Static prop per hull triangle index start/count
/// </summary>
/// <remarks>Source (L4D2 Branch)</remarks>
LUMP_PROPTRIS = 25,
/// <summary>
/// Displacement surface array
/// </summary>
LUMP_DISPINFO = 26,
/// <summary>
/// Brush faces array before splitting
/// </summary>
LUMP_ORIGINALFACES = 27,
/// <summary>
/// Displacement physics collision data
/// </summary>
LUMP_PHYSDISP = 28,
/// <summary>
/// Physics collision data
/// </summary>
LUMP_PHYSCOLLIDE = 29,
/// <summary>
/// Face plane normals
/// </summary>
LUMP_VERTNORMALS = 30,
/// <summary>
/// Face plane normal index array
/// </summary>
LUMP_VERTNORMALINDICES = 31,
/// <summary>
/// Displacement lightmap alphas (unused/empty since Source 2006)
/// </summary>
LUMP_DISP_LIGHTMAP_ALPHAS = 32,
/// <summary>
/// Vertices of displacement surface meshes
/// </summary>
LUMP_DISP_VERTS = 33,
/// <summary>
/// Displacement lightmap sample positions
/// </summary>
LUMP_DISP_LIGHTMAP_SAMPLE_POSITIONS = 34,
/// <summary>
/// Game-specific data lump
/// </summary>
LUMP_GAME_LUMP = 35,
/// <summary>
/// Data for leaf nodes that are inside water
/// </summary>
LUMP_LEAFWATERDATA = 36,
/// <summary>
/// Water polygon data
/// </summary>
LUMP_PRIMITIVES = 37,
/// <summary>
/// Water polygon vertices
/// </summary>
LUMP_PRIMVERTS = 38,
/// <summary>
/// Water polygon vertex index array
/// </summary>
LUMP_PRIMINDICES = 39,
/// <summary>
/// Embedded uncompressed or LZMA-compressed Zip-format file
/// </summary>
LUMP_PAKFILE = 40,
/// <summary>
/// Clipped portal polygon vertices
/// </summary>
LUMP_CLIPPORTALVERTS = 41,
/// <summary>
/// env_cubemap location array
/// </summary>
LUMP_CUBEMAPS = 42,
/// <summary>
/// Texture name data
/// </summary>
LUMP_TEXDATA_STRING_DATA = 43,
/// <summary>
/// Index array into texdata string data
/// </summary>
LUMP_TEXDATA_STRING_TABLE = 44,
/// <summary>
/// info_overlay data array
/// </summary>
LUMP_OVERLAYS = 45,
/// <summary>
/// Distance from leaves to water
/// </summary>
LUMP_LEAFMINDISTTOWATER = 46,
/// <summary>
/// Macro texture info for faces
/// </summary>
LUMP_FACE_MACRO_TEXTURE_INFO = 47,
/// <summary>
/// Displacement surface triangles
/// </summary>
LUMP_DISP_TRIS = 48,
/// <summary>
/// Compressed win32-specific Havok terrain surface collision data.
/// Deprecated and no longer used.
/// </summary>
/// <remarks>Source 2004</remarks>
LUMP_PHYSCOLLIDESURFACE = 49,
/// <summary>
/// Static prop triangle and string data
/// </summary>
/// <remarks>Source (L4D2 Branch)</remarks>
LUMP_PROP_BLOB = 49,
/// <summary>
/// Tied to any entity that uses the overlay_transition helper in FGD
/// </summary>
LUMP_WATEROVERLAYS = 50,
/// <summary>
/// Alternate lightdata implementation for Xbox
/// </summary>
/// <remarks>Source 2006</remarks>
LUMP_LIGHTMAPPAGES = 51,
/// <summary>
/// Index of LUMP_LEAF_AMBIENT_LIGHTING_HDR
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_LEAF_AMBIENT_INDEX_HDR = 51,
/// <summary>
/// Alternate lightdata indices for Xbox
/// </summary>
/// <remarks>Source 2006</remarks>
LUMP_LIGHTMAPPAGEINFOS = 52,
/// <summary>
/// Index of LUMP_LEAF_AMBIENT_LIGHTING
/// </summary>
/// <remarks>Source 2007/2009</remarks>
LUMP_LEAF_AMBIENT_INDEX = 52,
/// <summary>
/// HDR lightmap samples
/// </summary>
LUMP_LIGHTING_HDR = 53,
/// <summary>
/// Internal HDR world lights converted from the entity lump
/// </summary>
LUMP_WORLDLIGHTS_HDR = 54,
/// <summary>
/// Per-leaf ambient light samples (HDR)
/// </summary>
LUMP_LEAF_AMBIENT_LIGHTING_HDR = 55,
/// <summary>
/// Per-leaf ambient light samples (LDR)
/// </summary>
LUMP_LEAF_AMBIENT_LIGHTING = 56,
/// <summary>
/// XZip version of pak file for Xbox. Deprecated.
/// </summary>
LUMP_XZIPPAKFILE = 57,
/// <summary>
/// HDR maps may have different face data
/// </summary>
LUMP_FACES_HDR = 58,
/// <summary>
/// Extended level-wide flags. Not present in all levels.
/// </summary>
LUMP_MAP_FLAGS = 59,
/// <summary>
/// Fade distances for overlays
/// </summary>
LUMP_OVERLAY_FADES = 60,
/// <summary>
/// System level settings (min/max CPU & GPU to render this overlay)
/// </summary>
LUMP_OVERLAY_SYSTEM_LEVELS = 61,
/// <summary>
/// PhysX model of the World Brush.
/// </summary>
LUMP_PHYSLEVEL = 62,
/// <summary>
/// Displacement multiblend info
/// </summary>
LUMP_DISP_MULTIBLEND = 63,
#endregion
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public enum PlaneType : int
{
// Plane is perpendicular to given axis
PLANE_X = 0,
PLANE_Y = 1,
PLANE_Z = 2,
// Non-axial plane is snapped to the nearest
PLANE_ANYX = 3,
PLANE_ANYY = 4,
PLANE_ANYZ = 5,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)/Static_prop_flags"/>
[Flags]
public enum StaticPropFlags : uint
{
/// <summary>
/// Set by engine at runtime if the model fades out at a distance.
/// </summary>
STATIC_PROP_FLAG_FADES = 0x01,
/// <summary>
/// Set by engine at runtime if the model's lighting origin is
/// different from its position in the world.
/// </summary>
STATIC_PROP_USE_LIGHTING_ORIGIN = 0x02,
/// <summary>
/// Computed at run time based on dx level
/// </summary>
STATIC_PROP_NO_DRAW = 0x04,
/// <summary>
/// Set if disableflashlight is enabled.
/// </summary>
STATIC_PROP_NO_FLASHLIGHT = 0x04,
/// <summary>
/// Set if ignorenormals is enabled.
/// </summary>
STATIC_PROP_IGNORE_NORMALS = 0x08,
/// <summary>
/// Set if disableshadows is enabled.
/// </summary>
STATIC_PROP_NO_SHADOW = 0x10,
/// <summary>
/// Set if disableshadows is enabled.
/// </summary>
STATIC_PROP_SCREEN_SPACE_FADE = 0x20,
/// <summary>
/// Set if drawinfastreflection is enabled.
/// </summary>
STATIC_PROP_MARKED_FOR_FAST_REFLECTION = 0x20,
/// <summary>
/// In vrad, compute lighting at lighting origin,
/// not for each vertex
/// </summary>
STATIC_PROP_NO_PER_VERTEX_LIGHTING = 0x40,
/// <summary>
/// Disable self shadowing in vrad
/// </summary>
STATIC_PROP_NO_SELF_SHADOWING = 0x80,
/// <summary>
/// Whether we should do per-texel lightmaps in vrad
/// </summary>
STATIC_PROP_NO_PER_TEXEL_LIGHTING = 0x100,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)/Static_prop_flags"/>
[Flags]
public enum StaticPropFlagsEx : uint
{
/// <summary>
/// Set if disableshadowdepth is enabled.
/// </summary>
STATIC_PROP_FLAGS_EX_DISABLE_SHADOW_DEPTH = 0x00000001,
/// <summary>
/// Automatically set at runtime
/// </summary>
STATIC_PROP_FLAGS_EX_DISABLE_CSM = 0x00000002,
/// <summary>
/// Set if enablelightbounce is enabled.
/// </summary>
STATIC_PROP_FLAGS_EX_ENABLE_LIGHT_BOUNCE = 0x00000004,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_flags_(Source)"/>
[Flags]
public enum SurfaceFlag : uint
{
/// <summary>
/// Normally set on any surface that matches a RAD file entry;
/// not actually written to the BSP, unlike Quake II.
/// </summary>
SURF_LIGHT = 0x0001,
/// <summary>
/// Deprecated: Legacy Quake II flag; deprecated in favor of
/// surface properties.
/// </summary>
SURF_SLICK = 0x0002,
/// <summary>
/// Shows only the 2D skybox. Set via $Compile2DSky
/// </summary>
SURF_SKY2D = 0x0002,
/// <summary>
/// Shows both the 2D and 3D skybox. Set via $CompileSky
/// </summary>
SURF_SKY = 0x0004,
/// <summary>
/// Tells VVIS and the engine renderer that the surface is water.
/// Set via %CompileWater, but not %CompileSlime.
/// </summary>
SURF_WARP = 0x0008,
/// <summary>
/// Surface is translucent, either via $translucent or $alpha.
/// </summary>
SURF_TRANS = 0x0010,
/// <summary>
/// Deprecated: Legacy Quake II flag; deprecated in favor of
/// surface properties.
/// </summary>
SURF_WET = 0x0020,
/// <summary>
/// Set via %NoPortal
/// </summary>
SURF_NOPORTAL = 0x0020,
/// <summary>
/// Deprecated: Legacy Quake II flag; deprecated in favor of
/// material proxies.
/// </summary>
SURF_FLOWING = 0x0040,
/// <summary>
/// Set via %CompileTrigger. Doesn't do anything in the PC versions.
/// </summary>
SURF_TRIGGER = 0x0040,
/// <summary>
/// Set via %CompileNoDraw
/// </summary>
SURF_NODRAW = 0x0080,
/// <summary>
/// Set via %CompileHint
/// </summary>
SURF_HINT = 0x0100,
/// <summary>
/// Set via %CompileSkip. Should never be used on anything except
/// a hint brush.
/// </summary>
SURF_SKIP = 0x0200,
/// <summary>
/// Don't calculate light
/// </summary>
SURF_NOLIGHT = 0x0400,
/// <summary>
/// Calculate three lightmaps for the surface for bumpmapping
/// </summary>
SURF_BUMPLIGHT = 0x0800,
/// <summary>
/// Don't receive shadows
/// </summary>
SURF_NOSHADOWS = 0x1000,
/// <summary>
/// Don't receive decals
/// </summary>
SURF_NODECALS = 0x2000,
/// <summary>
/// Don't subdivide patches on this surface
/// </summary>
SURF_NOCHOP = 0x4000,
/// <summary>
/// Surface is part of a hitbox
/// </summary>
SURF_HITBOX = 0x8000,
}
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[Flags]
public enum TextureFlag : uint
{
/// <summary>
/// Disable lightmaps and subdivision for the surface
/// </summary>
/// <remarks>Used by sky and liquids</remarks>
DisableLightmaps = 0x01,
}
}

View File

@@ -1,22 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The Game lump (Lump 35) seems to be intended to be used for
/// map data that is specific to a particular game using the Source
/// engine, so that the file format can be extended without altering
/// the previously defined format.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class GameLump
{
/// <summary>
/// Number of game lumps
/// </summary>
public int LumpCount;
/// <summary>
/// <see cref="LumpCount"/>
/// </summary>
public GameLumpDirectory[]? Directories;
}
}

View File

@@ -1,40 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The Game lump (Lump 35) seems to be intended to be used for
/// map data that is specific to a particular game using the Source
/// engine, so that the file format can be extended without altering
/// the previously defined format.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class GameLumpDirectory
{
/// <summary>
/// Gamelump ID
/// </summary>
public int Id;
/// <summary>
/// Flags
/// </summary>
public ushort Flags;
/// <summary>
/// Gamelump version
/// </summary>
public ushort Version;
/// <summary>
/// Offset to this gamelump
/// </summary>
public int FileOffset;
/// <summary>
/// Length
/// </summary>
public int FileLength;
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// To associate each leaf with its collection of ambient samples,
/// the ambient lighting index lumps (Lumps 51 and 52) are used.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class LeafAmbientIndex
{
public ushort AmbientSampleCount;
public ushort FirstAmbientSample;
}
}

View File

@@ -1,41 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The ambient lighting lumps (Lumps 55 and 56) are present in
/// BSP version 20 and later. Lump 55 is used for HDR lighting,
/// and Lump 56 is used for LDR lighting. These lumps are used to
/// store the volumetric ambient lighting information in each leaf
/// (i.e. lighting information for entities such as NPCs, the
/// viewmodel, and non-static props). Prior to version 20, this
/// data was stored in the leaf lump (Lump 10), in the dleaf_t
/// structure, with far less precision than this newer lump allows.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class LeafAmbientLighting
{
public CompressedLightCube? Cube;
/// <summary>
/// Fixed point fraction of leaf bounds
/// </summary>
public byte X;
/// <summary>
/// Fixed point fraction of leaf bounds
/// </summary>
public byte Y;
/// <summary>
/// Fixed point fraction of leaf bounds
/// </summary>
public byte Z;
/// <summary>
/// Unused
/// </summary>
public byte Pad;
}
}

View File

@@ -1,16 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The leafbrush lump (Lump 17) is an array of unsigned shorts which are
/// used to map from brushes referenced in the leaf structure to indices in
/// the brush array.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class LeafBrushesLump : Lump
{
/// <summary>
/// Map
/// </summary>
public ushort[]? Map { get; set; }
}
}

View File

@@ -1,16 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The leafface lump (Lump 16) is an array of unsigned shorts which are
/// used to map from faces referenced in the leaf structure to indices in
/// the face array.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class LeafFacesLump : Lump
{
/// <summary>
/// Map
/// </summary>
public ushort[]? Map { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// This is one of the largest lumps in the BSP file. The lightmap
/// lump stores all lightmaps used in the entire map. The lightmaps
/// are arrays of triples of bytes (3 channel color, RGB) and stored
/// continuously.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class LightmapLump : Lump
{
/// <summary>
/// Lightmap RGB values
/// </summary>
/// <remarks>Array of 3-byte values</remarks>
public byte[][]? Lightmap { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// Represents a common Lump type
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public abstract class Lump
{
// No shared fields between types
}
}

View File

@@ -1,40 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// BSP files for console platforms such as PlayStation 3 and
/// Xbox 360 usually have their lumps compressed with LZMA.
/// In this case, the lump data starts with the following header
/// (from public/tier1/lzmaDecoder.h), which is used in place of
/// the standard 13-byte LZMA header.
///
/// lzmaSize denotes the size (in bytes) of compressed data, it
/// is equal to the size of a lump minus 17 bytes (lzma header).
/// actualSize denotes the size of decompressed data. properties[5]
/// field are used solely for LZMA decoding.
///
/// There are two special cases for compression: LUMP_PAKFILE is never
/// compressed as a lump (the contents of the zip are compressed instead)
/// and each of the game lumps in LUMP_GAME_LUMP are compressed individually.
/// The compressed size of a game lump can be determined by subtracting
/// the current game lump's offset with that of the next entry. For this
/// reason, when game lumps are compressed the last game lump is always
/// an empty dummy which only contains the offset.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class LzmaHeader
{
public uint Id;
/// <remarks>Little-endian</remarks>
public uint ActualSize;
/// <remarks>Little-endian</remarks>
public uint LzmaSize;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[]? Properties = new byte[5];
}
}

View File

@@ -1,19 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The marksurfaces lump is a simple array of short integers.
///
/// This lump is a simple table for redirecting the marksurfaces
/// indexes in the leafs to the actial face indexes. A leaf inserts
/// it's marksurface indexes into this array and gets the associated
/// faces contained within this leaf.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
public sealed class MarksurfacesLump : Lump
{
/// <summary>
/// Marksurfaces
/// </summary>
public ushort[]? Marksurfaces { get; set; }
}
}

View File

@@ -1,44 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Each of this structs describes a texture. The name of the
/// texture is a string and may be 16 characters long (including
/// the null-character at the end, char equals a 8bit signed
/// integer). The name of the texture is needed, if the texture
/// has to be found and loaded from an external WAD file.
/// Furthermore, the struct contains the width and height of
/// the texture. The 4 offsets at the end can either be zero,
/// if the texture is stored in an external WAD file, or point
/// to the beginnings of the binary texture data within the
/// texture lump relative to the beginning of it's BSPMIPTEX struct.
/// </summary>
/// <see href="https://github.com/RavuAlHemio/hllib/blob/master/HLLib/BSPFile.h"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class MipTexture
{
/// <summary>
/// Name of texture
/// </summary>
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = Constants.MAXTEXTURENAME)]
public string? Name;
/// <summary>
/// Extends of the texture
/// </summary>
public uint Width;
/// <summary>
/// Extends of the texture
/// </summary>
public uint Height;
/// <summary>
/// Offsets to texture mipmaps BSPMIPTEX
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.MIPLEVELS)]
public uint[]? Offsets;
}
}

View File

@@ -1,40 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The doccluderdata_t structure contains flags and dimensions
/// of the occluder, as well as the area where it remains.
/// firstpoly is the first index into the doccluderpolydata_t
/// with a total of polycount entries.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class OccluderData
{
public int Flags;
/// <summary>
/// Index into doccluderpolys
/// </summary>
public int FirstPoly;
/// <summary>
/// Amount of polygons
/// </summary>
public int PolyCount;
/// <summary>
/// Minima of all vertices
/// </summary>
public Vector3D? Mins;
/// <summary>
/// Maxima of all vertices
/// </summary>
public Vector3D? Maxs;
/// <remarks>Since v1</remarks>
public int Area;
}
}

View File

@@ -1,29 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Occluder polygons are stored in the doccluderpolydata_t
/// structure and contain the firstvertexindex field, which
/// is the first index into the vertex array of the occluder,
/// which are again indices for the vertex array of the vertex
/// lump (Lump 3). The total number of vertex indices is
/// stored in vertexcount.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class OccluderPolyData
{
/// <summary>
/// Index into doccludervertindices
/// </summary>
public int FirstVertexIndex;
/// <summary>
/// Amount of vertex indices
/// </summary>
public int VertexCount;
public int PlanEnum;
}
}

View File

@@ -1,46 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The occlusion lump (Lump 9) contains the polygon geometry and some
/// flags used by func_occluder entities. Unlike other brush entities,
/// func_occluders don't use the 'model' key in the entity lump.
/// Instead, the brushes are split from the entities during the compile
/// process and numeric occluder keys are assigned as 'occludernum'.
/// Brush sides textured with tools/toolsoccluder or tools/toolstrigger
/// are then stored together with the occluder keys and some additional
/// info in this lump.
///
/// The lump is divided into three parts and begins with a integer value
/// with the total number of occluders, followed by an array of
/// doccluderdata_t fields of the same size. The next part begins with
/// another integer value, this time for the total number of occluder
/// polygons, as well as an array of doccluderpolydata_t fields of equal
/// size. Part three begins with another integer value for the amount of
/// occluder polygon vertices, followed by an array of integer values for
/// the vertex indices, again of the same size.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class OcclusionLump : Lump
{
public int Count;
/// <summary>
/// <see cref="Count">
/// </summary>
public OccluderData[]? Data;
public int PolyDataCount;
/// <summary>
/// <see cref="PolyDataCount">
/// </summary>
public OccluderPolyData[]? PolyData;
public int VertexIndexCount;
/// <summary>
/// <see cref="VertexIndexCount">
/// </summary>
public int[]? VertexIndicies;
}
}

View File

@@ -1,48 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Unlike the simpler decals (infodecal entities), info_overlays
/// are removed from the entity lump and stored separately in the
/// Overlay lump (Lump 45).
///
/// The FaceCountAndRenderOrder member is split into two parts;
/// the lower 14 bits are the number of faces that the overlay
/// appears on, with the top 2 bits being the render order of
/// the overlay (for overlapping decals). The Ofaces array, which
/// is 64 elements in size (OVERLAY_BSP_FACE_COUNT) are the indices
/// into the face array indicating which map faces the overlay
/// should be displayed on. The other elements set the texture,
/// scale, and orientation of the overlay decal. There is no
/// enforced limit on overlays inside the engine. VBSP enforces
/// a limit of 512 (MAX_MAP_OVERLAYS, 1024 in Counter-Strike:
/// Global Offensive), but custom compilers can circumvent this.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Overlay
{
public int Id;
public short TexInfo;
public ushort FaceCountAndRenderOrder;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = Constants.OVERLAY_BSP_FACE_COUNT)]
public int[]? Ofaces = new int[Constants.OVERLAY_BSP_FACE_COUNT];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public float[]? U = new float[2];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public float[]? V = new float[2];
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public Vector3D[]? UVPoints = new Vector3D[4];
public Vector3D? Origin;
public Vector3D? BasisNormal;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class OverlaysLump : Lump
{
/// <summary>
/// Overlays
/// </summary>
public Overlay[]? Overlays { get; set; }
}
}

View File

@@ -1,43 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// The Pakfile lump (Lump 40) is a special lump that can contains
/// multiple files which are embedded into the bsp file. Usually,
/// they contain special texture (.vtf) and material (.vmt) files
/// which are used to store the reflection maps from env_cubemap
/// entities in the map; these files are built and placed in the
/// Pakfile lump when the buildcubemaps console command is executed.
/// The Pakfile can optionally contain such things as custom textures
/// and prop models used in the map, and are placed into the bsp file
/// by using the BSPZIP program (or alternate programs such as Pakrat).
/// These files are integrated into the game engine's file system
/// and will be loaded preferentially before externally located
/// files are used.
///
/// The format of the Pakfile lump is identical to that used by the
/// Zip compression utility when no compression is specified (i.e.,
/// the individual files are stored in uncompressed format). In some
/// branches, such as , LZMA compression can be used as well. If the
/// Pakfile lump is extracted and written to a file, it can therefore
/// be opened with WinZip and similar programs.
///
/// The header public/zip_uncompressed.h defines the structures
/// present in the Pakfile lump. The last element in the lump is a
/// ZIP_EndOfCentralDirRecord structure. This points to an array of
/// ZIP_FileHeader structures immediately preceeding it, one for each
/// file present in the Pak. Each of these headers then point to
/// ZIP_LocalFileHeader structures that are followed by that file's
/// data.
///
/// The Pakfile lump is usually the last element of the bsp file.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class PakfileLump
{
/// <summary>
/// Pakfile data
/// </summary>
/// TODO: Split and/or decompress data?
public byte[]? Data;
}
}

View File

@@ -1,11 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class PhysCollideLump : Lump
{
/// <summary>
/// Models
/// </summary>
public PhysModel[]? Models { get; set; }
}
}

View File

@@ -1,42 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The physcollide lump (Lump 29) contains physics data for the world.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class PhysModel
{
/// <summary>
/// Perhaps the index of the model to which this physics model applies?
/// </summary>
public int ModelIndex;
/// <summary>
/// Total size of the collision data sections
/// </summary>
public int DataSize;
/// <summary>
/// Size of the text section
/// </summary>
public int KeydataSize;
/// <summary>
/// Number of collision data sections
/// </summary>
public int SolidCount;
/// <summary>
/// Collision data of length <see cref="SolidCount"/>
/// </summary>
public PhysSolid[]? Solids;
/// <summary>
/// Key data of size <see cref="KeydataSize"/>
/// </summary>
public byte[]? TextData;
}
}

View File

@@ -1,25 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// The last two parts appear to be identical to the PHY file format,
/// which means their exact contents are unknown. Note that the
/// compactsurfaceheader_t structure contains the data size of each
/// collision data section (including the rest of the header)
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class PhysSolid
{
/// <summary>
/// Size of the collision data
/// </summary>
public int Size;
/// <summary>
/// Collision data of length <see cref="Size"/>
/// </summary>
public byte[]? CollisionData;
}
}

View File

@@ -1,40 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// Each of this structures defines a plane in 3-dimensional
/// space by using the Hesse normal form: normal * point - distance = 0
///
/// Where vNormal is the normalized normal vector of the plane
/// and fDist is the distance of the plane to the origin of
/// the coord system. Additionally, the structure also saves an
/// integer describing the orientation of the plane in space.
/// If nType equals PLANE_X, then the normal of the plane will
/// be parallel to the x axis, meaning the plane is perpendicular
/// to the x axis. If nType equals PLANE_ANYX, then the plane's
/// normal is nearer to the x axis then to any other axis.
/// This information is used by the renderer to speed up some
/// computations.
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
[StructLayout(LayoutKind.Sequential)]
public sealed class Plane
{
/// <summary>
/// The planes normal vector
/// </summary>
public Vector3D? NormalVector;
/// <summary>
/// Plane equation is: vNormal * X = fDist
/// </summary>
public float Distance;
/// <summary>
/// Plane type
/// </summary>
public PlaneType PlaneType;
}
}

View File

@@ -1,12 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(GoldSrc)"/>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class PlanesLump : Lump
{
/// <summary>
/// Planes
/// </summary>
public Plane[]? Planes { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.InteropServices;
namespace SabreTools.Models.BSP
{
/// <summary>
/// QAngle is a C++ class in Source that represents a three-dimensional
/// extrinsic Tait-Bryan rotations following the right-hand rule, offset
/// from the cardinal Z axis.
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public class QAngle
{
public float X;
public float Y;
public float Z;
}
}

View File

@@ -1,24 +0,0 @@
namespace SabreTools.Models.BSP
{
/// <summary>
/// Of interest is the gamelump which is used to store prop_static entities,
/// which uses the gamelump ID of 'sprp' ASCII (1936749168 decimal). Unlike
/// most other entities, static props are not stored in the entity lump. The
/// gamelump formats used in Source are defined in the public/gamebspfile.h
/// header file.
///
/// The first element of the static prop game lump is the dictionary; this is
/// an integer count followed by the list of model (prop) names used in the map
/// </summary>
/// <see href="https://developer.valvesoftware.com/wiki/BSP_(Source)"/>
public sealed class StaticPropDictLump
{
public int DictEntries;
/// <summary>
/// Model name
/// </summary>
/// <remarks>[dictEntries][128]</remarks>
public char[][]? Name;
}
}

Some files were not shown because too many files have changed in this diff Show More