diff options
| author | lbavoil <[email protected]> | 2018-03-15 11:08:34 +0100 |
|---|---|---|
| committer | lbavoil <[email protected]> | 2018-03-15 11:08:34 +0100 |
| commit | 636807e68a85a978473764d171ed0c7cc36f9be6 (patch) | |
| tree | 784a3d4fa8f48b4c085dd959678505b2af12f425 /build/tools | |
| parent | Remove test folder (diff) | |
| download | hbaoplus-636807e68a85a978473764d171ed0c7cc36f9be6.tar.xz hbaoplus-636807e68a85a978473764d171ed0c7cc36f9be6.zip | |
HBAO+ 4.0.0.23740451
Diffstat (limited to 'build/tools')
| -rw-r--r-- | build/tools/Stringify/Stringify.cpp | 48 | ||||
| -rw-r--r-- | build/tools/Stringify/Stringify.sln | 2 | ||||
| -rw-r--r-- | build/tools/Stringify/Stringify.vcxproj | 8 | ||||
| -rw-r--r-- | build/tools/Stringify/Stringify.vcxproj.filters | 6 |
4 files changed, 38 insertions, 26 deletions
diff --git a/build/tools/Stringify/Stringify.cpp b/build/tools/Stringify/Stringify.cpp index ea3fe68..38bd512 100644 --- a/build/tools/Stringify/Stringify.cpp +++ b/build/tools/Stringify/Stringify.cpp @@ -1,8 +1,8 @@ -// Stringify.cpp : Defines the entry point for the console application. -// - -#include "stdafx.h" - +#define _CRT_SECURE_NO_WARNINGS +#include <stdio.h> +#include <tchar.h> +#include <stdlib.h> +#include <vector> int main(int argc, char* argv[]) { @@ -16,7 +16,15 @@ int main(int argc, char* argv[]) const char* pVariableName = argv[2]; const char *pFilenameOut = argv[3]; - FILE *fpIn = fopen(pFilenameIn, "r"); + FILE *fpIn = fopen(pFilenameIn, "rb"); + fseek(fpIn, 0, SEEK_END); + long fileSize = ftell(fpIn); + fseek(fpIn, 0, SEEK_SET); + std::vector<uint8_t> entireFile(fileSize); + fread(entireFile.data(), 1, (size_t)fileSize, fpIn); + entireFile.push_back(0); + fseek(fpIn, 0, SEEK_SET); + if (!fpIn) { fprintf(stderr, "Error: Failed to open %s\n", pFilenameIn); @@ -30,17 +38,29 @@ int main(int argc, char* argv[]) exit(1); } - fprintf(fpOut, "static const char* %s =\n", pVariableName); + // fprintf(fpOut, "// static const char* %s =\n", pVariableName); + // + // char row[1024]; + // while (fgets(row, sizeof(row), fpIn)) + // { + // row[strlen(row) - 1] = row[strlen(row) - 2] = 0; // remove \r\n + // + // fprintf(fpOut, "// \"%s\\n\"", row); + // } + // + // fprintf(fpOut, "// ;\n"); - char row[1024]; - while (fgets(row, sizeof(row), fpIn)) - { - row[strlen(row) - 1] = 0; // remove \n + fprintf(fpOut, "static const char %s[] =\n{", pVariableName); - fprintf(fpOut, "\"%s\\n\"\n", row); + for (size_t i = 0; i < entireFile.size(); ++i) + { + fprintf(fpOut, "0x%X, ", (uint32_t)entireFile[i]); + if (i % 16 == 15) + { + fprintf(fpOut, "\n"); + } } - - fprintf(fpOut, ";\n"); + fprintf(fpOut, "};\n"); fclose(fpIn); fclose(fpOut); diff --git a/build/tools/Stringify/Stringify.sln b/build/tools/Stringify/Stringify.sln index d11dcad..c12a8e8 100644 --- a/build/tools/Stringify/Stringify.sln +++ b/build/tools/Stringify/Stringify.sln @@ -1,7 +1,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stringify", "Stringify\Stringify.vcxproj", "{199AEFC4-A2BC-4837-9D0D-69BEB794F681}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Stringify", "Stringify.vcxproj", "{199AEFC4-A2BC-4837-9D0D-69BEB794F681}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/build/tools/Stringify/Stringify.vcxproj b/build/tools/Stringify/Stringify.vcxproj index 245cf4e..d39aa32 100644 --- a/build/tools/Stringify/Stringify.vcxproj +++ b/build/tools/Stringify/Stringify.vcxproj @@ -77,15 +77,13 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="stdafx.h" /> <ClInclude Include="targetver.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="stdafx.cpp"> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> - <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <ClCompile Include="Stringify.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader> </ClCompile> - <ClCompile Include="Stringify.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/build/tools/Stringify/Stringify.vcxproj.filters b/build/tools/Stringify/Stringify.vcxproj.filters index 7827edd..772f8fd 100644 --- a/build/tools/Stringify/Stringify.vcxproj.filters +++ b/build/tools/Stringify/Stringify.vcxproj.filters @@ -15,17 +15,11 @@ </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="stdafx.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="targetver.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <ClCompile Include="stdafx.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="Stringify.cpp"> <Filter>Source Files</Filter> </ClCompile> |