Skip to content

Commit

Permalink
Merge pull request #13 from r-ex/main
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
biast12 authored Jan 20, 2024
2 parents 932b5b7 + 932d5c1 commit d996726
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 219 deletions.
Binary file modified Legion/Legion.rc
Binary file not shown.
6 changes: 4 additions & 2 deletions Legion/Legion.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(SolutionDir)cppnet\cppkore;$(IncludePath);$(ProjectDir)</IncludePath>
<IncludePath>$(SolutionDir)Legion\src;$(SolutionDir)cppnet\cppkore;$(IncludePath);$(ProjectDir)</IncludePath>
<LibraryPath>$(SolutionDir)bin\x64\Debug;$(SolutionDir)cppnet\cppkore_libs;$(LibraryPath)</LibraryPath>
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
<TargetName>LegionPlus</TargetName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)cppnet\cppkore;$(ProjectDir);$(IncludePath)</IncludePath>
<IncludePath>$(SolutionDir)Legion\src;$(SolutionDir)cppnet\cppkore;$(ProjectDir);$(IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)bin\x64\Release;$(SolutionDir)cppnet\cppkore_libs;$(LibraryPath)</LibraryPath>
<IntDir>$(SolutionDir)build\$(ProjectName)\$(Platform)\$(Configuration)\</IntDir>
<OutDir>$(SolutionDir)bin\$(Platform)\$(Configuration)\</OutDir>
Expand Down Expand Up @@ -227,6 +227,8 @@
<ClInclude Include="RpakLib.h" />
<ClInclude Include="rtech.h" />
<ClInclude Include="MdlLib.h" />
<ClInclude Include="src\Assets\shader.h" />
<ClInclude Include="src\assets\texture.h" />
<ClInclude Include="Utils.h" />
<ClInclude Include="version.h" />
<ClInclude Include="VpkLib.h" />
Expand Down
42 changes: 24 additions & 18 deletions Legion/Legion.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@
<Filter Include="Legion\Preview">
<UniqueIdentifier>{72c346a6-6ed2-46f8-a4c3-489f7b11a713}</UniqueIdentifier>
</Filter>
<Filter Include="RPak\Assets">
<UniqueIdentifier>{1d655a94-b625-497a-ac5a-d9484a7c36c4}</UniqueIdentifier>
</Filter>
<Filter Include="bsplib">
<UniqueIdentifier>{f59c98a7-f049-459a-b95c-b439ba81ba60}</UniqueIdentifier>
</Filter>
<Filter Include="bsplib\games">
<UniqueIdentifier>{ea19d614-6142-4a5f-a7c6-8d36427be121}</UniqueIdentifier>
</Filter>
<Filter Include="RPak\assets">
<UniqueIdentifier>{1d655a94-b625-497a-ac5a-d9484a7c36c4}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\ApexAsset.cpp">
Expand Down Expand Up @@ -103,49 +103,49 @@
<Filter>Miles</Filter>
</ClCompile>
<ClCompile Include="src\Assets\model.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\material.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\texture.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\uiia.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\animation.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\datatable.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\subtitles.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\shader.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\uimg.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\assets\settings.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\assets\rson.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\qc.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\rui.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\rmap.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\Assets\effect.cpp">
<Filter>RPak\Assets</Filter>
<Filter>RPak\assets</Filter>
</ClCompile>
<ClCompile Include="src\bsplib\games\bsp_apexlegends.cpp">
<Filter>bsplib\games</Filter>
Expand Down Expand Up @@ -239,6 +239,12 @@
<ClInclude Include="bsplib.h">
<Filter>bsplib</Filter>
</ClInclude>
<ClInclude Include="src\Assets\shader.h">
<Filter>RPak\assets</Filter>
</ClInclude>
<ClInclude Include="src\assets\texture.h">
<Filter>RPak\assets</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Legion.rc">
Expand Down
167 changes: 0 additions & 167 deletions Legion/RpakAssets.h
Original file line number Diff line number Diff line change
Expand Up @@ -1181,174 +1181,7 @@ struct StarpakStreamEntry
};

// SHADERS
// --- shdr ---
struct ShaderHeader
{
uint32_t NameIndex;
uint32_t NameOffset;
uint64_t DataSize;
uint64_t Padding2;

uint32_t Index1;
uint32_t Offset1;

uint32_t Index2;
uint32_t Offset2;
};

struct RShaderImage
{
uint32_t DataIndex;
uint32_t DataOffset;
uint32_t DataSize;
uint32_t Size2;
uint32_t DataIndex2;
uint32_t DataOffset2;
};

// --- shds ---
struct ShaderSetHeader {
uint64_t VTablePadding;
uint32_t NameIndex;
uint32_t NameOffset;
uint8_t Unknown1[0x8];
uint16_t Count1;
uint16_t TextureInputCount;
uint16_t Count3;
uint8_t Byte1;
uint8_t Byte2;

uint8_t Unknown2[0x10];

uint64_t OldVertexShaderHash;
uint64_t OldPixelShaderHash;

// only used for version 12+
uint64_t VertexShaderHash;
uint64_t PixelShaderHash;
uint64_t PixelShaderHashTF;

};

struct ShaderSetHeaderTF {
uint64_t VTablePadding;
uint32_t NameIndex;
uint32_t NameOffset;
uint8_t Unknown1[0x8];
uint16_t Count1;
uint16_t TextureInputCount;
uint16_t Count3;
uint8_t Byte1;
uint8_t Byte2;

uint8_t Unknown2[0x28];

// only used for version 12+
uint64_t VertexShaderHash;
uint64_t PixelShaderHash;
};


struct ShaderDataHeader
{
uint32_t ByteCodeIndex;
uint32_t ByteCodeOffset;
uint32_t DataSize;
};

// DX Shader Types
enum ShaderType : uint16_t
{
ComputeShader = 0x4353,
DomainShader = 0x4453,
GeometryShader = 0x4753,
HullShader = 0x4853,
VertexShader = 0xFFFE,
PixelShader = 0xFFFF,
};

// shader "DXBC" header
struct DXBCHeader
{
char FourCC[4];
uint32_t Checksum[4];
uint32_t One;
uint32_t DataSize;
uint32_t ChunkCount;
};

struct RDefHeader
{
uint32_t Magic; // RDEF
uint32_t DataSize;
uint32_t ConstBufferCount;
uint32_t ConstBufferOffset;
uint32_t ResBindingCount;
uint32_t ResBindingOffset;
uint8_t MinorVersion;
uint8_t MajorVersion;
ShaderType ShaderType;
uint32_t Flags;
uint32_t CompilerStringOffset;
};

struct RDefConstBuffer
{
uint32_t NameOffset;

uint32_t VariableCount;
uint32_t VariableOffset;
uint32_t DataSize;
uint32_t Flags;
uint32_t BufferType;
};

struct RDefCBufVar
{
uint32_t NameOffset;
uint32_t CBufStartOffset;
uint32_t Size;
uint32_t Flags;
uint32_t TypeOffset;
uint32_t DefaultOffset; // offset to the default value of this var
uint32_t unk[4];
};

struct RDefCBufVarType
{
uint16_t Class;
uint16_t Type;
uint16_t MatrixRows;
uint16_t MatrixColumns;
uint16_t ArraySize;
uint16_t StructMemberCount;
uint16_t FirstMemberOffset;
};

struct RDefResBinding
{
uint32_t NameOffset;
D3D_SHADER_INPUT_TYPE InputType;
D3D_RESOURCE_RETURN_TYPE ReturnType;
uint32_t ViewDimension;
uint32_t SampleCount;
uint32_t BindPoint;
uint32_t BindCount;
D3D_SHADER_INPUT_FLAGS InputFlags;
};

struct ShaderVar
{
string Name;
D3D_SHADER_VARIABLE_TYPE Type;
int Size;
};

struct ShaderResBinding
{
string Name;
D3D_SHADER_INPUT_TYPE Type;
};

// uimg - ui image atlas
struct UIAtlasHeader
Expand Down
4 changes: 3 additions & 1 deletion Legion/RpakLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "Exporter.h"
#include "rmdlstructs.h"

#include <assets/shader.h>

#define MAX_LOADED_FILES 4096

#pragma pack(push, 1)
Expand Down Expand Up @@ -467,7 +469,7 @@ class RpakLib

List<List<DataTableColumnData>> ExtractDataTable(const RpakLoadAsset& Asset);
List<ShaderVar> ExtractShaderVars(const RpakLoadAsset& Asset, const std::string& CBufName = "", D3D_SHADER_VARIABLE_TYPE Type = D3D_SVT_FORCE_DWORD); // default value as a type that should never be used
List<ShaderResBinding> ExtractShaderResourceBindings(const RpakLoadAsset& Asset, D3D_SHADER_INPUT_TYPE InputType);
Dictionary<uint32_t, ShaderResBinding> ExtractShaderResourceBindings(const RpakLoadAsset& Asset, D3D_SHADER_INPUT_TYPE InputType);

// Used by the BSP system.
RMdlMaterial ExtractMaterial(const RpakLoadAsset& Asset, const string& Path, bool IncludeImages, bool IncludeImageNames);
Expand Down
Loading

0 comments on commit d996726

Please sign in to comment.