diff --git a/.github/workflows/stylecheck.yml b/.github/workflows/stylecheck.yml
index 8c28a678410..ffbb051bf6b 100644
--- a/.github/workflows/stylecheck.yml
+++ b/.github/workflows/stylecheck.yml
@@ -21,13 +21,13 @@ jobs:
- name: Fix spacing
run: |
# Fix mixed tabs and spaces
- find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'expand -t 4 "$0" | sponge "$0"' {} \;
+ find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'expand -t 4 "$0" | sponge "$0"' {} \;
# Fix trailing white spaces
- find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'sed -i '' -e "s/[[:space:]]*$//" "$0"' {} \;
+ find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'sed -i '' -e "s/[[:space:]]*$//" "$0"' {} \;
# Ensure files end with a new line
- find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'tail -c1 < "$0" | read -r _ || echo >> "$0"' {} \;
+ find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|cs\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'tail -c1 < "$0" | read -r _ || echo >> "$0"' {} \;
- name: Report result
run: |
@@ -52,10 +52,10 @@ jobs:
- name: Fix encoding
run: |
# Ensure that files are UTF-8 encoded
- find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'recode UTF-8 "$0" 2> /dev/null' {} \;
+ find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'recode UTF-8 "$0" 2> /dev/null' {} \;
# Ensure that files have LF line endings and do not contain a BOM
- find . \( -path ./Externals -o -path ./sdk -o -path ./src/utils/mp_gpprof_server/libraries -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'dos2unix "$0" 2> /dev/null' {} \;
+ find . \( -path ./Externals -o -path ./sdk -o -path ./res \) -prune -o -iregex '.*\.\(h\|hpp\|inl\|c\|cpp\|yaml\|yml\|md\|txt\|cmake\|sh\)' -type f -exec bash -c 'dos2unix "$0" 2> /dev/null' {} \;
- name: Report result
run: |
@@ -103,7 +103,6 @@ jobs:
git restore ./Externals
git restore ./res
git restore ./sdk
- git restore ./src/utils/mp_gpprof_server/libraries
- name: Report result
run: |
diff --git a/src/Common/Common.vcxproj b/src/Common/Common.vcxproj
index bfa5fe31330..217dde6bb77 100644
--- a/src/Common/Common.vcxproj
+++ b/src/Common/Common.vcxproj
@@ -55,16 +55,11 @@
-
-
-
-
-
@@ -80,9 +75,6 @@
-
-
-
diff --git a/src/Common/Common.vcxproj.filters b/src/Common/Common.vcxproj.filters
index 6269d792325..a0c0018659d 100644
--- a/src/Common/Common.vcxproj.filters
+++ b/src/Common/Common.vcxproj.filters
@@ -3,7 +3,6 @@
-
@@ -18,18 +17,6 @@
-
- NvMender2003
-
-
- NvMender2003
-
-
- NvMender2003
-
-
- NvMender2003
-
Platform
@@ -95,9 +82,6 @@
-
- {4a2b53ad-98a9-4338-99a6-b5ea4123d5bf}
-
{05b6dbf9-e387-495f-9d92-e2b8ecc350fa}
@@ -108,11 +92,6 @@
{d02f2a58-bd08-43dc-86cc-6edd8c1f08a5}
-
-
- NvMender2003
-
-
Platform
diff --git a/src/Common/NvMender2003/NVMeshMender.cpp b/src/Common/NvMender2003/NVMeshMender.cpp
deleted file mode 100644
index f147008ffe2..00000000000
--- a/src/Common/NvMender2003/NVMeshMender.cpp
+++ /dev/null
@@ -1,1038 +0,0 @@
-/*********************************************************************NVMH4****
-Path:
-File:
-
-Copyright NVIDIA Corporation 2003
-TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
-*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
-BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
-WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
-ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-
-Comments:
-
- Todo
- - Performance improvements, right now for each vertex I am building the list
- of it's neighbors, when we could do a single pass and build the full adjacency
- map in the beginning. Note: I tried this and didn't see a real perf improvement.
-
- - I'd like to provide a non c++ standard library interface, probably
- a simple c interface for all those simple c folks. or the
- old nvMeshMender interface for all those using it already
-
-*/
-
-#include "stdafx.h"
-#include "nvMeshMender.h"
-#include "assert.h"
-
-namespace
-{
-const unsigned int NO_GROUP = 0xFFFFFFFF;
-
-// IC: Replacement for D3DXVec3Normalize so that we don't have dll dependancies.
-static D3DXVECTOR3* Vec3Normalize(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV)
-{
- assert(pOut != NULL);
- assert(pV != NULL);
-
- float v = 1.0f / _sqrt(pV->x * pV->x + pV->y * pV->y + pV->z * pV->z);
- pOut->x *= v;
- pOut->y *= v;
- pOut->z *= v;
- return pOut;
-}
-};
-
-void MeshMender::Triangle::Reset()
-{
- handled = false;
- group = NO_GROUP;
-}
-
-class MeshMender::CanSmoothChecker
-{
-public:
- virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle) = 0;
-};
-
-class CanSmoothNormalsChecker : public MeshMender::CanSmoothChecker
-{
-public:
- virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle)
- {
- assert(t1 && t2);
- // for checking the angle, we want these to be normalized,
- // they may not be for whatever reason
- D3DXVECTOR3 tmp1 = t1->normal;
- D3DXVECTOR3 tmp2 = t2->normal;
- Vec3Normalize(&tmp1, &tmp1);
- Vec3Normalize(&tmp2, &tmp2);
-
- if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle)
- {
- return true;
- }
- else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0)))
- {
- // check for them both being null, then they are
- // welcome to smooth no matter what the minCreaseAngle is
- return true;
- }
- return false;
- }
-};
-
-class CanSmoothTangentsChecker : public MeshMender::CanSmoothChecker
-{
-public:
- virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle)
- {
- assert(t1 && t2);
- // for checking the angle, we want these to be normalized,
- // they may not be for whatever reason
- D3DXVECTOR3 tmp1 = t1->tangent;
- D3DXVECTOR3 tmp2 = t2->tangent;
- Vec3Normalize(&tmp1, &tmp1);
- Vec3Normalize(&tmp2, &tmp2);
-
- if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle)
- {
- return true;
- }
- else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0)))
- {
- // check for them both being null, then they are
- // welcome to smooth no matter what the minCreaseAngle is
- return true;
- }
- return false;
- }
-};
-
-class CanSmoothBinormalsChecker : public MeshMender::CanSmoothChecker
-{
-public:
- virtual bool CanSmooth(MeshMender::Triangle* t1, MeshMender::Triangle* t2, const float& minCreaseAngle)
- {
- assert(t1 && t2);
- // for checking the angle, we want these to be normalized,
- // they may not be for whatever reason
- D3DXVECTOR3 tmp1 = t1->binormal;
- D3DXVECTOR3 tmp2 = t2->binormal;
- Vec3Normalize(&tmp1, &tmp1);
- Vec3Normalize(&tmp2, &tmp2);
-
- if (D3DXVec3Dot(&tmp1, &tmp2) >= minCreaseAngle)
- return true;
- else if ((tmp1 == D3DXVECTOR3(0, 0, 0)) && (tmp2 == D3DXVECTOR3(0, 0, 0)))
- {
- // check for them both being null, then they are
- // welcome to smooth no matter what the minCreaseAngle is
- return true;
- }
- return false;
- }
-};
-
-bool operator<(const D3DXVECTOR3& lhs, const D3DXVECTOR3& rhs)
-{
- // needed to have a vertex in a map.
- // must be an absolute sort so that we can reliably find the exact
- // position again, not a fuzzy compare for equality based on an epsilon.
- if (lhs.x == rhs.x)
- {
- if (lhs.y == rhs.y)
- {
- if (lhs.z == rhs.z)
- {
- return false;
- }
- else
- {
- return (lhs.z < rhs.z);
- }
- }
- else
- {
- return (lhs.y < rhs.y);
- }
- }
- else
- {
- return (lhs.x < rhs.x);
- }
-}
-
-MeshMender::MeshMender()
-{
- MinNormalsCreaseCosAngle = 0.3f;
- MinTangentsCreaseCosAngle = 0.0f;
- MinBinormalsCreaseCosAngle = 0.0f;
- WeightNormalsByArea = 0.0f;
- m_RespectExistingSplits = DONT_RESPECT_SPLITS;
-}
-MeshMender::~MeshMender() {}
-void MeshMender::UpdateIndices(const size_t oldIndex, const size_t newIndex, TriangleList& curGroup)
-{
- // make any triangle that used the oldIndex use the newIndex instead
-
- for (size_t t = 0; t < curGroup.size(); ++t)
- {
- TriID tID = curGroup[t];
- for (size_t indx = 0; indx < 3; ++indx)
- {
- if (m_Triangles[tID].indices[indx] == oldIndex)
- {
- m_Triangles[tID].indices[indx] = newIndex;
- }
- }
- }
-}
-void MeshMender::ProcessNormals(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition)
-{
- NeighborGroupList neighborGroups; // a fresh group for each pass
-
- // reset each triangle to prepare for smoothing group building
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- m_Triangles[possibleNeighbors[i]].Reset();
- }
-
- // now start building groups
- CanSmoothNormalsChecker canSmoothNormalsChecker;
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]);
- assert(currTri);
- if (!currTri->handled)
- {
- BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothNormalsChecker,
- MinNormalsCreaseCosAngle);
- }
- }
-
- xr_vector groupNormalVectors;
-
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- // for each group, calculate the group normal
- TriangleList& curGroup = neighborGroups[i];
- D3DXVECTOR3 gnorm(0.0f, 0.0f, 0.0f);
-
- assert(curGroup.size() != 0 && "should not be a zero group here.");
- for (size_t t = 0; t < curGroup.size(); ++t) // for each triangle in the group,
- {
- TriID tID = curGroup[t];
- gnorm += m_Triangles[tID].normal;
- }
- Vec3Normalize(&gnorm, &gnorm);
- groupNormalVectors.push_back(gnorm);
- }
-
- // next step, ensure that triangles in different groups are not
- // sharing vertices. and give the shared vertex their new group vector
- xr_set otherGroupsIndices;
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- TriangleList& curGroup = neighborGroups[i];
- xr_set thisGroupIndices;
-
- for (size_t t = 0; t < curGroup.size(); ++t) // for each tri
- {
- TriID tID = curGroup[t];
- for (size_t indx = 0; indx < 3; ++indx) // for each vert in that tri
- {
- // if it is at the positions in question
- if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition)
- {
- // see if another group is already using this vert
- if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end())
- {
- // then we need to make a new vertex
- Vertex ov;
- ov = theVerts[m_Triangles[tID].indices[indx]];
- ov.normal = groupNormalVectors[i];
- size_t oldIndex = m_Triangles[tID].indices[indx];
- size_t newIndex = theVerts.size();
- theVerts.push_back(ov);
- AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert);
- UpdateIndices(oldIndex, newIndex, curGroup);
- }
- else
- {
- // otherwise, just update it with the new vector
- theVerts[m_Triangles[tID].indices[indx]].normal = groupNormalVectors[i];
- }
-
- // store that we have used this index, so other groups can check
- thisGroupIndices.insert(m_Triangles[tID].indices[indx]);
- }
- }
- }
-
- for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it)
- {
- otherGroupsIndices.insert(*it);
- }
- }
-}
-
-void MeshMender::ProcessTangents(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition)
-{
- NeighborGroupList neighborGroups; // a fresh group for each pass
-
- // reset each triangle to prepare for smoothing group building
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- m_Triangles[possibleNeighbors[i]].Reset();
- }
-
- // now start building groups
- CanSmoothTangentsChecker canSmoothTangentsChecker;
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]);
- assert(currTri);
- if (!currTri->handled)
- {
- BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothTangentsChecker,
- MinTangentsCreaseCosAngle);
- }
- }
-
- xr_vector groupTangentVectors;
-
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- D3DXVECTOR3 gtang(0, 0, 0);
- for (unsigned int t = 0; t < neighborGroups[i].size(); ++t) // for each triangle in the group,
- {
- TriID tID = neighborGroups[i][t];
- gtang += m_Triangles[tID].tangent;
- }
- Vec3Normalize(>ang, >ang);
- groupTangentVectors.push_back(gtang);
- }
-
- // next step, ensure that triangles in different groups are not
- // sharing vertices. and give the shared vertex their new group vector
- xr_set otherGroupsIndices;
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- TriangleList& curGroup = neighborGroups[i];
- xr_set thisGroupIndices;
-
- for (size_t t = 0; t < curGroup.size(); ++t) // for each tri
- {
- TriID tID = curGroup[t];
- for (size_t indx = 0; indx < 3; indx++) // for each vert in that tri
- {
- // if it is at the positions in question
- if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition)
- {
- // see if another group is already using this vert
- if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end())
- {
- // then we need to make a new vertex
- Vertex ov;
- ov = theVerts[m_Triangles[tID].indices[indx]];
- ov.tangent = groupTangentVectors[i];
- size_t oldIndex = m_Triangles[tID].indices[indx];
- size_t newIndex = theVerts.size();
- theVerts.push_back(ov);
- AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert);
- UpdateIndices(oldIndex, newIndex, curGroup);
- }
- else
- {
- // otherwise, just update it with the new vector
- theVerts[m_Triangles[tID].indices[indx]].tangent = groupTangentVectors[i];
- }
-
- // store that we have used this index, so other groups can check
- thisGroupIndices.insert(m_Triangles[tID].indices[indx]);
- }
- }
- }
-
- for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it)
- {
- otherGroupsIndices.insert(*it);
- }
- }
-}
-
-void MeshMender::ProcessBinormals(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition)
-{
- NeighborGroupList neighborGroups; // a fresh group for each pass
-
- // reset each triangle to prepare for smoothing group building
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- m_Triangles[possibleNeighbors[i]].Reset();
- }
-
- // now start building groups
- CanSmoothBinormalsChecker canSmoothBinormalsChecker;
- for (u32 i = 0; i < possibleNeighbors.size(); ++i)
- {
- Triangle* currTri = &(m_Triangles[possibleNeighbors[i]]);
- assert(currTri);
- if (!currTri->handled)
- {
- BuildGroups(currTri, possibleNeighbors, neighborGroups, theVerts, &canSmoothBinormalsChecker,
- MinBinormalsCreaseCosAngle);
- }
- }
-
- xr_vector groupBinormalVectors;
-
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- D3DXVECTOR3 gbinormal(0, 0, 0);
- for (unsigned int t = 0; t < neighborGroups[i].size(); ++t) // for each triangle in the group,
- {
- TriID tID = neighborGroups[i][t];
- gbinormal += m_Triangles[tID].binormal;
- }
- Vec3Normalize(&gbinormal, &gbinormal);
- groupBinormalVectors.push_back(gbinormal);
- }
-
- // next step, ensure that triangles in different groups are not
- // sharing vertices. and give the shared vertex their new group vector
- xr_set otherGroupsIndices;
- for (u32 i = 0; i < neighborGroups.size(); ++i)
- {
- TriangleList& curGroup = neighborGroups[i];
- xr_set thisGroupIndices;
-
- for (size_t t = 0; t < curGroup.size(); ++t) // for each tri
- {
- TriID tID = curGroup[t];
- for (size_t indx = 0; indx < 3; ++indx) // for each vert in that tri
- {
- // if it is at the positions in question
- if (theVerts[m_Triangles[tID].indices[indx]].pos == workingPosition)
- {
- // see if another group is already using this vert
- if (otherGroupsIndices.find(m_Triangles[tID].indices[indx]) != otherGroupsIndices.end())
- {
- // then we need to make a new vertex
- Vertex ov;
- ov = theVerts[m_Triangles[tID].indices[indx]];
- ov.binormal = groupBinormalVectors[i];
- size_t oldIndex = m_Triangles[tID].indices[indx];
- size_t newIndex = theVerts.size();
- theVerts.push_back(ov);
- AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert);
- UpdateIndices(oldIndex, newIndex, curGroup);
- }
- else
- {
- // otherwise, just update it with the new vector
- theVerts[m_Triangles[tID].indices[indx]].binormal = groupBinormalVectors[i];
- }
-
- // store that we have used this index, so other groups can check
- thisGroupIndices.insert(m_Triangles[tID].indices[indx]);
- }
- }
- }
-
- for (xr_set::iterator it = thisGroupIndices.begin(); it != thisGroupIndices.end(); ++it)
- {
- otherGroupsIndices.insert(*it);
- }
- }
-}
-
-bool MeshMender::Mend(xr_vector& theVerts, xr_vector& theIndices,
- xr_vector& mappingNewToOldVert, const float minNormalsCreaseCosAngle,
- const float minTangentsCreaseCosAngle, const float minBinormalsCreaseCosAngle, const float weightNormalsByArea,
- const NormalCalcOption computeNormals, const ExistingSplitOption respectExistingSplits,
- const CylindricalFixOption fixCylindricalWrapping)
-{
- MinNormalsCreaseCosAngle = minNormalsCreaseCosAngle;
- MinTangentsCreaseCosAngle = minTangentsCreaseCosAngle;
- MinBinormalsCreaseCosAngle = minBinormalsCreaseCosAngle;
- WeightNormalsByArea = weightNormalsByArea;
- m_RespectExistingSplits = respectExistingSplits;
-
- // fix cylindrical should happen before we do any other calculations
- if (fixCylindricalWrapping == FIX_CYLINDRICAL)
- {
- FixCylindricalWrapping(theVerts, theIndices, mappingNewToOldVert);
- }
-
- SetUpData(theVerts, theIndices, mappingNewToOldVert, computeNormals);
-
- // for each unique position
- for (VertexChildrenMap::iterator vert = m_VertexChildrenMap.begin(); vert != m_VertexChildrenMap.end(); ++vert)
- {
- D3DXVECTOR3 workingPosition = vert->first;
-
- TriangleList& possibleNeighbors = vert->second;
- if (computeNormals == CALCULATE_NORMALS)
- {
- ProcessNormals(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition);
- }
- ProcessTangents(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition);
- ProcessBinormals(possibleNeighbors, theVerts, mappingNewToOldVert, workingPosition);
- }
-
- UpdateTheIndicesWithFinalIndices(theIndices);
- OrthogonalizeTangentsAndBinormals(theVerts);
-
- return true;
-}
-
-void MeshMender::BuildGroups(Triangle* tri, // the tri of interest
- TriangleList& possibleNeighbors, // all tris arround a vertex
- NeighborGroupList& neighborGroups, // the neighbor groups to be updated
- xr_vector& theVerts, CanSmoothChecker* smoothChecker, const float& minCreaseAngle)
-{
- if ((!tri) || (tri->handled))
- return;
-
- Triangle* neighbor1 = NULL;
- Triangle* neighbor2 = NULL;
-
- FindNeighbors(tri, possibleNeighbors, &neighbor1, &neighbor2, theVerts);
-
- // see if I can join my first neighbors group
- if (neighbor1 && (neighbor1->group != NO_GROUP))
- {
- if (smoothChecker->CanSmooth(tri, neighbor1, minCreaseAngle))
- {
- neighborGroups[neighbor1->group].push_back(tri->myID);
- tri->group = neighbor1->group;
- }
- }
-
- // see if I can join my second neighbors group
- if (neighbor2 && (neighbor2->group != NO_GROUP))
- {
- if (smoothChecker->CanSmooth(tri, neighbor2, minCreaseAngle))
- {
- neighborGroups[neighbor2->group].push_back(tri->myID);
- tri->group = neighbor2->group;
- }
- }
- // I either couldn't join, or they weren't in a group, so I think I'll
- // just go and start my own group...right here we go.
- if (tri->group == NO_GROUP)
- {
- tri->group = neighborGroups.size();
- neighborGroups.push_back(TriangleList());
- neighborGroups.back().push_back(tri->myID);
- }
- assert((tri->group != NO_GROUP) && "error!: tri should have a group set");
- tri->handled = true;
-
- // continue growing our group with each neighbor.
- BuildGroups(neighbor1, possibleNeighbors, neighborGroups, theVerts, smoothChecker, minCreaseAngle);
- BuildGroups(neighbor2, possibleNeighbors, neighborGroups, theVerts, smoothChecker, minCreaseAngle);
-}
-
-void MeshMender::FindNeighbors(Triangle* tri, TriangleList& possibleNeighbors, Triangle** neighbor1,
- Triangle** neighbor2, xr_vector& theVerts)
-{
- *neighbor1 = NULL;
- *neighbor2 = NULL;
-
- xr_vector theNeighbors;
- for (unsigned int n = 0; n < possibleNeighbors.size(); ++n)
- {
- TriID tID = possibleNeighbors[n];
- Triangle* possible = &(m_Triangles[tID]);
- if (possible != tri) // check for myself
- {
- if (SharesEdge(tri, possible, theVerts))
- {
- theNeighbors.push_back(possible);
- }
- }
- }
-
- if (theNeighbors.size() > 0)
- *neighbor1 = theNeighbors[0];
- if (theNeighbors.size() > 1)
- *neighbor2 = theNeighbors[1];
-}
-
-bool MeshMender::TriHasEdge(
- const size_t& p0, const size_t& p1, const size_t& triA, const size_t& triB, const size_t& triC)
-{
- if (((p0 == triB) && (p1 == triA)) || ((p0 == triA) && (p1 == triB)))
- {
- return true;
- }
-
- if (((p0 == triB) && (p1 == triC)) || ((p0 == triC) && (p1 == triB)))
- {
- return true;
- }
-
- if (((p0 == triC) && (p1 == triA)) || ((p0 == triA) && (p1 == triC)))
- {
- return true;
- }
- return false;
-}
-
-bool MeshMender::TriHasEdge(const D3DXVECTOR3& p0, const D3DXVECTOR3& p1, const D3DXVECTOR3& triA,
- const D3DXVECTOR3& triB, const D3DXVECTOR3& triC)
-{
- if (((p0 == triB) && (p1 == triA)) || ((p0 == triA) && (p1 == triB)))
- {
- return true;
- }
-
- if (((p0 == triB) && (p1 == triC)) || ((p0 == triC) && (p1 == triB)))
- {
- return true;
- }
-
- if (((p0 == triC) && (p1 == triA)) || ((p0 == triA) && (p1 == triC)))
- {
- return true;
- }
- return false;
-}
-
-bool MeshMender::SharesEdgeRespectSplits(Triangle* triA, Triangle* triB, xr_vector& theVerts)
-{
- assert(triA && triB && "invalid data passed to SharesEdgeNoSplit");
- // here we want to compare based solely on indices.
-
- size_t a1 = triA->indices[0];
- size_t b1 = triA->indices[1];
- size_t c1 = triA->indices[2];
-
- size_t a2 = triB->indices[0];
- size_t b2 = triB->indices[1];
- size_t c2 = triB->indices[2];
-
- // edge B1->A1
- if (TriHasEdge(b1, a1, a2, b2, c2))
- return true;
-
- // edge A1->C1
- if (TriHasEdge(a1, c1, a2, b2, c2))
- return true;
-
- // edge C1->B1
- if (TriHasEdge(c1, b1, a2, b2, c2))
- return true;
-
- return false;
-}
-
-bool MeshMender::SharesEdge(Triangle* triA, Triangle* triB, xr_vector& theVerts)
-{
- assert(triA && triB && "invalid data passed to SharesEdge");
-
- // check based on position not on indices, because there may be splits
- // we don't care about. unless the user has told us they care about those
- // splits
- if (m_RespectExistingSplits == RESPECT_SPLITS)
- {
- return SharesEdgeRespectSplits(triA, triB, theVerts);
- }
-
- D3DXVECTOR3 a1 = theVerts[triA->indices[0]].pos;
- D3DXVECTOR3 b1 = theVerts[triA->indices[1]].pos;
- D3DXVECTOR3 c1 = theVerts[triA->indices[2]].pos;
-
- D3DXVECTOR3 a2 = theVerts[triB->indices[0]].pos;
- D3DXVECTOR3 b2 = theVerts[triB->indices[1]].pos;
- D3DXVECTOR3 c2 = theVerts[triB->indices[2]].pos;
-
- // edge B1->A1
- if (TriHasEdge(b1, a1, a2, b2, c2))
- return true;
-
- // edge A1->C1
- if (TriHasEdge(a1, c1, a2, b2, c2))
- return true;
-
- // edge C1->B1
- if (TriHasEdge(c1, b1, a2, b2, c2))
- return true;
-
- return false;
-}
-
-void MeshMender::SetUpData(xr_vector& theVerts, const xr_vector& theIndices,
- xr_vector& mappingNewToOldVert, const NormalCalcOption computeNormals)
-{
- assert(((theIndices.size() % 3) == 0) && "expected the indices to be a multiple of 3");
- unsigned int i;
-
- // initialize the mapping
- for (i = 0; i < theVerts.size(); ++i)
- mappingNewToOldVert.push_back(i);
-
- m_originalNumVerts = theVerts.size();
-
- // set up our triangles
- for (i = 0; i < theIndices.size(); i += 3)
- {
- Triangle t;
-
- t.indices[0] = theIndices[i + 0];
- t.indices[1] = theIndices[i + 1];
- t.indices[2] = theIndices[i + 2];
-
- // set up bin, norm, and tan
- SetUpFaceVectors(t, theVerts, computeNormals);
-
- t.myID = m_Triangles.size(); // set id, to my index into m_Triangles
- m_Triangles.push_back(t);
- }
-
- // build vertex position/traingle pairings.
- // we use the position and not the actual vertex, because there may
- // be multiple coppies of the same vertex for textureing
- // but we don't want that to
- // effect our decisions about normal smoothing.
- // note: maybe this should be an option, the position thing.
- for (i = 0; i < m_Triangles.size(); ++i)
- {
- for (size_t indx = 0; indx < 3; ++indx)
- {
- D3DXVECTOR3 v = theVerts[m_Triangles[i].indices[indx]].pos;
- VertexChildrenMap::iterator iter = m_VertexChildrenMap.find(v);
- if (iter != m_VertexChildrenMap.end())
- {
- // we found it, so just add ourselves to it.
- iter->second.push_back(TriID(i));
- }
- else
- {
- // we didn't find it so join whatever was there.
- xr_vector tmp;
- m_VertexChildrenMap[v] = tmp;
- m_VertexChildrenMap[v].push_back(TriID(i));
- }
- }
- }
-}
-
-// sets up the normal, binormal, and tangent for a triangle
-// assumes the triangle indices are set to match whats in the verts
-void MeshMender::SetUpFaceVectors(Triangle& t, const xr_vector& verts, const NormalCalcOption computeNormals)
-{
- if (computeNormals == CALCULATE_NORMALS)
- {
- D3DXVECTOR3 edge0 = verts[t.indices[1]].pos - verts[t.indices[0]].pos;
- D3DXVECTOR3 edge1 = verts[t.indices[2]].pos - verts[t.indices[0]].pos;
-
- D3DXVec3Cross(&t.normal, &edge0, &edge1);
-
- if (WeightNormalsByArea < 1.0f)
- {
- D3DXVECTOR3 normalizedNorm;
- Vec3Normalize(&normalizedNorm, &t.normal);
- D3DXVECTOR3 finalNorm = (normalizedNorm * (1.0f - WeightNormalsByArea)) + (t.normal * WeightNormalsByArea);
- t.normal = finalNorm;
- }
- }
- // need to set up tangents, and binormals here
- GetGradients(verts[t.indices[0]], verts[t.indices[1]], verts[t.indices[2]], t.tangent, t.binormal);
-}
-
-void MeshMender::OrthogonalizeTangentsAndBinormals(xr_vector& theVerts)
-{
- // put our tangents and binormals through the final orthogonalization
- // with the final processed normals
- size_t len = theVerts.size();
- for (size_t i = 0; i < len; ++i)
- {
- assert(D3DXVec3Length(&(theVerts[i].normal)) > 0.00001f &&
- "found zero length normal when calculating tangent basis!,\
- if you are not using mesh mender to compute normals, you\
- must still pass in valid normals to be used when calculating\
- tangents and binormals.");
-
- // now with T and B and N we can get from tangent space to object space
- // but we want to go the other way, so we need the inverse
- // of the T, B,N matrix
- // we can use the Gram-Schmidt algorithm to find the newTangent and the newBinormal
- // newT = T - (N dot T)N
- // newB = B - (N dot B)N - (newT dot B)newT
-
- // NOTE: this should maybe happen with the final smoothed N, T, and B
- // will try it here and see what the results look like
-
- D3DXVECTOR3 tmpTan = theVerts[i].tangent;
- D3DXVECTOR3 tmpNorm = theVerts[i].normal;
- D3DXVECTOR3 tmpBin = theVerts[i].binormal;
-
- D3DXVECTOR3 newT = tmpTan - (D3DXVec3Dot(&tmpNorm, &tmpTan) * tmpNorm);
- D3DXVECTOR3 newB = tmpBin - (D3DXVec3Dot(&tmpNorm, &tmpBin) * tmpNorm) - (D3DXVec3Dot(&newT, &tmpBin) * newT);
-
- Vec3Normalize(&(theVerts[i].tangent), &newT);
- Vec3Normalize(&(theVerts[i].binormal), &newB);
-
- // this is where we can do a final check for zero length vectors
- // and set them to something appropriate
- float lenTan = D3DXVec3Length(&(theVerts[i].tangent));
- float lenBin = D3DXVec3Length(&(theVerts[i].binormal));
-
- if ((lenTan <= 0.001f) || (lenBin <= 0.001f)) // should be approx 1.0f
- {
- // the tangent space is ill defined at this vertex
- // so we can generate a valid one based on the normal vector,
- // which I'm assuming is valid!
-
- if (lenTan > 0.5f)
- {
- // the tangent is valid, so we can just use that
- // to calculate the binormal
- D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent));
- }
- else if (lenBin > 0.5)
- {
- // the binormal is good and we can use it to calculate
- // the tangent
- D3DXVec3Cross(&(theVerts[i].tangent), &(theVerts[i].binormal), &(theVerts[i].normal));
- }
- else
- {
- // both vectors are invalid, so we should create something
- // that is at least valid if not correct
- D3DXVECTOR3 xAxis(1.0f, 0.0f, 0.0f);
- D3DXVECTOR3 yAxis(0.0f, 1.0f, 0.0f);
- // I'm checking two possible axis, because the normal could be one of them,
- // and we want to chose a different one to start making our valid basis.
- // I can find out which is further away from it by checking the dot product
- D3DXVECTOR3 startAxis;
-
- if (D3DXVec3Dot(&xAxis, &(theVerts[i].normal)) < D3DXVec3Dot(&yAxis, &(theVerts[i].normal)))
- {
- // the xAxis is more different than the yAxis when compared to the normal
- startAxis = xAxis;
- }
- else
- {
- // the yAxis is more different than the xAxis when compared to the normal
- startAxis = yAxis;
- }
-
- D3DXVec3Cross(&(theVerts[i].tangent), &(theVerts[i].normal), &startAxis);
- D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent));
- }
- }
- else
- {
- // one final sanity check, make sure that they tangent and binormal are different enough
- if (D3DXVec3Dot(&(theVerts[i].binormal), &(theVerts[i].tangent)) > 0.999f)
- {
- // then they are too similar lets make them more different
- D3DXVec3Cross(&(theVerts[i].binormal), &(theVerts[i].normal), &(theVerts[i].tangent));
- }
- }
- }
-}
-
-void MeshMender::GetGradients(const MeshMender::Vertex& v0, const MeshMender::Vertex& v1, const MeshMender::Vertex& v2,
- D3DXVECTOR3& tangent, D3DXVECTOR3& binormal) const
-{
- // using Eric Lengyel's approach with a few modifications
- // from Mathematics for 3D Game Programmming and Computer Graphics
- // want to be able to trasform a vector in Object Space to Tangent Space
- // such that the x-axis cooresponds to the 's' direction and the
- // y-axis corresponds to the 't' direction, and the z-axis corresponds
- // to <0,0,1>, straight up out of the texture map
-
- // let P = v1 - v0
- D3DXVECTOR3 P = v1.pos - v0.pos;
- // let Q = v2 - v0
- D3DXVECTOR3 Q = v2.pos - v0.pos;
- float s1 = v1.s - v0.s;
- float t1 = v1.t - v0.t;
- float s2 = v2.s - v0.s;
- float t2 = v2.t - v0.t;
-
- // we need to solve the equation
- // P = s1*T + t1*B
- // Q = s2*T + t2*B
- // for T and B
-
- // this is a linear system with six unknowns and six equatinos, for TxTyTz BxByBz
- //[px,py,pz] = [s1,t1] * [Tx,Ty,Tz]
- // qx,qy,qz s2,t2 Bx,By,Bz
-
- // multiplying both sides by the inverse of the s,t matrix gives
- //[Tx,Ty,Tz] = 1/(s1t2-s2t1) * [t2,-t1] * [px,py,pz]
- // Bx,By,Bz -s2,s1 qx,qy,qz
-
- // solve this for the unormalized T and B to get from tangent to object space
-
- float tmp = 0.0f;
- if (_abs(s1 * t2 - s2 * t1) <= 0.0001f)
- {
- tmp = (s1 * t2 - s2 * t1) > 0.f ? 1.0f : -1.f;
- }
- else
- {
- tmp = 1.0f / (s1 * t2 - s2 * t1);
- }
-
- tangent.x = (t2 * P.x - t1 * Q.x);
- tangent.y = (t2 * P.y - t1 * Q.y);
- tangent.z = (t2 * P.z - t1 * Q.z);
-
- tangent = tmp * tangent;
-
- binormal.x = (s1 * Q.x - s2 * P.x);
- binormal.y = (s1 * Q.y - s2 * P.y);
- binormal.z = (s1 * Q.z - s2 * P.z);
-
- binormal = tmp * binormal;
-
- // after these vectors are smoothed together,
- // they must be again orthogonalized with the final normals
- // see OrthogonalizeTangentsAndBinormals
-}
-
-void MeshMender::UpdateTheIndicesWithFinalIndices(xr_vector& theIndices)
-{
- // theIndices is assumed to be filled with a copy of the in Indices.
-
- assert(((theIndices.size() / 3) == m_Triangles.size()) && "invalid number of tris, or indices.");
- // Note that we do not change the number or the order of indices at all,
- // so we just need to copy the triangles indices to the output.
- size_t oIndex = 0;
-
- for (size_t i = 0; i < m_Triangles.size(); ++i)
- {
- theIndices[oIndex + 0] = (u32)m_Triangles[i].indices[0];
- theIndices[oIndex + 1] = (u32)m_Triangles[i].indices[1];
- theIndices[oIndex + 2] = (u32)m_Triangles[i].indices[2];
- oIndex += 3;
- }
-}
-
-void MeshMender::FixCylindricalWrapping(
- xr_vector& theVerts, xr_vector& theIndices, xr_vector& mappingNewToOldVert)
-{
- // when using cylindrical texture coordinate generation,
- // you can end up with triangles that have coordinates like
- // <0,0.9> -------------> <0,0>
- // and
- // <0,0.9> -------------> <0,0.1>
- // this will cause the texture to be mapped from 0.9 back to 0.0 or 0.1 when
- // what you really want it to do is
- // wrap arround to 1.0, then start from 0.0 again.
- // to fix this, we can duplicate a vertex and add 1.0 to the wrapped texture coordinate
- // we need to do this for both the S and the T directions.
-
- size_t index;
- for (index = 0; index < theIndices.size(); index += 3)
- {
- // for each triangle
- xr_set alreadyDuped;
-
- for (unsigned int begin = 0; begin < 3; ++begin)
- {
- unsigned int end = begin + 1;
- if (begin == 2)
- end = 0;
- // for each begin -> end edge
-
- float sBegin = theVerts[theIndices[index + begin]].s;
- float sEnd = theVerts[theIndices[index + end]].s;
-
- if (sBegin <= 1.0f && sEnd <= 1.0f && sBegin >= 0.0f && sEnd >= 0.0f)
- {
- // we only handle coordinates between 0 and 1 for the cylindrical wrappign fix
- if (_abs(sBegin - sEnd) > 0.5f)
- {
- unsigned int theOneToDupe = begin;
- // we have some wrapping going on.
- if (sBegin > sEnd)
- theOneToDupe = end;
-
- if (alreadyDuped.find(theOneToDupe) == alreadyDuped.end())
- {
- size_t oldIndex = theIndices[index + theOneToDupe];
- Vertex theDupe = theVerts[oldIndex];
- alreadyDuped.insert(theOneToDupe);
- theDupe.s += 1.0f;
- theIndices[index + theOneToDupe] = theVerts.size();
- theVerts.push_back(theDupe);
- AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert);
- }
- else
- {
- theVerts[theIndices[index + theOneToDupe]].s += 1.0f;
- }
- }
- }
-
- float tBegin = theVerts[theIndices[index + begin]].t;
- float tEnd = theVerts[theIndices[index + end]].t;
-
- if (tBegin <= 1.0f && tEnd <= 1.0f && tBegin >= 0.0f && tEnd >= 0.0f)
- {
- // we only handle coordinates between 0 and 1 for the cylindrical wrappign fix
- if (_abs(tBegin - tEnd) > 0.5f)
- {
- unsigned int theOneToDupe = begin;
- // we have some wrapping going on.
- if (tBegin > tEnd)
- theOneToDupe = end;
-
- if (alreadyDuped.find(theOneToDupe) == alreadyDuped.end())
- {
- size_t oldIndex = theIndices[index + theOneToDupe];
- Vertex theDupe = theVerts[oldIndex];
- alreadyDuped.insert(theOneToDupe);
- theDupe.t += 1.0f;
- theIndices[index + theOneToDupe] = theVerts.size();
- theVerts.push_back(theDupe);
- AppendToMapping(oldIndex, m_originalNumVerts, mappingNewToOldVert);
- }
- else
- {
- theVerts[theIndices[index + theOneToDupe]].t += 1.0f;
- }
- }
- }
- }
- }
-}
-
-void MeshMender::AppendToMapping(
- const size_t oldIndex, const size_t originalNumVerts, xr_vector& mappingNewToOldVert)
-{
- if (oldIndex >= originalNumVerts)
- {
- // then this is a newer vertex we are mapping to another vertex we created in meshmender.
- // we need to find the original old vertex index to map to.
- // so we can just use the mapping
-
- // that is to say, just keep the same mapping for this new one.
- unsigned int originalVertIndex = mappingNewToOldVert[oldIndex];
- assert(originalVertIndex < originalNumVerts);
-
- mappingNewToOldVert.push_back(originalVertIndex);
- }
- else
- {
- // this is mapping to an original vertex
- mappingNewToOldVert.push_back(oldIndex);
- }
-}
diff --git a/src/Common/NvMender2003/NVMeshMender.h b/src/Common/NvMender2003/NVMeshMender.h
deleted file mode 100644
index 90af5babd1e..00000000000
--- a/src/Common/NvMender2003/NVMeshMender.h
+++ /dev/null
@@ -1,321 +0,0 @@
-/*********************************************************************NVMH4****
-Path:
-File:
-
-Copyright NVIDIA Corporation 2003
-TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
-*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY
-AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS
-BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES
-WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
-BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS)
-ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS
-BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-
-Comments:
- send questions or comments to sdietrich@nvidia.com, cbrewer@nvidia.com
-
- MeshMender's main purpose is to generate a tangent space basis for
- per pixel lighting. Given a set of vertices and normal map texture coordinates,
- MeshMender will return a set of normals, binormals, and tangents taking into
- account texture mirroring.
-
- Meshmender also lets you choose a minimum angle between neighboring
- triangles vectors to determine whether or not they can smooth together.
- If they can't smooth together, then MeshMender automagically mends the mesh
- so that each unsmoothable neighbor has it's own set of vectors in a unique vertex.
-
-
-
-How to use MeshMender:
- assumes that you have an array of vertices in myVerts and an array
- of indices in myIndices.
- the verts should be of the format
- float x, float y, float z,
- float s,
- float t
-
-------------------------
-
-
- std::vector theVerts;
- std::vector theIndices;
- std::vector mappingNewToOld;
-
- //fill up the vectors with your mesh's data
- for (DWORD i = 0; i < numVerts; ++i)
- {
- MeshMender::Vertex v;
- v.pos = myVerts[i].pos;
- v.s = myVerts[i].s;
- v.t = myVerts[i].t;
- //meshmender will computer normals, tangents, and binormals, no need to fill those in.
- //however, if you do not have meshmender compute the normals, you _must_ pass in valid
- //normals to meshmender
- theVerts.push_back(v);
- }
-
- for(DWORD ind = 0; ind
-
-class MeshMender
-{
-public:
- class Vertex
- {
- public:
- D3DXVECTOR3 pos;
- D3DXVECTOR3 normal;
- float s;
- float t;
- D3DXVECTOR3 tangent;
- D3DXVECTOR3 binormal;
- enum
- {
- FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE2(0) | D3DFVF_TEXCOORDSIZE3(1) |
- D3DFVF_TEXCOORDSIZE3(2)
- };
- Vertex() :
- pos(0.0f, 0.0f, 0.0f), normal(0.0f, 0.0f, 0.0f), s(0.0f), t(0.0f),
- tangent(0.0f, 0.0f, 0.0f), binormal(0.0f, 0.0f, 0.0f)
- {}
- };
-
- enum NormalCalcOption
- {
- DONT_CALCULATE_NORMALS,
- CALCULATE_NORMALS
- };
- enum ExistingSplitOption
- {
- DONT_RESPECT_SPLITS,
- RESPECT_SPLITS
- };
- enum CylindricalFixOption
- {
- DONT_FIX_CYLINDRICAL,
- FIX_CYLINDRICAL
- };
-
- // Mend - given a mesh, output the new data complete with smoothed
- // normals, binormals, and tangents
- //
- // RETURNS true on success, false on failure
- //
- // theVerts - should be initialized with your mesh data, NOTE that when
- // mesh mender is done with it, the number of vertices may grow
- // and it will be filled with normals, tangents and binormals
- //
- // theIndices - should be initialized with your mesh indices
- // will contain the new indices..we are not adding triangles,
- // so the number of indices passed back should be the same as the
- // number of indices passed in, but they may point to new vertices now.
- //
- // mappingNewToOldVert - this should be passed in as an empty vector. after mending
- // it will contain a mapping of newvertexindex -> oldvertexindex
- // so it could be used to map any per vertex data you had in your original
- // mesh to the new mesh like so:
- //
- // for each new vertex index
- // newVert[index]->myData = oldVert[ mappingNewToOldVert[index]]->myData;
- //
- // where myData is some custom vertex data in your original mesh.
- //
- // minNormalsCreaseCosAngle - the minimum cosine of the angle between normals
- // so that they are allowed to be smoothed together
- // ranges between -1.0 and +1.0
- // this is ignored if computeNormals is set to DONT_CALCULATE_NORMALS
- //
- //
- // minTangentsCreaseCosAngle - the minimum cosine of the angle between tangents
- // so that they are allowed to be smoothed together
- // ranges between -1.0 and +1.0
- //
- // minBinormalsCreaseCosAngle - the minimum cosine of the angle between binormals
- // so that they are allowed to be smoothed together
- // ranges between -1.0 and +1.0
- //
- // weightNormalsByArea - an ammount to blend the normalized face normal, and the
- // unnormalized face normal together. Thus weighting the
- // normal by the face area by a given ammount
- // ranges between 0.0 and +1.0
- // 0.0 means use the normalized face normals (not weighted by area)
- // 1.0 means use the unnormalized face normal(weighted by area)
- // this is ignored if computeNormals is set to DONT_CALCULATE_NORMALS
- //
- // computeNormals - should mesh mender calculate normals? If this is set to DONT_CALCULATE_NORMALS
- // then the vertex normals after mesh mender is called will be the
- // same ones you pass in. If you are automatically calculating normals yourself,
- // you may find that meshmender provides greater control over how normals are smoothed
- // together. I've been able to get better results using the Crease angle with
- // meshmender's smoothing groups
- //
- // respectExistingSplits - DONT_RESPECT_SPLITS means that neighboring triangles for smoothing will be determined
- // based on position and not on indices.
- // RESPECT_SPLITS means that neighboring triangles will be determined based on the indices of
- //the
- // triangle and not the positions of the vertices.
- // you can usually get better smoothing by not respecting existing splits
- // only respect them if you know they should be respected.
- //
- // fixCylindricalWrapping - DONT_FIX_CYLINDRICAL means take the texture coordinates as they come
- // FIX_CYLINDRICAL means we might need to split the verts
- // at that point and generate the proper texture coordinate.
- // for instance, if we have tex coords 0.9 -> 0.0-> 0.2 we would need to add
- // a new vert so that we have 0.9 -> 1.0 0.0-> 0.2
- // this is only supported for texture coordinates in the range [ 0.0f , 1.0f ]
- // NOTE: don't leave this on for all meshes, only use it when you know
- // you need it. If you have polygons that map to a large area in texture space
- // this option could mess up the texture coordinates
- bool Mend(xr_vector& theVerts, xr_vector& theIndices,
- xr_vector& mappingNewToOldVert, const float minNormalsCreaseCosAngle = 0.0f,
- const float minTangentsCreaseCosAngle = 0.0f, const float minBinormalsCreaseCosAngle = 0.0f,
- const float weightNormalsByArea = 1.0f, const NormalCalcOption computeNormals = CALCULATE_NORMALS,
- const ExistingSplitOption respectExistingSplits = DONT_RESPECT_SPLITS,
- const CylindricalFixOption fixCylindricalWrapping = DONT_FIX_CYLINDRICAL);
-
- MeshMender();
-
- ~MeshMender();
-
-protected:
- float MinNormalsCreaseCosAngle;
- float MinTangentsCreaseCosAngle;
- float MinBinormalsCreaseCosAngle;
- float WeightNormalsByArea;
- ExistingSplitOption m_RespectExistingSplits;
-
- class CanSmoothChecker;
- friend class CanSmoothChecker;
- friend class CanSmoothNormalsChecker;
- friend class CanSmoothTangentsChecker;
- friend class CanSmoothBinormalsChecker;
-
- // sets up any internal data structures needed
- void SetUpData(xr_vector& theVerts, const xr_vector& theIndices,
- xr_vector& mappingNewToOldVert, const NormalCalcOption computeNormals);
-
- typedef size_t NeighborhoodID;
- typedef size_t TriID;
- typedef xr_vector TriangleList;
-
- struct Triangle
- {
- size_t indices[3];
-
- // per face values
- D3DXVECTOR3 normal;
- D3DXVECTOR3 tangent;
- D3DXVECTOR3 binormal;
-
- // helper flags
- bool handled;
- NeighborhoodID group;
- void Reset();
-
- TriID myID; // a global id used to keep track of tris'
- };
-
- xr_vector m_Triangles;
-
- // each vertex has a set of triangles that contain it.
- // those triangles are considered to be that vertex's children
- typedef xr_map VertexChildrenMap;
- VertexChildrenMap m_VertexChildrenMap;
-
- // a neighbor group is defined to be the list of traingles
- // that all fall arround a single vertex, and can smooth with
- // eachother
- typedef xr_vector NeighborGroupList;
-
- size_t m_originalNumVerts;
-
- // sets up the normal, binormal, and tangent for a triangle
- // assumes the triangle indices are set to match whats in the verts
- void SetUpFaceVectors(Triangle& t, const xr_vector& verts, const NormalCalcOption computeNormals);
-
- // function responsible for growing the neighbor hood groups
- // arround a vertex
- void BuildGroups(Triangle* tri, // the tri of interest
- TriangleList& possibleNeighbors, // all tris arround a vertex
- NeighborGroupList& neighborGroups, // the neighbor groups to be updated
- xr_vector& theVerts, CanSmoothChecker* smoothChecker, const float& minCreaseAngle);
-
- // given 2 triangles, fill the two neighbor pointers with either
- // null or valid Triangle pointers.
- void FindNeighbors(Triangle* tri, TriangleList& possibleNeighbors, Triangle** neighbor1, Triangle** neighbor2,
- xr_vector& theVerts);
-
- bool SharesEdge(Triangle* triA, Triangle* triB, xr_vector& theVerts);
-
- bool SharesEdgeRespectSplits(Triangle* triA, Triangle* triB, xr_vector& theVerts);
-
- // calculates the tangent and binormal per face
- void GetGradients(const MeshMender::Vertex& v0, const MeshMender::Vertex& v1, const MeshMender::Vertex& v2,
- D3DXVECTOR3& tangent, D3DXVECTOR3& binormal) const;
-
- void OrthogonalizeTangentsAndBinormals(xr_vector& theVerts);
-
- void UpdateTheIndicesWithFinalIndices(xr_vector& theIndices);
-
- void FixCylindricalWrapping(
- xr_vector& theVerts, xr_vector& theIndices, xr_vector& mappingNewToOldVert);
-
- bool TriHasEdge(const D3DXVECTOR3& p0, const D3DXVECTOR3& p1, const D3DXVECTOR3& triA, const D3DXVECTOR3& triB,
- const D3DXVECTOR3& triC);
-
- bool TriHasEdge(const size_t& p0, const size_t& p1, const size_t& triA, const size_t& triB, const size_t& triC);
-
- void ProcessNormals(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition);
-
- void ProcessTangents(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition);
-
- void ProcessBinormals(TriangleList& possibleNeighbors, xr_vector& theVerts,
- xr_vector& mappingNewToOldVert, D3DXVECTOR3 workingPosition);
-
- // make any triangle that used the oldIndex use the newIndex instead
- void UpdateIndices(const size_t oldIndex, const size_t newIndex, TriangleList& curGroup);
-
- // adds a new mapping entry,
- // takes into account that we may be mapping a new vertex to another new vertex,
- // and uses the original old vertex index....is that confusing?
- void AppendToMapping(
- const size_t oldIndex, const size_t originalNumVerts, xr_vector& mappingNewToOldVert);
-};
-
-#endif
diff --git a/src/Common/NvMender2003/ReadMe.txt b/src/Common/NvMender2003/ReadMe.txt
deleted file mode 100644
index 3eab99358e9..00000000000
--- a/src/Common/NvMender2003/ReadMe.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-========================================================================
- STATIC LIBRARY : nv_meshmender
-========================================================================
-
-revision history
-
-2-05-2004
- - added the mapping from new to old vertices
-
-1-26-2004
- - grouped parameters to Mend() differently
- - added default values to Mend() parameters
- - renamed MeshMender::MenderVertex to MeshMender::Vertex since the extra mender was redundant
- - added some more comments in the options section with advice on usage
- - turned bool parameters into enums so that they aren't easily mixed up.
-
diff --git a/src/Common/NvMender2003/convert.h b/src/Common/NvMender2003/convert.h
deleted file mode 100644
index 618de30127a..00000000000
--- a/src/Common/NvMender2003/convert.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _CONVERT_H_
-#define _CONVERT_H_
-IC D3DXVECTOR3& cv_vector(D3DXVECTOR3& l, const Fvector& r)
-{
- l.x = r.x;
- l.y = r.y;
- l.z = r.z;
- return l;
-}
-
-IC Fvector& cv_vector(Fvector& l, const D3DXVECTOR3& r)
-{
- l.x = r.x;
- l.y = r.y;
- l.z = r.z;
- return l;
-}
-
-#endif
diff --git a/src/Common/NvMender2003/mender_input_output.h b/src/Common/NvMender2003/mender_input_output.h
deleted file mode 100644
index 5b201e5f3fa..00000000000
--- a/src/Common/NvMender2003/mender_input_output.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _MENDER_INPUT_OUTPUT_H_
-#define _MENDER_INPUT_OUTPUT_H_
-
-#include "convert.h"
-
-template
-IC void add_face(xr_vector& theIndices, const type_face& iF)
-{
- theIndices.push_back(face_vertex(iF, 0));
- theIndices.push_back(face_vertex(iF, 1));
- theIndices.push_back(face_vertex(iF, 2));
-}
-
-template
-IC void set_face(type_face& iF, unsigned int v0, unsigned int v1, unsigned int v2)
-{
- face_vertex(iF, 0) = v0;
- face_vertex(iF, 1) = v1;
- face_vertex(iF, 2) = v2;
-}
-
-template
-static void fill_mender_input(const xr_vector& vertices, const xr_vector& faces,
- xr_vector& theVerts, xr_vector& theIndices)
-{
- theVerts.clear();
- theIndices.clear();
- // fill inputs (verts)
- const u32 vertices_number = vertices.size();
- theVerts.resize(vertices_number);
- for (u32 i = 0; i < vertices_number; ++i)
- set_vertex(theVerts[i], vertices[i]);
- // fill inputs (indices)
- for (auto face_it = faces.cbegin(); face_it!=faces.cend(); ++face_it)
- add_face(theIndices, *face_it);
-}
-
-template
-static void retrive_data_from_mender_otput(xr_vector& vertices, // in-out
- xr_vector& faces, const xr_vector& theVerts,
- const xr_vector& theIndices, const xr_vector& mappingNewToOldVert)
-{
- xr_vector old_vertices;
- {
- old_vertices.clear();
- // save old vertices to retrive through mappingNewToOldVert data that missing in MeshMender::Vertex
- old_vertices = vertices;
- // retrieving data
- const u32 face_count = faces.size();
- for (u32 i = 0; i < face_count; ++i)
- set_face(faces[i], theIndices[3*i + 0], theIndices[3*i + 1], theIndices[3*i + 2]);
- }
- {
- const u32 vertex_count = theVerts.size();
- vertices.clear();
- vertices.resize(vertex_count);
- for (u32 i = 0; i < vertex_count; i++)
- set_vertex(vertices[i], old_vertices[mappingNewToOldVert[i]], theVerts[i]);
- }
-}
-
-#endif
diff --git a/src/Common/NvMender2003/remove_isolated_verts.h b/src/Common/NvMender2003/remove_isolated_verts.h
deleted file mode 100644
index 701b7f895cd..00000000000
--- a/src/Common/NvMender2003/remove_isolated_verts.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _REMOVE_ISOLATED_VERTS_H_
-#define _REMOVE_ISOLATED_VERTS_H_
-
-template
-static void add_face(const type_face& F, xr_vector& new_vertices, xr_vector& new_faces,
- const xr_vector& vertices, xr_vector& remap)
-{
- type_face new_face;
- for (u32 v = 0; v<3; v++)
- {
- u32 old_id = face_vertex(F, v);
- u32 new_id = remap[old_id];
- // Register new if not found
- if (new_id == u32(-1))
- {
- new_vertices.push_back(vertices[old_id]);
- new_id = new_vertices.size() - 1;
- remap[old_id] = new_id;
- }
- face_vertex(new_face, v) = new_id;
- }
- new_faces.push_back(new_face);
-}
-
-template
-static void t_remove_isolated_verts(xr_vector& new_vertices, xr_vector& new_faces,
- const xr_vector& vertices, const xr_vector& faces)
-{
- new_vertices.clear();
- new_faces.clear();
- xr_vector remap;
- remap.resize(vertices.size(), u32(-1));
- for (u32 f = 0; f
-void t_remove_isolated_verts(xr_vector& vertices, xr_vector& faces)
-{
- xr_vector old_vertices;
- xr_vector old_faces;
- old_vertices.clear();
- old_faces.clear();
-
- old_vertices = vertices;
- old_faces = faces;
-
- t_remove_isolated_verts(vertices, faces, old_vertices, old_faces);
-
- old_vertices.clear();
- old_faces.clear();
-}
-
-#endif
diff --git a/src/utils/mp_balancer/entry_point.cpp b/src/utils/mp_balancer/entry_point.cpp
deleted file mode 100644
index 8a4578f0aa5..00000000000
--- a/src/utils/mp_balancer/entry_point.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "pch.h"
-#include "wpn_collection.hpp"
-#include "statistics_collector.hpp"
-
-void main(int argc, char* argv[])
-{
- xrDebug::Initialize(false);
- Core.Initialize("mp_balancer", nullptr, true, "fsgame.ltx");
-
- SetConsoleOutputCP(1251);
-
- weapon_collection wpn_collection;
-
- wpn_collection.load_all_mp_weapons();
-
- if (argc == 2)
- {
- if (!strcmp(argv[1], "export_configs"))
- {
- wpn_collection.extract_all_params();
- wpn_collection.save_new_configs();
- }
- else if (!strcmp(argv[1], "made_csv"))
- {
- statistics_collector stat_collector(&wpn_collection);
- stat_collector.load_settings();
- stat_collector.save_files();
- }
- }
-
- Core._destroy();
-}
diff --git a/src/utils/mp_balancer/iostreams_proxy.cpp b/src/utils/mp_balancer/iostreams_proxy.cpp
deleted file mode 100644
index 309c83c69e1..00000000000
--- a/src/utils/mp_balancer/iostreams_proxy.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "pch.h"
-#include "iostreams_proxy.h"
-
-#ifdef _STLP_NO_IOSTREAMS
-
-namespace std
-{
-console_output cout;
-console_output cerr;
-console_output clog;
-char const* endl = "\n";
-}
-
-#endif //#ifdef _STLP_NO_IOSTREAMS
diff --git a/src/utils/mp_balancer/iostreams_proxy.h b/src/utils/mp_balancer/iostreams_proxy.h
deleted file mode 100644
index 513fbb5a1df..00000000000
--- a/src/utils/mp_balancer/iostreams_proxy.h
+++ /dev/null
@@ -1,35 +0,0 @@
-#ifndef IOSTREAMS_PROXY_INCLUDED
-#define IOSTREAMS_PROXY_INCLUDED
-
-#include
-#include
-
-#ifndef _STLP_NO_IOSTREAMS
-#include
-#else //#ifdef _STLP_NO_IOSTREAMS
-
-namespace std
-{
-class console_output
-{
-public:
- console_output(){};
- ~console_output(){};
-
- console_output& operator<<(char const* str)
- {
- printf(str);
- return *this;
- }
-}; // class console_output
-
-extern console_output cout;
-extern console_output cerr;
-extern console_output clog;
-extern char const* endl;
-
-}; // namespace std
-
-#endif //#ifndef _STLP_NO_IOSTREAMS
-
-#endif //#ifndef IOSTREAMS_PROXY_INCLUDED
diff --git a/src/utils/mp_balancer/mp_balancer.vcxproj b/src/utils/mp_balancer/mp_balancer.vcxproj
deleted file mode 100644
index 5e8c97fa9ed..00000000000
--- a/src/utils/mp_balancer/mp_balancer.vcxproj
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Release
- Win32
-
-
-
- mp_ballancer
- {93EA76CE-7B49-420D-BD4A-C9798B82CD59}
- mp_balancer
- Win32Proj
-
-
-
- Application
- $(xrPlatformToolset)
- MultiByte
- true
-
-
- Application
- $(xrPlatformToolset)
- MultiByte
-
-
-
-
-
-
-
-
-
-
-
-
- pch.h
-
-
- Console
-
-
-
-
- pch.h
-
-
- Console
-
-
-
-
-
-
- Create
- Create
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {a0f7d1fb-59a7-4717-a7e4-96f37e91998e}
-
-
- {c964d17a-05a8-4bfa-b0a8-7af5c6b627ec}
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/utils/mp_balancer/mp_balancer.vcxproj.filters b/src/utils/mp_balancer/mp_balancer.vcxproj.filters
deleted file mode 100644
index 1f3c210a582..00000000000
--- a/src/utils/mp_balancer/mp_balancer.vcxproj.filters
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- {fd2378e1-b71d-4204-a752-cae314fdb9fc}
-
-
-
-
- core
-
-
- core
-
-
- core
-
-
-
-
-
-
-
- core
-
-
- core
-
-
- core
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/utils/mp_balancer/pch.cpp b/src/utils/mp_balancer/pch.cpp
deleted file mode 100644
index 1d9f38c57d6..00000000000
--- a/src/utils/mp_balancer/pch.cpp
+++ /dev/null
@@ -1 +0,0 @@
-#include "pch.h"
diff --git a/src/utils/mp_balancer/pch.h b/src/utils/mp_balancer/pch.h
deleted file mode 100644
index 900d1326a06..00000000000
--- a/src/utils/mp_balancer/pch.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef PCH_H_INCLUDED
-#define PCH_H_INCLUDED
-
-#include "Common/Platform.hpp"
-#include "Common/Common.hpp"
-#include "Common/object_broker.h"
-#include "xrCore/xrCore.h"
-#include "xrCore/Containers/AssociativeVector.hpp"
-
-#include "xr_ini_ex.h"
-
-#include
-#include
-
-#endif // #define PCH_H_INCLUDED
diff --git a/src/utils/mp_balancer/statistics_collector.cpp b/src/utils/mp_balancer/statistics_collector.cpp
deleted file mode 100644
index 797a702f3b4..00000000000
--- a/src/utils/mp_balancer/statistics_collector.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "pch.h"
-#include "statistics_collector.hpp"
-#include "wpn_collection.hpp"
-#include "tools.hpp"
-
-statistics_collector::statistics_collector(weapon_collection* wpn_collection) { m_wpn_collection = wpn_collection; }
-statistics_collector::~statistics_collector() { delete_data(m_all_params); }
-#define CSV_SETTINGS "csv_settings"
-void statistics_collector::load_settings()
-{
- u32 file_count = m_wpn_collection->settings->line_count(CSV_SETTINGS);
- for (u32 i = 0; i != file_count; ++i)
- {
- LPCSTR key = NULL;
- LPCSTR value = NULL;
- if (m_wpn_collection->settings->r_line(CSV_SETTINGS, i, &key, &value) && key)
- {
- csv_files::iterator new_file_iter =
- m_all_params.emplace(shared_str(key), new params_collection()).first;
- if (value)
- {
- get_string_collection(value, *new_file_iter->second);
- }
- }
- }
-}
-
-void statistics_collector::save_files()
-{
- //std::for_each(m_all_params.begin(), m_all_params.end(),
- // std::bind1st(std::mem_fun(&statistics_collector::save_file), this));
- for (auto &it : m_all_params)
- save_file(it);
-}
-
-statistics_collector::csv_files::const_iterator statistics_collector::get_most_acceptable_group(
- shared_str const& section)
-{
- u32 max_size = 0;
- csv_files::const_iterator ret_iter = m_all_params.end();
- for (csv_files::const_iterator i = m_all_params.begin(), ie = m_all_params.end(); i != ie; ++i)
- {
- if (strncmp(i->first.c_str(), section.c_str(), i->first.size()))
- continue;
-
- if (ret_iter == ie)
- {
- ret_iter = i;
- max_size = i->first.size();
- }
- else if (max_size < i->first.size())
- {
- ret_iter = i;
- max_size = i->first.size();
- }
- }
- return ret_iter;
-}
-
-void statistics_collector::save_file(csv_files::value_type const& val)
-{
- // LPCSTR new_file_name;
- // STRCONCAT(new_file_name, val.first.c_str(), ".csv");
- string_path new_file_name;
- strconcat(sizeof(new_file_name), new_file_name, val.first.c_str(), ".csv");
-
- char temp_string[1024];
- xr_string dest_string;
- dest_string.reserve(4096);
-
- dest_string.append("\"section_name\",");
- for (params_collection::const_iterator i = val.second->begin(), ie = val.second->end(); i != ie; ++i)
- {
- sprintf_s(temp_string, "\"%s\",", i->c_str());
- dest_string.append(temp_string);
- }
- dest_string.erase(dest_string.end() - 1);
- dest_string.append("\r\n");
-
- for (xr_vector::const_iterator i = m_wpn_collection->all_weapons.begin(),
- ie = m_wpn_collection->all_weapons.end();
- i != ie; ++i)
- {
- csv_files::const_iterator temp_cit = get_most_acceptable_group(*i);
- if (temp_cit == m_all_params.end())
- continue;
- if (temp_cit->first != val.first)
- continue;
-
- sprintf_s(temp_string, "\"%s\",", i->c_str());
- dest_string.append(temp_string);
- for (params_collection::const_iterator param_i = val.second->begin(), param_ie = val.second->end();
- param_i != param_ie; ++param_i)
- {
- LPCSTR val = m_wpn_collection->priquel_config->r_string(i->c_str(), param_i->c_str());
- if (!val)
- val = "";
- sprintf_s(temp_string, "\"%s\",", val);
- dest_string.append(temp_string);
- }
- dest_string.erase(dest_string.end() - 1);
- dest_string.append("\r\n");
- }
-
- IWriter* new_file = FS.w_open(new_file_name);
- R_ASSERT(new_file);
- new_file->w_string(dest_string.c_str());
- FS.w_close(new_file);
-}
diff --git a/src/utils/mp_balancer/statistics_collector.hpp b/src/utils/mp_balancer/statistics_collector.hpp
deleted file mode 100644
index 1f8586d1226..00000000000
--- a/src/utils/mp_balancer/statistics_collector.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef STATISTICS_COLLECTOR
-#define STATISTICS_COLLECTOR
-
-class weapon_collection;
-
-class statistics_collector
-{
-private:
- weapon_collection* m_wpn_collection;
- typedef xr_vector params_collection;
- typedef AssociativeVector csv_files;
- csv_files m_all_params;
- void save_file(csv_files::value_type const& val);
- csv_files::const_iterator get_most_acceptable_group(shared_str const& section);
-
-public:
- explicit statistics_collector(weapon_collection* wpn_collection);
- ~statistics_collector();
- void save_files();
- void load_settings();
-};
-
-#endif //#ifndef STATISTICS_COLLECTOR
diff --git a/src/utils/mp_balancer/tools.hpp b/src/utils/mp_balancer/tools.hpp
deleted file mode 100644
index 00306487ee4..00000000000
--- a/src/utils/mp_balancer/tools.hpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef TOOLS_HPP
-#define TOOLS_HPP
-
-inline u32 get_string_collection(shared_str const& src, xr_vector& dest_collection)
-{
- u32 cnt = _GetItemCount(src.c_str());
- string1024 _one;
-
- for (u32 c = 0; c < cnt; ++c)
- {
- _GetItem(src.c_str(), c, _one);
- dest_collection.push_back(_one);
- }
- return cnt;
-}
-
-inline void get_string_from_collection(xr_vector const& src_collection, xr_string& dest_string)
-{
- xr_vector::const_iterator ie = src_collection.end();
- for (xr_vector::const_iterator i = src_collection.begin(); i != ie; ++i)
- {
- dest_string.append(i->c_str());
- if ((i + 1) != ie)
- dest_string.append(",");
- }
-}
-
-#endif //#ifndef TOOLS_HPP
diff --git a/src/utils/mp_balancer/wpn_collection.cpp b/src/utils/mp_balancer/wpn_collection.cpp
deleted file mode 100644
index f068ca4c050..00000000000
--- a/src/utils/mp_balancer/wpn_collection.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-#include "pch.h"
-#include "wpn_collection.hpp"
-
-weapon_collection::weapon_collection() {}
-weapon_collection::~weapon_collection()
-{
- if (priquel_config)
- xr_delete(priquel_config);
- if (patch_config)
- xr_delete(patch_config);
-
- if (settings)
- {
- xr_delete(settings);
- }
-
- delete_data(extract_list);
-}
-
-void weapon_collection::load_all_mp_weapons()
-{
- string_path path_ltx;
-
- FS.update_path(path_ltx, "$patch_config$", "system.ltx");
- patch_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE);
-
- FS.update_path(path_ltx, "$game_config$", "system.ltx");
- priquel_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE);
-
- /*FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\weapons_mp_for_work.ltx");
- work_mp_weapons = xr_new(path_ltx, TRUE, TRUE, FALSE);
-
- FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\ammo_mp_for_work.ltx");
- work_mp_ammo = xr_new(path_ltx, TRUE, TRUE, FALSE);
-
- FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\items_mp_for_work.ltx");
- work_mp_items = xr_new(path_ltx, TRUE, TRUE, FALSE);
-
- FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\outfit_mp_for_work.ltx");
- work_mp_outfits = xr_new(path_ltx, TRUE, TRUE, FALSE);*/
-
- FS.update_path(path_ltx, "$app_data_root$", "export_settings.ltx");
- settings = new CInifileEx(path_ltx, TRUE, TRUE, FALSE);
- load_settings();
-
- /*new_mp_weapons = xr_new("new_weapons_mp.ltx", FALSE, FALSE, FALSE);
- new_mp_ammo = xr_new("new_ammo_mp.ltx", FALSE, FALSE, FALSE);
- new_mp_items = xr_new("new_items_mp.ltx", FALSE, FALSE, FALSE);
- new_mp_outfits = xr_new("new_outfit_mp.ltx", FALSE, FALSE, FALSE);*/
-
- CInifileEx::Sect& dm_base_cost = priquel_config->r_section("deathmatch_base_cost");
- CInifileEx::SectIt_ ie = dm_base_cost.Data.end();
- std::cout << "Found next weapons and ammo:" << std::endl;
- for (CInifileEx::SectIt_ i = dm_base_cost.Data.begin(); i != ie; ++i)
- {
- std::cout << i->first.c_str() << std::endl;
- all_weapons.push_back(i->first);
- }
-}
-
-struct SymbolCountComparator : public std::binary_function
-{
- bool operator()(
- weapon_collection::tentity_extract_keys const* left, weapon_collection::tentity_extract_keys const* right) const
- {
- return (left->first.size() >= right->first.size());
- };
-};
-
-void read_arguments_to_set(xr_set& dest, char const* source_string)
-{
- xr_string tmp;
-
- for (int k = 0, cnt = _GetItemCount(source_string); k < cnt; ++k)
- {
- _GetItem(source_string, k, tmp);
- dest.insert(tmp.c_str());
- }
-}
-
-#define EXPORT_SETTINGS_SECT "export_settings"
-void weapon_collection::load_settings()
-{
- u32 params_count = settings->line_count(EXPORT_SETTINGS_SECT);
- extract_list.reserve(params_count);
- for (u32 param = 0; param < params_count; ++param)
- {
- const char* line = NULL;
- const char* larg = NULL;
- settings->r_line(EXPORT_SETTINGS_SECT, param, &line, &larg);
- R_ASSERT(line);
- extract_list.push_back(new tentity_extract_keys());
- extract_list.back()->first = line;
- new_config.insert(std::make_pair(shared_str(line), xr_vector()));
- if (larg)
- {
- read_arguments_to_set(extract_list.back()->second, larg);
- }
- }
- std::sort(extract_list.begin(), extract_list.end(), SymbolCountComparator());
-}
-
-weapon_collection::textract_list::const_iterator weapon_collection::get_extract_keys(char const* section_name)
-{
- for (weapon_collection::textract_list::const_iterator i = extract_list.begin(), ie = extract_list.end(); i != ie;
- ++i)
- {
- if (!strncmp((*i)->first.c_str(), section_name, (*i)->first.size()))
- return i;
- }
-
- return extract_list.end();
-}
-
-// save all items using existing structure..
-void weapon_collection::extract_all_params()
-{
- std::cout << "----------------- started to save values -----------------" << std::endl;
- xr_set no_extract_params;
- xr_vector::const_iterator ie = all_weapons.end();
- for (xr_vector::const_iterator i = all_weapons.begin(); i != ie; ++i)
- {
- textract_list::const_iterator extr_iter = get_extract_keys(i->c_str());
- if (extr_iter == extract_list.end())
- {
- std::cerr << "Not found extract list for section: " << i->c_str() << std::endl;
- continue;
- }
- std::cout << "\r\n\r\nProcessing section: " << i->c_str() << std::endl;
-
- CInifileEx::Sect new_sect;
- CInifileEx::Sect& temp_sect = priquel_config->r_section(*i);
- build_section(new_sect, temp_sect, (*extr_iter)->second);
-
- new_config[(*extr_iter)->first].push_back(new_sect);
-
- /*u32 params_count = priquel_config->line_count(*i);
- for (u32 param = 0; param < params_count; ++param)
- {
- const char * line = NULL;
- const char * larg = NULL;
- const char * patch_arg = NULL;
- const char * base_line = NULL;
- priquel_config->r_line(i->c_str(), param, &line, &larg);
- R_ASSERT(line);
- if (!larg) larg = "";
- std::cout << "Key: " << line << ", value: " << larg << std::endl;
- write_store->remove_line(i->c_str(), line);
- if (mp_base->line_exist(base_section, line))
- {
- std::cout << "This key present in base section ...\r\n";
- continue;
- }
- patch_arg = try_extract_from_patch(i->c_str(), line);
- if (patch_arg)
- {
- if (strcmp(larg, patch_arg))
- {
- std::cout << "Patch value is not equal: " << patch_arg << std::endl;
- if (remember_yes_keys.find(shared_str(line)) != remember_yes_keys.end())
- {
- larg = patch_arg;
- std::cout << "Processing YES action...\r\n";
- } else if (remember_no_keys.find(shared_str(line)) != remember_no_keys.end())
- {
- std::cout << "Processing NO action...\r\n";
- } else
- {
- std::cout << "Do you want to save patch value ? (y - single yes, Y - multiple yes, n - single
- no, N - multiple no):";
- int ch = _getch();
- if (ch == 'y')
- {
- larg = patch_arg;
- } else if (ch == 'Y')
- {
- remember_yes_keys.insert(shared_str(line));
- larg = patch_arg;
- } else if (ch == 'N')
- {
- remember_no_keys.insert(shared_str(line));
- }
- }
- }
- }
- std::cout << "Saving key: " << line << ", value: " << larg << std::endl << std::endl;
- write_store->w_string(temp_section, line, larg);
- }*/
- }
-}
-
-char const* weapon_collection::try_extract_from_patch(char const* sect, char const* line)
-{
- R_ASSERT(sect && line);
- if (patch_config->line_exist(sect, line))
- {
- return patch_config->r_string(sect, line);
- }
- return NULL;
-}
-
-void weapon_collection::copy_params_ex(
- CInifileEx::Sect& dest, CInifileEx::Sect const& from, xr_set const& copy_keys)
-{
- std::cout << "Processing section: " << from.Name.c_str() << std::endl;
- for (CInifileEx::SectCIt i = from.Data.begin(), ie = from.Data.end(); i != ie; ++i)
- {
- if (copy_keys.find(i->first) != copy_keys.end())
- {
- char const* larg = try_extract_from_patch(from.Name.c_str(), i->first.c_str());
- CInifileEx::Item temp_item;
- temp_item.first = i->first;
- temp_item.second = priquel_config->r_string(dest.Name.c_str(), temp_item.first.c_str());
- temp_item.comment = i->comment;
- if (larg)
- {
- if (temp_item.second != larg)
- {
- //--------------------------------
- std::cout << "Key: " << temp_item.first.c_str() << "\r\n";
- if (temp_item.comment.c_str())
- {
- std::cout << "Comment: " << temp_item.comment.c_str() << std::endl;
- }
-
- std::cout << "Values not EQUAL:\r\n"
- << "Priquel value is: " << temp_item.second.c_str() << ", patch value is: " << larg
- << std::endl;
- if (remember_yes_keys.find(shared_str(temp_item.first)) != remember_yes_keys.end())
- {
- temp_item.second = larg;
- std::cout << "Processing YES action...\r\n";
- }
- else if (remember_no_keys.find(shared_str(temp_item.first)) != remember_no_keys.end())
- {
- std::cout << "Processing NO action...\r\n";
- }
- else
- {
- std::cout << "Do you want to save patch value ? (y - single yes, Y - multiple yes, n - single "
- "no, N - multiple no):";
- int ch = _getch();
- if (ch == 'y')
- {
- temp_item.second = larg;
- }
- else if (ch == 'Y')
- {
- remember_yes_keys.insert(shared_str(temp_item.first));
- temp_item.second = larg;
- }
- else if (ch == 'N')
- {
- remember_no_keys.insert(shared_str(temp_item.first));
- }
- std::cout << std::endl;
- }
- //--------------------------------
- }
- }
- dest.Data.push_back(temp_item);
- }
- }
-}
-
-void weapon_collection::build_section(
- CInifileEx::Sect& dest, CInifileEx::Sect const& orig, xr_set const& extract_from_base_keys)
-{
- dest.Name = orig.Name;
- dest.base_sections = orig.base_sections;
-
- for (xr_vector::const_iterator bi = orig.base_sections.begin(), bie = orig.base_sections.end();
- bi != bie; ++bi)
- {
- R_ASSERT2(priquel_config->section_exist(bi->c_str()), "base section not exist");
- CInifileEx::Sect& base_sect = priquel_config->r_section(bi->c_str());
- copy_params_ex(dest, base_sect, extract_from_base_keys);
- }
-
- for (CInifileEx::SectCIt i = orig.Data.begin(), ie = orig.Data.end(); i != ie; ++i)
- {
- bool found_key = false;
-
- for (xr_vector::const_iterator bi = orig.base_sections.begin(), bie = orig.base_sections.end();
- bi != bie; ++bi)
- {
- if (priquel_config->line_exist(bi->c_str(), i->first.c_str()))
- {
- // char const * larg = config->r_string(bi->c_str(), i->first.c_str());
- // if (i->second == larg)
- //{
- found_key = true;
- break;
- //}
- }
- }
- if (!found_key)
- {
- dest.Data.push_back(*i);
- }
- }
-}
-
-void weapon_collection::save_config_to_file(tnew_config_map::const_iterator cfg_iter)
-{
- xr_set comments_set;
- IWriter* new_file = FS.w_open(cfg_iter->first.c_str());
- tnew_config_map::mapped_type const& sect_collection = cfg_iter->second;
- xr_string temp_string;
- temp_string.reserve(1024 * 5);
- char temp_buffer[2096];
- for (tnew_config_map::mapped_type::const_iterator i = sect_collection.begin(), ie = sect_collection.end(); i != ie;
- ++i)
- {
- temp_string.clear();
- sprintf_s(temp_buffer, "[%s]", i->Name.c_str());
-
- temp_string.append(temp_buffer);
- if (i->base_sections.size())
- {
- temp_string.append(":");
- for (xr_vector::const_iterator bi = i->base_sections.begin(), bie = i->base_sections.end();
- bi != bie; ++bi)
- {
- temp_string.append(bi->c_str());
- if ((bi + 1) != bie)
- temp_string.append(", ");
- }
- }
- temp_string.append("\r\n");
-
- for (CInifileEx::SectCIt si = i->Data.begin(), sie = i->Data.end(); si != sie; ++si)
- {
- sprintf_s(
- temp_buffer, "%4s%-32s = %-8s", " ", si->first.c_str(), si->second.c_str() ? si->second.c_str() : "");
- if (si->comment.c_str())
- {
- if (comments_set.find(si->first) == comments_set.end())
- {
- strcat_s(temp_buffer, ";");
- strcat_s(temp_buffer, si->comment.c_str());
- comments_set.insert(si->first);
- }
- }
- strcat_s(temp_buffer, "\r\n");
- temp_string.append(temp_buffer);
- }
- temp_string.append("\r\n");
- new_file->w_string(temp_string.c_str());
- }
- FS.w_close(new_file);
-}
-
-void weapon_collection::save_new_configs()
-{
- for (tnew_config_map::const_iterator i = new_config.begin(), ie = new_config.end(); i != ie; ++i)
- {
- save_config_to_file(i);
- }
-}
diff --git a/src/utils/mp_balancer/wpn_collection.hpp b/src/utils/mp_balancer/wpn_collection.hpp
deleted file mode 100644
index fb65ff4d159..00000000000
--- a/src/utils/mp_balancer/wpn_collection.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "pch.h"
-
-#ifndef WEAPON_COLLECTION
-#define WEAPON_COLLECTION
-
-class weapon_collection
-{
- friend class statistics_collector;
-
-protected:
- CInifileEx* priquel_config;
- CInifileEx* patch_config;
-
- /*CInifileEx* work_mp_weapons;
- CInifileEx* work_mp_ammo;
- CInifileEx* work_mp_items;
- CInifileEx* work_mp_outfits;*/
-
- CInifileEx* settings;
-
- xr_vector all_weapons;
- xr_set remember_yes_keys;
- xr_set remember_no_keys;
-
-public:
- typedef std::pair> tentity_extract_keys;
- typedef std::map> tnew_config_map;
- typedef std::vector textract_list;
-
- void load_all_mp_weapons();
- void load_settings();
-
- textract_list::const_iterator get_extract_keys(char const* section_name);
-
- void extract_all_params();
-
- char const* try_extract_from_patch(char const* sect, char const* key);
- void copy_params_ex(CInifileEx::Sect& dest, CInifileEx::Sect const& from, xr_set const& copy_keys);
- void build_section(CInifileEx::Sect& dest, CInifileEx::Sect const& orig, xr_set const& extract);
-
- void save_config_to_file(tnew_config_map::const_iterator cfg_iter);
- void save_new_configs();
-
- weapon_collection();
- ~weapon_collection();
-
-private:
- textract_list extract_list;
- tnew_config_map new_config;
-}; // class weapon_collection
-
-#endif //#ifndef WEAPON_COLLECTION
diff --git a/src/utils/mp_balancer/xr_ini_ex.cpp b/src/utils/mp_balancer/xr_ini_ex.cpp
deleted file mode 100644
index 329b5d9feab..00000000000
--- a/src/utils/mp_balancer/xr_ini_ex.cpp
+++ /dev/null
@@ -1,838 +0,0 @@
-#include "pch.h"
-#pragma hdrstop
-
-#include "xr_ini_ex.h"
-#include "../../xrCore/fs_internal.h"
-
-CInifileEx* pSettingsEx = NULL;
-
-CInifileEx* CInifileEx::Create(const char* szFileName, BOOL ReadOnly)
-{
- return new CInifileEx(szFileName, ReadOnly);
-}
-
-void CInifileEx::Destroy(CInifileEx* ini) { xr_delete(ini); }
-bool sect_pred(const CInifileEx::Sect* x, LPCSTR val) { return xr_strcmp(*x->Name, val) < 0; };
-bool item_pred(const CInifileEx::Item& x, LPCSTR val)
-{
- if ((!x.first) || (!val))
- return x.first < val;
- else
- return xr_strcmp(*x.first, val) < 0;
-}
-
-//------------------------------------------------------------------------------
-//Тело функций Inifile
-//------------------------------------------------------------------------------
-BOOL _parse(pstr dest, LPCSTR src)
-{
- BOOL bInsideSTR = false;
- if (src)
- {
- while (*src)
- {
- if (isspace((u8)*src))
- {
- if (bInsideSTR)
- {
- *dest++ = *src++;
- continue;
- }
- while (*src && isspace(*src))
- {
- ++src;
- }
- continue;
- }
- else if (*src == '"')
- {
- bInsideSTR = !bInsideSTR;
- }
- *dest++ = *src++;
- }
- }
- *dest = 0;
- return bInsideSTR;
-}
-
-void _decorate(pstr dest, LPCSTR src)
-{
- if (src)
- {
- BOOL bInsideSTR = false;
- while (*src)
- {
- if (*src == ',')
- {
- if (bInsideSTR)
- {
- *dest++ = *src++;
- }
- else
- {
- *dest++ = *src++;
- *dest++ = ' ';
- }
- continue;
- }
- else if (*src == '"')
- {
- bInsideSTR = !bInsideSTR;
- }
- *dest++ = *src++;
- }
- }
- *dest = 0;
-}
-//------------------------------------------------------------------------------
-
-BOOL CInifileEx::Sect::line_exist(LPCSTR L, LPCSTR* val)
-{
- SectCIt A = std::lower_bound(Data.begin(), Data.end(), L, item_pred);
- if (A != Data.end() && xr_strcmp(*A->first, L) == 0)
- {
- if (val)
- *val = *A->second;
- return TRUE;
- }
- return FALSE;
-}
-//------------------------------------------------------------------------------
-
-CInifileEx::CInifileEx(IReader* F, LPCSTR path)
-{
- m_file_name[0] = 0;
- m_flags.zero();
- m_flags.set(eSaveAtEnd, FALSE);
- m_flags.set(eReadOnly, TRUE);
- m_flags.set(eOverrideNames, FALSE);
- Load(F, path);
-}
-
-CInifileEx::CInifileEx(LPCSTR szFileName, BOOL ReadOnly, BOOL bLoad, BOOL SaveAtEnd)
-{
- m_file_name[0] = 0;
- m_flags.zero();
- if (szFileName)
- strcpy_s(m_file_name, szFileName);
-
- m_flags.set(eSaveAtEnd, SaveAtEnd);
- m_flags.set(eReadOnly, ReadOnly);
-
- if (bLoad)
- {
- string_path path, folder;
- _splitpath(m_file_name, path, folder, 0, 0);
- strcat(path, folder);
- IReader* R = FS.r_open(szFileName);
- if (R)
- {
- Load(R, path);
- FS.r_close(R);
- }
- }
-}
-
-CInifileEx::~CInifileEx()
-{
- if (!m_flags.test(eReadOnly) && m_flags.test(eSaveAtEnd))
- {
- if (!save_as())
- Log("!Can't save inifile:", m_file_name);
- }
-
- RootIt I = DATA.begin();
- RootIt E = DATA.end();
- for (; I != E; ++I)
- xr_delete(*I);
-}
-
-static void insert_item(CInifileEx::Sect* tgt, const CInifileEx::Item& I)
-{
- CInifileEx::SectIt_ sect_it = std::lower_bound(tgt->Data.begin(), tgt->Data.end(), *I.first, item_pred);
- if (sect_it != tgt->Data.end() && sect_it->first.equal(I.first))
- {
- sect_it->second = I.second;
-#ifdef DEBUG
- sect_it->comment = I.comment;
-#endif
- }
- else
- {
- tgt->Data.insert(sect_it, I);
- }
-}
-
-IC BOOL is_empty_line_now(IReader* F)
-{
- char* a0 = (char*)F->pointer() - 4;
- char* a1 = (char*)(F->pointer()) - 3;
- char* a2 = (char*)F->pointer() - 2;
- char* a3 = (char*)(F->pointer()) - 1;
-
- return (*a0 == 13) && (*a1 == 10) && (*a2 == 13) && (*a3 == 10);
-};
-
-void CInifileEx::Load(IReader* F, LPCSTR path)
-{
- R_ASSERT(F);
- Sect* Current = 0;
- string4096 str;
- string4096 str2;
-
- BOOL bInsideSTR = FALSE;
-
- while (!F->eof())
- {
- F->r_string(str, sizeof(str));
- _Trim(str);
- pstr comm = strchr(str, ';');
- pstr comm_1 = strchr(str, '/');
-
- if (comm_1 && (*(comm_1 + 1) == '/') && ((!comm) || (comm && (comm_1 < comm))))
- {
- comm = comm_1;
- }
-
-#ifdef DEBUG
- pstr comment = 0;
-#endif
- if (comm)
- {
- //."bla-bla-bla;nah-nah-nah"
- char quot = '"';
- bool in_quot = false;
-
- LPCSTR q1 = strchr(str, quot);
- if (q1 && q1 < comm)
- {
- LPCSTR q2 = strchr(++q1, quot);
- if (q2 && q2 > comm)
- in_quot = true;
- }
-
- if (!in_quot)
- {
- *comm = 0;
-#ifdef DEBUG
- comment = comm + 1;
-#endif
- }
- }
-
- if (str[0] && (str[0] == '#') && strstr(str, "#include")) // handle includes
- {
- string_path inc_name;
- R_ASSERT(path && path[0]);
- if (_GetItem(str, 1, inc_name, '"'))
- {
- string_path fn, inc_path, folder;
- strconcat(sizeof(fn), fn, path, inc_name);
- _splitpath(fn, inc_path, folder, 0, 0);
- strcat(inc_path, folder);
- IReader* I = FS.r_open(fn);
- R_ASSERT3(I, "Can't find include file:", inc_name);
- Load(I, inc_path);
- FS.r_close(I);
- }
- }
- else if (str[0] && (str[0] == '[')) // new section ?
- {
- // insert previous filled section
- if (Current)
- {
- // store previous section
- RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred);
- if ((I != DATA.end()) && ((*I)->Name == Current->Name))
- FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str());
- DATA.insert(I, Current);
- }
- Current = new Sect();
- Current->Name = 0;
- // start new section
- R_ASSERT3(strchr(str, ']'), "Bad ini section found: ", str);
- LPCSTR inherited_names = strstr(str, "]:");
- if (0 != inherited_names)
- {
- VERIFY2(m_flags.test(eReadOnly), "Allow for readonly mode only.");
- inherited_names += 2;
- int cnt = _GetItemCount(inherited_names);
-
- for (int k = 0; k < cnt; ++k)
- {
- xr_string tmp;
- _GetItem(inherited_names, k, tmp);
-#ifdef DEBUG
- Current->base_sections.push_back(tmp.c_str());
-#endif
- Sect& inherited_section = r_section(tmp.c_str());
- for (SectIt_ it = inherited_section.Data.begin(); it != inherited_section.Data.end(); it++)
- insert_item(Current, *it);
- }
- }
- *strchr(str, ']') = 0;
- Current->Name = strlwr(str + 1);
- }
- else // name = value
- {
- if (Current)
- {
- string4096 value_raw;
- char* name = str;
- char* t = strchr(name, '=');
- if (t)
- {
- *t = 0;
- _Trim(name);
- ++t;
- strcpy_s(value_raw, sizeof(value_raw), t);
- bInsideSTR = _parse(str2, value_raw);
- if (bInsideSTR) // multiline str value
- {
- while (bInsideSTR)
- {
- strcat_s(value_raw, sizeof(value_raw), "\r\n");
- string4096 str_add_raw;
- F->r_string(str_add_raw, sizeof(str_add_raw));
- R_ASSERT2(xr_strlen(value_raw) + xr_strlen(str_add_raw) < sizeof(value_raw),
- make_string("Incorrect inifile format: section[%s], variable[%s]. Odd number of quotes "
- "(\") found, but "
- "should be even.",
- Current->Name.c_str(), name));
- strcat_s(value_raw, sizeof(value_raw), str_add_raw);
- bInsideSTR = _parse(str2, value_raw);
- if (bInsideSTR)
- {
- if (is_empty_line_now(F))
- strcat_s(value_raw, sizeof(value_raw), "\r\n");
- }
- }
- }
- }
- else
- {
- _Trim(name);
- str2[0] = 0;
- }
-
- Item I;
- I.first = (name[0] ? name : NULL);
- I.second = (str2[0] ? str2 : NULL);
-#ifdef DEBUG
- I.comment = m_flags.test(eReadOnly) ? comment : 0; //:comment;
-#endif
-
- if (m_flags.test(eReadOnly))
- {
- if (*I.first)
- insert_item(Current, I);
- }
- else
- {
- if (*I.first || *I.second
-#ifdef DEBUG
- || *I.comment
-#endif
- )
- insert_item(Current, I);
- }
- }
- }
- }
- if (Current)
- {
- RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred);
- if ((I != DATA.end()) && ((*I)->Name == Current->Name))
- FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str());
- DATA.insert(I, Current);
- }
-}
-
-void CInifileEx::save_as(IWriter& writer)
-{
- string4096 temp, val;
- for (RootIt r_it = DATA.begin(); r_it != DATA.end(); ++r_it)
- {
- sprintf_s(temp, sizeof(temp), "[%s]", *(*r_it)->Name);
- writer.w_string(temp);
- for (SectCIt s_it = (*r_it)->Data.begin(); s_it != (*r_it)->Data.end(); ++s_it)
- {
- const Item& I = *s_it;
- if (*I.first)
- {
- if (*I.second)
- {
- _decorate(val, *I.second);
-#ifdef DEBUG
- if (*I.comment)
- {
- // name, value and comment
- sprintf_s(temp, sizeof(temp), "%8s%-32s = %-32s ;%s", " ", *I.first, val, *I.comment);
- }
- else
-#endif
- {
- // only name and value
- sprintf_s(temp, sizeof(temp), "%8s%-32s = %-32s", " ", *I.first, val);
- }
- }
- else
- {
-#ifdef DEBUG
- if (*I.comment)
- {
- // name and comment
- sprintf_s(temp, sizeof(temp), "%8s%-32s = ;%s", " ", *I.first, *I.comment);
- }
- else
-#endif
- {
- // only name
- sprintf_s(temp, sizeof(temp), "%8s%-32s = ", " ", *I.first);
- }
- }
- }
- else
- {
-// no name, so no value
-#ifdef DEBUG
- if (*I.comment)
- sprintf_s(temp, sizeof(temp), "%8s;%s", " ", *I.comment);
- else
-#endif
- temp[0] = 0;
- }
- _TrimRight(temp);
- if (temp[0])
- writer.w_string(temp);
- }
- writer.w_string(" ");
- }
-}
-
-bool CInifileEx::save_as(LPCSTR new_fname)
-{
- // save if needed
- if (new_fname && new_fname[0])
- strcpy_s(m_file_name, new_fname);
-
- R_ASSERT(m_file_name && m_file_name[0]);
- IWriter* F = FS.w_open_ex(m_file_name);
- if (!F)
- return (false);
-
- save_as(*F);
- FS.w_close(F);
- return (true);
-}
-
-BOOL CInifileEx::section_exist(LPCSTR S)
-{
- RootIt I = std::lower_bound(DATA.begin(), DATA.end(), S, sect_pred);
- return (I != DATA.end() && xr_strcmp(*(*I)->Name, S) == 0);
-}
-
-BOOL CInifileEx::line_exist(LPCSTR S, LPCSTR L)
-{
- if (!section_exist(S))
- return FALSE;
- Sect& I = r_section(S);
- SectCIt A = std::lower_bound(I.Data.begin(), I.Data.end(), L, item_pred);
- return (A != I.Data.end() && xr_strcmp(*A->first, L) == 0);
-}
-
-u32 CInifileEx::line_count(LPCSTR Sname)
-{
- Sect& S = r_section(Sname);
- SectCIt I = S.Data.begin();
- u32 C = 0;
- for (; I != S.Data.end(); I++)
- if (*I->first)
- C++;
- return C;
-}
-
-//--------------------------------------------------------------------------------------
-CInifileEx::Sect& CInifileEx::r_section(const shared_str& S) { return r_section(*S); }
-BOOL CInifileEx::line_exist(const shared_str& S, const shared_str& L) { return line_exist(*S, *L); }
-u32 CInifileEx::line_count(const shared_str& S) { return line_count(*S); }
-BOOL CInifileEx::section_exist(const shared_str& S) { return section_exist(*S); }
-//--------------------------------------------------------------------------------------
-// Read functions
-//--------------------------------------------------------------------------------------
-CInifileEx::Sect& CInifileEx::r_section(LPCSTR S)
-{
- char section[256];
- strcpy_s(section, sizeof(section), S);
- strlwr(section);
- RootIt I = std::lower_bound(DATA.begin(), DATA.end(), section, sect_pred);
- if (!(I != DATA.end() && xr_strcmp(*(*I)->Name, section) == 0))
- FATAL(make_string("Can't open section '%s'", S).c_str());
- return **I;
-}
-
-LPCSTR CInifileEx::r_string(LPCSTR S, LPCSTR L)
-{
- Sect& I = r_section(S);
- SectCIt A = std::lower_bound(I.Data.begin(), I.Data.end(), L, item_pred);
- if (A != I.Data.end() && xr_strcmp(*A->first, L) == 0)
- return *A->second;
- else
- FATAL(make_string("Can't find variable %s in [%s]", L, S).c_str());
- return 0;
-}
-
-shared_str CInifileEx::r_string_wb(LPCSTR S, LPCSTR L)
-{
- LPCSTR _base = r_string(S, L);
-
- if (0 == _base)
- return shared_str(0);
-
- string4096 _original;
- strcpy_s(_original, _base);
- u32 _len = xr_strlen(_original);
- if (0 == _len)
- return shared_str("");
- if ('"' == _original[_len - 1])
- _original[_len - 1] = 0; // skip end
- if ('"' == _original[0])
- return shared_str(&_original[0] + 1); // skip begin
- return shared_str(_original);
-}
-
-u8 CInifileEx::r_u8(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return u8(atoi(C));
-}
-u16 CInifileEx::r_u16(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return u16(atoi(C));
-}
-u32 CInifileEx::r_u32(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return u32(atoi(C));
-}
-u64 CInifileEx::r_u64(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
-#ifndef _EDITOR
- return _strtoui64(C, NULL, 10);
-#else
- return (u64)_atoi64(C);
-#endif
-}
-
-s64 CInifileEx::r_s64(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return _atoi64(C);
-}
-s8 CInifileEx::r_s8(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return s8(atoi(C));
-}
-s16 CInifileEx::r_s16(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return s16(atoi(C));
-}
-s32 CInifileEx::r_s32(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return s32(atoi(C));
-}
-float CInifileEx::r_float(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return float(atof(C));
-}
-Fcolor CInifileEx::r_fcolor(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Fcolor V = {0, 0, 0, 0};
- sscanf(C, "%f,%f,%f,%f", &V.r, &V.g, &V.b, &V.a);
- return V;
-}
-u32 CInifileEx::r_color(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- u32 r = 0, g = 0, b = 0, a = 255;
- sscanf(C, "%d,%d,%d,%d", &r, &g, &b, &a);
- return color_rgba(r, g, b, a);
-}
-
-Ivector2 CInifileEx::r_ivector2(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Ivector2 V = {0, 0};
- sscanf(C, "%d,%d", &V.x, &V.y);
- return V;
-}
-Ivector3 CInifileEx::r_ivector3(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Ivector V = {0, 0, 0};
- sscanf(C, "%d,%d,%d", &V.x, &V.y, &V.z);
- return V;
-}
-Ivector4 CInifileEx::r_ivector4(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Ivector4 V = {0, 0, 0, 0};
- sscanf(C, "%d,%d,%d,%d", &V.x, &V.y, &V.z, &V.w);
- return V;
-}
-Fvector2 CInifileEx::r_fvector2(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Fvector2 V = {0.f, 0.f};
- sscanf(C, "%f,%f", &V.x, &V.y);
- return V;
-}
-Fvector3 CInifileEx::r_fvector3(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Fvector3 V = {0.f, 0.f, 0.f};
- sscanf(C, "%f,%f,%f", &V.x, &V.y, &V.z);
- return V;
-}
-Fvector4 CInifileEx::r_fvector4(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- Fvector4 V = {0.f, 0.f, 0.f, 0.f};
- sscanf(C, "%f,%f,%f,%f", &V.x, &V.y, &V.z, &V.w);
- return V;
-}
-BOOL CInifileEx::r_bool(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- VERIFY2(xr_strlen(C) <= 5, make_string("\"%s\" is not a valid bool value, section[%s], line[%s]", C, S, L));
- char B[8];
- strncpy(B, C, 7);
- B[7] = 0;
- strlwr(B);
- return IsBOOL(B);
-}
-CLASS_ID CInifileEx::r_clsid(LPCSTR S, LPCSTR L)
-{
- LPCSTR C = r_string(S, L);
- return TEXT2CLSID(C);
-}
-int CInifileEx::r_token(LPCSTR S, LPCSTR L, const xr_token* token_list)
-{
- LPCSTR C = r_string(S, L);
- for (int i = 0; token_list[i].name; i++)
- if (!stricmp(C, token_list[i].name))
- return token_list[i].id;
- return 0;
-}
-BOOL CInifileEx::r_line(LPCSTR S, int L, const char** N, const char** V)
-{
- Sect& SS = r_section(S);
- if (L >= (int)SS.Data.size() || L < 0)
- return FALSE;
- for (SectCIt I = SS.Data.begin(); I != SS.Data.end(); I++)
- if (!(L--))
- {
- *N = *I->first;
- *V = *I->second;
- return TRUE;
- }
- return FALSE;
-}
-BOOL CInifileEx::r_line(const shared_str& S, int L, const char** N, const char** V) { return r_line(*S, L, N, V); }
-//--------------------------------------------------------------------------------------------------------
-// Write functions
-//--------------------------------------------------------------------------------------
-void CInifileEx::w_string(LPCSTR S, LPCSTR L, LPCSTR V, LPCSTR comment)
-{
- R_ASSERT(!m_flags.test(eReadOnly));
-
- // section
- string256 sect;
- _parse(sect, S);
- _strlwr(sect);
-
- if (!section_exist(sect))
- {
- // create _new_ section
- Sect* NEW = new Sect();
- NEW->Name = sect;
- RootIt I = std::lower_bound(DATA.begin(), DATA.end(), sect, sect_pred);
- DATA.insert(I, NEW);
- }
-
- // parse line/value
- string4096 line;
- _parse(line, L);
- string4096 value;
- _parse(value, V);
-
- // duplicate & insert
- Item I;
- Sect& data = r_section(sect);
- I.first = (line[0] ? line : 0);
- I.second = (value[0] ? value : 0);
-
-#ifdef DEBUG
- I.comment = (comment ? comment : 0);
-#endif
- SectIt_ it = std::lower_bound(data.Data.begin(), data.Data.end(), *I.first, item_pred);
-
- if (it != data.Data.end())
- {
- // Check for "first" matching
- if (0 == xr_strcmp(*it->first, *I.first))
- {
- BOOL b = m_flags.test(eOverrideNames);
- R_ASSERT2(b, make_string("name[%s] already exist in section[%s]", line, sect).c_str());
- *it = I;
- }
- else
- {
- data.Data.insert(it, I);
- }
- }
- else
- {
- data.Data.insert(it, I);
- }
-}
-void CInifileEx::w_u8(LPCSTR S, LPCSTR L, u8 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_u16(LPCSTR S, LPCSTR L, u16 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_u32(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_u64(LPCSTR S, LPCSTR L, u64 V, LPCSTR comment)
-{
- string128 temp;
-#ifndef _EDITOR
- _ui64toa_s(V, temp, sizeof(temp), 10);
-#else
- _ui64toa(V, temp, 10);
-#endif
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_s64(LPCSTR S, LPCSTR L, s64 V, LPCSTR comment)
-{
- string128 temp;
-#ifndef _EDITOR
- _i64toa_s(V, temp, sizeof(temp), 10);
-#else
- _i64toa(V, temp, 10);
-#endif
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_s8(LPCSTR S, LPCSTR L, s8 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_s16(LPCSTR S, LPCSTR L, s16 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_s32(LPCSTR S, LPCSTR L, s32 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_float(LPCSTR S, LPCSTR L, float V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%f", V);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_fcolor(LPCSTR S, LPCSTR L, const Fcolor& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%f,%f,%f,%f", V.r, V.g, V.b, V.a);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_color(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d,%d,%d,%d", color_get_R(V), color_get_G(V), color_get_B(V), color_get_A(V));
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_ivector2(LPCSTR S, LPCSTR L, const Ivector2& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d,%d", V.x, V.y);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_ivector3(LPCSTR S, LPCSTR L, const Ivector3& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d,%d,%d", V.x, V.y, V.z);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_ivector4(LPCSTR S, LPCSTR L, const Ivector4& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%d,%d,%d,%d", V.x, V.y, V.z, V.w);
- w_string(S, L, temp, comment);
-}
-void CInifileEx::w_fvector2(LPCSTR S, LPCSTR L, const Fvector2& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%f,%f", V.x, V.y);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_fvector3(LPCSTR S, LPCSTR L, const Fvector3& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%f,%f,%f", V.x, V.y, V.z);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_fvector4(LPCSTR S, LPCSTR L, const Fvector4& V, LPCSTR comment)
-{
- string128 temp;
- sprintf_s(temp, sizeof(temp), "%f,%f,%f,%f", V.x, V.y, V.z, V.w);
- w_string(S, L, temp, comment);
-}
-
-void CInifileEx::w_bool(LPCSTR S, LPCSTR L, BOOL V, LPCSTR comment) { w_string(S, L, V ? "on" : "off", comment); }
-void CInifileEx::remove_line(LPCSTR S, LPCSTR L)
-{
- R_ASSERT(!m_flags.test(eReadOnly));
-
- if (line_exist(S, L))
- {
- Sect& data = r_section(S);
- SectIt_ A = std::lower_bound(data.Data.begin(), data.Data.end(), L, item_pred);
- R_ASSERT(A != data.Data.end() && xr_strcmp(*A->first, L) == 0);
- data.Data.erase(A);
- }
-}
diff --git a/src/utils/mp_balancer/xr_ini_ex.h b/src/utils/mp_balancer/xr_ini_ex.h
deleted file mode 100644
index 2e5219deef4..00000000000
--- a/src/utils/mp_balancer/xr_ini_ex.h
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef xr_iniexH
-#define xr_iniexH
-
-// refs
-struct xr_token;
-
-class CInifileEx
-{
-public:
- struct Item
- {
- shared_str first;
- shared_str second;
-#ifdef DEBUG
- shared_str comment;
-#endif
- Item()
- : first(0), second(0)
-#ifdef DEBUG
- ,
- comment(0)
-#endif
- {};
- };
- typedef xr_vector- Items;
- typedef Items::const_iterator SectCIt;
- typedef Items::iterator SectIt_;
- struct Sect
- {
- shared_str Name;
- Items Data;
-#ifdef DEBUG
- xr_vector base_sections;
-#endif
- BOOL line_exist(LPCSTR L, LPCSTR* val = 0);
- };
- typedef xr_vector Root;
- typedef Root::iterator RootIt;
-
- static CInifileEx* Create(LPCSTR szFileName, BOOL ReadOnly = TRUE);
- static void Destroy(CInifileEx*);
- static IC BOOL IsBOOL(LPCSTR B)
- {
- return (
- xr_strcmp(B, "on") == 0 || xr_strcmp(B, "yes") == 0 || xr_strcmp(B, "true") == 0 || xr_strcmp(B, "1") == 0);
- }
-
-private:
- enum
- {
- eSaveAtEnd = (1 << 0),
- eReadOnly = (1 << 1),
- eOverrideNames = (1 << 2),
- };
- Flags8 m_flags;
- string_path m_file_name;
- Root DATA;
-
- void Load(IReader* F, LPCSTR path);
-
-public:
- CInifileEx(IReader* F, LPCSTR path = 0);
- CInifileEx(LPCSTR szFileName, BOOL ReadOnly = TRUE, BOOL bLoadAtStart = TRUE, BOOL SaveAtEnd = TRUE);
- virtual ~CInifileEx();
- bool save_as(LPCSTR new_fname = 0);
- void save_as(IWriter& writer);
- void set_override_names(BOOL b) { m_flags.set(eOverrideNames, b); }
- void save_at_end(BOOL b) { m_flags.set(eSaveAtEnd, b); }
- LPCSTR fname() { return m_file_name; };
- Sect& r_section(LPCSTR S);
- Sect& r_section(const shared_str& S);
- BOOL line_exist(LPCSTR S, LPCSTR L);
- BOOL line_exist(const shared_str& S, const shared_str& L);
- u32 line_count(LPCSTR S);
- u32 line_count(const shared_str& S);
- BOOL section_exist(LPCSTR S);
- BOOL section_exist(const shared_str& S);
- Root& sections() { return DATA; }
- CLASS_ID r_clsid(LPCSTR S, LPCSTR L);
- CLASS_ID r_clsid(const shared_str& S, LPCSTR L) { return r_clsid(*S, L); }
- LPCSTR r_string(LPCSTR S, LPCSTR L); // оÑтавлÑет кавычки
- LPCSTR r_string(const shared_str& S, LPCSTR L) { return r_string(*S, L); } // оÑтавлÑет кавычки
- shared_str r_string_wb(LPCSTR S, LPCSTR L); // убирает кавычки
- shared_str r_string_wb(const shared_str& S, LPCSTR L) { return r_string_wb(*S, L); } // убирает кавычки
- u8 r_u8(LPCSTR S, LPCSTR L);
- u8 r_u8(const shared_str& S, LPCSTR L) { return r_u8(*S, L); }
- u16 r_u16(LPCSTR S, LPCSTR L);
- u16 r_u16(const shared_str& S, LPCSTR L) { return r_u16(*S, L); }
- u32 r_u32(LPCSTR S, LPCSTR L);
- u32 r_u32(const shared_str& S, LPCSTR L) { return r_u32(*S, L); }
- u64 r_u64(LPCSTR S, LPCSTR L);
- s8 r_s8(LPCSTR S, LPCSTR L);
- s8 r_s8(const shared_str& S, LPCSTR L) { return r_s8(*S, L); }
- s16 r_s16(LPCSTR S, LPCSTR L);
- s16 r_s16(const shared_str& S, LPCSTR L) { return r_s16(*S, L); }
- s32 r_s32(LPCSTR S, LPCSTR L);
- s32 r_s32(const shared_str& S, LPCSTR L) { return r_s32(*S, L); }
- s64 r_s64(LPCSTR S, LPCSTR L);
- float r_float(LPCSTR S, LPCSTR L);
- float r_float(const shared_str& S, LPCSTR L) { return r_float(*S, L); }
- Fcolor r_fcolor(LPCSTR S, LPCSTR L);
- Fcolor r_fcolor(const shared_str& S, LPCSTR L) { return r_fcolor(*S, L); }
- u32 r_color(LPCSTR S, LPCSTR L);
- u32 r_color(const shared_str& S, LPCSTR L) { return r_color(*S, L); }
- Ivector2 r_ivector2(LPCSTR S, LPCSTR L);
- Ivector2 r_ivector2(const shared_str& S, LPCSTR L) { return r_ivector2(*S, L); }
- Ivector3 r_ivector3(LPCSTR S, LPCSTR L);
- Ivector3 r_ivector3(const shared_str& S, LPCSTR L) { return r_ivector3(*S, L); }
- Ivector4 r_ivector4(LPCSTR S, LPCSTR L);
- Ivector4 r_ivector4(const shared_str& S, LPCSTR L) { return r_ivector4(*S, L); }
- Fvector2 r_fvector2(LPCSTR S, LPCSTR L);
- Fvector2 r_fvector2(const shared_str& S, LPCSTR L) { return r_fvector2(*S, L); }
- Fvector3 r_fvector3(LPCSTR S, LPCSTR L);
- Fvector3 r_fvector3(const shared_str& S, LPCSTR L) { return r_fvector3(*S, L); }
- Fvector4 r_fvector4(LPCSTR S, LPCSTR L);
- Fvector4 r_fvector4(const shared_str& S, LPCSTR L) { return r_fvector4(*S, L); }
- BOOL r_bool(LPCSTR S, LPCSTR L);
- BOOL r_bool(const shared_str& S, LPCSTR L) { return r_bool(*S, L); }
- int r_token(LPCSTR S, LPCSTR L, const xr_token* token_list);
- BOOL r_line(LPCSTR S, int L, LPCSTR* N, LPCSTR* V);
- BOOL r_line(const shared_str& S, int L, LPCSTR* N, LPCSTR* V);
-
- void w_string(LPCSTR S, LPCSTR L, LPCSTR V, LPCSTR comment = 0);
- void w_u8(LPCSTR S, LPCSTR L, u8 V, LPCSTR comment = 0);
- void w_u16(LPCSTR S, LPCSTR L, u16 V, LPCSTR comment = 0);
- void w_u32(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment = 0);
- void w_u64(LPCSTR S, LPCSTR L, u64 V, LPCSTR comment = 0);
- void w_s64(LPCSTR S, LPCSTR L, s64 V, LPCSTR comment = 0);
- void w_s8(LPCSTR S, LPCSTR L, s8 V, LPCSTR comment = 0);
- void w_s16(LPCSTR S, LPCSTR L, s16 V, LPCSTR comment = 0);
- void w_s32(LPCSTR S, LPCSTR L, s32 V, LPCSTR comment = 0);
- void w_float(LPCSTR S, LPCSTR L, float V, LPCSTR comment = 0);
- void w_fcolor(LPCSTR S, LPCSTR L, const Fcolor& V, LPCSTR comment = 0);
- void w_color(LPCSTR S, LPCSTR L, u32 V, LPCSTR comment = 0);
- void w_ivector2(LPCSTR S, LPCSTR L, const Ivector2& V, LPCSTR comment = 0);
- void w_ivector3(LPCSTR S, LPCSTR L, const Ivector3& V, LPCSTR comment = 0);
- void w_ivector4(LPCSTR S, LPCSTR L, const Ivector4& V, LPCSTR comment = 0);
- void w_fvector2(LPCSTR S, LPCSTR L, const Fvector2& V, LPCSTR comment = 0);
- void w_fvector3(LPCSTR S, LPCSTR L, const Fvector3& V, LPCSTR comment = 0);
- void w_fvector4(LPCSTR S, LPCSTR L, const Fvector4& V, LPCSTR comment = 0);
- void w_bool(LPCSTR S, LPCSTR L, BOOL V, LPCSTR comment = 0);
-
- void remove_line(LPCSTR S, LPCSTR L);
-};
-
-// Main configuration file
-extern CInifileEx* pSettingsEx;
-
-#endif //__XR_INI_H__
diff --git a/src/utils/mp_gpprof_server/Makefile b/src/utils/mp_gpprof_server/Makefile
deleted file mode 100644
index 7dc8d8d175e..00000000000
--- a/src/utils/mp_gpprof_server/Makefile
+++ /dev/null
@@ -1,148 +0,0 @@
-SHELL = /bin/sh
-ROOT_DIR = .
-BIN_DIRECTORY = $(ROOT_DIR)/bin
-LIBS_DIR = $(ROOT_DIR)/libraries
-FASTCGI_LIB_DIR = $(LIBS_DIR)/fcgi-2.4.0
-GAMESPY_LIB_DIR = $(LIBS_DIR)/gamespy
-TARGET_NAME = $(BIN_DIRECTORY)/mp_gpprof_server
-
-INSTALL_DIR = /usr/share/mp_gpprof_server
-INITD_SCRIPT = mpgpprof
-INITD_DIR = /etc/init.d
-
-CC = gcc
-CPP = g++
-
-BASE_CFLAGS=-D_LINUX -DGSI_NO_THREADS
-
-CFLAGS=$(BASE_CFLAGS) -O6 -ffast-math -funroll-loops \
- -fomit-frame-pointer -fexpensive-optimizations -falign-loops=2 \
- -falign-jumps=2 -falign-functions=2 -lpthread
-CPPFLAGS=$(BASE_CFLAGS) -march=i486 -lpthread
-
-DEBUG_CFLAGS =$(BASE_CFLAGS) -g -lpthread -DGSI_COMMON_DEBUG -D_DEBUG
-DEBUG_CPPFLAGS =$(BASE_CFLAGS) -g -lpthread -DGSI_COMMON_DEBUG -D_DEBUG
-
-
-#use these to specify debug and release configurations
-CURR_CFLAGS = $(CFLAGS)
-CURR_CPPFLAGS = $(CPPFLAGS)
-
-FASTCGI_OBJS =\
- $(BIN_DIRECTORY)/libfcgi/fcgiapp.o\
- $(BIN_DIRECTORY)/libfcgi/os_unix.o\
- $(BIN_DIRECTORY)/libfcgi/fcgi_stdio.o\
- $(BIN_DIRECTORY)/libfcgi/fcgio.o
-
-MP_GPPROF_OBJS = \
- $(BIN_DIRECTORY)/entry_point.o\
- $(BIN_DIRECTORY)/gamespy_sake.o\
- $(BIN_DIRECTORY)/profile_data_types.o\
- $(BIN_DIRECTORY)/profile_request.o\
- $(BIN_DIRECTORY)/profiles_cache.o\
- $(BIN_DIRECTORY)/requests_processor.o\
- $(BIN_DIRECTORY)/sake_worker.o\
- $(BIN_DIRECTORY)/threads.o\
- $(BIN_DIRECTORY)/atlas_stalkercoppc_v1.o
-
-GAMESPY_OBJS =\
- $(BIN_DIRECTORY)/gamespy/md5c.o\
- $(BIN_DIRECTORY)/gamespy/darray.o\
- $(BIN_DIRECTORY)/gamespy/hashtable.o\
- $(BIN_DIRECTORY)/gamespy/common/linux/LinuxCommon.o\
- $(BIN_DIRECTORY)/gamespy/common/gsAssert.o\
- $(BIN_DIRECTORY)/gamespy/common/gsAvailable.o\
- $(BIN_DIRECTORY)/gamespy/common/gsDebug.o\
- $(BIN_DIRECTORY)/gamespy/common/gsCore.o\
- $(BIN_DIRECTORY)/gamespy/common/gsCrypt.o\
- $(BIN_DIRECTORY)/gamespy/common/gsLargeInt.o\
- $(BIN_DIRECTORY)/gamespy/common/gsStringUtil.o\
- $(BIN_DIRECTORY)/gamespy/common/gsPlatform.o\
- $(BIN_DIRECTORY)/gamespy/common/gsPlatformSocket.o\
- $(BIN_DIRECTORY)/gamespy/common/gsPlatformThread.o\
- $(BIN_DIRECTORY)/gamespy/common/gsPlatformUtil.o\
- $(BIN_DIRECTORY)/gamespy/common/gsMemory.o\
- $(BIN_DIRECTORY)/gamespy/common/gsXML.o\
- $(BIN_DIRECTORY)/gamespy/common/gsSHA1.o\
- $(BIN_DIRECTORY)/gamespy/common/gsRC4.o\
- $(BIN_DIRECTORY)/gamespy/common/gsSSL.o\
- $(BIN_DIRECTORY)/gamespy/common/gsSoap.o\
- $(BIN_DIRECTORY)/gamespy/common/gsUdpEngine.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpBuffer.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpCallbacks.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpConnection.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpEncryption.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpMain.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpProcess.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpCommon.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpPost.o\
- $(BIN_DIRECTORY)/gamespy/ghttp/ghttpc/ghttpc.o\
- $(BIN_DIRECTORY)/gamespy/GP/gp.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpi.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiBuddy.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiBuffer.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiCallback.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiConnect.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiInfo.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiKeys.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiOperation.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiPeer.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiProfile.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiSearch.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiUnique.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiUtility.o\
- $(BIN_DIRECTORY)/gamespy/GP/gpiTransfer.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Auth.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Buffer.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Callback.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Connection.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Encode.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Filter.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Main.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Message.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Socket.o\
- $(BIN_DIRECTORY)/gamespy/gt2/gt2Utility.o\
- $(BIN_DIRECTORY)/gamespy/sake/sakeMain.o\
- $(BIN_DIRECTORY)/gamespy/sake/sakeRequest.o\
- $(BIN_DIRECTORY)/gamespy/sake/sakeRequestMisc.o\
- $(BIN_DIRECTORY)/gamespy/sake/sakeRequestModify.o\
- $(BIN_DIRECTORY)/gamespy/sake/sakeRequestRead.o
-
-
-
-$(TARGET_NAME): $(GAMESPY_OBJS) $(FASTCGI_OBJS) $(MP_GPPROF_OBJS)
- $(CPP) $(CURR_CPPFLAGS) $(GAMESPY_OBJS) $(FASTCGI_OBJS) $(MP_GPPROF_OBJS) -o $@
-
-$(BIN_DIRECTORY)/%.o: %.c
- $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@
-
-$(BIN_DIRECTORY)/%.o: %.cpp
- $(CPP) $(CURR_CPPFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@
-
-$(BIN_DIRECTORY)/gamespy/%.o: $(GAMESPY_LIB_DIR)/%.c
- $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@
-
-$(BIN_DIRECTORY)/libfcgi/%.o: $(FASTCGI_LIB_DIR)/libfcgi/%.c
- $(CC) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@
-
-$(BIN_DIRECTORY)/libfcgi/%.o: $(FASTCGI_LIB_DIR)/libfcgi/%.cpp
- $(CPP) $(CURR_CFLAGS) -I$(FASTCGI_LIB_DIR) -I$(FASTCGI_LIB_DIR)/include -I$(GAMESPY_LIB_DIR) -c $< -o $@
-
-
-clean:
- find ./ -name "*.o" | xargs rm -f
- rm -f $(TARGET_NAME)
-all: $(TARGET_NAME)
-
-install: $(TARGET_NAME)
- mkdir $(INSTALL_DIR)
- cp $(TARGET_NAME) $(INSTALL_DIR)/mp_gpprof_server
- cp $(ROOT_DIR)/$(INITD_SCRIPT) $(INITD_DIR)/$(INITD_SCRIPT)
- chkconfig -a $(INITD_SCRIPT)
- $(INITD_DIR)/$(INITD_SCRIPT) start
-
-uninstall:
- $(INITD_DIR)/$(INITD_SCRIPT) stop
- rm -f $(INSTALL_DIR)/mp_gpprof_server
- rmdir $(INSTALL_DIR)
- rm -f $(INITD_DIR)/$(INITD_SCRIPT)
diff --git a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c b/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c
deleted file mode 100644
index 31b81a1e58c..00000000000
--- a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.c
+++ /dev/null
@@ -1,656 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// GameSpy ATLAS Competition System Source File
-//
-// NOTE: This is an auto-generated file, do not edit this file directly.
-///////////////////////////////////////////////////////////////////////////////
-
-#include
-#include "atlas_stalkercoppc_v1.h"
-
-int atlas_rule_set_version = 1;
-
-int ATLAS_GET_KEY(char* keyName)
-{
- if (!keyName)
- return 0;
-
- if (!strcmp("KEY_BestScore_KillsInRow", keyName))
- return KEY_BestScore_KillsInRow;
- if (!strcmp("KEY_BestScore_KnifeKillsInRow", keyName))
- return KEY_BestScore_KnifeKillsInRow;
- if (!strcmp("KEY_BestScore_BackstabsKillsInRow", keyName))
- return KEY_BestScore_BackstabsKillsInRow;
- if (!strcmp("KEY_BestScore_HeadshotsKillsInRow", keyName))
- return KEY_BestScore_HeadshotsKillsInRow;
- if (!strcmp("KEY_BestScore_EyeKillsInRow", keyName))
- return KEY_BestScore_EyeKillsInRow;
- if (!strcmp("KEY_BestScore_BleedKillsInRow", keyName))
- return KEY_BestScore_BleedKillsInRow;
- if (!strcmp("KEY_BestScore_ExplosiveKillsInRow", keyName))
- return KEY_BestScore_ExplosiveKillsInRow;
- if (!strcmp("KEY_AwardMasscare", keyName))
- return KEY_AwardMasscare;
- if (!strcmp("KEY_AwardMasscareLastRewardDate", keyName))
- return KEY_AwardMasscareLastRewardDate;
- if (!strcmp("KEY_AwardParanoia", keyName))
- return KEY_AwardParanoia;
- if (!strcmp("KEY_AwardParanoiaLastRewardDate", keyName))
- return KEY_AwardParanoiaLastRewardDate;
- if (!strcmp("KEY_AwardOverwhelmingSuperiority", keyName))
- return KEY_AwardOverwhelmingSuperiority;
- if (!strcmp("KEY_AwardOverwhelmingSuperiorityLastRewardDate", keyName))
- return KEY_AwardOverwhelmingSuperiorityLastRewardDate;
- if (!strcmp("KEY_AwardBlitzkrieg", keyName))
- return KEY_AwardBlitzkrieg;
- if (!strcmp("KEY_AwardBlitzkriegLastRewardDate", keyName))
- return KEY_AwardBlitzkriegLastRewardDate;
- if (!strcmp("KEY_AwardDryVictory", keyName))
- return KEY_AwardDryVictory;
- if (!strcmp("KEY_AwardDryVictoryLastRewardDate", keyName))
- return KEY_AwardDryVictoryLastRewardDate;
- if (!strcmp("KEY_AwardMultichampion", keyName))
- return KEY_AwardMultichampion;
- if (!strcmp("KEY_AwardMultichampionLastRewardDate", keyName))
- return KEY_AwardMultichampionLastRewardDate;
- if (!strcmp("KEY_AwardMad", keyName))
- return KEY_AwardMad;
- if (!strcmp("KEY_AwardMadLastRewardDate", keyName))
- return KEY_AwardMadLastRewardDate;
- if (!strcmp("KEY_AwardAchillesHeel", keyName))
- return KEY_AwardAchillesHeel;
- if (!strcmp("KEY_AwardAchillesHeelLastRewardDate", keyName))
- return KEY_AwardAchillesHeelLastRewardDate;
- if (!strcmp("KEY_AwardFasterThanBullets", keyName))
- return KEY_AwardFasterThanBullets;
- if (!strcmp("KEY_AwardFasterThanBulletsLastRewardDate", keyName))
- return KEY_AwardFasterThanBulletsLastRewardDate;
- if (!strcmp("KEY_AwardHarvestTime", keyName))
- return KEY_AwardHarvestTime;
- if (!strcmp("KEY_AwardHarvestTimeLastRewardDate", keyName))
- return KEY_AwardHarvestTimeLastRewardDate;
- if (!strcmp("KEY_AwardSkewer", keyName))
- return KEY_AwardSkewer;
- if (!strcmp("KEY_AwardSkewerLastRewardDate", keyName))
- return KEY_AwardSkewerLastRewardDate;
- if (!strcmp("KEY_AwardDoubleShotDoubleKill", keyName))
- return KEY_AwardDoubleShotDoubleKill;
- if (!strcmp("KEY_AwardDoubleShotDoubleKillLastRewardDate", keyName))
- return KEY_AwardDoubleShotDoubleKillLastRewardDate;
- if (!strcmp("KEY_AwardClimber", keyName))
- return KEY_AwardClimber;
- if (!strcmp("KEY_AwardClimberLastRewardDate", keyName))
- return KEY_AwardClimberLastRewardDate;
- if (!strcmp("KEY_AwardOpener", keyName))
- return KEY_AwardOpener;
- if (!strcmp("KEY_AwardOpenerLastRewardDate", keyName))
- return KEY_AwardOpenerLastRewardDate;
- if (!strcmp("KEY_AwardToughy", keyName))
- return KEY_AwardToughy;
- if (!strcmp("KEY_AwardToughyLastRewardDate", keyName))
- return KEY_AwardToughyLastRewardDate;
- if (!strcmp("KEY_AwardInvincibleFury", keyName))
- return KEY_AwardInvincibleFury;
- if (!strcmp("KEY_AwardInvincibleFuryLastRewardDate", keyName))
- return KEY_AwardInvincibleFuryLastRewardDate;
- if (!strcmp("KEY_AwardOculist", keyName))
- return KEY_AwardOculist;
- if (!strcmp("KEY_AwardOculistLastRewardDate", keyName))
- return KEY_AwardOculistLastRewardDate;
- if (!strcmp("KEY_AwardLightingReflexes", keyName))
- return KEY_AwardLightingReflexes;
- if (!strcmp("KEY_AwardLightingReflexesLastRewardDate", keyName))
- return KEY_AwardLightingReflexesLastRewardDate;
- if (!strcmp("KEY_AwardSprinterStopper", keyName))
- return KEY_AwardSprinterStopper;
- if (!strcmp("KEY_AwardSprinterStopperLastRewardDate", keyName))
- return KEY_AwardSprinterStopperLastRewardDate;
- if (!strcmp("KEY_AwardMarksMan", keyName))
- return KEY_AwardMarksMan;
- if (!strcmp("KEY_AwardMarksManLastRewardDate", keyName))
- return KEY_AwardMarksManLastRewardDate;
- if (!strcmp("KEY_AwardPeaceAmbassador", keyName))
- return KEY_AwardPeaceAmbassador;
- if (!strcmp("KEY_AwardPeaceAmbassadorLastRewardDate", keyName))
- return KEY_AwardPeaceAmbassadorLastRewardDate;
- if (!strcmp("KEY_AwardDeadlyAccuracy", keyName))
- return KEY_AwardDeadlyAccuracy;
- if (!strcmp("KEY_AwardDeadlyAccuracyLastRewardDate", keyName))
- return KEY_AwardDeadlyAccuracyLastRewardDate;
- if (!strcmp("KEY_AwardRemembrance", keyName))
- return KEY_AwardRemembrance;
- if (!strcmp("KEY_AwardRemembranceLastRewardDate", keyName))
- return KEY_AwardRemembranceLastRewardDate;
- if (!strcmp("KEY_AwardAvenger", keyName))
- return KEY_AwardAvenger;
- if (!strcmp("KEY_AwardAvengerLastRewardDate", keyName))
- return KEY_AwardAvengerLastRewardDate;
- if (!strcmp("KEY_AwardCherub", keyName))
- return KEY_AwardCherub;
- if (!strcmp("KEY_AwardCherubLastRewardDate", keyName))
- return KEY_AwardCherubLastRewardDate;
- if (!strcmp("KEY_AwardDignity", keyName))
- return KEY_AwardDignity;
- if (!strcmp("KEY_AwardDignityLastRewardDate", keyName))
- return KEY_AwardDignityLastRewardDate;
- if (!strcmp("KEY_AwardStalkerFlair", keyName))
- return KEY_AwardStalkerFlair;
- if (!strcmp("KEY_AwardStalkerFlairLastRewardDate", keyName))
- return KEY_AwardStalkerFlairLastRewardDate;
- if (!strcmp("KEY_AwardLucky", keyName))
- return KEY_AwardLucky;
- if (!strcmp("KEY_AwardLuckyLastRewardDate", keyName))
- return KEY_AwardLuckyLastRewardDate;
- if (!strcmp("KEY_AwardBlackList", keyName))
- return KEY_AwardBlackList;
- if (!strcmp("KEY_AwardBlackListLastRewardDate", keyName))
- return KEY_AwardBlackListLastRewardDate;
- if (!strcmp("KEY_AwardSilentDeath", keyName))
- return KEY_AwardSilentDeath;
- if (!strcmp("KEY_AwardSilentDeathLastRewardDate", keyName))
- return KEY_AwardSilentDeathLastRewardDate;
- if (!strcmp("KEY_PlayerName", keyName))
- return KEY_PlayerName;
-
- return 0;
-}
-
-char* ATLAS_GET_KEY_NAME(int keyId)
-{
- if (keyId <= 0)
- return "";
-
- if (keyId == KEY_BestScore_KillsInRow)
- return "KEY_BestScore_KillsInRow";
- if (keyId == KEY_BestScore_KnifeKillsInRow)
- return "KEY_BestScore_KnifeKillsInRow";
- if (keyId == KEY_BestScore_BackstabsKillsInRow)
- return "KEY_BestScore_BackstabsKillsInRow";
- if (keyId == KEY_BestScore_HeadshotsKillsInRow)
- return "KEY_BestScore_HeadshotsKillsInRow";
- if (keyId == KEY_BestScore_EyeKillsInRow)
- return "KEY_BestScore_EyeKillsInRow";
- if (keyId == KEY_BestScore_BleedKillsInRow)
- return "KEY_BestScore_BleedKillsInRow";
- if (keyId == KEY_BestScore_ExplosiveKillsInRow)
- return "KEY_BestScore_ExplosiveKillsInRow";
- if (keyId == KEY_AwardMasscare)
- return "KEY_AwardMasscare";
- if (keyId == KEY_AwardMasscareLastRewardDate)
- return "KEY_AwardMasscareLastRewardDate";
- if (keyId == KEY_AwardParanoia)
- return "KEY_AwardParanoia";
- if (keyId == KEY_AwardParanoiaLastRewardDate)
- return "KEY_AwardParanoiaLastRewardDate";
- if (keyId == KEY_AwardOverwhelmingSuperiority)
- return "KEY_AwardOverwhelmingSuperiority";
- if (keyId == KEY_AwardOverwhelmingSuperiorityLastRewardDate)
- return "KEY_AwardOverwhelmingSuperiorityLastRewardDate";
- if (keyId == KEY_AwardBlitzkrieg)
- return "KEY_AwardBlitzkrieg";
- if (keyId == KEY_AwardBlitzkriegLastRewardDate)
- return "KEY_AwardBlitzkriegLastRewardDate";
- if (keyId == KEY_AwardDryVictory)
- return "KEY_AwardDryVictory";
- if (keyId == KEY_AwardDryVictoryLastRewardDate)
- return "KEY_AwardDryVictoryLastRewardDate";
- if (keyId == KEY_AwardMultichampion)
- return "KEY_AwardMultichampion";
- if (keyId == KEY_AwardMultichampionLastRewardDate)
- return "KEY_AwardMultichampionLastRewardDate";
- if (keyId == KEY_AwardMad)
- return "KEY_AwardMad";
- if (keyId == KEY_AwardMadLastRewardDate)
- return "KEY_AwardMadLastRewardDate";
- if (keyId == KEY_AwardAchillesHeel)
- return "KEY_AwardAchillesHeel";
- if (keyId == KEY_AwardAchillesHeelLastRewardDate)
- return "KEY_AwardAchillesHeelLastRewardDate";
- if (keyId == KEY_AwardFasterThanBullets)
- return "KEY_AwardFasterThanBullets";
- if (keyId == KEY_AwardFasterThanBulletsLastRewardDate)
- return "KEY_AwardFasterThanBulletsLastRewardDate";
- if (keyId == KEY_AwardHarvestTime)
- return "KEY_AwardHarvestTime";
- if (keyId == KEY_AwardHarvestTimeLastRewardDate)
- return "KEY_AwardHarvestTimeLastRewardDate";
- if (keyId == KEY_AwardSkewer)
- return "KEY_AwardSkewer";
- if (keyId == KEY_AwardSkewerLastRewardDate)
- return "KEY_AwardSkewerLastRewardDate";
- if (keyId == KEY_AwardDoubleShotDoubleKill)
- return "KEY_AwardDoubleShotDoubleKill";
- if (keyId == KEY_AwardDoubleShotDoubleKillLastRewardDate)
- return "KEY_AwardDoubleShotDoubleKillLastRewardDate";
- if (keyId == KEY_AwardClimber)
- return "KEY_AwardClimber";
- if (keyId == KEY_AwardClimberLastRewardDate)
- return "KEY_AwardClimberLastRewardDate";
- if (keyId == KEY_AwardOpener)
- return "KEY_AwardOpener";
- if (keyId == KEY_AwardOpenerLastRewardDate)
- return "KEY_AwardOpenerLastRewardDate";
- if (keyId == KEY_AwardToughy)
- return "KEY_AwardToughy";
- if (keyId == KEY_AwardToughyLastRewardDate)
- return "KEY_AwardToughyLastRewardDate";
- if (keyId == KEY_AwardInvincibleFury)
- return "KEY_AwardInvincibleFury";
- if (keyId == KEY_AwardInvincibleFuryLastRewardDate)
- return "KEY_AwardInvincibleFuryLastRewardDate";
- if (keyId == KEY_AwardOculist)
- return "KEY_AwardOculist";
- if (keyId == KEY_AwardOculistLastRewardDate)
- return "KEY_AwardOculistLastRewardDate";
- if (keyId == KEY_AwardLightingReflexes)
- return "KEY_AwardLightingReflexes";
- if (keyId == KEY_AwardLightingReflexesLastRewardDate)
- return "KEY_AwardLightingReflexesLastRewardDate";
- if (keyId == KEY_AwardSprinterStopper)
- return "KEY_AwardSprinterStopper";
- if (keyId == KEY_AwardSprinterStopperLastRewardDate)
- return "KEY_AwardSprinterStopperLastRewardDate";
- if (keyId == KEY_AwardMarksMan)
- return "KEY_AwardMarksMan";
- if (keyId == KEY_AwardMarksManLastRewardDate)
- return "KEY_AwardMarksManLastRewardDate";
- if (keyId == KEY_AwardPeaceAmbassador)
- return "KEY_AwardPeaceAmbassador";
- if (keyId == KEY_AwardPeaceAmbassadorLastRewardDate)
- return "KEY_AwardPeaceAmbassadorLastRewardDate";
- if (keyId == KEY_AwardDeadlyAccuracy)
- return "KEY_AwardDeadlyAccuracy";
- if (keyId == KEY_AwardDeadlyAccuracyLastRewardDate)
- return "KEY_AwardDeadlyAccuracyLastRewardDate";
- if (keyId == KEY_AwardRemembrance)
- return "KEY_AwardRemembrance";
- if (keyId == KEY_AwardRemembranceLastRewardDate)
- return "KEY_AwardRemembranceLastRewardDate";
- if (keyId == KEY_AwardAvenger)
- return "KEY_AwardAvenger";
- if (keyId == KEY_AwardAvengerLastRewardDate)
- return "KEY_AwardAvengerLastRewardDate";
- if (keyId == KEY_AwardCherub)
- return "KEY_AwardCherub";
- if (keyId == KEY_AwardCherubLastRewardDate)
- return "KEY_AwardCherubLastRewardDate";
- if (keyId == KEY_AwardDignity)
- return "KEY_AwardDignity";
- if (keyId == KEY_AwardDignityLastRewardDate)
- return "KEY_AwardDignityLastRewardDate";
- if (keyId == KEY_AwardStalkerFlair)
- return "KEY_AwardStalkerFlair";
- if (keyId == KEY_AwardStalkerFlairLastRewardDate)
- return "KEY_AwardStalkerFlairLastRewardDate";
- if (keyId == KEY_AwardLucky)
- return "KEY_AwardLucky";
- if (keyId == KEY_AwardLuckyLastRewardDate)
- return "KEY_AwardLuckyLastRewardDate";
- if (keyId == KEY_AwardBlackList)
- return "KEY_AwardBlackList";
- if (keyId == KEY_AwardBlackListLastRewardDate)
- return "KEY_AwardBlackListLastRewardDate";
- if (keyId == KEY_AwardSilentDeath)
- return "KEY_AwardSilentDeath";
- if (keyId == KEY_AwardSilentDeathLastRewardDate)
- return "KEY_AwardSilentDeathLastRewardDate";
- if (keyId == KEY_PlayerName)
- return "KEY_PlayerName";
-
- return "";
-}
-
-int ATLAS_GET_STAT(char* statName)
-{
- if (!statName)
- return 0;
-
- if (!strcmp("STAT_AwardAchillesHeel", statName))
- return STAT_AwardAchillesHeel;
- if (!strcmp("STAT_AwardAchillesHeelLastRewardDate", statName))
- return STAT_AwardAchillesHeelLastRewardDate;
- if (!strcmp("STAT_AwardAvenger", statName))
- return STAT_AwardAvenger;
- if (!strcmp("STAT_AwardAvengerLastRewardDate", statName))
- return STAT_AwardAvengerLastRewardDate;
- if (!strcmp("STAT_AwardBlackList", statName))
- return STAT_AwardBlackList;
- if (!strcmp("STAT_AwardBlackListLastRewardDate", statName))
- return STAT_AwardBlackListLastRewardDate;
- if (!strcmp("STAT_AwardBlitzkrieg", statName))
- return STAT_AwardBlitzkrieg;
- if (!strcmp("STAT_AwardBlitzkriegLastRewardDate", statName))
- return STAT_AwardBlitzkriegLastRewardDate;
- if (!strcmp("STAT_AwardCherub", statName))
- return STAT_AwardCherub;
- if (!strcmp("STAT_AwardCherubLastRewardDate", statName))
- return STAT_AwardCherubLastRewardDate;
- if (!strcmp("STAT_AwardClimber", statName))
- return STAT_AwardClimber;
- if (!strcmp("STAT_AwardClimberLastRewardDate", statName))
- return STAT_AwardClimberLastRewardDate;
- if (!strcmp("STAT_AwardDeadlyAccuracy", statName))
- return STAT_AwardDeadlyAccuracy;
- if (!strcmp("STAT_AwardDeadlyAccuracyLastRewardDate", statName))
- return STAT_AwardDeadlyAccuracyLastRewardDate;
- if (!strcmp("STAT_AwardDignity", statName))
- return STAT_AwardDignity;
- if (!strcmp("STAT_AwardDignityLastRewardDate", statName))
- return STAT_AwardDignityLastRewardDate;
- if (!strcmp("STAT_AwardDoubleShotDoubleKill", statName))
- return STAT_AwardDoubleShotDoubleKill;
- if (!strcmp("STAT_AwardDoubleShotDoubleKillLastRewardDate", statName))
- return STAT_AwardDoubleShotDoubleKillLastRewardDate;
- if (!strcmp("STAT_AwardDryVictory", statName))
- return STAT_AwardDryVictory;
- if (!strcmp("STAT_AwardDryVictoryLastRewardDate", statName))
- return STAT_AwardDryVictoryLastRewardDate;
- if (!strcmp("STAT_AwardFasterThanBullets", statName))
- return STAT_AwardFasterThanBullets;
- if (!strcmp("STAT_AwardFasterThanBulletsLastRewardDate", statName))
- return STAT_AwardFasterThanBulletsLastRewardDate;
- if (!strcmp("STAT_AwardHarvestTime", statName))
- return STAT_AwardHarvestTime;
- if (!strcmp("STAT_AwardHarvestTimeLastRewardDate", statName))
- return STAT_AwardHarvestTimeLastRewardDate;
- if (!strcmp("STAT_AwardInvincibleFury", statName))
- return STAT_AwardInvincibleFury;
- if (!strcmp("STAT_AwardInvincibleFuryLastRewardDate", statName))
- return STAT_AwardInvincibleFuryLastRewardDate;
- if (!strcmp("STAT_AwardLightingReflexes", statName))
- return STAT_AwardLightingReflexes;
- if (!strcmp("STAT_AwardLightingReflexesLastRewardDate", statName))
- return STAT_AwardLightingReflexesLastRewardDate;
- if (!strcmp("STAT_AwardLucky", statName))
- return STAT_AwardLucky;
- if (!strcmp("STAT_AwardLuckyLastRewardDate", statName))
- return STAT_AwardLuckyLastRewardDate;
- if (!strcmp("STAT_AwardMad", statName))
- return STAT_AwardMad;
- if (!strcmp("STAT_AwardMadLastRewardDate", statName))
- return STAT_AwardMadLastRewardDate;
- if (!strcmp("STAT_AwardMarksman", statName))
- return STAT_AwardMarksman;
- if (!strcmp("STAT_AwardMarksmanLastRewardDate", statName))
- return STAT_AwardMarksmanLastRewardDate;
- if (!strcmp("STAT_AwardMasscare", statName))
- return STAT_AwardMasscare;
- if (!strcmp("STAT_AwardMasscareLastRewardDate", statName))
- return STAT_AwardMasscareLastRewardDate;
- if (!strcmp("STAT_AwardMultichampion", statName))
- return STAT_AwardMultichampion;
- if (!strcmp("STAT_AwardMultichampionLastRewardDate", statName))
- return STAT_AwardMultichampionLastRewardDate;
- if (!strcmp("STAT_AwardOculist", statName))
- return STAT_AwardOculist;
- if (!strcmp("STAT_AwardOculistLastRewardDate", statName))
- return STAT_AwardOculistLastRewardDate;
- if (!strcmp("STAT_AwardOpener", statName))
- return STAT_AwardOpener;
- if (!strcmp("STAT_AwardOpenerLastRewardDate", statName))
- return STAT_AwardOpenerLastRewardDate;
- if (!strcmp("STAT_AwardOwerwhelmingSuperiority", statName))
- return STAT_AwardOwerwhelmingSuperiority;
- if (!strcmp("STAT_AwardOwerwhelmingSuperiorityLastRewardDate", statName))
- return STAT_AwardOwerwhelmingSuperiorityLastRewardDate;
- if (!strcmp("STAT_AwardParanoia", statName))
- return STAT_AwardParanoia;
- if (!strcmp("STAT_AwardParanoiaLastRewardDate", statName))
- return STAT_AwardParanoiaLastRewardDate;
- if (!strcmp("STAT_AwardPeaceAmbassador", statName))
- return STAT_AwardPeaceAmbassador;
- if (!strcmp("STAT_AwardPeaceAmbassadorLastRewardDate", statName))
- return STAT_AwardPeaceAmbassadorLastRewardDate;
- if (!strcmp("STAT_AwardRemembrance", statName))
- return STAT_AwardRemembrance;
- if (!strcmp("STAT_AwardRemembranceLastRewardDate", statName))
- return STAT_AwardRemembranceLastRewardDate;
- if (!strcmp("STAT_AwardSilentDeath", statName))
- return STAT_AwardSilentDeath;
- if (!strcmp("STAT_AwardSilentDeathLastRewardDate", statName))
- return STAT_AwardSilentDeathLastRewardDate;
- if (!strcmp("STAT_AwardSkewer", statName))
- return STAT_AwardSkewer;
- if (!strcmp("STAT_AwardSkewerLastRewardDate", statName))
- return STAT_AwardSkewerLastRewardDate;
- if (!strcmp("STAT_AwardSprinterStopper", statName))
- return STAT_AwardSprinterStopper;
- if (!strcmp("STAT_AwardSprinterStopperLastRewardDate", statName))
- return STAT_AwardSprinterStopperLastRewardDate;
- if (!strcmp("STAT_AwardStalkerFlair", statName))
- return STAT_AwardStalkerFlair;
- if (!strcmp("STAT_AwardStalkerFlairLastRewardDate", statName))
- return STAT_AwardStalkerFlairLastRewardDate;
- if (!strcmp("STAT_AwardToughy", statName))
- return STAT_AwardToughy;
- if (!strcmp("STAT_AwardToughyLastRewardDate", statName))
- return STAT_AwardToughyLastRewardDate;
- if (!strcmp("STAT_BestScore_BackstabsKillsInRow", statName))
- return STAT_BestScore_BackstabsKillsInRow;
- if (!strcmp("STAT_BestScore_BleedKillsInRow", statName))
- return STAT_BestScore_BleedKillsInRow;
- if (!strcmp("STAT_BestScore_ExplosiveKillsInRow", statName))
- return STAT_BestScore_ExplosiveKillsInRow;
- if (!strcmp("STAT_BestScore_EyeKillsInRow", statName))
- return STAT_BestScore_EyeKillsInRow;
- if (!strcmp("STAT_BestScore_HeadshotsKillsInRow", statName))
- return STAT_BestScore_HeadshotsKillsInRow;
- if (!strcmp("STAT_BestScore_KillsInRow", statName))
- return STAT_BestScore_KillsInRow;
- if (!strcmp("STAT_BestScore_KnifeKillsInRow", statName))
- return STAT_BestScore_KnifeKillsInRow;
- if (!strcmp("STAT_PlayerName", statName))
- return STAT_PlayerName;
-
- return 0;
-}
-char* ATLAS_GET_STAT_NAME(int statId)
-{
- if (statId <= 0)
- return "";
-
- if (statId == STAT_AwardAchillesHeel)
- return "STAT_AwardAchillesHeel";
- if (statId == STAT_AwardAchillesHeelLastRewardDate)
- return "STAT_AwardAchillesHeelLastRewardDate";
- if (statId == STAT_AwardAvenger)
- return "STAT_AwardAvenger";
- if (statId == STAT_AwardAvengerLastRewardDate)
- return "STAT_AwardAvengerLastRewardDate";
- if (statId == STAT_AwardBlackList)
- return "STAT_AwardBlackList";
- if (statId == STAT_AwardBlackListLastRewardDate)
- return "STAT_AwardBlackListLastRewardDate";
- if (statId == STAT_AwardBlitzkrieg)
- return "STAT_AwardBlitzkrieg";
- if (statId == STAT_AwardBlitzkriegLastRewardDate)
- return "STAT_AwardBlitzkriegLastRewardDate";
- if (statId == STAT_AwardCherub)
- return "STAT_AwardCherub";
- if (statId == STAT_AwardCherubLastRewardDate)
- return "STAT_AwardCherubLastRewardDate";
- if (statId == STAT_AwardClimber)
- return "STAT_AwardClimber";
- if (statId == STAT_AwardClimberLastRewardDate)
- return "STAT_AwardClimberLastRewardDate";
- if (statId == STAT_AwardDeadlyAccuracy)
- return "STAT_AwardDeadlyAccuracy";
- if (statId == STAT_AwardDeadlyAccuracyLastRewardDate)
- return "STAT_AwardDeadlyAccuracyLastRewardDate";
- if (statId == STAT_AwardDignity)
- return "STAT_AwardDignity";
- if (statId == STAT_AwardDignityLastRewardDate)
- return "STAT_AwardDignityLastRewardDate";
- if (statId == STAT_AwardDoubleShotDoubleKill)
- return "STAT_AwardDoubleShotDoubleKill";
- if (statId == STAT_AwardDoubleShotDoubleKillLastRewardDate)
- return "STAT_AwardDoubleShotDoubleKillLastRewardDate";
- if (statId == STAT_AwardDryVictory)
- return "STAT_AwardDryVictory";
- if (statId == STAT_AwardDryVictoryLastRewardDate)
- return "STAT_AwardDryVictoryLastRewardDate";
- if (statId == STAT_AwardFasterThanBullets)
- return "STAT_AwardFasterThanBullets";
- if (statId == STAT_AwardFasterThanBulletsLastRewardDate)
- return "STAT_AwardFasterThanBulletsLastRewardDate";
- if (statId == STAT_AwardHarvestTime)
- return "STAT_AwardHarvestTime";
- if (statId == STAT_AwardHarvestTimeLastRewardDate)
- return "STAT_AwardHarvestTimeLastRewardDate";
- if (statId == STAT_AwardInvincibleFury)
- return "STAT_AwardInvincibleFury";
- if (statId == STAT_AwardInvincibleFuryLastRewardDate)
- return "STAT_AwardInvincibleFuryLastRewardDate";
- if (statId == STAT_AwardLightingReflexes)
- return "STAT_AwardLightingReflexes";
- if (statId == STAT_AwardLightingReflexesLastRewardDate)
- return "STAT_AwardLightingReflexesLastRewardDate";
- if (statId == STAT_AwardLucky)
- return "STAT_AwardLucky";
- if (statId == STAT_AwardLuckyLastRewardDate)
- return "STAT_AwardLuckyLastRewardDate";
- if (statId == STAT_AwardMad)
- return "STAT_AwardMad";
- if (statId == STAT_AwardMadLastRewardDate)
- return "STAT_AwardMadLastRewardDate";
- if (statId == STAT_AwardMarksman)
- return "STAT_AwardMarksman";
- if (statId == STAT_AwardMarksmanLastRewardDate)
- return "STAT_AwardMarksmanLastRewardDate";
- if (statId == STAT_AwardMasscare)
- return "STAT_AwardMasscare";
- if (statId == STAT_AwardMasscareLastRewardDate)
- return "STAT_AwardMasscareLastRewardDate";
- if (statId == STAT_AwardMultichampion)
- return "STAT_AwardMultichampion";
- if (statId == STAT_AwardMultichampionLastRewardDate)
- return "STAT_AwardMultichampionLastRewardDate";
- if (statId == STAT_AwardOculist)
- return "STAT_AwardOculist";
- if (statId == STAT_AwardOculistLastRewardDate)
- return "STAT_AwardOculistLastRewardDate";
- if (statId == STAT_AwardOpener)
- return "STAT_AwardOpener";
- if (statId == STAT_AwardOpenerLastRewardDate)
- return "STAT_AwardOpenerLastRewardDate";
- if (statId == STAT_AwardOwerwhelmingSuperiority)
- return "STAT_AwardOwerwhelmingSuperiority";
- if (statId == STAT_AwardOwerwhelmingSuperiorityLastRewardDate)
- return "STAT_AwardOwerwhelmingSuperiorityLastRewardDate";
- if (statId == STAT_AwardParanoia)
- return "STAT_AwardParanoia";
- if (statId == STAT_AwardParanoiaLastRewardDate)
- return "STAT_AwardParanoiaLastRewardDate";
- if (statId == STAT_AwardPeaceAmbassador)
- return "STAT_AwardPeaceAmbassador";
- if (statId == STAT_AwardPeaceAmbassadorLastRewardDate)
- return "STAT_AwardPeaceAmbassadorLastRewardDate";
- if (statId == STAT_AwardRemembrance)
- return "STAT_AwardRemembrance";
- if (statId == STAT_AwardRemembranceLastRewardDate)
- return "STAT_AwardRemembranceLastRewardDate";
- if (statId == STAT_AwardSilentDeath)
- return "STAT_AwardSilentDeath";
- if (statId == STAT_AwardSilentDeathLastRewardDate)
- return "STAT_AwardSilentDeathLastRewardDate";
- if (statId == STAT_AwardSkewer)
- return "STAT_AwardSkewer";
- if (statId == STAT_AwardSkewerLastRewardDate)
- return "STAT_AwardSkewerLastRewardDate";
- if (statId == STAT_AwardSprinterStopper)
- return "STAT_AwardSprinterStopper";
- if (statId == STAT_AwardSprinterStopperLastRewardDate)
- return "STAT_AwardSprinterStopperLastRewardDate";
- if (statId == STAT_AwardStalkerFlair)
- return "STAT_AwardStalkerFlair";
- if (statId == STAT_AwardStalkerFlairLastRewardDate)
- return "STAT_AwardStalkerFlairLastRewardDate";
- if (statId == STAT_AwardToughy)
- return "STAT_AwardToughy";
- if (statId == STAT_AwardToughyLastRewardDate)
- return "STAT_AwardToughyLastRewardDate";
- if (statId == STAT_BestScore_BackstabsKillsInRow)
- return "STAT_BestScore_BackstabsKillsInRow";
- if (statId == STAT_BestScore_BleedKillsInRow)
- return "STAT_BestScore_BleedKillsInRow";
- if (statId == STAT_BestScore_ExplosiveKillsInRow)
- return "STAT_BestScore_ExplosiveKillsInRow";
- if (statId == STAT_BestScore_EyeKillsInRow)
- return "STAT_BestScore_EyeKillsInRow";
- if (statId == STAT_BestScore_HeadshotsKillsInRow)
- return "STAT_BestScore_HeadshotsKillsInRow";
- if (statId == STAT_BestScore_KillsInRow)
- return "STAT_BestScore_KillsInRow";
- if (statId == STAT_BestScore_KnifeKillsInRow)
- return "STAT_BestScore_KnifeKillsInRow";
- if (statId == STAT_PlayerName)
- return "STAT_PlayerName";
-
- return "";
-}
-
-int ATLAS_GET_STAT_PAGE_BY_ID(int statId)
-{
- if (statId <= 0)
- return 0;
-
- // PlayerStats
- if (statId == 1 || statId == 2 || statId == 3 || statId == 4 || statId == 5 || statId == 6 || statId == 7 ||
- statId == 8 || statId == 9 || statId == 10 || statId == 11 || statId == 12 || statId == 13 || statId == 14 ||
- statId == 15 || statId == 16 || statId == 17 || statId == 18 || statId == 19 || statId == 20 || statId == 21 ||
- statId == 22 || statId == 23 || statId == 24 || statId == 25 || statId == 26 || statId == 27 || statId == 28 ||
- statId == 29 || statId == 30 || statId == 31 || statId == 32 || statId == 33 || statId == 34 || statId == 35 ||
- statId == 36 || statId == 37 || statId == 38 || statId == 39 || statId == 40 || statId == 41 || statId == 42 ||
- statId == 43 || statId == 44 || statId == 45 || statId == 46 || statId == 47 || statId == 48 || statId == 49 ||
- statId == 50 || statId == 51 || statId == 52 || statId == 53 || statId == 54 || statId == 55 || statId == 56 ||
- statId == 57 || statId == 58 || statId == 59 || statId == 60 || statId == 61 || statId == 62 || statId == 63 ||
- statId == 64 || statId == 65 || statId == 66 || statId == 67 || statId == 68)
- return 1;
-
- return 0;
-}
-
-int ATLAS_GET_STAT_PAGE_BY_NAME(char* statName)
-{
- if (!statName)
- return 0;
-
- // PlayerStats
- if (!strcmp("STAT_AwardAchillesHeel", statName) || !strcmp("STAT_AwardAchillesHeelLastRewardDate", statName) ||
- !strcmp("STAT_AwardAvenger", statName) || !strcmp("STAT_AwardAvengerLastRewardDate", statName) ||
- !strcmp("STAT_AwardBlackList", statName) || !strcmp("STAT_AwardBlackListLastRewardDate", statName) ||
- !strcmp("STAT_AwardBlitzkrieg", statName) || !strcmp("STAT_AwardBlitzkriegLastRewardDate", statName) ||
- !strcmp("STAT_AwardCherub", statName) || !strcmp("STAT_AwardCherubLastRewardDate", statName) ||
- !strcmp("STAT_AwardClimber", statName) || !strcmp("STAT_AwardClimberLastRewardDate", statName) ||
- !strcmp("STAT_AwardDeadlyAccuracy", statName) || !strcmp("STAT_AwardDeadlyAccuracyLastRewardDate", statName) ||
- !strcmp("STAT_AwardDignity", statName) || !strcmp("STAT_AwardDignityLastRewardDate", statName) ||
- !strcmp("STAT_AwardDoubleShotDoubleKill", statName) ||
- !strcmp("STAT_AwardDoubleShotDoubleKillLastRewardDate", statName) || !strcmp("STAT_AwardDryVictory", statName) ||
- !strcmp("STAT_AwardDryVictoryLastRewardDate", statName) || !strcmp("STAT_AwardFasterThanBullets", statName) ||
- !strcmp("STAT_AwardFasterThanBulletsLastRewardDate", statName) || !strcmp("STAT_AwardHarvestTime", statName) ||
- !strcmp("STAT_AwardHarvestTimeLastRewardDate", statName) || !strcmp("STAT_AwardInvincibleFury", statName) ||
- !strcmp("STAT_AwardInvincibleFuryLastRewardDate", statName) || !strcmp("STAT_AwardLightingReflexes", statName) ||
- !strcmp("STAT_AwardLightingReflexesLastRewardDate", statName) || !strcmp("STAT_AwardLucky", statName) ||
- !strcmp("STAT_AwardLuckyLastRewardDate", statName) || !strcmp("STAT_AwardMad", statName) ||
- !strcmp("STAT_AwardMadLastRewardDate", statName) || !strcmp("STAT_AwardMarksman", statName) ||
- !strcmp("STAT_AwardMarksmanLastRewardDate", statName) || !strcmp("STAT_AwardMasscare", statName) ||
- !strcmp("STAT_AwardMasscareLastRewardDate", statName) || !strcmp("STAT_AwardMultichampion", statName) ||
- !strcmp("STAT_AwardMultichampionLastRewardDate", statName) || !strcmp("STAT_AwardOculist", statName) ||
- !strcmp("STAT_AwardOculistLastRewardDate", statName) || !strcmp("STAT_AwardOpener", statName) ||
- !strcmp("STAT_AwardOpenerLastRewardDate", statName) || !strcmp("STAT_AwardOwerwhelmingSuperiority", statName) ||
- !strcmp("STAT_AwardOwerwhelmingSuperiorityLastRewardDate", statName) || !strcmp("STAT_AwardParanoia", statName) ||
- !strcmp("STAT_AwardParanoiaLastRewardDate", statName) || !strcmp("STAT_AwardPeaceAmbassador", statName) ||
- !strcmp("STAT_AwardPeaceAmbassadorLastRewardDate", statName) || !strcmp("STAT_AwardRemembrance", statName) ||
- !strcmp("STAT_AwardRemembranceLastRewardDate", statName) || !strcmp("STAT_AwardSilentDeath", statName) ||
- !strcmp("STAT_AwardSilentDeathLastRewardDate", statName) || !strcmp("STAT_AwardSkewer", statName) ||
- !strcmp("STAT_AwardSkewerLastRewardDate", statName) || !strcmp("STAT_AwardSprinterStopper", statName) ||
- !strcmp("STAT_AwardSprinterStopperLastRewardDate", statName) || !strcmp("STAT_AwardStalkerFlair", statName) ||
- !strcmp("STAT_AwardStalkerFlairLastRewardDate", statName) || !strcmp("STAT_AwardToughy", statName) ||
- !strcmp("STAT_AwardToughyLastRewardDate", statName) || !strcmp("STAT_BestScore_BackstabsKillsInRow", statName) ||
- !strcmp("STAT_BestScore_BleedKillsInRow", statName) || !strcmp("STAT_BestScore_ExplosiveKillsInRow", statName) ||
- !strcmp("STAT_BestScore_EyeKillsInRow", statName) || !strcmp("STAT_BestScore_HeadshotsKillsInRow", statName) ||
- !strcmp("STAT_BestScore_KillsInRow", statName) || !strcmp("STAT_BestScore_KnifeKillsInRow", statName) ||
- !strcmp("STAT_PlayerName", statName))
- return 1;
-
- return 0;
-}
diff --git a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h b/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h
deleted file mode 100644
index 98d1431ac94..00000000000
--- a/src/utils/mp_gpprof_server/atlas_stalkercoppc_v1.h
+++ /dev/null
@@ -1,173 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// GameSpy ATLAS Competition System Header File
-//
-// NOTE: This is an auto-generated file, do not edit this file directly.
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef _ATLAS_STALKERCOPPC_V1_H_
-#define _ATLAS_STALKERCOPPC_V1_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int ATLAS_GET_KEY(char* keyName);
-extern char* ATLAS_GET_KEY_NAME(int keyId);
-extern int ATLAS_GET_STAT(char* statName);
-extern char* ATLAS_GET_STAT_NAME(int statId);
-extern int ATLAS_GET_STAT_PAGE_BY_ID(int statId);
-extern int ATLAS_GET_STAT_PAGE_BY_NAME(char* statName);
-
-#define ATLAS_RULE_SET_VERSION 1
-
-// KEYS
-// Use these key ID's to report match data for your game.
-
-#define KEY_BestScore_KillsInRow 3 // [TYPE: int] [DESC: kills in row]
-#define KEY_BestScore_KnifeKillsInRow 4 // [TYPE: int] [DESC: knife kills in row]
-#define KEY_BestScore_BackstabsKillsInRow 5 // [TYPE: int] [DESC: knife backstabs kills in row]
-#define KEY_BestScore_HeadshotsKillsInRow 6 // [TYPE: int] [DESC: headshots kills in row]
-#define KEY_BestScore_EyeKillsInRow 7 // [TYPE: int] [DESC: eye kills in row]
-#define KEY_BestScore_BleedKillsInRow 8 // [TYPE: int] [DESC: bleed kills in row]
-#define KEY_BestScore_ExplosiveKillsInRow 9 // [TYPE: int] [DESC: explosive kills in row]
-#define KEY_AwardMasscare 10 // [TYPE: int]
-#define KEY_AwardMasscareLastRewardDate 11 // [TYPE: int]
-#define KEY_AwardParanoia 12 // [TYPE: int]
-#define KEY_AwardParanoiaLastRewardDate 13 // [TYPE: int]
-#define KEY_AwardOverwhelmingSuperiority 14 // [TYPE: int]
-#define KEY_AwardOverwhelmingSuperiorityLastRewardDate 15 // [TYPE: int]
-#define KEY_AwardBlitzkrieg 16 // [TYPE: int]
-#define KEY_AwardBlitzkriegLastRewardDate 17 // [TYPE: int]
-#define KEY_AwardDryVictory 18 // [TYPE: int]
-#define KEY_AwardDryVictoryLastRewardDate 19 // [TYPE: int]
-#define KEY_AwardMultichampion 20 // [TYPE: int]
-#define KEY_AwardMultichampionLastRewardDate 21 // [TYPE: int]
-#define KEY_AwardMad 22 // [TYPE: int]
-#define KEY_AwardMadLastRewardDate 23 // [TYPE: int]
-#define KEY_AwardAchillesHeel 24 // [TYPE: int]
-#define KEY_AwardAchillesHeelLastRewardDate 25 // [TYPE: int]
-#define KEY_AwardFasterThanBullets 26 // [TYPE: int]
-#define KEY_AwardFasterThanBulletsLastRewardDate 27 // [TYPE: int]
-#define KEY_AwardHarvestTime 28 // [TYPE: int]
-#define KEY_AwardHarvestTimeLastRewardDate 29 // [TYPE: int]
-#define KEY_AwardSkewer 30 // [TYPE: int]
-#define KEY_AwardSkewerLastRewardDate 31 // [TYPE: int]
-#define KEY_AwardDoubleShotDoubleKill 32 // [TYPE: int]
-#define KEY_AwardDoubleShotDoubleKillLastRewardDate 33 // [TYPE: int]
-#define KEY_AwardClimber 34 // [TYPE: int]
-#define KEY_AwardClimberLastRewardDate 35 // [TYPE: int]
-#define KEY_AwardOpener 36 // [TYPE: int]
-#define KEY_AwardOpenerLastRewardDate 37 // [TYPE: int]
-#define KEY_AwardToughy 38 // [TYPE: int]
-#define KEY_AwardToughyLastRewardDate 39 // [TYPE: int]
-#define KEY_AwardInvincibleFury 40 // [TYPE: int]
-#define KEY_AwardInvincibleFuryLastRewardDate 41 // [TYPE: int]
-#define KEY_AwardOculist 42 // [TYPE: int]
-#define KEY_AwardOculistLastRewardDate 43 // [TYPE: int]
-#define KEY_AwardLightingReflexes 44 // [TYPE: int]
-#define KEY_AwardLightingReflexesLastRewardDate 45 // [TYPE: int]
-#define KEY_AwardSprinterStopper 46 // [TYPE: int]
-#define KEY_AwardSprinterStopperLastRewardDate 47 // [TYPE: int]
-#define KEY_AwardMarksMan 48 // [TYPE: int]
-#define KEY_AwardMarksManLastRewardDate 49 // [TYPE: int]
-#define KEY_AwardPeaceAmbassador 50 // [TYPE: int]
-#define KEY_AwardPeaceAmbassadorLastRewardDate 51 // [TYPE: int]
-#define KEY_AwardDeadlyAccuracy 52 // [TYPE: int]
-#define KEY_AwardDeadlyAccuracyLastRewardDate 53 // [TYPE: int]
-#define KEY_AwardRemembrance 54 // [TYPE: int]
-#define KEY_AwardRemembranceLastRewardDate 55 // [TYPE: int]
-#define KEY_AwardAvenger 56 // [TYPE: int]
-#define KEY_AwardAvengerLastRewardDate 57 // [TYPE: int]
-#define KEY_AwardCherub 58 // [TYPE: int]
-#define KEY_AwardCherubLastRewardDate 59 // [TYPE: int]
-#define KEY_AwardDignity 60 // [TYPE: int]
-#define KEY_AwardDignityLastRewardDate 61 // [TYPE: int]
-#define KEY_AwardStalkerFlair 62 // [TYPE: int]
-#define KEY_AwardStalkerFlairLastRewardDate 63 // [TYPE: int]
-#define KEY_AwardLucky 64 // [TYPE: int]
-#define KEY_AwardLuckyLastRewardDate 65 // [TYPE: int]
-#define KEY_AwardBlackList 66 // [TYPE: int]
-#define KEY_AwardBlackListLastRewardDate 67 // [TYPE: int]
-#define KEY_AwardSilentDeath 68 // [TYPE: int]
-#define KEY_AwardSilentDeathLastRewardDate 69 // [TYPE: int]
-#define KEY_PlayerName 70 // [TYPE: string]
-
-///////////////////////////////////////////////////////////////////////////////
-
-// STATS
-// Use these stat ID's to query aggregate statistics for your game.
-
-#define STAT_AwardAchillesHeel 1 // [TYPE: int]
-#define STAT_AwardAchillesHeelLastRewardDate 2 // [TYPE: int]
-#define STAT_AwardAvenger 3 // [TYPE: int]
-#define STAT_AwardAvengerLastRewardDate 4 // [TYPE: int]
-#define STAT_AwardBlackList 5 // [TYPE: int]
-#define STAT_AwardBlackListLastRewardDate 6 // [TYPE: int]
-#define STAT_AwardBlitzkrieg 7 // [TYPE: int]
-#define STAT_AwardBlitzkriegLastRewardDate 8 // [TYPE: int]
-#define STAT_AwardCherub 9 // [TYPE: int]
-#define STAT_AwardCherubLastRewardDate 10 // [TYPE: int]
-#define STAT_AwardClimber 11 // [TYPE: int]
-#define STAT_AwardClimberLastRewardDate 12 // [TYPE: int]
-#define STAT_AwardDeadlyAccuracy 13 // [TYPE: int]
-#define STAT_AwardDeadlyAccuracyLastRewardDate 14 // [TYPE: int]
-#define STAT_AwardDignity 15 // [TYPE: int]
-#define STAT_AwardDignityLastRewardDate 16 // [TYPE: int]
-#define STAT_AwardDoubleShotDoubleKill 17 // [TYPE: int]
-#define STAT_AwardDoubleShotDoubleKillLastRewardDate 18 // [TYPE: int]
-#define STAT_AwardDryVictory 19 // [TYPE: int]
-#define STAT_AwardDryVictoryLastRewardDate 20 // [TYPE: int]
-#define STAT_AwardFasterThanBullets 21 // [TYPE: int]
-#define STAT_AwardFasterThanBulletsLastRewardDate 22 // [TYPE: int]
-#define STAT_AwardHarvestTime 23 // [TYPE: int]
-#define STAT_AwardHarvestTimeLastRewardDate 24 // [TYPE: int]
-#define STAT_AwardInvincibleFury 25 // [TYPE: int]
-#define STAT_AwardInvincibleFuryLastRewardDate 26 // [TYPE: int]
-#define STAT_AwardLightingReflexes 27 // [TYPE: int]
-#define STAT_AwardLightingReflexesLastRewardDate 28 // [TYPE: int]
-#define STAT_AwardLucky 29 // [TYPE: int]
-#define STAT_AwardLuckyLastRewardDate 30 // [TYPE: int]
-#define STAT_AwardMad 31 // [TYPE: int]
-#define STAT_AwardMadLastRewardDate 32 // [TYPE: int]
-#define STAT_AwardMarksman 33 // [TYPE: int]
-#define STAT_AwardMarksmanLastRewardDate 34 // [TYPE: int]
-#define STAT_AwardMasscare 35 // [TYPE: int]
-#define STAT_AwardMasscareLastRewardDate 36 // [TYPE: int]
-#define STAT_AwardMultichampion 37 // [TYPE: int]
-#define STAT_AwardMultichampionLastRewardDate 38 // [TYPE: int]
-#define STAT_AwardOculist 39 // [TYPE: int]
-#define STAT_AwardOculistLastRewardDate 40 // [TYPE: int]
-#define STAT_AwardOpener 41 // [TYPE: int]
-#define STAT_AwardOpenerLastRewardDate 42 // [TYPE: int]
-#define STAT_AwardOwerwhelmingSuperiority 43 // [TYPE: int]
-#define STAT_AwardOwerwhelmingSuperiorityLastRewardDate 44 // [TYPE: int]
-#define STAT_AwardParanoia 45 // [TYPE: int]
-#define STAT_AwardParanoiaLastRewardDate 46 // [TYPE: int]
-#define STAT_AwardPeaceAmbassador 47 // [TYPE: int]
-#define STAT_AwardPeaceAmbassadorLastRewardDate 48 // [TYPE: int]
-#define STAT_AwardRemembrance 49 // [TYPE: int]
-#define STAT_AwardRemembranceLastRewardDate 50 // [TYPE: int]
-#define STAT_AwardSilentDeath 51 // [TYPE: int]
-#define STAT_AwardSilentDeathLastRewardDate 52 // [TYPE: int]
-#define STAT_AwardSkewer 53 // [TYPE: int]
-#define STAT_AwardSkewerLastRewardDate 54 // [TYPE: int]
-#define STAT_AwardSprinterStopper 55 // [TYPE: int]
-#define STAT_AwardSprinterStopperLastRewardDate 56 // [TYPE: int]
-#define STAT_AwardStalkerFlair 57 // [TYPE: int]
-#define STAT_AwardStalkerFlairLastRewardDate 58 // [TYPE: int]
-#define STAT_AwardToughy 59 // [TYPE: int]
-#define STAT_AwardToughyLastRewardDate 60 // [TYPE: int]
-#define STAT_BestScore_BackstabsKillsInRow 61 // [TYPE: int]
-#define STAT_BestScore_BleedKillsInRow 62 // [TYPE: int]
-#define STAT_BestScore_ExplosiveKillsInRow 63 // [TYPE: int]
-#define STAT_BestScore_EyeKillsInRow 64 // [TYPE: int]
-#define STAT_BestScore_HeadshotsKillsInRow 65 // [TYPE: int]
-#define STAT_BestScore_KillsInRow 66 // [TYPE: int]
-#define STAT_BestScore_KnifeKillsInRow 67 // [TYPE: int]
-#define STAT_PlayerName 68 // [TYPE: string] [DESC: contains players name]
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // _ATLAS_STALKERCOPPC_V1_H_
diff --git a/src/utils/mp_gpprof_server/entry_point.cpp b/src/utils/mp_gpprof_server/entry_point.cpp
deleted file mode 100644
index 87fccc15ec3..00000000000
--- a/src/utils/mp_gpprof_server/entry_point.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#include "sake_worker.h"
-#include "requests_processor.h"
-#include "profile_request.h"
-#include "profile_printer.h"
-
-char const* game_name = "stalkercoppc";
-int game_id = 2760;
-int game_product_id = 11994;
-int game_namespace_id = 1;
-
-char const* default_root_path = "/gprof";
-char const* root_path = NULL;
-
-int main(int argc, char** argv)
-{
- using namespace std;
- using namespace gamespy_profile;
-
- try
- {
-#ifdef WIN32
- pthread_win32_process_attach_np();
-#endif
-
- /*streambuf* cin_streambuf = cin.rdbuf();
- streambuf* cout_streambuf = cout.rdbuf();
- streambuf* cerr_streambuf = cerr.rdbuf();*/
-
- FCGX_Init();
- int binded_sock = 0;
- if (argc >= 2)
- binded_sock = FCGX_OpenSocket(argv[1], 128);
- if (!binded_sock)
- {
- cerr << "failed to bind socket to address " << argv[1] << endl;
- return EXIT_FAILURE;
- }
-
- cout << "binded server to: " << argv[1] << ", value=" << binded_sock << endl;
-
- if (argc >= 3)
- root_path = argv[2];
-
- std::auto_ptr req_poll(new requests_poll());
- fetch_profile_request::request_ptr_t new_request(new FCGX_Request());
-
- FCGX_InitRequest(new_request.get(), binded_sock, 0);
-
- cout << "listening requests..." << endl;
- while (FCGX_Accept_r(new_request.get()) == 0)
- {
- req_poll->add_request(new_request);
- assert(!new_request.get());
- new_request.reset(new FCGX_Request());
- FCGX_InitRequest(new_request.get(), binded_sock, 0);
- }
-
- /*cin.rdbuf(cin_streambuf);
- cout.rdbuf(cout_streambuf);
- cerr.rdbuf(cerr_streambuf);*/
- }
- catch (const std::exception& e)
- {
- cerr << "Caught exception: " << e.what() << endl << "Type: " << typeid(e).name() << endl;
- return EXIT_FAILURE;
- }
-
- return EXIT_SUCCESS;
-};
diff --git a/src/utils/mp_gpprof_server/gamespy_sake.cpp b/src/utils/mp_gpprof_server/gamespy_sake.cpp
deleted file mode 100644
index 6d0b1e3ab16..00000000000
--- a/src/utils/mp_gpprof_server/gamespy_sake.cpp
+++ /dev/null
@@ -1,349 +0,0 @@
-#include
-#include
-#include
-#include "gamespy_sake.h"
-
-extern char const* game_name;
-extern int game_id;
-extern int game_product_id;
-extern int game_namespace_id;
-
-char const* gp_nick = "profile_printer@ua";
-char const* gp_email = "profile_printer@ua";
-char const* gp_pass = "loopzilla";
-
-typedef char secret_key_t[32];
-void fill_secret_key(secret_key_t& sc)
-{
- sc[0] = 'L';
- sc[1] = 'T';
- sc[2] = 'U';
- sc[3] = '2';
- sc[4] = 'z';
- sc[5] = '2';
- sc[6] = '\0';
-}
-
-#ifdef GSI_COMMON_DEBUG
-static void debug_callback(GSIDebugCategory theCat, GSIDebugType theType, GSIDebugLevel theLevel,
- const char* theTokenStr, va_list theParamList)
-{
- char tmp_prefix_buffer[256];
- char error_buffer[1024];
-
- // hope compiler will find specializations like: template int sprintf( char (&buffer)[size],
-
- sprintf(tmp_prefix_buffer, "GameSpy: [%s][%s] ", gGSIDebugCatStrings[theCat], gGSIDebugTypeStrings[theType]);
-
- vsprintf(error_buffer, theTokenStr, theParamList);
- std::cerr << tmp_prefix_buffer << error_buffer << std::endl;
-}
-#endif
-
-GSIACResult check_gamespy_services(void)
-{
- GSIACResult aResult;
- GSIStartAvailableCheck(game_name);
- // Continue processing while the check is in progress
- do
- {
- aResult = GSIAvailableCheckThink();
- msleep(10);
- } while (aResult == GSIACWaiting);
-
- // Check the result
- switch (aResult)
- {
- case GSIACAvailable: break;
- case GSIACUnavailable:
- std::cerr << "GameSpy: Online services are unavailable\r\n"
- << "GameSpy: Please visit www.mygame.com for more information.\r\n";
- break;
- case GSIACTemporarilyUnavailable:
- std::cerr << "GameSpy: Online services are temporarily unavailable.\r\n"
- << "GameSpy: Please visit www.mygame.com for more information.\r\n";
- break;
- default: break;
- };
- return aResult;
-}
-
-sake_processor::core_initializer::core_initializer()
-{
- if (check_gamespy_services() != GSIACAvailable)
- throw std::runtime_error("GameSpy services are unavailable");
-
-#ifdef GSI_COMMON_DEBUG
- gsSetDebugCallback(debug_callback);
- gsSetDebugLevel(GSIDebugCat_All, GSIDebugType_All, GSIDebugLevel_Hardcore);
-#endif
- gsCoreInitialize();
-}
-sake_processor::core_initializer::~core_initializer() { gsCoreShutdown(); }
-sake_processor::gp_processor::gp_processor() : m_connection(NULL)
-{
- memset(&m_login_ticket, 0, sizeof(m_login_ticket));
- GPResult tmp_res = gpInitialize(&m_connection, game_product_id, game_namespace_id, GP_PARTNERID_GAMESPY);
- m_complete = false;
- if (tmp_res != GP_NO_ERROR)
- {
- std::cerr << "GameSpy: GP initialization failed, errcode: " << tmp_res << std::endl;
- throw std::runtime_error("GameSpy GP initialization failed");
- }
-}
-
-bool sake_processor::gp_processor::login()
-{
- assert(m_connection);
- GPResult tmp_res = gpConnect(
- &m_connection, gp_nick, gp_email, gp_pass, GP_NO_FIREWALL, GP_BLOCKING, &gp_processor::login_result_cb, this);
-
- if (tmp_res != GP_NO_ERROR)
- return false;
-
- return true;
-}
-
-void sake_processor::gp_processor::login_result_cb(GPConnection* connection, void* arg, void* param)
-{
- gp_processor* me = static_cast(param);
- GPConnectResponseArg* tmp_rarg = static_cast(arg);
- me->m_complete = true;
-
- assert(tmp_rarg);
- if (tmp_rarg->result != GP_NO_ERROR)
- {
- std::cerr << "GameSpy: GP failed to connect, errcode: " << tmp_rarg->result << std::endl;
- return;
- }
- me->m_profile_id = tmp_rarg->profile;
- gpGetLoginTicket(&me->m_connection, me->m_login_ticket);
-}
-
-sake_processor::gp_processor::~gp_processor() { gpDestroy(&m_connection); }
-sake_processor::sake_processor()
-{
- static bool already_initialized = false;
- assert(!already_initialized && "sake_processor instance must be single (please implement singleton)");
- // setup the common debugging
- already_initialized = true;
-
- if (!m_gp_processor.login())
- {
- std::cerr << "GameSpy: GP failed to login" << std::endl;
- throw std::runtime_error(std::string("failed to login with GameSpy GP"));
- }
-
- if (sakeStartup(&m_sake_inst) != SAKEStartupResult_SUCCESS)
- {
- std::cerr << "GameSpy: failed to initialize SAKE" << std::endl;
- throw std::runtime_error(std::string("failed to initialize GameSpy SAKE"));
- }
- secret_key_t tmp_sc;
- memset(tmp_sc, 0, sizeof(secret_key_t));
- fill_secret_key(tmp_sc);
-
- sakeSetGame(m_sake_inst, game_name, game_id, tmp_sc);
- sakeSetProfile(m_sake_inst, m_gp_processor.m_profile_id, m_gp_processor.m_login_ticket);
-
- init_request_fields();
- m_processing_request = false;
-}
-
-void sake_processor::think(gsi_time ms) { gsCoreThink(ms); }
-sake_processor::~sake_processor() { sakeShutdown(m_sake_inst); }
-void sake_processor::begin_fetch()
-{
- m_request_names.clear();
- m_result_players.clear();
- m_current_offset = 0;
-}
-void sake_processor::add_name(char const* name)
-{
- for (player_names_t::const_iterator i = m_request_names.begin(), ie = m_request_names.end(); i != ie; ++i)
- {
- if (!strcmp(i->c_str(), name))
- return;
- }
- m_request_names.resize(m_request_names.size() + 1);
- m_request_names.back() = name;
-}
-
-bool sake_processor::get_profile(char const* name, gamespy_profile::profile_data& dest_data)
-{
- assert(!m_processing_request);
- m_tmp_string = name;
- players_map_t::iterator tmp_iter = m_result_players.find(m_tmp_string);
- if (tmp_iter != m_result_players.end())
- {
- dest_data = tmp_iter->second;
- return true;
- }
- return false;
-}
-
-bool security_treat(std::string const& name) { return (std::find(name.begin(), name.end(), '\'') != name.end()); }
-bool sake_processor::create_request_string()
-{
- m_tmp_string = "";
- m_request_names.erase(
- std::remove_if(m_request_names.begin(), m_request_names.end(), security_treat), m_request_names.end());
-
- player_names_t::const_iterator i = m_request_names.begin();
- player_names_t::const_iterator ie = m_request_names.end();
- if (i == ie)
- return false;
- do
- {
- m_tmp_string.append("(STAT_PlayerName='");
- m_tmp_string.append(*i);
- ++i;
- if (i == ie)
- {
- m_tmp_string.append("')");
- break;
- }
- else
- {
- m_tmp_string.append("')or");
- }
- } while (1);
- return true;
-}
-
-void sake_processor::fetch()
-{
- memset(&m_get_records_input, 0, sizeof(m_get_records_input));
- m_get_records_input.mTableId = gamespy_profile::profile_table_name;
- m_get_records_input.mFieldNames = m_field_names_store;
- m_get_records_input.mNumFields = merged_fields_count;
- m_get_records_input.mCacheFlag = gsi_true;
- if (!create_request_string())
- return;
-
- m_get_records_input.mFilter = &*m_tmp_string.begin();
- m_get_records_input.mOffset = m_current_offset;
- m_get_records_input.mMaxRecords = max_request_records;
-
- SAKERequest tmp_request =
- sakeSearchForRecords(m_sake_inst, &m_get_records_input, &sake_processor::request_callback, this);
- m_processing_request = true;
-
- if (!tmp_request)
- {
- SAKEStartRequestResult tmp_result = sakeGetStartRequestResult(m_sake_inst);
- std::cerr << "GameSpy: SAKE request failed, errcode: " << tmp_result << std::endl;
- request_callback(m_sake_inst, tmp_request, SAKERequestResult_UNKNOWN_ERROR, NULL, NULL, this);
- }
-}
-
-bool sake_processor::is_result_ready() const { return (m_processing_request == false); }
-void sake_processor::init_request_fields()
-{
- using namespace gamespy_profile;
- int ci = 0;
- for (int i = 0; i < bst_score_types_count; ++i)
- {
- m_field_names_store[ci] = ATLAS_GET_STAT_NAME(get_best_score_id_stat(static_cast(i)));
- ++ci;
- }
- for (int i = 0; i < at_awards_count; ++i)
- {
- int findex = i * ap_award_params_count;
- m_field_names_store[ci + ap_award_id] = ATLAS_GET_STAT_NAME(get_award_id_stat(static_cast(i)));
- m_field_names_store[ci + ap_award_rdate] =
- ATLAS_GET_STAT_NAME(get_award_reward_date_stat(static_cast(i)));
- ci += ap_award_params_count;
- }
- m_field_names_store[ci] = ATLAS_GET_STAT_NAME(STAT_PlayerName);
-}
-
-bool sake_processor::process_record(
- SAKESearchForRecordsInput* in, SAKEField* fields, gamespy_profile::profile_data& dest_data, std::string& dest_name)
-{
- using namespace gamespy_profile;
- int last_fi = 0;
- dest_name.clear();
- for (int i = 0; i < in->mNumFields; ++i, ++last_fi)
- {
- if (strcmp(fields[last_fi].mName, in->mFieldNames[i]))
- {
- bool found = false;
- last_fi = 0;
- do
- {
- if (!strcmp(fields[last_fi].mName, in->mFieldNames[i]))
- {
- found = true;
- break;
- }
- ++last_fi;
- } while (last_fi < in->mNumFields);
- if (!found)
- {
- last_fi = 0;
- continue;
- }
- }
- enum_awards_t tmp_award_id = get_award_by_stat_id_name(fields[last_fi].mName);
- if (tmp_award_id < at_awards_count)
- {
- dest_data.m_awards[tmp_award_id].m_count = fields[last_fi].mValue.mShort;
- continue;
- }
- tmp_award_id = get_award_by_stat_rdate_name(fields[last_fi].mName);
- if (tmp_award_id < at_awards_count)
- {
- dest_data.m_awards[tmp_award_id].m_last_reward_date = fields[last_fi].mValue.mInt;
- continue;
- }
- enum_best_score_type tmp_best_score_id = get_best_score_type_by_sname(fields[last_fi].mName);
- if (tmp_best_score_id < bst_score_types_count)
- {
- dest_data.m_best_scores[tmp_best_score_id] = fields[last_fi].mValue.mInt;
- continue;
- }
- if (strcmp(fields[last_fi].mName, ATLAS_GET_KEY_NAME(STAT_PlayerName)))
- {
- if (strlen(fields[last_fi].mValue.mAsciiString))
- {
- dest_name = fields[last_fi].mValue.mAsciiString;
- }
- }
- }
- return !dest_name.empty();
-}
-
-void sake_processor::process_out_request(SAKESearchForRecordsInput* in, SAKESearchForRecordsOutput* out)
-{
- using namespace gamespy_profile;
- for (int ri = 0; ri < out->mNumRecords; ++ri)
- {
- profile_data tmp_data;
- if (process_record(in, out->mRecords[ri], tmp_data, m_tmp_string))
- {
- m_result_players.insert(std::make_pair(m_tmp_string, tmp_data));
- m_tmp_string.clear();
- }
- }
-}
-
-void sake_processor::request_callback(
- SAKE sake, SAKERequest request, SAKERequestResult result, void* inputData, void* outputData, void* userData)
-{
- sake_processor* me = static_cast(userData);
- SAKESearchForRecordsInput* tmp_in = static_cast(inputData);
- SAKESearchForRecordsOutput* tmp_out = static_cast(outputData);
- if (tmp_out)
- {
- me->process_out_request(tmp_in, tmp_out);
- me->m_current_offset += tmp_out->mNumRecords;
- if ((tmp_out->mNumRecords == max_request_records) &&
- (static_cast(me->m_current_offset) < me->m_request_names.size()))
- {
- me->fetch();
- return;
- }
- }
- me->m_processing_request = false;
-}
diff --git a/src/utils/mp_gpprof_server/gamespy_sake.h b/src/utils/mp_gpprof_server/gamespy_sake.h
deleted file mode 100644
index 14b0f524411..00000000000
--- a/src/utils/mp_gpprof_server/gamespy_sake.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef GAMESPY_SAKE_INCLUDED
-#define GAMESPY_SAKE_INCLUDED
-
-#include
-#include
-#include