Skip to content

Commit

Permalink
gust_g1t: Fix some DDS texture not being openable by image editors
Browse files Browse the repository at this point in the history
Looks like most image editors bark if you have a DDS_NORMAL flag with RGBA.
Closes #84
  • Loading branch information
VitaSmith committed Aug 15, 2023
1 parent 9a5fa9a commit fa7ffe5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .vs/gust_g1t.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>NORM.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>H_RUK_Q.g1t</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>NORM.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>H_RUK_Q.g1t</LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>NORM.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>H_RUK_Q.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>NORM.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerCommandArguments>H_RUK_Q.g1t</LocalDebuggerCommandArguments>
<LocalDebuggerWorkingDirectory>$(SolutionDir)</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
Expand Down
4 changes: 3 additions & 1 deletion gust_g1t.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ static size_t write_dds_header(FILE* fd, enum DDS_FORMAT format, uint32_t width,
header.caps |= DDS_SURFACE_FLAGS_CUBEMAP;
header.caps2 |= DDS_CUBEMAP_ALLFACES;
}
if (flags[0] & G1T_FLAG_NORMAL_MAP)
// https://github.com/VitaSmith/gust_tools/issues/84
// Can't have DDS_NORMAL with RGBA textures
if ((flags[0] & G1T_FLAG_NORMAL_MAP) && !(header.ddspf.flags & DDS_RGBA))
header.ddspf.flags |= DDS_NORMAL;
size_t r = fwrite(&header, sizeof(DDS_HEADER), 1, fd);
if (r != 1)
Expand Down

0 comments on commit fa7ffe5

Please sign in to comment.