1 /* 2 Unmass - unpacker for game archives. 3 Copyright (C) 2002-2007 Mirex 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program; if not, write to the Free Software 17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 */ 19 20 #ifndef _utools_h_ 21 #define _utools_h_ 22 23 #include <vector> 24 25 #include "massfs.h" 26 27 class UnmassTools { 28 29 public: 30 31 // prints text into console 32 static void Log( int severity, const char* format, ... ); 33 34 // main routine. parses command line and processes it 35 int Start( int argc, char* argv[] ); 36 37 // prints help into console 38 void PrintHelp( void ); 39 40 // prints main program information 41 void PrintProgramInfo( void ); 42 43 // prints list of plugin modules 44 void PrintModules( void ); 45 46 int PrintMassFileList( const char* mass_filename, bool filenames_only = true ); 47 48 typedef std::vector< const char* > array_of_filenames; 49 // expects number_of_files * "const char* filename" in the "..." 50 // filename can be either "name" or "nam*" or "*me" or "na*me" or "*" 51 int ExtractMultipleFiles( const char* mass_filename, array_of_filenames names ); 52 53 // set output directory where files are extracted 54 void SetOutputDirectory( const char* s ); 55 56 // calling platform - dependant solutions of the functions 57 // lowercases whole string 58 static void _strlwr( char* string ); 59 60 // compares strings case insensitive 61 static int _strcasecmp( const char* s1, const char* s2 ); 62 63 // compares strings case insensitive, compares only first n characters 64 int _strncasecmp( const char* s1, const char* s2, int n ); 65 66 // list of possible command-line parameters 67 struct s_params { 68 int ident; 69 char string[ 20 ]; 70 int param_count; 71 } ; 72 73 enum e_params { 74 param_help, 75 param_extract_files, 76 param_list_of_modules, 77 param_print_file_list, 78 param_print_file_list_full, 79 80 param_count, 81 param_none 82 } ; 83 84 enum { 85 param_def_count = 7, 86 } ; 87 88 // data of the parameter definitions 89 static s_params param_def[ param_def_count ]; 90 91 92 // version string of the code 93 static char version_string[ 20 ]; 94 static char executable_name_string[ 20 ]; 95 96 97 CMassFiles massfs; 98 99 } ; 100 101 102 #endif 103