1 
2 /***************************************************************************
3  *                    __            __ _ ___________                       *
4  *                    \ \          / /| |____   ____|                      *
5  *                     \ \        / / | |    | |                           *
6  *                      \ \  /\  / /  | |    | |                           *
7  *                       \ \/  \/ /   | |    | |                           *
8  *                        \  /\  /    | |    | |                           *
9  *                         \/  \/     |_|    |_|                           *
10  *                                                                         *
11  *                           Wiimms ISO Tools                              *
12  *                         http://wit.wiimm.de/                            *
13  *                                                                         *
14  ***************************************************************************
15  *                                                                         *
16  *   This file is part of the WIT project.                                 *
17  *   Visit http://wit.wiimm.de/ for project details and sources.           *
18  *                                                                         *
19  *   Copyright (c) 2009-2013 by Dirk Clemens <wiimm@wiimm.de>              *
20  *                                                                         *
21  ***************************************************************************
22  *                                                                         *
23  *   This program is free software; you can redistribute it and/or modify  *
24  *   it under the terms of the GNU General Public License as published by  *
25  *   the Free Software Foundation; either version 2 of the License, or     *
26  *   (at your option) any later version.                                   *
27  *                                                                         *
28  *   This program is distributed in the hope that it will be useful,       *
29  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
30  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
31  *   GNU General Public License for more details.                          *
32  *                                                                         *
33  *   See file gpl-2.0.txt or http://www.gnu.org/licenses/gpl-2.0.txt       *
34  *                                                                         *
35  ***************************************************************************/
36 
37 //
38 ///////////////////////////////////////////////////////////////////////////////
39 ///////////////			  text controls			///////////////
40 ///////////////////////////////////////////////////////////////////////////////
41 
42 //	\1 : the following text is only for the built in help
43 //	\2 : the following text is only for the web site
44 //	\3 : the following text is for both, built in help and web site
45 //	\4 : replace by '<' for html tags on web site
46 
47 //
48 ///////////////////////////////////////////////////////////////////////////////
49 ///////////////			  declarations			///////////////
50 ///////////////////////////////////////////////////////////////////////////////
51 
52 typedef enum enumType
53 {
54 	//----- base types
55 
56 	T_END		=    0x0001,  // end of list
57 	T_DEF_TOOL	=    0x0002,  // start of a new tool
58 	T_DEF_CMD	=    0x0004,  // define a command
59 	T_SEP_CMD	=    0x0008,  // define a command separator
60 	T_DEF_OPT	=    0x0010,  // define an option
61 	T_SEP_OPT	=    0x0020,  // define an option separator
62 	T_GRP_BEG	=    0x0040,  // start option definitions for a group
63 	T_CMD_BEG	=    0x0080,  // start option definitions for a command
64 	T_CMD_OPT	=    0x0100,  // allowed option for command
65 	T_COPY_CMD	=    0x0200,  // copy options of other command
66 	T_COPY_GRP	=    0x0400,  // copy options of group
67 	T_ALL_OPT	=    0x0800,  // allow all options
68 
69 	//----- option flags
70 
71 	F_OPT_COMMAND	=  0x010000,  // option is command specific
72 	F_OPT_GLOBAL	=  0x020000,  // option is global
73 	F_OPT_MULTIUSE	=  0x040000,  // multiple usage of option possible
74 	F_OPT_PARAM	=  0x080000,  // option needs a parameter
75 	F_OPT_OPTPARAM	=  0x100000,  // option accepts a optional parameter
76 	F_SEPARATOR	=  0x200000,  // separator element
77 	F_SUPERSEDE	=  0x400000,  // supersedes all other commands and options
78 
79 	F_OPT_XPARAM	=  F_OPT_PARAM | F_OPT_OPTPARAM,
80 
81 
82 	//----- global flags
83 
84 	F_HIDDEN	= 0x1000000,  // option is hidden from help
85 
86 
87 	//----- option combinations
88 
89 	T_OPT_C		= T_DEF_OPT | F_OPT_COMMAND,
90 	T_OPT_CM	= T_DEF_OPT | F_OPT_COMMAND | F_OPT_MULTIUSE,
91 	T_OPT_CP	= T_DEF_OPT | F_OPT_COMMAND                  | F_OPT_PARAM,
92 	T_OPT_CMP	= T_DEF_OPT | F_OPT_COMMAND | F_OPT_MULTIUSE | F_OPT_PARAM,
93 	T_OPT_CO	= T_DEF_OPT | F_OPT_COMMAND                  | F_OPT_OPTPARAM,
94 	T_OPT_CMO	= T_DEF_OPT | F_OPT_COMMAND | F_OPT_MULTIUSE | F_OPT_OPTPARAM,
95 
96 	T_OPT_G		= T_DEF_OPT | F_OPT_GLOBAL,
97 	T_OPT_GM	= T_DEF_OPT | F_OPT_GLOBAL  | F_OPT_MULTIUSE,
98 	T_OPT_GP	= T_DEF_OPT | F_OPT_GLOBAL                   | F_OPT_PARAM,
99 	T_OPT_GMP	= T_DEF_OPT | F_OPT_GLOBAL  | F_OPT_MULTIUSE | F_OPT_PARAM,
100 	T_OPT_GO	= T_DEF_OPT | F_OPT_GLOBAL                   | F_OPT_OPTPARAM,
101 	T_OPT_GMO	= T_DEF_OPT | F_OPT_GLOBAL  | F_OPT_MULTIUSE | F_OPT_OPTPARAM,
102 
103 	T_OPT_S		= T_DEF_OPT | F_OPT_GLOBAL | F_SUPERSEDE,
104 
105 
106 	T_COPT		= T_CMD_OPT,
107 	T_COPT_M	= T_CMD_OPT | F_OPT_MULTIUSE,
108 
109 
110 	//----- hidden options and commands (hide from help)
111 
112 	H_DEF_TOOL	= F_HIDDEN | T_DEF_TOOL,
113 	H_DEF_CMD	= F_HIDDEN | T_DEF_CMD,
114 
115 	H_OPT_C		= F_HIDDEN | T_OPT_C,
116 	H_OPT_CM	= F_HIDDEN | T_OPT_CM,
117 	H_OPT_CP	= F_HIDDEN | T_OPT_CP,
118 	H_OPT_CMP	= F_HIDDEN | T_OPT_CMP,
119 	H_OPT_CO	= F_HIDDEN | T_OPT_CO,
120 	H_OPT_CMO	= F_HIDDEN | T_OPT_CMO,
121 
122 	H_OPT_G		= F_HIDDEN | T_OPT_G,
123 	H_OPT_GM	= F_HIDDEN | T_OPT_GM,
124 	H_OPT_GP	= F_HIDDEN | T_OPT_GP,
125 	H_OPT_GMP	= F_HIDDEN | T_OPT_GMP,
126 	H_OPT_GO	= F_HIDDEN | T_OPT_GO,
127 	H_OPT_GMO	= F_HIDDEN | T_OPT_GMO,
128 
129 	H_COPT		= F_HIDDEN | T_COPT,
130 	H_COPT_M	= F_HIDDEN | T_COPT_M,
131 
132 } enumType;
133 
134 ///////////////////////////////////////////////////////////////////////////////
135 
136 typedef struct info_t
137 {
138 	enumType type;		// entry type
139 	ccp c_name;		// the C name
140 	ccp namelist;		// list of names
141 	ccp param;		// name of parameter
142 	ccp help;		// help text
143 
144 	int index;		// calculated index
145 
146 } info_t;
147 
148 //
149 ///////////////////////////////////////////////////////////////////////////////
150 ///////////////			some helper macros		///////////////
151 ///////////////////////////////////////////////////////////////////////////////
152 
153 #define TEXT_WWT_OPT_REPAIR \
154 	"This option defines how to repair WBFS errors." \
155 	" The parameter is a comma separated list of the following keywords," \
156 	" case is ignored:" \
157 	" @NONE, FBT, INODES, STANDARD," \
158 	" RM-INVALID, RM-OVERLAP, RM-FREE, RM-EMPTY, RM-ALL, ALL@." \
159 	"\n " \
160 	" All keywords can be prefixed by '+' to enable that option," \
161 	" by a '-' to disable it or" \
162 	" by a '=' to enable that option and disable all others."
163 
164 #define TEXT_OPT_CHUNK_MODE(def) \
165 	"Defines an operation mode for {--chunk-size} and {--max-chunks}." \
166 	" Allowed keywords are @'ANY'@ to allow any values," \
167 	" @'32K'@ to force chunk sizes with a multiple of 32 KiB," \
168 	" @'POW2'@ to force chunk sizes >=32K and with a power of 2" \
169 	" or @'ISO'@ for ISO images (more restrictive as @'POW2'@," \
170 	" best for USB loaders)." \
171 	" The case of the keyword is ignored." \
172 	" The default key is @'" def "'@." \
173 	"\n " \
174 	" @--chm@ is a shortcut for @--chunk-mode@."
175 
176 #define TEXT_EXTRACT_LONG \
177 	"Print a summary line while extracting files." \
178 	" If set at least twice, print a status line for each extracted files."
179 
180 #define TEXT_FILE_FILTER \
181 	" This option can be used multiple times to extend the rule list." \
182 	" Rules beginning with a '+' or a '-' are allow or deny rules rules." \
183 	" Rules beginning with a ':' are macros for predefined rule sets." \
184 	"\1\n " \
185 	" See http://wit.wiimm.de/info/file-filter.html" \
186 	" for more details about file filters."
187 
188 ///////////////////////////////////////////////////////////////////////////////
189 
190 #define TEXT_DIFF_QUIET \
191 	"Be quiet and print only error messages and failure messages on mismatch." \
192 	" The comparison is aborted at the first mismatch for each source image." \
193 	" If set twice print nothing and report the diff result only as exit status" \
194 	" and the complete comparison is aborted at the first mismatch at all."
195 
196 #define TEXT_DIFF_VERBOSE \
197 	"The default is to print only differ messages." \
198 	" If set success messages and summaries are printed too." \
199 	" If set at least twice, a progress counter is printed too."
200 
201 #define TEXT_DIFF_FILE_LIMIT \
202 	"This option is only used if comparing discs on file level." \
203 	" If not set or set to null, then all files will be compared." \
204 	" If set to a value greater than comparison is aborted for" \
205 	" the current source image if the entered number of files differ." \
206 	" This option is ignored in quiet mode."
207 
208 #define TEXT_DIFF_LIMIT \
209 	"If not set, the comparison of the current file is aborted" \
210 	" if a mismatch is found." \
211 	" If set, the comparison is aborted after @'limit'@ mismatches." \
212 	" To compare the whole file use the special value @0@." \
213 	" This option is ignored in quiet mode."
214 
215 #define TEXT_DIFF_LONG \
216 	"If set, a status line with the offset is printed for each found mismatch." \
217 	" If set twice, an additional hex dump of the first bytes is printed." \
218 	" If set 3 or 4 times, the limit is set to 10 or unlimited" \
219 	" if option {--limit} is not already set." \
220 	" This option is ignored in quiet mode."
221 
222 #define TEXT_DIFF_BLOCK_SIZE \
223 	"If a mismatch is found in raw or disc mode then the comparison" \
224 	" is continued with the next block. This option sets the block size." \
225 	" The default value is @32K@ (Wii sector size)." \
226 	" This option is ignored in quiet mode."
227 
228 //
229 ///////////////////////////////////////////////////////////////////////////////
230 ///////////////			the info table			///////////////
231 ///////////////////////////////////////////////////////////////////////////////
232 
233 info_t info_tab[] =
234 {
235     #include "tab-wit.inc"
236     #include "tab-wwt.inc"
237     #include "tab-wdf.inc"
238     #include "tab-wfuse.inc"
239 
240     { T_END, 0,0,0,0 }
241 };
242 
243 //
244 ///////////////////////////////////////////////////////////////////////////////
245 ///////////////			    E N D			///////////////
246 ///////////////////////////////////////////////////////////////////////////////
247