@@ -117,24 +117,24 @@ int main(int argc, char *argv[])
117117 app.add_option (" --library,-l" , libraryPath, " Library path (.so)" )->required ()->check (CLI ::ExistingFile);
118118
119119 std::vector<std::filesystem::path> inputFilePaths;
120- app.add_option (" --input_files,-f" , inputFilePaths, " Gamedata input file paths (.txt.in, space-separated )" )->check (CLI ::ExistingFile);
120+ app.add_option (" --input_files,-f" , inputFilePaths, " Gamedata input file paths (space-separated, .txt.in)" )->check (CLI ::ExistingFile);
121121
122- std::filesystem::path outputPath ;
123- app.add_option (" --output ,-o" , outputPath , " Gamedata output path (one level above with *.games directories )" )-> check ( CLI ::ExistingDirectory); ;
122+ std::vector<std:: filesystem::path> outputDirectoryPaths ;
123+ app.add_option (" --output_dirs ,-o" , outputDirectoryPaths , " Gamedata output directory paths (space-separated )" );
124124
125125 app.add_flag (" --dump_offsets" , dumpOffsets, " Print all vtable offsets" );
126126 app.add_flag (" --dump_signatures" , dumpSignatures, " Print all signatures" );
127127
128128 std::string usage_msg = " Usage: gamedata-gen [options]" ;
129129 app.usage (usage_msg);
130130 app.set_help_flag (" " );
131- app.set_help_all_flag (" -h, --help" );
131+ app.set_help_all_flag (" -h,--help" );
132132
133133 app.get_formatter ()->column_width (44 );
134134
135135 CLI11_PARSE (app, argc, argv);
136136
137- if (outputPath .empty () && !dumpOffsets && !dumpSignatures)
137+ if (outputDirectoryPaths .empty () && !dumpOffsets && !dumpSignatures)
138138 {
139139 std::cerr << std::format (" Specify either --output or one of --dump_* options" ) << std::endl;
140140 return EXIT_FAILURE ;
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
151151 auto size = reader.size ();
152152#endif
153153
154- ProgramInfo programInfo = process (program, size);
154+ auto programInfo = process (program, size);
155155
156156 if (!programInfo.error .empty ())
157157 {
@@ -204,11 +204,11 @@ int main(int argc, char *argv[])
204204
205205 if (dumpOffsets)
206206 {
207+ std::cout << " Class name::Namespace::Function, Linux offset, Windows offset\n " << std::endl;
207208 for (const auto & outClass : out.classes )
208209 {
209210 auto functions = formatVTable (outClass);
210211
211- std::cout << " L W " << outClass.name << std::endl;
212212 for (const auto & function : functions)
213213 {
214214 std::string linuxIndex = " " ;
@@ -223,15 +223,26 @@ int main(int argc, char *argv[])
223223 windowsIndex = std::to_string (function.windowsIndex .value ());
224224 }
225225
226- std::cout << linuxIndex << " " << windowsIndex << " " << function.name << (function.isMulti ? " [Multi]" : " " ) << std::endl;
226+ std::cout << std::format ( " {}::{} {} {} {} " , outClass. name , function.name , (function.isMulti ? " [Multi]" : " " ), linuxIndex, windowsIndex ) << std::endl;
227227 }
228228 }
229229 }
230230
231231 if (dumpSignatures)
232232 {
233- // TODO
233+ for (const auto & symbol : programInfo.symbols )
234+ {
235+ if (symbol.name .empty ())
236+ {
237+ continue ;
238+ }
239+
240+ auto demangledSymbol = demangleSymbol (symbol.name .c_str ());
241+ auto demangledSymbolText = demangledSymbol ? &*demangledSymbol : symbol.name .c_str ();
242+
243+ std::cout << std::format (" {} {}" , demangledSymbolText, symbol.name ) << std::endl;
244+ }
234245 }
235246
236- return writeGamedataFile (out.classes , inputFilePaths, outputPath );
247+ return writeGamedataFile (out.classes , inputFilePaths, outputDirectoryPaths );
237248}
0 commit comments