50 {
"destiny", &
DestinyDumpLogText,
"Converts given string to binary and dumps it as destiny binary." },
51 {
"crc32", &
CRC32Text,
"Computes CRC-32 checksum of given arguments." },
53 {
"help", &
PrintHelp,
"Lists available commands or prints help about specified one." },
54 {
"now", &
PrintTimeNow,
"Prints current time in Win32 time format." },
55 {
"obj2sql", &
ObjectToSQL,
"Converts specified cache object into an SQL update." },
56 {
"script", &
LoadScript,
"Loads input from specified file(s)." },
57 {
"time", &
TimeToString,
"Interprets given integer as Win32 time." },
58 {
"tri2obj", &
TriToOBJ,
"Dumps specified TRI file." },
59 {
"unmarshal", &
UnmarshalLogText,
"Converts given string to binary and unmarshals it." },
60 {
"xstuff", &
StuffExtract,
"Dumps specified STUFF file." }
84 const char* cmdName = cmd.
arg( 0 ).c_str();
88 sLog.Error(
"input",
"Unknown command '%s'.", cmdName );
98 const char* cmdName = cmd.
arg( 0 ).c_str();
102 sLog.Error( cmdName,
"Usage: %s destiny-binary [destiny-binary] ...", cmdName );
106 for(
size_t i = 1; i < cmd.
argCount(); ++i )
108 const std::string& destinyBinaryStr = cmd.
arg( i );
113 sLog.Error( cmdName,
"Failed to decode destiny binary." );
123 const char* cmdName = cmd.
arg( 0 ).c_str();
127 sLog.Error( cmdName,
"Usage: %s text-to-checksum [text-to-checksum] ...", cmdName );
131 for(
size_t i = 1; i < cmd.
argCount(); ++i )
133 const std::string& s = cmd.
arg( i );
147 const char* cmdName = cmd.
arg( 0 ).c_str();
151 sLog.Log( cmdName,
"Available commands:" );
160 sLog.Log( cmdName,
"You can get detailed help by typing '%s <command> [<command>] ...'.", cmdName );
164 for(
size_t i = 1; i < cmd.
argCount(); ++i )
166 const std::string& cmdStr = cmd.
arg( i );
170 sLog.Error( cmdName,
"Unknown command '%s'.", cmdStr.c_str() );
179 const char* cmdName = cmd.
arg( 0 ).c_str();
186 const char* cmdName = cmd.
arg( 0 ).c_str();
190 sLog.Error( cmdName,
"Usage: %s [cache_file] [table_name] [key_field] [file_name]", cmdName );
193 const std::string& cacheFile = cmd.
arg( 1 );
194 const std::string& tableName = cmd.
arg( 2 );
195 const std::string& keyField = cmd.
arg( 3 );
196 const std::string& fileName = cmd.
arg( 4 );
198 std::string abs_fname(
"../data/cache/" );
199 abs_fname += cacheFile;
200 abs_fname +=
".cache";
202 sLog.Log( cmdName,
"Converting cached object %s:\n", abs_fname.c_str() );
208 sLog.Error( cmdName,
"Unable to load or decode '%s'!", abs_fname.c_str() );
215 sLog.Error( cmdName,
"Unable to load or decode body of '%s'!", abs_fname.c_str() );
221 FILE* out = fopen( fileName.c_str(),
"w" );
224 sLog.Error( cmdName,
"Unable to open output file '%s'", fileName.c_str() );
230 SetSQLDumper dumper( tableName.c_str(), keyField.c_str(), out );
232 sLog.Success( cmdName,
"Dumping of %s succeeded.", tableName.c_str() );
234 sLog.Error( cmdName,
"Dumping of %s failed.", tableName.c_str() );
242 const char* cmdName = cmd.
arg( 0 ).c_str();
246 sLog.Error( cmdName,
"Usage: %s file [file] ...", cmdName );
250 for(
size_t i = 1; i < cmd.
argCount(); ++i )
256 const char* cmdName = cmd.
arg( 0 ).c_str();
260 sLog.Error( cmdName,
"Usage: %s win32-time [win32-time] ...", cmdName );
264 for(
size_t i = 1; i < cmd.
argCount(); ++i )
266 const std::string& timeStr = cmd.
arg( i );
269 sscanf( timeStr.c_str(),
"%" SCNu64, &t );
272 sLog.Log( cmdName,
"%s is %s.", timeStr.c_str(), time.c_str() );
278 const char* cmdName = cmd.
arg( 0 ).c_str();
282 sLog.Error( cmdName,
"Usage: %s [trifile] [objout] [mtlout]", cmdName );
285 const std::string& trifile = cmd.
arg( 1 );
286 const std::string& objout = cmd.
arg( 2 );
287 const std::string& mtlout = cmd.
arg( 3 );
289 TriExporter::TriFile f;
290 if( !f.LoadFile( trifile.c_str() ) )
292 sLog.Error( cmdName,
"Failed to load trifile '%s'.", trifile.c_str() );
297 f.ExportObj( objout.c_str(), mtlout.c_str() );
299 sLog.Success( cmdName,
"%s - %s - written.", objout.c_str(), mtlout.c_str() );
304 const char* cmdName = cmd.
arg( 0 ).c_str();
308 sLog.Error( cmdName,
"Usage: %s marshal-binary [marshal-binary] ...", cmdName );
312 for(
size_t i = 1; i < cmd.
argCount(); ++i )
314 const std::string& marshalBinaryStr = cmd.
arg( i );
319 sLog.Error( cmdName,
"Failed to decode string into binary." );
325 sLog.Error( cmdName,
"Failed to unmarshal binary." );
328 sLog.Success( cmdName,
"Result:" );
329 r->
Dump( stdout,
" " );
353 const char* cmdName = cmd.
arg( 0 ).c_str();
357 sLog.Error( cmdName,
"Usage: %s [.stuff file]", cmdName );
360 const std::string& filename = cmd.
arg( 1 );
362 FILE* in = fopen( filename.c_str(),
"rb" );
365 sLog.Error( cmdName,
"Unable to open %s.", filename.c_str() );
370 if( 1 != fread( &file_count,
sizeof( file_count ), 1, in ) )
372 sLog.Log( cmdName,
"Unable to read file count." );
376 sLog.Log( cmdName,
"There are %u files in %s.", file_count, filename.c_str() );
378 std::vector<FileHeaderObj> headers;
379 headers.resize( file_count );
382 for(
uint32 i = 0; i < file_count; i++ )
385 if( 1 != fread( &head,
sizeof( head ), 1, in ) )
387 sLog.Error( cmdName,
"Unable to read header of file #%u.", i );
401 sLog.Error( cmdName,
"Unable to read name of file #%u.", i );
407 sLog.Log( cmdName,
"File #%u has length %u and path %s.", i, obj.
length, obj.
filename.c_str() );
411 std::vector<FileHeaderObj>::const_iterator cur, end;
412 cur = headers.begin();
414 for(; cur != end; cur++)
418 std::vector<std::string> components;
421 std::string pathname =
".";
423 std::vector<std::string>::const_iterator curc, endc;
424 curc = components.begin();
425 endc = components.end();
426 for(; curc != endc; curc++ )
431 if( ( curc + 1 ) == endc )
434 FILE* out = fopen( pathname.c_str(),
"wb" );
437 sLog.Error( cmdName,
"Unable to create file %s: %s.", pathname.c_str(), strerror( errno ) );
441 sLog.Log( cmdName,
"Extracting file %s of length %u.", pathname.c_str(), cur->length );
443 Buffer buf( cur->length );
444 if( cur->length != fread( &buf[0], 1, cur->length, in ) )
446 sLog.Error( cmdName,
"Unable to read file %s: %s.", cur->filename.c_str(), strerror( errno ) );
450 if( cur->length != fwrite( &buf[0], 1, cur->length, out ) )
452 sLog.Error( cmdName,
"Unable to write file %s: %s", pathname.c_str(), strerror( errno ) );
461 struct stat stat_struct;
463 if( -1 == stat( pathname.c_str(), &stat_struct ) )
465 if( ENOENT == errno )
469 sLog.Error( cmdName,
"Failed to make intermediate directory %s: %s", pathname.c_str(), strerror( errno ) );
475 sLog.Error( cmdName,
"Unable to stat %s: %s", pathname.c_str(), strerror( errno ) );
485 sLog.Log( cmdName,
"Extracting from archive %s finished.", filename.c_str() );
bool PyDecodeEscape(const char *str, Buffer &into)
Decodes string escapes into actual characters.
void UnmarshalLogText(const Seperator &cmd)
PyRep * InflateUnmarshal(const Buffer &data)
Turns possibly inflated marshal stream into Python object.
const std::string & arg(size_t index) const
void LoadScript(const Seperator &cmd)
void SplitPath(const std::string &path, std::vector< std::string > &into)
Splits path to its components.
Python object SQL dumper.
void ProcessFile(FILE *file)
Loads commands from given file.
Separates string to arguments.
void Dump(FILE *into, const char *pfx) const
Dumps object to file.
void PrintTimeNow(const Seperator &cmd)
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
void CRC32Text(const Seperator &cmd)
void TimeToString(const Seperator &cmd)
#define sLog
Evaluates to a NewLog instance.
Generic class for buffers.
const EVEToolCommand * FindCommand(const char *name)
Finds a command.
void ExitProgram(const Seperator &cmd)
int CreateDirectory(const char *name, void *)
void StuffExtract(const Seperator &cmd)
static uint32 Generate(const uint8 *buf, size_t bufsize)
void TriToOBJ(const Seperator &cmd)
const EVEToolCommand EVETOOL_COMMANDS[]
void ProcessCommand(const Seperator &cmd)
Processed given command.
void DumpUpdate(LogType into, const uint8 *data, uint32 len)
void ObjectToSQL(const Seperator &cmd)
void DestinyDumpLogText(const Seperator &cmd)
std::string Win32TimeToString(int64 win32t)
PyCachedObjectDecoder * LoadCachedObject(const char *filename, const char *oname)
void PrintHelp(const Seperator &cmd)
const size_t EVETOOL_COMMAND_COUNT
virtual bool visit(PyVisitor &v) const =0
Visits object.