command-line tools updated with -flist
This commit is contained in:
parent
211d960034
commit
3a4748ddeb
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -74,6 +75,7 @@ enum OPTIONS
|
||||
OPT_TA_WRAP,
|
||||
OPT_TA_MIRROR,
|
||||
OPT_TONEMAP,
|
||||
OPT_FILELIST,
|
||||
OPT_MAX
|
||||
};
|
||||
|
||||
@ -126,6 +128,7 @@ const SValue g_pOptions [] =
|
||||
{ L"wrap", OPT_TA_WRAP },
|
||||
{ L"mirror", OPT_TA_MIRROR },
|
||||
{ L"tonemap", OPT_TONEMAP },
|
||||
{ L"flist", OPT_FILELIST },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
@ -495,6 +498,7 @@ namespace
|
||||
wprintf(L" -dx10 Force use of 'DX10' extended header\n");
|
||||
wprintf(L" -nologo suppress copyright message\n");
|
||||
wprintf(L" -tonemap Apply a tonemap operator based on maximum luminance\n");
|
||||
wprintf(L" -flist <filename> use text file with a list of input files (one per line)\n");
|
||||
|
||||
wprintf(L"\n <format>: ");
|
||||
PrintList(13, g_pFormats);
|
||||
@ -592,6 +596,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_FORMAT:
|
||||
case OPT_FILTER:
|
||||
case OPT_OUTPUTFILE:
|
||||
case OPT_FILELIST:
|
||||
if (!*pValue)
|
||||
{
|
||||
if ((iArg + 1 >= argc))
|
||||
@ -703,6 +708,48 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
}
|
||||
dwFilterOpts |= TEX_FILTER_MIRROR;
|
||||
break;
|
||||
|
||||
case OPT_FILELIST:
|
||||
{
|
||||
std::wifstream inFile(pValue);
|
||||
if (!inFile)
|
||||
{
|
||||
wprintf(L"Error opening -flist file %ls\n", pValue);
|
||||
return 1;
|
||||
}
|
||||
wchar_t fname[1024] = {};
|
||||
for (;;)
|
||||
{
|
||||
inFile >> fname;
|
||||
if (!inFile)
|
||||
break;
|
||||
|
||||
if (*fname == L'#')
|
||||
{
|
||||
// Comment
|
||||
}
|
||||
else if (*fname == L'-')
|
||||
{
|
||||
wprintf(L"Command-line arguments not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else if (wcspbrk(fname, L"?*") != nullptr)
|
||||
{
|
||||
wprintf(L"Wildcards not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SConversion conv;
|
||||
wcscpy_s(conv.szSrc, MAX_PATH, fname);
|
||||
conversion.push_back(conv);
|
||||
}
|
||||
|
||||
inFile.ignore(1000, '\n');
|
||||
}
|
||||
inFile.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (wcspbrk(pArg, L"?*") != nullptr)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
|
||||
@ -100,6 +101,7 @@ enum OPTIONS
|
||||
OPT_COLORKEY,
|
||||
OPT_TONEMAP,
|
||||
OPT_X2_BIAS,
|
||||
OPT_FILELIST,
|
||||
OPT_MAX
|
||||
};
|
||||
|
||||
@ -171,6 +173,7 @@ const SValue g_pOptions[] =
|
||||
{ L"c", OPT_COLORKEY },
|
||||
{ L"tonemap", OPT_TONEMAP },
|
||||
{ L"x2bias", OPT_X2_BIAS },
|
||||
{ L"flist", OPT_FILELIST },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
@ -696,6 +699,7 @@ namespace
|
||||
wprintf(L" -c <hex-RGB> colorkey (a.k.a. chromakey) transparency\n");
|
||||
wprintf(L" -tonemap Apply a tonemap operator based on maximum luminance\n");
|
||||
wprintf(L" -x2bias Enable *2 - 1 conversion cases for unorm/pos-only-float\n");
|
||||
wprintf(L" -flist <filename> use text file with a list of input files (one per line)\n");
|
||||
|
||||
wprintf(L"\n <format>: ");
|
||||
PrintList(13, g_pFormats);
|
||||
@ -956,6 +960,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_NORMAL_MAP_AMPLITUDE:
|
||||
case OPT_WIC_QUALITY:
|
||||
case OPT_COLORKEY:
|
||||
case OPT_FILELIST:
|
||||
if (!*pValue)
|
||||
{
|
||||
if ((iArg + 1 >= argc))
|
||||
@ -1277,6 +1282,48 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_X2_BIAS:
|
||||
dwConvert |= TEX_FILTER_FLOAT_X2BIAS;
|
||||
break;
|
||||
|
||||
case OPT_FILELIST:
|
||||
{
|
||||
std::wifstream inFile(pValue);
|
||||
if (!inFile)
|
||||
{
|
||||
wprintf(L"Error opening -flist file %ls\n", pValue);
|
||||
return 1;
|
||||
}
|
||||
wchar_t fname[1024] = {};
|
||||
for (;;)
|
||||
{
|
||||
inFile >> fname;
|
||||
if (!inFile)
|
||||
break;
|
||||
|
||||
if (*fname == L'#')
|
||||
{
|
||||
// Comment
|
||||
}
|
||||
else if (*fname == L'-')
|
||||
{
|
||||
wprintf(L"Command-line arguments not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else if (wcspbrk(fname, L"?*") != nullptr)
|
||||
{
|
||||
wprintf(L"Wildcards not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SConversion conv;
|
||||
wcscpy_s(conv.szSrc, MAX_PATH, fname);
|
||||
conversion.push_back(conv);
|
||||
}
|
||||
|
||||
inFile.ignore(1000, '\n');
|
||||
}
|
||||
inFile.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (wcspbrk(pArg, L"?*") != nullptr)
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@ -67,6 +68,7 @@ enum OPTIONS
|
||||
OPT_EXPAND_LUMINANCE,
|
||||
OPT_TARGET_PIXELX,
|
||||
OPT_TARGET_PIXELY,
|
||||
OPT_FILELIST,
|
||||
OPT_MAX
|
||||
};
|
||||
|
||||
@ -112,6 +114,7 @@ const SValue g_pOptions[] =
|
||||
{ L"xlum", OPT_EXPAND_LUMINANCE },
|
||||
{ L"targetx", OPT_TARGET_PIXELX },
|
||||
{ L"targety", OPT_TARGET_PIXELY },
|
||||
{ L"flist", OPT_FILELIST },
|
||||
{ nullptr, 0 }
|
||||
};
|
||||
|
||||
@ -511,6 +514,7 @@ namespace
|
||||
wprintf(L" -targetx <num> dump pixels at location x (defaults to all)\n");
|
||||
wprintf(L" -targety <num> dump pixels at location y (defaults to all)\n");
|
||||
wprintf(L"\n -nologo suppress copyright message\n");
|
||||
wprintf(L" -flist <filename> use text file with a list of input files (one per line)\n");
|
||||
|
||||
wprintf(L"\n <format>: ");
|
||||
PrintList(13, g_pFormats);
|
||||
@ -3040,6 +3044,7 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
case OPT_OUTPUTFILE:
|
||||
case OPT_TARGET_PIXELX:
|
||||
case OPT_TARGET_PIXELY:
|
||||
case OPT_FILELIST:
|
||||
if (!*pValue)
|
||||
{
|
||||
if ((iArg + 1 >= argc))
|
||||
@ -3124,6 +3129,48 @@ int __cdecl wmain(_In_ int argc, _In_z_count_(argc) wchar_t* argv[])
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_FILELIST:
|
||||
{
|
||||
std::wifstream inFile(pValue);
|
||||
if (!inFile)
|
||||
{
|
||||
wprintf(L"Error opening -flist file %ls\n", pValue);
|
||||
return 1;
|
||||
}
|
||||
wchar_t fname[1024] = {};
|
||||
for (;;)
|
||||
{
|
||||
inFile >> fname;
|
||||
if (!inFile)
|
||||
break;
|
||||
|
||||
if (*fname == L'#')
|
||||
{
|
||||
// Comment
|
||||
}
|
||||
else if (*fname == L'-')
|
||||
{
|
||||
wprintf(L"Command-line arguments not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else if (wcspbrk(fname, L"?*") != nullptr)
|
||||
{
|
||||
wprintf(L"Wildcards not supported in -flist file\n");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SConversion conv;
|
||||
wcscpy_s(conv.szSrc, MAX_PATH, fname);
|
||||
conversion.push_back(conv);
|
||||
}
|
||||
|
||||
inFile.ignore(1000, '\n');
|
||||
}
|
||||
inFile.close();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (wcspbrk(pArg, L"?*") != nullptr)
|
||||
|
Loading…
Reference in New Issue
Block a user