mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 04:12:40 +01:00
Tools/MapExtractor: print human readable casc errors
This commit is contained in:
@@ -60,6 +60,32 @@
|
||||
#define OPEN_FLAGS (O_RDONLY | O_BINARY)
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
const char* HumanReadableCASCError(int error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case ERROR_SUCCESS: return "SUCCESS";
|
||||
case ERROR_FILE_CORRUPT: return "FILE_CORRUPT";
|
||||
case ERROR_CAN_NOT_COMPLETE: return "CAN_NOT_COMPLETE";
|
||||
case ERROR_HANDLE_EOF: return "HANDLE_EOF";
|
||||
case ERROR_NO_MORE_FILES: return "NO_MORE_FILES";
|
||||
case ERROR_BAD_FORMAT: return "BAD_FORMAT";
|
||||
case ERROR_INSUFFICIENT_BUFFER: return "INSUFFICIENT_BUFFER";
|
||||
case ERROR_ALREADY_EXISTS: return "ALREADY_EXISTS";
|
||||
case ERROR_DISK_FULL: return "DISK_FULL";
|
||||
case ERROR_INVALID_PARAMETER: return "INVALID_PARAMETER";
|
||||
case ERROR_NOT_SUPPORTED: return "NOT_SUPPORTED";
|
||||
case ERROR_NOT_ENOUGH_MEMORY: return "NOT_ENOUGH_MEMORY";
|
||||
case ERROR_INVALID_HANDLE: return "INVALID_HANDLE";
|
||||
case ERROR_ACCESS_DENIED: return "ACCESS_DENIED";
|
||||
case ERROR_FILE_NOT_FOUND: return "FILE_NOT_FOUND";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HANDLE CascStorage = NULL;
|
||||
|
||||
typedef struct
|
||||
@@ -268,7 +294,7 @@ uint32 ReadMapDBC()
|
||||
HANDLE dbcFile;
|
||||
if (!CascOpenFile(CascStorage, "DBFilesClient\\Map.dbc", CASC_LOCALE_NONE, 0, &dbcFile))
|
||||
{
|
||||
printf("Fatal error: Cannot find Map.dbc in archive!\n");
|
||||
printf("Fatal error: Cannot find Map.dbc in archive! %s\n", HumanReadableCASCError(GetLastError()));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -298,7 +324,7 @@ void ReadAreaTableDBC()
|
||||
HANDLE dbcFile;
|
||||
if (!CascOpenFile(CascStorage, "DBFilesClient\\AreaTable.dbc", CASC_LOCALE_NONE, 0, &dbcFile))
|
||||
{
|
||||
printf("Fatal error: Cannot find AreaTable.dbc in archive!\n");
|
||||
printf("Fatal error: Cannot find AreaTable.dbc in archive! %s\n", HumanReadableCASCError(GetLastError()));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -326,7 +352,7 @@ void ReadLiquidTypeTableDBC()
|
||||
HANDLE dbcFile;
|
||||
if (!CascOpenFile(CascStorage, "DBFilesClient\\LiquidType.dbc", CASC_LOCALE_NONE, 0, &dbcFile))
|
||||
{
|
||||
printf("Fatal error: Cannot find LiquidType.dbc in archive!\n");
|
||||
printf("Fatal error: Cannot find LiquidType.dbc in archive! %s\n", HumanReadableCASCError(GetLastError()));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1127,7 +1153,7 @@ void ExtractDBFilesClient(int l)
|
||||
CascCloseFile(dbcFile);
|
||||
}
|
||||
else
|
||||
printf("Unable to open file %s in the archive for locale %s.\n", fileName, Locales[l]);
|
||||
printf("Unable to open file %s in the archive for locale %s: %s\n", fileName, Locales[l], HumanReadableCASCError(GetLastError()));
|
||||
|
||||
fileName = DBFilesClientList[++index];
|
||||
}
|
||||
@@ -1140,7 +1166,7 @@ bool OpenCascStorage()
|
||||
boost::filesystem::path const storage_dir (boost::filesystem::canonical (input_path) / "Data");
|
||||
if (!CascOpenStorage(storage_dir.string().c_str(), 0, &CascStorage))
|
||||
{
|
||||
printf("error opening casc storage '%s': %d\n", storage_dir.string().c_str(), GetLastError());
|
||||
printf("error opening casc storage '%s': %s\n", storage_dir.string().c_str(), HumanReadableCASCError(GetLastError()));
|
||||
return false;
|
||||
}
|
||||
printf("opened casc storage '%s'\n", storage_dir.string().c_str());
|
||||
|
||||
Reference in New Issue
Block a user