mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Merge pull request #399 from Laupetin/fix/64-bit-compilation
fix: 64 bit compilation
This commit is contained in:
commit
0228e86980
@ -16,7 +16,7 @@ workspace "OpenAssetTools"
|
|||||||
objdir "%{wks.location}/obj"
|
objdir "%{wks.location}/obj"
|
||||||
symbols "On"
|
symbols "On"
|
||||||
systemversion "latest"
|
systemversion "latest"
|
||||||
cppdialect "C++20"
|
cppdialect "C++23"
|
||||||
largeaddressaware "on"
|
largeaddressaware "on"
|
||||||
|
|
||||||
flags {
|
flags {
|
||||||
@ -54,6 +54,10 @@ workspace "OpenAssetTools"
|
|||||||
symbols "On"
|
symbols "On"
|
||||||
filter {}
|
filter {}
|
||||||
|
|
||||||
|
filter {"system:windows", "configurations:Debug" }
|
||||||
|
buildoptions { "/bigobj" }
|
||||||
|
filter {}
|
||||||
|
|
||||||
filter "configurations:Release"
|
filter "configurations:Release"
|
||||||
defines "NDEBUG"
|
defines "NDEBUG"
|
||||||
optimize "Full"
|
optimize "Full"
|
||||||
|
@ -5,3 +5,5 @@ cd "$(dirname "$0")/.." || exit 2
|
|||||||
|
|
||||||
make -C build -j$(nproc) config=debug_x86 clean
|
make -C build -j$(nproc) config=debug_x86 clean
|
||||||
make -C build -j$(nproc) config=release_x86 clean
|
make -C build -j$(nproc) config=release_x86 clean
|
||||||
|
make -C build -j$(nproc) config=debug_x64 clean
|
||||||
|
make -C build -j$(nproc) config=release_x64 clean
|
||||||
|
6
scripts/make-debug-x64.sh
Executable file
6
scripts/make-debug-x64.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Go to repository root
|
||||||
|
cd "$(dirname "$0")/.." || exit 2
|
||||||
|
|
||||||
|
make -C build -j$(nproc) config=debug_x64 all
|
7
scripts/make-release-x64.sh
Executable file
7
scripts/make-release-x64.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Go to repository root
|
||||||
|
cd "$(dirname "$0")/.." || exit 2
|
||||||
|
|
||||||
|
echo "Start building with $(nproc) threads"
|
||||||
|
make -C build -j$(nproc) config=release_x64 all
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
struct ZoneHeader
|
struct ZoneHeader
|
||||||
{
|
{
|
||||||
@ -7,21 +8,11 @@ struct ZoneHeader
|
|||||||
uint32_t m_version;
|
uint32_t m_version;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef ARCH_x64
|
|
||||||
typedef uint32_t scr_string_t;
|
|
||||||
typedef uint64_t xchunk_size_t;
|
|
||||||
typedef uint64_t xblock_size_t;
|
|
||||||
typedef uint64_t zone_pointer_t;
|
|
||||||
|
|
||||||
constexpr uint16_t SCR_STRING_MAX = UINT32_MAX;
|
|
||||||
#elif ARCH_x86
|
|
||||||
typedef uint16_t scr_string_t;
|
typedef uint16_t scr_string_t;
|
||||||
typedef uint32_t xchunk_size_t;
|
typedef uint32_t xchunk_size_t;
|
||||||
typedef uint32_t xblock_size_t;
|
typedef uint32_t xblock_size_t;
|
||||||
typedef uint32_t zone_pointer_t;
|
|
||||||
|
|
||||||
constexpr uint16_t SCR_STRING_MAX = UINT16_MAX;
|
constexpr uint16_t SCR_STRING_MAX = std::numeric_limits<scr_string_t>::max();
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int block_t;
|
typedef int block_t;
|
||||||
typedef int asset_type_t;
|
typedef int asset_type_t;
|
||||||
|
@ -16,7 +16,7 @@ namespace ipak_consts
|
|||||||
static constexpr size_t IPAK_CHUNK_SIZE = 0x8000;
|
static constexpr size_t IPAK_CHUNK_SIZE = 0x8000;
|
||||||
static constexpr size_t IPAK_CHUNK_COUNT_PER_READ = 0x8;
|
static constexpr size_t IPAK_CHUNK_COUNT_PER_READ = 0x8;
|
||||||
|
|
||||||
static constexpr uint32_t IPAK_COMMAND_DEFAULT_SIZE = 0x7F00;
|
static constexpr size_t IPAK_COMMAND_DEFAULT_SIZE = 0x7F00;
|
||||||
static constexpr uint32_t IPAK_COMMAND_UNCOMPRESSED = 0;
|
static constexpr uint32_t IPAK_COMMAND_UNCOMPRESSED = 0;
|
||||||
static constexpr uint32_t IPAK_COMMAND_COMPRESSED = 1;
|
static constexpr uint32_t IPAK_COMMAND_COMPRESSED = 1;
|
||||||
static constexpr uint32_t IPAK_COMMAND_SKIP = 0xCF;
|
static constexpr uint32_t IPAK_COMMAND_SKIP = 0xCF;
|
||||||
|
@ -68,7 +68,7 @@ namespace
|
|||||||
T result;
|
T result;
|
||||||
} data{};
|
} data{};
|
||||||
|
|
||||||
const auto byteCount = utils::Align(bitCount, 8u) / 8u;
|
const auto byteCount = utils::Align(bitCount, 8uz) / 8uz;
|
||||||
assert(byteCount <= sizeof(T));
|
assert(byteCount <= sizeof(T));
|
||||||
|
|
||||||
const auto shiftCount = (8u - bitCount % 8) % 8;
|
const auto shiftCount = (8u - bitCount % 8) % 8;
|
||||||
@ -83,7 +83,7 @@ namespace
|
|||||||
|
|
||||||
while (remainingBits > 0)
|
while (remainingBits > 0)
|
||||||
{
|
{
|
||||||
const auto curBits = static_cast<uint8_t>(std::min(remainingBits, 8u));
|
const auto curBits = static_cast<uint8_t>(std::min(remainingBits, 8uz));
|
||||||
|
|
||||||
if (m_remaining_bits_last_byte > 0)
|
if (m_remaining_bits_last_byte > 0)
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ size_t CommonStructuredDataType::GetSizeInBits(const CommonStructuredDataDef& de
|
|||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
const auto& indexedArray = def.m_indexed_arrays[m_info.type_index];
|
const auto& indexedArray = def.m_indexed_arrays[m_info.type_index];
|
||||||
return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8u);
|
return utils::Align(indexedArray.m_element_size_in_bits * indexedArray.m_element_count, 8uz);
|
||||||
}
|
}
|
||||||
case CommonStructuredDataTypeCategory::ENUM_ARRAY:
|
case CommonStructuredDataTypeCategory::ENUM_ARRAY:
|
||||||
{
|
{
|
||||||
@ -69,7 +69,7 @@ size_t CommonStructuredDataType::GetSizeInBits(const CommonStructuredDataDef& de
|
|||||||
return 0u;
|
return 0u;
|
||||||
}
|
}
|
||||||
const auto& enumedArray = def.m_enumed_arrays[m_info.type_index];
|
const auto& enumedArray = def.m_enumed_arrays[m_info.type_index];
|
||||||
return utils::Align(enumedArray.m_element_size_in_bits * enumedArray.m_element_count, 8u);
|
return utils::Align(enumedArray.m_element_size_in_bits * enumedArray.m_element_count, 8uz);
|
||||||
}
|
}
|
||||||
|
|
||||||
case CommonStructuredDataTypeCategory::UNKNOWN:
|
case CommonStructuredDataTypeCategory::UNKNOWN:
|
||||||
|
@ -216,7 +216,7 @@ namespace
|
|||||||
const auto remainingSize = dataSize - dataOffset;
|
const auto remainingSize = dataSize - dataOffset;
|
||||||
const auto remainingChunkBufferWindowSize = std::max((ipak_consts::IPAK_CHUNK_COUNT_PER_READ * ipak_consts::IPAK_CHUNK_SIZE)
|
const auto remainingChunkBufferWindowSize = std::max((ipak_consts::IPAK_CHUNK_COUNT_PER_READ * ipak_consts::IPAK_CHUNK_SIZE)
|
||||||
- static_cast<size_t>(m_current_offset - m_chunk_buffer_window_start),
|
- static_cast<size_t>(m_current_offset - m_chunk_buffer_window_start),
|
||||||
0u);
|
0uz);
|
||||||
|
|
||||||
if (remainingChunkBufferWindowSize == 0)
|
if (remainingChunkBufferWindowSize == 0)
|
||||||
{
|
{
|
||||||
|
@ -53,15 +53,15 @@ namespace
|
|||||||
case CommonStructuredDataTypeCategory::SHORT:
|
case CommonStructuredDataTypeCategory::SHORT:
|
||||||
return {DATA_SHORT, {0}};
|
return {DATA_SHORT, {0}};
|
||||||
case CommonStructuredDataTypeCategory::STRING:
|
case CommonStructuredDataTypeCategory::STRING:
|
||||||
return {DATA_STRING, {inputType.m_info.string_length}};
|
return {DATA_STRING, {static_cast<unsigned>(inputType.m_info.string_length)}};
|
||||||
case CommonStructuredDataTypeCategory::ENUM:
|
case CommonStructuredDataTypeCategory::ENUM:
|
||||||
return {DATA_ENUM, {inputType.m_info.type_index}};
|
return {DATA_ENUM, {static_cast<unsigned>(inputType.m_info.type_index)}};
|
||||||
case CommonStructuredDataTypeCategory::STRUCT:
|
case CommonStructuredDataTypeCategory::STRUCT:
|
||||||
return {DATA_STRUCT, {inputType.m_info.type_index}};
|
return {DATA_STRUCT, {static_cast<unsigned>(inputType.m_info.type_index)}};
|
||||||
case CommonStructuredDataTypeCategory::INDEXED_ARRAY:
|
case CommonStructuredDataTypeCategory::INDEXED_ARRAY:
|
||||||
return {DATA_INDEXED_ARRAY, {inputType.m_info.type_index}};
|
return {DATA_INDEXED_ARRAY, {static_cast<unsigned>(inputType.m_info.type_index)}};
|
||||||
case CommonStructuredDataTypeCategory::ENUM_ARRAY:
|
case CommonStructuredDataTypeCategory::ENUM_ARRAY:
|
||||||
return {DATA_ENUM_ARRAY, {inputType.m_info.type_index}};
|
return {DATA_ENUM_ARRAY, {static_cast<unsigned>(inputType.m_info.type_index)}};
|
||||||
case CommonStructuredDataTypeCategory::UNKNOWN:
|
case CommonStructuredDataTypeCategory::UNKNOWN:
|
||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
@ -129,14 +129,14 @@ namespace
|
|||||||
{
|
{
|
||||||
outputIndexedArray.arraySize = static_cast<int>(inputIndexedArray.m_element_count);
|
outputIndexedArray.arraySize = static_cast<int>(inputIndexedArray.m_element_count);
|
||||||
outputIndexedArray.elementType = ConvertType(inputIndexedArray.m_array_type);
|
outputIndexedArray.elementType = ConvertType(inputIndexedArray.m_array_type);
|
||||||
outputIndexedArray.elementSize = utils::Align(inputIndexedArray.m_element_size_in_bits, 8u) / 8u;
|
outputIndexedArray.elementSize = utils::Align(inputIndexedArray.m_element_size_in_bits, 8uz) / 8uz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertEnumedArray(const CommonStructuredDataEnumedArray& inputEnumedArray, StructuredDataEnumedArray& outputEnumedArray)
|
void ConvertEnumedArray(const CommonStructuredDataEnumedArray& inputEnumedArray, StructuredDataEnumedArray& outputEnumedArray)
|
||||||
{
|
{
|
||||||
outputEnumedArray.enumIndex = static_cast<int>(inputEnumedArray.m_enum_index);
|
outputEnumedArray.enumIndex = static_cast<int>(inputEnumedArray.m_enum_index);
|
||||||
outputEnumedArray.elementType = ConvertType(inputEnumedArray.m_array_type);
|
outputEnumedArray.elementType = ConvertType(inputEnumedArray.m_array_type);
|
||||||
outputEnumedArray.elementSize = utils::Align(inputEnumedArray.m_element_size_in_bits, 8u) / 8u;
|
outputEnumedArray.elementSize = utils::Align(inputEnumedArray.m_element_size_in_bits, 8uz) / 8uz;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConvertDef(const CommonStructuredDataDef& inputDef, StructuredDataDef& outputDef)
|
void ConvertDef(const CommonStructuredDataDef& inputDef, StructuredDataDef& outputDef)
|
||||||
|
@ -131,7 +131,7 @@ public:
|
|||||||
sizeof(SoundAssetBankEntry),
|
sizeof(SoundAssetBankEntry),
|
||||||
sizeof(SoundAssetBankChecksum),
|
sizeof(SoundAssetBankChecksum),
|
||||||
0x40,
|
0x40,
|
||||||
m_entries.size(),
|
static_cast<unsigned>(m_entries.size()),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
m_total_size,
|
m_total_size,
|
||||||
@ -157,9 +157,9 @@ public:
|
|||||||
|
|
||||||
SoundAssetBankEntry entry{
|
SoundAssetBankEntry entry{
|
||||||
sound.m_sound_id,
|
sound.m_sound_id,
|
||||||
soundSize,
|
static_cast<unsigned>(soundSize),
|
||||||
static_cast<size_t>(m_current_offset),
|
static_cast<unsigned>(m_current_offset),
|
||||||
frameCount,
|
static_cast<unsigned>(frameCount),
|
||||||
frameRateIndex,
|
frameRateIndex,
|
||||||
static_cast<unsigned char>(header.formatChunk.nChannels),
|
static_cast<unsigned char>(header.formatChunk.nChannels),
|
||||||
sound.m_looping,
|
sound.m_looping,
|
||||||
@ -188,8 +188,8 @@ public:
|
|||||||
const auto frameRateIndex = INDEX_FOR_FRAMERATE[metaData.m_sample_rate];
|
const auto frameRateIndex = INDEX_FOR_FRAMERATE[metaData.m_sample_rate];
|
||||||
SoundAssetBankEntry entry{
|
SoundAssetBankEntry entry{
|
||||||
sound.m_sound_id,
|
sound.m_sound_id,
|
||||||
soundSize,
|
static_cast<unsigned>(soundSize),
|
||||||
static_cast<size_t>(m_current_offset),
|
static_cast<unsigned>(m_current_offset),
|
||||||
static_cast<unsigned>(metaData.m_total_samples),
|
static_cast<unsigned>(metaData.m_total_samples),
|
||||||
frameRateIndex,
|
frameRateIndex,
|
||||||
metaData.m_number_of_channels,
|
metaData.m_number_of_channels,
|
||||||
|
@ -240,7 +240,7 @@ namespace sdd::struct_scope_sequences
|
|||||||
if (state->m_current_struct_is_root && state->m_current_struct->m_properties.empty())
|
if (state->m_current_struct_is_root && state->m_current_struct->m_properties.empty())
|
||||||
state->m_current_struct_padding_offset -= 64u;
|
state->m_current_struct_padding_offset -= 64u;
|
||||||
|
|
||||||
state->m_current_struct->m_size_in_byte = utils::Align(state->m_current_struct_padding_offset, 8u) / 8;
|
state->m_current_struct->m_size_in_byte = utils::Align(state->m_current_struct_padding_offset, 8uz) / 8;
|
||||||
state->m_current_struct_padding_offset = 0u;
|
state->m_current_struct_padding_offset = 0u;
|
||||||
state->m_current_struct_is_root = false;
|
state->m_current_struct_is_root = false;
|
||||||
state->m_current_struct = nullptr;
|
state->m_current_struct = nullptr;
|
||||||
|
@ -74,7 +74,7 @@ class StructuredDataDefSizeCalculatorInternal
|
|||||||
|
|
||||||
m_type_stack.emplace_back(CommonStructuredDataTypeCategory::STRUCT, index);
|
m_type_stack.emplace_back(CommonStructuredDataTypeCategory::STRUCT, index);
|
||||||
|
|
||||||
auto currentOffset = 0u;
|
auto currentOffset = 0uz;
|
||||||
for (auto& property : _struct.m_properties)
|
for (auto& property : _struct.m_properties)
|
||||||
{
|
{
|
||||||
CalculateForType(property.m_type);
|
CalculateForType(property.m_type);
|
||||||
@ -85,7 +85,7 @@ class StructuredDataDefSizeCalculatorInternal
|
|||||||
|
|
||||||
currentOffset += property.m_type.GetSizeInBits(m_def);
|
currentOffset += property.m_type.GetSizeInBits(m_def);
|
||||||
}
|
}
|
||||||
currentOffset = utils::Align(currentOffset, 8u);
|
currentOffset = utils::Align(currentOffset, 8uz);
|
||||||
_struct.m_size_in_byte += currentOffset / 8;
|
_struct.m_size_in_byte += currentOffset / 8;
|
||||||
|
|
||||||
m_struct_calculated[index] = true;
|
m_struct_calculated[index] = true;
|
||||||
|
@ -286,7 +286,7 @@ namespace
|
|||||||
|
|
||||||
common.m_vertices.emplace_back(vertex);
|
common.m_vertices.emplace_back(vertex);
|
||||||
|
|
||||||
XModelVertexBoneWeights vertexWeights{.weightOffset = common.m_bone_weight_data.weights.size(), .weightCount = 0u};
|
XModelVertexBoneWeights vertexWeights{.weightOffset = static_cast<unsigned>(common.m_bone_weight_data.weights.size()), .weightCount = 0u};
|
||||||
for (auto i = 0u; i < std::extent_v<decltype(joints)>; i++)
|
for (auto i = 0u; i < std::extent_v<decltype(joints)>; i++)
|
||||||
{
|
{
|
||||||
if (std::abs(weights[i]) < std::numeric_limits<float>::epsilon())
|
if (std::abs(weights[i]) < std::numeric_limits<float>::epsilon())
|
||||||
|
@ -284,7 +284,7 @@ namespace
|
|||||||
const auto& vertList = surface.vertList[vertListIndex];
|
const auto& vertList = surface.vertList[vertListIndex];
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
|
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{vertList.boneOffset / sizeof(DObjSkelMat), 1.0f};
|
weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f};
|
||||||
|
|
||||||
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
||||||
{
|
{
|
||||||
@ -301,7 +301,7 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f};
|
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f};
|
||||||
|
|
||||||
vertsBlendOffset += 1;
|
vertsBlendOffset += 1;
|
||||||
@ -313,8 +313,8 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1;
|
const auto boneWeight0 = 1.0f - boneWeight1;
|
||||||
|
|
||||||
@ -330,10 +330,10 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
||||||
|
|
||||||
@ -350,12 +350,12 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
const unsigned boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
||||||
|
|
||||||
|
@ -37,22 +37,22 @@ CommonStructuredDataType AssetDumperStructuredDataDefSet::ConvertType(const Comm
|
|||||||
case DATA_ENUM:
|
case DATA_ENUM:
|
||||||
assert(!def->m_enums.empty());
|
assert(!def->m_enums.empty());
|
||||||
out.m_category = CommonStructuredDataTypeCategory::ENUM;
|
out.m_category = CommonStructuredDataTypeCategory::ENUM;
|
||||||
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.enumIndex), def->m_enums.size() - 1u), 0u);
|
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.enumIndex), def->m_enums.size() - 1uz), 0uz);
|
||||||
break;
|
break;
|
||||||
case DATA_STRUCT:
|
case DATA_STRUCT:
|
||||||
assert(!def->m_structs.empty());
|
assert(!def->m_structs.empty());
|
||||||
out.m_category = CommonStructuredDataTypeCategory::STRUCT;
|
out.m_category = CommonStructuredDataTypeCategory::STRUCT;
|
||||||
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.structIndex), def->m_structs.size() - 1u), 0u);
|
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.structIndex), def->m_structs.size() - 1uz), 0uz);
|
||||||
break;
|
break;
|
||||||
case DATA_INDEXED_ARRAY:
|
case DATA_INDEXED_ARRAY:
|
||||||
assert(!def->m_indexed_arrays.empty());
|
assert(!def->m_indexed_arrays.empty());
|
||||||
out.m_category = CommonStructuredDataTypeCategory::INDEXED_ARRAY;
|
out.m_category = CommonStructuredDataTypeCategory::INDEXED_ARRAY;
|
||||||
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.indexedArrayIndex), def->m_indexed_arrays.size() - 1u), 0u);
|
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.indexedArrayIndex), def->m_indexed_arrays.size() - 1uz), 0uz);
|
||||||
break;
|
break;
|
||||||
case DATA_ENUM_ARRAY:
|
case DATA_ENUM_ARRAY:
|
||||||
assert(!def->m_enumed_arrays.empty());
|
assert(!def->m_enumed_arrays.empty());
|
||||||
out.m_category = CommonStructuredDataTypeCategory::ENUM_ARRAY;
|
out.m_category = CommonStructuredDataTypeCategory::ENUM_ARRAY;
|
||||||
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.enumedArrayIndex), def->m_enumed_arrays.size() - 1u), 0u);
|
out.m_info.type_index = std::max(std::min(static_cast<size_t>(in.u.enumedArrayIndex), def->m_enumed_arrays.size() - 1uz), 0uz);
|
||||||
break;
|
break;
|
||||||
case DATA_COUNT:
|
case DATA_COUNT:
|
||||||
default:
|
default:
|
||||||
@ -138,7 +138,7 @@ void AssetDumperStructuredDataDefSet::ConvertEnumedArray(const CommonStructuredD
|
|||||||
assert(!def->m_enums.empty());
|
assert(!def->m_enums.empty());
|
||||||
out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8;
|
out->m_element_size_in_bits = in->elementType.type == DATA_BOOL ? 1 : in->elementSize * 8;
|
||||||
out->m_array_type = ConvertType(def, in->elementType);
|
out->m_array_type = ConvertType(def, in->elementType);
|
||||||
out->m_enum_index = std::max(std::min(static_cast<size_t>(in->enumIndex), def->m_enums.size() - 1u), 0u);
|
out->m_enum_index = std::max(std::min(static_cast<size_t>(in->enumIndex), def->m_enums.size() - 1uz), 0uz);
|
||||||
|
|
||||||
if (def->m_enums.empty())
|
if (def->m_enums.empty())
|
||||||
{
|
{
|
||||||
|
@ -267,7 +267,7 @@ namespace
|
|||||||
const auto& vertList = surface.vertList[vertListIndex];
|
const auto& vertList = surface.vertList[vertListIndex];
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
|
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{vertList.boneOffset / sizeof(DObjSkelMat), 1.0f};
|
weightCollection.weights[weightOffset++] = XModelBoneWeight{static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), 1.0f};
|
||||||
|
|
||||||
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
||||||
{
|
{
|
||||||
@ -284,7 +284,7 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f};
|
weightCollection.weights[weightOffset++] = XModelBoneWeight{boneIndex0, 1.0f};
|
||||||
|
|
||||||
vertsBlendOffset += 1;
|
vertsBlendOffset += 1;
|
||||||
@ -296,8 +296,8 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1;
|
const auto boneWeight0 = 1.0f - boneWeight1;
|
||||||
|
|
||||||
@ -313,10 +313,10 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
||||||
|
|
||||||
@ -333,12 +333,12 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
const unsigned boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ namespace
|
|||||||
"devraw/",
|
"devraw/",
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr size_t FRAME_RATE_FOR_INDEX[]{
|
constexpr unsigned FRAME_RATE_FOR_INDEX[]{
|
||||||
8000,
|
8000,
|
||||||
12000,
|
12000,
|
||||||
16000,
|
16000,
|
||||||
|
@ -27,7 +27,7 @@ void WavWriter::WritePcmHeader(const WavMetaData& metaData, const size_t dataLen
|
|||||||
};
|
};
|
||||||
m_stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk));
|
m_stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk));
|
||||||
|
|
||||||
const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, dataLen};
|
const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, static_cast<unsigned>(dataLen)};
|
||||||
m_stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader));
|
m_stream.write(reinterpret_cast<const char*>(&dataChunkHeader), sizeof(dataChunkHeader));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void StructuredDataDefDumper::DumpType(const CommonStructuredDataDef& def,
|
|||||||
|
|
||||||
void StructuredDataDefDumper::DumpProperty(const CommonStructuredDataDef& def,
|
void StructuredDataDefDumper::DumpProperty(const CommonStructuredDataDef& def,
|
||||||
const CommonStructuredDataStructProperty& property,
|
const CommonStructuredDataStructProperty& property,
|
||||||
unsigned& currentOffsetInBit) const
|
size_t& currentOffsetInBit) const
|
||||||
{
|
{
|
||||||
std::string typeName;
|
std::string typeName;
|
||||||
std::vector<std::string> arraySpecifiers;
|
std::vector<std::string> arraySpecifiers;
|
||||||
@ -205,11 +205,11 @@ void StructuredDataDefDumper::DumpStruct(const CommonStructuredDataDef& def, con
|
|||||||
IncIndent();
|
IncIndent();
|
||||||
|
|
||||||
auto currentOffsetInBit =
|
auto currentOffsetInBit =
|
||||||
def.m_root_type.m_category == CommonStructuredDataTypeCategory::STRUCT && def.m_root_type.m_info.type_index == structIndex ? 64u : 0u;
|
def.m_root_type.m_category == CommonStructuredDataTypeCategory::STRUCT && def.m_root_type.m_info.type_index == structIndex ? 64uz : 0uz;
|
||||||
for (const auto& property : _struct.m_properties)
|
for (const auto& property : _struct.m_properties)
|
||||||
DumpProperty(def, property, currentOffsetInBit);
|
DumpProperty(def, property, currentOffsetInBit);
|
||||||
|
|
||||||
currentOffsetInBit = utils::Align(currentOffsetInBit, 8u);
|
currentOffsetInBit = utils::Align(currentOffsetInBit, 8uz);
|
||||||
if ((currentOffsetInBit / 8) < _struct.m_size_in_byte)
|
if ((currentOffsetInBit / 8) < _struct.m_size_in_byte)
|
||||||
{
|
{
|
||||||
Indent();
|
Indent();
|
||||||
|
@ -17,7 +17,7 @@ class StructuredDataDefDumper : AbstractTextDumper
|
|||||||
|
|
||||||
void DumpEnum(const CommonStructuredDataEnum& _enum);
|
void DumpEnum(const CommonStructuredDataEnum& _enum);
|
||||||
void DumpType(const CommonStructuredDataDef& def, CommonStructuredDataType type, std::string& typeName, std::vector<std::string>& arraySpecifiers) const;
|
void DumpType(const CommonStructuredDataDef& def, CommonStructuredDataType type, std::string& typeName, std::vector<std::string>& arraySpecifiers) const;
|
||||||
void DumpProperty(const CommonStructuredDataDef& def, const CommonStructuredDataStructProperty& property, unsigned& currentOffsetInBit) const;
|
void DumpProperty(const CommonStructuredDataDef& def, const CommonStructuredDataStructProperty& property, size_t& currentOffsetInBit) const;
|
||||||
void DumpStruct(const CommonStructuredDataDef& def, const CommonStructuredDataStruct& _struct, size_t structIndex);
|
void DumpStruct(const CommonStructuredDataDef& def, const CommonStructuredDataStruct& _struct, size_t structIndex);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -393,7 +393,8 @@ namespace
|
|||||||
const auto& vertList = surface.vertList[vertListIndex];
|
const auto& vertList = surface.vertList[vertListIndex];
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
|
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = vertList.boneOffset / sizeof(DObjSkelMat), .weight = 1.0f};
|
weightCollection.weights[weightOffset++] =
|
||||||
|
XModelBoneWeight{.boneIndex = static_cast<unsigned>(vertList.boneOffset / sizeof(DObjSkelMat)), .weight = 1.0f};
|
||||||
|
|
||||||
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
for (auto vertListVertexOffset = 0u; vertListVertexOffset < vertList.vertCount; vertListVertexOffset++)
|
||||||
{
|
{
|
||||||
@ -410,7 +411,7 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[0]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = 1.0f};
|
weightCollection.weights[weightOffset++] = XModelBoneWeight{.boneIndex = boneIndex0, .weight = 1.0f};
|
||||||
|
|
||||||
vertsBlendOffset += 1;
|
vertsBlendOffset += 1;
|
||||||
@ -422,8 +423,8 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[1]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1;
|
const auto boneWeight0 = 1.0f - boneWeight1;
|
||||||
|
|
||||||
@ -439,10 +440,10 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[2]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2;
|
||||||
|
|
||||||
@ -459,12 +460,12 @@ namespace
|
|||||||
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
for (auto vertIndex = 0; vertIndex < surface.vertInfo.vertCount[3]; vertIndex++)
|
||||||
{
|
{
|
||||||
const auto boneWeightOffset = weightOffset;
|
const auto boneWeightOffset = weightOffset;
|
||||||
const auto boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
const unsigned boneIndex0 = surface.vertInfo.vertsBlend[vertsBlendOffset + 0] / sizeof(DObjSkelMat);
|
||||||
const auto boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
const unsigned boneIndex1 = surface.vertInfo.vertsBlend[vertsBlendOffset + 1] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
const auto boneWeight1 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 2]);
|
||||||
const auto boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
const unsigned boneIndex2 = surface.vertInfo.vertsBlend[vertsBlendOffset + 3] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
const auto boneWeight2 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 4]);
|
||||||
const auto boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
const unsigned boneIndex3 = surface.vertInfo.vertsBlend[vertsBlendOffset + 5] / sizeof(DObjSkelMat);
|
||||||
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
const auto boneWeight3 = BoneWeight16(surface.vertInfo.vertsBlend[vertsBlendOffset + 6]);
|
||||||
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
const auto boneWeight0 = 1.0f - boneWeight1 - boneWeight2 - boneWeight3;
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include "AbstractDirectiveStreamProxy.h"
|
#include "AbstractDirectiveStreamProxy.h"
|
||||||
|
|
||||||
TokenPos AbstractDirectiveStreamProxy::CreatePos(const ParserLine& line, const unsigned position)
|
TokenPos AbstractDirectiveStreamProxy::CreatePos(const ParserLine& line, const size_t position)
|
||||||
{
|
{
|
||||||
return TokenPos(*line.m_filename, line.m_line_number, static_cast<int>(position + 1));
|
return TokenPos(*line.m_filename, line.m_line_number, static_cast<int>(position + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::SkipWhitespace(const ParserLine& line, unsigned& position)
|
bool AbstractDirectiveStreamProxy::SkipWhitespace(const ParserLine& line, size_t& position)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -21,7 +21,7 @@ bool AbstractDirectiveStreamProxy::SkipWhitespace(const ParserLine& line, unsign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::ExtractInteger(const ParserLine& line, unsigned& position, int& value)
|
bool AbstractDirectiveStreamProxy::ExtractInteger(const ParserLine& line, size_t& position, int& value)
|
||||||
{
|
{
|
||||||
if (position >= line.m_line.size())
|
if (position >= line.m_line.size())
|
||||||
return false;
|
return false;
|
||||||
@ -40,7 +40,7 @@ bool AbstractDirectiveStreamProxy::ExtractInteger(const ParserLine& line, unsign
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::ExtractIdentifier(const ParserLine& line, unsigned& position)
|
bool AbstractDirectiveStreamProxy::ExtractIdentifier(const ParserLine& line, size_t& position)
|
||||||
{
|
{
|
||||||
auto firstChar = true;
|
auto firstChar = true;
|
||||||
while (true)
|
while (true)
|
||||||
@ -60,7 +60,7 @@ bool AbstractDirectiveStreamProxy::ExtractIdentifier(const ParserLine& line, uns
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::MatchCharacter(const ParserLine& line, unsigned& position, char c)
|
bool AbstractDirectiveStreamProxy::MatchCharacter(const ParserLine& line, size_t& position, char c)
|
||||||
{
|
{
|
||||||
if (position < line.m_line.size() && line.m_line[position] == c)
|
if (position < line.m_line.size() && line.m_line[position] == c)
|
||||||
{
|
{
|
||||||
@ -71,12 +71,12 @@ bool AbstractDirectiveStreamProxy::MatchCharacter(const ParserLine& line, unsign
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::MatchNextCharacter(const ParserLine& line, unsigned& position, char c)
|
bool AbstractDirectiveStreamProxy::MatchNextCharacter(const ParserLine& line, size_t& position, char c)
|
||||||
{
|
{
|
||||||
return SkipWhitespace(line, position) && MatchCharacter(line, position, c);
|
return SkipWhitespace(line, position) && MatchCharacter(line, position, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::MatchString(const ParserLine& line, unsigned& position, const char* str, unsigned len)
|
bool AbstractDirectiveStreamProxy::MatchString(const ParserLine& line, size_t& position, const char* str, size_t len)
|
||||||
{
|
{
|
||||||
if (line.m_line.compare(position, len, str) == 0)
|
if (line.m_line.compare(position, len, str) == 0)
|
||||||
{
|
{
|
||||||
@ -87,12 +87,12 @@ bool AbstractDirectiveStreamProxy::MatchString(const ParserLine& line, unsigned&
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::MatchNextString(const ParserLine& line, unsigned& position, const char* str, unsigned len)
|
bool AbstractDirectiveStreamProxy::MatchNextString(const ParserLine& line, size_t& position, const char* str, size_t len)
|
||||||
{
|
{
|
||||||
return SkipWhitespace(line, position) && MatchString(line, position, str, len);
|
return SkipWhitespace(line, position) && MatchString(line, position, str, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractDirectiveStreamProxy::FindDirective(const ParserLine& line, unsigned& directiveStartPosition, unsigned& directiveEndPos)
|
bool AbstractDirectiveStreamProxy::FindDirective(const ParserLine& line, size_t& directiveStartPosition, size_t& directiveEndPos)
|
||||||
{
|
{
|
||||||
directiveStartPosition = 0;
|
directiveStartPosition = 0;
|
||||||
for (; directiveStartPosition < line.m_line.size(); directiveStartPosition++)
|
for (; directiveStartPosition < line.m_line.size(); directiveStartPosition++)
|
||||||
|
@ -3,20 +3,22 @@
|
|||||||
#include "Parsing/IParserLineStream.h"
|
#include "Parsing/IParserLineStream.h"
|
||||||
#include "Parsing/TokenPos.h"
|
#include "Parsing/TokenPos.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
class AbstractDirectiveStreamProxy : public IParserLineStream
|
class AbstractDirectiveStreamProxy : public IParserLineStream
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
AbstractDirectiveStreamProxy() = default;
|
AbstractDirectiveStreamProxy() = default;
|
||||||
|
|
||||||
static TokenPos CreatePos(const ParserLine& line, unsigned position);
|
static TokenPos CreatePos(const ParserLine& line, size_t position);
|
||||||
|
|
||||||
static bool SkipWhitespace(const ParserLine& line, unsigned& position);
|
static bool SkipWhitespace(const ParserLine& line, size_t& position);
|
||||||
static bool ExtractInteger(const ParserLine& line, unsigned& position, int& value);
|
static bool ExtractInteger(const ParserLine& line, size_t& position, int& value);
|
||||||
static bool ExtractIdentifier(const ParserLine& line, unsigned& position);
|
static bool ExtractIdentifier(const ParserLine& line, size_t& position);
|
||||||
static bool MatchCharacter(const ParserLine& line, unsigned& position, char c);
|
static bool MatchCharacter(const ParserLine& line, size_t& position, char c);
|
||||||
static bool MatchNextCharacter(const ParserLine& line, unsigned& position, char c);
|
static bool MatchNextCharacter(const ParserLine& line, size_t& position, char c);
|
||||||
static bool MatchString(const ParserLine& line, unsigned& position, const char* str, unsigned len);
|
static bool MatchString(const ParserLine& line, size_t& position, const char* str, size_t len);
|
||||||
static bool MatchNextString(const ParserLine& line, unsigned& position, const char* str, unsigned len);
|
static bool MatchNextString(const ParserLine& line, size_t& position, const char* str, size_t len);
|
||||||
|
|
||||||
static bool FindDirective(const ParserLine& line, unsigned& directiveStartPosition, unsigned& directiveEndPos);
|
static bool FindDirective(const ParserLine& line, size_t& directiveStartPosition, size_t& directiveEndPos);
|
||||||
};
|
};
|
||||||
|
@ -14,12 +14,12 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
bool IsStringizeParameterForwardLookup(const std::string& value, unsigned pos)
|
bool IsStringizeParameterForwardLookup(const std::string& value, size_t pos)
|
||||||
{
|
{
|
||||||
return pos + 1 && (isalpha(value[pos + 1]) || value[pos + 1] == '_');
|
return pos + 1 && (isalpha(value[pos + 1]) || value[pos + 1] == '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsTokenPastingOperatorForwardLookup(const std::string& value, unsigned pos)
|
bool IsTokenPastingOperatorForwardLookup(const std::string& value, size_t pos)
|
||||||
{
|
{
|
||||||
return pos + 1 < value.size() && value[pos + 1] == '#';
|
return pos + 1 < value.size() && value[pos + 1] == '#';
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ DefinesStreamProxy::DefineParameterPosition::DefineParameterPosition()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
DefinesStreamProxy::DefineParameterPosition::DefineParameterPosition(const unsigned index, const unsigned position, const bool stringize)
|
DefinesStreamProxy::DefineParameterPosition::DefineParameterPosition(const unsigned index, const size_t position, const bool stringize)
|
||||||
: m_parameter_index(index),
|
: m_parameter_index(index),
|
||||||
m_parameter_position(position),
|
m_parameter_position(position),
|
||||||
m_stringize(stringize)
|
m_stringize(stringize)
|
||||||
@ -175,7 +175,7 @@ int DefinesStreamProxy::GetLineEndEscapePos(const ParserLine& line)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefinesStreamProxy::ContinueDefine(const ParserLine& line, const unsigned currentPos)
|
void DefinesStreamProxy::ContinueDefine(const ParserLine& line, const size_t currentPos)
|
||||||
{
|
{
|
||||||
const auto lineEndEscapePos = GetLineEndEscapePos(line);
|
const auto lineEndEscapePos = GetLineEndEscapePos(line);
|
||||||
if (lineEndEscapePos < 0)
|
if (lineEndEscapePos < 0)
|
||||||
@ -204,7 +204,7 @@ void DefinesStreamProxy::ContinueDefine(const ParserLine& line, const unsigned c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefinesStreamProxy::ContinueParameters(const ParserLine& line, unsigned& currentPos)
|
void DefinesStreamProxy::ContinueParameters(const ParserLine& line, size_t& currentPos)
|
||||||
{
|
{
|
||||||
const auto lineEndEscapePos = GetLineEndEscapePos(line);
|
const auto lineEndEscapePos = GetLineEndEscapePos(line);
|
||||||
while (true)
|
while (true)
|
||||||
@ -241,7 +241,7 @@ void DefinesStreamProxy::ContinueParameters(const ParserLine& line, unsigned& cu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefinesStreamProxy::MatchDefineParameters(const ParserLine& line, unsigned& currentPos)
|
void DefinesStreamProxy::MatchDefineParameters(const ParserLine& line, size_t& currentPos)
|
||||||
{
|
{
|
||||||
m_current_define_parameters = std::vector<std::string>();
|
m_current_define_parameters = std::vector<std::string>();
|
||||||
if (line.m_line[currentPos] != '(')
|
if (line.m_line[currentPos] != '(')
|
||||||
@ -253,7 +253,7 @@ void DefinesStreamProxy::MatchDefineParameters(const ParserLine& line, unsigned&
|
|||||||
ContinueParameters(line, currentPos);
|
ContinueParameters(line, currentPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchDefineDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchDefineDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -284,7 +284,7 @@ bool DefinesStreamProxy::MatchDefineDirective(const ParserLine& line, const unsi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchUndefDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchUndefDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ std::unique_ptr<ISimpleExpression> DefinesStreamProxy::ParseExpression(std::shar
|
|||||||
return expressionInterpreter.Evaluate();
|
return expressionInterpreter.Evaluate();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchIfDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchIfDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -356,7 +356,7 @@ bool DefinesStreamProxy::MatchIfDirective(const ParserLine& line, const unsigned
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchElIfDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchElIfDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ bool DefinesStreamProxy::MatchElIfDirective(const ParserLine& line, const unsign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchIfdefDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchIfdefDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -439,7 +439,7 @@ bool DefinesStreamProxy::MatchIfdefDirective(const ParserLine& line, const unsig
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchElseDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchElseDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -460,7 +460,7 @@ bool DefinesStreamProxy::MatchElseDirective(const ParserLine& line, const unsign
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchEndifDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool DefinesStreamProxy::MatchEndifDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPosition;
|
auto currentPos = directiveStartPosition;
|
||||||
|
|
||||||
@ -486,8 +486,8 @@ bool DefinesStreamProxy::MatchEndifDirective(const ParserLine& line, const unsig
|
|||||||
|
|
||||||
bool DefinesStreamProxy::MatchDirectives(ParserLine& line)
|
bool DefinesStreamProxy::MatchDirectives(ParserLine& line)
|
||||||
{
|
{
|
||||||
unsigned directiveStartPos;
|
size_t directiveStartPos;
|
||||||
unsigned directiveEndPos;
|
size_t directiveEndPos;
|
||||||
|
|
||||||
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
||||||
return false;
|
return false;
|
||||||
@ -537,9 +537,9 @@ void DefinesStreamProxy::ExtractParametersFromMacroUsage(
|
|||||||
ContinueMacroParameters(line, linePos, state, input, inputPos);
|
ContinueMacroParameters(line, linePos, state, input, inputPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefinesStreamProxy::MatchDefinedExpression(const ParserLine& line, unsigned& pos, std::string& definitionName)
|
bool DefinesStreamProxy::MatchDefinedExpression(const ParserLine& line, size_t& pos, std::string& definitionName)
|
||||||
{
|
{
|
||||||
unsigned currentPos = pos;
|
auto currentPos = pos;
|
||||||
|
|
||||||
if (!MatchNextCharacter(line, currentPos, '('))
|
if (!MatchNextCharacter(line, currentPos, '('))
|
||||||
return false;
|
return false;
|
||||||
@ -559,7 +559,7 @@ bool DefinesStreamProxy::MatchDefinedExpression(const ParserLine& line, unsigned
|
|||||||
|
|
||||||
void DefinesStreamProxy::ExpandDefinedExpressions(ParserLine& line) const
|
void DefinesStreamProxy::ExpandDefinedExpressions(ParserLine& line) const
|
||||||
{
|
{
|
||||||
auto currentPos = 0u;
|
auto currentPos = 0uz;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
@ -1094,7 +1094,7 @@ ParserLine DefinesStreamProxy::NextLine()
|
|||||||
{
|
{
|
||||||
if (m_in_define)
|
if (m_in_define)
|
||||||
{
|
{
|
||||||
unsigned currentPos = 0u;
|
auto currentPos = 0uz;
|
||||||
|
|
||||||
if (m_parameter_state != ParameterState::NOT_IN_PARAMETERS)
|
if (m_parameter_state != ParameterState::NOT_IN_PARAMETERS)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "Parsing/IParserLineStream.h"
|
#include "Parsing/IParserLineStream.h"
|
||||||
#include "Parsing/Simple/Expression/ISimpleExpression.h"
|
#include "Parsing/Simple/Expression/ISimpleExpression.h"
|
||||||
|
|
||||||
|
#include <cstddef>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -29,11 +30,11 @@ public:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
unsigned m_parameter_index;
|
unsigned m_parameter_index;
|
||||||
unsigned m_parameter_position;
|
size_t m_parameter_position;
|
||||||
bool m_stringize;
|
bool m_stringize;
|
||||||
|
|
||||||
DefineParameterPosition();
|
DefineParameterPosition();
|
||||||
DefineParameterPosition(unsigned index, unsigned position, bool stringize);
|
DefineParameterPosition(unsigned index, size_t position, bool stringize);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Define
|
class Define
|
||||||
@ -96,22 +97,22 @@ private:
|
|||||||
MacroParameterState m_multi_line_macro_parameters;
|
MacroParameterState m_multi_line_macro_parameters;
|
||||||
|
|
||||||
static int GetLineEndEscapePos(const ParserLine& line);
|
static int GetLineEndEscapePos(const ParserLine& line);
|
||||||
void MatchDefineParameters(const ParserLine& line, unsigned& currentPos);
|
void MatchDefineParameters(const ParserLine& line, size_t& currentPos);
|
||||||
void ContinueDefine(const ParserLine& line, unsigned currentPos);
|
void ContinueDefine(const ParserLine& line, size_t currentPos);
|
||||||
void ContinueParameters(const ParserLine& line, unsigned& currentPos);
|
void ContinueParameters(const ParserLine& line, size_t& currentPos);
|
||||||
_NODISCARD bool MatchDefineDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchDefineDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchUndefDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchUndefDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchIfDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchIfDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchElIfDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchElIfDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchIfdefDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchIfdefDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchElseDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchElseDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchEndifDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchEndifDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchDirectives(ParserLine& line);
|
_NODISCARD bool MatchDirectives(ParserLine& line);
|
||||||
|
|
||||||
void ExtractParametersFromMacroUsage(const ParserLine& line, unsigned& linePos, MacroParameterState& state, const std::string& input, unsigned& inputPos);
|
void ExtractParametersFromMacroUsage(const ParserLine& line, unsigned& linePos, MacroParameterState& state, const std::string& input, unsigned& inputPos);
|
||||||
bool FindMacroForIdentifier(const std::string& input, unsigned wordStart, unsigned wordEnd, const Define*& value) const;
|
bool FindMacroForIdentifier(const std::string& input, unsigned wordStart, unsigned wordEnd, const Define*& value) const;
|
||||||
|
|
||||||
static bool MatchDefinedExpression(const ParserLine& line, unsigned& pos, std::string& definitionName);
|
static bool MatchDefinedExpression(const ParserLine& line, size_t& pos, std::string& definitionName);
|
||||||
void ExpandDefinedExpressions(ParserLine& line) const;
|
void ExpandDefinedExpressions(ParserLine& line) const;
|
||||||
|
|
||||||
bool FindNextMacro(const std::string& input, unsigned& inputPos, unsigned& defineStart, const DefinesStreamProxy::Define*& define);
|
bool FindNextMacro(const std::string& input, unsigned& inputPos, unsigned& defineStart, const DefinesStreamProxy::Define*& define);
|
||||||
|
@ -13,9 +13,9 @@ IncludingStreamProxy::IncludingStreamProxy(IParserLineStream* stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IncludingStreamProxy::ExtractIncludeFilename(const ParserLine& line,
|
bool IncludingStreamProxy::ExtractIncludeFilename(const ParserLine& line,
|
||||||
const unsigned includeDirectivePosition,
|
const size_t includeDirectivePosition,
|
||||||
unsigned& filenameStartPosition,
|
size_t& filenameStartPosition,
|
||||||
unsigned& filenameEndPosition)
|
size_t& filenameEndPosition)
|
||||||
{
|
{
|
||||||
auto currentPos = includeDirectivePosition;
|
auto currentPos = includeDirectivePosition;
|
||||||
bool isDoubleQuotes;
|
bool isDoubleQuotes;
|
||||||
@ -60,7 +60,7 @@ bool IncludingStreamProxy::ExtractIncludeFilename(const ParserLine& line,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IncludingStreamProxy::MatchIncludeDirective(const ParserLine& line, const unsigned directiveStartPos, const unsigned directiveEndPos) const
|
bool IncludingStreamProxy::MatchIncludeDirective(const ParserLine& line, const size_t directiveStartPos, const size_t directiveEndPos) const
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPos;
|
auto currentPos = directiveStartPos;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ bool IncludingStreamProxy::MatchIncludeDirective(const ParserLine& line, const u
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned filenameStart, filenameEnd;
|
size_t filenameStart, filenameEnd;
|
||||||
|
|
||||||
if (!ExtractIncludeFilename(line, currentPos, filenameStart, filenameEnd))
|
if (!ExtractIncludeFilename(line, currentPos, filenameStart, filenameEnd))
|
||||||
throw ParsingException(TokenPos(*line.m_filename, line.m_line_number, static_cast<int>(currentPos)), INCLUDE_QUOTES_ERROR);
|
throw ParsingException(TokenPos(*line.m_filename, line.m_line_number, static_cast<int>(currentPos)), INCLUDE_QUOTES_ERROR);
|
||||||
@ -86,7 +86,7 @@ bool IncludingStreamProxy::MatchIncludeDirective(const ParserLine& line, const u
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IncludingStreamProxy::MatchPragmaOnceDirective(const ParserLine& line, const unsigned directiveStartPos, const unsigned directiveEndPos)
|
bool IncludingStreamProxy::MatchPragmaOnceDirective(const ParserLine& line, const size_t directiveStartPos, const size_t directiveEndPos)
|
||||||
{
|
{
|
||||||
auto currentPos = directiveStartPos;
|
auto currentPos = directiveStartPos;
|
||||||
|
|
||||||
@ -116,7 +116,7 @@ bool IncludingStreamProxy::MatchPragmaOnceDirective(const ParserLine& line, cons
|
|||||||
|
|
||||||
bool IncludingStreamProxy::MatchDirectives(const ParserLine& line)
|
bool IncludingStreamProxy::MatchDirectives(const ParserLine& line)
|
||||||
{
|
{
|
||||||
unsigned directiveStartPos, directiveEndPos;
|
size_t directiveStartPos, directiveEndPos;
|
||||||
|
|
||||||
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
||||||
return false;
|
return false;
|
||||||
|
@ -16,9 +16,9 @@ class IncludingStreamProxy final : public AbstractDirectiveStreamProxy
|
|||||||
std::set<std::string> m_included_files;
|
std::set<std::string> m_included_files;
|
||||||
|
|
||||||
_NODISCARD static bool
|
_NODISCARD static bool
|
||||||
ExtractIncludeFilename(const ParserLine& line, unsigned includeDirectivePosition, unsigned& filenameStartPosition, unsigned& filenameEndPosition);
|
ExtractIncludeFilename(const ParserLine& line, size_t includeDirectivePosition, size_t& filenameStartPosition, size_t& filenameEndPosition);
|
||||||
_NODISCARD bool MatchIncludeDirective(const ParserLine& line, unsigned directiveStartPos, unsigned directiveEndPos) const;
|
_NODISCARD bool MatchIncludeDirective(const ParserLine& line, size_t directiveStartPos, size_t directiveEndPos) const;
|
||||||
_NODISCARD bool MatchPragmaOnceDirective(const ParserLine& line, unsigned directiveStartPos, unsigned directiveEndPos);
|
_NODISCARD bool MatchPragmaOnceDirective(const ParserLine& line, size_t directiveStartPos, size_t directiveEndPos);
|
||||||
_NODISCARD bool MatchDirectives(const ParserLine& line);
|
_NODISCARD bool MatchDirectives(const ParserLine& line);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -7,7 +7,7 @@ PackDefinitionStreamProxy::PackDefinitionStreamProxy(IParserLineStream* stream)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PackDefinitionStreamProxy::MatchPackDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition)
|
bool PackDefinitionStreamProxy::MatchPackDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition)
|
||||||
{
|
{
|
||||||
auto packValue = 0;
|
auto packValue = 0;
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
@ -60,7 +60,7 @@ bool PackDefinitionStreamProxy::MatchPackDirective(const ParserLine& line, const
|
|||||||
|
|
||||||
bool PackDefinitionStreamProxy::MatchDirectives(const ParserLine& line)
|
bool PackDefinitionStreamProxy::MatchDirectives(const ParserLine& line)
|
||||||
{
|
{
|
||||||
unsigned directiveStartPos, directiveEndPos;
|
size_t directiveStartPos, directiveEndPos;
|
||||||
|
|
||||||
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,7 +21,7 @@ private:
|
|||||||
IParserLineStream* const m_stream;
|
IParserLineStream* const m_stream;
|
||||||
std::stack<int> m_current_pack;
|
std::stack<int> m_current_pack;
|
||||||
|
|
||||||
_NODISCARD bool MatchPackDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition);
|
_NODISCARD bool MatchPackDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition);
|
||||||
_NODISCARD bool MatchDirectives(const ParserLine& line);
|
_NODISCARD bool MatchDirectives(const ParserLine& line);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -15,7 +15,7 @@ void SetDefineStreamProxy::SetDefinesProxy(DefinesStreamProxy* definesProxy)
|
|||||||
m_defines_proxy = definesProxy;
|
m_defines_proxy = definesProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetDefineStreamProxy::MatchSetDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition) const
|
bool SetDefineStreamProxy::MatchSetDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition) const
|
||||||
{
|
{
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ bool SetDefineStreamProxy::MatchSetDirective(const ParserLine& line, const unsig
|
|||||||
|
|
||||||
bool SetDefineStreamProxy::MatchDirectives(const ParserLine& line) const
|
bool SetDefineStreamProxy::MatchDirectives(const ParserLine& line) const
|
||||||
{
|
{
|
||||||
unsigned directiveStartPos, directiveEndPos;
|
size_t directiveStartPos, directiveEndPos;
|
||||||
|
|
||||||
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
||||||
return false;
|
return false;
|
||||||
|
@ -22,7 +22,7 @@ namespace templating
|
|||||||
private:
|
private:
|
||||||
static constexpr const char* SET_DIRECTIVE = "set";
|
static constexpr const char* SET_DIRECTIVE = "set";
|
||||||
|
|
||||||
_NODISCARD bool MatchSetDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition) const;
|
_NODISCARD bool MatchSetDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition) const;
|
||||||
_NODISCARD bool MatchDirectives(const ParserLine& line) const;
|
_NODISCARD bool MatchDirectives(const ParserLine& line) const;
|
||||||
|
|
||||||
IParserLineStream* const m_stream;
|
IParserLineStream* const m_stream;
|
||||||
|
@ -18,7 +18,7 @@ void TemplatingStreamProxy::SetDefinesProxy(DefinesStreamProxy* definesProxy)
|
|||||||
m_defines_proxy = definesProxy;
|
m_defines_proxy = definesProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TemplatingStreamProxy::MatchSwitchDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition) const
|
bool TemplatingStreamProxy::MatchSwitchDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition) const
|
||||||
{
|
{
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
|
|
||||||
@ -43,7 +43,7 @@ bool TemplatingStreamProxy::MatchSwitchDirective(const ParserLine& line, const u
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TemplatingStreamProxy::MatchOptionsDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition) const
|
bool TemplatingStreamProxy::MatchOptionsDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition) const
|
||||||
{
|
{
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ bool TemplatingStreamProxy::MatchOptionsDirective(const ParserLine& line, const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TemplatingStreamProxy::MatchFilenameDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition) const
|
bool TemplatingStreamProxy::MatchFilenameDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition) const
|
||||||
{
|
{
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ bool TemplatingStreamProxy::MatchFilenameDirective(const ParserLine& line, const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TemplatingStreamProxy::MatchSkipDirective(const ParserLine& line, const unsigned directiveStartPosition, const unsigned directiveEndPosition) const
|
bool TemplatingStreamProxy::MatchSkipDirective(const ParserLine& line, const size_t directiveStartPosition, const size_t directiveEndPosition) const
|
||||||
{
|
{
|
||||||
auto currentPosition = directiveStartPosition;
|
auto currentPosition = directiveStartPosition;
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ bool TemplatingStreamProxy::MatchSkipDirective(const ParserLine& line, const uns
|
|||||||
|
|
||||||
bool TemplatingStreamProxy::MatchDirectives(const ParserLine& line) const
|
bool TemplatingStreamProxy::MatchDirectives(const ParserLine& line) const
|
||||||
{
|
{
|
||||||
unsigned directiveStartPos, directiveEndPos;
|
size_t directiveStartPos, directiveEndPos;
|
||||||
|
|
||||||
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
if (!FindDirective(line, directiveStartPos, directiveEndPos))
|
||||||
return false;
|
return false;
|
||||||
|
@ -43,10 +43,10 @@ namespace templating
|
|||||||
static constexpr const char* FILENAME_DIRECTIVE = "filename";
|
static constexpr const char* FILENAME_DIRECTIVE = "filename";
|
||||||
static constexpr const char* SKIP_DIRECTIVE = "skip";
|
static constexpr const char* SKIP_DIRECTIVE = "skip";
|
||||||
|
|
||||||
_NODISCARD bool MatchSwitchDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition) const;
|
_NODISCARD bool MatchSwitchDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition) const;
|
||||||
_NODISCARD bool MatchOptionsDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition) const;
|
_NODISCARD bool MatchOptionsDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition) const;
|
||||||
_NODISCARD bool MatchFilenameDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition) const;
|
_NODISCARD bool MatchFilenameDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition) const;
|
||||||
_NODISCARD bool MatchSkipDirective(const ParserLine& line, unsigned directiveStartPosition, unsigned directiveEndPosition) const;
|
_NODISCARD bool MatchSkipDirective(const ParserLine& line, size_t directiveStartPosition, size_t directiveEndPosition) const;
|
||||||
_NODISCARD bool MatchDirectives(const ParserLine& line) const;
|
_NODISCARD bool MatchDirectives(const ParserLine& line) const;
|
||||||
|
|
||||||
IParserLineStream* const m_stream;
|
IParserLineStream* const m_stream;
|
||||||
|
@ -22,7 +22,7 @@ uint8_t* AbstractSalsa20Processor::GetHashBlock(const int streamNumber) const
|
|||||||
void AbstractSalsa20Processor::InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) const
|
void AbstractSalsa20Processor::InitStreams(const std::string& zoneName, const uint8_t* salsa20Key, const size_t keySize) const
|
||||||
{
|
{
|
||||||
// Original buffer must have been 32 bytes because the zoneName can at most be 31 characters be long before being cut off
|
// Original buffer must have been 32 bytes because the zoneName can at most be 31 characters be long before being cut off
|
||||||
const auto zoneNameLength = std::min(zoneName.length(), 31u);
|
const auto zoneNameLength = std::min(zoneName.length(), 31uz);
|
||||||
|
|
||||||
const size_t blockHashBufferSize = BLOCK_HASHES_COUNT * m_stream_count * SHA1_HASH_SIZE;
|
const size_t blockHashBufferSize = BLOCK_HASHES_COUNT * m_stream_count * SHA1_HASH_SIZE;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ SearchPathOpenFile MockSearchPath::Open(const std::string& fileName)
|
|||||||
if (foundFileData == m_file_data_map.end())
|
if (foundFileData == m_file_data_map.end())
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
return {std::make_unique<std::istringstream>(foundFileData->second), foundFileData->second.size()};
|
return {std::make_unique<std::istringstream>(foundFileData->second), static_cast<int64_t>(foundFileData->second.size())};
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& MockSearchPath::GetPath()
|
const std::string& MockSearchPath::GetPath()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user