diff options
Diffstat (limited to 'src/tools/extractor_common')
-rw-r--r-- | src/tools/extractor_common/CascHandles.cpp | 7 | ||||
-rw-r--r-- | src/tools/extractor_common/CascHandles.h | 1 | ||||
-rw-r--r-- | src/tools/extractor_common/DB2CascFileSource.cpp | 5 | ||||
-rw-r--r-- | src/tools/extractor_common/DB2CascFileSource.h | 1 | ||||
-rw-r--r-- | src/tools/extractor_common/ExtractorDB2LoadInfo.h | 183 |
5 files changed, 141 insertions, 56 deletions
diff --git a/src/tools/extractor_common/CascHandles.cpp b/src/tools/extractor_common/CascHandles.cpp index 575f9fe3405..930d8eea420 100644 --- a/src/tools/extractor_common/CascHandles.cpp +++ b/src/tools/extractor_common/CascHandles.cpp @@ -127,6 +127,13 @@ DWORD CASC::GetFilePointer(FileHandle const& file) return ::CascSetFilePointer(file.get(), 0, nullptr, FILE_CURRENT); } +bool CASC::SetFilePointer(FileHandle const& file, LONGLONG position) +{ + LONG parts[2]; + memcpy(parts, &position, sizeof(parts)); + return ::CascSetFilePointer(file.get(), parts[0], &parts[1], FILE_BEGIN) != CASC_INVALID_POS; +} + bool CASC::ReadFile(FileHandle const& file, void* buffer, DWORD bytes, PDWORD bytesRead) { return ::CascReadFile(file.get(), buffer, bytes, bytesRead); diff --git a/src/tools/extractor_common/CascHandles.h b/src/tools/extractor_common/CascHandles.h index 0a8a1dd359c..a412976ce10 100644 --- a/src/tools/extractor_common/CascHandles.h +++ b/src/tools/extractor_common/CascHandles.h @@ -55,6 +55,7 @@ namespace CASC FileHandle OpenFile(StorageHandle const& storage, char const* fileName, DWORD localeMask, bool printErrors = false); DWORD GetFileSize(FileHandle const& file, PDWORD fileSizeHigh); DWORD GetFilePointer(FileHandle const& file); + bool SetFilePointer(FileHandle const& file, LONGLONG position); bool ReadFile(FileHandle const& file, void* buffer, DWORD bytes, PDWORD bytesRead); } diff --git a/src/tools/extractor_common/DB2CascFileSource.cpp b/src/tools/extractor_common/DB2CascFileSource.cpp index 5452c3e1518..b09f7f0b90e 100644 --- a/src/tools/extractor_common/DB2CascFileSource.cpp +++ b/src/tools/extractor_common/DB2CascFileSource.cpp @@ -40,6 +40,11 @@ std::size_t DB2CascFileSource::GetPosition() const return CASC::GetFilePointer(_fileHandle); } +bool DB2CascFileSource::SetPosition(std::size_t position) +{ + return CASC::SetFilePointer(_fileHandle, position); +} + std::size_t DB2CascFileSource::GetFileSize() const { DWORD sizeLow = 0; diff --git a/src/tools/extractor_common/DB2CascFileSource.h b/src/tools/extractor_common/DB2CascFileSource.h index 9708fcdcfe3..84376b6791d 100644 --- a/src/tools/extractor_common/DB2CascFileSource.h +++ b/src/tools/extractor_common/DB2CascFileSource.h @@ -28,6 +28,7 @@ struct DB2CascFileSource : public DB2FileSource bool IsOpen() const override; bool Read(void* buffer, std::size_t numBytes) override; std::size_t GetPosition() const override; + bool SetPosition(std::size_t position) override; std::size_t GetFileSize() const override; char const* GetFileName() const override; diff --git a/src/tools/extractor_common/ExtractorDB2LoadInfo.h b/src/tools/extractor_common/ExtractorDB2LoadInfo.h index fccfc924205..26c1fb860d7 100644 --- a/src/tools/extractor_common/ExtractorDB2LoadInfo.h +++ b/src/tools/extractor_common/ExtractorDB2LoadInfo.h @@ -26,20 +26,25 @@ struct CinematicCameraLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, - { false, FT_INT, "SoundID" }, { false, FT_FLOAT, "OriginX" }, { false, FT_FLOAT, "OriginY" }, { false, FT_FLOAT, "OriginZ" }, + { false, FT_INT, "SoundID" }, { false, FT_FLOAT, "OriginFacing" }, { false, FT_INT, "FileDataID" }, }; - static char const* types = "iffi"; - static uint8 const arraySizes[4] = { 1, 3, 1, 1 }; - static DB2Meta const meta(-1, 4, 0x0062B0F4, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2MetaField const fields[4] = + { + { FT_FLOAT, 3, true }, + { FT_INT, 1, false }, + { FT_FLOAT, 1, true }, + { FT_INT, 1, false }, + }; + static DB2Meta meta(-1, 4, 0x20C5E540, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; @@ -48,24 +53,30 @@ struct GameobjectDisplayInfoLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, - { true, FT_INT, "FileDataID" }, { false, FT_FLOAT, "GeoBoxMinX" }, { false, FT_FLOAT, "GeoBoxMinY" }, { false, FT_FLOAT, "GeoBoxMinZ" }, { false, FT_FLOAT, "GeoBoxMaxX" }, { false, FT_FLOAT, "GeoBoxMaxY" }, { false, FT_FLOAT, "GeoBoxMaxZ" }, + { true, FT_INT, "FileDataID" }, + { true, FT_SHORT, "ObjectEffectPackageID" }, { false, FT_FLOAT, "OverrideLootEffectScale" }, { false, FT_FLOAT, "OverrideNameScale" }, - { true, FT_SHORT, "ObjectEffectPackageID" }, }; - static char const* types = "ifffh"; - static uint8 const arraySizes[5] = { 1, 6, 1, 1, 1 }; - static DB2Meta const meta(-1, 5, 0x9F2098D1, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2MetaField const fields[5] = + { + { FT_FLOAT, 6, true }, + { FT_INT, 1, true }, + { FT_SHORT, 1, true }, + { FT_FLOAT, 1, true }, + { FT_FLOAT, 1, true }, + }; + static DB2Meta meta(-1, 5, 0x7A816799, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; @@ -74,16 +85,19 @@ struct LiquidMaterialLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, - { true, FT_BYTE, "LVF" }, { true, FT_BYTE, "Flags" }, + { true, FT_BYTE, "LVF" }, }; - static char const* types = "bb"; - static uint8 const arraySizes[2] = { 1, 1 }; - static DB2Meta meta(-1, 2, 0x62BE0340, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2MetaField const fields[2] = + { + { FT_BYTE, 1, true }, + { FT_BYTE, 1, true }, + }; + static DB2Meta meta(-1, 2, 0x6A7287A2, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; @@ -92,7 +106,7 @@ struct LiquidObjectLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, { false, FT_FLOAT, "FlowDirection" }, @@ -101,10 +115,16 @@ struct LiquidObjectLoadInfo { false, FT_BYTE, "Fishable" }, { false, FT_BYTE, "Reflection" }, }; - static char const* types = "ffhbb"; - static uint8 const arraySizes[5] = { 1, 1, 1, 1, 1 }; - static DB2Meta meta(-1, 5, 0xACC168A6, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2MetaField const fields[5] = + { + { FT_FLOAT, 1, true }, + { FT_FLOAT, 1, true }, + { FT_SHORT, 1, true }, + { FT_BYTE, 1, false }, + { FT_BYTE, 1, false }, + }; + static DB2Meta meta(-1, 5, 0x7AF380AA, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; @@ -113,7 +133,7 @@ struct LiquidTypeLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, { false, FT_STRING_NOT_LOCALIZED, "Name" }, @@ -123,12 +143,26 @@ struct LiquidTypeLoadInfo { false, FT_STRING_NOT_LOCALIZED, "Texture4" }, { false, FT_STRING_NOT_LOCALIZED, "Texture5" }, { false, FT_STRING_NOT_LOCALIZED, "Texture6" }, + { false, FT_SHORT, "Flags" }, + { false, FT_BYTE, "SoundBank" }, + { false, FT_INT, "SoundID" }, { false, FT_INT, "SpellID" }, { false, FT_FLOAT, "MaxDarkenDepth" }, { false, FT_FLOAT, "FogDarkenIntensity" }, { false, FT_FLOAT, "AmbDarkenIntensity" }, { false, FT_FLOAT, "DirDarkenIntensity" }, + { false, FT_SHORT, "LightID" }, { false, FT_FLOAT, "ParticleScale" }, + { false, FT_BYTE, "ParticleMovement" }, + { false, FT_BYTE, "ParticleTexSlots" }, + { false, FT_BYTE, "MaterialID" }, + { true, FT_INT, "MinimapStaticCol" }, + { false, FT_BYTE, "FrameCountTexture1" }, + { false, FT_BYTE, "FrameCountTexture2" }, + { false, FT_BYTE, "FrameCountTexture3" }, + { false, FT_BYTE, "FrameCountTexture4" }, + { false, FT_BYTE, "FrameCountTexture5" }, + { false, FT_BYTE, "FrameCountTexture6" }, { true, FT_INT, "Color1" }, { true, FT_INT, "Color2" }, { false, FT_FLOAT, "Float1" }, @@ -153,24 +187,37 @@ struct LiquidTypeLoadInfo { false, FT_INT, "Int2" }, { false, FT_INT, "Int3" }, { false, FT_INT, "Int4" }, - { false, FT_SHORT, "Flags" }, - { false, FT_SHORT, "LightID" }, - { false, FT_BYTE, "SoundBank" }, - { false, FT_BYTE, "ParticleMovement" }, - { false, FT_BYTE, "ParticleTexSlots" }, - { false, FT_BYTE, "MaterialID" }, - { false, FT_BYTE, "FrameCountTexture1" }, - { false, FT_BYTE, "FrameCountTexture2" }, - { false, FT_BYTE, "FrameCountTexture3" }, - { false, FT_BYTE, "FrameCountTexture4" }, - { false, FT_BYTE, "FrameCountTexture5" }, - { false, FT_BYTE, "FrameCountTexture6" }, - { false, FT_INT, "SoundID" }, + { false, FT_FLOAT, "Coefficient1" }, + { false, FT_FLOAT, "Coefficient2" }, + { false, FT_FLOAT, "Coefficient3" }, + { false, FT_FLOAT, "Coefficient4" }, + }; + static DB2MetaField const fields[21] = + { + { FT_STRING_NOT_LOCALIZED, 1, true }, + { FT_STRING_NOT_LOCALIZED, 6, true }, + { FT_SHORT, 1, false }, + { FT_BYTE, 1, false }, + { FT_INT, 1, false }, + { FT_INT, 1, false }, + { FT_FLOAT, 1, true }, + { FT_FLOAT, 1, true }, + { FT_FLOAT, 1, true }, + { FT_FLOAT, 1, true }, + { FT_SHORT, 1, false }, + { FT_FLOAT, 1, true }, + { FT_BYTE, 1, false }, + { FT_BYTE, 1, false }, + { FT_BYTE, 1, false }, + { FT_INT, 1, true }, + { FT_BYTE, 6, false }, + { FT_INT, 2, true }, + { FT_FLOAT, 18, true }, + { FT_INT, 4, false }, + { FT_FLOAT, 4, true }, }; - static char const* types = "ssifffffifihhbbbbbi"; - static uint8 const arraySizes[19] = { 1, 6, 1, 1, 1, 1, 1, 1, 2, 18, 4, 1, 1, 1, 1, 1, 1, 6, 1 }; - static DB2Meta const meta(-1, 19, 0x3313BBF3, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2Meta meta(-1, 21, 0x29F8C65E, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; @@ -179,7 +226,7 @@ struct MapLoadInfo { static DB2FileLoadInfo const* Instance() { - static DB2FieldMeta const fields[] = + static DB2FieldMeta const loadedFields[] = { { false, FT_INT, "ID" }, { false, FT_STRING_NOT_LOCALIZED, "Directory" }, @@ -188,28 +235,52 @@ struct MapLoadInfo { false, FT_STRING, "MapDescription1" }, { false, FT_STRING, "PvpShortDescription" }, { false, FT_STRING, "PvpLongDescription" }, - { true, FT_INT, "Flags1" }, - { true, FT_INT, "Flags2" }, - { false, FT_FLOAT, "MinimapIconScale" }, { false, FT_FLOAT, "CorpseX" }, { false, FT_FLOAT, "CorpseY" }, + { false, FT_BYTE, "MapType" }, + { true, FT_BYTE, "InstanceType" }, + { false, FT_BYTE, "ExpansionID" }, { false, FT_SHORT, "AreaTableID" }, { true, FT_SHORT, "LoadingScreenID" }, - { true, FT_SHORT, "CorpseMapID" }, { true, FT_SHORT, "TimeOfDayOverride" }, { true, FT_SHORT, "ParentMapID" }, { true, FT_SHORT, "CosmeticParentMapID" }, - { true, FT_SHORT, "WindSettingsID" }, - { false, FT_BYTE, "InstanceType" }, - { false, FT_BYTE, "MapType" }, - { false, FT_BYTE, "ExpansionID" }, - { false, FT_BYTE, "MaxPlayers" }, { false, FT_BYTE, "TimeOffset" }, + { false, FT_FLOAT, "MinimapIconScale" }, + { true, FT_SHORT, "CorpseMapID" }, + { false, FT_BYTE, "MaxPlayers" }, + { true, FT_SHORT, "WindSettingsID" }, + { true, FT_INT, "ZmpFileDataID" }, + { true, FT_INT, "Flags1" }, + { true, FT_INT, "Flags2" }, + }; + static DB2MetaField const fields[22] = + { + { FT_STRING_NOT_LOCALIZED, 1, true }, + { FT_STRING, 1, true }, + { FT_STRING, 1, true }, + { FT_STRING, 1, true }, + { FT_STRING, 1, true }, + { FT_STRING, 1, true }, + { FT_FLOAT, 2, true }, + { FT_BYTE, 1, false }, + { FT_BYTE, 1, true }, + { FT_BYTE, 1, false }, + { FT_SHORT, 1, false }, + { FT_SHORT, 1, true }, + { FT_SHORT, 1, true }, + { FT_SHORT, 1, true }, + { FT_SHORT, 1, true }, + { FT_BYTE, 1, false }, + { FT_FLOAT, 1, true }, + { FT_SHORT, 1, true }, + { FT_BYTE, 1, false }, + { FT_SHORT, 1, true }, + { FT_INT, 1, true }, + { FT_INT, 2, true }, }; - static char const* types = "ssssssiffhhhhhhhbbbbb"; - static uint8 const arraySizes[21] = { 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; - static DB2Meta const meta(-1, 21, 0xF568DF12, types, arraySizes, -1); - static DB2FileLoadInfo const loadInfo(&fields[0], std::extent<decltype(fields)>::value, &meta); + static DB2Meta meta(-1, 22, 0x503A3E58, fields, -1); + static DB2FileLoadInfo const loadInfo(&loadedFields[0], std::extent<decltype(loadedFields)>::value, &meta); return &loadInfo; } }; |