refactor autopk3

unlimit list sizes
	* -pk3, -repack: support multiple bsp files input by command line
This commit is contained in:
Garux
2021-10-02 19:13:28 +03:00
parent ff07c6e244
commit a0e79e8ecd
7 changed files with 416 additions and 562 deletions

View File

@@ -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

View File

@@ -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 );

View File

@@ -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"},

View File

@@ -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;
};