-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
978 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="..\src\modules\gx2\gx2_enum_string.cpp" /> | ||
<ClCompile Include="..\tools\gfd.cpp" /> | ||
<ClCompile Include="..\tools\gtx-convert\gtx-convert.cpp" /> | ||
<ClCompile Include="..\tools\gtx-convert\untile.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="..\tools\gfd.h" /> | ||
<ClInclude Include="..\tools\gtx-convert\untile.h" /> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{7CB8D060-968B-4173-B2BF-1E29088107F2}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>gshdisassemble</RootNamespace> | ||
<WindowsTargetPlatformVersion>10.0.10240.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</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|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" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LinkIncremental>true</LinkIncremental> | ||
<IncludePath>$(SolutionDir)\tools;$(SolutionDir)\src;$(SolutionDir)\libraries\docopt;$(SolutionDir)\libraries\gsl\include;$(SolutionDir)\libraries\spdlog\include;$(IncludePath)</IncludePath> | ||
<OutDir>$(SolutionDir)\obj\$(Configuration)\</OutDir> | ||
<IntDir>obj\$(ProjectName)\$(Configuration)\</IntDir> | ||
<LibraryPath>$(SolutionDir)\obj\$(Configuration);$(LibraryPath)</LibraryPath> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LinkIncremental>false</LinkIncremental> | ||
<OutDir>$(SolutionDir)\obj\$(Configuration)\</OutDir> | ||
<IntDir>obj\$(ProjectName)\$(Configuration)\</IntDir> | ||
<IncludePath>$(SolutionDir)\tools;$(SolutionDir)\src;$(SolutionDir)\libraries\docopt;$(SolutionDir)\libraries\gsl\include;$(SolutionDir)\libraries\spdlog\include;$(IncludePath)</IncludePath> | ||
<LibraryPath>$(SolutionDir)\obj\$(Configuration);$(LibraryPath)</LibraryPath> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>NOMINMAX;_CONSOLE;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<AdditionalDependencies>docopt.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>NOMINMAX;_CONSOLE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<AdditionalDependencies>docopt.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="Header Files"> | ||
<UniqueIdentifier>{f39f532d-a857-4aa2-a25d-773b4f6cb60a}</UniqueIdentifier> | ||
</Filter> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{b728fa72-a1fd-4056-9b35-afd40bc2003d}</UniqueIdentifier> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="..\tools\gtx-convert\gtx-convert.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="..\tools\gfd.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="..\src\modules\gx2\gx2_enum_string.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="..\tools\gtx-convert\untile.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="..\tools\gfd.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="..\tools\gtx-convert\untile.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "gfd.h" | ||
#include "utils/binaryfile.h" | ||
|
||
namespace gfd | ||
{ | ||
|
||
bool | ||
readFile(const std::string &filename, File &out) | ||
{ | ||
BinaryFile file; | ||
|
||
if (!file.open(filename)) { | ||
return false; | ||
} | ||
|
||
file.read(out.header); | ||
|
||
if (out.header.magic != FileHeader::Magic) { | ||
return false; | ||
} | ||
|
||
if (out.header.headerSize != sizeof(FileHeader)) { | ||
return false; | ||
} | ||
|
||
while (!file.eof()) { | ||
Block block; | ||
file.read(block.header); | ||
|
||
if (block.header.magic != BlockHeader::Magic) { | ||
return false; | ||
} | ||
|
||
if (block.header.headerSize != sizeof(BlockHeader)) { | ||
return false; | ||
} | ||
|
||
if (block.header.dataSize) { | ||
file.read(block.data, block.header.dataSize); | ||
} | ||
|
||
out.blocks.emplace_back(block); | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} // namespace gsh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include <cstdint> | ||
#include <vector> | ||
#include "utils/be_val.h" | ||
|
||
namespace gfd | ||
{ | ||
|
||
#pragma pack(push, 1) | ||
|
||
namespace BlockType | ||
{ | ||
enum Type : uint32_t | ||
{ | ||
VertexShaderHeader = 3, | ||
VertexShaderProgram = 5, | ||
PixelShaderHeader = 6, | ||
PixelShaderProgram = 7, | ||
GeometryShaderHeader = 8, | ||
GeometryShaderProgram = 9, | ||
TextureHeader = 11, | ||
TextureImage = 12, | ||
TextureMipmap = 13, | ||
}; | ||
} | ||
|
||
struct FileHeader | ||
{ | ||
static const uint32_t Magic = 0x47667832; | ||
be_val<uint32_t> magic; | ||
be_val<uint32_t> headerSize; | ||
be_val<uint32_t> version1; | ||
be_val<uint32_t> version2; | ||
be_val<uint32_t> version3; | ||
be_val<uint32_t> align; | ||
be_val<uint32_t> unk1; | ||
be_val<uint32_t> unk2; | ||
}; | ||
|
||
struct BlockHeader | ||
{ | ||
static const uint32_t Magic = 0x424C4B7B; | ||
be_val<uint32_t> magic; | ||
be_val<uint32_t> headerSize; | ||
be_val<uint32_t> version1; | ||
be_val<uint32_t> version2; | ||
be_val<BlockType::Type> type; | ||
be_val<uint32_t> dataSize; | ||
be_val<uint32_t> id; | ||
be_val<uint32_t> index; | ||
}; | ||
|
||
#pragma pack(pop) | ||
|
||
struct Block | ||
{ | ||
BlockHeader header; | ||
std::vector<uint8_t> data; | ||
}; | ||
|
||
struct File | ||
{ | ||
FileHeader header; | ||
std::vector<Block> blocks; | ||
}; | ||
|
||
bool | ||
readFile(const std::string &filename, File &out); | ||
|
||
} // namespace gfd | ||
|
File renamed without changes.
Oops, something went wrong.