refactor autopk3
unlimit list sizes * -pk3, -repack: support multiple bsp files input by command line
This commit is contained in:
parent
ff07c6e244
commit
a0e79e8ecd
|
|
@ -401,7 +401,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
|
||||
<h2 id="PK3-creation">PK3 creation<a href="#PK3-creation" class="wiki-anchor">¶</a></h2>
|
||||
<ul>
|
||||
<li><strong><code>-pk3</code> ... filename.bsp:</strong> Creates a pk3 for the BSP (complete Q3 support). Using file 'gamename.exclude' to exclude vanilla game resources.</li>
|
||||
<li><strong><code>-pk3</code> ... filename.bsp .. filenameN.bsp:</strong> Creates a pk3 for the BSP(s) (complete Q3 support). Using file 'gamename.exclude' to exclude vanilla game resources.</li>
|
||||
<li><strong><code>-complevel</code> N:</strong> Set compression level (-1 .. 10); 0 = uncompressed, -1 = 6, 10 = ultra zlib incompatible preset</li>
|
||||
<li><strong><code>-dbg</code>:</strong> Print wall of debug text, useful for .exclude file creation</li>
|
||||
<li><strong><code>-png</code>:</strong> include png textures, at highest priority; taking tga, jpg by default</li>
|
||||
|
|
@ -410,7 +410,7 @@ td.formatted_questions ol { margin-top: 0px; margin-bottom: 0px; }
|
|||
|
||||
<h2 id="Maps-repack-creation">Maps repack creation<a href="#Maps-repack-creation" class="wiki-anchor">¶</a></h2>
|
||||
<ul>
|
||||
<li><strong><code>-repack</code> ... filename.bsp or filenames.txt:</strong> Creates repack of BSP(s) (complete Q3 support). Rips off only used shaders to new shader file. Using file 'gamename.exclude' to exclude vanilla game resources and 'repack.exclude' to exclude resources of existing repack.</li>
|
||||
<li><strong><code>-repack</code> ... filename.bsp .. filenameN.bsp or filenames.txt:</strong> Creates repack of BSP(s) (complete Q3 support). Rips off only used shaders to new shader file. Using file 'gamename.exclude' to exclude vanilla game resources and 'repack.exclude' to exclude resources of existing repack.</li>
|
||||
<li><strong><code>-analyze</code>:</strong> Only print bsp resource references and exit</li>
|
||||
<li><strong><code>-complevel</code> N:</strong> Set compression level (-1 .. 10); 0 = uncompressed, -1 = 6, 10 = ultra zlib incompatible preset</li>
|
||||
<li><strong><code>-dbg</code>:</strong> Print wall of debug text</li>
|
||||
|
|
|
|||
|
|
@ -280,4 +280,30 @@ TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const Direct
|
|||
}
|
||||
|
||||
|
||||
template<typename SRC>
|
||||
class PathDefaultExtension
|
||||
{
|
||||
public:
|
||||
static_assert( std::is_same_v<SRC, PathCleaned> || std::is_same_v<SRC, const char*> );
|
||||
const SRC& m_path;
|
||||
const char* m_extension;
|
||||
PathDefaultExtension( const SRC& path, const char* extension ) : m_path( path ), m_extension( extension ) {}
|
||||
};
|
||||
|
||||
/// \brief Writes \p path to \p ostream and appends extension, if there is none.
|
||||
template<typename TextOutputStreamType, typename SRC>
|
||||
TextOutputStreamType& ostream_write( TextOutputStreamType& ostream, const PathDefaultExtension<SRC>& path ){
|
||||
ostream << path.m_path;
|
||||
if constexpr ( std::is_same_v<SRC, PathCleaned> ){
|
||||
if( strEmpty( path_get_extension( path.m_path.m_path ) ) )
|
||||
ostream << path.m_extension;
|
||||
}
|
||||
else if constexpr ( std::is_same_v<SRC, const char*> ){
|
||||
if( strEmpty( path_get_extension( path.m_path ) ) )
|
||||
ostream << path.m_extension;
|
||||
}
|
||||
return ostream;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -38,6 +38,13 @@ public:
|
|||
StringFixedSize() {
|
||||
clear();
|
||||
}
|
||||
explicit StringFixedSize( const char* string ){
|
||||
operator()( string );
|
||||
}
|
||||
StringFixedSize( const StringFixedSize& ) = default;
|
||||
StringFixedSize( StringFixedSize&& ) noexcept = default;
|
||||
StringFixedSize& operator=( const StringFixedSize& ) = default;
|
||||
StringFixedSize& operator=( StringFixedSize&& ) noexcept = default;
|
||||
std::size_t write( const char* buffer, std::size_t length ) override {
|
||||
if( m_length + length < SIZE ){
|
||||
for( auto i = length; i != 0; --i )
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -580,16 +580,6 @@ bool entity_t::read_keyvalue_( Vector3& vector3_value, std::initializer_list<con
|
|||
}
|
||||
return false;
|
||||
}
|
||||
bool entity_t::read_keyvalue_( char (&string_value)[1024], std::initializer_list<const char*>&& keys ) const {
|
||||
for( const char* key : keys ){
|
||||
const char* value = valueForKey( key );
|
||||
if( !strEmpty( value ) ){
|
||||
strcpy( string_value, value );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool entity_t::read_keyvalue_( const char *&string_ptr_value, std::initializer_list<const char*>&& keys ) const {
|
||||
for( const char* key : keys ){
|
||||
const char* value = valueForKey( key );
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ void HelpMinimap()
|
|||
void HelpPk3()
|
||||
{
|
||||
const std::vector<HelpOption> options = {
|
||||
{"-pk3 [options] <filename.bsp>", "Creates a pk3 for the BSP (complete Q3 support). Using file 'gamename.exclude' to exclude vanilla game resources."},
|
||||
{"-pk3 [options] <filename.bsp .. filenameN.bsp>", "Creates a pk3 for the BSP(s) (complete Q3 support). Using file 'gamename.exclude' to exclude vanilla game resources."},
|
||||
{"-complevel <N>", "Set compression level (-1 .. 10); 0 = uncompressed, -1 = 6, 10 = ultra zlib incompatible preset"},
|
||||
{"-dbg", "Print wall of debug text, useful for .exclude file creation"},
|
||||
{"-png", "include png textures, at highest priority; taking tga, jpg by default"},
|
||||
|
|
@ -410,7 +410,7 @@ void HelpPk3()
|
|||
void HelpRepack()
|
||||
{
|
||||
const std::vector<HelpOption> options = {
|
||||
{"-repack [options] <filename.bsp|filenames.txt>", "Creates repack of BSP(s) (complete Q3 support). Rips off only used shaders to new shader file. Using file 'gamename.exclude' to exclude vanilla game resources and 'repack.exclude' to exclude resources of existing repack."},
|
||||
{"-repack [options] <filename.bsp .. filenameN.bsp|filenames.txt>", "Creates repack of BSP(s) (complete Q3 support). Rips off only used shaders to new shader file. Using file 'gamename.exclude' to exclude vanilla game resources and 'repack.exclude' to exclude resources of existing repack."},
|
||||
{"-analyze", "Only print bsp resource references and exit"},
|
||||
{"-complevel <N>", "Set compression level (-1 .. 10); 0 = uncompressed, -1 = 6, 10 = ultra zlib incompatible preset"},
|
||||
{"-dbg", "Print wall of debug text"},
|
||||
|
|
|
|||
|
|
@ -948,7 +948,6 @@ private:
|
|||
bool read_keyvalue_( int &int_value, std::initializer_list<const char*>&& keys ) const;
|
||||
bool read_keyvalue_( float &float_value, std::initializer_list<const char*>&& keys ) const;
|
||||
bool read_keyvalue_( Vector3& vector3_value, std::initializer_list<const char*>&& keys ) const;
|
||||
bool read_keyvalue_( char (&string_value)[1024], std::initializer_list<const char*>&& keys ) const;
|
||||
bool read_keyvalue_( const char *&string_ptr_value, std::initializer_list<const char*>&& keys ) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user