Add project files.
This commit is contained in:
31
Navmesher.sln
Normal file
31
Navmesher.sln
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 17
|
||||||
|
VisualStudioVersion = 17.3.32922.545
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Navmesher", "Navmesher\Navmesher.vcxproj", "{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|x64 = Debug|x64
|
||||||
|
Debug|x86 = Debug|x86
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
Release|x86 = Release|x86
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Debug|x64.ActiveCfg = Debug|x64
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Debug|x64.Build.0 = Debug|x64
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Debug|x86.ActiveCfg = Debug|Win32
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Debug|x86.Build.0 = Debug|Win32
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Release|x64.Build.0 = Release|x64
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Release|x86.ActiveCfg = Release|Win32
|
||||||
|
{FD707FEA-8D2F-45AB-93FE-CD31B92EFB1D}.Release|x86.Build.0 = Release|Win32
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {21B9C92D-FC98-4B4E-B3BD-BD6A441CAC1D}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
147
Navmesher/Navmesher.vcxproj
Normal file
147
Navmesher/Navmesher.vcxproj
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>16.0</VCProjectVersion>
|
||||||
|
<Keyword>Win32Proj</Keyword>
|
||||||
|
<ProjectGuid>{fd707fea-8d2f-45ab-93fe-cd31b92efb1d}</ProjectGuid>
|
||||||
|
<RootNamespace>Navmesher</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<EnableASAN>true</EnableASAN>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
<SmallerTypeCheck>false</SmallerTypeCheck>
|
||||||
|
<ControlFlowGuard>Guard</ControlFlowGuard>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<DisableLanguageExtensions>true</DisableLanguageExtensions>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>EnableAllWarnings</WarningLevel>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<ConformanceMode>true</ConformanceMode>
|
||||||
|
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Console</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="esx_reader_lut.cpp" />
|
||||||
|
<ClCompile Include="main.cpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="esx_reader.hpp" />
|
||||||
|
<ClInclude Include="utility.hpp" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
33
Navmesher/Navmesher.vcxproj.filters
Normal file
33
Navmesher/Navmesher.vcxproj.filters
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="Source Files">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Header Files">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="Resource Files">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="main.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="esx_reader_lut.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="esx_reader.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="utility.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
142
Navmesher/esx_reader.hpp
Normal file
142
Navmesher/esx_reader.hpp
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
#ifndef ESX_READER_H
|
||||||
|
#define ESX_READER_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <variant>
|
||||||
|
#include <array>
|
||||||
|
#include <string_view>
|
||||||
|
#include <compare>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "utility.hpp"
|
||||||
|
|
||||||
|
namespace esxr {
|
||||||
|
|
||||||
|
//
|
||||||
|
// Forward declarations
|
||||||
|
//
|
||||||
|
|
||||||
|
class GroupNode;
|
||||||
|
class RecordNode;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Enumerations
|
||||||
|
//
|
||||||
|
|
||||||
|
// This is defined by the file spec, do not change unless the file spec changes.
|
||||||
|
enum class GroupType : int32_t {
|
||||||
|
Top = 0,
|
||||||
|
WorldChildren = 1,
|
||||||
|
InteriorCellBlock = 2,
|
||||||
|
InteriorCellSubBlock = 3,
|
||||||
|
ExteriorCellBlock = 4,
|
||||||
|
ExteriorCellSubBlock = 5,
|
||||||
|
CellChildren = 6,
|
||||||
|
TopicChildren = 7,
|
||||||
|
CellPersistentChildren = 8,
|
||||||
|
CellTemporaryChildren = 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class RecordType {
|
||||||
|
None,
|
||||||
|
AACT, ACHR, ACTI, ADDN, ALCH, AMMO, ANIO, APPA, ARMA, ARMO, ARTO, ASPC, ASTP, AVIF, BOOK, BPTD, CAMS, CELL, CLAS, CLDC, CLFM,
|
||||||
|
CLMT, COBJ, COLL, CONT, CPTH, CSTY, DEBR, DIAL, DLBR, DLVW, DOBJ, DOOR, DUAL, ECZN, EFSH, ENCH, EQUP, EXPL, EYES, FACT, FLOR,
|
||||||
|
FLST, FSTP, FSTS, FURN, GLOB, GMST, GRAS, GRUP, HAIR, HAZD, HDPT, IDLE, IDLM, IMAD, IMGS, INFO, INGR, IPCT, IPDS, KEYM, KYWD,
|
||||||
|
LAND, LCRT, LCTN, LENS, LGTM, LIGH, LSCR, LTEX, LVLI, LVLN, LVSP, MATO, MATT, MESG, MGEF, MISC, MOVT, MSTT, MUSC, MUST, NAVI,
|
||||||
|
NAVM, NOTE, NPC_, OTFT, PACK, PARW, PBAR, PBEA, PCON, PERK, PFLA, PGRE, PHZD, PLYR, PMIS, PROJ, PWAT, QUST, RACE, REFR, REGN,
|
||||||
|
RELA, REVB, RFCT, RGDL, SCEN, SCOL, SCOL, SCPT, SCRL, SHOU, SLGM, SMBN, SMEN, SMQN, SNCT, SNDR, SOPM, SOUN, SPEL, SPGD, STAT,
|
||||||
|
TACT, TES4, TREE, TXST, VOLI, VTYP, WATR, WEAP, WOOP, WRLD, WTHR
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Type aliases
|
||||||
|
//
|
||||||
|
|
||||||
|
using Node = std::variant<GroupNode, RecordNode>;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Aggregate types
|
||||||
|
//
|
||||||
|
|
||||||
|
struct FourCC : utility::Store<std::array<char, 4>> {
|
||||||
|
constexpr FourCC() noexcept = default;
|
||||||
|
explicit constexpr FourCC(const char (&str)[5]) noexcept : Store{ utility::literal_to_array(str) } { }
|
||||||
|
};
|
||||||
|
static_assert(std::is_trivial_v<FourCC>);
|
||||||
|
|
||||||
|
struct FormID : utility::Store<uint32_t> { };
|
||||||
|
struct Timestamp : utility::Store<uint16_t> { };
|
||||||
|
struct VCInfo : utility::Store<uint16_t> { };
|
||||||
|
|
||||||
|
struct GroupHeader {
|
||||||
|
struct Coord {
|
||||||
|
int16_t y, x;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct TopType : utility::Store<FourCC> { };
|
||||||
|
struct ParentWorld : utility::Store<FormID> { };
|
||||||
|
struct BlockNumber : utility::Store<int32_t> { };
|
||||||
|
struct SubBlockNumber : utility::Store<int32_t> { };
|
||||||
|
struct BlockCoord : utility::Store<Coord> { };
|
||||||
|
struct SubBlockCoord : utility::Store<Coord> { };
|
||||||
|
struct ParentCell : utility::Store<FormID> { };
|
||||||
|
struct ParentDialogue : utility::Store<FormID> { };
|
||||||
|
|
||||||
|
union GroupLabel {
|
||||||
|
TopType top_type;
|
||||||
|
ParentWorld parent_world;
|
||||||
|
BlockNumber block_number;
|
||||||
|
SubBlockNumber sub_block_number;
|
||||||
|
BlockCoord block_coord;
|
||||||
|
SubBlockCoord sub_block_coord;
|
||||||
|
ParentCell parent_cell;
|
||||||
|
ParentDialogue parent_dialogue;
|
||||||
|
};
|
||||||
|
|
||||||
|
RecordType grup;
|
||||||
|
uint32_t size;
|
||||||
|
GroupLabel label;
|
||||||
|
GroupType type;
|
||||||
|
Timestamp timestamp;
|
||||||
|
VCInfo version_control_information;
|
||||||
|
uint32_t unknown;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(GroupHeader) == 24);
|
||||||
|
|
||||||
|
struct RecordHeader {
|
||||||
|
struct Flags : utility::Store<uint32_t> { };
|
||||||
|
struct Version : utility::Store<uint16_t> { };
|
||||||
|
|
||||||
|
RecordType type;
|
||||||
|
uint32_t size;
|
||||||
|
Flags flags;
|
||||||
|
FormID formid;
|
||||||
|
Timestamp timestamp;
|
||||||
|
VCInfo version_control_information;
|
||||||
|
Version version;
|
||||||
|
uint16_t unknown;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(RecordHeader) == 24);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Classes
|
||||||
|
//
|
||||||
|
|
||||||
|
class GroupNode {
|
||||||
|
private:
|
||||||
|
GroupHeader m_header;
|
||||||
|
std::vector<Node> m_children;
|
||||||
|
};
|
||||||
|
|
||||||
|
class RecordNode {
|
||||||
|
private:
|
||||||
|
RecordHeader m_header;
|
||||||
|
std::vector<std::byte> data;
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Free functions
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
318
Navmesher/esx_reader_lut.cpp
Normal file
318
Navmesher/esx_reader_lut.cpp
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
#include "esx_reader.hpp"
|
||||||
|
|
||||||
|
using namespace esxr;
|
||||||
|
|
||||||
|
namespace esxr_lut {
|
||||||
|
|
||||||
|
static constexpr std::pair<RecordType, std::string_view> record_type_name_map[] = {
|
||||||
|
{RecordType::AACT, "Action"},
|
||||||
|
{RecordType::ACHR, "Placed NPC"},
|
||||||
|
{RecordType::ACTI, "Activator"},
|
||||||
|
{RecordType::ADDN, "Addon Node"},
|
||||||
|
{RecordType::ALCH, "Ingestible"},
|
||||||
|
{RecordType::AMMO, "Ammunition"},
|
||||||
|
{RecordType::ANIO, "Animated Object"},
|
||||||
|
{RecordType::APPA, "Alchemical Apparatus"},
|
||||||
|
{RecordType::ARMA, "Armor Addon"},
|
||||||
|
{RecordType::ARMO, "Armor"},
|
||||||
|
{RecordType::ARTO, "Art Object"},
|
||||||
|
{RecordType::ASPC, "Acoustic Space"},
|
||||||
|
{RecordType::ASTP, "Association Type"},
|
||||||
|
{RecordType::AVIF, "Actor Value Information"},
|
||||||
|
{RecordType::BOOK, "Book"},
|
||||||
|
{RecordType::BPTD, "Body Part Data"},
|
||||||
|
{RecordType::CAMS, "Camera Shot"},
|
||||||
|
{RecordType::CELL, "Cell"},
|
||||||
|
{RecordType::CLAS, "Class"},
|
||||||
|
{RecordType::CLDC, "CLDC"},
|
||||||
|
{RecordType::CLFM, "Color"},
|
||||||
|
{RecordType::CLMT, "Climate"},
|
||||||
|
{RecordType::COBJ, "Constructible Object"},
|
||||||
|
{RecordType::COLL, "Collision Layer"},
|
||||||
|
{RecordType::CONT, "Container"},
|
||||||
|
{RecordType::CPTH, "Camera Path"},
|
||||||
|
{RecordType::CSTY, "Combat Style"},
|
||||||
|
{RecordType::DEBR, "Debris"},
|
||||||
|
{RecordType::DIAL, "Dialog Topic"},
|
||||||
|
{RecordType::DLBR, "Dialog Branch"},
|
||||||
|
{RecordType::DLVW, "Dialog View"},
|
||||||
|
{RecordType::DOBJ, "Default Object Manager"},
|
||||||
|
{RecordType::DOOR, "Door"},
|
||||||
|
{RecordType::DUAL, "Dual Cast Data"},
|
||||||
|
{RecordType::ECZN, "Encounter Zone"},
|
||||||
|
{RecordType::EFSH, "Effect Shader"},
|
||||||
|
{RecordType::ENCH, "Object Effect"},
|
||||||
|
{RecordType::EQUP, "Equip Type"},
|
||||||
|
{RecordType::EXPL, "Explosion"},
|
||||||
|
{RecordType::EYES, "Eyes"},
|
||||||
|
{RecordType::FACT, "Faction"},
|
||||||
|
{RecordType::FLOR, "Flora"},
|
||||||
|
{RecordType::FLST, "FormID List"},
|
||||||
|
{RecordType::FSTP, "Footstep"},
|
||||||
|
{RecordType::FSTS, "Footstep Set"},
|
||||||
|
{RecordType::FURN, "Furniture"},
|
||||||
|
{RecordType::GLOB, "Global"},
|
||||||
|
{RecordType::GMST, "Game Setting"},
|
||||||
|
{RecordType::GRAS, "Grass"},
|
||||||
|
{RecordType::GRUP, "Internal File Structure Group"},
|
||||||
|
{RecordType::HAIR, "HAIR"},
|
||||||
|
{RecordType::HAZD, "Hazard"},
|
||||||
|
{RecordType::HDPT, "Head Part"},
|
||||||
|
{RecordType::IDLE, "Idle Animation"},
|
||||||
|
{RecordType::IDLM, "Idle Marker"},
|
||||||
|
{RecordType::IMAD, "Image Space Adapter"},
|
||||||
|
{RecordType::IMGS, "Image Space"},
|
||||||
|
{RecordType::INFO, "Dialog response"},
|
||||||
|
{RecordType::INGR, "Ingredient"},
|
||||||
|
{RecordType::IPCT, "Impact"},
|
||||||
|
{RecordType::IPDS, "Impact Data Set"},
|
||||||
|
{RecordType::KEYM, "Key"},
|
||||||
|
{RecordType::KYWD, "Keyword"},
|
||||||
|
{RecordType::LAND, "Landscape"},
|
||||||
|
{RecordType::LCRT, "Location Reference Type"},
|
||||||
|
{RecordType::LCTN, "Location"},
|
||||||
|
{RecordType::LENS, "Lens Flare"},
|
||||||
|
{RecordType::LGTM, "Lighting Template"},
|
||||||
|
{RecordType::LIGH, "Light"},
|
||||||
|
{RecordType::LSCR, "Load Screen"},
|
||||||
|
{RecordType::LTEX, "Landscape Texture"},
|
||||||
|
{RecordType::LVLI, "Leveled Item"},
|
||||||
|
{RecordType::LVLN, "Leveled NPC"},
|
||||||
|
{RecordType::LVSP, "Leveled Spell"},
|
||||||
|
{RecordType::MATO, "Material Object"},
|
||||||
|
{RecordType::MATT, "Material Type"},
|
||||||
|
{RecordType::MESG, "Message"},
|
||||||
|
{RecordType::MGEF, "Magic Effect"},
|
||||||
|
{RecordType::MISC, "Misc.Item"},
|
||||||
|
{RecordType::MOVT, "Movement Type"},
|
||||||
|
{RecordType::MSTT, "Moveable Static"},
|
||||||
|
{RecordType::MUSC, "Music Type"},
|
||||||
|
{RecordType::MUST, "Music Track"},
|
||||||
|
{RecordType::NAVI, "Navigation Mesh Info Map"},
|
||||||
|
{RecordType::NAVM, "Navigation Mesh"},
|
||||||
|
{RecordType::NOTE, "NOTE"},
|
||||||
|
{RecordType::NPC_, "Non - Player Character(Actor)"},
|
||||||
|
{RecordType::OTFT, "Outfit"},
|
||||||
|
{RecordType::PACK, "Package"},
|
||||||
|
{RecordType::PARW, "Placed Arrow"},
|
||||||
|
{RecordType::PBAR, "Placed Barrier"},
|
||||||
|
{RecordType::PBEA, "Placed Beam"},
|
||||||
|
{RecordType::PCON, "Placed Cone / Voice"},
|
||||||
|
{RecordType::PERK, "Perk"},
|
||||||
|
{RecordType::PFLA, "Placed Flame"},
|
||||||
|
{RecordType::PGRE, "Placed Projectile"},
|
||||||
|
{RecordType::PHZD, "Placed Hazard"},
|
||||||
|
{RecordType::PLYR, "Player Reference"},
|
||||||
|
{RecordType::PMIS, "Placed Missile"},
|
||||||
|
{RecordType::PROJ, "Projectile"},
|
||||||
|
{RecordType::PWAT, "PWAT"},
|
||||||
|
{RecordType::QUST, "Quest"},
|
||||||
|
{RecordType::RACE, "Race"},
|
||||||
|
{RecordType::REFR, "Placed Object"},
|
||||||
|
{RecordType::REGN, "Region"},
|
||||||
|
{RecordType::RELA, "Relationship"},
|
||||||
|
{RecordType::REVB, "Reverb Parameters"},
|
||||||
|
{RecordType::RFCT, "Visual Effect"},
|
||||||
|
{RecordType::RGDL, "RGDL"},
|
||||||
|
{RecordType::SCEN, "Scene"},
|
||||||
|
{RecordType::SCOL, "SCOL"},
|
||||||
|
{RecordType::SCOL, "Static Collection"},
|
||||||
|
{RecordType::SCPT, "SCPT"},
|
||||||
|
{RecordType::SCRL, "Scroll"},
|
||||||
|
{RecordType::SHOU, "Shout"},
|
||||||
|
{RecordType::SLGM, "Soul Gem"},
|
||||||
|
{RecordType::SMBN, "Story Manager Branch Node"},
|
||||||
|
{RecordType::SMEN, "Story Manager Event Node"},
|
||||||
|
{RecordType::SMQN, "Story Manager Quest Node"},
|
||||||
|
{RecordType::SNCT, "Sound Category"},
|
||||||
|
{RecordType::SNDR, "Sound Descriptor"},
|
||||||
|
{RecordType::SOPM, "Sound Output Model"},
|
||||||
|
{RecordType::SOUN, "Sound Marker"},
|
||||||
|
{RecordType::SPEL, "Spell"},
|
||||||
|
{RecordType::SPGD, "Shader Particle Geometry"},
|
||||||
|
{RecordType::STAT, "Static"},
|
||||||
|
{RecordType::TACT, "Talking Activator"},
|
||||||
|
{RecordType::TES4, "Main File Header"},
|
||||||
|
{RecordType::TREE, "Tree"},
|
||||||
|
{RecordType::TXST, "Texture Set"},
|
||||||
|
{RecordType::VOLI, "Volumetric Lighting"},
|
||||||
|
{RecordType::VTYP, "Voice Type"},
|
||||||
|
{RecordType::WATR, "Water"},
|
||||||
|
{RecordType::WEAP, "Weapon"},
|
||||||
|
{RecordType::WOOP, "Word of Power"},
|
||||||
|
{RecordType::WRLD, "Worldspace"},
|
||||||
|
{RecordType::WTHR, "Weather"}
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr std::pair<RecordType, FourCC> record_type_fourcc_map[] = {
|
||||||
|
{RecordType::AACT, FourCC("AACT")},
|
||||||
|
{RecordType::ACHR, FourCC("ACHR")},
|
||||||
|
{RecordType::ACTI, FourCC("ACTI")},
|
||||||
|
{RecordType::ADDN, FourCC("ADDN")},
|
||||||
|
{RecordType::ALCH, FourCC("ALCH")},
|
||||||
|
{RecordType::AMMO, FourCC("AMMO")},
|
||||||
|
{RecordType::ANIO, FourCC("ANIO")},
|
||||||
|
{RecordType::APPA, FourCC("APPA")},
|
||||||
|
{RecordType::ARMA, FourCC("ARMA")},
|
||||||
|
{RecordType::ARMO, FourCC("ARMO")},
|
||||||
|
{RecordType::ARTO, FourCC("ARTO")},
|
||||||
|
{RecordType::ASPC, FourCC("ASPC")},
|
||||||
|
{RecordType::ASTP, FourCC("ASTP")},
|
||||||
|
{RecordType::AVIF, FourCC("AVIF")},
|
||||||
|
{RecordType::BOOK, FourCC("BOOK")},
|
||||||
|
{RecordType::BPTD, FourCC("BPTD")},
|
||||||
|
{RecordType::CAMS, FourCC("CAMS")},
|
||||||
|
{RecordType::CELL, FourCC("CELL")},
|
||||||
|
{RecordType::CLAS, FourCC("CLAS")},
|
||||||
|
{RecordType::CLDC, FourCC("CLDC")},
|
||||||
|
{RecordType::CLFM, FourCC("CLFM")},
|
||||||
|
{RecordType::CLMT, FourCC("CLMT")},
|
||||||
|
{RecordType::COBJ, FourCC("COBJ")},
|
||||||
|
{RecordType::COLL, FourCC("COLL")},
|
||||||
|
{RecordType::CONT, FourCC("CONT")},
|
||||||
|
{RecordType::CPTH, FourCC("CPTH")},
|
||||||
|
{RecordType::CSTY, FourCC("CSTY")},
|
||||||
|
{RecordType::DEBR, FourCC("DEBR")},
|
||||||
|
{RecordType::DIAL, FourCC("DIAL")},
|
||||||
|
{RecordType::DLBR, FourCC("DLBR")},
|
||||||
|
{RecordType::DLVW, FourCC("DLVW")},
|
||||||
|
{RecordType::DOBJ, FourCC("DOBJ")},
|
||||||
|
{RecordType::DOOR, FourCC("DOOR")},
|
||||||
|
{RecordType::DUAL, FourCC("DUAL")},
|
||||||
|
{RecordType::ECZN, FourCC("ECZN")},
|
||||||
|
{RecordType::EFSH, FourCC("EFSH")},
|
||||||
|
{RecordType::ENCH, FourCC("ENCH")},
|
||||||
|
{RecordType::EQUP, FourCC("EQUP")},
|
||||||
|
{RecordType::EXPL, FourCC("EXPL")},
|
||||||
|
{RecordType::EYES, FourCC("EYES")},
|
||||||
|
{RecordType::FACT, FourCC("FACT")},
|
||||||
|
{RecordType::FLOR, FourCC("FLOR")},
|
||||||
|
{RecordType::FLST, FourCC("FLST")},
|
||||||
|
{RecordType::FSTP, FourCC("FSTP")},
|
||||||
|
{RecordType::FSTS, FourCC("FSTS")},
|
||||||
|
{RecordType::FURN, FourCC("FURN")},
|
||||||
|
{RecordType::GLOB, FourCC("GLOB")},
|
||||||
|
{RecordType::GMST, FourCC("GMST")},
|
||||||
|
{RecordType::GRAS, FourCC("GRAS")},
|
||||||
|
{RecordType::GRUP, FourCC("GRUP")},
|
||||||
|
{RecordType::HAIR, FourCC("HAIR")},
|
||||||
|
{RecordType::HAZD, FourCC("HAZD")},
|
||||||
|
{RecordType::HDPT, FourCC("HDPT")},
|
||||||
|
{RecordType::IDLE, FourCC("IDLE")},
|
||||||
|
{RecordType::IDLM, FourCC("IDLM")},
|
||||||
|
{RecordType::IMAD, FourCC("IMAD")},
|
||||||
|
{RecordType::IMGS, FourCC("IMGS")},
|
||||||
|
{RecordType::INFO, FourCC("INFO")},
|
||||||
|
{RecordType::INGR, FourCC("INGR")},
|
||||||
|
{RecordType::IPCT, FourCC("IPCT")},
|
||||||
|
{RecordType::IPDS, FourCC("IPDS")},
|
||||||
|
{RecordType::KEYM, FourCC("KEYM")},
|
||||||
|
{RecordType::KYWD, FourCC("KYWD")},
|
||||||
|
{RecordType::LAND, FourCC("LAND")},
|
||||||
|
{RecordType::LCRT, FourCC("LCRT")},
|
||||||
|
{RecordType::LCTN, FourCC("LCTN")},
|
||||||
|
{RecordType::LENS, FourCC("LENS")},
|
||||||
|
{RecordType::LGTM, FourCC("LGTM")},
|
||||||
|
{RecordType::LIGH, FourCC("LIGH")},
|
||||||
|
{RecordType::LSCR, FourCC("LSCR")},
|
||||||
|
{RecordType::LTEX, FourCC("LTEX")},
|
||||||
|
{RecordType::LVLI, FourCC("LVLI")},
|
||||||
|
{RecordType::LVLN, FourCC("LVLN")},
|
||||||
|
{RecordType::LVSP, FourCC("LVSP")},
|
||||||
|
{RecordType::MATO, FourCC("MATO")},
|
||||||
|
{RecordType::MATT, FourCC("MATT")},
|
||||||
|
{RecordType::MESG, FourCC("MESG")},
|
||||||
|
{RecordType::MGEF, FourCC("MGEF")},
|
||||||
|
{RecordType::MISC, FourCC("MISC")},
|
||||||
|
{RecordType::MOVT, FourCC("MOVT")},
|
||||||
|
{RecordType::MSTT, FourCC("MSTT")},
|
||||||
|
{RecordType::MUSC, FourCC("MUSC")},
|
||||||
|
{RecordType::MUST, FourCC("MUST")},
|
||||||
|
{RecordType::NAVI, FourCC("NAVI")},
|
||||||
|
{RecordType::NAVM, FourCC("NAVM")},
|
||||||
|
{RecordType::NOTE, FourCC("NOTE")},
|
||||||
|
{RecordType::NPC_, FourCC("NPC_")},
|
||||||
|
{RecordType::OTFT, FourCC("OTFT")},
|
||||||
|
{RecordType::PACK, FourCC("PACK")},
|
||||||
|
{RecordType::PARW, FourCC("PARW")},
|
||||||
|
{RecordType::PBAR, FourCC("PBAR")},
|
||||||
|
{RecordType::PBEA, FourCC("PBEA")},
|
||||||
|
{RecordType::PCON, FourCC("PCON")},
|
||||||
|
{RecordType::PERK, FourCC("PERK")},
|
||||||
|
{RecordType::PFLA, FourCC("PFLA")},
|
||||||
|
{RecordType::PGRE, FourCC("PGRE")},
|
||||||
|
{RecordType::PHZD, FourCC("PHZD")},
|
||||||
|
{RecordType::PLYR, FourCC("PLYR")},
|
||||||
|
{RecordType::PMIS, FourCC("PMIS")},
|
||||||
|
{RecordType::PROJ, FourCC("PROJ")},
|
||||||
|
{RecordType::PWAT, FourCC("PWAT")},
|
||||||
|
{RecordType::QUST, FourCC("QUST")},
|
||||||
|
{RecordType::RACE, FourCC("RACE")},
|
||||||
|
{RecordType::REFR, FourCC("REFR")},
|
||||||
|
{RecordType::REGN, FourCC("REGN")},
|
||||||
|
{RecordType::RELA, FourCC("RELA")},
|
||||||
|
{RecordType::REVB, FourCC("REVB")},
|
||||||
|
{RecordType::RFCT, FourCC("RFCT")},
|
||||||
|
{RecordType::RGDL, FourCC("RGDL")},
|
||||||
|
{RecordType::SCEN, FourCC("SCEN")},
|
||||||
|
{RecordType::SCOL, FourCC("SCOL")},
|
||||||
|
{RecordType::SCOL, FourCC("SCOL")},
|
||||||
|
{RecordType::SCPT, FourCC("SCPT")},
|
||||||
|
{RecordType::SCRL, FourCC("SCRL")},
|
||||||
|
{RecordType::SHOU, FourCC("SHOU")},
|
||||||
|
{RecordType::SLGM, FourCC("SLGM")},
|
||||||
|
{RecordType::SMBN, FourCC("SMBN")},
|
||||||
|
{RecordType::SMEN, FourCC("SMEN")},
|
||||||
|
{RecordType::SMQN, FourCC("SMQN")},
|
||||||
|
{RecordType::SNCT, FourCC("SNCT")},
|
||||||
|
{RecordType::SNDR, FourCC("SNDR")},
|
||||||
|
{RecordType::SOPM, FourCC("SOPM")},
|
||||||
|
{RecordType::SOUN, FourCC("SOUN")},
|
||||||
|
{RecordType::SPEL, FourCC("SPEL")},
|
||||||
|
{RecordType::SPGD, FourCC("SPGD")},
|
||||||
|
{RecordType::STAT, FourCC("STAT")},
|
||||||
|
{RecordType::TACT, FourCC("TACT")},
|
||||||
|
{RecordType::TES4, FourCC("TES4")},
|
||||||
|
{RecordType::TREE, FourCC("TREE")},
|
||||||
|
{RecordType::TXST, FourCC("TXST")},
|
||||||
|
{RecordType::VOLI, FourCC("VOLI")},
|
||||||
|
{RecordType::VTYP, FourCC("VTYP")},
|
||||||
|
{RecordType::WATR, FourCC("WATR")},
|
||||||
|
{RecordType::WEAP, FourCC("WEAP")},
|
||||||
|
{RecordType::WOOP, FourCC("WOOP")},
|
||||||
|
{RecordType::WRLD, FourCC("WRLD")},
|
||||||
|
{RecordType::WTHR, FourCC("WTHR")},
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr std::pair<GroupType, std::string_view> group_type_names_map[] = {
|
||||||
|
{GroupType::Top , "Top Type" },
|
||||||
|
{GroupType::WorldChildren , "World Children" },
|
||||||
|
{GroupType::InteriorCellBlock , "Interior Cell Block" },
|
||||||
|
{GroupType::InteriorCellSubBlock , "Interior Cell Sub-Block" },
|
||||||
|
{GroupType::ExteriorCellBlock , "Exterior Cell" },
|
||||||
|
{GroupType::ExteriorCellSubBlock , "Exterior Cell Sub-Block" },
|
||||||
|
{GroupType::CellChildren , "Cell Children" },
|
||||||
|
{GroupType::TopicChildren , "Topic Children" },
|
||||||
|
{GroupType::CellPersistentChildren, "Cell Persistent Children"},
|
||||||
|
{GroupType::CellTemporaryChildren , "Cell Temporary Children" },
|
||||||
|
};
|
||||||
|
|
||||||
|
struct flag {
|
||||||
|
RecordType type;
|
||||||
|
unsigned bit;
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr std::pair<flag, std::string_view> flag_strings_map[]{
|
||||||
|
{{RecordType::ACHR, 9}, "Starts Dead"},
|
||||||
|
};
|
||||||
|
|
||||||
|
struct refr_flag {
|
||||||
|
RecordType refr_type;
|
||||||
|
unsigned bit;
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr std::pair<flag, std::string_view> refr_flag_strings_map[]{
|
||||||
|
{{RecordType::ACHR, 9}, "Hidden From Local Map"},
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
7
Navmesher/main.cpp
Normal file
7
Navmesher/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <iostream>
|
||||||
|
#include "esx_reader.hpp"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << "Test" << std::endl;
|
||||||
|
}
|
||||||
46
Navmesher/utility.hpp
Normal file
46
Navmesher/utility.hpp
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
|
namespace utility {
|
||||||
|
|
||||||
|
// Converts a string literal to a std::array<char>, from https://stackoverflow.com/a/33484394
|
||||||
|
template <std::size_t N, std::size_t ... Is>
|
||||||
|
constexpr std::array<char, N - 1>
|
||||||
|
literal_to_array(const char(&a)[N], std::index_sequence<Is...>)
|
||||||
|
{
|
||||||
|
return { {a[Is]...} };
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t N>
|
||||||
|
constexpr std::array<char, N - 1> literal_to_array(const char(&a)[N])
|
||||||
|
{
|
||||||
|
return literal_to_array(a, std::make_index_sequence<N - 1>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Used to inspect type sizes and values at compile time. Example:
|
||||||
|
//
|
||||||
|
// TS<sizeof(Type)> x = 0;
|
||||||
|
//
|
||||||
|
// or
|
||||||
|
//
|
||||||
|
// TD<Type> x = 0;
|
||||||
|
template<size_t X>
|
||||||
|
class TS;
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class TD;
|
||||||
|
|
||||||
|
|
||||||
|
// This is a base class for a generic store for some value that can be represented by
|
||||||
|
// type T but should not be type checked as type T, but rather some more constrained class.
|
||||||
|
template <class T>
|
||||||
|
struct Store {
|
||||||
|
static_assert(std::is_trivial_v<T>);
|
||||||
|
T value;
|
||||||
|
friend constexpr auto operator<=>(const Store &, const Store &) noexcept = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
114
reference/flag_filter.py
Normal file
114
reference/flag_filter.py
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
import re
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
|
class Jsonify:
|
||||||
|
def encode(self, value=None):
|
||||||
|
if not value:
|
||||||
|
value = self.__dict__
|
||||||
|
return value
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Flag(Jsonify):
|
||||||
|
bit: int
|
||||||
|
description: str
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Record(Jsonify):
|
||||||
|
fourcc: str
|
||||||
|
name: str
|
||||||
|
flags: list[Flag]
|
||||||
|
|
||||||
|
|
||||||
|
re_flags = re.compile(".*?(\d+?),.*?'(.*)'")
|
||||||
|
|
||||||
|
|
||||||
|
def find_records(data, re_record, re_first):
|
||||||
|
found_records = re_record.findall(data)
|
||||||
|
|
||||||
|
seen = set()
|
||||||
|
records = []
|
||||||
|
for record in found_records:
|
||||||
|
s = record.split('\n')
|
||||||
|
[first] = re_first.findall(s[0])
|
||||||
|
assert len(first) == 2, "Could not parse first line of record:\n{}".format(record)
|
||||||
|
flags = []
|
||||||
|
for line in s[2:-1]:
|
||||||
|
[f] = re_flags.findall(line)
|
||||||
|
assert len(f) == 2, "Could not parse flag definition: {}".format(line)
|
||||||
|
desc = f[1].replace("''", "'").replace("', '", "")
|
||||||
|
flags += [Flag(int(f[0]), desc)]
|
||||||
|
r = Record(first[0], first[1], flags)
|
||||||
|
if r.fourcc not in seen:
|
||||||
|
records += [r]
|
||||||
|
seen.add(r.fourcc)
|
||||||
|
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
def find_wbRecords(data):
|
||||||
|
re_wbRecord = re.compile("wbRecord\(.*?\n.*?wbFlagsList\(\[\n(?:.*?\n)*?.*?\]")
|
||||||
|
re_wbRecord_first = re.compile("wbRecord\((\w{4}).*?'(.+?)'.*?")
|
||||||
|
return find_records(data, re_wbRecord, re_wbRecord_first)
|
||||||
|
|
||||||
|
|
||||||
|
def find_stat(data):
|
||||||
|
re_stat = re.compile("wbRecord\(STAT,.*?\n.*?\n(?:.*?\n)+?.*?]")
|
||||||
|
lines = re_stat.findall(data)[0].split('\n')
|
||||||
|
|
||||||
|
re_stat_first = re.compile("STAT, '(.*?)'")
|
||||||
|
[name] = re_stat_first.findall(lines[0])
|
||||||
|
|
||||||
|
re_stat_flag = re.compile("'(.*?)'")
|
||||||
|
flags = []
|
||||||
|
for i, line in enumerate(lines[2:-1]):
|
||||||
|
[l] = re_stat_flag.findall(line)
|
||||||
|
if l:
|
||||||
|
flags += [Flag(i, l)]
|
||||||
|
|
||||||
|
return Record("STAT", name, flags)
|
||||||
|
|
||||||
|
|
||||||
|
def find_concrete_wbRefRecords(data):
|
||||||
|
re_wbRefRecord = re.compile("wbRefRecord\(\w{4},.*?\n.*?wbFlagsList\(\[.*?\n(?:.*?\n)+?.*?\]")
|
||||||
|
re_wbRefRecord_first = re.compile("wbRefRecord\((\w{4}).*?'(.+?)'.*?")
|
||||||
|
return find_records(data, re_wbRefRecord, re_wbRefRecord_first)
|
||||||
|
|
||||||
|
|
||||||
|
def find_ReferenceRecords(data):
|
||||||
|
re_ReferenceRecordDef = re.compile("wbRefRecord\(aSignature, .*?\n(?:.*?\n)+?.*?]")
|
||||||
|
re_ReferenceRecordDef_first = re.compile("wbRefRecord\((\w+?), (\w+?),")
|
||||||
|
[d] = find_records(data, re_ReferenceRecordDef, re_ReferenceRecordDef_first)
|
||||||
|
|
||||||
|
re_ReferenceRecord = re.compile("ReferenceRecord\((\w{4}), '(.*?)'\);")
|
||||||
|
rr = re_ReferenceRecord.findall(data)
|
||||||
|
|
||||||
|
records = [Record(r[0], r[1], d.flags) for r in rr]
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
def find_wbRefRecords(data):
|
||||||
|
records = find_concrete_wbRefRecords(data)
|
||||||
|
records = find_ReferenceRecords(data)
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
|
fdir = os.path.dirname(__file__)
|
||||||
|
with open(os.path.join(fdir, "wbDefinitionsTES5.pas"), "r") as f:
|
||||||
|
inp = f.read()
|
||||||
|
|
||||||
|
records = find_wbRecords(inp) + [find_stat(inp)] + find_wbRefRecords(inp)
|
||||||
|
records.sort(key = lambda x: x.fourcc)
|
||||||
|
print(len(records))
|
||||||
|
|
||||||
|
class Encoder(json.JSONEncoder):
|
||||||
|
def default(self, obj):
|
||||||
|
if isinstance(obj, Jsonify):
|
||||||
|
return obj.encode()
|
||||||
|
else:
|
||||||
|
return json.JSONEncoder.default(self, obj)
|
||||||
|
|
||||||
|
with open(os.path.join(fdir, "flags.json"), "w") as f:
|
||||||
|
json.dump(records, f, cls=Encoder, indent=4)
|
||||||
1391
reference/flags.json
Normal file
1391
reference/flags.json
Normal file
File diff suppressed because it is too large
Load Diff
95
reference/record_filter.py
Normal file
95
reference/record_filter.py
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
import os
|
||||||
|
import re
|
||||||
|
import json
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
# helper used when dumping the records to JSON
|
||||||
|
class Jsonify:
|
||||||
|
def encode(self, value=None):
|
||||||
|
if not value:
|
||||||
|
value = self.__dict__
|
||||||
|
return value
|
||||||
|
|
||||||
|
# Record model
|
||||||
|
@dataclass
|
||||||
|
class Flag(Jsonify):
|
||||||
|
bit: int
|
||||||
|
description: str
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Record(Jsonify):
|
||||||
|
fourcc: str
|
||||||
|
name: str
|
||||||
|
flags: list[Flag]
|
||||||
|
|
||||||
|
|
||||||
|
# open and read the records from xEdit source
|
||||||
|
fdir = os.path.dirname(__file__)
|
||||||
|
with open(os.path.join(fdir, "wbDefinitionsTES5.pas"), "r") as f:
|
||||||
|
inp = f.read()
|
||||||
|
|
||||||
|
# find all wbRecord/wbRefRecord calls
|
||||||
|
re_record = re.compile("(?:wbRecord|wbRefRecord)\((.*?\n(?:.*?\n)*?.*?)\);")
|
||||||
|
all = re_record.findall(inp)
|
||||||
|
|
||||||
|
# find all ReferenceRecord calls
|
||||||
|
re_ReferenceRecord = re.compile("ReferenceRecord\((\w{4}), '(.*?)'\);")
|
||||||
|
rr = re_ReferenceRecord.findall(inp)
|
||||||
|
|
||||||
|
# partition all into true records and the ReferenceRecord template
|
||||||
|
[ref_template] = [x for x in all if x.startswith('aSignature')]
|
||||||
|
all = [x for x in all if not x.startswith('aSignature')]
|
||||||
|
|
||||||
|
# generate and add ReferenceRecords to all
|
||||||
|
for sig, name in rr:
|
||||||
|
all += [ref_template.replace('aSignature', sig).replace('aName', "'" + name + "'")]
|
||||||
|
|
||||||
|
# parse strings into Records
|
||||||
|
re_first = re.compile("(\w{4}), '(.*?)'")
|
||||||
|
re_flags = re.compile(".*?\n.*?wbFlagsList\(.*?\n(?:.*?\n)+?.*?\]")
|
||||||
|
re_flag_line = re.compile(".*?(\d+?),.*?'(.*)'")
|
||||||
|
re_stat_flag = re.compile(".*?'(.*?)'")
|
||||||
|
records = []
|
||||||
|
for string in all:
|
||||||
|
# git sig and name from first line
|
||||||
|
sig, name = re_first.match(string).groups()
|
||||||
|
# check for a flag list, process if found
|
||||||
|
flags_string = re_flags.match(string)
|
||||||
|
flags = []
|
||||||
|
if flags_string:
|
||||||
|
flag_lines = flags_string.group(0).split('\n')[2:-1]
|
||||||
|
assert len(flag_lines) > 0
|
||||||
|
for line in flag_lines:
|
||||||
|
bit, desc = re_flag_line.match(line).groups()
|
||||||
|
flags += [Flag(bit, desc)]
|
||||||
|
# handle STAT special case
|
||||||
|
elif sig == "STAT":
|
||||||
|
flags_string = re.match(".*?\n.*?wbFlags\(.*?\n(?:.*?\n){32}.*?\]", string).group(0)
|
||||||
|
lines = flags_string.split('\n')[2:-1]
|
||||||
|
for bit, line in enumerate(lines):
|
||||||
|
desc = re_stat_flag.match(line).group(1)
|
||||||
|
if desc:
|
||||||
|
flags += [Flag(bit, desc)]
|
||||||
|
records += [Record(sig, name, flags)]
|
||||||
|
|
||||||
|
# remove duplicates
|
||||||
|
rdict = {r.fourcc: r for r in records}
|
||||||
|
records = list(rdict.values())
|
||||||
|
|
||||||
|
# add in the apparently supported NOTE
|
||||||
|
records += [Record("NOTE", "Note", [])]
|
||||||
|
|
||||||
|
# sort the records by signature
|
||||||
|
records = sorted(records, key=lambda x: x.fourcc)
|
||||||
|
|
||||||
|
# write the records out to a JSON file
|
||||||
|
class Encoder(json.JSONEncoder):
|
||||||
|
def default(self, obj):
|
||||||
|
if isinstance(obj, Jsonify):
|
||||||
|
return obj.encode()
|
||||||
|
else:
|
||||||
|
return json.JSONEncoder.default(self, obj)
|
||||||
|
|
||||||
|
with open(os.path.join(fdir, "flags.json"), "w") as f:
|
||||||
|
json.dump(records, f, cls=Encoder, indent=4)
|
||||||
|
|
||||||
137
reference/record_types.csv
Normal file
137
reference/record_types.csv
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
AACT,Action
|
||||||
|
ACHR,Placed NPC
|
||||||
|
ACTI,Activator
|
||||||
|
ADDN,Addon Node
|
||||||
|
ALCH,Ingestible
|
||||||
|
AMMO,Ammunition
|
||||||
|
ANIO,Animated Object
|
||||||
|
APPA,Alchemical Apparatus
|
||||||
|
ARMA,Armor Addon
|
||||||
|
ARMO,Armor
|
||||||
|
ARTO,Art Object
|
||||||
|
ASPC,Acoustic Space
|
||||||
|
ASTP,Association Type
|
||||||
|
AVIF,Actor Value Information
|
||||||
|
BOOK,Book
|
||||||
|
BPTD,Body Part Data
|
||||||
|
CAMS,Camera Shot
|
||||||
|
CELL,Cell
|
||||||
|
CLAS,Class
|
||||||
|
CLDC,CLDC
|
||||||
|
CLFM,Color
|
||||||
|
CLMT,Climate
|
||||||
|
COBJ,Constructible Object
|
||||||
|
COLL,Collision Layer
|
||||||
|
CONT,Container
|
||||||
|
CPTH,Camera Path
|
||||||
|
CSTY,Combat Style
|
||||||
|
DEBR,Debris
|
||||||
|
DIAL,Dialog Topic
|
||||||
|
DLBR,Dialog Branch
|
||||||
|
DLVW,Dialog View
|
||||||
|
DOBJ,Default Object Manager
|
||||||
|
DOOR,Door
|
||||||
|
DUAL,Dual Cast Data
|
||||||
|
ECZN,Encounter Zone
|
||||||
|
EFSH,Effect Shader
|
||||||
|
ENCH,Object Effect
|
||||||
|
EQUP,Equip Type
|
||||||
|
EXPL,Explosion
|
||||||
|
EYES,Eyes
|
||||||
|
FACT,Faction
|
||||||
|
FLOR,Flora
|
||||||
|
FLST,FormID List
|
||||||
|
FSTP,Footstep
|
||||||
|
FSTS,Footstep Set
|
||||||
|
FURN,Furniture
|
||||||
|
GLOB,Global
|
||||||
|
GMST,Game Setting
|
||||||
|
GRAS,Grass
|
||||||
|
GRUP,Internal File Structure Group
|
||||||
|
HAIR,HAIR
|
||||||
|
HAZD,Hazard
|
||||||
|
HDPT,Head Part
|
||||||
|
IDLE,Idle Animation
|
||||||
|
IDLM,Idle Marker
|
||||||
|
IMAD,Image Space Adapter
|
||||||
|
IMGS,Image Space
|
||||||
|
INFO,Dialog response
|
||||||
|
INGR,Ingredient
|
||||||
|
IPCT,Impact
|
||||||
|
IPDS,Impact Data Set
|
||||||
|
KEYM,Key
|
||||||
|
KYWD,Keyword
|
||||||
|
LAND,Landscape
|
||||||
|
LCRT,Location Reference Type
|
||||||
|
LCTN,Location
|
||||||
|
LENS,Lens Flare
|
||||||
|
LGTM,Lighting Template
|
||||||
|
LIGH,Light
|
||||||
|
LSCR,Load Screen
|
||||||
|
LTEX,Landscape Texture
|
||||||
|
LVLI,Leveled Item
|
||||||
|
LVLN,Leveled NPC
|
||||||
|
LVSP,Leveled Spell
|
||||||
|
MATO,Material Object
|
||||||
|
MATT,Material Type
|
||||||
|
MESG,Message
|
||||||
|
MGEF,Magic Effect
|
||||||
|
MISC,Misc. Item
|
||||||
|
MOVT,Movement Type
|
||||||
|
MSTT,Moveable Static
|
||||||
|
MUSC,Music Type
|
||||||
|
MUST,Music Track
|
||||||
|
NAVI,Navigation Mesh Info Map
|
||||||
|
NAVM,Navigation Mesh
|
||||||
|
NOTE,NOTE
|
||||||
|
NPC_,Non-Player Character (Actor)
|
||||||
|
OTFT,Outfit
|
||||||
|
PACK,Package
|
||||||
|
PARW,Placed Arrow
|
||||||
|
PBAR,Placed Barrier
|
||||||
|
PBEA,Placed Beam
|
||||||
|
PCON,Placed Cone/Voice
|
||||||
|
PERK,Perk
|
||||||
|
PFLA,Placed Flame
|
||||||
|
PGRE,Placed Projectile
|
||||||
|
PHZD,Placed Hazard
|
||||||
|
PLYR,Player Reference
|
||||||
|
PMIS,Placed Missile
|
||||||
|
PROJ,Projectile
|
||||||
|
PWAT,PWAT
|
||||||
|
QUST,Quest
|
||||||
|
RACE,Race
|
||||||
|
REFR,Placed Object
|
||||||
|
REGN,Region
|
||||||
|
RELA,Relationship
|
||||||
|
REVB,Reverb Parameters
|
||||||
|
RFCT,Visual Effect
|
||||||
|
RGDL,RGDL
|
||||||
|
SCEN,Scene
|
||||||
|
SCOL,SCOL
|
||||||
|
SCOL,Static Collection
|
||||||
|
SCPT,SCPT
|
||||||
|
SCRL,Scroll
|
||||||
|
SHOU,Shout
|
||||||
|
SLGM,Soul Gem
|
||||||
|
SMBN,Story Manager Branch Node
|
||||||
|
SMEN,Story Manager Event Node
|
||||||
|
SMQN,Story Manager Quest Node
|
||||||
|
SNCT,Sound Category
|
||||||
|
SNDR,Sound Descriptor
|
||||||
|
SOPM,Sound Output Model
|
||||||
|
SOUN,Sound Marker
|
||||||
|
SPEL,Spell
|
||||||
|
SPGD,Shader Particle Geometry
|
||||||
|
STAT,Static
|
||||||
|
TACT,Talking Activator
|
||||||
|
TES4,Main File Header
|
||||||
|
TREE,Tree
|
||||||
|
TXST,Texture Set
|
||||||
|
VOLI,Volumetric Lighting
|
||||||
|
VTYP,Voice Type
|
||||||
|
WATR,Water
|
||||||
|
WEAP,Weapon
|
||||||
|
WOOP,Word of Power
|
||||||
|
WRLD,Worldspace
|
||||||
|
WTHR,Weather
|
||||||
|
13841
reference/wbDefinitionsTES5.pas
Normal file
13841
reference/wbDefinitionsTES5.pas
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user